@http-forge/core 0.6.2-2.beta.2 → 0.6.2-2.beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +76 -76
- package/dist/index.mjs +76 -76
- package/dist/infrastructure/script/script-executor.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var a2=Object.create;var Kh=Object.defineProperty;var l2=Object.getOwnPropertyDescriptor;var u2=Object.getOwnPropertyNames;var c2=Object.getPrototypeOf,f2=Object.prototype.hasOwnProperty;var ae=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var V=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Rs=(t,e)=>{for(var r in e)Kh(t,r,{get:e[r],enumerable:!0})},gq=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of u2(e))!f2.call(t,i)&&i!==r&&Kh(t,i,{get:()=>e[i],enumerable:!(n=l2(e,i))||n.enumerable});return t};var ve=(t,e,r)=>(r=t!=null?a2(c2(t)):{},gq(e||!t||!t.__esModule?Kh(r,"default",{value:t,enumerable:!0}):r,t)),Oa=t=>gq(Kh({},"__esModule",{value:!0}),t);function Ht(t){return t.replace(/[^a-zA-Z0-9-_]/g,"_").replace(/\s+/g,"-").toLowerCase().substring(0,100)}function Ot(t){let e=Date.now().toString(36)+(d2++).toString(36)+Math.random().toString(36).slice(2,7);return t?`${Ht(t)}_${e}`:e}function Qh(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function gu(t,e){let r={},n={};for(let[i,s]of Object.entries(t)){let o=i.toLowerCase();n[o]=i,r[i]=s}for(let[i,s]of Object.entries(e)){let o=i.toLowerCase(),l=n[o];l&&delete r[l],n[o]=i,r[i]=s}return r}function yq(t){return JSON.parse(JSON.stringify(t))}function vq(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function bq(t,e){try{return JSON.parse(t)}catch{return e}}function Sq(t){if(t===0)return"0 B";let e=1024,r=["B","KB","MB","GB"],n=Math.floor(Math.log(t)/Math.log(e));return`${parseFloat((t/Math.pow(e,n)).toFixed(1))} ${r[n]}`}function wq(t){return t<1e3?`${t} ms`:`${(t/1e3).toFixed(2)} s`}var d2,Un=ae(()=>{"use strict";d2=0});function qf(t){if(!mt.existsSync(t))return;let e={},r=wn.join(t,Ef.preRequest);mt.existsSync(r)&&(e.preRequest=mt.readFileSync(r,"utf-8"));let n=wn.join(t,Ef.postResponse);return mt.existsSync(n)&&(e.postResponse=mt.readFileSync(n,"utf-8")),Object.keys(e).length>0?e:void 0}async function Of(t,e){await mt.promises.mkdir(t,{recursive:!0});let r=wn.join(t,Ef.preRequest);e.preRequest?await mt.promises.writeFile(r,e.preRequest,"utf-8"):mt.existsSync(r)&&await mt.promises.unlink(r);let n=wn.join(t,Ef.postResponse);e.postResponse?await mt.promises.writeFile(n,e.postResponse,"utf-8"):mt.existsSync(n)&&await mt.promises.unlink(n)}function VS(t){for(let[e,r]of Object.entries(BS)){let n=wn.join(t,e);if(mt.existsSync(n))try{let i=mt.readFileSync(n,"utf-8"),s;if(r.type==="graphql")try{s=JSON.parse(i)}catch{s=i}else s=i;return{type:r.type,format:r.format,content:s}}catch(i){console.error(`[FolderIO] Failed to load body from ${n}:`,i)}}}function WS(t){if(!t||t.type==="none")return{bodyForMetadata:t};if(t.type==="raw"){let e=t.format||"json",n={json:"body.json",xml:"body.xml",text:"body.txt",html:"body.html",javascript:"body.js"}[e];if(n){let i=e==="json"?typeof t.content=="string"?t.content:JSON.stringify(t.content,null,2):String(t.content||"");return{bodyForMetadata:{type:t.type,format:t.format},externalBodyFile:{filename:n,content:i}}}}if(t.type==="graphql"){let e=typeof t.content=="string"?t.content:JSON.stringify(t.content,null,2);return{bodyForMetadata:{type:t.type},externalBodyFile:{filename:"body.graphql",content:e}}}return{bodyForMetadata:t}}async function zS(t,e){for(let r of Object.keys(BS))if(r!==e){let n=wn.join(t,r);if(mt.existsSync(n))try{await mt.promises.unlink(n)}catch{}}}function JS(t){if(mt.existsSync(t))try{let e=mt.readFileSync(t,"utf-8");return JSON.parse(e)}catch(e){console.error(`[FolderIO] Failed to load schema file ${t}:`,e);return}}async function GS(t,e,r){let n=wn.join(t,yu.responseSchema),i=wn.join(t,yu.bodySchema);e?await mt.promises.writeFile(n,JSON.stringify(e,null,2),"utf-8"):mt.existsSync(n)&&await mt.promises.unlink(n),r?await mt.promises.writeFile(i,JSON.stringify(r,null,2),"utf-8"):mt.existsSync(i)&&await mt.promises.unlink(i)}function Zh(t,e){for(let r of t){if(r.id===e)return r;if(r.type==="folder"&&r.items){let n=Zh(r.items,e);if(n)return n}}}function Xh(t,e){for(let r=0;r<t.length;r++){let n=t[r];if(n.id===e)return t.splice(r,1),!0;if(n.type==="folder"&&n.items&&Xh(n.items,e))return!0}return!1}function YS(t,e){let r=new Map(t.map(i=>[i.id,i])),n=[];for(let i of e){let s=r.get(i);s&&(n.push(s),r.delete(i))}for(let i of r.values())n.push(i);return n}function em(t,e){let r;try{r=mt.readdirSync(t,{withFileTypes:!0})}catch{return}for(let n of r){if(!n.isDirectory()||n.name===en)continue;if(n.name===e)return wn.join(t,n.name);let i=em(wn.join(t,n.name),e);if(i)return i}}function p2(t){for(let e of[Rr.request,Rr.folder]){let r=wn.join(t,e);if(mt.existsSync(r))try{let n=mt.readFileSync(r,"utf-8");return JSON.parse(n).id}catch{return}}}function tm(t,e){let r;try{r=mt.readdirSync(t,{withFileTypes:!0})}catch{return}for(let n of r){if(!n.isDirectory()||n.name===en)continue;let i=wn.join(t,n.name);if(p2(i)===e)return i;let s=tm(i,e);if(s)return s}}function _n(t,e=[]){let r=t.toLowerCase().trim(),n=r.match(/^(get|post|put|patch|delete|head|options)[_\s-]/i),i=n?n[1]:"",s=r.match(/t(\d+)/gi)||[],o=0;for(let y of s){let b=parseInt(y.substring(1));b>o&&(o=b)}let l="";if(o>0)l=`t${o}`;else{let y=r.match(/[_\s-](\d+\.\d+)[_\s-]/);y&&(l=`v${y[1].replace(".","_")}`)}let c=r;n&&(c=c.substring(n[0].length)),c=c.replace(/[_\s-]?t\d+(?:\.\d+)?[_\s-]?/gi,"-"),c=c.replace(/[_\s-]?\d+\.\d+[_\s-]?/g,"-"),c=c.replace(/\([^)]+\)/g,""),c=c.replace(/:[a-z_][a-z0-9_]*/gi,""),c=c.replace(/\{[^}]+\}/g,""),c=c.replace(/\?$/g,"").replace(/[_/\\ ]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"");let d=c.split("-").filter(y=>y.length>0),p=[];i&&p.push(i),p.push(...d),l&&p.push(l);let m=p.join("-");if(m||(m="item"),e.includes(m)){let y=2;for(;e.includes(`${m}-${y}`);)y++;m=`${m}-${y}`}return m}var mt,wn,Ef,Rr,BS,yu,en,Pa=ae(()=>{"use strict";mt=ve(require("fs")),wn=ve(require("path")),Ef={preRequest:"pre-request.js",postResponse:"post-response.js"},Rr={collection:"collection.json",folder:"folder.json",request:"request.json"},BS={"body.json":{type:"raw",format:"json"},"body.xml":{type:"raw",format:"xml"},"body.txt":{type:"raw",format:"text"},"body.html":{type:"raw",format:"html"},"body.js":{type:"raw",format:"javascript"},"body.graphql":{type:"graphql"}},yu={responseSchema:"response.schema.json",bodySchema:"body.schema.json"},en="scripts"});var Me,Le,Cs,rm=ae(()=>{"use strict";Me=ve(require("fs")),Le=ve(require("path"));Un();Pa();Cs=class{collectionsDir;cache=new Map;slugToIdMap=new Map;idToSlugMap=new Map;constructor(e){this.collectionsDir=e,this.ensureDirectory()}getSlugById(e){return this.idToSlugMap.get(e)}getIdBySlug(e){return this.slugToIdMap.get(e)}ensureDirectory(){Me.existsSync(this.collectionsDir)||Me.mkdirSync(this.collectionsDir,{recursive:!0})}readJsonFileSafe(e,r){let n;try{n=Me.readFileSync(e,"utf-8")}catch(i){console.error(`[FolderCollectionStore] Failed to read ${r} ${e}:`,i);return}if(n.trim().length!==0)try{return JSON.parse(n)}catch(i){if(i instanceof SyntaxError&&/Unexpected end of JSON input/.test(i.message))return;console.error(`[FolderCollectionStore] Failed to parse ${r} ${e}:`,i);return}}loadAll(){if(this.cache.clear(),this.slugToIdMap.clear(),this.idToSlugMap.clear(),!Me.existsSync(this.collectionsDir))return[];let e=Me.readdirSync(this.collectionsDir,{withFileTypes:!0}),r=[];for(let n of e)if(n.isDirectory())try{let i=this.loadCollectionFromFolder(n.name);i&&(this.cache.set(i.id,i),this.slugToIdMap.set(n.name,i.id),this.idToSlugMap.set(i.id,n.name),r.push(i))}catch(i){console.error(`[FolderCollectionStore] Failed to load ${n.name}:`,i)}return r}loadCollectionFromFolder(e){let r=Le.join(this.collectionsDir,e),n=Le.join(r,Rr.collection);if(!Me.existsSync(n))return;let i=this.readJsonFileSafe(n,"collection");if(i)try{let s=this.loadScriptsFromDir(Le.join(r,en)),o=this.loadItemsFromDir(r,i.id,i.order);return{id:i.id,name:i.name,description:i.description,version:i.version,variables:i.variables,auth:i.auth,scripts:s,items:o}}catch(s){console.error(`[FolderCollectionStore] Failed to parse ${n}:`,s);return}}loadItemsFromDir(e,r,n){let i=[],s=new Map,o=Me.readdirSync(e,{withFileTypes:!0});for(let l of o){if(!l.isDirectory()||l.name===en)continue;let c=Le.join(e,l.name);if(Me.existsSync(Le.join(c,Rr.folder))){let d=this.loadFolderFromDir(c,l.name);d&&s.set(l.name,d)}else if(Me.existsSync(Le.join(c,Rr.request))){let d=this.loadRequestFromDir(c,l.name);d&&s.set(l.name,d)}}if(n&&n.length>0){for(let l of n){let c=s.get(l);c&&(i.push(c),s.delete(l))}for(let l of s.values())i.push(l)}else for(let l of s.values())i.push(l);return i}loadFolderFromDir(e,r){let n=Le.join(e,Rr.folder),i=this.readJsonFileSafe(n,"folder");if(i)try{let s=this.loadScriptsFromDir(Le.join(e,en)),o=this.loadItemsFromDir(e,i.id,i.order);return this.slugToIdMap.set(r,i.id),this.idToSlugMap.set(i.id,r),{id:i.id,type:"folder",name:i.name,description:i.description,auth:i.auth,scripts:s,items:o}}catch(s){console.error(`[FolderCollectionStore] Failed to load folder ${e}:`,s);return}}loadRequestFromDir(e,r){let n=Le.join(e,Rr.request),i=this.readJsonFileSafe(n,"request");if(i)try{let s=this.loadScriptsFromDir(Le.join(e,en)),o=i.body,l=this.loadBodyFromDir(e);l&&(o=l);let c=this.loadSchemaFile(Le.join(e,yu.responseSchema)),d=this.loadSchemaFile(Le.join(e,yu.bodySchema)),p=Le.join(e,"doc.md"),m=Me.existsSync(p)?Me.readFileSync(p,"utf-8"):void 0;return this.slugToIdMap.set(r,i.id),this.idToSlugMap.set(i.id,r),{id:i.id,type:"request",name:i.name,description:i.description,method:i.method,url:i.url,params:i.params,query:i.query,headers:i.headers,body:o,bodyContentType:i.bodyContentType,auth:i.auth,settings:i.settings,scripts:s,disabled:i.disabled,deprecated:i.deprecated,operationId:i.operationId,summary:i.summary,tags:i.tags,examples:i.examples,responses:i.responses,security:i.security,...m&&{doc:m},...c&&{responseSchema:c},...d&&{bodySchema:d}}}catch(s){console.error(`[FolderCollectionStore] Failed to load request ${e}:`,s);return}}loadScriptsFromDir(e){return qf(e)}loadBodyFromDir(e){return VS(e)}loadSchemaFile(e){return JS(e)}async saveSchemaFiles(e,r){return GS(e,r.responseSchema,r.bodySchema)}load(e){if(this.cache.has(e))return this.cache.get(e);let r=this.idToSlugMap.get(e);if(r){let n=this.loadCollectionFromFolder(r);return n&&this.cache.set(e,n),n}return this.loadAll(),this.cache.get(e)}async save(e){if(this.ensureDirectory(),!e.name)throw new Error("Collection name is required");e.id||(e.id=Ot(e.name));let r=this.idToSlugMap.get(e.id);if(!r){let l=Me.readdirSync(this.collectionsDir);r=_n(e.name,l),this.idToSlugMap.set(e.id,r),this.slugToIdMap.set(r,e.id)}let n=Le.join(this.collectionsDir,r),i=!Me.existsSync(n);await Me.promises.mkdir(n,{recursive:!0});let s={id:e.id,name:e.name,description:e.description,version:e.version,variables:e.variables,auth:e.auth},[o]=await Promise.all([this.saveItemsToDir(n,e.items,i),e.scripts?this.saveScriptsToDir(Le.join(n,en),e.scripts):Promise.resolve()]);o.length>0&&(s.order=o),await Me.promises.writeFile(Le.join(n,Rr.collection),JSON.stringify(s,null,2),"utf-8"),this.cache.set(e.id,e)}async saveItemsToDir(e,r,n=!1){let i=[],s=[];for(let o of r){let l=this.idToSlugMap.get(o.id);l||(l=_n(o.name,i),this.idToSlugMap.set(o.id,l),this.slugToIdMap.set(l,o.id)),i.push(l),s.push({item:o,slug:l})}return await Promise.all(s.map(async({item:o,slug:l})=>{let c=Le.join(e,l);await Me.promises.mkdir(c,{recursive:!0}),o.type==="folder"?await this.saveFolderToDir(c,o,n):await this.saveRequestToDir(c,o,n)})),i}async saveFolderToDir(e,r,n=!1){let i={id:r.id,name:r.name,description:r.description,auth:r.auth},[s]=await Promise.all([r.items?this.saveItemsToDir(e,r.items,n):Promise.resolve([]),r.scripts?this.saveScriptsToDir(Le.join(e,en),r.scripts):Promise.resolve()]);s.length>0&&(i.order=s),await Me.promises.writeFile(Le.join(e,Rr.folder),JSON.stringify(i,null,2),"utf-8")}async saveRequestToDir(e,r,n=!1){let{bodyForMetadata:i,externalBodyFile:s}=this.prepareBodyForSave(r.body),o={id:r.id,name:r.name,method:r.method||"GET",url:r.url||"",description:r.description,params:r.params,query:r.query,headers:r.headers,body:i,bodyContentType:r.bodyContentType,auth:r.auth,settings:r.settings,...r.disabled!==void 0&&{disabled:r.disabled},...r.deprecated&&{deprecated:r.deprecated},...r.operationId&&{operationId:r.operationId},...r.summary&&{summary:r.summary},...r.tags&&r.tags.length>0&&{tags:r.tags},...r.examples&&r.examples.length>0&&{examples:r.examples},...r.responses&&Object.keys(r.responses).length>0&&{responses:r.responses},...r.security&&r.security.length>0&&{security:r.security}},l=[Me.promises.writeFile(Le.join(e,Rr.request),JSON.stringify(o,null,2),"utf-8")];s&&l.push(Me.promises.writeFile(Le.join(e,s.filename),s.content,"utf-8")),n||l.push(this.cleanupOldBodyFiles(e,s?.filename)),(!n||r.responseSchema||r.bodySchema)&&l.push(this.saveSchemaFiles(e,r)),r.doc&&l.push(Me.promises.writeFile(Le.join(e,"doc.md"),r.doc,"utf-8")),r.scripts&&l.push(this.saveScriptsToDir(Le.join(e,en),r.scripts)),await Promise.all(l)}prepareBodyForSave(e){return WS(e)}async cleanupOldBodyFiles(e,r){return zS(e,r)}async saveScriptsToDir(e,r){return Of(e,r)}async delete(e){let r=this.idToSlugMap.get(e);if(!r&&(this.loadAll(),r=this.idToSlugMap.get(e),!r))return!1;let n=Le.join(this.collectionsDir,r);if(!Me.existsSync(n))return!1;try{return await Me.promises.rm(n,{recursive:!0,force:!0}),this.cache.delete(e),this.idToSlugMap.delete(e),this.slugToIdMap.delete(r),!0}catch(i){return console.error(`[FolderCollectionStore] Failed to delete collection ${e}:`,i),!1}}exists(e){let r=this.idToSlugMap.get(e);return r?Me.existsSync(Le.join(this.collectionsDir,r,Rr.collection)):!1}getCollectionPath(e){let r=this.idToSlugMap.get(e)||e;return Le.join(this.collectionsDir,r)}getItemPath(e,r){return this.findItemPath(e,r)}async create(e,r){let n={id:r||Ot(e),name:e,items:[]};return await this.save(n),n}async saveScripts(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.findItemPath(e,r);if(!s)throw new Error(`Item ${r} not found in collection ${e}`);await this.saveScriptsToDir(Le.join(s,en),n);let o=this.findItemById(i.items,r);o&&(o.scripts=n)}loadScripts(e,r){let n=this.findItemPath(e,r);if(n)return this.loadScriptsFromDir(Le.join(n,en))}async updateCollectionMetadata(e,r){let n=this.load(e);if(!n)throw new Error(`Collection ${e} not found`);let i=this.idToSlugMap.get(e);if(!i)throw new Error(`Collection slug not found for ${e}`);let s=Le.join(this.collectionsDir,i),o=Le.join(s,Rr.collection),l=Me.readFileSync(o,"utf-8"),d={...JSON.parse(l),...r,id:e};await Me.promises.writeFile(o,JSON.stringify(d,null,2),"utf-8"),r.name!==void 0&&(n.name=r.name),r.description!==void 0&&(n.description=r.description),r.version!==void 0&&(n.version=r.version),r.variables!==void 0&&(n.variables=r.variables),r.auth!==void 0&&(n.auth=r.auth)}async saveItem(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.idToSlugMap.get(e);if(!s)throw new Error(`Collection slug not found for ${e}`);let o;if(n){let p=this.findItemPath(e,n);if(!p)throw new Error(`Parent folder ${n} not found`);o=p}else o=Le.join(this.collectionsDir,s);let l=this.idToSlugMap.get(r.id);if(!l){let p=Me.readdirSync(o).filter(m=>Me.statSync(Le.join(o,m)).isDirectory()&&m!==en);l=_n(r.name,p),this.idToSlugMap.set(r.id,l),this.slugToIdMap.set(l,r.id)}let c=Le.join(o,l);await Me.promises.mkdir(c,{recursive:!0}),r.type==="folder"?await this.saveFolderToDir(c,r):await this.saveRequestToDir(c,r);let d=this.findItemById(i.items,r.id);if(d)Object.assign(d,r);else if(n){let p=this.findItemById(i.items,n);p&&p.type==="folder"&&(p.items=p.items||[],p.items.push(r))}else i.items.push(r)}async deleteItem(e,r){let n=this.load(e);if(!n)return!1;let i=this.findItemPath(e,r);if(!i||!Me.existsSync(i))return!1;try{await Me.promises.rm(i,{recursive:!0,force:!0}),this.deleteItemFromTree(n.items,r);let s=this.idToSlugMap.get(r);return s&&(this.slugToIdMap.delete(s),this.idToSlugMap.delete(r)),!0}catch(s){return console.error(`[FolderCollectionStore] Failed to delete item ${r}:`,s),!1}}async updateItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.findItemPath(e,r);if(!s)return!1;let o=this.findItemById(i.items,r);if(!o)return!1;let{id:l,type:c,items:d,...p}=n;return Object.assign(o,p),o.type==="folder"?await this.saveFolderToDir(s,o):await this.saveRequestToDir(s,o),!0}async moveItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.idToSlugMap.get(e);if(!s)return!1;let o=this.findItemPath(e,r);if(!o||!Me.existsSync(o))return!1;let l;if(n){let p=this.findItemPath(e,n);if(!p)return!1;l=p}else l=Le.join(this.collectionsDir,s);let c=this.idToSlugMap.get(r);if(!c)return!1;let d=Le.join(l,c);if(Me.existsSync(d))return!1;try{await Me.promises.rename(o,d);let p=this.findItemById(i.items,r);if(p){let m=p.type==="folder"?{...p,items:p.items?[...p.items]:[]}:{...p};if(this.deleteItemFromTree(i.items,r),n){let y=this.findItemById(i.items,n);y&&y.type==="folder"&&(y.items=y.items||[],y.items.push(m))}else i.items.push(m)}return!0}catch(p){return console.error(`[FolderCollectionStore] Failed to move item ${r}:`,p),!1}}async reorderItems(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.idToSlugMap.get(e);if(!s)return!1;let o=[];for(let l of n){let c=this.idToSlugMap.get(l);c&&o.push(c)}try{if(r){let l=this.findItemPath(e,r);if(!l)return!1;let c=Le.join(l,Rr.folder),d=Me.readFileSync(c,"utf-8"),p=JSON.parse(d);p.order=o,await Me.promises.writeFile(c,JSON.stringify(p,null,2),"utf-8");let m=this.findItemById(i.items,r);m&&m.type==="folder"&&m.items&&(m.items=this.sortItemsByOrder(m.items,n))}else{let l=Le.join(this.collectionsDir,s,Rr.collection),c=Me.readFileSync(l,"utf-8"),d=JSON.parse(c);d.order=o,await Me.promises.writeFile(l,JSON.stringify(d,null,2),"utf-8"),i.items=this.sortItemsByOrder(i.items,n)}return!0}catch(l){return console.error("[FolderCollectionStore] Failed to reorder items:",l),!1}}sortItemsByOrder(e,r){return YS(e,r)}findItemPath(e,r){let n=this.idToSlugMap.get(e);if(!n)return;let i=Le.join(this.collectionsDir,n),s=tm(i,r);if(s)return s;let o=this.load(e);if(o){let c=this.buildSlugPath(o.items,r);if(c)return Le.join(i,...c)}let l=this.idToSlugMap.get(r);if(l)return em(i,l)}buildSlugPath(e,r){for(let n of e){let i=this.idToSlugMap.get(n.id);if(i){if(n.id===r)return[i];if(n.type==="folder"&&n.items){let s=this.buildSlugPath(n.items,r);if(s)return[i,...s]}}}}findItemById(e,r){return Zh(e,r)}deleteItemFromTree(e,r){return Xh(e,r)}}});var Rt,ka=ae(()=>{"use strict";Rt=class{static parseSetCookie(e,r){let n=e.split(";").map(p=>p.trim());if(n.length===0)return null;let[i,...s]=n,o=i.indexOf("=");if(o===-1)return null;let l=i.substring(0,o).trim(),c=i.substring(o+1).trim(),d={name:l,value:c,domain:r};for(let p of s){let m=p.indexOf("="),y=(m===-1?p:p.substring(0,m)).toLowerCase(),b=m===-1?"":p.substring(m+1);switch(y){case"domain":d.domain=b.startsWith(".")?b.substring(1):b;break;case"path":d.path=b;break;case"expires":d.expires=b;break;case"max-age":d.maxAge=parseInt(b,10);break;case"httponly":d.httpOnly=!0;break;case"secure":d.secure=!0;break;case"samesite":d.sameSite=b;break}}return d}static parseCookieHeaders(e,r){let n=[],i=e["set-cookie"]||e["Set-Cookie"];if(!i)return n;let s=Array.isArray(i)?i:[i];for(let o of s){let l=this.parseSetCookie(o,r);l&&n.push(l)}return n}static formatCookieHeader(e){return e.map(r=>`${r.name}=${r.value}`).join("; ")}static isExpired(e){return!!(e.expires&&new Date(e.expires).getTime()<Date.now()||e.maxAge!==void 0&&e.maxAge<=0)}static domainMatches(e,r){if(r==="*")return!0;let n=e.toLowerCase().split(".").reverse(),i=r.toLowerCase().split(".").reverse();if(i.length>n.length)return!1;for(let s=0;s<i.length;s++)if(i[s]!==n[s])return!1;return!0}static extractDomain(e){try{return new URL(e).hostname}catch{return""}}static extractPath(e){try{return new URL(e).pathname}catch{return"/"}}}});function If(t){let e=t.toLowerCase();return e==="_global.json"||e==="_global.local.json"||e.endsWith(".local.json")}function wu(t){if(!ho.existsSync(t))return m2();let e=nm(Aa.join(t,"_global.json"))||{},r=e.variables||{},n=e.defaultHeaders||{},i=ho.readdirSync(t).filter(d=>d.endsWith(".json")).filter(d=>!d.endsWith(".local.json")).filter(d=>!If(d)),s={};for(let d of i){let p=nm(Aa.join(t,d))||{},m=Aa.basename(d,".json");s[m]={description:p.description,requiresConfirmation:p.requiresConfirmation,variables:p.variables||{},secretVariables:p.secretVariables}}let l=(nm(Aa.join(t,"_global.local.json"))||{}).variables||{},c={};for(let d of Object.keys(s)){let p=Aa.join(t,`${d}.local.json`);if(ho.existsSync(p)){let m=nm(p)||{};c[d]={variables:m.variables||{}}}}return{globalVariables:r,defaultHeaders:n,environments:s,localVariables:l,localCredentials:c}}function m2(){return{globalVariables:{},defaultHeaders:{},environments:{},localVariables:{},localCredentials:{}}}function nm(t){try{if(!ho.existsSync(t))return null;let e=ho.readFileSync(t,"utf-8");return JSON.parse(e)}catch(e){return console.error(`[environment-file-loader] Failed to load JSON from ${t}:`,e),null}}var ho,Aa,im=ae(()=>{"use strict";ho=ve(require("fs")),Aa=ve(require("path"))});var Hn,_u=ae(()=>{"use strict";Hn=class{buildUrl(e,r={},n={}){let i=e;return i=this.replacePathParams(i,r),i=this.appendQueryParams(i,n),i}replacePathParams(e,r){let n="",i="",s=e,o="",l=e.indexOf("?");l!==-1&&(o=e.substring(l),s=e.substring(0,l));let c=s.match(/^(https?:\/\/)([^\/]*)(\/.*)?$/);c&&(n=c[1],i=c[2],s=c[3]||"/");let d=/:(\w+)(?:\([^)]*\))?(\?)?/g,p=s.replace(d,(m,y,b)=>{let E=r[y];return E!==void 0&&E!==""?encodeURIComponent(E):b?"":(console.warn(`[UrlBuilder] Missing required path parameter: ${y}`),m)});return p=p.replace(/([^:])\/+/g,"$1/"),p.length>1&&p.endsWith("/")&&(p=p.slice(0,-1)),`${n}${i}${p}${o}`}extractPathParams(e){let r=/:(\w+)(?:\([^)]*\))?(\?)?/g,n=[],i;for(;(i=r.exec(e))!==null;)n.push(i[1]);return[...new Set(n)]}appendQueryParams(e,r){let n=e,i={};if(e.includes("?")){let[c,d]=e.split("?");n=c,d&&new URLSearchParams(d).forEach((m,y)=>{i[y]=m})}let s={...i,...r},o=new URLSearchParams;for(let[c,d]of Object.entries(s))d!=null&&o.append(c,d);let l=o.toString();return l?`${n}?${l}`:n}}});function Rq(t,e=0){return(pr[t[e+0]]+pr[t[e+1]]+pr[t[e+2]]+pr[t[e+3]]+"-"+pr[t[e+4]]+pr[t[e+5]]+"-"+pr[t[e+6]]+pr[t[e+7]]+"-"+pr[t[e+8]]+pr[t[e+9]]+"-"+pr[t[e+10]]+pr[t[e+11]]+pr[t[e+12]]+pr[t[e+13]]+pr[t[e+14]]+pr[t[e+15]]).toLowerCase()}var pr,Cq=ae(()=>{pr=[];for(let t=0;t<256;++t)pr.push((t+256).toString(16).slice(1))});function ZS(){return crypto.getRandomValues(g2)}var g2,xq=ae(()=>{g2=new Uint8Array(16)});function y2(t,e,r){return!e&&!t&&crypto.randomUUID?crypto.randomUUID():v2(t,e,r)}function v2(t,e,r){t=t||{};let n=t.random??t.rng?.()??ZS();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[r+i]=n[i];return e}return Rq(n)}var Ru,Eq=ae(()=>{xq();Cq();Ru=y2});var XS=ae(()=>{Eq()});function b2(t=0,e=999){return Math.floor(Math.random()*(e-t+1))+t}function S2(){return Date.now()}function qq(){return Ru()}function w2(){return Ru()}function Oq(t=10){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="";for(let n=0;n<t;n++)r+=e.charAt(Math.floor(Math.random()*e.length));return r}function _2(){let t=Oq(8).toLowerCase(),e=["example.com","test.org","mail.dev","sample.net"];return`${t}@${e[Math.floor(Math.random()*e.length)]}`}function R2(){return Math.random()<.5}function C2(t=10){let e="0123456789abcdef",r="";for(let n=0;n<t;n++)r+=e.charAt(Math.floor(Math.random()*e.length));return r}function x2(){return Math.floor(Date.now()/1e3)}function E2(){return new Date().toISOString()}function q2(){return new Date().toISOString().split("T")[0]}function O2(){return new Date().toISOString().split("T")[1].split(".")[0]}function I2(){return new Date().toISOString()}function P2(t=""){return Buffer.from(String(t)).toString("base64")}function k2(t=""){return Buffer.from(String(t),"base64").toString("utf-8")}function A2(t=""){return encodeURIComponent(String(t))}function T2(t=""){return decodeURIComponent(String(t))}function $2(t){return t?t.split(",").map(e=>{let r=e.trim(),n=Number(r);return!isNaN(n)&&r!==""?n:r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'")?r.slice(1,-1):r}):[]}function Vi(t,e){let r=ew[t];return r?e&&e.length>0?r(...e):r():null}function Iq(t){return!t||typeof t!="string"?t:t.replace(/\{\{\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?\}\}/g,(e,r,n)=>{try{let i=n?$2(n):void 0,s=Vi(r,i);return s===null?e:String(s)}catch{return e}})}function mo(t,e){let r=/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,n=null,i;for(;(i=r.exec(t))!==null;){let s=i[0],o=i[1];if(!(s in e)){let l=Vi(o);l!==null&&(n||(n={...e}),n[s]=l)}}return n??e}var ew,sm=ae(()=>{"use strict";XS();ew={randomInt:b2,timestamp:S2,guid:w2,uuid:qq,randomUUID:qq,randomString:Oq,randomHexadecimal:C2,randomEmail:_2,randomBoolean:R2,isoTimestamp:I2,timestamp_s:x2,datetime:E2,date:q2,time:O2,base64Encode:P2,base64Decode:k2,urlEncode:A2,urlDecode:T2}});function go(t){let e=t.trim();return!e||/^(\$?)[a-zA-Z_][a-zA-Z0-9_]*(\([^)]*\))?$/.test(e)||/(?<!\|)\|(?!\|)/.test(e)?!1:/[+\-*/%<>=!&|?:~^()[\]{}.,`]/.test(e)}function ui(t,e={}){try{let r={...e,Math,Date,JSON,Number,String,Boolean,Array,Object,parseInt,parseFloat,isNaN,isFinite,encodeURIComponent,decodeURIComponent,encodeURI,decodeURI,undefined:void 0,null:null,true:!0,false:!1,NaN:NaN,Infinity:1/0},n=om.createContext(r);return om.runInContext(t,n,{timeout:N2,displayErrors:!1})}catch{return}}var om,N2,Pf=ae(()=>{"use strict";om=ve(require("vm")),N2=100});function M2(t){if(typeof t=="string"&&t.charCodeAt(0)===30)try{return JSON.parse(t.slice(1))}catch{return t}return t}function Cu(t){if(!t||!t.includes("|"))return null;let e=F2(t);if(e.length<2)return null;let r=e[0].trim(),n=[];for(let i=1;i<e.length;i++){let s=e[i].trim();if(!s)continue;let o=D2(s);o&&n.push(o)}return n.length===0?null:{input:r,filters:n}}function F2(t){let e=[],r="",n=0,i=!1,s=!1;for(let o=0;o<t.length;o++){let l=t[o],c=o>0?t[o-1]:"",d=o<t.length-1?t[o+1]:"";if(c==="\\"){r+=l;continue}if(l==="'"&&!s)i=!i;else if(l==='"'&&!i)s=!s;else if(l==="("&&!i&&!s)n++;else if(l===")"&&!i&&!s)n--;else if(l==="|"&&n===0&&!i&&!s){if(d==="|"){r+="||",o++;continue}e.push(r),r="";continue}r+=l}return r&&e.push(r),e}function D2(t){let e=t.indexOf("(");if(e===-1)return{name:t.trim(),args:[]};let r=t.substring(0,e).trim(),n=t.substring(e+1,t.lastIndexOf(")"));return{name:r,args:j2(n)}}function j2(t){if(!t||!t.trim())return[];let e=[],r="",n=!1,i=!1;for(let s=0;s<t.length;s++){let o=t[s];if((s>0?t[s-1]:"")==="\\"){r+=o;continue}if(o==="'"&&!i){n=!n,r+=o;continue}else if(o==='"'&&!n){i=!i,r+=o;continue}else if(o===","&&!n&&!i){e.push(r.trim()),r="";continue}r+=o}return r.trim()&&e.push(r.trim()),e}function Wt(t,e){if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);let r=Number(t);if(!isNaN(r)&&t!=="")return r;if(t==="true")return!0;if(t==="false")return!1;if(e&&t in e){let n=M2(e[t]),i=Number(n);return!isNaN(i)&&n!==""?i:n}return t}function xu(t,e,r={}){let n=t;for(let i of e)n=L2(n,i.name,i.args,r);return n}function L2(t,e,r,n){switch(e){case"upper":return String(t).toUpperCase();case"lower":return String(t).toLowerCase();case"trim":return String(t).trim();case"length":return Array.isArray(t)?t.length:String(t).length;case"substring":{let i=Wt(r[0],n),s=r[1]!==void 0?Wt(r[1],n):void 0;return String(t).substring(i<0?String(t).length+i:i,s!==void 0?s<0?String(t).length+s:s:void 0)}case"replace":{let i=r[0]!==void 0?String(Wt(r[0],n)):"",s=r[1]!==void 0?String(Wt(r[1],n)):"";return String(t).replace(new RegExp(H2(i),"g"),s)}case"split":{let i=r[0]!==void 0?String(Wt(r[0],n)):",";return String(t).split(i)}case"join":{let i=r[0]!==void 0?String(Wt(r[0],n)):",";return Array.isArray(t)?t.join(i):String(t)}case"removeQuotes":return String(t).replace(/["']/g,"");case"removeSpaces":return String(t).replace(/\s/g,"");case"format":{let i=r[0]!==void 0?String(Wt(r[0],n)):"{0}";i=i.replace("{0}",String(t));for(let s=1;s<r.length;s++){let o=Wt(r[s],n);i=i.replace(`{${s}}`,String(o))}return i}case"add":{let i=Wt(r[0],n);return Number(t)+i}case"subtract":{let i=Wt(r[0],n);return Number(t)-i}case"multiply":{let i=Wt(r[0],n);return Number(t)*i}case"abs":return Math.abs(Number(t));case"btoa":return Buffer.from(String(t)).toString("base64");case"atob":return Buffer.from(String(t),"base64").toString("utf-8");case"urlEncode":return encodeURIComponent(String(t));case"urlDecode":return decodeURIComponent(String(t));case"hash":{let i=String(r[0]!==void 0?Wt(r[0],n):"md5").toLowerCase(),s=String(r[1]!==void 0?Wt(r[1],n):"base64"),l={md5:"md5",sha1:"sha1",sha256:"sha256",sha512:"sha512"}[i]||"md5";return am.createHash(l).update(String(t)).digest(s)}case"hmac":{let i=r[0]?String(Wt(r[0],n)):"",s=String(r[1]!==void 0?Wt(r[1],n):"sha256").toLowerCase(),o=String(r[2]!==void 0?Wt(r[2],n):"base64"),c={md5:"md5",sha1:"sha1",sha256:"sha256",sha512:"sha512"}[s]||"sha256";return am.createHmac(c,i).update(String(t)).digest(o)}case"first":return Array.isArray(t)?t[0]:t;case"last":return Array.isArray(t)?t[t.length-1]:t;case"at":{let i=Wt(r[0],n);return Array.isArray(t)?t.at(i):t}case"slice":{let i=Wt(r[0],n),s=r[1]!==void 0?Wt(r[1],n):void 0;return Array.isArray(t)?t.slice(i,s):String(t).slice(i,s)}case"unique":return Array.isArray(t)?[...new Set(t)]:t;case"filter":return!Array.isArray(t)||!r[0]?t:U2(t,r[0],n);case"map":{if(!Array.isArray(t))return t;let i=r.map(s=>String(Wt(s,n)));return i.length===1?t.map(s=>kf(s,i[0])):t.map(s=>{let o={};for(let l of i){let c=kf(s,l);c!==void 0&&(o[l]=c)}return o})}case"prop":{let i=r[0]!==void 0?String(Wt(r[0],n)):"";if(Array.isArray(t)){let s=t.map(o=>kf(o,i)).filter(o=>o!==void 0);return s.length===1?s[0]:s.join(",")}return t&&typeof t=="object"?kf(t,i):t}case"parseJSON":try{return JSON.parse(String(t))}catch{return t}case"stringify":try{return JSON.stringify(t)}catch{return String(t)}case"isEmail":return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t));case"isUrl":try{return new URL(String(t)),!0}catch{return!1}case"setIfValue":return t||void 0;case"setNull":return t===null?null:t;default:return t}}function U2(t,e,r){let n=e.match(/^([\w.]+)\s*(>=|<=|!=|\*=|\^=|\$=|>|<|=)\s*(.+)$/);if(!n)return t;let[,i,s,o]=n,l=Wt(o,r);return t.filter(c=>{let d=kf(c,i);if(d===void 0)return!1;switch(s){case">":return Number(d)>Number(l);case">=":return Number(d)>=Number(l);case"<":return Number(d)<Number(l);case"<=":return Number(d)<=Number(l);case"=":return String(d)===String(l);case"!=":return String(d)!==String(l);case"*=":return String(d).includes(String(l));case"^=":return String(d).startsWith(String(l));case"$=":return String(d).endsWith(String(l));default:return!0}})}function kf(t,e){if(!(!t||typeof t!="object"))return e in t?t[e]:e.split(".").reduce((r,n)=>r?.[n],t)}function H2(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var am,lm=ae(()=>{"use strict";am=ve(require("crypto"))});function Pq(t,e){if(t)return t.split(",").map(r=>{let n=r.trim();if(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))return n.slice(1,-1);let i=Number(n);if(!isNaN(i)&&n!=="")return i;if(e&&n in e){let s=e[n],o=Number(s);return!isNaN(o)&&s!==""?o:s}return n})}function kq(t){return new yo(t)}var yo,vo,Af=ae(()=>{"use strict";sm();Pf();lm();yo=class t{allVariables;static MAX_RESOLUTION_DEPTH=20;constructor(e){this.allVariables={...e.globals,...e.collectionVariables,...e.environmentVariables,...e.variables}}resolveString(e,r=!1){return typeof e!="string"?e:this.resolveUntilStable(e,this.allVariables,r)}resolveStringWithExtra(e,r,n=!1){if(typeof e!="string")return e;let i={...this.allVariables,...r};return this.resolveUntilStable(e,i,n)}resolveUntilStable(e,r,n){let i=e;for(let s=0;s<t.MAX_RESOLUTION_DEPTH;s++){let o=this.resolveSinglePass(i,r,n);if(o===i)break;i=o}return i}resolveSinglePass(e,r,n){if(!n)return e.replace(/\{\{((?:[^}]|\}(?!\}))+)\}\}/g,(c,d)=>this.resolveTemplateContent(d.trim(),r,c));let i="",s=0,o=/\{\{((?:[^}]|\}(?!\}))+)\}\}/g,l;for(;(l=o.exec(e))!==null;){let c=l[1].trim(),d=this.resolveTemplateContent(c,r,l[0]);if(d!==l[0]){i+=e.slice(s,l.index);let p=this.getStringContext(e,l.index);i+=p?this.escapeForString(String(d),p):String(d)}else i+=e.slice(s,l.index+l[0].length);s=l.index+l[0].length}return i+=e.slice(s),i}resolveObject(e,r=!1){if(typeof e=="string")return this.resolveString(e,r);if(Array.isArray(e))return e.map(n=>this.resolveObject(n,r));if(e!==null&&typeof e=="object"){let n={};for(let[i,s]of Object.entries(e))n[i]=this.resolveObject(s,r);return n}return e}resolveObjectWithExtra(e,r,n=!1){if(typeof e=="string")return this.resolveStringWithExtra(e,r,n);if(Array.isArray(e))return e.map(i=>this.resolveObjectWithExtra(i,r,n));if(e!==null&&typeof e=="object"){let i={};for(let[s,o]of Object.entries(e))i[s]=this.resolveObjectWithExtra(o,r,n);return i}return e}resolveTemplateContent(e,r,n){let i=e.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(i){let l=Pq(i[2],r),c=Vi(i[1],l);return c!==null?String(c):n}let s=Cu(e);if(s){let l=this.resolveFilterInput(s.input,r);if(l!==void 0){let c=xu(l,s.filters,r);return c!==void 0?String(c):n}return n}let o=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(\[.+\]|\..+)$/);if(o){let l=o[1];if(r[l]!==void 0){let c=this.deserializeValue(r[l]),d=o[2],p=this.resolvePropertyAccess(c,d);if(p!==void 0)return typeof p=="object"?JSON.stringify(p):String(p)}}if(r[e]!==void 0){let l=r[e];return typeof l=="string"&&l.charCodeAt(0)===30?l.slice(1):String(l)}if(go(e)){let l=this.deserializeVariables(r),c=mo(e,l),d=ui(e,c);if(d!==void 0)return String(d)}return n}resolveFilterInput(e,r){if(e==="@")return"";if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1);let n=e.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(n){let s=Pq(n[2],r),o=Vi(n[1],s);return o!==null?o:void 0}let i=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(\[.+\]|\..+)$/);if(i){let s=i[1];if(r[s]!==void 0){let o=this.deserializeValue(r[s]),l=this.resolvePropertyAccess(o,i[2]);if(l!==void 0)return l}}if(r[e]!==void 0)return this.deserializeValue(r[e]);if(go(e)){let s=this.deserializeVariables(r),o=mo(e,s),l=ui(e,o);if(l!==void 0)return l}}deserializeValue(e){if(typeof e=="string"&&e.charCodeAt(0)===30)try{return JSON.parse(e.slice(1))}catch{return e}return e}deserializeVariables(e){let r={};for(let[n,i]of Object.entries(e))r[n]=this.deserializeValue(i);return r}resolvePropertyAccess(e,r){let n=e,i=/\[(\d+|"[^"]*"|'[^']*')\]|\.([a-zA-Z_][a-zA-Z0-9_]*)/g,s;for(;(s=i.exec(r))!==null;){if(n==null)return;if(s[1]!==void 0){let o=s[1];/^\d+$/.test(o)?n=n[Number(o)]:n=n[o.slice(1,-1)]}else s[2]!==void 0&&(n=n[s[2]])}return n}escapeForString(e,r){let n=e.replace(/\\/g,"\\\\");return r==='"'?n=n.replace(/"/g,'\\"'):n=n.replace(/'/g,"\\'"),n.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}getStringContext(e,r){let n=null;for(let i=0;i<r;i++){let s=e[i];(i>0?e[i-1]:"")!=="\\"&&(s==='"'||s==="'")&&(n===null?n=s:n===s&&(n=null))}return n}},vo=class{interpolate(e,r){return!e||typeof e!="string"?e:new yo({globals:{},collectionVariables:{},environmentVariables:{},variables:r}).resolveString(e,!0)}extractVariables(e){if(!e||typeof e!="string")return[];let r=[],n,i=/\{\{((?:[^}]|\}(?!\}))+)\}\}/g;for(;(n=i.exec(e))!==null;){let s=n[1].trim();!s.startsWith("$")&&!s.includes("|")&&/^[a-zA-Z_]\w*$/.test(s)&&(r.includes(s)||r.push(s))}return r}interpolateObject(e,r){if(e==null)return e;if(typeof e=="string")return this.interpolate(e,r);if(Array.isArray(e))return e.map(n=>this.interpolateObject(n,r));if(typeof e=="object"){let n={};for(let[i,s]of Object.entries(e))n[i]=this.interpolateObject(s,r);return n}return e}}});var Wi,Tf=ae(()=>{"use strict";Wi=class{constructor(e,r,n){this.urlBuilder=e;this.interceptors=r;this.httpClient=n}urlBuilder;interceptors;httpClient;async execute(e){let r={},n;try{n=await this.interceptors.executeRequestInterceptors(e,r)}catch(i){let s=await this.interceptors.executeErrorInterceptors(i,e,r);if(s)return s;throw i}try{let i=await this.httpClient.send(n);return await this.interceptors.executeResponseInterceptors(i,n,r)}catch(i){let s=await this.interceptors.executeErrorInterceptors(i,n,r);if(s)return s;throw i}}buildUrl(e,r={},n={}){return this.urlBuilder.buildUrl(e,r,n)}}});var zi,um,cm,fm,$f=ae(()=>{"use strict";zi=class{requestInterceptors=[];responseInterceptors=[];errorInterceptors=[];addRequestInterceptor(e){return this.requestInterceptors.push(e),this.sortByPriority(this.requestInterceptors),this}addResponseInterceptor(e){return this.responseInterceptors.push(e),this.sortByPriority(this.responseInterceptors),this}addErrorInterceptor(e){return this.errorInterceptors.push(e),this.sortByPriority(this.errorInterceptors),this}removeRequestInterceptor(e){let r=this.requestInterceptors.findIndex(n=>n.name===e);return r>=0?(this.requestInterceptors.splice(r,1),!0):!1}removeResponseInterceptor(e){let r=this.responseInterceptors.findIndex(n=>n.name===e);return r>=0?(this.responseInterceptors.splice(r,1),!0):!1}removeErrorInterceptor(e){let r=this.errorInterceptors.findIndex(n=>n.name===e);return r>=0?(this.errorInterceptors.splice(r,1),!0):!1}async executeRequestInterceptors(e,r){let n=e;for(let i of this.requestInterceptors)try{n=await i.intercept(n,r)}catch(s){throw console.error(`[InterceptorChain] Request interceptor '${i.name}' failed:`,s),s}return n}async executeResponseInterceptors(e,r,n){let i=e;for(let s of this.responseInterceptors)try{i=await s.intercept(i,r,n)}catch(o){throw console.error(`[InterceptorChain] Response interceptor '${s.name}' failed:`,o),o}return i}async executeErrorInterceptors(e,r,n){for(let i of this.errorInterceptors)try{let s=await i.handle(e,r,n);if(s)return s}catch(s){console.error(`[InterceptorChain] Error interceptor '${i.name}' failed:`,s)}}clear(){this.requestInterceptors=[],this.responseInterceptors=[],this.errorInterceptors=[]}getRegisteredInterceptors(){return{request:this.requestInterceptors.map(e=>e.name),response:this.responseInterceptors.map(e=>e.name),error:this.errorInterceptors.map(e=>e.name)}}sortByPriority(e){e.sort((r,n)=>(r.priority??100)-(n.priority??100))}},um=class{name="logging";priority=1e3;intercept(e,r){return e}},cm=class{name="timing";priority=1;intercept(e,r,n){return e}},fm=class{name="retry";priority=1;maxRetries;retryableErrors;constructor(e=3,r=["ECONNRESET","ETIMEDOUT"]){this.maxRetries=e,this.retryableErrors=r}handle(e,r,n){let i=this.retryableErrors.some(s=>e.message.includes(s))}}});var Aq=V((Eu,Nf)=>{(function(){var t,e="4.18.1",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",s="Invalid `variable` option passed into `_.template`",o="Invalid `imports` option passed into `_.template`",l="__lodash_hash_undefined__",c=500,d="__lodash_placeholder__",p=1,m=2,y=4,b=1,E=2,C=1,v=2,_=4,q=8,k=16,O=32,M=64,j=128,I=256,R=512,A=30,F="...",U=800,D=16,J=1,Q=2,se=3,ce=1/0,Ve=9007199254740991,Re=17976931348623157e292,me=NaN,Ae=4294967295,gt=Ae-1,Nt=Ae>>>1,pe=[["ary",j],["bind",C],["bindKey",v],["curry",q],["curryRight",k],["flip",R],["partial",O],["partialRight",M],["rearg",I]],Gt="[object Arguments]",kr="[object Array]",ut="[object AsyncFunction]",Ar="[object Boolean]",br="[object Date]",xt="[object DOMException]",wt="[object Error]",zr="[object Function]",Ws="[object GeneratorFunction]",At="[object Map]",Ai="[object Number]",On="[object Null]",te="[object Object]",ne="[object Promise]",Pe="[object Proxy]",ye="[object RegExp]",be="[object Set]",Ke="[object String]",ur="[object Symbol]",Te="[object Undefined]",ge="[object WeakMap]",In="[object WeakSet]",pn="[object ArrayBuffer]",yt="[object DataView]",qe="[object Float32Array]",Pn="[object Float64Array]",Il="[object Int8Array]",zs="[object Int16Array]",ea="[object Int32Array]",Js="[object Uint8Array]",Ti="[object Uint8ClampedArray]",Gs="[object Uint16Array]",Bc="[object Uint32Array]",Pl=/\b__p \+= '';/g,Ov=/\b(__p \+=) '' \+/g,ta=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ls=/&(?:amp|lt|gt|quot|#39);/g,kl=/[&<>"']/g,Al=RegExp(ls.source),he=RegExp(kl.source),Iv=/<%-([\s\S]+?)%>/g,Pv=/<%([\s\S]+?)%>/g,kn=/<%=([\s\S]+?)%>/g,Jr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,We=/^\w*$/,Vc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,dt=/[\\^$.*+?()[\]{}|]/g,ra=RegExp(dt.source),Wc=/^\s+/,Tl=/\s/,cr=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Qn=/\{\n\/\* \[wrapped with (.+)\] \*/,An=/,? & /,Yt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Gr=/[()=,{}\[\]\/\s]/,Zn=/\\(\\)?/g,us=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,jp=/\w*$/,kv=/^[-+]0x[0-9a-f]+$/i,na=/^0b[01]+$/i,Lp=/^\[object .+?Constructor\]$/,Av=/^0o[0-7]+$/i,Ys=/^(?:0|[1-9]\d*)$/,ia=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,sa=/($^)/,Tv=/['\n\r\u2028\u2029\\]/g,$l="\\ud800-\\udfff",$v="\\u0300-\\u036f",Lt="\\ufe20-\\ufe2f",zc="\\u20d0-\\u20ff",Up=$v+Lt+zc,Jc="\\u2700-\\u27bf",Gc="a-z\\xdf-\\xf6\\xf8-\\xff",Nv="\\xac\\xb1\\xd7\\xf7",Mv="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Fv="\\u2000-\\u206f",Dv=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Hp="A-Z\\xc0-\\xd6\\xd8-\\xde",Bp="\\ufe0e\\ufe0f",Yc=Nv+Mv+Fv+Dv,Nl="['\u2019]",jv="["+$l+"]",Vp="["+Yc+"]",Ml="["+Up+"]",Kc="\\d+",Lv="["+Jc+"]",Ks="["+Gc+"]",oa="[^"+$l+Yc+Kc+Jc+Gc+Hp+"]",Fl="\\ud83c[\\udffb-\\udfff]",aa="(?:"+Ml+"|"+Fl+")",Tn="[^"+$l+"]",Qc="(?:\\ud83c[\\udde6-\\uddff]){2}",Zc="[\\ud800-\\udbff][\\udc00-\\udfff]",Qs="["+Hp+"]",Wp="\\u200d",zp="(?:"+Ks+"|"+oa+")",Uv="(?:"+Qs+"|"+oa+")",Jp="(?:"+Nl+"(?:d|ll|m|re|s|t|ve))?",Gp="(?:"+Nl+"(?:D|LL|M|RE|S|T|VE))?",Dl=aa+"?",Yp="["+Bp+"]?",Kp="(?:"+Wp+"(?:"+[Tn,Qc,Zc].join("|")+")"+Yp+Dl+")*",Hv="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Bv="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Qp=Yp+Dl+Kp,Vv="(?:"+[Lv,Qc,Zc].join("|")+")"+Qp,Wv="(?:"+[Tn+Ml+"?",Ml,Qc,Zc,jv].join("|")+")",zv=RegExp(Nl,"g"),Jv=RegExp(Ml,"g"),Xc=RegExp(Fl+"(?="+Fl+")|"+Wv+Qp,"g"),Gv=RegExp([Qs+"?"+Ks+"+"+Jp+"(?="+[Vp,Qs,"$"].join("|")+")",Uv+"+"+Gp+"(?="+[Vp,Qs+zp,"$"].join("|")+")",Qs+"?"+zp+"+"+Jp,Qs+"+"+Gp,Bv,Hv,Kc,Vv].join("|"),"g"),Yv=RegExp("["+Wp+$l+Up+Bp+"]"),Kv=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Qv=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Zv=-1,Pt={};Pt[qe]=Pt[Pn]=Pt[Il]=Pt[zs]=Pt[ea]=Pt[Js]=Pt[Ti]=Pt[Gs]=Pt[Bc]=!0,Pt[Gt]=Pt[kr]=Pt[pn]=Pt[Ar]=Pt[yt]=Pt[br]=Pt[wt]=Pt[zr]=Pt[At]=Pt[Ai]=Pt[te]=Pt[ye]=Pt[be]=Pt[Ke]=Pt[ge]=!1;var Et={};Et[Gt]=Et[kr]=Et[pn]=Et[yt]=Et[Ar]=Et[br]=Et[qe]=Et[Pn]=Et[Il]=Et[zs]=Et[ea]=Et[At]=Et[Ai]=Et[te]=Et[ye]=Et[be]=Et[Ke]=Et[ur]=Et[Js]=Et[Ti]=Et[Gs]=Et[Bc]=!0,Et[wt]=Et[zr]=Et[ge]=!1;var ef={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},tf={"&":"&","<":"<",">":">",'"':""","'":"'"},Xv={"&":"&","<":"<",">":">",""":'"',"'":"'"},Zp={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Xp=parseFloat,eb=parseInt,eh=typeof global=="object"&&global&&global.Object===Object&&global,tb=typeof self=="object"&&self&&self.Object===Object&&self,Xt=eh||tb||Function("return this")(),jl=typeof Eu=="object"&&Eu&&!Eu.nodeType&&Eu,pt=jl&&typeof Nf=="object"&&Nf&&!Nf.nodeType&&Nf,Zs=pt&&pt.exports===jl,cs=Zs&&eh.process,Yr=(function(){try{var W=pt&&pt.require&&pt.require("util").types;return W||cs&&cs.binding&&cs.binding("util")}catch{}})(),rf=Yr&&Yr.isArrayBuffer,th=Yr&&Yr.isDate,rh=Yr&&Yr.isMap,la=Yr&&Yr.isRegExp,Xn=Yr&&Yr.isSet,Ll=Yr&&Yr.isTypedArray;function Tr(W,Z,Y){switch(Y.length){case 0:return W.call(Z);case 1:return W.call(Z,Y[0]);case 2:return W.call(Z,Y[0],Y[1]);case 3:return W.call(Z,Y[0],Y[1],Y[2])}return W.apply(Z,Y)}function ei(W,Z,Y,de){for(var Ie=-1,ct=W==null?0:W.length;++Ie<ct;){var bt=W[Ie];Z(de,bt,Y(bt),W)}return de}function $r(W,Z){for(var Y=-1,de=W==null?0:W.length;++Y<de&&Z(W[Y],Y,W)!==!1;);return W}function nf(W,Z){for(var Y=W==null?0:W.length;Y--&&Z(W[Y],Y,W)!==!1;);return W}function nh(W,Z){for(var Y=-1,de=W==null?0:W.length;++Y<de;)if(!Z(W[Y],Y,W))return!1;return!0}function $i(W,Z){for(var Y=-1,de=W==null?0:W.length,Ie=0,ct=[];++Y<de;){var bt=W[Y];Z(bt,Y,W)&&(ct[Ie++]=bt)}return ct}function Ul(W,Z){var Y=W==null?0:W.length;return!!Y&&fs(W,Z,0)>-1}function Xs(W,Z,Y){for(var de=-1,Ie=W==null?0:W.length;++de<Ie;)if(Y(Z,W[de]))return!0;return!1}function qt(W,Z){for(var Y=-1,de=W==null?0:W.length,Ie=Array(de);++Y<de;)Ie[Y]=Z(W[Y],Y,W);return Ie}function Ni(W,Z){for(var Y=-1,de=Z.length,Ie=W.length;++Y<de;)W[Ie+Y]=Z[Y];return W}function sf(W,Z,Y,de){var Ie=-1,ct=W==null?0:W.length;for(de&&ct&&(Y=W[++Ie]);++Ie<ct;)Y=Z(Y,W[Ie],Ie,W);return Y}function rb(W,Z,Y,de){var Ie=W==null?0:W.length;for(de&&Ie&&(Y=W[--Ie]);Ie--;)Y=Z(Y,W[Ie],Ie,W);return Y}function Hl(W,Z){for(var Y=-1,de=W==null?0:W.length;++Y<de;)if(Z(W[Y],Y,W))return!0;return!1}var nb=ua("length");function ib(W){return W.split("")}function sb(W){return W.match(Yt)||[]}function ih(W,Z,Y){var de;return Y(W,function(Ie,ct,bt){if(Z(Ie,ct,bt))return de=ct,!1}),de}function Bl(W,Z,Y,de){for(var Ie=W.length,ct=Y+(de?1:-1);de?ct--:++ct<Ie;)if(Z(W[ct],ct,W))return ct;return-1}function fs(W,Z,Y){return Z===Z?hb(W,Z,Y):Bl(W,ds,Y)}function ob(W,Z,Y,de){for(var Ie=Y-1,ct=W.length;++Ie<ct;)if(de(W[Ie],Z))return Ie;return-1}function ds(W){return W!==W}function sh(W,Z){var Y=W==null?0:W.length;return Y?af(W,Z)/Y:me}function ua(W){return function(Z){return Z==null?t:Z[W]}}function of(W){return function(Z){return W==null?t:W[Z]}}function Vl(W,Z,Y,de,Ie){return Ie(W,function(ct,bt,et){Y=de?(de=!1,ct):Z(Y,ct,bt,et)}),Y}function ab(W,Z){var Y=W.length;for(W.sort(Z);Y--;)W[Y]=W[Y].value;return W}function af(W,Z){for(var Y,de=-1,Ie=W.length;++de<Ie;){var ct=Z(W[de]);ct!==t&&(Y=Y===t?ct:Y+ct)}return Y}function lf(W,Z){for(var Y=-1,de=Array(W);++Y<W;)de[Y]=Z(Y);return de}function lb(W,Z){return qt(Z,function(Y){return[Y,W[Y]]})}function uf(W){return W&&W.slice(0,ch(W)+1).replace(Wc,"")}function Nr(W){return function(Z){return W(Z)}}function Wl(W,Z){return qt(Z,function(Y){return W[Y]})}function vt(W,Z){return W.has(Z)}function oh(W,Z){for(var Y=-1,de=W.length;++Y<de&&fs(Z,W[Y],0)>-1;);return Y}function ah(W,Z){for(var Y=W.length;Y--&&fs(Z,W[Y],0)>-1;);return Y}function lh(W,Z){for(var Y=W.length,de=0;Y--;)W[Y]===Z&&++de;return de}var ub=of(ef),cb=of(tf);function fb(W){return"\\"+Zp[W]}function ca(W,Z){return W==null?t:W[Z]}function eo(W){return Yv.test(W)}function db(W){return Kv.test(W)}function pb(W){for(var Z,Y=[];!(Z=W.next()).done;)Y.push(Z.value);return Y}function to(W){var Z=-1,Y=Array(W.size);return W.forEach(function(de,Ie){Y[++Z]=[Ie,de]}),Y}function fa(W,Z){return function(Y){return W(Z(Y))}}function $n(W,Z){for(var Y=-1,de=W.length,Ie=0,ct=[];++Y<de;){var bt=W[Y];(bt===Z||bt===d)&&(W[Y]=d,ct[Ie++]=Y)}return ct}function zl(W){var Z=-1,Y=Array(W.size);return W.forEach(function(de){Y[++Z]=de}),Y}function uh(W){var Z=-1,Y=Array(W.size);return W.forEach(function(de){Y[++Z]=[de,de]}),Y}function hb(W,Z,Y){for(var de=Y-1,Ie=W.length;++de<Ie;)if(W[de]===Z)return de;return-1}function cf(W,Z,Y){for(var de=Y+1;de--;)if(W[de]===Z)return de;return de}function Mi(W){return eo(W)?gb(W):nb(W)}function Mr(W){return eo(W)?yb(W):ib(W)}function ch(W){for(var Z=W.length;Z--&&Tl.test(W.charAt(Z)););return Z}var mb=of(Xv);function gb(W){for(var Z=Xc.lastIndex=0;Xc.test(W);)++Z;return Z}function yb(W){return W.match(Xc)||[]}function vb(W){return W.match(Gv)||[]}var bb=(function W(Z){Z=Z==null?Xt:Fi.defaults(Xt.Object(),Z,Fi.pick(Xt,Qv));var Y=Z.Array,de=Z.Date,Ie=Z.Error,ct=Z.Function,bt=Z.Math,et=Z.Object,Jl=Z.RegExp,Sb=Z.String,Fr=Z.TypeError,da=Y.prototype,wb=ct.prototype,ro=et.prototype,pa=Z["__core-js_shared__"],Gl=wb.toString,ht=ro.hasOwnProperty,_b=0,fh=(function(){var a=/[^.]+$/.exec(pa&&pa.keys&&pa.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})(),Yl=ro.toString,Rb=Gl.call(et),Cb=Xt._,xb=Jl("^"+Gl.call(ht).replace(dt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Kl=Zs?Z.Buffer:t,Di=Z.Symbol,Ql=Z.Uint8Array,dh=Kl?Kl.allocUnsafe:t,Zl=fa(et.getPrototypeOf,et),ph=et.create,ha=ro.propertyIsEnumerable,Xl=da.splice,hh=Di?Di.isConcatSpreadable:t,ma=Di?Di.iterator:t,ps=Di?Di.toStringTag:t,eu=(function(){try{var a=xa(et,"defineProperty");return a({},"",{}),a}catch{}})(),Eb=Z.clearTimeout!==Xt.clearTimeout&&Z.clearTimeout,qb=de&&de.now!==Xt.Date.now&&de.now,Ob=Z.setTimeout!==Xt.setTimeout&&Z.setTimeout,ga=bt.ceil,ya=bt.floor,tu=et.getOwnPropertySymbols,ru=Kl?Kl.isBuffer:t,hs=Z.isFinite,nu=da.join,mh=fa(et.keys,et),Tt=bt.max,sr=bt.min,gh=de.now,Ib=Z.parseInt,yh=bt.random,Pb=da.reverse,ff=xa(Z,"DataView"),va=xa(Z,"Map"),df=xa(Z,"Promise"),no=xa(Z,"Set"),ba=xa(Z,"WeakMap"),Sa=xa(et,"create"),iu=ba&&new ba,io={},kb=Ea(ff),Ab=Ea(va),Tb=Ea(df),$b=Ea(no),Nb=Ea(ba),su=Di?Di.prototype:t,wa=su?su.valueOf:t,vh=su?su.toString:t;function $(a){if(Vt(a)&&!Ne(a)&&!(a instanceof ze)){if(a instanceof Sr)return a;if(ht.call(a,"__wrapped__"))return $E(a)}return new Sr(a)}var so=(function(){function a(){}return function(u){if(!Ut(u))return{};if(ph)return ph(u);a.prototype=u;var h=new a;return a.prototype=t,h}})();function ou(){}function Sr(a,u){this.__wrapped__=a,this.__actions__=[],this.__chain__=!!u,this.__index__=0,this.__values__=t}$.templateSettings={escape:Iv,evaluate:Pv,interpolate:kn,variable:"",imports:{_:$}},$.prototype=ou.prototype,$.prototype.constructor=$,Sr.prototype=so(ou.prototype),Sr.prototype.constructor=Sr;function ze(a){this.__wrapped__=a,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Ae,this.__views__=[]}function Mb(){var a=new ze(this.__wrapped__);return a.__actions__=Kr(this.__actions__),a.__dir__=this.__dir__,a.__filtered__=this.__filtered__,a.__iteratees__=Kr(this.__iteratees__),a.__takeCount__=this.__takeCount__,a.__views__=Kr(this.__views__),a}function Fb(){if(this.__filtered__){var a=new ze(this);a.__dir__=-1,a.__filtered__=!0}else a=this.clone(),a.__dir__*=-1;return a}function pf(){var a=this.__wrapped__.value(),u=this.__dir__,h=Ne(a),S=u<0,P=h?a.length:0,N=NM(0,P,this.__views__),L=N.start,B=N.end,z=B-L,X=S?B:L-1,ee=this.__iteratees__,re=ee.length,ue=0,Se=sr(z,this.__takeCount__);if(!h||!S&&P==z&&Se==z)return nE(a,this.__actions__);var Ee=[];e:for(;z--&&ue<Se;){X+=u;for(var je=-1,Ce=a[X];++je<re;){var Ze=ee[je],tt=Ze.iteratee,bn=Ze.type,Lr=tt(Ce);if(bn==Q)Ce=Lr;else if(!Lr){if(bn==J)continue e;break e}}Ee[ue++]=Ce}return Ee}ze.prototype=so(ou.prototype),ze.prototype.constructor=ze;function Nn(a){var u=-1,h=a==null?0:a.length;for(this.clear();++u<h;){var S=a[u];this.set(S[0],S[1])}}function Db(){this.__data__=Sa?Sa(null):{},this.size=0}function jb(a){var u=this.has(a)&&delete this.__data__[a];return this.size-=u?1:0,u}function Lb(a){var u=this.__data__;if(Sa){var h=u[a];return h===l?t:h}return ht.call(u,a)?u[a]:t}function Ub(a){var u=this.__data__;return Sa?u[a]!==t:ht.call(u,a)}function Hb(a,u){var h=this.__data__;return this.size+=this.has(a)?0:1,h[a]=Sa&&u===t?l:u,this}Nn.prototype.clear=Db,Nn.prototype.delete=jb,Nn.prototype.get=Lb,Nn.prototype.has=Ub,Nn.prototype.set=Hb;function ti(a){var u=-1,h=a==null?0:a.length;for(this.clear();++u<h;){var S=a[u];this.set(S[0],S[1])}}function bh(){this.__data__=[],this.size=0}function Bb(a){var u=this.__data__,h=lu(u,a);if(h<0)return!1;var S=u.length-1;return h==S?u.pop():Xl.call(u,h,1),--this.size,!0}function Vb(a){var u=this.__data__,h=lu(u,a);return h<0?t:u[h][1]}function Sh(a){return lu(this.__data__,a)>-1}function Wb(a,u){var h=this.__data__,S=lu(h,a);return S<0?(++this.size,h.push([a,u])):h[S][1]=u,this}ti.prototype.clear=bh,ti.prototype.delete=Bb,ti.prototype.get=Vb,ti.prototype.has=Sh,ti.prototype.set=Wb;function ri(a){var u=-1,h=a==null?0:a.length;for(this.clear();++u<h;){var S=a[u];this.set(S[0],S[1])}}function zb(){this.size=0,this.__data__={hash:new Nn,map:new(va||ti),string:new Nn}}function ji(a){var u=Uh(this,a).delete(a);return this.size-=u?1:0,u}function wh(a){return Uh(this,a).get(a)}function Jb(a){return Uh(this,a).has(a)}function Gb(a,u){var h=Uh(this,a),S=h.size;return h.set(a,u),this.size+=h.size==S?0:1,this}ri.prototype.clear=zb,ri.prototype.delete=ji,ri.prototype.get=wh,ri.prototype.has=Jb,ri.prototype.set=Gb;function ms(a){var u=-1,h=a==null?0:a.length;for(this.__data__=new ri;++u<h;)this.add(a[u])}function ie(a){return this.__data__.set(a,l),this}function Yb(a){return this.__data__.has(a)}ms.prototype.add=ms.prototype.push=ie,ms.prototype.has=Yb;function hn(a){var u=this.__data__=new ti(a);this.size=u.size}function _h(){this.__data__=new ti,this.size=0}function it(a){var u=this.__data__,h=u.delete(a);return this.size=u.size,h}function au(a){return this.__data__.get(a)}function Rh(a){return this.__data__.has(a)}function hf(a,u){var h=this.__data__;if(h instanceof ti){var S=h.__data__;if(!va||S.length<r-1)return S.push([a,u]),this.size=++h.size,this;h=this.__data__=new ri(S)}return h.set(a,u),this.size=h.size,this}hn.prototype.clear=_h,hn.prototype.delete=it,hn.prototype.get=au,hn.prototype.has=Rh,hn.prototype.set=hf;function Ch(a,u){var h=Ne(a),S=!h&&qa(a),P=!h&&!S&&po(a),N=!h&&!S&&!P&&hu(a),L=h||S||P||N,B=L?lf(a.length,Sb):[],z=B.length;for(var X in a)(u||ht.call(a,X))&&!(L&&(X=="length"||P&&(X=="offset"||X=="parent")||N&&(X=="buffer"||X=="byteLength"||X=="byteOffset")||bs(X,z)))&&B.push(X);return B}function xh(a){var u=a.length;return u?a[lS(0,u-1)]:t}function Kb(a,u){return Hh(Kr(a),Li(u,0,a.length))}function Qb(a){return Hh(Kr(a))}function mf(a,u,h){(h!==t&&!ai(a[u],h)||h===t&&!(u in a))&&mn(a,u,h)}function Dr(a,u,h){var S=a[u];(!(ht.call(a,u)&&ai(S,h))||h===t&&!(u in a))&&mn(a,u,h)}function lu(a,u){for(var h=a.length;h--;)if(ai(a[h][0],u))return h;return-1}function Eh(a,u,h,S){return Ui(a,function(P,N,L){u(S,P,h(P),L)}),S}function qh(a,u){return a&&Hi(u,fr(u),a)}function Zb(a,u){return a&&Hi(u,Zr(u),a)}function mn(a,u,h){u=="__proto__"&&eu?eu(a,u,{configurable:!0,enumerable:!0,value:h,writable:!0}):a[u]=h}function gf(a,u){for(var h=-1,S=u.length,P=Y(S),N=a==null;++h<S;)P[h]=N?t:$S(a,u[h]);return P}function Li(a,u,h){return a===a&&(h!==t&&(a=a<=h?a:h),u!==t&&(a=a>=u?a:u)),a}function wr(a,u,h,S,P,N){var L,B=u&p,z=u&m,X=u&y;if(h&&(L=P?h(a,S,P,N):h(a)),L!==t)return L;if(!Ut(a))return a;var ee=Ne(a);if(ee){if(L=FM(a),!B)return Kr(a,L)}else{var re=_r(a),ue=re==zr||re==Ws;if(po(a))return oE(a,B);if(re==te||re==Gt||ue&&!P){if(L=z||ue?{}:xE(a),!B)return z?EM(a,Zb(L,a)):xM(a,qh(L,a))}else{if(!Et[re])return P?a:{};L=DM(a,re,B)}}N||(N=new hn);var Se=N.get(a);if(Se)return Se;N.set(a,L),eq(a)?a.forEach(function(Ce){L.add(wr(Ce,u,h,Ce,a,N))}):ZE(a)&&a.forEach(function(Ce,Ze){L.set(Ze,wr(Ce,u,h,Ze,a,N))});var Ee=X?z?bS:vS:z?Zr:fr,je=ee?t:Ee(a);return $r(je||a,function(Ce,Ze){je&&(Ze=Ce,Ce=a[Ze]),Dr(L,Ze,wr(Ce,u,h,Ze,a,N))}),L}function Xb(a){var u=fr(a);return function(h){return Mn(h,a,u)}}function Mn(a,u,h){var S=h.length;if(a==null)return!S;for(a=et(a);S--;){var P=h[S],N=u[P],L=a[P];if(L===t&&!(P in a)||!N(L))return!1}return!0}function yf(a,u,h){if(typeof a!="function")throw new Fr(i);return Cf(function(){a.apply(t,h)},u)}function _a(a,u,h,S){var P=-1,N=Ul,L=!0,B=a.length,z=[],X=u.length;if(!B)return z;h&&(u=qt(u,Nr(h))),S?(N=Xs,L=!1):u.length>=r&&(N=vt,L=!1,u=new ms(u));e:for(;++P<B;){var ee=a[P],re=h==null?ee:h(ee);if(ee=S||ee!==0?ee:0,L&&re===re){for(var ue=X;ue--;)if(u[ue]===re)continue e;z.push(ee)}else N(u,re,S)||z.push(ee)}return z}var Ui=fE(Fn),Oh=fE(ni,!0);function eS(a,u){var h=!0;return Ui(a,function(S,P,N){return h=!!u(S,P,N),h}),h}function uu(a,u,h){for(var S=-1,P=a.length;++S<P;){var N=a[S],L=u(N);if(L!=null&&(B===t?L===L&&!vn(L):h(L,B)))var B=L,z=N}return z}function tS(a,u,h,S){var P=a.length;for(h=Fe(h),h<0&&(h=-h>P?0:P+h),S=S===t||S>P?P:Fe(S),S<0&&(S+=P),S=h>S?0:rq(S);h<S;)a[h++]=u;return a}function Ih(a,u){var h=[];return Ui(a,function(S,P,N){u(S,P,N)&&h.push(S)}),h}function or(a,u,h,S,P){var N=-1,L=a.length;for(h||(h=LM),P||(P=[]);++N<L;){var B=a[N];u>0&&h(B)?u>1?or(B,u-1,h,S,P):Ni(P,B):S||(P[P.length]=B)}return P}var vf=dE(),Ph=dE(!0);function Fn(a,u){return a&&vf(a,u,fr)}function ni(a,u){return a&&Ph(a,u,fr)}function cu(a,u){return $i(u,function(h){return Ss(a[h])})}function gs(a,u){u=co(u,a);for(var h=0,S=u.length;a!=null&&h<S;)a=a[oi(u[h++])];return h&&h==S?a:t}function kh(a,u,h){var S=u(a);return Ne(a)?S:Ni(S,h(a))}function dr(a){return a==null?a===t?Te:On:ps&&ps in et(a)?$M(a):JM(a)}function bf(a,u){return a>u}function rS(a,u){return a!=null&&ht.call(a,u)}function nS(a,u){return a!=null&&u in et(a)}function iS(a,u,h){return a>=sr(u,h)&&a<Tt(u,h)}function gn(a,u,h){for(var S=h?Xs:Ul,P=a[0].length,N=a.length,L=N,B=Y(N),z=1/0,X=[];L--;){var ee=a[L];L&&u&&(ee=qt(ee,Nr(u))),z=sr(ee.length,z),B[L]=!h&&(u||P>=120&&ee.length>=120)?new ms(L&&ee):t}ee=a[0];var re=-1,ue=B[0];e:for(;++re<P&&X.length<z;){var Se=ee[re],Ee=u?u(Se):Se;if(Se=h||Se!==0?Se:0,!(ue?vt(ue,Ee):S(X,Ee,h))){for(L=N;--L;){var je=B[L];if(!(je?vt(je,Ee):S(a[L],Ee,h)))continue e}ue&&ue.push(Ee),X.push(Se)}}return X}function oo(a,u,h,S){return Fn(a,function(P,N,L){u(S,h(P),N,L)}),S}function Ra(a,u,h){u=co(u,a),a=IE(a,u);var S=a==null?a:a[oi(jn(u))];return S==null?t:Tr(S,a,h)}function Ah(a){return Vt(a)&&dr(a)==Gt}function sS(a){return Vt(a)&&dr(a)==pn}function oS(a){return Vt(a)&&dr(a)==br}function Ca(a,u,h,S,P){return a===u?!0:a==null||u==null||!Vt(a)&&!Vt(u)?a!==a&&u!==u:Sf(a,u,h,S,Ca,P)}function Sf(a,u,h,S,P,N){var L=Ne(a),B=Ne(u),z=L?kr:_r(a),X=B?kr:_r(u);z=z==Gt?te:z,X=X==Gt?te:X;var ee=z==te,re=X==te,ue=z==X;if(ue&&po(a)){if(!po(u))return!1;L=!0,ee=!1}if(ue&&!ee)return N||(N=new hn),L||hu(a)?_E(a,u,h,S,P,N):AM(a,u,z,h,S,P,N);if(!(h&b)){var Se=ee&&ht.call(a,"__wrapped__"),Ee=re&&ht.call(u,"__wrapped__");if(Se||Ee){var je=Se?a.value():a,Ce=Ee?u.value():u;return N||(N=new hn),P(je,Ce,h,S,N)}}return ue?(N||(N=new hn),TM(a,u,h,S,P,N)):!1}function ao(a){return Vt(a)&&_r(a)==At}function lo(a,u,h,S){var P=h.length,N=P,L=!S;if(a==null)return!N;for(a=et(a);P--;){var B=h[P];if(L&&B[2]?B[1]!==a[B[0]]:!(B[0]in a))return!1}for(;++P<N;){B=h[P];var z=B[0],X=a[z],ee=B[1];if(L&&B[2]){if(X===t&&!(z in a))return!1}else{var re=new hn;if(S)var ue=S(X,ee,z,a,u,re);if(!(ue===t?Ca(ee,X,b|E,S,re):ue))return!1}}return!0}function Qe(a){if(!Ut(a)||HM(a))return!1;var u=Ss(a)?xb:Lp;return u.test(Ea(a))}function f(a){return Vt(a)&&dr(a)==ye}function g(a){return Vt(a)&&_r(a)==be}function w(a){return Vt(a)&&Gh(a.length)&&!!Pt[dr(a)]}function x(a){return typeof a=="function"?a:a==null?Xr:typeof a=="object"?Ne(a)?Je(a[0],a[1]):Oe(a):hq(a)}function T(a){if(!Rf(a))return mh(a);var u=[];for(var h in et(a))ht.call(a,h)&&h!="constructor"&&u.push(h);return u}function H(a){if(!Ut(a))return zM(a);var u=Rf(a),h=[];for(var S in a)S=="constructor"&&(u||!ht.call(a,S))||h.push(S);return h}function K(a,u){return a<u}function fe(a,u){var h=-1,S=Qr(a)?Y(a.length):[];return Ui(a,function(P,N,L){S[++h]=u(P,N,L)}),S}function Oe(a){var u=wS(a);return u.length==1&&u[0][2]?qE(u[0][0],u[0][1]):function(h){return h===a||lo(h,a,u)}}function Je(a,u){return RS(a)&&EE(u)?qE(oi(a),u):function(h){var S=$S(h,a);return S===t&&S===u?NS(h,a):Ca(u,S,b|E)}}function er(a,u,h,S,P){a!==u&&vf(u,function(N,L){if(P||(P=new hn),Ut(N))ii(a,u,L,h,er,S,P);else{var B=S?S(xS(a,L),N,L+"",a,u,P):t;B===t&&(B=N),mf(a,L,B)}},Zr)}function ii(a,u,h,S,P,N,L){var B=xS(a,h),z=xS(u,h),X=L.get(z);if(X){mf(a,h,X);return}var ee=N?N(B,z,h+"",a,u,L):t,re=ee===t;if(re){var ue=Ne(z),Se=!ue&&po(z),Ee=!ue&&!Se&&hu(z);ee=z,ue||Se||Ee?Ne(B)?ee=B:Kt(B)?ee=Kr(B):Se?(re=!1,ee=oE(z,!0)):Ee?(re=!1,ee=aE(z,!0)):ee=[]:xf(z)||qa(z)?(ee=B,qa(B)?ee=nq(B):(!Ut(B)||Ss(B))&&(ee=xE(z))):re=!1}re&&(L.set(z,ee),P(ee,z,S,N,L),L.delete(z)),mf(a,h,ee)}function si(a,u){var h=a.length;if(h)return u+=u<0?h:0,bs(u,h)?a[u]:t}function Kx(a,u,h){u.length?u=qt(u,function(N){return Ne(N)?function(L){return gs(L,N.length===1?N[0]:N)}:N}):u=[Xr];var S=-1;u=qt(u,Nr(xe()));var P=fe(a,function(N,L,B){var z=qt(u,function(X){return X(N)});return{criteria:z,index:++S,value:N}});return ab(P,function(N,L){return CM(N,L,h)})}function dM(a,u){return Qx(a,u,function(h,S){return NS(a,S)})}function Qx(a,u,h){for(var S=-1,P=u.length,N={};++S<P;){var L=u[S],B=gs(a,L);h(B,L)&&wf(N,co(L,a),B)}return N}function pM(a){return function(u){return gs(u,a)}}function aS(a,u,h,S){var P=S?ob:fs,N=-1,L=u.length,B=a;for(a===u&&(u=Kr(u)),h&&(B=qt(a,Nr(h)));++N<L;)for(var z=0,X=u[N],ee=h?h(X):X;(z=P(B,ee,z,S))>-1;)B!==a&&Xl.call(B,z,1),Xl.call(a,z,1);return a}function Zx(a,u){for(var h=a?u.length:0,S=h-1;h--;){var P=u[h];if(h==S||P!==N){var N=P;bs(P)?Xl.call(a,P,1):fS(a,P)}}return a}function lS(a,u){return a+ya(yh()*(u-a+1))}function hM(a,u,h,S){for(var P=-1,N=Tt(ga((u-a)/(h||1)),0),L=Y(N);N--;)L[S?N:++P]=a,a+=h;return L}function uS(a,u){var h="";if(!a||u<1||u>Ve)return h;do u%2&&(h+=a),u=ya(u/2),u&&(a+=a);while(u);return h}function He(a,u){return ES(OE(a,u,Xr),a+"")}function mM(a){return xh(mu(a))}function gM(a,u){var h=mu(a);return Hh(h,Li(u,0,h.length))}function wf(a,u,h,S){if(!Ut(a))return a;u=co(u,a);for(var P=-1,N=u.length,L=N-1,B=a;B!=null&&++P<N;){var z=oi(u[P]),X=h;if(z==="__proto__"||z==="constructor"||z==="prototype")return a;if(P!=L){var ee=B[z];X=S?S(ee,z,B):t,X===t&&(X=Ut(ee)?ee:bs(u[P+1])?[]:{})}Dr(B,z,X),B=B[z]}return a}var Xx=iu?function(a,u){return iu.set(a,u),a}:Xr,yM=eu?function(a,u){return eu(a,"toString",{configurable:!0,enumerable:!1,value:FS(u),writable:!0})}:Xr;function vM(a){return Hh(mu(a))}function Dn(a,u,h){var S=-1,P=a.length;u<0&&(u=-u>P?0:P+u),h=h>P?P:h,h<0&&(h+=P),P=u>h?0:h-u>>>0,u>>>=0;for(var N=Y(P);++S<P;)N[S]=a[S+u];return N}function bM(a,u){var h;return Ui(a,function(S,P,N){return h=u(S,P,N),!h}),!!h}function Th(a,u,h){var S=0,P=a==null?S:a.length;if(typeof u=="number"&&u===u&&P<=Nt){for(;S<P;){var N=S+P>>>1,L=a[N];L!==null&&!vn(L)&&(h?L<=u:L<u)?S=N+1:P=N}return P}return cS(a,u,Xr,h)}function cS(a,u,h,S){var P=0,N=a==null?0:a.length;if(N===0)return 0;u=h(u);for(var L=u!==u,B=u===null,z=vn(u),X=u===t;P<N;){var ee=ya((P+N)/2),re=h(a[ee]),ue=re!==t,Se=re===null,Ee=re===re,je=vn(re);if(L)var Ce=S||Ee;else X?Ce=Ee&&(S||ue):B?Ce=Ee&&ue&&(S||!Se):z?Ce=Ee&&ue&&!Se&&(S||!je):Se||je?Ce=!1:Ce=S?re<=u:re<u;Ce?P=ee+1:N=ee}return sr(N,gt)}function eE(a,u){for(var h=-1,S=a.length,P=0,N=[];++h<S;){var L=a[h],B=u?u(L):L;if(!h||!ai(B,z)){var z=B;N[P++]=L===0?0:L}}return N}function tE(a){return typeof a=="number"?a:vn(a)?me:+a}function yn(a){if(typeof a=="string")return a;if(Ne(a))return qt(a,yn)+"";if(vn(a))return vh?vh.call(a):"";var u=a+"";return u=="0"&&1/a==-ce?"-0":u}function uo(a,u,h){var S=-1,P=Ul,N=a.length,L=!0,B=[],z=B;if(h)L=!1,P=Xs;else if(N>=r){var X=u?null:PM(a);if(X)return zl(X);L=!1,P=vt,z=new ms}else z=u?[]:B;e:for(;++S<N;){var ee=a[S],re=u?u(ee):ee;if(ee=h||ee!==0?ee:0,L&&re===re){for(var ue=z.length;ue--;)if(z[ue]===re)continue e;u&&z.push(re),B.push(ee)}else P(z,re,h)||(z!==B&&z.push(re),B.push(ee))}return B}function fS(a,u){u=co(u,a);var h=-1,S=u.length;if(!S)return!0;for(;++h<S;){var P=oi(u[h]);if(P==="__proto__"&&!ht.call(a,"__proto__")||(P==="constructor"||P==="prototype")&&h<S-1)return!1}var N=IE(a,u);return N==null||delete N[oi(jn(u))]}function rE(a,u,h,S){return wf(a,u,h(gs(a,u)),S)}function $h(a,u,h,S){for(var P=a.length,N=S?P:-1;(S?N--:++N<P)&&u(a[N],N,a););return h?Dn(a,S?0:N,S?N+1:P):Dn(a,S?N+1:0,S?P:N)}function nE(a,u){var h=a;return h instanceof ze&&(h=h.value()),sf(u,function(S,P){return P.func.apply(P.thisArg,Ni([S],P.args))},h)}function dS(a,u,h){var S=a.length;if(S<2)return S?uo(a[0]):[];for(var P=-1,N=Y(S);++P<S;)for(var L=a[P],B=-1;++B<S;)B!=P&&(N[P]=_a(N[P]||L,a[B],u,h));return uo(or(N,1),u,h)}function iE(a,u,h){for(var S=-1,P=a.length,N=u.length,L={};++S<P;){var B=S<N?u[S]:t;h(L,a[S],B)}return L}function pS(a){return Kt(a)?a:[]}function hS(a){return typeof a=="function"?a:Xr}function co(a,u){return Ne(a)?a:RS(a,u)?[a]:TE(_t(a))}var SM=He;function fo(a,u,h){var S=a.length;return h=h===t?S:h,!u&&h>=S?a:Dn(a,u,h)}var sE=Eb||function(a){return Xt.clearTimeout(a)};function oE(a,u){if(u)return a.slice();var h=a.length,S=dh?dh(h):new a.constructor(h);return a.copy(S),S}function mS(a){var u=new a.constructor(a.byteLength);return new Ql(u).set(new Ql(a)),u}function wM(a,u){var h=u?mS(a.buffer):a.buffer;return new a.constructor(h,a.byteOffset,a.byteLength)}function _M(a){var u=new a.constructor(a.source,jp.exec(a));return u.lastIndex=a.lastIndex,u}function RM(a){return wa?et(wa.call(a)):{}}function aE(a,u){var h=u?mS(a.buffer):a.buffer;return new a.constructor(h,a.byteOffset,a.length)}function lE(a,u){if(a!==u){var h=a!==t,S=a===null,P=a===a,N=vn(a),L=u!==t,B=u===null,z=u===u,X=vn(u);if(!B&&!X&&!N&&a>u||N&&L&&z&&!B&&!X||S&&L&&z||!h&&z||!P)return 1;if(!S&&!N&&!X&&a<u||X&&h&&P&&!S&&!N||B&&h&&P||!L&&P||!z)return-1}return 0}function CM(a,u,h){for(var S=-1,P=a.criteria,N=u.criteria,L=P.length,B=h.length;++S<L;){var z=lE(P[S],N[S]);if(z){if(S>=B)return z;var X=h[S];return z*(X=="desc"?-1:1)}}return a.index-u.index}function uE(a,u,h,S){for(var P=-1,N=a.length,L=h.length,B=-1,z=u.length,X=Tt(N-L,0),ee=Y(z+X),re=!S;++B<z;)ee[B]=u[B];for(;++P<L;)(re||P<N)&&(ee[h[P]]=a[P]);for(;X--;)ee[B++]=a[P++];return ee}function cE(a,u,h,S){for(var P=-1,N=a.length,L=-1,B=h.length,z=-1,X=u.length,ee=Tt(N-B,0),re=Y(ee+X),ue=!S;++P<ee;)re[P]=a[P];for(var Se=P;++z<X;)re[Se+z]=u[z];for(;++L<B;)(ue||P<N)&&(re[Se+h[L]]=a[P++]);return re}function Kr(a,u){var h=-1,S=a.length;for(u||(u=Y(S));++h<S;)u[h]=a[h];return u}function Hi(a,u,h,S){var P=!h;h||(h={});for(var N=-1,L=u.length;++N<L;){var B=u[N],z=S?S(h[B],a[B],B,h,a):t;z===t&&(z=a[B]),P?mn(h,B,z):Dr(h,B,z)}return h}function xM(a,u){return Hi(a,_S(a),u)}function EM(a,u){return Hi(a,RE(a),u)}function Nh(a,u){return function(h,S){var P=Ne(h)?ei:Eh,N=u?u():{};return P(h,a,xe(S,2),N)}}function fu(a){return He(function(u,h){var S=-1,P=h.length,N=P>1?h[P-1]:t,L=P>2?h[2]:t;for(N=a.length>3&&typeof N=="function"?(P--,N):t,L&&jr(h[0],h[1],L)&&(N=P<3?t:N,P=1),u=et(u);++S<P;){var B=h[S];B&&a(u,B,S,N)}return u})}function fE(a,u){return function(h,S){if(h==null)return h;if(!Qr(h))return a(h,S);for(var P=h.length,N=u?P:-1,L=et(h);(u?N--:++N<P)&&S(L[N],N,L)!==!1;);return h}}function dE(a){return function(u,h,S){for(var P=-1,N=et(u),L=S(u),B=L.length;B--;){var z=L[a?B:++P];if(h(N[z],z,N)===!1)break}return u}}function qM(a,u,h){var S=u&C,P=_f(a);function N(){var L=this&&this!==Xt&&this instanceof N?P:a;return L.apply(S?h:this,arguments)}return N}function pE(a){return function(u){u=_t(u);var h=eo(u)?Mr(u):t,S=h?h[0]:u.charAt(0),P=h?fo(h,1).join(""):u.slice(1);return S[a]()+P}}function du(a){return function(u){return sf(dq(fq(u).replace(zv,"")),a,"")}}function _f(a){return function(){var u=arguments;switch(u.length){case 0:return new a;case 1:return new a(u[0]);case 2:return new a(u[0],u[1]);case 3:return new a(u[0],u[1],u[2]);case 4:return new a(u[0],u[1],u[2],u[3]);case 5:return new a(u[0],u[1],u[2],u[3],u[4]);case 6:return new a(u[0],u[1],u[2],u[3],u[4],u[5]);case 7:return new a(u[0],u[1],u[2],u[3],u[4],u[5],u[6])}var h=so(a.prototype),S=a.apply(h,u);return Ut(S)?S:h}}function OM(a,u,h){var S=_f(a);function P(){for(var N=arguments.length,L=Y(N),B=N,z=pu(P);B--;)L[B]=arguments[B];var X=N<3&&L[0]!==z&&L[N-1]!==z?[]:$n(L,z);if(N-=X.length,N<h)return vE(a,u,Mh,P.placeholder,t,L,X,t,t,h-N);var ee=this&&this!==Xt&&this instanceof P?S:a;return Tr(ee,this,L)}return P}function hE(a){return function(u,h,S){var P=et(u);if(!Qr(u)){var N=xe(h,3);u=fr(u),h=function(B){return N(P[B],B,P)}}var L=a(u,h,S);return L>-1?P[N?u[L]:L]:t}}function mE(a){return vs(function(u){var h=u.length,S=h,P=Sr.prototype.thru;for(a&&u.reverse();S--;){var N=u[S];if(typeof N!="function")throw new Fr(i);if(P&&!L&&Lh(N)=="wrapper")var L=new Sr([],!0)}for(S=L?S:h;++S<h;){N=u[S];var B=Lh(N),z=B=="wrapper"?SS(N):t;z&&CS(z[0])&&z[1]==(j|q|O|I)&&!z[4].length&&z[9]==1?L=L[Lh(z[0])].apply(L,z[3]):L=N.length==1&&CS(N)?L[B]():L.thru(N)}return function(){var X=arguments,ee=X[0];if(L&&X.length==1&&Ne(ee))return L.plant(ee).value();for(var re=0,ue=h?u[re].apply(this,X):ee;++re<h;)ue=u[re].call(this,ue);return ue}})}function Mh(a,u,h,S,P,N,L,B,z,X){var ee=u&j,re=u&C,ue=u&v,Se=u&(q|k),Ee=u&R,je=ue?t:_f(a);function Ce(){for(var Ze=arguments.length,tt=Y(Ze),bn=Ze;bn--;)tt[bn]=arguments[bn];if(Se)var Lr=pu(Ce),Sn=lh(tt,Lr);if(S&&(tt=uE(tt,S,P,Se)),N&&(tt=cE(tt,N,L,Se)),Ze-=Sn,Se&&Ze<X){var Qt=$n(tt,Lr);return vE(a,u,Mh,Ce.placeholder,h,tt,Qt,B,z,X-Ze)}var li=re?h:this,_s=ue?li[a]:a;return Ze=tt.length,B?tt=GM(tt,B):Ee&&Ze>1&&tt.reverse(),ee&&z<Ze&&(tt.length=z),this&&this!==Xt&&this instanceof Ce&&(_s=je||_f(_s)),_s.apply(li,tt)}return Ce}function gE(a,u){return function(h,S){return oo(h,a,u(S),{})}}function Fh(a,u){return function(h,S){var P;if(h===t&&S===t)return u;if(h!==t&&(P=h),S!==t){if(P===t)return S;typeof h=="string"||typeof S=="string"?(h=yn(h),S=yn(S)):(h=tE(h),S=tE(S)),P=a(h,S)}return P}}function gS(a){return vs(function(u){return u=qt(u,Nr(xe())),He(function(h){var S=this;return a(u,function(P){return Tr(P,S,h)})})})}function Dh(a,u){u=u===t?" ":yn(u);var h=u.length;if(h<2)return h?uS(u,a):u;var S=uS(u,ga(a/Mi(u)));return eo(u)?fo(Mr(S),0,a).join(""):S.slice(0,a)}function IM(a,u,h,S){var P=u&C,N=_f(a);function L(){for(var B=-1,z=arguments.length,X=-1,ee=S.length,re=Y(ee+z),ue=this&&this!==Xt&&this instanceof L?N:a;++X<ee;)re[X]=S[X];for(;z--;)re[X++]=arguments[++B];return Tr(ue,P?h:this,re)}return L}function yE(a){return function(u,h,S){return S&&typeof S!="number"&&jr(u,h,S)&&(h=S=t),u=ws(u),h===t?(h=u,u=0):h=ws(h),S=S===t?u<h?1:-1:ws(S),hM(u,h,S,a)}}function jh(a){return function(u,h){return typeof u=="string"&&typeof h=="string"||(u=Ln(u),h=Ln(h)),a(u,h)}}function vE(a,u,h,S,P,N,L,B,z,X){var ee=u&q,re=ee?L:t,ue=ee?t:L,Se=ee?N:t,Ee=ee?t:N;u|=ee?O:M,u&=~(ee?M:O),u&_||(u&=~(C|v));var je=[a,u,P,Se,re,Ee,ue,B,z,X],Ce=h.apply(t,je);return CS(a)&&PE(Ce,je),Ce.placeholder=S,kE(Ce,a,u)}function yS(a){var u=bt[a];return function(h,S){if(h=Ln(h),S=S==null?0:sr(Fe(S),292),S&&hs(h)){var P=(_t(h)+"e").split("e"),N=u(P[0]+"e"+(+P[1]+S));return P=(_t(N)+"e").split("e"),+(P[0]+"e"+(+P[1]-S))}return u(h)}}var PM=no&&1/zl(new no([,-0]))[1]==ce?function(a){return new no(a)}:LS;function bE(a){return function(u){var h=_r(u);return h==At?to(u):h==be?uh(u):lb(u,a(u))}}function ys(a,u,h,S,P,N,L,B){var z=u&v;if(!z&&typeof a!="function")throw new Fr(i);var X=S?S.length:0;if(X||(u&=~(O|M),S=P=t),L=L===t?L:Tt(Fe(L),0),B=B===t?B:Fe(B),X-=P?P.length:0,u&M){var ee=S,re=P;S=P=t}var ue=z?t:SS(a),Se=[a,u,h,S,P,ee,re,N,L,B];if(ue&&WM(Se,ue),a=Se[0],u=Se[1],h=Se[2],S=Se[3],P=Se[4],B=Se[9]=Se[9]===t?z?0:a.length:Tt(Se[9]-X,0),!B&&u&(q|k)&&(u&=~(q|k)),!u||u==C)var Ee=qM(a,u,h);else u==q||u==k?Ee=OM(a,u,B):(u==O||u==(C|O))&&!P.length?Ee=IM(a,u,h,S):Ee=Mh.apply(t,Se);var je=ue?Xx:PE;return kE(je(Ee,Se),a,u)}function SE(a,u,h,S){return a===t||ai(a,ro[h])&&!ht.call(S,h)?u:a}function wE(a,u,h,S,P,N){return Ut(a)&&Ut(u)&&(N.set(u,a),er(a,u,t,wE,N),N.delete(u)),a}function kM(a){return xf(a)?t:a}function _E(a,u,h,S,P,N){var L=h&b,B=a.length,z=u.length;if(B!=z&&!(L&&z>B))return!1;var X=N.get(a),ee=N.get(u);if(X&&ee)return X==u&&ee==a;var re=-1,ue=!0,Se=h&E?new ms:t;for(N.set(a,u),N.set(u,a);++re<B;){var Ee=a[re],je=u[re];if(S)var Ce=L?S(je,Ee,re,u,a,N):S(Ee,je,re,a,u,N);if(Ce!==t){if(Ce)continue;ue=!1;break}if(Se){if(!Hl(u,function(Ze,tt){if(!vt(Se,tt)&&(Ee===Ze||P(Ee,Ze,h,S,N)))return Se.push(tt)})){ue=!1;break}}else if(!(Ee===je||P(Ee,je,h,S,N))){ue=!1;break}}return N.delete(a),N.delete(u),ue}function AM(a,u,h,S,P,N,L){switch(h){case yt:if(a.byteLength!=u.byteLength||a.byteOffset!=u.byteOffset)return!1;a=a.buffer,u=u.buffer;case pn:return!(a.byteLength!=u.byteLength||!N(new Ql(a),new Ql(u)));case Ar:case br:case Ai:return ai(+a,+u);case wt:return a.name==u.name&&a.message==u.message;case ye:case Ke:return a==u+"";case At:var B=to;case be:var z=S&b;if(B||(B=zl),a.size!=u.size&&!z)return!1;var X=L.get(a);if(X)return X==u;S|=E,L.set(a,u);var ee=_E(B(a),B(u),S,P,N,L);return L.delete(a),ee;case ur:if(wa)return wa.call(a)==wa.call(u)}return!1}function TM(a,u,h,S,P,N){var L=h&b,B=vS(a),z=B.length,X=vS(u),ee=X.length;if(z!=ee&&!L)return!1;for(var re=z;re--;){var ue=B[re];if(!(L?ue in u:ht.call(u,ue)))return!1}var Se=N.get(a),Ee=N.get(u);if(Se&&Ee)return Se==u&&Ee==a;var je=!0;N.set(a,u),N.set(u,a);for(var Ce=L;++re<z;){ue=B[re];var Ze=a[ue],tt=u[ue];if(S)var bn=L?S(tt,Ze,ue,u,a,N):S(Ze,tt,ue,a,u,N);if(!(bn===t?Ze===tt||P(Ze,tt,h,S,N):bn)){je=!1;break}Ce||(Ce=ue=="constructor")}if(je&&!Ce){var Lr=a.constructor,Sn=u.constructor;Lr!=Sn&&"constructor"in a&&"constructor"in u&&!(typeof Lr=="function"&&Lr instanceof Lr&&typeof Sn=="function"&&Sn instanceof Sn)&&(je=!1)}return N.delete(a),N.delete(u),je}function vs(a){return ES(OE(a,t,FE),a+"")}function vS(a){return kh(a,fr,_S)}function bS(a){return kh(a,Zr,RE)}var SS=iu?function(a){return iu.get(a)}:LS;function Lh(a){for(var u=a.name+"",h=io[u],S=ht.call(io,u)?h.length:0;S--;){var P=h[S],N=P.func;if(N==null||N==a)return P.name}return u}function pu(a){var u=ht.call($,"placeholder")?$:a;return u.placeholder}function xe(){var a=$.iteratee||DS;return a=a===DS?x:a,arguments.length?a(arguments[0],arguments[1]):a}function Uh(a,u){var h=a.__data__;return UM(u)?h[typeof u=="string"?"string":"hash"]:h.map}function wS(a){for(var u=fr(a),h=u.length;h--;){var S=u[h],P=a[S];u[h]=[S,P,EE(P)]}return u}function xa(a,u){var h=ca(a,u);return Qe(h)?h:t}function $M(a){var u=ht.call(a,ps),h=a[ps];try{a[ps]=t;var S=!0}catch{}var P=Yl.call(a);return S&&(u?a[ps]=h:delete a[ps]),P}var _S=tu?function(a){return a==null?[]:(a=et(a),$i(tu(a),function(u){return ha.call(a,u)}))}:US,RE=tu?function(a){for(var u=[];a;)Ni(u,_S(a)),a=Zl(a);return u}:US,_r=dr;(ff&&_r(new ff(new ArrayBuffer(1)))!=yt||va&&_r(new va)!=At||df&&_r(df.resolve())!=ne||no&&_r(new no)!=be||ba&&_r(new ba)!=ge)&&(_r=function(a){var u=dr(a),h=u==te?a.constructor:t,S=h?Ea(h):"";if(S)switch(S){case kb:return yt;case Ab:return At;case Tb:return ne;case $b:return be;case Nb:return ge}return u});function NM(a,u,h){for(var S=-1,P=h.length;++S<P;){var N=h[S],L=N.size;switch(N.type){case"drop":a+=L;break;case"dropRight":u-=L;break;case"take":u=sr(u,a+L);break;case"takeRight":a=Tt(a,u-L);break}}return{start:a,end:u}}function MM(a){var u=a.match(Qn);return u?u[1].split(An):[]}function CE(a,u,h){u=co(u,a);for(var S=-1,P=u.length,N=!1;++S<P;){var L=oi(u[S]);if(!(N=a!=null&&h(a,L)))break;a=a[L]}return N||++S!=P?N:(P=a==null?0:a.length,!!P&&Gh(P)&&bs(L,P)&&(Ne(a)||qa(a)))}function FM(a){var u=a.length,h=new a.constructor(u);return u&&typeof a[0]=="string"&&ht.call(a,"index")&&(h.index=a.index,h.input=a.input),h}function xE(a){return typeof a.constructor=="function"&&!Rf(a)?so(Zl(a)):{}}function DM(a,u,h){var S=a.constructor;switch(u){case pn:return mS(a);case Ar:case br:return new S(+a);case yt:return wM(a,h);case qe:case Pn:case Il:case zs:case ea:case Js:case Ti:case Gs:case Bc:return aE(a,h);case At:return new S;case Ai:case Ke:return new S(a);case ye:return _M(a);case be:return new S;case ur:return RM(a)}}function jM(a,u){var h=u.length;if(!h)return a;var S=h-1;return u[S]=(h>1?"& ":"")+u[S],u=u.join(h>2?", ":" "),a.replace(cr,`{
|
|
1
|
+
"use strict";var a2=Object.create;var Kh=Object.defineProperty;var l2=Object.getOwnPropertyDescriptor;var u2=Object.getOwnPropertyNames;var c2=Object.getPrototypeOf,f2=Object.prototype.hasOwnProperty;var ae=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var V=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Rs=(t,e)=>{for(var r in e)Kh(t,r,{get:e[r],enumerable:!0})},gq=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of u2(e))!f2.call(t,i)&&i!==r&&Kh(t,i,{get:()=>e[i],enumerable:!(n=l2(e,i))||n.enumerable});return t};var ve=(t,e,r)=>(r=t!=null?a2(c2(t)):{},gq(e||!t||!t.__esModule?Kh(r,"default",{value:t,enumerable:!0}):r,t)),Oa=t=>gq(Kh({},"__esModule",{value:!0}),t);function Ht(t){return t.replace(/[^a-zA-Z0-9-_]/g,"_").replace(/\s+/g,"-").toLowerCase().substring(0,100)}function Ot(t){let e=Date.now().toString(36)+(d2++).toString(36)+Math.random().toString(36).slice(2,7);return t?`${Ht(t)}_${e}`:e}function Qh(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function gu(t,e){let r={},n={};for(let[i,s]of Object.entries(t)){let o=i.toLowerCase();n[o]=i,r[i]=s}for(let[i,s]of Object.entries(e)){let o=i.toLowerCase(),l=n[o];l&&delete r[l],n[o]=i,r[i]=s}return r}function yq(t){return JSON.parse(JSON.stringify(t))}function vq(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function bq(t,e){try{return JSON.parse(t)}catch{return e}}function Sq(t){if(t===0)return"0 B";let e=1024,r=["B","KB","MB","GB"],n=Math.floor(Math.log(t)/Math.log(e));return`${parseFloat((t/Math.pow(e,n)).toFixed(1))} ${r[n]}`}function wq(t){return t<1e3?`${t} ms`:`${(t/1e3).toFixed(2)} s`}var d2,Un=ae(()=>{"use strict";d2=0});function qf(t){if(!mt.existsSync(t))return;let e={},r=wn.join(t,Ef.preRequest);mt.existsSync(r)&&(e.preRequest=mt.readFileSync(r,"utf-8"));let n=wn.join(t,Ef.postResponse);return mt.existsSync(n)&&(e.postResponse=mt.readFileSync(n,"utf-8")),Object.keys(e).length>0?e:void 0}async function Of(t,e){await mt.promises.mkdir(t,{recursive:!0});let r=wn.join(t,Ef.preRequest);e.preRequest?await mt.promises.writeFile(r,e.preRequest,"utf-8"):mt.existsSync(r)&&await mt.promises.unlink(r);let n=wn.join(t,Ef.postResponse);e.postResponse?await mt.promises.writeFile(n,e.postResponse,"utf-8"):mt.existsSync(n)&&await mt.promises.unlink(n)}function VS(t){for(let[e,r]of Object.entries(BS)){let n=wn.join(t,e);if(mt.existsSync(n))try{let i=mt.readFileSync(n,"utf-8"),s;if(r.type==="graphql")try{s=JSON.parse(i)}catch{s=i}else s=i;return{type:r.type,format:r.format,content:s}}catch(i){console.error(`[FolderIO] Failed to load body from ${n}:`,i)}}}function WS(t){if(!t||t.type==="none")return{bodyForMetadata:t};if(t.type==="raw"){let e=t.format||"json",n={json:"body.json",xml:"body.xml",text:"body.txt",html:"body.html",javascript:"body.js"}[e];if(n){let i=e==="json"?typeof t.content=="string"?t.content:JSON.stringify(t.content,null,2):String(t.content||"");return{bodyForMetadata:{type:t.type,format:t.format},externalBodyFile:{filename:n,content:i}}}}if(t.type==="graphql"){let e=typeof t.content=="string"?t.content:JSON.stringify(t.content,null,2);return{bodyForMetadata:{type:t.type},externalBodyFile:{filename:"body.graphql",content:e}}}return{bodyForMetadata:t}}async function zS(t,e){for(let r of Object.keys(BS))if(r!==e){let n=wn.join(t,r);if(mt.existsSync(n))try{await mt.promises.unlink(n)}catch{}}}function JS(t){if(mt.existsSync(t))try{let e=mt.readFileSync(t,"utf-8");return JSON.parse(e)}catch(e){console.error(`[FolderIO] Failed to load schema file ${t}:`,e);return}}async function GS(t,e,r){let n=wn.join(t,yu.responseSchema),i=wn.join(t,yu.bodySchema);e?await mt.promises.writeFile(n,JSON.stringify(e,null,2),"utf-8"):mt.existsSync(n)&&await mt.promises.unlink(n),r?await mt.promises.writeFile(i,JSON.stringify(r,null,2),"utf-8"):mt.existsSync(i)&&await mt.promises.unlink(i)}function Zh(t,e){for(let r of t){if(r.id===e)return r;if(r.type==="folder"&&r.items){let n=Zh(r.items,e);if(n)return n}}}function Xh(t,e){for(let r=0;r<t.length;r++){let n=t[r];if(n.id===e)return t.splice(r,1),!0;if(n.type==="folder"&&n.items&&Xh(n.items,e))return!0}return!1}function YS(t,e){let r=new Map(t.map(i=>[i.id,i])),n=[];for(let i of e){let s=r.get(i);s&&(n.push(s),r.delete(i))}for(let i of r.values())n.push(i);return n}function em(t,e){let r;try{r=mt.readdirSync(t,{withFileTypes:!0})}catch{return}for(let n of r){if(!n.isDirectory()||n.name===en)continue;if(n.name===e)return wn.join(t,n.name);let i=em(wn.join(t,n.name),e);if(i)return i}}function p2(t){for(let e of[Rr.request,Rr.folder]){let r=wn.join(t,e);if(mt.existsSync(r))try{let n=mt.readFileSync(r,"utf-8");return JSON.parse(n).id}catch{return}}}function tm(t,e){let r;try{r=mt.readdirSync(t,{withFileTypes:!0})}catch{return}for(let n of r){if(!n.isDirectory()||n.name===en)continue;let i=wn.join(t,n.name);if(p2(i)===e)return i;let s=tm(i,e);if(s)return s}}function _n(t,e=[]){let r=t.toLowerCase().trim(),n=r.match(/^(get|post|put|patch|delete|head|options)[_\s-]/i),i=n?n[1]:"",s=r.match(/t(\d+)/gi)||[],o=0;for(let y of s){let b=parseInt(y.substring(1));b>o&&(o=b)}let l="";if(o>0)l=`t${o}`;else{let y=r.match(/[_\s-](\d+\.\d+)[_\s-]/);y&&(l=`v${y[1].replace(".","_")}`)}let c=r;n&&(c=c.substring(n[0].length)),c=c.replace(/[_\s-]?t\d+(?:\.\d+)?[_\s-]?/gi,"-"),c=c.replace(/[_\s-]?\d+\.\d+[_\s-]?/g,"-"),c=c.replace(/\([^)]+\)/g,""),c=c.replace(/:[a-z_][a-z0-9_]*/gi,""),c=c.replace(/\{[^}]+\}/g,""),c=c.replace(/\?$/g,"").replace(/[_/\\ ]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"");let d=c.split("-").filter(y=>y.length>0),p=[];i&&p.push(i),p.push(...d),l&&p.push(l);let m=p.join("-");if(m||(m="item"),e.includes(m)){let y=2;for(;e.includes(`${m}-${y}`);)y++;m=`${m}-${y}`}return m}var mt,wn,Ef,Rr,BS,yu,en,Pa=ae(()=>{"use strict";mt=ve(require("fs")),wn=ve(require("path")),Ef={preRequest:"pre-request.js",postResponse:"post-response.js"},Rr={collection:"collection.json",folder:"folder.json",request:"request.json"},BS={"body.json":{type:"raw",format:"json"},"body.xml":{type:"raw",format:"xml"},"body.txt":{type:"raw",format:"text"},"body.html":{type:"raw",format:"html"},"body.js":{type:"raw",format:"javascript"},"body.graphql":{type:"graphql"}},yu={responseSchema:"response.schema.json",bodySchema:"body.schema.json"},en="scripts"});var Me,Le,Cs,rm=ae(()=>{"use strict";Me=ve(require("fs")),Le=ve(require("path"));Un();Pa();Cs=class{collectionsDir;cache=new Map;slugToIdMap=new Map;idToSlugMap=new Map;constructor(e){this.collectionsDir=e,this.ensureDirectory()}getSlugById(e){return this.idToSlugMap.get(e)}getIdBySlug(e){return this.slugToIdMap.get(e)}ensureDirectory(){Me.existsSync(this.collectionsDir)||Me.mkdirSync(this.collectionsDir,{recursive:!0})}readJsonFileSafe(e,r){let n;try{n=Me.readFileSync(e,"utf-8")}catch(i){console.error(`[FolderCollectionStore] Failed to read ${r} ${e}:`,i);return}if(n.trim().length!==0)try{return JSON.parse(n)}catch(i){if(i instanceof SyntaxError&&/Unexpected end of JSON input/.test(i.message))return;console.error(`[FolderCollectionStore] Failed to parse ${r} ${e}:`,i);return}}loadAll(){if(this.cache.clear(),this.slugToIdMap.clear(),this.idToSlugMap.clear(),!Me.existsSync(this.collectionsDir))return[];let e=Me.readdirSync(this.collectionsDir,{withFileTypes:!0}),r=[];for(let n of e)if(n.isDirectory())try{let i=this.loadCollectionFromFolder(n.name);i&&(this.cache.set(i.id,i),this.slugToIdMap.set(n.name,i.id),this.idToSlugMap.set(i.id,n.name),r.push(i))}catch(i){console.error(`[FolderCollectionStore] Failed to load ${n.name}:`,i)}return r}loadCollectionFromFolder(e){let r=Le.join(this.collectionsDir,e),n=Le.join(r,Rr.collection);if(!Me.existsSync(n))return;let i=this.readJsonFileSafe(n,"collection");if(i)try{let s=this.loadScriptsFromDir(Le.join(r,en)),o=this.loadItemsFromDir(r,i.id,i.order);return{id:i.id,name:i.name,description:i.description,version:i.version,variables:i.variables,auth:i.auth,scripts:s,items:o}}catch(s){console.error(`[FolderCollectionStore] Failed to parse ${n}:`,s);return}}loadItemsFromDir(e,r,n){let i=[],s=new Map,o=Me.readdirSync(e,{withFileTypes:!0});for(let l of o){if(!l.isDirectory()||l.name===en)continue;let c=Le.join(e,l.name);if(Me.existsSync(Le.join(c,Rr.folder))){let d=this.loadFolderFromDir(c,l.name);d&&s.set(l.name,d)}else if(Me.existsSync(Le.join(c,Rr.request))){let d=this.loadRequestFromDir(c,l.name);d&&s.set(l.name,d)}}if(n&&n.length>0){for(let l of n){let c=s.get(l);c&&(i.push(c),s.delete(l))}for(let l of s.values())i.push(l)}else for(let l of s.values())i.push(l);return i}loadFolderFromDir(e,r){let n=Le.join(e,Rr.folder),i=this.readJsonFileSafe(n,"folder");if(i)try{let s=this.loadScriptsFromDir(Le.join(e,en)),o=this.loadItemsFromDir(e,i.id,i.order);return this.slugToIdMap.set(r,i.id),this.idToSlugMap.set(i.id,r),{id:i.id,type:"folder",name:i.name,description:i.description,auth:i.auth,scripts:s,items:o}}catch(s){console.error(`[FolderCollectionStore] Failed to load folder ${e}:`,s);return}}loadRequestFromDir(e,r){let n=Le.join(e,Rr.request),i=this.readJsonFileSafe(n,"request");if(i)try{let s=this.loadScriptsFromDir(Le.join(e,en)),o=i.body,l=this.loadBodyFromDir(e);l&&(o=l);let c=this.loadSchemaFile(Le.join(e,yu.responseSchema)),d=this.loadSchemaFile(Le.join(e,yu.bodySchema)),p=Le.join(e,"doc.md"),m=Me.existsSync(p)?Me.readFileSync(p,"utf-8"):void 0;return this.slugToIdMap.set(r,i.id),this.idToSlugMap.set(i.id,r),{id:i.id,type:"request",name:i.name,description:i.description,method:i.method,url:i.url,params:i.params,query:i.query,headers:i.headers,body:o,bodyContentType:i.bodyContentType,auth:i.auth,settings:i.settings,scripts:s,disabled:i.disabled,deprecated:i.deprecated,operationId:i.operationId,summary:i.summary,tags:i.tags,examples:i.examples,responses:i.responses,security:i.security,...m&&{doc:m},...c&&{responseSchema:c},...d&&{bodySchema:d}}}catch(s){console.error(`[FolderCollectionStore] Failed to load request ${e}:`,s);return}}loadScriptsFromDir(e){return qf(e)}loadBodyFromDir(e){return VS(e)}loadSchemaFile(e){return JS(e)}async saveSchemaFiles(e,r){return GS(e,r.responseSchema,r.bodySchema)}load(e){if(this.cache.has(e))return this.cache.get(e);let r=this.idToSlugMap.get(e);if(r){let n=this.loadCollectionFromFolder(r);return n&&this.cache.set(e,n),n}return this.loadAll(),this.cache.get(e)}async save(e){if(this.ensureDirectory(),!e.name)throw new Error("Collection name is required");e.id||(e.id=Ot(e.name));let r=this.idToSlugMap.get(e.id);if(!r){let l=Me.readdirSync(this.collectionsDir);r=_n(e.name,l),this.idToSlugMap.set(e.id,r),this.slugToIdMap.set(r,e.id)}let n=Le.join(this.collectionsDir,r),i=!Me.existsSync(n);await Me.promises.mkdir(n,{recursive:!0});let s={id:e.id,name:e.name,description:e.description,version:e.version,variables:e.variables,auth:e.auth},[o]=await Promise.all([this.saveItemsToDir(n,e.items,i),e.scripts?this.saveScriptsToDir(Le.join(n,en),e.scripts):Promise.resolve()]);o.length>0&&(s.order=o),await Me.promises.writeFile(Le.join(n,Rr.collection),JSON.stringify(s,null,2),"utf-8"),this.cache.set(e.id,e)}async saveItemsToDir(e,r,n=!1){let i=[],s=[];for(let o of r){let l=this.idToSlugMap.get(o.id);l||(l=_n(o.name,i),this.idToSlugMap.set(o.id,l),this.slugToIdMap.set(l,o.id)),i.push(l),s.push({item:o,slug:l})}return await Promise.all(s.map(async({item:o,slug:l})=>{let c=Le.join(e,l);await Me.promises.mkdir(c,{recursive:!0}),o.type==="folder"?await this.saveFolderToDir(c,o,n):await this.saveRequestToDir(c,o,n)})),i}async saveFolderToDir(e,r,n=!1){let i={id:r.id,name:r.name,description:r.description,auth:r.auth},[s]=await Promise.all([r.items?this.saveItemsToDir(e,r.items,n):Promise.resolve([]),r.scripts?this.saveScriptsToDir(Le.join(e,en),r.scripts):Promise.resolve()]);s.length>0&&(i.order=s),await Me.promises.writeFile(Le.join(e,Rr.folder),JSON.stringify(i,null,2),"utf-8")}async saveRequestToDir(e,r,n=!1){let{bodyForMetadata:i,externalBodyFile:s}=this.prepareBodyForSave(r.body),o={id:r.id,name:r.name,method:r.method||"GET",url:r.url||"",description:r.description,params:r.params,query:r.query,headers:r.headers,body:i,bodyContentType:r.bodyContentType,auth:r.auth,settings:r.settings,...r.disabled!==void 0&&{disabled:r.disabled},...r.deprecated&&{deprecated:r.deprecated},...r.operationId&&{operationId:r.operationId},...r.summary&&{summary:r.summary},...r.tags&&r.tags.length>0&&{tags:r.tags},...r.examples&&r.examples.length>0&&{examples:r.examples},...r.responses&&Object.keys(r.responses).length>0&&{responses:r.responses},...r.security&&r.security.length>0&&{security:r.security}},l=[Me.promises.writeFile(Le.join(e,Rr.request),JSON.stringify(o,null,2),"utf-8")];s&&l.push(Me.promises.writeFile(Le.join(e,s.filename),s.content,"utf-8")),n||l.push(this.cleanupOldBodyFiles(e,s?.filename)),(!n||r.responseSchema||r.bodySchema)&&l.push(this.saveSchemaFiles(e,r)),r.doc&&l.push(Me.promises.writeFile(Le.join(e,"doc.md"),r.doc,"utf-8")),r.scripts&&l.push(this.saveScriptsToDir(Le.join(e,en),r.scripts)),await Promise.all(l)}prepareBodyForSave(e){return WS(e)}async cleanupOldBodyFiles(e,r){return zS(e,r)}async saveScriptsToDir(e,r){return Of(e,r)}async delete(e){let r=this.idToSlugMap.get(e);if(!r&&(this.loadAll(),r=this.idToSlugMap.get(e),!r))return!1;let n=Le.join(this.collectionsDir,r);if(!Me.existsSync(n))return!1;try{return await Me.promises.rm(n,{recursive:!0,force:!0}),this.cache.delete(e),this.idToSlugMap.delete(e),this.slugToIdMap.delete(r),!0}catch(i){return console.error(`[FolderCollectionStore] Failed to delete collection ${e}:`,i),!1}}exists(e){let r=this.idToSlugMap.get(e);return r?Me.existsSync(Le.join(this.collectionsDir,r,Rr.collection)):!1}getCollectionPath(e){let r=this.idToSlugMap.get(e)||e;return Le.join(this.collectionsDir,r)}getItemPath(e,r){return this.findItemPath(e,r)}async create(e,r){let n={id:r||Ot(e),name:e,items:[]};return await this.save(n),n}async saveScripts(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.findItemPath(e,r);if(!s)throw new Error(`Item ${r} not found in collection ${e}`);await this.saveScriptsToDir(Le.join(s,en),n);let o=this.findItemById(i.items,r);o&&(o.scripts=n)}loadScripts(e,r){let n=this.findItemPath(e,r);if(n)return this.loadScriptsFromDir(Le.join(n,en))}async updateCollectionMetadata(e,r){let n=this.load(e);if(!n)throw new Error(`Collection ${e} not found`);let i=this.idToSlugMap.get(e);if(!i)throw new Error(`Collection slug not found for ${e}`);let s=Le.join(this.collectionsDir,i),o=Le.join(s,Rr.collection),l=Me.readFileSync(o,"utf-8"),d={...JSON.parse(l),...r,id:e};await Me.promises.writeFile(o,JSON.stringify(d,null,2),"utf-8"),r.name!==void 0&&(n.name=r.name),r.description!==void 0&&(n.description=r.description),r.version!==void 0&&(n.version=r.version),r.variables!==void 0&&(n.variables=r.variables),r.auth!==void 0&&(n.auth=r.auth)}async saveItem(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.idToSlugMap.get(e);if(!s)throw new Error(`Collection slug not found for ${e}`);let o;if(n){let p=this.findItemPath(e,n);if(!p)throw new Error(`Parent folder ${n} not found`);o=p}else o=Le.join(this.collectionsDir,s);let l=this.idToSlugMap.get(r.id);if(!l){let p=Me.readdirSync(o).filter(m=>Me.statSync(Le.join(o,m)).isDirectory()&&m!==en);l=_n(r.name,p),this.idToSlugMap.set(r.id,l),this.slugToIdMap.set(l,r.id)}let c=Le.join(o,l);await Me.promises.mkdir(c,{recursive:!0}),r.type==="folder"?await this.saveFolderToDir(c,r):await this.saveRequestToDir(c,r);let d=this.findItemById(i.items,r.id);if(d)Object.assign(d,r);else if(n){let p=this.findItemById(i.items,n);p&&p.type==="folder"&&(p.items=p.items||[],p.items.push(r))}else i.items.push(r)}async deleteItem(e,r){let n=this.load(e);if(!n)return!1;let i=this.findItemPath(e,r);if(!i||!Me.existsSync(i))return!1;try{await Me.promises.rm(i,{recursive:!0,force:!0}),this.deleteItemFromTree(n.items,r);let s=this.idToSlugMap.get(r);return s&&(this.slugToIdMap.delete(s),this.idToSlugMap.delete(r)),!0}catch(s){return console.error(`[FolderCollectionStore] Failed to delete item ${r}:`,s),!1}}async updateItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.findItemPath(e,r);if(!s)return!1;let o=this.findItemById(i.items,r);if(!o)return!1;let{id:l,type:c,items:d,...p}=n;return Object.assign(o,p),o.type==="folder"?await this.saveFolderToDir(s,o):await this.saveRequestToDir(s,o),!0}async moveItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.idToSlugMap.get(e);if(!s)return!1;let o=this.findItemPath(e,r);if(!o||!Me.existsSync(o))return!1;let l;if(n){let p=this.findItemPath(e,n);if(!p)return!1;l=p}else l=Le.join(this.collectionsDir,s);let c=this.idToSlugMap.get(r);if(!c)return!1;let d=Le.join(l,c);if(Me.existsSync(d))return!1;try{await Me.promises.rename(o,d);let p=this.findItemById(i.items,r);if(p){let m=p.type==="folder"?{...p,items:p.items?[...p.items]:[]}:{...p};if(this.deleteItemFromTree(i.items,r),n){let y=this.findItemById(i.items,n);y&&y.type==="folder"&&(y.items=y.items||[],y.items.push(m))}else i.items.push(m)}return!0}catch(p){return console.error(`[FolderCollectionStore] Failed to move item ${r}:`,p),!1}}async reorderItems(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.idToSlugMap.get(e);if(!s)return!1;let o=[];for(let l of n){let c=this.idToSlugMap.get(l);c&&o.push(c)}try{if(r){let l=this.findItemPath(e,r);if(!l)return!1;let c=Le.join(l,Rr.folder),d=Me.readFileSync(c,"utf-8"),p=JSON.parse(d);p.order=o,await Me.promises.writeFile(c,JSON.stringify(p,null,2),"utf-8");let m=this.findItemById(i.items,r);m&&m.type==="folder"&&m.items&&(m.items=this.sortItemsByOrder(m.items,n))}else{let l=Le.join(this.collectionsDir,s,Rr.collection),c=Me.readFileSync(l,"utf-8"),d=JSON.parse(c);d.order=o,await Me.promises.writeFile(l,JSON.stringify(d,null,2),"utf-8"),i.items=this.sortItemsByOrder(i.items,n)}return!0}catch(l){return console.error("[FolderCollectionStore] Failed to reorder items:",l),!1}}sortItemsByOrder(e,r){return YS(e,r)}findItemPath(e,r){let n=this.idToSlugMap.get(e);if(!n)return;let i=Le.join(this.collectionsDir,n),s=tm(i,r);if(s)return s;let o=this.load(e);if(o){let c=this.buildSlugPath(o.items,r);if(c)return Le.join(i,...c)}let l=this.idToSlugMap.get(r);if(l)return em(i,l)}buildSlugPath(e,r){for(let n of e){let i=this.idToSlugMap.get(n.id);if(i){if(n.id===r)return[i];if(n.type==="folder"&&n.items){let s=this.buildSlugPath(n.items,r);if(s)return[i,...s]}}}}findItemById(e,r){return Zh(e,r)}deleteItemFromTree(e,r){return Xh(e,r)}}});var Rt,ka=ae(()=>{"use strict";Rt=class{static parseSetCookie(e,r){let n=e.split(";").map(p=>p.trim());if(n.length===0)return null;let[i,...s]=n,o=i.indexOf("=");if(o===-1)return null;let l=i.substring(0,o).trim(),c=i.substring(o+1).trim(),d={name:l,value:c,domain:r};for(let p of s){let m=p.indexOf("="),y=(m===-1?p:p.substring(0,m)).toLowerCase(),b=m===-1?"":p.substring(m+1);switch(y){case"domain":d.domain=b.startsWith(".")?b.substring(1):b;break;case"path":d.path=b;break;case"expires":d.expires=b;break;case"max-age":d.maxAge=parseInt(b,10);break;case"httponly":d.httpOnly=!0;break;case"secure":d.secure=!0;break;case"samesite":d.sameSite=b;break}}return d}static parseCookieHeaders(e,r){let n=[],i=e["set-cookie"]||e["Set-Cookie"];if(!i)return n;let s=Array.isArray(i)?i:[i];for(let o of s){let l=this.parseSetCookie(o,r);l&&n.push(l)}return n}static formatCookieHeader(e){return e.map(r=>`${r.name}=${r.value}`).join("; ")}static isExpired(e){return!!(e.expires&&new Date(e.expires).getTime()<Date.now()||e.maxAge!==void 0&&e.maxAge<=0)}static domainMatches(e,r){if(r==="*")return!0;let n=e.toLowerCase().split(".").reverse(),i=r.toLowerCase().split(".").reverse();if(i.length>n.length)return!1;for(let s=0;s<i.length;s++)if(i[s]!==n[s])return!1;return!0}static extractDomain(e){try{return new URL(e).hostname}catch{return""}}static extractPath(e){try{return new URL(e).pathname}catch{return"/"}}}});function If(t){let e=t.toLowerCase();return e==="_global.json"||e==="_global.local.json"||e.endsWith(".local.json")}function wu(t){if(!ho.existsSync(t))return m2();let e=nm(Aa.join(t,"_global.json"))||{},r=e.variables||{},n=e.defaultHeaders||{},i=ho.readdirSync(t).filter(d=>d.endsWith(".json")).filter(d=>!d.endsWith(".local.json")).filter(d=>!If(d)),s={};for(let d of i){let p=nm(Aa.join(t,d))||{},m=Aa.basename(d,".json");s[m]={description:p.description,requiresConfirmation:p.requiresConfirmation,variables:p.variables||{},secretVariables:p.secretVariables}}let l=(nm(Aa.join(t,"_global.local.json"))||{}).variables||{},c={};for(let d of Object.keys(s)){let p=Aa.join(t,`${d}.local.json`);if(ho.existsSync(p)){let m=nm(p)||{};c[d]={variables:m.variables||{}}}}return{globalVariables:r,defaultHeaders:n,environments:s,localVariables:l,localCredentials:c}}function m2(){return{globalVariables:{},defaultHeaders:{},environments:{},localVariables:{},localCredentials:{}}}function nm(t){try{if(!ho.existsSync(t))return null;let e=ho.readFileSync(t,"utf-8");return JSON.parse(e)}catch(e){return console.error(`[environment-file-loader] Failed to load JSON from ${t}:`,e),null}}var ho,Aa,im=ae(()=>{"use strict";ho=ve(require("fs")),Aa=ve(require("path"))});var Hn,_u=ae(()=>{"use strict";Hn=class{buildUrl(e,r={},n={}){let i=e;return i=this.replacePathParams(i,r),i=this.appendQueryParams(i,n),i}replacePathParams(e,r){let n="",i="",s=e,o="",l=e.indexOf("?");l!==-1&&(o=e.substring(l),s=e.substring(0,l));let c=s.match(/^(https?:\/\/)([^\/]*)(\/.*)?$/);c&&(n=c[1],i=c[2],s=c[3]||"/");let d=/:(\w+)(?:\([^)]*\))?(\?)?/g,p=s.replace(d,(m,y,b)=>{let q=r[y];return q!==void 0&&q!==""?encodeURIComponent(q):b?"":(console.warn(`[UrlBuilder] Missing required path parameter: ${y}`),m)});return p=p.replace(/([^:])\/+/g,"$1/"),p.length>1&&p.endsWith("/")&&(p=p.slice(0,-1)),`${n}${i}${p}${o}`}extractPathParams(e){let r=/:(\w+)(?:\([^)]*\))?(\?)?/g,n=[],i;for(;(i=r.exec(e))!==null;)n.push(i[1]);return[...new Set(n)]}appendQueryParams(e,r){let n=e,i={};if(e.includes("?")){let[c,d]=e.split("?");n=c,d&&new URLSearchParams(d).forEach((m,y)=>{i[y]=m})}let s={...i,...r},o=new URLSearchParams;for(let[c,d]of Object.entries(s))d!=null&&o.append(c,d);let l=o.toString();return l?`${n}?${l}`:n}}});function Rq(t,e=0){return(pr[t[e+0]]+pr[t[e+1]]+pr[t[e+2]]+pr[t[e+3]]+"-"+pr[t[e+4]]+pr[t[e+5]]+"-"+pr[t[e+6]]+pr[t[e+7]]+"-"+pr[t[e+8]]+pr[t[e+9]]+"-"+pr[t[e+10]]+pr[t[e+11]]+pr[t[e+12]]+pr[t[e+13]]+pr[t[e+14]]+pr[t[e+15]]).toLowerCase()}var pr,Cq=ae(()=>{pr=[];for(let t=0;t<256;++t)pr.push((t+256).toString(16).slice(1))});function ZS(){return crypto.getRandomValues(g2)}var g2,xq=ae(()=>{g2=new Uint8Array(16)});function y2(t,e,r){return!e&&!t&&crypto.randomUUID?crypto.randomUUID():v2(t,e,r)}function v2(t,e,r){t=t||{};let n=t.random??t.rng?.()??ZS();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[r+i]=n[i];return e}return Rq(n)}var Ru,Eq=ae(()=>{xq();Cq();Ru=y2});var XS=ae(()=>{Eq()});function b2(t=0,e=999){return Math.floor(Math.random()*(e-t+1))+t}function S2(){return Date.now()}function qq(){return Ru()}function w2(){return Ru()}function Oq(t=10){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="";for(let n=0;n<t;n++)r+=e.charAt(Math.floor(Math.random()*e.length));return r}function _2(){let t=Oq(8).toLowerCase(),e=["example.com","test.org","mail.dev","sample.net"];return`${t}@${e[Math.floor(Math.random()*e.length)]}`}function R2(){return Math.random()<.5}function C2(t=10){let e="0123456789abcdef",r="";for(let n=0;n<t;n++)r+=e.charAt(Math.floor(Math.random()*e.length));return r}function x2(){return Math.floor(Date.now()/1e3)}function E2(){return new Date().toISOString()}function q2(){return new Date().toISOString().split("T")[0]}function O2(){return new Date().toISOString().split("T")[1].split(".")[0]}function I2(){return new Date().toISOString()}function P2(t=""){return Buffer.from(String(t)).toString("base64")}function k2(t=""){return Buffer.from(String(t),"base64").toString("utf-8")}function A2(t=""){return encodeURIComponent(String(t))}function T2(t=""){return decodeURIComponent(String(t))}function $2(t){return t?t.split(",").map(e=>{let r=e.trim(),n=Number(r);return!isNaN(n)&&r!==""?n:r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'")?r.slice(1,-1):r}):[]}function Vi(t,e){let r=ew[t];return r?e&&e.length>0?r(...e):r():null}function Iq(t){return!t||typeof t!="string"?t:t.replace(/\{\{\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?\}\}/g,(e,r,n)=>{try{let i=n?$2(n):void 0,s=Vi(r,i);return s===null?e:String(s)}catch{return e}})}function mo(t,e){let r=/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,n=null,i;for(;(i=r.exec(t))!==null;){let s=i[0],o=i[1];if(!(s in e)){let l=Vi(o);l!==null&&(n||(n={...e}),n[s]=l)}}return n??e}var ew,sm=ae(()=>{"use strict";XS();ew={randomInt:b2,timestamp:S2,guid:w2,uuid:qq,randomUUID:qq,randomString:Oq,randomHexadecimal:C2,randomEmail:_2,randomBoolean:R2,isoTimestamp:I2,timestamp_s:x2,datetime:E2,date:q2,time:O2,base64Encode:P2,base64Decode:k2,urlEncode:A2,urlDecode:T2}});function go(t){let e=t.trim();return!e||/^(\$?)[a-zA-Z_][a-zA-Z0-9_]*(\([^)]*\))?$/.test(e)||/(?<!\|)\|(?!\|)/.test(e)?!1:/[+\-*/%<>=!&|?:~^()[\]{}.,`]/.test(e)}function ui(t,e={}){try{let r={...e,Math,Date,JSON,Number,String,Boolean,Array,Object,parseInt,parseFloat,isNaN,isFinite,encodeURIComponent,decodeURIComponent,encodeURI,decodeURI,undefined:void 0,null:null,true:!0,false:!1,NaN:NaN,Infinity:1/0},n=om.createContext(r);return om.runInContext(t,n,{timeout:N2,displayErrors:!1})}catch{return}}var om,N2,Pf=ae(()=>{"use strict";om=ve(require("vm")),N2=100});function M2(t){if(typeof t=="string"&&t.charCodeAt(0)===30)try{return JSON.parse(t.slice(1))}catch{return t}return t}function Cu(t){if(!t||!t.includes("|"))return null;let e=F2(t);if(e.length<2)return null;let r=e[0].trim(),n=[];for(let i=1;i<e.length;i++){let s=e[i].trim();if(!s)continue;let o=D2(s);o&&n.push(o)}return n.length===0?null:{input:r,filters:n}}function F2(t){let e=[],r="",n=0,i=!1,s=!1;for(let o=0;o<t.length;o++){let l=t[o],c=o>0?t[o-1]:"",d=o<t.length-1?t[o+1]:"";if(c==="\\"){r+=l;continue}if(l==="'"&&!s)i=!i;else if(l==='"'&&!i)s=!s;else if(l==="("&&!i&&!s)n++;else if(l===")"&&!i&&!s)n--;else if(l==="|"&&n===0&&!i&&!s){if(d==="|"){r+="||",o++;continue}e.push(r),r="";continue}r+=l}return r&&e.push(r),e}function D2(t){let e=t.indexOf("(");if(e===-1)return{name:t.trim(),args:[]};let r=t.substring(0,e).trim(),n=t.substring(e+1,t.lastIndexOf(")"));return{name:r,args:j2(n)}}function j2(t){if(!t||!t.trim())return[];let e=[],r="",n=!1,i=!1;for(let s=0;s<t.length;s++){let o=t[s];if((s>0?t[s-1]:"")==="\\"){r+=o;continue}if(o==="'"&&!i){n=!n,r+=o;continue}else if(o==='"'&&!n){i=!i,r+=o;continue}else if(o===","&&!n&&!i){e.push(r.trim()),r="";continue}r+=o}return r.trim()&&e.push(r.trim()),e}function Wt(t,e){if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);let r=Number(t);if(!isNaN(r)&&t!=="")return r;if(t==="true")return!0;if(t==="false")return!1;if(e&&t in e){let n=M2(e[t]),i=Number(n);return!isNaN(i)&&n!==""?i:n}return t}function xu(t,e,r={}){let n=t;for(let i of e)n=L2(n,i.name,i.args,r);return n}function L2(t,e,r,n){switch(e){case"upper":return String(t).toUpperCase();case"lower":return String(t).toLowerCase();case"trim":return String(t).trim();case"length":return Array.isArray(t)?t.length:String(t).length;case"substring":{let i=Wt(r[0],n),s=r[1]!==void 0?Wt(r[1],n):void 0;return String(t).substring(i<0?String(t).length+i:i,s!==void 0?s<0?String(t).length+s:s:void 0)}case"replace":{let i=r[0]!==void 0?String(Wt(r[0],n)):"",s=r[1]!==void 0?String(Wt(r[1],n)):"";return String(t).replace(new RegExp(H2(i),"g"),s)}case"split":{let i=r[0]!==void 0?String(Wt(r[0],n)):",";return String(t).split(i)}case"join":{let i=r[0]!==void 0?String(Wt(r[0],n)):",";return Array.isArray(t)?t.join(i):String(t)}case"removeQuotes":return String(t).replace(/["']/g,"");case"removeSpaces":return String(t).replace(/\s/g,"");case"format":{let i=r[0]!==void 0?String(Wt(r[0],n)):"{0}";i=i.replace("{0}",String(t));for(let s=1;s<r.length;s++){let o=Wt(r[s],n);i=i.replace(`{${s}}`,String(o))}return i}case"add":{let i=Wt(r[0],n);return Number(t)+i}case"subtract":{let i=Wt(r[0],n);return Number(t)-i}case"multiply":{let i=Wt(r[0],n);return Number(t)*i}case"abs":return Math.abs(Number(t));case"btoa":return Buffer.from(String(t)).toString("base64");case"atob":return Buffer.from(String(t),"base64").toString("utf-8");case"urlEncode":return encodeURIComponent(String(t));case"urlDecode":return decodeURIComponent(String(t));case"hash":{let i=String(r[0]!==void 0?Wt(r[0],n):"md5").toLowerCase(),s=String(r[1]!==void 0?Wt(r[1],n):"base64"),l={md5:"md5",sha1:"sha1",sha256:"sha256",sha512:"sha512"}[i]||"md5";return am.createHash(l).update(String(t)).digest(s)}case"hmac":{let i=r[0]?String(Wt(r[0],n)):"",s=String(r[1]!==void 0?Wt(r[1],n):"sha256").toLowerCase(),o=String(r[2]!==void 0?Wt(r[2],n):"base64"),c={md5:"md5",sha1:"sha1",sha256:"sha256",sha512:"sha512"}[s]||"sha256";return am.createHmac(c,i).update(String(t)).digest(o)}case"first":return Array.isArray(t)?t[0]:t;case"last":return Array.isArray(t)?t[t.length-1]:t;case"at":{let i=Wt(r[0],n);return Array.isArray(t)?t.at(i):t}case"slice":{let i=Wt(r[0],n),s=r[1]!==void 0?Wt(r[1],n):void 0;return Array.isArray(t)?t.slice(i,s):String(t).slice(i,s)}case"unique":return Array.isArray(t)?[...new Set(t)]:t;case"filter":return!Array.isArray(t)||!r[0]?t:U2(t,r[0],n);case"map":{if(!Array.isArray(t))return t;let i=r.map(s=>String(Wt(s,n)));return i.length===1?t.map(s=>kf(s,i[0])):t.map(s=>{let o={};for(let l of i){let c=kf(s,l);c!==void 0&&(o[l]=c)}return o})}case"prop":{let i=r[0]!==void 0?String(Wt(r[0],n)):"";if(Array.isArray(t)){let s=t.map(o=>kf(o,i)).filter(o=>o!==void 0);return s.length===1?s[0]:s.join(",")}return t&&typeof t=="object"?kf(t,i):t}case"parseJSON":try{return JSON.parse(String(t))}catch{return t}case"stringify":try{return JSON.stringify(t)}catch{return String(t)}case"isEmail":return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t));case"isUrl":try{return new URL(String(t)),!0}catch{return!1}case"setIfValue":return t||void 0;case"setNull":return t===null?null:t;default:return t}}function U2(t,e,r){let n=e.match(/^([\w.]+)\s*(>=|<=|!=|\*=|\^=|\$=|>|<|=)\s*(.+)$/);if(!n)return t;let[,i,s,o]=n,l=Wt(o,r);return t.filter(c=>{let d=kf(c,i);if(d===void 0)return!1;switch(s){case">":return Number(d)>Number(l);case">=":return Number(d)>=Number(l);case"<":return Number(d)<Number(l);case"<=":return Number(d)<=Number(l);case"=":return String(d)===String(l);case"!=":return String(d)!==String(l);case"*=":return String(d).includes(String(l));case"^=":return String(d).startsWith(String(l));case"$=":return String(d).endsWith(String(l));default:return!0}})}function kf(t,e){if(!(!t||typeof t!="object"))return e in t?t[e]:e.split(".").reduce((r,n)=>r?.[n],t)}function H2(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var am,lm=ae(()=>{"use strict";am=ve(require("crypto"))});function Pq(t,e){if(t)return t.split(",").map(r=>{let n=r.trim();if(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))return n.slice(1,-1);let i=Number(n);if(!isNaN(i)&&n!=="")return i;if(e&&n in e){let s=e[n],o=Number(s);return!isNaN(o)&&s!==""?o:s}return n})}function kq(t){return new yo(t)}var yo,vo,Af=ae(()=>{"use strict";sm();Pf();lm();yo=class t{allVariables;static MAX_RESOLUTION_DEPTH=20;constructor(e){this.allVariables={...e.globals,...e.collectionVariables,...e.environmentVariables,...e.variables}}resolveString(e,r=!1){return typeof e!="string"?e:this.resolveUntilStable(e,this.allVariables,r)}resolveStringWithExtra(e,r,n=!1){if(typeof e!="string")return e;let i={...this.allVariables,...r};return this.resolveUntilStable(e,i,n)}resolveUntilStable(e,r,n){let i=e;for(let s=0;s<t.MAX_RESOLUTION_DEPTH;s++){let o=this.resolveSinglePass(i,r,n);if(o===i)break;i=o}return i}resolveSinglePass(e,r,n){if(!n)return e.replace(/\{\{((?:[^}]|\}(?!\}))+)\}\}/g,(c,d)=>this.resolveTemplateContent(d.trim(),r,c));let i="",s=0,o=/\{\{((?:[^}]|\}(?!\}))+)\}\}/g,l;for(;(l=o.exec(e))!==null;){let c=l[1].trim(),d=this.resolveTemplateContent(c,r,l[0]);if(d!==l[0]){i+=e.slice(s,l.index);let p=this.getStringContext(e,l.index);i+=p?this.escapeForString(String(d),p):String(d)}else i+=e.slice(s,l.index+l[0].length);s=l.index+l[0].length}return i+=e.slice(s),i}resolveObject(e,r=!1){if(typeof e=="string")return this.resolveString(e,r);if(Array.isArray(e))return e.map(n=>this.resolveObject(n,r));if(e!==null&&typeof e=="object"){let n={};for(let[i,s]of Object.entries(e))n[i]=this.resolveObject(s,r);return n}return e}resolveObjectWithExtra(e,r,n=!1){if(typeof e=="string")return this.resolveStringWithExtra(e,r,n);if(Array.isArray(e))return e.map(i=>this.resolveObjectWithExtra(i,r,n));if(e!==null&&typeof e=="object"){let i={};for(let[s,o]of Object.entries(e))i[s]=this.resolveObjectWithExtra(o,r,n);return i}return e}resolveTemplateContent(e,r,n){let i=e.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(i){let l=Pq(i[2],r),c=Vi(i[1],l);return c!==null?String(c):n}let s=Cu(e);if(s){let l=this.resolveFilterInput(s.input,r);if(l!==void 0){let c=xu(l,s.filters,r);return c!==void 0?String(c):n}return n}let o=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(\[.+\]|\..+)$/);if(o){let l=o[1];if(r[l]!==void 0){let c=this.deserializeValue(r[l]),d=o[2],p=this.resolvePropertyAccess(c,d);if(p!==void 0)return typeof p=="object"?JSON.stringify(p):String(p)}}if(r[e]!==void 0){let l=r[e];if(typeof l=="string"&&l.charCodeAt(0)===30){let c=l.slice(1);return c==="undefined"?"":c}return String(l)}if(go(e)){let l=this.deserializeVariables(r),c=mo(e,l),d=ui(e,c);if(d!==void 0)return String(d)}return n}resolveFilterInput(e,r){if(e==="@")return"";if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1);let n=e.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(n){let s=Pq(n[2],r),o=Vi(n[1],s);return o!==null?o:void 0}let i=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(\[.+\]|\..+)$/);if(i){let s=i[1];if(r[s]!==void 0){let o=this.deserializeValue(r[s]),l=this.resolvePropertyAccess(o,i[2]);if(l!==void 0)return l}}if(r[e]!==void 0)return this.deserializeValue(r[e]);if(go(e)){let s=this.deserializeVariables(r),o=mo(e,s),l=ui(e,o);if(l!==void 0)return l}}deserializeValue(e){if(typeof e=="string"&&e.charCodeAt(0)===30){let r=e.slice(1);if(r==="undefined")return;try{return JSON.parse(r)}catch{return e}}return e}deserializeVariables(e){let r={};for(let[n,i]of Object.entries(e))r[n]=this.deserializeValue(i);return r}resolvePropertyAccess(e,r){let n=e,i=/\[(\d+|"[^"]*"|'[^']*')\]|\.([a-zA-Z_][a-zA-Z0-9_]*)/g,s;for(;(s=i.exec(r))!==null;){if(n==null)return;if(s[1]!==void 0){let o=s[1];/^\d+$/.test(o)?n=n[Number(o)]:n=n[o.slice(1,-1)]}else s[2]!==void 0&&(n=n[s[2]])}return n}escapeForString(e,r){let n=e.replace(/\\/g,"\\\\");return r==='"'?n=n.replace(/"/g,'\\"'):n=n.replace(/'/g,"\\'"),n.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}getStringContext(e,r){let n=null;for(let i=0;i<r;i++){let s=e[i];(i>0?e[i-1]:"")!=="\\"&&(s==='"'||s==="'")&&(n===null?n=s:n===s&&(n=null))}return n}},vo=class{interpolate(e,r){return!e||typeof e!="string"?e:new yo({globals:{},collectionVariables:{},environmentVariables:{},variables:r}).resolveString(e,!0)}extractVariables(e){if(!e||typeof e!="string")return[];let r=[],n,i=/\{\{((?:[^}]|\}(?!\}))+)\}\}/g;for(;(n=i.exec(e))!==null;){let s=n[1].trim();!s.startsWith("$")&&!s.includes("|")&&/^[a-zA-Z_]\w*$/.test(s)&&(r.includes(s)||r.push(s))}return r}interpolateObject(e,r){if(e==null)return e;if(typeof e=="string")return this.interpolate(e,r);if(Array.isArray(e))return e.map(n=>this.interpolateObject(n,r));if(typeof e=="object"){let n={};for(let[i,s]of Object.entries(e))n[i]=this.interpolateObject(s,r);return n}return e}}});var Wi,Tf=ae(()=>{"use strict";Wi=class{constructor(e,r,n){this.urlBuilder=e;this.interceptors=r;this.httpClient=n}urlBuilder;interceptors;httpClient;async execute(e){let r={},n;try{n=await this.interceptors.executeRequestInterceptors(e,r)}catch(i){let s=await this.interceptors.executeErrorInterceptors(i,e,r);if(s)return s;throw i}try{let i=await this.httpClient.send(n);return await this.interceptors.executeResponseInterceptors(i,n,r)}catch(i){let s=await this.interceptors.executeErrorInterceptors(i,n,r);if(s)return s;throw i}}buildUrl(e,r={},n={}){return this.urlBuilder.buildUrl(e,r,n)}}});var zi,um,cm,fm,$f=ae(()=>{"use strict";zi=class{requestInterceptors=[];responseInterceptors=[];errorInterceptors=[];addRequestInterceptor(e){return this.requestInterceptors.push(e),this.sortByPriority(this.requestInterceptors),this}addResponseInterceptor(e){return this.responseInterceptors.push(e),this.sortByPriority(this.responseInterceptors),this}addErrorInterceptor(e){return this.errorInterceptors.push(e),this.sortByPriority(this.errorInterceptors),this}removeRequestInterceptor(e){let r=this.requestInterceptors.findIndex(n=>n.name===e);return r>=0?(this.requestInterceptors.splice(r,1),!0):!1}removeResponseInterceptor(e){let r=this.responseInterceptors.findIndex(n=>n.name===e);return r>=0?(this.responseInterceptors.splice(r,1),!0):!1}removeErrorInterceptor(e){let r=this.errorInterceptors.findIndex(n=>n.name===e);return r>=0?(this.errorInterceptors.splice(r,1),!0):!1}async executeRequestInterceptors(e,r){let n=e;for(let i of this.requestInterceptors)try{n=await i.intercept(n,r)}catch(s){throw console.error(`[InterceptorChain] Request interceptor '${i.name}' failed:`,s),s}return n}async executeResponseInterceptors(e,r,n){let i=e;for(let s of this.responseInterceptors)try{i=await s.intercept(i,r,n)}catch(o){throw console.error(`[InterceptorChain] Response interceptor '${s.name}' failed:`,o),o}return i}async executeErrorInterceptors(e,r,n){for(let i of this.errorInterceptors)try{let s=await i.handle(e,r,n);if(s)return s}catch(s){console.error(`[InterceptorChain] Error interceptor '${i.name}' failed:`,s)}}clear(){this.requestInterceptors=[],this.responseInterceptors=[],this.errorInterceptors=[]}getRegisteredInterceptors(){return{request:this.requestInterceptors.map(e=>e.name),response:this.responseInterceptors.map(e=>e.name),error:this.errorInterceptors.map(e=>e.name)}}sortByPriority(e){e.sort((r,n)=>(r.priority??100)-(n.priority??100))}},um=class{name="logging";priority=1e3;intercept(e,r){return e}},cm=class{name="timing";priority=1;intercept(e,r,n){return e}},fm=class{name="retry";priority=1;maxRetries;retryableErrors;constructor(e=3,r=["ECONNRESET","ETIMEDOUT"]){this.maxRetries=e,this.retryableErrors=r}handle(e,r,n){let i=this.retryableErrors.some(s=>e.message.includes(s))}}});var Aq=V((Eu,Nf)=>{(function(){var t,e="4.18.1",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",s="Invalid `variable` option passed into `_.template`",o="Invalid `imports` option passed into `_.template`",l="__lodash_hash_undefined__",c=500,d="__lodash_placeholder__",p=1,m=2,y=4,b=1,q=2,C=1,v=2,_=4,E=8,k=16,O=32,M=64,j=128,I=256,R=512,A=30,F="...",U=800,D=16,J=1,Q=2,se=3,ce=1/0,Ve=9007199254740991,Re=17976931348623157e292,me=NaN,Ae=4294967295,gt=Ae-1,Nt=Ae>>>1,pe=[["ary",j],["bind",C],["bindKey",v],["curry",E],["curryRight",k],["flip",R],["partial",O],["partialRight",M],["rearg",I]],Gt="[object Arguments]",kr="[object Array]",ut="[object AsyncFunction]",Ar="[object Boolean]",br="[object Date]",xt="[object DOMException]",wt="[object Error]",zr="[object Function]",Ws="[object GeneratorFunction]",At="[object Map]",Ai="[object Number]",On="[object Null]",te="[object Object]",ne="[object Promise]",Pe="[object Proxy]",ye="[object RegExp]",be="[object Set]",Ke="[object String]",ur="[object Symbol]",Te="[object Undefined]",ge="[object WeakMap]",In="[object WeakSet]",pn="[object ArrayBuffer]",yt="[object DataView]",qe="[object Float32Array]",Pn="[object Float64Array]",Il="[object Int8Array]",zs="[object Int16Array]",ea="[object Int32Array]",Js="[object Uint8Array]",Ti="[object Uint8ClampedArray]",Gs="[object Uint16Array]",Bc="[object Uint32Array]",Pl=/\b__p \+= '';/g,Ov=/\b(__p \+=) '' \+/g,ta=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ls=/&(?:amp|lt|gt|quot|#39);/g,kl=/[&<>"']/g,Al=RegExp(ls.source),he=RegExp(kl.source),Iv=/<%-([\s\S]+?)%>/g,Pv=/<%([\s\S]+?)%>/g,kn=/<%=([\s\S]+?)%>/g,Jr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,We=/^\w*$/,Vc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,dt=/[\\^$.*+?()[\]{}|]/g,ra=RegExp(dt.source),Wc=/^\s+/,Tl=/\s/,cr=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Qn=/\{\n\/\* \[wrapped with (.+)\] \*/,An=/,? & /,Yt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Gr=/[()=,{}\[\]\/\s]/,Zn=/\\(\\)?/g,us=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,jp=/\w*$/,kv=/^[-+]0x[0-9a-f]+$/i,na=/^0b[01]+$/i,Lp=/^\[object .+?Constructor\]$/,Av=/^0o[0-7]+$/i,Ys=/^(?:0|[1-9]\d*)$/,ia=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,sa=/($^)/,Tv=/['\n\r\u2028\u2029\\]/g,$l="\\ud800-\\udfff",$v="\\u0300-\\u036f",Lt="\\ufe20-\\ufe2f",zc="\\u20d0-\\u20ff",Up=$v+Lt+zc,Jc="\\u2700-\\u27bf",Gc="a-z\\xdf-\\xf6\\xf8-\\xff",Nv="\\xac\\xb1\\xd7\\xf7",Mv="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Fv="\\u2000-\\u206f",Dv=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Hp="A-Z\\xc0-\\xd6\\xd8-\\xde",Bp="\\ufe0e\\ufe0f",Yc=Nv+Mv+Fv+Dv,Nl="['\u2019]",jv="["+$l+"]",Vp="["+Yc+"]",Ml="["+Up+"]",Kc="\\d+",Lv="["+Jc+"]",Ks="["+Gc+"]",oa="[^"+$l+Yc+Kc+Jc+Gc+Hp+"]",Fl="\\ud83c[\\udffb-\\udfff]",aa="(?:"+Ml+"|"+Fl+")",Tn="[^"+$l+"]",Qc="(?:\\ud83c[\\udde6-\\uddff]){2}",Zc="[\\ud800-\\udbff][\\udc00-\\udfff]",Qs="["+Hp+"]",Wp="\\u200d",zp="(?:"+Ks+"|"+oa+")",Uv="(?:"+Qs+"|"+oa+")",Jp="(?:"+Nl+"(?:d|ll|m|re|s|t|ve))?",Gp="(?:"+Nl+"(?:D|LL|M|RE|S|T|VE))?",Dl=aa+"?",Yp="["+Bp+"]?",Kp="(?:"+Wp+"(?:"+[Tn,Qc,Zc].join("|")+")"+Yp+Dl+")*",Hv="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Bv="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Qp=Yp+Dl+Kp,Vv="(?:"+[Lv,Qc,Zc].join("|")+")"+Qp,Wv="(?:"+[Tn+Ml+"?",Ml,Qc,Zc,jv].join("|")+")",zv=RegExp(Nl,"g"),Jv=RegExp(Ml,"g"),Xc=RegExp(Fl+"(?="+Fl+")|"+Wv+Qp,"g"),Gv=RegExp([Qs+"?"+Ks+"+"+Jp+"(?="+[Vp,Qs,"$"].join("|")+")",Uv+"+"+Gp+"(?="+[Vp,Qs+zp,"$"].join("|")+")",Qs+"?"+zp+"+"+Jp,Qs+"+"+Gp,Bv,Hv,Kc,Vv].join("|"),"g"),Yv=RegExp("["+Wp+$l+Up+Bp+"]"),Kv=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Qv=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Zv=-1,Pt={};Pt[qe]=Pt[Pn]=Pt[Il]=Pt[zs]=Pt[ea]=Pt[Js]=Pt[Ti]=Pt[Gs]=Pt[Bc]=!0,Pt[Gt]=Pt[kr]=Pt[pn]=Pt[Ar]=Pt[yt]=Pt[br]=Pt[wt]=Pt[zr]=Pt[At]=Pt[Ai]=Pt[te]=Pt[ye]=Pt[be]=Pt[Ke]=Pt[ge]=!1;var Et={};Et[Gt]=Et[kr]=Et[pn]=Et[yt]=Et[Ar]=Et[br]=Et[qe]=Et[Pn]=Et[Il]=Et[zs]=Et[ea]=Et[At]=Et[Ai]=Et[te]=Et[ye]=Et[be]=Et[Ke]=Et[ur]=Et[Js]=Et[Ti]=Et[Gs]=Et[Bc]=!0,Et[wt]=Et[zr]=Et[ge]=!1;var ef={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},tf={"&":"&","<":"<",">":">",'"':""","'":"'"},Xv={"&":"&","<":"<",">":">",""":'"',"'":"'"},Zp={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Xp=parseFloat,eb=parseInt,eh=typeof global=="object"&&global&&global.Object===Object&&global,tb=typeof self=="object"&&self&&self.Object===Object&&self,Xt=eh||tb||Function("return this")(),jl=typeof Eu=="object"&&Eu&&!Eu.nodeType&&Eu,pt=jl&&typeof Nf=="object"&&Nf&&!Nf.nodeType&&Nf,Zs=pt&&pt.exports===jl,cs=Zs&&eh.process,Yr=(function(){try{var W=pt&&pt.require&&pt.require("util").types;return W||cs&&cs.binding&&cs.binding("util")}catch{}})(),rf=Yr&&Yr.isArrayBuffer,th=Yr&&Yr.isDate,rh=Yr&&Yr.isMap,la=Yr&&Yr.isRegExp,Xn=Yr&&Yr.isSet,Ll=Yr&&Yr.isTypedArray;function Tr(W,Z,Y){switch(Y.length){case 0:return W.call(Z);case 1:return W.call(Z,Y[0]);case 2:return W.call(Z,Y[0],Y[1]);case 3:return W.call(Z,Y[0],Y[1],Y[2])}return W.apply(Z,Y)}function ei(W,Z,Y,de){for(var Ie=-1,ct=W==null?0:W.length;++Ie<ct;){var bt=W[Ie];Z(de,bt,Y(bt),W)}return de}function $r(W,Z){for(var Y=-1,de=W==null?0:W.length;++Y<de&&Z(W[Y],Y,W)!==!1;);return W}function nf(W,Z){for(var Y=W==null?0:W.length;Y--&&Z(W[Y],Y,W)!==!1;);return W}function nh(W,Z){for(var Y=-1,de=W==null?0:W.length;++Y<de;)if(!Z(W[Y],Y,W))return!1;return!0}function $i(W,Z){for(var Y=-1,de=W==null?0:W.length,Ie=0,ct=[];++Y<de;){var bt=W[Y];Z(bt,Y,W)&&(ct[Ie++]=bt)}return ct}function Ul(W,Z){var Y=W==null?0:W.length;return!!Y&&fs(W,Z,0)>-1}function Xs(W,Z,Y){for(var de=-1,Ie=W==null?0:W.length;++de<Ie;)if(Y(Z,W[de]))return!0;return!1}function qt(W,Z){for(var Y=-1,de=W==null?0:W.length,Ie=Array(de);++Y<de;)Ie[Y]=Z(W[Y],Y,W);return Ie}function Ni(W,Z){for(var Y=-1,de=Z.length,Ie=W.length;++Y<de;)W[Ie+Y]=Z[Y];return W}function sf(W,Z,Y,de){var Ie=-1,ct=W==null?0:W.length;for(de&&ct&&(Y=W[++Ie]);++Ie<ct;)Y=Z(Y,W[Ie],Ie,W);return Y}function rb(W,Z,Y,de){var Ie=W==null?0:W.length;for(de&&Ie&&(Y=W[--Ie]);Ie--;)Y=Z(Y,W[Ie],Ie,W);return Y}function Hl(W,Z){for(var Y=-1,de=W==null?0:W.length;++Y<de;)if(Z(W[Y],Y,W))return!0;return!1}var nb=ua("length");function ib(W){return W.split("")}function sb(W){return W.match(Yt)||[]}function ih(W,Z,Y){var de;return Y(W,function(Ie,ct,bt){if(Z(Ie,ct,bt))return de=ct,!1}),de}function Bl(W,Z,Y,de){for(var Ie=W.length,ct=Y+(de?1:-1);de?ct--:++ct<Ie;)if(Z(W[ct],ct,W))return ct;return-1}function fs(W,Z,Y){return Z===Z?hb(W,Z,Y):Bl(W,ds,Y)}function ob(W,Z,Y,de){for(var Ie=Y-1,ct=W.length;++Ie<ct;)if(de(W[Ie],Z))return Ie;return-1}function ds(W){return W!==W}function sh(W,Z){var Y=W==null?0:W.length;return Y?af(W,Z)/Y:me}function ua(W){return function(Z){return Z==null?t:Z[W]}}function of(W){return function(Z){return W==null?t:W[Z]}}function Vl(W,Z,Y,de,Ie){return Ie(W,function(ct,bt,et){Y=de?(de=!1,ct):Z(Y,ct,bt,et)}),Y}function ab(W,Z){var Y=W.length;for(W.sort(Z);Y--;)W[Y]=W[Y].value;return W}function af(W,Z){for(var Y,de=-1,Ie=W.length;++de<Ie;){var ct=Z(W[de]);ct!==t&&(Y=Y===t?ct:Y+ct)}return Y}function lf(W,Z){for(var Y=-1,de=Array(W);++Y<W;)de[Y]=Z(Y);return de}function lb(W,Z){return qt(Z,function(Y){return[Y,W[Y]]})}function uf(W){return W&&W.slice(0,ch(W)+1).replace(Wc,"")}function Nr(W){return function(Z){return W(Z)}}function Wl(W,Z){return qt(Z,function(Y){return W[Y]})}function vt(W,Z){return W.has(Z)}function oh(W,Z){for(var Y=-1,de=W.length;++Y<de&&fs(Z,W[Y],0)>-1;);return Y}function ah(W,Z){for(var Y=W.length;Y--&&fs(Z,W[Y],0)>-1;);return Y}function lh(W,Z){for(var Y=W.length,de=0;Y--;)W[Y]===Z&&++de;return de}var ub=of(ef),cb=of(tf);function fb(W){return"\\"+Zp[W]}function ca(W,Z){return W==null?t:W[Z]}function eo(W){return Yv.test(W)}function db(W){return Kv.test(W)}function pb(W){for(var Z,Y=[];!(Z=W.next()).done;)Y.push(Z.value);return Y}function to(W){var Z=-1,Y=Array(W.size);return W.forEach(function(de,Ie){Y[++Z]=[Ie,de]}),Y}function fa(W,Z){return function(Y){return W(Z(Y))}}function $n(W,Z){for(var Y=-1,de=W.length,Ie=0,ct=[];++Y<de;){var bt=W[Y];(bt===Z||bt===d)&&(W[Y]=d,ct[Ie++]=Y)}return ct}function zl(W){var Z=-1,Y=Array(W.size);return W.forEach(function(de){Y[++Z]=de}),Y}function uh(W){var Z=-1,Y=Array(W.size);return W.forEach(function(de){Y[++Z]=[de,de]}),Y}function hb(W,Z,Y){for(var de=Y-1,Ie=W.length;++de<Ie;)if(W[de]===Z)return de;return-1}function cf(W,Z,Y){for(var de=Y+1;de--;)if(W[de]===Z)return de;return de}function Mi(W){return eo(W)?gb(W):nb(W)}function Mr(W){return eo(W)?yb(W):ib(W)}function ch(W){for(var Z=W.length;Z--&&Tl.test(W.charAt(Z)););return Z}var mb=of(Xv);function gb(W){for(var Z=Xc.lastIndex=0;Xc.test(W);)++Z;return Z}function yb(W){return W.match(Xc)||[]}function vb(W){return W.match(Gv)||[]}var bb=(function W(Z){Z=Z==null?Xt:Fi.defaults(Xt.Object(),Z,Fi.pick(Xt,Qv));var Y=Z.Array,de=Z.Date,Ie=Z.Error,ct=Z.Function,bt=Z.Math,et=Z.Object,Jl=Z.RegExp,Sb=Z.String,Fr=Z.TypeError,da=Y.prototype,wb=ct.prototype,ro=et.prototype,pa=Z["__core-js_shared__"],Gl=wb.toString,ht=ro.hasOwnProperty,_b=0,fh=(function(){var a=/[^.]+$/.exec(pa&&pa.keys&&pa.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})(),Yl=ro.toString,Rb=Gl.call(et),Cb=Xt._,xb=Jl("^"+Gl.call(ht).replace(dt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Kl=Zs?Z.Buffer:t,Di=Z.Symbol,Ql=Z.Uint8Array,dh=Kl?Kl.allocUnsafe:t,Zl=fa(et.getPrototypeOf,et),ph=et.create,ha=ro.propertyIsEnumerable,Xl=da.splice,hh=Di?Di.isConcatSpreadable:t,ma=Di?Di.iterator:t,ps=Di?Di.toStringTag:t,eu=(function(){try{var a=xa(et,"defineProperty");return a({},"",{}),a}catch{}})(),Eb=Z.clearTimeout!==Xt.clearTimeout&&Z.clearTimeout,qb=de&&de.now!==Xt.Date.now&&de.now,Ob=Z.setTimeout!==Xt.setTimeout&&Z.setTimeout,ga=bt.ceil,ya=bt.floor,tu=et.getOwnPropertySymbols,ru=Kl?Kl.isBuffer:t,hs=Z.isFinite,nu=da.join,mh=fa(et.keys,et),Tt=bt.max,sr=bt.min,gh=de.now,Ib=Z.parseInt,yh=bt.random,Pb=da.reverse,ff=xa(Z,"DataView"),va=xa(Z,"Map"),df=xa(Z,"Promise"),no=xa(Z,"Set"),ba=xa(Z,"WeakMap"),Sa=xa(et,"create"),iu=ba&&new ba,io={},kb=Ea(ff),Ab=Ea(va),Tb=Ea(df),$b=Ea(no),Nb=Ea(ba),su=Di?Di.prototype:t,wa=su?su.valueOf:t,vh=su?su.toString:t;function $(a){if(Vt(a)&&!Ne(a)&&!(a instanceof ze)){if(a instanceof Sr)return a;if(ht.call(a,"__wrapped__"))return $E(a)}return new Sr(a)}var so=(function(){function a(){}return function(u){if(!Ut(u))return{};if(ph)return ph(u);a.prototype=u;var h=new a;return a.prototype=t,h}})();function ou(){}function Sr(a,u){this.__wrapped__=a,this.__actions__=[],this.__chain__=!!u,this.__index__=0,this.__values__=t}$.templateSettings={escape:Iv,evaluate:Pv,interpolate:kn,variable:"",imports:{_:$}},$.prototype=ou.prototype,$.prototype.constructor=$,Sr.prototype=so(ou.prototype),Sr.prototype.constructor=Sr;function ze(a){this.__wrapped__=a,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Ae,this.__views__=[]}function Mb(){var a=new ze(this.__wrapped__);return a.__actions__=Kr(this.__actions__),a.__dir__=this.__dir__,a.__filtered__=this.__filtered__,a.__iteratees__=Kr(this.__iteratees__),a.__takeCount__=this.__takeCount__,a.__views__=Kr(this.__views__),a}function Fb(){if(this.__filtered__){var a=new ze(this);a.__dir__=-1,a.__filtered__=!0}else a=this.clone(),a.__dir__*=-1;return a}function pf(){var a=this.__wrapped__.value(),u=this.__dir__,h=Ne(a),S=u<0,P=h?a.length:0,N=NM(0,P,this.__views__),L=N.start,B=N.end,z=B-L,X=S?B:L-1,ee=this.__iteratees__,re=ee.length,ue=0,Se=sr(z,this.__takeCount__);if(!h||!S&&P==z&&Se==z)return nE(a,this.__actions__);var Ee=[];e:for(;z--&&ue<Se;){X+=u;for(var je=-1,Ce=a[X];++je<re;){var Ze=ee[je],tt=Ze.iteratee,bn=Ze.type,Lr=tt(Ce);if(bn==Q)Ce=Lr;else if(!Lr){if(bn==J)continue e;break e}}Ee[ue++]=Ce}return Ee}ze.prototype=so(ou.prototype),ze.prototype.constructor=ze;function Nn(a){var u=-1,h=a==null?0:a.length;for(this.clear();++u<h;){var S=a[u];this.set(S[0],S[1])}}function Db(){this.__data__=Sa?Sa(null):{},this.size=0}function jb(a){var u=this.has(a)&&delete this.__data__[a];return this.size-=u?1:0,u}function Lb(a){var u=this.__data__;if(Sa){var h=u[a];return h===l?t:h}return ht.call(u,a)?u[a]:t}function Ub(a){var u=this.__data__;return Sa?u[a]!==t:ht.call(u,a)}function Hb(a,u){var h=this.__data__;return this.size+=this.has(a)?0:1,h[a]=Sa&&u===t?l:u,this}Nn.prototype.clear=Db,Nn.prototype.delete=jb,Nn.prototype.get=Lb,Nn.prototype.has=Ub,Nn.prototype.set=Hb;function ti(a){var u=-1,h=a==null?0:a.length;for(this.clear();++u<h;){var S=a[u];this.set(S[0],S[1])}}function bh(){this.__data__=[],this.size=0}function Bb(a){var u=this.__data__,h=lu(u,a);if(h<0)return!1;var S=u.length-1;return h==S?u.pop():Xl.call(u,h,1),--this.size,!0}function Vb(a){var u=this.__data__,h=lu(u,a);return h<0?t:u[h][1]}function Sh(a){return lu(this.__data__,a)>-1}function Wb(a,u){var h=this.__data__,S=lu(h,a);return S<0?(++this.size,h.push([a,u])):h[S][1]=u,this}ti.prototype.clear=bh,ti.prototype.delete=Bb,ti.prototype.get=Vb,ti.prototype.has=Sh,ti.prototype.set=Wb;function ri(a){var u=-1,h=a==null?0:a.length;for(this.clear();++u<h;){var S=a[u];this.set(S[0],S[1])}}function zb(){this.size=0,this.__data__={hash:new Nn,map:new(va||ti),string:new Nn}}function ji(a){var u=Uh(this,a).delete(a);return this.size-=u?1:0,u}function wh(a){return Uh(this,a).get(a)}function Jb(a){return Uh(this,a).has(a)}function Gb(a,u){var h=Uh(this,a),S=h.size;return h.set(a,u),this.size+=h.size==S?0:1,this}ri.prototype.clear=zb,ri.prototype.delete=ji,ri.prototype.get=wh,ri.prototype.has=Jb,ri.prototype.set=Gb;function ms(a){var u=-1,h=a==null?0:a.length;for(this.__data__=new ri;++u<h;)this.add(a[u])}function ie(a){return this.__data__.set(a,l),this}function Yb(a){return this.__data__.has(a)}ms.prototype.add=ms.prototype.push=ie,ms.prototype.has=Yb;function hn(a){var u=this.__data__=new ti(a);this.size=u.size}function _h(){this.__data__=new ti,this.size=0}function it(a){var u=this.__data__,h=u.delete(a);return this.size=u.size,h}function au(a){return this.__data__.get(a)}function Rh(a){return this.__data__.has(a)}function hf(a,u){var h=this.__data__;if(h instanceof ti){var S=h.__data__;if(!va||S.length<r-1)return S.push([a,u]),this.size=++h.size,this;h=this.__data__=new ri(S)}return h.set(a,u),this.size=h.size,this}hn.prototype.clear=_h,hn.prototype.delete=it,hn.prototype.get=au,hn.prototype.has=Rh,hn.prototype.set=hf;function Ch(a,u){var h=Ne(a),S=!h&&qa(a),P=!h&&!S&&po(a),N=!h&&!S&&!P&&hu(a),L=h||S||P||N,B=L?lf(a.length,Sb):[],z=B.length;for(var X in a)(u||ht.call(a,X))&&!(L&&(X=="length"||P&&(X=="offset"||X=="parent")||N&&(X=="buffer"||X=="byteLength"||X=="byteOffset")||bs(X,z)))&&B.push(X);return B}function xh(a){var u=a.length;return u?a[lS(0,u-1)]:t}function Kb(a,u){return Hh(Kr(a),Li(u,0,a.length))}function Qb(a){return Hh(Kr(a))}function mf(a,u,h){(h!==t&&!ai(a[u],h)||h===t&&!(u in a))&&mn(a,u,h)}function Dr(a,u,h){var S=a[u];(!(ht.call(a,u)&&ai(S,h))||h===t&&!(u in a))&&mn(a,u,h)}function lu(a,u){for(var h=a.length;h--;)if(ai(a[h][0],u))return h;return-1}function Eh(a,u,h,S){return Ui(a,function(P,N,L){u(S,P,h(P),L)}),S}function qh(a,u){return a&&Hi(u,fr(u),a)}function Zb(a,u){return a&&Hi(u,Zr(u),a)}function mn(a,u,h){u=="__proto__"&&eu?eu(a,u,{configurable:!0,enumerable:!0,value:h,writable:!0}):a[u]=h}function gf(a,u){for(var h=-1,S=u.length,P=Y(S),N=a==null;++h<S;)P[h]=N?t:$S(a,u[h]);return P}function Li(a,u,h){return a===a&&(h!==t&&(a=a<=h?a:h),u!==t&&(a=a>=u?a:u)),a}function wr(a,u,h,S,P,N){var L,B=u&p,z=u&m,X=u&y;if(h&&(L=P?h(a,S,P,N):h(a)),L!==t)return L;if(!Ut(a))return a;var ee=Ne(a);if(ee){if(L=FM(a),!B)return Kr(a,L)}else{var re=_r(a),ue=re==zr||re==Ws;if(po(a))return oE(a,B);if(re==te||re==Gt||ue&&!P){if(L=z||ue?{}:xE(a),!B)return z?EM(a,Zb(L,a)):xM(a,qh(L,a))}else{if(!Et[re])return P?a:{};L=DM(a,re,B)}}N||(N=new hn);var Se=N.get(a);if(Se)return Se;N.set(a,L),eq(a)?a.forEach(function(Ce){L.add(wr(Ce,u,h,Ce,a,N))}):ZE(a)&&a.forEach(function(Ce,Ze){L.set(Ze,wr(Ce,u,h,Ze,a,N))});var Ee=X?z?bS:vS:z?Zr:fr,je=ee?t:Ee(a);return $r(je||a,function(Ce,Ze){je&&(Ze=Ce,Ce=a[Ze]),Dr(L,Ze,wr(Ce,u,h,Ze,a,N))}),L}function Xb(a){var u=fr(a);return function(h){return Mn(h,a,u)}}function Mn(a,u,h){var S=h.length;if(a==null)return!S;for(a=et(a);S--;){var P=h[S],N=u[P],L=a[P];if(L===t&&!(P in a)||!N(L))return!1}return!0}function yf(a,u,h){if(typeof a!="function")throw new Fr(i);return Cf(function(){a.apply(t,h)},u)}function _a(a,u,h,S){var P=-1,N=Ul,L=!0,B=a.length,z=[],X=u.length;if(!B)return z;h&&(u=qt(u,Nr(h))),S?(N=Xs,L=!1):u.length>=r&&(N=vt,L=!1,u=new ms(u));e:for(;++P<B;){var ee=a[P],re=h==null?ee:h(ee);if(ee=S||ee!==0?ee:0,L&&re===re){for(var ue=X;ue--;)if(u[ue]===re)continue e;z.push(ee)}else N(u,re,S)||z.push(ee)}return z}var Ui=fE(Fn),Oh=fE(ni,!0);function eS(a,u){var h=!0;return Ui(a,function(S,P,N){return h=!!u(S,P,N),h}),h}function uu(a,u,h){for(var S=-1,P=a.length;++S<P;){var N=a[S],L=u(N);if(L!=null&&(B===t?L===L&&!vn(L):h(L,B)))var B=L,z=N}return z}function tS(a,u,h,S){var P=a.length;for(h=Fe(h),h<0&&(h=-h>P?0:P+h),S=S===t||S>P?P:Fe(S),S<0&&(S+=P),S=h>S?0:rq(S);h<S;)a[h++]=u;return a}function Ih(a,u){var h=[];return Ui(a,function(S,P,N){u(S,P,N)&&h.push(S)}),h}function or(a,u,h,S,P){var N=-1,L=a.length;for(h||(h=LM),P||(P=[]);++N<L;){var B=a[N];u>0&&h(B)?u>1?or(B,u-1,h,S,P):Ni(P,B):S||(P[P.length]=B)}return P}var vf=dE(),Ph=dE(!0);function Fn(a,u){return a&&vf(a,u,fr)}function ni(a,u){return a&&Ph(a,u,fr)}function cu(a,u){return $i(u,function(h){return Ss(a[h])})}function gs(a,u){u=co(u,a);for(var h=0,S=u.length;a!=null&&h<S;)a=a[oi(u[h++])];return h&&h==S?a:t}function kh(a,u,h){var S=u(a);return Ne(a)?S:Ni(S,h(a))}function dr(a){return a==null?a===t?Te:On:ps&&ps in et(a)?$M(a):JM(a)}function bf(a,u){return a>u}function rS(a,u){return a!=null&&ht.call(a,u)}function nS(a,u){return a!=null&&u in et(a)}function iS(a,u,h){return a>=sr(u,h)&&a<Tt(u,h)}function gn(a,u,h){for(var S=h?Xs:Ul,P=a[0].length,N=a.length,L=N,B=Y(N),z=1/0,X=[];L--;){var ee=a[L];L&&u&&(ee=qt(ee,Nr(u))),z=sr(ee.length,z),B[L]=!h&&(u||P>=120&&ee.length>=120)?new ms(L&&ee):t}ee=a[0];var re=-1,ue=B[0];e:for(;++re<P&&X.length<z;){var Se=ee[re],Ee=u?u(Se):Se;if(Se=h||Se!==0?Se:0,!(ue?vt(ue,Ee):S(X,Ee,h))){for(L=N;--L;){var je=B[L];if(!(je?vt(je,Ee):S(a[L],Ee,h)))continue e}ue&&ue.push(Ee),X.push(Se)}}return X}function oo(a,u,h,S){return Fn(a,function(P,N,L){u(S,h(P),N,L)}),S}function Ra(a,u,h){u=co(u,a),a=IE(a,u);var S=a==null?a:a[oi(jn(u))];return S==null?t:Tr(S,a,h)}function Ah(a){return Vt(a)&&dr(a)==Gt}function sS(a){return Vt(a)&&dr(a)==pn}function oS(a){return Vt(a)&&dr(a)==br}function Ca(a,u,h,S,P){return a===u?!0:a==null||u==null||!Vt(a)&&!Vt(u)?a!==a&&u!==u:Sf(a,u,h,S,Ca,P)}function Sf(a,u,h,S,P,N){var L=Ne(a),B=Ne(u),z=L?kr:_r(a),X=B?kr:_r(u);z=z==Gt?te:z,X=X==Gt?te:X;var ee=z==te,re=X==te,ue=z==X;if(ue&&po(a)){if(!po(u))return!1;L=!0,ee=!1}if(ue&&!ee)return N||(N=new hn),L||hu(a)?_E(a,u,h,S,P,N):AM(a,u,z,h,S,P,N);if(!(h&b)){var Se=ee&&ht.call(a,"__wrapped__"),Ee=re&&ht.call(u,"__wrapped__");if(Se||Ee){var je=Se?a.value():a,Ce=Ee?u.value():u;return N||(N=new hn),P(je,Ce,h,S,N)}}return ue?(N||(N=new hn),TM(a,u,h,S,P,N)):!1}function ao(a){return Vt(a)&&_r(a)==At}function lo(a,u,h,S){var P=h.length,N=P,L=!S;if(a==null)return!N;for(a=et(a);P--;){var B=h[P];if(L&&B[2]?B[1]!==a[B[0]]:!(B[0]in a))return!1}for(;++P<N;){B=h[P];var z=B[0],X=a[z],ee=B[1];if(L&&B[2]){if(X===t&&!(z in a))return!1}else{var re=new hn;if(S)var ue=S(X,ee,z,a,u,re);if(!(ue===t?Ca(ee,X,b|q,S,re):ue))return!1}}return!0}function Qe(a){if(!Ut(a)||HM(a))return!1;var u=Ss(a)?xb:Lp;return u.test(Ea(a))}function f(a){return Vt(a)&&dr(a)==ye}function g(a){return Vt(a)&&_r(a)==be}function w(a){return Vt(a)&&Gh(a.length)&&!!Pt[dr(a)]}function x(a){return typeof a=="function"?a:a==null?Xr:typeof a=="object"?Ne(a)?Je(a[0],a[1]):Oe(a):hq(a)}function T(a){if(!Rf(a))return mh(a);var u=[];for(var h in et(a))ht.call(a,h)&&h!="constructor"&&u.push(h);return u}function H(a){if(!Ut(a))return zM(a);var u=Rf(a),h=[];for(var S in a)S=="constructor"&&(u||!ht.call(a,S))||h.push(S);return h}function K(a,u){return a<u}function fe(a,u){var h=-1,S=Qr(a)?Y(a.length):[];return Ui(a,function(P,N,L){S[++h]=u(P,N,L)}),S}function Oe(a){var u=wS(a);return u.length==1&&u[0][2]?qE(u[0][0],u[0][1]):function(h){return h===a||lo(h,a,u)}}function Je(a,u){return RS(a)&&EE(u)?qE(oi(a),u):function(h){var S=$S(h,a);return S===t&&S===u?NS(h,a):Ca(u,S,b|q)}}function er(a,u,h,S,P){a!==u&&vf(u,function(N,L){if(P||(P=new hn),Ut(N))ii(a,u,L,h,er,S,P);else{var B=S?S(xS(a,L),N,L+"",a,u,P):t;B===t&&(B=N),mf(a,L,B)}},Zr)}function ii(a,u,h,S,P,N,L){var B=xS(a,h),z=xS(u,h),X=L.get(z);if(X){mf(a,h,X);return}var ee=N?N(B,z,h+"",a,u,L):t,re=ee===t;if(re){var ue=Ne(z),Se=!ue&&po(z),Ee=!ue&&!Se&&hu(z);ee=z,ue||Se||Ee?Ne(B)?ee=B:Kt(B)?ee=Kr(B):Se?(re=!1,ee=oE(z,!0)):Ee?(re=!1,ee=aE(z,!0)):ee=[]:xf(z)||qa(z)?(ee=B,qa(B)?ee=nq(B):(!Ut(B)||Ss(B))&&(ee=xE(z))):re=!1}re&&(L.set(z,ee),P(ee,z,S,N,L),L.delete(z)),mf(a,h,ee)}function si(a,u){var h=a.length;if(h)return u+=u<0?h:0,bs(u,h)?a[u]:t}function Kx(a,u,h){u.length?u=qt(u,function(N){return Ne(N)?function(L){return gs(L,N.length===1?N[0]:N)}:N}):u=[Xr];var S=-1;u=qt(u,Nr(xe()));var P=fe(a,function(N,L,B){var z=qt(u,function(X){return X(N)});return{criteria:z,index:++S,value:N}});return ab(P,function(N,L){return CM(N,L,h)})}function dM(a,u){return Qx(a,u,function(h,S){return NS(a,S)})}function Qx(a,u,h){for(var S=-1,P=u.length,N={};++S<P;){var L=u[S],B=gs(a,L);h(B,L)&&wf(N,co(L,a),B)}return N}function pM(a){return function(u){return gs(u,a)}}function aS(a,u,h,S){var P=S?ob:fs,N=-1,L=u.length,B=a;for(a===u&&(u=Kr(u)),h&&(B=qt(a,Nr(h)));++N<L;)for(var z=0,X=u[N],ee=h?h(X):X;(z=P(B,ee,z,S))>-1;)B!==a&&Xl.call(B,z,1),Xl.call(a,z,1);return a}function Zx(a,u){for(var h=a?u.length:0,S=h-1;h--;){var P=u[h];if(h==S||P!==N){var N=P;bs(P)?Xl.call(a,P,1):fS(a,P)}}return a}function lS(a,u){return a+ya(yh()*(u-a+1))}function hM(a,u,h,S){for(var P=-1,N=Tt(ga((u-a)/(h||1)),0),L=Y(N);N--;)L[S?N:++P]=a,a+=h;return L}function uS(a,u){var h="";if(!a||u<1||u>Ve)return h;do u%2&&(h+=a),u=ya(u/2),u&&(a+=a);while(u);return h}function He(a,u){return ES(OE(a,u,Xr),a+"")}function mM(a){return xh(mu(a))}function gM(a,u){var h=mu(a);return Hh(h,Li(u,0,h.length))}function wf(a,u,h,S){if(!Ut(a))return a;u=co(u,a);for(var P=-1,N=u.length,L=N-1,B=a;B!=null&&++P<N;){var z=oi(u[P]),X=h;if(z==="__proto__"||z==="constructor"||z==="prototype")return a;if(P!=L){var ee=B[z];X=S?S(ee,z,B):t,X===t&&(X=Ut(ee)?ee:bs(u[P+1])?[]:{})}Dr(B,z,X),B=B[z]}return a}var Xx=iu?function(a,u){return iu.set(a,u),a}:Xr,yM=eu?function(a,u){return eu(a,"toString",{configurable:!0,enumerable:!1,value:FS(u),writable:!0})}:Xr;function vM(a){return Hh(mu(a))}function Dn(a,u,h){var S=-1,P=a.length;u<0&&(u=-u>P?0:P+u),h=h>P?P:h,h<0&&(h+=P),P=u>h?0:h-u>>>0,u>>>=0;for(var N=Y(P);++S<P;)N[S]=a[S+u];return N}function bM(a,u){var h;return Ui(a,function(S,P,N){return h=u(S,P,N),!h}),!!h}function Th(a,u,h){var S=0,P=a==null?S:a.length;if(typeof u=="number"&&u===u&&P<=Nt){for(;S<P;){var N=S+P>>>1,L=a[N];L!==null&&!vn(L)&&(h?L<=u:L<u)?S=N+1:P=N}return P}return cS(a,u,Xr,h)}function cS(a,u,h,S){var P=0,N=a==null?0:a.length;if(N===0)return 0;u=h(u);for(var L=u!==u,B=u===null,z=vn(u),X=u===t;P<N;){var ee=ya((P+N)/2),re=h(a[ee]),ue=re!==t,Se=re===null,Ee=re===re,je=vn(re);if(L)var Ce=S||Ee;else X?Ce=Ee&&(S||ue):B?Ce=Ee&&ue&&(S||!Se):z?Ce=Ee&&ue&&!Se&&(S||!je):Se||je?Ce=!1:Ce=S?re<=u:re<u;Ce?P=ee+1:N=ee}return sr(N,gt)}function eE(a,u){for(var h=-1,S=a.length,P=0,N=[];++h<S;){var L=a[h],B=u?u(L):L;if(!h||!ai(B,z)){var z=B;N[P++]=L===0?0:L}}return N}function tE(a){return typeof a=="number"?a:vn(a)?me:+a}function yn(a){if(typeof a=="string")return a;if(Ne(a))return qt(a,yn)+"";if(vn(a))return vh?vh.call(a):"";var u=a+"";return u=="0"&&1/a==-ce?"-0":u}function uo(a,u,h){var S=-1,P=Ul,N=a.length,L=!0,B=[],z=B;if(h)L=!1,P=Xs;else if(N>=r){var X=u?null:PM(a);if(X)return zl(X);L=!1,P=vt,z=new ms}else z=u?[]:B;e:for(;++S<N;){var ee=a[S],re=u?u(ee):ee;if(ee=h||ee!==0?ee:0,L&&re===re){for(var ue=z.length;ue--;)if(z[ue]===re)continue e;u&&z.push(re),B.push(ee)}else P(z,re,h)||(z!==B&&z.push(re),B.push(ee))}return B}function fS(a,u){u=co(u,a);var h=-1,S=u.length;if(!S)return!0;for(;++h<S;){var P=oi(u[h]);if(P==="__proto__"&&!ht.call(a,"__proto__")||(P==="constructor"||P==="prototype")&&h<S-1)return!1}var N=IE(a,u);return N==null||delete N[oi(jn(u))]}function rE(a,u,h,S){return wf(a,u,h(gs(a,u)),S)}function $h(a,u,h,S){for(var P=a.length,N=S?P:-1;(S?N--:++N<P)&&u(a[N],N,a););return h?Dn(a,S?0:N,S?N+1:P):Dn(a,S?N+1:0,S?P:N)}function nE(a,u){var h=a;return h instanceof ze&&(h=h.value()),sf(u,function(S,P){return P.func.apply(P.thisArg,Ni([S],P.args))},h)}function dS(a,u,h){var S=a.length;if(S<2)return S?uo(a[0]):[];for(var P=-1,N=Y(S);++P<S;)for(var L=a[P],B=-1;++B<S;)B!=P&&(N[P]=_a(N[P]||L,a[B],u,h));return uo(or(N,1),u,h)}function iE(a,u,h){for(var S=-1,P=a.length,N=u.length,L={};++S<P;){var B=S<N?u[S]:t;h(L,a[S],B)}return L}function pS(a){return Kt(a)?a:[]}function hS(a){return typeof a=="function"?a:Xr}function co(a,u){return Ne(a)?a:RS(a,u)?[a]:TE(_t(a))}var SM=He;function fo(a,u,h){var S=a.length;return h=h===t?S:h,!u&&h>=S?a:Dn(a,u,h)}var sE=Eb||function(a){return Xt.clearTimeout(a)};function oE(a,u){if(u)return a.slice();var h=a.length,S=dh?dh(h):new a.constructor(h);return a.copy(S),S}function mS(a){var u=new a.constructor(a.byteLength);return new Ql(u).set(new Ql(a)),u}function wM(a,u){var h=u?mS(a.buffer):a.buffer;return new a.constructor(h,a.byteOffset,a.byteLength)}function _M(a){var u=new a.constructor(a.source,jp.exec(a));return u.lastIndex=a.lastIndex,u}function RM(a){return wa?et(wa.call(a)):{}}function aE(a,u){var h=u?mS(a.buffer):a.buffer;return new a.constructor(h,a.byteOffset,a.length)}function lE(a,u){if(a!==u){var h=a!==t,S=a===null,P=a===a,N=vn(a),L=u!==t,B=u===null,z=u===u,X=vn(u);if(!B&&!X&&!N&&a>u||N&&L&&z&&!B&&!X||S&&L&&z||!h&&z||!P)return 1;if(!S&&!N&&!X&&a<u||X&&h&&P&&!S&&!N||B&&h&&P||!L&&P||!z)return-1}return 0}function CM(a,u,h){for(var S=-1,P=a.criteria,N=u.criteria,L=P.length,B=h.length;++S<L;){var z=lE(P[S],N[S]);if(z){if(S>=B)return z;var X=h[S];return z*(X=="desc"?-1:1)}}return a.index-u.index}function uE(a,u,h,S){for(var P=-1,N=a.length,L=h.length,B=-1,z=u.length,X=Tt(N-L,0),ee=Y(z+X),re=!S;++B<z;)ee[B]=u[B];for(;++P<L;)(re||P<N)&&(ee[h[P]]=a[P]);for(;X--;)ee[B++]=a[P++];return ee}function cE(a,u,h,S){for(var P=-1,N=a.length,L=-1,B=h.length,z=-1,X=u.length,ee=Tt(N-B,0),re=Y(ee+X),ue=!S;++P<ee;)re[P]=a[P];for(var Se=P;++z<X;)re[Se+z]=u[z];for(;++L<B;)(ue||P<N)&&(re[Se+h[L]]=a[P++]);return re}function Kr(a,u){var h=-1,S=a.length;for(u||(u=Y(S));++h<S;)u[h]=a[h];return u}function Hi(a,u,h,S){var P=!h;h||(h={});for(var N=-1,L=u.length;++N<L;){var B=u[N],z=S?S(h[B],a[B],B,h,a):t;z===t&&(z=a[B]),P?mn(h,B,z):Dr(h,B,z)}return h}function xM(a,u){return Hi(a,_S(a),u)}function EM(a,u){return Hi(a,RE(a),u)}function Nh(a,u){return function(h,S){var P=Ne(h)?ei:Eh,N=u?u():{};return P(h,a,xe(S,2),N)}}function fu(a){return He(function(u,h){var S=-1,P=h.length,N=P>1?h[P-1]:t,L=P>2?h[2]:t;for(N=a.length>3&&typeof N=="function"?(P--,N):t,L&&jr(h[0],h[1],L)&&(N=P<3?t:N,P=1),u=et(u);++S<P;){var B=h[S];B&&a(u,B,S,N)}return u})}function fE(a,u){return function(h,S){if(h==null)return h;if(!Qr(h))return a(h,S);for(var P=h.length,N=u?P:-1,L=et(h);(u?N--:++N<P)&&S(L[N],N,L)!==!1;);return h}}function dE(a){return function(u,h,S){for(var P=-1,N=et(u),L=S(u),B=L.length;B--;){var z=L[a?B:++P];if(h(N[z],z,N)===!1)break}return u}}function qM(a,u,h){var S=u&C,P=_f(a);function N(){var L=this&&this!==Xt&&this instanceof N?P:a;return L.apply(S?h:this,arguments)}return N}function pE(a){return function(u){u=_t(u);var h=eo(u)?Mr(u):t,S=h?h[0]:u.charAt(0),P=h?fo(h,1).join(""):u.slice(1);return S[a]()+P}}function du(a){return function(u){return sf(dq(fq(u).replace(zv,"")),a,"")}}function _f(a){return function(){var u=arguments;switch(u.length){case 0:return new a;case 1:return new a(u[0]);case 2:return new a(u[0],u[1]);case 3:return new a(u[0],u[1],u[2]);case 4:return new a(u[0],u[1],u[2],u[3]);case 5:return new a(u[0],u[1],u[2],u[3],u[4]);case 6:return new a(u[0],u[1],u[2],u[3],u[4],u[5]);case 7:return new a(u[0],u[1],u[2],u[3],u[4],u[5],u[6])}var h=so(a.prototype),S=a.apply(h,u);return Ut(S)?S:h}}function OM(a,u,h){var S=_f(a);function P(){for(var N=arguments.length,L=Y(N),B=N,z=pu(P);B--;)L[B]=arguments[B];var X=N<3&&L[0]!==z&&L[N-1]!==z?[]:$n(L,z);if(N-=X.length,N<h)return vE(a,u,Mh,P.placeholder,t,L,X,t,t,h-N);var ee=this&&this!==Xt&&this instanceof P?S:a;return Tr(ee,this,L)}return P}function hE(a){return function(u,h,S){var P=et(u);if(!Qr(u)){var N=xe(h,3);u=fr(u),h=function(B){return N(P[B],B,P)}}var L=a(u,h,S);return L>-1?P[N?u[L]:L]:t}}function mE(a){return vs(function(u){var h=u.length,S=h,P=Sr.prototype.thru;for(a&&u.reverse();S--;){var N=u[S];if(typeof N!="function")throw new Fr(i);if(P&&!L&&Lh(N)=="wrapper")var L=new Sr([],!0)}for(S=L?S:h;++S<h;){N=u[S];var B=Lh(N),z=B=="wrapper"?SS(N):t;z&&CS(z[0])&&z[1]==(j|E|O|I)&&!z[4].length&&z[9]==1?L=L[Lh(z[0])].apply(L,z[3]):L=N.length==1&&CS(N)?L[B]():L.thru(N)}return function(){var X=arguments,ee=X[0];if(L&&X.length==1&&Ne(ee))return L.plant(ee).value();for(var re=0,ue=h?u[re].apply(this,X):ee;++re<h;)ue=u[re].call(this,ue);return ue}})}function Mh(a,u,h,S,P,N,L,B,z,X){var ee=u&j,re=u&C,ue=u&v,Se=u&(E|k),Ee=u&R,je=ue?t:_f(a);function Ce(){for(var Ze=arguments.length,tt=Y(Ze),bn=Ze;bn--;)tt[bn]=arguments[bn];if(Se)var Lr=pu(Ce),Sn=lh(tt,Lr);if(S&&(tt=uE(tt,S,P,Se)),N&&(tt=cE(tt,N,L,Se)),Ze-=Sn,Se&&Ze<X){var Qt=$n(tt,Lr);return vE(a,u,Mh,Ce.placeholder,h,tt,Qt,B,z,X-Ze)}var li=re?h:this,_s=ue?li[a]:a;return Ze=tt.length,B?tt=GM(tt,B):Ee&&Ze>1&&tt.reverse(),ee&&z<Ze&&(tt.length=z),this&&this!==Xt&&this instanceof Ce&&(_s=je||_f(_s)),_s.apply(li,tt)}return Ce}function gE(a,u){return function(h,S){return oo(h,a,u(S),{})}}function Fh(a,u){return function(h,S){var P;if(h===t&&S===t)return u;if(h!==t&&(P=h),S!==t){if(P===t)return S;typeof h=="string"||typeof S=="string"?(h=yn(h),S=yn(S)):(h=tE(h),S=tE(S)),P=a(h,S)}return P}}function gS(a){return vs(function(u){return u=qt(u,Nr(xe())),He(function(h){var S=this;return a(u,function(P){return Tr(P,S,h)})})})}function Dh(a,u){u=u===t?" ":yn(u);var h=u.length;if(h<2)return h?uS(u,a):u;var S=uS(u,ga(a/Mi(u)));return eo(u)?fo(Mr(S),0,a).join(""):S.slice(0,a)}function IM(a,u,h,S){var P=u&C,N=_f(a);function L(){for(var B=-1,z=arguments.length,X=-1,ee=S.length,re=Y(ee+z),ue=this&&this!==Xt&&this instanceof L?N:a;++X<ee;)re[X]=S[X];for(;z--;)re[X++]=arguments[++B];return Tr(ue,P?h:this,re)}return L}function yE(a){return function(u,h,S){return S&&typeof S!="number"&&jr(u,h,S)&&(h=S=t),u=ws(u),h===t?(h=u,u=0):h=ws(h),S=S===t?u<h?1:-1:ws(S),hM(u,h,S,a)}}function jh(a){return function(u,h){return typeof u=="string"&&typeof h=="string"||(u=Ln(u),h=Ln(h)),a(u,h)}}function vE(a,u,h,S,P,N,L,B,z,X){var ee=u&E,re=ee?L:t,ue=ee?t:L,Se=ee?N:t,Ee=ee?t:N;u|=ee?O:M,u&=~(ee?M:O),u&_||(u&=~(C|v));var je=[a,u,P,Se,re,Ee,ue,B,z,X],Ce=h.apply(t,je);return CS(a)&&PE(Ce,je),Ce.placeholder=S,kE(Ce,a,u)}function yS(a){var u=bt[a];return function(h,S){if(h=Ln(h),S=S==null?0:sr(Fe(S),292),S&&hs(h)){var P=(_t(h)+"e").split("e"),N=u(P[0]+"e"+(+P[1]+S));return P=(_t(N)+"e").split("e"),+(P[0]+"e"+(+P[1]-S))}return u(h)}}var PM=no&&1/zl(new no([,-0]))[1]==ce?function(a){return new no(a)}:LS;function bE(a){return function(u){var h=_r(u);return h==At?to(u):h==be?uh(u):lb(u,a(u))}}function ys(a,u,h,S,P,N,L,B){var z=u&v;if(!z&&typeof a!="function")throw new Fr(i);var X=S?S.length:0;if(X||(u&=~(O|M),S=P=t),L=L===t?L:Tt(Fe(L),0),B=B===t?B:Fe(B),X-=P?P.length:0,u&M){var ee=S,re=P;S=P=t}var ue=z?t:SS(a),Se=[a,u,h,S,P,ee,re,N,L,B];if(ue&&WM(Se,ue),a=Se[0],u=Se[1],h=Se[2],S=Se[3],P=Se[4],B=Se[9]=Se[9]===t?z?0:a.length:Tt(Se[9]-X,0),!B&&u&(E|k)&&(u&=~(E|k)),!u||u==C)var Ee=qM(a,u,h);else u==E||u==k?Ee=OM(a,u,B):(u==O||u==(C|O))&&!P.length?Ee=IM(a,u,h,S):Ee=Mh.apply(t,Se);var je=ue?Xx:PE;return kE(je(Ee,Se),a,u)}function SE(a,u,h,S){return a===t||ai(a,ro[h])&&!ht.call(S,h)?u:a}function wE(a,u,h,S,P,N){return Ut(a)&&Ut(u)&&(N.set(u,a),er(a,u,t,wE,N),N.delete(u)),a}function kM(a){return xf(a)?t:a}function _E(a,u,h,S,P,N){var L=h&b,B=a.length,z=u.length;if(B!=z&&!(L&&z>B))return!1;var X=N.get(a),ee=N.get(u);if(X&&ee)return X==u&&ee==a;var re=-1,ue=!0,Se=h&q?new ms:t;for(N.set(a,u),N.set(u,a);++re<B;){var Ee=a[re],je=u[re];if(S)var Ce=L?S(je,Ee,re,u,a,N):S(Ee,je,re,a,u,N);if(Ce!==t){if(Ce)continue;ue=!1;break}if(Se){if(!Hl(u,function(Ze,tt){if(!vt(Se,tt)&&(Ee===Ze||P(Ee,Ze,h,S,N)))return Se.push(tt)})){ue=!1;break}}else if(!(Ee===je||P(Ee,je,h,S,N))){ue=!1;break}}return N.delete(a),N.delete(u),ue}function AM(a,u,h,S,P,N,L){switch(h){case yt:if(a.byteLength!=u.byteLength||a.byteOffset!=u.byteOffset)return!1;a=a.buffer,u=u.buffer;case pn:return!(a.byteLength!=u.byteLength||!N(new Ql(a),new Ql(u)));case Ar:case br:case Ai:return ai(+a,+u);case wt:return a.name==u.name&&a.message==u.message;case ye:case Ke:return a==u+"";case At:var B=to;case be:var z=S&b;if(B||(B=zl),a.size!=u.size&&!z)return!1;var X=L.get(a);if(X)return X==u;S|=q,L.set(a,u);var ee=_E(B(a),B(u),S,P,N,L);return L.delete(a),ee;case ur:if(wa)return wa.call(a)==wa.call(u)}return!1}function TM(a,u,h,S,P,N){var L=h&b,B=vS(a),z=B.length,X=vS(u),ee=X.length;if(z!=ee&&!L)return!1;for(var re=z;re--;){var ue=B[re];if(!(L?ue in u:ht.call(u,ue)))return!1}var Se=N.get(a),Ee=N.get(u);if(Se&&Ee)return Se==u&&Ee==a;var je=!0;N.set(a,u),N.set(u,a);for(var Ce=L;++re<z;){ue=B[re];var Ze=a[ue],tt=u[ue];if(S)var bn=L?S(tt,Ze,ue,u,a,N):S(Ze,tt,ue,a,u,N);if(!(bn===t?Ze===tt||P(Ze,tt,h,S,N):bn)){je=!1;break}Ce||(Ce=ue=="constructor")}if(je&&!Ce){var Lr=a.constructor,Sn=u.constructor;Lr!=Sn&&"constructor"in a&&"constructor"in u&&!(typeof Lr=="function"&&Lr instanceof Lr&&typeof Sn=="function"&&Sn instanceof Sn)&&(je=!1)}return N.delete(a),N.delete(u),je}function vs(a){return ES(OE(a,t,FE),a+"")}function vS(a){return kh(a,fr,_S)}function bS(a){return kh(a,Zr,RE)}var SS=iu?function(a){return iu.get(a)}:LS;function Lh(a){for(var u=a.name+"",h=io[u],S=ht.call(io,u)?h.length:0;S--;){var P=h[S],N=P.func;if(N==null||N==a)return P.name}return u}function pu(a){var u=ht.call($,"placeholder")?$:a;return u.placeholder}function xe(){var a=$.iteratee||DS;return a=a===DS?x:a,arguments.length?a(arguments[0],arguments[1]):a}function Uh(a,u){var h=a.__data__;return UM(u)?h[typeof u=="string"?"string":"hash"]:h.map}function wS(a){for(var u=fr(a),h=u.length;h--;){var S=u[h],P=a[S];u[h]=[S,P,EE(P)]}return u}function xa(a,u){var h=ca(a,u);return Qe(h)?h:t}function $M(a){var u=ht.call(a,ps),h=a[ps];try{a[ps]=t;var S=!0}catch{}var P=Yl.call(a);return S&&(u?a[ps]=h:delete a[ps]),P}var _S=tu?function(a){return a==null?[]:(a=et(a),$i(tu(a),function(u){return ha.call(a,u)}))}:US,RE=tu?function(a){for(var u=[];a;)Ni(u,_S(a)),a=Zl(a);return u}:US,_r=dr;(ff&&_r(new ff(new ArrayBuffer(1)))!=yt||va&&_r(new va)!=At||df&&_r(df.resolve())!=ne||no&&_r(new no)!=be||ba&&_r(new ba)!=ge)&&(_r=function(a){var u=dr(a),h=u==te?a.constructor:t,S=h?Ea(h):"";if(S)switch(S){case kb:return yt;case Ab:return At;case Tb:return ne;case $b:return be;case Nb:return ge}return u});function NM(a,u,h){for(var S=-1,P=h.length;++S<P;){var N=h[S],L=N.size;switch(N.type){case"drop":a+=L;break;case"dropRight":u-=L;break;case"take":u=sr(u,a+L);break;case"takeRight":a=Tt(a,u-L);break}}return{start:a,end:u}}function MM(a){var u=a.match(Qn);return u?u[1].split(An):[]}function CE(a,u,h){u=co(u,a);for(var S=-1,P=u.length,N=!1;++S<P;){var L=oi(u[S]);if(!(N=a!=null&&h(a,L)))break;a=a[L]}return N||++S!=P?N:(P=a==null?0:a.length,!!P&&Gh(P)&&bs(L,P)&&(Ne(a)||qa(a)))}function FM(a){var u=a.length,h=new a.constructor(u);return u&&typeof a[0]=="string"&&ht.call(a,"index")&&(h.index=a.index,h.input=a.input),h}function xE(a){return typeof a.constructor=="function"&&!Rf(a)?so(Zl(a)):{}}function DM(a,u,h){var S=a.constructor;switch(u){case pn:return mS(a);case Ar:case br:return new S(+a);case yt:return wM(a,h);case qe:case Pn:case Il:case zs:case ea:case Js:case Ti:case Gs:case Bc:return aE(a,h);case At:return new S;case Ai:case Ke:return new S(a);case ye:return _M(a);case be:return new S;case ur:return RM(a)}}function jM(a,u){var h=u.length;if(!h)return a;var S=h-1;return u[S]=(h>1?"& ":"")+u[S],u=u.join(h>2?", ":" "),a.replace(cr,`{
|
|
2
2
|
/* [wrapped with `+u+`] */
|
|
3
|
-
`)}function LM(a){return Ne(a)||qa(a)||!!(hh&&a&&a[hh])}function bs(a,u){var h=typeof a;return u=u??Ve,!!u&&(h=="number"||h!="symbol"&&Ys.test(a))&&a>-1&&a%1==0&&a<u}function jr(a,u,h){if(!Ut(h))return!1;var S=typeof u;return(S=="number"?Qr(h)&&bs(u,h.length):S=="string"&&u in h)?ai(h[u],a):!1}function RS(a,u){if(Ne(a))return!1;var h=typeof a;return h=="number"||h=="symbol"||h=="boolean"||a==null||vn(a)?!0:We.test(a)||!Jr.test(a)||u!=null&&a in et(u)}function UM(a){var u=typeof a;return u=="string"||u=="number"||u=="symbol"||u=="boolean"?a!=="__proto__":a===null}function CS(a){var u=Lh(a),h=$[u];if(typeof h!="function"||!(u in ze.prototype))return!1;if(a===h)return!0;var S=SS(h);return!!S&&a===S[0]}function HM(a){return!!fh&&fh in a}var BM=pa?Ss:HS;function Rf(a){var u=a&&a.constructor,h=typeof u=="function"&&u.prototype||ro;return a===h}function EE(a){return a===a&&!Ut(a)}function qE(a,u){return function(h){return h==null?!1:h[a]===u&&(u!==t||a in et(h))}}function VM(a){var u=zh(a,function(S){return h.size===c&&h.clear(),S}),h=u.cache;return u}function WM(a,u){var h=a[1],S=u[1],P=h|S,N=P<(C|v|j),L=S==j&&h==q||S==j&&h==I&&a[7].length<=u[8]||S==(j|I)&&u[7].length<=u[8]&&h==q;if(!(N||L))return a;S&C&&(a[2]=u[2],P|=h&C?0:_);var B=u[3];if(B){var z=a[3];a[3]=z?uE(z,B,u[4]):B,a[4]=z?$n(a[3],d):u[4]}return B=u[5],B&&(z=a[5],a[5]=z?cE(z,B,u[6]):B,a[6]=z?$n(a[5],d):u[6]),B=u[7],B&&(a[7]=B),S&j&&(a[8]=a[8]==null?u[8]:sr(a[8],u[8])),a[9]==null&&(a[9]=u[9]),a[0]=u[0],a[1]=P,a}function zM(a){var u=[];if(a!=null)for(var h in et(a))u.push(h);return u}function JM(a){return Yl.call(a)}function OE(a,u,h){return u=Tt(u===t?a.length-1:u,0),function(){for(var S=arguments,P=-1,N=Tt(S.length-u,0),L=Y(N);++P<N;)L[P]=S[u+P];P=-1;for(var B=Y(u+1);++P<u;)B[P]=S[P];return B[u]=h(L),Tr(a,this,B)}}function IE(a,u){return u.length<2?a:gs(a,Dn(u,0,-1))}function GM(a,u){for(var h=a.length,S=sr(u.length,h),P=Kr(a);S--;){var N=u[S];a[S]=bs(N,h)?P[N]:t}return a}function xS(a,u){if(!(u==="constructor"&&typeof a[u]=="function")&&u!="__proto__")return a[u]}var PE=AE(Xx),Cf=Ob||function(a,u){return Xt.setTimeout(a,u)},ES=AE(yM);function kE(a,u,h){var S=u+"";return ES(a,jM(S,YM(MM(S),h)))}function AE(a){var u=0,h=0;return function(){var S=gh(),P=D-(S-h);if(h=S,P>0){if(++u>=U)return arguments[0]}else u=0;return a.apply(t,arguments)}}function Hh(a,u){var h=-1,S=a.length,P=S-1;for(u=u===t?S:u;++h<u;){var N=lS(h,P),L=a[N];a[N]=a[h],a[h]=L}return a.length=u,a}var TE=VM(function(a){var u=[];return a.charCodeAt(0)===46&&u.push(""),a.replace(Vc,function(h,S,P,N){u.push(P?N.replace(Zn,"$1"):S||h)}),u});function oi(a){if(typeof a=="string"||vn(a))return a;var u=a+"";return u=="0"&&1/a==-ce?"-0":u}function Ea(a){if(a!=null){try{return Gl.call(a)}catch{}try{return a+""}catch{}}return""}function YM(a,u){return $r(pe,function(h){var S="_."+h[0];u&h[1]&&!Ul(a,S)&&a.push(S)}),a.sort()}function $E(a){if(a instanceof ze)return a.clone();var u=new Sr(a.__wrapped__,a.__chain__);return u.__actions__=Kr(a.__actions__),u.__index__=a.__index__,u.__values__=a.__values__,u}function KM(a,u,h){(h?jr(a,u,h):u===t)?u=1:u=Tt(Fe(u),0);var S=a==null?0:a.length;if(!S||u<1)return[];for(var P=0,N=0,L=Y(ga(S/u));P<S;)L[N++]=Dn(a,P,P+=u);return L}function QM(a){for(var u=-1,h=a==null?0:a.length,S=0,P=[];++u<h;){var N=a[u];N&&(P[S++]=N)}return P}function ZM(){var a=arguments.length;if(!a)return[];for(var u=Y(a-1),h=arguments[0],S=a;S--;)u[S-1]=arguments[S];return Ni(Ne(h)?Kr(h):[h],or(u,1))}var XM=He(function(a,u){return Kt(a)?_a(a,or(u,1,Kt,!0)):[]}),eF=He(function(a,u){var h=jn(u);return Kt(h)&&(h=t),Kt(a)?_a(a,or(u,1,Kt,!0),xe(h,2)):[]}),tF=He(function(a,u){var h=jn(u);return Kt(h)&&(h=t),Kt(a)?_a(a,or(u,1,Kt,!0),t,h):[]});function rF(a,u,h){var S=a==null?0:a.length;return S?(u=h||u===t?1:Fe(u),Dn(a,u<0?0:u,S)):[]}function nF(a,u,h){var S=a==null?0:a.length;return S?(u=h||u===t?1:Fe(u),u=S-u,Dn(a,0,u<0?0:u)):[]}function iF(a,u){return a&&a.length?$h(a,xe(u,3),!0,!0):[]}function sF(a,u){return a&&a.length?$h(a,xe(u,3),!0):[]}function oF(a,u,h,S){var P=a==null?0:a.length;return P?(h&&typeof h!="number"&&jr(a,u,h)&&(h=0,S=P),tS(a,u,h,S)):[]}function NE(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=h==null?0:Fe(h);return P<0&&(P=Tt(S+P,0)),Bl(a,xe(u,3),P)}function ME(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=S-1;return h!==t&&(P=Fe(h),P=h<0?Tt(S+P,0):sr(P,S-1)),Bl(a,xe(u,3),P,!0)}function FE(a){var u=a==null?0:a.length;return u?or(a,1):[]}function aF(a){var u=a==null?0:a.length;return u?or(a,ce):[]}function lF(a,u){var h=a==null?0:a.length;return h?(u=u===t?1:Fe(u),or(a,u)):[]}function uF(a){for(var u=-1,h=a==null?0:a.length,S={};++u<h;){var P=a[u];mn(S,P[0],P[1])}return S}function DE(a){return a&&a.length?a[0]:t}function cF(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=h==null?0:Fe(h);return P<0&&(P=Tt(S+P,0)),fs(a,u,P)}function fF(a){var u=a==null?0:a.length;return u?Dn(a,0,-1):[]}var dF=He(function(a){var u=qt(a,pS);return u.length&&u[0]===a[0]?gn(u):[]}),pF=He(function(a){var u=jn(a),h=qt(a,pS);return u===jn(h)?u=t:h.pop(),h.length&&h[0]===a[0]?gn(h,xe(u,2)):[]}),hF=He(function(a){var u=jn(a),h=qt(a,pS);return u=typeof u=="function"?u:t,u&&h.pop(),h.length&&h[0]===a[0]?gn(h,t,u):[]});function mF(a,u){return a==null?"":nu.call(a,u)}function jn(a){var u=a==null?0:a.length;return u?a[u-1]:t}function gF(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=S;return h!==t&&(P=Fe(h),P=P<0?Tt(S+P,0):sr(P,S-1)),u===u?cf(a,u,P):Bl(a,ds,P,!0)}function yF(a,u){return a&&a.length?si(a,Fe(u)):t}var vF=He(jE);function jE(a,u){return a&&a.length&&u&&u.length?aS(a,u):a}function bF(a,u,h){return a&&a.length&&u&&u.length?aS(a,u,xe(h,2)):a}function SF(a,u,h){return a&&a.length&&u&&u.length?aS(a,u,t,h):a}var wF=vs(function(a,u){var h=a==null?0:a.length,S=gf(a,u);return Zx(a,qt(u,function(P){return bs(P,h)?+P:P}).sort(lE)),S});function _F(a,u){var h=[];if(!(a&&a.length))return h;var S=-1,P=[],N=a.length;for(u=xe(u,3);++S<N;){var L=a[S];u(L,S,a)&&(h.push(L),P.push(S))}return Zx(a,P),h}function qS(a){return a==null?a:Pb.call(a)}function RF(a,u,h){var S=a==null?0:a.length;return S?(h&&typeof h!="number"&&jr(a,u,h)?(u=0,h=S):(u=u==null?0:Fe(u),h=h===t?S:Fe(h)),Dn(a,u,h)):[]}function CF(a,u){return Th(a,u)}function xF(a,u,h){return cS(a,u,xe(h,2))}function EF(a,u){var h=a==null?0:a.length;if(h){var S=Th(a,u);if(S<h&&ai(a[S],u))return S}return-1}function qF(a,u){return Th(a,u,!0)}function OF(a,u,h){return cS(a,u,xe(h,2),!0)}function IF(a,u){var h=a==null?0:a.length;if(h){var S=Th(a,u,!0)-1;if(ai(a[S],u))return S}return-1}function PF(a){return a&&a.length?eE(a):[]}function kF(a,u){return a&&a.length?eE(a,xe(u,2)):[]}function AF(a){var u=a==null?0:a.length;return u?Dn(a,1,u):[]}function TF(a,u,h){return a&&a.length?(u=h||u===t?1:Fe(u),Dn(a,0,u<0?0:u)):[]}function $F(a,u,h){var S=a==null?0:a.length;return S?(u=h||u===t?1:Fe(u),u=S-u,Dn(a,u<0?0:u,S)):[]}function NF(a,u){return a&&a.length?$h(a,xe(u,3),!1,!0):[]}function MF(a,u){return a&&a.length?$h(a,xe(u,3)):[]}var FF=He(function(a){return uo(or(a,1,Kt,!0))}),DF=He(function(a){var u=jn(a);return Kt(u)&&(u=t),uo(or(a,1,Kt,!0),xe(u,2))}),jF=He(function(a){var u=jn(a);return u=typeof u=="function"?u:t,uo(or(a,1,Kt,!0),t,u)});function LF(a){return a&&a.length?uo(a):[]}function UF(a,u){return a&&a.length?uo(a,xe(u,2)):[]}function HF(a,u){return u=typeof u=="function"?u:t,a&&a.length?uo(a,t,u):[]}function OS(a){if(!(a&&a.length))return[];var u=0;return a=$i(a,function(h){if(Kt(h))return u=Tt(h.length,u),!0}),lf(u,function(h){return qt(a,ua(h))})}function LE(a,u){if(!(a&&a.length))return[];var h=OS(a);return u==null?h:qt(h,function(S){return Tr(u,t,S)})}var BF=He(function(a,u){return Kt(a)?_a(a,u):[]}),VF=He(function(a){return dS($i(a,Kt))}),WF=He(function(a){var u=jn(a);return Kt(u)&&(u=t),dS($i(a,Kt),xe(u,2))}),zF=He(function(a){var u=jn(a);return u=typeof u=="function"?u:t,dS($i(a,Kt),t,u)}),JF=He(OS);function GF(a,u){return iE(a||[],u||[],Dr)}function YF(a,u){return iE(a||[],u||[],wf)}var KF=He(function(a){var u=a.length,h=u>1?a[u-1]:t;return h=typeof h=="function"?(a.pop(),h):t,LE(a,h)});function UE(a){var u=$(a);return u.__chain__=!0,u}function QF(a,u){return u(a),a}function Bh(a,u){return u(a)}var ZF=vs(function(a){var u=a.length,h=u?a[0]:0,S=this.__wrapped__,P=function(N){return gf(N,a)};return u>1||this.__actions__.length||!(S instanceof ze)||!bs(h)?this.thru(P):(S=S.slice(h,+h+(u?1:0)),S.__actions__.push({func:Bh,args:[P],thisArg:t}),new Sr(S,this.__chain__).thru(function(N){return u&&!N.length&&N.push(t),N}))});function XF(){return UE(this)}function eD(){return new Sr(this.value(),this.__chain__)}function tD(){this.__values__===t&&(this.__values__=tq(this.value()));var a=this.__index__>=this.__values__.length,u=a?t:this.__values__[this.__index__++];return{done:a,value:u}}function rD(){return this}function nD(a){for(var u,h=this;h instanceof ou;){var S=$E(h);S.__index__=0,S.__values__=t,u?P.__wrapped__=S:u=S;var P=S;h=h.__wrapped__}return P.__wrapped__=a,u}function iD(){var a=this.__wrapped__;if(a instanceof ze){var u=a;return this.__actions__.length&&(u=new ze(this)),u=u.reverse(),u.__actions__.push({func:Bh,args:[qS],thisArg:t}),new Sr(u,this.__chain__)}return this.thru(qS)}function sD(){return nE(this.__wrapped__,this.__actions__)}var oD=Nh(function(a,u,h){ht.call(a,h)?++a[h]:mn(a,h,1)});function aD(a,u,h){var S=Ne(a)?nh:eS;return h&&jr(a,u,h)&&(u=t),S(a,xe(u,3))}function lD(a,u){var h=Ne(a)?$i:Ih;return h(a,xe(u,3))}var uD=hE(NE),cD=hE(ME);function fD(a,u){return or(Vh(a,u),1)}function dD(a,u){return or(Vh(a,u),ce)}function pD(a,u,h){return h=h===t?1:Fe(h),or(Vh(a,u),h)}function HE(a,u){var h=Ne(a)?$r:Ui;return h(a,xe(u,3))}function BE(a,u){var h=Ne(a)?nf:Oh;return h(a,xe(u,3))}var hD=Nh(function(a,u,h){ht.call(a,h)?a[h].push(u):mn(a,h,[u])});function mD(a,u,h,S){a=Qr(a)?a:mu(a),h=h&&!S?Fe(h):0;var P=a.length;return h<0&&(h=Tt(P+h,0)),Yh(a)?h<=P&&a.indexOf(u,h)>-1:!!P&&fs(a,u,h)>-1}var gD=He(function(a,u,h){var S=-1,P=typeof u=="function",N=Qr(a)?Y(a.length):[];return Ui(a,function(L){N[++S]=P?Tr(u,L,h):Ra(L,u,h)}),N}),yD=Nh(function(a,u,h){mn(a,h,u)});function Vh(a,u){var h=Ne(a)?qt:fe;return h(a,xe(u,3))}function vD(a,u,h,S){return a==null?[]:(Ne(u)||(u=u==null?[]:[u]),h=S?t:h,Ne(h)||(h=h==null?[]:[h]),Kx(a,u,h))}var bD=Nh(function(a,u,h){a[h?0:1].push(u)},function(){return[[],[]]});function SD(a,u,h){var S=Ne(a)?sf:Vl,P=arguments.length<3;return S(a,xe(u,4),h,P,Ui)}function wD(a,u,h){var S=Ne(a)?rb:Vl,P=arguments.length<3;return S(a,xe(u,4),h,P,Oh)}function _D(a,u){var h=Ne(a)?$i:Ih;return h(a,Jh(xe(u,3)))}function RD(a){var u=Ne(a)?xh:mM;return u(a)}function CD(a,u,h){(h?jr(a,u,h):u===t)?u=1:u=Fe(u);var S=Ne(a)?Kb:gM;return S(a,u)}function xD(a){var u=Ne(a)?Qb:vM;return u(a)}function ED(a){if(a==null)return 0;if(Qr(a))return Yh(a)?Mi(a):a.length;var u=_r(a);return u==At||u==be?a.size:T(a).length}function qD(a,u,h){var S=Ne(a)?Hl:bM;return h&&jr(a,u,h)&&(u=t),S(a,xe(u,3))}var OD=He(function(a,u){if(a==null)return[];var h=u.length;return h>1&&jr(a,u[0],u[1])?u=[]:h>2&&jr(u[0],u[1],u[2])&&(u=[u[0]]),Kx(a,or(u,1),[])}),Wh=qb||function(){return Xt.Date.now()};function ID(a,u){if(typeof u!="function")throw new Fr(i);return a=Fe(a),function(){if(--a<1)return u.apply(this,arguments)}}function VE(a,u,h){return u=h?t:u,u=a&&u==null?a.length:u,ys(a,j,t,t,t,t,u)}function WE(a,u){var h;if(typeof u!="function")throw new Fr(i);return a=Fe(a),function(){return--a>0&&(h=u.apply(this,arguments)),a<=1&&(u=t),h}}var IS=He(function(a,u,h){var S=C;if(h.length){var P=$n(h,pu(IS));S|=O}return ys(a,S,u,h,P)}),zE=He(function(a,u,h){var S=C|v;if(h.length){var P=$n(h,pu(zE));S|=O}return ys(u,S,a,h,P)});function JE(a,u,h){u=h?t:u;var S=ys(a,q,t,t,t,t,t,u);return S.placeholder=JE.placeholder,S}function GE(a,u,h){u=h?t:u;var S=ys(a,k,t,t,t,t,t,u);return S.placeholder=GE.placeholder,S}function YE(a,u,h){var S,P,N,L,B,z,X=0,ee=!1,re=!1,ue=!0;if(typeof a!="function")throw new Fr(i);u=Ln(u)||0,Ut(h)&&(ee=!!h.leading,re="maxWait"in h,N=re?Tt(Ln(h.maxWait)||0,u):N,ue="trailing"in h?!!h.trailing:ue);function Se(Qt){var li=S,_s=P;return S=P=t,X=Qt,L=a.apply(_s,li),L}function Ee(Qt){return X=Qt,B=Cf(Ze,u),ee?Se(Qt):L}function je(Qt){var li=Qt-z,_s=Qt-X,mq=u-li;return re?sr(mq,N-_s):mq}function Ce(Qt){var li=Qt-z,_s=Qt-X;return z===t||li>=u||li<0||re&&_s>=N}function Ze(){var Qt=Wh();if(Ce(Qt))return tt(Qt);B=Cf(Ze,je(Qt))}function tt(Qt){return B=t,ue&&S?Se(Qt):(S=P=t,L)}function bn(){B!==t&&sE(B),X=0,S=z=P=B=t}function Lr(){return B===t?L:tt(Wh())}function Sn(){var Qt=Wh(),li=Ce(Qt);if(S=arguments,P=this,z=Qt,li){if(B===t)return Ee(z);if(re)return sE(B),B=Cf(Ze,u),Se(z)}return B===t&&(B=Cf(Ze,u)),L}return Sn.cancel=bn,Sn.flush=Lr,Sn}var PD=He(function(a,u){return yf(a,1,u)}),kD=He(function(a,u,h){return yf(a,Ln(u)||0,h)});function AD(a){return ys(a,R)}function zh(a,u){if(typeof a!="function"||u!=null&&typeof u!="function")throw new Fr(i);var h=function(){var S=arguments,P=u?u.apply(this,S):S[0],N=h.cache;if(N.has(P))return N.get(P);var L=a.apply(this,S);return h.cache=N.set(P,L)||N,L};return h.cache=new(zh.Cache||ri),h}zh.Cache=ri;function Jh(a){if(typeof a!="function")throw new Fr(i);return function(){var u=arguments;switch(u.length){case 0:return!a.call(this);case 1:return!a.call(this,u[0]);case 2:return!a.call(this,u[0],u[1]);case 3:return!a.call(this,u[0],u[1],u[2])}return!a.apply(this,u)}}function TD(a){return WE(2,a)}var $D=SM(function(a,u){u=u.length==1&&Ne(u[0])?qt(u[0],Nr(xe())):qt(or(u,1),Nr(xe()));var h=u.length;return He(function(S){for(var P=-1,N=sr(S.length,h);++P<N;)S[P]=u[P].call(this,S[P]);return Tr(a,this,S)})}),PS=He(function(a,u){var h=$n(u,pu(PS));return ys(a,O,t,u,h)}),KE=He(function(a,u){var h=$n(u,pu(KE));return ys(a,M,t,u,h)}),ND=vs(function(a,u){return ys(a,I,t,t,t,u)});function MD(a,u){if(typeof a!="function")throw new Fr(i);return u=u===t?u:Fe(u),He(a,u)}function FD(a,u){if(typeof a!="function")throw new Fr(i);return u=u==null?0:Tt(Fe(u),0),He(function(h){var S=h[u],P=fo(h,0,u);return S&&Ni(P,S),Tr(a,this,P)})}function DD(a,u,h){var S=!0,P=!0;if(typeof a!="function")throw new Fr(i);return Ut(h)&&(S="leading"in h?!!h.leading:S,P="trailing"in h?!!h.trailing:P),YE(a,u,{leading:S,maxWait:u,trailing:P})}function jD(a){return VE(a,1)}function LD(a,u){return PS(hS(u),a)}function UD(){if(!arguments.length)return[];var a=arguments[0];return Ne(a)?a:[a]}function HD(a){return wr(a,y)}function BD(a,u){return u=typeof u=="function"?u:t,wr(a,y,u)}function VD(a){return wr(a,p|y)}function WD(a,u){return u=typeof u=="function"?u:t,wr(a,p|y,u)}function zD(a,u){return u==null||Mn(a,u,fr(u))}function ai(a,u){return a===u||a!==a&&u!==u}var JD=jh(bf),GD=jh(function(a,u){return a>=u}),qa=Ah((function(){return arguments})())?Ah:function(a){return Vt(a)&&ht.call(a,"callee")&&!ha.call(a,"callee")},Ne=Y.isArray,YD=rf?Nr(rf):sS;function Qr(a){return a!=null&&Gh(a.length)&&!Ss(a)}function Kt(a){return Vt(a)&&Qr(a)}function KD(a){return a===!0||a===!1||Vt(a)&&dr(a)==Ar}var po=ru||HS,QD=th?Nr(th):oS;function ZD(a){return Vt(a)&&a.nodeType===1&&!xf(a)}function XD(a){if(a==null)return!0;if(Qr(a)&&(Ne(a)||typeof a=="string"||typeof a.splice=="function"||po(a)||hu(a)||qa(a)))return!a.length;var u=_r(a);if(u==At||u==be)return!a.size;if(Rf(a))return!T(a).length;for(var h in a)if(ht.call(a,h))return!1;return!0}function ej(a,u){return Ca(a,u)}function tj(a,u,h){h=typeof h=="function"?h:t;var S=h?h(a,u):t;return S===t?Ca(a,u,t,h):!!S}function kS(a){if(!Vt(a))return!1;var u=dr(a);return u==wt||u==xt||typeof a.message=="string"&&typeof a.name=="string"&&!xf(a)}function rj(a){return typeof a=="number"&&hs(a)}function Ss(a){if(!Ut(a))return!1;var u=dr(a);return u==zr||u==Ws||u==ut||u==Pe}function QE(a){return typeof a=="number"&&a==Fe(a)}function Gh(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=Ve}function Ut(a){var u=typeof a;return a!=null&&(u=="object"||u=="function")}function Vt(a){return a!=null&&typeof a=="object"}var ZE=rh?Nr(rh):ao;function nj(a,u){return a===u||lo(a,u,wS(u))}function ij(a,u,h){return h=typeof h=="function"?h:t,lo(a,u,wS(u),h)}function sj(a){return XE(a)&&a!=+a}function oj(a){if(BM(a))throw new Ie(n);return Qe(a)}function aj(a){return a===null}function lj(a){return a==null}function XE(a){return typeof a=="number"||Vt(a)&&dr(a)==Ai}function xf(a){if(!Vt(a)||dr(a)!=te)return!1;var u=Zl(a);if(u===null)return!0;var h=ht.call(u,"constructor")&&u.constructor;return typeof h=="function"&&h instanceof h&&Gl.call(h)==Rb}var AS=la?Nr(la):f;function uj(a){return QE(a)&&a>=-Ve&&a<=Ve}var eq=Xn?Nr(Xn):g;function Yh(a){return typeof a=="string"||!Ne(a)&&Vt(a)&&dr(a)==Ke}function vn(a){return typeof a=="symbol"||Vt(a)&&dr(a)==ur}var hu=Ll?Nr(Ll):w;function cj(a){return a===t}function fj(a){return Vt(a)&&_r(a)==ge}function dj(a){return Vt(a)&&dr(a)==In}var pj=jh(K),hj=jh(function(a,u){return a<=u});function tq(a){if(!a)return[];if(Qr(a))return Yh(a)?Mr(a):Kr(a);if(ma&&a[ma])return pb(a[ma]());var u=_r(a),h=u==At?to:u==be?zl:mu;return h(a)}function ws(a){if(!a)return a===0?a:0;if(a=Ln(a),a===ce||a===-ce){var u=a<0?-1:1;return u*Re}return a===a?a:0}function Fe(a){var u=ws(a),h=u%1;return u===u?h?u-h:u:0}function rq(a){return a?Li(Fe(a),0,Ae):0}function Ln(a){if(typeof a=="number")return a;if(vn(a))return me;if(Ut(a)){var u=typeof a.valueOf=="function"?a.valueOf():a;a=Ut(u)?u+"":u}if(typeof a!="string")return a===0?a:+a;a=uf(a);var h=na.test(a);return h||Av.test(a)?eb(a.slice(2),h?2:8):kv.test(a)?me:+a}function nq(a){return Hi(a,Zr(a))}function mj(a){return a?Li(Fe(a),-Ve,Ve):a===0?a:0}function _t(a){return a==null?"":yn(a)}var gj=fu(function(a,u){if(Rf(u)||Qr(u)){Hi(u,fr(u),a);return}for(var h in u)ht.call(u,h)&&Dr(a,h,u[h])}),iq=fu(function(a,u){Hi(u,Zr(u),a)}),sq=fu(function(a,u,h,S){Hi(u,Zr(u),a,S)}),TS=fu(function(a,u,h,S){Hi(u,fr(u),a,S)}),yj=vs(gf);function vj(a,u){var h=so(a);return u==null?h:qh(h,u)}var bj=He(function(a,u){a=et(a);var h=-1,S=u.length,P=S>2?u[2]:t;for(P&&jr(u[0],u[1],P)&&(S=1);++h<S;)for(var N=u[h],L=Zr(N),B=-1,z=L.length;++B<z;){var X=L[B],ee=a[X];(ee===t||ai(ee,ro[X])&&!ht.call(a,X))&&(a[X]=N[X])}return a}),Sj=He(function(a){return a.push(t,wE),Tr(oq,t,a)});function wj(a,u){return ih(a,xe(u,3),Fn)}function _j(a,u){return ih(a,xe(u,3),ni)}function Rj(a,u){return a==null?a:vf(a,xe(u,3),Zr)}function Cj(a,u){return a==null?a:Ph(a,xe(u,3),Zr)}function xj(a,u){return a&&Fn(a,xe(u,3))}function Ej(a,u){return a&&ni(a,xe(u,3))}function qj(a){return a==null?[]:cu(a,fr(a))}function Oj(a){return a==null?[]:cu(a,Zr(a))}function $S(a,u,h){var S=a==null?t:gs(a,u);return S===t?h:S}function Ij(a,u){return a!=null&&CE(a,u,rS)}function NS(a,u){return a!=null&&CE(a,u,nS)}var Pj=gE(function(a,u,h){u!=null&&typeof u.toString!="function"&&(u=Yl.call(u)),a[u]=h},FS(Xr)),kj=gE(function(a,u,h){u!=null&&typeof u.toString!="function"&&(u=Yl.call(u)),ht.call(a,u)?a[u].push(h):a[u]=[h]},xe),Aj=He(Ra);function fr(a){return Qr(a)?Ch(a):T(a)}function Zr(a){return Qr(a)?Ch(a,!0):H(a)}function Tj(a,u){var h={};return u=xe(u,3),Fn(a,function(S,P,N){mn(h,u(S,P,N),S)}),h}function $j(a,u){var h={};return u=xe(u,3),Fn(a,function(S,P,N){mn(h,P,u(S,P,N))}),h}var Nj=fu(function(a,u,h){er(a,u,h)}),oq=fu(function(a,u,h,S){er(a,u,h,S)}),Mj=vs(function(a,u){var h={};if(a==null)return h;var S=!1;u=qt(u,function(N){return N=co(N,a),S||(S=N.length>1),N}),Hi(a,bS(a),h),S&&(h=wr(h,p|m|y,kM));for(var P=u.length;P--;)fS(h,u[P]);return h});function Fj(a,u){return aq(a,Jh(xe(u)))}var Dj=vs(function(a,u){return a==null?{}:dM(a,u)});function aq(a,u){if(a==null)return{};var h=qt(bS(a),function(S){return[S]});return u=xe(u),Qx(a,h,function(S,P){return u(S,P[0])})}function jj(a,u,h){u=co(u,a);var S=-1,P=u.length;for(P||(P=1,a=t);++S<P;){var N=a==null?t:a[oi(u[S])];N===t&&(S=P,N=h),a=Ss(N)?N.call(a):N}return a}function Lj(a,u,h){return a==null?a:wf(a,u,h)}function Uj(a,u,h,S){return S=typeof S=="function"?S:t,a==null?a:wf(a,u,h,S)}var lq=bE(fr),uq=bE(Zr);function Hj(a,u,h){var S=Ne(a),P=S||po(a)||hu(a);if(u=xe(u,4),h==null){var N=a&&a.constructor;P?h=S?new N:[]:Ut(a)?h=Ss(N)?so(Zl(a)):{}:h={}}return(P?$r:Fn)(a,function(L,B,z){return u(h,L,B,z)}),h}function Bj(a,u){return a==null?!0:fS(a,u)}function Vj(a,u,h){return a==null?a:rE(a,u,hS(h))}function Wj(a,u,h,S){return S=typeof S=="function"?S:t,a==null?a:rE(a,u,hS(h),S)}function mu(a){return a==null?[]:Wl(a,fr(a))}function zj(a){return a==null?[]:Wl(a,Zr(a))}function Jj(a,u,h){return h===t&&(h=u,u=t),h!==t&&(h=Ln(h),h=h===h?h:0),u!==t&&(u=Ln(u),u=u===u?u:0),Li(Ln(a),u,h)}function Gj(a,u,h){return u=ws(u),h===t?(h=u,u=0):h=ws(h),a=Ln(a),iS(a,u,h)}function Yj(a,u,h){if(h&&typeof h!="boolean"&&jr(a,u,h)&&(u=h=t),h===t&&(typeof u=="boolean"?(h=u,u=t):typeof a=="boolean"&&(h=a,a=t)),a===t&&u===t?(a=0,u=1):(a=ws(a),u===t?(u=a,a=0):u=ws(u)),a>u){var S=a;a=u,u=S}if(h||a%1||u%1){var P=yh();return sr(a+P*(u-a+Xp("1e-"+((P+"").length-1))),u)}return lS(a,u)}var Kj=du(function(a,u,h){return u=u.toLowerCase(),a+(h?cq(u):u)});function cq(a){return MS(_t(a).toLowerCase())}function fq(a){return a=_t(a),a&&a.replace(ia,ub).replace(Jv,"")}function Qj(a,u,h){a=_t(a),u=yn(u);var S=a.length;h=h===t?S:Li(Fe(h),0,S);var P=h;return h-=u.length,h>=0&&a.slice(h,P)==u}function Zj(a){return a=_t(a),a&&he.test(a)?a.replace(kl,cb):a}function Xj(a){return a=_t(a),a&&ra.test(a)?a.replace(dt,"\\$&"):a}var eL=du(function(a,u,h){return a+(h?"-":"")+u.toLowerCase()}),tL=du(function(a,u,h){return a+(h?" ":"")+u.toLowerCase()}),rL=pE("toLowerCase");function nL(a,u,h){a=_t(a),u=Fe(u);var S=u?Mi(a):0;if(!u||S>=u)return a;var P=(u-S)/2;return Dh(ya(P),h)+a+Dh(ga(P),h)}function iL(a,u,h){a=_t(a),u=Fe(u);var S=u?Mi(a):0;return u&&S<u?a+Dh(u-S,h):a}function sL(a,u,h){a=_t(a),u=Fe(u);var S=u?Mi(a):0;return u&&S<u?Dh(u-S,h)+a:a}function oL(a,u,h){return h||u==null?u=0:u&&(u=+u),Ib(_t(a).replace(Wc,""),u||0)}function aL(a,u,h){return(h?jr(a,u,h):u===t)?u=1:u=Fe(u),uS(_t(a),u)}function lL(){var a=arguments,u=_t(a[0]);return a.length<3?u:u.replace(a[1],a[2])}var uL=du(function(a,u,h){return a+(h?"_":"")+u.toLowerCase()});function cL(a,u,h){return h&&typeof h!="number"&&jr(a,u,h)&&(u=h=t),h=h===t?Ae:h>>>0,h?(a=_t(a),a&&(typeof u=="string"||u!=null&&!AS(u))&&(u=yn(u),!u&&eo(a))?fo(Mr(a),0,h):a.split(u,h)):[]}var fL=du(function(a,u,h){return a+(h?" ":"")+MS(u)});function dL(a,u,h){return a=_t(a),h=h==null?0:Li(Fe(h),0,a.length),u=yn(u),a.slice(h,h+u.length)==u}function pL(a,u,h){var S=$.templateSettings;h&&jr(a,u,h)&&(u=t),a=_t(a),u=TS({},u,S,SE);var P=TS({},u.imports,S.imports,SE),N=fr(P),L=Wl(P,N);$r(N,function(Ce){if(Gr.test(Ce))throw new Ie(o)});var B,z,X=0,ee=u.interpolate||sa,re="__p += '",ue=Jl((u.escape||sa).source+"|"+ee.source+"|"+(ee===kn?us:sa).source+"|"+(u.evaluate||sa).source+"|$","g"),Se="//# sourceURL="+(ht.call(u,"sourceURL")?(u.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Zv+"]")+`
|
|
3
|
+
`)}function LM(a){return Ne(a)||qa(a)||!!(hh&&a&&a[hh])}function bs(a,u){var h=typeof a;return u=u??Ve,!!u&&(h=="number"||h!="symbol"&&Ys.test(a))&&a>-1&&a%1==0&&a<u}function jr(a,u,h){if(!Ut(h))return!1;var S=typeof u;return(S=="number"?Qr(h)&&bs(u,h.length):S=="string"&&u in h)?ai(h[u],a):!1}function RS(a,u){if(Ne(a))return!1;var h=typeof a;return h=="number"||h=="symbol"||h=="boolean"||a==null||vn(a)?!0:We.test(a)||!Jr.test(a)||u!=null&&a in et(u)}function UM(a){var u=typeof a;return u=="string"||u=="number"||u=="symbol"||u=="boolean"?a!=="__proto__":a===null}function CS(a){var u=Lh(a),h=$[u];if(typeof h!="function"||!(u in ze.prototype))return!1;if(a===h)return!0;var S=SS(h);return!!S&&a===S[0]}function HM(a){return!!fh&&fh in a}var BM=pa?Ss:HS;function Rf(a){var u=a&&a.constructor,h=typeof u=="function"&&u.prototype||ro;return a===h}function EE(a){return a===a&&!Ut(a)}function qE(a,u){return function(h){return h==null?!1:h[a]===u&&(u!==t||a in et(h))}}function VM(a){var u=zh(a,function(S){return h.size===c&&h.clear(),S}),h=u.cache;return u}function WM(a,u){var h=a[1],S=u[1],P=h|S,N=P<(C|v|j),L=S==j&&h==E||S==j&&h==I&&a[7].length<=u[8]||S==(j|I)&&u[7].length<=u[8]&&h==E;if(!(N||L))return a;S&C&&(a[2]=u[2],P|=h&C?0:_);var B=u[3];if(B){var z=a[3];a[3]=z?uE(z,B,u[4]):B,a[4]=z?$n(a[3],d):u[4]}return B=u[5],B&&(z=a[5],a[5]=z?cE(z,B,u[6]):B,a[6]=z?$n(a[5],d):u[6]),B=u[7],B&&(a[7]=B),S&j&&(a[8]=a[8]==null?u[8]:sr(a[8],u[8])),a[9]==null&&(a[9]=u[9]),a[0]=u[0],a[1]=P,a}function zM(a){var u=[];if(a!=null)for(var h in et(a))u.push(h);return u}function JM(a){return Yl.call(a)}function OE(a,u,h){return u=Tt(u===t?a.length-1:u,0),function(){for(var S=arguments,P=-1,N=Tt(S.length-u,0),L=Y(N);++P<N;)L[P]=S[u+P];P=-1;for(var B=Y(u+1);++P<u;)B[P]=S[P];return B[u]=h(L),Tr(a,this,B)}}function IE(a,u){return u.length<2?a:gs(a,Dn(u,0,-1))}function GM(a,u){for(var h=a.length,S=sr(u.length,h),P=Kr(a);S--;){var N=u[S];a[S]=bs(N,h)?P[N]:t}return a}function xS(a,u){if(!(u==="constructor"&&typeof a[u]=="function")&&u!="__proto__")return a[u]}var PE=AE(Xx),Cf=Ob||function(a,u){return Xt.setTimeout(a,u)},ES=AE(yM);function kE(a,u,h){var S=u+"";return ES(a,jM(S,YM(MM(S),h)))}function AE(a){var u=0,h=0;return function(){var S=gh(),P=D-(S-h);if(h=S,P>0){if(++u>=U)return arguments[0]}else u=0;return a.apply(t,arguments)}}function Hh(a,u){var h=-1,S=a.length,P=S-1;for(u=u===t?S:u;++h<u;){var N=lS(h,P),L=a[N];a[N]=a[h],a[h]=L}return a.length=u,a}var TE=VM(function(a){var u=[];return a.charCodeAt(0)===46&&u.push(""),a.replace(Vc,function(h,S,P,N){u.push(P?N.replace(Zn,"$1"):S||h)}),u});function oi(a){if(typeof a=="string"||vn(a))return a;var u=a+"";return u=="0"&&1/a==-ce?"-0":u}function Ea(a){if(a!=null){try{return Gl.call(a)}catch{}try{return a+""}catch{}}return""}function YM(a,u){return $r(pe,function(h){var S="_."+h[0];u&h[1]&&!Ul(a,S)&&a.push(S)}),a.sort()}function $E(a){if(a instanceof ze)return a.clone();var u=new Sr(a.__wrapped__,a.__chain__);return u.__actions__=Kr(a.__actions__),u.__index__=a.__index__,u.__values__=a.__values__,u}function KM(a,u,h){(h?jr(a,u,h):u===t)?u=1:u=Tt(Fe(u),0);var S=a==null?0:a.length;if(!S||u<1)return[];for(var P=0,N=0,L=Y(ga(S/u));P<S;)L[N++]=Dn(a,P,P+=u);return L}function QM(a){for(var u=-1,h=a==null?0:a.length,S=0,P=[];++u<h;){var N=a[u];N&&(P[S++]=N)}return P}function ZM(){var a=arguments.length;if(!a)return[];for(var u=Y(a-1),h=arguments[0],S=a;S--;)u[S-1]=arguments[S];return Ni(Ne(h)?Kr(h):[h],or(u,1))}var XM=He(function(a,u){return Kt(a)?_a(a,or(u,1,Kt,!0)):[]}),eF=He(function(a,u){var h=jn(u);return Kt(h)&&(h=t),Kt(a)?_a(a,or(u,1,Kt,!0),xe(h,2)):[]}),tF=He(function(a,u){var h=jn(u);return Kt(h)&&(h=t),Kt(a)?_a(a,or(u,1,Kt,!0),t,h):[]});function rF(a,u,h){var S=a==null?0:a.length;return S?(u=h||u===t?1:Fe(u),Dn(a,u<0?0:u,S)):[]}function nF(a,u,h){var S=a==null?0:a.length;return S?(u=h||u===t?1:Fe(u),u=S-u,Dn(a,0,u<0?0:u)):[]}function iF(a,u){return a&&a.length?$h(a,xe(u,3),!0,!0):[]}function sF(a,u){return a&&a.length?$h(a,xe(u,3),!0):[]}function oF(a,u,h,S){var P=a==null?0:a.length;return P?(h&&typeof h!="number"&&jr(a,u,h)&&(h=0,S=P),tS(a,u,h,S)):[]}function NE(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=h==null?0:Fe(h);return P<0&&(P=Tt(S+P,0)),Bl(a,xe(u,3),P)}function ME(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=S-1;return h!==t&&(P=Fe(h),P=h<0?Tt(S+P,0):sr(P,S-1)),Bl(a,xe(u,3),P,!0)}function FE(a){var u=a==null?0:a.length;return u?or(a,1):[]}function aF(a){var u=a==null?0:a.length;return u?or(a,ce):[]}function lF(a,u){var h=a==null?0:a.length;return h?(u=u===t?1:Fe(u),or(a,u)):[]}function uF(a){for(var u=-1,h=a==null?0:a.length,S={};++u<h;){var P=a[u];mn(S,P[0],P[1])}return S}function DE(a){return a&&a.length?a[0]:t}function cF(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=h==null?0:Fe(h);return P<0&&(P=Tt(S+P,0)),fs(a,u,P)}function fF(a){var u=a==null?0:a.length;return u?Dn(a,0,-1):[]}var dF=He(function(a){var u=qt(a,pS);return u.length&&u[0]===a[0]?gn(u):[]}),pF=He(function(a){var u=jn(a),h=qt(a,pS);return u===jn(h)?u=t:h.pop(),h.length&&h[0]===a[0]?gn(h,xe(u,2)):[]}),hF=He(function(a){var u=jn(a),h=qt(a,pS);return u=typeof u=="function"?u:t,u&&h.pop(),h.length&&h[0]===a[0]?gn(h,t,u):[]});function mF(a,u){return a==null?"":nu.call(a,u)}function jn(a){var u=a==null?0:a.length;return u?a[u-1]:t}function gF(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=S;return h!==t&&(P=Fe(h),P=P<0?Tt(S+P,0):sr(P,S-1)),u===u?cf(a,u,P):Bl(a,ds,P,!0)}function yF(a,u){return a&&a.length?si(a,Fe(u)):t}var vF=He(jE);function jE(a,u){return a&&a.length&&u&&u.length?aS(a,u):a}function bF(a,u,h){return a&&a.length&&u&&u.length?aS(a,u,xe(h,2)):a}function SF(a,u,h){return a&&a.length&&u&&u.length?aS(a,u,t,h):a}var wF=vs(function(a,u){var h=a==null?0:a.length,S=gf(a,u);return Zx(a,qt(u,function(P){return bs(P,h)?+P:P}).sort(lE)),S});function _F(a,u){var h=[];if(!(a&&a.length))return h;var S=-1,P=[],N=a.length;for(u=xe(u,3);++S<N;){var L=a[S];u(L,S,a)&&(h.push(L),P.push(S))}return Zx(a,P),h}function qS(a){return a==null?a:Pb.call(a)}function RF(a,u,h){var S=a==null?0:a.length;return S?(h&&typeof h!="number"&&jr(a,u,h)?(u=0,h=S):(u=u==null?0:Fe(u),h=h===t?S:Fe(h)),Dn(a,u,h)):[]}function CF(a,u){return Th(a,u)}function xF(a,u,h){return cS(a,u,xe(h,2))}function EF(a,u){var h=a==null?0:a.length;if(h){var S=Th(a,u);if(S<h&&ai(a[S],u))return S}return-1}function qF(a,u){return Th(a,u,!0)}function OF(a,u,h){return cS(a,u,xe(h,2),!0)}function IF(a,u){var h=a==null?0:a.length;if(h){var S=Th(a,u,!0)-1;if(ai(a[S],u))return S}return-1}function PF(a){return a&&a.length?eE(a):[]}function kF(a,u){return a&&a.length?eE(a,xe(u,2)):[]}function AF(a){var u=a==null?0:a.length;return u?Dn(a,1,u):[]}function TF(a,u,h){return a&&a.length?(u=h||u===t?1:Fe(u),Dn(a,0,u<0?0:u)):[]}function $F(a,u,h){var S=a==null?0:a.length;return S?(u=h||u===t?1:Fe(u),u=S-u,Dn(a,u<0?0:u,S)):[]}function NF(a,u){return a&&a.length?$h(a,xe(u,3),!1,!0):[]}function MF(a,u){return a&&a.length?$h(a,xe(u,3)):[]}var FF=He(function(a){return uo(or(a,1,Kt,!0))}),DF=He(function(a){var u=jn(a);return Kt(u)&&(u=t),uo(or(a,1,Kt,!0),xe(u,2))}),jF=He(function(a){var u=jn(a);return u=typeof u=="function"?u:t,uo(or(a,1,Kt,!0),t,u)});function LF(a){return a&&a.length?uo(a):[]}function UF(a,u){return a&&a.length?uo(a,xe(u,2)):[]}function HF(a,u){return u=typeof u=="function"?u:t,a&&a.length?uo(a,t,u):[]}function OS(a){if(!(a&&a.length))return[];var u=0;return a=$i(a,function(h){if(Kt(h))return u=Tt(h.length,u),!0}),lf(u,function(h){return qt(a,ua(h))})}function LE(a,u){if(!(a&&a.length))return[];var h=OS(a);return u==null?h:qt(h,function(S){return Tr(u,t,S)})}var BF=He(function(a,u){return Kt(a)?_a(a,u):[]}),VF=He(function(a){return dS($i(a,Kt))}),WF=He(function(a){var u=jn(a);return Kt(u)&&(u=t),dS($i(a,Kt),xe(u,2))}),zF=He(function(a){var u=jn(a);return u=typeof u=="function"?u:t,dS($i(a,Kt),t,u)}),JF=He(OS);function GF(a,u){return iE(a||[],u||[],Dr)}function YF(a,u){return iE(a||[],u||[],wf)}var KF=He(function(a){var u=a.length,h=u>1?a[u-1]:t;return h=typeof h=="function"?(a.pop(),h):t,LE(a,h)});function UE(a){var u=$(a);return u.__chain__=!0,u}function QF(a,u){return u(a),a}function Bh(a,u){return u(a)}var ZF=vs(function(a){var u=a.length,h=u?a[0]:0,S=this.__wrapped__,P=function(N){return gf(N,a)};return u>1||this.__actions__.length||!(S instanceof ze)||!bs(h)?this.thru(P):(S=S.slice(h,+h+(u?1:0)),S.__actions__.push({func:Bh,args:[P],thisArg:t}),new Sr(S,this.__chain__).thru(function(N){return u&&!N.length&&N.push(t),N}))});function XF(){return UE(this)}function eD(){return new Sr(this.value(),this.__chain__)}function tD(){this.__values__===t&&(this.__values__=tq(this.value()));var a=this.__index__>=this.__values__.length,u=a?t:this.__values__[this.__index__++];return{done:a,value:u}}function rD(){return this}function nD(a){for(var u,h=this;h instanceof ou;){var S=$E(h);S.__index__=0,S.__values__=t,u?P.__wrapped__=S:u=S;var P=S;h=h.__wrapped__}return P.__wrapped__=a,u}function iD(){var a=this.__wrapped__;if(a instanceof ze){var u=a;return this.__actions__.length&&(u=new ze(this)),u=u.reverse(),u.__actions__.push({func:Bh,args:[qS],thisArg:t}),new Sr(u,this.__chain__)}return this.thru(qS)}function sD(){return nE(this.__wrapped__,this.__actions__)}var oD=Nh(function(a,u,h){ht.call(a,h)?++a[h]:mn(a,h,1)});function aD(a,u,h){var S=Ne(a)?nh:eS;return h&&jr(a,u,h)&&(u=t),S(a,xe(u,3))}function lD(a,u){var h=Ne(a)?$i:Ih;return h(a,xe(u,3))}var uD=hE(NE),cD=hE(ME);function fD(a,u){return or(Vh(a,u),1)}function dD(a,u){return or(Vh(a,u),ce)}function pD(a,u,h){return h=h===t?1:Fe(h),or(Vh(a,u),h)}function HE(a,u){var h=Ne(a)?$r:Ui;return h(a,xe(u,3))}function BE(a,u){var h=Ne(a)?nf:Oh;return h(a,xe(u,3))}var hD=Nh(function(a,u,h){ht.call(a,h)?a[h].push(u):mn(a,h,[u])});function mD(a,u,h,S){a=Qr(a)?a:mu(a),h=h&&!S?Fe(h):0;var P=a.length;return h<0&&(h=Tt(P+h,0)),Yh(a)?h<=P&&a.indexOf(u,h)>-1:!!P&&fs(a,u,h)>-1}var gD=He(function(a,u,h){var S=-1,P=typeof u=="function",N=Qr(a)?Y(a.length):[];return Ui(a,function(L){N[++S]=P?Tr(u,L,h):Ra(L,u,h)}),N}),yD=Nh(function(a,u,h){mn(a,h,u)});function Vh(a,u){var h=Ne(a)?qt:fe;return h(a,xe(u,3))}function vD(a,u,h,S){return a==null?[]:(Ne(u)||(u=u==null?[]:[u]),h=S?t:h,Ne(h)||(h=h==null?[]:[h]),Kx(a,u,h))}var bD=Nh(function(a,u,h){a[h?0:1].push(u)},function(){return[[],[]]});function SD(a,u,h){var S=Ne(a)?sf:Vl,P=arguments.length<3;return S(a,xe(u,4),h,P,Ui)}function wD(a,u,h){var S=Ne(a)?rb:Vl,P=arguments.length<3;return S(a,xe(u,4),h,P,Oh)}function _D(a,u){var h=Ne(a)?$i:Ih;return h(a,Jh(xe(u,3)))}function RD(a){var u=Ne(a)?xh:mM;return u(a)}function CD(a,u,h){(h?jr(a,u,h):u===t)?u=1:u=Fe(u);var S=Ne(a)?Kb:gM;return S(a,u)}function xD(a){var u=Ne(a)?Qb:vM;return u(a)}function ED(a){if(a==null)return 0;if(Qr(a))return Yh(a)?Mi(a):a.length;var u=_r(a);return u==At||u==be?a.size:T(a).length}function qD(a,u,h){var S=Ne(a)?Hl:bM;return h&&jr(a,u,h)&&(u=t),S(a,xe(u,3))}var OD=He(function(a,u){if(a==null)return[];var h=u.length;return h>1&&jr(a,u[0],u[1])?u=[]:h>2&&jr(u[0],u[1],u[2])&&(u=[u[0]]),Kx(a,or(u,1),[])}),Wh=qb||function(){return Xt.Date.now()};function ID(a,u){if(typeof u!="function")throw new Fr(i);return a=Fe(a),function(){if(--a<1)return u.apply(this,arguments)}}function VE(a,u,h){return u=h?t:u,u=a&&u==null?a.length:u,ys(a,j,t,t,t,t,u)}function WE(a,u){var h;if(typeof u!="function")throw new Fr(i);return a=Fe(a),function(){return--a>0&&(h=u.apply(this,arguments)),a<=1&&(u=t),h}}var IS=He(function(a,u,h){var S=C;if(h.length){var P=$n(h,pu(IS));S|=O}return ys(a,S,u,h,P)}),zE=He(function(a,u,h){var S=C|v;if(h.length){var P=$n(h,pu(zE));S|=O}return ys(u,S,a,h,P)});function JE(a,u,h){u=h?t:u;var S=ys(a,E,t,t,t,t,t,u);return S.placeholder=JE.placeholder,S}function GE(a,u,h){u=h?t:u;var S=ys(a,k,t,t,t,t,t,u);return S.placeholder=GE.placeholder,S}function YE(a,u,h){var S,P,N,L,B,z,X=0,ee=!1,re=!1,ue=!0;if(typeof a!="function")throw new Fr(i);u=Ln(u)||0,Ut(h)&&(ee=!!h.leading,re="maxWait"in h,N=re?Tt(Ln(h.maxWait)||0,u):N,ue="trailing"in h?!!h.trailing:ue);function Se(Qt){var li=S,_s=P;return S=P=t,X=Qt,L=a.apply(_s,li),L}function Ee(Qt){return X=Qt,B=Cf(Ze,u),ee?Se(Qt):L}function je(Qt){var li=Qt-z,_s=Qt-X,mq=u-li;return re?sr(mq,N-_s):mq}function Ce(Qt){var li=Qt-z,_s=Qt-X;return z===t||li>=u||li<0||re&&_s>=N}function Ze(){var Qt=Wh();if(Ce(Qt))return tt(Qt);B=Cf(Ze,je(Qt))}function tt(Qt){return B=t,ue&&S?Se(Qt):(S=P=t,L)}function bn(){B!==t&&sE(B),X=0,S=z=P=B=t}function Lr(){return B===t?L:tt(Wh())}function Sn(){var Qt=Wh(),li=Ce(Qt);if(S=arguments,P=this,z=Qt,li){if(B===t)return Ee(z);if(re)return sE(B),B=Cf(Ze,u),Se(z)}return B===t&&(B=Cf(Ze,u)),L}return Sn.cancel=bn,Sn.flush=Lr,Sn}var PD=He(function(a,u){return yf(a,1,u)}),kD=He(function(a,u,h){return yf(a,Ln(u)||0,h)});function AD(a){return ys(a,R)}function zh(a,u){if(typeof a!="function"||u!=null&&typeof u!="function")throw new Fr(i);var h=function(){var S=arguments,P=u?u.apply(this,S):S[0],N=h.cache;if(N.has(P))return N.get(P);var L=a.apply(this,S);return h.cache=N.set(P,L)||N,L};return h.cache=new(zh.Cache||ri),h}zh.Cache=ri;function Jh(a){if(typeof a!="function")throw new Fr(i);return function(){var u=arguments;switch(u.length){case 0:return!a.call(this);case 1:return!a.call(this,u[0]);case 2:return!a.call(this,u[0],u[1]);case 3:return!a.call(this,u[0],u[1],u[2])}return!a.apply(this,u)}}function TD(a){return WE(2,a)}var $D=SM(function(a,u){u=u.length==1&&Ne(u[0])?qt(u[0],Nr(xe())):qt(or(u,1),Nr(xe()));var h=u.length;return He(function(S){for(var P=-1,N=sr(S.length,h);++P<N;)S[P]=u[P].call(this,S[P]);return Tr(a,this,S)})}),PS=He(function(a,u){var h=$n(u,pu(PS));return ys(a,O,t,u,h)}),KE=He(function(a,u){var h=$n(u,pu(KE));return ys(a,M,t,u,h)}),ND=vs(function(a,u){return ys(a,I,t,t,t,u)});function MD(a,u){if(typeof a!="function")throw new Fr(i);return u=u===t?u:Fe(u),He(a,u)}function FD(a,u){if(typeof a!="function")throw new Fr(i);return u=u==null?0:Tt(Fe(u),0),He(function(h){var S=h[u],P=fo(h,0,u);return S&&Ni(P,S),Tr(a,this,P)})}function DD(a,u,h){var S=!0,P=!0;if(typeof a!="function")throw new Fr(i);return Ut(h)&&(S="leading"in h?!!h.leading:S,P="trailing"in h?!!h.trailing:P),YE(a,u,{leading:S,maxWait:u,trailing:P})}function jD(a){return VE(a,1)}function LD(a,u){return PS(hS(u),a)}function UD(){if(!arguments.length)return[];var a=arguments[0];return Ne(a)?a:[a]}function HD(a){return wr(a,y)}function BD(a,u){return u=typeof u=="function"?u:t,wr(a,y,u)}function VD(a){return wr(a,p|y)}function WD(a,u){return u=typeof u=="function"?u:t,wr(a,p|y,u)}function zD(a,u){return u==null||Mn(a,u,fr(u))}function ai(a,u){return a===u||a!==a&&u!==u}var JD=jh(bf),GD=jh(function(a,u){return a>=u}),qa=Ah((function(){return arguments})())?Ah:function(a){return Vt(a)&&ht.call(a,"callee")&&!ha.call(a,"callee")},Ne=Y.isArray,YD=rf?Nr(rf):sS;function Qr(a){return a!=null&&Gh(a.length)&&!Ss(a)}function Kt(a){return Vt(a)&&Qr(a)}function KD(a){return a===!0||a===!1||Vt(a)&&dr(a)==Ar}var po=ru||HS,QD=th?Nr(th):oS;function ZD(a){return Vt(a)&&a.nodeType===1&&!xf(a)}function XD(a){if(a==null)return!0;if(Qr(a)&&(Ne(a)||typeof a=="string"||typeof a.splice=="function"||po(a)||hu(a)||qa(a)))return!a.length;var u=_r(a);if(u==At||u==be)return!a.size;if(Rf(a))return!T(a).length;for(var h in a)if(ht.call(a,h))return!1;return!0}function ej(a,u){return Ca(a,u)}function tj(a,u,h){h=typeof h=="function"?h:t;var S=h?h(a,u):t;return S===t?Ca(a,u,t,h):!!S}function kS(a){if(!Vt(a))return!1;var u=dr(a);return u==wt||u==xt||typeof a.message=="string"&&typeof a.name=="string"&&!xf(a)}function rj(a){return typeof a=="number"&&hs(a)}function Ss(a){if(!Ut(a))return!1;var u=dr(a);return u==zr||u==Ws||u==ut||u==Pe}function QE(a){return typeof a=="number"&&a==Fe(a)}function Gh(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=Ve}function Ut(a){var u=typeof a;return a!=null&&(u=="object"||u=="function")}function Vt(a){return a!=null&&typeof a=="object"}var ZE=rh?Nr(rh):ao;function nj(a,u){return a===u||lo(a,u,wS(u))}function ij(a,u,h){return h=typeof h=="function"?h:t,lo(a,u,wS(u),h)}function sj(a){return XE(a)&&a!=+a}function oj(a){if(BM(a))throw new Ie(n);return Qe(a)}function aj(a){return a===null}function lj(a){return a==null}function XE(a){return typeof a=="number"||Vt(a)&&dr(a)==Ai}function xf(a){if(!Vt(a)||dr(a)!=te)return!1;var u=Zl(a);if(u===null)return!0;var h=ht.call(u,"constructor")&&u.constructor;return typeof h=="function"&&h instanceof h&&Gl.call(h)==Rb}var AS=la?Nr(la):f;function uj(a){return QE(a)&&a>=-Ve&&a<=Ve}var eq=Xn?Nr(Xn):g;function Yh(a){return typeof a=="string"||!Ne(a)&&Vt(a)&&dr(a)==Ke}function vn(a){return typeof a=="symbol"||Vt(a)&&dr(a)==ur}var hu=Ll?Nr(Ll):w;function cj(a){return a===t}function fj(a){return Vt(a)&&_r(a)==ge}function dj(a){return Vt(a)&&dr(a)==In}var pj=jh(K),hj=jh(function(a,u){return a<=u});function tq(a){if(!a)return[];if(Qr(a))return Yh(a)?Mr(a):Kr(a);if(ma&&a[ma])return pb(a[ma]());var u=_r(a),h=u==At?to:u==be?zl:mu;return h(a)}function ws(a){if(!a)return a===0?a:0;if(a=Ln(a),a===ce||a===-ce){var u=a<0?-1:1;return u*Re}return a===a?a:0}function Fe(a){var u=ws(a),h=u%1;return u===u?h?u-h:u:0}function rq(a){return a?Li(Fe(a),0,Ae):0}function Ln(a){if(typeof a=="number")return a;if(vn(a))return me;if(Ut(a)){var u=typeof a.valueOf=="function"?a.valueOf():a;a=Ut(u)?u+"":u}if(typeof a!="string")return a===0?a:+a;a=uf(a);var h=na.test(a);return h||Av.test(a)?eb(a.slice(2),h?2:8):kv.test(a)?me:+a}function nq(a){return Hi(a,Zr(a))}function mj(a){return a?Li(Fe(a),-Ve,Ve):a===0?a:0}function _t(a){return a==null?"":yn(a)}var gj=fu(function(a,u){if(Rf(u)||Qr(u)){Hi(u,fr(u),a);return}for(var h in u)ht.call(u,h)&&Dr(a,h,u[h])}),iq=fu(function(a,u){Hi(u,Zr(u),a)}),sq=fu(function(a,u,h,S){Hi(u,Zr(u),a,S)}),TS=fu(function(a,u,h,S){Hi(u,fr(u),a,S)}),yj=vs(gf);function vj(a,u){var h=so(a);return u==null?h:qh(h,u)}var bj=He(function(a,u){a=et(a);var h=-1,S=u.length,P=S>2?u[2]:t;for(P&&jr(u[0],u[1],P)&&(S=1);++h<S;)for(var N=u[h],L=Zr(N),B=-1,z=L.length;++B<z;){var X=L[B],ee=a[X];(ee===t||ai(ee,ro[X])&&!ht.call(a,X))&&(a[X]=N[X])}return a}),Sj=He(function(a){return a.push(t,wE),Tr(oq,t,a)});function wj(a,u){return ih(a,xe(u,3),Fn)}function _j(a,u){return ih(a,xe(u,3),ni)}function Rj(a,u){return a==null?a:vf(a,xe(u,3),Zr)}function Cj(a,u){return a==null?a:Ph(a,xe(u,3),Zr)}function xj(a,u){return a&&Fn(a,xe(u,3))}function Ej(a,u){return a&&ni(a,xe(u,3))}function qj(a){return a==null?[]:cu(a,fr(a))}function Oj(a){return a==null?[]:cu(a,Zr(a))}function $S(a,u,h){var S=a==null?t:gs(a,u);return S===t?h:S}function Ij(a,u){return a!=null&&CE(a,u,rS)}function NS(a,u){return a!=null&&CE(a,u,nS)}var Pj=gE(function(a,u,h){u!=null&&typeof u.toString!="function"&&(u=Yl.call(u)),a[u]=h},FS(Xr)),kj=gE(function(a,u,h){u!=null&&typeof u.toString!="function"&&(u=Yl.call(u)),ht.call(a,u)?a[u].push(h):a[u]=[h]},xe),Aj=He(Ra);function fr(a){return Qr(a)?Ch(a):T(a)}function Zr(a){return Qr(a)?Ch(a,!0):H(a)}function Tj(a,u){var h={};return u=xe(u,3),Fn(a,function(S,P,N){mn(h,u(S,P,N),S)}),h}function $j(a,u){var h={};return u=xe(u,3),Fn(a,function(S,P,N){mn(h,P,u(S,P,N))}),h}var Nj=fu(function(a,u,h){er(a,u,h)}),oq=fu(function(a,u,h,S){er(a,u,h,S)}),Mj=vs(function(a,u){var h={};if(a==null)return h;var S=!1;u=qt(u,function(N){return N=co(N,a),S||(S=N.length>1),N}),Hi(a,bS(a),h),S&&(h=wr(h,p|m|y,kM));for(var P=u.length;P--;)fS(h,u[P]);return h});function Fj(a,u){return aq(a,Jh(xe(u)))}var Dj=vs(function(a,u){return a==null?{}:dM(a,u)});function aq(a,u){if(a==null)return{};var h=qt(bS(a),function(S){return[S]});return u=xe(u),Qx(a,h,function(S,P){return u(S,P[0])})}function jj(a,u,h){u=co(u,a);var S=-1,P=u.length;for(P||(P=1,a=t);++S<P;){var N=a==null?t:a[oi(u[S])];N===t&&(S=P,N=h),a=Ss(N)?N.call(a):N}return a}function Lj(a,u,h){return a==null?a:wf(a,u,h)}function Uj(a,u,h,S){return S=typeof S=="function"?S:t,a==null?a:wf(a,u,h,S)}var lq=bE(fr),uq=bE(Zr);function Hj(a,u,h){var S=Ne(a),P=S||po(a)||hu(a);if(u=xe(u,4),h==null){var N=a&&a.constructor;P?h=S?new N:[]:Ut(a)?h=Ss(N)?so(Zl(a)):{}:h={}}return(P?$r:Fn)(a,function(L,B,z){return u(h,L,B,z)}),h}function Bj(a,u){return a==null?!0:fS(a,u)}function Vj(a,u,h){return a==null?a:rE(a,u,hS(h))}function Wj(a,u,h,S){return S=typeof S=="function"?S:t,a==null?a:rE(a,u,hS(h),S)}function mu(a){return a==null?[]:Wl(a,fr(a))}function zj(a){return a==null?[]:Wl(a,Zr(a))}function Jj(a,u,h){return h===t&&(h=u,u=t),h!==t&&(h=Ln(h),h=h===h?h:0),u!==t&&(u=Ln(u),u=u===u?u:0),Li(Ln(a),u,h)}function Gj(a,u,h){return u=ws(u),h===t?(h=u,u=0):h=ws(h),a=Ln(a),iS(a,u,h)}function Yj(a,u,h){if(h&&typeof h!="boolean"&&jr(a,u,h)&&(u=h=t),h===t&&(typeof u=="boolean"?(h=u,u=t):typeof a=="boolean"&&(h=a,a=t)),a===t&&u===t?(a=0,u=1):(a=ws(a),u===t?(u=a,a=0):u=ws(u)),a>u){var S=a;a=u,u=S}if(h||a%1||u%1){var P=yh();return sr(a+P*(u-a+Xp("1e-"+((P+"").length-1))),u)}return lS(a,u)}var Kj=du(function(a,u,h){return u=u.toLowerCase(),a+(h?cq(u):u)});function cq(a){return MS(_t(a).toLowerCase())}function fq(a){return a=_t(a),a&&a.replace(ia,ub).replace(Jv,"")}function Qj(a,u,h){a=_t(a),u=yn(u);var S=a.length;h=h===t?S:Li(Fe(h),0,S);var P=h;return h-=u.length,h>=0&&a.slice(h,P)==u}function Zj(a){return a=_t(a),a&&he.test(a)?a.replace(kl,cb):a}function Xj(a){return a=_t(a),a&&ra.test(a)?a.replace(dt,"\\$&"):a}var eL=du(function(a,u,h){return a+(h?"-":"")+u.toLowerCase()}),tL=du(function(a,u,h){return a+(h?" ":"")+u.toLowerCase()}),rL=pE("toLowerCase");function nL(a,u,h){a=_t(a),u=Fe(u);var S=u?Mi(a):0;if(!u||S>=u)return a;var P=(u-S)/2;return Dh(ya(P),h)+a+Dh(ga(P),h)}function iL(a,u,h){a=_t(a),u=Fe(u);var S=u?Mi(a):0;return u&&S<u?a+Dh(u-S,h):a}function sL(a,u,h){a=_t(a),u=Fe(u);var S=u?Mi(a):0;return u&&S<u?Dh(u-S,h)+a:a}function oL(a,u,h){return h||u==null?u=0:u&&(u=+u),Ib(_t(a).replace(Wc,""),u||0)}function aL(a,u,h){return(h?jr(a,u,h):u===t)?u=1:u=Fe(u),uS(_t(a),u)}function lL(){var a=arguments,u=_t(a[0]);return a.length<3?u:u.replace(a[1],a[2])}var uL=du(function(a,u,h){return a+(h?"_":"")+u.toLowerCase()});function cL(a,u,h){return h&&typeof h!="number"&&jr(a,u,h)&&(u=h=t),h=h===t?Ae:h>>>0,h?(a=_t(a),a&&(typeof u=="string"||u!=null&&!AS(u))&&(u=yn(u),!u&&eo(a))?fo(Mr(a),0,h):a.split(u,h)):[]}var fL=du(function(a,u,h){return a+(h?" ":"")+MS(u)});function dL(a,u,h){return a=_t(a),h=h==null?0:Li(Fe(h),0,a.length),u=yn(u),a.slice(h,h+u.length)==u}function pL(a,u,h){var S=$.templateSettings;h&&jr(a,u,h)&&(u=t),a=_t(a),u=TS({},u,S,SE);var P=TS({},u.imports,S.imports,SE),N=fr(P),L=Wl(P,N);$r(N,function(Ce){if(Gr.test(Ce))throw new Ie(o)});var B,z,X=0,ee=u.interpolate||sa,re="__p += '",ue=Jl((u.escape||sa).source+"|"+ee.source+"|"+(ee===kn?us:sa).source+"|"+(u.evaluate||sa).source+"|$","g"),Se="//# sourceURL="+(ht.call(u,"sourceURL")?(u.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Zv+"]")+`
|
|
4
4
|
`;a.replace(ue,function(Ce,Ze,tt,bn,Lr,Sn){return tt||(tt=bn),re+=a.slice(X,Sn).replace(Tv,fb),Ze&&(B=!0,re+=`' +
|
|
5
5
|
__e(`+Ze+`) +
|
|
6
6
|
'`),Lr&&(z=!0,re+=`';
|
|
@@ -17,17 +17,17 @@ __p += '`),tt&&(re+=`' +
|
|
|
17
17
|
function print() { __p += __j.call(arguments, '') }
|
|
18
18
|
`:`;
|
|
19
19
|
`)+re+`return __p
|
|
20
|
-
}`;var je=pq(function(){return ct(N,Se+"return "+re).apply(t,L)});if(je.source=re,kS(je))throw je;return je}function hL(a){return _t(a).toLowerCase()}function mL(a){return _t(a).toUpperCase()}function gL(a,u,h){if(a=_t(a),a&&(h||u===t))return uf(a);if(!a||!(u=yn(u)))return a;var S=Mr(a),P=Mr(u),N=oh(S,P),L=ah(S,P)+1;return fo(S,N,L).join("")}function yL(a,u,h){if(a=_t(a),a&&(h||u===t))return a.slice(0,ch(a)+1);if(!a||!(u=yn(u)))return a;var S=Mr(a),P=ah(S,Mr(u))+1;return fo(S,0,P).join("")}function vL(a,u,h){if(a=_t(a),a&&(h||u===t))return a.replace(Wc,"");if(!a||!(u=yn(u)))return a;var S=Mr(a),P=oh(S,Mr(u));return fo(S,P).join("")}function bL(a,u){var h=A,S=F;if(Ut(u)){var P="separator"in u?u.separator:P;h="length"in u?Fe(u.length):h,S="omission"in u?yn(u.omission):S}a=_t(a);var N=a.length;if(eo(a)){var L=Mr(a);N=L.length}if(h>=N)return a;var B=h-Mi(S);if(B<1)return S;var z=L?fo(L,0,B).join(""):a.slice(0,B);if(P===t)return z+S;if(L&&(B+=z.length-B),AS(P)){if(a.slice(B).search(P)){var X,ee=z;for(P.global||(P=Jl(P.source,_t(jp.exec(P))+"g")),P.lastIndex=0;X=P.exec(ee);)var re=X.index;z=z.slice(0,re===t?B:re)}}else if(a.indexOf(yn(P),B)!=B){var ue=z.lastIndexOf(P);ue>-1&&(z=z.slice(0,ue))}return z+S}function SL(a){return a=_t(a),a&&Al.test(a)?a.replace(ls,mb):a}var wL=du(function(a,u,h){return a+(h?" ":"")+u.toUpperCase()}),MS=pE("toUpperCase");function dq(a,u,h){return a=_t(a),u=h?t:u,u===t?db(a)?vb(a):sb(a):a.match(u)||[]}var pq=He(function(a,u){try{return Tr(a,t,u)}catch(h){return kS(h)?h:new Ie(h)}}),_L=vs(function(a,u){return $r(u,function(h){h=oi(h),mn(a,h,IS(a[h],a))}),a});function RL(a){var u=a==null?0:a.length,h=xe();return a=u?qt(a,function(S){if(typeof S[1]!="function")throw new Fr(i);return[h(S[0]),S[1]]}):[],He(function(S){for(var P=-1;++P<u;){var N=a[P];if(Tr(N[0],this,S))return Tr(N[1],this,S)}})}function CL(a){return Xb(wr(a,p))}function FS(a){return function(){return a}}function xL(a,u){return a==null||a!==a?u:a}var EL=mE(),qL=mE(!0);function Xr(a){return a}function DS(a){return x(typeof a=="function"?a:wr(a,p))}function OL(a){return Oe(wr(a,p))}function IL(a,u){return Je(a,wr(u,p))}var PL=He(function(a,u){return function(h){return Ra(h,a,u)}}),kL=He(function(a,u){return function(h){return Ra(a,h,u)}});function jS(a,u,h){var S=fr(u),P=cu(u,S);h==null&&!(Ut(u)&&(P.length||!S.length))&&(h=u,u=a,a=this,P=cu(u,fr(u)));var N=!(Ut(h)&&"chain"in h)||!!h.chain,L=Ss(a);return $r(P,function(B){var z=u[B];a[B]=z,L&&(a.prototype[B]=function(){var X=this.__chain__;if(N||X){var ee=a(this.__wrapped__),re=ee.__actions__=Kr(this.__actions__);return re.push({func:z,args:arguments,thisArg:a}),ee.__chain__=X,ee}return z.apply(a,Ni([this.value()],arguments))})}),a}function AL(){return Xt._===this&&(Xt._=Cb),this}function LS(){}function TL(a){return a=Fe(a),He(function(u){return si(u,a)})}var $L=gS(qt),NL=gS(nh),ML=gS(Hl);function hq(a){return RS(a)?ua(oi(a)):pM(a)}function FL(a){return function(u){return a==null?t:gs(a,u)}}var DL=yE(),jL=yE(!0);function US(){return[]}function HS(){return!1}function LL(){return{}}function UL(){return""}function HL(){return!0}function BL(a,u){if(a=Fe(a),a<1||a>Ve)return[];var h=Ae,S=sr(a,Ae);u=xe(u),a-=Ae;for(var P=lf(S,u);++h<a;)u(h);return P}function VL(a){return Ne(a)?qt(a,oi):vn(a)?[a]:Kr(TE(_t(a)))}function WL(a){var u=++_b;return _t(a)+u}var zL=Fh(function(a,u){return a+u},0),JL=yS("ceil"),GL=Fh(function(a,u){return a/u},1),YL=yS("floor");function KL(a){return a&&a.length?uu(a,Xr,bf):t}function QL(a,u){return a&&a.length?uu(a,xe(u,2),bf):t}function ZL(a){return sh(a,Xr)}function XL(a,u){return sh(a,xe(u,2))}function e2(a){return a&&a.length?uu(a,Xr,K):t}function t2(a,u){return a&&a.length?uu(a,xe(u,2),K):t}var r2=Fh(function(a,u){return a*u},1),n2=yS("round"),i2=Fh(function(a,u){return a-u},0);function s2(a){return a&&a.length?af(a,Xr):0}function o2(a,u){return a&&a.length?af(a,xe(u,2)):0}return $.after=ID,$.ary=VE,$.assign=gj,$.assignIn=iq,$.assignInWith=sq,$.assignWith=TS,$.at=yj,$.before=WE,$.bind=IS,$.bindAll=_L,$.bindKey=zE,$.castArray=UD,$.chain=UE,$.chunk=KM,$.compact=QM,$.concat=ZM,$.cond=RL,$.conforms=CL,$.constant=FS,$.countBy=oD,$.create=vj,$.curry=JE,$.curryRight=GE,$.debounce=YE,$.defaults=bj,$.defaultsDeep=Sj,$.defer=PD,$.delay=kD,$.difference=XM,$.differenceBy=eF,$.differenceWith=tF,$.drop=rF,$.dropRight=nF,$.dropRightWhile=iF,$.dropWhile=sF,$.fill=oF,$.filter=lD,$.flatMap=fD,$.flatMapDeep=dD,$.flatMapDepth=pD,$.flatten=FE,$.flattenDeep=aF,$.flattenDepth=lF,$.flip=AD,$.flow=EL,$.flowRight=qL,$.fromPairs=uF,$.functions=qj,$.functionsIn=Oj,$.groupBy=hD,$.initial=fF,$.intersection=dF,$.intersectionBy=pF,$.intersectionWith=hF,$.invert=Pj,$.invertBy=kj,$.invokeMap=gD,$.iteratee=DS,$.keyBy=yD,$.keys=fr,$.keysIn=Zr,$.map=Vh,$.mapKeys=Tj,$.mapValues=$j,$.matches=OL,$.matchesProperty=IL,$.memoize=zh,$.merge=Nj,$.mergeWith=oq,$.method=PL,$.methodOf=kL,$.mixin=jS,$.negate=Jh,$.nthArg=TL,$.omit=Mj,$.omitBy=Fj,$.once=TD,$.orderBy=vD,$.over=$L,$.overArgs=$D,$.overEvery=NL,$.overSome=ML,$.partial=PS,$.partialRight=KE,$.partition=bD,$.pick=Dj,$.pickBy=aq,$.property=hq,$.propertyOf=FL,$.pull=vF,$.pullAll=jE,$.pullAllBy=bF,$.pullAllWith=SF,$.pullAt=wF,$.range=DL,$.rangeRight=jL,$.rearg=ND,$.reject=_D,$.remove=_F,$.rest=MD,$.reverse=qS,$.sampleSize=CD,$.set=Lj,$.setWith=Uj,$.shuffle=xD,$.slice=RF,$.sortBy=OD,$.sortedUniq=PF,$.sortedUniqBy=kF,$.split=cL,$.spread=FD,$.tail=AF,$.take=TF,$.takeRight=$F,$.takeRightWhile=NF,$.takeWhile=MF,$.tap=QF,$.throttle=DD,$.thru=Bh,$.toArray=tq,$.toPairs=lq,$.toPairsIn=uq,$.toPath=VL,$.toPlainObject=nq,$.transform=Hj,$.unary=jD,$.union=FF,$.unionBy=DF,$.unionWith=jF,$.uniq=LF,$.uniqBy=UF,$.uniqWith=HF,$.unset=Bj,$.unzip=OS,$.unzipWith=LE,$.update=Vj,$.updateWith=Wj,$.values=mu,$.valuesIn=zj,$.without=BF,$.words=dq,$.wrap=LD,$.xor=VF,$.xorBy=WF,$.xorWith=zF,$.zip=JF,$.zipObject=GF,$.zipObjectDeep=YF,$.zipWith=KF,$.entries=lq,$.entriesIn=uq,$.extend=iq,$.extendWith=sq,jS($,$),$.add=zL,$.attempt=pq,$.camelCase=Kj,$.capitalize=cq,$.ceil=JL,$.clamp=Jj,$.clone=HD,$.cloneDeep=VD,$.cloneDeepWith=WD,$.cloneWith=BD,$.conformsTo=zD,$.deburr=fq,$.defaultTo=xL,$.divide=GL,$.endsWith=Qj,$.eq=ai,$.escape=Zj,$.escapeRegExp=Xj,$.every=aD,$.find=uD,$.findIndex=NE,$.findKey=wj,$.findLast=cD,$.findLastIndex=ME,$.findLastKey=_j,$.floor=YL,$.forEach=HE,$.forEachRight=BE,$.forIn=Rj,$.forInRight=Cj,$.forOwn=xj,$.forOwnRight=Ej,$.get=$S,$.gt=JD,$.gte=GD,$.has=Ij,$.hasIn=NS,$.head=DE,$.identity=Xr,$.includes=mD,$.indexOf=cF,$.inRange=Gj,$.invoke=Aj,$.isArguments=qa,$.isArray=Ne,$.isArrayBuffer=YD,$.isArrayLike=Qr,$.isArrayLikeObject=Kt,$.isBoolean=KD,$.isBuffer=po,$.isDate=QD,$.isElement=ZD,$.isEmpty=XD,$.isEqual=ej,$.isEqualWith=tj,$.isError=kS,$.isFinite=rj,$.isFunction=Ss,$.isInteger=QE,$.isLength=Gh,$.isMap=ZE,$.isMatch=nj,$.isMatchWith=ij,$.isNaN=sj,$.isNative=oj,$.isNil=lj,$.isNull=aj,$.isNumber=XE,$.isObject=Ut,$.isObjectLike=Vt,$.isPlainObject=xf,$.isRegExp=AS,$.isSafeInteger=uj,$.isSet=eq,$.isString=Yh,$.isSymbol=vn,$.isTypedArray=hu,$.isUndefined=cj,$.isWeakMap=fj,$.isWeakSet=dj,$.join=mF,$.kebabCase=eL,$.last=jn,$.lastIndexOf=gF,$.lowerCase=tL,$.lowerFirst=rL,$.lt=pj,$.lte=hj,$.max=KL,$.maxBy=QL,$.mean=ZL,$.meanBy=XL,$.min=e2,$.minBy=t2,$.stubArray=US,$.stubFalse=HS,$.stubObject=LL,$.stubString=UL,$.stubTrue=HL,$.multiply=r2,$.nth=yF,$.noConflict=AL,$.noop=LS,$.now=Wh,$.pad=nL,$.padEnd=iL,$.padStart=sL,$.parseInt=oL,$.random=Yj,$.reduce=SD,$.reduceRight=wD,$.repeat=aL,$.replace=lL,$.result=jj,$.round=n2,$.runInContext=W,$.sample=RD,$.size=ED,$.snakeCase=uL,$.some=qD,$.sortedIndex=CF,$.sortedIndexBy=xF,$.sortedIndexOf=EF,$.sortedLastIndex=qF,$.sortedLastIndexBy=OF,$.sortedLastIndexOf=IF,$.startCase=fL,$.startsWith=dL,$.subtract=i2,$.sum=s2,$.sumBy=o2,$.template=pL,$.times=BL,$.toFinite=ws,$.toInteger=Fe,$.toLength=rq,$.toLower=hL,$.toNumber=Ln,$.toSafeInteger=mj,$.toString=_t,$.toUpper=mL,$.trim=gL,$.trimEnd=yL,$.trimStart=vL,$.truncate=bL,$.unescape=SL,$.uniqueId=WL,$.upperCase=wL,$.upperFirst=MS,$.each=HE,$.eachRight=BE,$.first=DE,jS($,(function(){var a={};return Fn($,function(u,h){ht.call($.prototype,h)||(a[h]=u)}),a})(),{chain:!1}),$.VERSION=e,$r(["bind","bindKey","curry","curryRight","partial","partialRight"],function(a){$[a].placeholder=$}),$r(["drop","take"],function(a,u){ze.prototype[a]=function(h){h=h===t?1:Tt(Fe(h),0);var S=this.__filtered__&&!u?new ze(this):this.clone();return S.__filtered__?S.__takeCount__=sr(h,S.__takeCount__):S.__views__.push({size:sr(h,Ae),type:a+(S.__dir__<0?"Right":"")}),S},ze.prototype[a+"Right"]=function(h){return this.reverse()[a](h).reverse()}}),$r(["filter","map","takeWhile"],function(a,u){var h=u+1,S=h==J||h==se;ze.prototype[a]=function(P){var N=this.clone();return N.__iteratees__.push({iteratee:xe(P,3),type:h}),N.__filtered__=N.__filtered__||S,N}}),$r(["head","last"],function(a,u){var h="take"+(u?"Right":"");ze.prototype[a]=function(){return this[h](1).value()[0]}}),$r(["initial","tail"],function(a,u){var h="drop"+(u?"":"Right");ze.prototype[a]=function(){return this.__filtered__?new ze(this):this[h](1)}}),ze.prototype.compact=function(){return this.filter(Xr)},ze.prototype.find=function(a){return this.filter(a).head()},ze.prototype.findLast=function(a){return this.reverse().find(a)},ze.prototype.invokeMap=He(function(a,u){return typeof a=="function"?new ze(this):this.map(function(h){return Ra(h,a,u)})}),ze.prototype.reject=function(a){return this.filter(Jh(xe(a)))},ze.prototype.slice=function(a,u){a=Fe(a);var h=this;return h.__filtered__&&(a>0||u<0)?new ze(h):(a<0?h=h.takeRight(-a):a&&(h=h.drop(a)),u!==t&&(u=Fe(u),h=u<0?h.dropRight(-u):h.take(u-a)),h)},ze.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},ze.prototype.toArray=function(){return this.take(Ae)},Fn(ze.prototype,function(a,u){var h=/^(?:filter|find|map|reject)|While$/.test(u),S=/^(?:head|last)$/.test(u),P=$[S?"take"+(u=="last"?"Right":""):u],N=S||/^find/.test(u);P&&($.prototype[u]=function(){var L=this.__wrapped__,B=S?[1]:arguments,z=L instanceof ze,X=B[0],ee=z||Ne(L),re=function(Ze){var tt=P.apply($,Ni([Ze],B));return S&&ue?tt[0]:tt};ee&&h&&typeof X=="function"&&X.length!=1&&(z=ee=!1);var ue=this.__chain__,Se=!!this.__actions__.length,Ee=N&&!ue,je=z&&!Se;if(!N&&ee){L=je?L:new ze(this);var Ce=a.apply(L,B);return Ce.__actions__.push({func:Bh,args:[re],thisArg:t}),new Sr(Ce,ue)}return Ee&&je?a.apply(this,B):(Ce=this.thru(re),Ee?S?Ce.value()[0]:Ce.value():Ce)})}),$r(["pop","push","shift","sort","splice","unshift"],function(a){var u=da[a],h=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",S=/^(?:pop|shift)$/.test(a);$.prototype[a]=function(){var P=arguments;if(S&&!this.__chain__){var N=this.value();return u.apply(Ne(N)?N:[],P)}return this[h](function(L){return u.apply(Ne(L)?L:[],P)})}}),Fn(ze.prototype,function(a,u){var h=$[u];if(h){var S=h.name+"";ht.call(io,S)||(io[S]=[]),io[S].push({name:u,func:h})}}),io[Mh(t,v).name]=[{name:"wrapper",func:t}],ze.prototype.clone=Mb,ze.prototype.reverse=Fb,ze.prototype.value=pf,$.prototype.at=ZF,$.prototype.chain=XF,$.prototype.commit=eD,$.prototype.next=tD,$.prototype.plant=nD,$.prototype.reverse=iD,$.prototype.toJSON=$.prototype.valueOf=$.prototype.value=sD,$.prototype.first=$.prototype.head,ma&&($.prototype[ma]=rD),$}),Fi=bb();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Xt._=Fi,define(function(){return Fi})):pt?((pt.exports=Fi)._=Fi,jl._=Fi):Xt._=Fi}).call(Eu)});var Tq=V((tw,qu)=>{(function(t,e){typeof tw=="object"&&typeof qu<"u"?qu.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(tw,(function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(f){t=f}function n(f){return f instanceof Array||Object.prototype.toString.call(f)==="[object Array]"}function i(f){return f!=null&&Object.prototype.toString.call(f)==="[object Object]"}function s(f,g){return Object.prototype.hasOwnProperty.call(f,g)}function o(f){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(f).length===0;var g;for(g in f)if(s(f,g))return!1;return!0}function l(f){return f===void 0}function c(f){return typeof f=="number"||Object.prototype.toString.call(f)==="[object Number]"}function d(f){return f instanceof Date||Object.prototype.toString.call(f)==="[object Date]"}function p(f,g){var w=[],x,T=f.length;for(x=0;x<T;++x)w.push(g(f[x],x));return w}function m(f,g){for(var w in g)s(g,w)&&(f[w]=g[w]);return s(g,"toString")&&(f.toString=g.toString),s(g,"valueOf")&&(f.valueOf=g.valueOf),f}function y(f,g,w,x){return Wl(f,g,w,x,!0).utc()}function b(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function E(f){return f._pf==null&&(f._pf=b()),f._pf}var C;Array.prototype.some?C=Array.prototype.some:C=function(f){var g=Object(this),w=g.length>>>0,x;for(x=0;x<w;x++)if(x in g&&f.call(this,g[x],x,g))return!0;return!1};function v(f){var g=null,w=!1,x=f._d&&!isNaN(f._d.getTime());if(x&&(g=E(f),w=C.call(g.parsedDateParts,function(T){return T!=null}),x=g.overflow<0&&!g.empty&&!g.invalidEra&&!g.invalidMonth&&!g.invalidWeekday&&!g.weekdayMismatch&&!g.nullInput&&!g.invalidFormat&&!g.userInvalidated&&(!g.meridiem||g.meridiem&&w),f._strict&&(x=x&&g.charsLeftOver===0&&g.unusedTokens.length===0&&g.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(f))f._isValid=x;else return x;return f._isValid}function _(f){var g=y(NaN);return f!=null?m(E(g),f):E(g).userInvalidated=!0,g}var q=e.momentProperties=[],k=!1;function O(f,g){var w,x,T,H=q.length;if(l(g._isAMomentObject)||(f._isAMomentObject=g._isAMomentObject),l(g._i)||(f._i=g._i),l(g._f)||(f._f=g._f),l(g._l)||(f._l=g._l),l(g._strict)||(f._strict=g._strict),l(g._tzm)||(f._tzm=g._tzm),l(g._isUTC)||(f._isUTC=g._isUTC),l(g._offset)||(f._offset=g._offset),l(g._pf)||(f._pf=E(g)),l(g._locale)||(f._locale=g._locale),H>0)for(w=0;w<H;w++)x=q[w],T=g[x],l(T)||(f[x]=T);return f}function M(f){O(this,f),this._d=new Date(f._d!=null?f._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),k===!1&&(k=!0,e.updateOffset(this),k=!1)}function j(f){return f instanceof M||f!=null&&f._isAMomentObject!=null}function I(f){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+f)}function R(f,g){var w=!0;return m(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,f),w){var x=[],T,H,K,fe=arguments.length;for(H=0;H<fe;H++){if(T="",typeof arguments[H]=="object"){T+=`
|
|
20
|
+
}`;var je=pq(function(){return ct(N,Se+"return "+re).apply(t,L)});if(je.source=re,kS(je))throw je;return je}function hL(a){return _t(a).toLowerCase()}function mL(a){return _t(a).toUpperCase()}function gL(a,u,h){if(a=_t(a),a&&(h||u===t))return uf(a);if(!a||!(u=yn(u)))return a;var S=Mr(a),P=Mr(u),N=oh(S,P),L=ah(S,P)+1;return fo(S,N,L).join("")}function yL(a,u,h){if(a=_t(a),a&&(h||u===t))return a.slice(0,ch(a)+1);if(!a||!(u=yn(u)))return a;var S=Mr(a),P=ah(S,Mr(u))+1;return fo(S,0,P).join("")}function vL(a,u,h){if(a=_t(a),a&&(h||u===t))return a.replace(Wc,"");if(!a||!(u=yn(u)))return a;var S=Mr(a),P=oh(S,Mr(u));return fo(S,P).join("")}function bL(a,u){var h=A,S=F;if(Ut(u)){var P="separator"in u?u.separator:P;h="length"in u?Fe(u.length):h,S="omission"in u?yn(u.omission):S}a=_t(a);var N=a.length;if(eo(a)){var L=Mr(a);N=L.length}if(h>=N)return a;var B=h-Mi(S);if(B<1)return S;var z=L?fo(L,0,B).join(""):a.slice(0,B);if(P===t)return z+S;if(L&&(B+=z.length-B),AS(P)){if(a.slice(B).search(P)){var X,ee=z;for(P.global||(P=Jl(P.source,_t(jp.exec(P))+"g")),P.lastIndex=0;X=P.exec(ee);)var re=X.index;z=z.slice(0,re===t?B:re)}}else if(a.indexOf(yn(P),B)!=B){var ue=z.lastIndexOf(P);ue>-1&&(z=z.slice(0,ue))}return z+S}function SL(a){return a=_t(a),a&&Al.test(a)?a.replace(ls,mb):a}var wL=du(function(a,u,h){return a+(h?" ":"")+u.toUpperCase()}),MS=pE("toUpperCase");function dq(a,u,h){return a=_t(a),u=h?t:u,u===t?db(a)?vb(a):sb(a):a.match(u)||[]}var pq=He(function(a,u){try{return Tr(a,t,u)}catch(h){return kS(h)?h:new Ie(h)}}),_L=vs(function(a,u){return $r(u,function(h){h=oi(h),mn(a,h,IS(a[h],a))}),a});function RL(a){var u=a==null?0:a.length,h=xe();return a=u?qt(a,function(S){if(typeof S[1]!="function")throw new Fr(i);return[h(S[0]),S[1]]}):[],He(function(S){for(var P=-1;++P<u;){var N=a[P];if(Tr(N[0],this,S))return Tr(N[1],this,S)}})}function CL(a){return Xb(wr(a,p))}function FS(a){return function(){return a}}function xL(a,u){return a==null||a!==a?u:a}var EL=mE(),qL=mE(!0);function Xr(a){return a}function DS(a){return x(typeof a=="function"?a:wr(a,p))}function OL(a){return Oe(wr(a,p))}function IL(a,u){return Je(a,wr(u,p))}var PL=He(function(a,u){return function(h){return Ra(h,a,u)}}),kL=He(function(a,u){return function(h){return Ra(a,h,u)}});function jS(a,u,h){var S=fr(u),P=cu(u,S);h==null&&!(Ut(u)&&(P.length||!S.length))&&(h=u,u=a,a=this,P=cu(u,fr(u)));var N=!(Ut(h)&&"chain"in h)||!!h.chain,L=Ss(a);return $r(P,function(B){var z=u[B];a[B]=z,L&&(a.prototype[B]=function(){var X=this.__chain__;if(N||X){var ee=a(this.__wrapped__),re=ee.__actions__=Kr(this.__actions__);return re.push({func:z,args:arguments,thisArg:a}),ee.__chain__=X,ee}return z.apply(a,Ni([this.value()],arguments))})}),a}function AL(){return Xt._===this&&(Xt._=Cb),this}function LS(){}function TL(a){return a=Fe(a),He(function(u){return si(u,a)})}var $L=gS(qt),NL=gS(nh),ML=gS(Hl);function hq(a){return RS(a)?ua(oi(a)):pM(a)}function FL(a){return function(u){return a==null?t:gs(a,u)}}var DL=yE(),jL=yE(!0);function US(){return[]}function HS(){return!1}function LL(){return{}}function UL(){return""}function HL(){return!0}function BL(a,u){if(a=Fe(a),a<1||a>Ve)return[];var h=Ae,S=sr(a,Ae);u=xe(u),a-=Ae;for(var P=lf(S,u);++h<a;)u(h);return P}function VL(a){return Ne(a)?qt(a,oi):vn(a)?[a]:Kr(TE(_t(a)))}function WL(a){var u=++_b;return _t(a)+u}var zL=Fh(function(a,u){return a+u},0),JL=yS("ceil"),GL=Fh(function(a,u){return a/u},1),YL=yS("floor");function KL(a){return a&&a.length?uu(a,Xr,bf):t}function QL(a,u){return a&&a.length?uu(a,xe(u,2),bf):t}function ZL(a){return sh(a,Xr)}function XL(a,u){return sh(a,xe(u,2))}function e2(a){return a&&a.length?uu(a,Xr,K):t}function t2(a,u){return a&&a.length?uu(a,xe(u,2),K):t}var r2=Fh(function(a,u){return a*u},1),n2=yS("round"),i2=Fh(function(a,u){return a-u},0);function s2(a){return a&&a.length?af(a,Xr):0}function o2(a,u){return a&&a.length?af(a,xe(u,2)):0}return $.after=ID,$.ary=VE,$.assign=gj,$.assignIn=iq,$.assignInWith=sq,$.assignWith=TS,$.at=yj,$.before=WE,$.bind=IS,$.bindAll=_L,$.bindKey=zE,$.castArray=UD,$.chain=UE,$.chunk=KM,$.compact=QM,$.concat=ZM,$.cond=RL,$.conforms=CL,$.constant=FS,$.countBy=oD,$.create=vj,$.curry=JE,$.curryRight=GE,$.debounce=YE,$.defaults=bj,$.defaultsDeep=Sj,$.defer=PD,$.delay=kD,$.difference=XM,$.differenceBy=eF,$.differenceWith=tF,$.drop=rF,$.dropRight=nF,$.dropRightWhile=iF,$.dropWhile=sF,$.fill=oF,$.filter=lD,$.flatMap=fD,$.flatMapDeep=dD,$.flatMapDepth=pD,$.flatten=FE,$.flattenDeep=aF,$.flattenDepth=lF,$.flip=AD,$.flow=EL,$.flowRight=qL,$.fromPairs=uF,$.functions=qj,$.functionsIn=Oj,$.groupBy=hD,$.initial=fF,$.intersection=dF,$.intersectionBy=pF,$.intersectionWith=hF,$.invert=Pj,$.invertBy=kj,$.invokeMap=gD,$.iteratee=DS,$.keyBy=yD,$.keys=fr,$.keysIn=Zr,$.map=Vh,$.mapKeys=Tj,$.mapValues=$j,$.matches=OL,$.matchesProperty=IL,$.memoize=zh,$.merge=Nj,$.mergeWith=oq,$.method=PL,$.methodOf=kL,$.mixin=jS,$.negate=Jh,$.nthArg=TL,$.omit=Mj,$.omitBy=Fj,$.once=TD,$.orderBy=vD,$.over=$L,$.overArgs=$D,$.overEvery=NL,$.overSome=ML,$.partial=PS,$.partialRight=KE,$.partition=bD,$.pick=Dj,$.pickBy=aq,$.property=hq,$.propertyOf=FL,$.pull=vF,$.pullAll=jE,$.pullAllBy=bF,$.pullAllWith=SF,$.pullAt=wF,$.range=DL,$.rangeRight=jL,$.rearg=ND,$.reject=_D,$.remove=_F,$.rest=MD,$.reverse=qS,$.sampleSize=CD,$.set=Lj,$.setWith=Uj,$.shuffle=xD,$.slice=RF,$.sortBy=OD,$.sortedUniq=PF,$.sortedUniqBy=kF,$.split=cL,$.spread=FD,$.tail=AF,$.take=TF,$.takeRight=$F,$.takeRightWhile=NF,$.takeWhile=MF,$.tap=QF,$.throttle=DD,$.thru=Bh,$.toArray=tq,$.toPairs=lq,$.toPairsIn=uq,$.toPath=VL,$.toPlainObject=nq,$.transform=Hj,$.unary=jD,$.union=FF,$.unionBy=DF,$.unionWith=jF,$.uniq=LF,$.uniqBy=UF,$.uniqWith=HF,$.unset=Bj,$.unzip=OS,$.unzipWith=LE,$.update=Vj,$.updateWith=Wj,$.values=mu,$.valuesIn=zj,$.without=BF,$.words=dq,$.wrap=LD,$.xor=VF,$.xorBy=WF,$.xorWith=zF,$.zip=JF,$.zipObject=GF,$.zipObjectDeep=YF,$.zipWith=KF,$.entries=lq,$.entriesIn=uq,$.extend=iq,$.extendWith=sq,jS($,$),$.add=zL,$.attempt=pq,$.camelCase=Kj,$.capitalize=cq,$.ceil=JL,$.clamp=Jj,$.clone=HD,$.cloneDeep=VD,$.cloneDeepWith=WD,$.cloneWith=BD,$.conformsTo=zD,$.deburr=fq,$.defaultTo=xL,$.divide=GL,$.endsWith=Qj,$.eq=ai,$.escape=Zj,$.escapeRegExp=Xj,$.every=aD,$.find=uD,$.findIndex=NE,$.findKey=wj,$.findLast=cD,$.findLastIndex=ME,$.findLastKey=_j,$.floor=YL,$.forEach=HE,$.forEachRight=BE,$.forIn=Rj,$.forInRight=Cj,$.forOwn=xj,$.forOwnRight=Ej,$.get=$S,$.gt=JD,$.gte=GD,$.has=Ij,$.hasIn=NS,$.head=DE,$.identity=Xr,$.includes=mD,$.indexOf=cF,$.inRange=Gj,$.invoke=Aj,$.isArguments=qa,$.isArray=Ne,$.isArrayBuffer=YD,$.isArrayLike=Qr,$.isArrayLikeObject=Kt,$.isBoolean=KD,$.isBuffer=po,$.isDate=QD,$.isElement=ZD,$.isEmpty=XD,$.isEqual=ej,$.isEqualWith=tj,$.isError=kS,$.isFinite=rj,$.isFunction=Ss,$.isInteger=QE,$.isLength=Gh,$.isMap=ZE,$.isMatch=nj,$.isMatchWith=ij,$.isNaN=sj,$.isNative=oj,$.isNil=lj,$.isNull=aj,$.isNumber=XE,$.isObject=Ut,$.isObjectLike=Vt,$.isPlainObject=xf,$.isRegExp=AS,$.isSafeInteger=uj,$.isSet=eq,$.isString=Yh,$.isSymbol=vn,$.isTypedArray=hu,$.isUndefined=cj,$.isWeakMap=fj,$.isWeakSet=dj,$.join=mF,$.kebabCase=eL,$.last=jn,$.lastIndexOf=gF,$.lowerCase=tL,$.lowerFirst=rL,$.lt=pj,$.lte=hj,$.max=KL,$.maxBy=QL,$.mean=ZL,$.meanBy=XL,$.min=e2,$.minBy=t2,$.stubArray=US,$.stubFalse=HS,$.stubObject=LL,$.stubString=UL,$.stubTrue=HL,$.multiply=r2,$.nth=yF,$.noConflict=AL,$.noop=LS,$.now=Wh,$.pad=nL,$.padEnd=iL,$.padStart=sL,$.parseInt=oL,$.random=Yj,$.reduce=SD,$.reduceRight=wD,$.repeat=aL,$.replace=lL,$.result=jj,$.round=n2,$.runInContext=W,$.sample=RD,$.size=ED,$.snakeCase=uL,$.some=qD,$.sortedIndex=CF,$.sortedIndexBy=xF,$.sortedIndexOf=EF,$.sortedLastIndex=qF,$.sortedLastIndexBy=OF,$.sortedLastIndexOf=IF,$.startCase=fL,$.startsWith=dL,$.subtract=i2,$.sum=s2,$.sumBy=o2,$.template=pL,$.times=BL,$.toFinite=ws,$.toInteger=Fe,$.toLength=rq,$.toLower=hL,$.toNumber=Ln,$.toSafeInteger=mj,$.toString=_t,$.toUpper=mL,$.trim=gL,$.trimEnd=yL,$.trimStart=vL,$.truncate=bL,$.unescape=SL,$.uniqueId=WL,$.upperCase=wL,$.upperFirst=MS,$.each=HE,$.eachRight=BE,$.first=DE,jS($,(function(){var a={};return Fn($,function(u,h){ht.call($.prototype,h)||(a[h]=u)}),a})(),{chain:!1}),$.VERSION=e,$r(["bind","bindKey","curry","curryRight","partial","partialRight"],function(a){$[a].placeholder=$}),$r(["drop","take"],function(a,u){ze.prototype[a]=function(h){h=h===t?1:Tt(Fe(h),0);var S=this.__filtered__&&!u?new ze(this):this.clone();return S.__filtered__?S.__takeCount__=sr(h,S.__takeCount__):S.__views__.push({size:sr(h,Ae),type:a+(S.__dir__<0?"Right":"")}),S},ze.prototype[a+"Right"]=function(h){return this.reverse()[a](h).reverse()}}),$r(["filter","map","takeWhile"],function(a,u){var h=u+1,S=h==J||h==se;ze.prototype[a]=function(P){var N=this.clone();return N.__iteratees__.push({iteratee:xe(P,3),type:h}),N.__filtered__=N.__filtered__||S,N}}),$r(["head","last"],function(a,u){var h="take"+(u?"Right":"");ze.prototype[a]=function(){return this[h](1).value()[0]}}),$r(["initial","tail"],function(a,u){var h="drop"+(u?"":"Right");ze.prototype[a]=function(){return this.__filtered__?new ze(this):this[h](1)}}),ze.prototype.compact=function(){return this.filter(Xr)},ze.prototype.find=function(a){return this.filter(a).head()},ze.prototype.findLast=function(a){return this.reverse().find(a)},ze.prototype.invokeMap=He(function(a,u){return typeof a=="function"?new ze(this):this.map(function(h){return Ra(h,a,u)})}),ze.prototype.reject=function(a){return this.filter(Jh(xe(a)))},ze.prototype.slice=function(a,u){a=Fe(a);var h=this;return h.__filtered__&&(a>0||u<0)?new ze(h):(a<0?h=h.takeRight(-a):a&&(h=h.drop(a)),u!==t&&(u=Fe(u),h=u<0?h.dropRight(-u):h.take(u-a)),h)},ze.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},ze.prototype.toArray=function(){return this.take(Ae)},Fn(ze.prototype,function(a,u){var h=/^(?:filter|find|map|reject)|While$/.test(u),S=/^(?:head|last)$/.test(u),P=$[S?"take"+(u=="last"?"Right":""):u],N=S||/^find/.test(u);P&&($.prototype[u]=function(){var L=this.__wrapped__,B=S?[1]:arguments,z=L instanceof ze,X=B[0],ee=z||Ne(L),re=function(Ze){var tt=P.apply($,Ni([Ze],B));return S&&ue?tt[0]:tt};ee&&h&&typeof X=="function"&&X.length!=1&&(z=ee=!1);var ue=this.__chain__,Se=!!this.__actions__.length,Ee=N&&!ue,je=z&&!Se;if(!N&&ee){L=je?L:new ze(this);var Ce=a.apply(L,B);return Ce.__actions__.push({func:Bh,args:[re],thisArg:t}),new Sr(Ce,ue)}return Ee&&je?a.apply(this,B):(Ce=this.thru(re),Ee?S?Ce.value()[0]:Ce.value():Ce)})}),$r(["pop","push","shift","sort","splice","unshift"],function(a){var u=da[a],h=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",S=/^(?:pop|shift)$/.test(a);$.prototype[a]=function(){var P=arguments;if(S&&!this.__chain__){var N=this.value();return u.apply(Ne(N)?N:[],P)}return this[h](function(L){return u.apply(Ne(L)?L:[],P)})}}),Fn(ze.prototype,function(a,u){var h=$[u];if(h){var S=h.name+"";ht.call(io,S)||(io[S]=[]),io[S].push({name:u,func:h})}}),io[Mh(t,v).name]=[{name:"wrapper",func:t}],ze.prototype.clone=Mb,ze.prototype.reverse=Fb,ze.prototype.value=pf,$.prototype.at=ZF,$.prototype.chain=XF,$.prototype.commit=eD,$.prototype.next=tD,$.prototype.plant=nD,$.prototype.reverse=iD,$.prototype.toJSON=$.prototype.valueOf=$.prototype.value=sD,$.prototype.first=$.prototype.head,ma&&($.prototype[ma]=rD),$}),Fi=bb();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Xt._=Fi,define(function(){return Fi})):pt?((pt.exports=Fi)._=Fi,jl._=Fi):Xt._=Fi}).call(Eu)});var Tq=V((tw,qu)=>{(function(t,e){typeof tw=="object"&&typeof qu<"u"?qu.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(tw,(function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(f){t=f}function n(f){return f instanceof Array||Object.prototype.toString.call(f)==="[object Array]"}function i(f){return f!=null&&Object.prototype.toString.call(f)==="[object Object]"}function s(f,g){return Object.prototype.hasOwnProperty.call(f,g)}function o(f){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(f).length===0;var g;for(g in f)if(s(f,g))return!1;return!0}function l(f){return f===void 0}function c(f){return typeof f=="number"||Object.prototype.toString.call(f)==="[object Number]"}function d(f){return f instanceof Date||Object.prototype.toString.call(f)==="[object Date]"}function p(f,g){var w=[],x,T=f.length;for(x=0;x<T;++x)w.push(g(f[x],x));return w}function m(f,g){for(var w in g)s(g,w)&&(f[w]=g[w]);return s(g,"toString")&&(f.toString=g.toString),s(g,"valueOf")&&(f.valueOf=g.valueOf),f}function y(f,g,w,x){return Wl(f,g,w,x,!0).utc()}function b(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function q(f){return f._pf==null&&(f._pf=b()),f._pf}var C;Array.prototype.some?C=Array.prototype.some:C=function(f){var g=Object(this),w=g.length>>>0,x;for(x=0;x<w;x++)if(x in g&&f.call(this,g[x],x,g))return!0;return!1};function v(f){var g=null,w=!1,x=f._d&&!isNaN(f._d.getTime());if(x&&(g=q(f),w=C.call(g.parsedDateParts,function(T){return T!=null}),x=g.overflow<0&&!g.empty&&!g.invalidEra&&!g.invalidMonth&&!g.invalidWeekday&&!g.weekdayMismatch&&!g.nullInput&&!g.invalidFormat&&!g.userInvalidated&&(!g.meridiem||g.meridiem&&w),f._strict&&(x=x&&g.charsLeftOver===0&&g.unusedTokens.length===0&&g.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(f))f._isValid=x;else return x;return f._isValid}function _(f){var g=y(NaN);return f!=null?m(q(g),f):q(g).userInvalidated=!0,g}var E=e.momentProperties=[],k=!1;function O(f,g){var w,x,T,H=E.length;if(l(g._isAMomentObject)||(f._isAMomentObject=g._isAMomentObject),l(g._i)||(f._i=g._i),l(g._f)||(f._f=g._f),l(g._l)||(f._l=g._l),l(g._strict)||(f._strict=g._strict),l(g._tzm)||(f._tzm=g._tzm),l(g._isUTC)||(f._isUTC=g._isUTC),l(g._offset)||(f._offset=g._offset),l(g._pf)||(f._pf=q(g)),l(g._locale)||(f._locale=g._locale),H>0)for(w=0;w<H;w++)x=E[w],T=g[x],l(T)||(f[x]=T);return f}function M(f){O(this,f),this._d=new Date(f._d!=null?f._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),k===!1&&(k=!0,e.updateOffset(this),k=!1)}function j(f){return f instanceof M||f!=null&&f._isAMomentObject!=null}function I(f){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+f)}function R(f,g){var w=!0;return m(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,f),w){var x=[],T,H,K,fe=arguments.length;for(H=0;H<fe;H++){if(T="",typeof arguments[H]=="object"){T+=`
|
|
21
21
|
[`+H+"] ";for(K in arguments[0])s(arguments[0],K)&&(T+=K+": "+arguments[0][K]+", ");T=T.slice(0,-2)}else T=arguments[H];x.push(T)}I(f+`
|
|
22
22
|
Arguments: `+Array.prototype.slice.call(x).join("")+`
|
|
23
|
-
`+new Error().stack),w=!1}return g.apply(this,arguments)},g)}var A={};function F(f,g){e.deprecationHandler!=null&&e.deprecationHandler(f,g),A[f]||(I(g),A[f]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function U(f){return typeof Function<"u"&&f instanceof Function||Object.prototype.toString.call(f)==="[object Function]"}function D(f){var g,w;for(w in f)s(f,w)&&(g=f[w],U(g)?this[w]=g:this["_"+w]=g);this._config=f,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function J(f,g){var w=m({},f),x;for(x in g)s(g,x)&&(i(f[x])&&i(g[x])?(w[x]={},m(w[x],f[x]),m(w[x],g[x])):g[x]!=null?w[x]=g[x]:delete w[x]);for(x in f)s(f,x)&&!s(g,x)&&i(f[x])&&(w[x]=m({},w[x]));return w}function Q(f){f!=null&&this.set(f)}var se;Object.keys?se=Object.keys:se=function(f){var g,w=[];for(g in f)s(f,g)&&w.push(g);return w};var ce={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function Ve(f,g,w){var x=this._calendar[f]||this._calendar.sameElse;return U(x)?x.call(g,w):x}function Re(f,g,w){var x=""+Math.abs(f),T=g-x.length,H=f>=0;return(H?w?"+":"":"-")+Math.pow(10,Math.max(0,T)).toString().substr(1)+x}var me=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Ae=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,gt={},Nt={};function pe(f,g,w,x){var T=x;typeof x=="string"&&(T=function(){return this[x]()}),f&&(Nt[f]=T),g&&(Nt[g[0]]=function(){return Re(T.apply(this,arguments),g[1],g[2])}),w&&(Nt[w]=function(){return this.localeData().ordinal(T.apply(this,arguments),f)})}function Gt(f){return f.match(/\[[\s\S]/)?f.replace(/^\[|\]$/g,""):f.replace(/\\/g,"")}function kr(f){var g=f.match(me),w,x;for(w=0,x=g.length;w<x;w++)Nt[g[w]]?g[w]=Nt[g[w]]:g[w]=Gt(g[w]);return function(T){var H="",K;for(K=0;K<x;K++)H+=U(g[K])?g[K].call(T,f):g[K];return H}}function ut(f,g){return f.isValid()?(g=Ar(g,f.localeData()),gt[g]=gt[g]||kr(g),gt[g](f)):f.localeData().invalidDate()}function Ar(f,g){var w=5;function x(T){return g.longDateFormat(T)||T}for(Ae.lastIndex=0;w>=0&&Ae.test(f);)f=f.replace(Ae,x),Ae.lastIndex=0,w-=1;return f}var br={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function xt(f){var g=this._longDateFormat[f],w=this._longDateFormat[f.toUpperCase()];return g||!w?g:(this._longDateFormat[f]=w.match(me).map(function(x){return x==="MMMM"||x==="MM"||x==="DD"||x==="dddd"?x.slice(1):x}).join(""),this._longDateFormat[f])}var wt="Invalid date";function zr(){return this._invalidDate}var Ws="%d",At=/\d{1,2}/;function Ai(f){return this._ordinal.replace("%d",f)}var On={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function te(f,g,w,x){var T=this._relativeTime[w];return U(T)?T(f,g,w,x):T.replace(/%d/i,f)}function ne(f,g){var w=this._relativeTime[f>0?"future":"past"];return U(w)?w(g):w.replace(/%s/i,g)}var Pe={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ye(f){return typeof f=="string"?Pe[f]||Pe[f.toLowerCase()]:void 0}function be(f){var g={},w,x;for(x in f)s(f,x)&&(w=ye(x),w&&(g[w]=f[x]));return g}var Ke={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function ur(f){var g=[],w;for(w in f)s(f,w)&&g.push({unit:w,priority:Ke[w]});return g.sort(function(x,T){return x.priority-T.priority}),g}var Te=/\d/,ge=/\d\d/,In=/\d{3}/,pn=/\d{4}/,yt=/[+-]?\d{6}/,qe=/\d\d?/,Pn=/\d\d\d\d?/,Il=/\d\d\d\d\d\d?/,zs=/\d{1,3}/,ea=/\d{1,4}/,Js=/[+-]?\d{1,6}/,Ti=/\d+/,Gs=/[+-]?\d+/,Bc=/Z|[+-]\d\d:?\d\d/gi,Pl=/Z|[+-]\d\d(?::?\d\d)?/gi,Ov=/[+-]?\d+(\.\d{1,3})?/,ta=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,ls=/^[1-9]\d?/,kl=/^([1-9]\d|\d)/,Al;Al={};function he(f,g,w){Al[f]=U(g)?g:function(x,T){return x&&w?w:g}}function Iv(f,g){return s(Al,f)?Al[f](g._strict,g._locale):new RegExp(Pv(f))}function Pv(f){return kn(f.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(g,w,x,T,H){return w||x||T||H}))}function kn(f){return f.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Jr(f){return f<0?Math.ceil(f)||0:Math.floor(f)}function We(f){var g=+f,w=0;return g!==0&&isFinite(g)&&(w=Jr(g)),w}var Vc={};function dt(f,g){var w,x=g,T;for(typeof f=="string"&&(f=[f]),c(g)&&(x=function(H,K){K[g]=We(H)}),T=f.length,w=0;w<T;w++)Vc[f[w]]=x}function ra(f,g){dt(f,function(w,x,T,H){T._w=T._w||{},g(w,T._w,T,H)})}function Wc(f,g,w){g!=null&&s(Vc,f)&&Vc[f](g,w._a,w,f)}function Tl(f){return f%4===0&&f%100!==0||f%400===0}var cr=0,Qn=1,An=2,Yt=3,Gr=4,Zn=5,us=6,jp=7,kv=8;pe("Y",0,0,function(){var f=this.year();return f<=9999?Re(f,4):"+"+f}),pe(0,["YY",2],0,function(){return this.year()%100}),pe(0,["YYYY",4],0,"year"),pe(0,["YYYYY",5],0,"year"),pe(0,["YYYYYY",6,!0],0,"year"),he("Y",Gs),he("YY",qe,ge),he("YYYY",ea,pn),he("YYYYY",Js,yt),he("YYYYYY",Js,yt),dt(["YYYYY","YYYYYY"],cr),dt("YYYY",function(f,g){g[cr]=f.length===2?e.parseTwoDigitYear(f):We(f)}),dt("YY",function(f,g){g[cr]=e.parseTwoDigitYear(f)}),dt("Y",function(f,g){g[cr]=parseInt(f,10)});function na(f){return Tl(f)?366:365}e.parseTwoDigitYear=function(f){return We(f)+(We(f)>68?1900:2e3)};var Lp=Ys("FullYear",!0);function Av(){return Tl(this.year())}function Ys(f,g){return function(w){return w!=null?(sa(this,f,w),e.updateOffset(this,g),this):ia(this,f)}}function ia(f,g){if(!f.isValid())return NaN;var w=f._d,x=f._isUTC;switch(g){case"Milliseconds":return x?w.getUTCMilliseconds():w.getMilliseconds();case"Seconds":return x?w.getUTCSeconds():w.getSeconds();case"Minutes":return x?w.getUTCMinutes():w.getMinutes();case"Hours":return x?w.getUTCHours():w.getHours();case"Date":return x?w.getUTCDate():w.getDate();case"Day":return x?w.getUTCDay():w.getDay();case"Month":return x?w.getUTCMonth():w.getMonth();case"FullYear":return x?w.getUTCFullYear():w.getFullYear();default:return NaN}}function sa(f,g,w){var x,T,H,K,fe;if(!(!f.isValid()||isNaN(w))){switch(x=f._d,T=f._isUTC,g){case"Milliseconds":return void(T?x.setUTCMilliseconds(w):x.setMilliseconds(w));case"Seconds":return void(T?x.setUTCSeconds(w):x.setSeconds(w));case"Minutes":return void(T?x.setUTCMinutes(w):x.setMinutes(w));case"Hours":return void(T?x.setUTCHours(w):x.setHours(w));case"Date":return void(T?x.setUTCDate(w):x.setDate(w));case"FullYear":break;default:return}H=w,K=f.month(),fe=f.date(),fe=fe===29&&K===1&&!Tl(H)?28:fe,T?x.setUTCFullYear(H,K,fe):x.setFullYear(H,K,fe)}}function Tv(f){return f=ye(f),U(this[f])?this[f]():this}function $l(f,g){if(typeof f=="object"){f=be(f);var w=ur(f),x,T=w.length;for(x=0;x<T;x++)this[w[x].unit](f[w[x].unit])}else if(f=ye(f),U(this[f]))return this[f](g);return this}function $v(f,g){return(f%g+g)%g}var Lt;Array.prototype.indexOf?Lt=Array.prototype.indexOf:Lt=function(f){var g;for(g=0;g<this.length;++g)if(this[g]===f)return g;return-1};function zc(f,g){if(isNaN(f)||isNaN(g))return NaN;var w=$v(g,12);return f+=(g-w)/12,w===1?Tl(f)?29:28:31-w%7%2}pe("M",["MM",2],"Mo",function(){return this.month()+1}),pe("MMM",0,0,function(f){return this.localeData().monthsShort(this,f)}),pe("MMMM",0,0,function(f){return this.localeData().months(this,f)}),he("M",qe,ls),he("MM",qe,ge),he("MMM",function(f,g){return g.monthsShortRegex(f)}),he("MMMM",function(f,g){return g.monthsRegex(f)}),dt(["M","MM"],function(f,g){g[Qn]=We(f)-1}),dt(["MMM","MMMM"],function(f,g,w,x){var T=w._locale.monthsParse(f,x,w._strict);T!=null?g[Qn]=T:E(w).invalidMonth=f});var Up="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Jc="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Gc=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Nv=ta,Mv=ta;function Fv(f,g){return f?n(this._months)?this._months[f.month()]:this._months[(this._months.isFormat||Gc).test(g)?"format":"standalone"][f.month()]:n(this._months)?this._months:this._months.standalone}function Dv(f,g){return f?n(this._monthsShort)?this._monthsShort[f.month()]:this._monthsShort[Gc.test(g)?"format":"standalone"][f.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Hp(f,g,w){var x,T,H,K=f.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],x=0;x<12;++x)H=y([2e3,x]),this._shortMonthsParse[x]=this.monthsShort(H,"").toLocaleLowerCase(),this._longMonthsParse[x]=this.months(H,"").toLocaleLowerCase();return w?g==="MMM"?(T=Lt.call(this._shortMonthsParse,K),T!==-1?T:null):(T=Lt.call(this._longMonthsParse,K),T!==-1?T:null):g==="MMM"?(T=Lt.call(this._shortMonthsParse,K),T!==-1?T:(T=Lt.call(this._longMonthsParse,K),T!==-1?T:null)):(T=Lt.call(this._longMonthsParse,K),T!==-1?T:(T=Lt.call(this._shortMonthsParse,K),T!==-1?T:null))}function Bp(f,g,w){var x,T,H;if(this._monthsParseExact)return Hp.call(this,f,g,w);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),x=0;x<12;x++){if(T=y([2e3,x]),w&&!this._longMonthsParse[x]&&(this._longMonthsParse[x]=new RegExp("^"+this.months(T,"").replace(".","")+"$","i"),this._shortMonthsParse[x]=new RegExp("^"+this.monthsShort(T,"").replace(".","")+"$","i")),!w&&!this._monthsParse[x]&&(H="^"+this.months(T,"")+"|^"+this.monthsShort(T,""),this._monthsParse[x]=new RegExp(H.replace(".",""),"i")),w&&g==="MMMM"&&this._longMonthsParse[x].test(f))return x;if(w&&g==="MMM"&&this._shortMonthsParse[x].test(f))return x;if(!w&&this._monthsParse[x].test(f))return x}}function Yc(f,g){if(!f.isValid())return f;if(typeof g=="string"){if(/^\d+$/.test(g))g=We(g);else if(g=f.localeData().monthsParse(g),!c(g))return f}var w=g,x=f.date();return x=x<29?x:Math.min(x,zc(f.year(),w)),f._isUTC?f._d.setUTCMonth(w,x):f._d.setMonth(w,x),f}function Nl(f){return f!=null?(Yc(this,f),e.updateOffset(this,!0),this):ia(this,"Month")}function jv(){return zc(this.year(),this.month())}function Vp(f){return this._monthsParseExact?(s(this,"_monthsRegex")||Kc.call(this),f?this._monthsShortStrictRegex:this._monthsShortRegex):(s(this,"_monthsShortRegex")||(this._monthsShortRegex=Nv),this._monthsShortStrictRegex&&f?this._monthsShortStrictRegex:this._monthsShortRegex)}function Ml(f){return this._monthsParseExact?(s(this,"_monthsRegex")||Kc.call(this),f?this._monthsStrictRegex:this._monthsRegex):(s(this,"_monthsRegex")||(this._monthsRegex=Mv),this._monthsStrictRegex&&f?this._monthsStrictRegex:this._monthsRegex)}function Kc(){function f(Oe,Je){return Je.length-Oe.length}var g=[],w=[],x=[],T,H,K,fe;for(T=0;T<12;T++)H=y([2e3,T]),K=kn(this.monthsShort(H,"")),fe=kn(this.months(H,"")),g.push(K),w.push(fe),x.push(fe),x.push(K);g.sort(f),w.sort(f),x.sort(f),this._monthsRegex=new RegExp("^("+x.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+w.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+g.join("|")+")","i")}function Lv(f,g,w,x,T,H,K){var fe;return f<100&&f>=0?(fe=new Date(f+400,g,w,x,T,H,K),isFinite(fe.getFullYear())&&fe.setFullYear(f)):fe=new Date(f,g,w,x,T,H,K),fe}function Ks(f){var g,w;return f<100&&f>=0?(w=Array.prototype.slice.call(arguments),w[0]=f+400,g=new Date(Date.UTC.apply(null,w)),isFinite(g.getUTCFullYear())&&g.setUTCFullYear(f)):g=new Date(Date.UTC.apply(null,arguments)),g}function oa(f,g,w){var x=7+g-w,T=(7+Ks(f,0,x).getUTCDay()-g)%7;return-T+x-1}function Fl(f,g,w,x,T){var H=(7+w-x)%7,K=oa(f,x,T),fe=1+7*(g-1)+H+K,Oe,Je;return fe<=0?(Oe=f-1,Je=na(Oe)+fe):fe>na(f)?(Oe=f+1,Je=fe-na(f)):(Oe=f,Je=fe),{year:Oe,dayOfYear:Je}}function aa(f,g,w){var x=oa(f.year(),g,w),T=Math.floor((f.dayOfYear()-x-1)/7)+1,H,K;return T<1?(K=f.year()-1,H=T+Tn(K,g,w)):T>Tn(f.year(),g,w)?(H=T-Tn(f.year(),g,w),K=f.year()+1):(K=f.year(),H=T),{week:H,year:K}}function Tn(f,g,w){var x=oa(f,g,w),T=oa(f+1,g,w);return(na(f)-x+T)/7}pe("w",["ww",2],"wo","week"),pe("W",["WW",2],"Wo","isoWeek"),he("w",qe,ls),he("ww",qe,ge),he("W",qe,ls),he("WW",qe,ge),ra(["w","ww","W","WW"],function(f,g,w,x){g[x.substr(0,1)]=We(f)});function Qc(f){return aa(f,this._week.dow,this._week.doy).week}var Zc={dow:0,doy:6};function Qs(){return this._week.dow}function Wp(){return this._week.doy}function zp(f){var g=this.localeData().week(this);return f==null?g:this.add((f-g)*7,"d")}function Uv(f){var g=aa(this,1,4).week;return f==null?g:this.add((f-g)*7,"d")}pe("d",0,"do","day"),pe("dd",0,0,function(f){return this.localeData().weekdaysMin(this,f)}),pe("ddd",0,0,function(f){return this.localeData().weekdaysShort(this,f)}),pe("dddd",0,0,function(f){return this.localeData().weekdays(this,f)}),pe("e",0,0,"weekday"),pe("E",0,0,"isoWeekday"),he("d",qe),he("e",qe),he("E",qe),he("dd",function(f,g){return g.weekdaysMinRegex(f)}),he("ddd",function(f,g){return g.weekdaysShortRegex(f)}),he("dddd",function(f,g){return g.weekdaysRegex(f)}),ra(["dd","ddd","dddd"],function(f,g,w,x){var T=w._locale.weekdaysParse(f,x,w._strict);T!=null?g.d=T:E(w).invalidWeekday=f}),ra(["d","e","E"],function(f,g,w,x){g[x]=We(f)});function Jp(f,g){return typeof f!="string"?f:isNaN(f)?(f=g.weekdaysParse(f),typeof f=="number"?f:null):parseInt(f,10)}function Gp(f,g){return typeof f=="string"?g.weekdaysParse(f)%7||7:isNaN(f)?null:f}function Dl(f,g){return f.slice(g,7).concat(f.slice(0,g))}var Yp="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Kp="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Hv="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Bv=ta,Qp=ta,Vv=ta;function Wv(f,g){var w=n(this._weekdays)?this._weekdays:this._weekdays[f&&f!==!0&&this._weekdays.isFormat.test(g)?"format":"standalone"];return f===!0?Dl(w,this._week.dow):f?w[f.day()]:w}function zv(f){return f===!0?Dl(this._weekdaysShort,this._week.dow):f?this._weekdaysShort[f.day()]:this._weekdaysShort}function Jv(f){return f===!0?Dl(this._weekdaysMin,this._week.dow):f?this._weekdaysMin[f.day()]:this._weekdaysMin}function Xc(f,g,w){var x,T,H,K=f.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],x=0;x<7;++x)H=y([2e3,1]).day(x),this._minWeekdaysParse[x]=this.weekdaysMin(H,"").toLocaleLowerCase(),this._shortWeekdaysParse[x]=this.weekdaysShort(H,"").toLocaleLowerCase(),this._weekdaysParse[x]=this.weekdays(H,"").toLocaleLowerCase();return w?g==="dddd"?(T=Lt.call(this._weekdaysParse,K),T!==-1?T:null):g==="ddd"?(T=Lt.call(this._shortWeekdaysParse,K),T!==-1?T:null):(T=Lt.call(this._minWeekdaysParse,K),T!==-1?T:null):g==="dddd"?(T=Lt.call(this._weekdaysParse,K),T!==-1||(T=Lt.call(this._shortWeekdaysParse,K),T!==-1)?T:(T=Lt.call(this._minWeekdaysParse,K),T!==-1?T:null)):g==="ddd"?(T=Lt.call(this._shortWeekdaysParse,K),T!==-1||(T=Lt.call(this._weekdaysParse,K),T!==-1)?T:(T=Lt.call(this._minWeekdaysParse,K),T!==-1?T:null)):(T=Lt.call(this._minWeekdaysParse,K),T!==-1||(T=Lt.call(this._weekdaysParse,K),T!==-1)?T:(T=Lt.call(this._shortWeekdaysParse,K),T!==-1?T:null))}function Gv(f,g,w){var x,T,H;if(this._weekdaysParseExact)return Xc.call(this,f,g,w);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),x=0;x<7;x++){if(T=y([2e3,1]).day(x),w&&!this._fullWeekdaysParse[x]&&(this._fullWeekdaysParse[x]=new RegExp("^"+this.weekdays(T,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[x]=new RegExp("^"+this.weekdaysShort(T,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[x]=new RegExp("^"+this.weekdaysMin(T,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[x]||(H="^"+this.weekdays(T,"")+"|^"+this.weekdaysShort(T,"")+"|^"+this.weekdaysMin(T,""),this._weekdaysParse[x]=new RegExp(H.replace(".",""),"i")),w&&g==="dddd"&&this._fullWeekdaysParse[x].test(f))return x;if(w&&g==="ddd"&&this._shortWeekdaysParse[x].test(f))return x;if(w&&g==="dd"&&this._minWeekdaysParse[x].test(f))return x;if(!w&&this._weekdaysParse[x].test(f))return x}}function Yv(f){if(!this.isValid())return f!=null?this:NaN;var g=ia(this,"Day");return f!=null?(f=Jp(f,this.localeData()),this.add(f-g,"d")):g}function Kv(f){if(!this.isValid())return f!=null?this:NaN;var g=(this.day()+7-this.localeData()._week.dow)%7;return f==null?g:this.add(f-g,"d")}function Qv(f){if(!this.isValid())return f!=null?this:NaN;if(f!=null){var g=Gp(f,this.localeData());return this.day(this.day()%7?g:g-7)}else return this.day()||7}function Zv(f){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||ef.call(this),f?this._weekdaysStrictRegex:this._weekdaysRegex):(s(this,"_weekdaysRegex")||(this._weekdaysRegex=Bv),this._weekdaysStrictRegex&&f?this._weekdaysStrictRegex:this._weekdaysRegex)}function Pt(f){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||ef.call(this),f?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(s(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Qp),this._weekdaysShortStrictRegex&&f?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Et(f){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||ef.call(this),f?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(s(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Vv),this._weekdaysMinStrictRegex&&f?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function ef(){function f(er,ii){return ii.length-er.length}var g=[],w=[],x=[],T=[],H,K,fe,Oe,Je;for(H=0;H<7;H++)K=y([2e3,1]).day(H),fe=kn(this.weekdaysMin(K,"")),Oe=kn(this.weekdaysShort(K,"")),Je=kn(this.weekdays(K,"")),g.push(fe),w.push(Oe),x.push(Je),T.push(fe),T.push(Oe),T.push(Je);g.sort(f),w.sort(f),x.sort(f),T.sort(f),this._weekdaysRegex=new RegExp("^("+T.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+x.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+w.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function tf(){return this.hours()%12||12}function Xv(){return this.hours()||24}pe("H",["HH",2],0,"hour"),pe("h",["hh",2],0,tf),pe("k",["kk",2],0,Xv),pe("hmm",0,0,function(){return""+tf.apply(this)+Re(this.minutes(),2)}),pe("hmmss",0,0,function(){return""+tf.apply(this)+Re(this.minutes(),2)+Re(this.seconds(),2)}),pe("Hmm",0,0,function(){return""+this.hours()+Re(this.minutes(),2)}),pe("Hmmss",0,0,function(){return""+this.hours()+Re(this.minutes(),2)+Re(this.seconds(),2)});function Zp(f,g){pe(f,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),g)})}Zp("a",!0),Zp("A",!1);function Xp(f,g){return g._meridiemParse}he("a",Xp),he("A",Xp),he("H",qe,kl),he("h",qe,ls),he("k",qe,ls),he("HH",qe,ge),he("hh",qe,ge),he("kk",qe,ge),he("hmm",Pn),he("hmmss",Il),he("Hmm",Pn),he("Hmmss",Il),dt(["H","HH"],Yt),dt(["k","kk"],function(f,g,w){var x=We(f);g[Yt]=x===24?0:x}),dt(["a","A"],function(f,g,w){w._isPm=w._locale.isPM(f),w._meridiem=f}),dt(["h","hh"],function(f,g,w){g[Yt]=We(f),E(w).bigHour=!0}),dt("hmm",function(f,g,w){var x=f.length-2;g[Yt]=We(f.substr(0,x)),g[Gr]=We(f.substr(x)),E(w).bigHour=!0}),dt("hmmss",function(f,g,w){var x=f.length-4,T=f.length-2;g[Yt]=We(f.substr(0,x)),g[Gr]=We(f.substr(x,2)),g[Zn]=We(f.substr(T)),E(w).bigHour=!0}),dt("Hmm",function(f,g,w){var x=f.length-2;g[Yt]=We(f.substr(0,x)),g[Gr]=We(f.substr(x))}),dt("Hmmss",function(f,g,w){var x=f.length-4,T=f.length-2;g[Yt]=We(f.substr(0,x)),g[Gr]=We(f.substr(x,2)),g[Zn]=We(f.substr(T))});function eb(f){return(f+"").toLowerCase().charAt(0)==="p"}var eh=/[ap]\.?m?\.?/i,tb=Ys("Hours",!0);function Xt(f,g,w){return f>11?w?"pm":"PM":w?"am":"AM"}var jl={calendar:ce,longDateFormat:br,invalidDate:wt,ordinal:Ws,dayOfMonthOrdinalParse:At,relativeTime:On,months:Up,monthsShort:Jc,week:Zc,weekdays:Yp,weekdaysMin:Hv,weekdaysShort:Kp,meridiemParse:eh},pt={},Zs={},cs;function Yr(f,g){var w,x=Math.min(f.length,g.length);for(w=0;w<x;w+=1)if(f[w]!==g[w])return w;return x}function rf(f){return f&&f.toLowerCase().replace("_","-")}function th(f){for(var g=0,w,x,T,H;g<f.length;){for(H=rf(f[g]).split("-"),w=H.length,x=rf(f[g+1]),x=x?x.split("-"):null;w>0;){if(T=la(H.slice(0,w).join("-")),T)return T;if(x&&x.length>=w&&Yr(H,x)>=w-1)break;w--}g++}return cs}function rh(f){return!!(f&&f.match("^[^/\\\\]*$"))}function la(f){var g=null,w;if(pt[f]===void 0&&typeof qu<"u"&&qu&&qu.exports&&rh(f))try{g=cs._abbr,w=require,w("./locale/"+f),Xn(g)}catch{pt[f]=null}return pt[f]}function Xn(f,g){var w;return f&&(l(g)?w=ei(f):w=Ll(f,g),w?cs=w:typeof console<"u"&&console.warn&&console.warn("Locale "+f+" not found. Did you forget to load it?")),cs._abbr}function Ll(f,g){if(g!==null){var w,x=jl;if(g.abbr=f,pt[f]!=null)F("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),x=pt[f]._config;else if(g.parentLocale!=null)if(pt[g.parentLocale]!=null)x=pt[g.parentLocale]._config;else if(w=la(g.parentLocale),w!=null)x=w._config;else return Zs[g.parentLocale]||(Zs[g.parentLocale]=[]),Zs[g.parentLocale].push({name:f,config:g}),null;return pt[f]=new Q(J(x,g)),Zs[f]&&Zs[f].forEach(function(T){Ll(T.name,T.config)}),Xn(f),pt[f]}else return delete pt[f],null}function Tr(f,g){if(g!=null){var w,x,T=jl;pt[f]!=null&&pt[f].parentLocale!=null?pt[f].set(J(pt[f]._config,g)):(x=la(f),x!=null&&(T=x._config),g=J(T,g),x==null&&(g.abbr=f),w=new Q(g),w.parentLocale=pt[f],pt[f]=w),Xn(f)}else pt[f]!=null&&(pt[f].parentLocale!=null?(pt[f]=pt[f].parentLocale,f===Xn()&&Xn(f)):pt[f]!=null&&delete pt[f]);return pt[f]}function ei(f){var g;if(f&&f._locale&&f._locale._abbr&&(f=f._locale._abbr),!f)return cs;if(!n(f)){if(g=la(f),g)return g;f=[f]}return th(f)}function $r(){return se(pt)}function nf(f){var g,w=f._a;return w&&E(f).overflow===-2&&(g=w[Qn]<0||w[Qn]>11?Qn:w[An]<1||w[An]>zc(w[cr],w[Qn])?An:w[Yt]<0||w[Yt]>24||w[Yt]===24&&(w[Gr]!==0||w[Zn]!==0||w[us]!==0)?Yt:w[Gr]<0||w[Gr]>59?Gr:w[Zn]<0||w[Zn]>59?Zn:w[us]<0||w[us]>999?us:-1,E(f)._overflowDayOfYear&&(g<cr||g>An)&&(g=An),E(f)._overflowWeeks&&g===-1&&(g=jp),E(f)._overflowWeekday&&g===-1&&(g=kv),E(f).overflow=g),f}var nh=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,$i=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ul=/Z|[+-]\d\d(?::?\d\d)?/,Xs=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],qt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ni=/^\/?Date\((-?\d+)/i,sf=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,rb={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Hl(f){var g,w,x=f._i,T=nh.exec(x)||$i.exec(x),H,K,fe,Oe,Je=Xs.length,er=qt.length;if(T){for(E(f).iso=!0,g=0,w=Je;g<w;g++)if(Xs[g][1].exec(T[1])){K=Xs[g][0],H=Xs[g][2]!==!1;break}if(K==null){f._isValid=!1;return}if(T[3]){for(g=0,w=er;g<w;g++)if(qt[g][1].exec(T[3])){fe=(T[2]||" ")+qt[g][0];break}if(fe==null){f._isValid=!1;return}}if(!H&&fe!=null){f._isValid=!1;return}if(T[4])if(Ul.exec(T[4]))Oe="Z";else{f._isValid=!1;return}f._f=K+(fe||"")+(Oe||""),Vl(f)}else f._isValid=!1}function nb(f,g,w,x,T,H){var K=[ib(f),Jc.indexOf(g),parseInt(w,10),parseInt(x,10),parseInt(T,10)];return H&&K.push(parseInt(H,10)),K}function ib(f){var g=parseInt(f,10);return g<=49?2e3+g:g<=999?1900+g:g}function sb(f){return f.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function ih(f,g,w){if(f){var x=Kp.indexOf(f),T=new Date(g[0],g[1],g[2]).getDay();if(x!==T)return E(w).weekdayMismatch=!0,w._isValid=!1,!1}return!0}function Bl(f,g,w){if(f)return rb[f];if(g)return 0;var x=parseInt(w,10),T=x%100,H=(x-T)/100;return H*60+T}function fs(f){var g=sf.exec(sb(f._i)),w;if(g){if(w=nb(g[4],g[3],g[2],g[5],g[6],g[7]),!ih(g[1],w,f))return;f._a=w,f._tzm=Bl(g[8],g[9],g[10]),f._d=Ks.apply(null,f._a),f._d.setUTCMinutes(f._d.getUTCMinutes()-f._tzm),E(f).rfc2822=!0}else f._isValid=!1}function ob(f){var g=Ni.exec(f._i);if(g!==null){f._d=new Date(+g[1]);return}if(Hl(f),f._isValid===!1)delete f._isValid;else return;if(fs(f),f._isValid===!1)delete f._isValid;else return;f._strict?f._isValid=!1:e.createFromInputFallback(f)}e.createFromInputFallback=R("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(f){f._d=new Date(f._i+(f._useUTC?" UTC":""))});function ds(f,g,w){return f??g??w}function sh(f){var g=new Date(e.now());return f._useUTC?[g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()]:[g.getFullYear(),g.getMonth(),g.getDate()]}function ua(f){var g,w,x=[],T,H,K;if(!f._d){for(T=sh(f),f._w&&f._a[An]==null&&f._a[Qn]==null&&of(f),f._dayOfYear!=null&&(K=ds(f._a[cr],T[cr]),(f._dayOfYear>na(K)||f._dayOfYear===0)&&(E(f)._overflowDayOfYear=!0),w=Ks(K,0,f._dayOfYear),f._a[Qn]=w.getUTCMonth(),f._a[An]=w.getUTCDate()),g=0;g<3&&f._a[g]==null;++g)f._a[g]=x[g]=T[g];for(;g<7;g++)f._a[g]=x[g]=f._a[g]==null?g===2?1:0:f._a[g];f._a[Yt]===24&&f._a[Gr]===0&&f._a[Zn]===0&&f._a[us]===0&&(f._nextDay=!0,f._a[Yt]=0),f._d=(f._useUTC?Ks:Lv).apply(null,x),H=f._useUTC?f._d.getUTCDay():f._d.getDay(),f._tzm!=null&&f._d.setUTCMinutes(f._d.getUTCMinutes()-f._tzm),f._nextDay&&(f._a[Yt]=24),f._w&&typeof f._w.d<"u"&&f._w.d!==H&&(E(f).weekdayMismatch=!0)}}function of(f){var g,w,x,T,H,K,fe,Oe,Je;g=f._w,g.GG!=null||g.W!=null||g.E!=null?(H=1,K=4,w=ds(g.GG,f._a[cr],aa(vt(),1,4).year),x=ds(g.W,1),T=ds(g.E,1),(T<1||T>7)&&(Oe=!0)):(H=f._locale._week.dow,K=f._locale._week.doy,Je=aa(vt(),H,K),w=ds(g.gg,f._a[cr],Je.year),x=ds(g.w,Je.week),g.d!=null?(T=g.d,(T<0||T>6)&&(Oe=!0)):g.e!=null?(T=g.e+H,(g.e<0||g.e>6)&&(Oe=!0)):T=H),x<1||x>Tn(w,H,K)?E(f)._overflowWeeks=!0:Oe!=null?E(f)._overflowWeekday=!0:(fe=Fl(w,x,T,H,K),f._a[cr]=fe.year,f._dayOfYear=fe.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function Vl(f){if(f._f===e.ISO_8601){Hl(f);return}if(f._f===e.RFC_2822){fs(f);return}f._a=[],E(f).empty=!0;var g=""+f._i,w,x,T,H,K,fe=g.length,Oe=0,Je,er;for(T=Ar(f._f,f._locale).match(me)||[],er=T.length,w=0;w<er;w++)H=T[w],x=(g.match(Iv(H,f))||[])[0],x&&(K=g.substr(0,g.indexOf(x)),K.length>0&&E(f).unusedInput.push(K),g=g.slice(g.indexOf(x)+x.length),Oe+=x.length),Nt[H]?(x?E(f).empty=!1:E(f).unusedTokens.push(H),Wc(H,x,f)):f._strict&&!x&&E(f).unusedTokens.push(H);E(f).charsLeftOver=fe-Oe,g.length>0&&E(f).unusedInput.push(g),f._a[Yt]<=12&&E(f).bigHour===!0&&f._a[Yt]>0&&(E(f).bigHour=void 0),E(f).parsedDateParts=f._a.slice(0),E(f).meridiem=f._meridiem,f._a[Yt]=ab(f._locale,f._a[Yt],f._meridiem),Je=E(f).era,Je!==null&&(f._a[cr]=f._locale.erasConvertYear(Je,f._a[cr])),ua(f),nf(f)}function ab(f,g,w){var x;return w==null?g:f.meridiemHour!=null?f.meridiemHour(g,w):(f.isPM!=null&&(x=f.isPM(w),x&&g<12&&(g+=12),!x&&g===12&&(g=0)),g)}function af(f){var g,w,x,T,H,K,fe=!1,Oe=f._f.length;if(Oe===0){E(f).invalidFormat=!0,f._d=new Date(NaN);return}for(T=0;T<Oe;T++)H=0,K=!1,g=O({},f),f._useUTC!=null&&(g._useUTC=f._useUTC),g._f=f._f[T],Vl(g),v(g)&&(K=!0),H+=E(g).charsLeftOver,H+=E(g).unusedTokens.length*10,E(g).score=H,fe?H<x&&(x=H,w=g):(x==null||H<x||K)&&(x=H,w=g,K&&(fe=!0));m(f,w||g)}function lf(f){if(!f._d){var g=be(f._i),w=g.day===void 0?g.date:g.day;f._a=p([g.year,g.month,w,g.hour,g.minute,g.second,g.millisecond],function(x){return x&&parseInt(x,10)}),ua(f)}}function lb(f){var g=new M(nf(uf(f)));return g._nextDay&&(g.add(1,"d"),g._nextDay=void 0),g}function uf(f){var g=f._i,w=f._f;return f._locale=f._locale||ei(f._l),g===null||w===void 0&&g===""?_({nullInput:!0}):(typeof g=="string"&&(f._i=g=f._locale.preparse(g)),j(g)?new M(nf(g)):(d(g)?f._d=g:n(w)?af(f):w?Vl(f):Nr(f),v(f)||(f._d=null),f))}function Nr(f){var g=f._i;l(g)?f._d=new Date(e.now()):d(g)?f._d=new Date(g.valueOf()):typeof g=="string"?ob(f):n(g)?(f._a=p(g.slice(0),function(w){return parseInt(w,10)}),ua(f)):i(g)?lf(f):c(g)?f._d=new Date(g):e.createFromInputFallback(f)}function Wl(f,g,w,x,T){var H={};return(g===!0||g===!1)&&(x=g,g=void 0),(w===!0||w===!1)&&(x=w,w=void 0),(i(f)&&o(f)||n(f)&&f.length===0)&&(f=void 0),H._isAMomentObject=!0,H._useUTC=H._isUTC=T,H._l=w,H._i=f,H._f=g,H._strict=x,lb(H)}function vt(f,g,w,x){return Wl(f,g,w,x,!1)}var oh=R("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var f=vt.apply(null,arguments);return this.isValid()&&f.isValid()?f<this?this:f:_()}),ah=R("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var f=vt.apply(null,arguments);return this.isValid()&&f.isValid()?f>this?this:f:_()});function lh(f,g){var w,x;if(g.length===1&&n(g[0])&&(g=g[0]),!g.length)return vt();for(w=g[0],x=1;x<g.length;++x)(!g[x].isValid()||g[x][f](w))&&(w=g[x]);return w}function ub(){var f=[].slice.call(arguments,0);return lh("isBefore",f)}function cb(){var f=[].slice.call(arguments,0);return lh("isAfter",f)}var fb=function(){return Date.now?Date.now():+new Date},ca=["year","quarter","month","week","day","hour","minute","second","millisecond"];function eo(f){var g,w=!1,x,T=ca.length;for(g in f)if(s(f,g)&&!(Lt.call(ca,g)!==-1&&(f[g]==null||!isNaN(f[g]))))return!1;for(x=0;x<T;++x)if(f[ca[x]]){if(w)return!1;parseFloat(f[ca[x]])!==We(f[ca[x]])&&(w=!0)}return!0}function db(){return this._isValid}function pb(){return bt(NaN)}function to(f){var g=be(f),w=g.year||0,x=g.quarter||0,T=g.month||0,H=g.week||g.isoWeek||0,K=g.day||0,fe=g.hour||0,Oe=g.minute||0,Je=g.second||0,er=g.millisecond||0;this._isValid=eo(g),this._milliseconds=+er+Je*1e3+Oe*6e4+fe*1e3*60*60,this._days=+K+H*7,this._months=+T+x*3+w*12,this._data={},this._locale=ei(),this._bubble()}function fa(f){return f instanceof to}function $n(f){return f<0?Math.round(-1*f)*-1:Math.round(f)}function zl(f,g,w){var x=Math.min(f.length,g.length),T=Math.abs(f.length-g.length),H=0,K;for(K=0;K<x;K++)(w&&f[K]!==g[K]||!w&&We(f[K])!==We(g[K]))&&H++;return H+T}function uh(f,g){pe(f,0,0,function(){var w=this.utcOffset(),x="+";return w<0&&(w=-w,x="-"),x+Re(~~(w/60),2)+g+Re(~~w%60,2)})}uh("Z",":"),uh("ZZ",""),he("Z",Pl),he("ZZ",Pl),dt(["Z","ZZ"],function(f,g,w){w._useUTC=!0,w._tzm=cf(Pl,f)});var hb=/([\+\-]|\d\d)/gi;function cf(f,g){var w=(g||"").match(f),x,T,H;return w===null?null:(x=w[w.length-1]||[],T=(x+"").match(hb)||["-",0,0],H=+(T[1]*60)+We(T[2]),H===0?0:T[0]==="+"?H:-H)}function Mi(f,g){var w,x;return g._isUTC?(w=g.clone(),x=(j(f)||d(f)?f.valueOf():vt(f).valueOf())-w.valueOf(),w._d.setTime(w._d.valueOf()+x),e.updateOffset(w,!1),w):vt(f).local()}function Mr(f){return-Math.round(f._d.getTimezoneOffset())}e.updateOffset=function(){};function ch(f,g,w){var x=this._offset||0,T;if(!this.isValid())return f!=null?this:NaN;if(f!=null){if(typeof f=="string"){if(f=cf(Pl,f),f===null)return this}else Math.abs(f)<16&&!w&&(f=f*60);return!this._isUTC&&g&&(T=Mr(this)),this._offset=f,this._isUTC=!0,T!=null&&this.add(T,"m"),x!==f&&(!g||this._changeInProgress?da(this,bt(f-x,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?x:Mr(this)}function mb(f,g){return f!=null?(typeof f!="string"&&(f=-f),this.utcOffset(f,g),this):-this.utcOffset()}function gb(f){return this.utcOffset(0,f)}function yb(f){return this._isUTC&&(this.utcOffset(0,f),this._isUTC=!1,f&&this.subtract(Mr(this),"m")),this}function vb(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var f=cf(Bc,this._i);f!=null?this.utcOffset(f):this.utcOffset(0,!0)}return this}function bb(f){return this.isValid()?(f=f?vt(f).utcOffset():0,(this.utcOffset()-f)%60===0):!1}function Fi(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function W(){if(!l(this._isDSTShifted))return this._isDSTShifted;var f={},g;return O(f,this),f=uf(f),f._a?(g=f._isUTC?y(f._a):vt(f._a),this._isDSTShifted=this.isValid()&&zl(f._a,g.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Z(){return this.isValid()?!this._isUTC:!1}function Y(){return this.isValid()?this._isUTC:!1}function de(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Ie=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,ct=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function bt(f,g){var w=f,x=null,T,H,K;return fa(f)?w={ms:f._milliseconds,d:f._days,M:f._months}:c(f)||!isNaN(+f)?(w={},g?w[g]=+f:w.milliseconds=+f):(x=Ie.exec(f))?(T=x[1]==="-"?-1:1,w={y:0,d:We(x[An])*T,h:We(x[Yt])*T,m:We(x[Gr])*T,s:We(x[Zn])*T,ms:We($n(x[us]*1e3))*T}):(x=ct.exec(f))?(T=x[1]==="-"?-1:1,w={y:et(x[2],T),M:et(x[3],T),w:et(x[4],T),d:et(x[5],T),h:et(x[6],T),m:et(x[7],T),s:et(x[8],T)}):w==null?w={}:typeof w=="object"&&("from"in w||"to"in w)&&(K=Sb(vt(w.from),vt(w.to)),w={},w.ms=K.milliseconds,w.M=K.months),H=new to(w),fa(f)&&s(f,"_locale")&&(H._locale=f._locale),fa(f)&&s(f,"_isValid")&&(H._isValid=f._isValid),H}bt.fn=to.prototype,bt.invalid=pb;function et(f,g){var w=f&&parseFloat(f.replace(",","."));return(isNaN(w)?0:w)*g}function Jl(f,g){var w={};return w.months=g.month()-f.month()+(g.year()-f.year())*12,f.clone().add(w.months,"M").isAfter(g)&&--w.months,w.milliseconds=+g-+f.clone().add(w.months,"M"),w}function Sb(f,g){var w;return f.isValid()&&g.isValid()?(g=Mi(g,f),f.isBefore(g)?w=Jl(f,g):(w=Jl(g,f),w.milliseconds=-w.milliseconds,w.months=-w.months),w):{milliseconds:0,months:0}}function Fr(f,g){return function(w,x){var T,H;return x!==null&&!isNaN(+x)&&(F(g,"moment()."+g+"(period, number) is deprecated. Please use moment()."+g+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),H=w,w=x,x=H),T=bt(w,x),da(this,T,f),this}}function da(f,g,w,x){var T=g._milliseconds,H=$n(g._days),K=$n(g._months);f.isValid()&&(x=x??!0,K&&Yc(f,ia(f,"Month")+K*w),H&&sa(f,"Date",ia(f,"Date")+H*w),T&&f._d.setTime(f._d.valueOf()+T*w),x&&e.updateOffset(f,H||K))}var wb=Fr(1,"add"),ro=Fr(-1,"subtract");function pa(f){return typeof f=="string"||f instanceof String}function Gl(f){return j(f)||d(f)||pa(f)||c(f)||_b(f)||ht(f)||f===null||f===void 0}function ht(f){var g=i(f)&&!o(f),w=!1,x=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],T,H,K=x.length;for(T=0;T<K;T+=1)H=x[T],w=w||s(f,H);return g&&w}function _b(f){var g=n(f),w=!1;return g&&(w=f.filter(function(x){return!c(x)&&pa(f)}).length===0),g&&w}function fh(f){var g=i(f)&&!o(f),w=!1,x=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],T,H;for(T=0;T<x.length;T+=1)H=x[T],w=w||s(f,H);return g&&w}function Yl(f,g){var w=f.diff(g,"days",!0);return w<-6?"sameElse":w<-1?"lastWeek":w<0?"lastDay":w<1?"sameDay":w<2?"nextDay":w<7?"nextWeek":"sameElse"}function Rb(f,g){arguments.length===1&&(arguments[0]?Gl(arguments[0])?(f=arguments[0],g=void 0):fh(arguments[0])&&(g=arguments[0],f=void 0):(f=void 0,g=void 0));var w=f||vt(),x=Mi(w,this).startOf("day"),T=e.calendarFormat(this,x)||"sameElse",H=g&&(U(g[T])?g[T].call(this,w):g[T]);return this.format(H||this.localeData().calendar(T,this,vt(w)))}function Cb(){return new M(this)}function xb(f,g){var w=j(f)?f:vt(f);return this.isValid()&&w.isValid()?(g=ye(g)||"millisecond",g==="millisecond"?this.valueOf()>w.valueOf():w.valueOf()<this.clone().startOf(g).valueOf()):!1}function Kl(f,g){var w=j(f)?f:vt(f);return this.isValid()&&w.isValid()?(g=ye(g)||"millisecond",g==="millisecond"?this.valueOf()<w.valueOf():this.clone().endOf(g).valueOf()<w.valueOf()):!1}function Di(f,g,w,x){var T=j(f)?f:vt(f),H=j(g)?g:vt(g);return this.isValid()&&T.isValid()&&H.isValid()?(x=x||"()",(x[0]==="("?this.isAfter(T,w):!this.isBefore(T,w))&&(x[1]===")"?this.isBefore(H,w):!this.isAfter(H,w))):!1}function Ql(f,g){var w=j(f)?f:vt(f),x;return this.isValid()&&w.isValid()?(g=ye(g)||"millisecond",g==="millisecond"?this.valueOf()===w.valueOf():(x=w.valueOf(),this.clone().startOf(g).valueOf()<=x&&x<=this.clone().endOf(g).valueOf())):!1}function dh(f,g){return this.isSame(f,g)||this.isAfter(f,g)}function Zl(f,g){return this.isSame(f,g)||this.isBefore(f,g)}function ph(f,g,w){var x,T,H;if(!this.isValid())return NaN;if(x=Mi(f,this),!x.isValid())return NaN;switch(T=(x.utcOffset()-this.utcOffset())*6e4,g=ye(g),g){case"year":H=ha(this,x)/12;break;case"month":H=ha(this,x);break;case"quarter":H=ha(this,x)/3;break;case"second":H=(this-x)/1e3;break;case"minute":H=(this-x)/6e4;break;case"hour":H=(this-x)/36e5;break;case"day":H=(this-x-T)/864e5;break;case"week":H=(this-x-T)/6048e5;break;default:H=this-x}return w?H:Jr(H)}function ha(f,g){if(f.date()<g.date())return-ha(g,f);var w=(g.year()-f.year())*12+(g.month()-f.month()),x=f.clone().add(w,"months"),T,H;return g-x<0?(T=f.clone().add(w-1,"months"),H=(g-x)/(x-T)):(T=f.clone().add(w+1,"months"),H=(g-x)/(T-x)),-(w+H)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function Xl(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function hh(f){if(!this.isValid())return null;var g=f!==!0,w=g?this.clone().utc():this;return w.year()<0||w.year()>9999?ut(w,g?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):U(Date.prototype.toISOString)?g?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",ut(w,"Z")):ut(w,g?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function ma(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var f="moment",g="",w,x,T,H;return this.isLocal()||(f=this.utcOffset()===0?"moment.utc":"moment.parseZone",g="Z"),w="["+f+'("]',x=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",T="-MM-DD[T]HH:mm:ss.SSS",H=g+'[")]',this.format(w+x+T+H)}function ps(f){f||(f=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var g=ut(this,f);return this.localeData().postformat(g)}function eu(f,g){return this.isValid()&&(j(f)&&f.isValid()||vt(f).isValid())?bt({to:this,from:f}).locale(this.locale()).humanize(!g):this.localeData().invalidDate()}function Eb(f){return this.from(vt(),f)}function qb(f,g){return this.isValid()&&(j(f)&&f.isValid()||vt(f).isValid())?bt({from:this,to:f}).locale(this.locale()).humanize(!g):this.localeData().invalidDate()}function Ob(f){return this.to(vt(),f)}function ga(f){var g;return f===void 0?this._locale._abbr:(g=ei(f),g!=null&&(this._locale=g),this)}var ya=R("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(f){return f===void 0?this.localeData():this.locale(f)});function tu(){return this._locale}var ru=1e3,hs=60*ru,nu=60*hs,mh=(365*400+97)*24*nu;function Tt(f,g){return(f%g+g)%g}function sr(f,g,w){return f<100&&f>=0?new Date(f+400,g,w)-mh:new Date(f,g,w).valueOf()}function gh(f,g,w){return f<100&&f>=0?Date.UTC(f+400,g,w)-mh:Date.UTC(f,g,w)}function Ib(f){var g,w;if(f=ye(f),f===void 0||f==="millisecond"||!this.isValid())return this;switch(w=this._isUTC?gh:sr,f){case"year":g=w(this.year(),0,1);break;case"quarter":g=w(this.year(),this.month()-this.month()%3,1);break;case"month":g=w(this.year(),this.month(),1);break;case"week":g=w(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":g=w(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":g=w(this.year(),this.month(),this.date());break;case"hour":g=this._d.valueOf(),g-=Tt(g+(this._isUTC?0:this.utcOffset()*hs),nu);break;case"minute":g=this._d.valueOf(),g-=Tt(g,hs);break;case"second":g=this._d.valueOf(),g-=Tt(g,ru);break}return this._d.setTime(g),e.updateOffset(this,!0),this}function yh(f){var g,w;if(f=ye(f),f===void 0||f==="millisecond"||!this.isValid())return this;switch(w=this._isUTC?gh:sr,f){case"year":g=w(this.year()+1,0,1)-1;break;case"quarter":g=w(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":g=w(this.year(),this.month()+1,1)-1;break;case"week":g=w(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":g=w(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":g=w(this.year(),this.month(),this.date()+1)-1;break;case"hour":g=this._d.valueOf(),g+=nu-Tt(g+(this._isUTC?0:this.utcOffset()*hs),nu)-1;break;case"minute":g=this._d.valueOf(),g+=hs-Tt(g,hs)-1;break;case"second":g=this._d.valueOf(),g+=ru-Tt(g,ru)-1;break}return this._d.setTime(g),e.updateOffset(this,!0),this}function Pb(){return this._d.valueOf()-(this._offset||0)*6e4}function ff(){return Math.floor(this.valueOf()/1e3)}function va(){return new Date(this.valueOf())}function df(){var f=this;return[f.year(),f.month(),f.date(),f.hour(),f.minute(),f.second(),f.millisecond()]}function no(){var f=this;return{years:f.year(),months:f.month(),date:f.date(),hours:f.hours(),minutes:f.minutes(),seconds:f.seconds(),milliseconds:f.milliseconds()}}function ba(){return this.isValid()?this.toISOString():null}function Sa(){return v(this)}function iu(){return m({},E(this))}function io(){return E(this).overflow}function kb(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}pe("N",0,0,"eraAbbr"),pe("NN",0,0,"eraAbbr"),pe("NNN",0,0,"eraAbbr"),pe("NNNN",0,0,"eraName"),pe("NNNNN",0,0,"eraNarrow"),pe("y",["y",1],"yo","eraYear"),pe("y",["yy",2],0,"eraYear"),pe("y",["yyy",3],0,"eraYear"),pe("y",["yyyy",4],0,"eraYear"),he("N",Sr),he("NN",Sr),he("NNN",Sr),he("NNNN",ze),he("NNNNN",Mb),dt(["N","NN","NNN","NNNN","NNNNN"],function(f,g,w,x){var T=w._locale.erasParse(f,x,w._strict);T?E(w).era=T:E(w).invalidEra=f}),he("y",Ti),he("yy",Ti),he("yyy",Ti),he("yyyy",Ti),he("yo",Fb),dt(["y","yy","yyy","yyyy"],cr),dt(["yo"],function(f,g,w,x){var T;w._locale._eraYearOrdinalRegex&&(T=f.match(w._locale._eraYearOrdinalRegex)),w._locale.eraYearOrdinalParse?g[cr]=w._locale.eraYearOrdinalParse(f,T):g[cr]=parseInt(f,10)});function Ab(f,g){var w,x,T,H=this._eras||ei("en")._eras;for(w=0,x=H.length;w<x;++w)switch(typeof H[w].since==="string"&&(T=e(H[w].since).startOf("day"),H[w].since=T.valueOf()),typeof H[w].until){case"undefined":H[w].until=1/0;break;case"string":T=e(H[w].until).startOf("day").valueOf(),H[w].until=T.valueOf();break}return H}function Tb(f,g,w){var x,T,H=this.eras(),K,fe,Oe;for(f=f.toUpperCase(),x=0,T=H.length;x<T;++x)if(K=H[x].name.toUpperCase(),fe=H[x].abbr.toUpperCase(),Oe=H[x].narrow.toUpperCase(),w)switch(g){case"N":case"NN":case"NNN":if(fe===f)return H[x];break;case"NNNN":if(K===f)return H[x];break;case"NNNNN":if(Oe===f)return H[x];break}else if([K,fe,Oe].indexOf(f)>=0)return H[x]}function $b(f,g){var w=f.since<=f.until?1:-1;return g===void 0?e(f.since).year():e(f.since).year()+(g-f.offset)*w}function Nb(){var f,g,w,x=this.localeData().eras();for(f=0,g=x.length;f<g;++f)if(w=this.clone().startOf("day").valueOf(),x[f].since<=w&&w<=x[f].until||x[f].until<=w&&w<=x[f].since)return x[f].name;return""}function su(){var f,g,w,x=this.localeData().eras();for(f=0,g=x.length;f<g;++f)if(w=this.clone().startOf("day").valueOf(),x[f].since<=w&&w<=x[f].until||x[f].until<=w&&w<=x[f].since)return x[f].narrow;return""}function wa(){var f,g,w,x=this.localeData().eras();for(f=0,g=x.length;f<g;++f)if(w=this.clone().startOf("day").valueOf(),x[f].since<=w&&w<=x[f].until||x[f].until<=w&&w<=x[f].since)return x[f].abbr;return""}function vh(){var f,g,w,x,T=this.localeData().eras();for(f=0,g=T.length;f<g;++f)if(w=T[f].since<=T[f].until?1:-1,x=this.clone().startOf("day").valueOf(),T[f].since<=x&&x<=T[f].until||T[f].until<=x&&x<=T[f].since)return(this.year()-e(T[f].since).year())*w+T[f].offset;return this.year()}function $(f){return s(this,"_erasNameRegex")||pf.call(this),f?this._erasNameRegex:this._erasRegex}function so(f){return s(this,"_erasAbbrRegex")||pf.call(this),f?this._erasAbbrRegex:this._erasRegex}function ou(f){return s(this,"_erasNarrowRegex")||pf.call(this),f?this._erasNarrowRegex:this._erasRegex}function Sr(f,g){return g.erasAbbrRegex(f)}function ze(f,g){return g.erasNameRegex(f)}function Mb(f,g){return g.erasNarrowRegex(f)}function Fb(f,g){return g._eraYearOrdinalRegex||Ti}function pf(){var f=[],g=[],w=[],x=[],T,H,K,fe,Oe,Je=this.eras();for(T=0,H=Je.length;T<H;++T)K=kn(Je[T].name),fe=kn(Je[T].abbr),Oe=kn(Je[T].narrow),g.push(K),f.push(fe),w.push(Oe),x.push(K),x.push(fe),x.push(Oe);this._erasRegex=new RegExp("^("+x.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+g.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+f.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+w.join("|")+")","i")}pe(0,["gg",2],0,function(){return this.weekYear()%100}),pe(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Nn(f,g){pe(0,[f,f.length],0,g)}Nn("gggg","weekYear"),Nn("ggggg","weekYear"),Nn("GGGG","isoWeekYear"),Nn("GGGGG","isoWeekYear"),he("G",Gs),he("g",Gs),he("GG",qe,ge),he("gg",qe,ge),he("GGGG",ea,pn),he("gggg",ea,pn),he("GGGGG",Js,yt),he("ggggg",Js,yt),ra(["gggg","ggggg","GGGG","GGGGG"],function(f,g,w,x){g[x.substr(0,2)]=We(f)}),ra(["gg","GG"],function(f,g,w,x){g[x]=e.parseTwoDigitYear(f)});function Db(f){return bh.call(this,f,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function jb(f){return bh.call(this,f,this.isoWeek(),this.isoWeekday(),1,4)}function Lb(){return Tn(this.year(),1,4)}function Ub(){return Tn(this.isoWeekYear(),1,4)}function Hb(){var f=this.localeData()._week;return Tn(this.year(),f.dow,f.doy)}function ti(){var f=this.localeData()._week;return Tn(this.weekYear(),f.dow,f.doy)}function bh(f,g,w,x,T){var H;return f==null?aa(this,x,T).year:(H=Tn(f,x,T),g>H&&(g=H),Bb.call(this,f,g,w,x,T))}function Bb(f,g,w,x,T){var H=Fl(f,g,w,x,T),K=Ks(H.year,0,H.dayOfYear);return this.year(K.getUTCFullYear()),this.month(K.getUTCMonth()),this.date(K.getUTCDate()),this}pe("Q",0,"Qo","quarter"),he("Q",Te),dt("Q",function(f,g){g[Qn]=(We(f)-1)*3});function Vb(f){return f==null?Math.ceil((this.month()+1)/3):this.month((f-1)*3+this.month()%3)}pe("D",["DD",2],"Do","date"),he("D",qe,ls),he("DD",qe,ge),he("Do",function(f,g){return f?g._dayOfMonthOrdinalParse||g._ordinalParse:g._dayOfMonthOrdinalParseLenient}),dt(["D","DD"],An),dt("Do",function(f,g){g[An]=We(f.match(qe)[0])});var Sh=Ys("Date",!0);pe("DDD",["DDDD",3],"DDDo","dayOfYear"),he("DDD",zs),he("DDDD",In),dt(["DDD","DDDD"],function(f,g,w){w._dayOfYear=We(f)});function Wb(f){var g=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return f==null?g:this.add(f-g,"d")}pe("m",["mm",2],0,"minute"),he("m",qe,kl),he("mm",qe,ge),dt(["m","mm"],Gr);var ri=Ys("Minutes",!1);pe("s",["ss",2],0,"second"),he("s",qe,kl),he("ss",qe,ge),dt(["s","ss"],Zn);var zb=Ys("Seconds",!1);pe("S",0,0,function(){return~~(this.millisecond()/100)}),pe(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),pe(0,["SSS",3],0,"millisecond"),pe(0,["SSSS",4],0,function(){return this.millisecond()*10}),pe(0,["SSSSS",5],0,function(){return this.millisecond()*100}),pe(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),pe(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),pe(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),pe(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),he("S",zs,Te),he("SS",zs,ge),he("SSS",zs,In);var ji,wh;for(ji="SSSS";ji.length<=9;ji+="S")he(ji,Ti);function Jb(f,g){g[us]=We(("0."+f)*1e3)}for(ji="S";ji.length<=9;ji+="S")dt(ji,Jb);wh=Ys("Milliseconds",!1),pe("z",0,0,"zoneAbbr"),pe("zz",0,0,"zoneName");function Gb(){return this._isUTC?"UTC":""}function ms(){return this._isUTC?"Coordinated Universal Time":""}var ie=M.prototype;ie.add=wb,ie.calendar=Rb,ie.clone=Cb,ie.diff=ph,ie.endOf=yh,ie.format=ps,ie.from=eu,ie.fromNow=Eb,ie.to=qb,ie.toNow=Ob,ie.get=Tv,ie.invalidAt=io,ie.isAfter=xb,ie.isBefore=Kl,ie.isBetween=Di,ie.isSame=Ql,ie.isSameOrAfter=dh,ie.isSameOrBefore=Zl,ie.isValid=Sa,ie.lang=ya,ie.locale=ga,ie.localeData=tu,ie.max=ah,ie.min=oh,ie.parsingFlags=iu,ie.set=$l,ie.startOf=Ib,ie.subtract=ro,ie.toArray=df,ie.toObject=no,ie.toDate=va,ie.toISOString=hh,ie.inspect=ma,typeof Symbol<"u"&&Symbol.for!=null&&(ie[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),ie.toJSON=ba,ie.toString=Xl,ie.unix=ff,ie.valueOf=Pb,ie.creationData=kb,ie.eraName=Nb,ie.eraNarrow=su,ie.eraAbbr=wa,ie.eraYear=vh,ie.year=Lp,ie.isLeapYear=Av,ie.weekYear=Db,ie.isoWeekYear=jb,ie.quarter=ie.quarters=Vb,ie.month=Nl,ie.daysInMonth=jv,ie.week=ie.weeks=zp,ie.isoWeek=ie.isoWeeks=Uv,ie.weeksInYear=Hb,ie.weeksInWeekYear=ti,ie.isoWeeksInYear=Lb,ie.isoWeeksInISOWeekYear=Ub,ie.date=Sh,ie.day=ie.days=Yv,ie.weekday=Kv,ie.isoWeekday=Qv,ie.dayOfYear=Wb,ie.hour=ie.hours=tb,ie.minute=ie.minutes=ri,ie.second=ie.seconds=zb,ie.millisecond=ie.milliseconds=wh,ie.utcOffset=ch,ie.utc=gb,ie.local=yb,ie.parseZone=vb,ie.hasAlignedHourOffset=bb,ie.isDST=Fi,ie.isLocal=Z,ie.isUtcOffset=Y,ie.isUtc=de,ie.isUTC=de,ie.zoneAbbr=Gb,ie.zoneName=ms,ie.dates=R("dates accessor is deprecated. Use date instead.",Sh),ie.months=R("months accessor is deprecated. Use month instead",Nl),ie.years=R("years accessor is deprecated. Use year instead",Lp),ie.zone=R("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",mb),ie.isDSTShifted=R("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",W);function Yb(f){return vt(f*1e3)}function hn(){return vt.apply(null,arguments).parseZone()}function _h(f){return f}var it=Q.prototype;it.calendar=Ve,it.longDateFormat=xt,it.invalidDate=zr,it.ordinal=Ai,it.preparse=_h,it.postformat=_h,it.relativeTime=te,it.pastFuture=ne,it.set=D,it.eras=Ab,it.erasParse=Tb,it.erasConvertYear=$b,it.erasAbbrRegex=so,it.erasNameRegex=$,it.erasNarrowRegex=ou,it.months=Fv,it.monthsShort=Dv,it.monthsParse=Bp,it.monthsRegex=Ml,it.monthsShortRegex=Vp,it.week=Qc,it.firstDayOfYear=Wp,it.firstDayOfWeek=Qs,it.weekdays=Wv,it.weekdaysMin=Jv,it.weekdaysShort=zv,it.weekdaysParse=Gv,it.weekdaysRegex=Zv,it.weekdaysShortRegex=Pt,it.weekdaysMinRegex=Et,it.isPM=eb,it.meridiem=Xt;function au(f,g,w,x){var T=ei(),H=y().set(x,g);return T[w](H,f)}function Rh(f,g,w){if(c(f)&&(g=f,f=void 0),f=f||"",g!=null)return au(f,g,w,"month");var x,T=[];for(x=0;x<12;x++)T[x]=au(f,x,w,"month");return T}function hf(f,g,w,x){typeof f=="boolean"?(c(g)&&(w=g,g=void 0),g=g||""):(g=f,w=g,f=!1,c(g)&&(w=g,g=void 0),g=g||"");var T=ei(),H=f?T._week.dow:0,K,fe=[];if(w!=null)return au(g,(w+H)%7,x,"day");for(K=0;K<7;K++)fe[K]=au(g,(K+H)%7,x,"day");return fe}function Ch(f,g){return Rh(f,g,"months")}function xh(f,g){return Rh(f,g,"monthsShort")}function Kb(f,g,w){return hf(f,g,w,"weekdays")}function Qb(f,g,w){return hf(f,g,w,"weekdaysShort")}function mf(f,g,w){return hf(f,g,w,"weekdaysMin")}Xn("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(f){var g=f%10,w=We(f%100/10)===1?"th":g===1?"st":g===2?"nd":g===3?"rd":"th";return f+w}}),e.lang=R("moment.lang is deprecated. Use moment.locale instead.",Xn),e.langData=R("moment.langData is deprecated. Use moment.localeData instead.",ei);var Dr=Math.abs;function lu(){var f=this._data;return this._milliseconds=Dr(this._milliseconds),this._days=Dr(this._days),this._months=Dr(this._months),f.milliseconds=Dr(f.milliseconds),f.seconds=Dr(f.seconds),f.minutes=Dr(f.minutes),f.hours=Dr(f.hours),f.months=Dr(f.months),f.years=Dr(f.years),this}function Eh(f,g,w,x){var T=bt(g,w);return f._milliseconds+=x*T._milliseconds,f._days+=x*T._days,f._months+=x*T._months,f._bubble()}function qh(f,g){return Eh(this,f,g,1)}function Zb(f,g){return Eh(this,f,g,-1)}function mn(f){return f<0?Math.floor(f):Math.ceil(f)}function gf(){var f=this._milliseconds,g=this._days,w=this._months,x=this._data,T,H,K,fe,Oe;return f>=0&&g>=0&&w>=0||f<=0&&g<=0&&w<=0||(f+=mn(wr(w)+g)*864e5,g=0,w=0),x.milliseconds=f%1e3,T=Jr(f/1e3),x.seconds=T%60,H=Jr(T/60),x.minutes=H%60,K=Jr(H/60),x.hours=K%24,g+=Jr(K/24),Oe=Jr(Li(g)),w+=Oe,g-=mn(wr(Oe)),fe=Jr(w/12),w%=12,x.days=g,x.months=w,x.years=fe,this}function Li(f){return f*4800/146097}function wr(f){return f*146097/4800}function Xb(f){if(!this.isValid())return NaN;var g,w,x=this._milliseconds;if(f=ye(f),f==="month"||f==="quarter"||f==="year")switch(g=this._days+x/864e5,w=this._months+Li(g),f){case"month":return w;case"quarter":return w/3;case"year":return w/12}else switch(g=this._days+Math.round(wr(this._months)),f){case"week":return g/7+x/6048e5;case"day":return g+x/864e5;case"hour":return g*24+x/36e5;case"minute":return g*1440+x/6e4;case"second":return g*86400+x/1e3;case"millisecond":return Math.floor(g*864e5)+x;default:throw new Error("Unknown unit "+f)}}function Mn(f){return function(){return this.as(f)}}var yf=Mn("ms"),_a=Mn("s"),Ui=Mn("m"),Oh=Mn("h"),eS=Mn("d"),uu=Mn("w"),tS=Mn("M"),Ih=Mn("Q"),or=Mn("y"),vf=yf;function Ph(){return bt(this)}function Fn(f){return f=ye(f),this.isValid()?this[f+"s"]():NaN}function ni(f){return function(){return this.isValid()?this._data[f]:NaN}}var cu=ni("milliseconds"),gs=ni("seconds"),kh=ni("minutes"),dr=ni("hours"),bf=ni("days"),rS=ni("months"),nS=ni("years");function iS(){return Jr(this.days()/7)}var gn=Math.round,oo={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Ra(f,g,w,x,T){return T.relativeTime(g||1,!!w,f,x)}function Ah(f,g,w,x){var T=bt(f).abs(),H=gn(T.as("s")),K=gn(T.as("m")),fe=gn(T.as("h")),Oe=gn(T.as("d")),Je=gn(T.as("M")),er=gn(T.as("w")),ii=gn(T.as("y")),si=H<=w.ss&&["s",H]||H<w.s&&["ss",H]||K<=1&&["m"]||K<w.m&&["mm",K]||fe<=1&&["h"]||fe<w.h&&["hh",fe]||Oe<=1&&["d"]||Oe<w.d&&["dd",Oe];return w.w!=null&&(si=si||er<=1&&["w"]||er<w.w&&["ww",er]),si=si||Je<=1&&["M"]||Je<w.M&&["MM",Je]||ii<=1&&["y"]||["yy",ii],si[2]=g,si[3]=+f>0,si[4]=x,Ra.apply(null,si)}function sS(f){return f===void 0?gn:typeof f=="function"?(gn=f,!0):!1}function oS(f,g){return oo[f]===void 0?!1:g===void 0?oo[f]:(oo[f]=g,f==="s"&&(oo.ss=g-1),!0)}function Ca(f,g){if(!this.isValid())return this.localeData().invalidDate();var w=!1,x=oo,T,H;return typeof f=="object"&&(g=f,f=!1),typeof f=="boolean"&&(w=f),typeof g=="object"&&(x=Object.assign({},oo,g),g.s!=null&&g.ss==null&&(x.ss=g.s-1)),T=this.localeData(),H=Ah(this,!w,x,T),w&&(H=T.pastFuture(+this,H)),T.postformat(H)}var Sf=Math.abs;function ao(f){return(f>0)-(f<0)||+f}function lo(){if(!this.isValid())return this.localeData().invalidDate();var f=Sf(this._milliseconds)/1e3,g=Sf(this._days),w=Sf(this._months),x,T,H,K,fe=this.asSeconds(),Oe,Je,er,ii;return fe?(x=Jr(f/60),T=Jr(x/60),f%=60,x%=60,H=Jr(w/12),w%=12,K=f?f.toFixed(3).replace(/\.?0+$/,""):"",Oe=fe<0?"-":"",Je=ao(this._months)!==ao(fe)?"-":"",er=ao(this._days)!==ao(fe)?"-":"",ii=ao(this._milliseconds)!==ao(fe)?"-":"",Oe+"P"+(H?Je+H+"Y":"")+(w?Je+w+"M":"")+(g?er+g+"D":"")+(T||x||f?"T":"")+(T?ii+T+"H":"")+(x?ii+x+"M":"")+(f?ii+K+"S":"")):"P0D"}var Qe=to.prototype;Qe.isValid=db,Qe.abs=lu,Qe.add=qh,Qe.subtract=Zb,Qe.as=Xb,Qe.asMilliseconds=yf,Qe.asSeconds=_a,Qe.asMinutes=Ui,Qe.asHours=Oh,Qe.asDays=eS,Qe.asWeeks=uu,Qe.asMonths=tS,Qe.asQuarters=Ih,Qe.asYears=or,Qe.valueOf=vf,Qe._bubble=gf,Qe.clone=Ph,Qe.get=Fn,Qe.milliseconds=cu,Qe.seconds=gs,Qe.minutes=kh,Qe.hours=dr,Qe.days=bf,Qe.weeks=iS,Qe.months=rS,Qe.years=nS,Qe.humanize=Ca,Qe.toISOString=lo,Qe.toString=lo,Qe.toJSON=lo,Qe.locale=ga,Qe.localeData=tu,Qe.toIsoString=R("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",lo),Qe.lang=ya,pe("X",0,0,"unix"),pe("x",0,0,"valueOf"),he("x",Gs),he("X",Ov),dt("X",function(f,g,w){w._d=new Date(parseFloat(f)*1e3)}),dt("x",function(f,g,w){w._d=new Date(We(f))});return e.version="2.30.1",r(vt),e.fn=ie,e.min=ub,e.max=cb,e.now=fb,e.utc=y,e.unix=Yb,e.months=Ch,e.isDate=d,e.locale=Xn,e.invalid=_,e.duration=bt,e.isMoment=j,e.weekdays=Kb,e.parseZone=hn,e.localeData=ei,e.isDuration=fa,e.monthsShort=xh,e.weekdaysMin=mf,e.defineLocale=Ll,e.updateLocale=Tr,e.locales=$r,e.weekdaysShort=Qb,e.normalizeUnits=ye,e.relativeTimeRounding=sS,e.relativeTimeThreshold=oS,e.calendarFormat=Yl,e.prototype=ie,e.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},e}))});var Nq=V(($q,dm)=>{(function(t,e){typeof define=="function"&&define.amd?define([],e):typeof dm<"u"&&dm.exports?dm.exports=e():t.tv4=e()})($q,function(){Object.keys||(Object.keys=(function(){var I=Object.prototype.hasOwnProperty,R=!{toString:null}.propertyIsEnumerable("toString"),A=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],F=A.length;return function(U){if(typeof U!="object"&&typeof U!="function"||U===null)throw new TypeError("Object.keys called on non-object");var D=[];for(var J in U)I.call(U,J)&&D.push(J);if(R)for(var Q=0;Q<F;Q++)I.call(U,A[Q])&&D.push(A[Q]);return D}})()),Object.create||(Object.create=(function(){function I(){}return function(R){if(arguments.length!==1)throw new Error("Object.create implementation only accepts one parameter.");return I.prototype=R,new I}})()),Array.isArray||(Array.isArray=function(I){return Object.prototype.toString.call(I)==="[object Array]"}),Array.prototype.indexOf||(Array.prototype.indexOf=function(I){if(this===null)throw new TypeError;var R=Object(this),A=R.length>>>0;if(A===0)return-1;var F=0;if(arguments.length>1&&(F=Number(arguments[1]),F!==F?F=0:F!==0&&F!==1/0&&F!==-1/0&&(F=(F>0||-1)*Math.floor(Math.abs(F)))),F>=A)return-1;for(var U=F>=0?F:Math.max(A-Math.abs(F),0);U<A;U++)if(U in R&&R[U]===I)return U;return-1}),Object.isFrozen||(Object.isFrozen=function(I){for(var R="tv4_test_frozen_key";I.hasOwnProperty(R);)R+=Math.random();try{return I[R]=!0,delete I[R],!1}catch{return!0}});var t={"+":!0,"#":!0,".":!0,"/":!0,";":!0,"?":!0,"&":!0},e={"*":!0};function r(I){return encodeURI(I).replace(/%25[0-9][0-9]/g,function(R){return"%"+R.substring(3)})}function n(I){var R="";t[I.charAt(0)]&&(R=I.charAt(0),I=I.substring(1));var A="",F="",U=!0,D=!1,J=!1;R==="+"?U=!1:R==="."?(F=".",A="."):R==="/"?(F="/",A="/"):R==="#"?(F="#",U=!1):R===";"?(F=";",A=";",D=!0,J=!0):R==="?"?(F="?",A="&",D=!0):R==="&"&&(F="&",A="&",D=!0);for(var Q=[],se=I.split(","),ce=[],Ve={},Re=0;Re<se.length;Re++){var me=se[Re],Ae=null;if(me.indexOf(":")!==-1){var gt=me.split(":");me=gt[0],Ae=parseInt(gt[1],10)}for(var Nt={};e[me.charAt(me.length-1)];)Nt[me.charAt(me.length-1)]=!0,me=me.substring(0,me.length-1);var pe={truncate:Ae,name:me,suffices:Nt};ce.push(pe),Ve[me]=pe,Q.push(me)}var Gt=function(kr){for(var ut="",Ar=0,br=0;br<ce.length;br++){var xt=ce[br],wt=kr(xt.name);if(wt==null||Array.isArray(wt)&&wt.length===0||typeof wt=="object"&&Object.keys(wt).length===0){Ar++;continue}if(br===Ar?ut+=F:ut+=A||",",Array.isArray(wt)){D&&(ut+=xt.name+"=");for(var zr=0;zr<wt.length;zr++)zr>0&&(ut+=xt.suffices["*"]&&A||",",xt.suffices["*"]&&D&&(ut+=xt.name+"=")),ut+=U?encodeURIComponent(wt[zr]).replace(/!/g,"%21"):r(wt[zr])}else if(typeof wt=="object"){D&&!xt.suffices["*"]&&(ut+=xt.name+"=");var Ws=!0;for(var At in wt)Ws||(ut+=xt.suffices["*"]&&A||","),Ws=!1,ut+=U?encodeURIComponent(At).replace(/!/g,"%21"):r(At),ut+=xt.suffices["*"]?"=":",",ut+=U?encodeURIComponent(wt[At]).replace(/!/g,"%21"):r(wt[At])}else D&&(ut+=xt.name,(!J||wt!=="")&&(ut+="=")),xt.truncate!=null&&(wt=wt.substring(0,xt.truncate)),ut+=U?encodeURIComponent(wt).replace(/!/g,"%21"):r(wt)}return ut};return Gt.varNames=Q,{prefix:F,substitution:Gt}}function i(I){if(!(this instanceof i))return new i(I);for(var R=I.split("{"),A=[R.shift()],F=[],U=[],D=[];R.length>0;){var J=R.shift(),Q=J.split("}")[0],se=J.substring(Q.length+1),ce=n(Q);U.push(ce.substitution),F.push(ce.prefix),A.push(se),D=D.concat(ce.substitution.varNames)}this.fill=function(Ve){for(var Re=A[0],me=0;me<U.length;me++){var Ae=U[me];Re+=Ae(Ve),Re+=A[me+1]}return Re},this.varNames=D,this.template=I}i.prototype={toString:function(){return this.template},fillFromObject:function(I){return this.fill(function(R){return I[R]})}};var s=function(R,A,F,U,D){if(this.missing=[],this.missingMap={},this.formatValidators=R?Object.create(R.formatValidators):{},this.schemas=R?Object.create(R.schemas):{},this.collectMultiple=A,this.errors=[],this.handleError=A?this.collectError:this.returnError,U&&(this.checkRecursive=!0,this.scanned=[],this.scannedFrozen=[],this.scannedFrozenSchemas=[],this.scannedFrozenValidationErrors=[],this.validatedSchemasKey="tv4_validation_id",this.validationErrorsKey="tv4_validation_errors_id"),D&&(this.trackUnknownProperties=!0,this.knownPropertyPaths={},this.unknownPropertyPaths={}),this.errorReporter=F||b("en"),typeof this.errorReporter=="string")throw new Error("debug");if(this.definedKeywords={},R)for(var J in R.definedKeywords)this.definedKeywords[J]=R.definedKeywords[J].slice(0)};s.prototype.defineKeyword=function(I,R){this.definedKeywords[I]=this.definedKeywords[I]||[],this.definedKeywords[I].push(R)},s.prototype.createError=function(I,R,A,F,U,D,J){var Q=new q(I,R,A,F,U);return Q.message=this.errorReporter(Q,D,J),Q},s.prototype.returnError=function(I){return I},s.prototype.collectError=function(I){return I&&this.errors.push(I),null},s.prototype.prefixErrors=function(I,R,A){for(var F=I;F<this.errors.length;F++)this.errors[F]=this.errors[F].prefixWith(R,A);return this},s.prototype.banUnknownProperties=function(I,R){for(var A in this.unknownPropertyPaths){var F=this.createError(E.UNKNOWN_PROPERTY,{path:A},A,"",null,I,R),U=this.handleError(F);if(U)return U}return null},s.prototype.addFormat=function(I,R){if(typeof I=="object"){for(var A in I)this.addFormat(A,I[A]);return this}this.formatValidators[I]=R},s.prototype.resolveRefs=function(I,R){if(I.$ref!==void 0){if(R=R||{},R[I.$ref])return this.createError(E.CIRCULAR_REFERENCE,{urls:Object.keys(R).join(", ")},"","",null,void 0,I);R[I.$ref]=!0,I=this.getSchema(I.$ref,R)}return I},s.prototype.getSchema=function(I,R){var A;if(this.schemas[I]!==void 0)return A=this.schemas[I],this.resolveRefs(A,R);var F=I,U="";if(I.indexOf("#")!==-1&&(U=I.substring(I.indexOf("#")+1),F=I.substring(0,I.indexOf("#"))),typeof this.schemas[F]=="object"){A=this.schemas[F];var D=decodeURIComponent(U);if(D==="")return this.resolveRefs(A,R);if(D.charAt(0)!=="/")return;for(var J=D.split("/").slice(1),Q=0;Q<J.length;Q++){var se=J[Q].replace(/~1/g,"/").replace(/~0/g,"~");if(A[se]===void 0){A=void 0;break}A=A[se]}if(A!==void 0)return this.resolveRefs(A,R)}this.missing[F]===void 0&&(this.missing.push(F),this.missing[F]=F,this.missingMap[F]=F)},s.prototype.searchSchemas=function(I,R){if(Array.isArray(I))for(var A=0;A<I.length;A++)this.searchSchemas(I[A],R);else if(I&&typeof I=="object"){typeof I.id=="string"&&k(R,I.id)&&this.schemas[I.id]===void 0&&(this.schemas[I.id]=I);for(var F in I)if(F!=="enum"){if(typeof I[F]=="object")this.searchSchemas(I[F],R);else if(F==="$ref"){var U=m(I[F]);U&&this.schemas[U]===void 0&&this.missingMap[U]===void 0&&(this.missingMap[U]=U)}}}},s.prototype.addSchema=function(I,R){if(typeof I!="string"||typeof R>"u")if(typeof I=="object"&&typeof I.id=="string")R=I,I=R.id;else return;I===m(I)+"#"&&(I=m(I)),this.schemas[I]=R,delete this.missingMap[I],y(R,I),this.searchSchemas(R,I)},s.prototype.getSchemaMap=function(){var I={};for(var R in this.schemas)I[R]=this.schemas[R];return I},s.prototype.getSchemaUris=function(I){var R=[];for(var A in this.schemas)(!I||I.test(A))&&R.push(A);return R},s.prototype.getMissingUris=function(I){var R=[];for(var A in this.missingMap)(!I||I.test(A))&&R.push(A);return R},s.prototype.dropSchemas=function(){this.schemas={},this.reset()},s.prototype.reset=function(){this.missing=[],this.missingMap={},this.errors=[]},s.prototype.validateAll=function(I,R,A,F,U){var D;if(R=this.resolveRefs(R),R){if(R instanceof q)return this.errors.push(R),R}else return null;var J=this.errors.length,Q,se=null,ce=null;if(this.checkRecursive&&I&&typeof I=="object"){if(D=!this.scanned.length,I[this.validatedSchemasKey]){var Ve=I[this.validatedSchemasKey].indexOf(R);if(Ve!==-1)return this.errors=this.errors.concat(I[this.validationErrorsKey][Ve]),null}if(Object.isFrozen(I)&&(Q=this.scannedFrozen.indexOf(I),Q!==-1)){var Re=this.scannedFrozenSchemas[Q].indexOf(R);if(Re!==-1)return this.errors=this.errors.concat(this.scannedFrozenValidationErrors[Q][Re]),null}if(this.scanned.push(I),Object.isFrozen(I))Q===-1&&(Q=this.scannedFrozen.length,this.scannedFrozen.push(I),this.scannedFrozenSchemas.push([])),se=this.scannedFrozenSchemas[Q].length,this.scannedFrozenSchemas[Q][se]=R,this.scannedFrozenValidationErrors[Q][se]=[];else{if(!I[this.validatedSchemasKey])try{Object.defineProperty(I,this.validatedSchemasKey,{value:[],configurable:!0}),Object.defineProperty(I,this.validationErrorsKey,{value:[],configurable:!0})}catch{I[this.validatedSchemasKey]=[],I[this.validationErrorsKey]=[]}ce=I[this.validatedSchemasKey].length,I[this.validatedSchemasKey][ce]=R,I[this.validationErrorsKey][ce]=[]}}var me=this.errors.length,Ae=this.validateBasic(I,R,U)||this.validateNumeric(I,R,U)||this.validateString(I,R,U)||this.validateArray(I,R,U)||this.validateObject(I,R,U)||this.validateCombinations(I,R,U)||this.validateHypermedia(I,R,U)||this.validateFormat(I,R,U)||this.validateDefinedKeywords(I,R,U)||null;if(D){for(;this.scanned.length;){var gt=this.scanned.pop();delete gt[this.validatedSchemasKey]}this.scannedFrozen=[],this.scannedFrozenSchemas=[]}if(Ae||me!==this.errors.length)for(;A&&A.length||F&&F.length;){var Nt=A&&A.length?""+A.pop():null,pe=F&&F.length?""+F.pop():null;Ae&&(Ae=Ae.prefixWith(Nt,pe)),this.prefixErrors(me,Nt,pe)}return se!==null?this.scannedFrozenValidationErrors[Q][se]=this.errors.slice(J):ce!==null&&(I[this.validationErrorsKey][ce]=this.errors.slice(J)),this.handleError(Ae)},s.prototype.validateFormat=function(I,R){if(typeof R.format!="string"||!this.formatValidators[R.format])return null;var A=this.formatValidators[R.format].call(null,I,R);return typeof A=="string"||typeof A=="number"?this.createError(E.FORMAT_CUSTOM,{message:A},"","/format",null,I,R):A&&typeof A=="object"?this.createError(E.FORMAT_CUSTOM,{message:A.message||"?"},A.dataPath||"",A.schemaPath||"/format",null,I,R):null},s.prototype.validateDefinedKeywords=function(I,R,A){for(var F in this.definedKeywords)if(!(typeof R[F]>"u"))for(var U=this.definedKeywords[F],D=0;D<U.length;D++){var J=U[D],Q=J(I,R[F],R,A);if(typeof Q=="string"||typeof Q=="number")return this.createError(E.KEYWORD_CUSTOM,{key:F,message:Q},"","",null,I,R).prefixWith(null,F);if(Q&&typeof Q=="object"){var se=Q.code;if(typeof se=="string"){if(!E[se])throw new Error("Undefined error code (use defineError): "+se);se=E[se]}else typeof se!="number"&&(se=E.KEYWORD_CUSTOM);var ce=typeof Q.message=="object"?Q.message:{key:F,message:Q.message||"?"},Ve=Q.schemaPath||"/"+F.replace(/~/g,"~0").replace(/\//g,"~1");return this.createError(se,ce,Q.dataPath||null,Ve,null,I,R)}}return null};function o(I,R){if(I===R)return!0;if(I&&R&&typeof I=="object"&&typeof R=="object"){if(Array.isArray(I)!==Array.isArray(R))return!1;if(Array.isArray(I)){if(I.length!==R.length)return!1;for(var A=0;A<I.length;A++)if(!o(I[A],R[A]))return!1}else{var F;for(F in I)if(R[F]===void 0&&I[F]!==void 0)return!1;for(F in R)if(I[F]===void 0&&R[F]!==void 0)return!1;for(F in I)if(!o(I[F],R[F]))return!1}return!0}return!1}s.prototype.validateBasic=function(R,A,F){var U;return(U=this.validateType(R,A,F))||(U=this.validateEnum(R,A,F))?U.prefixWith(null,"type"):null},s.prototype.validateType=function(R,A){if(A.type===void 0)return null;var F=typeof R;R===null?F="null":Array.isArray(R)&&(F="array");var U=A.type;Array.isArray(U)||(U=[U]);for(var D=0;D<U.length;D++){var J=U[D];if(J===F||J==="integer"&&F==="number"&&R%1===0)return null}return this.createError(E.INVALID_TYPE,{type:F,expected:U.join("/")},"","",null,R,A)},s.prototype.validateEnum=function(R,A){if(A.enum===void 0)return null;for(var F=0;F<A.enum.length;F++){var U=A.enum[F];if(o(R,U))return null}return this.createError(E.ENUM_MISMATCH,{value:typeof JSON<"u"?JSON.stringify(R):R},"","",null,R,A)},s.prototype.validateNumeric=function(R,A,F){return this.validateMultipleOf(R,A,F)||this.validateMinMax(R,A,F)||this.validateNaN(R,A,F)||null};var l=Math.pow(2,-51),c=1-l;s.prototype.validateMultipleOf=function(R,A){var F=A.multipleOf||A.divisibleBy;if(F===void 0)return null;if(typeof R=="number"){var U=R/F%1;if(U>=l&&U<c)return this.createError(E.NUMBER_MULTIPLE_OF,{value:R,multipleOf:F},"","",null,R,A)}return null},s.prototype.validateMinMax=function(R,A){if(typeof R!="number")return null;if(A.minimum!==void 0){if(R<A.minimum)return this.createError(E.NUMBER_MINIMUM,{value:R,minimum:A.minimum},"","/minimum",null,R,A);if(A.exclusiveMinimum&&R===A.minimum)return this.createError(E.NUMBER_MINIMUM_EXCLUSIVE,{value:R,minimum:A.minimum},"","/exclusiveMinimum",null,R,A)}if(A.maximum!==void 0){if(R>A.maximum)return this.createError(E.NUMBER_MAXIMUM,{value:R,maximum:A.maximum},"","/maximum",null,R,A);if(A.exclusiveMaximum&&R===A.maximum)return this.createError(E.NUMBER_MAXIMUM_EXCLUSIVE,{value:R,maximum:A.maximum},"","/exclusiveMaximum",null,R,A)}return null},s.prototype.validateNaN=function(R,A){return typeof R!="number"?null:isNaN(R)===!0||R===1/0||R===-1/0?this.createError(E.NUMBER_NOT_A_NUMBER,{value:R},"","/type",null,R,A):null},s.prototype.validateString=function(R,A,F){return this.validateStringLength(R,A,F)||this.validateStringPattern(R,A,F)||null},s.prototype.validateStringLength=function(R,A){return typeof R!="string"?null:A.minLength!==void 0&&R.length<A.minLength?this.createError(E.STRING_LENGTH_SHORT,{length:R.length,minimum:A.minLength},"","/minLength",null,R,A):A.maxLength!==void 0&&R.length>A.maxLength?this.createError(E.STRING_LENGTH_LONG,{length:R.length,maximum:A.maxLength},"","/maxLength",null,R,A):null},s.prototype.validateStringPattern=function(R,A){if(typeof R!="string"||typeof A.pattern!="string"&&!(A.pattern instanceof RegExp))return null;var F;if(A.pattern instanceof RegExp)F=A.pattern;else{var U,D="",J=A.pattern.match(/^\/(.+)\/([img]*)$/);J?(U=J[1],D=J[2]):U=A.pattern,F=new RegExp(U,D)}return F.test(R)?null:this.createError(E.STRING_PATTERN,{pattern:A.pattern},"","/pattern",null,R,A)},s.prototype.validateArray=function(R,A,F){return Array.isArray(R)&&(this.validateArrayLength(R,A,F)||this.validateArrayUniqueItems(R,A,F)||this.validateArrayItems(R,A,F))||null},s.prototype.validateArrayLength=function(R,A){var F;return A.minItems!==void 0&&R.length<A.minItems&&(F=this.createError(E.ARRAY_LENGTH_SHORT,{length:R.length,minimum:A.minItems},"","/minItems",null,R,A),this.handleError(F))||A.maxItems!==void 0&&R.length>A.maxItems&&(F=this.createError(E.ARRAY_LENGTH_LONG,{length:R.length,maximum:A.maxItems},"","/maxItems",null,R,A),this.handleError(F))?F:null},s.prototype.validateArrayUniqueItems=function(R,A){if(A.uniqueItems){for(var F=0;F<R.length;F++)for(var U=F+1;U<R.length;U++)if(o(R[F],R[U])){var D=this.createError(E.ARRAY_UNIQUE,{match1:F,match2:U},"","/uniqueItems",null,R,A);if(this.handleError(D))return D}}return null},s.prototype.validateArrayItems=function(R,A,F){if(A.items===void 0)return null;var U,D;if(Array.isArray(A.items)){for(D=0;D<R.length;D++)if(D<A.items.length){if(U=this.validateAll(R[D],A.items[D],[D],["items",D],F+"/"+D))return U}else if(A.additionalItems!==void 0){if(typeof A.additionalItems=="boolean"){if(!A.additionalItems&&(U=this.createError(E.ARRAY_ADDITIONAL_ITEMS,{},"/"+D,"/additionalItems",null,R,A),this.handleError(U)))return U}else if(U=this.validateAll(R[D],A.additionalItems,[D],["additionalItems"],F+"/"+D))return U}}else for(D=0;D<R.length;D++)if(U=this.validateAll(R[D],A.items,[D],["items"],F+"/"+D))return U;return null},s.prototype.validateObject=function(R,A,F){return typeof R!="object"||R===null||Array.isArray(R)?null:this.validateObjectMinMaxProperties(R,A,F)||this.validateObjectRequiredProperties(R,A,F)||this.validateObjectProperties(R,A,F)||this.validateObjectDependencies(R,A,F)||null},s.prototype.validateObjectMinMaxProperties=function(R,A){var F=Object.keys(R),U;return A.minProperties!==void 0&&F.length<A.minProperties&&(U=this.createError(E.OBJECT_PROPERTIES_MINIMUM,{propertyCount:F.length,minimum:A.minProperties},"","/minProperties",null,R,A),this.handleError(U))||A.maxProperties!==void 0&&F.length>A.maxProperties&&(U=this.createError(E.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:F.length,maximum:A.maxProperties},"","/maxProperties",null,R,A),this.handleError(U))?U:null},s.prototype.validateObjectRequiredProperties=function(R,A){if(A.required!==void 0)for(var F=0;F<A.required.length;F++){var U=A.required[F];if(R[U]===void 0){var D=this.createError(E.OBJECT_REQUIRED,{key:U},"","/required/"+F,null,R,A);if(this.handleError(D))return D}}return null},s.prototype.validateObjectProperties=function(R,A,F){var U;for(var D in R){var J=F+"/"+D.replace(/~/g,"~0").replace(/\//g,"~1"),Q=!1;if(A.properties!==void 0&&A.properties[D]!==void 0&&(Q=!0,U=this.validateAll(R[D],A.properties[D],[D],["properties",D],J)))return U;if(A.patternProperties!==void 0)for(var se in A.patternProperties){var ce=new RegExp(se);if(ce.test(D)&&(Q=!0,U=this.validateAll(R[D],A.patternProperties[se],[D],["patternProperties",se],J)))return U}if(Q)this.trackUnknownProperties&&(this.knownPropertyPaths[J]=!0,delete this.unknownPropertyPaths[J]);else if(A.additionalProperties!==void 0){if(this.trackUnknownProperties&&(this.knownPropertyPaths[J]=!0,delete this.unknownPropertyPaths[J]),typeof A.additionalProperties=="boolean"){if(!A.additionalProperties&&(U=this.createError(E.OBJECT_ADDITIONAL_PROPERTIES,{key:D},"","/additionalProperties",null,R,A).prefixWith(D,null),this.handleError(U)))return U}else if(U=this.validateAll(R[D],A.additionalProperties,[D],["additionalProperties"],J))return U}else this.trackUnknownProperties&&!this.knownPropertyPaths[J]&&(this.unknownPropertyPaths[J]=!0)}return null},s.prototype.validateObjectDependencies=function(R,A,F){var U;if(A.dependencies!==void 0){for(var D in A.dependencies)if(R[D]!==void 0){var J=A.dependencies[D];if(typeof J=="string"){if(R[J]===void 0&&(U=this.createError(E.OBJECT_DEPENDENCY_KEY,{key:D,missing:J},"","",null,R,A).prefixWith(null,D).prefixWith(null,"dependencies"),this.handleError(U)))return U}else if(Array.isArray(J))for(var Q=0;Q<J.length;Q++){var se=J[Q];if(R[se]===void 0&&(U=this.createError(E.OBJECT_DEPENDENCY_KEY,{key:D,missing:se},"","/"+Q,null,R,A).prefixWith(null,D).prefixWith(null,"dependencies"),this.handleError(U)))return U}else if(U=this.validateAll(R,J,[],["dependencies",D],F))return U}}return null},s.prototype.validateCombinations=function(R,A,F){return this.validateAllOf(R,A,F)||this.validateAnyOf(R,A,F)||this.validateOneOf(R,A,F)||this.validateNot(R,A,F)||null},s.prototype.validateAllOf=function(R,A,F){if(A.allOf===void 0)return null;for(var U,D=0;D<A.allOf.length;D++){var J=A.allOf[D];if(U=this.validateAll(R,J,[],["allOf",D],F))return U}return null},s.prototype.validateAnyOf=function(R,A,F){if(A.anyOf===void 0)return null;var U=[],D=this.errors.length,J,Q;this.trackUnknownProperties&&(J=this.unknownPropertyPaths,Q=this.knownPropertyPaths);for(var se=!0,ce=0;ce<A.anyOf.length;ce++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var Ve=A.anyOf[ce],Re=this.errors.length,me=this.validateAll(R,Ve,[],["anyOf",ce],F);if(me===null&&Re===this.errors.length){if(this.errors=this.errors.slice(0,D),this.trackUnknownProperties){for(var Ae in this.knownPropertyPaths)Q[Ae]=!0,delete J[Ae];for(var gt in this.unknownPropertyPaths)Q[gt]||(J[gt]=!0);se=!1;continue}return null}me&&U.push(me.prefixWith(null,""+ce).prefixWith(null,"anyOf"))}if(this.trackUnknownProperties&&(this.unknownPropertyPaths=J,this.knownPropertyPaths=Q),se)return U=U.concat(this.errors.slice(D)),this.errors=this.errors.slice(0,D),this.createError(E.ANY_OF_MISSING,{},"","/anyOf",U,R,A)},s.prototype.validateOneOf=function(R,A,F){if(A.oneOf===void 0)return null;var U=null,D=[],J=this.errors.length,Q,se;this.trackUnknownProperties&&(Q=this.unknownPropertyPaths,se=this.knownPropertyPaths);for(var ce=0;ce<A.oneOf.length;ce++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var Ve=A.oneOf[ce],Re=this.errors.length,me=this.validateAll(R,Ve,[],["oneOf",ce],F);if(me===null&&Re===this.errors.length){if(U===null)U=ce;else return this.errors=this.errors.slice(0,J),this.createError(E.ONE_OF_MULTIPLE,{index1:U,index2:ce},"","/oneOf",null,R,A);if(this.trackUnknownProperties){for(var Ae in this.knownPropertyPaths)se[Ae]=!0,delete Q[Ae];for(var gt in this.unknownPropertyPaths)se[gt]||(Q[gt]=!0)}}else me&&D.push(me)}return this.trackUnknownProperties&&(this.unknownPropertyPaths=Q,this.knownPropertyPaths=se),U===null?(D=D.concat(this.errors.slice(J)),this.errors=this.errors.slice(0,J),this.createError(E.ONE_OF_MISSING,{},"","/oneOf",D,R,A)):(this.errors=this.errors.slice(0,J),null)},s.prototype.validateNot=function(R,A,F){if(A.not===void 0)return null;var U=this.errors.length,D,J;this.trackUnknownProperties&&(D=this.unknownPropertyPaths,J=this.knownPropertyPaths,this.unknownPropertyPaths={},this.knownPropertyPaths={});var Q=this.validateAll(R,A.not,null,null,F),se=this.errors.slice(U);return this.errors=this.errors.slice(0,U),this.trackUnknownProperties&&(this.unknownPropertyPaths=D,this.knownPropertyPaths=J),Q===null&&se.length===0?this.createError(E.NOT_PASSED,{},"","/not",null,R,A):null},s.prototype.validateHypermedia=function(R,A,F){if(!A.links)return null;for(var U,D=0;D<A.links.length;D++){var J=A.links[D];if(J.rel==="describedby"){for(var Q=new i(J.href),se=!0,ce=0;ce<Q.varNames.length;ce++)if(!(Q.varNames[ce]in R)){se=!1;break}if(se){var Ve=Q.fillFromObject(R),Re={$ref:Ve};if(U=this.validateAll(R,Re,[],["links",D],F))return U}}}};function d(I){var R=String(I).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return R?{href:R[0]||"",protocol:R[1]||"",authority:R[2]||"",host:R[3]||"",hostname:R[4]||"",port:R[5]||"",pathname:R[6]||"",search:R[7]||"",hash:R[8]||""}:null}function p(I,R){function A(F){var U=[];return F.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(D){D==="/.."?U.pop():U.push(D)}),U.join("").replace(/^\//,F.charAt(0)==="/"?"/":"")}return R=d(R||""),I=d(I||""),!R||!I?null:(R.protocol||I.protocol)+(R.protocol||R.authority?R.authority:I.authority)+A(R.protocol||R.authority||R.pathname.charAt(0)==="/"?R.pathname:R.pathname?(I.authority&&!I.pathname?"/":"")+I.pathname.slice(0,I.pathname.lastIndexOf("/")+1)+R.pathname:I.pathname)+(R.protocol||R.authority||R.pathname?R.search:R.search||I.search)+R.hash}function m(I){return I.split("#")[0]}function y(I,R){if(I&&typeof I=="object")if(R===void 0?R=I.id:typeof I.id=="string"&&(R=p(R,I.id),I.id=R),Array.isArray(I))for(var A=0;A<I.length;A++)y(I[A],R);else{typeof I.$ref=="string"&&(I.$ref=p(R,I.$ref));for(var F in I)F!=="enum"&&y(I[F],R)}}function b(I){I=I||"en";var R=O[I];return function(A){var F=R[A.code]||_[A.code];if(typeof F!="string")return"Unknown error code "+A.code+": "+JSON.stringify(A.messageParams);var U=A.params;return F.replace(/\{([^{}]*)\}/g,function(D,J){var Q=U[J];return typeof Q=="string"||typeof Q=="number"?Q:D})}}var E={INVALID_TYPE:0,ENUM_MISMATCH:1,ANY_OF_MISSING:10,ONE_OF_MISSING:11,ONE_OF_MULTIPLE:12,NOT_PASSED:13,NUMBER_MULTIPLE_OF:100,NUMBER_MINIMUM:101,NUMBER_MINIMUM_EXCLUSIVE:102,NUMBER_MAXIMUM:103,NUMBER_MAXIMUM_EXCLUSIVE:104,NUMBER_NOT_A_NUMBER:105,STRING_LENGTH_SHORT:200,STRING_LENGTH_LONG:201,STRING_PATTERN:202,OBJECT_PROPERTIES_MINIMUM:300,OBJECT_PROPERTIES_MAXIMUM:301,OBJECT_REQUIRED:302,OBJECT_ADDITIONAL_PROPERTIES:303,OBJECT_DEPENDENCY_KEY:304,ARRAY_LENGTH_SHORT:400,ARRAY_LENGTH_LONG:401,ARRAY_UNIQUE:402,ARRAY_ADDITIONAL_ITEMS:403,FORMAT_CUSTOM:500,KEYWORD_CUSTOM:501,CIRCULAR_REFERENCE:600,UNKNOWN_PROPERTY:1e3},C={};for(var v in E)C[E[v]]=v;var _={INVALID_TYPE:"Invalid type: {type} (expected {expected})",ENUM_MISMATCH:"No enum match for: {value}",ANY_OF_MISSING:'Data does not match any schemas from "anyOf"',ONE_OF_MISSING:'Data does not match any schemas from "oneOf"',ONE_OF_MULTIPLE:'Data is valid against more than one schema from "oneOf": indices {index1} and {index2}',NOT_PASSED:'Data matches schema from "not"',NUMBER_MULTIPLE_OF:"Value {value} is not a multiple of {multipleOf}",NUMBER_MINIMUM:"Value {value} is less than minimum {minimum}",NUMBER_MINIMUM_EXCLUSIVE:"Value {value} is equal to exclusive minimum {minimum}",NUMBER_MAXIMUM:"Value {value} is greater than maximum {maximum}",NUMBER_MAXIMUM_EXCLUSIVE:"Value {value} is equal to exclusive maximum {maximum}",NUMBER_NOT_A_NUMBER:"Value {value} is not a valid number",STRING_LENGTH_SHORT:"String is too short ({length} chars), minimum {minimum}",STRING_LENGTH_LONG:"String is too long ({length} chars), maximum {maximum}",STRING_PATTERN:"String does not match pattern: {pattern}",OBJECT_PROPERTIES_MINIMUM:"Too few properties defined ({propertyCount}), minimum {minimum}",OBJECT_PROPERTIES_MAXIMUM:"Too many properties defined ({propertyCount}), maximum {maximum}",OBJECT_REQUIRED:"Missing required property: {key}",OBJECT_ADDITIONAL_PROPERTIES:"Additional properties not allowed",OBJECT_DEPENDENCY_KEY:"Dependency failed - key must exist: {missing} (due to key: {key})",ARRAY_LENGTH_SHORT:"Array is too short ({length}), minimum {minimum}",ARRAY_LENGTH_LONG:"Array is too long ({length}), maximum {maximum}",ARRAY_UNIQUE:"Array items are not unique (indices {match1} and {match2})",ARRAY_ADDITIONAL_ITEMS:"Additional items not allowed",FORMAT_CUSTOM:"Format validation failed ({message})",KEYWORD_CUSTOM:"Keyword failed: {key} ({message})",CIRCULAR_REFERENCE:"Circular $refs: {urls}",UNKNOWN_PROPERTY:"Unknown property (not in schema)"};function q(I,R,A,F,U){if(Error.call(this),I===void 0)throw new Error("No error code supplied: "+F);this.message="",this.params=R,this.code=I,this.dataPath=A||"",this.schemaPath=F||"",this.subErrors=U||null;var D=new Error(this.message);if(this.stack=D.stack||D.stacktrace,!this.stack)try{throw D}catch(J){this.stack=J.stack||J.stacktrace}}q.prototype=Object.create(Error.prototype),q.prototype.constructor=q,q.prototype.name="ValidationError",q.prototype.prefixWith=function(I,R){if(I!==null&&(I=I.replace(/~/g,"~0").replace(/\//g,"~1"),this.dataPath="/"+I+this.dataPath),R!==null&&(R=R.replace(/~/g,"~0").replace(/\//g,"~1"),this.schemaPath="/"+R+this.schemaPath),this.subErrors!==null)for(var A=0;A<this.subErrors.length;A++)this.subErrors[A].prefixWith(I,R);return this};function k(I,R){if(R.substring(0,I.length)===I){var A=R.substring(I.length);if(R.length>0&&R.charAt(I.length-1)==="/"||A.charAt(0)==="#"||A.charAt(0)==="?")return!0}return!1}var O={};function M(I){var R=new s,A,F,U={setErrorReporter:function(D){return typeof D=="string"?this.language(D):(F=D,!0)},addFormat:function(){R.addFormat.apply(R,arguments)},language:function(D){return D?(O[D]||(D=D.split("-")[0]),O[D]?(A=D,D):!1):A},addLanguage:function(D,J){var Q;for(Q in E)J[Q]&&!J[E[Q]]&&(J[E[Q]]=J[Q]);var se=D.split("-")[0];if(!O[se])O[D]=J,O[se]=J;else{O[D]=Object.create(O[se]);for(Q in J)typeof O[se][Q]>"u"&&(O[se][Q]=J[Q]),O[D][Q]=J[Q]}return this},freshApi:function(D){var J=M();return D&&J.language(D),J},validate:function(D,J,Q,se){var ce=b(A),Ve=F?function(Ae,gt,Nt){return F(Ae,gt,Nt)||ce(Ae,gt,Nt)}:ce,Re=new s(R,!1,Ve,Q,se);typeof J=="string"&&(J={$ref:J}),Re.addSchema("",J);var me=Re.validateAll(D,J,null,null,"");return!me&&se&&(me=Re.banUnknownProperties(D,J)),this.error=me,this.missing=Re.missing,this.valid=me===null,this.valid},validateResult:function(){var D={toString:function(){return this.valid?"valid":this.error.message}};return this.validate.apply(D,arguments),D},validateMultiple:function(D,J,Q,se){var ce=b(A),Ve=F?function(Ae,gt,Nt){return F(Ae,gt,Nt)||ce(Ae,gt,Nt)}:ce,Re=new s(R,!0,Ve,Q,se);typeof J=="string"&&(J={$ref:J}),Re.addSchema("",J),Re.validateAll(D,J,null,null,""),se&&Re.banUnknownProperties(D,J);var me={toString:function(){return this.valid?"valid":this.error.message}};return me.errors=Re.errors,me.missing=Re.missing,me.valid=me.errors.length===0,me},addSchema:function(){return R.addSchema.apply(R,arguments)},getSchema:function(){return R.getSchema.apply(R,arguments)},getSchemaMap:function(){return R.getSchemaMap.apply(R,arguments)},getSchemaUris:function(){return R.getSchemaUris.apply(R,arguments)},getMissingUris:function(){return R.getMissingUris.apply(R,arguments)},dropSchemas:function(){R.dropSchemas.apply(R,arguments)},defineKeyword:function(){R.defineKeyword.apply(R,arguments)},defineError:function(D,J,Q){if(typeof D!="string"||!/^[A-Z]+(_[A-Z]+)*$/.test(D))throw new Error("Code name must be a string in UPPER_CASE_WITH_UNDERSCORES");if(typeof J!="number"||J%1!==0||J<1e4)throw new Error("Code number must be an integer > 10000");if(typeof E[D]<"u")throw new Error("Error already defined: "+D+" as "+E[D]);if(typeof C[J]<"u")throw new Error("Error code already used: "+C[J]+" as "+J);E[D]=J,C[J]=D,_[D]=_[J]=Q;for(var se in O){var ce=O[se];ce[D]&&(ce[J]=ce[J]||ce[D])}},reset:function(){R.reset(),this.error=null,this.missing=[],this.valid=!0},missing:[],error:null,valid:!0,normSchema:y,resolveUrl:p,getDocumentUri:m,errorCodes:E};return U.language(I||"en"),U}var j=M();return j.addLanguage("en-gb",_),j.tv4=j,j})});var Df=V(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.regexpCode=ft.getEsmExportName=ft.getProperty=ft.safeStringify=ft.stringify=ft.strConcat=ft.addCodeArg=ft.str=ft._=ft.nil=ft._Code=ft.Name=ft.IDENTIFIER=ft._CodeOrName=void 0;var Mf=class{};ft._CodeOrName=Mf;ft.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ta=class extends Mf{constructor(e){if(super(),!ft.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ft.Name=Ta;var Bn=class extends Mf{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Ta&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ft._Code=Bn;ft.nil=new Bn("");function Mq(t,...e){let r=[t[0]],n=0;for(;n<e.length;)nw(r,e[n]),r.push(t[++n]);return new Bn(r)}ft._=Mq;var rw=new Bn("+");function Fq(t,...e){let r=[Ff(t[0])],n=0;for(;n<e.length;)r.push(rw),nw(r,e[n]),r.push(rw,Ff(t[++n]));return B2(r),new Bn(r)}ft.str=Fq;function nw(t,e){e instanceof Bn?t.push(...e._items):e instanceof Ta?t.push(e):t.push(z2(e))}ft.addCodeArg=nw;function B2(t){let e=1;for(;e<t.length-1;){if(t[e]===rw){let r=V2(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function V2(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ta||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ta))return`"${t}${e.slice(1)}`}function W2(t,e){return e.emptyStr()?t:t.emptyStr()?e:Fq`${t}${e}`}ft.strConcat=W2;function z2(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Ff(Array.isArray(t)?t.join(","):t)}function J2(t){return new Bn(Ff(t))}ft.stringify=J2;function Ff(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ft.safeStringify=Ff;function G2(t){return typeof t=="string"&&ft.IDENTIFIER.test(t)?new Bn(`.${t}`):Mq`[${t}]`}ft.getProperty=G2;function Y2(t){if(typeof t=="string"&&ft.IDENTIFIER.test(t))return new Bn(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ft.getEsmExportName=Y2;function K2(t){return new Bn(t.toString())}ft.regexpCode=K2});var ow=V(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.ValueScope=rn.ValueScopeName=rn.Scope=rn.varKinds=rn.UsedValueState=void 0;var tn=Df(),iw=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},pm;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(pm||(rn.UsedValueState=pm={}));rn.varKinds={const:new tn.Name("const"),let:new tn.Name("let"),var:new tn.Name("var")};var hm=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof tn.Name?e:this.name(e)}name(e){return new tn.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};rn.Scope=hm;var mm=class extends tn.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,tn._)`.${new tn.Name(r)}[${n}]`}};rn.ValueScopeName=mm;var Q2=(0,tn._)`\n`,sw=class extends hm{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Q2:tn.nil}}get(){return this._scope}name(e){return new mm(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,l=this._values[s];if(l){let p=l.get(o);if(p)return p}else l=this._values[s]=new Map;l.set(o,i);let c=this._scope[s]||(this._scope[s]=[]),d=c.length;return c[d]=r.ref,i.setValue(r,{property:s,itemIndex:d}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,tn._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=tn.nil;for(let o in e){let l=e[o];if(!l)continue;let c=n[o]=n[o]||new Map;l.forEach(d=>{if(c.has(d))return;c.set(d,pm.Started);let p=r(d);if(p){let m=this.opts.es5?rn.varKinds.var:rn.varKinds.const;s=(0,tn._)`${s}${m} ${d} = ${p};${this.opts._n}`}else if(p=i?.(d))s=(0,tn._)`${s}${p}${this.opts._n}`;else throw new iw(d);c.set(d,pm.Completed)})}return s}};rn.ValueScope=sw});var Ge=V(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.or=Be.and=Be.not=Be.CodeGen=Be.operators=Be.varKinds=Be.ValueScopeName=Be.ValueScope=Be.Scope=Be.Name=Be.regexpCode=Be.stringify=Be.getProperty=Be.nil=Be.strConcat=Be.str=Be._=void 0;var rt=Df(),ci=ow(),bo=Df();Object.defineProperty(Be,"_",{enumerable:!0,get:function(){return bo._}});Object.defineProperty(Be,"str",{enumerable:!0,get:function(){return bo.str}});Object.defineProperty(Be,"strConcat",{enumerable:!0,get:function(){return bo.strConcat}});Object.defineProperty(Be,"nil",{enumerable:!0,get:function(){return bo.nil}});Object.defineProperty(Be,"getProperty",{enumerable:!0,get:function(){return bo.getProperty}});Object.defineProperty(Be,"stringify",{enumerable:!0,get:function(){return bo.stringify}});Object.defineProperty(Be,"regexpCode",{enumerable:!0,get:function(){return bo.regexpCode}});Object.defineProperty(Be,"Name",{enumerable:!0,get:function(){return bo.Name}});var bm=ow();Object.defineProperty(Be,"Scope",{enumerable:!0,get:function(){return bm.Scope}});Object.defineProperty(Be,"ValueScope",{enumerable:!0,get:function(){return bm.ValueScope}});Object.defineProperty(Be,"ValueScopeName",{enumerable:!0,get:function(){return bm.ValueScopeName}});Object.defineProperty(Be,"varKinds",{enumerable:!0,get:function(){return bm.varKinds}});Be.operators={GT:new rt._Code(">"),GTE:new rt._Code(">="),LT:new rt._Code("<"),LTE:new rt._Code("<="),EQ:new rt._Code("==="),NEQ:new rt._Code("!=="),NOT:new rt._Code("!"),OR:new rt._Code("||"),AND:new rt._Code("&&"),ADD:new rt._Code("+")};var Es=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},aw=class extends Es{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?ci.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Iu(this.rhs,e,r)),this}get names(){return this.rhs instanceof rt._CodeOrName?this.rhs.names:{}}},gm=class extends Es{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof rt.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Iu(this.rhs,e,r),this}get names(){let e=this.lhs instanceof rt.Name?{}:{...this.lhs.names};return vm(e,this.rhs)}},lw=class extends gm{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},uw=class extends Es{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},cw=class extends Es{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},fw=class extends Es{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},dw=class extends Es{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Iu(this.code,e,r),this}get names(){return this.code instanceof rt._CodeOrName?this.code.names:{}}},jf=class extends Es{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(Z2(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Ma(e,r.names),{})}},qs=class extends jf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},pw=class extends jf{},Ou=class extends qs{};Ou.kind="else";var $a=class t extends qs{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Ou(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Dq(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Iu(this.condition,e,r),this}get names(){let e=super.names;return vm(e,this.condition),this.else&&Ma(e,this.else.names),e}};$a.kind="if";var Na=class extends qs{};Na.kind="for";var hw=class extends Na{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Iu(this.iteration,e,r),this}get names(){return Ma(super.names,this.iteration.names)}},mw=class extends Na{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?ci.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=vm(super.names,this.from);return vm(e,this.to)}},ym=class extends Na{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Iu(this.iterable,e,r),this}get names(){return Ma(super.names,this.iterable.names)}},Lf=class extends qs{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Lf.kind="func";var Uf=class extends jf{render(e){return"return "+super.render(e)}};Uf.kind="return";var gw=class extends qs{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Ma(e,this.catch.names),this.finally&&Ma(e,this.finally.names),e}},Hf=class extends qs{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Hf.kind="catch";var Bf=class extends qs{render(e){return"finally"+super.render(e)}};Bf.kind="finally";var yw=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
23
|
+
`+new Error().stack),w=!1}return g.apply(this,arguments)},g)}var A={};function F(f,g){e.deprecationHandler!=null&&e.deprecationHandler(f,g),A[f]||(I(g),A[f]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function U(f){return typeof Function<"u"&&f instanceof Function||Object.prototype.toString.call(f)==="[object Function]"}function D(f){var g,w;for(w in f)s(f,w)&&(g=f[w],U(g)?this[w]=g:this["_"+w]=g);this._config=f,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function J(f,g){var w=m({},f),x;for(x in g)s(g,x)&&(i(f[x])&&i(g[x])?(w[x]={},m(w[x],f[x]),m(w[x],g[x])):g[x]!=null?w[x]=g[x]:delete w[x]);for(x in f)s(f,x)&&!s(g,x)&&i(f[x])&&(w[x]=m({},w[x]));return w}function Q(f){f!=null&&this.set(f)}var se;Object.keys?se=Object.keys:se=function(f){var g,w=[];for(g in f)s(f,g)&&w.push(g);return w};var ce={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function Ve(f,g,w){var x=this._calendar[f]||this._calendar.sameElse;return U(x)?x.call(g,w):x}function Re(f,g,w){var x=""+Math.abs(f),T=g-x.length,H=f>=0;return(H?w?"+":"":"-")+Math.pow(10,Math.max(0,T)).toString().substr(1)+x}var me=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Ae=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,gt={},Nt={};function pe(f,g,w,x){var T=x;typeof x=="string"&&(T=function(){return this[x]()}),f&&(Nt[f]=T),g&&(Nt[g[0]]=function(){return Re(T.apply(this,arguments),g[1],g[2])}),w&&(Nt[w]=function(){return this.localeData().ordinal(T.apply(this,arguments),f)})}function Gt(f){return f.match(/\[[\s\S]/)?f.replace(/^\[|\]$/g,""):f.replace(/\\/g,"")}function kr(f){var g=f.match(me),w,x;for(w=0,x=g.length;w<x;w++)Nt[g[w]]?g[w]=Nt[g[w]]:g[w]=Gt(g[w]);return function(T){var H="",K;for(K=0;K<x;K++)H+=U(g[K])?g[K].call(T,f):g[K];return H}}function ut(f,g){return f.isValid()?(g=Ar(g,f.localeData()),gt[g]=gt[g]||kr(g),gt[g](f)):f.localeData().invalidDate()}function Ar(f,g){var w=5;function x(T){return g.longDateFormat(T)||T}for(Ae.lastIndex=0;w>=0&&Ae.test(f);)f=f.replace(Ae,x),Ae.lastIndex=0,w-=1;return f}var br={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function xt(f){var g=this._longDateFormat[f],w=this._longDateFormat[f.toUpperCase()];return g||!w?g:(this._longDateFormat[f]=w.match(me).map(function(x){return x==="MMMM"||x==="MM"||x==="DD"||x==="dddd"?x.slice(1):x}).join(""),this._longDateFormat[f])}var wt="Invalid date";function zr(){return this._invalidDate}var Ws="%d",At=/\d{1,2}/;function Ai(f){return this._ordinal.replace("%d",f)}var On={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function te(f,g,w,x){var T=this._relativeTime[w];return U(T)?T(f,g,w,x):T.replace(/%d/i,f)}function ne(f,g){var w=this._relativeTime[f>0?"future":"past"];return U(w)?w(g):w.replace(/%s/i,g)}var Pe={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ye(f){return typeof f=="string"?Pe[f]||Pe[f.toLowerCase()]:void 0}function be(f){var g={},w,x;for(x in f)s(f,x)&&(w=ye(x),w&&(g[w]=f[x]));return g}var Ke={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function ur(f){var g=[],w;for(w in f)s(f,w)&&g.push({unit:w,priority:Ke[w]});return g.sort(function(x,T){return x.priority-T.priority}),g}var Te=/\d/,ge=/\d\d/,In=/\d{3}/,pn=/\d{4}/,yt=/[+-]?\d{6}/,qe=/\d\d?/,Pn=/\d\d\d\d?/,Il=/\d\d\d\d\d\d?/,zs=/\d{1,3}/,ea=/\d{1,4}/,Js=/[+-]?\d{1,6}/,Ti=/\d+/,Gs=/[+-]?\d+/,Bc=/Z|[+-]\d\d:?\d\d/gi,Pl=/Z|[+-]\d\d(?::?\d\d)?/gi,Ov=/[+-]?\d+(\.\d{1,3})?/,ta=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,ls=/^[1-9]\d?/,kl=/^([1-9]\d|\d)/,Al;Al={};function he(f,g,w){Al[f]=U(g)?g:function(x,T){return x&&w?w:g}}function Iv(f,g){return s(Al,f)?Al[f](g._strict,g._locale):new RegExp(Pv(f))}function Pv(f){return kn(f.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(g,w,x,T,H){return w||x||T||H}))}function kn(f){return f.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Jr(f){return f<0?Math.ceil(f)||0:Math.floor(f)}function We(f){var g=+f,w=0;return g!==0&&isFinite(g)&&(w=Jr(g)),w}var Vc={};function dt(f,g){var w,x=g,T;for(typeof f=="string"&&(f=[f]),c(g)&&(x=function(H,K){K[g]=We(H)}),T=f.length,w=0;w<T;w++)Vc[f[w]]=x}function ra(f,g){dt(f,function(w,x,T,H){T._w=T._w||{},g(w,T._w,T,H)})}function Wc(f,g,w){g!=null&&s(Vc,f)&&Vc[f](g,w._a,w,f)}function Tl(f){return f%4===0&&f%100!==0||f%400===0}var cr=0,Qn=1,An=2,Yt=3,Gr=4,Zn=5,us=6,jp=7,kv=8;pe("Y",0,0,function(){var f=this.year();return f<=9999?Re(f,4):"+"+f}),pe(0,["YY",2],0,function(){return this.year()%100}),pe(0,["YYYY",4],0,"year"),pe(0,["YYYYY",5],0,"year"),pe(0,["YYYYYY",6,!0],0,"year"),he("Y",Gs),he("YY",qe,ge),he("YYYY",ea,pn),he("YYYYY",Js,yt),he("YYYYYY",Js,yt),dt(["YYYYY","YYYYYY"],cr),dt("YYYY",function(f,g){g[cr]=f.length===2?e.parseTwoDigitYear(f):We(f)}),dt("YY",function(f,g){g[cr]=e.parseTwoDigitYear(f)}),dt("Y",function(f,g){g[cr]=parseInt(f,10)});function na(f){return Tl(f)?366:365}e.parseTwoDigitYear=function(f){return We(f)+(We(f)>68?1900:2e3)};var Lp=Ys("FullYear",!0);function Av(){return Tl(this.year())}function Ys(f,g){return function(w){return w!=null?(sa(this,f,w),e.updateOffset(this,g),this):ia(this,f)}}function ia(f,g){if(!f.isValid())return NaN;var w=f._d,x=f._isUTC;switch(g){case"Milliseconds":return x?w.getUTCMilliseconds():w.getMilliseconds();case"Seconds":return x?w.getUTCSeconds():w.getSeconds();case"Minutes":return x?w.getUTCMinutes():w.getMinutes();case"Hours":return x?w.getUTCHours():w.getHours();case"Date":return x?w.getUTCDate():w.getDate();case"Day":return x?w.getUTCDay():w.getDay();case"Month":return x?w.getUTCMonth():w.getMonth();case"FullYear":return x?w.getUTCFullYear():w.getFullYear();default:return NaN}}function sa(f,g,w){var x,T,H,K,fe;if(!(!f.isValid()||isNaN(w))){switch(x=f._d,T=f._isUTC,g){case"Milliseconds":return void(T?x.setUTCMilliseconds(w):x.setMilliseconds(w));case"Seconds":return void(T?x.setUTCSeconds(w):x.setSeconds(w));case"Minutes":return void(T?x.setUTCMinutes(w):x.setMinutes(w));case"Hours":return void(T?x.setUTCHours(w):x.setHours(w));case"Date":return void(T?x.setUTCDate(w):x.setDate(w));case"FullYear":break;default:return}H=w,K=f.month(),fe=f.date(),fe=fe===29&&K===1&&!Tl(H)?28:fe,T?x.setUTCFullYear(H,K,fe):x.setFullYear(H,K,fe)}}function Tv(f){return f=ye(f),U(this[f])?this[f]():this}function $l(f,g){if(typeof f=="object"){f=be(f);var w=ur(f),x,T=w.length;for(x=0;x<T;x++)this[w[x].unit](f[w[x].unit])}else if(f=ye(f),U(this[f]))return this[f](g);return this}function $v(f,g){return(f%g+g)%g}var Lt;Array.prototype.indexOf?Lt=Array.prototype.indexOf:Lt=function(f){var g;for(g=0;g<this.length;++g)if(this[g]===f)return g;return-1};function zc(f,g){if(isNaN(f)||isNaN(g))return NaN;var w=$v(g,12);return f+=(g-w)/12,w===1?Tl(f)?29:28:31-w%7%2}pe("M",["MM",2],"Mo",function(){return this.month()+1}),pe("MMM",0,0,function(f){return this.localeData().monthsShort(this,f)}),pe("MMMM",0,0,function(f){return this.localeData().months(this,f)}),he("M",qe,ls),he("MM",qe,ge),he("MMM",function(f,g){return g.monthsShortRegex(f)}),he("MMMM",function(f,g){return g.monthsRegex(f)}),dt(["M","MM"],function(f,g){g[Qn]=We(f)-1}),dt(["MMM","MMMM"],function(f,g,w,x){var T=w._locale.monthsParse(f,x,w._strict);T!=null?g[Qn]=T:q(w).invalidMonth=f});var Up="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Jc="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Gc=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Nv=ta,Mv=ta;function Fv(f,g){return f?n(this._months)?this._months[f.month()]:this._months[(this._months.isFormat||Gc).test(g)?"format":"standalone"][f.month()]:n(this._months)?this._months:this._months.standalone}function Dv(f,g){return f?n(this._monthsShort)?this._monthsShort[f.month()]:this._monthsShort[Gc.test(g)?"format":"standalone"][f.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Hp(f,g,w){var x,T,H,K=f.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],x=0;x<12;++x)H=y([2e3,x]),this._shortMonthsParse[x]=this.monthsShort(H,"").toLocaleLowerCase(),this._longMonthsParse[x]=this.months(H,"").toLocaleLowerCase();return w?g==="MMM"?(T=Lt.call(this._shortMonthsParse,K),T!==-1?T:null):(T=Lt.call(this._longMonthsParse,K),T!==-1?T:null):g==="MMM"?(T=Lt.call(this._shortMonthsParse,K),T!==-1?T:(T=Lt.call(this._longMonthsParse,K),T!==-1?T:null)):(T=Lt.call(this._longMonthsParse,K),T!==-1?T:(T=Lt.call(this._shortMonthsParse,K),T!==-1?T:null))}function Bp(f,g,w){var x,T,H;if(this._monthsParseExact)return Hp.call(this,f,g,w);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),x=0;x<12;x++){if(T=y([2e3,x]),w&&!this._longMonthsParse[x]&&(this._longMonthsParse[x]=new RegExp("^"+this.months(T,"").replace(".","")+"$","i"),this._shortMonthsParse[x]=new RegExp("^"+this.monthsShort(T,"").replace(".","")+"$","i")),!w&&!this._monthsParse[x]&&(H="^"+this.months(T,"")+"|^"+this.monthsShort(T,""),this._monthsParse[x]=new RegExp(H.replace(".",""),"i")),w&&g==="MMMM"&&this._longMonthsParse[x].test(f))return x;if(w&&g==="MMM"&&this._shortMonthsParse[x].test(f))return x;if(!w&&this._monthsParse[x].test(f))return x}}function Yc(f,g){if(!f.isValid())return f;if(typeof g=="string"){if(/^\d+$/.test(g))g=We(g);else if(g=f.localeData().monthsParse(g),!c(g))return f}var w=g,x=f.date();return x=x<29?x:Math.min(x,zc(f.year(),w)),f._isUTC?f._d.setUTCMonth(w,x):f._d.setMonth(w,x),f}function Nl(f){return f!=null?(Yc(this,f),e.updateOffset(this,!0),this):ia(this,"Month")}function jv(){return zc(this.year(),this.month())}function Vp(f){return this._monthsParseExact?(s(this,"_monthsRegex")||Kc.call(this),f?this._monthsShortStrictRegex:this._monthsShortRegex):(s(this,"_monthsShortRegex")||(this._monthsShortRegex=Nv),this._monthsShortStrictRegex&&f?this._monthsShortStrictRegex:this._monthsShortRegex)}function Ml(f){return this._monthsParseExact?(s(this,"_monthsRegex")||Kc.call(this),f?this._monthsStrictRegex:this._monthsRegex):(s(this,"_monthsRegex")||(this._monthsRegex=Mv),this._monthsStrictRegex&&f?this._monthsStrictRegex:this._monthsRegex)}function Kc(){function f(Oe,Je){return Je.length-Oe.length}var g=[],w=[],x=[],T,H,K,fe;for(T=0;T<12;T++)H=y([2e3,T]),K=kn(this.monthsShort(H,"")),fe=kn(this.months(H,"")),g.push(K),w.push(fe),x.push(fe),x.push(K);g.sort(f),w.sort(f),x.sort(f),this._monthsRegex=new RegExp("^("+x.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+w.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+g.join("|")+")","i")}function Lv(f,g,w,x,T,H,K){var fe;return f<100&&f>=0?(fe=new Date(f+400,g,w,x,T,H,K),isFinite(fe.getFullYear())&&fe.setFullYear(f)):fe=new Date(f,g,w,x,T,H,K),fe}function Ks(f){var g,w;return f<100&&f>=0?(w=Array.prototype.slice.call(arguments),w[0]=f+400,g=new Date(Date.UTC.apply(null,w)),isFinite(g.getUTCFullYear())&&g.setUTCFullYear(f)):g=new Date(Date.UTC.apply(null,arguments)),g}function oa(f,g,w){var x=7+g-w,T=(7+Ks(f,0,x).getUTCDay()-g)%7;return-T+x-1}function Fl(f,g,w,x,T){var H=(7+w-x)%7,K=oa(f,x,T),fe=1+7*(g-1)+H+K,Oe,Je;return fe<=0?(Oe=f-1,Je=na(Oe)+fe):fe>na(f)?(Oe=f+1,Je=fe-na(f)):(Oe=f,Je=fe),{year:Oe,dayOfYear:Je}}function aa(f,g,w){var x=oa(f.year(),g,w),T=Math.floor((f.dayOfYear()-x-1)/7)+1,H,K;return T<1?(K=f.year()-1,H=T+Tn(K,g,w)):T>Tn(f.year(),g,w)?(H=T-Tn(f.year(),g,w),K=f.year()+1):(K=f.year(),H=T),{week:H,year:K}}function Tn(f,g,w){var x=oa(f,g,w),T=oa(f+1,g,w);return(na(f)-x+T)/7}pe("w",["ww",2],"wo","week"),pe("W",["WW",2],"Wo","isoWeek"),he("w",qe,ls),he("ww",qe,ge),he("W",qe,ls),he("WW",qe,ge),ra(["w","ww","W","WW"],function(f,g,w,x){g[x.substr(0,1)]=We(f)});function Qc(f){return aa(f,this._week.dow,this._week.doy).week}var Zc={dow:0,doy:6};function Qs(){return this._week.dow}function Wp(){return this._week.doy}function zp(f){var g=this.localeData().week(this);return f==null?g:this.add((f-g)*7,"d")}function Uv(f){var g=aa(this,1,4).week;return f==null?g:this.add((f-g)*7,"d")}pe("d",0,"do","day"),pe("dd",0,0,function(f){return this.localeData().weekdaysMin(this,f)}),pe("ddd",0,0,function(f){return this.localeData().weekdaysShort(this,f)}),pe("dddd",0,0,function(f){return this.localeData().weekdays(this,f)}),pe("e",0,0,"weekday"),pe("E",0,0,"isoWeekday"),he("d",qe),he("e",qe),he("E",qe),he("dd",function(f,g){return g.weekdaysMinRegex(f)}),he("ddd",function(f,g){return g.weekdaysShortRegex(f)}),he("dddd",function(f,g){return g.weekdaysRegex(f)}),ra(["dd","ddd","dddd"],function(f,g,w,x){var T=w._locale.weekdaysParse(f,x,w._strict);T!=null?g.d=T:q(w).invalidWeekday=f}),ra(["d","e","E"],function(f,g,w,x){g[x]=We(f)});function Jp(f,g){return typeof f!="string"?f:isNaN(f)?(f=g.weekdaysParse(f),typeof f=="number"?f:null):parseInt(f,10)}function Gp(f,g){return typeof f=="string"?g.weekdaysParse(f)%7||7:isNaN(f)?null:f}function Dl(f,g){return f.slice(g,7).concat(f.slice(0,g))}var Yp="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Kp="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Hv="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Bv=ta,Qp=ta,Vv=ta;function Wv(f,g){var w=n(this._weekdays)?this._weekdays:this._weekdays[f&&f!==!0&&this._weekdays.isFormat.test(g)?"format":"standalone"];return f===!0?Dl(w,this._week.dow):f?w[f.day()]:w}function zv(f){return f===!0?Dl(this._weekdaysShort,this._week.dow):f?this._weekdaysShort[f.day()]:this._weekdaysShort}function Jv(f){return f===!0?Dl(this._weekdaysMin,this._week.dow):f?this._weekdaysMin[f.day()]:this._weekdaysMin}function Xc(f,g,w){var x,T,H,K=f.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],x=0;x<7;++x)H=y([2e3,1]).day(x),this._minWeekdaysParse[x]=this.weekdaysMin(H,"").toLocaleLowerCase(),this._shortWeekdaysParse[x]=this.weekdaysShort(H,"").toLocaleLowerCase(),this._weekdaysParse[x]=this.weekdays(H,"").toLocaleLowerCase();return w?g==="dddd"?(T=Lt.call(this._weekdaysParse,K),T!==-1?T:null):g==="ddd"?(T=Lt.call(this._shortWeekdaysParse,K),T!==-1?T:null):(T=Lt.call(this._minWeekdaysParse,K),T!==-1?T:null):g==="dddd"?(T=Lt.call(this._weekdaysParse,K),T!==-1||(T=Lt.call(this._shortWeekdaysParse,K),T!==-1)?T:(T=Lt.call(this._minWeekdaysParse,K),T!==-1?T:null)):g==="ddd"?(T=Lt.call(this._shortWeekdaysParse,K),T!==-1||(T=Lt.call(this._weekdaysParse,K),T!==-1)?T:(T=Lt.call(this._minWeekdaysParse,K),T!==-1?T:null)):(T=Lt.call(this._minWeekdaysParse,K),T!==-1||(T=Lt.call(this._weekdaysParse,K),T!==-1)?T:(T=Lt.call(this._shortWeekdaysParse,K),T!==-1?T:null))}function Gv(f,g,w){var x,T,H;if(this._weekdaysParseExact)return Xc.call(this,f,g,w);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),x=0;x<7;x++){if(T=y([2e3,1]).day(x),w&&!this._fullWeekdaysParse[x]&&(this._fullWeekdaysParse[x]=new RegExp("^"+this.weekdays(T,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[x]=new RegExp("^"+this.weekdaysShort(T,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[x]=new RegExp("^"+this.weekdaysMin(T,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[x]||(H="^"+this.weekdays(T,"")+"|^"+this.weekdaysShort(T,"")+"|^"+this.weekdaysMin(T,""),this._weekdaysParse[x]=new RegExp(H.replace(".",""),"i")),w&&g==="dddd"&&this._fullWeekdaysParse[x].test(f))return x;if(w&&g==="ddd"&&this._shortWeekdaysParse[x].test(f))return x;if(w&&g==="dd"&&this._minWeekdaysParse[x].test(f))return x;if(!w&&this._weekdaysParse[x].test(f))return x}}function Yv(f){if(!this.isValid())return f!=null?this:NaN;var g=ia(this,"Day");return f!=null?(f=Jp(f,this.localeData()),this.add(f-g,"d")):g}function Kv(f){if(!this.isValid())return f!=null?this:NaN;var g=(this.day()+7-this.localeData()._week.dow)%7;return f==null?g:this.add(f-g,"d")}function Qv(f){if(!this.isValid())return f!=null?this:NaN;if(f!=null){var g=Gp(f,this.localeData());return this.day(this.day()%7?g:g-7)}else return this.day()||7}function Zv(f){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||ef.call(this),f?this._weekdaysStrictRegex:this._weekdaysRegex):(s(this,"_weekdaysRegex")||(this._weekdaysRegex=Bv),this._weekdaysStrictRegex&&f?this._weekdaysStrictRegex:this._weekdaysRegex)}function Pt(f){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||ef.call(this),f?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(s(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Qp),this._weekdaysShortStrictRegex&&f?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Et(f){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||ef.call(this),f?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(s(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Vv),this._weekdaysMinStrictRegex&&f?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function ef(){function f(er,ii){return ii.length-er.length}var g=[],w=[],x=[],T=[],H,K,fe,Oe,Je;for(H=0;H<7;H++)K=y([2e3,1]).day(H),fe=kn(this.weekdaysMin(K,"")),Oe=kn(this.weekdaysShort(K,"")),Je=kn(this.weekdays(K,"")),g.push(fe),w.push(Oe),x.push(Je),T.push(fe),T.push(Oe),T.push(Je);g.sort(f),w.sort(f),x.sort(f),T.sort(f),this._weekdaysRegex=new RegExp("^("+T.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+x.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+w.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function tf(){return this.hours()%12||12}function Xv(){return this.hours()||24}pe("H",["HH",2],0,"hour"),pe("h",["hh",2],0,tf),pe("k",["kk",2],0,Xv),pe("hmm",0,0,function(){return""+tf.apply(this)+Re(this.minutes(),2)}),pe("hmmss",0,0,function(){return""+tf.apply(this)+Re(this.minutes(),2)+Re(this.seconds(),2)}),pe("Hmm",0,0,function(){return""+this.hours()+Re(this.minutes(),2)}),pe("Hmmss",0,0,function(){return""+this.hours()+Re(this.minutes(),2)+Re(this.seconds(),2)});function Zp(f,g){pe(f,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),g)})}Zp("a",!0),Zp("A",!1);function Xp(f,g){return g._meridiemParse}he("a",Xp),he("A",Xp),he("H",qe,kl),he("h",qe,ls),he("k",qe,ls),he("HH",qe,ge),he("hh",qe,ge),he("kk",qe,ge),he("hmm",Pn),he("hmmss",Il),he("Hmm",Pn),he("Hmmss",Il),dt(["H","HH"],Yt),dt(["k","kk"],function(f,g,w){var x=We(f);g[Yt]=x===24?0:x}),dt(["a","A"],function(f,g,w){w._isPm=w._locale.isPM(f),w._meridiem=f}),dt(["h","hh"],function(f,g,w){g[Yt]=We(f),q(w).bigHour=!0}),dt("hmm",function(f,g,w){var x=f.length-2;g[Yt]=We(f.substr(0,x)),g[Gr]=We(f.substr(x)),q(w).bigHour=!0}),dt("hmmss",function(f,g,w){var x=f.length-4,T=f.length-2;g[Yt]=We(f.substr(0,x)),g[Gr]=We(f.substr(x,2)),g[Zn]=We(f.substr(T)),q(w).bigHour=!0}),dt("Hmm",function(f,g,w){var x=f.length-2;g[Yt]=We(f.substr(0,x)),g[Gr]=We(f.substr(x))}),dt("Hmmss",function(f,g,w){var x=f.length-4,T=f.length-2;g[Yt]=We(f.substr(0,x)),g[Gr]=We(f.substr(x,2)),g[Zn]=We(f.substr(T))});function eb(f){return(f+"").toLowerCase().charAt(0)==="p"}var eh=/[ap]\.?m?\.?/i,tb=Ys("Hours",!0);function Xt(f,g,w){return f>11?w?"pm":"PM":w?"am":"AM"}var jl={calendar:ce,longDateFormat:br,invalidDate:wt,ordinal:Ws,dayOfMonthOrdinalParse:At,relativeTime:On,months:Up,monthsShort:Jc,week:Zc,weekdays:Yp,weekdaysMin:Hv,weekdaysShort:Kp,meridiemParse:eh},pt={},Zs={},cs;function Yr(f,g){var w,x=Math.min(f.length,g.length);for(w=0;w<x;w+=1)if(f[w]!==g[w])return w;return x}function rf(f){return f&&f.toLowerCase().replace("_","-")}function th(f){for(var g=0,w,x,T,H;g<f.length;){for(H=rf(f[g]).split("-"),w=H.length,x=rf(f[g+1]),x=x?x.split("-"):null;w>0;){if(T=la(H.slice(0,w).join("-")),T)return T;if(x&&x.length>=w&&Yr(H,x)>=w-1)break;w--}g++}return cs}function rh(f){return!!(f&&f.match("^[^/\\\\]*$"))}function la(f){var g=null,w;if(pt[f]===void 0&&typeof qu<"u"&&qu&&qu.exports&&rh(f))try{g=cs._abbr,w=require,w("./locale/"+f),Xn(g)}catch{pt[f]=null}return pt[f]}function Xn(f,g){var w;return f&&(l(g)?w=ei(f):w=Ll(f,g),w?cs=w:typeof console<"u"&&console.warn&&console.warn("Locale "+f+" not found. Did you forget to load it?")),cs._abbr}function Ll(f,g){if(g!==null){var w,x=jl;if(g.abbr=f,pt[f]!=null)F("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),x=pt[f]._config;else if(g.parentLocale!=null)if(pt[g.parentLocale]!=null)x=pt[g.parentLocale]._config;else if(w=la(g.parentLocale),w!=null)x=w._config;else return Zs[g.parentLocale]||(Zs[g.parentLocale]=[]),Zs[g.parentLocale].push({name:f,config:g}),null;return pt[f]=new Q(J(x,g)),Zs[f]&&Zs[f].forEach(function(T){Ll(T.name,T.config)}),Xn(f),pt[f]}else return delete pt[f],null}function Tr(f,g){if(g!=null){var w,x,T=jl;pt[f]!=null&&pt[f].parentLocale!=null?pt[f].set(J(pt[f]._config,g)):(x=la(f),x!=null&&(T=x._config),g=J(T,g),x==null&&(g.abbr=f),w=new Q(g),w.parentLocale=pt[f],pt[f]=w),Xn(f)}else pt[f]!=null&&(pt[f].parentLocale!=null?(pt[f]=pt[f].parentLocale,f===Xn()&&Xn(f)):pt[f]!=null&&delete pt[f]);return pt[f]}function ei(f){var g;if(f&&f._locale&&f._locale._abbr&&(f=f._locale._abbr),!f)return cs;if(!n(f)){if(g=la(f),g)return g;f=[f]}return th(f)}function $r(){return se(pt)}function nf(f){var g,w=f._a;return w&&q(f).overflow===-2&&(g=w[Qn]<0||w[Qn]>11?Qn:w[An]<1||w[An]>zc(w[cr],w[Qn])?An:w[Yt]<0||w[Yt]>24||w[Yt]===24&&(w[Gr]!==0||w[Zn]!==0||w[us]!==0)?Yt:w[Gr]<0||w[Gr]>59?Gr:w[Zn]<0||w[Zn]>59?Zn:w[us]<0||w[us]>999?us:-1,q(f)._overflowDayOfYear&&(g<cr||g>An)&&(g=An),q(f)._overflowWeeks&&g===-1&&(g=jp),q(f)._overflowWeekday&&g===-1&&(g=kv),q(f).overflow=g),f}var nh=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,$i=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ul=/Z|[+-]\d\d(?::?\d\d)?/,Xs=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],qt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ni=/^\/?Date\((-?\d+)/i,sf=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,rb={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Hl(f){var g,w,x=f._i,T=nh.exec(x)||$i.exec(x),H,K,fe,Oe,Je=Xs.length,er=qt.length;if(T){for(q(f).iso=!0,g=0,w=Je;g<w;g++)if(Xs[g][1].exec(T[1])){K=Xs[g][0],H=Xs[g][2]!==!1;break}if(K==null){f._isValid=!1;return}if(T[3]){for(g=0,w=er;g<w;g++)if(qt[g][1].exec(T[3])){fe=(T[2]||" ")+qt[g][0];break}if(fe==null){f._isValid=!1;return}}if(!H&&fe!=null){f._isValid=!1;return}if(T[4])if(Ul.exec(T[4]))Oe="Z";else{f._isValid=!1;return}f._f=K+(fe||"")+(Oe||""),Vl(f)}else f._isValid=!1}function nb(f,g,w,x,T,H){var K=[ib(f),Jc.indexOf(g),parseInt(w,10),parseInt(x,10),parseInt(T,10)];return H&&K.push(parseInt(H,10)),K}function ib(f){var g=parseInt(f,10);return g<=49?2e3+g:g<=999?1900+g:g}function sb(f){return f.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function ih(f,g,w){if(f){var x=Kp.indexOf(f),T=new Date(g[0],g[1],g[2]).getDay();if(x!==T)return q(w).weekdayMismatch=!0,w._isValid=!1,!1}return!0}function Bl(f,g,w){if(f)return rb[f];if(g)return 0;var x=parseInt(w,10),T=x%100,H=(x-T)/100;return H*60+T}function fs(f){var g=sf.exec(sb(f._i)),w;if(g){if(w=nb(g[4],g[3],g[2],g[5],g[6],g[7]),!ih(g[1],w,f))return;f._a=w,f._tzm=Bl(g[8],g[9],g[10]),f._d=Ks.apply(null,f._a),f._d.setUTCMinutes(f._d.getUTCMinutes()-f._tzm),q(f).rfc2822=!0}else f._isValid=!1}function ob(f){var g=Ni.exec(f._i);if(g!==null){f._d=new Date(+g[1]);return}if(Hl(f),f._isValid===!1)delete f._isValid;else return;if(fs(f),f._isValid===!1)delete f._isValid;else return;f._strict?f._isValid=!1:e.createFromInputFallback(f)}e.createFromInputFallback=R("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(f){f._d=new Date(f._i+(f._useUTC?" UTC":""))});function ds(f,g,w){return f??g??w}function sh(f){var g=new Date(e.now());return f._useUTC?[g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()]:[g.getFullYear(),g.getMonth(),g.getDate()]}function ua(f){var g,w,x=[],T,H,K;if(!f._d){for(T=sh(f),f._w&&f._a[An]==null&&f._a[Qn]==null&&of(f),f._dayOfYear!=null&&(K=ds(f._a[cr],T[cr]),(f._dayOfYear>na(K)||f._dayOfYear===0)&&(q(f)._overflowDayOfYear=!0),w=Ks(K,0,f._dayOfYear),f._a[Qn]=w.getUTCMonth(),f._a[An]=w.getUTCDate()),g=0;g<3&&f._a[g]==null;++g)f._a[g]=x[g]=T[g];for(;g<7;g++)f._a[g]=x[g]=f._a[g]==null?g===2?1:0:f._a[g];f._a[Yt]===24&&f._a[Gr]===0&&f._a[Zn]===0&&f._a[us]===0&&(f._nextDay=!0,f._a[Yt]=0),f._d=(f._useUTC?Ks:Lv).apply(null,x),H=f._useUTC?f._d.getUTCDay():f._d.getDay(),f._tzm!=null&&f._d.setUTCMinutes(f._d.getUTCMinutes()-f._tzm),f._nextDay&&(f._a[Yt]=24),f._w&&typeof f._w.d<"u"&&f._w.d!==H&&(q(f).weekdayMismatch=!0)}}function of(f){var g,w,x,T,H,K,fe,Oe,Je;g=f._w,g.GG!=null||g.W!=null||g.E!=null?(H=1,K=4,w=ds(g.GG,f._a[cr],aa(vt(),1,4).year),x=ds(g.W,1),T=ds(g.E,1),(T<1||T>7)&&(Oe=!0)):(H=f._locale._week.dow,K=f._locale._week.doy,Je=aa(vt(),H,K),w=ds(g.gg,f._a[cr],Je.year),x=ds(g.w,Je.week),g.d!=null?(T=g.d,(T<0||T>6)&&(Oe=!0)):g.e!=null?(T=g.e+H,(g.e<0||g.e>6)&&(Oe=!0)):T=H),x<1||x>Tn(w,H,K)?q(f)._overflowWeeks=!0:Oe!=null?q(f)._overflowWeekday=!0:(fe=Fl(w,x,T,H,K),f._a[cr]=fe.year,f._dayOfYear=fe.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function Vl(f){if(f._f===e.ISO_8601){Hl(f);return}if(f._f===e.RFC_2822){fs(f);return}f._a=[],q(f).empty=!0;var g=""+f._i,w,x,T,H,K,fe=g.length,Oe=0,Je,er;for(T=Ar(f._f,f._locale).match(me)||[],er=T.length,w=0;w<er;w++)H=T[w],x=(g.match(Iv(H,f))||[])[0],x&&(K=g.substr(0,g.indexOf(x)),K.length>0&&q(f).unusedInput.push(K),g=g.slice(g.indexOf(x)+x.length),Oe+=x.length),Nt[H]?(x?q(f).empty=!1:q(f).unusedTokens.push(H),Wc(H,x,f)):f._strict&&!x&&q(f).unusedTokens.push(H);q(f).charsLeftOver=fe-Oe,g.length>0&&q(f).unusedInput.push(g),f._a[Yt]<=12&&q(f).bigHour===!0&&f._a[Yt]>0&&(q(f).bigHour=void 0),q(f).parsedDateParts=f._a.slice(0),q(f).meridiem=f._meridiem,f._a[Yt]=ab(f._locale,f._a[Yt],f._meridiem),Je=q(f).era,Je!==null&&(f._a[cr]=f._locale.erasConvertYear(Je,f._a[cr])),ua(f),nf(f)}function ab(f,g,w){var x;return w==null?g:f.meridiemHour!=null?f.meridiemHour(g,w):(f.isPM!=null&&(x=f.isPM(w),x&&g<12&&(g+=12),!x&&g===12&&(g=0)),g)}function af(f){var g,w,x,T,H,K,fe=!1,Oe=f._f.length;if(Oe===0){q(f).invalidFormat=!0,f._d=new Date(NaN);return}for(T=0;T<Oe;T++)H=0,K=!1,g=O({},f),f._useUTC!=null&&(g._useUTC=f._useUTC),g._f=f._f[T],Vl(g),v(g)&&(K=!0),H+=q(g).charsLeftOver,H+=q(g).unusedTokens.length*10,q(g).score=H,fe?H<x&&(x=H,w=g):(x==null||H<x||K)&&(x=H,w=g,K&&(fe=!0));m(f,w||g)}function lf(f){if(!f._d){var g=be(f._i),w=g.day===void 0?g.date:g.day;f._a=p([g.year,g.month,w,g.hour,g.minute,g.second,g.millisecond],function(x){return x&&parseInt(x,10)}),ua(f)}}function lb(f){var g=new M(nf(uf(f)));return g._nextDay&&(g.add(1,"d"),g._nextDay=void 0),g}function uf(f){var g=f._i,w=f._f;return f._locale=f._locale||ei(f._l),g===null||w===void 0&&g===""?_({nullInput:!0}):(typeof g=="string"&&(f._i=g=f._locale.preparse(g)),j(g)?new M(nf(g)):(d(g)?f._d=g:n(w)?af(f):w?Vl(f):Nr(f),v(f)||(f._d=null),f))}function Nr(f){var g=f._i;l(g)?f._d=new Date(e.now()):d(g)?f._d=new Date(g.valueOf()):typeof g=="string"?ob(f):n(g)?(f._a=p(g.slice(0),function(w){return parseInt(w,10)}),ua(f)):i(g)?lf(f):c(g)?f._d=new Date(g):e.createFromInputFallback(f)}function Wl(f,g,w,x,T){var H={};return(g===!0||g===!1)&&(x=g,g=void 0),(w===!0||w===!1)&&(x=w,w=void 0),(i(f)&&o(f)||n(f)&&f.length===0)&&(f=void 0),H._isAMomentObject=!0,H._useUTC=H._isUTC=T,H._l=w,H._i=f,H._f=g,H._strict=x,lb(H)}function vt(f,g,w,x){return Wl(f,g,w,x,!1)}var oh=R("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var f=vt.apply(null,arguments);return this.isValid()&&f.isValid()?f<this?this:f:_()}),ah=R("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var f=vt.apply(null,arguments);return this.isValid()&&f.isValid()?f>this?this:f:_()});function lh(f,g){var w,x;if(g.length===1&&n(g[0])&&(g=g[0]),!g.length)return vt();for(w=g[0],x=1;x<g.length;++x)(!g[x].isValid()||g[x][f](w))&&(w=g[x]);return w}function ub(){var f=[].slice.call(arguments,0);return lh("isBefore",f)}function cb(){var f=[].slice.call(arguments,0);return lh("isAfter",f)}var fb=function(){return Date.now?Date.now():+new Date},ca=["year","quarter","month","week","day","hour","minute","second","millisecond"];function eo(f){var g,w=!1,x,T=ca.length;for(g in f)if(s(f,g)&&!(Lt.call(ca,g)!==-1&&(f[g]==null||!isNaN(f[g]))))return!1;for(x=0;x<T;++x)if(f[ca[x]]){if(w)return!1;parseFloat(f[ca[x]])!==We(f[ca[x]])&&(w=!0)}return!0}function db(){return this._isValid}function pb(){return bt(NaN)}function to(f){var g=be(f),w=g.year||0,x=g.quarter||0,T=g.month||0,H=g.week||g.isoWeek||0,K=g.day||0,fe=g.hour||0,Oe=g.minute||0,Je=g.second||0,er=g.millisecond||0;this._isValid=eo(g),this._milliseconds=+er+Je*1e3+Oe*6e4+fe*1e3*60*60,this._days=+K+H*7,this._months=+T+x*3+w*12,this._data={},this._locale=ei(),this._bubble()}function fa(f){return f instanceof to}function $n(f){return f<0?Math.round(-1*f)*-1:Math.round(f)}function zl(f,g,w){var x=Math.min(f.length,g.length),T=Math.abs(f.length-g.length),H=0,K;for(K=0;K<x;K++)(w&&f[K]!==g[K]||!w&&We(f[K])!==We(g[K]))&&H++;return H+T}function uh(f,g){pe(f,0,0,function(){var w=this.utcOffset(),x="+";return w<0&&(w=-w,x="-"),x+Re(~~(w/60),2)+g+Re(~~w%60,2)})}uh("Z",":"),uh("ZZ",""),he("Z",Pl),he("ZZ",Pl),dt(["Z","ZZ"],function(f,g,w){w._useUTC=!0,w._tzm=cf(Pl,f)});var hb=/([\+\-]|\d\d)/gi;function cf(f,g){var w=(g||"").match(f),x,T,H;return w===null?null:(x=w[w.length-1]||[],T=(x+"").match(hb)||["-",0,0],H=+(T[1]*60)+We(T[2]),H===0?0:T[0]==="+"?H:-H)}function Mi(f,g){var w,x;return g._isUTC?(w=g.clone(),x=(j(f)||d(f)?f.valueOf():vt(f).valueOf())-w.valueOf(),w._d.setTime(w._d.valueOf()+x),e.updateOffset(w,!1),w):vt(f).local()}function Mr(f){return-Math.round(f._d.getTimezoneOffset())}e.updateOffset=function(){};function ch(f,g,w){var x=this._offset||0,T;if(!this.isValid())return f!=null?this:NaN;if(f!=null){if(typeof f=="string"){if(f=cf(Pl,f),f===null)return this}else Math.abs(f)<16&&!w&&(f=f*60);return!this._isUTC&&g&&(T=Mr(this)),this._offset=f,this._isUTC=!0,T!=null&&this.add(T,"m"),x!==f&&(!g||this._changeInProgress?da(this,bt(f-x,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?x:Mr(this)}function mb(f,g){return f!=null?(typeof f!="string"&&(f=-f),this.utcOffset(f,g),this):-this.utcOffset()}function gb(f){return this.utcOffset(0,f)}function yb(f){return this._isUTC&&(this.utcOffset(0,f),this._isUTC=!1,f&&this.subtract(Mr(this),"m")),this}function vb(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var f=cf(Bc,this._i);f!=null?this.utcOffset(f):this.utcOffset(0,!0)}return this}function bb(f){return this.isValid()?(f=f?vt(f).utcOffset():0,(this.utcOffset()-f)%60===0):!1}function Fi(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function W(){if(!l(this._isDSTShifted))return this._isDSTShifted;var f={},g;return O(f,this),f=uf(f),f._a?(g=f._isUTC?y(f._a):vt(f._a),this._isDSTShifted=this.isValid()&&zl(f._a,g.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Z(){return this.isValid()?!this._isUTC:!1}function Y(){return this.isValid()?this._isUTC:!1}function de(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Ie=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,ct=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function bt(f,g){var w=f,x=null,T,H,K;return fa(f)?w={ms:f._milliseconds,d:f._days,M:f._months}:c(f)||!isNaN(+f)?(w={},g?w[g]=+f:w.milliseconds=+f):(x=Ie.exec(f))?(T=x[1]==="-"?-1:1,w={y:0,d:We(x[An])*T,h:We(x[Yt])*T,m:We(x[Gr])*T,s:We(x[Zn])*T,ms:We($n(x[us]*1e3))*T}):(x=ct.exec(f))?(T=x[1]==="-"?-1:1,w={y:et(x[2],T),M:et(x[3],T),w:et(x[4],T),d:et(x[5],T),h:et(x[6],T),m:et(x[7],T),s:et(x[8],T)}):w==null?w={}:typeof w=="object"&&("from"in w||"to"in w)&&(K=Sb(vt(w.from),vt(w.to)),w={},w.ms=K.milliseconds,w.M=K.months),H=new to(w),fa(f)&&s(f,"_locale")&&(H._locale=f._locale),fa(f)&&s(f,"_isValid")&&(H._isValid=f._isValid),H}bt.fn=to.prototype,bt.invalid=pb;function et(f,g){var w=f&&parseFloat(f.replace(",","."));return(isNaN(w)?0:w)*g}function Jl(f,g){var w={};return w.months=g.month()-f.month()+(g.year()-f.year())*12,f.clone().add(w.months,"M").isAfter(g)&&--w.months,w.milliseconds=+g-+f.clone().add(w.months,"M"),w}function Sb(f,g){var w;return f.isValid()&&g.isValid()?(g=Mi(g,f),f.isBefore(g)?w=Jl(f,g):(w=Jl(g,f),w.milliseconds=-w.milliseconds,w.months=-w.months),w):{milliseconds:0,months:0}}function Fr(f,g){return function(w,x){var T,H;return x!==null&&!isNaN(+x)&&(F(g,"moment()."+g+"(period, number) is deprecated. Please use moment()."+g+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),H=w,w=x,x=H),T=bt(w,x),da(this,T,f),this}}function da(f,g,w,x){var T=g._milliseconds,H=$n(g._days),K=$n(g._months);f.isValid()&&(x=x??!0,K&&Yc(f,ia(f,"Month")+K*w),H&&sa(f,"Date",ia(f,"Date")+H*w),T&&f._d.setTime(f._d.valueOf()+T*w),x&&e.updateOffset(f,H||K))}var wb=Fr(1,"add"),ro=Fr(-1,"subtract");function pa(f){return typeof f=="string"||f instanceof String}function Gl(f){return j(f)||d(f)||pa(f)||c(f)||_b(f)||ht(f)||f===null||f===void 0}function ht(f){var g=i(f)&&!o(f),w=!1,x=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],T,H,K=x.length;for(T=0;T<K;T+=1)H=x[T],w=w||s(f,H);return g&&w}function _b(f){var g=n(f),w=!1;return g&&(w=f.filter(function(x){return!c(x)&&pa(f)}).length===0),g&&w}function fh(f){var g=i(f)&&!o(f),w=!1,x=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],T,H;for(T=0;T<x.length;T+=1)H=x[T],w=w||s(f,H);return g&&w}function Yl(f,g){var w=f.diff(g,"days",!0);return w<-6?"sameElse":w<-1?"lastWeek":w<0?"lastDay":w<1?"sameDay":w<2?"nextDay":w<7?"nextWeek":"sameElse"}function Rb(f,g){arguments.length===1&&(arguments[0]?Gl(arguments[0])?(f=arguments[0],g=void 0):fh(arguments[0])&&(g=arguments[0],f=void 0):(f=void 0,g=void 0));var w=f||vt(),x=Mi(w,this).startOf("day"),T=e.calendarFormat(this,x)||"sameElse",H=g&&(U(g[T])?g[T].call(this,w):g[T]);return this.format(H||this.localeData().calendar(T,this,vt(w)))}function Cb(){return new M(this)}function xb(f,g){var w=j(f)?f:vt(f);return this.isValid()&&w.isValid()?(g=ye(g)||"millisecond",g==="millisecond"?this.valueOf()>w.valueOf():w.valueOf()<this.clone().startOf(g).valueOf()):!1}function Kl(f,g){var w=j(f)?f:vt(f);return this.isValid()&&w.isValid()?(g=ye(g)||"millisecond",g==="millisecond"?this.valueOf()<w.valueOf():this.clone().endOf(g).valueOf()<w.valueOf()):!1}function Di(f,g,w,x){var T=j(f)?f:vt(f),H=j(g)?g:vt(g);return this.isValid()&&T.isValid()&&H.isValid()?(x=x||"()",(x[0]==="("?this.isAfter(T,w):!this.isBefore(T,w))&&(x[1]===")"?this.isBefore(H,w):!this.isAfter(H,w))):!1}function Ql(f,g){var w=j(f)?f:vt(f),x;return this.isValid()&&w.isValid()?(g=ye(g)||"millisecond",g==="millisecond"?this.valueOf()===w.valueOf():(x=w.valueOf(),this.clone().startOf(g).valueOf()<=x&&x<=this.clone().endOf(g).valueOf())):!1}function dh(f,g){return this.isSame(f,g)||this.isAfter(f,g)}function Zl(f,g){return this.isSame(f,g)||this.isBefore(f,g)}function ph(f,g,w){var x,T,H;if(!this.isValid())return NaN;if(x=Mi(f,this),!x.isValid())return NaN;switch(T=(x.utcOffset()-this.utcOffset())*6e4,g=ye(g),g){case"year":H=ha(this,x)/12;break;case"month":H=ha(this,x);break;case"quarter":H=ha(this,x)/3;break;case"second":H=(this-x)/1e3;break;case"minute":H=(this-x)/6e4;break;case"hour":H=(this-x)/36e5;break;case"day":H=(this-x-T)/864e5;break;case"week":H=(this-x-T)/6048e5;break;default:H=this-x}return w?H:Jr(H)}function ha(f,g){if(f.date()<g.date())return-ha(g,f);var w=(g.year()-f.year())*12+(g.month()-f.month()),x=f.clone().add(w,"months"),T,H;return g-x<0?(T=f.clone().add(w-1,"months"),H=(g-x)/(x-T)):(T=f.clone().add(w+1,"months"),H=(g-x)/(T-x)),-(w+H)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function Xl(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function hh(f){if(!this.isValid())return null;var g=f!==!0,w=g?this.clone().utc():this;return w.year()<0||w.year()>9999?ut(w,g?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):U(Date.prototype.toISOString)?g?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",ut(w,"Z")):ut(w,g?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function ma(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var f="moment",g="",w,x,T,H;return this.isLocal()||(f=this.utcOffset()===0?"moment.utc":"moment.parseZone",g="Z"),w="["+f+'("]',x=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",T="-MM-DD[T]HH:mm:ss.SSS",H=g+'[")]',this.format(w+x+T+H)}function ps(f){f||(f=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var g=ut(this,f);return this.localeData().postformat(g)}function eu(f,g){return this.isValid()&&(j(f)&&f.isValid()||vt(f).isValid())?bt({to:this,from:f}).locale(this.locale()).humanize(!g):this.localeData().invalidDate()}function Eb(f){return this.from(vt(),f)}function qb(f,g){return this.isValid()&&(j(f)&&f.isValid()||vt(f).isValid())?bt({from:this,to:f}).locale(this.locale()).humanize(!g):this.localeData().invalidDate()}function Ob(f){return this.to(vt(),f)}function ga(f){var g;return f===void 0?this._locale._abbr:(g=ei(f),g!=null&&(this._locale=g),this)}var ya=R("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(f){return f===void 0?this.localeData():this.locale(f)});function tu(){return this._locale}var ru=1e3,hs=60*ru,nu=60*hs,mh=(365*400+97)*24*nu;function Tt(f,g){return(f%g+g)%g}function sr(f,g,w){return f<100&&f>=0?new Date(f+400,g,w)-mh:new Date(f,g,w).valueOf()}function gh(f,g,w){return f<100&&f>=0?Date.UTC(f+400,g,w)-mh:Date.UTC(f,g,w)}function Ib(f){var g,w;if(f=ye(f),f===void 0||f==="millisecond"||!this.isValid())return this;switch(w=this._isUTC?gh:sr,f){case"year":g=w(this.year(),0,1);break;case"quarter":g=w(this.year(),this.month()-this.month()%3,1);break;case"month":g=w(this.year(),this.month(),1);break;case"week":g=w(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":g=w(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":g=w(this.year(),this.month(),this.date());break;case"hour":g=this._d.valueOf(),g-=Tt(g+(this._isUTC?0:this.utcOffset()*hs),nu);break;case"minute":g=this._d.valueOf(),g-=Tt(g,hs);break;case"second":g=this._d.valueOf(),g-=Tt(g,ru);break}return this._d.setTime(g),e.updateOffset(this,!0),this}function yh(f){var g,w;if(f=ye(f),f===void 0||f==="millisecond"||!this.isValid())return this;switch(w=this._isUTC?gh:sr,f){case"year":g=w(this.year()+1,0,1)-1;break;case"quarter":g=w(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":g=w(this.year(),this.month()+1,1)-1;break;case"week":g=w(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":g=w(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":g=w(this.year(),this.month(),this.date()+1)-1;break;case"hour":g=this._d.valueOf(),g+=nu-Tt(g+(this._isUTC?0:this.utcOffset()*hs),nu)-1;break;case"minute":g=this._d.valueOf(),g+=hs-Tt(g,hs)-1;break;case"second":g=this._d.valueOf(),g+=ru-Tt(g,ru)-1;break}return this._d.setTime(g),e.updateOffset(this,!0),this}function Pb(){return this._d.valueOf()-(this._offset||0)*6e4}function ff(){return Math.floor(this.valueOf()/1e3)}function va(){return new Date(this.valueOf())}function df(){var f=this;return[f.year(),f.month(),f.date(),f.hour(),f.minute(),f.second(),f.millisecond()]}function no(){var f=this;return{years:f.year(),months:f.month(),date:f.date(),hours:f.hours(),minutes:f.minutes(),seconds:f.seconds(),milliseconds:f.milliseconds()}}function ba(){return this.isValid()?this.toISOString():null}function Sa(){return v(this)}function iu(){return m({},q(this))}function io(){return q(this).overflow}function kb(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}pe("N",0,0,"eraAbbr"),pe("NN",0,0,"eraAbbr"),pe("NNN",0,0,"eraAbbr"),pe("NNNN",0,0,"eraName"),pe("NNNNN",0,0,"eraNarrow"),pe("y",["y",1],"yo","eraYear"),pe("y",["yy",2],0,"eraYear"),pe("y",["yyy",3],0,"eraYear"),pe("y",["yyyy",4],0,"eraYear"),he("N",Sr),he("NN",Sr),he("NNN",Sr),he("NNNN",ze),he("NNNNN",Mb),dt(["N","NN","NNN","NNNN","NNNNN"],function(f,g,w,x){var T=w._locale.erasParse(f,x,w._strict);T?q(w).era=T:q(w).invalidEra=f}),he("y",Ti),he("yy",Ti),he("yyy",Ti),he("yyyy",Ti),he("yo",Fb),dt(["y","yy","yyy","yyyy"],cr),dt(["yo"],function(f,g,w,x){var T;w._locale._eraYearOrdinalRegex&&(T=f.match(w._locale._eraYearOrdinalRegex)),w._locale.eraYearOrdinalParse?g[cr]=w._locale.eraYearOrdinalParse(f,T):g[cr]=parseInt(f,10)});function Ab(f,g){var w,x,T,H=this._eras||ei("en")._eras;for(w=0,x=H.length;w<x;++w)switch(typeof H[w].since==="string"&&(T=e(H[w].since).startOf("day"),H[w].since=T.valueOf()),typeof H[w].until){case"undefined":H[w].until=1/0;break;case"string":T=e(H[w].until).startOf("day").valueOf(),H[w].until=T.valueOf();break}return H}function Tb(f,g,w){var x,T,H=this.eras(),K,fe,Oe;for(f=f.toUpperCase(),x=0,T=H.length;x<T;++x)if(K=H[x].name.toUpperCase(),fe=H[x].abbr.toUpperCase(),Oe=H[x].narrow.toUpperCase(),w)switch(g){case"N":case"NN":case"NNN":if(fe===f)return H[x];break;case"NNNN":if(K===f)return H[x];break;case"NNNNN":if(Oe===f)return H[x];break}else if([K,fe,Oe].indexOf(f)>=0)return H[x]}function $b(f,g){var w=f.since<=f.until?1:-1;return g===void 0?e(f.since).year():e(f.since).year()+(g-f.offset)*w}function Nb(){var f,g,w,x=this.localeData().eras();for(f=0,g=x.length;f<g;++f)if(w=this.clone().startOf("day").valueOf(),x[f].since<=w&&w<=x[f].until||x[f].until<=w&&w<=x[f].since)return x[f].name;return""}function su(){var f,g,w,x=this.localeData().eras();for(f=0,g=x.length;f<g;++f)if(w=this.clone().startOf("day").valueOf(),x[f].since<=w&&w<=x[f].until||x[f].until<=w&&w<=x[f].since)return x[f].narrow;return""}function wa(){var f,g,w,x=this.localeData().eras();for(f=0,g=x.length;f<g;++f)if(w=this.clone().startOf("day").valueOf(),x[f].since<=w&&w<=x[f].until||x[f].until<=w&&w<=x[f].since)return x[f].abbr;return""}function vh(){var f,g,w,x,T=this.localeData().eras();for(f=0,g=T.length;f<g;++f)if(w=T[f].since<=T[f].until?1:-1,x=this.clone().startOf("day").valueOf(),T[f].since<=x&&x<=T[f].until||T[f].until<=x&&x<=T[f].since)return(this.year()-e(T[f].since).year())*w+T[f].offset;return this.year()}function $(f){return s(this,"_erasNameRegex")||pf.call(this),f?this._erasNameRegex:this._erasRegex}function so(f){return s(this,"_erasAbbrRegex")||pf.call(this),f?this._erasAbbrRegex:this._erasRegex}function ou(f){return s(this,"_erasNarrowRegex")||pf.call(this),f?this._erasNarrowRegex:this._erasRegex}function Sr(f,g){return g.erasAbbrRegex(f)}function ze(f,g){return g.erasNameRegex(f)}function Mb(f,g){return g.erasNarrowRegex(f)}function Fb(f,g){return g._eraYearOrdinalRegex||Ti}function pf(){var f=[],g=[],w=[],x=[],T,H,K,fe,Oe,Je=this.eras();for(T=0,H=Je.length;T<H;++T)K=kn(Je[T].name),fe=kn(Je[T].abbr),Oe=kn(Je[T].narrow),g.push(K),f.push(fe),w.push(Oe),x.push(K),x.push(fe),x.push(Oe);this._erasRegex=new RegExp("^("+x.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+g.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+f.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+w.join("|")+")","i")}pe(0,["gg",2],0,function(){return this.weekYear()%100}),pe(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Nn(f,g){pe(0,[f,f.length],0,g)}Nn("gggg","weekYear"),Nn("ggggg","weekYear"),Nn("GGGG","isoWeekYear"),Nn("GGGGG","isoWeekYear"),he("G",Gs),he("g",Gs),he("GG",qe,ge),he("gg",qe,ge),he("GGGG",ea,pn),he("gggg",ea,pn),he("GGGGG",Js,yt),he("ggggg",Js,yt),ra(["gggg","ggggg","GGGG","GGGGG"],function(f,g,w,x){g[x.substr(0,2)]=We(f)}),ra(["gg","GG"],function(f,g,w,x){g[x]=e.parseTwoDigitYear(f)});function Db(f){return bh.call(this,f,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function jb(f){return bh.call(this,f,this.isoWeek(),this.isoWeekday(),1,4)}function Lb(){return Tn(this.year(),1,4)}function Ub(){return Tn(this.isoWeekYear(),1,4)}function Hb(){var f=this.localeData()._week;return Tn(this.year(),f.dow,f.doy)}function ti(){var f=this.localeData()._week;return Tn(this.weekYear(),f.dow,f.doy)}function bh(f,g,w,x,T){var H;return f==null?aa(this,x,T).year:(H=Tn(f,x,T),g>H&&(g=H),Bb.call(this,f,g,w,x,T))}function Bb(f,g,w,x,T){var H=Fl(f,g,w,x,T),K=Ks(H.year,0,H.dayOfYear);return this.year(K.getUTCFullYear()),this.month(K.getUTCMonth()),this.date(K.getUTCDate()),this}pe("Q",0,"Qo","quarter"),he("Q",Te),dt("Q",function(f,g){g[Qn]=(We(f)-1)*3});function Vb(f){return f==null?Math.ceil((this.month()+1)/3):this.month((f-1)*3+this.month()%3)}pe("D",["DD",2],"Do","date"),he("D",qe,ls),he("DD",qe,ge),he("Do",function(f,g){return f?g._dayOfMonthOrdinalParse||g._ordinalParse:g._dayOfMonthOrdinalParseLenient}),dt(["D","DD"],An),dt("Do",function(f,g){g[An]=We(f.match(qe)[0])});var Sh=Ys("Date",!0);pe("DDD",["DDDD",3],"DDDo","dayOfYear"),he("DDD",zs),he("DDDD",In),dt(["DDD","DDDD"],function(f,g,w){w._dayOfYear=We(f)});function Wb(f){var g=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return f==null?g:this.add(f-g,"d")}pe("m",["mm",2],0,"minute"),he("m",qe,kl),he("mm",qe,ge),dt(["m","mm"],Gr);var ri=Ys("Minutes",!1);pe("s",["ss",2],0,"second"),he("s",qe,kl),he("ss",qe,ge),dt(["s","ss"],Zn);var zb=Ys("Seconds",!1);pe("S",0,0,function(){return~~(this.millisecond()/100)}),pe(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),pe(0,["SSS",3],0,"millisecond"),pe(0,["SSSS",4],0,function(){return this.millisecond()*10}),pe(0,["SSSSS",5],0,function(){return this.millisecond()*100}),pe(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),pe(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),pe(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),pe(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),he("S",zs,Te),he("SS",zs,ge),he("SSS",zs,In);var ji,wh;for(ji="SSSS";ji.length<=9;ji+="S")he(ji,Ti);function Jb(f,g){g[us]=We(("0."+f)*1e3)}for(ji="S";ji.length<=9;ji+="S")dt(ji,Jb);wh=Ys("Milliseconds",!1),pe("z",0,0,"zoneAbbr"),pe("zz",0,0,"zoneName");function Gb(){return this._isUTC?"UTC":""}function ms(){return this._isUTC?"Coordinated Universal Time":""}var ie=M.prototype;ie.add=wb,ie.calendar=Rb,ie.clone=Cb,ie.diff=ph,ie.endOf=yh,ie.format=ps,ie.from=eu,ie.fromNow=Eb,ie.to=qb,ie.toNow=Ob,ie.get=Tv,ie.invalidAt=io,ie.isAfter=xb,ie.isBefore=Kl,ie.isBetween=Di,ie.isSame=Ql,ie.isSameOrAfter=dh,ie.isSameOrBefore=Zl,ie.isValid=Sa,ie.lang=ya,ie.locale=ga,ie.localeData=tu,ie.max=ah,ie.min=oh,ie.parsingFlags=iu,ie.set=$l,ie.startOf=Ib,ie.subtract=ro,ie.toArray=df,ie.toObject=no,ie.toDate=va,ie.toISOString=hh,ie.inspect=ma,typeof Symbol<"u"&&Symbol.for!=null&&(ie[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),ie.toJSON=ba,ie.toString=Xl,ie.unix=ff,ie.valueOf=Pb,ie.creationData=kb,ie.eraName=Nb,ie.eraNarrow=su,ie.eraAbbr=wa,ie.eraYear=vh,ie.year=Lp,ie.isLeapYear=Av,ie.weekYear=Db,ie.isoWeekYear=jb,ie.quarter=ie.quarters=Vb,ie.month=Nl,ie.daysInMonth=jv,ie.week=ie.weeks=zp,ie.isoWeek=ie.isoWeeks=Uv,ie.weeksInYear=Hb,ie.weeksInWeekYear=ti,ie.isoWeeksInYear=Lb,ie.isoWeeksInISOWeekYear=Ub,ie.date=Sh,ie.day=ie.days=Yv,ie.weekday=Kv,ie.isoWeekday=Qv,ie.dayOfYear=Wb,ie.hour=ie.hours=tb,ie.minute=ie.minutes=ri,ie.second=ie.seconds=zb,ie.millisecond=ie.milliseconds=wh,ie.utcOffset=ch,ie.utc=gb,ie.local=yb,ie.parseZone=vb,ie.hasAlignedHourOffset=bb,ie.isDST=Fi,ie.isLocal=Z,ie.isUtcOffset=Y,ie.isUtc=de,ie.isUTC=de,ie.zoneAbbr=Gb,ie.zoneName=ms,ie.dates=R("dates accessor is deprecated. Use date instead.",Sh),ie.months=R("months accessor is deprecated. Use month instead",Nl),ie.years=R("years accessor is deprecated. Use year instead",Lp),ie.zone=R("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",mb),ie.isDSTShifted=R("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",W);function Yb(f){return vt(f*1e3)}function hn(){return vt.apply(null,arguments).parseZone()}function _h(f){return f}var it=Q.prototype;it.calendar=Ve,it.longDateFormat=xt,it.invalidDate=zr,it.ordinal=Ai,it.preparse=_h,it.postformat=_h,it.relativeTime=te,it.pastFuture=ne,it.set=D,it.eras=Ab,it.erasParse=Tb,it.erasConvertYear=$b,it.erasAbbrRegex=so,it.erasNameRegex=$,it.erasNarrowRegex=ou,it.months=Fv,it.monthsShort=Dv,it.monthsParse=Bp,it.monthsRegex=Ml,it.monthsShortRegex=Vp,it.week=Qc,it.firstDayOfYear=Wp,it.firstDayOfWeek=Qs,it.weekdays=Wv,it.weekdaysMin=Jv,it.weekdaysShort=zv,it.weekdaysParse=Gv,it.weekdaysRegex=Zv,it.weekdaysShortRegex=Pt,it.weekdaysMinRegex=Et,it.isPM=eb,it.meridiem=Xt;function au(f,g,w,x){var T=ei(),H=y().set(x,g);return T[w](H,f)}function Rh(f,g,w){if(c(f)&&(g=f,f=void 0),f=f||"",g!=null)return au(f,g,w,"month");var x,T=[];for(x=0;x<12;x++)T[x]=au(f,x,w,"month");return T}function hf(f,g,w,x){typeof f=="boolean"?(c(g)&&(w=g,g=void 0),g=g||""):(g=f,w=g,f=!1,c(g)&&(w=g,g=void 0),g=g||"");var T=ei(),H=f?T._week.dow:0,K,fe=[];if(w!=null)return au(g,(w+H)%7,x,"day");for(K=0;K<7;K++)fe[K]=au(g,(K+H)%7,x,"day");return fe}function Ch(f,g){return Rh(f,g,"months")}function xh(f,g){return Rh(f,g,"monthsShort")}function Kb(f,g,w){return hf(f,g,w,"weekdays")}function Qb(f,g,w){return hf(f,g,w,"weekdaysShort")}function mf(f,g,w){return hf(f,g,w,"weekdaysMin")}Xn("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(f){var g=f%10,w=We(f%100/10)===1?"th":g===1?"st":g===2?"nd":g===3?"rd":"th";return f+w}}),e.lang=R("moment.lang is deprecated. Use moment.locale instead.",Xn),e.langData=R("moment.langData is deprecated. Use moment.localeData instead.",ei);var Dr=Math.abs;function lu(){var f=this._data;return this._milliseconds=Dr(this._milliseconds),this._days=Dr(this._days),this._months=Dr(this._months),f.milliseconds=Dr(f.milliseconds),f.seconds=Dr(f.seconds),f.minutes=Dr(f.minutes),f.hours=Dr(f.hours),f.months=Dr(f.months),f.years=Dr(f.years),this}function Eh(f,g,w,x){var T=bt(g,w);return f._milliseconds+=x*T._milliseconds,f._days+=x*T._days,f._months+=x*T._months,f._bubble()}function qh(f,g){return Eh(this,f,g,1)}function Zb(f,g){return Eh(this,f,g,-1)}function mn(f){return f<0?Math.floor(f):Math.ceil(f)}function gf(){var f=this._milliseconds,g=this._days,w=this._months,x=this._data,T,H,K,fe,Oe;return f>=0&&g>=0&&w>=0||f<=0&&g<=0&&w<=0||(f+=mn(wr(w)+g)*864e5,g=0,w=0),x.milliseconds=f%1e3,T=Jr(f/1e3),x.seconds=T%60,H=Jr(T/60),x.minutes=H%60,K=Jr(H/60),x.hours=K%24,g+=Jr(K/24),Oe=Jr(Li(g)),w+=Oe,g-=mn(wr(Oe)),fe=Jr(w/12),w%=12,x.days=g,x.months=w,x.years=fe,this}function Li(f){return f*4800/146097}function wr(f){return f*146097/4800}function Xb(f){if(!this.isValid())return NaN;var g,w,x=this._milliseconds;if(f=ye(f),f==="month"||f==="quarter"||f==="year")switch(g=this._days+x/864e5,w=this._months+Li(g),f){case"month":return w;case"quarter":return w/3;case"year":return w/12}else switch(g=this._days+Math.round(wr(this._months)),f){case"week":return g/7+x/6048e5;case"day":return g+x/864e5;case"hour":return g*24+x/36e5;case"minute":return g*1440+x/6e4;case"second":return g*86400+x/1e3;case"millisecond":return Math.floor(g*864e5)+x;default:throw new Error("Unknown unit "+f)}}function Mn(f){return function(){return this.as(f)}}var yf=Mn("ms"),_a=Mn("s"),Ui=Mn("m"),Oh=Mn("h"),eS=Mn("d"),uu=Mn("w"),tS=Mn("M"),Ih=Mn("Q"),or=Mn("y"),vf=yf;function Ph(){return bt(this)}function Fn(f){return f=ye(f),this.isValid()?this[f+"s"]():NaN}function ni(f){return function(){return this.isValid()?this._data[f]:NaN}}var cu=ni("milliseconds"),gs=ni("seconds"),kh=ni("minutes"),dr=ni("hours"),bf=ni("days"),rS=ni("months"),nS=ni("years");function iS(){return Jr(this.days()/7)}var gn=Math.round,oo={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Ra(f,g,w,x,T){return T.relativeTime(g||1,!!w,f,x)}function Ah(f,g,w,x){var T=bt(f).abs(),H=gn(T.as("s")),K=gn(T.as("m")),fe=gn(T.as("h")),Oe=gn(T.as("d")),Je=gn(T.as("M")),er=gn(T.as("w")),ii=gn(T.as("y")),si=H<=w.ss&&["s",H]||H<w.s&&["ss",H]||K<=1&&["m"]||K<w.m&&["mm",K]||fe<=1&&["h"]||fe<w.h&&["hh",fe]||Oe<=1&&["d"]||Oe<w.d&&["dd",Oe];return w.w!=null&&(si=si||er<=1&&["w"]||er<w.w&&["ww",er]),si=si||Je<=1&&["M"]||Je<w.M&&["MM",Je]||ii<=1&&["y"]||["yy",ii],si[2]=g,si[3]=+f>0,si[4]=x,Ra.apply(null,si)}function sS(f){return f===void 0?gn:typeof f=="function"?(gn=f,!0):!1}function oS(f,g){return oo[f]===void 0?!1:g===void 0?oo[f]:(oo[f]=g,f==="s"&&(oo.ss=g-1),!0)}function Ca(f,g){if(!this.isValid())return this.localeData().invalidDate();var w=!1,x=oo,T,H;return typeof f=="object"&&(g=f,f=!1),typeof f=="boolean"&&(w=f),typeof g=="object"&&(x=Object.assign({},oo,g),g.s!=null&&g.ss==null&&(x.ss=g.s-1)),T=this.localeData(),H=Ah(this,!w,x,T),w&&(H=T.pastFuture(+this,H)),T.postformat(H)}var Sf=Math.abs;function ao(f){return(f>0)-(f<0)||+f}function lo(){if(!this.isValid())return this.localeData().invalidDate();var f=Sf(this._milliseconds)/1e3,g=Sf(this._days),w=Sf(this._months),x,T,H,K,fe=this.asSeconds(),Oe,Je,er,ii;return fe?(x=Jr(f/60),T=Jr(x/60),f%=60,x%=60,H=Jr(w/12),w%=12,K=f?f.toFixed(3).replace(/\.?0+$/,""):"",Oe=fe<0?"-":"",Je=ao(this._months)!==ao(fe)?"-":"",er=ao(this._days)!==ao(fe)?"-":"",ii=ao(this._milliseconds)!==ao(fe)?"-":"",Oe+"P"+(H?Je+H+"Y":"")+(w?Je+w+"M":"")+(g?er+g+"D":"")+(T||x||f?"T":"")+(T?ii+T+"H":"")+(x?ii+x+"M":"")+(f?ii+K+"S":"")):"P0D"}var Qe=to.prototype;Qe.isValid=db,Qe.abs=lu,Qe.add=qh,Qe.subtract=Zb,Qe.as=Xb,Qe.asMilliseconds=yf,Qe.asSeconds=_a,Qe.asMinutes=Ui,Qe.asHours=Oh,Qe.asDays=eS,Qe.asWeeks=uu,Qe.asMonths=tS,Qe.asQuarters=Ih,Qe.asYears=or,Qe.valueOf=vf,Qe._bubble=gf,Qe.clone=Ph,Qe.get=Fn,Qe.milliseconds=cu,Qe.seconds=gs,Qe.minutes=kh,Qe.hours=dr,Qe.days=bf,Qe.weeks=iS,Qe.months=rS,Qe.years=nS,Qe.humanize=Ca,Qe.toISOString=lo,Qe.toString=lo,Qe.toJSON=lo,Qe.locale=ga,Qe.localeData=tu,Qe.toIsoString=R("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",lo),Qe.lang=ya,pe("X",0,0,"unix"),pe("x",0,0,"valueOf"),he("x",Gs),he("X",Ov),dt("X",function(f,g,w){w._d=new Date(parseFloat(f)*1e3)}),dt("x",function(f,g,w){w._d=new Date(We(f))});return e.version="2.30.1",r(vt),e.fn=ie,e.min=ub,e.max=cb,e.now=fb,e.utc=y,e.unix=Yb,e.months=Ch,e.isDate=d,e.locale=Xn,e.invalid=_,e.duration=bt,e.isMoment=j,e.weekdays=Kb,e.parseZone=hn,e.localeData=ei,e.isDuration=fa,e.monthsShort=xh,e.weekdaysMin=mf,e.defineLocale=Ll,e.updateLocale=Tr,e.locales=$r,e.weekdaysShort=Qb,e.normalizeUnits=ye,e.relativeTimeRounding=sS,e.relativeTimeThreshold=oS,e.calendarFormat=Yl,e.prototype=ie,e.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},e}))});var Nq=V(($q,dm)=>{(function(t,e){typeof define=="function"&&define.amd?define([],e):typeof dm<"u"&&dm.exports?dm.exports=e():t.tv4=e()})($q,function(){Object.keys||(Object.keys=(function(){var I=Object.prototype.hasOwnProperty,R=!{toString:null}.propertyIsEnumerable("toString"),A=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],F=A.length;return function(U){if(typeof U!="object"&&typeof U!="function"||U===null)throw new TypeError("Object.keys called on non-object");var D=[];for(var J in U)I.call(U,J)&&D.push(J);if(R)for(var Q=0;Q<F;Q++)I.call(U,A[Q])&&D.push(A[Q]);return D}})()),Object.create||(Object.create=(function(){function I(){}return function(R){if(arguments.length!==1)throw new Error("Object.create implementation only accepts one parameter.");return I.prototype=R,new I}})()),Array.isArray||(Array.isArray=function(I){return Object.prototype.toString.call(I)==="[object Array]"}),Array.prototype.indexOf||(Array.prototype.indexOf=function(I){if(this===null)throw new TypeError;var R=Object(this),A=R.length>>>0;if(A===0)return-1;var F=0;if(arguments.length>1&&(F=Number(arguments[1]),F!==F?F=0:F!==0&&F!==1/0&&F!==-1/0&&(F=(F>0||-1)*Math.floor(Math.abs(F)))),F>=A)return-1;for(var U=F>=0?F:Math.max(A-Math.abs(F),0);U<A;U++)if(U in R&&R[U]===I)return U;return-1}),Object.isFrozen||(Object.isFrozen=function(I){for(var R="tv4_test_frozen_key";I.hasOwnProperty(R);)R+=Math.random();try{return I[R]=!0,delete I[R],!1}catch{return!0}});var t={"+":!0,"#":!0,".":!0,"/":!0,";":!0,"?":!0,"&":!0},e={"*":!0};function r(I){return encodeURI(I).replace(/%25[0-9][0-9]/g,function(R){return"%"+R.substring(3)})}function n(I){var R="";t[I.charAt(0)]&&(R=I.charAt(0),I=I.substring(1));var A="",F="",U=!0,D=!1,J=!1;R==="+"?U=!1:R==="."?(F=".",A="."):R==="/"?(F="/",A="/"):R==="#"?(F="#",U=!1):R===";"?(F=";",A=";",D=!0,J=!0):R==="?"?(F="?",A="&",D=!0):R==="&"&&(F="&",A="&",D=!0);for(var Q=[],se=I.split(","),ce=[],Ve={},Re=0;Re<se.length;Re++){var me=se[Re],Ae=null;if(me.indexOf(":")!==-1){var gt=me.split(":");me=gt[0],Ae=parseInt(gt[1],10)}for(var Nt={};e[me.charAt(me.length-1)];)Nt[me.charAt(me.length-1)]=!0,me=me.substring(0,me.length-1);var pe={truncate:Ae,name:me,suffices:Nt};ce.push(pe),Ve[me]=pe,Q.push(me)}var Gt=function(kr){for(var ut="",Ar=0,br=0;br<ce.length;br++){var xt=ce[br],wt=kr(xt.name);if(wt==null||Array.isArray(wt)&&wt.length===0||typeof wt=="object"&&Object.keys(wt).length===0){Ar++;continue}if(br===Ar?ut+=F:ut+=A||",",Array.isArray(wt)){D&&(ut+=xt.name+"=");for(var zr=0;zr<wt.length;zr++)zr>0&&(ut+=xt.suffices["*"]&&A||",",xt.suffices["*"]&&D&&(ut+=xt.name+"=")),ut+=U?encodeURIComponent(wt[zr]).replace(/!/g,"%21"):r(wt[zr])}else if(typeof wt=="object"){D&&!xt.suffices["*"]&&(ut+=xt.name+"=");var Ws=!0;for(var At in wt)Ws||(ut+=xt.suffices["*"]&&A||","),Ws=!1,ut+=U?encodeURIComponent(At).replace(/!/g,"%21"):r(At),ut+=xt.suffices["*"]?"=":",",ut+=U?encodeURIComponent(wt[At]).replace(/!/g,"%21"):r(wt[At])}else D&&(ut+=xt.name,(!J||wt!=="")&&(ut+="=")),xt.truncate!=null&&(wt=wt.substring(0,xt.truncate)),ut+=U?encodeURIComponent(wt).replace(/!/g,"%21"):r(wt)}return ut};return Gt.varNames=Q,{prefix:F,substitution:Gt}}function i(I){if(!(this instanceof i))return new i(I);for(var R=I.split("{"),A=[R.shift()],F=[],U=[],D=[];R.length>0;){var J=R.shift(),Q=J.split("}")[0],se=J.substring(Q.length+1),ce=n(Q);U.push(ce.substitution),F.push(ce.prefix),A.push(se),D=D.concat(ce.substitution.varNames)}this.fill=function(Ve){for(var Re=A[0],me=0;me<U.length;me++){var Ae=U[me];Re+=Ae(Ve),Re+=A[me+1]}return Re},this.varNames=D,this.template=I}i.prototype={toString:function(){return this.template},fillFromObject:function(I){return this.fill(function(R){return I[R]})}};var s=function(R,A,F,U,D){if(this.missing=[],this.missingMap={},this.formatValidators=R?Object.create(R.formatValidators):{},this.schemas=R?Object.create(R.schemas):{},this.collectMultiple=A,this.errors=[],this.handleError=A?this.collectError:this.returnError,U&&(this.checkRecursive=!0,this.scanned=[],this.scannedFrozen=[],this.scannedFrozenSchemas=[],this.scannedFrozenValidationErrors=[],this.validatedSchemasKey="tv4_validation_id",this.validationErrorsKey="tv4_validation_errors_id"),D&&(this.trackUnknownProperties=!0,this.knownPropertyPaths={},this.unknownPropertyPaths={}),this.errorReporter=F||b("en"),typeof this.errorReporter=="string")throw new Error("debug");if(this.definedKeywords={},R)for(var J in R.definedKeywords)this.definedKeywords[J]=R.definedKeywords[J].slice(0)};s.prototype.defineKeyword=function(I,R){this.definedKeywords[I]=this.definedKeywords[I]||[],this.definedKeywords[I].push(R)},s.prototype.createError=function(I,R,A,F,U,D,J){var Q=new E(I,R,A,F,U);return Q.message=this.errorReporter(Q,D,J),Q},s.prototype.returnError=function(I){return I},s.prototype.collectError=function(I){return I&&this.errors.push(I),null},s.prototype.prefixErrors=function(I,R,A){for(var F=I;F<this.errors.length;F++)this.errors[F]=this.errors[F].prefixWith(R,A);return this},s.prototype.banUnknownProperties=function(I,R){for(var A in this.unknownPropertyPaths){var F=this.createError(q.UNKNOWN_PROPERTY,{path:A},A,"",null,I,R),U=this.handleError(F);if(U)return U}return null},s.prototype.addFormat=function(I,R){if(typeof I=="object"){for(var A in I)this.addFormat(A,I[A]);return this}this.formatValidators[I]=R},s.prototype.resolveRefs=function(I,R){if(I.$ref!==void 0){if(R=R||{},R[I.$ref])return this.createError(q.CIRCULAR_REFERENCE,{urls:Object.keys(R).join(", ")},"","",null,void 0,I);R[I.$ref]=!0,I=this.getSchema(I.$ref,R)}return I},s.prototype.getSchema=function(I,R){var A;if(this.schemas[I]!==void 0)return A=this.schemas[I],this.resolveRefs(A,R);var F=I,U="";if(I.indexOf("#")!==-1&&(U=I.substring(I.indexOf("#")+1),F=I.substring(0,I.indexOf("#"))),typeof this.schemas[F]=="object"){A=this.schemas[F];var D=decodeURIComponent(U);if(D==="")return this.resolveRefs(A,R);if(D.charAt(0)!=="/")return;for(var J=D.split("/").slice(1),Q=0;Q<J.length;Q++){var se=J[Q].replace(/~1/g,"/").replace(/~0/g,"~");if(A[se]===void 0){A=void 0;break}A=A[se]}if(A!==void 0)return this.resolveRefs(A,R)}this.missing[F]===void 0&&(this.missing.push(F),this.missing[F]=F,this.missingMap[F]=F)},s.prototype.searchSchemas=function(I,R){if(Array.isArray(I))for(var A=0;A<I.length;A++)this.searchSchemas(I[A],R);else if(I&&typeof I=="object"){typeof I.id=="string"&&k(R,I.id)&&this.schemas[I.id]===void 0&&(this.schemas[I.id]=I);for(var F in I)if(F!=="enum"){if(typeof I[F]=="object")this.searchSchemas(I[F],R);else if(F==="$ref"){var U=m(I[F]);U&&this.schemas[U]===void 0&&this.missingMap[U]===void 0&&(this.missingMap[U]=U)}}}},s.prototype.addSchema=function(I,R){if(typeof I!="string"||typeof R>"u")if(typeof I=="object"&&typeof I.id=="string")R=I,I=R.id;else return;I===m(I)+"#"&&(I=m(I)),this.schemas[I]=R,delete this.missingMap[I],y(R,I),this.searchSchemas(R,I)},s.prototype.getSchemaMap=function(){var I={};for(var R in this.schemas)I[R]=this.schemas[R];return I},s.prototype.getSchemaUris=function(I){var R=[];for(var A in this.schemas)(!I||I.test(A))&&R.push(A);return R},s.prototype.getMissingUris=function(I){var R=[];for(var A in this.missingMap)(!I||I.test(A))&&R.push(A);return R},s.prototype.dropSchemas=function(){this.schemas={},this.reset()},s.prototype.reset=function(){this.missing=[],this.missingMap={},this.errors=[]},s.prototype.validateAll=function(I,R,A,F,U){var D;if(R=this.resolveRefs(R),R){if(R instanceof E)return this.errors.push(R),R}else return null;var J=this.errors.length,Q,se=null,ce=null;if(this.checkRecursive&&I&&typeof I=="object"){if(D=!this.scanned.length,I[this.validatedSchemasKey]){var Ve=I[this.validatedSchemasKey].indexOf(R);if(Ve!==-1)return this.errors=this.errors.concat(I[this.validationErrorsKey][Ve]),null}if(Object.isFrozen(I)&&(Q=this.scannedFrozen.indexOf(I),Q!==-1)){var Re=this.scannedFrozenSchemas[Q].indexOf(R);if(Re!==-1)return this.errors=this.errors.concat(this.scannedFrozenValidationErrors[Q][Re]),null}if(this.scanned.push(I),Object.isFrozen(I))Q===-1&&(Q=this.scannedFrozen.length,this.scannedFrozen.push(I),this.scannedFrozenSchemas.push([])),se=this.scannedFrozenSchemas[Q].length,this.scannedFrozenSchemas[Q][se]=R,this.scannedFrozenValidationErrors[Q][se]=[];else{if(!I[this.validatedSchemasKey])try{Object.defineProperty(I,this.validatedSchemasKey,{value:[],configurable:!0}),Object.defineProperty(I,this.validationErrorsKey,{value:[],configurable:!0})}catch{I[this.validatedSchemasKey]=[],I[this.validationErrorsKey]=[]}ce=I[this.validatedSchemasKey].length,I[this.validatedSchemasKey][ce]=R,I[this.validationErrorsKey][ce]=[]}}var me=this.errors.length,Ae=this.validateBasic(I,R,U)||this.validateNumeric(I,R,U)||this.validateString(I,R,U)||this.validateArray(I,R,U)||this.validateObject(I,R,U)||this.validateCombinations(I,R,U)||this.validateHypermedia(I,R,U)||this.validateFormat(I,R,U)||this.validateDefinedKeywords(I,R,U)||null;if(D){for(;this.scanned.length;){var gt=this.scanned.pop();delete gt[this.validatedSchemasKey]}this.scannedFrozen=[],this.scannedFrozenSchemas=[]}if(Ae||me!==this.errors.length)for(;A&&A.length||F&&F.length;){var Nt=A&&A.length?""+A.pop():null,pe=F&&F.length?""+F.pop():null;Ae&&(Ae=Ae.prefixWith(Nt,pe)),this.prefixErrors(me,Nt,pe)}return se!==null?this.scannedFrozenValidationErrors[Q][se]=this.errors.slice(J):ce!==null&&(I[this.validationErrorsKey][ce]=this.errors.slice(J)),this.handleError(Ae)},s.prototype.validateFormat=function(I,R){if(typeof R.format!="string"||!this.formatValidators[R.format])return null;var A=this.formatValidators[R.format].call(null,I,R);return typeof A=="string"||typeof A=="number"?this.createError(q.FORMAT_CUSTOM,{message:A},"","/format",null,I,R):A&&typeof A=="object"?this.createError(q.FORMAT_CUSTOM,{message:A.message||"?"},A.dataPath||"",A.schemaPath||"/format",null,I,R):null},s.prototype.validateDefinedKeywords=function(I,R,A){for(var F in this.definedKeywords)if(!(typeof R[F]>"u"))for(var U=this.definedKeywords[F],D=0;D<U.length;D++){var J=U[D],Q=J(I,R[F],R,A);if(typeof Q=="string"||typeof Q=="number")return this.createError(q.KEYWORD_CUSTOM,{key:F,message:Q},"","",null,I,R).prefixWith(null,F);if(Q&&typeof Q=="object"){var se=Q.code;if(typeof se=="string"){if(!q[se])throw new Error("Undefined error code (use defineError): "+se);se=q[se]}else typeof se!="number"&&(se=q.KEYWORD_CUSTOM);var ce=typeof Q.message=="object"?Q.message:{key:F,message:Q.message||"?"},Ve=Q.schemaPath||"/"+F.replace(/~/g,"~0").replace(/\//g,"~1");return this.createError(se,ce,Q.dataPath||null,Ve,null,I,R)}}return null};function o(I,R){if(I===R)return!0;if(I&&R&&typeof I=="object"&&typeof R=="object"){if(Array.isArray(I)!==Array.isArray(R))return!1;if(Array.isArray(I)){if(I.length!==R.length)return!1;for(var A=0;A<I.length;A++)if(!o(I[A],R[A]))return!1}else{var F;for(F in I)if(R[F]===void 0&&I[F]!==void 0)return!1;for(F in R)if(I[F]===void 0&&R[F]!==void 0)return!1;for(F in I)if(!o(I[F],R[F]))return!1}return!0}return!1}s.prototype.validateBasic=function(R,A,F){var U;return(U=this.validateType(R,A,F))||(U=this.validateEnum(R,A,F))?U.prefixWith(null,"type"):null},s.prototype.validateType=function(R,A){if(A.type===void 0)return null;var F=typeof R;R===null?F="null":Array.isArray(R)&&(F="array");var U=A.type;Array.isArray(U)||(U=[U]);for(var D=0;D<U.length;D++){var J=U[D];if(J===F||J==="integer"&&F==="number"&&R%1===0)return null}return this.createError(q.INVALID_TYPE,{type:F,expected:U.join("/")},"","",null,R,A)},s.prototype.validateEnum=function(R,A){if(A.enum===void 0)return null;for(var F=0;F<A.enum.length;F++){var U=A.enum[F];if(o(R,U))return null}return this.createError(q.ENUM_MISMATCH,{value:typeof JSON<"u"?JSON.stringify(R):R},"","",null,R,A)},s.prototype.validateNumeric=function(R,A,F){return this.validateMultipleOf(R,A,F)||this.validateMinMax(R,A,F)||this.validateNaN(R,A,F)||null};var l=Math.pow(2,-51),c=1-l;s.prototype.validateMultipleOf=function(R,A){var F=A.multipleOf||A.divisibleBy;if(F===void 0)return null;if(typeof R=="number"){var U=R/F%1;if(U>=l&&U<c)return this.createError(q.NUMBER_MULTIPLE_OF,{value:R,multipleOf:F},"","",null,R,A)}return null},s.prototype.validateMinMax=function(R,A){if(typeof R!="number")return null;if(A.minimum!==void 0){if(R<A.minimum)return this.createError(q.NUMBER_MINIMUM,{value:R,minimum:A.minimum},"","/minimum",null,R,A);if(A.exclusiveMinimum&&R===A.minimum)return this.createError(q.NUMBER_MINIMUM_EXCLUSIVE,{value:R,minimum:A.minimum},"","/exclusiveMinimum",null,R,A)}if(A.maximum!==void 0){if(R>A.maximum)return this.createError(q.NUMBER_MAXIMUM,{value:R,maximum:A.maximum},"","/maximum",null,R,A);if(A.exclusiveMaximum&&R===A.maximum)return this.createError(q.NUMBER_MAXIMUM_EXCLUSIVE,{value:R,maximum:A.maximum},"","/exclusiveMaximum",null,R,A)}return null},s.prototype.validateNaN=function(R,A){return typeof R!="number"?null:isNaN(R)===!0||R===1/0||R===-1/0?this.createError(q.NUMBER_NOT_A_NUMBER,{value:R},"","/type",null,R,A):null},s.prototype.validateString=function(R,A,F){return this.validateStringLength(R,A,F)||this.validateStringPattern(R,A,F)||null},s.prototype.validateStringLength=function(R,A){return typeof R!="string"?null:A.minLength!==void 0&&R.length<A.minLength?this.createError(q.STRING_LENGTH_SHORT,{length:R.length,minimum:A.minLength},"","/minLength",null,R,A):A.maxLength!==void 0&&R.length>A.maxLength?this.createError(q.STRING_LENGTH_LONG,{length:R.length,maximum:A.maxLength},"","/maxLength",null,R,A):null},s.prototype.validateStringPattern=function(R,A){if(typeof R!="string"||typeof A.pattern!="string"&&!(A.pattern instanceof RegExp))return null;var F;if(A.pattern instanceof RegExp)F=A.pattern;else{var U,D="",J=A.pattern.match(/^\/(.+)\/([img]*)$/);J?(U=J[1],D=J[2]):U=A.pattern,F=new RegExp(U,D)}return F.test(R)?null:this.createError(q.STRING_PATTERN,{pattern:A.pattern},"","/pattern",null,R,A)},s.prototype.validateArray=function(R,A,F){return Array.isArray(R)&&(this.validateArrayLength(R,A,F)||this.validateArrayUniqueItems(R,A,F)||this.validateArrayItems(R,A,F))||null},s.prototype.validateArrayLength=function(R,A){var F;return A.minItems!==void 0&&R.length<A.minItems&&(F=this.createError(q.ARRAY_LENGTH_SHORT,{length:R.length,minimum:A.minItems},"","/minItems",null,R,A),this.handleError(F))||A.maxItems!==void 0&&R.length>A.maxItems&&(F=this.createError(q.ARRAY_LENGTH_LONG,{length:R.length,maximum:A.maxItems},"","/maxItems",null,R,A),this.handleError(F))?F:null},s.prototype.validateArrayUniqueItems=function(R,A){if(A.uniqueItems){for(var F=0;F<R.length;F++)for(var U=F+1;U<R.length;U++)if(o(R[F],R[U])){var D=this.createError(q.ARRAY_UNIQUE,{match1:F,match2:U},"","/uniqueItems",null,R,A);if(this.handleError(D))return D}}return null},s.prototype.validateArrayItems=function(R,A,F){if(A.items===void 0)return null;var U,D;if(Array.isArray(A.items)){for(D=0;D<R.length;D++)if(D<A.items.length){if(U=this.validateAll(R[D],A.items[D],[D],["items",D],F+"/"+D))return U}else if(A.additionalItems!==void 0){if(typeof A.additionalItems=="boolean"){if(!A.additionalItems&&(U=this.createError(q.ARRAY_ADDITIONAL_ITEMS,{},"/"+D,"/additionalItems",null,R,A),this.handleError(U)))return U}else if(U=this.validateAll(R[D],A.additionalItems,[D],["additionalItems"],F+"/"+D))return U}}else for(D=0;D<R.length;D++)if(U=this.validateAll(R[D],A.items,[D],["items"],F+"/"+D))return U;return null},s.prototype.validateObject=function(R,A,F){return typeof R!="object"||R===null||Array.isArray(R)?null:this.validateObjectMinMaxProperties(R,A,F)||this.validateObjectRequiredProperties(R,A,F)||this.validateObjectProperties(R,A,F)||this.validateObjectDependencies(R,A,F)||null},s.prototype.validateObjectMinMaxProperties=function(R,A){var F=Object.keys(R),U;return A.minProperties!==void 0&&F.length<A.minProperties&&(U=this.createError(q.OBJECT_PROPERTIES_MINIMUM,{propertyCount:F.length,minimum:A.minProperties},"","/minProperties",null,R,A),this.handleError(U))||A.maxProperties!==void 0&&F.length>A.maxProperties&&(U=this.createError(q.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:F.length,maximum:A.maxProperties},"","/maxProperties",null,R,A),this.handleError(U))?U:null},s.prototype.validateObjectRequiredProperties=function(R,A){if(A.required!==void 0)for(var F=0;F<A.required.length;F++){var U=A.required[F];if(R[U]===void 0){var D=this.createError(q.OBJECT_REQUIRED,{key:U},"","/required/"+F,null,R,A);if(this.handleError(D))return D}}return null},s.prototype.validateObjectProperties=function(R,A,F){var U;for(var D in R){var J=F+"/"+D.replace(/~/g,"~0").replace(/\//g,"~1"),Q=!1;if(A.properties!==void 0&&A.properties[D]!==void 0&&(Q=!0,U=this.validateAll(R[D],A.properties[D],[D],["properties",D],J)))return U;if(A.patternProperties!==void 0)for(var se in A.patternProperties){var ce=new RegExp(se);if(ce.test(D)&&(Q=!0,U=this.validateAll(R[D],A.patternProperties[se],[D],["patternProperties",se],J)))return U}if(Q)this.trackUnknownProperties&&(this.knownPropertyPaths[J]=!0,delete this.unknownPropertyPaths[J]);else if(A.additionalProperties!==void 0){if(this.trackUnknownProperties&&(this.knownPropertyPaths[J]=!0,delete this.unknownPropertyPaths[J]),typeof A.additionalProperties=="boolean"){if(!A.additionalProperties&&(U=this.createError(q.OBJECT_ADDITIONAL_PROPERTIES,{key:D},"","/additionalProperties",null,R,A).prefixWith(D,null),this.handleError(U)))return U}else if(U=this.validateAll(R[D],A.additionalProperties,[D],["additionalProperties"],J))return U}else this.trackUnknownProperties&&!this.knownPropertyPaths[J]&&(this.unknownPropertyPaths[J]=!0)}return null},s.prototype.validateObjectDependencies=function(R,A,F){var U;if(A.dependencies!==void 0){for(var D in A.dependencies)if(R[D]!==void 0){var J=A.dependencies[D];if(typeof J=="string"){if(R[J]===void 0&&(U=this.createError(q.OBJECT_DEPENDENCY_KEY,{key:D,missing:J},"","",null,R,A).prefixWith(null,D).prefixWith(null,"dependencies"),this.handleError(U)))return U}else if(Array.isArray(J))for(var Q=0;Q<J.length;Q++){var se=J[Q];if(R[se]===void 0&&(U=this.createError(q.OBJECT_DEPENDENCY_KEY,{key:D,missing:se},"","/"+Q,null,R,A).prefixWith(null,D).prefixWith(null,"dependencies"),this.handleError(U)))return U}else if(U=this.validateAll(R,J,[],["dependencies",D],F))return U}}return null},s.prototype.validateCombinations=function(R,A,F){return this.validateAllOf(R,A,F)||this.validateAnyOf(R,A,F)||this.validateOneOf(R,A,F)||this.validateNot(R,A,F)||null},s.prototype.validateAllOf=function(R,A,F){if(A.allOf===void 0)return null;for(var U,D=0;D<A.allOf.length;D++){var J=A.allOf[D];if(U=this.validateAll(R,J,[],["allOf",D],F))return U}return null},s.prototype.validateAnyOf=function(R,A,F){if(A.anyOf===void 0)return null;var U=[],D=this.errors.length,J,Q;this.trackUnknownProperties&&(J=this.unknownPropertyPaths,Q=this.knownPropertyPaths);for(var se=!0,ce=0;ce<A.anyOf.length;ce++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var Ve=A.anyOf[ce],Re=this.errors.length,me=this.validateAll(R,Ve,[],["anyOf",ce],F);if(me===null&&Re===this.errors.length){if(this.errors=this.errors.slice(0,D),this.trackUnknownProperties){for(var Ae in this.knownPropertyPaths)Q[Ae]=!0,delete J[Ae];for(var gt in this.unknownPropertyPaths)Q[gt]||(J[gt]=!0);se=!1;continue}return null}me&&U.push(me.prefixWith(null,""+ce).prefixWith(null,"anyOf"))}if(this.trackUnknownProperties&&(this.unknownPropertyPaths=J,this.knownPropertyPaths=Q),se)return U=U.concat(this.errors.slice(D)),this.errors=this.errors.slice(0,D),this.createError(q.ANY_OF_MISSING,{},"","/anyOf",U,R,A)},s.prototype.validateOneOf=function(R,A,F){if(A.oneOf===void 0)return null;var U=null,D=[],J=this.errors.length,Q,se;this.trackUnknownProperties&&(Q=this.unknownPropertyPaths,se=this.knownPropertyPaths);for(var ce=0;ce<A.oneOf.length;ce++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var Ve=A.oneOf[ce],Re=this.errors.length,me=this.validateAll(R,Ve,[],["oneOf",ce],F);if(me===null&&Re===this.errors.length){if(U===null)U=ce;else return this.errors=this.errors.slice(0,J),this.createError(q.ONE_OF_MULTIPLE,{index1:U,index2:ce},"","/oneOf",null,R,A);if(this.trackUnknownProperties){for(var Ae in this.knownPropertyPaths)se[Ae]=!0,delete Q[Ae];for(var gt in this.unknownPropertyPaths)se[gt]||(Q[gt]=!0)}}else me&&D.push(me)}return this.trackUnknownProperties&&(this.unknownPropertyPaths=Q,this.knownPropertyPaths=se),U===null?(D=D.concat(this.errors.slice(J)),this.errors=this.errors.slice(0,J),this.createError(q.ONE_OF_MISSING,{},"","/oneOf",D,R,A)):(this.errors=this.errors.slice(0,J),null)},s.prototype.validateNot=function(R,A,F){if(A.not===void 0)return null;var U=this.errors.length,D,J;this.trackUnknownProperties&&(D=this.unknownPropertyPaths,J=this.knownPropertyPaths,this.unknownPropertyPaths={},this.knownPropertyPaths={});var Q=this.validateAll(R,A.not,null,null,F),se=this.errors.slice(U);return this.errors=this.errors.slice(0,U),this.trackUnknownProperties&&(this.unknownPropertyPaths=D,this.knownPropertyPaths=J),Q===null&&se.length===0?this.createError(q.NOT_PASSED,{},"","/not",null,R,A):null},s.prototype.validateHypermedia=function(R,A,F){if(!A.links)return null;for(var U,D=0;D<A.links.length;D++){var J=A.links[D];if(J.rel==="describedby"){for(var Q=new i(J.href),se=!0,ce=0;ce<Q.varNames.length;ce++)if(!(Q.varNames[ce]in R)){se=!1;break}if(se){var Ve=Q.fillFromObject(R),Re={$ref:Ve};if(U=this.validateAll(R,Re,[],["links",D],F))return U}}}};function d(I){var R=String(I).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return R?{href:R[0]||"",protocol:R[1]||"",authority:R[2]||"",host:R[3]||"",hostname:R[4]||"",port:R[5]||"",pathname:R[6]||"",search:R[7]||"",hash:R[8]||""}:null}function p(I,R){function A(F){var U=[];return F.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(D){D==="/.."?U.pop():U.push(D)}),U.join("").replace(/^\//,F.charAt(0)==="/"?"/":"")}return R=d(R||""),I=d(I||""),!R||!I?null:(R.protocol||I.protocol)+(R.protocol||R.authority?R.authority:I.authority)+A(R.protocol||R.authority||R.pathname.charAt(0)==="/"?R.pathname:R.pathname?(I.authority&&!I.pathname?"/":"")+I.pathname.slice(0,I.pathname.lastIndexOf("/")+1)+R.pathname:I.pathname)+(R.protocol||R.authority||R.pathname?R.search:R.search||I.search)+R.hash}function m(I){return I.split("#")[0]}function y(I,R){if(I&&typeof I=="object")if(R===void 0?R=I.id:typeof I.id=="string"&&(R=p(R,I.id),I.id=R),Array.isArray(I))for(var A=0;A<I.length;A++)y(I[A],R);else{typeof I.$ref=="string"&&(I.$ref=p(R,I.$ref));for(var F in I)F!=="enum"&&y(I[F],R)}}function b(I){I=I||"en";var R=O[I];return function(A){var F=R[A.code]||_[A.code];if(typeof F!="string")return"Unknown error code "+A.code+": "+JSON.stringify(A.messageParams);var U=A.params;return F.replace(/\{([^{}]*)\}/g,function(D,J){var Q=U[J];return typeof Q=="string"||typeof Q=="number"?Q:D})}}var q={INVALID_TYPE:0,ENUM_MISMATCH:1,ANY_OF_MISSING:10,ONE_OF_MISSING:11,ONE_OF_MULTIPLE:12,NOT_PASSED:13,NUMBER_MULTIPLE_OF:100,NUMBER_MINIMUM:101,NUMBER_MINIMUM_EXCLUSIVE:102,NUMBER_MAXIMUM:103,NUMBER_MAXIMUM_EXCLUSIVE:104,NUMBER_NOT_A_NUMBER:105,STRING_LENGTH_SHORT:200,STRING_LENGTH_LONG:201,STRING_PATTERN:202,OBJECT_PROPERTIES_MINIMUM:300,OBJECT_PROPERTIES_MAXIMUM:301,OBJECT_REQUIRED:302,OBJECT_ADDITIONAL_PROPERTIES:303,OBJECT_DEPENDENCY_KEY:304,ARRAY_LENGTH_SHORT:400,ARRAY_LENGTH_LONG:401,ARRAY_UNIQUE:402,ARRAY_ADDITIONAL_ITEMS:403,FORMAT_CUSTOM:500,KEYWORD_CUSTOM:501,CIRCULAR_REFERENCE:600,UNKNOWN_PROPERTY:1e3},C={};for(var v in q)C[q[v]]=v;var _={INVALID_TYPE:"Invalid type: {type} (expected {expected})",ENUM_MISMATCH:"No enum match for: {value}",ANY_OF_MISSING:'Data does not match any schemas from "anyOf"',ONE_OF_MISSING:'Data does not match any schemas from "oneOf"',ONE_OF_MULTIPLE:'Data is valid against more than one schema from "oneOf": indices {index1} and {index2}',NOT_PASSED:'Data matches schema from "not"',NUMBER_MULTIPLE_OF:"Value {value} is not a multiple of {multipleOf}",NUMBER_MINIMUM:"Value {value} is less than minimum {minimum}",NUMBER_MINIMUM_EXCLUSIVE:"Value {value} is equal to exclusive minimum {minimum}",NUMBER_MAXIMUM:"Value {value} is greater than maximum {maximum}",NUMBER_MAXIMUM_EXCLUSIVE:"Value {value} is equal to exclusive maximum {maximum}",NUMBER_NOT_A_NUMBER:"Value {value} is not a valid number",STRING_LENGTH_SHORT:"String is too short ({length} chars), minimum {minimum}",STRING_LENGTH_LONG:"String is too long ({length} chars), maximum {maximum}",STRING_PATTERN:"String does not match pattern: {pattern}",OBJECT_PROPERTIES_MINIMUM:"Too few properties defined ({propertyCount}), minimum {minimum}",OBJECT_PROPERTIES_MAXIMUM:"Too many properties defined ({propertyCount}), maximum {maximum}",OBJECT_REQUIRED:"Missing required property: {key}",OBJECT_ADDITIONAL_PROPERTIES:"Additional properties not allowed",OBJECT_DEPENDENCY_KEY:"Dependency failed - key must exist: {missing} (due to key: {key})",ARRAY_LENGTH_SHORT:"Array is too short ({length}), minimum {minimum}",ARRAY_LENGTH_LONG:"Array is too long ({length}), maximum {maximum}",ARRAY_UNIQUE:"Array items are not unique (indices {match1} and {match2})",ARRAY_ADDITIONAL_ITEMS:"Additional items not allowed",FORMAT_CUSTOM:"Format validation failed ({message})",KEYWORD_CUSTOM:"Keyword failed: {key} ({message})",CIRCULAR_REFERENCE:"Circular $refs: {urls}",UNKNOWN_PROPERTY:"Unknown property (not in schema)"};function E(I,R,A,F,U){if(Error.call(this),I===void 0)throw new Error("No error code supplied: "+F);this.message="",this.params=R,this.code=I,this.dataPath=A||"",this.schemaPath=F||"",this.subErrors=U||null;var D=new Error(this.message);if(this.stack=D.stack||D.stacktrace,!this.stack)try{throw D}catch(J){this.stack=J.stack||J.stacktrace}}E.prototype=Object.create(Error.prototype),E.prototype.constructor=E,E.prototype.name="ValidationError",E.prototype.prefixWith=function(I,R){if(I!==null&&(I=I.replace(/~/g,"~0").replace(/\//g,"~1"),this.dataPath="/"+I+this.dataPath),R!==null&&(R=R.replace(/~/g,"~0").replace(/\//g,"~1"),this.schemaPath="/"+R+this.schemaPath),this.subErrors!==null)for(var A=0;A<this.subErrors.length;A++)this.subErrors[A].prefixWith(I,R);return this};function k(I,R){if(R.substring(0,I.length)===I){var A=R.substring(I.length);if(R.length>0&&R.charAt(I.length-1)==="/"||A.charAt(0)==="#"||A.charAt(0)==="?")return!0}return!1}var O={};function M(I){var R=new s,A,F,U={setErrorReporter:function(D){return typeof D=="string"?this.language(D):(F=D,!0)},addFormat:function(){R.addFormat.apply(R,arguments)},language:function(D){return D?(O[D]||(D=D.split("-")[0]),O[D]?(A=D,D):!1):A},addLanguage:function(D,J){var Q;for(Q in q)J[Q]&&!J[q[Q]]&&(J[q[Q]]=J[Q]);var se=D.split("-")[0];if(!O[se])O[D]=J,O[se]=J;else{O[D]=Object.create(O[se]);for(Q in J)typeof O[se][Q]>"u"&&(O[se][Q]=J[Q]),O[D][Q]=J[Q]}return this},freshApi:function(D){var J=M();return D&&J.language(D),J},validate:function(D,J,Q,se){var ce=b(A),Ve=F?function(Ae,gt,Nt){return F(Ae,gt,Nt)||ce(Ae,gt,Nt)}:ce,Re=new s(R,!1,Ve,Q,se);typeof J=="string"&&(J={$ref:J}),Re.addSchema("",J);var me=Re.validateAll(D,J,null,null,"");return!me&&se&&(me=Re.banUnknownProperties(D,J)),this.error=me,this.missing=Re.missing,this.valid=me===null,this.valid},validateResult:function(){var D={toString:function(){return this.valid?"valid":this.error.message}};return this.validate.apply(D,arguments),D},validateMultiple:function(D,J,Q,se){var ce=b(A),Ve=F?function(Ae,gt,Nt){return F(Ae,gt,Nt)||ce(Ae,gt,Nt)}:ce,Re=new s(R,!0,Ve,Q,se);typeof J=="string"&&(J={$ref:J}),Re.addSchema("",J),Re.validateAll(D,J,null,null,""),se&&Re.banUnknownProperties(D,J);var me={toString:function(){return this.valid?"valid":this.error.message}};return me.errors=Re.errors,me.missing=Re.missing,me.valid=me.errors.length===0,me},addSchema:function(){return R.addSchema.apply(R,arguments)},getSchema:function(){return R.getSchema.apply(R,arguments)},getSchemaMap:function(){return R.getSchemaMap.apply(R,arguments)},getSchemaUris:function(){return R.getSchemaUris.apply(R,arguments)},getMissingUris:function(){return R.getMissingUris.apply(R,arguments)},dropSchemas:function(){R.dropSchemas.apply(R,arguments)},defineKeyword:function(){R.defineKeyword.apply(R,arguments)},defineError:function(D,J,Q){if(typeof D!="string"||!/^[A-Z]+(_[A-Z]+)*$/.test(D))throw new Error("Code name must be a string in UPPER_CASE_WITH_UNDERSCORES");if(typeof J!="number"||J%1!==0||J<1e4)throw new Error("Code number must be an integer > 10000");if(typeof q[D]<"u")throw new Error("Error already defined: "+D+" as "+q[D]);if(typeof C[J]<"u")throw new Error("Error code already used: "+C[J]+" as "+J);q[D]=J,C[J]=D,_[D]=_[J]=Q;for(var se in O){var ce=O[se];ce[D]&&(ce[J]=ce[J]||ce[D])}},reset:function(){R.reset(),this.error=null,this.missing=[],this.valid=!0},missing:[],error:null,valid:!0,normSchema:y,resolveUrl:p,getDocumentUri:m,errorCodes:q};return U.language(I||"en"),U}var j=M();return j.addLanguage("en-gb",_),j.tv4=j,j})});var Df=V(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.regexpCode=ft.getEsmExportName=ft.getProperty=ft.safeStringify=ft.stringify=ft.strConcat=ft.addCodeArg=ft.str=ft._=ft.nil=ft._Code=ft.Name=ft.IDENTIFIER=ft._CodeOrName=void 0;var Mf=class{};ft._CodeOrName=Mf;ft.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ta=class extends Mf{constructor(e){if(super(),!ft.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ft.Name=Ta;var Bn=class extends Mf{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Ta&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ft._Code=Bn;ft.nil=new Bn("");function Mq(t,...e){let r=[t[0]],n=0;for(;n<e.length;)nw(r,e[n]),r.push(t[++n]);return new Bn(r)}ft._=Mq;var rw=new Bn("+");function Fq(t,...e){let r=[Ff(t[0])],n=0;for(;n<e.length;)r.push(rw),nw(r,e[n]),r.push(rw,Ff(t[++n]));return B2(r),new Bn(r)}ft.str=Fq;function nw(t,e){e instanceof Bn?t.push(...e._items):e instanceof Ta?t.push(e):t.push(z2(e))}ft.addCodeArg=nw;function B2(t){let e=1;for(;e<t.length-1;){if(t[e]===rw){let r=V2(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function V2(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ta||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ta))return`"${t}${e.slice(1)}`}function W2(t,e){return e.emptyStr()?t:t.emptyStr()?e:Fq`${t}${e}`}ft.strConcat=W2;function z2(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Ff(Array.isArray(t)?t.join(","):t)}function J2(t){return new Bn(Ff(t))}ft.stringify=J2;function Ff(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ft.safeStringify=Ff;function G2(t){return typeof t=="string"&&ft.IDENTIFIER.test(t)?new Bn(`.${t}`):Mq`[${t}]`}ft.getProperty=G2;function Y2(t){if(typeof t=="string"&&ft.IDENTIFIER.test(t))return new Bn(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ft.getEsmExportName=Y2;function K2(t){return new Bn(t.toString())}ft.regexpCode=K2});var ow=V(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.ValueScope=rn.ValueScopeName=rn.Scope=rn.varKinds=rn.UsedValueState=void 0;var tn=Df(),iw=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},pm;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(pm||(rn.UsedValueState=pm={}));rn.varKinds={const:new tn.Name("const"),let:new tn.Name("let"),var:new tn.Name("var")};var hm=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof tn.Name?e:this.name(e)}name(e){return new tn.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};rn.Scope=hm;var mm=class extends tn.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,tn._)`.${new tn.Name(r)}[${n}]`}};rn.ValueScopeName=mm;var Q2=(0,tn._)`\n`,sw=class extends hm{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Q2:tn.nil}}get(){return this._scope}name(e){return new mm(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,l=this._values[s];if(l){let p=l.get(o);if(p)return p}else l=this._values[s]=new Map;l.set(o,i);let c=this._scope[s]||(this._scope[s]=[]),d=c.length;return c[d]=r.ref,i.setValue(r,{property:s,itemIndex:d}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,tn._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=tn.nil;for(let o in e){let l=e[o];if(!l)continue;let c=n[o]=n[o]||new Map;l.forEach(d=>{if(c.has(d))return;c.set(d,pm.Started);let p=r(d);if(p){let m=this.opts.es5?rn.varKinds.var:rn.varKinds.const;s=(0,tn._)`${s}${m} ${d} = ${p};${this.opts._n}`}else if(p=i?.(d))s=(0,tn._)`${s}${p}${this.opts._n}`;else throw new iw(d);c.set(d,pm.Completed)})}return s}};rn.ValueScope=sw});var Ge=V(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.or=Be.and=Be.not=Be.CodeGen=Be.operators=Be.varKinds=Be.ValueScopeName=Be.ValueScope=Be.Scope=Be.Name=Be.regexpCode=Be.stringify=Be.getProperty=Be.nil=Be.strConcat=Be.str=Be._=void 0;var rt=Df(),ci=ow(),bo=Df();Object.defineProperty(Be,"_",{enumerable:!0,get:function(){return bo._}});Object.defineProperty(Be,"str",{enumerable:!0,get:function(){return bo.str}});Object.defineProperty(Be,"strConcat",{enumerable:!0,get:function(){return bo.strConcat}});Object.defineProperty(Be,"nil",{enumerable:!0,get:function(){return bo.nil}});Object.defineProperty(Be,"getProperty",{enumerable:!0,get:function(){return bo.getProperty}});Object.defineProperty(Be,"stringify",{enumerable:!0,get:function(){return bo.stringify}});Object.defineProperty(Be,"regexpCode",{enumerable:!0,get:function(){return bo.regexpCode}});Object.defineProperty(Be,"Name",{enumerable:!0,get:function(){return bo.Name}});var bm=ow();Object.defineProperty(Be,"Scope",{enumerable:!0,get:function(){return bm.Scope}});Object.defineProperty(Be,"ValueScope",{enumerable:!0,get:function(){return bm.ValueScope}});Object.defineProperty(Be,"ValueScopeName",{enumerable:!0,get:function(){return bm.ValueScopeName}});Object.defineProperty(Be,"varKinds",{enumerable:!0,get:function(){return bm.varKinds}});Be.operators={GT:new rt._Code(">"),GTE:new rt._Code(">="),LT:new rt._Code("<"),LTE:new rt._Code("<="),EQ:new rt._Code("==="),NEQ:new rt._Code("!=="),NOT:new rt._Code("!"),OR:new rt._Code("||"),AND:new rt._Code("&&"),ADD:new rt._Code("+")};var Es=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},aw=class extends Es{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?ci.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Iu(this.rhs,e,r)),this}get names(){return this.rhs instanceof rt._CodeOrName?this.rhs.names:{}}},gm=class extends Es{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof rt.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Iu(this.rhs,e,r),this}get names(){let e=this.lhs instanceof rt.Name?{}:{...this.lhs.names};return vm(e,this.rhs)}},lw=class extends gm{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},uw=class extends Es{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},cw=class extends Es{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},fw=class extends Es{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},dw=class extends Es{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Iu(this.code,e,r),this}get names(){return this.code instanceof rt._CodeOrName?this.code.names:{}}},jf=class extends Es{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(Z2(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Ma(e,r.names),{})}},qs=class extends jf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},pw=class extends jf{},Ou=class extends qs{};Ou.kind="else";var $a=class t extends qs{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Ou(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Dq(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Iu(this.condition,e,r),this}get names(){let e=super.names;return vm(e,this.condition),this.else&&Ma(e,this.else.names),e}};$a.kind="if";var Na=class extends qs{};Na.kind="for";var hw=class extends Na{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Iu(this.iteration,e,r),this}get names(){return Ma(super.names,this.iteration.names)}},mw=class extends Na{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?ci.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=vm(super.names,this.from);return vm(e,this.to)}},ym=class extends Na{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Iu(this.iterable,e,r),this}get names(){return Ma(super.names,this.iterable.names)}},Lf=class extends qs{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Lf.kind="func";var Uf=class extends jf{render(e){return"return "+super.render(e)}};Uf.kind="return";var gw=class extends qs{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Ma(e,this.catch.names),this.finally&&Ma(e,this.finally.names),e}},Hf=class extends qs{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Hf.kind="catch";var Bf=class extends qs{render(e){return"finally"+super.render(e)}};Bf.kind="finally";var yw=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
24
24
|
`:""},this._extScope=e,this._scope=new ci.Scope({parent:e}),this._nodes=[new pw]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let s=this._scope.toName(r);return n!==void 0&&i&&(this._constants[s.str]=n),this._leafNode(new aw(e,s,n)),s}const(e,r,n){return this._def(ci.varKinds.const,e,r,n)}let(e,r,n){return this._def(ci.varKinds.let,e,r,n)}var(e,r,n){return this._def(ci.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new gm(e,r,n))}add(e,r){return this._leafNode(new lw(e,Be.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==rt.nil&&this._leafNode(new dw(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,rt.addCodeArg)(r,i));return r.push("}"),new rt._Code(r)}if(e,r,n){if(this._blockNode(new $a(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new $a(e))}else(){return this._elseNode(new Ou)}endIf(){return this._endBlockNode($a,Ou)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new hw(e),r)}forRange(e,r,n,i,s=this.opts.es5?ci.varKinds.var:ci.varKinds.let){let o=this._scope.toName(e);return this._for(new mw(s,o,r,n),()=>i(o))}forOf(e,r,n,i=ci.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=r instanceof rt.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,rt._)`${o}.length`,l=>{this.var(s,(0,rt._)`${o}[${l}]`),n(s)})}return this._for(new ym("of",i,s,r),()=>n(s))}forIn(e,r,n,i=this.opts.es5?ci.varKinds.var:ci.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,rt._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new ym("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(Na)}label(e){return this._leafNode(new uw(e))}break(e){return this._leafNode(new cw(e))}return(e){let r=new Uf;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Uf)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new gw;if(this._blockNode(i),this.code(e),r){let s=this.name("e");this._currNode=i.catch=new Hf(s),r(s)}return n&&(this._currNode=i.finally=new Bf,this.code(n)),this._endBlockNode(Hf,Bf)}throw(e){return this._leafNode(new fw(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=rt.nil,n,i){return this._blockNode(new Lf(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Lf)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof $a))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Be.CodeGen=yw;function Ma(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function vm(t,e){return e instanceof rt._CodeOrName?Ma(t,e.names):t}function Iu(t,e,r){if(t instanceof rt.Name)return n(t);if(!i(t))return t;return new rt._Code(t._items.reduce((s,o)=>(o instanceof rt.Name&&(o=n(o)),o instanceof rt._Code?s.push(...o._items):s.push(o),s),[]));function n(s){let o=r[s.str];return o===void 0||e[s.str]!==1?s:(delete e[s.str],o)}function i(s){return s instanceof rt._Code&&s._items.some(o=>o instanceof rt.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function Z2(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Dq(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,rt._)`!${vw(t)}`}Be.not=Dq;var X2=jq(Be.operators.AND);function eU(...t){return t.reduce(X2)}Be.and=eU;var tU=jq(Be.operators.OR);function rU(...t){return t.reduce(tU)}Be.or=rU;function jq(t){return(e,r)=>e===rt.nil?r:r===rt.nil?e:(0,rt._)`${vw(e)} ${t} ${vw(r)}`}function vw(t){return t instanceof rt.Name?t:(0,rt._)`(${t})`}});var st=V(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.checkStrictMode=Ye.getErrorPath=Ye.Type=Ye.useFunc=Ye.setEvaluated=Ye.evaluatedPropsToName=Ye.mergeEvaluated=Ye.eachItem=Ye.unescapeJsonPointer=Ye.escapeJsonPointer=Ye.escapeFragment=Ye.unescapeFragment=Ye.schemaRefOrVal=Ye.schemaHasRulesButRef=Ye.schemaHasRules=Ye.checkUnknownRules=Ye.alwaysValidSchema=Ye.toHash=void 0;var kt=Ge(),nU=Df();function iU(t){let e={};for(let r of t)e[r]=!0;return e}Ye.toHash=iU;function sU(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Hq(t,e),!Bq(e,t.self.RULES.all))}Ye.alwaysValidSchema=sU;function Hq(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let s in e)i[s]||zq(t,`unknown keyword: "${s}"`)}Ye.checkUnknownRules=Hq;function Bq(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Ye.schemaHasRules=Bq;function oU(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Ye.schemaHasRulesButRef=oU;function aU({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,kt._)`${r}`}return(0,kt._)`${t}${e}${(0,kt.getProperty)(n)}`}Ye.schemaRefOrVal=aU;function lU(t){return Vq(decodeURIComponent(t))}Ye.unescapeFragment=lU;function uU(t){return encodeURIComponent(Sw(t))}Ye.escapeFragment=uU;function Sw(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Ye.escapeJsonPointer=Sw;function Vq(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Ye.unescapeJsonPointer=Vq;function cU(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Ye.eachItem=cU;function Lq({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,s,o,l)=>{let c=o===void 0?s:o instanceof kt.Name?(s instanceof kt.Name?t(i,s,o):e(i,s,o),o):s instanceof kt.Name?(e(i,o,s),s):r(s,o);return l===kt.Name&&!(c instanceof kt.Name)?n(i,c):c}}Ye.mergeEvaluated={props:Lq({mergeNames:(t,e,r)=>t.if((0,kt._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,kt._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,kt._)`${r} || {}`).code((0,kt._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,kt._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,kt._)`${r} || {}`),ww(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Wq}),items:Lq({mergeNames:(t,e,r)=>t.if((0,kt._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,kt._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,kt._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,kt._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Wq(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,kt._)`{}`);return e!==void 0&&ww(t,r,e),r}Ye.evaluatedPropsToName=Wq;function ww(t,e,r){Object.keys(r).forEach(n=>t.assign((0,kt._)`${e}${(0,kt.getProperty)(n)}`,!0))}Ye.setEvaluated=ww;var Uq={};function fU(t,e){return t.scopeValue("func",{ref:e,code:Uq[e.code]||(Uq[e.code]=new nU._Code(e.code))})}Ye.useFunc=fU;var bw;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(bw||(Ye.Type=bw={}));function dU(t,e,r){if(t instanceof kt.Name){let n=e===bw.Num;return r?n?(0,kt._)`"[" + ${t} + "]"`:(0,kt._)`"['" + ${t} + "']"`:n?(0,kt._)`"/" + ${t}`:(0,kt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,kt.getProperty)(t).toString():"/"+Sw(t)}Ye.getErrorPath=dU;function zq(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Ye.checkStrictMode=zq});var Os=V(_w=>{"use strict";Object.defineProperty(_w,"__esModule",{value:!0});var Cr=Ge(),pU={data:new Cr.Name("data"),valCxt:new Cr.Name("valCxt"),instancePath:new Cr.Name("instancePath"),parentData:new Cr.Name("parentData"),parentDataProperty:new Cr.Name("parentDataProperty"),rootData:new Cr.Name("rootData"),dynamicAnchors:new Cr.Name("dynamicAnchors"),vErrors:new Cr.Name("vErrors"),errors:new Cr.Name("errors"),this:new Cr.Name("this"),self:new Cr.Name("self"),scope:new Cr.Name("scope"),json:new Cr.Name("json"),jsonPos:new Cr.Name("jsonPos"),jsonLen:new Cr.Name("jsonLen"),jsonPart:new Cr.Name("jsonPart")};_w.default=pU});var Vf=V(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.extendErrors=xr.resetErrorsCount=xr.reportExtraError=xr.reportError=xr.keyword$DataError=xr.keywordError=void 0;var ot=Ge(),Sm=st(),Ur=Os();xr.keywordError={message:({keyword:t})=>(0,ot.str)`must pass "${t}" keyword validation`};xr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,ot.str)`"${t}" keyword must be ${e} ($data)`:(0,ot.str)`"${t}" keyword is invalid ($data)`};function hU(t,e=xr.keywordError,r,n){let{it:i}=t,{gen:s,compositeRule:o,allErrors:l}=i,c=Yq(t,e,r);n??(o||l)?Jq(s,c):Gq(i,(0,ot._)`[${c}]`)}xr.reportError=hU;function mU(t,e=xr.keywordError,r){let{it:n}=t,{gen:i,compositeRule:s,allErrors:o}=n,l=Yq(t,e,r);Jq(i,l),s||o||Gq(n,Ur.default.vErrors)}xr.reportExtraError=mU;function gU(t,e){t.assign(Ur.default.errors,e),t.if((0,ot._)`${Ur.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,ot._)`${Ur.default.vErrors}.length`,e),()=>t.assign(Ur.default.vErrors,null)))}xr.resetErrorsCount=gU;function yU({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,Ur.default.errors,l=>{t.const(o,(0,ot._)`${Ur.default.vErrors}[${l}]`),t.if((0,ot._)`${o}.instancePath === undefined`,()=>t.assign((0,ot._)`${o}.instancePath`,(0,ot.strConcat)(Ur.default.instancePath,s.errorPath))),t.assign((0,ot._)`${o}.schemaPath`,(0,ot.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,ot._)`${o}.schema`,r),t.assign((0,ot._)`${o}.data`,n))})}xr.extendErrors=yU;function Jq(t,e){let r=t.const("err",e);t.if((0,ot._)`${Ur.default.vErrors} === null`,()=>t.assign(Ur.default.vErrors,(0,ot._)`[${r}]`),(0,ot._)`${Ur.default.vErrors}.push(${r})`),t.code((0,ot._)`${Ur.default.errors}++`)}function Gq(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,ot._)`new ${t.ValidationError}(${e})`):(r.assign((0,ot._)`${n}.errors`,e),r.return(!1))}var Fa={keyword:new ot.Name("keyword"),schemaPath:new ot.Name("schemaPath"),params:new ot.Name("params"),propertyName:new ot.Name("propertyName"),message:new ot.Name("message"),schema:new ot.Name("schema"),parentSchema:new ot.Name("parentSchema")};function Yq(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,ot._)`{}`:vU(t,e,r)}function vU(t,e,r={}){let{gen:n,it:i}=t,s=[bU(i,r),SU(t,r)];return wU(t,e,s),n.object(...s)}function bU({errorPath:t},{instancePath:e}){let r=e?(0,ot.str)`${t}${(0,Sm.getErrorPath)(e,Sm.Type.Str)}`:t;return[Ur.default.instancePath,(0,ot.strConcat)(Ur.default.instancePath,r)]}function SU({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,ot.str)`${e}/${t}`;return r&&(i=(0,ot.str)`${i}${(0,Sm.getErrorPath)(r,Sm.Type.Str)}`),[Fa.schemaPath,i]}function wU(t,{params:e,message:r},n){let{keyword:i,data:s,schemaValue:o,it:l}=t,{opts:c,propertyName:d,topSchemaRef:p,schemaPath:m}=l;n.push([Fa.keyword,i],[Fa.params,typeof e=="function"?e(t):e||(0,ot._)`{}`]),c.messages&&n.push([Fa.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Fa.schema,o],[Fa.parentSchema,(0,ot._)`${p}${m}`],[Ur.default.data,s]),d&&n.push([Fa.propertyName,d])}});var Qq=V(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.boolOrEmptySchema=Pu.topBoolOrEmptySchema=void 0;var _U=Vf(),RU=Ge(),CU=Os(),xU={message:"boolean schema is false"};function EU(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Kq(t,!1):typeof r=="object"&&r.$async===!0?e.return(CU.default.data):(e.assign((0,RU._)`${n}.errors`,null),e.return(!0))}Pu.topBoolOrEmptySchema=EU;function qU(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Kq(t)):r.var(e,!0)}Pu.boolOrEmptySchema=qU;function Kq(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,_U.reportError)(i,xU,void 0,e)}});var Rw=V(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.getRules=ku.isJSONType=void 0;var OU=["string","number","integer","boolean","null","object","array"],IU=new Set(OU);function PU(t){return typeof t=="string"&&IU.has(t)}ku.isJSONType=PU;function kU(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}ku.getRules=kU});var Cw=V(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.shouldUseRule=So.shouldUseGroup=So.schemaHasRulesForType=void 0;function AU({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Zq(t,n)}So.schemaHasRulesForType=AU;function Zq(t,e){return e.rules.some(r=>Xq(t,r))}So.shouldUseGroup=Zq;function Xq(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}So.shouldUseRule=Xq});var Wf=V(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.reportTypeError=Er.checkDataTypes=Er.checkDataType=Er.coerceAndCheckDataType=Er.getJSONTypes=Er.getSchemaTypes=Er.DataType=void 0;var TU=Rw(),$U=Cw(),NU=Vf(),De=Ge(),eO=st(),Au;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Au||(Er.DataType=Au={}));function MU(t){let e=tO(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Er.getSchemaTypes=MU;function tO(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(TU.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Er.getJSONTypes=tO;function FU(t,e){let{gen:r,data:n,opts:i}=t,s=DU(e,i.coerceTypes),o=e.length>0&&!(s.length===0&&e.length===1&&(0,$U.schemaHasRulesForType)(t,e[0]));if(o){let l=Ew(e,n,i.strictNumbers,Au.Wrong);r.if(l,()=>{s.length?jU(t,e,s):qw(t)})}return o}Er.coerceAndCheckDataType=FU;var rO=new Set(["string","number","integer","boolean","null"]);function DU(t,e){return e?t.filter(r=>rO.has(r)||e==="array"&&r==="array"):[]}function jU(t,e,r){let{gen:n,data:i,opts:s}=t,o=n.let("dataType",(0,De._)`typeof ${i}`),l=n.let("coerced",(0,De._)`undefined`);s.coerceTypes==="array"&&n.if((0,De._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,De._)`${i}[0]`).assign(o,(0,De._)`typeof ${i}`).if(Ew(e,i,s.strictNumbers),()=>n.assign(l,i))),n.if((0,De._)`${l} !== undefined`);for(let d of r)(rO.has(d)||d==="array"&&s.coerceTypes==="array")&&c(d);n.else(),qw(t),n.endIf(),n.if((0,De._)`${l} !== undefined`,()=>{n.assign(i,l),LU(t,l)});function c(d){switch(d){case"string":n.elseIf((0,De._)`${o} == "number" || ${o} == "boolean"`).assign(l,(0,De._)`"" + ${i}`).elseIf((0,De._)`${i} === null`).assign(l,(0,De._)`""`);return;case"number":n.elseIf((0,De._)`${o} == "boolean" || ${i} === null
|
|
25
25
|
|| (${o} == "string" && ${i} && ${i} == +${i})`).assign(l,(0,De._)`+${i}`);return;case"integer":n.elseIf((0,De._)`${o} === "boolean" || ${i} === null
|
|
26
26
|
|| (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(l,(0,De._)`+${i}`);return;case"boolean":n.elseIf((0,De._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(l,!1).elseIf((0,De._)`${i} === "true" || ${i} === 1`).assign(l,!0);return;case"null":n.elseIf((0,De._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(l,null);return;case"array":n.elseIf((0,De._)`${o} === "string" || ${o} === "number"
|
|
27
|
-
|| ${o} === "boolean" || ${i} === null`).assign(l,(0,De._)`[${i}]`)}}}function LU({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,De._)`${e} !== undefined`,()=>t.assign((0,De._)`${e}[${r}]`,n))}function xw(t,e,r,n=Au.Correct){let i=n===Au.Correct?De.operators.EQ:De.operators.NEQ,s;switch(t){case"null":return(0,De._)`${e} ${i} null`;case"array":s=(0,De._)`Array.isArray(${e})`;break;case"object":s=(0,De._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=o((0,De._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=o();break;default:return(0,De._)`typeof ${e} ${i} ${t}`}return n===Au.Correct?s:(0,De.not)(s);function o(l=De.nil){return(0,De.and)((0,De._)`typeof ${e} == "number"`,l,r?(0,De._)`isFinite(${e})`:De.nil)}}Er.checkDataType=xw;function Ew(t,e,r,n){if(t.length===1)return xw(t[0],e,r,n);let i,s=(0,eO.toHash)(t);if(s.array&&s.object){let o=(0,De._)`typeof ${e} != "object"`;i=s.null?o:(0,De._)`!${e} || ${o}`,delete s.null,delete s.array,delete s.object}else i=De.nil;s.number&&delete s.integer;for(let o in s)i=(0,De.and)(i,xw(o,e,r,n));return i}Er.checkDataTypes=Ew;var UU={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,De._)`{type: ${t}}`:(0,De._)`{type: ${e}}`};function qw(t){let e=HU(t);(0,NU.reportError)(e,UU)}Er.reportTypeError=qw;function HU(t){let{gen:e,data:r,schema:n}=t,i=(0,eO.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var iO=V(wm=>{"use strict";Object.defineProperty(wm,"__esModule",{value:!0});wm.assignDefaults=void 0;var Tu=Ge(),BU=st();function VU(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)nO(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,s)=>nO(t,s,i.default))}wm.assignDefaults=VU;function nO(t,e,r){let{gen:n,compositeRule:i,data:s,opts:o}=t;if(r===void 0)return;let l=(0,Tu._)`${s}${(0,Tu.getProperty)(e)}`;if(i){(0,BU.checkStrictMode)(t,`default is ignored for: ${l}`);return}let c=(0,Tu._)`${l} === undefined`;o.useDefaults==="empty"&&(c=(0,Tu._)`${c} || ${l} === null || ${l} === ""`),n.if(c,(0,Tu._)`${l} = ${(0,Tu.stringify)(r)}`)}});var Vn=V(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.validateUnion=It.validateArray=It.usePattern=It.callValidateCode=It.schemaProperties=It.allSchemaProperties=It.noPropertyInData=It.propertyInData=It.isOwnProperty=It.hasPropFunc=It.reportMissingProp=It.checkMissingProp=It.checkReportMissingProp=void 0;var Mt=Ge(),Ow=st(),wo=Os(),WU=st();function zU(t,e){let{gen:r,data:n,it:i}=t;r.if(Pw(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Mt._)`${e}`},!0),t.error()})}It.checkReportMissingProp=zU;function JU({gen:t,data:e,it:{opts:r}},n,i){return(0,Mt.or)(...n.map(s=>(0,Mt.and)(Pw(t,e,s,r.ownProperties),(0,Mt._)`${i} = ${s}`)))}It.checkMissingProp=JU;function GU(t,e){t.setParams({missingProperty:e},!0),t.error()}It.reportMissingProp=GU;function sO(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Mt._)`Object.prototype.hasOwnProperty`})}It.hasPropFunc=sO;function Iw(t,e,r){return(0,Mt._)`${sO(t)}.call(${e}, ${r})`}It.isOwnProperty=Iw;function YU(t,e,r,n){let i=(0,Mt._)`${e}${(0,Mt.getProperty)(r)} !== undefined`;return n?(0,Mt._)`${i} && ${Iw(t,e,r)}`:i}It.propertyInData=YU;function Pw(t,e,r,n){let i=(0,Mt._)`${e}${(0,Mt.getProperty)(r)} === undefined`;return n?(0,Mt.or)(i,(0,Mt.not)(Iw(t,e,r))):i}It.noPropertyInData=Pw;function oO(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}It.allSchemaProperties=oO;function KU(t,e){return oO(e).filter(r=>!(0,Ow.alwaysValidSchema)(t,e[r]))}It.schemaProperties=KU;function QU({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:s},it:o},l,c,d){let p=d?(0,Mt._)`${t}, ${e}, ${n}${i}`:e,m=[[wo.default.instancePath,(0,Mt.strConcat)(wo.default.instancePath,s)],[wo.default.parentData,o.parentData],[wo.default.parentDataProperty,o.parentDataProperty],[wo.default.rootData,wo.default.rootData]];o.opts.dynamicRef&&m.push([wo.default.dynamicAnchors,wo.default.dynamicAnchors]);let y=(0,Mt._)`${p}, ${r.object(...m)}`;return c!==Mt.nil?(0,Mt._)`${l}.call(${c}, ${y})`:(0,Mt._)`${l}(${y})`}It.callValidateCode=QU;var ZU=(0,Mt._)`new RegExp`;function XU({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,s=i(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,Mt._)`${i.code==="new RegExp"?ZU:(0,WU.useFunc)(t,i)}(${r}, ${n})`})}It.usePattern=XU;function eH(t){let{gen:e,data:r,keyword:n,it:i}=t,s=e.name("valid");if(i.allErrors){let l=e.let("valid",!0);return o(()=>e.assign(l,!1)),l}return e.var(s,!0),o(()=>e.break()),s;function o(l){let c=e.const("len",(0,Mt._)`${r}.length`);e.forRange("i",0,c,d=>{t.subschema({keyword:n,dataProp:d,dataPropType:Ow.Type.Num},s),e.if((0,Mt.not)(s),l)})}}It.validateArray=eH;function tH(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Ow.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),l=e.name("_valid");e.block(()=>r.forEach((c,d)=>{let p=t.subschema({keyword:n,schemaProp:d,compositeRule:!0},l);e.assign(o,(0,Mt._)`${o} || ${l}`),t.mergeValidEvaluated(p,l)||e.if((0,Mt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}It.validateUnion=tH});var uO=V(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.validateKeywordUsage=Ji.validSchemaType=Ji.funcKeywordCode=Ji.macroKeywordCode=void 0;var Hr=Ge(),Da=Os(),rH=Vn(),nH=Vf();function iH(t,e){let{gen:r,keyword:n,schema:i,parentSchema:s,it:o}=t,l=e.macro.call(o.self,i,s,o),c=lO(r,n,l);o.opts.validateSchema!==!1&&o.self.validateSchema(l,!0);let d=r.name("valid");t.subschema({schema:l,schemaPath:Hr.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},d),t.pass(d,()=>t.error(!0))}Ji.macroKeywordCode=iH;function sH(t,e){var r;let{gen:n,keyword:i,schema:s,parentSchema:o,$data:l,it:c}=t;aH(c,e);let d=!l&&e.compile?e.compile.call(c.self,s,o,c):e.validate,p=lO(n,i,d),m=n.let("valid");t.block$data(m,y),t.ok((r=e.valid)!==null&&r!==void 0?r:m);function y(){if(e.errors===!1)C(),e.modifying&&aO(t),v(()=>t.error());else{let _=e.async?b():E();e.modifying&&aO(t),v(()=>oH(t,_))}}function b(){let _=n.let("ruleErrs",null);return n.try(()=>C((0,Hr._)`await `),q=>n.assign(m,!1).if((0,Hr._)`${q} instanceof ${c.ValidationError}`,()=>n.assign(_,(0,Hr._)`${q}.errors`),()=>n.throw(q))),_}function E(){let _=(0,Hr._)`${p}.errors`;return n.assign(_,null),C(Hr.nil),_}function C(_=e.async?(0,Hr._)`await `:Hr.nil){let q=c.opts.passContext?Da.default.this:Da.default.self,k=!("compile"in e&&!l||e.schema===!1);n.assign(m,(0,Hr._)`${_}${(0,rH.callValidateCode)(t,p,q,k)}`,e.modifying)}function v(_){var q;n.if((0,Hr.not)((q=e.valid)!==null&&q!==void 0?q:m),_)}}Ji.funcKeywordCode=sH;function aO(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Hr._)`${n.parentData}[${n.parentDataProperty}]`))}function oH(t,e){let{gen:r}=t;r.if((0,Hr._)`Array.isArray(${e})`,()=>{r.assign(Da.default.vErrors,(0,Hr._)`${Da.default.vErrors} === null ? ${e} : ${Da.default.vErrors}.concat(${e})`).assign(Da.default.errors,(0,Hr._)`${Da.default.vErrors}.length`),(0,nH.extendErrors)(t)},()=>t.error())}function aH({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function lO(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Hr.stringify)(r)})}function lH(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Ji.validSchemaType=lH;function uH({schema:t,opts:e,self:r,errSchemaPath:n},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(l=>!Object.prototype.hasOwnProperty.call(t,l)))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ji.validateKeywordUsage=uH});var fO=V(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.extendSubschemaMode=_o.extendSubschemaData=_o.getSubschema=void 0;var Gi=Ge(),cO=st();function cH(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:s,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let l=t.schema[e];return r===void 0?{schema:l,schemaPath:(0,Gi._)`${t.schemaPath}${(0,Gi.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:l[r],schemaPath:(0,Gi._)`${t.schemaPath}${(0,Gi.getProperty)(e)}${(0,Gi.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,cO.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||s===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}_o.getSubschema=cH;function fH(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:s,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:l}=e;if(r!==void 0){let{errorPath:d,dataPathArr:p,opts:m}=e,y=l.let("data",(0,Gi._)`${e.data}${(0,Gi.getProperty)(r)}`,!0);c(y),t.errorPath=(0,Gi.str)`${d}${(0,cO.getErrorPath)(r,n,m.jsPropertySyntax)}`,t.parentDataProperty=(0,Gi._)`${r}`,t.dataPathArr=[...p,t.parentDataProperty]}if(i!==void 0){let d=i instanceof Gi.Name?i:l.let("data",i,!0);c(d),o!==void 0&&(t.propertyName=o)}s&&(t.dataTypes=s);function c(d){t.data=d,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,d]}}_o.extendSubschemaData=fH;function dH(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:s}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}_o.extendSubschemaMode=dH});var kw=V((IQ,dO)=>{"use strict";dO.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;i--!==0;){var o=s[i];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var hO=V((PQ,pO)=>{"use strict";var Ro=pO.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};_m(e,n,i,t,"",t)};Ro.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ro.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ro.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ro.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function _m(t,e,r,n,i,s,o,l,c,d){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,s,o,l,c,d);for(var p in n){var m=n[p];if(Array.isArray(m)){if(p in Ro.arrayKeywords)for(var y=0;y<m.length;y++)_m(t,e,r,m[y],i+"/"+p+"/"+y,s,i,p,n,y)}else if(p in Ro.propsKeywords){if(m&&typeof m=="object")for(var b in m)_m(t,e,r,m[b],i+"/"+p+"/"+pH(b),s,i,p,n,b)}else(p in Ro.keywords||t.allKeys&&!(p in Ro.skipKeywords))&&_m(t,e,r,m,i+"/"+p,s,i,p,n)}r(n,i,s,o,l,c,d)}}function pH(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var zf=V(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.getSchemaRefs=nn.resolveUrl=nn.normalizeId=nn._getFullPath=nn.getFullPath=nn.inlineRef=void 0;var hH=st(),mH=kw(),gH=hO(),yH=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function vH(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Aw(t):e?mO(t)<=e:!1}nn.inlineRef=vH;var bH=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Aw(t){for(let e in t){if(bH.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Aw)||typeof r=="object"&&Aw(r))return!0}return!1}function mO(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!yH.has(r)&&(typeof t[r]=="object"&&(0,hH.eachItem)(t[r],n=>e+=mO(n)),e===1/0))return 1/0}return e}function gO(t,e="",r){r!==!1&&(e=$u(e));let n=t.parse(e);return yO(t,n)}nn.getFullPath=gO;function yO(t,e){return t.serialize(e).split("#")[0]+"#"}nn._getFullPath=yO;var SH=/#\/?$/;function $u(t){return t?t.replace(SH,""):""}nn.normalizeId=$u;function wH(t,e,r){return r=$u(r),t.resolve(e,r)}nn.resolveUrl=wH;var _H=/^[a-z_][-a-z0-9._]*$/i;function RH(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=$u(t[r]||e),s={"":i},o=gO(n,i,!1),l={},c=new Set;return gH(t,{allKeys:!0},(m,y,b,E)=>{if(E===void 0)return;let C=o+y,v=s[E];typeof m[r]=="string"&&(v=_.call(this,m[r])),q.call(this,m.$anchor),q.call(this,m.$dynamicAnchor),s[y]=v;function _(k){let O=this.opts.uriResolver.resolve;if(k=$u(v?O(v,k):k),c.has(k))throw p(k);c.add(k);let M=this.refs[k];return typeof M=="string"&&(M=this.refs[M]),typeof M=="object"?d(m,M.schema,k):k!==$u(C)&&(k[0]==="#"?(d(m,l[k],k),l[k]=m):this.refs[k]=C),k}function q(k){if(typeof k=="string"){if(!_H.test(k))throw new Error(`invalid anchor "${k}"`);_.call(this,`#${k}`)}}}),l;function d(m,y,b){if(y!==void 0&&!mH(m,y))throw p(b)}function p(m){return new Error(`reference "${m}" resolves to more than one schema`)}}nn.getSchemaRefs=RH});var Yf=V(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.getData=Co.KeywordCxt=Co.validateFunctionCode=void 0;var _O=Qq(),vO=Wf(),$w=Cw(),Rm=Wf(),CH=iO(),Gf=uO(),Tw=fO(),_e=Ge(),ke=Os(),xH=zf(),Is=st(),Jf=Vf();function EH(t){if(xO(t)&&(EO(t),CO(t))){IH(t);return}RO(t,()=>(0,_O.topBoolOrEmptySchema)(t))}Co.validateFunctionCode=EH;function RO({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},s){i.code.es5?t.func(e,(0,_e._)`${ke.default.data}, ${ke.default.valCxt}`,n.$async,()=>{t.code((0,_e._)`"use strict"; ${bO(r,i)}`),OH(t,i),t.code(s)}):t.func(e,(0,_e._)`${ke.default.data}, ${qH(i)}`,n.$async,()=>t.code(bO(r,i)).code(s))}function qH(t){return(0,_e._)`{${ke.default.instancePath}="", ${ke.default.parentData}, ${ke.default.parentDataProperty}, ${ke.default.rootData}=${ke.default.data}${t.dynamicRef?(0,_e._)`, ${ke.default.dynamicAnchors}={}`:_e.nil}}={}`}function OH(t,e){t.if(ke.default.valCxt,()=>{t.var(ke.default.instancePath,(0,_e._)`${ke.default.valCxt}.${ke.default.instancePath}`),t.var(ke.default.parentData,(0,_e._)`${ke.default.valCxt}.${ke.default.parentData}`),t.var(ke.default.parentDataProperty,(0,_e._)`${ke.default.valCxt}.${ke.default.parentDataProperty}`),t.var(ke.default.rootData,(0,_e._)`${ke.default.valCxt}.${ke.default.rootData}`),e.dynamicRef&&t.var(ke.default.dynamicAnchors,(0,_e._)`${ke.default.valCxt}.${ke.default.dynamicAnchors}`)},()=>{t.var(ke.default.instancePath,(0,_e._)`""`),t.var(ke.default.parentData,(0,_e._)`undefined`),t.var(ke.default.parentDataProperty,(0,_e._)`undefined`),t.var(ke.default.rootData,ke.default.data),e.dynamicRef&&t.var(ke.default.dynamicAnchors,(0,_e._)`{}`)})}function IH(t){let{schema:e,opts:r,gen:n}=t;RO(t,()=>{r.$comment&&e.$comment&&OO(t),$H(t),n.let(ke.default.vErrors,null),n.let(ke.default.errors,0),r.unevaluated&&PH(t),qO(t),FH(t)})}function PH(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,_e._)`${r}.evaluated`),e.if((0,_e._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,_e._)`${t.evaluated}.props`,(0,_e._)`undefined`)),e.if((0,_e._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,_e._)`${t.evaluated}.items`,(0,_e._)`undefined`))}function bO(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,_e._)`/*# sourceURL=${r} */`:_e.nil}function kH(t,e){if(xO(t)&&(EO(t),CO(t))){AH(t,e);return}(0,_O.boolOrEmptySchema)(t,e)}function CO({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function xO(t){return typeof t.schema!="boolean"}function AH(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&OO(t),NH(t),MH(t);let s=n.const("_errs",ke.default.errors);qO(t,s),n.var(e,(0,_e._)`${s} === ${ke.default.errors}`)}function EO(t){(0,Is.checkUnknownRules)(t),TH(t)}function qO(t,e){if(t.opts.jtd)return SO(t,[],!1,e);let r=(0,vO.getSchemaTypes)(t.schema),n=(0,vO.coerceAndCheckDataType)(t,r);SO(t,r,!n,e)}function TH(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Is.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function $H(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Is.checkStrictMode)(t,"default is ignored in the schema root")}function NH(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,xH.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function MH(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function OO({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let s=r.$comment;if(i.$comment===!0)t.code((0,_e._)`${ke.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){let o=(0,_e.str)`${n}/$comment`,l=t.scopeValue("root",{ref:e.root});t.code((0,_e._)`${ke.default.self}.opts.$comment(${s}, ${o}, ${l}.schema)`)}}function FH(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:s}=t;r.$async?e.if((0,_e._)`${ke.default.errors} === 0`,()=>e.return(ke.default.data),()=>e.throw((0,_e._)`new ${i}(${ke.default.vErrors})`)):(e.assign((0,_e._)`${n}.errors`,ke.default.vErrors),s.unevaluated&&DH(t),e.return((0,_e._)`${ke.default.errors} === 0`))}function DH({gen:t,evaluated:e,props:r,items:n}){r instanceof _e.Name&&t.assign((0,_e._)`${e}.props`,r),n instanceof _e.Name&&t.assign((0,_e._)`${e}.items`,n)}function SO(t,e,r,n){let{gen:i,schema:s,data:o,allErrors:l,opts:c,self:d}=t,{RULES:p}=d;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Is.schemaHasRulesButRef)(s,p))){i.block(()=>PO(t,"$ref",p.all.$ref.definition));return}c.jtd||jH(t,e),i.block(()=>{for(let y of p.rules)m(y);m(p.post)});function m(y){(0,$w.shouldUseGroup)(s,y)&&(y.type?(i.if((0,Rm.checkDataType)(y.type,o,c.strictNumbers)),wO(t,y),e.length===1&&e[0]===y.type&&r&&(i.else(),(0,Rm.reportTypeError)(t)),i.endIf()):wO(t,y),l||i.if((0,_e._)`${ke.default.errors} === ${n||0}`))}}function wO(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,CH.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,$w.shouldUseRule)(n,s)&&PO(t,s.keyword,s.definition,e.type)})}function jH(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(LH(t,e),t.opts.allowUnionTypes||UH(t,e),HH(t,t.dataTypes))}function LH(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{IO(t.dataTypes,r)||Nw(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),VH(t,e)}}function UH(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Nw(t,"use allowUnionTypes to allow union type keyword")}function HH(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,$w.shouldUseRule)(t.schema,i)){let{type:s}=i.definition;s.length&&!s.some(o=>BH(e,o))&&Nw(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function BH(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function IO(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function VH(t,e){let r=[];for(let n of t.dataTypes)IO(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function Nw(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Is.checkStrictMode)(t,e,t.opts.strictTypes)}var Cm=class{constructor(e,r,n){if((0,Gf.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Is.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",kO(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Gf.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",ke.default.errors))}result(e,r,n){this.failResult((0,_e.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,_e.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,_e._)`${r} !== undefined && (${(0,_e.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Jf.reportExtraError:Jf.reportError)(this,this.def.error,r)}$dataError(){(0,Jf.reportError)(this,this.def.$dataError||Jf.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Jf.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=_e.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=_e.nil,r=_e.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:s,def:o}=this;n.if((0,_e.or)((0,_e._)`${i} === undefined`,r)),e!==_e.nil&&n.assign(e,!0),(s.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==_e.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:s}=this;return(0,_e.or)(o(),l());function o(){if(n.length){if(!(r instanceof _e.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,_e._)`${(0,Rm.checkDataTypes)(c,r,s.opts.strictNumbers,Rm.DataType.Wrong)}`}return _e.nil}function l(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,_e._)`!${c}(${r})`}return _e.nil}}subschema(e,r){let n=(0,Tw.getSubschema)(this.it,e);(0,Tw.extendSubschemaData)(n,this.it,e),(0,Tw.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return kH(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Is.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Is.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,_e.Name)),!0}};Co.KeywordCxt=Cm;function PO(t,e,r,n){let i=new Cm(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Gf.funcKeywordCode)(i,r):"macro"in r?(0,Gf.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Gf.funcKeywordCode)(i,r)}var WH=/^\/(?:[^~]|~0|~1)*$/,zH=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function kO(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,s;if(t==="")return ke.default.rootData;if(t[0]==="/"){if(!WH.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=ke.default.rootData}else{let d=zH.exec(t);if(!d)throw new Error(`Invalid JSON-pointer: ${t}`);let p=+d[1];if(i=d[2],i==="#"){if(p>=e)throw new Error(c("property/index",p));return n[e-p]}if(p>e)throw new Error(c("data",p));if(s=r[e-p],!i)return s}let o=s,l=i.split("/");for(let d of l)d&&(s=(0,_e._)`${s}${(0,_e.getProperty)((0,Is.unescapeJsonPointer)(d))}`,o=(0,_e._)`${o} && ${s}`);return o;function c(d,p){return`Cannot access ${d} ${p} levels up, current level is ${e}`}}Co.getData=kO});var xm=V(Fw=>{"use strict";Object.defineProperty(Fw,"__esModule",{value:!0});var Mw=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Fw.default=Mw});var Kf=V(Lw=>{"use strict";Object.defineProperty(Lw,"__esModule",{value:!0});var Dw=zf(),jw=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Dw.resolveUrl)(e,r,n),this.missingSchema=(0,Dw.normalizeId)((0,Dw.getFullPath)(e,this.missingRef))}};Lw.default=jw});var qm=V(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.resolveSchema=Wn.getCompilingSchema=Wn.resolveRef=Wn.compileSchema=Wn.SchemaEnv=void 0;var fi=Ge(),JH=xm(),ja=Os(),di=zf(),AO=st(),GH=Yf(),Nu=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,di.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Wn.SchemaEnv=Nu;function Hw(t){let e=TO.call(this,t);if(e)return e;let r=(0,di.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new fi.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),l;t.$async&&(l=o.scopeValue("Error",{ref:JH.default,code:(0,fi._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let d={gen:o,allErrors:this.opts.allErrors,data:ja.default.data,parentData:ja.default.parentData,parentDataProperty:ja.default.parentDataProperty,dataNames:[ja.default.data],dataPathArr:[fi.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,fi.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:l,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:fi.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,fi._)`""`,opts:this.opts,self:this},p;try{this._compilations.add(t),(0,GH.validateFunctionCode)(d),o.optimize(this.opts.code.optimize);let m=o.toString();p=`${o.scopeRefs(ja.default.scope)}return ${m}`,this.opts.code.process&&(p=this.opts.code.process(p,t));let b=new Function(`${ja.default.self}`,`${ja.default.scope}`,p)(this,this.scope.get());if(this.scope.value(c,{ref:b}),b.errors=null,b.schema=t.schema,b.schemaEnv=t,t.$async&&(b.$async=!0),this.opts.code.source===!0&&(b.source={validateName:c,validateCode:m,scopeValues:o._values}),this.opts.unevaluated){let{props:E,items:C}=d;b.evaluated={props:E instanceof fi.Name?void 0:E,items:C instanceof fi.Name?void 0:C,dynamicProps:E instanceof fi.Name,dynamicItems:C instanceof fi.Name},b.source&&(b.source.evaluated=(0,fi.stringify)(b.evaluated))}return t.validate=b,t}catch(m){throw delete t.validate,delete t.validateName,p&&this.logger.error("Error compiling schema, function code:",p),m}finally{this._compilations.delete(t)}}Wn.compileSchema=Hw;function YH(t,e,r){var n;r=(0,di.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let s=ZH.call(this,t,r);if(s===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:l}=this.opts;o&&(s=new Nu({schema:o,schemaId:l,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=KH.call(this,s)}Wn.resolveRef=YH;function KH(t){return(0,di.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Hw.call(this,t)}function TO(t){for(let e of this._compilations)if(QH(e,t))return e}Wn.getCompilingSchema=TO;function QH(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function ZH(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Em.call(this,t,e)}function Em(t,e){let r=this.opts.uriResolver.parse(e),n=(0,di._getFullPath)(this.opts.uriResolver,r),i=(0,di.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return Uw.call(this,r,t);let s=(0,di.normalizeId)(n),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){let l=Em.call(this,t,o);return typeof l?.schema!="object"?void 0:Uw.call(this,r,l)}if(typeof o?.schema=="object"){if(o.validate||Hw.call(this,o),s===(0,di.normalizeId)(e)){let{schema:l}=o,{schemaId:c}=this.opts,d=l[c];return d&&(i=(0,di.resolveUrl)(this.opts.uriResolver,i,d)),new Nu({schema:l,schemaId:c,root:t,baseId:i})}return Uw.call(this,r,o)}}Wn.resolveSchema=Em;var XH=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Uw(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let l of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,AO.unescapeFragment)(l)];if(c===void 0)return;r=c;let d=typeof r=="object"&&r[this.opts.schemaId];!XH.has(l)&&d&&(e=(0,di.resolveUrl)(this.opts.uriResolver,e,d))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,AO.schemaHasRulesButRef)(r,this.RULES)){let l=(0,di.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=Em.call(this,n,l)}let{schemaId:o}=this.opts;if(s=s||new Nu({schema:r,schemaId:o,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var $O=V((MQ,eB)=>{eB.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Ww=V((FQ,LO)=>{"use strict";var tB=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),MO=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),Bw=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),FO=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),rB=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Vw(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var nB=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function NO(t){return t.length=0,!0}function iB(t,e,r){if(t.length){let n=Vw(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function sB(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],s=!1,o=!1,l=iB;for(let c=0;c<t.length;c++){let d=t[c];if(!(d==="["||d==="]"))if(d===":"){if(s===!0&&(o=!0),!l(i,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),n.push(":");continue}else if(d==="%"){if(!l(i,n,r))break;l=NO}else{i.push(d);continue}}return i.length&&(l===NO?r.zone=i.join(""):o?n.push(i.join("")):n.push(Vw(i))),r.address=n.join(""),r}function DO(t){if(oB(t,":")<2)return{host:t,isIPV6:!1};let e=sB(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function oB(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function aB(t){let e=t,r=[],n=-1,i=0;for(;i=e.length;){if(i===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(i===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(i===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}var lB={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},uB=/[@/?#:]/g,cB=/[@/?#]/g;function jO(t,e){let r=e?cB:uB;return r.lastIndex=0,t.replace(r,n=>lB[n])}function fB(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let i=t.slice(n+1,n+3);if(Bw(i)){let s=i.toUpperCase(),o=String.fromCharCode(parseInt(s,16));e&&FO(o)?r+=o:r+="%"+s,n+=2;continue}}r+=t[n]}return r}function dB(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(Bw(n)){let i=n.toUpperCase(),s=String.fromCharCode(parseInt(i,16));s!=="."&&FO(s)?e+=s:e+="%"+i,r+=2;continue}}rB(t[r])?e+=t[r]:e+=escape(t[r])}return e}function pB(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(Bw(n)){e+="%"+n.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function hB(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!MO(r)){let n=DO(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=jO(r,!1)}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}LO.exports={nonSimpleDomain:nB,recomposeAuthority:hB,reescapeHostDelimiters:jO,normalizePercentEncoding:fB,normalizePathEncoding:dB,escapePreservingEscapes:pB,removeDotSegments:aB,isIPv4:MO,isUUID:tB,normalizeIPv6:DO,stringArrayToHexStripped:Vw}});var WO=V((DQ,VO)=>{"use strict";var{isUUID:mB}=Ww(),gB=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,yB=["http","https","ws","wss","urn","urn:uuid"];function vB(t){return yB.indexOf(t)!==-1}function zw(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function UO(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function HO(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function bB(t){return t.secure=zw(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function SB(t){if((t.port===(zw(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function wB(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(gB);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,s=Jw(i);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function _B(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,s=Jw(i);s&&(t=s.serialize(t,e));let o=t,l=t.nss;return o.path=`${n||e.nid}:${l}`,e.skipEscape=!0,o}function RB(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!mB(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function CB(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var BO={scheme:"http",domainHost:!0,parse:UO,serialize:HO},xB={scheme:"https",domainHost:BO.domainHost,parse:UO,serialize:HO},Om={scheme:"ws",domainHost:!0,parse:bB,serialize:SB},EB={scheme:"wss",domainHost:Om.domainHost,parse:Om.parse,serialize:Om.serialize},qB={scheme:"urn",parse:wB,serialize:_B,skipNormalize:!0},OB={scheme:"urn:uuid",parse:RB,serialize:CB,skipNormalize:!0},Im={http:BO,https:xB,ws:Om,wss:EB,urn:qB,"urn:uuid":OB};Object.setPrototypeOf(Im,null);function Jw(t){return t&&(Im[t]||Im[t.toLowerCase()])||void 0}VO.exports={wsIsSecure:zw,SCHEMES:Im,isValidSchemeName:vB,getSchemeHandler:Jw}});var QO=V((jQ,Pm)=>{"use strict";var{normalizeIPv6:IB,removeDotSegments:Qf,recomposeAuthority:PB,normalizePercentEncoding:kB,normalizePathEncoding:AB,escapePreservingEscapes:TB,reescapeHostDelimiters:$B,isIPv4:NB,nonSimpleDomain:MB}=Ww(),{SCHEMES:FB,getSchemeHandler:JO}=WO();function DB(t,e){return typeof t=="string"?t=BB(t,e):typeof t=="object"&&(t=Mu(La(t,e),e)),t}function jB(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=GO(Mu(t,n),Mu(e,n),n,!0);return n.skipEscape=!0,La(i,n)}function GO(t,e,r,n){let i={};return n||(t=Mu(La(t,r),r),e=Mu(La(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Qf(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Qf(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=Qf(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=Qf(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function LB(t,e,r){let n=zO(t,r),i=zO(e,r);return n!==void 0&&i!==void 0&&n.toLowerCase()===i.toLowerCase()}function La(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],s=JO(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=kB(r.path):(r.path=TB(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=PB(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let l=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(l=Qf(l)),o===void 0&&l[0]==="/"&&l[1]==="/"&&(l="/%2F"+l.slice(2)),i.push(l)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var UB=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function HB(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function YO(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let o=t.match(UB);if(o){n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]);let l=HB(n,o);if(l!==void 0&&(n.error=n.error||l,i=!0),n.host)if(NB(n.host)===!1){let p=IB(n.host);n.host=p.host.toLowerCase(),s=p.isIPV6}else s=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let c=JO(r.scheme||n.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&n.host&&(r.domainHost||c&&c.domainHost)&&s===!1&&MB(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(d){n.error=n.error||"Host's domain name can not be converted to ASCII: "+d}if((!c||c&&!c.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=$B(unescape(n.host),s))),n.path&&(n.path=AB(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}c&&c.parse&&c.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:i}}function Mu(t,e){return YO(t,e).parsed}function BB(t,e){return KO(t,e).normalized}function KO(t,e){let{parsed:r,malformedAuthorityOrPort:n}=YO(t,e);return{normalized:n?t:La(r,e),malformedAuthorityOrPort:n}}function zO(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:n}=KO(t,e);return n?void 0:r}if(typeof t=="object")return La(t,e)}var Gw={SCHEMES:FB,normalize:DB,resolve:jB,resolveComponent:GO,equal:LB,serialize:La,parse:Mu};Pm.exports=Gw;Pm.exports.default=Gw;Pm.exports.fastUri=Gw});var XO=V(Yw=>{"use strict";Object.defineProperty(Yw,"__esModule",{value:!0});var ZO=QO();ZO.code='require("ajv/dist/runtime/uri").default';Yw.default=ZO});var aI=V(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.CodeGen=hr.Name=hr.nil=hr.stringify=hr.str=hr._=hr.KeywordCxt=void 0;var VB=Yf();Object.defineProperty(hr,"KeywordCxt",{enumerable:!0,get:function(){return VB.KeywordCxt}});var Fu=Ge();Object.defineProperty(hr,"_",{enumerable:!0,get:function(){return Fu._}});Object.defineProperty(hr,"str",{enumerable:!0,get:function(){return Fu.str}});Object.defineProperty(hr,"stringify",{enumerable:!0,get:function(){return Fu.stringify}});Object.defineProperty(hr,"nil",{enumerable:!0,get:function(){return Fu.nil}});Object.defineProperty(hr,"Name",{enumerable:!0,get:function(){return Fu.Name}});Object.defineProperty(hr,"CodeGen",{enumerable:!0,get:function(){return Fu.CodeGen}});var WB=xm(),iI=Kf(),zB=Rw(),Zf=qm(),JB=Ge(),Xf=zf(),km=Wf(),Qw=st(),eI=$O(),GB=XO(),sI=(t,e)=>new RegExp(t,e);sI.code="new RegExp";var YB=["removeAdditional","useDefaults","coerceTypes"],KB=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),QB={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},ZB={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},tI=200;function XB(t){var e,r,n,i,s,o,l,c,d,p,m,y,b,E,C,v,_,q,k,O,M,j,I,R,A;let F=t.strict,U=(e=t.code)===null||e===void 0?void 0:e.optimize,D=U===!0||U===void 0?1:U||0,J=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:sI,Q=(i=t.uriResolver)!==null&&i!==void 0?i:GB.default;return{strictSchema:(o=(s=t.strictSchema)!==null&&s!==void 0?s:F)!==null&&o!==void 0?o:!0,strictNumbers:(c=(l=t.strictNumbers)!==null&&l!==void 0?l:F)!==null&&c!==void 0?c:!0,strictTypes:(p=(d=t.strictTypes)!==null&&d!==void 0?d:F)!==null&&p!==void 0?p:"log",strictTuples:(y=(m=t.strictTuples)!==null&&m!==void 0?m:F)!==null&&y!==void 0?y:"log",strictRequired:(E=(b=t.strictRequired)!==null&&b!==void 0?b:F)!==null&&E!==void 0?E:!1,code:t.code?{...t.code,optimize:D,regExp:J}:{optimize:D,regExp:J},loopRequired:(C=t.loopRequired)!==null&&C!==void 0?C:tI,loopEnum:(v=t.loopEnum)!==null&&v!==void 0?v:tI,meta:(_=t.meta)!==null&&_!==void 0?_:!0,messages:(q=t.messages)!==null&&q!==void 0?q:!0,inlineRefs:(k=t.inlineRefs)!==null&&k!==void 0?k:!0,schemaId:(O=t.schemaId)!==null&&O!==void 0?O:"$id",addUsedSchema:(M=t.addUsedSchema)!==null&&M!==void 0?M:!0,validateSchema:(j=t.validateSchema)!==null&&j!==void 0?j:!0,validateFormats:(I=t.validateFormats)!==null&&I!==void 0?I:!0,unicodeRegExp:(R=t.unicodeRegExp)!==null&&R!==void 0?R:!0,int32range:(A=t.int32range)!==null&&A!==void 0?A:!0,uriResolver:Q}}var ed=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...XB(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new JB.ValueScope({scope:{},prefixes:KB,es5:r,lines:n}),this.logger=sV(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,zB.getRules)(),rI.call(this,QB,e,"NOT SUPPORTED"),rI.call(this,ZB,e,"DEPRECATED","warn"),this._metaOpts=nV.call(this),e.formats&&tV.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&rV.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),eV.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=eI;n==="id"&&(i={...eI},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(p,m){await s.call(this,p.$schema);let y=this._addSchema(p,m);return y.validate||o.call(this,y)}async function s(p){p&&!this.getSchema(p)&&await i.call(this,{$ref:p},!0)}async function o(p){try{return this._compileSchemaEnv(p)}catch(m){if(!(m instanceof iI.default))throw m;return l.call(this,m),await c.call(this,m.missingSchema),o.call(this,p)}}function l({missingSchema:p,missingRef:m}){if(this.refs[p])throw new Error(`AnySchema ${p} is loaded but ${m} cannot be resolved`)}async function c(p){let m=await d.call(this,p);this.refs[p]||await s.call(this,m.$schema),this.refs[p]||this.addSchema(m,p,r)}async function d(p){let m=this._loading[p];if(m)return m;try{return await(this._loading[p]=n(p))}finally{delete this._loading[p]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let s;if(typeof e=="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw new Error(`schema ${o} must be string`)}return r=(0,Xf.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return i}getSchema(e){let r;for(;typeof(r=nI.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new Zf.SchemaEnv({schema:{},schemaId:n});if(r=Zf.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=nI.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Xf.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(aV.call(this,n,r),!r)return(0,Qw.eachItem)(n,s=>Kw.call(this,s)),this;uV.call(this,r);let i={...r,type:(0,km.getJSONTypes)(r.type),schemaType:(0,km.getJSONTypes)(r.schemaType)};return(0,Qw.eachItem)(n,i.type.length===0?s=>Kw.call(this,s,i):s=>i.type.forEach(o=>Kw.call(this,s,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(s=>s.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,s)=>i+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let s=i.split("/").slice(1),o=e;for(let l of s)o=o[l];for(let l in n){let c=n[l];if(typeof c!="object")continue;let{$data:d}=c.definition,p=o[l];d&&p&&(o[l]=oI(p))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:l}=this.opts;if(typeof e=="object")o=e[l];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Xf.normalizeId)(o||n);let d=Xf.getSchemaRefs.call(this,e,n);return c=new Zf.SchemaEnv({schema:e,schemaId:l,meta:r,baseId:n,localRefs:d}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Zf.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Zf.compileSchema.call(this,e)}finally{this.opts=r}}};ed.ValidationError=WB.default;ed.MissingRefError=iI.default;hr.default=ed;function rI(t,e,r,n="error"){for(let i in t){let s=i;s in e&&this.logger[n](`${r}: option ${i}. ${t[s]}`)}}function nI(t){return t=(0,Xf.normalizeId)(t),this.schemas[t]||this.refs[t]}function eV(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function tV(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function rV(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function nV(){let t={...this.opts};for(let e of YB)delete t[e];return t}var iV={log(){},warn(){},error(){}};function sV(t){if(t===!1)return iV;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var oV=/^[a-z_$][a-z0-9_$:-]*$/i;function aV(t,e){let{RULES:r}=this;if((0,Qw.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!oV.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Kw(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,o=i?s.post:s.rules.find(({type:c})=>c===r);if(o||(o={type:r,rules:[]},s.rules.push(o)),s.keywords[t]=!0,!e)return;let l={keyword:t,definition:{...e,type:(0,km.getJSONTypes)(e.type),schemaType:(0,km.getJSONTypes)(e.schemaType)}};e.before?lV.call(this,o,l,e.before):o.rules.push(l),s.all[t]=l,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function lV(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function uV(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=oI(e)),t.validateSchema=this.compile(e,!0))}var cV={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function oI(t){return{anyOf:[t,cV]}}});var lI=V(Zw=>{"use strict";Object.defineProperty(Zw,"__esModule",{value:!0});var fV={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Zw.default=fV});var dI=V(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});Ua.callRef=Ua.getValidate=void 0;var dV=Kf(),uI=Vn(),sn=Ge(),Du=Os(),cI=qm(),Am=st(),pV={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:s,validateName:o,opts:l,self:c}=n,{root:d}=s;if((r==="#"||r==="#/")&&i===d.baseId)return m();let p=cI.resolveRef.call(c,d,i,r);if(p===void 0)throw new dV.default(n.opts.uriResolver,i,r);if(p instanceof cI.SchemaEnv)return y(p);return b(p);function m(){if(s===d)return Tm(t,o,s,s.$async);let E=e.scopeValue("root",{ref:d});return Tm(t,(0,sn._)`${E}.validate`,d,d.$async)}function y(E){let C=fI(t,E);Tm(t,C,E,E.$async)}function b(E){let C=e.scopeValue("schema",l.code.source===!0?{ref:E,code:(0,sn.stringify)(E)}:{ref:E}),v=e.name("valid"),_=t.subschema({schema:E,dataTypes:[],schemaPath:sn.nil,topSchemaRef:C,errSchemaPath:r},v);t.mergeEvaluated(_),t.ok(v)}}};function fI(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,sn._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Ua.getValidate=fI;function Tm(t,e,r,n){let{gen:i,it:s}=t,{allErrors:o,schemaEnv:l,opts:c}=s,d=c.passContext?Du.default.this:sn.nil;n?p():m();function p(){if(!l.$async)throw new Error("async schema referenced by sync schema");let E=i.let("valid");i.try(()=>{i.code((0,sn._)`await ${(0,uI.callValidateCode)(t,e,d)}`),b(e),o||i.assign(E,!0)},C=>{i.if((0,sn._)`!(${C} instanceof ${s.ValidationError})`,()=>i.throw(C)),y(C),o||i.assign(E,!1)}),t.ok(E)}function m(){t.result((0,uI.callValidateCode)(t,e,d),()=>b(e),()=>y(e))}function y(E){let C=(0,sn._)`${E}.errors`;i.assign(Du.default.vErrors,(0,sn._)`${Du.default.vErrors} === null ? ${C} : ${Du.default.vErrors}.concat(${C})`),i.assign(Du.default.errors,(0,sn._)`${Du.default.vErrors}.length`)}function b(E){var C;if(!s.opts.unevaluated)return;let v=(C=r?.validate)===null||C===void 0?void 0:C.evaluated;if(s.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(s.props=Am.mergeEvaluated.props(i,v.props,s.props));else{let _=i.var("props",(0,sn._)`${E}.evaluated.props`);s.props=Am.mergeEvaluated.props(i,_,s.props,sn.Name)}if(s.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(s.items=Am.mergeEvaluated.items(i,v.items,s.items));else{let _=i.var("items",(0,sn._)`${E}.evaluated.items`);s.items=Am.mergeEvaluated.items(i,_,s.items,sn.Name)}}}Ua.callRef=Tm;Ua.default=pV});var pI=V(Xw=>{"use strict";Object.defineProperty(Xw,"__esModule",{value:!0});var hV=lI(),mV=dI(),gV=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",hV.default,mV.default];Xw.default=gV});var hI=V(e0=>{"use strict";Object.defineProperty(e0,"__esModule",{value:!0});var $m=Ge(),xo=$m.operators,Nm={maximum:{okStr:"<=",ok:xo.LTE,fail:xo.GT},minimum:{okStr:">=",ok:xo.GTE,fail:xo.LT},exclusiveMaximum:{okStr:"<",ok:xo.LT,fail:xo.GTE},exclusiveMinimum:{okStr:">",ok:xo.GT,fail:xo.LTE}},yV={message:({keyword:t,schemaCode:e})=>(0,$m.str)`must be ${Nm[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,$m._)`{comparison: ${Nm[t].okStr}, limit: ${e}}`},vV={keyword:Object.keys(Nm),type:"number",schemaType:"number",$data:!0,error:yV,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,$m._)`${r} ${Nm[e].fail} ${n} || isNaN(${r})`)}};e0.default=vV});var mI=V(t0=>{"use strict";Object.defineProperty(t0,"__esModule",{value:!0});var td=Ge(),bV={message:({schemaCode:t})=>(0,td.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,td._)`{multipleOf: ${t}}`},SV={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:bV,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),l=s?(0,td._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,td._)`${o} !== parseInt(${o})`;t.fail$data((0,td._)`(${n} === 0 || (${o} = ${r}/${n}, ${l}))`)}};t0.default=SV});var yI=V(r0=>{"use strict";Object.defineProperty(r0,"__esModule",{value:!0});function gI(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}r0.default=gI;gI.code='require("ajv/dist/runtime/ucs2length").default'});var vI=V(n0=>{"use strict";Object.defineProperty(n0,"__esModule",{value:!0});var Ha=Ge(),wV=st(),_V=yI(),RV={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Ha.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Ha._)`{limit: ${t}}`},CV={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:RV,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,s=e==="maxLength"?Ha.operators.GT:Ha.operators.LT,o=i.opts.unicode===!1?(0,Ha._)`${r}.length`:(0,Ha._)`${(0,wV.useFunc)(t.gen,_V.default)}(${r})`;t.fail$data((0,Ha._)`${o} ${s} ${n}`)}};n0.default=CV});var bI=V(i0=>{"use strict";Object.defineProperty(i0,"__esModule",{value:!0});var xV=Vn(),EV=st(),ju=Ge(),qV={message:({schemaCode:t})=>(0,ju.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,ju._)`{pattern: ${t}}`},OV={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:qV,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t,l=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=o.opts.code,d=c.code==="new RegExp"?(0,ju._)`new RegExp`:(0,EV.useFunc)(e,c),p=e.let("valid");e.try(()=>e.assign(p,(0,ju._)`${d}(${s}, ${l}).test(${r})`),()=>e.assign(p,!1)),t.fail$data((0,ju._)`!${p}`)}else{let c=(0,xV.usePattern)(t,i);t.fail$data((0,ju._)`!${c}.test(${r})`)}}};i0.default=OV});var SI=V(s0=>{"use strict";Object.defineProperty(s0,"__esModule",{value:!0});var rd=Ge(),IV={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,rd.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,rd._)`{limit: ${t}}`},PV={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:IV,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?rd.operators.GT:rd.operators.LT;t.fail$data((0,rd._)`Object.keys(${r}).length ${i} ${n}`)}};s0.default=PV});var wI=V(o0=>{"use strict";Object.defineProperty(o0,"__esModule",{value:!0});var nd=Vn(),id=Ge(),kV=st(),AV={message:({params:{missingProperty:t}})=>(0,id.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,id._)`{missingProperty: ${t}}`},TV={keyword:"required",type:"object",schemaType:"array",$data:!0,error:AV,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:s,it:o}=t,{opts:l}=o;if(!s&&r.length===0)return;let c=r.length>=l.loopRequired;if(o.allErrors?d():p(),l.strictRequired){let b=t.parentSchema.properties,{definedProperties:E}=t.it;for(let C of r)if(b?.[C]===void 0&&!E.has(C)){let v=o.schemaEnv.baseId+o.errSchemaPath,_=`required property "${C}" is not defined at "${v}" (strictRequired)`;(0,kV.checkStrictMode)(o,_,o.opts.strictRequired)}}function d(){if(c||s)t.block$data(id.nil,m);else for(let b of r)(0,nd.checkReportMissingProp)(t,b)}function p(){let b=e.let("missing");if(c||s){let E=e.let("valid",!0);t.block$data(E,()=>y(b,E)),t.ok(E)}else e.if((0,nd.checkMissingProp)(t,r,b)),(0,nd.reportMissingProp)(t,b),e.else()}function m(){e.forOf("prop",n,b=>{t.setParams({missingProperty:b}),e.if((0,nd.noPropertyInData)(e,i,b,l.ownProperties),()=>t.error())})}function y(b,E){t.setParams({missingProperty:b}),e.forOf(b,n,()=>{e.assign(E,(0,nd.propertyInData)(e,i,b,l.ownProperties)),e.if((0,id.not)(E),()=>{t.error(),e.break()})},id.nil)}}};o0.default=TV});var _I=V(a0=>{"use strict";Object.defineProperty(a0,"__esModule",{value:!0});var sd=Ge(),$V={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,sd.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,sd._)`{limit: ${t}}`},NV={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:$V,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?sd.operators.GT:sd.operators.LT;t.fail$data((0,sd._)`${r}.length ${i} ${n}`)}};a0.default=NV});var Mm=V(l0=>{"use strict";Object.defineProperty(l0,"__esModule",{value:!0});var RI=kw();RI.code='require("ajv/dist/runtime/equal").default';l0.default=RI});var CI=V(c0=>{"use strict";Object.defineProperty(c0,"__esModule",{value:!0});var u0=Wf(),mr=Ge(),MV=st(),FV=Mm(),DV={message:({params:{i:t,j:e}})=>(0,mr.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,mr._)`{i: ${t}, j: ${e}}`},jV={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:DV,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:s,schemaCode:o,it:l}=t;if(!n&&!i)return;let c=e.let("valid"),d=s.items?(0,u0.getSchemaTypes)(s.items):[];t.block$data(c,p,(0,mr._)`${o} === false`),t.ok(c);function p(){let E=e.let("i",(0,mr._)`${r}.length`),C=e.let("j");t.setParams({i:E,j:C}),e.assign(c,!0),e.if((0,mr._)`${E} > 1`,()=>(m()?y:b)(E,C))}function m(){return d.length>0&&!d.some(E=>E==="object"||E==="array")}function y(E,C){let v=e.name("item"),_=(0,u0.checkDataTypes)(d,v,l.opts.strictNumbers,u0.DataType.Wrong),q=e.const("indices",(0,mr._)`{}`);e.for((0,mr._)`;${E}--;`,()=>{e.let(v,(0,mr._)`${r}[${E}]`),e.if(_,(0,mr._)`continue`),d.length>1&&e.if((0,mr._)`typeof ${v} == "string"`,(0,mr._)`${v} += "_"`),e.if((0,mr._)`typeof ${q}[${v}] == "number"`,()=>{e.assign(C,(0,mr._)`${q}[${v}]`),t.error(),e.assign(c,!1).break()}).code((0,mr._)`${q}[${v}] = ${E}`)})}function b(E,C){let v=(0,MV.useFunc)(e,FV.default),_=e.name("outer");e.label(_).for((0,mr._)`;${E}--;`,()=>e.for((0,mr._)`${C} = ${E}; ${C}--;`,()=>e.if((0,mr._)`${v}(${r}[${E}], ${r}[${C}])`,()=>{t.error(),e.assign(c,!1).break(_)})))}}};c0.default=jV});var xI=V(d0=>{"use strict";Object.defineProperty(d0,"__esModule",{value:!0});var f0=Ge(),LV=st(),UV=Mm(),HV={message:"must be equal to constant",params:({schemaCode:t})=>(0,f0._)`{allowedValue: ${t}}`},BV={keyword:"const",$data:!0,error:HV,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,f0._)`!${(0,LV.useFunc)(e,UV.default)}(${r}, ${i})`):t.fail((0,f0._)`${s} !== ${r}`)}};d0.default=BV});var EI=V(p0=>{"use strict";Object.defineProperty(p0,"__esModule",{value:!0});var od=Ge(),VV=st(),WV=Mm(),zV={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,od._)`{allowedValues: ${t}}`},JV={keyword:"enum",schemaType:"array",$data:!0,error:zV,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let l=i.length>=o.opts.loopEnum,c,d=()=>c??(c=(0,VV.useFunc)(e,WV.default)),p;if(l||n)p=e.let("valid"),t.block$data(p,m);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let b=e.const("vSchema",s);p=(0,od.or)(...i.map((E,C)=>y(b,C)))}t.pass(p);function m(){e.assign(p,!1),e.forOf("v",s,b=>e.if((0,od._)`${d()}(${r}, ${b})`,()=>e.assign(p,!0).break()))}function y(b,E){let C=i[E];return typeof C=="object"&&C!==null?(0,od._)`${d()}(${r}, ${b}[${E}])`:(0,od._)`${r} === ${C}`}}};p0.default=JV});var qI=V(h0=>{"use strict";Object.defineProperty(h0,"__esModule",{value:!0});var GV=hI(),YV=mI(),KV=vI(),QV=bI(),ZV=SI(),XV=wI(),eW=_I(),tW=CI(),rW=xI(),nW=EI(),iW=[GV.default,YV.default,KV.default,QV.default,ZV.default,XV.default,eW.default,tW.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},rW.default,nW.default];h0.default=iW});var g0=V(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.validateAdditionalItems=void 0;var Ba=Ge(),m0=st(),sW={message:({params:{len:t}})=>(0,Ba.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Ba._)`{limit: ${t}}`},oW={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:sW,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,m0.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}OI(t,n)}};function OI(t,e){let{gen:r,schema:n,data:i,keyword:s,it:o}=t;o.items=!0;let l=r.const("len",(0,Ba._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Ba._)`${l} <= ${e.length}`);else if(typeof n=="object"&&!(0,m0.alwaysValidSchema)(o,n)){let d=r.var("valid",(0,Ba._)`${l} <= ${e.length}`);r.if((0,Ba.not)(d),()=>c(d)),t.ok(d)}function c(d){r.forRange("i",e.length,l,p=>{t.subschema({keyword:s,dataProp:p,dataPropType:m0.Type.Num},d),o.allErrors||r.if((0,Ba.not)(d),()=>r.break())})}}ad.validateAdditionalItems=OI;ad.default=oW});var y0=V(ld=>{"use strict";Object.defineProperty(ld,"__esModule",{value:!0});ld.validateTuple=void 0;var II=Ge(),Fm=st(),aW=Vn(),lW={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return PI(t,"additionalItems",e);r.items=!0,!(0,Fm.alwaysValidSchema)(r,e)&&t.ok((0,aW.validateArray)(t))}};function PI(t,e,r=t.schema){let{gen:n,parentSchema:i,data:s,keyword:o,it:l}=t;p(i),l.opts.unevaluated&&r.length&&l.items!==!0&&(l.items=Fm.mergeEvaluated.items(n,r.length,l.items));let c=n.name("valid"),d=n.const("len",(0,II._)`${s}.length`);r.forEach((m,y)=>{(0,Fm.alwaysValidSchema)(l,m)||(n.if((0,II._)`${d} > ${y}`,()=>t.subschema({keyword:o,schemaProp:y,dataProp:y},c)),t.ok(c))});function p(m){let{opts:y,errSchemaPath:b}=l,E=r.length,C=E===m.minItems&&(E===m.maxItems||m[e]===!1);if(y.strictTuples&&!C){let v=`"${o}" is ${E}-tuple, but minItems or maxItems/${e} are not specified or different at path "${b}"`;(0,Fm.checkStrictMode)(l,v,y.strictTuples)}}}ld.validateTuple=PI;ld.default=lW});var kI=V(v0=>{"use strict";Object.defineProperty(v0,"__esModule",{value:!0});var uW=y0(),cW={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,uW.validateTuple)(t,"items")};v0.default=cW});var TI=V(b0=>{"use strict";Object.defineProperty(b0,"__esModule",{value:!0});var AI=Ge(),fW=st(),dW=Vn(),pW=g0(),hW={message:({params:{len:t}})=>(0,AI.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,AI._)`{limit: ${t}}`},mW={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:hW,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,fW.alwaysValidSchema)(n,e)&&(i?(0,pW.validateAdditionalItems)(t,i):t.ok((0,dW.validateArray)(t)))}};b0.default=mW});var $I=V(S0=>{"use strict";Object.defineProperty(S0,"__esModule",{value:!0});var zn=Ge(),Dm=st(),gW={message:({params:{min:t,max:e}})=>e===void 0?(0,zn.str)`must contain at least ${t} valid item(s)`:(0,zn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,zn._)`{minContains: ${t}}`:(0,zn._)`{minContains: ${t}, maxContains: ${e}}`},yW={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:gW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t,o,l,{minContains:c,maxContains:d}=n;s.opts.next?(o=c===void 0?1:c,l=d):o=1;let p=e.const("len",(0,zn._)`${i}.length`);if(t.setParams({min:o,max:l}),l===void 0&&o===0){(0,Dm.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&o>l){(0,Dm.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Dm.alwaysValidSchema)(s,r)){let C=(0,zn._)`${p} >= ${o}`;l!==void 0&&(C=(0,zn._)`${C} && ${p} <= ${l}`),t.pass(C);return}s.items=!0;let m=e.name("valid");l===void 0&&o===1?b(m,()=>e.if(m,()=>e.break())):o===0?(e.let(m,!0),l!==void 0&&e.if((0,zn._)`${i}.length > 0`,y)):(e.let(m,!1),y()),t.result(m,()=>t.reset());function y(){let C=e.name("_valid"),v=e.let("count",0);b(C,()=>e.if(C,()=>E(v)))}function b(C,v){e.forRange("i",0,p,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:Dm.Type.Num,compositeRule:!0},C),v()})}function E(C){e.code((0,zn._)`${C}++`),l===void 0?e.if((0,zn._)`${C} >= ${o}`,()=>e.assign(m,!0).break()):(e.if((0,zn._)`${C} > ${l}`,()=>e.assign(m,!1).break()),o===1?e.assign(m,!0):e.if((0,zn._)`${C} >= ${o}`,()=>e.assign(m,!0)))}}};S0.default=yW});var FI=V(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.validateSchemaDeps=Yi.validatePropertyDeps=Yi.error=void 0;var w0=Ge(),vW=st(),ud=Vn();Yi.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,w0.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,w0._)`{property: ${t},
|
|
27
|
+
|| ${o} === "boolean" || ${i} === null`).assign(l,(0,De._)`[${i}]`)}}}function LU({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,De._)`${e} !== undefined`,()=>t.assign((0,De._)`${e}[${r}]`,n))}function xw(t,e,r,n=Au.Correct){let i=n===Au.Correct?De.operators.EQ:De.operators.NEQ,s;switch(t){case"null":return(0,De._)`${e} ${i} null`;case"array":s=(0,De._)`Array.isArray(${e})`;break;case"object":s=(0,De._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=o((0,De._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=o();break;default:return(0,De._)`typeof ${e} ${i} ${t}`}return n===Au.Correct?s:(0,De.not)(s);function o(l=De.nil){return(0,De.and)((0,De._)`typeof ${e} == "number"`,l,r?(0,De._)`isFinite(${e})`:De.nil)}}Er.checkDataType=xw;function Ew(t,e,r,n){if(t.length===1)return xw(t[0],e,r,n);let i,s=(0,eO.toHash)(t);if(s.array&&s.object){let o=(0,De._)`typeof ${e} != "object"`;i=s.null?o:(0,De._)`!${e} || ${o}`,delete s.null,delete s.array,delete s.object}else i=De.nil;s.number&&delete s.integer;for(let o in s)i=(0,De.and)(i,xw(o,e,r,n));return i}Er.checkDataTypes=Ew;var UU={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,De._)`{type: ${t}}`:(0,De._)`{type: ${e}}`};function qw(t){let e=HU(t);(0,NU.reportError)(e,UU)}Er.reportTypeError=qw;function HU(t){let{gen:e,data:r,schema:n}=t,i=(0,eO.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var iO=V(wm=>{"use strict";Object.defineProperty(wm,"__esModule",{value:!0});wm.assignDefaults=void 0;var Tu=Ge(),BU=st();function VU(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)nO(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,s)=>nO(t,s,i.default))}wm.assignDefaults=VU;function nO(t,e,r){let{gen:n,compositeRule:i,data:s,opts:o}=t;if(r===void 0)return;let l=(0,Tu._)`${s}${(0,Tu.getProperty)(e)}`;if(i){(0,BU.checkStrictMode)(t,`default is ignored for: ${l}`);return}let c=(0,Tu._)`${l} === undefined`;o.useDefaults==="empty"&&(c=(0,Tu._)`${c} || ${l} === null || ${l} === ""`),n.if(c,(0,Tu._)`${l} = ${(0,Tu.stringify)(r)}`)}});var Vn=V(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.validateUnion=It.validateArray=It.usePattern=It.callValidateCode=It.schemaProperties=It.allSchemaProperties=It.noPropertyInData=It.propertyInData=It.isOwnProperty=It.hasPropFunc=It.reportMissingProp=It.checkMissingProp=It.checkReportMissingProp=void 0;var Mt=Ge(),Ow=st(),wo=Os(),WU=st();function zU(t,e){let{gen:r,data:n,it:i}=t;r.if(Pw(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Mt._)`${e}`},!0),t.error()})}It.checkReportMissingProp=zU;function JU({gen:t,data:e,it:{opts:r}},n,i){return(0,Mt.or)(...n.map(s=>(0,Mt.and)(Pw(t,e,s,r.ownProperties),(0,Mt._)`${i} = ${s}`)))}It.checkMissingProp=JU;function GU(t,e){t.setParams({missingProperty:e},!0),t.error()}It.reportMissingProp=GU;function sO(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Mt._)`Object.prototype.hasOwnProperty`})}It.hasPropFunc=sO;function Iw(t,e,r){return(0,Mt._)`${sO(t)}.call(${e}, ${r})`}It.isOwnProperty=Iw;function YU(t,e,r,n){let i=(0,Mt._)`${e}${(0,Mt.getProperty)(r)} !== undefined`;return n?(0,Mt._)`${i} && ${Iw(t,e,r)}`:i}It.propertyInData=YU;function Pw(t,e,r,n){let i=(0,Mt._)`${e}${(0,Mt.getProperty)(r)} === undefined`;return n?(0,Mt.or)(i,(0,Mt.not)(Iw(t,e,r))):i}It.noPropertyInData=Pw;function oO(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}It.allSchemaProperties=oO;function KU(t,e){return oO(e).filter(r=>!(0,Ow.alwaysValidSchema)(t,e[r]))}It.schemaProperties=KU;function QU({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:s},it:o},l,c,d){let p=d?(0,Mt._)`${t}, ${e}, ${n}${i}`:e,m=[[wo.default.instancePath,(0,Mt.strConcat)(wo.default.instancePath,s)],[wo.default.parentData,o.parentData],[wo.default.parentDataProperty,o.parentDataProperty],[wo.default.rootData,wo.default.rootData]];o.opts.dynamicRef&&m.push([wo.default.dynamicAnchors,wo.default.dynamicAnchors]);let y=(0,Mt._)`${p}, ${r.object(...m)}`;return c!==Mt.nil?(0,Mt._)`${l}.call(${c}, ${y})`:(0,Mt._)`${l}(${y})`}It.callValidateCode=QU;var ZU=(0,Mt._)`new RegExp`;function XU({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,s=i(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,Mt._)`${i.code==="new RegExp"?ZU:(0,WU.useFunc)(t,i)}(${r}, ${n})`})}It.usePattern=XU;function eH(t){let{gen:e,data:r,keyword:n,it:i}=t,s=e.name("valid");if(i.allErrors){let l=e.let("valid",!0);return o(()=>e.assign(l,!1)),l}return e.var(s,!0),o(()=>e.break()),s;function o(l){let c=e.const("len",(0,Mt._)`${r}.length`);e.forRange("i",0,c,d=>{t.subschema({keyword:n,dataProp:d,dataPropType:Ow.Type.Num},s),e.if((0,Mt.not)(s),l)})}}It.validateArray=eH;function tH(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Ow.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),l=e.name("_valid");e.block(()=>r.forEach((c,d)=>{let p=t.subschema({keyword:n,schemaProp:d,compositeRule:!0},l);e.assign(o,(0,Mt._)`${o} || ${l}`),t.mergeValidEvaluated(p,l)||e.if((0,Mt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}It.validateUnion=tH});var uO=V(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.validateKeywordUsage=Ji.validSchemaType=Ji.funcKeywordCode=Ji.macroKeywordCode=void 0;var Hr=Ge(),Da=Os(),rH=Vn(),nH=Vf();function iH(t,e){let{gen:r,keyword:n,schema:i,parentSchema:s,it:o}=t,l=e.macro.call(o.self,i,s,o),c=lO(r,n,l);o.opts.validateSchema!==!1&&o.self.validateSchema(l,!0);let d=r.name("valid");t.subschema({schema:l,schemaPath:Hr.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},d),t.pass(d,()=>t.error(!0))}Ji.macroKeywordCode=iH;function sH(t,e){var r;let{gen:n,keyword:i,schema:s,parentSchema:o,$data:l,it:c}=t;aH(c,e);let d=!l&&e.compile?e.compile.call(c.self,s,o,c):e.validate,p=lO(n,i,d),m=n.let("valid");t.block$data(m,y),t.ok((r=e.valid)!==null&&r!==void 0?r:m);function y(){if(e.errors===!1)C(),e.modifying&&aO(t),v(()=>t.error());else{let _=e.async?b():q();e.modifying&&aO(t),v(()=>oH(t,_))}}function b(){let _=n.let("ruleErrs",null);return n.try(()=>C((0,Hr._)`await `),E=>n.assign(m,!1).if((0,Hr._)`${E} instanceof ${c.ValidationError}`,()=>n.assign(_,(0,Hr._)`${E}.errors`),()=>n.throw(E))),_}function q(){let _=(0,Hr._)`${p}.errors`;return n.assign(_,null),C(Hr.nil),_}function C(_=e.async?(0,Hr._)`await `:Hr.nil){let E=c.opts.passContext?Da.default.this:Da.default.self,k=!("compile"in e&&!l||e.schema===!1);n.assign(m,(0,Hr._)`${_}${(0,rH.callValidateCode)(t,p,E,k)}`,e.modifying)}function v(_){var E;n.if((0,Hr.not)((E=e.valid)!==null&&E!==void 0?E:m),_)}}Ji.funcKeywordCode=sH;function aO(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Hr._)`${n.parentData}[${n.parentDataProperty}]`))}function oH(t,e){let{gen:r}=t;r.if((0,Hr._)`Array.isArray(${e})`,()=>{r.assign(Da.default.vErrors,(0,Hr._)`${Da.default.vErrors} === null ? ${e} : ${Da.default.vErrors}.concat(${e})`).assign(Da.default.errors,(0,Hr._)`${Da.default.vErrors}.length`),(0,nH.extendErrors)(t)},()=>t.error())}function aH({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function lO(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Hr.stringify)(r)})}function lH(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Ji.validSchemaType=lH;function uH({schema:t,opts:e,self:r,errSchemaPath:n},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(l=>!Object.prototype.hasOwnProperty.call(t,l)))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ji.validateKeywordUsage=uH});var fO=V(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.extendSubschemaMode=_o.extendSubschemaData=_o.getSubschema=void 0;var Gi=Ge(),cO=st();function cH(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:s,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let l=t.schema[e];return r===void 0?{schema:l,schemaPath:(0,Gi._)`${t.schemaPath}${(0,Gi.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:l[r],schemaPath:(0,Gi._)`${t.schemaPath}${(0,Gi.getProperty)(e)}${(0,Gi.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,cO.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||s===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}_o.getSubschema=cH;function fH(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:s,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:l}=e;if(r!==void 0){let{errorPath:d,dataPathArr:p,opts:m}=e,y=l.let("data",(0,Gi._)`${e.data}${(0,Gi.getProperty)(r)}`,!0);c(y),t.errorPath=(0,Gi.str)`${d}${(0,cO.getErrorPath)(r,n,m.jsPropertySyntax)}`,t.parentDataProperty=(0,Gi._)`${r}`,t.dataPathArr=[...p,t.parentDataProperty]}if(i!==void 0){let d=i instanceof Gi.Name?i:l.let("data",i,!0);c(d),o!==void 0&&(t.propertyName=o)}s&&(t.dataTypes=s);function c(d){t.data=d,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,d]}}_o.extendSubschemaData=fH;function dH(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:s}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}_o.extendSubschemaMode=dH});var kw=V((IQ,dO)=>{"use strict";dO.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;i--!==0;){var o=s[i];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var hO=V((PQ,pO)=>{"use strict";var Ro=pO.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};_m(e,n,i,t,"",t)};Ro.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ro.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ro.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ro.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function _m(t,e,r,n,i,s,o,l,c,d){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,s,o,l,c,d);for(var p in n){var m=n[p];if(Array.isArray(m)){if(p in Ro.arrayKeywords)for(var y=0;y<m.length;y++)_m(t,e,r,m[y],i+"/"+p+"/"+y,s,i,p,n,y)}else if(p in Ro.propsKeywords){if(m&&typeof m=="object")for(var b in m)_m(t,e,r,m[b],i+"/"+p+"/"+pH(b),s,i,p,n,b)}else(p in Ro.keywords||t.allKeys&&!(p in Ro.skipKeywords))&&_m(t,e,r,m,i+"/"+p,s,i,p,n)}r(n,i,s,o,l,c,d)}}function pH(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var zf=V(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.getSchemaRefs=nn.resolveUrl=nn.normalizeId=nn._getFullPath=nn.getFullPath=nn.inlineRef=void 0;var hH=st(),mH=kw(),gH=hO(),yH=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function vH(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Aw(t):e?mO(t)<=e:!1}nn.inlineRef=vH;var bH=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Aw(t){for(let e in t){if(bH.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Aw)||typeof r=="object"&&Aw(r))return!0}return!1}function mO(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!yH.has(r)&&(typeof t[r]=="object"&&(0,hH.eachItem)(t[r],n=>e+=mO(n)),e===1/0))return 1/0}return e}function gO(t,e="",r){r!==!1&&(e=$u(e));let n=t.parse(e);return yO(t,n)}nn.getFullPath=gO;function yO(t,e){return t.serialize(e).split("#")[0]+"#"}nn._getFullPath=yO;var SH=/#\/?$/;function $u(t){return t?t.replace(SH,""):""}nn.normalizeId=$u;function wH(t,e,r){return r=$u(r),t.resolve(e,r)}nn.resolveUrl=wH;var _H=/^[a-z_][-a-z0-9._]*$/i;function RH(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=$u(t[r]||e),s={"":i},o=gO(n,i,!1),l={},c=new Set;return gH(t,{allKeys:!0},(m,y,b,q)=>{if(q===void 0)return;let C=o+y,v=s[q];typeof m[r]=="string"&&(v=_.call(this,m[r])),E.call(this,m.$anchor),E.call(this,m.$dynamicAnchor),s[y]=v;function _(k){let O=this.opts.uriResolver.resolve;if(k=$u(v?O(v,k):k),c.has(k))throw p(k);c.add(k);let M=this.refs[k];return typeof M=="string"&&(M=this.refs[M]),typeof M=="object"?d(m,M.schema,k):k!==$u(C)&&(k[0]==="#"?(d(m,l[k],k),l[k]=m):this.refs[k]=C),k}function E(k){if(typeof k=="string"){if(!_H.test(k))throw new Error(`invalid anchor "${k}"`);_.call(this,`#${k}`)}}}),l;function d(m,y,b){if(y!==void 0&&!mH(m,y))throw p(b)}function p(m){return new Error(`reference "${m}" resolves to more than one schema`)}}nn.getSchemaRefs=RH});var Yf=V(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.getData=Co.KeywordCxt=Co.validateFunctionCode=void 0;var _O=Qq(),vO=Wf(),$w=Cw(),Rm=Wf(),CH=iO(),Gf=uO(),Tw=fO(),_e=Ge(),ke=Os(),xH=zf(),Is=st(),Jf=Vf();function EH(t){if(xO(t)&&(EO(t),CO(t))){IH(t);return}RO(t,()=>(0,_O.topBoolOrEmptySchema)(t))}Co.validateFunctionCode=EH;function RO({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},s){i.code.es5?t.func(e,(0,_e._)`${ke.default.data}, ${ke.default.valCxt}`,n.$async,()=>{t.code((0,_e._)`"use strict"; ${bO(r,i)}`),OH(t,i),t.code(s)}):t.func(e,(0,_e._)`${ke.default.data}, ${qH(i)}`,n.$async,()=>t.code(bO(r,i)).code(s))}function qH(t){return(0,_e._)`{${ke.default.instancePath}="", ${ke.default.parentData}, ${ke.default.parentDataProperty}, ${ke.default.rootData}=${ke.default.data}${t.dynamicRef?(0,_e._)`, ${ke.default.dynamicAnchors}={}`:_e.nil}}={}`}function OH(t,e){t.if(ke.default.valCxt,()=>{t.var(ke.default.instancePath,(0,_e._)`${ke.default.valCxt}.${ke.default.instancePath}`),t.var(ke.default.parentData,(0,_e._)`${ke.default.valCxt}.${ke.default.parentData}`),t.var(ke.default.parentDataProperty,(0,_e._)`${ke.default.valCxt}.${ke.default.parentDataProperty}`),t.var(ke.default.rootData,(0,_e._)`${ke.default.valCxt}.${ke.default.rootData}`),e.dynamicRef&&t.var(ke.default.dynamicAnchors,(0,_e._)`${ke.default.valCxt}.${ke.default.dynamicAnchors}`)},()=>{t.var(ke.default.instancePath,(0,_e._)`""`),t.var(ke.default.parentData,(0,_e._)`undefined`),t.var(ke.default.parentDataProperty,(0,_e._)`undefined`),t.var(ke.default.rootData,ke.default.data),e.dynamicRef&&t.var(ke.default.dynamicAnchors,(0,_e._)`{}`)})}function IH(t){let{schema:e,opts:r,gen:n}=t;RO(t,()=>{r.$comment&&e.$comment&&OO(t),$H(t),n.let(ke.default.vErrors,null),n.let(ke.default.errors,0),r.unevaluated&&PH(t),qO(t),FH(t)})}function PH(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,_e._)`${r}.evaluated`),e.if((0,_e._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,_e._)`${t.evaluated}.props`,(0,_e._)`undefined`)),e.if((0,_e._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,_e._)`${t.evaluated}.items`,(0,_e._)`undefined`))}function bO(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,_e._)`/*# sourceURL=${r} */`:_e.nil}function kH(t,e){if(xO(t)&&(EO(t),CO(t))){AH(t,e);return}(0,_O.boolOrEmptySchema)(t,e)}function CO({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function xO(t){return typeof t.schema!="boolean"}function AH(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&OO(t),NH(t),MH(t);let s=n.const("_errs",ke.default.errors);qO(t,s),n.var(e,(0,_e._)`${s} === ${ke.default.errors}`)}function EO(t){(0,Is.checkUnknownRules)(t),TH(t)}function qO(t,e){if(t.opts.jtd)return SO(t,[],!1,e);let r=(0,vO.getSchemaTypes)(t.schema),n=(0,vO.coerceAndCheckDataType)(t,r);SO(t,r,!n,e)}function TH(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Is.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function $H(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Is.checkStrictMode)(t,"default is ignored in the schema root")}function NH(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,xH.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function MH(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function OO({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let s=r.$comment;if(i.$comment===!0)t.code((0,_e._)`${ke.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){let o=(0,_e.str)`${n}/$comment`,l=t.scopeValue("root",{ref:e.root});t.code((0,_e._)`${ke.default.self}.opts.$comment(${s}, ${o}, ${l}.schema)`)}}function FH(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:s}=t;r.$async?e.if((0,_e._)`${ke.default.errors} === 0`,()=>e.return(ke.default.data),()=>e.throw((0,_e._)`new ${i}(${ke.default.vErrors})`)):(e.assign((0,_e._)`${n}.errors`,ke.default.vErrors),s.unevaluated&&DH(t),e.return((0,_e._)`${ke.default.errors} === 0`))}function DH({gen:t,evaluated:e,props:r,items:n}){r instanceof _e.Name&&t.assign((0,_e._)`${e}.props`,r),n instanceof _e.Name&&t.assign((0,_e._)`${e}.items`,n)}function SO(t,e,r,n){let{gen:i,schema:s,data:o,allErrors:l,opts:c,self:d}=t,{RULES:p}=d;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Is.schemaHasRulesButRef)(s,p))){i.block(()=>PO(t,"$ref",p.all.$ref.definition));return}c.jtd||jH(t,e),i.block(()=>{for(let y of p.rules)m(y);m(p.post)});function m(y){(0,$w.shouldUseGroup)(s,y)&&(y.type?(i.if((0,Rm.checkDataType)(y.type,o,c.strictNumbers)),wO(t,y),e.length===1&&e[0]===y.type&&r&&(i.else(),(0,Rm.reportTypeError)(t)),i.endIf()):wO(t,y),l||i.if((0,_e._)`${ke.default.errors} === ${n||0}`))}}function wO(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,CH.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,$w.shouldUseRule)(n,s)&&PO(t,s.keyword,s.definition,e.type)})}function jH(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(LH(t,e),t.opts.allowUnionTypes||UH(t,e),HH(t,t.dataTypes))}function LH(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{IO(t.dataTypes,r)||Nw(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),VH(t,e)}}function UH(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Nw(t,"use allowUnionTypes to allow union type keyword")}function HH(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,$w.shouldUseRule)(t.schema,i)){let{type:s}=i.definition;s.length&&!s.some(o=>BH(e,o))&&Nw(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function BH(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function IO(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function VH(t,e){let r=[];for(let n of t.dataTypes)IO(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function Nw(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Is.checkStrictMode)(t,e,t.opts.strictTypes)}var Cm=class{constructor(e,r,n){if((0,Gf.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Is.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",kO(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Gf.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",ke.default.errors))}result(e,r,n){this.failResult((0,_e.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,_e.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,_e._)`${r} !== undefined && (${(0,_e.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Jf.reportExtraError:Jf.reportError)(this,this.def.error,r)}$dataError(){(0,Jf.reportError)(this,this.def.$dataError||Jf.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Jf.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=_e.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=_e.nil,r=_e.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:s,def:o}=this;n.if((0,_e.or)((0,_e._)`${i} === undefined`,r)),e!==_e.nil&&n.assign(e,!0),(s.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==_e.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:s}=this;return(0,_e.or)(o(),l());function o(){if(n.length){if(!(r instanceof _e.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,_e._)`${(0,Rm.checkDataTypes)(c,r,s.opts.strictNumbers,Rm.DataType.Wrong)}`}return _e.nil}function l(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,_e._)`!${c}(${r})`}return _e.nil}}subschema(e,r){let n=(0,Tw.getSubschema)(this.it,e);(0,Tw.extendSubschemaData)(n,this.it,e),(0,Tw.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return kH(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Is.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Is.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,_e.Name)),!0}};Co.KeywordCxt=Cm;function PO(t,e,r,n){let i=new Cm(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Gf.funcKeywordCode)(i,r):"macro"in r?(0,Gf.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Gf.funcKeywordCode)(i,r)}var WH=/^\/(?:[^~]|~0|~1)*$/,zH=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function kO(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,s;if(t==="")return ke.default.rootData;if(t[0]==="/"){if(!WH.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=ke.default.rootData}else{let d=zH.exec(t);if(!d)throw new Error(`Invalid JSON-pointer: ${t}`);let p=+d[1];if(i=d[2],i==="#"){if(p>=e)throw new Error(c("property/index",p));return n[e-p]}if(p>e)throw new Error(c("data",p));if(s=r[e-p],!i)return s}let o=s,l=i.split("/");for(let d of l)d&&(s=(0,_e._)`${s}${(0,_e.getProperty)((0,Is.unescapeJsonPointer)(d))}`,o=(0,_e._)`${o} && ${s}`);return o;function c(d,p){return`Cannot access ${d} ${p} levels up, current level is ${e}`}}Co.getData=kO});var xm=V(Fw=>{"use strict";Object.defineProperty(Fw,"__esModule",{value:!0});var Mw=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Fw.default=Mw});var Kf=V(Lw=>{"use strict";Object.defineProperty(Lw,"__esModule",{value:!0});var Dw=zf(),jw=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Dw.resolveUrl)(e,r,n),this.missingSchema=(0,Dw.normalizeId)((0,Dw.getFullPath)(e,this.missingRef))}};Lw.default=jw});var qm=V(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.resolveSchema=Wn.getCompilingSchema=Wn.resolveRef=Wn.compileSchema=Wn.SchemaEnv=void 0;var fi=Ge(),JH=xm(),ja=Os(),di=zf(),AO=st(),GH=Yf(),Nu=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,di.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Wn.SchemaEnv=Nu;function Hw(t){let e=TO.call(this,t);if(e)return e;let r=(0,di.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new fi.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),l;t.$async&&(l=o.scopeValue("Error",{ref:JH.default,code:(0,fi._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let d={gen:o,allErrors:this.opts.allErrors,data:ja.default.data,parentData:ja.default.parentData,parentDataProperty:ja.default.parentDataProperty,dataNames:[ja.default.data],dataPathArr:[fi.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,fi.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:l,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:fi.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,fi._)`""`,opts:this.opts,self:this},p;try{this._compilations.add(t),(0,GH.validateFunctionCode)(d),o.optimize(this.opts.code.optimize);let m=o.toString();p=`${o.scopeRefs(ja.default.scope)}return ${m}`,this.opts.code.process&&(p=this.opts.code.process(p,t));let b=new Function(`${ja.default.self}`,`${ja.default.scope}`,p)(this,this.scope.get());if(this.scope.value(c,{ref:b}),b.errors=null,b.schema=t.schema,b.schemaEnv=t,t.$async&&(b.$async=!0),this.opts.code.source===!0&&(b.source={validateName:c,validateCode:m,scopeValues:o._values}),this.opts.unevaluated){let{props:q,items:C}=d;b.evaluated={props:q instanceof fi.Name?void 0:q,items:C instanceof fi.Name?void 0:C,dynamicProps:q instanceof fi.Name,dynamicItems:C instanceof fi.Name},b.source&&(b.source.evaluated=(0,fi.stringify)(b.evaluated))}return t.validate=b,t}catch(m){throw delete t.validate,delete t.validateName,p&&this.logger.error("Error compiling schema, function code:",p),m}finally{this._compilations.delete(t)}}Wn.compileSchema=Hw;function YH(t,e,r){var n;r=(0,di.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let s=ZH.call(this,t,r);if(s===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:l}=this.opts;o&&(s=new Nu({schema:o,schemaId:l,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=KH.call(this,s)}Wn.resolveRef=YH;function KH(t){return(0,di.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Hw.call(this,t)}function TO(t){for(let e of this._compilations)if(QH(e,t))return e}Wn.getCompilingSchema=TO;function QH(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function ZH(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Em.call(this,t,e)}function Em(t,e){let r=this.opts.uriResolver.parse(e),n=(0,di._getFullPath)(this.opts.uriResolver,r),i=(0,di.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return Uw.call(this,r,t);let s=(0,di.normalizeId)(n),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){let l=Em.call(this,t,o);return typeof l?.schema!="object"?void 0:Uw.call(this,r,l)}if(typeof o?.schema=="object"){if(o.validate||Hw.call(this,o),s===(0,di.normalizeId)(e)){let{schema:l}=o,{schemaId:c}=this.opts,d=l[c];return d&&(i=(0,di.resolveUrl)(this.opts.uriResolver,i,d)),new Nu({schema:l,schemaId:c,root:t,baseId:i})}return Uw.call(this,r,o)}}Wn.resolveSchema=Em;var XH=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Uw(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let l of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,AO.unescapeFragment)(l)];if(c===void 0)return;r=c;let d=typeof r=="object"&&r[this.opts.schemaId];!XH.has(l)&&d&&(e=(0,di.resolveUrl)(this.opts.uriResolver,e,d))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,AO.schemaHasRulesButRef)(r,this.RULES)){let l=(0,di.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=Em.call(this,n,l)}let{schemaId:o}=this.opts;if(s=s||new Nu({schema:r,schemaId:o,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var $O=V((MQ,eB)=>{eB.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Ww=V((FQ,LO)=>{"use strict";var tB=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),MO=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),Bw=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),FO=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),rB=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Vw(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var nB=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function NO(t){return t.length=0,!0}function iB(t,e,r){if(t.length){let n=Vw(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function sB(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],s=!1,o=!1,l=iB;for(let c=0;c<t.length;c++){let d=t[c];if(!(d==="["||d==="]"))if(d===":"){if(s===!0&&(o=!0),!l(i,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),n.push(":");continue}else if(d==="%"){if(!l(i,n,r))break;l=NO}else{i.push(d);continue}}return i.length&&(l===NO?r.zone=i.join(""):o?n.push(i.join("")):n.push(Vw(i))),r.address=n.join(""),r}function DO(t){if(oB(t,":")<2)return{host:t,isIPV6:!1};let e=sB(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function oB(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function aB(t){let e=t,r=[],n=-1,i=0;for(;i=e.length;){if(i===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(i===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(i===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}var lB={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},uB=/[@/?#:]/g,cB=/[@/?#]/g;function jO(t,e){let r=e?cB:uB;return r.lastIndex=0,t.replace(r,n=>lB[n])}function fB(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let i=t.slice(n+1,n+3);if(Bw(i)){let s=i.toUpperCase(),o=String.fromCharCode(parseInt(s,16));e&&FO(o)?r+=o:r+="%"+s,n+=2;continue}}r+=t[n]}return r}function dB(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(Bw(n)){let i=n.toUpperCase(),s=String.fromCharCode(parseInt(i,16));s!=="."&&FO(s)?e+=s:e+="%"+i,r+=2;continue}}rB(t[r])?e+=t[r]:e+=escape(t[r])}return e}function pB(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(Bw(n)){e+="%"+n.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function hB(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!MO(r)){let n=DO(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=jO(r,!1)}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}LO.exports={nonSimpleDomain:nB,recomposeAuthority:hB,reescapeHostDelimiters:jO,normalizePercentEncoding:fB,normalizePathEncoding:dB,escapePreservingEscapes:pB,removeDotSegments:aB,isIPv4:MO,isUUID:tB,normalizeIPv6:DO,stringArrayToHexStripped:Vw}});var WO=V((DQ,VO)=>{"use strict";var{isUUID:mB}=Ww(),gB=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,yB=["http","https","ws","wss","urn","urn:uuid"];function vB(t){return yB.indexOf(t)!==-1}function zw(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function UO(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function HO(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function bB(t){return t.secure=zw(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function SB(t){if((t.port===(zw(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function wB(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(gB);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,s=Jw(i);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function _B(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,s=Jw(i);s&&(t=s.serialize(t,e));let o=t,l=t.nss;return o.path=`${n||e.nid}:${l}`,e.skipEscape=!0,o}function RB(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!mB(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function CB(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var BO={scheme:"http",domainHost:!0,parse:UO,serialize:HO},xB={scheme:"https",domainHost:BO.domainHost,parse:UO,serialize:HO},Om={scheme:"ws",domainHost:!0,parse:bB,serialize:SB},EB={scheme:"wss",domainHost:Om.domainHost,parse:Om.parse,serialize:Om.serialize},qB={scheme:"urn",parse:wB,serialize:_B,skipNormalize:!0},OB={scheme:"urn:uuid",parse:RB,serialize:CB,skipNormalize:!0},Im={http:BO,https:xB,ws:Om,wss:EB,urn:qB,"urn:uuid":OB};Object.setPrototypeOf(Im,null);function Jw(t){return t&&(Im[t]||Im[t.toLowerCase()])||void 0}VO.exports={wsIsSecure:zw,SCHEMES:Im,isValidSchemeName:vB,getSchemeHandler:Jw}});var QO=V((jQ,Pm)=>{"use strict";var{normalizeIPv6:IB,removeDotSegments:Qf,recomposeAuthority:PB,normalizePercentEncoding:kB,normalizePathEncoding:AB,escapePreservingEscapes:TB,reescapeHostDelimiters:$B,isIPv4:NB,nonSimpleDomain:MB}=Ww(),{SCHEMES:FB,getSchemeHandler:JO}=WO();function DB(t,e){return typeof t=="string"?t=BB(t,e):typeof t=="object"&&(t=Mu(La(t,e),e)),t}function jB(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=GO(Mu(t,n),Mu(e,n),n,!0);return n.skipEscape=!0,La(i,n)}function GO(t,e,r,n){let i={};return n||(t=Mu(La(t,r),r),e=Mu(La(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Qf(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Qf(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=Qf(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=Qf(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function LB(t,e,r){let n=zO(t,r),i=zO(e,r);return n!==void 0&&i!==void 0&&n.toLowerCase()===i.toLowerCase()}function La(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],s=JO(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=kB(r.path):(r.path=TB(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=PB(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let l=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(l=Qf(l)),o===void 0&&l[0]==="/"&&l[1]==="/"&&(l="/%2F"+l.slice(2)),i.push(l)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var UB=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function HB(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function YO(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let o=t.match(UB);if(o){n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]);let l=HB(n,o);if(l!==void 0&&(n.error=n.error||l,i=!0),n.host)if(NB(n.host)===!1){let p=IB(n.host);n.host=p.host.toLowerCase(),s=p.isIPV6}else s=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let c=JO(r.scheme||n.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&n.host&&(r.domainHost||c&&c.domainHost)&&s===!1&&MB(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(d){n.error=n.error||"Host's domain name can not be converted to ASCII: "+d}if((!c||c&&!c.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=$B(unescape(n.host),s))),n.path&&(n.path=AB(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}c&&c.parse&&c.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:i}}function Mu(t,e){return YO(t,e).parsed}function BB(t,e){return KO(t,e).normalized}function KO(t,e){let{parsed:r,malformedAuthorityOrPort:n}=YO(t,e);return{normalized:n?t:La(r,e),malformedAuthorityOrPort:n}}function zO(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:n}=KO(t,e);return n?void 0:r}if(typeof t=="object")return La(t,e)}var Gw={SCHEMES:FB,normalize:DB,resolve:jB,resolveComponent:GO,equal:LB,serialize:La,parse:Mu};Pm.exports=Gw;Pm.exports.default=Gw;Pm.exports.fastUri=Gw});var XO=V(Yw=>{"use strict";Object.defineProperty(Yw,"__esModule",{value:!0});var ZO=QO();ZO.code='require("ajv/dist/runtime/uri").default';Yw.default=ZO});var aI=V(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.CodeGen=hr.Name=hr.nil=hr.stringify=hr.str=hr._=hr.KeywordCxt=void 0;var VB=Yf();Object.defineProperty(hr,"KeywordCxt",{enumerable:!0,get:function(){return VB.KeywordCxt}});var Fu=Ge();Object.defineProperty(hr,"_",{enumerable:!0,get:function(){return Fu._}});Object.defineProperty(hr,"str",{enumerable:!0,get:function(){return Fu.str}});Object.defineProperty(hr,"stringify",{enumerable:!0,get:function(){return Fu.stringify}});Object.defineProperty(hr,"nil",{enumerable:!0,get:function(){return Fu.nil}});Object.defineProperty(hr,"Name",{enumerable:!0,get:function(){return Fu.Name}});Object.defineProperty(hr,"CodeGen",{enumerable:!0,get:function(){return Fu.CodeGen}});var WB=xm(),iI=Kf(),zB=Rw(),Zf=qm(),JB=Ge(),Xf=zf(),km=Wf(),Qw=st(),eI=$O(),GB=XO(),sI=(t,e)=>new RegExp(t,e);sI.code="new RegExp";var YB=["removeAdditional","useDefaults","coerceTypes"],KB=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),QB={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},ZB={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},tI=200;function XB(t){var e,r,n,i,s,o,l,c,d,p,m,y,b,q,C,v,_,E,k,O,M,j,I,R,A;let F=t.strict,U=(e=t.code)===null||e===void 0?void 0:e.optimize,D=U===!0||U===void 0?1:U||0,J=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:sI,Q=(i=t.uriResolver)!==null&&i!==void 0?i:GB.default;return{strictSchema:(o=(s=t.strictSchema)!==null&&s!==void 0?s:F)!==null&&o!==void 0?o:!0,strictNumbers:(c=(l=t.strictNumbers)!==null&&l!==void 0?l:F)!==null&&c!==void 0?c:!0,strictTypes:(p=(d=t.strictTypes)!==null&&d!==void 0?d:F)!==null&&p!==void 0?p:"log",strictTuples:(y=(m=t.strictTuples)!==null&&m!==void 0?m:F)!==null&&y!==void 0?y:"log",strictRequired:(q=(b=t.strictRequired)!==null&&b!==void 0?b:F)!==null&&q!==void 0?q:!1,code:t.code?{...t.code,optimize:D,regExp:J}:{optimize:D,regExp:J},loopRequired:(C=t.loopRequired)!==null&&C!==void 0?C:tI,loopEnum:(v=t.loopEnum)!==null&&v!==void 0?v:tI,meta:(_=t.meta)!==null&&_!==void 0?_:!0,messages:(E=t.messages)!==null&&E!==void 0?E:!0,inlineRefs:(k=t.inlineRefs)!==null&&k!==void 0?k:!0,schemaId:(O=t.schemaId)!==null&&O!==void 0?O:"$id",addUsedSchema:(M=t.addUsedSchema)!==null&&M!==void 0?M:!0,validateSchema:(j=t.validateSchema)!==null&&j!==void 0?j:!0,validateFormats:(I=t.validateFormats)!==null&&I!==void 0?I:!0,unicodeRegExp:(R=t.unicodeRegExp)!==null&&R!==void 0?R:!0,int32range:(A=t.int32range)!==null&&A!==void 0?A:!0,uriResolver:Q}}var ed=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...XB(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new JB.ValueScope({scope:{},prefixes:KB,es5:r,lines:n}),this.logger=sV(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,zB.getRules)(),rI.call(this,QB,e,"NOT SUPPORTED"),rI.call(this,ZB,e,"DEPRECATED","warn"),this._metaOpts=nV.call(this),e.formats&&tV.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&rV.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),eV.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=eI;n==="id"&&(i={...eI},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(p,m){await s.call(this,p.$schema);let y=this._addSchema(p,m);return y.validate||o.call(this,y)}async function s(p){p&&!this.getSchema(p)&&await i.call(this,{$ref:p},!0)}async function o(p){try{return this._compileSchemaEnv(p)}catch(m){if(!(m instanceof iI.default))throw m;return l.call(this,m),await c.call(this,m.missingSchema),o.call(this,p)}}function l({missingSchema:p,missingRef:m}){if(this.refs[p])throw new Error(`AnySchema ${p} is loaded but ${m} cannot be resolved`)}async function c(p){let m=await d.call(this,p);this.refs[p]||await s.call(this,m.$schema),this.refs[p]||this.addSchema(m,p,r)}async function d(p){let m=this._loading[p];if(m)return m;try{return await(this._loading[p]=n(p))}finally{delete this._loading[p]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let s;if(typeof e=="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw new Error(`schema ${o} must be string`)}return r=(0,Xf.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return i}getSchema(e){let r;for(;typeof(r=nI.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new Zf.SchemaEnv({schema:{},schemaId:n});if(r=Zf.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=nI.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Xf.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(aV.call(this,n,r),!r)return(0,Qw.eachItem)(n,s=>Kw.call(this,s)),this;uV.call(this,r);let i={...r,type:(0,km.getJSONTypes)(r.type),schemaType:(0,km.getJSONTypes)(r.schemaType)};return(0,Qw.eachItem)(n,i.type.length===0?s=>Kw.call(this,s,i):s=>i.type.forEach(o=>Kw.call(this,s,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(s=>s.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,s)=>i+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let s=i.split("/").slice(1),o=e;for(let l of s)o=o[l];for(let l in n){let c=n[l];if(typeof c!="object")continue;let{$data:d}=c.definition,p=o[l];d&&p&&(o[l]=oI(p))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:l}=this.opts;if(typeof e=="object")o=e[l];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Xf.normalizeId)(o||n);let d=Xf.getSchemaRefs.call(this,e,n);return c=new Zf.SchemaEnv({schema:e,schemaId:l,meta:r,baseId:n,localRefs:d}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Zf.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Zf.compileSchema.call(this,e)}finally{this.opts=r}}};ed.ValidationError=WB.default;ed.MissingRefError=iI.default;hr.default=ed;function rI(t,e,r,n="error"){for(let i in t){let s=i;s in e&&this.logger[n](`${r}: option ${i}. ${t[s]}`)}}function nI(t){return t=(0,Xf.normalizeId)(t),this.schemas[t]||this.refs[t]}function eV(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function tV(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function rV(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function nV(){let t={...this.opts};for(let e of YB)delete t[e];return t}var iV={log(){},warn(){},error(){}};function sV(t){if(t===!1)return iV;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var oV=/^[a-z_$][a-z0-9_$:-]*$/i;function aV(t,e){let{RULES:r}=this;if((0,Qw.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!oV.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Kw(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,o=i?s.post:s.rules.find(({type:c})=>c===r);if(o||(o={type:r,rules:[]},s.rules.push(o)),s.keywords[t]=!0,!e)return;let l={keyword:t,definition:{...e,type:(0,km.getJSONTypes)(e.type),schemaType:(0,km.getJSONTypes)(e.schemaType)}};e.before?lV.call(this,o,l,e.before):o.rules.push(l),s.all[t]=l,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function lV(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function uV(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=oI(e)),t.validateSchema=this.compile(e,!0))}var cV={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function oI(t){return{anyOf:[t,cV]}}});var lI=V(Zw=>{"use strict";Object.defineProperty(Zw,"__esModule",{value:!0});var fV={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Zw.default=fV});var dI=V(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});Ua.callRef=Ua.getValidate=void 0;var dV=Kf(),uI=Vn(),sn=Ge(),Du=Os(),cI=qm(),Am=st(),pV={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:s,validateName:o,opts:l,self:c}=n,{root:d}=s;if((r==="#"||r==="#/")&&i===d.baseId)return m();let p=cI.resolveRef.call(c,d,i,r);if(p===void 0)throw new dV.default(n.opts.uriResolver,i,r);if(p instanceof cI.SchemaEnv)return y(p);return b(p);function m(){if(s===d)return Tm(t,o,s,s.$async);let q=e.scopeValue("root",{ref:d});return Tm(t,(0,sn._)`${q}.validate`,d,d.$async)}function y(q){let C=fI(t,q);Tm(t,C,q,q.$async)}function b(q){let C=e.scopeValue("schema",l.code.source===!0?{ref:q,code:(0,sn.stringify)(q)}:{ref:q}),v=e.name("valid"),_=t.subschema({schema:q,dataTypes:[],schemaPath:sn.nil,topSchemaRef:C,errSchemaPath:r},v);t.mergeEvaluated(_),t.ok(v)}}};function fI(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,sn._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Ua.getValidate=fI;function Tm(t,e,r,n){let{gen:i,it:s}=t,{allErrors:o,schemaEnv:l,opts:c}=s,d=c.passContext?Du.default.this:sn.nil;n?p():m();function p(){if(!l.$async)throw new Error("async schema referenced by sync schema");let q=i.let("valid");i.try(()=>{i.code((0,sn._)`await ${(0,uI.callValidateCode)(t,e,d)}`),b(e),o||i.assign(q,!0)},C=>{i.if((0,sn._)`!(${C} instanceof ${s.ValidationError})`,()=>i.throw(C)),y(C),o||i.assign(q,!1)}),t.ok(q)}function m(){t.result((0,uI.callValidateCode)(t,e,d),()=>b(e),()=>y(e))}function y(q){let C=(0,sn._)`${q}.errors`;i.assign(Du.default.vErrors,(0,sn._)`${Du.default.vErrors} === null ? ${C} : ${Du.default.vErrors}.concat(${C})`),i.assign(Du.default.errors,(0,sn._)`${Du.default.vErrors}.length`)}function b(q){var C;if(!s.opts.unevaluated)return;let v=(C=r?.validate)===null||C===void 0?void 0:C.evaluated;if(s.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(s.props=Am.mergeEvaluated.props(i,v.props,s.props));else{let _=i.var("props",(0,sn._)`${q}.evaluated.props`);s.props=Am.mergeEvaluated.props(i,_,s.props,sn.Name)}if(s.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(s.items=Am.mergeEvaluated.items(i,v.items,s.items));else{let _=i.var("items",(0,sn._)`${q}.evaluated.items`);s.items=Am.mergeEvaluated.items(i,_,s.items,sn.Name)}}}Ua.callRef=Tm;Ua.default=pV});var pI=V(Xw=>{"use strict";Object.defineProperty(Xw,"__esModule",{value:!0});var hV=lI(),mV=dI(),gV=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",hV.default,mV.default];Xw.default=gV});var hI=V(e0=>{"use strict";Object.defineProperty(e0,"__esModule",{value:!0});var $m=Ge(),xo=$m.operators,Nm={maximum:{okStr:"<=",ok:xo.LTE,fail:xo.GT},minimum:{okStr:">=",ok:xo.GTE,fail:xo.LT},exclusiveMaximum:{okStr:"<",ok:xo.LT,fail:xo.GTE},exclusiveMinimum:{okStr:">",ok:xo.GT,fail:xo.LTE}},yV={message:({keyword:t,schemaCode:e})=>(0,$m.str)`must be ${Nm[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,$m._)`{comparison: ${Nm[t].okStr}, limit: ${e}}`},vV={keyword:Object.keys(Nm),type:"number",schemaType:"number",$data:!0,error:yV,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,$m._)`${r} ${Nm[e].fail} ${n} || isNaN(${r})`)}};e0.default=vV});var mI=V(t0=>{"use strict";Object.defineProperty(t0,"__esModule",{value:!0});var td=Ge(),bV={message:({schemaCode:t})=>(0,td.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,td._)`{multipleOf: ${t}}`},SV={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:bV,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),l=s?(0,td._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,td._)`${o} !== parseInt(${o})`;t.fail$data((0,td._)`(${n} === 0 || (${o} = ${r}/${n}, ${l}))`)}};t0.default=SV});var yI=V(r0=>{"use strict";Object.defineProperty(r0,"__esModule",{value:!0});function gI(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}r0.default=gI;gI.code='require("ajv/dist/runtime/ucs2length").default'});var vI=V(n0=>{"use strict";Object.defineProperty(n0,"__esModule",{value:!0});var Ha=Ge(),wV=st(),_V=yI(),RV={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Ha.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Ha._)`{limit: ${t}}`},CV={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:RV,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,s=e==="maxLength"?Ha.operators.GT:Ha.operators.LT,o=i.opts.unicode===!1?(0,Ha._)`${r}.length`:(0,Ha._)`${(0,wV.useFunc)(t.gen,_V.default)}(${r})`;t.fail$data((0,Ha._)`${o} ${s} ${n}`)}};n0.default=CV});var bI=V(i0=>{"use strict";Object.defineProperty(i0,"__esModule",{value:!0});var xV=Vn(),EV=st(),ju=Ge(),qV={message:({schemaCode:t})=>(0,ju.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,ju._)`{pattern: ${t}}`},OV={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:qV,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t,l=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=o.opts.code,d=c.code==="new RegExp"?(0,ju._)`new RegExp`:(0,EV.useFunc)(e,c),p=e.let("valid");e.try(()=>e.assign(p,(0,ju._)`${d}(${s}, ${l}).test(${r})`),()=>e.assign(p,!1)),t.fail$data((0,ju._)`!${p}`)}else{let c=(0,xV.usePattern)(t,i);t.fail$data((0,ju._)`!${c}.test(${r})`)}}};i0.default=OV});var SI=V(s0=>{"use strict";Object.defineProperty(s0,"__esModule",{value:!0});var rd=Ge(),IV={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,rd.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,rd._)`{limit: ${t}}`},PV={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:IV,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?rd.operators.GT:rd.operators.LT;t.fail$data((0,rd._)`Object.keys(${r}).length ${i} ${n}`)}};s0.default=PV});var wI=V(o0=>{"use strict";Object.defineProperty(o0,"__esModule",{value:!0});var nd=Vn(),id=Ge(),kV=st(),AV={message:({params:{missingProperty:t}})=>(0,id.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,id._)`{missingProperty: ${t}}`},TV={keyword:"required",type:"object",schemaType:"array",$data:!0,error:AV,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:s,it:o}=t,{opts:l}=o;if(!s&&r.length===0)return;let c=r.length>=l.loopRequired;if(o.allErrors?d():p(),l.strictRequired){let b=t.parentSchema.properties,{definedProperties:q}=t.it;for(let C of r)if(b?.[C]===void 0&&!q.has(C)){let v=o.schemaEnv.baseId+o.errSchemaPath,_=`required property "${C}" is not defined at "${v}" (strictRequired)`;(0,kV.checkStrictMode)(o,_,o.opts.strictRequired)}}function d(){if(c||s)t.block$data(id.nil,m);else for(let b of r)(0,nd.checkReportMissingProp)(t,b)}function p(){let b=e.let("missing");if(c||s){let q=e.let("valid",!0);t.block$data(q,()=>y(b,q)),t.ok(q)}else e.if((0,nd.checkMissingProp)(t,r,b)),(0,nd.reportMissingProp)(t,b),e.else()}function m(){e.forOf("prop",n,b=>{t.setParams({missingProperty:b}),e.if((0,nd.noPropertyInData)(e,i,b,l.ownProperties),()=>t.error())})}function y(b,q){t.setParams({missingProperty:b}),e.forOf(b,n,()=>{e.assign(q,(0,nd.propertyInData)(e,i,b,l.ownProperties)),e.if((0,id.not)(q),()=>{t.error(),e.break()})},id.nil)}}};o0.default=TV});var _I=V(a0=>{"use strict";Object.defineProperty(a0,"__esModule",{value:!0});var sd=Ge(),$V={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,sd.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,sd._)`{limit: ${t}}`},NV={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:$V,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?sd.operators.GT:sd.operators.LT;t.fail$data((0,sd._)`${r}.length ${i} ${n}`)}};a0.default=NV});var Mm=V(l0=>{"use strict";Object.defineProperty(l0,"__esModule",{value:!0});var RI=kw();RI.code='require("ajv/dist/runtime/equal").default';l0.default=RI});var CI=V(c0=>{"use strict";Object.defineProperty(c0,"__esModule",{value:!0});var u0=Wf(),mr=Ge(),MV=st(),FV=Mm(),DV={message:({params:{i:t,j:e}})=>(0,mr.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,mr._)`{i: ${t}, j: ${e}}`},jV={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:DV,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:s,schemaCode:o,it:l}=t;if(!n&&!i)return;let c=e.let("valid"),d=s.items?(0,u0.getSchemaTypes)(s.items):[];t.block$data(c,p,(0,mr._)`${o} === false`),t.ok(c);function p(){let q=e.let("i",(0,mr._)`${r}.length`),C=e.let("j");t.setParams({i:q,j:C}),e.assign(c,!0),e.if((0,mr._)`${q} > 1`,()=>(m()?y:b)(q,C))}function m(){return d.length>0&&!d.some(q=>q==="object"||q==="array")}function y(q,C){let v=e.name("item"),_=(0,u0.checkDataTypes)(d,v,l.opts.strictNumbers,u0.DataType.Wrong),E=e.const("indices",(0,mr._)`{}`);e.for((0,mr._)`;${q}--;`,()=>{e.let(v,(0,mr._)`${r}[${q}]`),e.if(_,(0,mr._)`continue`),d.length>1&&e.if((0,mr._)`typeof ${v} == "string"`,(0,mr._)`${v} += "_"`),e.if((0,mr._)`typeof ${E}[${v}] == "number"`,()=>{e.assign(C,(0,mr._)`${E}[${v}]`),t.error(),e.assign(c,!1).break()}).code((0,mr._)`${E}[${v}] = ${q}`)})}function b(q,C){let v=(0,MV.useFunc)(e,FV.default),_=e.name("outer");e.label(_).for((0,mr._)`;${q}--;`,()=>e.for((0,mr._)`${C} = ${q}; ${C}--;`,()=>e.if((0,mr._)`${v}(${r}[${q}], ${r}[${C}])`,()=>{t.error(),e.assign(c,!1).break(_)})))}}};c0.default=jV});var xI=V(d0=>{"use strict";Object.defineProperty(d0,"__esModule",{value:!0});var f0=Ge(),LV=st(),UV=Mm(),HV={message:"must be equal to constant",params:({schemaCode:t})=>(0,f0._)`{allowedValue: ${t}}`},BV={keyword:"const",$data:!0,error:HV,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,f0._)`!${(0,LV.useFunc)(e,UV.default)}(${r}, ${i})`):t.fail((0,f0._)`${s} !== ${r}`)}};d0.default=BV});var EI=V(p0=>{"use strict";Object.defineProperty(p0,"__esModule",{value:!0});var od=Ge(),VV=st(),WV=Mm(),zV={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,od._)`{allowedValues: ${t}}`},JV={keyword:"enum",schemaType:"array",$data:!0,error:zV,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let l=i.length>=o.opts.loopEnum,c,d=()=>c??(c=(0,VV.useFunc)(e,WV.default)),p;if(l||n)p=e.let("valid"),t.block$data(p,m);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let b=e.const("vSchema",s);p=(0,od.or)(...i.map((q,C)=>y(b,C)))}t.pass(p);function m(){e.assign(p,!1),e.forOf("v",s,b=>e.if((0,od._)`${d()}(${r}, ${b})`,()=>e.assign(p,!0).break()))}function y(b,q){let C=i[q];return typeof C=="object"&&C!==null?(0,od._)`${d()}(${r}, ${b}[${q}])`:(0,od._)`${r} === ${C}`}}};p0.default=JV});var qI=V(h0=>{"use strict";Object.defineProperty(h0,"__esModule",{value:!0});var GV=hI(),YV=mI(),KV=vI(),QV=bI(),ZV=SI(),XV=wI(),eW=_I(),tW=CI(),rW=xI(),nW=EI(),iW=[GV.default,YV.default,KV.default,QV.default,ZV.default,XV.default,eW.default,tW.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},rW.default,nW.default];h0.default=iW});var g0=V(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.validateAdditionalItems=void 0;var Ba=Ge(),m0=st(),sW={message:({params:{len:t}})=>(0,Ba.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Ba._)`{limit: ${t}}`},oW={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:sW,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,m0.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}OI(t,n)}};function OI(t,e){let{gen:r,schema:n,data:i,keyword:s,it:o}=t;o.items=!0;let l=r.const("len",(0,Ba._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Ba._)`${l} <= ${e.length}`);else if(typeof n=="object"&&!(0,m0.alwaysValidSchema)(o,n)){let d=r.var("valid",(0,Ba._)`${l} <= ${e.length}`);r.if((0,Ba.not)(d),()=>c(d)),t.ok(d)}function c(d){r.forRange("i",e.length,l,p=>{t.subschema({keyword:s,dataProp:p,dataPropType:m0.Type.Num},d),o.allErrors||r.if((0,Ba.not)(d),()=>r.break())})}}ad.validateAdditionalItems=OI;ad.default=oW});var y0=V(ld=>{"use strict";Object.defineProperty(ld,"__esModule",{value:!0});ld.validateTuple=void 0;var II=Ge(),Fm=st(),aW=Vn(),lW={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return PI(t,"additionalItems",e);r.items=!0,!(0,Fm.alwaysValidSchema)(r,e)&&t.ok((0,aW.validateArray)(t))}};function PI(t,e,r=t.schema){let{gen:n,parentSchema:i,data:s,keyword:o,it:l}=t;p(i),l.opts.unevaluated&&r.length&&l.items!==!0&&(l.items=Fm.mergeEvaluated.items(n,r.length,l.items));let c=n.name("valid"),d=n.const("len",(0,II._)`${s}.length`);r.forEach((m,y)=>{(0,Fm.alwaysValidSchema)(l,m)||(n.if((0,II._)`${d} > ${y}`,()=>t.subschema({keyword:o,schemaProp:y,dataProp:y},c)),t.ok(c))});function p(m){let{opts:y,errSchemaPath:b}=l,q=r.length,C=q===m.minItems&&(q===m.maxItems||m[e]===!1);if(y.strictTuples&&!C){let v=`"${o}" is ${q}-tuple, but minItems or maxItems/${e} are not specified or different at path "${b}"`;(0,Fm.checkStrictMode)(l,v,y.strictTuples)}}}ld.validateTuple=PI;ld.default=lW});var kI=V(v0=>{"use strict";Object.defineProperty(v0,"__esModule",{value:!0});var uW=y0(),cW={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,uW.validateTuple)(t,"items")};v0.default=cW});var TI=V(b0=>{"use strict";Object.defineProperty(b0,"__esModule",{value:!0});var AI=Ge(),fW=st(),dW=Vn(),pW=g0(),hW={message:({params:{len:t}})=>(0,AI.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,AI._)`{limit: ${t}}`},mW={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:hW,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,fW.alwaysValidSchema)(n,e)&&(i?(0,pW.validateAdditionalItems)(t,i):t.ok((0,dW.validateArray)(t)))}};b0.default=mW});var $I=V(S0=>{"use strict";Object.defineProperty(S0,"__esModule",{value:!0});var zn=Ge(),Dm=st(),gW={message:({params:{min:t,max:e}})=>e===void 0?(0,zn.str)`must contain at least ${t} valid item(s)`:(0,zn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,zn._)`{minContains: ${t}}`:(0,zn._)`{minContains: ${t}, maxContains: ${e}}`},yW={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:gW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t,o,l,{minContains:c,maxContains:d}=n;s.opts.next?(o=c===void 0?1:c,l=d):o=1;let p=e.const("len",(0,zn._)`${i}.length`);if(t.setParams({min:o,max:l}),l===void 0&&o===0){(0,Dm.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&o>l){(0,Dm.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Dm.alwaysValidSchema)(s,r)){let C=(0,zn._)`${p} >= ${o}`;l!==void 0&&(C=(0,zn._)`${C} && ${p} <= ${l}`),t.pass(C);return}s.items=!0;let m=e.name("valid");l===void 0&&o===1?b(m,()=>e.if(m,()=>e.break())):o===0?(e.let(m,!0),l!==void 0&&e.if((0,zn._)`${i}.length > 0`,y)):(e.let(m,!1),y()),t.result(m,()=>t.reset());function y(){let C=e.name("_valid"),v=e.let("count",0);b(C,()=>e.if(C,()=>q(v)))}function b(C,v){e.forRange("i",0,p,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:Dm.Type.Num,compositeRule:!0},C),v()})}function q(C){e.code((0,zn._)`${C}++`),l===void 0?e.if((0,zn._)`${C} >= ${o}`,()=>e.assign(m,!0).break()):(e.if((0,zn._)`${C} > ${l}`,()=>e.assign(m,!1).break()),o===1?e.assign(m,!0):e.if((0,zn._)`${C} >= ${o}`,()=>e.assign(m,!0)))}}};S0.default=yW});var FI=V(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.validateSchemaDeps=Yi.validatePropertyDeps=Yi.error=void 0;var w0=Ge(),vW=st(),ud=Vn();Yi.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,w0.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,w0._)`{property: ${t},
|
|
28
28
|
missingProperty: ${n},
|
|
29
29
|
depsCount: ${e},
|
|
30
|
-
deps: ${r}}`};var bW={keyword:"dependencies",type:"object",schemaType:"object",error:Yi.error,code(t){let[e,r]=SW(t);NI(t,e),MI(t,r)}};function SW({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function NI(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let o in e){let l=e[o];if(l.length===0)continue;let c=(0,ud.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:l.length,deps:l.join(", ")}),i.allErrors?r.if(c,()=>{for(let d of l)(0,ud.checkReportMissingProp)(t,d)}):(r.if((0,w0._)`${c} && (${(0,ud.checkMissingProp)(t,l,s)})`),(0,ud.reportMissingProp)(t,s),r.else())}}Yi.validatePropertyDeps=NI;function MI(t,e=t.schema){let{gen:r,data:n,keyword:i,it:s}=t,o=r.name("valid");for(let l in e)(0,vW.alwaysValidSchema)(s,e[l])||(r.if((0,ud.propertyInData)(r,n,l,s.opts.ownProperties),()=>{let c=t.subschema({keyword:i,schemaProp:l},o);t.mergeValidEvaluated(c,o)},()=>r.var(o,!0)),t.ok(o))}Yi.validateSchemaDeps=MI;Yi.default=bW});var jI=V(_0=>{"use strict";Object.defineProperty(_0,"__esModule",{value:!0});var DI=Ge(),wW=st(),_W={message:"property name must be valid",params:({params:t})=>(0,DI._)`{propertyName: ${t.propertyName}}`},RW={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:_W,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,wW.alwaysValidSchema)(i,r))return;let s=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),e.if((0,DI.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};_0.default=RW});var C0=V(R0=>{"use strict";Object.defineProperty(R0,"__esModule",{value:!0});var jm=Vn(),pi=Ge(),CW=Os(),Lm=st(),xW={message:"must NOT have additional properties",params:({params:t})=>(0,pi._)`{additionalProperty: ${t.additionalProperty}}`},EW={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:xW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:s,it:o}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:l,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,Lm.alwaysValidSchema)(o,r))return;let d=(0,jm.allSchemaProperties)(n.properties),p=(0,jm.allSchemaProperties)(n.patternProperties);m(),t.ok((0,pi._)`${s} === ${CW.default.errors}`);function m(){e.forIn("key",i,v=>{!d.length&&!p.length?E(v):e.if(y(v),()=>E(v))})}function y(v){let _;if(d.length>8){let q=(0,Lm.schemaRefOrVal)(o,n.properties,"properties");_=(0,jm.isOwnProperty)(e,q,v)}else d.length?_=(0,pi.or)(...d.map(q=>(0,pi._)`${v} === ${q}`)):_=pi.nil;return p.length&&(_=(0,pi.or)(_,...p.map(q=>(0,pi._)`${(0,jm.usePattern)(t,q)}.test(${v})`))),(0,pi.not)(_)}function b(v){e.code((0,pi._)`delete ${i}[${v}]`)}function E(v){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){b(v);return}if(r===!1){t.setParams({additionalProperty:v}),t.error(),l||e.break();return}if(typeof r=="object"&&!(0,Lm.alwaysValidSchema)(o,r)){let _=e.name("valid");c.removeAdditional==="failing"?(C(v,_,!1),e.if((0,pi.not)(_),()=>{t.reset(),b(v)})):(C(v,_),l||e.if((0,pi.not)(_),()=>e.break()))}}function C(v,_,q){let k={keyword:"additionalProperties",dataProp:v,dataPropType:Lm.Type.Str};q===!1&&Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(k,_)}}};R0.default=EW});var HI=V(E0=>{"use strict";Object.defineProperty(E0,"__esModule",{value:!0});var qW=Yf(),LI=Vn(),x0=st(),UI=C0(),OW={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&UI.default.code(new qW.KeywordCxt(s,UI.default,"additionalProperties"));let o=(0,LI.allSchemaProperties)(r);for(let m of o)s.definedProperties.add(m);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=x0.mergeEvaluated.props(e,(0,x0.toHash)(o),s.props));let l=o.filter(m=>!(0,x0.alwaysValidSchema)(s,r[m]));if(l.length===0)return;let c=e.name("valid");for(let m of l)d(m)?p(m):(e.if((0,LI.propertyInData)(e,i,m,s.opts.ownProperties)),p(m),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(m),t.ok(c);function d(m){return s.opts.useDefaults&&!s.compositeRule&&r[m].default!==void 0}function p(m){t.subschema({keyword:"properties",schemaProp:m,dataProp:m},c)}}};E0.default=OW});var zI=V(q0=>{"use strict";Object.defineProperty(q0,"__esModule",{value:!0});var BI=Vn(),Um=Ge(),VI=st(),WI=st(),IW={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:s}=t,{opts:o}=s,l=(0,BI.allSchemaProperties)(r),c=l.filter(C=>(0,VI.alwaysValidSchema)(s,r[C]));if(l.length===0||c.length===l.length&&(!s.opts.unevaluated||s.props===!0))return;let d=o.strictSchema&&!o.allowMatchingProperties&&i.properties,p=e.name("valid");s.props!==!0&&!(s.props instanceof Um.Name)&&(s.props=(0,WI.evaluatedPropsToName)(e,s.props));let{props:m}=s;y();function y(){for(let C of l)d&&b(C),s.allErrors?E(C):(e.var(p,!0),E(C),e.if(p))}function b(C){for(let v in d)new RegExp(C).test(v)&&(0,VI.checkStrictMode)(s,`property ${v} matches pattern ${C} (use allowMatchingProperties)`)}function E(C){e.forIn("key",n,v=>{e.if((0,Um._)`${(0,BI.usePattern)(t,C)}.test(${v})`,()=>{let _=c.includes(C);_||t.subschema({keyword:"patternProperties",schemaProp:C,dataProp:v,dataPropType:WI.Type.Str},p),s.opts.unevaluated&&m!==!0?e.assign((0,Um._)`${m}[${v}]`,!0):!_&&!s.allErrors&&e.if((0,Um.not)(p),()=>e.break())})})}}};q0.default=IW});var JI=V(O0=>{"use strict";Object.defineProperty(O0,"__esModule",{value:!0});var PW=st(),kW={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,PW.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};O0.default=kW});var GI=V(I0=>{"use strict";Object.defineProperty(I0,"__esModule",{value:!0});var AW=Vn(),TW={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:AW.validateUnion,error:{message:"must match a schema in anyOf"}};I0.default=TW});var YI=V(P0=>{"use strict";Object.defineProperty(P0,"__esModule",{value:!0});var Hm=Ge(),$W=st(),NW={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Hm._)`{passingSchemas: ${t.passing}}`},MW={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:NW,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let s=r,o=e.let("valid",!1),l=e.let("passing",null),c=e.name("_valid");t.setParams({passing:l}),e.block(d),t.result(o,()=>t.reset(),()=>t.error(!0));function d(){s.forEach((p,m)=>{let y;(0,$W.alwaysValidSchema)(i,p)?e.var(c,!0):y=t.subschema({keyword:"oneOf",schemaProp:m,compositeRule:!0},c),m>0&&e.if((0,Hm._)`${c} && ${o}`).assign(o,!1).assign(l,(0,Hm._)`[${l}, ${m}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(l,m),y&&t.mergeEvaluated(y,Hm.Name)})})}}};P0.default=MW});var KI=V(k0=>{"use strict";Object.defineProperty(k0,"__esModule",{value:!0});var FW=st(),DW={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((s,o)=>{if((0,FW.alwaysValidSchema)(n,s))return;let l=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(l)})}};k0.default=DW});var XI=V(A0=>{"use strict";Object.defineProperty(A0,"__esModule",{value:!0});var Bm=Ge(),ZI=st(),jW={message:({params:t})=>(0,Bm.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Bm._)`{failingKeyword: ${t.ifClause}}`},LW={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:jW,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,ZI.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=QI(n,"then"),s=QI(n,"else");if(!i&&!s)return;let o=e.let("valid",!0),l=e.name("_valid");if(c(),t.reset(),i&&s){let p=e.let("ifClause");t.setParams({ifClause:p}),e.if(l,d("then",p),d("else",p))}else i?e.if(l,d("then")):e.if((0,Bm.not)(l),d("else"));t.pass(o,()=>t.error(!0));function c(){let p=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);t.mergeEvaluated(p)}function d(p,m){return()=>{let y=t.subschema({keyword:p},l);e.assign(o,l),t.mergeValidEvaluated(y,o),m?e.assign(m,(0,Bm._)`${p}`):t.setParams({ifClause:p})}}}};function QI(t,e){let r=t.schema[e];return r!==void 0&&!(0,ZI.alwaysValidSchema)(t,r)}A0.default=LW});var eP=V(T0=>{"use strict";Object.defineProperty(T0,"__esModule",{value:!0});var UW=st(),HW={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,UW.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};T0.default=HW});var tP=V($0=>{"use strict";Object.defineProperty($0,"__esModule",{value:!0});var BW=g0(),VW=kI(),WW=y0(),zW=TI(),JW=$I(),GW=FI(),YW=jI(),KW=C0(),QW=HI(),ZW=zI(),XW=JI(),ez=GI(),tz=YI(),rz=KI(),nz=XI(),iz=eP();function sz(t=!1){let e=[XW.default,ez.default,tz.default,rz.default,nz.default,iz.default,YW.default,KW.default,GW.default,QW.default,ZW.default];return t?e.push(VW.default,zW.default):e.push(BW.default,WW.default),e.push(JW.default),e}$0.default=sz});var rP=V(N0=>{"use strict";Object.defineProperty(N0,"__esModule",{value:!0});var Zt=Ge(),oz={message:({schemaCode:t})=>(0,Zt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Zt._)`{format: ${t}}`},az={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:oz,code(t,e){let{gen:r,data:n,$data:i,schema:s,schemaCode:o,it:l}=t,{opts:c,errSchemaPath:d,schemaEnv:p,self:m}=l;if(!c.validateFormats)return;i?y():b();function y(){let E=r.scopeValue("formats",{ref:m.formats,code:c.code.formats}),C=r.const("fDef",(0,Zt._)`${E}[${o}]`),v=r.let("fType"),_=r.let("format");r.if((0,Zt._)`typeof ${C} == "object" && !(${C} instanceof RegExp)`,()=>r.assign(v,(0,Zt._)`${C}.type || "string"`).assign(_,(0,Zt._)`${C}.validate`),()=>r.assign(v,(0,Zt._)`"string"`).assign(_,C)),t.fail$data((0,Zt.or)(q(),k()));function q(){return c.strictSchema===!1?Zt.nil:(0,Zt._)`${o} && !${_}`}function k(){let O=p.$async?(0,Zt._)`(${C}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,Zt._)`${_}(${n})`,M=(0,Zt._)`(typeof ${_} == "function" ? ${O} : ${_}.test(${n}))`;return(0,Zt._)`${_} && ${_} !== true && ${v} === ${e} && !${M}`}}function b(){let E=m.formats[s];if(!E){q();return}if(E===!0)return;let[C,v,_]=k(E);C===e&&t.pass(O());function q(){if(c.strictSchema===!1){m.logger.warn(M());return}throw new Error(M());function M(){return`unknown format "${s}" ignored in schema at path "${d}"`}}function k(M){let j=M instanceof RegExp?(0,Zt.regexpCode)(M):c.code.formats?(0,Zt._)`${c.code.formats}${(0,Zt.getProperty)(s)}`:void 0,I=r.scopeValue("formats",{key:s,ref:M,code:j});return typeof M=="object"&&!(M instanceof RegExp)?[M.type||"string",M.validate,(0,Zt._)`${I}.validate`]:["string",M,I]}function O(){if(typeof E=="object"&&!(E instanceof RegExp)&&E.async){if(!p.$async)throw new Error("async format in sync schema");return(0,Zt._)`await ${_}(${n})`}return typeof v=="function"?(0,Zt._)`${_}(${n})`:(0,Zt._)`${_}.test(${n})`}}}};N0.default=az});var nP=V(M0=>{"use strict";Object.defineProperty(M0,"__esModule",{value:!0});var lz=rP(),uz=[lz.default];M0.default=uz});var iP=V(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.contentVocabulary=Lu.metadataVocabulary=void 0;Lu.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Lu.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var oP=V(F0=>{"use strict";Object.defineProperty(F0,"__esModule",{value:!0});var cz=pI(),fz=qI(),dz=tP(),pz=nP(),sP=iP(),hz=[cz.default,fz.default,(0,dz.default)(),pz.default,sP.metadataVocabulary,sP.contentVocabulary];F0.default=hz});var lP=V(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.DiscrError=void 0;var aP;(function(t){t.Tag="tag",t.Mapping="mapping"})(aP||(Vm.DiscrError=aP={}))});var cP=V(j0=>{"use strict";Object.defineProperty(j0,"__esModule",{value:!0});var Uu=Ge(),D0=lP(),uP=qm(),mz=Kf(),gz=st(),yz={message:({params:{discrError:t,tagName:e}})=>t===D0.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Uu._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},vz={keyword:"discriminator",type:"object",schemaType:"object",error:yz,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:s}=t,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let l=n.propertyName;if(typeof l!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),d=e.const("tag",(0,Uu._)`${r}${(0,Uu.getProperty)(l)}`);e.if((0,Uu._)`typeof ${d} == "string"`,()=>p(),()=>t.error(!1,{discrError:D0.DiscrError.Tag,tag:d,tagName:l})),t.ok(c);function p(){let b=y();e.if(!1);for(let E in b)e.elseIf((0,Uu._)`${d} === ${E}`),e.assign(c,m(b[E]));e.else(),t.error(!1,{discrError:D0.DiscrError.Mapping,tag:d,tagName:l}),e.endIf()}function m(b){let E=e.name("valid"),C=t.subschema({keyword:"oneOf",schemaProp:b},E);return t.mergeEvaluated(C,Uu.Name),E}function y(){var b;let E={},C=_(i),v=!0;for(let O=0;O<o.length;O++){let M=o[O];if(M?.$ref&&!(0,gz.schemaHasRulesButRef)(M,s.self.RULES)){let I=M.$ref;if(M=uP.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,I),M instanceof uP.SchemaEnv&&(M=M.schema),M===void 0)throw new mz.default(s.opts.uriResolver,s.baseId,I)}let j=(b=M?.properties)===null||b===void 0?void 0:b[l];if(typeof j!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);v=v&&(C||_(M)),q(j,O)}if(!v)throw new Error(`discriminator: "${l}" must be required`);return E;function _({required:O}){return Array.isArray(O)&&O.includes(l)}function q(O,M){if(O.const)k(O.const,M);else if(O.enum)for(let j of O.enum)k(j,M);else throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`)}function k(O,M){if(typeof O!="string"||O in E)throw new Error(`discriminator: "${l}" values must be unique strings`);E[O]=M}}}};j0.default=vz});var fP=V((qZ,bz)=>{bz.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var pP=V((Ft,L0)=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.MissingRefError=Ft.ValidationError=Ft.CodeGen=Ft.Name=Ft.nil=Ft.stringify=Ft.str=Ft._=Ft.KeywordCxt=Ft.Ajv=void 0;var Sz=aI(),wz=oP(),_z=cP(),dP=fP(),Rz=["/properties"],Wm="http://json-schema.org/draft-07/schema",Hu=class extends Sz.default{_addVocabularies(){super._addVocabularies(),wz.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(_z.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(dP,Rz):dP;this.addMetaSchema(e,Wm,!1),this.refs["http://json-schema.org/schema"]=Wm}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Wm)?Wm:void 0)}};Ft.Ajv=Hu;L0.exports=Ft=Hu;L0.exports.Ajv=Hu;Object.defineProperty(Ft,"__esModule",{value:!0});Ft.default=Hu;var Cz=Yf();Object.defineProperty(Ft,"KeywordCxt",{enumerable:!0,get:function(){return Cz.KeywordCxt}});var Bu=Ge();Object.defineProperty(Ft,"_",{enumerable:!0,get:function(){return Bu._}});Object.defineProperty(Ft,"str",{enumerable:!0,get:function(){return Bu.str}});Object.defineProperty(Ft,"stringify",{enumerable:!0,get:function(){return Bu.stringify}});Object.defineProperty(Ft,"nil",{enumerable:!0,get:function(){return Bu.nil}});Object.defineProperty(Ft,"Name",{enumerable:!0,get:function(){return Bu.Name}});Object.defineProperty(Ft,"CodeGen",{enumerable:!0,get:function(){return Bu.CodeGen}});var xz=xm();Object.defineProperty(Ft,"ValidationError",{enumerable:!0,get:function(){return xz.default}});var Ez=Kf();Object.defineProperty(Ft,"MissingRefError",{enumerable:!0,get:function(){return Ez.default}})});function fd(){return{format:(t,e)=>{let r=t?new Date(t):new Date;return e==="YYYY-MM-DD"?r.toISOString().split("T")[0]:r.toISOString()},unix:()=>Math.floor(Date.now()/1e3),utc:()=>{let t=new Date;return{format:()=>t.toISOString(),toISOString:()=>t.toISOString()}},__isShim:!0,__warning:"This is a lightweight shim. For full features, install moment.js via modules/package.json"}}function U0(){return{get:(t,e,r)=>{let n=e.split("."),i=t;for(let s of n)if(i=i?.[s],i===void 0)return r;return i},set:(t,e,r)=>{let n=e.split("."),i=t;for(let s=0;s<n.length-1;s++)i[n[s]]||(i[n[s]]={}),i=i[n[s]];return i[n[n.length-1]]=r,t},cloneDeep:t=>JSON.parse(JSON.stringify(t)),keys:t=>Object.keys(t??{}),values:t=>Object.values(t??{}),entries:t=>Object.entries(t??{}),each(t,e){Array.isArray(t)?t.forEach((r,n)=>e(r,n,t)):t&&typeof t=="object"&&Object.entries(t).forEach(([r,n])=>e(n,r,t))},forEach(t,e){Array.isArray(t)?t.forEach((r,n)=>e(r,n,t)):t&&typeof t=="object"&&Object.entries(t).forEach(([r,n])=>e(n,r,t))},map:(t,e)=>(Array.isArray(t)?t:Object.values(t??{})).map(r=>e(r)),filter:(t,e)=>(Array.isArray(t)?t:Object.values(t??{})).filter(r=>e(r)),find:(t,e)=>(Array.isArray(t)?t:Object.values(t??{})).find(r=>e(r)),reduce:(t,e,r)=>(Array.isArray(t)?t:Object.values(t??{})).reduce((n,i)=>e(n,i),r),includes:(t,e)=>Array.isArray(t)?t.includes(e):Object.values(t??{}).includes(e),isObject:t=>t!==null&&typeof t=="object"&&!Array.isArray(t),isArray:t=>Array.isArray(t),isString:t=>typeof t=="string",isNumber:t=>typeof t=="number",isFunction:t=>typeof t=="function",isNil:t=>t==null,isEmpty:t=>t==null?!0:Array.isArray(t)||typeof t=="string"?t.length===0:typeof t=="object"?Object.keys(t).length===0:!1,assign:(t,...e)=>Object.assign(t,...e),merge:(t,...e)=>{let r={...t};for(let n of e)for(let[i,s]of Object.entries(n??{}))r[i]=s&&typeof s=="object"&&!Array.isArray(s)?{...r[i]??{},...s}:s;return r},omit:(t,e)=>{let r={...t};for(let n of e)delete r[n];return r},pick:(t,e)=>{let r={};for(let n of e)n in(t??{})&&(r[n]=t[n]);return r}}}function zm(t,e){return new cd(t,e)}var qz,Va,hP,hi,cd,H0=ae(()=>{"use strict";qz=ve(require("crypto")),Va=ve(require("fs")),hP=require("module"),hi=ve(require("path"));XS();cd=class{availableModules=new Set;customModulesRequire;globalSetupExports;options;modulesPath=null;moduleCache=new Map;resolveStack=new Set;builtinModules={uuid:()=>({v4:Ru}),crypto:()=>qz,path:()=>hi,querystring:()=>require("querystring"),lodash:()=>this.loadOptionalModule("lodash",()=>Aq(),U0),moment:()=>this.loadOptionalModule("moment",()=>Tq(),fd),tv4:()=>this.loadOptionalModule("tv4",()=>Nq()),ajv:()=>this.loadOptionalModule("ajv",()=>pP()),"crypto-js":()=>this.loadOptionalModule("crypto-js",()=>require("crypto-js"),()=>{throw new Error('crypto-js npm module is not installed. The built-in CryptoJS global is already available in scripts with AES/DES/TripleDES/hash/HMAC/PBKDF2 support. If you need the exact npm package, add "crypto-js" to your modules/package.json and run npm install.')})};constructor(e=[],r={}){this.options={allowCustomModules:!0,maxResolveDepth:10,...r,outputChannel:r.outputChannel||{appendLine:n=>{console.log(`[ModuleLoader] ${n}`)}}};for(let n of e){let i=hi.resolve(n);if(this.initializeModules(i)){this.modulesPath=i;break}}}loadOptionalModule(e,r,n){try{return r()}catch{if(this.customModulesRequire)try{return console.debug(`[ModuleLoader] ${e} not in core, trying user modules`),this.customModulesRequire(e)}catch{this.logModuleWarning(e,"user")}else this.logModuleWarning(e,"core");if(n)return console.warn(`[ModuleLoader] Using shim for ${e}. Some features may be limited.`),n();throw new Error(this.getModuleInstallInstructions(e))}}logModuleWarning(e,r){let i={moment:"Date/time manipulation",lodash:"Utility functions",tv4:"JSON Schema validation (v4)",ajv:"JSON Schema validation"}[e]||e;console.warn(`[ModuleLoader] ${i} functionality (${e}) is not available.
|
|
30
|
+
deps: ${r}}`};var bW={keyword:"dependencies",type:"object",schemaType:"object",error:Yi.error,code(t){let[e,r]=SW(t);NI(t,e),MI(t,r)}};function SW({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function NI(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let o in e){let l=e[o];if(l.length===0)continue;let c=(0,ud.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:l.length,deps:l.join(", ")}),i.allErrors?r.if(c,()=>{for(let d of l)(0,ud.checkReportMissingProp)(t,d)}):(r.if((0,w0._)`${c} && (${(0,ud.checkMissingProp)(t,l,s)})`),(0,ud.reportMissingProp)(t,s),r.else())}}Yi.validatePropertyDeps=NI;function MI(t,e=t.schema){let{gen:r,data:n,keyword:i,it:s}=t,o=r.name("valid");for(let l in e)(0,vW.alwaysValidSchema)(s,e[l])||(r.if((0,ud.propertyInData)(r,n,l,s.opts.ownProperties),()=>{let c=t.subschema({keyword:i,schemaProp:l},o);t.mergeValidEvaluated(c,o)},()=>r.var(o,!0)),t.ok(o))}Yi.validateSchemaDeps=MI;Yi.default=bW});var jI=V(_0=>{"use strict";Object.defineProperty(_0,"__esModule",{value:!0});var DI=Ge(),wW=st(),_W={message:"property name must be valid",params:({params:t})=>(0,DI._)`{propertyName: ${t.propertyName}}`},RW={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:_W,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,wW.alwaysValidSchema)(i,r))return;let s=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),e.if((0,DI.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};_0.default=RW});var C0=V(R0=>{"use strict";Object.defineProperty(R0,"__esModule",{value:!0});var jm=Vn(),pi=Ge(),CW=Os(),Lm=st(),xW={message:"must NOT have additional properties",params:({params:t})=>(0,pi._)`{additionalProperty: ${t.additionalProperty}}`},EW={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:xW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:s,it:o}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:l,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,Lm.alwaysValidSchema)(o,r))return;let d=(0,jm.allSchemaProperties)(n.properties),p=(0,jm.allSchemaProperties)(n.patternProperties);m(),t.ok((0,pi._)`${s} === ${CW.default.errors}`);function m(){e.forIn("key",i,v=>{!d.length&&!p.length?q(v):e.if(y(v),()=>q(v))})}function y(v){let _;if(d.length>8){let E=(0,Lm.schemaRefOrVal)(o,n.properties,"properties");_=(0,jm.isOwnProperty)(e,E,v)}else d.length?_=(0,pi.or)(...d.map(E=>(0,pi._)`${v} === ${E}`)):_=pi.nil;return p.length&&(_=(0,pi.or)(_,...p.map(E=>(0,pi._)`${(0,jm.usePattern)(t,E)}.test(${v})`))),(0,pi.not)(_)}function b(v){e.code((0,pi._)`delete ${i}[${v}]`)}function q(v){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){b(v);return}if(r===!1){t.setParams({additionalProperty:v}),t.error(),l||e.break();return}if(typeof r=="object"&&!(0,Lm.alwaysValidSchema)(o,r)){let _=e.name("valid");c.removeAdditional==="failing"?(C(v,_,!1),e.if((0,pi.not)(_),()=>{t.reset(),b(v)})):(C(v,_),l||e.if((0,pi.not)(_),()=>e.break()))}}function C(v,_,E){let k={keyword:"additionalProperties",dataProp:v,dataPropType:Lm.Type.Str};E===!1&&Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(k,_)}}};R0.default=EW});var HI=V(E0=>{"use strict";Object.defineProperty(E0,"__esModule",{value:!0});var qW=Yf(),LI=Vn(),x0=st(),UI=C0(),OW={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&UI.default.code(new qW.KeywordCxt(s,UI.default,"additionalProperties"));let o=(0,LI.allSchemaProperties)(r);for(let m of o)s.definedProperties.add(m);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=x0.mergeEvaluated.props(e,(0,x0.toHash)(o),s.props));let l=o.filter(m=>!(0,x0.alwaysValidSchema)(s,r[m]));if(l.length===0)return;let c=e.name("valid");for(let m of l)d(m)?p(m):(e.if((0,LI.propertyInData)(e,i,m,s.opts.ownProperties)),p(m),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(m),t.ok(c);function d(m){return s.opts.useDefaults&&!s.compositeRule&&r[m].default!==void 0}function p(m){t.subschema({keyword:"properties",schemaProp:m,dataProp:m},c)}}};E0.default=OW});var zI=V(q0=>{"use strict";Object.defineProperty(q0,"__esModule",{value:!0});var BI=Vn(),Um=Ge(),VI=st(),WI=st(),IW={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:s}=t,{opts:o}=s,l=(0,BI.allSchemaProperties)(r),c=l.filter(C=>(0,VI.alwaysValidSchema)(s,r[C]));if(l.length===0||c.length===l.length&&(!s.opts.unevaluated||s.props===!0))return;let d=o.strictSchema&&!o.allowMatchingProperties&&i.properties,p=e.name("valid");s.props!==!0&&!(s.props instanceof Um.Name)&&(s.props=(0,WI.evaluatedPropsToName)(e,s.props));let{props:m}=s;y();function y(){for(let C of l)d&&b(C),s.allErrors?q(C):(e.var(p,!0),q(C),e.if(p))}function b(C){for(let v in d)new RegExp(C).test(v)&&(0,VI.checkStrictMode)(s,`property ${v} matches pattern ${C} (use allowMatchingProperties)`)}function q(C){e.forIn("key",n,v=>{e.if((0,Um._)`${(0,BI.usePattern)(t,C)}.test(${v})`,()=>{let _=c.includes(C);_||t.subschema({keyword:"patternProperties",schemaProp:C,dataProp:v,dataPropType:WI.Type.Str},p),s.opts.unevaluated&&m!==!0?e.assign((0,Um._)`${m}[${v}]`,!0):!_&&!s.allErrors&&e.if((0,Um.not)(p),()=>e.break())})})}}};q0.default=IW});var JI=V(O0=>{"use strict";Object.defineProperty(O0,"__esModule",{value:!0});var PW=st(),kW={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,PW.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};O0.default=kW});var GI=V(I0=>{"use strict";Object.defineProperty(I0,"__esModule",{value:!0});var AW=Vn(),TW={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:AW.validateUnion,error:{message:"must match a schema in anyOf"}};I0.default=TW});var YI=V(P0=>{"use strict";Object.defineProperty(P0,"__esModule",{value:!0});var Hm=Ge(),$W=st(),NW={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Hm._)`{passingSchemas: ${t.passing}}`},MW={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:NW,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let s=r,o=e.let("valid",!1),l=e.let("passing",null),c=e.name("_valid");t.setParams({passing:l}),e.block(d),t.result(o,()=>t.reset(),()=>t.error(!0));function d(){s.forEach((p,m)=>{let y;(0,$W.alwaysValidSchema)(i,p)?e.var(c,!0):y=t.subschema({keyword:"oneOf",schemaProp:m,compositeRule:!0},c),m>0&&e.if((0,Hm._)`${c} && ${o}`).assign(o,!1).assign(l,(0,Hm._)`[${l}, ${m}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(l,m),y&&t.mergeEvaluated(y,Hm.Name)})})}}};P0.default=MW});var KI=V(k0=>{"use strict";Object.defineProperty(k0,"__esModule",{value:!0});var FW=st(),DW={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((s,o)=>{if((0,FW.alwaysValidSchema)(n,s))return;let l=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(l)})}};k0.default=DW});var XI=V(A0=>{"use strict";Object.defineProperty(A0,"__esModule",{value:!0});var Bm=Ge(),ZI=st(),jW={message:({params:t})=>(0,Bm.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Bm._)`{failingKeyword: ${t.ifClause}}`},LW={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:jW,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,ZI.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=QI(n,"then"),s=QI(n,"else");if(!i&&!s)return;let o=e.let("valid",!0),l=e.name("_valid");if(c(),t.reset(),i&&s){let p=e.let("ifClause");t.setParams({ifClause:p}),e.if(l,d("then",p),d("else",p))}else i?e.if(l,d("then")):e.if((0,Bm.not)(l),d("else"));t.pass(o,()=>t.error(!0));function c(){let p=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);t.mergeEvaluated(p)}function d(p,m){return()=>{let y=t.subschema({keyword:p},l);e.assign(o,l),t.mergeValidEvaluated(y,o),m?e.assign(m,(0,Bm._)`${p}`):t.setParams({ifClause:p})}}}};function QI(t,e){let r=t.schema[e];return r!==void 0&&!(0,ZI.alwaysValidSchema)(t,r)}A0.default=LW});var eP=V(T0=>{"use strict";Object.defineProperty(T0,"__esModule",{value:!0});var UW=st(),HW={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,UW.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};T0.default=HW});var tP=V($0=>{"use strict";Object.defineProperty($0,"__esModule",{value:!0});var BW=g0(),VW=kI(),WW=y0(),zW=TI(),JW=$I(),GW=FI(),YW=jI(),KW=C0(),QW=HI(),ZW=zI(),XW=JI(),ez=GI(),tz=YI(),rz=KI(),nz=XI(),iz=eP();function sz(t=!1){let e=[XW.default,ez.default,tz.default,rz.default,nz.default,iz.default,YW.default,KW.default,GW.default,QW.default,ZW.default];return t?e.push(VW.default,zW.default):e.push(BW.default,WW.default),e.push(JW.default),e}$0.default=sz});var rP=V(N0=>{"use strict";Object.defineProperty(N0,"__esModule",{value:!0});var Zt=Ge(),oz={message:({schemaCode:t})=>(0,Zt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Zt._)`{format: ${t}}`},az={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:oz,code(t,e){let{gen:r,data:n,$data:i,schema:s,schemaCode:o,it:l}=t,{opts:c,errSchemaPath:d,schemaEnv:p,self:m}=l;if(!c.validateFormats)return;i?y():b();function y(){let q=r.scopeValue("formats",{ref:m.formats,code:c.code.formats}),C=r.const("fDef",(0,Zt._)`${q}[${o}]`),v=r.let("fType"),_=r.let("format");r.if((0,Zt._)`typeof ${C} == "object" && !(${C} instanceof RegExp)`,()=>r.assign(v,(0,Zt._)`${C}.type || "string"`).assign(_,(0,Zt._)`${C}.validate`),()=>r.assign(v,(0,Zt._)`"string"`).assign(_,C)),t.fail$data((0,Zt.or)(E(),k()));function E(){return c.strictSchema===!1?Zt.nil:(0,Zt._)`${o} && !${_}`}function k(){let O=p.$async?(0,Zt._)`(${C}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,Zt._)`${_}(${n})`,M=(0,Zt._)`(typeof ${_} == "function" ? ${O} : ${_}.test(${n}))`;return(0,Zt._)`${_} && ${_} !== true && ${v} === ${e} && !${M}`}}function b(){let q=m.formats[s];if(!q){E();return}if(q===!0)return;let[C,v,_]=k(q);C===e&&t.pass(O());function E(){if(c.strictSchema===!1){m.logger.warn(M());return}throw new Error(M());function M(){return`unknown format "${s}" ignored in schema at path "${d}"`}}function k(M){let j=M instanceof RegExp?(0,Zt.regexpCode)(M):c.code.formats?(0,Zt._)`${c.code.formats}${(0,Zt.getProperty)(s)}`:void 0,I=r.scopeValue("formats",{key:s,ref:M,code:j});return typeof M=="object"&&!(M instanceof RegExp)?[M.type||"string",M.validate,(0,Zt._)`${I}.validate`]:["string",M,I]}function O(){if(typeof q=="object"&&!(q instanceof RegExp)&&q.async){if(!p.$async)throw new Error("async format in sync schema");return(0,Zt._)`await ${_}(${n})`}return typeof v=="function"?(0,Zt._)`${_}(${n})`:(0,Zt._)`${_}.test(${n})`}}}};N0.default=az});var nP=V(M0=>{"use strict";Object.defineProperty(M0,"__esModule",{value:!0});var lz=rP(),uz=[lz.default];M0.default=uz});var iP=V(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.contentVocabulary=Lu.metadataVocabulary=void 0;Lu.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Lu.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var oP=V(F0=>{"use strict";Object.defineProperty(F0,"__esModule",{value:!0});var cz=pI(),fz=qI(),dz=tP(),pz=nP(),sP=iP(),hz=[cz.default,fz.default,(0,dz.default)(),pz.default,sP.metadataVocabulary,sP.contentVocabulary];F0.default=hz});var lP=V(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.DiscrError=void 0;var aP;(function(t){t.Tag="tag",t.Mapping="mapping"})(aP||(Vm.DiscrError=aP={}))});var cP=V(j0=>{"use strict";Object.defineProperty(j0,"__esModule",{value:!0});var Uu=Ge(),D0=lP(),uP=qm(),mz=Kf(),gz=st(),yz={message:({params:{discrError:t,tagName:e}})=>t===D0.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Uu._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},vz={keyword:"discriminator",type:"object",schemaType:"object",error:yz,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:s}=t,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let l=n.propertyName;if(typeof l!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),d=e.const("tag",(0,Uu._)`${r}${(0,Uu.getProperty)(l)}`);e.if((0,Uu._)`typeof ${d} == "string"`,()=>p(),()=>t.error(!1,{discrError:D0.DiscrError.Tag,tag:d,tagName:l})),t.ok(c);function p(){let b=y();e.if(!1);for(let q in b)e.elseIf((0,Uu._)`${d} === ${q}`),e.assign(c,m(b[q]));e.else(),t.error(!1,{discrError:D0.DiscrError.Mapping,tag:d,tagName:l}),e.endIf()}function m(b){let q=e.name("valid"),C=t.subschema({keyword:"oneOf",schemaProp:b},q);return t.mergeEvaluated(C,Uu.Name),q}function y(){var b;let q={},C=_(i),v=!0;for(let O=0;O<o.length;O++){let M=o[O];if(M?.$ref&&!(0,gz.schemaHasRulesButRef)(M,s.self.RULES)){let I=M.$ref;if(M=uP.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,I),M instanceof uP.SchemaEnv&&(M=M.schema),M===void 0)throw new mz.default(s.opts.uriResolver,s.baseId,I)}let j=(b=M?.properties)===null||b===void 0?void 0:b[l];if(typeof j!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);v=v&&(C||_(M)),E(j,O)}if(!v)throw new Error(`discriminator: "${l}" must be required`);return q;function _({required:O}){return Array.isArray(O)&&O.includes(l)}function E(O,M){if(O.const)k(O.const,M);else if(O.enum)for(let j of O.enum)k(j,M);else throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`)}function k(O,M){if(typeof O!="string"||O in q)throw new Error(`discriminator: "${l}" values must be unique strings`);q[O]=M}}}};j0.default=vz});var fP=V((qZ,bz)=>{bz.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var pP=V((Ft,L0)=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.MissingRefError=Ft.ValidationError=Ft.CodeGen=Ft.Name=Ft.nil=Ft.stringify=Ft.str=Ft._=Ft.KeywordCxt=Ft.Ajv=void 0;var Sz=aI(),wz=oP(),_z=cP(),dP=fP(),Rz=["/properties"],Wm="http://json-schema.org/draft-07/schema",Hu=class extends Sz.default{_addVocabularies(){super._addVocabularies(),wz.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(_z.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(dP,Rz):dP;this.addMetaSchema(e,Wm,!1),this.refs["http://json-schema.org/schema"]=Wm}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Wm)?Wm:void 0)}};Ft.Ajv=Hu;L0.exports=Ft=Hu;L0.exports.Ajv=Hu;Object.defineProperty(Ft,"__esModule",{value:!0});Ft.default=Hu;var Cz=Yf();Object.defineProperty(Ft,"KeywordCxt",{enumerable:!0,get:function(){return Cz.KeywordCxt}});var Bu=Ge();Object.defineProperty(Ft,"_",{enumerable:!0,get:function(){return Bu._}});Object.defineProperty(Ft,"str",{enumerable:!0,get:function(){return Bu.str}});Object.defineProperty(Ft,"stringify",{enumerable:!0,get:function(){return Bu.stringify}});Object.defineProperty(Ft,"nil",{enumerable:!0,get:function(){return Bu.nil}});Object.defineProperty(Ft,"Name",{enumerable:!0,get:function(){return Bu.Name}});Object.defineProperty(Ft,"CodeGen",{enumerable:!0,get:function(){return Bu.CodeGen}});var xz=xm();Object.defineProperty(Ft,"ValidationError",{enumerable:!0,get:function(){return xz.default}});var Ez=Kf();Object.defineProperty(Ft,"MissingRefError",{enumerable:!0,get:function(){return Ez.default}})});function fd(){return{format:(t,e)=>{let r=t?new Date(t):new Date;return e==="YYYY-MM-DD"?r.toISOString().split("T")[0]:r.toISOString()},unix:()=>Math.floor(Date.now()/1e3),utc:()=>{let t=new Date;return{format:()=>t.toISOString(),toISOString:()=>t.toISOString()}},__isShim:!0,__warning:"This is a lightweight shim. For full features, install moment.js via modules/package.json"}}function U0(){return{get:(t,e,r)=>{let n=e.split("."),i=t;for(let s of n)if(i=i?.[s],i===void 0)return r;return i},set:(t,e,r)=>{let n=e.split("."),i=t;for(let s=0;s<n.length-1;s++)i[n[s]]||(i[n[s]]={}),i=i[n[s]];return i[n[n.length-1]]=r,t},cloneDeep:t=>JSON.parse(JSON.stringify(t)),keys:t=>Object.keys(t??{}),values:t=>Object.values(t??{}),entries:t=>Object.entries(t??{}),each(t,e){Array.isArray(t)?t.forEach((r,n)=>e(r,n,t)):t&&typeof t=="object"&&Object.entries(t).forEach(([r,n])=>e(n,r,t))},forEach(t,e){Array.isArray(t)?t.forEach((r,n)=>e(r,n,t)):t&&typeof t=="object"&&Object.entries(t).forEach(([r,n])=>e(n,r,t))},map:(t,e)=>(Array.isArray(t)?t:Object.values(t??{})).map(r=>e(r)),filter:(t,e)=>(Array.isArray(t)?t:Object.values(t??{})).filter(r=>e(r)),find:(t,e)=>(Array.isArray(t)?t:Object.values(t??{})).find(r=>e(r)),reduce:(t,e,r)=>(Array.isArray(t)?t:Object.values(t??{})).reduce((n,i)=>e(n,i),r),includes:(t,e)=>Array.isArray(t)?t.includes(e):Object.values(t??{}).includes(e),isObject:t=>t!==null&&typeof t=="object"&&!Array.isArray(t),isArray:t=>Array.isArray(t),isString:t=>typeof t=="string",isNumber:t=>typeof t=="number",isFunction:t=>typeof t=="function",isNil:t=>t==null,isEmpty:t=>t==null?!0:Array.isArray(t)||typeof t=="string"?t.length===0:typeof t=="object"?Object.keys(t).length===0:!1,assign:(t,...e)=>Object.assign(t,...e),merge:(t,...e)=>{let r={...t};for(let n of e)for(let[i,s]of Object.entries(n??{}))r[i]=s&&typeof s=="object"&&!Array.isArray(s)?{...r[i]??{},...s}:s;return r},omit:(t,e)=>{let r={...t};for(let n of e)delete r[n];return r},pick:(t,e)=>{let r={};for(let n of e)n in(t??{})&&(r[n]=t[n]);return r}}}function zm(t,e){return new cd(t,e)}var qz,Va,hP,hi,cd,H0=ae(()=>{"use strict";qz=ve(require("crypto")),Va=ve(require("fs")),hP=require("module"),hi=ve(require("path"));XS();cd=class{availableModules=new Set;customModulesRequire;globalSetupExports;options;modulesPath=null;moduleCache=new Map;resolveStack=new Set;builtinModules={uuid:()=>({v4:Ru}),crypto:()=>qz,path:()=>hi,querystring:()=>require("querystring"),lodash:()=>this.loadOptionalModule("lodash",()=>Aq(),U0),moment:()=>this.loadOptionalModule("moment",()=>Tq(),fd),tv4:()=>this.loadOptionalModule("tv4",()=>Nq()),ajv:()=>this.loadOptionalModule("ajv",()=>pP()),"crypto-js":()=>this.loadOptionalModule("crypto-js",()=>require("crypto-js"),()=>{throw new Error('crypto-js npm module is not installed. The built-in CryptoJS global is already available in scripts with AES/DES/TripleDES/hash/HMAC/PBKDF2 support. If you need the exact npm package, add "crypto-js" to your modules/package.json and run npm install.')})};constructor(e=[],r={}){this.options={allowCustomModules:!0,maxResolveDepth:10,...r,outputChannel:r.outputChannel||{appendLine:n=>{console.log(`[ModuleLoader] ${n}`)}}};for(let n of e){let i=hi.resolve(n);if(this.initializeModules(i)){this.modulesPath=i;break}}}loadOptionalModule(e,r,n){try{return r()}catch{if(this.customModulesRequire)try{return console.debug(`[ModuleLoader] ${e} not in core, trying user modules`),this.customModulesRequire(e)}catch{this.logModuleWarning(e,"user")}else this.logModuleWarning(e,"core");if(n)return console.warn(`[ModuleLoader] Using shim for ${e}. Some features may be limited.`),n();throw new Error(this.getModuleInstallInstructions(e))}}logModuleWarning(e,r){let i={moment:"Date/time manipulation",lodash:"Utility functions",tv4:"JSON Schema validation (v4)",ajv:"JSON Schema validation"}[e]||e;console.warn(`[ModuleLoader] ${i} functionality (${e}) is not available.
|
|
31
31
|
${this.getModuleInstallInstructions(e)}`)}getModuleInstallInstructions(e){let n={moment:"^2.30.1",lodash:"^4.17.21",tv4:"^1.3.0",ajv:"^8.17.1"}[e]||"latest";return`To use ${e}, add it to http-forge/modules/package.json:
|
|
32
32
|
{
|
|
33
33
|
"dependencies": {
|
|
@@ -49,10 +49,10 @@ ${i}
|
|
|
49
49
|
|
|
50
50
|
// --- Next Script ---
|
|
51
51
|
|
|
52
|
-
`)}function Vu(t,e){return JSON.stringify(t)!==JSON.stringify(e)}function Ja(t){return t.map(e=>{let r=e.args.map(n=>{if(typeof n=="object")try{return JSON.stringify(n,null,2)}catch{return String(n)}return String(n)}).join(" ");return`[${e.level}] ${r}`})}function vP(t){return{log:(...e)=>t.push({level:"log",args:e}),info:(...e)=>t.push({level:"info",args:e}),warn:(...e)=>t.push({level:"warn",args:e}),error:(...e)=>t.push({level:"error",args:e})}}function Ym(t){let e=[],r=(n,i)=>{try{let s=i();if(s&&typeof s.then=="function"){let o=s.then(()=>{t.push({name:n,passed:!0})},l=>{t.push({name:n,passed:!1,message:l.message||String(l)})});e.push(o)}else t.push({name:n,passed:!0})}catch(s){t.push({name:n,passed:!1,message:s.message})}};return r.skip=(n,i)=>{t.push({name:n,passed:!0,skipped:!0})},r.fail=n=>{t.push({name:n||"Failed test",passed:!1,message:n||"pm.test.fail()"})},r.index=()=>t.length,r._pendingTests=e,r}function Km(t){let e={};for(let[r,n]of Object.entries(t))e[r]=Array.isArray(n)?n.join(", "):n;return e}function Qm(t,e,r){let n;if(r)try{n=new URL(r).hostname}catch{n=void 0}let i=Rt.parseCookieHeaders(t||{},n);return i.length>0?i:Array.isArray(e)&&e.length>0?e.filter(s=>s&&s.name).map(s=>({name:s.name,value:s.value,domain:s.domain??n,path:s.path,expires:s.expires,maxAge:s.maxAge,httpOnly:s.httpOnly,secure:s.secure,sameSite:s.sameSite})):[]}var hd=ae(()=>{"use strict";ka()});function Az(t){let e=null;try{e=new URL(t)}catch{}return{toString(){return t},valueOf(){return t},[Symbol.toPrimitive](n){return n==="number"?NaN:t},getHost(){return e?e.hostname:""},getPath(){return e?e.pathname:t},getPathWithQuery(){return e?e.pathname+e.search:t},getQueryString(){return e?e.search.startsWith("?")?e.search.slice(1):e.search:""},getRemote(){if(!e)return"";let n=e.port||(e.protocol==="https:"?"443":"80");return`${e.hostname}:${n}`},getOAuth1BaseUrl(){return e?`${e.protocol}//${e.host}${e.pathname}`:t},get protocol(){return e?.protocol?.replace(":","")||""},get host(){return e?e.hostname.split("."):[]},get port(){return e?.port||""},get path(){return e?e.pathname.split("/").filter(Boolean):[]},get hash(){return e?.hash?.replace("#","")||""},query:{toObject(){if(!e)return{};let n={};return e.searchParams.forEach((i,s)=>{n[s]=i}),n},has(n){return e?e.searchParams.has(n):!1},get(n){return e?e.searchParams.get(n):void 0},each(n){e&&e.searchParams.forEach((i,s)=>n({key:s,value:i}))}}}}var B0,Wu,V0=ae(()=>{"use strict";B0=ve(require("vm"));gP();Gm();hd();Wu=class{constructor(e,r){this.deps=e;this.initialContext=r;this.timerRegistry=mP(n=>{let i=n instanceof Error?n.message:String(n);this.consoleMessages.push({level:"error",args:[`Uncaught error in async callback: ${i}`]})}),this.initializeSession()}deps;initialContext;vmContext=null;ctx=null;modifiedRequest=null;assertions=[];consoleMessages=[];_variables={};_collectionVariables={};_globals={};_environmentVariables={};_liveEnvironmentScope=null;_liveGlobalsScope=null;_liveCollectionScope=null;_nextRequest=void 0;_skipRequest=!1;_visualizerData=void 0;timerRegistry;initializeSession(){this.modifiedRequest={url:this.initialContext.request.url,method:this.initialContext.request.method,headers:{...this.initialContext.request.headers},body:this.initialContext.request.body?{...this.initialContext.request.body}:null,params:this.initialContext.request.params?{...this.initialContext.request.params}:{},query:this.initialContext.request.query?{...this.initialContext.request.query}:{}},this.assertions=[],this.ctx=this.createSharedContext(),this.consoleMessages=[];let e=this,r={log:(...n)=>{e.consoleMessages.push({level:"log",args:n})},info:(...n)=>{e.consoleMessages.push({level:"info",args:n})},warn:(...n)=>{e.consoleMessages.push({level:"warn",args:n})},error:(...n)=>{e.consoleMessages.push({level:"error",args:n})}};this.vmContext=this.deps.createVM(this.ctx,r,this.timerRegistry.timers)}createSharedContext(){let e=this.initialContext,r=this.modifiedRequest,n=this.deps.createCommonContext(e,"prerequest");this._variables={...e.variables},this._collectionVariables={...e.collectionVariables||{}},this._globals={...e.globals||{}},this._environmentVariables={...e.environmentVariables||{}},this._liveEnvironmentScope=n.environment,this._liveGlobalsScope=n.globals,this._liveCollectionScope=n.collectionVariables;let i;try{i=new URL(e.request.url).hostname}catch{}let s={get:l=>e.cookieJar?e.cookieJar.get(l,i)?.value:void 0,set:(l,c)=>{e.cookieJar&&e.cookieJar.set({name:l,value:c,domain:i})},has:l=>e.cookieJar?e.cookieJar.has(l,i):!1,list:()=>e.cookieJar?e.cookieJar.getAll(i).map(l=>({name:l.name,value:l.value})):[],toObject:()=>{if(!e.cookieJar)return{};let l=e.cookieJar.getAll(i),c={};for(let d of l)c[d.name]=d.value;return c},jar:()=>{let l=e.cookieJar,c=d=>{if(d==null)return;let p=typeof d=="string"?d:typeof d=="object"||typeof d=="number"||typeof d=="boolean"?String(d):void 0;if(!p)return;let m=p.trim();if(m)try{return new URL(m).hostname}catch{return m}};return{getAll(d,p){try{if(!l){p(null,[]);return}let m=c(d),y=l.getAll(m).map(b=>({name:b.name,value:b.value,domain:b.domain,path:b.path,httpOnly:b.httpOnly,secure:b.secure}));p(null,y)}catch(m){p(m,[])}},get(d,p,m){try{if(!l){m(null,void 0);return}let y=c(d),b=l.get(p,y);m(null,b?{name:b.name,value:b.value,domain:b.domain}:void 0)}catch(y){m(y,void 0)}},set(d,p,m,y){try{if(!l){(y||m)?.(null);return}let b=c(d);typeof p=="string"&&typeof m=="string"?(l.set({name:p,value:m,domain:b}),y?.(null)):typeof p=="object"&&(l.set({...p,domain:b}),m?.(null))}catch(b){(y||m)?.(b)}},unset(d,p,m){try{if(!l){m?.(null);return}let y=c(d);l.delete(p,y),m?.(null)}catch(y){m?.(y)}},clear(d,p){try{let m=typeof d=="function"?d:p;if(!l){m?.(null);return}let y=typeof d=="function"?void 0:c(d);y&&typeof l.clearDomain=="function"?l.clearDomain(y):l.clear(),m?.(null)}catch(m){(typeof d=="function"?d:p)?.(m)}}}},remove:l=>{e.cookieJar&&e.cookieJar.delete(l,i)},unset:l=>{e.cookieJar&&e.cookieJar.delete(l,i)},clear:()=>{e.cookieJar&&e.cookieJar.clear()}},o=this;return{request:this.createRequestObject(r,e),response:null,test:Ym(this.assertions),expect:za,cookies:s,execution:{setNextRequest(l){o._nextRequest=l},skipRequest(){o._skipRequest=!0},runRequest(l,c){let p=(async()=>{if(typeof n.sendRequest!="function")throw new Error("pm.execution.runRequest is not available \u2014 HTTP service not configured.");let m=typeof l=="string"?{url:l,method:"GET"}:l,y=await n.sendRequest(m),b=Array.isArray(y?.cookies)?y.cookies.filter(v=>v?.name):[],E=y?.body,C=0;if(typeof E=="string")C=Buffer.byteLength(E,"utf8");else if(Buffer.isBuffer(E))C=E.length;else if(E!=null)try{C=Buffer.byteLength(JSON.stringify(E),"utf8")}catch{}return dd({executedRequest:null,status:y?.status??0,statusText:y?.statusText??"",headers:y?.headers??{},body:E,cookies:b,responseTime:y?.time,responseSize:C})})();if(typeof c=="function"){p.then(m=>c(null,m),m=>c(m));return}return p},location:{current:n.info?.requestName||"",currentRequestName:n.info?.requestName||"",eventName:"prerequest",toString(){return n.info?.requestName||""}}},setNextRequest(l){o._nextRequest=l},visualizer:{set(l,c){o._visualizerData={template:l,data:c}},clear(){o._visualizerData=void 0}},...n,info:{...n.info||{},eventName:"prerequest",requestName:n.info?.requestName||void 0,requestId:n.info?.requestId||void 0,iteration:e.iteration||0,iterationCount:e.iterationCount||1}}}createRequestObject(e,r){let n=l=>{if(!l)return"none";switch(l){case"raw":return"raw";case"form-data":return"formdata";case"x-www-form-urlencoded":return"urlencoded";case"binary":return"file";case"graphql":return"graphql";case"none":return"none";default:return"raw"}},i=l=>{if(!l)return"none";switch(l){case"raw":return"raw";case"formdata":return"form-data";case"urlencoded":return"x-www-form-urlencoded";case"file":return"binary";case"graphql":return"graphql";case"none":return"none";default:return"raw"}},s={...e.headers,add:l=>{l&&l.key&&(e.headers[l.key]=l.value||"")},get:l=>{for(let[c,d]of Object.entries(e.headers))if(c.toLowerCase()===l.toLowerCase())return d},has:l=>{for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.toLowerCase())return!0;return!1},remove:l=>{for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.toLowerCase()){delete e.headers[c];break}},update:l=>{if(l&&l.key){for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.key.toLowerCase()){e.headers[c]=l.value||"";return}}},upsert:l=>{if(l&&l.key){for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.key.toLowerCase()){e.headers[c]=l.value||"";return}e.headers[l.key]=l.value||""}},toObject:()=>{let l={};for(let[c,d]of Object.entries(e.headers))typeof d=="string"&&(l[c]=d);return l},each:l=>{for(let[c,d]of Object.entries(e.headers))typeof d=="string"&&l({key:c,value:d})}},o={get mode(){return n(e.body?.type)},set mode(l){let c=i(l);e.body?e.body.type=c:e.body={type:c,content:null}},get raw(){let l=e.body?.content;return typeof l=="string"?l:l&&typeof l=="object"?JSON.stringify(l):""},set raw(l){e.body?(e.body.type="raw",e.body.content=l):e.body={type:"raw",content:l}},get formdata(){return e.body?.type==="form-data"&&Array.isArray(e.body.content)?e.body.content:[]},get urlencoded(){return e.body?.type==="x-www-form-urlencoded"&&Array.isArray(e.body.content)?e.body.content:[]},get graphql(){return e.body?.type==="graphql"?e.body.content:null},get file(){return e.body?.type==="binary"?e.body.content:null}};return{get url(){return Az(e.url)},set url(l){e.url=typeof l=="string"?l:String(l)},get method(){return e.method},set method(l){e.method=l},headers:s,get body(){return o},set body(l){if(l==null)e.body=null;else if(typeof l=="string")e.body={type:"raw",content:l};else if(typeof l=="object")if(l.type||l.mode||l.content!==void 0){let c=l.mode?i(l.mode):l.type||"raw";e.body={type:c,format:l.format,content:l.content}}else e.body={type:"raw",content:l}},get params(){return e.params||{}},set params(l){e.params=l||{}},get query(){return e.query||{}},set query(l){e.query=l||{}},get auth(){return r.request?.auth||null},set auth(l){r.request&&(r.request.auth=l)},get certificate(){return r.request?.certificate||null},set certificate(l){r.request&&(r.request.certificate=l)},get description(){return r.request?.description||null},set description(l){r.request&&(r.request.description=l)},get name(){return r.request?.name||null},set name(l){r.request&&(r.request.name=l)},get id(){return r.request?.id||null},get disabled(){return r.request?.disabled||!1},set disabled(l){r.request&&(r.request.disabled=l)},get messages(){return r.request?.messages||[]},get methodPath(){return r.request?.methodPath||null},get metadata(){return r.request?.metadata||[]},getHeaders(l){let c={};for(let[d,p]of Object.entries(e.headers))typeof p=="string"&&(c[d]=p);return c},addQueryParams(l){if(typeof l=="string"){let c=new URLSearchParams(l);for(let[d,p]of c)e.query||(e.query={}),e.query[d]=p}else Array.isArray(l)&&(e.query||(e.query={}),l.forEach(c=>{c.key&&(e.query[c.key]=c.value||"")}))},removeQueryParams(l){e.query&&(typeof l=="string"?delete e.query[l]:Array.isArray(l)&&l.forEach(c=>{let d=typeof c=="string"?c:c.key;d&&delete e.query[d]}))},authorizeUsing(l,c){r.request&&(typeof l=="string"?(r.request.auth||(r.request.auth={}),r.request.auth.type=l,c&&(r.request.auth.parameters=c)):typeof l=="object"&&(r.request.auth=l))},clone(){return{url:e.url,method:e.method,headers:{...e.headers},body:e.body?{...e.body}:null,params:e.params?{...e.params}:{},query:e.query?{...e.query}:{},auth:r.request?.auth,certificate:r.request?.certificate,description:r.request?.description,name:r.request?.name,id:r.request?.id,disabled:r.request?.disabled,metadata:r.request?.metadata,messages:r.request?.messages,methodPath:r.request?.methodPath}},describe(l,c){r.request&&(r.request.description={content:l,type:c||"text/plain"})},setHeader(l,c){e.headers[l]=c},addHeader(l,c){typeof l=="object"&&l!==null?e.headers[l.key]=l.value:e.headers[l]=c},removeHeader(l){delete e.headers[l]},setBody(l,c,d){e.body={type:c||e.body?.type||"raw",format:d||e.body?.format,content:l}}}}injectLegacyGlobals(e,r){let n=this.vmContext;if(!n)return;let i=this.initialContext,s=e==="test"&&r?.executedRequest?r.executedRequest:this.modifiedRequest,o={};for(let[b,E]of Object.entries(s?.headers||{}))typeof E=="string"&&(o[b]=E);let l=s?.body,c=l==null?null:typeof l=="object"&&"content"in l?l.content:l,d=i.request;if(n.request={id:d?.id??"",name:d?.name??"",description:d?.description??"",url:typeof s?.url=="string"?s.url:String(s?.url??""),method:s?.method??"GET",headers:o,data:c},n.environment=this._liveEnvironmentScope?.toObject?.()??{...this._environmentVariables},n.globals=this._liveGlobalsScope?.toObject?.()??{...this._globals},n.data={...i.iterationData||{}},typeof n.iteration!="number"&&(n.iteration=0),e!=="test"||!r)return;let p=r.body;n.responseBody=p==null?"":typeof p=="string"?p:JSON.stringify(p);let m=r.statusText||"";n.responseCode={code:r.status,name:m,detail:m},n.responseHeaders={...r.headers||{}},n.responseTime=r.responseTime??0,n.responseCookies=(r.cookies||[]).map(b=>({...b}));let y=this;n.tests=new Proxy({},{set(b,E,C){return y.assertions.push({name:String(E),passed:!!C,message:C?void 0:`"${String(E)}" was false`}),!0}})}async executePreRequest(e){let r=pd(e,this.deps.isolateScripts);if(!r||!r.trim())return{success:!0};try{this.consoleMessages.length=0,this.injectLegacyGlobals("prerequest");let n=this.ctx.variables.replaceIn(r),i=this.deps.scriptTimeoutMs??5e3,s=B0.runInContext(n,this.vmContext,{timeout:i});this.deps.isolateScripts&&s&&typeof s.then=="function"&&await s,(await this.timerRegistry.drain(i)).timedOut&&this.consoleMessages.push({level:"warn",args:[`Script timed out after ${i}ms; pending async work was cancelled.`]});let l=Ja(this.consoleMessages),c=this.initialContext.request.body,d=!this.bodiesEqual(this.modifiedRequest.body,c);return{success:!0,modifiedRequest:{url:this.modifiedRequest.url!==this.initialContext.request.url?this.modifiedRequest.url:void 0,headers:Vu(this.modifiedRequest.headers,this.initialContext.request.headers)?this.modifiedRequest.headers:void 0,body:d?this.modifiedRequest.body:void 0,params:Vu(this.modifiedRequest.params,this.initialContext.request.params||{})?this.modifiedRequest.params:void 0,query:Vu(this.modifiedRequest.query,this.initialContext.request.query||{})?this.modifiedRequest.query:void 0},modifiedVariables:this.ctx.variables.toObject(),localVariables:this.ctx.variables.toLocalObject?.()??{},modifiedCollectionVariables:this._liveCollectionScope?.toObject()||this._collectionVariables,modifiedGlobals:this._liveGlobalsScope?.toObject()||this._globals,modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,consoleOutput:l.length>0?l:void 0,nextRequest:this._nextRequest,skipRequest:this._skipRequest||void 0}}catch(n){let i=[...Ja(this.consoleMessages),`[error] Script execution failed: ${n.message}`];return{success:!1,error:n.message||"Pre-request script execution failed",consoleOutput:i,modifiedVariables:this.ctx?.variables?.toObject(),localVariables:this.ctx?.variables?.toLocalObject?.()??{},modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,nextRequest:this._nextRequest,skipRequest:this._skipRequest||void 0}}}async executePostResponse(e,r){let n=pd(e,this.deps.isolateScripts);if(!n||!n.trim())return{testResults:[],consoleOutput:[]};try{this.consoleMessages.length=0,this.assertions.length=0,this.ctx.info.eventName="test",this.ctx.response=dd(r),this.ctx.request=this.createRequestObject(r.executedRequest,this.initialContext),this.injectLegacyGlobals("test",r);let i=this.ctx.variables.replaceIn(n),s=this.deps.scriptTimeoutMs??5e3,o=B0.runInContext(i,this.vmContext,{timeout:s});this.deps.isolateScripts&&o&&typeof o.then=="function"&&await o,this.ctx.test._pendingTests?.length>0&&(await Promise.all(this.ctx.test._pendingTests),this.ctx.test._pendingTests.length=0),(await this.timerRegistry.drain(s)).timedOut&&this.consoleMessages.push({level:"warn",args:[`Script timed out after ${s}ms; pending async work was cancelled.`]});let c=Ja(this.consoleMessages);return{testResults:[...this.assertions],consoleOutput:c.length>0?c:void 0,modifiedVariables:this.ctx?.variables?.toObject?.(),localVariables:this.ctx?.variables?.toLocalObject?.()??{},modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,modifiedGlobals:this._liveGlobalsScope?.toObject()||this._globals,modifiedCollectionVariables:this._liveCollectionScope?.toObject()||this._collectionVariables,nextRequest:this._nextRequest,visualizerData:this._visualizerData}}catch(i){this.assertions.push({name:"Script Execution",passed:!1,message:i.message||"Script execution failed"});let s=[...Ja(this.consoleMessages),`[error] Script execution failed: ${i.message}`];return{testResults:[...this.assertions],consoleOutput:s,modifiedVariables:this.ctx?.variables?.toObject?.(),localVariables:this.ctx?.variables?.toLocalObject?.()??{},modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,modifiedGlobals:this._liveGlobalsScope?.toObject()||this._globals,modifiedCollectionVariables:this._liveCollectionScope?.toObject()||this._collectionVariables,nextRequest:this._nextRequest,visualizerData:this._visualizerData}}}bodiesEqual(e,r){return e===r||!e&&!r?!0:!e||!r?!1:e.type===r.type&&e.format===r.format&&JSON.stringify(e.content)===JSON.stringify(r.content)}dispose(){this.timerRegistry.clearAll(),this.vmContext=null,this.ctx=null,this.assertions=[]}}});function wP(t,e){if(t)return t.split(",").map(r=>{let n=r.trim();if(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))return n.slice(1,-1);let i=Number(n);if(!isNaN(i)&&n!=="")return i;if(e&&n in e){let s=e[n],o=Number(s);return!isNaN(o)&&s!==""?o:s}return n})}function _P(t){if(typeof t=="string"&&t.charCodeAt(0)===30)try{return JSON.parse(t.slice(1))}catch{return t}return t}function $z(t,e){if(t==="@")return"";if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);let r=t.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(r){let n=wP(r[2],e),i=Vi(r[1],n);return i!==null?i:void 0}if(e[t]!==void 0)return _P(e[t]);if(go(t)){let n=mo(t,e),i=ui(t,n);if(i!==void 0)return i}}function bP(t,e,r,n){let i=Buffer.concat([Buffer.from(t,"utf8"),n||Buffer.alloc(0)]),s=[],o=Buffer.alloc(0);for(;Buffer.concat(s).length<e+r;)o=gr.createHash("md5").update(Buffer.concat([o,i])).digest(),s.push(o);let l=Buffer.concat(s);return{key:l.subarray(0,e),iv:l.subarray(e,e+r)}}function W0(t,e,r){let n=i=>t==="aes"?`aes-${i*8}-cbc`:t==="des"?"des-cbc":t==="des-ede3"?"des-ede3-cbc":t;return{encrypt(i,s,o){let l=i instanceof Xe?i.toBuffer():Buffer.from(String(i),"utf8");if(typeof s=="string"){let c=gr.randomBytes(8),{key:d,iv:p}=bP(s,e,r,c),m=gr.createCipheriv(n(e),d,p),y=Buffer.concat([m.update(l),m.final()]),b=Buffer.concat([Buffer.from("Salted__"),c,y]);return{ciphertext:new Xe(y),salt:new Xe(c),toString:E=>E?E.stringify(new Xe(b)):b.toString("base64")}}else{let c=s.toBuffer(),d=o?.iv&&o.iv instanceof Xe?o.iv.toBuffer():Buffer.alloc(r),p=gr.createCipheriv(n(c.length),c,d);o?.padding===!1&&p.setAutoPadding(!1);let m=Buffer.concat([p.update(l),p.final()]);return{ciphertext:new Xe(m),toString:y=>y?y.stringify(new Xe(m)):m.toString("base64")}}},decrypt(i,s,o){if(typeof s=="string"){let l=typeof i=="string"?Buffer.from(i,"base64"):i.ciphertext.toBuffer(),c,d;l.subarray(0,8).toString()==="Salted__"?(d=l.subarray(8,16),c=l.subarray(16)):(d=Buffer.alloc(0),c=l);let{key:p,iv:m}=bP(s,e,r,d),y=gr.createDecipheriv(n(e),p,m);return new Xe(Buffer.concat([y.update(c),y.final()]))}else{let l=s.toBuffer(),c=o?.iv&&o.iv instanceof Xe?o.iv.toBuffer():Buffer.alloc(r),d=typeof i=="string"?Buffer.from(i,"base64"):i.ciphertext?i.ciphertext.toBuffer():Buffer.from(i),p=gr.createDecipheriv(n(l.length),l,c);return o?.padding===!1&&p.setAutoPadding(!1),new Xe(Buffer.concat([p.update(d),p.final()]))}}}}function Nz(){let t=r=>n=>{let i=n instanceof Xe?n.toBuffer():Buffer.from(String(n),"utf8");return new Xe(gr.createHash(r).update(i).digest())},e=r=>(n,i)=>{let s=n instanceof Xe?n.toBuffer():Buffer.from(String(n),"utf8"),o=i instanceof Xe?i.toBuffer():Buffer.from(String(i),"utf8");return new Xe(gr.createHmac(r,o).update(s).digest())};return{MD5:t("md5"),SHA1:t("sha1"),SHA224:t("sha224"),SHA256:t("sha256"),SHA384:t("sha384"),SHA512:t("sha512"),SHA3:t("sha3-256"),RIPEMD160:t("ripemd160"),HmacMD5:e("md5"),HmacSHA1:e("sha1"),HmacSHA256:e("sha256"),HmacSHA512:e("sha512"),AES:W0("aes",32,16),DES:W0("des",8,8),TripleDES:W0("des-ede3",24,8),PBKDF2(r,n,i){let s=r instanceof Xe?r.toBuffer():Buffer.from(String(r),"utf8"),o=n instanceof Xe?n.toBuffer():Buffer.from(String(n),"utf8"),l=(i?.keySize||4)*4,c=i?.iterations||1;return new Xe(gr.pbkdf2Sync(s,o,c,l,"sha1"))},enc:{Base64:{stringify:r=>(r instanceof Xe?r.toBuffer():Buffer.from(String(r))).toString("base64"),parse:r=>Xe.fromBase64(r)},Utf8:{stringify:r=>(r instanceof Xe?r.toBuffer():Buffer.from(String(r))).toString("utf8"),parse:r=>Xe.fromUtf8(r)},Hex:{stringify:r=>(r instanceof Xe?r.toBuffer():Buffer.from(String(r))).toString("hex"),parse:r=>Xe.fromHex(r)},Latin1:{stringify:r=>(r instanceof Xe?r.toBuffer():Buffer.from(String(r))).toString("latin1"),parse:r=>new Xe(Buffer.from(r,"latin1"))},Utf16:{stringify:r=>(r instanceof Xe?r.toBuffer():Buffer.from(String(r))).toString("utf16le"),parse:r=>new Xe(Buffer.from(r,"utf16le"))},Utf16BE:{stringify:r=>(r instanceof Xe?r.toBuffer():Buffer.from(String(r))).swap16().toString("utf16le"),parse:r=>new Xe(Buffer.from(r,"utf16le").swap16())}},lib:{WordArray:{create:r=>r?typeof r=="string"?new Xe(Buffer.from(r,"utf8")):Buffer.isBuffer(r)?new Xe(r):new Xe(Buffer.from(String(r))):new Xe(Buffer.alloc(0)),random:r=>new Xe(gr.randomBytes(r))}},pad:{Pkcs7:{_name:"pkcs7"},NoPadding:{_name:"nopadding"},ZeroPadding:{_name:"zeropadding"}},mode:{CBC:{_name:"cbc"},ECB:{_name:"ecb"}}}}var gr,Tz,SP,Xe,Ki,md=ae(()=>{"use strict";gr=ve(require("crypto")),Tz=ve(require("querystring")),SP=ve(require("vm"));sm();Pf();lm();H0();V0();Gm();Xe=class t{_buffer;constructor(e){this._buffer=typeof e=="string"?Buffer.from(e,"utf8"):e}toString(e){return e?e.stringify(this):this._buffer.toString("hex")}toBuffer(){return this._buffer}static fromHex(e){return new t(Buffer.from(e,"hex"))}static fromBase64(e){return new t(Buffer.from(e,"base64"))}static fromUtf8(e){return new t(Buffer.from(e,"utf8"))}};Ki=class t{constructor(e,r=[],n,i="shared",s=5e3){this.httpService=e;this.secretRegistry=n;this.scopeMode=i;this.scriptTimeoutMs=s;this.moduleLoader=zm(r)}httpService;secretRegistry;scopeMode;scriptTimeoutMs;moduleLoader;createRequestSession(e){return new Wu({createVM:this.createVM.bind(this),createCommonContext:this.createCommonContext.bind(this),isolateScripts:this.scopeMode==="isolated",scriptTimeoutMs:this.scriptTimeoutMs},e)}createVM(e,r,n){let i=this.moduleLoader.getGlobalSetupExports(),s=this.moduleLoader.createRequireFunction();e.require=s,e.vault=this.createVault();let o={ctx:e,hf:e,pm:e,console:r,...i||{},global:i,setTimeout:n?.setTimeout??setTimeout,setInterval:n?.setInterval??setInterval,clearTimeout:n?.clearTimeout??clearTimeout,clearInterval:n?.clearInterval??clearInterval,URL,URLSearchParams,Buffer,atob:l=>Buffer.from(l,"base64").toString("binary"),btoa:l=>Buffer.from(l,"binary").toString("base64"),TextEncoder,TextDecoder,crypto:gr,_:s("lodash"),require:s,moment:fd(),querystring:Tz,CryptoJS:Nz(),tv4:(()=>{try{return s("tv4")}catch{return}})(),postman:{setNextRequest:l=>e.setNextRequest?.(l),setGlobalVariable:(l,c)=>e.globals?.set(l,c),getGlobalVariable:l=>e.globals?.get(l),clearGlobalVariable:l=>e.globals?.unset(l),setEnvironmentVariable:(l,c)=>e.environment?.set(l,c),getEnvironmentVariable:l=>e.environment?.get(l),clearEnvironmentVariable:l=>e.environment?.unset(l),getResponseHeader:l=>{let c=e.response?.headers?.get?.(l);return c===void 0?null:c},getResponseCookie:l=>{let c=e.response?.cookies;if(c&&typeof c[Symbol.iterator]=="function"){for(let d of c)if(d?.name&&d.name.toLowerCase()===l.toLowerCase())return{...d}}return null}},jsonStringify:(l,c,d)=>JSON.stringify(l,c,d),jsonParse:l=>JSON.parse(l),xml2Json:l=>{try{let c=this.moduleLoader.createRequireFunction()("xml2js"),d;return c.parseString(l,{explicitArray:!1},(p,m)=>{if(p)throw p;d=m}),d}catch{throw new Error("xml2Json() requires the xml2js module. Add it to your modules/package.json and run npm install.")}}};return SP.createContext(o)}createCommonContext(e,r){let n={...e.variables},i={...e.collectionVariables||{}},s={...e.globals||{}},o={...e.environmentVariables||{}},l=e.iterationData||{},c=this.createMergedVariableScope(n,o,i,s,l),d=this.createGlobalsScope(s,e.onGlobalsChange),p=this.createVariableScope(i),m=this.createEnvironmentScope(o,e.environmentName,e.onEnvironmentChange,!0),y={...m,set:(C,v)=>{let _=this.serializeValue(v);m.set(C,_),n[C]=_},unset(C){m.unset(C),delete n[C]},clear(){let C=Object.keys(o);m.clear();for(let v of C)delete n[v]}},b={...d,set:(C,v)=>{let _=this.serializeValue(v);d.set(C,_),n[C]=_},unset(C){d.unset(C),delete n[C]},clear(){let C=Object.keys(s);d.clear();for(let v of C)delete n[v]}};return b.replaceIn=c.replaceIn,p.replaceIn=c.replaceIn,y.replaceIn=c.replaceIn,{globals:b,collectionVariables:p,variables:c,environment:y,iterationData:{get:C=>l[C],has:C=>C in l,toObject:()=>({...l}),toJSON:()=>JSON.stringify(l)},sendRequest:this.createSendRequest(),expect:za,info:e.info||{eventName:r,requestName:void 0,requestId:void 0}}}static JSON_TYPE_MARKER="";serializeValue(e){return typeof e=="string"?e:t.JSON_TYPE_MARKER+JSON.stringify(e)}deserializeValue(e){if(e!==void 0){if(typeof e=="string"&&e.charCodeAt(0)===30)try{return JSON.parse(e.slice(1))}catch{}return e}}createVariableScope(e){return{get:r=>this.deserializeValue(e[r]),set:(r,n)=>{e[r]=this.serializeValue(n)},has(r){return r in e},unset(r){delete e[r]},clear(){Object.keys(e).forEach(r=>delete e[r])},toObject(){return{...e}}}}createGlobalsScope(e,r){let n=(i,s,o)=>{r&&r(i,s,o)};return{get:i=>this.deserializeValue(e[i]),set:(i,s)=>{let o=this.serializeValue(s);e[i]=o,n("set",i,o)},has(i){return i in e},unset(i){delete e[i],n("unset",i)},clear(){Object.keys(e).forEach(i=>delete e[i]),n("clear")},toObject(){return{...e}}}}createMergedVariableScope(e,r,n,i,s={}){let o={get:l=>l in e?this.deserializeValue(e[l]):l in s?s[l]:l in r?this.deserializeValue(r[l]):l in n?this.deserializeValue(n[l]):this.deserializeValue(i[l]),set:(l,c)=>{e[l]=this.serializeValue(c)},has(l){return l in e||l in s||l in r||l in r||l in n||l in i},unset(l){delete e[l]},clear(){Object.keys(e).forEach(l=>delete e[l])},toObject(){return{...i,...n,...r,...s,...e}},toLocalObject(){return{...n,...r,...s,...e}},replaceIn(l){if(!l||typeof l!="string")return l;let c=o.toObject(),d=20,p=y=>y.replace(/\{\{([^}]+)\}\}/g,(b,E)=>{let C=E.trim(),v=C.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(v)try{let k=wP(v[2],c),O=Vi(v[1],k);return O!==null?String(O):b}catch{return b}let _=Cu(C);if(_){let k=$z(_.input,c);if(k!==void 0){let O=xu(k,_.filters,c);return O!==void 0?String(O):b}return b}let q=o.get(C);if(q!==void 0)return String(q);if(go(C)){let k={};for(let[j,I]of Object.entries(c))k[j]=_P(I);let O=mo(C,k),M=ui(C,O);if(M!==void 0)return String(M)}return b}),m=l;for(let y=0;y<d;y++){let b=p(m);if(b===m)break;m=b}return m}};return o}createEnvironmentScope(e,r,n,i){let s=(o,l,c)=>{n&&(i?n(o,l,c):n(l||"",o==="set"?c:void 0))};return{name:r||"",get:o=>this.deserializeValue(e[o]),set:(o,l)=>{let c=this.serializeValue(l);e[o]=c,s("set",o,c)},has(o){return o in e},unset(o){delete e[o],s("unset",o)},clear(){Object.keys(e).forEach(o=>delete e[o]),s("clear")},toObject(){return{...e}}}}createVault(){let e=this.secretRegistry,r=()=>{throw new Error("pm.vault is read-only in HTTP Forge. Use environment variables or {{secret:provider/path}} tokens to manage secrets.")};return{async get(n){if(!e)throw new Error('pm.vault is not available \u2014 no secret providers are configured. Configure a provider under "secrets.providers" to use pm.vault.get().');let i=`secret:${n}`;return(await e.resolveSecretTokens(`{{${i}}}`))[i]},set:r,unset:r}}createSendRequest(){return this.httpService?(e,r)=>{let n=typeof e=="string"?{url:e,method:"GET"}:e,i=this.httpService.execute({url:n.url,method:n.method||"GET",headers:n.headers||{},body:n.body,...n});if(r){i.then(s=>r(null,s)).catch(s=>r(s,null));return}return i}:(e,r)=>{let n=new Error("sendRequest not available - HTTP service not configured");if(r){r(n,null);return}return Promise.reject(n)}}}});var RP,Fz,J0,Zm,z0,Xm,on,Eo,gd=ae(()=>{"use strict";RP=ve(require("fs")),Fz=ve(require("http")),J0=ve(require("https")),Zm=ve(require("path")),z0=require("url"),Xm=ve(require("zlib")),on={timeout:3e4,followRedirects:!0,followOriginalMethod:!1,followAuthHeader:!1,maxRedirects:10,strictSSL:!0,decompress:!0,includeCookies:!1,tls:{},certificates:[]},Eo=class{settings;version;basePath;constructor(e,r=process.cwd()){this.settings={...on,...e},this.basePath=r;try{this.version=require("../../package.json").version||"0.0.0"}catch{this.version="0.0.0"}this.settings.strictSSL===!1&&console.log("[NodeHttpClient] SSL verification disabled (strictSSL: false)")}async send(e){let r=this.mergeSettings(e.settings);return await this.executeInternal(e,r,0)}mergeSettings(e){return{timeout:e?.timeout??this.settings.timeout,followRedirects:e?.followRedirects??this.settings.followRedirects,followOriginalMethod:e?.followOriginalMethod??this.settings.followOriginalMethod,followAuthHeader:e?.followAuthHeader??this.settings.followAuthHeader,maxRedirects:e?.maxRedirects??this.settings.maxRedirects,strictSSL:e?.strictSSL??this.settings.strictSSL,decompress:e?.decompress??this.settings.decompress,includeCookies:e?.includeCookies??this.settings.includeCookies,tls:e?.tls??this.settings.tls??{},certificates:e?.certificates??this.settings.certificates??[]}}async executeInternal(e,r,n,i){let s=Date.now(),o=new z0.URL(e.url),l=o.protocol==="https:",c=this.sanitizeHeaders(e.headers||{});Object.keys(c).some(m=>m.toLowerCase()==="user-agent")||(c["User-Agent"]=`HttpForge/${this.version}`);let p={hostname:o.hostname,port:o.port||(l?443:80),path:o.pathname+o.search,method:e.method,headers:{...c},timeout:r.timeout||void 0};if(r.decompress&&!c["accept-encoding"]&&!c["Accept-Encoding"]&&(p.headers["Accept-Encoding"]="gzip, deflate"),l){let m=this.resolveTlsSettings(o,r),y=p;y.rejectUnauthorized=r.strictSSL;let b={rejectUnauthorized:r.strictSSL},E=this.readOptionalFile(m.caPath,"CA certificate");E&&(b.ca=E);let C=this.readOptionalFile(m.certPath,"client certificate");C&&(b.cert=C);let v=this.readOptionalFile(m.keyPath,"client private key");v&&(b.key=v);let _=this.readOptionalFile(m.pfxPath,"client pfx");_&&(b.pfx=_),m.passphrase&&(b.passphrase=m.passphrase),m.servername&&(y.servername=m.servername),y.agent=new J0.Agent(b)}return new Promise((m,y)=>{if(i?.aborted){let C=new Error("Request cancelled");C.name="AbortError",y(C);return}let E=(l?J0:Fz).request(p,async C=>{let v=C.statusCode||0;if(r.followRedirects&&[301,302,303,307,308].includes(v)){if(n>=r.maxRedirects){y(new Error(`Maximum redirects (${r.maxRedirects}) exceeded`));return}let q=C.headers.location;if(!q){y(new Error("Redirect response missing Location header"));return}let k=new z0.URL(q,e.url).toString(),O=e.method;!r.followOriginalMethod&&[301,302,303].includes(v)&&(O="GET");let M={...e.headers};r.followAuthHeader||(delete M.authorization,delete M.Authorization);try{let j=await this.executeInternal({...e,url:k,method:O,headers:M,body:O==="GET"?void 0:e.body},r,n+1,i),I=Date.now();j.time=I-s,m(j)}catch(j){y(j)}return}let _=[];C.on("data",q=>_.push(q)),C.on("end",()=>{let q=Date.now(),k=Buffer.concat(_),O=C.headers["content-encoding"];if(r.decompress&&O)try{O==="gzip"?k=Xm.gunzipSync(k):O==="deflate"&&(k=Xm.inflateSync(k))}catch(R){console.warn("[NodeHttpClient] Decompression failed:",R)}let M=k.toString("utf-8"),j={};for(let[R,A]of Object.entries(C.headers))(typeof A=="string"||Array.isArray(A))&&(j[R]=A);let I=this.parseCookies(C.headers["set-cookie"],o.hostname);m({status:C.statusCode||0,statusText:C.statusMessage||"",headers:j,cookies:I,body:M,time:q-s,size:k.length})})});if(i&&i.addEventListener("abort",()=>{E.destroy();let C=new Error("Request cancelled");C.name="AbortError",y(C)}),E.on("error",C=>{y(C)}),E.on("timeout",()=>{E.destroy(),y(new Error("Request timeout"))}),e.body!==void 0&&e.body!==null){let C=typeof e.body=="string"?e.body:JSON.stringify(e.body);E.write(C)}E.end()})}resolveTlsSettings(e,r){let n=r.tls||{};if(!!(n.caPath||n.certPath||n.keyPath||n.pfxPath||n.servername||n.passphrase))return n;let s=this.findCertificateMapping(e,r.certificates||[]);return s?{caPath:s.caPath,certPath:s.certPath,keyPath:s.keyPath,pfxPath:s.pfxPath,passphrase:s.passphrase,servername:s.servername}:n}findCertificateMapping(e,r){if(!Array.isArray(r)||r.length===0)return;let n=e.hostname,i=e.port?Number(e.port):443,s=r.find(o=>this.mappingMatchesHost(o,n,i,!0));return s||r.find(o=>this.mappingMatchesHost(o,n,i,!1))}mappingMatchesHost(e,r,n,i){if(!e||e.enabled===!1)return!1;let s=String(e.host||"").trim().toLowerCase();if(!s||e.port!=null&&Number(e.port)!==n)return!1;let o=r.toLowerCase();if(i)return s!=="*"&&!s.startsWith("*.")&&o===s;if(s==="*")return!0;if(s.startsWith("*.")){let l=s.slice(2);return o===l||o.endsWith(`.${l}`)}return o===s}readOptionalFile(e,r){if(!e)return;let n=Zm.isAbsolute(e)?e:Zm.resolve(this.basePath,e);try{return RP.readFileSync(n)}catch(i){throw new Error(`[NodeHttpClient] Failed to read ${r} file at ${n}: ${i?.message||"Unknown error"}`)}}sanitizeHeaderValue(e){return e?String(e).replace(/[\u201C\u201D\u201E\u201F\u2033\u2036]/g,'"').replace(/[\u2018\u2019\u201A\u201B\u2032\u2035]/g,"'").replace(/[\x00-\x08\x0A-\x1F\x7F]/g,""):""}sanitizeHeaders(e){let r={};for(let[n,i]of Object.entries(e))r[n]=this.sanitizeHeaderValue(String(i));return r}parseCookies(e,r){return e?e.map(n=>{let i=n.split(";").map(p=>p.trim()),[s,...o]=i,[l,c]=s.split("="),d={name:l.trim(),value:c?.trim()||"",domain:r};for(let p of o){let[m,y]=p.split("=");switch(m.toLowerCase().trim()){case"domain":d.domain=y?.trim();break;case"path":d.path=y?.trim();break;case"expires":d.expires=y?.trim();break;case"httponly":d.httpOnly=!0;break;case"secure":d.secure=!0;break}}return d}):[]}}});var G0,qo,eg=ae(()=>{"use strict";G0={json:"application/json",xml:"application/xml",html:"text/html",text:"text/plain",javascript:"application/javascript",css:"text/css","x-www-form-urlencoded":"application/x-www-form-urlencoded","form-data":"multipart/form-data",graphql:"application/json"},qo=class{sanitizeHeaderValue(e){return e?String(e).replace(/[\u201C\u201D\u201E\u201F\u2033\u2036]/g,'"').replace(/[\u2018\u2019\u201A\u201B\u2032\u2035]/g,"'").replace(/[\x00-\x08\x0A-\x1F\x7F]/g,""):""}sanitizeHeaders(e){let r={};for(let[n,i]of Object.entries(e))r[n]=this.sanitizeHeaderValue(String(i));return r}encodeBody(e){if(!e||e.type==="none")return null;let{type:r,content:n}=e;switch(r){case"x-www-form-urlencoded":return this.encodeUrlEncodedBody(n);case"form-data":return n;case"graphql":return this.encodeGraphQLBody(n);case"raw":return n;default:return n}}encodeUrlEncodedBody(e){if(Array.isArray(e)){let r=new URLSearchParams;for(let n of e)n.enabled!==!1&&n.key&&r.append(n.key,n.value||"");return r.toString()}return typeof e=="string"?e:String(e)}encodeGraphQLBody(e){if(typeof e=="string")try{e=JSON.parse(e)}catch{return e}if(typeof e=="object"&&e!==null&&e.query){let r=e.variables;if(typeof r=="string")try{r=r.trim()?JSON.parse(r):void 0}catch{r=void 0}return JSON.stringify({query:e.query,...r!=null?{variables:r}:{},...e.operationName?{operationName:e.operationName}:{}})}return JSON.stringify(e)}setContentTypeHeader(e,r,n){if(Object.keys(e).some(o=>o.toLowerCase()==="content-type"))return;if(n){e["Content-Type"]=n;return}if(!r||r.type==="none")return;let s;switch(r.type){case"x-www-form-urlencoded":s=G0["x-www-form-urlencoded"];break;case"raw":s=r.format?G0[r.format]:"text/plain",s||(s="text/plain");break;case"graphql":s=G0.graphql;break;case"binary":s="application/octet-stream";break}s&&(e["Content-Type"]=s)}}});var Io,tg=ae(()=>{"use strict";Io=class{parse(e,r){return r.toLowerCase().endsWith(".json")?this.parseJson(e):this.parseCsv(e)}parseJson(e){try{let r=JSON.parse(e);return Array.isArray(r)?r:[r]}catch{throw new Error("Failed to parse JSON data file: Invalid JSON format")}}parseCsv(e){let r=e.split(/\r?\n/).filter(s=>s.trim());if(r.length<2)return[{}];let n=this.parseCsvLine(r[0]),i=[];for(let s=1;s<r.length;s++){let o=this.parseCsvLine(r[s]),l={};n.forEach((c,d)=>{l[c]=o[d]||""}),i.push(l)}return i}parseCsvLine(e){let r=[],n="",i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=e[s+1];o==='"'?i&&l==='"'?(n+='"',s++):i=!i:o===","&&!i?(r.push(n.trim()),n=""):n+=o}return r.push(n.trim()),r}}});var Ku,Dz,Qu,Y0=ae(()=>{"use strict";Ku=ve(require("crypto")),Dz=3e4,Qu=class{constructor(e,r,n,i,s="henry-huang.http-forge/oauth2/callback"){this.secretStore=e;this.browserService=r;this.envConfigService=n;this.httpService=i;this.callbackPath=s}secretStore;browserService;envConfigService;httpService;callbackPath;tokenCache=new Map;pendingAuthCallback=null;pendingImplicitCallback=null;async getToken(e,r){if(e.accessToken)return{accessToken:this.resolve(e.accessToken,r),tokenType:e.tokenPrefix||"Bearer",raw:{}};let n=this.buildCacheKeyString(e),i=this.tokenCache.get(n);if(i&&!this.isExpired(i))return i;if(i?.refreshToken)try{return await this.refreshToken(e,i.refreshToken,r)}catch{this.tokenCache.delete(n)}if(!i){let o=await this.secretStore.get(`oauth2_refresh_${n}`);if(o)try{return await this.refreshToken(e,o,r)}catch{await this.secretStore.delete(`oauth2_refresh_${n}`)}}let s;switch(e.grantType){case"client_credentials":s=await this.fetchToken(e,r,"client_credentials");break;case"password":s=await this.fetchToken(e,r,"password");break;case"authorization_code":s=await this.authorizationCodeFlow(e,r);break;case"implicit":s=await this.implicitFlow(e,r);break;default:throw new Error(`Unknown OAuth2 grant type: ${e.grantType}`)}return this.tokenCache.set(n,s),s.refreshToken&&await this.storeRefreshToken(n,s.refreshToken),s}async refreshToken(e,r,n){let i=this.resolve(e.tokenUrl||"",n);if(!i)throw new Error("OAuth2 tokenUrl is required for token refresh");let s=this.resolve(e.clientId||"",n),o=this.resolve(e.clientSecret||"",n),l=new URLSearchParams;l.append("grant_type","refresh_token"),l.append("refresh_token",r);let c={"Content-Type":"application/x-www-form-urlencoded"};this.applyClientAuth(e,c,l,s,o,n);let d=await this.httpService.execute({method:"POST",url:i,headers:c,body:l.toString()}),p=this.parseTokenResponse(d.body,e);p.refreshToken||(p.refreshToken=r);let m=this.buildCacheKeyString(e);return this.tokenCache.set(m,p),p.refreshToken&&await this.storeRefreshToken(m,p.refreshToken),p}async authorizationCodeFlow(e,r){let n=this.resolve(e.authUrl||"",r),i=this.resolve(e.tokenUrl||"",r),s=this.resolve(e.clientId||"",r),o=this.resolve(e.clientSecret||"",r),l=e.scope?this.resolve(e.scope,r):void 0;if(!n)throw new Error("OAuth2 authUrl is required for authorization code flow");if(!i)throw new Error("OAuth2 tokenUrl is required for authorization code flow");if(!s)throw new Error("OAuth2 clientId is required for authorization code flow");let c=e.usePkce!==!1,d,p,m;if(c){d=this.generateCodeVerifier();let j=e.pkceMethod||"S256";p=j==="S256"?this.generateCodeChallengeS256(d):d,m=j}let y=e.state||Ku.randomBytes(16).toString("hex"),b=await this.getCallbackUri(),E=new URL(n);if(E.searchParams.set("response_type","code"),E.searchParams.set("client_id",s),E.searchParams.set("redirect_uri",b),l&&E.searchParams.set("scope",l),E.searchParams.set("state",y),p&&(E.searchParams.set("code_challenge",p),E.searchParams.set("code_challenge_method",m)),e.audience&&E.searchParams.set("audience",this.resolve(e.audience,r)),e.resource&&E.searchParams.set("resource",this.resolve(e.resource,r)),e.extraParams)for(let[j,I]of Object.entries(e.extraParams))E.searchParams.set(j,this.resolve(I,r));this.pendingAuthCallback&&(this.pendingAuthCallback.reject(new Error("OAuth2 authorization superseded by a new request")),this.pendingAuthCallback=null);let C=new Promise((j,I)=>{this.pendingAuthCallback={resolve:j,reject:I,state:y}});await this.browserService.openExternal(E.toString());let v;try{v=await Promise.race([C,new Promise((j,I)=>setTimeout(()=>{this.pendingAuthCallback=null,I(new Error("OAuth2 authorization timed out after 2 minutes"))},12e4))])}finally{this.pendingAuthCallback=null}if(v.state&&v.state!==y)throw new Error("OAuth2 state mismatch \u2014 potential CSRF attack");let _=new URLSearchParams;_.append("grant_type","authorization_code"),_.append("code",v.code),_.append("redirect_uri",b),d&&_.append("code_verifier",d);let q={"Content-Type":"application/x-www-form-urlencoded"};this.applyClientAuth(e,q,_,s,o,r);let k=await this.httpService.execute({method:"POST",url:i,headers:q,body:_.toString()}),O=this.parseTokenResponse(k.body,e),M=this.buildCacheKeyString(e);return this.tokenCache.set(M,O),O.refreshToken&&await this.storeRefreshToken(M,O.refreshToken),O}async implicitFlow(e,r){let n=this.resolve(e.authUrl||"",r),i=this.resolve(e.clientId||"",r),s=e.scope?this.resolve(e.scope,r):void 0;if(!n)throw new Error("OAuth2 authUrl is required for implicit flow");if(!i)throw new Error("OAuth2 clientId is required for implicit flow");let o=e.state||Ku.randomBytes(16).toString("hex"),l=await this.getCallbackUri(),c=new URL(n);if(c.searchParams.set("response_type","token"),c.searchParams.set("client_id",i),c.searchParams.set("redirect_uri",l),s&&c.searchParams.set("scope",s),c.searchParams.set("state",o),e.audience&&c.searchParams.set("audience",this.resolve(e.audience,r)),e.resource&&c.searchParams.set("resource",this.resolve(e.resource,r)),e.extraParams)for(let[b,E]of Object.entries(e.extraParams))c.searchParams.set(b,this.resolve(E,r));this.pendingImplicitCallback&&(this.pendingImplicitCallback.reject(new Error("OAuth2 implicit flow superseded by a new request")),this.pendingImplicitCallback=null);let d=new Promise((b,E)=>{this.pendingImplicitCallback={resolve:b,reject:E,state:o}});await this.browserService.openExternal(c.toString());let p;try{p=await Promise.race([d,new Promise((b,E)=>setTimeout(()=>{this.pendingImplicitCallback=null,E(new Error("OAuth2 implicit flow timed out after 2 minutes"))},12e4))])}finally{this.pendingImplicitCallback=null}if(p.state&&p.state!==o)throw new Error("OAuth2 state mismatch \u2014 potential CSRF attack");let m={accessToken:p.accessToken,tokenType:p.tokenType||e.tokenPrefix||"Bearer",expiresAt:p.expiresIn?Date.now()+p.expiresIn*1e3:void 0,raw:{access_token:p.accessToken,token_type:p.tokenType,expires_in:p.expiresIn}},y=this.buildCacheKeyString(e);return this.tokenCache.set(y,m),m}handleAuthorizationCallback(e,r,n){if(n){let i=new Error(`OAuth2 authorization error: ${n}`);this.pendingAuthCallback?.reject(i),this.pendingImplicitCallback?.reject(i),this.pendingAuthCallback=null,this.pendingImplicitCallback=null;return}if(e&&this.pendingAuthCallback){this.pendingAuthCallback.resolve({code:e,state:r}),this.pendingAuthCallback=null;return}!e&&!this.pendingAuthCallback&&this.pendingImplicitCallback&&(this.pendingImplicitCallback.reject(new Error("OAuth2 implicit flow did not receive access_token")),this.pendingImplicitCallback=null)}handleImplicitCallback(e,r,n,i){this.pendingImplicitCallback&&(this.pendingImplicitCallback.resolve({accessToken:e,tokenType:r,expiresIn:n,state:i}),this.pendingImplicitCallback=null)}clearToken(e){let r=`${e.tokenUrl}|${e.clientId}|${e.scope||""}|${e.grantType}`;this.tokenCache.delete(r),this.secretStore.delete(`oauth2_refresh_${r}`)}clearAllTokens(){for(let e of this.tokenCache.keys())this.secretStore.delete(`oauth2_refresh_${e}`);this.tokenCache.clear()}async fetchToken(e,r,n){let i=this.resolve(e.tokenUrl||"",r);if(!i)throw new Error("OAuth2 tokenUrl is required");let s=this.resolve(e.clientId||"",r),o=this.resolve(e.clientSecret||"",r),l=e.scope?this.resolve(e.scope,r):void 0,c=new URLSearchParams;if(c.append("grant_type",n),l&&c.append("scope",l),n==="password"){let m=this.resolve(e.username||"",r),y=this.resolve(e.password||"",r);if(!m)throw new Error("OAuth2 password grant requires username");c.append("username",m),c.append("password",y)}if(e.audience&&c.append("audience",this.resolve(e.audience,r)),e.resource&&c.append("resource",this.resolve(e.resource,r)),e.extraParams)for(let[m,y]of Object.entries(e.extraParams))c.append(m,this.resolve(y,r));let d={"Content-Type":"application/x-www-form-urlencoded"};this.applyClientAuth(e,d,c,s,o,r);let p=await this.httpService.execute({method:"POST",url:i,headers:d,body:c.toString()});return this.parseTokenResponse(p.body,e)}applyClientAuth(e,r,n,i,s,o){if(e.clientAuthentication==="header"){let l=Buffer.from(`${i}:${s}`).toString("base64");r.Authorization=`Basic ${l}`}else i&&n.set("client_id",i),s&&n.set("client_secret",s)}parseTokenResponse(e,r){let n=e;if(typeof n=="string")try{n=JSON.parse(n)}catch{throw new Error("OAuth2 token response is not valid JSON")}if(!n||typeof n!="object")throw new Error("OAuth2 token response is not a valid JSON object");let i=n,s=r.tokenField||"access_token",o=i[s];if(!o)throw new Error(`OAuth2 token fetch failed: '${s}' not present in response`);let l=typeof i.expires_in=="number"?i.expires_in:void 0;return{accessToken:o,tokenType:i.token_type||r.tokenPrefix||"Bearer",expiresAt:l?Date.now()+l*1e3:void 0,refreshToken:i.refresh_token,scope:i.scope,raw:i}}isExpired(e){return e.expiresAt?Date.now()>=e.expiresAt-Dz:!1}buildCacheKeyString(e){return`${e.tokenUrl||""}|${e.clientId||""}|${e.scope||""}|${e.grantType}`}async getCallbackUri(){let e=`${this.browserService.uriScheme}://${this.callbackPath}`;return this.browserService.asExternalUri(e)}resolve(e,r){return this.envConfigService.resolveVariables(e,r)}generateCodeVerifier(){return Ku.randomBytes(32).toString("base64url")}generateCodeChallengeS256(e){return Ku.createHash("sha256").update(e).digest("base64url")}async storeRefreshToken(e,r){try{await this.secretStore.store(`oauth2_refresh_${e}`,r)}catch{}}}});function Ka(t,e={}){let r=[];Object.entries(e).forEach(([n,i])=>{r.push(`${n}=${i}`)}),r.length&&Ya.writeFileSync(t,r.join(`
|
|
52
|
+
`)}function Vu(t,e){return JSON.stringify(t)!==JSON.stringify(e)}function Ja(t){return t.map(e=>{let r=e.args.map(n=>{if(typeof n=="object")try{return JSON.stringify(n,null,2)}catch{return String(n)}return String(n)}).join(" ");return`[${e.level}] ${r}`})}function vP(t){return{log:(...e)=>t.push({level:"log",args:e}),info:(...e)=>t.push({level:"info",args:e}),warn:(...e)=>t.push({level:"warn",args:e}),error:(...e)=>t.push({level:"error",args:e})}}function Ym(t){let e=[],r=(n,i)=>{try{let s=i();if(s&&typeof s.then=="function"){let o=s.then(()=>{t.push({name:n,passed:!0})},l=>{t.push({name:n,passed:!1,message:l.message||String(l)})});e.push(o)}else t.push({name:n,passed:!0})}catch(s){t.push({name:n,passed:!1,message:s.message})}};return r.skip=(n,i)=>{t.push({name:n,passed:!0,skipped:!0})},r.fail=n=>{t.push({name:n||"Failed test",passed:!1,message:n||"pm.test.fail()"})},r.index=()=>t.length,r._pendingTests=e,r}function Km(t){let e={};for(let[r,n]of Object.entries(t))e[r]=Array.isArray(n)?n.join(", "):n;return e}function Qm(t,e,r){let n;if(r)try{n=new URL(r).hostname}catch{n=void 0}let i=Rt.parseCookieHeaders(t||{},n);return i.length>0?i:Array.isArray(e)&&e.length>0?e.filter(s=>s&&s.name).map(s=>({name:s.name,value:s.value,domain:s.domain??n,path:s.path,expires:s.expires,maxAge:s.maxAge,httpOnly:s.httpOnly,secure:s.secure,sameSite:s.sameSite})):[]}var hd=ae(()=>{"use strict";ka()});function Az(t){let e=null;try{e=new URL(t)}catch{}return{toString(){return t},valueOf(){return t},[Symbol.toPrimitive](n){return n==="number"?NaN:t},getHost(){return e?e.hostname:""},getPath(){return e?e.pathname:t},getPathWithQuery(){return e?e.pathname+e.search:t},getQueryString(){return e?e.search.startsWith("?")?e.search.slice(1):e.search:""},getRemote(){if(!e)return"";let n=e.port||(e.protocol==="https:"?"443":"80");return`${e.hostname}:${n}`},getOAuth1BaseUrl(){return e?`${e.protocol}//${e.host}${e.pathname}`:t},get protocol(){return e?.protocol?.replace(":","")||""},get host(){return e?e.hostname.split("."):[]},get port(){return e?.port||""},get path(){return e?e.pathname.split("/").filter(Boolean):[]},get hash(){return e?.hash?.replace("#","")||""},query:{toObject(){if(!e)return{};let n={};return e.searchParams.forEach((i,s)=>{n[s]=i}),n},has(n){return e?e.searchParams.has(n):!1},get(n){return e?e.searchParams.get(n):void 0},each(n){e&&e.searchParams.forEach((i,s)=>n({key:s,value:i}))}}}}var B0,Wu,V0=ae(()=>{"use strict";B0=ve(require("vm"));gP();Gm();hd();Wu=class{constructor(e,r){this.deps=e;this.initialContext=r;this.timerRegistry=mP(n=>{let i=n instanceof Error?n.message:String(n);this.consoleMessages.push({level:"error",args:[`Uncaught error in async callback: ${i}`]})}),this.initializeSession()}deps;initialContext;vmContext=null;ctx=null;modifiedRequest=null;assertions=[];consoleMessages=[];_variables={};_collectionVariables={};_globals={};_environmentVariables={};_liveEnvironmentScope=null;_liveGlobalsScope=null;_liveCollectionScope=null;_nextRequest=void 0;_skipRequest=!1;_visualizerData=void 0;timerRegistry;initializeSession(){this.modifiedRequest={url:this.initialContext.request.url,method:this.initialContext.request.method,headers:{...this.initialContext.request.headers},body:this.initialContext.request.body?{...this.initialContext.request.body}:null,params:this.initialContext.request.params?{...this.initialContext.request.params}:{},query:this.initialContext.request.query?{...this.initialContext.request.query}:{}},this.assertions=[],this.ctx=this.createSharedContext(),this.consoleMessages=[];let e=this,r={log:(...n)=>{e.consoleMessages.push({level:"log",args:n})},info:(...n)=>{e.consoleMessages.push({level:"info",args:n})},warn:(...n)=>{e.consoleMessages.push({level:"warn",args:n})},error:(...n)=>{e.consoleMessages.push({level:"error",args:n})}};this.vmContext=this.deps.createVM(this.ctx,r,this.timerRegistry.timers)}createSharedContext(){let e=this.initialContext,r=this.modifiedRequest,n=this.deps.createCommonContext(e,"prerequest");this._variables={...e.variables},this._collectionVariables={...e.collectionVariables||{}},this._globals={...e.globals||{}},this._environmentVariables={...e.environmentVariables||{}},this._liveEnvironmentScope=n.environment,this._liveGlobalsScope=n.globals,this._liveCollectionScope=n.collectionVariables;let i;try{i=new URL(e.request.url).hostname}catch{}let s={get:l=>e.cookieJar?e.cookieJar.get(l,i)?.value:void 0,set:(l,c)=>{e.cookieJar&&e.cookieJar.set({name:l,value:c,domain:i})},has:l=>e.cookieJar?e.cookieJar.has(l,i):!1,list:()=>e.cookieJar?e.cookieJar.getAll(i).map(l=>({name:l.name,value:l.value})):[],toObject:()=>{if(!e.cookieJar)return{};let l=e.cookieJar.getAll(i),c={};for(let d of l)c[d.name]=d.value;return c},jar:()=>{let l=e.cookieJar,c=d=>{if(d==null)return;let p=typeof d=="string"?d:typeof d=="object"||typeof d=="number"||typeof d=="boolean"?String(d):void 0;if(!p)return;let m=p.trim();if(m)try{return new URL(m).hostname}catch{return m}};return{getAll(d,p){try{if(!l){p(null,[]);return}let m=c(d),y=l.getAll(m).map(b=>({name:b.name,value:b.value,domain:b.domain,path:b.path,httpOnly:b.httpOnly,secure:b.secure}));p(null,y)}catch(m){p(m,[])}},get(d,p,m){try{if(!l){m(null,void 0);return}let y=c(d),b=l.get(p,y);m(null,b?{name:b.name,value:b.value,domain:b.domain}:void 0)}catch(y){m(y,void 0)}},set(d,p,m,y){try{if(!l){(y||m)?.(null);return}let b=c(d);typeof p=="string"&&typeof m=="string"?(l.set({name:p,value:m,domain:b}),y?.(null)):typeof p=="object"&&(l.set({...p,domain:b}),m?.(null))}catch(b){(y||m)?.(b)}},unset(d,p,m){try{if(!l){m?.(null);return}let y=c(d);l.delete(p,y),m?.(null)}catch(y){m?.(y)}},clear(d,p){try{let m=typeof d=="function"?d:p;if(!l){m?.(null);return}let y=typeof d=="function"?void 0:c(d);y&&typeof l.clearDomain=="function"?l.clearDomain(y):l.clear(),m?.(null)}catch(m){(typeof d=="function"?d:p)?.(m)}}}},remove:l=>{e.cookieJar&&e.cookieJar.delete(l,i)},unset:l=>{e.cookieJar&&e.cookieJar.delete(l,i)},clear:()=>{e.cookieJar&&e.cookieJar.clear()}},o=this;return{request:this.createRequestObject(r,e),response:null,test:Ym(this.assertions),expect:za,cookies:s,execution:{setNextRequest(l){o._nextRequest=l},skipRequest(){o._skipRequest=!0},runRequest(l,c){let p=(async()=>{if(typeof n.sendRequest!="function")throw new Error("pm.execution.runRequest is not available \u2014 HTTP service not configured.");let m=typeof l=="string"?{url:l,method:"GET"}:l,y=await n.sendRequest(m),b=Array.isArray(y?.cookies)?y.cookies.filter(v=>v?.name):[],q=y?.body,C=0;if(typeof q=="string")C=Buffer.byteLength(q,"utf8");else if(Buffer.isBuffer(q))C=q.length;else if(q!=null)try{C=Buffer.byteLength(JSON.stringify(q),"utf8")}catch{}return dd({executedRequest:null,status:y?.status??0,statusText:y?.statusText??"",headers:y?.headers??{},body:q,cookies:b,responseTime:y?.time,responseSize:C})})();if(typeof c=="function"){p.then(m=>c(null,m),m=>c(m));return}return p},location:{current:n.info?.requestName||"",currentRequestName:n.info?.requestName||"",eventName:"prerequest",toString(){return n.info?.requestName||""}}},setNextRequest(l){o._nextRequest=l},visualizer:{set(l,c){o._visualizerData={template:l,data:c}},clear(){o._visualizerData=void 0}},...n,info:{...n.info||{},eventName:"prerequest",requestName:n.info?.requestName||void 0,requestId:n.info?.requestId||void 0,iteration:e.iteration||0,iterationCount:e.iterationCount||1}}}createRequestObject(e,r){let n=l=>{if(!l)return"none";switch(l){case"raw":return"raw";case"form-data":return"formdata";case"x-www-form-urlencoded":return"urlencoded";case"binary":return"file";case"graphql":return"graphql";case"none":return"none";default:return"raw"}},i=l=>{if(!l)return"none";switch(l){case"raw":return"raw";case"formdata":return"form-data";case"urlencoded":return"x-www-form-urlencoded";case"file":return"binary";case"graphql":return"graphql";case"none":return"none";default:return"raw"}},s={...e.headers,add:l=>{l&&l.key&&(e.headers[l.key]=l.value||"")},get:l=>{for(let[c,d]of Object.entries(e.headers))if(c.toLowerCase()===l.toLowerCase())return d},has:l=>{for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.toLowerCase())return!0;return!1},remove:l=>{for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.toLowerCase()){delete e.headers[c];break}},update:l=>{if(l&&l.key){for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.key.toLowerCase()){e.headers[c]=l.value||"";return}}},upsert:l=>{if(l&&l.key){for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.key.toLowerCase()){e.headers[c]=l.value||"";return}e.headers[l.key]=l.value||""}},toObject:()=>{let l={};for(let[c,d]of Object.entries(e.headers))typeof d=="string"&&(l[c]=d);return l},each:l=>{for(let[c,d]of Object.entries(e.headers))typeof d=="string"&&l({key:c,value:d})}},o={get mode(){return n(e.body?.type)},set mode(l){let c=i(l);e.body?e.body.type=c:e.body={type:c,content:null}},get raw(){let l=e.body?.content;return typeof l=="string"?l:l&&typeof l=="object"?JSON.stringify(l):""},set raw(l){e.body?(e.body.type="raw",e.body.content=l):e.body={type:"raw",content:l}},get formdata(){return e.body?.type==="form-data"&&Array.isArray(e.body.content)?e.body.content:[]},get urlencoded(){return e.body?.type==="x-www-form-urlencoded"&&Array.isArray(e.body.content)?e.body.content:[]},get graphql(){return e.body?.type==="graphql"?e.body.content:null},get file(){return e.body?.type==="binary"?e.body.content:null}};return{get url(){return Az(e.url)},set url(l){e.url=typeof l=="string"?l:String(l)},get method(){return e.method},set method(l){e.method=l},headers:s,get body(){return o},set body(l){if(l==null)e.body=null;else if(typeof l=="string")e.body={type:"raw",content:l};else if(typeof l=="object")if(l.type||l.mode||l.content!==void 0){let c=l.mode?i(l.mode):l.type||"raw";e.body={type:c,format:l.format,content:l.content}}else e.body={type:"raw",content:l}},get params(){return e.params||{}},set params(l){e.params=l||{}},get query(){return e.query||{}},set query(l){e.query=l||{}},get auth(){return r.request?.auth||null},set auth(l){r.request&&(r.request.auth=l)},get certificate(){return r.request?.certificate||null},set certificate(l){r.request&&(r.request.certificate=l)},get description(){return r.request?.description||null},set description(l){r.request&&(r.request.description=l)},get name(){return r.request?.name||null},set name(l){r.request&&(r.request.name=l)},get id(){return r.request?.id||null},get disabled(){return r.request?.disabled||!1},set disabled(l){r.request&&(r.request.disabled=l)},get messages(){return r.request?.messages||[]},get methodPath(){return r.request?.methodPath||null},get metadata(){return r.request?.metadata||[]},getHeaders(l){let c={};for(let[d,p]of Object.entries(e.headers))typeof p=="string"&&(c[d]=p);return c},addQueryParams(l){if(typeof l=="string"){let c=new URLSearchParams(l);for(let[d,p]of c)e.query||(e.query={}),e.query[d]=p}else Array.isArray(l)&&(e.query||(e.query={}),l.forEach(c=>{c.key&&(e.query[c.key]=c.value||"")}))},removeQueryParams(l){e.query&&(typeof l=="string"?delete e.query[l]:Array.isArray(l)&&l.forEach(c=>{let d=typeof c=="string"?c:c.key;d&&delete e.query[d]}))},authorizeUsing(l,c){r.request&&(typeof l=="string"?(r.request.auth||(r.request.auth={}),r.request.auth.type=l,c&&(r.request.auth.parameters=c)):typeof l=="object"&&(r.request.auth=l))},clone(){return{url:e.url,method:e.method,headers:{...e.headers},body:e.body?{...e.body}:null,params:e.params?{...e.params}:{},query:e.query?{...e.query}:{},auth:r.request?.auth,certificate:r.request?.certificate,description:r.request?.description,name:r.request?.name,id:r.request?.id,disabled:r.request?.disabled,metadata:r.request?.metadata,messages:r.request?.messages,methodPath:r.request?.methodPath}},describe(l,c){r.request&&(r.request.description={content:l,type:c||"text/plain"})},setHeader(l,c){e.headers[l]=c},addHeader(l,c){typeof l=="object"&&l!==null?e.headers[l.key]=l.value:e.headers[l]=c},removeHeader(l){delete e.headers[l]},setBody(l,c,d){e.body={type:c||e.body?.type||"raw",format:d||e.body?.format,content:l}}}}injectLegacyGlobals(e,r){let n=this.vmContext;if(!n)return;let i=this.initialContext,s=e==="test"&&r?.executedRequest?r.executedRequest:this.modifiedRequest,o={};for(let[b,q]of Object.entries(s?.headers||{}))typeof q=="string"&&(o[b]=q);let l=s?.body,c=l==null?null:typeof l=="object"&&"content"in l?l.content:l,d=i.request;if(n.request={id:d?.id??"",name:d?.name??"",description:d?.description??"",url:typeof s?.url=="string"?s.url:String(s?.url??""),method:s?.method??"GET",headers:o,data:c},n.environment=this._liveEnvironmentScope?.toObject?.()??{...this._environmentVariables},n.globals=this._liveGlobalsScope?.toObject?.()??{...this._globals},n.data={...i.iterationData||{}},typeof n.iteration!="number"&&(n.iteration=0),e!=="test"||!r)return;let p=r.body;n.responseBody=p==null?"":typeof p=="string"?p:JSON.stringify(p);let m=r.statusText||"";n.responseCode={code:r.status,name:m,detail:m},n.responseHeaders={...r.headers||{}},n.responseTime=r.responseTime??0,n.responseCookies=(r.cookies||[]).map(b=>({...b}));let y=this;n.tests=new Proxy({},{set(b,q,C){return y.assertions.push({name:String(q),passed:!!C,message:C?void 0:`"${String(q)}" was false`}),!0}})}async executePreRequest(e){let r=pd(e,this.deps.isolateScripts);if(!r||!r.trim())return{success:!0};try{this.consoleMessages.length=0,this.injectLegacyGlobals("prerequest");let n=this.ctx.variables.replaceIn(r),i=this.deps.scriptTimeoutMs??5e3,s=B0.runInContext(n,this.vmContext,{timeout:i});this.deps.isolateScripts&&s&&typeof s.then=="function"&&await s,(await this.timerRegistry.drain(i)).timedOut&&this.consoleMessages.push({level:"warn",args:[`Script timed out after ${i}ms; pending async work was cancelled.`]});let l=Ja(this.consoleMessages),c=this.initialContext.request.body,d=!this.bodiesEqual(this.modifiedRequest.body,c);return{success:!0,modifiedRequest:{url:this.modifiedRequest.url!==this.initialContext.request.url?this.modifiedRequest.url:void 0,headers:Vu(this.modifiedRequest.headers,this.initialContext.request.headers)?this.modifiedRequest.headers:void 0,body:d?this.modifiedRequest.body:void 0,params:Vu(this.modifiedRequest.params,this.initialContext.request.params||{})?this.modifiedRequest.params:void 0,query:Vu(this.modifiedRequest.query,this.initialContext.request.query||{})?this.modifiedRequest.query:void 0},modifiedVariables:this.ctx.variables.toObject(),localVariables:this.ctx.variables.toLocalObject?.()??{},modifiedCollectionVariables:this._liveCollectionScope?.toObject()||this._collectionVariables,modifiedGlobals:this._liveGlobalsScope?.toObject()||this._globals,modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,consoleOutput:l.length>0?l:void 0,nextRequest:this._nextRequest,skipRequest:this._skipRequest||void 0}}catch(n){let i=[...Ja(this.consoleMessages),`[error] Script execution failed: ${n.message}`];return{success:!1,error:n.message||"Pre-request script execution failed",consoleOutput:i,modifiedVariables:this.ctx?.variables?.toObject(),localVariables:this.ctx?.variables?.toLocalObject?.()??{},modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,nextRequest:this._nextRequest,skipRequest:this._skipRequest||void 0}}}async executePostResponse(e,r){let n=pd(e,this.deps.isolateScripts);if(!n||!n.trim())return{testResults:[],consoleOutput:[]};try{this.consoleMessages.length=0,this.assertions.length=0,this.ctx.info.eventName="test",this.ctx.response=dd(r),this.ctx.request=this.createRequestObject(r.executedRequest,this.initialContext),this.injectLegacyGlobals("test",r);let i=this.ctx.variables.replaceIn(n),s=this.deps.scriptTimeoutMs??5e3,o=B0.runInContext(i,this.vmContext,{timeout:s});this.deps.isolateScripts&&o&&typeof o.then=="function"&&await o,this.ctx.test._pendingTests?.length>0&&(await Promise.all(this.ctx.test._pendingTests),this.ctx.test._pendingTests.length=0),(await this.timerRegistry.drain(s)).timedOut&&this.consoleMessages.push({level:"warn",args:[`Script timed out after ${s}ms; pending async work was cancelled.`]});let c=Ja(this.consoleMessages);return{testResults:[...this.assertions],consoleOutput:c.length>0?c:void 0,modifiedVariables:this.ctx?.variables?.toObject?.(),localVariables:this.ctx?.variables?.toLocalObject?.()??{},modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,modifiedGlobals:this._liveGlobalsScope?.toObject()||this._globals,modifiedCollectionVariables:this._liveCollectionScope?.toObject()||this._collectionVariables,nextRequest:this._nextRequest,visualizerData:this._visualizerData}}catch(i){this.assertions.push({name:"Script Execution",passed:!1,message:i.message||"Script execution failed"});let s=[...Ja(this.consoleMessages),`[error] Script execution failed: ${i.message}`];return{testResults:[...this.assertions],consoleOutput:s,modifiedVariables:this.ctx?.variables?.toObject?.(),localVariables:this.ctx?.variables?.toLocalObject?.()??{},modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,modifiedGlobals:this._liveGlobalsScope?.toObject()||this._globals,modifiedCollectionVariables:this._liveCollectionScope?.toObject()||this._collectionVariables,nextRequest:this._nextRequest,visualizerData:this._visualizerData}}}bodiesEqual(e,r){return e===r||!e&&!r?!0:!e||!r?!1:e.type===r.type&&e.format===r.format&&JSON.stringify(e.content)===JSON.stringify(r.content)}dispose(){this.timerRegistry.clearAll(),this.vmContext=null,this.ctx=null,this.assertions=[]}}});function wP(t,e){if(t)return t.split(",").map(r=>{let n=r.trim();if(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))return n.slice(1,-1);let i=Number(n);if(!isNaN(i)&&n!=="")return i;if(e&&n in e){let s=e[n],o=Number(s);return!isNaN(o)&&s!==""?o:s}return n})}function _P(t){if(typeof t=="string"&&t.charCodeAt(0)===30)try{return JSON.parse(t.slice(1))}catch{return t}return t}function $z(t,e){if(t==="@")return"";if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);let r=t.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(r){let n=wP(r[2],e),i=Vi(r[1],n);return i!==null?i:void 0}if(e[t]!==void 0)return _P(e[t]);if(go(t)){let n=mo(t,e),i=ui(t,n);if(i!==void 0)return i}}function bP(t,e,r,n){let i=Buffer.concat([Buffer.from(t,"utf8"),n||Buffer.alloc(0)]),s=[],o=Buffer.alloc(0);for(;Buffer.concat(s).length<e+r;)o=gr.createHash("md5").update(Buffer.concat([o,i])).digest(),s.push(o);let l=Buffer.concat(s);return{key:l.subarray(0,e),iv:l.subarray(e,e+r)}}function W0(t,e,r){let n=i=>t==="aes"?`aes-${i*8}-cbc`:t==="des"?"des-cbc":t==="des-ede3"?"des-ede3-cbc":t;return{encrypt(i,s,o){let l=i instanceof Xe?i.toBuffer():Buffer.from(String(i),"utf8");if(typeof s=="string"){let c=gr.randomBytes(8),{key:d,iv:p}=bP(s,e,r,c),m=gr.createCipheriv(n(e),d,p),y=Buffer.concat([m.update(l),m.final()]),b=Buffer.concat([Buffer.from("Salted__"),c,y]);return{ciphertext:new Xe(y),salt:new Xe(c),toString:q=>q?q.stringify(new Xe(b)):b.toString("base64")}}else{let c=s.toBuffer(),d=o?.iv&&o.iv instanceof Xe?o.iv.toBuffer():Buffer.alloc(r),p=gr.createCipheriv(n(c.length),c,d);o?.padding===!1&&p.setAutoPadding(!1);let m=Buffer.concat([p.update(l),p.final()]);return{ciphertext:new Xe(m),toString:y=>y?y.stringify(new Xe(m)):m.toString("base64")}}},decrypt(i,s,o){if(typeof s=="string"){let l=typeof i=="string"?Buffer.from(i,"base64"):i.ciphertext.toBuffer(),c,d;l.subarray(0,8).toString()==="Salted__"?(d=l.subarray(8,16),c=l.subarray(16)):(d=Buffer.alloc(0),c=l);let{key:p,iv:m}=bP(s,e,r,d),y=gr.createDecipheriv(n(e),p,m);return new Xe(Buffer.concat([y.update(c),y.final()]))}else{let l=s.toBuffer(),c=o?.iv&&o.iv instanceof Xe?o.iv.toBuffer():Buffer.alloc(r),d=typeof i=="string"?Buffer.from(i,"base64"):i.ciphertext?i.ciphertext.toBuffer():Buffer.from(i),p=gr.createDecipheriv(n(l.length),l,c);return o?.padding===!1&&p.setAutoPadding(!1),new Xe(Buffer.concat([p.update(d),p.final()]))}}}}function Nz(){let t=r=>n=>{let i=n instanceof Xe?n.toBuffer():Buffer.from(String(n),"utf8");return new Xe(gr.createHash(r).update(i).digest())},e=r=>(n,i)=>{let s=n instanceof Xe?n.toBuffer():Buffer.from(String(n),"utf8"),o=i instanceof Xe?i.toBuffer():Buffer.from(String(i),"utf8");return new Xe(gr.createHmac(r,o).update(s).digest())};return{MD5:t("md5"),SHA1:t("sha1"),SHA224:t("sha224"),SHA256:t("sha256"),SHA384:t("sha384"),SHA512:t("sha512"),SHA3:t("sha3-256"),RIPEMD160:t("ripemd160"),HmacMD5:e("md5"),HmacSHA1:e("sha1"),HmacSHA256:e("sha256"),HmacSHA512:e("sha512"),AES:W0("aes",32,16),DES:W0("des",8,8),TripleDES:W0("des-ede3",24,8),PBKDF2(r,n,i){let s=r instanceof Xe?r.toBuffer():Buffer.from(String(r),"utf8"),o=n instanceof Xe?n.toBuffer():Buffer.from(String(n),"utf8"),l=(i?.keySize||4)*4,c=i?.iterations||1;return new Xe(gr.pbkdf2Sync(s,o,c,l,"sha1"))},enc:{Base64:{stringify:r=>(r instanceof Xe?r.toBuffer():Buffer.from(String(r))).toString("base64"),parse:r=>Xe.fromBase64(r)},Utf8:{stringify:r=>(r instanceof Xe?r.toBuffer():Buffer.from(String(r))).toString("utf8"),parse:r=>Xe.fromUtf8(r)},Hex:{stringify:r=>(r instanceof Xe?r.toBuffer():Buffer.from(String(r))).toString("hex"),parse:r=>Xe.fromHex(r)},Latin1:{stringify:r=>(r instanceof Xe?r.toBuffer():Buffer.from(String(r))).toString("latin1"),parse:r=>new Xe(Buffer.from(r,"latin1"))},Utf16:{stringify:r=>(r instanceof Xe?r.toBuffer():Buffer.from(String(r))).toString("utf16le"),parse:r=>new Xe(Buffer.from(r,"utf16le"))},Utf16BE:{stringify:r=>(r instanceof Xe?r.toBuffer():Buffer.from(String(r))).swap16().toString("utf16le"),parse:r=>new Xe(Buffer.from(r,"utf16le").swap16())}},lib:{WordArray:{create:r=>r?typeof r=="string"?new Xe(Buffer.from(r,"utf8")):Buffer.isBuffer(r)?new Xe(r):new Xe(Buffer.from(String(r))):new Xe(Buffer.alloc(0)),random:r=>new Xe(gr.randomBytes(r))}},pad:{Pkcs7:{_name:"pkcs7"},NoPadding:{_name:"nopadding"},ZeroPadding:{_name:"zeropadding"}},mode:{CBC:{_name:"cbc"},ECB:{_name:"ecb"}}}}var gr,Tz,SP,Xe,Ki,md=ae(()=>{"use strict";gr=ve(require("crypto")),Tz=ve(require("querystring")),SP=ve(require("vm"));sm();Pf();lm();H0();V0();Gm();Xe=class t{_buffer;constructor(e){this._buffer=typeof e=="string"?Buffer.from(e,"utf8"):e}toString(e){return e?e.stringify(this):this._buffer.toString("hex")}toBuffer(){return this._buffer}static fromHex(e){return new t(Buffer.from(e,"hex"))}static fromBase64(e){return new t(Buffer.from(e,"base64"))}static fromUtf8(e){return new t(Buffer.from(e,"utf8"))}};Ki=class t{constructor(e,r=[],n,i="shared",s=5e3){this.httpService=e;this.secretRegistry=n;this.scopeMode=i;this.scriptTimeoutMs=s;this.moduleLoader=zm(r)}httpService;secretRegistry;scopeMode;scriptTimeoutMs;moduleLoader;createRequestSession(e){return new Wu({createVM:this.createVM.bind(this),createCommonContext:this.createCommonContext.bind(this),isolateScripts:this.scopeMode==="isolated",scriptTimeoutMs:this.scriptTimeoutMs},e)}createVM(e,r,n){let i=this.moduleLoader.getGlobalSetupExports(),s=this.moduleLoader.createRequireFunction();e.require=s,e.vault=this.createVault();let o={ctx:e,hf:e,pm:e,console:r,...i||{},global:i,setTimeout:n?.setTimeout??setTimeout,setInterval:n?.setInterval??setInterval,clearTimeout:n?.clearTimeout??clearTimeout,clearInterval:n?.clearInterval??clearInterval,URL,URLSearchParams,Buffer,atob:l=>Buffer.from(l,"base64").toString("binary"),btoa:l=>Buffer.from(l,"binary").toString("base64"),TextEncoder,TextDecoder,crypto:gr,_:s("lodash"),require:s,moment:fd(),querystring:Tz,CryptoJS:Nz(),tv4:(()=>{try{return s("tv4")}catch{return}})(),postman:{setNextRequest:l=>e.setNextRequest?.(l),setGlobalVariable:(l,c)=>e.globals?.set(l,c),getGlobalVariable:l=>e.globals?.get(l),clearGlobalVariable:l=>e.globals?.unset(l),setEnvironmentVariable:(l,c)=>e.environment?.set(l,c),getEnvironmentVariable:l=>e.environment?.get(l),clearEnvironmentVariable:l=>e.environment?.unset(l),getResponseHeader:l=>{let c=e.response?.headers?.get?.(l);return c===void 0?null:c},getResponseCookie:l=>{let c=e.response?.cookies;if(c&&typeof c[Symbol.iterator]=="function"){for(let d of c)if(d?.name&&d.name.toLowerCase()===l.toLowerCase())return{...d}}return null}},jsonStringify:(l,c,d)=>JSON.stringify(l,c,d),jsonParse:l=>JSON.parse(l),xml2Json:l=>{try{let c=this.moduleLoader.createRequireFunction()("xml2js"),d;return c.parseString(l,{explicitArray:!1},(p,m)=>{if(p)throw p;d=m}),d}catch{throw new Error("xml2Json() requires the xml2js module. Add it to your modules/package.json and run npm install.")}}};return SP.createContext(o)}createCommonContext(e,r){let n={...e.variables},i={...e.collectionVariables||{}},s={...e.globals||{}},o={...e.environmentVariables||{}},l=e.iterationData||{},c=this.createMergedVariableScope(n,o,i,s,l),d=this.createGlobalsScope(s,e.onGlobalsChange),p=this.createVariableScope(i),m=this.createEnvironmentScope(o,e.environmentName,e.onEnvironmentChange,!0),y={...m,set:(C,v)=>{let _=this.serializeValue(v);m.set(C,_),n[C]=_},unset(C){m.unset(C),delete n[C]},clear(){let C=Object.keys(o);m.clear();for(let v of C)delete n[v]}},b={...d,set:(C,v)=>{let _=this.serializeValue(v);d.set(C,_),n[C]=_},unset(C){d.unset(C),delete n[C]},clear(){let C=Object.keys(s);d.clear();for(let v of C)delete n[v]}};return b.replaceIn=c.replaceIn,p.replaceIn=c.replaceIn,y.replaceIn=c.replaceIn,{globals:b,collectionVariables:p,variables:c,environment:y,iterationData:{get:C=>l[C],has:C=>C in l,toObject:()=>({...l}),toJSON:()=>JSON.stringify(l)},sendRequest:this.createSendRequest(),expect:za,info:e.info||{eventName:r,requestName:void 0,requestId:void 0}}}static JSON_TYPE_MARKER="";serializeValue(e){return typeof e=="string"?e:e===void 0?t.JSON_TYPE_MARKER+"undefined":t.JSON_TYPE_MARKER+JSON.stringify(e)}deserializeValue(e){if(e!==void 0){if(typeof e=="string"&&e.charCodeAt(0)===30){let r=e.slice(1);if(r==="undefined")return;try{return JSON.parse(r)}catch{}}return e}}createVariableScope(e){return{get:r=>this.deserializeValue(e[r]),set:(r,n)=>{e[r]=this.serializeValue(n)},has(r){return r in e},unset(r){delete e[r]},clear(){Object.keys(e).forEach(r=>delete e[r])},toObject(){return{...e}}}}createGlobalsScope(e,r){let n=(i,s,o)=>{r&&r(i,s,o)};return{get:i=>this.deserializeValue(e[i]),set:(i,s)=>{let o=this.serializeValue(s);e[i]=o,n("set",i,o)},has(i){return i in e},unset(i){delete e[i],n("unset",i)},clear(){Object.keys(e).forEach(i=>delete e[i]),n("clear")},toObject(){return{...e}}}}createMergedVariableScope(e,r,n,i,s={}){let o={get:l=>l in e?this.deserializeValue(e[l]):l in s?s[l]:l in r?this.deserializeValue(r[l]):l in n?this.deserializeValue(n[l]):this.deserializeValue(i[l]),set:(l,c)=>{e[l]=this.serializeValue(c)},has(l){return l in e||l in s||l in r||l in r||l in n||l in i},unset(l){delete e[l]},clear(){Object.keys(e).forEach(l=>delete e[l])},toObject(){return{...i,...n,...r,...s,...e}},toLocalObject(){return{...n,...r,...s,...e}},replaceIn(l){if(!l||typeof l!="string")return l;let c=o.toObject(),d=20,p=y=>y.replace(/\{\{([^}]+)\}\}/g,(b,q)=>{let C=q.trim(),v=C.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(v)try{let E=wP(v[2],c),k=Vi(v[1],E);return k!==null?String(k):b}catch{return b}let _=Cu(C);if(_){let E=$z(_.input,c);if(E!==void 0){let k=xu(E,_.filters,c);return k!==void 0?String(k):b}return b}if(o.has(C)){let E=o.get(C);return E===void 0?"":String(E)}if(go(C)){let E={};for(let[M,j]of Object.entries(c))E[M]=_P(j);let k=mo(C,E),O=ui(C,k);if(O!==void 0)return String(O)}return b}),m=l;for(let y=0;y<d;y++){let b=p(m);if(b===m)break;m=b}return m}};return o}createEnvironmentScope(e,r,n,i){let s=(o,l,c)=>{n&&(i?n(o,l,c):n(l||"",o==="set"?c:void 0))};return{name:r||"",get:o=>this.deserializeValue(e[o]),set:(o,l)=>{let c=this.serializeValue(l);e[o]=c,s("set",o,c)},has(o){return o in e},unset(o){delete e[o],s("unset",o)},clear(){Object.keys(e).forEach(o=>delete e[o]),s("clear")},toObject(){return{...e}}}}createVault(){let e=this.secretRegistry,r=()=>{throw new Error("pm.vault is read-only in HTTP Forge. Use environment variables or {{secret:provider/path}} tokens to manage secrets.")};return{async get(n){if(!e)throw new Error('pm.vault is not available \u2014 no secret providers are configured. Configure a provider under "secrets.providers" to use pm.vault.get().');let i=`secret:${n}`;return(await e.resolveSecretTokens(`{{${i}}}`))[i]},set:r,unset:r}}createSendRequest(){return this.httpService?(e,r)=>{let n=typeof e=="string"?{url:e,method:"GET"}:e,i=this.httpService.execute({url:n.url,method:n.method||"GET",headers:n.headers||{},body:n.body,...n});if(r){i.then(s=>r(null,s)).catch(s=>r(s,null));return}return i}:(e,r)=>{let n=new Error("sendRequest not available - HTTP service not configured");if(r){r(n,null);return}return Promise.reject(n)}}}});var RP,Fz,J0,Zm,z0,Xm,on,Eo,gd=ae(()=>{"use strict";RP=ve(require("fs")),Fz=ve(require("http")),J0=ve(require("https")),Zm=ve(require("path")),z0=require("url"),Xm=ve(require("zlib")),on={timeout:3e4,followRedirects:!0,followOriginalMethod:!1,followAuthHeader:!1,maxRedirects:10,strictSSL:!0,decompress:!0,includeCookies:!1,tls:{},certificates:[]},Eo=class{settings;version;basePath;constructor(e,r=process.cwd()){this.settings={...on,...e},this.basePath=r;try{this.version=require("../../package.json").version||"0.0.0"}catch{this.version="0.0.0"}this.settings.strictSSL===!1&&console.log("[NodeHttpClient] SSL verification disabled (strictSSL: false)")}async send(e){let r=this.mergeSettings(e.settings);return await this.executeInternal(e,r,0)}mergeSettings(e){return{timeout:e?.timeout??this.settings.timeout,followRedirects:e?.followRedirects??this.settings.followRedirects,followOriginalMethod:e?.followOriginalMethod??this.settings.followOriginalMethod,followAuthHeader:e?.followAuthHeader??this.settings.followAuthHeader,maxRedirects:e?.maxRedirects??this.settings.maxRedirects,strictSSL:e?.strictSSL??this.settings.strictSSL,decompress:e?.decompress??this.settings.decompress,includeCookies:e?.includeCookies??this.settings.includeCookies,tls:e?.tls??this.settings.tls??{},certificates:e?.certificates??this.settings.certificates??[]}}async executeInternal(e,r,n,i){let s=Date.now(),o=new z0.URL(e.url),l=o.protocol==="https:",c=this.sanitizeHeaders(e.headers||{});Object.keys(c).some(m=>m.toLowerCase()==="user-agent")||(c["User-Agent"]=`HttpForge/${this.version}`);let p={hostname:o.hostname,port:o.port||(l?443:80),path:o.pathname+o.search,method:e.method,headers:{...c},timeout:r.timeout||void 0};if(r.decompress&&!c["accept-encoding"]&&!c["Accept-Encoding"]&&(p.headers["Accept-Encoding"]="gzip, deflate"),l){let m=this.resolveTlsSettings(o,r),y=p;y.rejectUnauthorized=r.strictSSL;let b={rejectUnauthorized:r.strictSSL},q=this.readOptionalFile(m.caPath,"CA certificate");q&&(b.ca=q);let C=this.readOptionalFile(m.certPath,"client certificate");C&&(b.cert=C);let v=this.readOptionalFile(m.keyPath,"client private key");v&&(b.key=v);let _=this.readOptionalFile(m.pfxPath,"client pfx");_&&(b.pfx=_),m.passphrase&&(b.passphrase=m.passphrase),m.servername&&(y.servername=m.servername),y.agent=new J0.Agent(b)}return new Promise((m,y)=>{if(i?.aborted){let C=new Error("Request cancelled");C.name="AbortError",y(C);return}let q=(l?J0:Fz).request(p,async C=>{let v=C.statusCode||0;if(r.followRedirects&&[301,302,303,307,308].includes(v)){if(n>=r.maxRedirects){y(new Error(`Maximum redirects (${r.maxRedirects}) exceeded`));return}let E=C.headers.location;if(!E){y(new Error("Redirect response missing Location header"));return}let k=new z0.URL(E,e.url).toString(),O=e.method;!r.followOriginalMethod&&[301,302,303].includes(v)&&(O="GET");let M={...e.headers};r.followAuthHeader||(delete M.authorization,delete M.Authorization);try{let j=await this.executeInternal({...e,url:k,method:O,headers:M,body:O==="GET"?void 0:e.body},r,n+1,i),I=Date.now();j.time=I-s,m(j)}catch(j){y(j)}return}let _=[];C.on("data",E=>_.push(E)),C.on("end",()=>{let E=Date.now(),k=Buffer.concat(_),O=C.headers["content-encoding"];if(r.decompress&&O)try{O==="gzip"?k=Xm.gunzipSync(k):O==="deflate"&&(k=Xm.inflateSync(k))}catch(R){console.warn("[NodeHttpClient] Decompression failed:",R)}let M=k.toString("utf-8"),j={};for(let[R,A]of Object.entries(C.headers))(typeof A=="string"||Array.isArray(A))&&(j[R]=A);let I=this.parseCookies(C.headers["set-cookie"],o.hostname);m({status:C.statusCode||0,statusText:C.statusMessage||"",headers:j,cookies:I,body:M,time:E-s,size:k.length})})});if(i&&i.addEventListener("abort",()=>{q.destroy();let C=new Error("Request cancelled");C.name="AbortError",y(C)}),q.on("error",C=>{y(C)}),q.on("timeout",()=>{q.destroy(),y(new Error("Request timeout"))}),e.body!==void 0&&e.body!==null){let C=typeof e.body=="string"?e.body:JSON.stringify(e.body);q.write(C)}q.end()})}resolveTlsSettings(e,r){let n=r.tls||{};if(!!(n.caPath||n.certPath||n.keyPath||n.pfxPath||n.servername||n.passphrase))return n;let s=this.findCertificateMapping(e,r.certificates||[]);return s?{caPath:s.caPath,certPath:s.certPath,keyPath:s.keyPath,pfxPath:s.pfxPath,passphrase:s.passphrase,servername:s.servername}:n}findCertificateMapping(e,r){if(!Array.isArray(r)||r.length===0)return;let n=e.hostname,i=e.port?Number(e.port):443,s=r.find(o=>this.mappingMatchesHost(o,n,i,!0));return s||r.find(o=>this.mappingMatchesHost(o,n,i,!1))}mappingMatchesHost(e,r,n,i){if(!e||e.enabled===!1)return!1;let s=String(e.host||"").trim().toLowerCase();if(!s||e.port!=null&&Number(e.port)!==n)return!1;let o=r.toLowerCase();if(i)return s!=="*"&&!s.startsWith("*.")&&o===s;if(s==="*")return!0;if(s.startsWith("*.")){let l=s.slice(2);return o===l||o.endsWith(`.${l}`)}return o===s}readOptionalFile(e,r){if(!e)return;let n=Zm.isAbsolute(e)?e:Zm.resolve(this.basePath,e);try{return RP.readFileSync(n)}catch(i){throw new Error(`[NodeHttpClient] Failed to read ${r} file at ${n}: ${i?.message||"Unknown error"}`)}}sanitizeHeaderValue(e){return e?String(e).replace(/[\u201C\u201D\u201E\u201F\u2033\u2036]/g,'"').replace(/[\u2018\u2019\u201A\u201B\u2032\u2035]/g,"'").replace(/[\x00-\x08\x0A-\x1F\x7F]/g,""):""}sanitizeHeaders(e){let r={};for(let[n,i]of Object.entries(e))r[n]=this.sanitizeHeaderValue(String(i));return r}parseCookies(e,r){return e?e.map(n=>{let i=n.split(";").map(p=>p.trim()),[s,...o]=i,[l,c]=s.split("="),d={name:l.trim(),value:c?.trim()||"",domain:r};for(let p of o){let[m,y]=p.split("=");switch(m.toLowerCase().trim()){case"domain":d.domain=y?.trim();break;case"path":d.path=y?.trim();break;case"expires":d.expires=y?.trim();break;case"httponly":d.httpOnly=!0;break;case"secure":d.secure=!0;break}}return d}):[]}}});var G0,qo,eg=ae(()=>{"use strict";G0={json:"application/json",xml:"application/xml",html:"text/html",text:"text/plain",javascript:"application/javascript",css:"text/css","x-www-form-urlencoded":"application/x-www-form-urlencoded","form-data":"multipart/form-data",graphql:"application/json"},qo=class{sanitizeHeaderValue(e){return e?String(e).replace(/[\u201C\u201D\u201E\u201F\u2033\u2036]/g,'"').replace(/[\u2018\u2019\u201A\u201B\u2032\u2035]/g,"'").replace(/[\x00-\x08\x0A-\x1F\x7F]/g,""):""}sanitizeHeaders(e){let r={};for(let[n,i]of Object.entries(e))r[n]=this.sanitizeHeaderValue(String(i));return r}encodeBody(e){if(!e||e.type==="none")return null;let{type:r,content:n}=e;switch(r){case"x-www-form-urlencoded":return this.encodeUrlEncodedBody(n);case"form-data":return n;case"graphql":return this.encodeGraphQLBody(n);case"raw":return n;default:return n}}encodeUrlEncodedBody(e){if(Array.isArray(e)){let r=new URLSearchParams;for(let n of e)n.enabled!==!1&&n.key&&r.append(n.key,n.value||"");return r.toString()}return typeof e=="string"?e:String(e)}encodeGraphQLBody(e){if(typeof e=="string")try{e=JSON.parse(e)}catch{return e}if(typeof e=="object"&&e!==null&&e.query){let r=e.variables;if(typeof r=="string")try{r=r.trim()?JSON.parse(r):void 0}catch{r=void 0}return JSON.stringify({query:e.query,...r!=null?{variables:r}:{},...e.operationName?{operationName:e.operationName}:{}})}return JSON.stringify(e)}setContentTypeHeader(e,r,n){if(Object.keys(e).some(o=>o.toLowerCase()==="content-type"))return;if(n){e["Content-Type"]=n;return}if(!r||r.type==="none")return;let s;switch(r.type){case"x-www-form-urlencoded":s=G0["x-www-form-urlencoded"];break;case"raw":s=r.format?G0[r.format]:"text/plain",s||(s="text/plain");break;case"graphql":s=G0.graphql;break;case"binary":s="application/octet-stream";break}s&&(e["Content-Type"]=s)}}});var Io,tg=ae(()=>{"use strict";Io=class{parse(e,r){return r.toLowerCase().endsWith(".json")?this.parseJson(e):this.parseCsv(e)}parseJson(e){try{let r=JSON.parse(e);return Array.isArray(r)?r:[r]}catch{throw new Error("Failed to parse JSON data file: Invalid JSON format")}}parseCsv(e){let r=e.split(/\r?\n/).filter(s=>s.trim());if(r.length<2)return[{}];let n=this.parseCsvLine(r[0]),i=[];for(let s=1;s<r.length;s++){let o=this.parseCsvLine(r[s]),l={};n.forEach((c,d)=>{l[c]=o[d]||""}),i.push(l)}return i}parseCsvLine(e){let r=[],n="",i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=e[s+1];o==='"'?i&&l==='"'?(n+='"',s++):i=!i:o===","&&!i?(r.push(n.trim()),n=""):n+=o}return r.push(n.trim()),r}}});var Ku,Dz,Qu,Y0=ae(()=>{"use strict";Ku=ve(require("crypto")),Dz=3e4,Qu=class{constructor(e,r,n,i,s="henry-huang.http-forge/oauth2/callback"){this.secretStore=e;this.browserService=r;this.envConfigService=n;this.httpService=i;this.callbackPath=s}secretStore;browserService;envConfigService;httpService;callbackPath;tokenCache=new Map;pendingAuthCallback=null;pendingImplicitCallback=null;async getToken(e,r){if(e.accessToken)return{accessToken:this.resolve(e.accessToken,r),tokenType:e.tokenPrefix||"Bearer",raw:{}};let n=this.buildCacheKeyString(e),i=this.tokenCache.get(n);if(i&&!this.isExpired(i))return i;if(i?.refreshToken)try{return await this.refreshToken(e,i.refreshToken,r)}catch{this.tokenCache.delete(n)}if(!i){let o=await this.secretStore.get(`oauth2_refresh_${n}`);if(o)try{return await this.refreshToken(e,o,r)}catch{await this.secretStore.delete(`oauth2_refresh_${n}`)}}let s;switch(e.grantType){case"client_credentials":s=await this.fetchToken(e,r,"client_credentials");break;case"password":s=await this.fetchToken(e,r,"password");break;case"authorization_code":s=await this.authorizationCodeFlow(e,r);break;case"implicit":s=await this.implicitFlow(e,r);break;default:throw new Error(`Unknown OAuth2 grant type: ${e.grantType}`)}return this.tokenCache.set(n,s),s.refreshToken&&await this.storeRefreshToken(n,s.refreshToken),s}async refreshToken(e,r,n){let i=this.resolve(e.tokenUrl||"",n);if(!i)throw new Error("OAuth2 tokenUrl is required for token refresh");let s=this.resolve(e.clientId||"",n),o=this.resolve(e.clientSecret||"",n),l=new URLSearchParams;l.append("grant_type","refresh_token"),l.append("refresh_token",r);let c={"Content-Type":"application/x-www-form-urlencoded"};this.applyClientAuth(e,c,l,s,o,n);let d=await this.httpService.execute({method:"POST",url:i,headers:c,body:l.toString()}),p=this.parseTokenResponse(d.body,e);p.refreshToken||(p.refreshToken=r);let m=this.buildCacheKeyString(e);return this.tokenCache.set(m,p),p.refreshToken&&await this.storeRefreshToken(m,p.refreshToken),p}async authorizationCodeFlow(e,r){let n=this.resolve(e.authUrl||"",r),i=this.resolve(e.tokenUrl||"",r),s=this.resolve(e.clientId||"",r),o=this.resolve(e.clientSecret||"",r),l=e.scope?this.resolve(e.scope,r):void 0;if(!n)throw new Error("OAuth2 authUrl is required for authorization code flow");if(!i)throw new Error("OAuth2 tokenUrl is required for authorization code flow");if(!s)throw new Error("OAuth2 clientId is required for authorization code flow");let c=e.usePkce!==!1,d,p,m;if(c){d=this.generateCodeVerifier();let j=e.pkceMethod||"S256";p=j==="S256"?this.generateCodeChallengeS256(d):d,m=j}let y=e.state||Ku.randomBytes(16).toString("hex"),b=await this.getCallbackUri(),q=new URL(n);if(q.searchParams.set("response_type","code"),q.searchParams.set("client_id",s),q.searchParams.set("redirect_uri",b),l&&q.searchParams.set("scope",l),q.searchParams.set("state",y),p&&(q.searchParams.set("code_challenge",p),q.searchParams.set("code_challenge_method",m)),e.audience&&q.searchParams.set("audience",this.resolve(e.audience,r)),e.resource&&q.searchParams.set("resource",this.resolve(e.resource,r)),e.extraParams)for(let[j,I]of Object.entries(e.extraParams))q.searchParams.set(j,this.resolve(I,r));this.pendingAuthCallback&&(this.pendingAuthCallback.reject(new Error("OAuth2 authorization superseded by a new request")),this.pendingAuthCallback=null);let C=new Promise((j,I)=>{this.pendingAuthCallback={resolve:j,reject:I,state:y}});await this.browserService.openExternal(q.toString());let v;try{v=await Promise.race([C,new Promise((j,I)=>setTimeout(()=>{this.pendingAuthCallback=null,I(new Error("OAuth2 authorization timed out after 2 minutes"))},12e4))])}finally{this.pendingAuthCallback=null}if(v.state&&v.state!==y)throw new Error("OAuth2 state mismatch \u2014 potential CSRF attack");let _=new URLSearchParams;_.append("grant_type","authorization_code"),_.append("code",v.code),_.append("redirect_uri",b),d&&_.append("code_verifier",d);let E={"Content-Type":"application/x-www-form-urlencoded"};this.applyClientAuth(e,E,_,s,o,r);let k=await this.httpService.execute({method:"POST",url:i,headers:E,body:_.toString()}),O=this.parseTokenResponse(k.body,e),M=this.buildCacheKeyString(e);return this.tokenCache.set(M,O),O.refreshToken&&await this.storeRefreshToken(M,O.refreshToken),O}async implicitFlow(e,r){let n=this.resolve(e.authUrl||"",r),i=this.resolve(e.clientId||"",r),s=e.scope?this.resolve(e.scope,r):void 0;if(!n)throw new Error("OAuth2 authUrl is required for implicit flow");if(!i)throw new Error("OAuth2 clientId is required for implicit flow");let o=e.state||Ku.randomBytes(16).toString("hex"),l=await this.getCallbackUri(),c=new URL(n);if(c.searchParams.set("response_type","token"),c.searchParams.set("client_id",i),c.searchParams.set("redirect_uri",l),s&&c.searchParams.set("scope",s),c.searchParams.set("state",o),e.audience&&c.searchParams.set("audience",this.resolve(e.audience,r)),e.resource&&c.searchParams.set("resource",this.resolve(e.resource,r)),e.extraParams)for(let[b,q]of Object.entries(e.extraParams))c.searchParams.set(b,this.resolve(q,r));this.pendingImplicitCallback&&(this.pendingImplicitCallback.reject(new Error("OAuth2 implicit flow superseded by a new request")),this.pendingImplicitCallback=null);let d=new Promise((b,q)=>{this.pendingImplicitCallback={resolve:b,reject:q,state:o}});await this.browserService.openExternal(c.toString());let p;try{p=await Promise.race([d,new Promise((b,q)=>setTimeout(()=>{this.pendingImplicitCallback=null,q(new Error("OAuth2 implicit flow timed out after 2 minutes"))},12e4))])}finally{this.pendingImplicitCallback=null}if(p.state&&p.state!==o)throw new Error("OAuth2 state mismatch \u2014 potential CSRF attack");let m={accessToken:p.accessToken,tokenType:p.tokenType||e.tokenPrefix||"Bearer",expiresAt:p.expiresIn?Date.now()+p.expiresIn*1e3:void 0,raw:{access_token:p.accessToken,token_type:p.tokenType,expires_in:p.expiresIn}},y=this.buildCacheKeyString(e);return this.tokenCache.set(y,m),m}handleAuthorizationCallback(e,r,n){if(n){let i=new Error(`OAuth2 authorization error: ${n}`);this.pendingAuthCallback?.reject(i),this.pendingImplicitCallback?.reject(i),this.pendingAuthCallback=null,this.pendingImplicitCallback=null;return}if(e&&this.pendingAuthCallback){this.pendingAuthCallback.resolve({code:e,state:r}),this.pendingAuthCallback=null;return}!e&&!this.pendingAuthCallback&&this.pendingImplicitCallback&&(this.pendingImplicitCallback.reject(new Error("OAuth2 implicit flow did not receive access_token")),this.pendingImplicitCallback=null)}handleImplicitCallback(e,r,n,i){this.pendingImplicitCallback&&(this.pendingImplicitCallback.resolve({accessToken:e,tokenType:r,expiresIn:n,state:i}),this.pendingImplicitCallback=null)}clearToken(e){let r=`${e.tokenUrl}|${e.clientId}|${e.scope||""}|${e.grantType}`;this.tokenCache.delete(r),this.secretStore.delete(`oauth2_refresh_${r}`)}clearAllTokens(){for(let e of this.tokenCache.keys())this.secretStore.delete(`oauth2_refresh_${e}`);this.tokenCache.clear()}async fetchToken(e,r,n){let i=this.resolve(e.tokenUrl||"",r);if(!i)throw new Error("OAuth2 tokenUrl is required");let s=this.resolve(e.clientId||"",r),o=this.resolve(e.clientSecret||"",r),l=e.scope?this.resolve(e.scope,r):void 0,c=new URLSearchParams;if(c.append("grant_type",n),l&&c.append("scope",l),n==="password"){let m=this.resolve(e.username||"",r),y=this.resolve(e.password||"",r);if(!m)throw new Error("OAuth2 password grant requires username");c.append("username",m),c.append("password",y)}if(e.audience&&c.append("audience",this.resolve(e.audience,r)),e.resource&&c.append("resource",this.resolve(e.resource,r)),e.extraParams)for(let[m,y]of Object.entries(e.extraParams))c.append(m,this.resolve(y,r));let d={"Content-Type":"application/x-www-form-urlencoded"};this.applyClientAuth(e,d,c,s,o,r);let p=await this.httpService.execute({method:"POST",url:i,headers:d,body:c.toString()});return this.parseTokenResponse(p.body,e)}applyClientAuth(e,r,n,i,s,o){if(e.clientAuthentication==="header"){let l=Buffer.from(`${i}:${s}`).toString("base64");r.Authorization=`Basic ${l}`}else i&&n.set("client_id",i),s&&n.set("client_secret",s)}parseTokenResponse(e,r){let n=e;if(typeof n=="string")try{n=JSON.parse(n)}catch{throw new Error("OAuth2 token response is not valid JSON")}if(!n||typeof n!="object")throw new Error("OAuth2 token response is not a valid JSON object");let i=n,s=r.tokenField||"access_token",o=i[s];if(!o)throw new Error(`OAuth2 token fetch failed: '${s}' not present in response`);let l=typeof i.expires_in=="number"?i.expires_in:void 0;return{accessToken:o,tokenType:i.token_type||r.tokenPrefix||"Bearer",expiresAt:l?Date.now()+l*1e3:void 0,refreshToken:i.refresh_token,scope:i.scope,raw:i}}isExpired(e){return e.expiresAt?Date.now()>=e.expiresAt-Dz:!1}buildCacheKeyString(e){return`${e.tokenUrl||""}|${e.clientId||""}|${e.scope||""}|${e.grantType}`}async getCallbackUri(){let e=`${this.browserService.uriScheme}://${this.callbackPath}`;return this.browserService.asExternalUri(e)}resolve(e,r){return this.envConfigService.resolveVariables(e,r)}generateCodeVerifier(){return Ku.randomBytes(32).toString("base64url")}generateCodeChallengeS256(e){return Ku.createHash("sha256").update(e).digest("base64url")}async storeRefreshToken(e,r){try{await this.secretStore.store(`oauth2_refresh_${e}`,r)}catch{}}}});function Ka(t,e={}){let r=[];Object.entries(e).forEach(([n,i])=>{r.push(`${n}=${i}`)}),r.length&&Ya.writeFileSync(t,r.join(`
|
|
53
53
|
`),"utf-8")}function Zu(t,e,r){r&&(r.preRequest&&r.preRequest.trim()&&Ya.writeFileSync(Po.join(t,`${e}.pre.js`),r.preRequest,"utf-8"),r.postResponse&&r.postResponse.trim()&&Ya.writeFileSync(Po.join(t,`${e}.post.js`),r.postResponse,"utf-8"))}function CP(t,e){let n=e&&e.trim()?e.trim():"collections-rest-client";return Po.isAbsolute(n)?n:Po.join(t,n)}async function xP(t,e,r,n,i){await t.exportCollectionAsRestClientFolder(r,n),e.exportEnvironmentsToFolder(n,i)}function yd(t,e,r){t.forEach(n=>{if(n.type==="folder"){let i=Po.join(e,Ht(n.name));Ya.mkdirSync(i,{recursive:!0}),Zu(i,Ht(n.name),n.scripts),yd(n.items||[],i,r)}else if(n.type==="request"){let i=n,s=Ht(i.name)+".http",o=Po.join(e,s),l=jz(i,r);Ya.writeFileSync(o,l,"utf-8"),Zu(e,Ht(i.name),i.scripts)}})}function jz(t,e){let r=[];r.push(`### ${e.name} / ${t.name}`),r.push(`# collection env: ${Ht(e.name)}.env`),r.push(`# request scripts: ${Ht(t.name)}.pre.js and .post.js`);let n=Lz(t);return r.push(`${t.method} ${n}`),(t.headers||[]).filter(i=>i.enabled!==!1).forEach(i=>{r.push(`${i.key}: ${i.value}`)}),t.body&&t.body.content&&r.push("",t.body.content),r.join(`
|
|
54
|
-
`)}function Lz(t){let e=t.url;if(t.query&&t.query.length){let r=t.query.filter(n=>n.enabled!==!1).map(n=>`${encodeURIComponent(n.key)}=${encodeURIComponent(n.value)}`).join("&");r&&(e+=(e.includes("?")?"&":"?")+r)}return e}var Ya,Po,ng=ae(()=>{"use strict";Ya=ve(require("fs")),Po=ve(require("path"));Un()});var qr,K0,Qa,Q0=ae(()=>{"use strict";qr=ve(require("fs")),K0=ve(require("path"));Un();Qa=class{collectionsDir;cache=new Map;constructor(e){this.collectionsDir=e,this.ensureDirectory()}ensureDirectory(){qr.existsSync(this.collectionsDir)||qr.mkdirSync(this.collectionsDir,{recursive:!0})}loadAll(){if(this.cache.clear(),!qr.existsSync(this.collectionsDir))return[];let e=qr.readdirSync(this.collectionsDir),r=[];for(let n of e)if(n.endsWith(".json"))try{let i=K0.join(this.collectionsDir,n),s=qr.readFileSync(i,"utf-8"),o=JSON.parse(s);o.id&&o.name&&(this.cache.set(o.id,o),r.push(o))}catch(i){console.error(`[JsonCollectionLoader] Failed to load ${n}:`,i)}return r}load(e){if(this.cache.has(e))return this.cache.get(e);let r=this.getCollectionPath(e);if(qr.existsSync(r))try{let n=qr.readFileSync(r,"utf-8"),i=JSON.parse(n);return this.cache.set(e,i),i}catch(n){console.error(`[JsonCollectionLoader] Failed to load collection ${e}:`,n);return}}async save(e){if(this.ensureDirectory(),!e.name)throw new Error("Collection name is required");e.id||(e.id=Ot(e.name));let r=this.getCollectionPath(e.id),n=JSON.stringify(e,null,2);await qr.promises.writeFile(r,n,"utf-8"),this.cache.set(e.id,e)}async delete(e){let r=this.getCollectionPath(e);if(!qr.existsSync(r))return!1;try{return await qr.promises.unlink(r),this.cache.delete(e),!0}catch(n){return console.error(`[JsonCollectionLoader] Failed to delete collection ${e}:`,n),!1}}exists(e){return qr.existsSync(this.getCollectionPath(e))}getCollectionPath(e){return K0.join(this.collectionsDir,`${e}.json`)}getItemPath(e,r){}async create(e,r){let n={id:r||Ot(e),name:e,items:[]};return await this.save(n),n}async saveScripts(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.findItemById(i.items,r);s&&(s.scripts=n,await this.save(i))}loadScripts(e,r){let n=this.load(e);return n?this.findItemById(n.items,r)?.scripts:void 0}async updateCollectionMetadata(e,r){let n=this.load(e);if(!n)throw new Error(`Collection ${e} not found`);r.name!==void 0&&(n.name=r.name),r.description!==void 0&&(n.description=r.description),r.version!==void 0&&(n.version=r.version),r.variables!==void 0&&(n.variables=r.variables),r.auth!==void 0&&(n.auth=r.auth),await this.save(n)}async saveItem(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.findItemById(i.items,r.id);if(s)Object.assign(s,r);else if(n){let o=this.findItemById(i.items,n);if(o&&o.type==="folder")o.items=o.items||[],o.items.push(r);else throw new Error(`Parent folder ${n} not found`)}else i.items.push(r);await this.save(i)}async deleteItem(e,r){let n=this.load(e);if(!n)return!1;let i=this.deleteItemById(n.items,r);return i&&await this.save(n),i}async updateItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.findItemById(i.items,r);if(!s)return!1;let{id:o,type:l,...c}=n;return Object.assign(s,c),await this.save(i),!0}async moveItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.findItemById(i.items,r);if(!s)return!1;let o={...s};if(!this.deleteItemById(i.items,r))return!1;if(n){let l=this.findItemById(i.items,n);if(l&&l.type==="folder")l.items=l.items||[],l.items.push(o);else return i.items.push(o),!1}else i.items.push(o);return await this.save(i),!0}async reorderItems(e,r,n){let i=this.load(e);if(!i)return!1;try{let s;if(r){let c=this.findItemById(i.items,r);if(!c||!c.items)return!1;s=c.items}else s=i.items;let o=new Map(s.map(c=>[c.id,c])),l=[];for(let c of n){let d=o.get(c);d&&(l.push(d),o.delete(c))}for(let c of o.values())l.push(c);if(r){let c=this.findItemById(i.items,r);c&&(c.items=l)}else i.items=l;return await this.save(i),!0}catch(s){return console.error("[JsonCollectionLoader] Failed to reorder items:",s),!1}}findItemById(e,r){for(let n of e){if(n.id===r)return n;if(n.type==="folder"&&n.items){let i=this.findItemById(n.items,r);if(i)return i}}}deleteItemById(e,r){for(let n=0;n<e.length;n++){if(e[n].id===r)return e.splice(n,1),!0;let i=e[n];if(i.type==="folder"&&i.items&&this.deleteItemById(i.items,r))return!0}return!1}}});var Xu,Z0=ae(()=>{"use strict";rm();Q0();Xu=class{static create(e){let r=e.getStorageConfig(),n=e.getCollectionsPath();return r.format==="folder"?new Cs(n):new Qa(n)}static createForFormat(e,r){return e==="folder"?new Cs(r):new Qa(r)}}});function EP(t){if(typeof t!="string")return"text";let e=t.trim();try{let r=JSON.parse(e);if(typeof r=="object"&&r!==null)return"json"}catch{}return/^<\?xml/.test(e)||/^<([a-zA-Z_][\w\-\.]*)[\s>]/.test(e)?/^<\!DOCTYPE html>/i.test(e)||/^<html[\s>]/i.test(e)?"html":"xml":/^<\!DOCTYPE html>/i.test(e)||/^<html[\s>]/i.test(e)?"html":/^(function\s*\(|\(\)\s*=>|const |let |var |export |import )/.test(e)?"javascript":"text"}function Uz(t){return{info:{name:t.name,_postman_id:t.id,schema:"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},item:t.items.map(e=>qP(e)),event:X0(t.scripts),variable:t.variables?Object.entries(t.variables).map(([e,r])=>({key:e,value:r})):[]}}function qP(t){if(t.type==="folder")return{name:t.name,item:t.items?t.items.map(qP):[],event:X0(t.scripts)};if(t.type==="request"){let e=t;return{name:e.name,request:{method:e.method,header:(e.headers||[]).map(Hz),url:Bz(e),body:Vz(e),auth:Wz(e.auth),description:e.description},event:X0(e.scripts),protocolProfileBehavior:zz(e.settings)}}}function Hz(t){return{key:t.key,value:t.value,disabled:t.enabled===!1,...t.description!==void 0?{description:t.description}:{},...t.type!==void 0?{type:t.type}:{},...t.required!==void 0?{required:t.required}:{},...t.format!==void 0?{format:t.format}:{},...t.enum!==void 0?{enum:t.enum}:{},...t.deprecated!==void 0?{deprecated:t.deprecated}:{},...t.pattern!==void 0?{pattern:t.pattern}:{},...t.minLength!==void 0?{minLength:t.minLength}:{},...t.maxLength!==void 0?{maxLength:t.maxLength}:{},...t.minimum!==void 0?{minimum:t.minimum}:{},...t.maximum!==void 0?{maximum:t.maximum}:{},...t.exclusiveMinimum!==void 0?{exclusiveMinimum:t.exclusiveMinimum}:{},...t.exclusiveMaximum!==void 0?{exclusiveMaximum:t.exclusiveMaximum}:{},...t.multipleOf!==void 0?{multipleOf:t.multipleOf}:{},...t.minItems!==void 0?{minItems:t.minItems}:{},...t.maxItems!==void 0?{maxItems:t.maxItems}:{},...t.uniqueItems!==void 0?{uniqueItems:t.uniqueItems}:{},...t.nullable!==void 0?{nullable:t.nullable}:{},...t.oneOf!==void 0?{oneOf:t.oneOf}:{}}}function Bz(t){let e=t.url,r=t.url.replace(/^[a-zA-Z]+:\/\//,""),n=[],i=r.match(/^([^\/\?]+)/);if(i){let d=i[1];/^{{.*}}$/.test(d)?n=[d]:n=d.split(".")}let s=[],o=r.match(/^[^\/\?]+(\/[^\?]*)?/);if(o&&o[1]!==void 0){let d=o[1].replace(/^\//,"");d.endsWith("/")?(s=d.slice(0,-1).split("/"),s.push("")):s=d.length>0?d.split("/"):[]}let l;if(Array.isArray(t.query)&&t.query.length>0)l=t.query.map(d=>{let p={key:d.key,value:d.value};return d.enabled===!1&&(p.disabled=!0),d.description!==void 0&&(p.description=d.description),d.type!==void 0&&(p.type=d.type),d.required!==void 0&&(p.required=d.required),d.format!==void 0&&(p.format=d.format),d.enum!==void 0&&(p.enum=d.enum),d.deprecated!==void 0&&(p.deprecated=d.deprecated),d.pattern!==void 0&&(p.pattern=d.pattern),d.minLength!==void 0&&(p.minLength=d.minLength),d.maxLength!==void 0&&(p.maxLength=d.maxLength),d.minimum!==void 0&&(p.minimum=d.minimum),d.maximum!==void 0&&(p.maximum=d.maximum),d.exclusiveMinimum!==void 0&&(p.exclusiveMinimum=d.exclusiveMinimum),d.exclusiveMaximum!==void 0&&(p.exclusiveMaximum=d.exclusiveMaximum),d.multipleOf!==void 0&&(p.multipleOf=d.multipleOf),d.minItems!==void 0&&(p.minItems=d.minItems),d.maxItems!==void 0&&(p.maxItems=d.maxItems),d.uniqueItems!==void 0&&(p.uniqueItems=d.uniqueItems),d.nullable!==void 0&&(p.nullable=d.nullable),d.oneOf!==void 0&&(p.oneOf=d.oneOf),p});else{let d=r.indexOf("?");d!==-1&&(l=r.substring(d+1).split("&").map(m=>{let[y,...b]=m.split("=");return{key:y,value:b.join("=")}}))}let c;return t.params&&typeof t.params=="object"&&(c=Object.entries(t.params).map(([d,p])=>({key:d,value:String(p)}))),{raw:e,host:n.length>0?n:void 0,path:s.length>0?s:void 0,query:l&&l.length>0?l:void 0,variable:c&&c.length>0?c:void 0}}function Vz(t){if(!t.body)return;let e=t.body;if(typeof e=="string"){let s=EP(e);return{mode:"raw",raw:e,options:{raw:{language:s}}}}if(e.type==="raw"){let s=e.format||EP(e.content);return{mode:"raw",raw:e.content,options:{raw:{language:s}}}}let r=e.type==="form-data"&&Array.isArray(e.content)?e.content:e.type==="formdata"&&Array.isArray(e.fields)?e.fields:null;if(r)return{mode:"formdata",formdata:r.map(s=>({key:s.key,value:s.value,type:s.type||"text",disabled:s.enabled===!1}))};let n=e.type==="x-www-form-urlencoded"&&Array.isArray(e.content)?e.content:e.type==="urlencoded"&&Array.isArray(e.fields)?e.fields:null;if(n)return{mode:"urlencoded",urlencoded:n.map(s=>({key:s.key,value:s.value,disabled:s.enabled===!1}))};if(e.type==="file"&&e.fileName)return{mode:"file",file:{src:e.fileName}};if(e.type==="binary")return{mode:"binary",file:{}};let i=e.type==="graphql"?e.content??(e.query?e:null):null;if(i){let s=i.query??"",o=i.variables;return{mode:"graphql",graphql:{query:s,variables:o?typeof o=="string"?o:JSON.stringify(o):void 0}}}if(e.content)return{mode:"raw",raw:e.content}}function Wz(t){if(!(!t||!t.type||t.type==="none")){if(t.type==="bearer")return{type:"bearer",bearer:[{key:"token",value:t.bearerToken,type:"string"}]};if(t.type==="basic"&&t.basicAuth)return{type:"basic",basic:[{key:"username",value:t.basicAuth.username,type:"string"},{key:"password",value:t.basicAuth.password,type:"string"}]}}}function zz(t){if(!t)return;let e={};return t.followRedirects===!1&&(e.followRedirects=!1),t.followOriginalMethod===!0&&(e.followOriginalHttpMethod=!0),t.followAuthHeader===!1&&(e.followAuthorizationHeader=!1),t.maxRedirects!==void 0&&(e.maxRedirects=t.maxRedirects),t.strictSSL===!1&&(e.disableUrlEncoding=!1),t.timeout!==void 0&&(e.requestTimeout=t.timeout),Object.keys(e).length>0?e:void 0}function X0(t){if(!t)return[];let e=[];return t.preRequest&&e.push({listen:"prerequest",script:{type:"text/javascript",exec:[t.preRequest]}}),t.postResponse&&e.push({listen:"test",script:{type:"text/javascript",exec:[t.postResponse]}}),e}var Dt,mi,ec,e_=ae(()=>{"use strict";Un();ng();Z0();Dt=ve(require("fs")),mi=ve(require("path"));ec=class{constructor(e,r,n){this.workspaceRoot=e;this.configService=r;this.fileWatcherFactory=n;this.collectionsDir=r.getCollectionsPath(),this.loader=Xu.create(r),this.ensureCollectionsDir(),this.loadCollections(),this.setupFileWatcher()}workspaceRoot;configService;fileWatcherFactory;collectionsDir;collections=new Map;fileWatcher;loader;debounceTimer=null;selfWritePending=!1;localCollectionValues=new Map;onCollectionsChanged;ensureCollectionsDir(){Dt.existsSync(this.collectionsDir)||Dt.mkdirSync(this.collectionsDir,{recursive:!0})}loadCollections(){this.collections.clear();let e=this.loader.loadAll();for(let r of e)this.collections.set(r.id,r)}setupFileWatcher(){if(!this.fileWatcherFactory)return;this.fileWatcher=this.fileWatcherFactory.createFileWatcher(this.collectionsDir,"**/*");let e=()=>{this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null;let r=this.selfWritePending;this.selfWritePending=!1,r||this.loadCollections(),this.onCollectionsChanged?.()},300)};this.fileWatcher.onDidChange(e),this.fileWatcher.onDidCreate(e),this.fileWatcher.onDidDelete(e)}getAllCollections(){return Array.from(this.collections.values())}getCollection(e){return this.collections.get(e)}getCollectionById(e){for(let r of this.collections.values())if(r.id===e)return r}getCollectionByName(e){let r=e.toLowerCase();for(let n of this.collections.values())if(n.name.toLowerCase()===r)return n}async saveCollection(e){if(this.ensureCollectionsDir(),!e.name)throw new Error("Collection name is required");e.id||(e.id=Ot(e.name)),this.selfWritePending=!0,await this.loader.save(e),this.collections.set(e.id,e)}getCollectionVariables(e){let r=this.collections.get(e);return r?.variables?{...r.variables}:{}}getCollectionVariableLocals(e){return{...this.localCollectionValues.get(e)||{}}}setCollectionVariable(e,r,n){this.localCollectionValues.has(e)||this.localCollectionValues.set(e,{}),this.localCollectionValues.get(e)[r]=String(n)}deleteCollectionVariable(e,r){let n=this.localCollectionValues.get(e);n&&delete n[r]}clearCollectionVariables(e){this.localCollectionValues.set(e,{})}async deleteCollection(e){if(!this.collections.get(e))return!1;this.selfWritePending=!0;let n=await this.loader.delete(e);return n&&this.collections.delete(e),n}findRequest(e,r){let n=this.collections.get(e);if(n)return this.findItemRecursive(n.items,r)}findRequestByPath(e,r){let n=this.collections.get(e);if(!n)return;let i=r.split("/").filter(s=>s.trim());return this.findItemByPath(n.items,i)}async updateRequest(e,r,n){let i=this.collections.get(e);if(!i)return!1;this.selfWritePending=!0;let s=await this.loader.updateItem(e,r,n);if(s){let o=this.findItemRecursive(i.items,r);if(o){let{id:l,type:c,...d}=n;Object.assign(o,d)}}return s}async addRequest(e,r,n){if(!this.collections.get(e))return!1;r.id||(r.id=Ot(r.name)),this.selfWritePending=!0;try{return await this.loader.saveItem(e,r,n),!0}catch(s){return console.error("[CollectionService] Failed to add request:",s),!1}}async deleteRequest(e,r){let n=this.collections.get(e);if(!n)return!1;this.selfWritePending=!0;let i=await this.loader.deleteItem(e,r);return i&&this.deleteItemRecursive(n.items,r),i}getAllRequests(e){let r=this.collections.get(e);if(!r)return[];let n=[];return this.collectRequestsRecursive(r.items,n),n}findItemRecursive(e,r){for(let n of e){if(n.id===r)return n;if(n.type==="folder"&&n.items){let i=this.findItemRecursive(n.items,r);if(i)return i}}}findItemByPath(e,r){if(r.length===0)return;let[n,...i]=r,s=e.find(o=>o.name===n);if(s){if(i.length===0)return s;if(s.type==="folder"&&s.items)return this.findItemByPath(s.items,i)}}updateItemRecursive(e,r,n){for(let i=0;i<e.length;i++){let s=e[i];if(s.id===r)return e[i]={...s,...n},!0;if(s.type==="folder"&&s.items&&this.updateItemRecursive(s.items,r,n))return!0}return!1}deleteItemRecursive(e,r){for(let n=0;n<e.length;n++){let i=e[n];if(i.id===r)return e.splice(n,1),!0;if(i.type==="folder"&&i.items&&this.deleteItemRecursive(i.items,r))return!0}return!1}collectRequestsRecursive(e,r){for(let n of e)n.type==="request"?r.push(n):n.type==="folder"&&n.items&&this.collectRequestsRecursive(n.items,r)}async createCollection(e){let r={id:Ot(e),name:e,items:[]};return await this.saveCollection(r),r}async renameCollection(e,r){let n=this.collections.get(e);return n?(n.name=r,await this.saveCollection(n),!0):!1}async duplicateCollection(e,r){if(!this.collections.get(e))throw new Error(`Collection not found: ${e}`);this.selfWritePending=!0;let i=Ot(r),s=this.loader.getCollectionPath(e),o=mi.join(this.collectionsDir,i);if(!Dt.existsSync(s))throw new Error(`Collection directory not found: ${s}`);this.copyDirRecursive(s,o);let l=mi.join(o,"collection.json");if(Dt.existsSync(l)){let d=JSON.parse(Dt.readFileSync(l,"utf-8"));d.id=i,d.name=r,Dt.writeFileSync(l,JSON.stringify(d,null,2))}else Dt.writeFileSync(l,JSON.stringify({id:i,name:r},null,2));this.loadCollections();let c=this.collections.get(i);if(!c)throw new Error("Failed to load duplicated collection");return c}async createFolder(e){if(!this.collections.get(e.collectionId))throw new Error("Collection not found");this.selfWritePending=!0;let n={id:Ot(e.name),type:"folder",name:e.name,items:[]};await this.loader.saveItem(e.collectionId,n,e.parentId);let i=this.loader.load(e.collectionId);return i&&this.collections.set(e.collectionId,i),n}async deleteFolder(e,r){let n=this.collections.get(e);if(!n)return!1;this.selfWritePending=!0;let i=await this.loader.deleteItem(e,r);return i&&this.deleteItemById(n.items,r),i}async renameFolder(e,r,n){let i=this.collections.get(e);if(!i)return!1;this.selfWritePending=!0;let s=await this.loader.updateItem(e,r,{name:n});if(s){let o=this.findItemById(i.items,r);o&&(o.name=n)}return s}async duplicateFolder(e,r,n){if(!this.collections.get(e))throw new Error("Collection not found");let s=this.loader.getItemPath(e,r);if(!s||!Dt.existsSync(s))throw new Error(`Folder not found on disk: ${r}`);let o=mi.dirname(s),l=Ot(n),c=mi.join(o,l);this.selfWritePending=!0,this.copyDirRecursive(s,c);let d=mi.join(c,"folder.json");if(Dt.existsSync(d)){let y=JSON.parse(Dt.readFileSync(d,"utf-8"));y.id=l,y.name=n,Dt.writeFileSync(d,JSON.stringify(y,null,2))}else Dt.writeFileSync(d,JSON.stringify({id:l,name:n,type:"folder"},null,2));this.loadCollections();let p=this.collections.get(e),m=p?this.findItemById(p.items,l):void 0;return m||{id:l,type:"folder",name:n,items:[]}}async createRequest(e){if(!this.collections.get(e.collectionId))throw new Error("Collection not found");this.selfWritePending=!0;let n={id:e.id||Ot(e.name),type:"request",name:e.name,method:e.method||"GET",url:e.url,params:e.params,query:e.query,headers:e.headers,body:e.body,auth:e.auth,settings:e.settings,scripts:e.scripts,deprecated:e.deprecated,description:e.description,doc:e.doc,responseSchema:e.responseSchema,bodySchema:e.bodySchema,operationId:e.operationId,summary:e.summary,tags:e.tags,examples:e.examples,responses:e.responses,security:e.security};await this.loader.saveItem(e.collectionId,n,e.parentId);let i=this.loader.load(e.collectionId);return i&&this.collections.set(e.collectionId,i),n}async renameRequest(e,r,n){let i=this.collections.get(e);if(!i)return!1;this.selfWritePending=!0;let s=await this.loader.updateItem(e,r,{name:n});if(s){let o=this.findItemById(i.items,r);o&&(o.name=n)}return s}async moveItem(e,r,n){if(!this.collections.get(e))return!1;this.selfWritePending=!0;let s=await this.loader.moveItem(e,r,n);return s&&this.loadCollections(),s}async reorderItems(e,r,n){if(!this.collections.get(e))return!1;this.selfWritePending=!0;let s=await this.loader.reorderItems(e,r,n);return s&&this.loadCollections(),s}getRequestScript(e,r,n){let i=this.collections.get(e);if(!i)return;let s=this.findItemById(i.items,r);if(!s||s.type!=="request")return;let o=s;return n==="pre-request"?o.scripts?.preRequest:o.scripts?.postResponse}async setRequestScript(e,r,n,i){let s=this.collections.get(e);if(!s)return!1;let o=this.findItemById(s.items,r);if(!o||o.type!=="request")return!1;let l=o,d={...l.scripts??{},...n==="pre-request"?{preRequest:i}:{postResponse:i}};l.scripts=d,this.selfWritePending=!0;try{return await this.loader.saveScripts(e,r,d),!0}catch{return!1}}findItemById(e,r){for(let n of e){if(n.id===r)return n;if(n.type==="folder"&&n.items){let i=this.findItemById(n.items,r);if(i)return i}}}copyDirRecursive(e,r){Dt.existsSync(r)||Dt.mkdirSync(r,{recursive:!0});for(let n of Dt.readdirSync(e,{withFileTypes:!0})){let i=mi.join(e,n.name),s=mi.join(r,n.name);n.isDirectory()?this.copyDirRecursive(i,s):Dt.copyFileSync(i,s)}}deleteItemById(e,r){for(let n=0;n<e.length;n++){let i=e[n];if(i.id===r)return e.splice(n,1),!0;if(i.type==="folder"&&i.items&&this.deleteItemById(i.items,r))return!0}return!1}async importCollection(e){let r=Dt.readFileSync(e,"utf-8"),n;try{n=JSON.parse(r)}catch{throw new Error("Invalid JSON file")}if(n.info&&n.info._postman_id)return this.importPostmanCollection(n);let i={id:n.id||Ot(n.name||"Imported Collection"),name:n.name||"Imported Collection",description:n.description,items:n.items||[]};return await this.saveCollection(i),i}async importPostmanCollection(e){let r=p=>{if(!p)return;switch(p.type?.toLowerCase()){case"bearer":return{type:"bearer",bearerToken:p.bearer?.find(q=>q.key==="token")?.value||""};case"basic":let b=p.basic?.find(q=>q.key==="username"),E=p.basic?.find(q=>q.key==="password");return{type:"basic",basicAuth:{username:b?.value||"",password:E?.value||""}};case"apikey":let C=p.apikey?.find(q=>q.key==="key"),v=p.apikey?.find(q=>q.key==="value"),_=p.apikey?.find(q=>q.key==="in");return{type:"apikey",apikey:{key:C?.value||"",value:v?.value||"",in:_?.value||"header"}};case"noauth":return{type:"none"};default:return}},n=p=>{if(!Array.isArray(p)||p.length===0)return;let m={};for(let y of p){let b=y.script?.exec;if(!b)continue;let E=Array.isArray(b)?b.join(`
|
|
55
|
-
`):b;y.listen==="prerequest"?m.preRequest=E:y.listen==="test"&&(m.postResponse=E)}return m.preRequest||m.postResponse?m:void 0},i=p=>{if(!p||typeof p!="object")return;let m={};return p.followRedirects===!1&&(m.followRedirects=!1),p.followOriginalHttpMethod===!0&&(m.followOriginalMethod=!0),p.followAuthorizationHeader===!1&&(m.followAuthHeader=!1),p.maxRedirects!==void 0&&(m.maxRedirects=p.maxRedirects),p.requestTimeout!==void 0&&(m.timeout=p.requestTimeout),Object.keys(m).length>0?m:void 0},s=p=>{if(!p||typeof p=="string")return;let m=p.query;if(!(!Array.isArray(m)||m.length===0))return m.map(y=>({key:y.key||"",value:y.value||"",enabled:y.disabled!==!0,...y.description!==void 0?{description:y.description}:{},...y.type!==void 0?{type:y.type}:{},...y.required!==void 0?{required:y.required}:{},...y.format!==void 0?{format:y.format}:{},...y.enum!==void 0?{enum:y.enum}:{},...y.deprecated!==void 0?{deprecated:y.deprecated}:{},...y.pattern!==void 0?{pattern:y.pattern}:{},...y.minLength!==void 0?{minLength:y.minLength}:{},...y.maxLength!==void 0?{maxLength:y.maxLength}:{},...y.minimum!==void 0?{minimum:y.minimum}:{},...y.maximum!==void 0?{maximum:y.maximum}:{},...y.exclusiveMinimum!==void 0?{exclusiveMinimum:y.exclusiveMinimum}:{},...y.exclusiveMaximum!==void 0?{exclusiveMaximum:y.exclusiveMaximum}:{},...y.multipleOf!==void 0?{multipleOf:y.multipleOf}:{},...y.minItems!==void 0?{minItems:y.minItems}:{},...y.maxItems!==void 0?{maxItems:y.maxItems}:{},...y.uniqueItems!==void 0?{uniqueItems:y.uniqueItems}:{},...y.nullable!==void 0?{nullable:y.nullable}:{},...y.oneOf!==void 0?{oneOf:y.oneOf}:{}}))},o=p=>{if(typeof p=="string")return p;if(!p)return"";let m=new Set;if(Array.isArray(p.variable))for(let b of p.variable)b.key&&m.add(b.key);if(m.size===0&&p.raw)return p.raw;let y="";if(p.protocol&&(y+=p.protocol+"://"),p.host&&(y+=Array.isArray(p.host)?p.host.join("."):p.host),p.port&&(y+=":"+p.port),p.path){let E=(Array.isArray(p.path)?p.path:[p.path]).map(C=>{let v=C.startsWith(":")?C.substring(1):C;return m.has(v)?":"+v:(C.startsWith(":"),C)});y+="/"+E.join("/")}return!y&&p.raw?p.raw:y},l=p=>{if(!Array.isArray(p)||p.length===0)return;let m={responses:{}};for(let y of p){let b=String(y.code||200),E,C={};if(Array.isArray(y.header))for(let O of y.header)!O.key||O.disabled||(O.key.toLowerCase()==="content-type"?E=O.value?.split(";")[0]?.trim():C[O.key]={description:String(O.value??""),schema:{type:"string"}});let v=y.body;if(typeof y.body=="string"&&y.body)try{v=JSON.parse(y.body)}catch{}let _=y.originalRequest,q;if(_){let O=typeof _.url=="string"?_.url:_.url?.raw??"";q=`${_.method||""} ${O}`.trim()||void 0}let k=y.name?y.name.replace(/[^a-zA-Z0-9_-]/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,"").toLowerCase()||`example_${b}`:`example_${b}`;if(m.responses[b]){let O=m.responses[b];O.examples=O.examples??{},O.examples[k]={summary:q,value:v}}else m.responses[b]={description:y.name,contentType:E,examples:{[k]:{summary:q,value:v}},...Object.keys(C).length>0?{headers:C}:{}}}return Object.keys(m.responses).length>0?m:void 0},c=p=>p.map(m=>{if(m.item)return{id:Ot(m.name),type:"folder",name:m.name,description:m.description,auth:r(m.auth),scripts:n(m.event),items:c(m.item)};{let y=m.request||{};return{id:Ot(m.name),type:"request",name:m.name,description:m.description||y.description,method:typeof y.method=="string"?y.method:"GET",url:o(y.url),query:s(y.url),headers:Array.isArray(y.header)?y.header.map(b=>({key:b.key||b.name||"",value:b.value||b.value||"",enabled:b.disabled!==!0,...b.description!==void 0?{description:b.description}:{},...b.type!==void 0?{type:b.type}:{},...b.required!==void 0?{required:b.required}:{},...b.format!==void 0?{format:b.format}:{},...b.enum!==void 0?{enum:b.enum}:{},...b.deprecated!==void 0?{deprecated:b.deprecated}:{},...b.pattern!==void 0?{pattern:b.pattern}:{},...b.minLength!==void 0?{minLength:b.minLength}:{},...b.maxLength!==void 0?{maxLength:b.maxLength}:{},...b.minimum!==void 0?{minimum:b.minimum}:{},...b.maximum!==void 0?{maximum:b.maximum}:{},...b.exclusiveMinimum!==void 0?{exclusiveMinimum:b.exclusiveMinimum}:{},...b.exclusiveMaximum!==void 0?{exclusiveMaximum:b.exclusiveMaximum}:{},...b.multipleOf!==void 0?{multipleOf:b.multipleOf}:{},...b.minItems!==void 0?{minItems:b.minItems}:{},...b.maxItems!==void 0?{maxItems:b.maxItems}:{},...b.uniqueItems!==void 0?{uniqueItems:b.uniqueItems}:{},...b.nullable!==void 0?{nullable:b.nullable}:{},...b.oneOf!==void 0?{oneOf:b.oneOf}:{}})):[],body:(()=>{let b=y.body;if(b){if(b.mode==="raw"&&b.raw){let E=b.options?.raw?.language;return{type:"raw",format:E==="xml"?"xml":E==="html"?"html":E==="javascript"?"javascript":E==="text"?"text":"json",content:b.raw}}if(b.mode==="urlencoded"&&Array.isArray(b.urlencoded))return{type:"x-www-form-urlencoded",content:b.urlencoded.map(E=>({key:E.key||"",value:E.value||"",enabled:E.disabled!==!0}))};if(b.mode==="formdata"&&Array.isArray(b.formdata))return{type:"form-data",content:b.formdata.map(E=>({key:E.key||"",value:E.value||"",type:E.type||"text",enabled:E.disabled!==!0}))};if(b.mode==="graphql"&&b.graphql){let E;if(b.graphql.variables)try{E=JSON.parse(b.graphql.variables)}catch{E=void 0}return{type:"graphql",content:{query:b.graphql.query||"",variables:E}}}if(b.mode==="binary")return{type:"binary",content:""}}})(),auth:r(y.auth),scripts:n(m.event),settings:i(m.protocolProfileBehavior),responseSchema:l(m.response)}}}),d={id:Ot(e.info?.name||"Imported Postman Collection"),name:e.info?.name||"Imported Postman Collection",description:e.info?.description,auth:r(e.auth),scripts:n(e.event),variables:Array.isArray(e.variable)?Object.fromEntries(e.variable.filter(p=>p&&p.key).map(p=>[p.key,String(p.value??"")])):typeof e.variable=="object"&&e.variable!==null?Object.fromEntries(Object.entries(e.variable).map(([p,m])=>[p,String(m??"")])):void 0,items:c(e.item||[])};return await this.saveCollection(d),d}async exportCollection(e,r){let n=this.collections.get(e);if(!n)throw new Error("Collection not found");let i=Uz(n),s=JSON.stringify(i,null,2);Dt.writeFileSync(r,s,"utf-8")}async exportCollectionAsRestClientFolder(e,r){let n=this.collections.get(e);if(!n)throw new Error("Collection not found");let i=mi.join(r,Ht(n.name));Dt.mkdirSync(i,{recursive:!0});let s=n.variables||{};Ka(mi.join(i,`${Ht(n.name)}.env`),s),Zu(i,Ht(n.name),n.scripts),yd(n.items,i,n)}dispose(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.fileWatcher?.dispose()}}});var tr,ko,Ps,t_=ae(()=>{"use strict";tr={version:"1.0",storage:{format:"folder",root:"./.http-forge/assets",history:"./.http-forge/.cache/histories",results:"./.http-forge/.cache/results"},request:{timeout:3e4,followRedirects:!0,maxRedirects:10,strictSSL:!0,tls:{},certificates:[]},scripts:{modulePaths:["./.http-forge/assets/src","./.http-forge/assets/lib"],scope:"shared",timeout:5e3},runner:{resultsRetentionDays:7,indexPageSize:1e3,recentErrorsLimit:20},environments:{default:"dev"},restClientExport:{path:"collections-rest-client",mergeGlobals:!0},mcp:{port:3100,excludedCollections:[],excludedSuites:[],toolPrefix:"",maxRequestsPerCall:500,toolMode:"auto",drilldownThreshold:100,toolPageSize:200,cors:{allowedOrigins:["http://localhost","http://127.0.0.1"]}},proxy:null,secrets:{providers:{aws:{provider:"aws"},azure:{provider:"azure",vaultUrl:""},gcp:{provider:"gcp"},vault:{provider:"vault"},op:{provider:"1password"},doppler:{provider:"doppler"}}}},ko={preferred:".http-forge/http-forge.config.json",legacy:"http-forge.config.json"},Ps={collections:"collections",environments:"environments",flows:"flows",suites:"suites"}});var Bt,zt,ks,ig=ae(()=>{"use strict";Bt=ve(require("fs")),zt=ve(require("path"));t_();ks=class{constructor(e,r,n){this.workspacePath=e;this.fileWatcherFactory=r;this.notifications=n;this.configPath=this.resolveConfigPath(),this.config=this.loadConfig(),this.setupFileWatcher()}workspacePath;fileWatcherFactory;notifications;config;configPath;fileWatchers=[];resolveConfigPath(){let e=zt.join(this.workspacePath,ko.preferred);if(Bt.existsSync(e))return e;let r=zt.join(this.workspacePath,ko.legacy);return Bt.existsSync(r)?r:e}loadConfig(){if(this.configPath=this.resolveConfigPath(),!Bt.existsSync(this.configPath))return{...tr};try{let e=Bt.readFileSync(this.configPath,"utf-8"),r=JSON.parse(e);return this.mergeWithDefaults(r)}catch(e){return console.error("[ConfigService] Failed to load config:",e),this.notifications?.showWarning(`Failed to parse ${zt.relative(this.workspacePath,this.configPath)}. Using default configuration.`),{...tr}}}mergeWithDefaults(e){return{version:e.version??tr.version,storage:{...tr.storage,...e.storage},request:{...tr.request,...e.request},scripts:{...tr.scripts,...e.scripts},runner:{...tr.runner,...e.runner},environments:{...tr.environments,...e.environments},restClientExport:{...tr.restClientExport,...e.restClientExport},proxy:e.proxy!==void 0?e.proxy:tr.proxy,mcp:{...tr.mcp,...e.mcp,cors:{...tr.mcp.cors,...e.mcp?.cors}},secrets:{...tr.secrets,...e.secrets,providers:{...tr.secrets?.providers,...e.secrets?.providers}}}}setupFileWatcher(){if(!this.fileWatcherFactory)return;let e=()=>{this.reload()};for(let r of[ko.preferred,ko.legacy]){let n=this.fileWatcherFactory.createFileWatcher(this.workspacePath,r);n.onDidChange(e),n.onDidCreate(e),n.onDidDelete(e),this.fileWatchers.push(n)}}getConfig(){return this.config}getStorageConfig(){return this.config.storage}getRequestConfig(){return this.config.request}getScriptsConfig(){return this.config.scripts}getRunnerConfig(){return this.config.runner}getEnvironmentsConfig(){return this.config.environments}getRestClientExportPath(){let e=this.config.restClientExport?.path||"collections-rest-client";return zt.isAbsolute(e)?e:this.resolvePath(e)}getRestClientMergeGlobals(){return this.config.restClientExport?.mergeGlobals??!0}getProxyConfig(){return this.config.proxy??null}getMcpConfig(){let e=this.config.mcp??tr.mcp,r=["flat","drilldown","auto"];return{...e,port:Math.min(65535,Math.max(1,Math.floor(e.port??3100))),toolMode:r.includes(e.toolMode)?e.toolMode:"auto",drilldownThreshold:Math.min(500,Math.max(10,e.drilldownThreshold??100)),toolPageSize:e.toolPageSize===0?0:Math.min(1e3,Math.max(10,e.toolPageSize??200)),maxRequestsPerCall:Math.min(1e4,Math.max(1,e.maxRequestsPerCall??500))}}resolvePath(e){let r=e.startsWith("./")?e.slice(2):e;return zt.join(this.workspacePath,...r.split("/"))}hasFolderCollectionsAtRoot(e){let r=zt.join(e,Ps.collections);if(!Bt.existsSync(r))return!1;let n;try{n=Bt.readdirSync(r,{withFileTypes:!0})}catch{return!1}return n.some(i=>{if(!i.isDirectory())return!1;let s=zt.join(r,i.name,"collection.json");return Bt.existsSync(s)})}hasAnyEntries(e){if(!Bt.existsSync(e))return!1;try{return Bt.readdirSync(e).length>0}catch{return!1}}resolveStorageRootPath(){let e=this.resolvePath(this.config.storage.root);return this.configExists()||this.hasFolderCollectionsAtRoot(e)?e:[zt.join(this.workspacePath,"http-forge-assets")].find(i=>this.hasFolderCollectionsAtRoot(i))||e}getRootPath(){return this.resolveStorageRootPath()}getCollectionsPath(){return zt.join(this.getRootPath(),Ps.collections)}getEnvironmentsPath(){return zt.join(this.getRootPath(),Ps.environments)}getFlowsPath(){return zt.join(this.getRootPath(),Ps.flows)}getHistoryPath(){let e=this.resolvePath(this.config.storage.history);if(this.configExists()||this.hasAnyEntries(e))return e;let r=zt.join(this.workspacePath,".http-forge-cache","histories");return this.hasAnyEntries(r)?r:e}getResultsPath(){let e=this.resolvePath(this.config.storage.results);if(this.configExists()||this.hasAnyEntries(e))return e;let r=zt.join(this.workspacePath,".http-forge-cache","results");return this.hasAnyEntries(r)?r:e}getSuitesPath(){return zt.join(this.getRootPath(),Ps.suites)}getModulePaths(){return this.config.scripts.modulePaths.map(e=>this.resolvePath(e))}getScriptScope(){return this.config.scripts.scope??"shared"}getScriptTimeout(){return this.config.scripts.timeout??5e3}getWorkspacePath(){return this.workspacePath}reload(){this.configPath=this.resolveConfigPath(),this.config=this.loadConfig()}configExists(){return Bt.existsSync(this.resolveConfigPath())}async createDefaultConfig(){await Bt.promises.mkdir(zt.dirname(this.configPath),{recursive:!0});let e=JSON.stringify(tr,null,2);await Bt.promises.writeFile(this.configPath,e,"utf-8");let r=[this.getCollectionsPath(),this.getEnvironmentsPath(),this.getFlowsPath(),this.getSuitesPath()];for(let i of r)Bt.existsSync(i)||await Bt.promises.mkdir(i,{recursive:!0});let n=[this.getHistoryPath(),this.getResultsPath()];for(let i of n)Bt.existsSync(i)||await Bt.promises.mkdir(i,{recursive:!0});await this.createSampleEnvironments()}async createSampleEnvironments(){let e=this.getEnvironmentsPath(),r={id:"globals",name:"Global Variables",variables:{appName:"HTTP Forge"}};await Bt.promises.writeFile(zt.join(e,"globals.json"),JSON.stringify(r,null,2),"utf-8");let n={id:"env_dev",name:"Development",variables:{baseUrl:"http://localhost:3000",apiVersion:"v1"}};await Bt.promises.writeFile(zt.join(e,"dev.json"),JSON.stringify(n,null,2),"utf-8");let i={id:"default_headers",name:"Default Headers",headers:{"Content-Type":"application/json",Accept:"application/json"}};await Bt.promises.writeFile(zt.join(e,"default-headers.json"),JSON.stringify(i,null,2),"utf-8")}dispose(){for(let e of this.fileWatchers)e.dispose();this.fileWatchers=[]}}});var Jz,tc,r_=ae(()=>{"use strict";ka();Jz="httpForge.cookies",tc=class{constructor(e,r=Jz){this.store=e;this.storeKey=r;this.loadCookies()}store;storeKey;cookies=new Map;loadCookies(){try{let e=this.store.get(this.storeKey);e&&(this.cookies=new Map(Object.entries(e)),this.cleanExpiredCookies())}catch(e){console.error("[CookieService] Failed to load cookies:",e)}}async saveCookies(){try{let e={};this.cookies.forEach((r,n)=>{e[n]=r}),await this.store.update(this.storeKey,e)}catch(e){console.error("[CookieService] Failed to save cookies:",e)}}getCookieKey(e,r,n){return`${r||"*"}|${n||"/"}|${e}`}get(e,r){if(r){let s=this.getCookieKey(e,r),o=this.cookies.get(s);if(o&&!this.isExpired(o))return o}let n=this.getCookieKey(e,"*"),i=this.cookies.get(n);if(i&&!this.isExpired(i))return i;for(let s of this.cookies.values())if(s.name===e&&!this.isExpired(s))if(r&&s.domain){if(this.domainMatches(r,s.domain))return s}else return s}async set(e){let r=this.getCookieKey(e.name,e.domain,e.path);this.cookies.set(r,e),await this.saveCookies()}async setFromResponse(e){for(let r of e){let n=this.getCookieKey(r.name,r.domain,r.path);this.cookies.set(n,r)}await this.saveCookies()}has(e,r){return this.get(e,r)!==void 0}async delete(e,r,n){let i=this.getCookieKey(e,r,n),s=this.cookies.delete(i);return s&&await this.saveCookies(),s}getAll(e){let r=[];for(let n of this.cookies.values())this.isExpired(n)||(e?(!n.domain||this.domainMatches(e,n.domain))&&r.push(n):r.push(n));return r}getCookieHeader(e){let r=this.getAll(e);return Rt.formatCookieHeader(r)}async clear(){this.cookies.clear(),await this.saveCookies()}async clearDomain(e){let r=[];for(let[n,i]of this.cookies.entries())i.domain&&this.domainMatches(e,i.domain)&&r.push(n);for(let n of r)this.cookies.delete(n);await this.saveCookies()}parseCookieHeaders(e,r){return Rt.parseCookieHeaders(e,r)}isExpired(e){return Rt.isExpired(e)}cleanExpiredCookies(){let e=[];for(let[r,n]of this.cookies.entries())this.isExpired(n)&&e.push(r);for(let r of e)this.cookies.delete(r);e.length>0&&this.saveCookies()}domainMatches(e,r){return Rt.domainMatches(e,r)}get count(){return this.cookies.size}}});var rc,n_=ae(()=>{"use strict";ka();rc=class{constructor(e){this.cookieService=e;this.localCache=[...e.getAll()]}cookieService;localCache=[];pendingOperations=[];get(e,r){return r?this.localCache.find(n=>n.name===e&&(!n.domain||n.domain===r||r.endsWith(n.domain))):this.localCache.find(n=>n.name===e)}has(e,r){return this.get(e,r)!==void 0}set(e){let r=this.localCache.findIndex(n=>n.name===e.name&&(!e.domain||n.domain===e.domain));r>=0?this.localCache[r]=e:this.localCache.push(e),this.pendingOperations.push({type:"set",cookie:e})}delete(e,r,n){let i=this.localCache.findIndex(s=>s.name===e&&(!r||s.domain===r||s.domain&&r.endsWith(s.domain)));return i>=0&&this.localCache.splice(i,1),this.pendingOperations.push({type:"delete",name:e,domain:r,path:n}),!0}getAll(e){return e?this.localCache.filter(r=>{let n=r.domain||"";return n===e||e.endsWith(n)}):[...this.localCache]}getCookiesForDomain(e){return this.localCache.filter(r=>{let n=r.domain||"";return n===e||e.endsWith(n)})}async setCookiesFromResponse(e,r){let n=new URL(e).hostname,i=this.cookieService.parseCookieHeaders(r,n);i.length>0&&(i.forEach(s=>{let o=this.localCache.findIndex(l=>l.name===s.name&&l.domain===(s.domain||n));o>=0?this.localCache[o]=s:this.localCache.push(s)}),await this.cookieService.setFromResponse(i))}getCookieHeader(e){let r=new URL(e).hostname,n=new URL(e).pathname,i=this.localCache.filter(s=>!(Rt.isExpired(s)||s.domain&&!Rt.domainMatches(r,s.domain)||!s.domain||s.path&&!n.startsWith(s.path)));if(i.length!==0)return Rt.formatCookieHeader(i)}clear(){this.localCache=[],this.pendingOperations.push({type:"clear"})}async flush(){for(let e of this.pendingOperations)switch(e.type){case"set":e.cookie&&await this.cookieService.set(e.cookie);break;case"delete":e.name&&await this.cookieService.delete(e.name,e.domain,e.path);break;case"clear":await this.cookieService.clear();break}this.pendingOperations=[]}}});function vd(t){try{let e=JSON.parse(typeof t=="string"?t:t.toString("utf-8"));if(!e)return null;let r=e.environment||e,n=r.name||e.name||"imported-environment",i=r.values||r.variables||e.values||e.variables||[],s={};if(Array.isArray(i))for(let l of i){if(!l)continue;let c=l.key??l.name,d=typeof l.enabled=="boolean"?l.enabled:!0;c&&d!==!1&&(s[c]=l.value??l.initial??"")}else if(typeof i=="object"&&i!==null)for(let[l,c]of Object.entries(i))s[l]=String(c??"");let o=r._postman_exported_at?"Imported from Postman export":r.description||"";return{name:n,variables:s,description:o}}catch{return null}}async function OP(t,e){try{let r=await e.readFile(t);return vd(r)}catch{return null}}var i_=ae(()=>{"use strict"});var ar,Cn,bd,nc,s_=ae(()=>{"use strict";ar=ve(require("fs")),Cn=ve(require("path"));Un();i_();ng();im();Af();bd={SELECTED_ENVIRONMENT:"httpForge.selectedEnvironment",ENV_OVERRIDES_PREFIX:"httpForge.envOverrides."},nc=class{constructor(e,r,n,i,s,o=!0){this.workspaceFolder=e;this.workspaceStore=r;this.configService=n;this.fileWatcherFactory=i;this.secretStore=s;this.persistOverrides=o;let l=n.getEnvironmentsPath();this.environmentsPath=l,this.sharedConfigPath=Cn.join(l,"_global.json"),this.localConfigPath=Cn.join(l,"_global.local.json"),this.historiesPath=n.getHistoryPath(),this.selectedEnvironment=r?.get(bd.SELECTED_ENVIRONMENT,"dev")??"dev",this.localGlobalValues={},this.localEnvironmentValues=new Map,this.persistOverrides&&this.loadPersistedEnvironmentOverrides(),this.loadSecretVariables(this.selectedEnvironment).catch(()=>{}),this.setupFileWatcher()}workspaceFolder;workspaceStore;configService;fileWatcherFactory;secretStore;persistOverrides;environmentsPath;sharedConfigPath;localConfigPath;historiesPath;sharedConfig=null;localConfig=null;selectedEnvironment="dev";fileWatcher;localGlobalValues={};localEnvironmentValues=new Map;secretValuesCache=new Map;onEnvironmentsChanged;setupFileWatcher(){if(!this.fileWatcherFactory||!ar.existsSync(this.environmentsPath))return;this.fileWatcher=this.fileWatcherFactory.createFileWatcher(this.environmentsPath,"**/*.json");let e=()=>{this.reload(),this.onEnvironmentsChanged?.()};this.fileWatcher.onDidChange(e),this.fileWatcher.onDidCreate(e),this.fileWatcher.onDidDelete(e)}dispose(){this.fileWatcher?.dispose()}getWorkspaceFolder(){return this.workspaceFolder}getRootPath(){return this.configService.getRootPath()}loadConfigs(){if(!ar.existsSync(this.environmentsPath)){this.sharedConfig={environments:{},globalVariables:{},defaultHeaders:{}},this.localConfig={credentials:{},variables:{}};return}this.loadFolderConfigs()}getSharedConfig(){return this.sharedConfig||this.loadConfigs(),this.sharedConfig}getLocalConfig(){return this.localConfig||this.loadConfigs(),this.localConfig}getEnvironmentNames(){let e=this.getSharedConfig();return e?.environments?Object.keys(e.environments):[]}getSelectedEnvironment(){return this.selectedEnvironment}async setSelectedEnvironment(e){if(this.selectedEnvironment=e,await this.workspaceStore?.update(bd.SELECTED_ENVIRONMENT,e),!this.localEnvironmentValues.has(e)){let r=this.getEnvOverridesStateKey(e),n=this.workspaceStore?.get(r,{});n&&Object.keys(n).length>0&&this.localEnvironmentValues.set(e,{...n})}await this.loadSecretVariables(e)}getEnvOverridesStateKey(e){return`${bd.ENV_OVERRIDES_PREFIX}${e||this.selectedEnvironment}`}loadPersistedEnvironmentOverrides(){let e=this.getEnvOverridesStateKey(),r=this.workspaceStore?.get(e,{});r&&Object.keys(r).length>0&&this.localEnvironmentValues.set(this.selectedEnvironment,{...r})}persistEnvironmentOverrides(e){if(!this.persistOverrides)return;let r=this.getEnvOverridesStateKey(e),n=this.localEnvironmentValues.get(e)||{};this.workspaceStore?.update(r,n)}setEnvironmentVariable(e,r,n){let i=n??this.selectedEnvironment;this.localEnvironmentValues.has(i)||this.localEnvironmentValues.set(i,{}),this.localEnvironmentValues.get(i)[e]=String(r),this.persistEnvironmentOverrides(i)}deleteEnvironmentVariable(e,r){let n=r??this.selectedEnvironment,i=this.localEnvironmentValues.get(n);i&&(delete i[e],this.persistEnvironmentOverrides(n))}clearEnvironmentVariables(e){let r=e??this.selectedEnvironment;this.localEnvironmentValues.set(r,{}),this.persistEnvironmentOverrides(r)}async resetEnvironmentOverrides(e){let r=e||this.selectedEnvironment;this.localEnvironmentValues.delete(r),await this.workspaceStore?.update(this.getEnvOverridesStateKey(r),void 0)}getEnvironmentVariableLocal(e){return this.localEnvironmentValues.get(this.selectedEnvironment)?.[e]}getEnvironmentVariableLocals(){return{...this.localEnvironmentValues.get(this.selectedEnvironment)||{}}}setGlobalVariable(e,r){this.localGlobalValues[e]=String(r)}getGlobalVariable(e){return this.getSharedConfig()?.globalVariables?.[e]}getGlobalVariableLocal(e){return this.localGlobalValues[e]}getGlobalVariables(){return{...this.getSharedConfig()?.globalVariables||{},...this.getLocalConfig()?.variables||{},...this.localGlobalValues}}getGlobalVariableLocals(){return{...this.localGlobalValues}}deleteGlobalVariable(e){delete this.localGlobalValues[e]}clearGlobalVariables(){this.localGlobalValues={}}getResolvedEnvironment(e){let r=e||this.selectedEnvironment,n=this.getSharedConfig(),i=this.getLocalConfig();if(!n?.environments?.[r])return null;let s=n.environments[r],o=i?.credentials?.[r],l=i?.variables||{},c=o?.variables||{},d=o&&o.headers||{},p=gu(n.defaultHeaders||{},d),m=this.localEnvironmentValues.get(r)||{},y=this.secretValuesCache.get(r)||{},b={...s.variables||{},...c,...m,...y};return{name:r,description:s.description,requiresConfirmation:s.requiresConfirmation,headers:p,variables:b}}async getSecretVariable(e,r){return this.secretStore?.get(`${e}:${r}`)}async setSecretVariable(e,r,n){await this.secretStore?.store(`${e}:${r}`,n),this.secretValuesCache.has(e)||this.secretValuesCache.set(e,{}),this.secretValuesCache.get(e)[r]=n}async deleteSecretVariable(e,r){await this.secretStore?.delete(`${e}:${r}`),this.secretValuesCache.get(e)&&delete this.secretValuesCache.get(e)[r]}async loadSecretVariables(e){if(!this.secretStore)return;let r=e||this.selectedEnvironment,n=this.getSharedConfig()?.environments?.[r]?.secretVariables??[];if(n.length===0)return;let i={};await Promise.all(n.map(async s=>{let o=await this.secretStore.get(`${r}:${s}`);o!==void 0&&(i[s]=o)})),this.secretValuesCache.set(r,i)}resolveVariables(e,r){return this.createResolver(r).resolveString(e,!0)}exportEnvironmentsToFolder(e,r=!0){let n=this.getEnvironmentNames(),i=this.getSharedConfig(),s=i?.globalVariables?{...i.globalVariables}:{};if(!r&&Object.keys(s).length){let o=Cn.join(e,"globals.env");Ka(o,s)}n.forEach(o=>{let l=i?.environments?.[o];if(!l)return;let c={...l.variables||{}};r&&(c={...s,...c});let d=Cn.join(e,`${Ht(o)}.env`);Ka(d,c)})}resolveVariablesWithExtra(e,r,n){return this.createResolver(n,r).resolveString(e,!0)}resolveVariablesInObject(e,r){return this.createResolver(r).resolveObject(e,!0)}resolveVariablesInObjectWithExtra(e,r,n){return this.createResolver(n,r).resolveObject(e,!0)}getHistoriesPath(){return this.historiesPath}getSharedConfigPath(){return this.sharedConfigPath}getLocalConfigPath(){return this.localConfigPath}getEnvironmentConfigPath(e){return Cn.join(this.environmentsPath,`${e}.json`)}localConfigExists(){return ar.existsSync(this.localConfigPath)}saveSharedConfig(e){this.saveFolderSharedConfig(e),this.sharedConfig=e}saveLocalConfig(e){let r={variables:e.variables||{}};this.saveJsonFile(this.localConfigPath,r);for(let[n,i]of Object.entries(e.credentials||{})){let s=this.getEnvLocalConfigPath(n),o={variables:i.variables||{}};this.saveJsonFile(s,o)}this.localConfig=e}importPostmanEnvironmentFile(e){try{let r=ar.readFileSync(e,"utf-8"),n=vd(r);if(!n)throw new Error("Failed to parse Postman environment file");this.sharedConfig||this.loadConfigs(),this.sharedConfig||(this.sharedConfig={environments:{},globalVariables:{},defaultHeaders:{}});let i=n.name||`imported-${Date.now()}`;return this.sharedConfig.environments=this.sharedConfig.environments||{},this.sharedConfig.environments[i]=this.sharedConfig.environments[i]||{},this.sharedConfig.environments[i].variables=n.variables,n.description&&(this.sharedConfig.environments[i].description=n.description),this.saveSharedConfig(this.sharedConfig),n}catch(r){throw console.error("[EnvironmentConfigService] importPostmanEnvironmentFile failed:",r),r}}saveEnvLocalConfig(e,r){let n=this.getEnvLocalConfigPath(e),i={variables:r};this.saveJsonFile(n,i),this.localConfig||(this.localConfig={credentials:{},variables:{}}),this.localConfig.credentials||(this.localConfig.credentials={}),this.localConfig.credentials[e]={variables:r}}getEnvLocalPath(e){return this.getEnvLocalConfigPath(e)}getEnvLocalConfigPath(e){return Cn.join(this.environmentsPath,`${e}.local.json`)}loadFolderConfigs(){let e=wu(this.environmentsPath);this.sharedConfig={environments:e.environments,globalVariables:e.globalVariables,defaultHeaders:e.defaultHeaders},this.localConfig={credentials:e.localCredentials,variables:e.localVariables}}createResolver(e,r){let i=this.getResolvedEnvironment(e)?.variables||{},s=this.getGlobalVariables(),o=this.getGlobalVariableLocals();return new yo({globals:s,collectionVariables:{},environmentVariables:i,variables:{...o,...r||{}}})}saveFolderSharedConfig(e){ar.existsSync(this.environmentsPath)||ar.mkdirSync(this.environmentsPath,{recursive:!0});let r={variables:e.globalVariables||{},defaultHeaders:e.defaultHeaders||{}};this.saveJsonFile(this.sharedConfigPath,r);let n=ar.readdirSync(this.environmentsPath).filter(s=>s.endsWith(".json")).filter(s=>!If(s)),i=new Set(Object.keys(e.environments||{}));for(let s of n){let o=Cn.basename(s,".json");if(!i.has(o))try{ar.unlinkSync(Cn.join(this.environmentsPath,s))}catch{}}for(let[s,o]of Object.entries(e.environments||{})){let l={name:s,description:o.description,requiresConfirmation:o.requiresConfirmation,variables:o.variables||{}};this.saveJsonFile(Cn.join(this.environmentsPath,`${s}.json`),l)}}reload(){this.sharedConfig=null,this.localConfig=null,this.loadConfigs()}getAllEnvironments(){return this.loadConfigs(),this.sharedConfig?Object.entries(this.sharedConfig.environments).map(([e,r])=>({id:e,name:e,active:e===this.selectedEnvironment,variables:r.variables||{}})):[]}async setActiveEnvironment(e){await this.setSelectedEnvironment(e)}async createEnvironment(e){if(this.loadConfigs(),this.sharedConfig||(this.sharedConfig={environments:{},globalVariables:{}}),this.sharedConfig.environments[e])throw new Error(`Environment "${e}" already exists`);this.sharedConfig.environments[e]={description:`Created ${new Date().toISOString()}`,variables:{}},this.saveSharedConfig(this.sharedConfig)}async deleteEnvironment(e){if(this.loadConfigs(),this.validateConfigLoaded(),this.validateEnvironmentExists(e),delete this.sharedConfig.environments[e],this.selectedEnvironment===e){let r=Object.keys(this.sharedConfig.environments);this.selectedEnvironment=r.length>0?r[0]:"dev",await this.workspaceStore?.update(bd.SELECTED_ENVIRONMENT,this.selectedEnvironment)}this.saveSharedConfig(this.sharedConfig)}async duplicateEnvironment(e,r){this.loadConfigs(),this.validateConfigLoaded(),this.validateEnvironmentName(r),this.validateEnvironmentExists(e),this.validateEnvironmentNameNotTaken(r);let n=this.sharedConfig.environments[e];this.sharedConfig.environments[r]=JSON.parse(JSON.stringify(n)),this.sharedConfig.environments[r].description=`Copied from ${e}`,this.saveSharedConfig(this.sharedConfig)}async renameEnvironment(e,r){this.loadConfigs(),this.validateConfigLoaded(),this.validateEnvironmentName(r),this.validateEnvironmentExists(e),r!==e&&(this.validateEnvironmentNameNotTaken(r),this.sharedConfig.environments[r]=this.sharedConfig.environments[e],delete this.sharedConfig.environments[e],this.selectedEnvironment===e&&(this.selectedEnvironment=r,await this.workspaceStore?.update(bd.SELECTED_ENVIRONMENT,r)),this.saveSharedConfig(this.sharedConfig))}validateEnvironmentName(e){if(!e||e.trim().length===0)throw new Error("Environment name cannot be empty");if(e.length>128)throw new Error("Environment name cannot exceed 128 characters");if(!/^[a-zA-Z0-9_\-\.]+$/.test(e))throw new Error("Environment name can only contain letters, numbers, hyphens, underscores, and dots")}validateEnvironmentExists(e){if(!this.sharedConfig?.environments?.[e])throw new Error(`Environment "${e}" not found`)}validateEnvironmentNameNotTaken(e){if(this.sharedConfig?.environments?.[e])throw new Error(`Environment "${e}" already exists`)}validateConfigLoaded(){if(!this.sharedConfig)throw new Error("No environment configuration loaded")}async updateEnvironmentVariables(e,r){if(this.loadConfigs(),!this.sharedConfig)throw new Error("No configuration loaded");let n=this.sharedConfig.environments[e];if(!n)throw new Error(`Environment "${e}" not found`);n.variables=r,this.saveSharedConfig(this.sharedConfig)}loadJsonFile(e){try{if(!ar.existsSync(e))return null;let r=ar.readFileSync(e,"utf-8");return JSON.parse(r)}catch(r){return console.error(`Failed to load JSON from ${e}:`,r),null}}saveJsonFile(e,r){try{let n=Cn.dirname(e);ar.existsSync(n)||ar.mkdirSync(n,{recursive:!0}),ar.writeFileSync(e,JSON.stringify(r,null,2),"utf-8")}catch(n){throw console.error(`Failed to save JSON to ${e}:`,n),n}}}});var As,sg=ae(()=>{"use strict";hd();As=class t{constructor(e,r,n,i,s,o,l,c,d,p,m,y,b){this.httpService=e;this.scriptExecutor=r;this.envConfigService=n;this.requestPreparer=i;this.environment=s;this.cookieJar=o;this.collectionScripts=l;this.folderScriptsChain=c;this.onConsoleOutput=d;this.collectionName=p;this.collectionAuth=m;this.iteration=y;this.iterationCount=b}httpService;scriptExecutor;envConfigService;requestPreparer;environment;cookieJar;collectionScripts;folderScriptsChain;onConsoleOutput;collectionName;collectionAuth;iteration;iterationCount;async execute(e,r,n){let i=Date.now();return this.executeWithSession(e,r,n,i)}async executeWithSession(e,r,n,i){let s=this.collectPreRequestScripts(e),o=this.collectPostResponseScripts(e),l=this.envConfigService.getResolvedEnvironment(this.environment);if(!l)throw new Error(`Environment "${this.environment}" not found or not configured`);let c=this.envConfigService.getGlobalVariables(),d={request:e,variables:{...r},environmentVariables:l.variables||{},globals:{...c},environmentName:this.environment,cookieJar:this.cookieJar,info:{eventName:"prerequest",requestName:e.name,requestId:e.id,collectionName:this.collectionName,iteration:this.iteration,iterationCount:this.iterationCount},onEnvironmentChange:async(y,b,E)=>{y==="set"&&b&&E!==void 0?this.envConfigService.setEnvironmentVariable(b,E,this.environment):y==="unset"&&b?this.envConfigService.deleteEnvironmentVariable(b,this.environment):y==="clear"&&this.envConfigService.clearEnvironmentVariables(this.environment)},onGlobalsChange:(y,b,E)=>{y==="set"&&b&&E!==void 0?this.envConfigService.setGlobalVariable(b,E):y==="unset"&&b?this.envConfigService.deleteGlobalVariable(b):y==="clear"&&this.envConfigService.clearGlobalVariables()}},p=this.scriptExecutor.createRequestSession(d),m=null;try{let y={...r},b={...e},E;if((!b.auth||b.auth.type==="inherit")&&(b.auth=this.collectionAuth&&this.collectionAuth.type!=="inherit"?this.collectionAuth:void 0),s.length>0){let D=await p.executePreRequest(s);if(D.consoleOutput&&D.consoleOutput.length>0&&this.onConsoleOutput?.(D.consoleOutput,{requestName:e.name||"",phase:"pre-request"}),D.nextRequest!==void 0&&(E=D.nextRequest),D.skipRequest){let J={type:"none",content:null};return{requestId:e.id,name:e.name,executedRequest:{url:e.url||"",method:e.method||"GET",headers:{},body:J,params:{},query:{}},response:{status:0,statusText:"Skipped",headers:{},body:null,time:0,cookies:[]},duration:Date.now()-i,timestamp:Date.now(),passed:!0,assertions:[],modifiedVariables:y,nextRequest:E}}D.success&&(D.modifiedRequest&&(D.modifiedRequest.url&&(b.url=D.modifiedRequest.url),D.modifiedRequest.headers&&(b.headers=D.modifiedRequest.headers),D.modifiedRequest.params&&(b.params=D.modifiedRequest.params),D.modifiedRequest.query&&(b.query=D.modifiedRequest.query),D.modifiedRequest.body!==void 0&&(b.body=D.modifiedRequest.body)),(D.localVariables??D.modifiedVariables)&&(y=D.localVariables??D.modifiedVariables))}m=await this.requestPreparer.prepareRequest(b,this.environment,l,y);let{url:C,headers:v,body:_,method:q}=m,k={};for(let D in v)Object.prototype.hasOwnProperty.call(v,D)&&(k[D.toUpperCase()]=v[D]);if(!k.COOKIE&&b.settings?.includeCookies!==!1&&this.cookieJar){let J=this.cookieJar.getCookieHeader(C);J&&(k.COOKIE=J)}let O={method:q,url:C,headers:k,body:_.content,signal:n,settings:b.settings?{...b.settings}:void 0},M=await this.httpService.execute(O);this.cookieJar&&M.headers&&await this.cookieJar.setCookiesFromResponse(C,M.headers);let j=Date.now()-i,I=[],R={},A;if(o.length>0){let D=0;if(M.body)if(typeof M.body=="string")D=Buffer.byteLength(M.body,"utf8");else if(Buffer.isBuffer(M.body))D=M.body.length;else try{D=Buffer.byteLength(JSON.stringify(M.body),"utf8")}catch{D=0}let J=Qm(M.headers,M.cookies,m.url),Q={executedRequest:m,status:M.status,statusText:M.statusText,headers:Km(M.headers||{}),body:M.body,cookies:J,responseTime:M.time,responseSize:D},se=await p.executePostResponse(o,Q);I=se.testResults,R=se.modifiedEnvironmentVariables||{},A=se.visualizerData,(se.localVariables??se.modifiedVariables)&&(y=se.localVariables??se.modifiedVariables),se.nextRequest!==void 0&&(E=se.nextRequest),se.consoleOutput&&se.consoleOutput.length>0&&this.onConsoleOutput?.(se.consoleOutput,{requestName:e.name||"",phase:"post-response"})}let F=I.length===0||I.every(D=>D.passed),U=I.length>0?F:M.status>=200&&M.status<=302;return{requestId:e.id,name:e.name,executedRequest:{...m,headers:k},response:{status:M.status,statusText:M.statusText,headers:M.headers||{},body:M.body,time:M.time||j,cookies:M.cookies||[]},duration:j,timestamp:Date.now(),passed:U,assertions:I,modifiedVariables:y,modifiedEnvironmentVariables:R,nextRequest:E,visualizerData:A}}catch(y){return this.handleError(e,m,y,i)}finally{p.dispose?.()}}collectPreRequestScripts(e){let r=[];if(this.collectionScripts?.preRequest&&r.push(this.collectionScripts.preRequest),this.folderScriptsChain)if(Array.isArray(this.folderScriptsChain))for(let n of this.folderScriptsChain)n?.preRequest&&r.push(n.preRequest);else this.folderScriptsChain.preRequest&&r.push(this.folderScriptsChain.preRequest);return e.scripts?.preRequest&&r.push(e.scripts.preRequest),r}collectPostResponseScripts(e){let r=[];if(e.scripts?.postResponse&&r.push(e.scripts.postResponse),this.folderScriptsChain)if(Array.isArray(this.folderScriptsChain)){let n=[...this.folderScriptsChain].reverse();for(let i of n)i?.postResponse&&r.push(i.postResponse)}else this.folderScriptsChain.postResponse&&r.push(this.folderScriptsChain.postResponse);return this.collectionScripts?.postResponse&&r.push(this.collectionScripts.postResponse),r}handleError(e,r,n,i){let s=Date.now()-i,o=r?.method||e.method,l=r?.url||e.url;this.onConsoleOutput?.([`${n.message||n}`],{requestName:e.name||"",phase:"error"});let c=String(n.name==="AbortError"?"Request was aborted":n.message||n),d=n?.stack?String(n.stack):"",p=this.errorBodyFormat,m,y;p==="html"||p==="both"?(m=t.formatErrorAsHtml(c,d),y={"content-type":"text/html; charset=utf-8"}):(m=c,y={});let b={type:"none",content:null};return{requestId:e.id,name:e.name,executedRequest:{url:l||"",method:o||"GET",headers:r?.headers||{},body:r?.body||b,params:r?.params||{},query:r?.query||{}},response:{status:0,statusText:n.name==="AbortError"?"Aborted":n.code||n.message||"Request Error",headers:y,cookies:[],body:m,time:0},duration:s,timestamp:Date.now(),passed:!1,assertions:[],error:c}}get errorBodyFormat(){return"text"}static formatErrorAsHtml(e,r){let n=i=>i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");return`<!doctype html>
|
|
54
|
+
`)}function Lz(t){let e=t.url;if(t.query&&t.query.length){let r=t.query.filter(n=>n.enabled!==!1).map(n=>`${encodeURIComponent(n.key)}=${encodeURIComponent(n.value)}`).join("&");r&&(e+=(e.includes("?")?"&":"?")+r)}return e}var Ya,Po,ng=ae(()=>{"use strict";Ya=ve(require("fs")),Po=ve(require("path"));Un()});var qr,K0,Qa,Q0=ae(()=>{"use strict";qr=ve(require("fs")),K0=ve(require("path"));Un();Qa=class{collectionsDir;cache=new Map;constructor(e){this.collectionsDir=e,this.ensureDirectory()}ensureDirectory(){qr.existsSync(this.collectionsDir)||qr.mkdirSync(this.collectionsDir,{recursive:!0})}loadAll(){if(this.cache.clear(),!qr.existsSync(this.collectionsDir))return[];let e=qr.readdirSync(this.collectionsDir),r=[];for(let n of e)if(n.endsWith(".json"))try{let i=K0.join(this.collectionsDir,n),s=qr.readFileSync(i,"utf-8"),o=JSON.parse(s);o.id&&o.name&&(this.cache.set(o.id,o),r.push(o))}catch(i){console.error(`[JsonCollectionLoader] Failed to load ${n}:`,i)}return r}load(e){if(this.cache.has(e))return this.cache.get(e);let r=this.getCollectionPath(e);if(qr.existsSync(r))try{let n=qr.readFileSync(r,"utf-8"),i=JSON.parse(n);return this.cache.set(e,i),i}catch(n){console.error(`[JsonCollectionLoader] Failed to load collection ${e}:`,n);return}}async save(e){if(this.ensureDirectory(),!e.name)throw new Error("Collection name is required");e.id||(e.id=Ot(e.name));let r=this.getCollectionPath(e.id),n=JSON.stringify(e,null,2);await qr.promises.writeFile(r,n,"utf-8"),this.cache.set(e.id,e)}async delete(e){let r=this.getCollectionPath(e);if(!qr.existsSync(r))return!1;try{return await qr.promises.unlink(r),this.cache.delete(e),!0}catch(n){return console.error(`[JsonCollectionLoader] Failed to delete collection ${e}:`,n),!1}}exists(e){return qr.existsSync(this.getCollectionPath(e))}getCollectionPath(e){return K0.join(this.collectionsDir,`${e}.json`)}getItemPath(e,r){}async create(e,r){let n={id:r||Ot(e),name:e,items:[]};return await this.save(n),n}async saveScripts(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.findItemById(i.items,r);s&&(s.scripts=n,await this.save(i))}loadScripts(e,r){let n=this.load(e);return n?this.findItemById(n.items,r)?.scripts:void 0}async updateCollectionMetadata(e,r){let n=this.load(e);if(!n)throw new Error(`Collection ${e} not found`);r.name!==void 0&&(n.name=r.name),r.description!==void 0&&(n.description=r.description),r.version!==void 0&&(n.version=r.version),r.variables!==void 0&&(n.variables=r.variables),r.auth!==void 0&&(n.auth=r.auth),await this.save(n)}async saveItem(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.findItemById(i.items,r.id);if(s)Object.assign(s,r);else if(n){let o=this.findItemById(i.items,n);if(o&&o.type==="folder")o.items=o.items||[],o.items.push(r);else throw new Error(`Parent folder ${n} not found`)}else i.items.push(r);await this.save(i)}async deleteItem(e,r){let n=this.load(e);if(!n)return!1;let i=this.deleteItemById(n.items,r);return i&&await this.save(n),i}async updateItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.findItemById(i.items,r);if(!s)return!1;let{id:o,type:l,...c}=n;return Object.assign(s,c),await this.save(i),!0}async moveItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.findItemById(i.items,r);if(!s)return!1;let o={...s};if(!this.deleteItemById(i.items,r))return!1;if(n){let l=this.findItemById(i.items,n);if(l&&l.type==="folder")l.items=l.items||[],l.items.push(o);else return i.items.push(o),!1}else i.items.push(o);return await this.save(i),!0}async reorderItems(e,r,n){let i=this.load(e);if(!i)return!1;try{let s;if(r){let c=this.findItemById(i.items,r);if(!c||!c.items)return!1;s=c.items}else s=i.items;let o=new Map(s.map(c=>[c.id,c])),l=[];for(let c of n){let d=o.get(c);d&&(l.push(d),o.delete(c))}for(let c of o.values())l.push(c);if(r){let c=this.findItemById(i.items,r);c&&(c.items=l)}else i.items=l;return await this.save(i),!0}catch(s){return console.error("[JsonCollectionLoader] Failed to reorder items:",s),!1}}findItemById(e,r){for(let n of e){if(n.id===r)return n;if(n.type==="folder"&&n.items){let i=this.findItemById(n.items,r);if(i)return i}}}deleteItemById(e,r){for(let n=0;n<e.length;n++){if(e[n].id===r)return e.splice(n,1),!0;let i=e[n];if(i.type==="folder"&&i.items&&this.deleteItemById(i.items,r))return!0}return!1}}});var Xu,Z0=ae(()=>{"use strict";rm();Q0();Xu=class{static create(e){let r=e.getStorageConfig(),n=e.getCollectionsPath();return r.format==="folder"?new Cs(n):new Qa(n)}static createForFormat(e,r){return e==="folder"?new Cs(r):new Qa(r)}}});function EP(t){if(typeof t!="string")return"text";let e=t.trim();try{let r=JSON.parse(e);if(typeof r=="object"&&r!==null)return"json"}catch{}return/^<\?xml/.test(e)||/^<([a-zA-Z_][\w\-\.]*)[\s>]/.test(e)?/^<\!DOCTYPE html>/i.test(e)||/^<html[\s>]/i.test(e)?"html":"xml":/^<\!DOCTYPE html>/i.test(e)||/^<html[\s>]/i.test(e)?"html":/^(function\s*\(|\(\)\s*=>|const |let |var |export |import )/.test(e)?"javascript":"text"}function Uz(t){return{info:{name:t.name,_postman_id:t.id,schema:"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},item:t.items.map(e=>qP(e)),event:X0(t.scripts),variable:t.variables?Object.entries(t.variables).map(([e,r])=>({key:e,value:r})):[]}}function qP(t){if(t.type==="folder")return{name:t.name,item:t.items?t.items.map(qP):[],event:X0(t.scripts)};if(t.type==="request"){let e=t;return{name:e.name,request:{method:e.method,header:(e.headers||[]).map(Hz),url:Bz(e),body:Vz(e),auth:Wz(e.auth),description:e.description},event:X0(e.scripts),protocolProfileBehavior:zz(e.settings)}}}function Hz(t){return{key:t.key,value:t.value,disabled:t.enabled===!1,...t.description!==void 0?{description:t.description}:{},...t.type!==void 0?{type:t.type}:{},...t.required!==void 0?{required:t.required}:{},...t.format!==void 0?{format:t.format}:{},...t.enum!==void 0?{enum:t.enum}:{},...t.deprecated!==void 0?{deprecated:t.deprecated}:{},...t.pattern!==void 0?{pattern:t.pattern}:{},...t.minLength!==void 0?{minLength:t.minLength}:{},...t.maxLength!==void 0?{maxLength:t.maxLength}:{},...t.minimum!==void 0?{minimum:t.minimum}:{},...t.maximum!==void 0?{maximum:t.maximum}:{},...t.exclusiveMinimum!==void 0?{exclusiveMinimum:t.exclusiveMinimum}:{},...t.exclusiveMaximum!==void 0?{exclusiveMaximum:t.exclusiveMaximum}:{},...t.multipleOf!==void 0?{multipleOf:t.multipleOf}:{},...t.minItems!==void 0?{minItems:t.minItems}:{},...t.maxItems!==void 0?{maxItems:t.maxItems}:{},...t.uniqueItems!==void 0?{uniqueItems:t.uniqueItems}:{},...t.nullable!==void 0?{nullable:t.nullable}:{},...t.oneOf!==void 0?{oneOf:t.oneOf}:{}}}function Bz(t){let e=t.url,r=t.url.replace(/^[a-zA-Z]+:\/\//,""),n=[],i=r.match(/^([^\/\?]+)/);if(i){let d=i[1];/^{{.*}}$/.test(d)?n=[d]:n=d.split(".")}let s=[],o=r.match(/^[^\/\?]+(\/[^\?]*)?/);if(o&&o[1]!==void 0){let d=o[1].replace(/^\//,"");d.endsWith("/")?(s=d.slice(0,-1).split("/"),s.push("")):s=d.length>0?d.split("/"):[]}let l;if(Array.isArray(t.query)&&t.query.length>0)l=t.query.map(d=>{let p={key:d.key,value:d.value};return d.enabled===!1&&(p.disabled=!0),d.description!==void 0&&(p.description=d.description),d.type!==void 0&&(p.type=d.type),d.required!==void 0&&(p.required=d.required),d.format!==void 0&&(p.format=d.format),d.enum!==void 0&&(p.enum=d.enum),d.deprecated!==void 0&&(p.deprecated=d.deprecated),d.pattern!==void 0&&(p.pattern=d.pattern),d.minLength!==void 0&&(p.minLength=d.minLength),d.maxLength!==void 0&&(p.maxLength=d.maxLength),d.minimum!==void 0&&(p.minimum=d.minimum),d.maximum!==void 0&&(p.maximum=d.maximum),d.exclusiveMinimum!==void 0&&(p.exclusiveMinimum=d.exclusiveMinimum),d.exclusiveMaximum!==void 0&&(p.exclusiveMaximum=d.exclusiveMaximum),d.multipleOf!==void 0&&(p.multipleOf=d.multipleOf),d.minItems!==void 0&&(p.minItems=d.minItems),d.maxItems!==void 0&&(p.maxItems=d.maxItems),d.uniqueItems!==void 0&&(p.uniqueItems=d.uniqueItems),d.nullable!==void 0&&(p.nullable=d.nullable),d.oneOf!==void 0&&(p.oneOf=d.oneOf),p});else{let d=r.indexOf("?");d!==-1&&(l=r.substring(d+1).split("&").map(m=>{let[y,...b]=m.split("=");return{key:y,value:b.join("=")}}))}let c;return t.params&&typeof t.params=="object"&&(c=Object.entries(t.params).map(([d,p])=>({key:d,value:String(p)}))),{raw:e,host:n.length>0?n:void 0,path:s.length>0?s:void 0,query:l&&l.length>0?l:void 0,variable:c&&c.length>0?c:void 0}}function Vz(t){if(!t.body)return;let e=t.body;if(typeof e=="string"){let s=EP(e);return{mode:"raw",raw:e,options:{raw:{language:s}}}}if(e.type==="raw"){let s=e.format||EP(e.content);return{mode:"raw",raw:e.content,options:{raw:{language:s}}}}let r=e.type==="form-data"&&Array.isArray(e.content)?e.content:e.type==="formdata"&&Array.isArray(e.fields)?e.fields:null;if(r)return{mode:"formdata",formdata:r.map(s=>({key:s.key,value:s.value,type:s.type||"text",disabled:s.enabled===!1}))};let n=e.type==="x-www-form-urlencoded"&&Array.isArray(e.content)?e.content:e.type==="urlencoded"&&Array.isArray(e.fields)?e.fields:null;if(n)return{mode:"urlencoded",urlencoded:n.map(s=>({key:s.key,value:s.value,disabled:s.enabled===!1}))};if(e.type==="file"&&e.fileName)return{mode:"file",file:{src:e.fileName}};if(e.type==="binary")return{mode:"binary",file:{}};let i=e.type==="graphql"?e.content??(e.query?e:null):null;if(i){let s=i.query??"",o=i.variables;return{mode:"graphql",graphql:{query:s,variables:o?typeof o=="string"?o:JSON.stringify(o):void 0}}}if(e.content)return{mode:"raw",raw:e.content}}function Wz(t){if(!(!t||!t.type||t.type==="none")){if(t.type==="bearer")return{type:"bearer",bearer:[{key:"token",value:t.bearerToken,type:"string"}]};if(t.type==="basic"&&t.basicAuth)return{type:"basic",basic:[{key:"username",value:t.basicAuth.username,type:"string"},{key:"password",value:t.basicAuth.password,type:"string"}]}}}function zz(t){if(!t)return;let e={};return t.followRedirects===!1&&(e.followRedirects=!1),t.followOriginalMethod===!0&&(e.followOriginalHttpMethod=!0),t.followAuthHeader===!1&&(e.followAuthorizationHeader=!1),t.maxRedirects!==void 0&&(e.maxRedirects=t.maxRedirects),t.strictSSL===!1&&(e.disableUrlEncoding=!1),t.timeout!==void 0&&(e.requestTimeout=t.timeout),Object.keys(e).length>0?e:void 0}function X0(t){if(!t)return[];let e=[];return t.preRequest&&e.push({listen:"prerequest",script:{type:"text/javascript",exec:[t.preRequest]}}),t.postResponse&&e.push({listen:"test",script:{type:"text/javascript",exec:[t.postResponse]}}),e}var Dt,mi,ec,e_=ae(()=>{"use strict";Un();ng();Z0();Dt=ve(require("fs")),mi=ve(require("path"));ec=class{constructor(e,r,n){this.workspaceRoot=e;this.configService=r;this.fileWatcherFactory=n;this.collectionsDir=r.getCollectionsPath(),this.loader=Xu.create(r),this.ensureCollectionsDir(),this.loadCollections(),this.setupFileWatcher()}workspaceRoot;configService;fileWatcherFactory;collectionsDir;collections=new Map;fileWatcher;loader;debounceTimer=null;selfWritePending=!1;localCollectionValues=new Map;onCollectionsChanged;ensureCollectionsDir(){Dt.existsSync(this.collectionsDir)||Dt.mkdirSync(this.collectionsDir,{recursive:!0})}loadCollections(){this.collections.clear();let e=this.loader.loadAll();for(let r of e)this.collections.set(r.id,r)}setupFileWatcher(){if(!this.fileWatcherFactory)return;this.fileWatcher=this.fileWatcherFactory.createFileWatcher(this.collectionsDir,"**/*");let e=()=>{this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null;let r=this.selfWritePending;this.selfWritePending=!1,r||this.loadCollections(),this.onCollectionsChanged?.()},300)};this.fileWatcher.onDidChange(e),this.fileWatcher.onDidCreate(e),this.fileWatcher.onDidDelete(e)}getAllCollections(){return Array.from(this.collections.values())}getCollection(e){return this.collections.get(e)}getCollectionById(e){for(let r of this.collections.values())if(r.id===e)return r}getCollectionByName(e){let r=e.toLowerCase();for(let n of this.collections.values())if(n.name.toLowerCase()===r)return n}async saveCollection(e){if(this.ensureCollectionsDir(),!e.name)throw new Error("Collection name is required");e.id||(e.id=Ot(e.name)),this.selfWritePending=!0,await this.loader.save(e),this.collections.set(e.id,e)}getCollectionVariables(e){let r=this.collections.get(e);return r?.variables?{...r.variables}:{}}getCollectionVariableLocals(e){return{...this.localCollectionValues.get(e)||{}}}setCollectionVariable(e,r,n){this.localCollectionValues.has(e)||this.localCollectionValues.set(e,{}),this.localCollectionValues.get(e)[r]=String(n)}deleteCollectionVariable(e,r){let n=this.localCollectionValues.get(e);n&&delete n[r]}clearCollectionVariables(e){this.localCollectionValues.set(e,{})}async deleteCollection(e){if(!this.collections.get(e))return!1;this.selfWritePending=!0;let n=await this.loader.delete(e);return n&&this.collections.delete(e),n}findRequest(e,r){let n=this.collections.get(e);if(n)return this.findItemRecursive(n.items,r)}findRequestByPath(e,r){let n=this.collections.get(e);if(!n)return;let i=r.split("/").filter(s=>s.trim());return this.findItemByPath(n.items,i)}async updateRequest(e,r,n){let i=this.collections.get(e);if(!i)return!1;this.selfWritePending=!0;let s=await this.loader.updateItem(e,r,n);if(s){let o=this.findItemRecursive(i.items,r);if(o){let{id:l,type:c,...d}=n;Object.assign(o,d)}}return s}async addRequest(e,r,n){if(!this.collections.get(e))return!1;r.id||(r.id=Ot(r.name)),this.selfWritePending=!0;try{return await this.loader.saveItem(e,r,n),!0}catch(s){return console.error("[CollectionService] Failed to add request:",s),!1}}async deleteRequest(e,r){let n=this.collections.get(e);if(!n)return!1;this.selfWritePending=!0;let i=await this.loader.deleteItem(e,r);return i&&this.deleteItemRecursive(n.items,r),i}getAllRequests(e){let r=this.collections.get(e);if(!r)return[];let n=[];return this.collectRequestsRecursive(r.items,n),n}findItemRecursive(e,r){for(let n of e){if(n.id===r)return n;if(n.type==="folder"&&n.items){let i=this.findItemRecursive(n.items,r);if(i)return i}}}findItemByPath(e,r){if(r.length===0)return;let[n,...i]=r,s=e.find(o=>o.name===n);if(s){if(i.length===0)return s;if(s.type==="folder"&&s.items)return this.findItemByPath(s.items,i)}}updateItemRecursive(e,r,n){for(let i=0;i<e.length;i++){let s=e[i];if(s.id===r)return e[i]={...s,...n},!0;if(s.type==="folder"&&s.items&&this.updateItemRecursive(s.items,r,n))return!0}return!1}deleteItemRecursive(e,r){for(let n=0;n<e.length;n++){let i=e[n];if(i.id===r)return e.splice(n,1),!0;if(i.type==="folder"&&i.items&&this.deleteItemRecursive(i.items,r))return!0}return!1}collectRequestsRecursive(e,r){for(let n of e)n.type==="request"?r.push(n):n.type==="folder"&&n.items&&this.collectRequestsRecursive(n.items,r)}async createCollection(e){let r={id:Ot(e),name:e,items:[]};return await this.saveCollection(r),r}async renameCollection(e,r){let n=this.collections.get(e);return n?(n.name=r,await this.saveCollection(n),!0):!1}async duplicateCollection(e,r){if(!this.collections.get(e))throw new Error(`Collection not found: ${e}`);this.selfWritePending=!0;let i=Ot(r),s=this.loader.getCollectionPath(e),o=mi.join(this.collectionsDir,i);if(!Dt.existsSync(s))throw new Error(`Collection directory not found: ${s}`);this.copyDirRecursive(s,o);let l=mi.join(o,"collection.json");if(Dt.existsSync(l)){let d=JSON.parse(Dt.readFileSync(l,"utf-8"));d.id=i,d.name=r,Dt.writeFileSync(l,JSON.stringify(d,null,2))}else Dt.writeFileSync(l,JSON.stringify({id:i,name:r},null,2));this.loadCollections();let c=this.collections.get(i);if(!c)throw new Error("Failed to load duplicated collection");return c}async createFolder(e){if(!this.collections.get(e.collectionId))throw new Error("Collection not found");this.selfWritePending=!0;let n={id:Ot(e.name),type:"folder",name:e.name,items:[]};await this.loader.saveItem(e.collectionId,n,e.parentId);let i=this.loader.load(e.collectionId);return i&&this.collections.set(e.collectionId,i),n}async deleteFolder(e,r){let n=this.collections.get(e);if(!n)return!1;this.selfWritePending=!0;let i=await this.loader.deleteItem(e,r);return i&&this.deleteItemById(n.items,r),i}async renameFolder(e,r,n){let i=this.collections.get(e);if(!i)return!1;this.selfWritePending=!0;let s=await this.loader.updateItem(e,r,{name:n});if(s){let o=this.findItemById(i.items,r);o&&(o.name=n)}return s}async duplicateFolder(e,r,n){if(!this.collections.get(e))throw new Error("Collection not found");let s=this.loader.getItemPath(e,r);if(!s||!Dt.existsSync(s))throw new Error(`Folder not found on disk: ${r}`);let o=mi.dirname(s),l=Ot(n),c=mi.join(o,l);this.selfWritePending=!0,this.copyDirRecursive(s,c);let d=mi.join(c,"folder.json");if(Dt.existsSync(d)){let y=JSON.parse(Dt.readFileSync(d,"utf-8"));y.id=l,y.name=n,Dt.writeFileSync(d,JSON.stringify(y,null,2))}else Dt.writeFileSync(d,JSON.stringify({id:l,name:n,type:"folder"},null,2));this.loadCollections();let p=this.collections.get(e),m=p?this.findItemById(p.items,l):void 0;return m||{id:l,type:"folder",name:n,items:[]}}async createRequest(e){if(!this.collections.get(e.collectionId))throw new Error("Collection not found");this.selfWritePending=!0;let n={id:e.id||Ot(e.name),type:"request",name:e.name,method:e.method||"GET",url:e.url,params:e.params,query:e.query,headers:e.headers,body:e.body,auth:e.auth,settings:e.settings,scripts:e.scripts,deprecated:e.deprecated,description:e.description,doc:e.doc,responseSchema:e.responseSchema,bodySchema:e.bodySchema,operationId:e.operationId,summary:e.summary,tags:e.tags,examples:e.examples,responses:e.responses,security:e.security};await this.loader.saveItem(e.collectionId,n,e.parentId);let i=this.loader.load(e.collectionId);return i&&this.collections.set(e.collectionId,i),n}async renameRequest(e,r,n){let i=this.collections.get(e);if(!i)return!1;this.selfWritePending=!0;let s=await this.loader.updateItem(e,r,{name:n});if(s){let o=this.findItemById(i.items,r);o&&(o.name=n)}return s}async moveItem(e,r,n){if(!this.collections.get(e))return!1;this.selfWritePending=!0;let s=await this.loader.moveItem(e,r,n);return s&&this.loadCollections(),s}async reorderItems(e,r,n){if(!this.collections.get(e))return!1;this.selfWritePending=!0;let s=await this.loader.reorderItems(e,r,n);return s&&this.loadCollections(),s}getRequestScript(e,r,n){let i=this.collections.get(e);if(!i)return;let s=this.findItemById(i.items,r);if(!s||s.type!=="request")return;let o=s;return n==="pre-request"?o.scripts?.preRequest:o.scripts?.postResponse}async setRequestScript(e,r,n,i){let s=this.collections.get(e);if(!s)return!1;let o=this.findItemById(s.items,r);if(!o||o.type!=="request")return!1;let l=o,d={...l.scripts??{},...n==="pre-request"?{preRequest:i}:{postResponse:i}};l.scripts=d,this.selfWritePending=!0;try{return await this.loader.saveScripts(e,r,d),!0}catch{return!1}}findItemById(e,r){for(let n of e){if(n.id===r)return n;if(n.type==="folder"&&n.items){let i=this.findItemById(n.items,r);if(i)return i}}}copyDirRecursive(e,r){Dt.existsSync(r)||Dt.mkdirSync(r,{recursive:!0});for(let n of Dt.readdirSync(e,{withFileTypes:!0})){let i=mi.join(e,n.name),s=mi.join(r,n.name);n.isDirectory()?this.copyDirRecursive(i,s):Dt.copyFileSync(i,s)}}deleteItemById(e,r){for(let n=0;n<e.length;n++){let i=e[n];if(i.id===r)return e.splice(n,1),!0;if(i.type==="folder"&&i.items&&this.deleteItemById(i.items,r))return!0}return!1}async importCollection(e){let r=Dt.readFileSync(e,"utf-8"),n;try{n=JSON.parse(r)}catch{throw new Error("Invalid JSON file")}if(n.info&&n.info._postman_id)return this.importPostmanCollection(n);let i={id:n.id||Ot(n.name||"Imported Collection"),name:n.name||"Imported Collection",description:n.description,items:n.items||[]};return await this.saveCollection(i),i}async importPostmanCollection(e){let r=p=>{if(!p)return;switch(p.type?.toLowerCase()){case"bearer":return{type:"bearer",bearerToken:p.bearer?.find(E=>E.key==="token")?.value||""};case"basic":let b=p.basic?.find(E=>E.key==="username"),q=p.basic?.find(E=>E.key==="password");return{type:"basic",basicAuth:{username:b?.value||"",password:q?.value||""}};case"apikey":let C=p.apikey?.find(E=>E.key==="key"),v=p.apikey?.find(E=>E.key==="value"),_=p.apikey?.find(E=>E.key==="in");return{type:"apikey",apikey:{key:C?.value||"",value:v?.value||"",in:_?.value||"header"}};case"noauth":return{type:"none"};default:return}},n=p=>{if(!Array.isArray(p)||p.length===0)return;let m={};for(let y of p){let b=y.script?.exec;if(!b)continue;let q=Array.isArray(b)?b.join(`
|
|
55
|
+
`):b;y.listen==="prerequest"?m.preRequest=q:y.listen==="test"&&(m.postResponse=q)}return m.preRequest||m.postResponse?m:void 0},i=p=>{if(!p||typeof p!="object")return;let m={};return p.followRedirects===!1&&(m.followRedirects=!1),p.followOriginalHttpMethod===!0&&(m.followOriginalMethod=!0),p.followAuthorizationHeader===!1&&(m.followAuthHeader=!1),p.maxRedirects!==void 0&&(m.maxRedirects=p.maxRedirects),p.requestTimeout!==void 0&&(m.timeout=p.requestTimeout),Object.keys(m).length>0?m:void 0},s=p=>{if(!p||typeof p=="string")return;let m=p.query;if(!(!Array.isArray(m)||m.length===0))return m.map(y=>({key:y.key||"",value:y.value||"",enabled:y.disabled!==!0,...y.description!==void 0?{description:y.description}:{},...y.type!==void 0?{type:y.type}:{},...y.required!==void 0?{required:y.required}:{},...y.format!==void 0?{format:y.format}:{},...y.enum!==void 0?{enum:y.enum}:{},...y.deprecated!==void 0?{deprecated:y.deprecated}:{},...y.pattern!==void 0?{pattern:y.pattern}:{},...y.minLength!==void 0?{minLength:y.minLength}:{},...y.maxLength!==void 0?{maxLength:y.maxLength}:{},...y.minimum!==void 0?{minimum:y.minimum}:{},...y.maximum!==void 0?{maximum:y.maximum}:{},...y.exclusiveMinimum!==void 0?{exclusiveMinimum:y.exclusiveMinimum}:{},...y.exclusiveMaximum!==void 0?{exclusiveMaximum:y.exclusiveMaximum}:{},...y.multipleOf!==void 0?{multipleOf:y.multipleOf}:{},...y.minItems!==void 0?{minItems:y.minItems}:{},...y.maxItems!==void 0?{maxItems:y.maxItems}:{},...y.uniqueItems!==void 0?{uniqueItems:y.uniqueItems}:{},...y.nullable!==void 0?{nullable:y.nullable}:{},...y.oneOf!==void 0?{oneOf:y.oneOf}:{}}))},o=p=>{if(typeof p=="string")return p;if(!p)return"";let m=new Set;if(Array.isArray(p.variable))for(let b of p.variable)b.key&&m.add(b.key);if(m.size===0&&p.raw)return p.raw;let y="";if(p.protocol&&(y+=p.protocol+"://"),p.host&&(y+=Array.isArray(p.host)?p.host.join("."):p.host),p.port&&(y+=":"+p.port),p.path){let q=(Array.isArray(p.path)?p.path:[p.path]).map(C=>{let v=C.startsWith(":")?C.substring(1):C;return m.has(v)?":"+v:(C.startsWith(":"),C)});y+="/"+q.join("/")}return!y&&p.raw?p.raw:y},l=p=>{if(!Array.isArray(p)||p.length===0)return;let m={responses:{}};for(let y of p){let b=String(y.code||200),q,C={};if(Array.isArray(y.header))for(let O of y.header)!O.key||O.disabled||(O.key.toLowerCase()==="content-type"?q=O.value?.split(";")[0]?.trim():C[O.key]={description:String(O.value??""),schema:{type:"string"}});let v=y.body;if(typeof y.body=="string"&&y.body)try{v=JSON.parse(y.body)}catch{}let _=y.originalRequest,E;if(_){let O=typeof _.url=="string"?_.url:_.url?.raw??"";E=`${_.method||""} ${O}`.trim()||void 0}let k=y.name?y.name.replace(/[^a-zA-Z0-9_-]/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,"").toLowerCase()||`example_${b}`:`example_${b}`;if(m.responses[b]){let O=m.responses[b];O.examples=O.examples??{},O.examples[k]={summary:E,value:v}}else m.responses[b]={description:y.name,contentType:q,examples:{[k]:{summary:E,value:v}},...Object.keys(C).length>0?{headers:C}:{}}}return Object.keys(m.responses).length>0?m:void 0},c=p=>p.map(m=>{if(m.item)return{id:Ot(m.name),type:"folder",name:m.name,description:m.description,auth:r(m.auth),scripts:n(m.event),items:c(m.item)};{let y=m.request||{};return{id:Ot(m.name),type:"request",name:m.name,description:m.description||y.description,method:typeof y.method=="string"?y.method:"GET",url:o(y.url),query:s(y.url),headers:Array.isArray(y.header)?y.header.map(b=>({key:b.key||b.name||"",value:b.value||b.value||"",enabled:b.disabled!==!0,...b.description!==void 0?{description:b.description}:{},...b.type!==void 0?{type:b.type}:{},...b.required!==void 0?{required:b.required}:{},...b.format!==void 0?{format:b.format}:{},...b.enum!==void 0?{enum:b.enum}:{},...b.deprecated!==void 0?{deprecated:b.deprecated}:{},...b.pattern!==void 0?{pattern:b.pattern}:{},...b.minLength!==void 0?{minLength:b.minLength}:{},...b.maxLength!==void 0?{maxLength:b.maxLength}:{},...b.minimum!==void 0?{minimum:b.minimum}:{},...b.maximum!==void 0?{maximum:b.maximum}:{},...b.exclusiveMinimum!==void 0?{exclusiveMinimum:b.exclusiveMinimum}:{},...b.exclusiveMaximum!==void 0?{exclusiveMaximum:b.exclusiveMaximum}:{},...b.multipleOf!==void 0?{multipleOf:b.multipleOf}:{},...b.minItems!==void 0?{minItems:b.minItems}:{},...b.maxItems!==void 0?{maxItems:b.maxItems}:{},...b.uniqueItems!==void 0?{uniqueItems:b.uniqueItems}:{},...b.nullable!==void 0?{nullable:b.nullable}:{},...b.oneOf!==void 0?{oneOf:b.oneOf}:{}})):[],body:(()=>{let b=y.body;if(b){if(b.mode==="raw"&&b.raw){let q=b.options?.raw?.language;return{type:"raw",format:q==="xml"?"xml":q==="html"?"html":q==="javascript"?"javascript":q==="text"?"text":"json",content:b.raw}}if(b.mode==="urlencoded"&&Array.isArray(b.urlencoded))return{type:"x-www-form-urlencoded",content:b.urlencoded.map(q=>({key:q.key||"",value:q.value||"",enabled:q.disabled!==!0}))};if(b.mode==="formdata"&&Array.isArray(b.formdata))return{type:"form-data",content:b.formdata.map(q=>({key:q.key||"",value:q.value||"",type:q.type||"text",enabled:q.disabled!==!0}))};if(b.mode==="graphql"&&b.graphql){let q;if(b.graphql.variables)try{q=JSON.parse(b.graphql.variables)}catch{q=void 0}return{type:"graphql",content:{query:b.graphql.query||"",variables:q}}}if(b.mode==="binary")return{type:"binary",content:""}}})(),auth:r(y.auth),scripts:n(m.event),settings:i(m.protocolProfileBehavior),responseSchema:l(m.response)}}}),d={id:Ot(e.info?.name||"Imported Postman Collection"),name:e.info?.name||"Imported Postman Collection",description:e.info?.description,auth:r(e.auth),scripts:n(e.event),variables:Array.isArray(e.variable)?Object.fromEntries(e.variable.filter(p=>p&&p.key).map(p=>[p.key,String(p.value??"")])):typeof e.variable=="object"&&e.variable!==null?Object.fromEntries(Object.entries(e.variable).map(([p,m])=>[p,String(m??"")])):void 0,items:c(e.item||[])};return await this.saveCollection(d),d}async exportCollection(e,r){let n=this.collections.get(e);if(!n)throw new Error("Collection not found");let i=Uz(n),s=JSON.stringify(i,null,2);Dt.writeFileSync(r,s,"utf-8")}async exportCollectionAsRestClientFolder(e,r){let n=this.collections.get(e);if(!n)throw new Error("Collection not found");let i=mi.join(r,Ht(n.name));Dt.mkdirSync(i,{recursive:!0});let s=n.variables||{};Ka(mi.join(i,`${Ht(n.name)}.env`),s),Zu(i,Ht(n.name),n.scripts),yd(n.items,i,n)}dispose(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.fileWatcher?.dispose()}}});var tr,ko,Ps,t_=ae(()=>{"use strict";tr={version:"1.0",storage:{format:"folder",root:"./.http-forge/assets",history:"./.http-forge/.cache/histories",results:"./.http-forge/.cache/results"},request:{timeout:3e4,followRedirects:!0,maxRedirects:10,strictSSL:!0,tls:{},certificates:[]},scripts:{modulePaths:["./.http-forge/assets/src","./.http-forge/assets/lib"],scope:"shared",timeout:5e3},runner:{resultsRetentionDays:7,indexPageSize:1e3,recentErrorsLimit:20},environments:{default:"dev"},restClientExport:{path:"collections-rest-client",mergeGlobals:!0},mcp:{port:3100,excludedCollections:[],excludedSuites:[],toolPrefix:"",maxRequestsPerCall:500,toolMode:"auto",drilldownThreshold:100,toolPageSize:200,cors:{allowedOrigins:["http://localhost","http://127.0.0.1"]}},proxy:null,secrets:{providers:{aws:{provider:"aws"},azure:{provider:"azure",vaultUrl:""},gcp:{provider:"gcp"},vault:{provider:"vault"},op:{provider:"1password"},doppler:{provider:"doppler"}}}},ko={preferred:".http-forge/http-forge.config.json",legacy:"http-forge.config.json"},Ps={collections:"collections",environments:"environments",flows:"flows",suites:"suites"}});var Bt,zt,ks,ig=ae(()=>{"use strict";Bt=ve(require("fs")),zt=ve(require("path"));t_();ks=class{constructor(e,r,n){this.workspacePath=e;this.fileWatcherFactory=r;this.notifications=n;this.configPath=this.resolveConfigPath(),this.config=this.loadConfig(),this.setupFileWatcher()}workspacePath;fileWatcherFactory;notifications;config;configPath;fileWatchers=[];resolveConfigPath(){let e=zt.join(this.workspacePath,ko.preferred);if(Bt.existsSync(e))return e;let r=zt.join(this.workspacePath,ko.legacy);return Bt.existsSync(r)?r:e}loadConfig(){if(this.configPath=this.resolveConfigPath(),!Bt.existsSync(this.configPath))return{...tr};try{let e=Bt.readFileSync(this.configPath,"utf-8"),r=JSON.parse(e);return this.mergeWithDefaults(r)}catch(e){return console.error("[ConfigService] Failed to load config:",e),this.notifications?.showWarning(`Failed to parse ${zt.relative(this.workspacePath,this.configPath)}. Using default configuration.`),{...tr}}}mergeWithDefaults(e){return{version:e.version??tr.version,storage:{...tr.storage,...e.storage},request:{...tr.request,...e.request},scripts:{...tr.scripts,...e.scripts},runner:{...tr.runner,...e.runner},environments:{...tr.environments,...e.environments},restClientExport:{...tr.restClientExport,...e.restClientExport},proxy:e.proxy!==void 0?e.proxy:tr.proxy,mcp:{...tr.mcp,...e.mcp,cors:{...tr.mcp.cors,...e.mcp?.cors}},secrets:{...tr.secrets,...e.secrets,providers:{...tr.secrets?.providers,...e.secrets?.providers}}}}setupFileWatcher(){if(!this.fileWatcherFactory)return;let e=()=>{this.reload()};for(let r of[ko.preferred,ko.legacy]){let n=this.fileWatcherFactory.createFileWatcher(this.workspacePath,r);n.onDidChange(e),n.onDidCreate(e),n.onDidDelete(e),this.fileWatchers.push(n)}}getConfig(){return this.config}getStorageConfig(){return this.config.storage}getRequestConfig(){return this.config.request}getScriptsConfig(){return this.config.scripts}getRunnerConfig(){return this.config.runner}getEnvironmentsConfig(){return this.config.environments}getRestClientExportPath(){let e=this.config.restClientExport?.path||"collections-rest-client";return zt.isAbsolute(e)?e:this.resolvePath(e)}getRestClientMergeGlobals(){return this.config.restClientExport?.mergeGlobals??!0}getProxyConfig(){return this.config.proxy??null}getMcpConfig(){let e=this.config.mcp??tr.mcp,r=["flat","drilldown","auto"];return{...e,port:Math.min(65535,Math.max(1,Math.floor(e.port??3100))),toolMode:r.includes(e.toolMode)?e.toolMode:"auto",drilldownThreshold:Math.min(500,Math.max(10,e.drilldownThreshold??100)),toolPageSize:e.toolPageSize===0?0:Math.min(1e3,Math.max(10,e.toolPageSize??200)),maxRequestsPerCall:Math.min(1e4,Math.max(1,e.maxRequestsPerCall??500))}}resolvePath(e){let r=e.startsWith("./")?e.slice(2):e;return zt.join(this.workspacePath,...r.split("/"))}hasFolderCollectionsAtRoot(e){let r=zt.join(e,Ps.collections);if(!Bt.existsSync(r))return!1;let n;try{n=Bt.readdirSync(r,{withFileTypes:!0})}catch{return!1}return n.some(i=>{if(!i.isDirectory())return!1;let s=zt.join(r,i.name,"collection.json");return Bt.existsSync(s)})}hasAnyEntries(e){if(!Bt.existsSync(e))return!1;try{return Bt.readdirSync(e).length>0}catch{return!1}}resolveStorageRootPath(){let e=this.resolvePath(this.config.storage.root);return this.configExists()||this.hasFolderCollectionsAtRoot(e)?e:[zt.join(this.workspacePath,"http-forge-assets")].find(i=>this.hasFolderCollectionsAtRoot(i))||e}getRootPath(){return this.resolveStorageRootPath()}getCollectionsPath(){return zt.join(this.getRootPath(),Ps.collections)}getEnvironmentsPath(){return zt.join(this.getRootPath(),Ps.environments)}getFlowsPath(){return zt.join(this.getRootPath(),Ps.flows)}getHistoryPath(){let e=this.resolvePath(this.config.storage.history);if(this.configExists()||this.hasAnyEntries(e))return e;let r=zt.join(this.workspacePath,".http-forge-cache","histories");return this.hasAnyEntries(r)?r:e}getResultsPath(){let e=this.resolvePath(this.config.storage.results);if(this.configExists()||this.hasAnyEntries(e))return e;let r=zt.join(this.workspacePath,".http-forge-cache","results");return this.hasAnyEntries(r)?r:e}getSuitesPath(){return zt.join(this.getRootPath(),Ps.suites)}getModulePaths(){return this.config.scripts.modulePaths.map(e=>this.resolvePath(e))}getScriptScope(){return this.config.scripts.scope??"shared"}getScriptTimeout(){return this.config.scripts.timeout??5e3}getWorkspacePath(){return this.workspacePath}reload(){this.configPath=this.resolveConfigPath(),this.config=this.loadConfig()}configExists(){return Bt.existsSync(this.resolveConfigPath())}async createDefaultConfig(){await Bt.promises.mkdir(zt.dirname(this.configPath),{recursive:!0});let e=JSON.stringify(tr,null,2);await Bt.promises.writeFile(this.configPath,e,"utf-8");let r=[this.getCollectionsPath(),this.getEnvironmentsPath(),this.getFlowsPath(),this.getSuitesPath()];for(let i of r)Bt.existsSync(i)||await Bt.promises.mkdir(i,{recursive:!0});let n=[this.getHistoryPath(),this.getResultsPath()];for(let i of n)Bt.existsSync(i)||await Bt.promises.mkdir(i,{recursive:!0});await this.createSampleEnvironments()}async createSampleEnvironments(){let e=this.getEnvironmentsPath(),r={id:"globals",name:"Global Variables",variables:{appName:"HTTP Forge"}};await Bt.promises.writeFile(zt.join(e,"globals.json"),JSON.stringify(r,null,2),"utf-8");let n={id:"env_dev",name:"Development",variables:{baseUrl:"http://localhost:3000",apiVersion:"v1"}};await Bt.promises.writeFile(zt.join(e,"dev.json"),JSON.stringify(n,null,2),"utf-8");let i={id:"default_headers",name:"Default Headers",headers:{"Content-Type":"application/json",Accept:"application/json"}};await Bt.promises.writeFile(zt.join(e,"default-headers.json"),JSON.stringify(i,null,2),"utf-8")}dispose(){for(let e of this.fileWatchers)e.dispose();this.fileWatchers=[]}}});var Jz,tc,r_=ae(()=>{"use strict";ka();Jz="httpForge.cookies",tc=class{constructor(e,r=Jz){this.store=e;this.storeKey=r;this.loadCookies()}store;storeKey;cookies=new Map;loadCookies(){try{let e=this.store.get(this.storeKey);e&&(this.cookies=new Map(Object.entries(e)),this.cleanExpiredCookies())}catch(e){console.error("[CookieService] Failed to load cookies:",e)}}async saveCookies(){try{let e={};this.cookies.forEach((r,n)=>{e[n]=r}),await this.store.update(this.storeKey,e)}catch(e){console.error("[CookieService] Failed to save cookies:",e)}}getCookieKey(e,r,n){return`${r||"*"}|${n||"/"}|${e}`}get(e,r){if(r){let s=this.getCookieKey(e,r),o=this.cookies.get(s);if(o&&!this.isExpired(o))return o}let n=this.getCookieKey(e,"*"),i=this.cookies.get(n);if(i&&!this.isExpired(i))return i;for(let s of this.cookies.values())if(s.name===e&&!this.isExpired(s))if(r&&s.domain){if(this.domainMatches(r,s.domain))return s}else return s}async set(e){let r=this.getCookieKey(e.name,e.domain,e.path);this.cookies.set(r,e),await this.saveCookies()}async setFromResponse(e){for(let r of e){let n=this.getCookieKey(r.name,r.domain,r.path);this.cookies.set(n,r)}await this.saveCookies()}has(e,r){return this.get(e,r)!==void 0}async delete(e,r,n){let i=this.getCookieKey(e,r,n),s=this.cookies.delete(i);return s&&await this.saveCookies(),s}getAll(e){let r=[];for(let n of this.cookies.values())this.isExpired(n)||(e?(!n.domain||this.domainMatches(e,n.domain))&&r.push(n):r.push(n));return r}getCookieHeader(e){let r=this.getAll(e);return Rt.formatCookieHeader(r)}async clear(){this.cookies.clear(),await this.saveCookies()}async clearDomain(e){let r=[];for(let[n,i]of this.cookies.entries())i.domain&&this.domainMatches(e,i.domain)&&r.push(n);for(let n of r)this.cookies.delete(n);await this.saveCookies()}parseCookieHeaders(e,r){return Rt.parseCookieHeaders(e,r)}isExpired(e){return Rt.isExpired(e)}cleanExpiredCookies(){let e=[];for(let[r,n]of this.cookies.entries())this.isExpired(n)&&e.push(r);for(let r of e)this.cookies.delete(r);e.length>0&&this.saveCookies()}domainMatches(e,r){return Rt.domainMatches(e,r)}get count(){return this.cookies.size}}});var rc,n_=ae(()=>{"use strict";ka();rc=class{constructor(e){this.cookieService=e;this.localCache=[...e.getAll()]}cookieService;localCache=[];pendingOperations=[];get(e,r){return r?this.localCache.find(n=>n.name===e&&(!n.domain||n.domain===r||r.endsWith(n.domain))):this.localCache.find(n=>n.name===e)}has(e,r){return this.get(e,r)!==void 0}set(e){let r=this.localCache.findIndex(n=>n.name===e.name&&(!e.domain||n.domain===e.domain));r>=0?this.localCache[r]=e:this.localCache.push(e),this.pendingOperations.push({type:"set",cookie:e})}delete(e,r,n){let i=this.localCache.findIndex(s=>s.name===e&&(!r||s.domain===r||s.domain&&r.endsWith(s.domain)));return i>=0&&this.localCache.splice(i,1),this.pendingOperations.push({type:"delete",name:e,domain:r,path:n}),!0}getAll(e){return e?this.localCache.filter(r=>{let n=r.domain||"";return n===e||e.endsWith(n)}):[...this.localCache]}getCookiesForDomain(e){return this.localCache.filter(r=>{let n=r.domain||"";return n===e||e.endsWith(n)})}async setCookiesFromResponse(e,r){let n=new URL(e).hostname,i=this.cookieService.parseCookieHeaders(r,n);i.length>0&&(i.forEach(s=>{let o=this.localCache.findIndex(l=>l.name===s.name&&l.domain===(s.domain||n));o>=0?this.localCache[o]=s:this.localCache.push(s)}),await this.cookieService.setFromResponse(i))}getCookieHeader(e){let r=new URL(e).hostname,n=new URL(e).pathname,i=this.localCache.filter(s=>!(Rt.isExpired(s)||s.domain&&!Rt.domainMatches(r,s.domain)||!s.domain||s.path&&!n.startsWith(s.path)));if(i.length!==0)return Rt.formatCookieHeader(i)}clear(){this.localCache=[],this.pendingOperations.push({type:"clear"})}async flush(){for(let e of this.pendingOperations)switch(e.type){case"set":e.cookie&&await this.cookieService.set(e.cookie);break;case"delete":e.name&&await this.cookieService.delete(e.name,e.domain,e.path);break;case"clear":await this.cookieService.clear();break}this.pendingOperations=[]}}});function vd(t){try{let e=JSON.parse(typeof t=="string"?t:t.toString("utf-8"));if(!e)return null;let r=e.environment||e,n=r.name||e.name||"imported-environment",i=r.values||r.variables||e.values||e.variables||[],s={};if(Array.isArray(i))for(let l of i){if(!l)continue;let c=l.key??l.name,d=typeof l.enabled=="boolean"?l.enabled:!0;c&&d!==!1&&(s[c]=l.value??l.initial??"")}else if(typeof i=="object"&&i!==null)for(let[l,c]of Object.entries(i))s[l]=String(c??"");let o=r._postman_exported_at?"Imported from Postman export":r.description||"";return{name:n,variables:s,description:o}}catch{return null}}async function OP(t,e){try{let r=await e.readFile(t);return vd(r)}catch{return null}}var i_=ae(()=>{"use strict"});var ar,Cn,bd,nc,s_=ae(()=>{"use strict";ar=ve(require("fs")),Cn=ve(require("path"));Un();i_();ng();im();Af();bd={SELECTED_ENVIRONMENT:"httpForge.selectedEnvironment",ENV_OVERRIDES_PREFIX:"httpForge.envOverrides."},nc=class{constructor(e,r,n,i,s,o=!0){this.workspaceFolder=e;this.workspaceStore=r;this.configService=n;this.fileWatcherFactory=i;this.secretStore=s;this.persistOverrides=o;let l=n.getEnvironmentsPath();this.environmentsPath=l,this.sharedConfigPath=Cn.join(l,"_global.json"),this.localConfigPath=Cn.join(l,"_global.local.json"),this.historiesPath=n.getHistoryPath(),this.selectedEnvironment=r?.get(bd.SELECTED_ENVIRONMENT,"dev")??"dev",this.localGlobalValues={},this.localEnvironmentValues=new Map,this.persistOverrides&&this.loadPersistedEnvironmentOverrides(),this.loadSecretVariables(this.selectedEnvironment).catch(()=>{}),this.setupFileWatcher()}workspaceFolder;workspaceStore;configService;fileWatcherFactory;secretStore;persistOverrides;environmentsPath;sharedConfigPath;localConfigPath;historiesPath;sharedConfig=null;localConfig=null;selectedEnvironment="dev";fileWatcher;localGlobalValues={};localEnvironmentValues=new Map;secretValuesCache=new Map;onEnvironmentsChanged;setupFileWatcher(){if(!this.fileWatcherFactory||!ar.existsSync(this.environmentsPath))return;this.fileWatcher=this.fileWatcherFactory.createFileWatcher(this.environmentsPath,"**/*.json");let e=()=>{this.reload(),this.onEnvironmentsChanged?.()};this.fileWatcher.onDidChange(e),this.fileWatcher.onDidCreate(e),this.fileWatcher.onDidDelete(e)}dispose(){this.fileWatcher?.dispose()}getWorkspaceFolder(){return this.workspaceFolder}getRootPath(){return this.configService.getRootPath()}loadConfigs(){if(!ar.existsSync(this.environmentsPath)){this.sharedConfig={environments:{},globalVariables:{},defaultHeaders:{}},this.localConfig={credentials:{},variables:{}};return}this.loadFolderConfigs()}getSharedConfig(){return this.sharedConfig||this.loadConfigs(),this.sharedConfig}getLocalConfig(){return this.localConfig||this.loadConfigs(),this.localConfig}getEnvironmentNames(){let e=this.getSharedConfig();return e?.environments?Object.keys(e.environments):[]}getSelectedEnvironment(){return this.selectedEnvironment}async setSelectedEnvironment(e){if(this.selectedEnvironment=e,await this.workspaceStore?.update(bd.SELECTED_ENVIRONMENT,e),!this.localEnvironmentValues.has(e)){let r=this.getEnvOverridesStateKey(e),n=this.workspaceStore?.get(r,{});n&&Object.keys(n).length>0&&this.localEnvironmentValues.set(e,{...n})}await this.loadSecretVariables(e)}getEnvOverridesStateKey(e){return`${bd.ENV_OVERRIDES_PREFIX}${e||this.selectedEnvironment}`}loadPersistedEnvironmentOverrides(){let e=this.getEnvOverridesStateKey(),r=this.workspaceStore?.get(e,{});r&&Object.keys(r).length>0&&this.localEnvironmentValues.set(this.selectedEnvironment,{...r})}persistEnvironmentOverrides(e){if(!this.persistOverrides)return;let r=this.getEnvOverridesStateKey(e),n=this.localEnvironmentValues.get(e)||{};this.workspaceStore?.update(r,n)}setEnvironmentVariable(e,r,n){let i=n??this.selectedEnvironment;this.localEnvironmentValues.has(i)||this.localEnvironmentValues.set(i,{}),this.localEnvironmentValues.get(i)[e]=String(r),this.persistEnvironmentOverrides(i)}deleteEnvironmentVariable(e,r){let n=r??this.selectedEnvironment,i=this.localEnvironmentValues.get(n);i&&(delete i[e],this.persistEnvironmentOverrides(n))}clearEnvironmentVariables(e){let r=e??this.selectedEnvironment;this.localEnvironmentValues.set(r,{}),this.persistEnvironmentOverrides(r)}async resetEnvironmentOverrides(e){let r=e||this.selectedEnvironment;this.localEnvironmentValues.delete(r),await this.workspaceStore?.update(this.getEnvOverridesStateKey(r),void 0)}getEnvironmentVariableLocal(e){return this.localEnvironmentValues.get(this.selectedEnvironment)?.[e]}getEnvironmentVariableLocals(){return{...this.localEnvironmentValues.get(this.selectedEnvironment)||{}}}setGlobalVariable(e,r){this.localGlobalValues[e]=String(r)}getGlobalVariable(e){return this.getSharedConfig()?.globalVariables?.[e]}getGlobalVariableLocal(e){return this.localGlobalValues[e]}getGlobalVariables(){return{...this.getSharedConfig()?.globalVariables||{},...this.getLocalConfig()?.variables||{},...this.localGlobalValues}}getGlobalVariableLocals(){return{...this.localGlobalValues}}deleteGlobalVariable(e){delete this.localGlobalValues[e]}clearGlobalVariables(){this.localGlobalValues={}}getResolvedEnvironment(e){let r=e||this.selectedEnvironment,n=this.getSharedConfig(),i=this.getLocalConfig();if(!n?.environments?.[r])return null;let s=n.environments[r],o=i?.credentials?.[r],l=i?.variables||{},c=o?.variables||{},d=o&&o.headers||{},p=gu(n.defaultHeaders||{},d),m=this.localEnvironmentValues.get(r)||{},y=this.secretValuesCache.get(r)||{},b={...s.variables||{},...c,...m,...y};return{name:r,description:s.description,requiresConfirmation:s.requiresConfirmation,headers:p,variables:b}}async getSecretVariable(e,r){return this.secretStore?.get(`${e}:${r}`)}async setSecretVariable(e,r,n){await this.secretStore?.store(`${e}:${r}`,n),this.secretValuesCache.has(e)||this.secretValuesCache.set(e,{}),this.secretValuesCache.get(e)[r]=n}async deleteSecretVariable(e,r){await this.secretStore?.delete(`${e}:${r}`),this.secretValuesCache.get(e)&&delete this.secretValuesCache.get(e)[r]}async loadSecretVariables(e){if(!this.secretStore)return;let r=e||this.selectedEnvironment,n=this.getSharedConfig()?.environments?.[r]?.secretVariables??[];if(n.length===0)return;let i={};await Promise.all(n.map(async s=>{let o=await this.secretStore.get(`${r}:${s}`);o!==void 0&&(i[s]=o)})),this.secretValuesCache.set(r,i)}resolveVariables(e,r){return this.createResolver(r).resolveString(e,!0)}exportEnvironmentsToFolder(e,r=!0){let n=this.getEnvironmentNames(),i=this.getSharedConfig(),s=i?.globalVariables?{...i.globalVariables}:{};if(!r&&Object.keys(s).length){let o=Cn.join(e,"globals.env");Ka(o,s)}n.forEach(o=>{let l=i?.environments?.[o];if(!l)return;let c={...l.variables||{}};r&&(c={...s,...c});let d=Cn.join(e,`${Ht(o)}.env`);Ka(d,c)})}resolveVariablesWithExtra(e,r,n){return this.createResolver(n,r).resolveString(e,!0)}resolveVariablesInObject(e,r){return this.createResolver(r).resolveObject(e,!0)}resolveVariablesInObjectWithExtra(e,r,n){return this.createResolver(n,r).resolveObject(e,!0)}getHistoriesPath(){return this.historiesPath}getSharedConfigPath(){return this.sharedConfigPath}getLocalConfigPath(){return this.localConfigPath}getEnvironmentConfigPath(e){return Cn.join(this.environmentsPath,`${e}.json`)}localConfigExists(){return ar.existsSync(this.localConfigPath)}saveSharedConfig(e){this.saveFolderSharedConfig(e),this.sharedConfig=e}saveLocalConfig(e){let r={variables:e.variables||{}};this.saveJsonFile(this.localConfigPath,r);for(let[n,i]of Object.entries(e.credentials||{})){let s=this.getEnvLocalConfigPath(n),o={variables:i.variables||{}};this.saveJsonFile(s,o)}this.localConfig=e}importPostmanEnvironmentFile(e){try{let r=ar.readFileSync(e,"utf-8"),n=vd(r);if(!n)throw new Error("Failed to parse Postman environment file");this.sharedConfig||this.loadConfigs(),this.sharedConfig||(this.sharedConfig={environments:{},globalVariables:{},defaultHeaders:{}});let i=n.name||`imported-${Date.now()}`;return this.sharedConfig.environments=this.sharedConfig.environments||{},this.sharedConfig.environments[i]=this.sharedConfig.environments[i]||{},this.sharedConfig.environments[i].variables=n.variables,n.description&&(this.sharedConfig.environments[i].description=n.description),this.saveSharedConfig(this.sharedConfig),n}catch(r){throw console.error("[EnvironmentConfigService] importPostmanEnvironmentFile failed:",r),r}}saveEnvLocalConfig(e,r){let n=this.getEnvLocalConfigPath(e),i={variables:r};this.saveJsonFile(n,i),this.localConfig||(this.localConfig={credentials:{},variables:{}}),this.localConfig.credentials||(this.localConfig.credentials={}),this.localConfig.credentials[e]={variables:r}}getEnvLocalPath(e){return this.getEnvLocalConfigPath(e)}getEnvLocalConfigPath(e){return Cn.join(this.environmentsPath,`${e}.local.json`)}loadFolderConfigs(){let e=wu(this.environmentsPath);this.sharedConfig={environments:e.environments,globalVariables:e.globalVariables,defaultHeaders:e.defaultHeaders},this.localConfig={credentials:e.localCredentials,variables:e.localVariables}}createResolver(e,r){let i=this.getResolvedEnvironment(e)?.variables||{},s=this.getGlobalVariables(),o=this.getGlobalVariableLocals();return new yo({globals:s,collectionVariables:{},environmentVariables:i,variables:{...o,...r||{}}})}saveFolderSharedConfig(e){ar.existsSync(this.environmentsPath)||ar.mkdirSync(this.environmentsPath,{recursive:!0});let r={variables:e.globalVariables||{},defaultHeaders:e.defaultHeaders||{}};this.saveJsonFile(this.sharedConfigPath,r);let n=ar.readdirSync(this.environmentsPath).filter(s=>s.endsWith(".json")).filter(s=>!If(s)),i=new Set(Object.keys(e.environments||{}));for(let s of n){let o=Cn.basename(s,".json");if(!i.has(o))try{ar.unlinkSync(Cn.join(this.environmentsPath,s))}catch{}}for(let[s,o]of Object.entries(e.environments||{})){let l={name:s,description:o.description,requiresConfirmation:o.requiresConfirmation,variables:o.variables||{}};this.saveJsonFile(Cn.join(this.environmentsPath,`${s}.json`),l)}}reload(){this.sharedConfig=null,this.localConfig=null,this.loadConfigs()}getAllEnvironments(){return this.loadConfigs(),this.sharedConfig?Object.entries(this.sharedConfig.environments).map(([e,r])=>({id:e,name:e,active:e===this.selectedEnvironment,variables:r.variables||{}})):[]}async setActiveEnvironment(e){await this.setSelectedEnvironment(e)}async createEnvironment(e){if(this.loadConfigs(),this.sharedConfig||(this.sharedConfig={environments:{},globalVariables:{}}),this.sharedConfig.environments[e])throw new Error(`Environment "${e}" already exists`);this.sharedConfig.environments[e]={description:`Created ${new Date().toISOString()}`,variables:{}},this.saveSharedConfig(this.sharedConfig)}async deleteEnvironment(e){if(this.loadConfigs(),this.validateConfigLoaded(),this.validateEnvironmentExists(e),delete this.sharedConfig.environments[e],this.selectedEnvironment===e){let r=Object.keys(this.sharedConfig.environments);this.selectedEnvironment=r.length>0?r[0]:"dev",await this.workspaceStore?.update(bd.SELECTED_ENVIRONMENT,this.selectedEnvironment)}this.saveSharedConfig(this.sharedConfig)}async duplicateEnvironment(e,r){this.loadConfigs(),this.validateConfigLoaded(),this.validateEnvironmentName(r),this.validateEnvironmentExists(e),this.validateEnvironmentNameNotTaken(r);let n=this.sharedConfig.environments[e];this.sharedConfig.environments[r]=JSON.parse(JSON.stringify(n)),this.sharedConfig.environments[r].description=`Copied from ${e}`,this.saveSharedConfig(this.sharedConfig)}async renameEnvironment(e,r){this.loadConfigs(),this.validateConfigLoaded(),this.validateEnvironmentName(r),this.validateEnvironmentExists(e),r!==e&&(this.validateEnvironmentNameNotTaken(r),this.sharedConfig.environments[r]=this.sharedConfig.environments[e],delete this.sharedConfig.environments[e],this.selectedEnvironment===e&&(this.selectedEnvironment=r,await this.workspaceStore?.update(bd.SELECTED_ENVIRONMENT,r)),this.saveSharedConfig(this.sharedConfig))}validateEnvironmentName(e){if(!e||e.trim().length===0)throw new Error("Environment name cannot be empty");if(e.length>128)throw new Error("Environment name cannot exceed 128 characters");if(!/^[a-zA-Z0-9_\-\.]+$/.test(e))throw new Error("Environment name can only contain letters, numbers, hyphens, underscores, and dots")}validateEnvironmentExists(e){if(!this.sharedConfig?.environments?.[e])throw new Error(`Environment "${e}" not found`)}validateEnvironmentNameNotTaken(e){if(this.sharedConfig?.environments?.[e])throw new Error(`Environment "${e}" already exists`)}validateConfigLoaded(){if(!this.sharedConfig)throw new Error("No environment configuration loaded")}async updateEnvironmentVariables(e,r){if(this.loadConfigs(),!this.sharedConfig)throw new Error("No configuration loaded");let n=this.sharedConfig.environments[e];if(!n)throw new Error(`Environment "${e}" not found`);n.variables=r,this.saveSharedConfig(this.sharedConfig)}loadJsonFile(e){try{if(!ar.existsSync(e))return null;let r=ar.readFileSync(e,"utf-8");return JSON.parse(r)}catch(r){return console.error(`Failed to load JSON from ${e}:`,r),null}}saveJsonFile(e,r){try{let n=Cn.dirname(e);ar.existsSync(n)||ar.mkdirSync(n,{recursive:!0}),ar.writeFileSync(e,JSON.stringify(r,null,2),"utf-8")}catch(n){throw console.error(`Failed to save JSON to ${e}:`,n),n}}}});var As,sg=ae(()=>{"use strict";hd();As=class t{constructor(e,r,n,i,s,o,l,c,d,p,m,y,b){this.httpService=e;this.scriptExecutor=r;this.envConfigService=n;this.requestPreparer=i;this.environment=s;this.cookieJar=o;this.collectionScripts=l;this.folderScriptsChain=c;this.onConsoleOutput=d;this.collectionName=p;this.collectionAuth=m;this.iteration=y;this.iterationCount=b}httpService;scriptExecutor;envConfigService;requestPreparer;environment;cookieJar;collectionScripts;folderScriptsChain;onConsoleOutput;collectionName;collectionAuth;iteration;iterationCount;async execute(e,r,n){let i=Date.now();return this.executeWithSession(e,r,n,i)}async executeWithSession(e,r,n,i){let s=this.collectPreRequestScripts(e),o=this.collectPostResponseScripts(e),l=this.envConfigService.getResolvedEnvironment(this.environment);if(!l)throw new Error(`Environment "${this.environment}" not found or not configured`);let c=this.envConfigService.getGlobalVariables(),d={request:e,variables:{...r},environmentVariables:l.variables||{},globals:{...c},environmentName:this.environment,cookieJar:this.cookieJar,info:{eventName:"prerequest",requestName:e.name,requestId:e.id,collectionName:this.collectionName,iteration:this.iteration,iterationCount:this.iterationCount},onEnvironmentChange:async(y,b,q)=>{y==="set"&&b&&q!==void 0?this.envConfigService.setEnvironmentVariable(b,q,this.environment):y==="unset"&&b?this.envConfigService.deleteEnvironmentVariable(b,this.environment):y==="clear"&&this.envConfigService.clearEnvironmentVariables(this.environment)},onGlobalsChange:(y,b,q)=>{y==="set"&&b&&q!==void 0?this.envConfigService.setGlobalVariable(b,q):y==="unset"&&b?this.envConfigService.deleteGlobalVariable(b):y==="clear"&&this.envConfigService.clearGlobalVariables()}},p=this.scriptExecutor.createRequestSession(d),m=null;try{let y={...r},b={...e},q;if((!b.auth||b.auth.type==="inherit")&&(b.auth=this.collectionAuth&&this.collectionAuth.type!=="inherit"?this.collectionAuth:void 0),s.length>0){let D=await p.executePreRequest(s);if(D.consoleOutput&&D.consoleOutput.length>0&&this.onConsoleOutput?.(D.consoleOutput,{requestName:e.name||"",phase:"pre-request"}),D.nextRequest!==void 0&&(q=D.nextRequest),D.skipRequest){let J={type:"none",content:null};return{requestId:e.id,name:e.name,executedRequest:{url:e.url||"",method:e.method||"GET",headers:{},body:J,params:{},query:{}},response:{status:0,statusText:"Skipped",headers:{},body:null,time:0,cookies:[]},duration:Date.now()-i,timestamp:Date.now(),passed:!0,assertions:[],modifiedVariables:y,nextRequest:q}}D.success&&(D.modifiedRequest&&(D.modifiedRequest.url&&(b.url=D.modifiedRequest.url),D.modifiedRequest.headers&&(b.headers=D.modifiedRequest.headers),D.modifiedRequest.params&&(b.params=D.modifiedRequest.params),D.modifiedRequest.query&&(b.query=D.modifiedRequest.query),D.modifiedRequest.body!==void 0&&(b.body=D.modifiedRequest.body)),(D.localVariables??D.modifiedVariables)&&(y=D.localVariables??D.modifiedVariables))}m=await this.requestPreparer.prepareRequest(b,this.environment,l,y);let{url:C,headers:v,body:_,method:E}=m,k={};for(let D in v)Object.prototype.hasOwnProperty.call(v,D)&&(k[D.toUpperCase()]=v[D]);if(!k.COOKIE&&b.settings?.includeCookies!==!1&&this.cookieJar){let J=this.cookieJar.getCookieHeader(C);J&&(k.COOKIE=J)}let O={method:E,url:C,headers:k,body:_.content,signal:n,settings:b.settings?{...b.settings}:void 0},M=await this.httpService.execute(O);this.cookieJar&&M.headers&&await this.cookieJar.setCookiesFromResponse(C,M.headers);let j=Date.now()-i,I=[],R={},A;if(o.length>0){let D=0;if(M.body)if(typeof M.body=="string")D=Buffer.byteLength(M.body,"utf8");else if(Buffer.isBuffer(M.body))D=M.body.length;else try{D=Buffer.byteLength(JSON.stringify(M.body),"utf8")}catch{D=0}let J=Qm(M.headers,M.cookies,m.url),Q={executedRequest:m,status:M.status,statusText:M.statusText,headers:Km(M.headers||{}),body:M.body,cookies:J,responseTime:M.time,responseSize:D},se=await p.executePostResponse(o,Q);I=se.testResults,R=se.modifiedEnvironmentVariables||{},A=se.visualizerData,(se.localVariables??se.modifiedVariables)&&(y=se.localVariables??se.modifiedVariables),se.nextRequest!==void 0&&(q=se.nextRequest),se.consoleOutput&&se.consoleOutput.length>0&&this.onConsoleOutput?.(se.consoleOutput,{requestName:e.name||"",phase:"post-response"})}let F=I.length===0||I.every(D=>D.passed),U=I.length>0?F:M.status>=200&&M.status<=302;return{requestId:e.id,name:e.name,executedRequest:{...m,headers:k},response:{status:M.status,statusText:M.statusText,headers:M.headers||{},body:M.body,time:M.time||j,cookies:M.cookies||[]},duration:j,timestamp:Date.now(),passed:U,assertions:I,modifiedVariables:y,modifiedEnvironmentVariables:R,nextRequest:q,visualizerData:A}}catch(y){return this.handleError(e,m,y,i)}finally{p.dispose?.()}}collectPreRequestScripts(e){let r=[];if(this.collectionScripts?.preRequest&&r.push(this.collectionScripts.preRequest),this.folderScriptsChain)if(Array.isArray(this.folderScriptsChain))for(let n of this.folderScriptsChain)n?.preRequest&&r.push(n.preRequest);else this.folderScriptsChain.preRequest&&r.push(this.folderScriptsChain.preRequest);return e.scripts?.preRequest&&r.push(e.scripts.preRequest),r}collectPostResponseScripts(e){let r=[];if(e.scripts?.postResponse&&r.push(e.scripts.postResponse),this.folderScriptsChain)if(Array.isArray(this.folderScriptsChain)){let n=[...this.folderScriptsChain].reverse();for(let i of n)i?.postResponse&&r.push(i.postResponse)}else this.folderScriptsChain.postResponse&&r.push(this.folderScriptsChain.postResponse);return this.collectionScripts?.postResponse&&r.push(this.collectionScripts.postResponse),r}handleError(e,r,n,i){let s=Date.now()-i,o=r?.method||e.method,l=r?.url||e.url;this.onConsoleOutput?.([`${n.message||n}`],{requestName:e.name||"",phase:"error"});let c=String(n.name==="AbortError"?"Request was aborted":n.message||n),d=n?.stack?String(n.stack):"",p=this.errorBodyFormat,m,y;p==="html"||p==="both"?(m=t.formatErrorAsHtml(c,d),y={"content-type":"text/html; charset=utf-8"}):(m=c,y={});let b={type:"none",content:null};return{requestId:e.id,name:e.name,executedRequest:{url:l||"",method:o||"GET",headers:r?.headers||{},body:r?.body||b,params:r?.params||{},query:r?.query||{}},response:{status:0,statusText:n.name==="AbortError"?"Aborted":n.code||n.message||"Request Error",headers:y,cookies:[],body:m,time:0},duration:s,timestamp:Date.now(),passed:!1,assertions:[],error:c}}get errorBodyFormat(){return"text"}static formatErrorAsHtml(e,r){let n=i=>i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");return`<!doctype html>
|
|
56
56
|
<html>
|
|
57
57
|
<body style="font-family:system-ui,Segoe UI,Roboto,-apple-system,Helvetica,Arial,sans-serif;padding:12px;color:#c7254e;">
|
|
58
58
|
<h2 style="margin-top:0;color:#a94442">Request Error</h2>
|
|
@@ -61,7 +61,7 @@ ${i}
|
|
|
61
61
|
${n(r)}
|
|
62
62
|
</pre>`:""}
|
|
63
63
|
</body>
|
|
64
|
-
</html>`}}});var ic,o_=ae(()=>{"use strict";Un();ic=class{constructor(e,r,n,i,s,o){this.envConfigService=e;this.httpService=r;this.preprocessor=n;this.tokenManager=i;this.appInfo=s;this.secretRegistry=o}envConfigService;httpService;preprocessor;tokenManager;appInfo;secretRegistry;async prepareRequest(e,r,n,i){if(this.secretRegistry?.hasProviders){let _=await this.secretRegistry.resolveSecretTokens(e);Object.keys(_).length>0&&(i={..._,...i??{}})}let s=i&&Object.keys(i).length>0,o=s?this.envConfigService.resolveVariablesInObjectWithExtra(e.params||{},i,r):this.envConfigService.resolveVariablesInObject(e.params||{},r),l=s?this.envConfigService.resolveVariablesInObjectWithExtra(e.query||{},i,r):this.envConfigService.resolveVariablesInObject(e.query||{},r),c=gu(n?.headers||{},e.headers||{}),d=s?this.envConfigService.resolveVariablesInObjectWithExtra(c,i,r):this.envConfigService.resolveVariablesInObject(c,r);if(d=this.preprocessor.sanitizeHeaders(d),!Object.keys(d).some(_=>_.toLowerCase()==="user-agent")){let _=this.appInfo?.version||"0.0.0",
|
|
64
|
+
</html>`}}});var ic,o_=ae(()=>{"use strict";Un();ic=class{constructor(e,r,n,i,s,o){this.envConfigService=e;this.httpService=r;this.preprocessor=n;this.tokenManager=i;this.appInfo=s;this.secretRegistry=o}envConfigService;httpService;preprocessor;tokenManager;appInfo;secretRegistry;async prepareRequest(e,r,n,i){if(this.secretRegistry?.hasProviders){let _=await this.secretRegistry.resolveSecretTokens(e);Object.keys(_).length>0&&(i={..._,...i??{}})}let s=i&&Object.keys(i).length>0,o=s?this.envConfigService.resolveVariablesInObjectWithExtra(e.params||{},i,r):this.envConfigService.resolveVariablesInObject(e.params||{},r),l=s?this.envConfigService.resolveVariablesInObjectWithExtra(e.query||{},i,r):this.envConfigService.resolveVariablesInObject(e.query||{},r),c=gu(n?.headers||{},e.headers||{}),d=s?this.envConfigService.resolveVariablesInObjectWithExtra(c,i,r):this.envConfigService.resolveVariablesInObject(c,r);if(d=this.preprocessor.sanitizeHeaders(d),!Object.keys(d).some(_=>_.toLowerCase()==="user-agent")){let _=this.appInfo?.version||"0.0.0",E=this.appInfo?.name||"HttpForge";d["User-Agent"]=`${E}/${_}`}if(e.auth?.type==="bearer"&&e.auth.bearerToken){let _=s?this.envConfigService.resolveVariablesWithExtra(e.auth.bearerToken,i,r):this.envConfigService.resolveVariables(e.auth.bearerToken,r);d.Authorization=`Bearer ${_}`}if(e.auth?.type==="basic"&&e.auth.basicAuth){let _=s?this.envConfigService.resolveVariablesWithExtra(e.auth.basicAuth.username||"",i,r):this.envConfigService.resolveVariables(e.auth.basicAuth.username||"",r),E=s?this.envConfigService.resolveVariablesWithExtra(e.auth.basicAuth.password||"",i,r):this.envConfigService.resolveVariables(e.auth.basicAuth.password||"",r),k=Buffer.from(`${_}:${E}`).toString("base64");d.Authorization=`Basic ${k}`}e.auth?.type==="apikey"&&e.auth.apikey&&this.applyApiKey(e.auth.apikey,d,l,r,i),e.auth?.type==="oauth2"&&e.auth.oauth2&&await this.applyOAuth2(e.auth.oauth2,d,r);let m=null;if(e.body&&e.body.type!=="none"){let _=i&&Object.keys(i).length>0?this.envConfigService.resolveVariablesInObjectWithExtra(e.body.content,i,r):this.envConfigService.resolveVariablesInObject(e.body.content,r);if((e.body.format==="json"||e.body.type==="graphql")&&typeof _=="string")try{_=JSON.parse(_)}catch{e.body.format==="json"&&console.warn("[RequestPreparer] Failed to parse JSON body after variable resolution, keeping as string")}let E={type:e.body.type,format:e.body.format,content:_};e.body.type==="form-data"?m=this.buildMultipartFormData(E.content):m=this.preprocessor.encodeBody(E)}e.body?.type!=="form-data"&&this.preprocessor.setContentTypeHeader(d,e.body,e.bodyContentType);let y=e.method||"GET",b=e.url||"",q=i&&Object.keys(i).length>0?this.envConfigService.resolveVariablesWithExtra(b,i,r):this.envConfigService.resolveVariables(b,r),C=this.httpService.buildUrl(q,o,l),v={type:e.body?.type||"none",format:e.body?.format,content:m};return{url:C,method:y,headers:d,body:v,params:o,query:l}}async applyOAuth2(e,r,n){if(e.accessToken){let s=this.envConfigService.resolveVariables(e.accessToken,n),o=e.tokenPrefix||"Bearer";r.Authorization=`${o} ${s}`;return}if(!this.tokenManager)throw new Error("OAuth2 authentication requires IOAuth2TokenManager. Ensure the service is properly registered.");let i=await this.tokenManager.getToken(e,n);r.Authorization=`${i.tokenType} ${i.accessToken}`}applyApiKey(e,r,n,i,s){if(!e||!e.key)return;let o=s&&Object.keys(s).length>0,l=o?this.envConfigService.resolveVariablesWithExtra(e.key||"",s,i):this.envConfigService.resolveVariables(e.key||"",i),c=o?this.envConfigService.resolveVariablesWithExtra(e.value||"",s,i):this.envConfigService.resolveVariables(e.value||"",i);(e.in||"header").toLowerCase()==="query"?n[l]=c:r[l]=c}buildMultipartFormData(e){if(!Array.isArray(e))return;let r=new FormData;for(let n of e)!n?.key||n.enabled===!1||r.append(n.key,n.value==null?"":String(n.value));return r}}});var Gz,sc,a_=ae(()=>{"use strict";Gz=`
|
|
65
65
|
query IntrospectionQuery {
|
|
66
66
|
__schema {
|
|
67
67
|
queryType { name }
|
|
@@ -94,16 +94,16 @@ fragment TypeRef on __Type {
|
|
|
94
94
|
`))return Yz(e)}return t}function ug(t){return{...t,sentRequest:{...t.sentRequest,url:wd(t.sentRequest.url),headers:gi(t.sentRequest.headers),body:t.sentRequest.body!=null?lg(t.sentRequest.body):t.sentRequest.body}}}function cg(t){return{...t,headers:gi(t.headers),cookies:t.cookies.map(e=>e&&typeof e=="object"&&e.name&&xn.test(e.name)?{...e,value:Ao}:e)}}function fg(t){return{...t,url:wd(t.url),request:{...t.request,url:wd(t.request.url),headers:gi(t.request.headers),query:gi(t.request.query),params:gi(t.request.params),body:t.request.body!=null?lg(t.request.body):t.request.body},response:{headers:gi(t.response.headers),body:t.response.body,time:t.response.time,size:t.response.size,cookies:t.response.cookies?u_(t.response.cookies):t.response.cookies}}}function Or(t){return typeof t=="string"&&Kz.test(t)}function PP(t){let e=[];if(t.url)try{let r=new URL(t.url.includes("://")?t.url:`http://placeholder${t.url.startsWith("/")?"":"/"}${t.url}`);for(let[n,i]of r.searchParams)xn.test(n)&&i&&!Or(i)&&e.push({location:"url",field:n,message:`URL query parameter "${n}" contains a hardcoded value. Use a {{variable}} instead.`})}catch{}if(t.headers){let r=Array.isArray(t.headers)?t.headers.filter(n=>n.enabled!==!1).map(n=>[n.key,n.value]):Object.entries(t.headers);for(let[n,i]of r)l_.test(n)&&i&&!Or(i)&&e.push({location:"header",field:n,message:`Header "${n}" contains a hardcoded value. Use a {{variable}} instead (e.g. {{${n.toLowerCase().replace(/[^a-z0-9]/g,"_")}}})`})}if(t.query){let r=Array.isArray(t.query)?t.query.filter(n=>n.enabled!==!1).map(n=>[n.key,n.value]):Object.entries(t.query);for(let[n,i]of r)xn.test(n)&&i&&!Or(i)&&e.push({location:"query",field:n,message:`Query parameter "${n}" contains a hardcoded value. Use a {{variable}} instead.`})}if(t.auth){let r=t.auth;if(r.bearerToken&&!Or(r.bearerToken)&&e.push({location:"auth",field:"bearerToken",message:"Bearer token contains a hardcoded value. Store it in a {{variable}} in your .local.json environment file."}),r.basicAuth&&r.basicAuth.password&&!Or(r.basicAuth.password)&&e.push({location:"auth",field:"basicAuth.password",message:"Basic auth password contains a hardcoded value. Use a {{variable}} instead."}),r.apikey||r.apiKey){let n=r.apikey||r.apiKey;n.value&&!Or(n.value)&&e.push({location:"auth",field:"apiKey.value",message:"API key contains a hardcoded value. Use a {{variable}} instead."})}}if(t.body){let r=typeof t.body=="object"&&"content"in t.body?t.body.content:t.body;r&&og(r,e)}return e}function og(t,e){if(t!=null){if(typeof t=="string"){let r=t.trim();if(r.startsWith("{")||r.startsWith("[")){try{og(JSON.parse(r),e)}catch{}return}if(r.includes("=")&&!r.includes(`
|
|
95
95
|
`)){try{let n=new URLSearchParams(r);for(let[i,s]of n)xn.test(i)&&s&&!Or(s)&&e.push({location:"body",field:i,message:`Form field "${i}" contains a hardcoded value. Use a {{variable}} instead.`})}catch{}return}return}if(Array.isArray(t)){t.forEach(r=>og(r,e));return}if(typeof t=="object")for(let[r,n]of Object.entries(t))xn.test(r)&&n&&typeof n=="string"&&!Or(n)?e.push({location:"body",field:r,message:`Body field "${r}" contains a hardcoded value. Use a {{variable}} instead.`}):typeof n=="object"&&n!==null&&og(n,e)}}function Za(t){return t.replace(/\./g,"_").replace(/[^a-zA-Z0-9_]/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,"").toLowerCase()}function kP(t){let e=[],r=new Set;function n(i){let s=i,o=2;for(;r.has(s);)s=`${i}_${o++}`;return r.add(s),s}if(t.url)try{let i=new URL(t.url.includes("://")?t.url:`http://placeholder${t.url.startsWith("/")?"":"/"}${t.url}`);for(let[s,o]of i.searchParams)xn.test(s)&&o&&!Or(o)&&e.push({location:"url",field:s,value:o,variableName:n(Za(s))})}catch{}if(t.headers){let i=Array.isArray(t.headers)?t.headers.filter(s=>s.enabled!==!1).map(s=>[s.key,s.value]):Object.entries(t.headers);for(let[s,o]of i)l_.test(s)&&o&&!Or(o)&&e.push({location:"header",field:s,value:o,variableName:n(Za(s))})}if(t.query){let i=Array.isArray(t.query)?t.query.filter(s=>s.enabled!==!1).map(s=>[s.key,s.value]):Object.entries(t.query);for(let[s,o]of i)xn.test(s)&&o&&!Or(o)&&e.push({location:"query",field:s,value:o,variableName:n(Za(s))})}if(t.auth){let i=t.auth;if(i.bearerToken&&!Or(i.bearerToken)&&e.push({location:"auth",field:"bearerToken",value:i.bearerToken,variableName:n("bearer_token")}),i.basicAuth&&i.basicAuth.password&&!Or(i.basicAuth.password)&&e.push({location:"auth",field:"basicAuth.password",value:i.basicAuth.password,variableName:n("basic_auth_password")}),i.apikey||i.apiKey){let s=i.apikey||i.apiKey;s.value&&!Or(s.value)&&e.push({location:"auth",field:"apiKey.value",value:s.value,variableName:n("api_key")})}}if(t.body){let i=typeof t.body=="object"&&"content"in t.body?t.body.content:t.body;i&&ag(i,e,r,"")}return e}function ag(t,e,r,n){if(t!=null){if(typeof t=="string"){let i=t.trim();if(i.startsWith("{")||i.startsWith("[")){try{ag(JSON.parse(i),e,r,n)}catch{}return}if(i.includes("=")&&!i.includes(`
|
|
96
96
|
`)){try{let s=new URLSearchParams(i);for(let[o,l]of s)if(xn.test(o)&&l&&!Or(l)){let c=Za(o),d=2;for(;r.has(c);)c=`${Za(o)}_${d++}`;r.add(c),e.push({location:"body",field:o,path:n?`${n}.${o}`:o,value:l,variableName:c})}}catch{}return}return}if(Array.isArray(t)){t.forEach((i,s)=>ag(i,e,r,`${n}[${s}]`));return}if(typeof t=="object")for(let[i,s]of Object.entries(t)){let o=n?`${n}.${i}`:i;if(xn.test(i)&&s&&typeof s=="string"&&!Or(s)){let l=Za(i),c=2;for(;r.has(l);)l=`${Za(i)}_${c++}`;r.add(l),e.push({location:"body",field:i,path:o,value:s,variableName:l})}else typeof s=="object"&&s!==null&&ag(s,e,r,o)}}}function AP(t,e){let r=JSON.parse(JSON.stringify(t));for(let n of e){let i=`{{${n.variableName}}}`;switch(n.location){case"url":r.url&&(r.url=r.url.replace(new RegExp(`([?&])${Zz(n.field)}=[^&]*`),`$1${n.field}=${i}`));break;case"header":if(Array.isArray(r.headers)){let s=r.headers.find(o=>o.key===n.field&&o.value===n.value);s&&(s.value=i)}else r.headers&&r.headers[n.field]===n.value&&(r.headers[n.field]=i);break;case"query":if(Array.isArray(r.query)){let s=r.query.find(o=>o.key===n.field&&o.value===n.value);s&&(s.value=i)}else r.query&&r.query[n.field]===n.value&&(r.query[n.field]=i);break;case"auth":if(r.auth){if(n.field==="bearerToken")r.auth.bearerToken=i;else if(n.field==="basicAuth.password"&&r.auth.basicAuth)r.auth.basicAuth.password=i;else if(n.field==="apiKey.value"){let s=r.auth.apikey||r.auth.apiKey;s&&(s.value=i)}}break;case"body":Qz(r,n.field,n.path,n.value,i);break}}return r}function Qz(t,e,r,n,i){let s=typeof t.body=="object"&&t.body!==null&&"content"in t.body?t.body:null,o=s?s.content:t.body;if(o){if(typeof o=="string"){let l=o.trim();if(l.startsWith("{")||l.startsWith("[")){try{let c=JSON.parse(l);IP(c,e,r||e,n,i);let d=JSON.stringify(c,null,2);s?s.content=d:t.body=d}catch{}return}if(l.includes("=")&&!l.includes(`
|
|
97
|
-
`)){let c=new URLSearchParams(l);if(c.get(e)===n){c.set(e,i);let d=c.toString();s?s.content=d:t.body=d}return}return}typeof o=="object"&&o!==null&&IP(o,e,r||e,n,i)}}function IP(t,e,r,n,i){let s=r.split("."),o=t;for(let c=0;c<s.length-1;c++){let d=s[c],p=d.match(/^(.+)\[(\d+)\]$/);if(p?o=o?.[p[1]]?.[parseInt(p[2])]:o=o?.[d],o==null)return}let l=s[s.length-1];o&&o[l]===n&&(o[l]=i)}function Zz(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Ao,l_,xn,Kz,_d=ae(()=>{"use strict";Ao="***",l_=/^(authorization|proxy-authorization|www-authenticate)$|(token|cookie|secret|credential|api[_\-]?key|bearer|session[_\-]?id)/i,xn=/(password|passwd|pwd|token|cookie|secret|credential|api[_\-]?key|apikey|access[_\-]?token|refresh[_\-]?token|client[_\-]?secret|private[_\-]?key|auth[_\-]?code|bearer|session[_\-]?id|jwt)/i;Kz=/\{\{[^}]+\}\}/});var Ue,an,oc,c_=ae(()=>{"use strict";Ue=ve(require("fs")),an=ve(require("path"));Un();_d();oc=class{historyPath;sharedHistoryPath;constructor(e,r){this.historyPath=e,this.sharedHistoryPath=r}getEnvironmentHistoryPath(e){return an.join(this.historyPath,Ht(e))}getCollectionHistoryPath(e,r){return an.join(this.getEnvironmentHistoryPath(e),r)}getRequestPath(e,r,n){return an.join(this.getCollectionHistoryPath(e,r),Ht(n))}getSharedEnvironmentHistoryPath(e){return an.join(this.sharedHistoryPath,Ht(e))}getSharedCollectionHistoryPath(e,r){return an.join(this.getSharedEnvironmentHistoryPath(e),r)}getSharedRequestPath(e,r,n){return an.join(this.getSharedCollectionHistoryPath(e,r),Ht(n))}getHistoryFilePath(e,r,n){return an.join(this.getRequestPath(e,r,n),"transactions.json")}getSharedHistoryFilePath(e,r,n){return an.join(this.getSharedRequestPath(e,r,n),"transactions.json")}getResponseFilePath(e,r,n,i){return an.join(this.getRequestPath(e,r,n),`${i}.json`)}getSharedResponseFilePath(e,r,n,i){return an.join(this.getSharedRequestPath(e,r,n),`${i}.json`)}loadHistory(e,r,n){let i=this.getHistoryFilePath(e,r,n);try{if(!Ue.existsSync(i))return null;let s=Ue.readFileSync(i,"utf-8"),o=JSON.parse(s);return{environment:e||o.environment,requestPath:r||o.requestPath,requestId:n||o.requestId,method:o.method,requests:o.requests}}catch(s){return console.error(`Failed to load history for ${n}:`,s),null}}loadSharedHistory(e,r,n){let i=this.getSharedHistoryFilePath(e,r,n);try{if(!Ue.existsSync(i))return null;let s=Ue.readFileSync(i,"utf-8"),o=JSON.parse(s);return{environment:e||o.environment,requestPath:r||o.requestPath,requestId:n||o.requestId,method:o.method,requests:o.requests}}catch(s){return console.error(`Failed to load shared history for ${n}:`,s),null}}getEntriesForEnvironment(e,r,n){let i=this.loadHistory(e,r,n);return i?i.requests:[]}getEntriesGroupedByTicket(e,r,n){let i=this.getEntriesForEnvironment(e,r,n),s=new Map;for(let o of i){let l=o.ticket||o.branch||"";s.has(l)||s.set(l,[]),s.get(l).push(o)}return s}getSharedEntriesGroupedByTicket(e,r,n){let i=this.loadSharedHistory(e,r,n)?.requests??[],s=new Map;for(let o of i){let l=o.ticket||o.branch||"";s.has(l)||s.set(l,[]),s.get(l).push(o)}return s}saveHistory(e){let r=this.getRequestPath(e.environment,e.requestPath,e.requestId),n=this.getHistoryFilePath(e.environment,e.requestPath,e.requestId);try{Ue.existsSync(r)||Ue.mkdirSync(r,{recursive:!0}),Ue.writeFileSync(n,JSON.stringify(e,null,2),"utf-8")}catch(i){throw console.error(`Failed to save history for ${e.requestId}:`,i),i}}saveSharedHistory(e){let r=this.getSharedRequestPath(e.environment,e.requestPath,e.requestId),n=this.getSharedHistoryFilePath(e.environment,e.requestPath,e.requestId);try{Ue.existsSync(r)||Ue.mkdirSync(r,{recursive:!0}),Ue.writeFileSync(n,JSON.stringify(e,null,2),"utf-8")}catch(i){throw console.error(`Failed to save shared history for ${e.requestId}:`,i),i}}addEntry(e,r,n,i,s){let o=this.loadHistory(e,r,n);o||(o={environment:e,requestPath:r,requestId:n,method:i,requests:[]});let l=ug({...s,method:i,id:Qh(),timestamp:Date.now()});return o.requests.unshift(l),o.requests.length>100&&(o.requests=o.requests.slice(0,100)),this.saveHistory(o),l}deleteEntry(e,r,n,i){let s=this.loadHistory(e,r,n);if(!s)return!1;let o=s.requests.length;if(s.requests=s.requests.filter(l=>l.id!==i),s.requests.length!==o){this.saveHistory(s);let l=this.getResponseFilePath(e,r,n,i);return Ue.existsSync(l)&&Ue.unlinkSync(l),!0}return!1}deleteSharedEntry(e,r,n,i){let s=this.loadSharedHistory(e,r,n);if(!s)return!1;let o=s.requests.length;if(s.requests=s.requests.filter(l=>l.id!==i),s.requests.length!==o){this.saveSharedHistory(s);let l=this.getSharedResponseFilePath(e,r,n,i);return Ue.existsSync(l)&&Ue.unlinkSync(l),!0}return!1}shareEntry(e,r,n,i,s){let o=(s||"").trim();if(!o)return!1;let l=this.loadHistory(e,r,n);if(!l)return!1;let c=l.requests.findIndex(b=>b.id===i);if(c===-1)return!1;let[d]=l.requests.splice(c,1);this.saveHistory(l);let p=this.loadSharedHistory(e,r,n)||{environment:e,requestPath:r,requestId:n,method:l.method,requests:[]};if(!p.requests.some(b=>b.id===i)){let b={...d,ticket:null,branch:o};p.requests.unshift(b),p.requests.length>100&&(p.requests=p.requests.slice(0,100)),this.saveSharedHistory(p)}let m=this.getResponseFilePath(e,r,n,i),y=this.getSharedResponseFilePath(e,r,n,i);if(Ue.existsSync(m)){let b=an.dirname(y);Ue.existsSync(b)||Ue.mkdirSync(b,{recursive:!0});try{Ue.renameSync(m,y)}catch{try{Ue.copyFileSync(m,y)}catch(C){return console.error(`Failed to copy full response from ${m} to ${y}:`,C),!0}try{Ue.unlinkSync(m)}catch(C){console.warn(`Failed to remove original full response after copy: ${m}`,C)}}}return!0}moveSharedEntry(e,r,n,i,s){let o=(s||"").trim();if(!o)return!1;let l=this.loadSharedHistory(e,r,n);if(!l)return!1;let c=!1;return l.requests=l.requests.map(d=>d.id===i?(c=!0,{...d,ticket:null,branch:o}):d),c?(this.saveSharedHistory(l),!0):!1}renameSharedGroup(e,r,n,i,s){let o=(i||"").trim(),l=(s||"").trim();if(!o||!l||o===l)return!1;let c=this.loadSharedHistory(e,r,n);if(!c)return!1;let d=!1;return c.requests=c.requests.map(p=>!p.ticket&&p.branch===o?(d=!0,{...p,branch:l}):p),d?(this.saveSharedHistory(c),!0):!1}clearHistory(e,r,n){let i=this.getRequestPath(e,r,n);if(Ue.existsSync(i)){let s=Ue.readdirSync(i);for(let o of s)Ue.unlinkSync(an.join(i,o));Ue.rmdirSync(i)}}saveFullResponse(e,r,n,i,s){let o=this.getRequestPath(e,r,n),l=this.getResponseFilePath(e,r,n,i);try{Ue.existsSync(o)||Ue.mkdirSync(o,{recursive:!0});let c=cg(s);Ue.writeFileSync(l,JSON.stringify(c,null,2),"utf-8")}catch(c){throw console.error(`Failed to save full response for ${i}:`,c),c}}loadFullResponse(e,r,n,i){let s=this.getResponseFilePath(e,r,n,i);try{if(!Ue.existsSync(s))return null;let o=Ue.readFileSync(s,"utf-8");return JSON.parse(o)}catch(o){return console.error(`Failed to load full response for ${i}:`,o),null}}loadSharedFullResponse(e,r,n,i){let s=this.getSharedResponseFilePath(e,r,n,i);try{if(!Ue.existsSync(s))return null;let o=Ue.readFileSync(s,"utf-8");return JSON.parse(o)}catch(o){return console.error(`Failed to load shared full response for ${i}:`,o),null}}}});var Xa,f_=ae(()=>{"use strict";Xa=class{constructor(e,r){this.historyService=e;this.inferrer=r}historyService;inferrer;async analyze(e,r,n){let i=n?.environment||"default",s=n?.maxSamples||50,o=this.historyService.loadHistory(i,e,r),l=this.historyService.loadSharedHistory(i,e,r),c=[...o?.requests||[],...l?.requests||[]];if(c.length===0)return{responses:{}};let d=c.slice(0,s),p=new Map;for(let y of d){let b=this.historyService.loadFullResponse(i,e,r,y.id);if(b||(b=this.historyService.loadSharedFullResponse(i,e,r,y.id)),b){let E=b.status;p.has(E)||p.set(E,[]),p.get(E).push(b)}}let m={};for(let[y,b]of p){let E=this.buildResponseDefinition(b);m[String(y)]=E}return{responses:m}}buildResponseDefinition(e){let r={};if(e.length===0)return r;let n=e[0];r.description=n.statusText||`Status ${n.status}`;let i=this.extractContentType(n.headers);if(i&&(r.contentType=i),i&&this.isJsonContentType(i)){let o=this.inferBodySchema(n);for(let l=1;l<e.length;l++){let c=this.inferBodySchema(e[l]);c&&o?o=this.inferrer.mergeSchemas(o,c):c&&(o=c)}if(o&&(r.schema=o),n.body!==void 0&&n.body!==null){let l=typeof n.body=="string"?this.tryParseJson(n.body):n.body;l!==void 0&&(r.examples={default:{summary:"Captured from history",value:l}})}}let s=this.findConsistentHeaders(e);return Object.keys(s).length>0&&(r.headers=s),r}inferBodySchema(e){if(e.body===void 0||e.body===null)return;let r=e.body;if(!(typeof r=="string"&&(r=this.tryParseJson(r),r===void 0)))return this.inferrer.inferFromValue(r)}extractContentType(e){for(let[r,n]of Object.entries(e))if(r.toLowerCase()==="content-type")return(Array.isArray(n)?n[0]:n).split(";")[0].trim()}isJsonContentType(e){return e.includes("json")||e.includes("+json")||e==="application/json"}findConsistentHeaders(e){if(e.length===0)return{};let r=new Set(["content-type","content-length","content-encoding","transfer-encoding","connection","date","server","set-cookie","vary","cache-control","expires","pragma","etag","last-modified","age"]),n=new Map,i=new Map;for(let l of e)for(let[c,d]of Object.entries(l.headers)){let p=c.toLowerCase();r.has(p)||(n.set(p,(n.get(p)||0)+1),i.has(p)||i.set(p,Array.isArray(d)?d.join(", "):d))}let s=Math.ceil(e.length/2),o={};for(let[l,c]of n)if(c>=s){let d=i.get(l);o[l]={schema:this.inferHeaderSchema(d)}}return o}inferHeaderSchema(e){return e?/^\d+$/.test(e)?{type:"integer"}:{type:"string"}:{type:"string"}}tryParseJson(e){try{return JSON.parse(e)}catch{return}}}});var at=V(yr=>{"use strict";var d_=Symbol.for("yaml.alias"),TP=Symbol.for("yaml.document"),dg=Symbol.for("yaml.map"),$P=Symbol.for("yaml.pair"),p_=Symbol.for("yaml.scalar"),pg=Symbol.for("yaml.seq"),Ts=Symbol.for("yaml.node.type"),Xz=t=>!!t&&typeof t=="object"&&t[Ts]===d_,eJ=t=>!!t&&typeof t=="object"&&t[Ts]===TP,tJ=t=>!!t&&typeof t=="object"&&t[Ts]===dg,rJ=t=>!!t&&typeof t=="object"&&t[Ts]===$P,NP=t=>!!t&&typeof t=="object"&&t[Ts]===p_,nJ=t=>!!t&&typeof t=="object"&&t[Ts]===pg;function MP(t){if(t&&typeof t=="object")switch(t[Ts]){case dg:case pg:return!0}return!1}function iJ(t){if(t&&typeof t=="object")switch(t[Ts]){case d_:case dg:case p_:case pg:return!0}return!1}var sJ=t=>(NP(t)||MP(t))&&!!t.anchor;yr.ALIAS=d_;yr.DOC=TP;yr.MAP=dg;yr.NODE_TYPE=Ts;yr.PAIR=$P;yr.SCALAR=p_;yr.SEQ=pg;yr.hasAnchor=sJ;yr.isAlias=Xz;yr.isCollection=MP;yr.isDocument=eJ;yr.isMap=tJ;yr.isNode=iJ;yr.isPair=rJ;yr.isScalar=NP;yr.isSeq=nJ});var Rd=V(h_=>{"use strict";var lr=at(),ln=Symbol("break visit"),FP=Symbol("skip children"),Qi=Symbol("remove node");function hg(t,e){let r=DP(e);lr.isDocument(t)?ac(null,t.contents,r,Object.freeze([t]))===Qi&&(t.contents=null):ac(null,t,r,Object.freeze([]))}hg.BREAK=ln;hg.SKIP=FP;hg.REMOVE=Qi;function ac(t,e,r,n){let i=jP(t,e,r,n);if(lr.isNode(i)||lr.isPair(i))return LP(t,n,i),ac(t,i,r,n);if(typeof i!="symbol"){if(lr.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=ac(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===ln)return ln;o===Qi&&(e.items.splice(s,1),s-=1)}}}else if(lr.isPair(e)){n=Object.freeze(n.concat(e));let s=ac("key",e.key,r,n);if(s===ln)return ln;s===Qi&&(e.key=null);let o=ac("value",e.value,r,n);if(o===ln)return ln;o===Qi&&(e.value=null)}}return i}async function mg(t,e){let r=DP(e);lr.isDocument(t)?await lc(null,t.contents,r,Object.freeze([t]))===Qi&&(t.contents=null):await lc(null,t,r,Object.freeze([]))}mg.BREAK=ln;mg.SKIP=FP;mg.REMOVE=Qi;async function lc(t,e,r,n){let i=await jP(t,e,r,n);if(lr.isNode(i)||lr.isPair(i))return LP(t,n,i),lc(t,i,r,n);if(typeof i!="symbol"){if(lr.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=await lc(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===ln)return ln;o===Qi&&(e.items.splice(s,1),s-=1)}}}else if(lr.isPair(e)){n=Object.freeze(n.concat(e));let s=await lc("key",e.key,r,n);if(s===ln)return ln;s===Qi&&(e.key=null);let o=await lc("value",e.value,r,n);if(o===ln)return ln;o===Qi&&(e.value=null)}}return i}function DP(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function jP(t,e,r,n){if(typeof r=="function")return r(t,e,n);if(lr.isMap(e))return r.Map?.(t,e,n);if(lr.isSeq(e))return r.Seq?.(t,e,n);if(lr.isPair(e))return r.Pair?.(t,e,n);if(lr.isScalar(e))return r.Scalar?.(t,e,n);if(lr.isAlias(e))return r.Alias?.(t,e,n)}function LP(t,e,r){let n=e[e.length-1];if(lr.isCollection(n))n.items[t]=r;else if(lr.isPair(n))t==="key"?n.key=r:n.value=r;else if(lr.isDocument(n))n.contents=r;else{let i=lr.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}h_.visit=hg;h_.visitAsync=mg});var m_=V(HP=>{"use strict";var UP=at(),oJ=Rd(),aJ={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},lJ=t=>t.replace(/[!,[\]{}]/g,e=>aJ[e]),Cd=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[s,o]=n;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[s]=n;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return r(6,`Unsupported YAML version ${s}`,o),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let s=this.tags[n];if(s)try{return s+decodeURIComponent(i)}catch(o){return r(String(o)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+lJ(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&UP.isNode(e.contents)){let s={};oJ.visit(e.contents,(o,l)=>{UP.isNode(l)&&l.tag&&(s[l.tag]=!0)}),i=Object.keys(s)}else i=[];for(let[s,o]of n)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(l=>l.startsWith(o)))&&r.push(`%TAG ${s} ${o}`);return r.join(`
|
|
97
|
+
`)){let c=new URLSearchParams(l);if(c.get(e)===n){c.set(e,i);let d=c.toString();s?s.content=d:t.body=d}return}return}typeof o=="object"&&o!==null&&IP(o,e,r||e,n,i)}}function IP(t,e,r,n,i){let s=r.split("."),o=t;for(let c=0;c<s.length-1;c++){let d=s[c],p=d.match(/^(.+)\[(\d+)\]$/);if(p?o=o?.[p[1]]?.[parseInt(p[2])]:o=o?.[d],o==null)return}let l=s[s.length-1];o&&o[l]===n&&(o[l]=i)}function Zz(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Ao,l_,xn,Kz,_d=ae(()=>{"use strict";Ao="***",l_=/^(authorization|proxy-authorization|www-authenticate)$|(token|cookie|secret|credential|api[_\-]?key|bearer|session[_\-]?id)/i,xn=/(password|passwd|pwd|token|cookie|secret|credential|api[_\-]?key|apikey|access[_\-]?token|refresh[_\-]?token|client[_\-]?secret|private[_\-]?key|auth[_\-]?code|bearer|session[_\-]?id|jwt)/i;Kz=/\{\{[^}]+\}\}/});var Ue,an,oc,c_=ae(()=>{"use strict";Ue=ve(require("fs")),an=ve(require("path"));Un();_d();oc=class{historyPath;sharedHistoryPath;constructor(e,r){this.historyPath=e,this.sharedHistoryPath=r}getEnvironmentHistoryPath(e){return an.join(this.historyPath,Ht(e))}getCollectionHistoryPath(e,r){return an.join(this.getEnvironmentHistoryPath(e),r)}getRequestPath(e,r,n){return an.join(this.getCollectionHistoryPath(e,r),Ht(n))}getSharedEnvironmentHistoryPath(e){return an.join(this.sharedHistoryPath,Ht(e))}getSharedCollectionHistoryPath(e,r){return an.join(this.getSharedEnvironmentHistoryPath(e),r)}getSharedRequestPath(e,r,n){return an.join(this.getSharedCollectionHistoryPath(e,r),Ht(n))}getHistoryFilePath(e,r,n){return an.join(this.getRequestPath(e,r,n),"transactions.json")}getSharedHistoryFilePath(e,r,n){return an.join(this.getSharedRequestPath(e,r,n),"transactions.json")}getResponseFilePath(e,r,n,i){return an.join(this.getRequestPath(e,r,n),`${i}.json`)}getSharedResponseFilePath(e,r,n,i){return an.join(this.getSharedRequestPath(e,r,n),`${i}.json`)}loadHistory(e,r,n){let i=this.getHistoryFilePath(e,r,n);try{if(!Ue.existsSync(i))return null;let s=Ue.readFileSync(i,"utf-8"),o=JSON.parse(s);return{environment:e||o.environment,requestPath:r||o.requestPath,requestId:n||o.requestId,method:o.method,requests:o.requests}}catch(s){return console.error(`Failed to load history for ${n}:`,s),null}}loadSharedHistory(e,r,n){let i=this.getSharedHistoryFilePath(e,r,n);try{if(!Ue.existsSync(i))return null;let s=Ue.readFileSync(i,"utf-8"),o=JSON.parse(s);return{environment:e||o.environment,requestPath:r||o.requestPath,requestId:n||o.requestId,method:o.method,requests:o.requests}}catch(s){return console.error(`Failed to load shared history for ${n}:`,s),null}}getEntriesForEnvironment(e,r,n){let i=this.loadHistory(e,r,n);return i?i.requests:[]}getEntriesGroupedByTicket(e,r,n){let i=this.getEntriesForEnvironment(e,r,n),s=new Map;for(let o of i){let l=o.ticket||o.branch||"";s.has(l)||s.set(l,[]),s.get(l).push(o)}return s}getSharedEntriesGroupedByTicket(e,r,n){let i=this.loadSharedHistory(e,r,n)?.requests??[],s=new Map;for(let o of i){let l=o.ticket||o.branch||"";s.has(l)||s.set(l,[]),s.get(l).push(o)}return s}saveHistory(e){let r=this.getRequestPath(e.environment,e.requestPath,e.requestId),n=this.getHistoryFilePath(e.environment,e.requestPath,e.requestId);try{Ue.existsSync(r)||Ue.mkdirSync(r,{recursive:!0}),Ue.writeFileSync(n,JSON.stringify(e,null,2),"utf-8")}catch(i){throw console.error(`Failed to save history for ${e.requestId}:`,i),i}}saveSharedHistory(e){let r=this.getSharedRequestPath(e.environment,e.requestPath,e.requestId),n=this.getSharedHistoryFilePath(e.environment,e.requestPath,e.requestId);try{Ue.existsSync(r)||Ue.mkdirSync(r,{recursive:!0}),Ue.writeFileSync(n,JSON.stringify(e,null,2),"utf-8")}catch(i){throw console.error(`Failed to save shared history for ${e.requestId}:`,i),i}}addEntry(e,r,n,i,s){let o=this.loadHistory(e,r,n);o||(o={environment:e,requestPath:r,requestId:n,method:i,requests:[]});let l=ug({...s,method:i,id:Qh(),timestamp:Date.now()});return o.requests.unshift(l),o.requests.length>100&&(o.requests=o.requests.slice(0,100)),this.saveHistory(o),l}deleteEntry(e,r,n,i){let s=this.loadHistory(e,r,n);if(!s)return!1;let o=s.requests.length;if(s.requests=s.requests.filter(l=>l.id!==i),s.requests.length!==o){this.saveHistory(s);let l=this.getResponseFilePath(e,r,n,i);return Ue.existsSync(l)&&Ue.unlinkSync(l),!0}return!1}deleteSharedEntry(e,r,n,i){let s=this.loadSharedHistory(e,r,n);if(!s)return!1;let o=s.requests.length;if(s.requests=s.requests.filter(l=>l.id!==i),s.requests.length!==o){this.saveSharedHistory(s);let l=this.getSharedResponseFilePath(e,r,n,i);return Ue.existsSync(l)&&Ue.unlinkSync(l),!0}return!1}shareEntry(e,r,n,i,s){let o=(s||"").trim();if(!o)return!1;let l=this.loadHistory(e,r,n);if(!l)return!1;let c=l.requests.findIndex(b=>b.id===i);if(c===-1)return!1;let[d]=l.requests.splice(c,1);this.saveHistory(l);let p=this.loadSharedHistory(e,r,n)||{environment:e,requestPath:r,requestId:n,method:l.method,requests:[]};if(!p.requests.some(b=>b.id===i)){let b={...d,ticket:null,branch:o};p.requests.unshift(b),p.requests.length>100&&(p.requests=p.requests.slice(0,100)),this.saveSharedHistory(p)}let m=this.getResponseFilePath(e,r,n,i),y=this.getSharedResponseFilePath(e,r,n,i);if(Ue.existsSync(m)){let b=an.dirname(y);Ue.existsSync(b)||Ue.mkdirSync(b,{recursive:!0});try{Ue.renameSync(m,y)}catch{try{Ue.copyFileSync(m,y)}catch(C){return console.error(`Failed to copy full response from ${m} to ${y}:`,C),!0}try{Ue.unlinkSync(m)}catch(C){console.warn(`Failed to remove original full response after copy: ${m}`,C)}}}return!0}moveSharedEntry(e,r,n,i,s){let o=(s||"").trim();if(!o)return!1;let l=this.loadSharedHistory(e,r,n);if(!l)return!1;let c=!1;return l.requests=l.requests.map(d=>d.id===i?(c=!0,{...d,ticket:null,branch:o}):d),c?(this.saveSharedHistory(l),!0):!1}renameSharedGroup(e,r,n,i,s){let o=(i||"").trim(),l=(s||"").trim();if(!o||!l||o===l)return!1;let c=this.loadSharedHistory(e,r,n);if(!c)return!1;let d=!1;return c.requests=c.requests.map(p=>!p.ticket&&p.branch===o?(d=!0,{...p,branch:l}):p),d?(this.saveSharedHistory(c),!0):!1}clearHistory(e,r,n){let i=this.getRequestPath(e,r,n);if(Ue.existsSync(i)){let s=Ue.readdirSync(i);for(let o of s)Ue.unlinkSync(an.join(i,o));Ue.rmdirSync(i)}}saveFullResponse(e,r,n,i,s){let o=this.getRequestPath(e,r,n),l=this.getResponseFilePath(e,r,n,i);try{Ue.existsSync(o)||Ue.mkdirSync(o,{recursive:!0});let c=cg(s);Ue.writeFileSync(l,JSON.stringify(c,null,2),"utf-8")}catch(c){throw console.error(`Failed to save full response for ${i}:`,c),c}}loadFullResponse(e,r,n,i){let s=this.getResponseFilePath(e,r,n,i);try{if(!Ue.existsSync(s))return null;let o=Ue.readFileSync(s,"utf-8");return JSON.parse(o)}catch(o){return console.error(`Failed to load full response for ${i}:`,o),null}}loadSharedFullResponse(e,r,n,i){let s=this.getSharedResponseFilePath(e,r,n,i);try{if(!Ue.existsSync(s))return null;let o=Ue.readFileSync(s,"utf-8");return JSON.parse(o)}catch(o){return console.error(`Failed to load shared full response for ${i}:`,o),null}}}});var Xa,f_=ae(()=>{"use strict";Xa=class{constructor(e,r){this.historyService=e;this.inferrer=r}historyService;inferrer;async analyze(e,r,n){let i=n?.environment||"default",s=n?.maxSamples||50,o=this.historyService.loadHistory(i,e,r),l=this.historyService.loadSharedHistory(i,e,r),c=[...o?.requests||[],...l?.requests||[]];if(c.length===0)return{responses:{}};let d=c.slice(0,s),p=new Map;for(let y of d){let b=this.historyService.loadFullResponse(i,e,r,y.id);if(b||(b=this.historyService.loadSharedFullResponse(i,e,r,y.id)),b){let q=b.status;p.has(q)||p.set(q,[]),p.get(q).push(b)}}let m={};for(let[y,b]of p){let q=this.buildResponseDefinition(b);m[String(y)]=q}return{responses:m}}buildResponseDefinition(e){let r={};if(e.length===0)return r;let n=e[0];r.description=n.statusText||`Status ${n.status}`;let i=this.extractContentType(n.headers);if(i&&(r.contentType=i),i&&this.isJsonContentType(i)){let o=this.inferBodySchema(n);for(let l=1;l<e.length;l++){let c=this.inferBodySchema(e[l]);c&&o?o=this.inferrer.mergeSchemas(o,c):c&&(o=c)}if(o&&(r.schema=o),n.body!==void 0&&n.body!==null){let l=typeof n.body=="string"?this.tryParseJson(n.body):n.body;l!==void 0&&(r.examples={default:{summary:"Captured from history",value:l}})}}let s=this.findConsistentHeaders(e);return Object.keys(s).length>0&&(r.headers=s),r}inferBodySchema(e){if(e.body===void 0||e.body===null)return;let r=e.body;if(!(typeof r=="string"&&(r=this.tryParseJson(r),r===void 0)))return this.inferrer.inferFromValue(r)}extractContentType(e){for(let[r,n]of Object.entries(e))if(r.toLowerCase()==="content-type")return(Array.isArray(n)?n[0]:n).split(";")[0].trim()}isJsonContentType(e){return e.includes("json")||e.includes("+json")||e==="application/json"}findConsistentHeaders(e){if(e.length===0)return{};let r=new Set(["content-type","content-length","content-encoding","transfer-encoding","connection","date","server","set-cookie","vary","cache-control","expires","pragma","etag","last-modified","age"]),n=new Map,i=new Map;for(let l of e)for(let[c,d]of Object.entries(l.headers)){let p=c.toLowerCase();r.has(p)||(n.set(p,(n.get(p)||0)+1),i.has(p)||i.set(p,Array.isArray(d)?d.join(", "):d))}let s=Math.ceil(e.length/2),o={};for(let[l,c]of n)if(c>=s){let d=i.get(l);o[l]={schema:this.inferHeaderSchema(d)}}return o}inferHeaderSchema(e){return e?/^\d+$/.test(e)?{type:"integer"}:{type:"string"}:{type:"string"}}tryParseJson(e){try{return JSON.parse(e)}catch{return}}}});var at=V(yr=>{"use strict";var d_=Symbol.for("yaml.alias"),TP=Symbol.for("yaml.document"),dg=Symbol.for("yaml.map"),$P=Symbol.for("yaml.pair"),p_=Symbol.for("yaml.scalar"),pg=Symbol.for("yaml.seq"),Ts=Symbol.for("yaml.node.type"),Xz=t=>!!t&&typeof t=="object"&&t[Ts]===d_,eJ=t=>!!t&&typeof t=="object"&&t[Ts]===TP,tJ=t=>!!t&&typeof t=="object"&&t[Ts]===dg,rJ=t=>!!t&&typeof t=="object"&&t[Ts]===$P,NP=t=>!!t&&typeof t=="object"&&t[Ts]===p_,nJ=t=>!!t&&typeof t=="object"&&t[Ts]===pg;function MP(t){if(t&&typeof t=="object")switch(t[Ts]){case dg:case pg:return!0}return!1}function iJ(t){if(t&&typeof t=="object")switch(t[Ts]){case d_:case dg:case p_:case pg:return!0}return!1}var sJ=t=>(NP(t)||MP(t))&&!!t.anchor;yr.ALIAS=d_;yr.DOC=TP;yr.MAP=dg;yr.NODE_TYPE=Ts;yr.PAIR=$P;yr.SCALAR=p_;yr.SEQ=pg;yr.hasAnchor=sJ;yr.isAlias=Xz;yr.isCollection=MP;yr.isDocument=eJ;yr.isMap=tJ;yr.isNode=iJ;yr.isPair=rJ;yr.isScalar=NP;yr.isSeq=nJ});var Rd=V(h_=>{"use strict";var lr=at(),ln=Symbol("break visit"),FP=Symbol("skip children"),Qi=Symbol("remove node");function hg(t,e){let r=DP(e);lr.isDocument(t)?ac(null,t.contents,r,Object.freeze([t]))===Qi&&(t.contents=null):ac(null,t,r,Object.freeze([]))}hg.BREAK=ln;hg.SKIP=FP;hg.REMOVE=Qi;function ac(t,e,r,n){let i=jP(t,e,r,n);if(lr.isNode(i)||lr.isPair(i))return LP(t,n,i),ac(t,i,r,n);if(typeof i!="symbol"){if(lr.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=ac(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===ln)return ln;o===Qi&&(e.items.splice(s,1),s-=1)}}}else if(lr.isPair(e)){n=Object.freeze(n.concat(e));let s=ac("key",e.key,r,n);if(s===ln)return ln;s===Qi&&(e.key=null);let o=ac("value",e.value,r,n);if(o===ln)return ln;o===Qi&&(e.value=null)}}return i}async function mg(t,e){let r=DP(e);lr.isDocument(t)?await lc(null,t.contents,r,Object.freeze([t]))===Qi&&(t.contents=null):await lc(null,t,r,Object.freeze([]))}mg.BREAK=ln;mg.SKIP=FP;mg.REMOVE=Qi;async function lc(t,e,r,n){let i=await jP(t,e,r,n);if(lr.isNode(i)||lr.isPair(i))return LP(t,n,i),lc(t,i,r,n);if(typeof i!="symbol"){if(lr.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=await lc(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===ln)return ln;o===Qi&&(e.items.splice(s,1),s-=1)}}}else if(lr.isPair(e)){n=Object.freeze(n.concat(e));let s=await lc("key",e.key,r,n);if(s===ln)return ln;s===Qi&&(e.key=null);let o=await lc("value",e.value,r,n);if(o===ln)return ln;o===Qi&&(e.value=null)}}return i}function DP(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function jP(t,e,r,n){if(typeof r=="function")return r(t,e,n);if(lr.isMap(e))return r.Map?.(t,e,n);if(lr.isSeq(e))return r.Seq?.(t,e,n);if(lr.isPair(e))return r.Pair?.(t,e,n);if(lr.isScalar(e))return r.Scalar?.(t,e,n);if(lr.isAlias(e))return r.Alias?.(t,e,n)}function LP(t,e,r){let n=e[e.length-1];if(lr.isCollection(n))n.items[t]=r;else if(lr.isPair(n))t==="key"?n.key=r:n.value=r;else if(lr.isDocument(n))n.contents=r;else{let i=lr.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}h_.visit=hg;h_.visitAsync=mg});var m_=V(HP=>{"use strict";var UP=at(),oJ=Rd(),aJ={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},lJ=t=>t.replace(/[!,[\]{}]/g,e=>aJ[e]),Cd=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[s,o]=n;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[s]=n;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return r(6,`Unsupported YAML version ${s}`,o),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let s=this.tags[n];if(s)try{return s+decodeURIComponent(i)}catch(o){return r(String(o)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+lJ(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&UP.isNode(e.contents)){let s={};oJ.visit(e.contents,(o,l)=>{UP.isNode(l)&&l.tag&&(s[l.tag]=!0)}),i=Object.keys(s)}else i=[];for(let[s,o]of n)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(l=>l.startsWith(o)))&&r.push(`%TAG ${s} ${o}`);return r.join(`
|
|
98
98
|
`)}};Cd.defaultYaml={explicit:!1,version:"1.2"};Cd.defaultTags={"!!":"tag:yaml.org,2002:"};HP.Directives=Cd});var gg=V(xd=>{"use strict";var BP=at(),uJ=Rd();function cJ(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function VP(t){let e=new Set;return uJ.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function WP(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function fJ(t,e){let r=[],n=new Map,i=null;return{onAnchor:s=>{r.push(s),i??(i=VP(t));let o=WP(e,i);return i.add(o),o},setAnchors:()=>{for(let s of r){let o=n.get(s);if(typeof o=="object"&&o.anchor&&(BP.isScalar(o.node)||BP.isCollection(o.node)))o.node.anchor=o.anchor;else{let l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=s,l}}},sourceObjects:n}}xd.anchorIsValid=cJ;xd.anchorNames=VP;xd.createNodeAnchors=fJ;xd.findNewAnchor=WP});var g_=V(zP=>{"use strict";function Ed(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,s=n.length;i<s;++i){let o=n[i],l=Ed(t,n,String(i),o);l===void 0?delete n[i]:l!==o&&(n[i]=l)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let s=n.get(i),o=Ed(t,n,i,s);o===void 0?n.delete(i):o!==s&&n.set(i,o)}else if(n instanceof Set)for(let i of Array.from(n)){let s=Ed(t,n,i,i);s===void 0?n.delete(i):s!==i&&(n.delete(i),n.add(s))}else for(let[i,s]of Object.entries(n)){let o=Ed(t,n,i,s);o===void 0?delete n[i]:o!==s&&(n[i]=o)}return t.call(e,r,n)}zP.applyReviver=Ed});var To=V(GP=>{"use strict";var dJ=at();function JP(t,e,r){if(Array.isArray(t))return t.map((n,i)=>JP(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!dJ.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=s=>{n.res=s,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}GP.toJS=JP});var yg=V(KP=>{"use strict";var pJ=g_(),YP=at(),hJ=To(),y_=class{constructor(e){Object.defineProperty(this,YP.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:s}={}){if(!YP.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},l=hJ.toJS(this,"",o);if(typeof i=="function")for(let{count:c,res:d}of o.anchors.values())i(d,c);return typeof s=="function"?pJ.applyReviver(s,{"":l},"",l):l}};KP.NodeBase=y_});var qd=V(QP=>{"use strict";var mJ=gg(),gJ=Rd(),uc=at(),yJ=yg(),vJ=To(),v_=class extends yJ.NodeBase{constructor(e){super(uc.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],gJ.visit(e,{Node:(s,o)=>{(uc.isAlias(o)||uc.hasAnchor(o))&&n.push(o)}}),r&&(r.aliasResolveCache=n));let i;for(let s of n){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:s}=r,o=this.resolve(i,r);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=n.get(o);if(l||(vJ.toJS(o,null,r),l=n.get(o)),l?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=vg(i,o,n)),l.count*l.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return l.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(mJ.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${i} `}return i}};function vg(t,e,r){if(uc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(uc.isCollection(e)){let n=0;for(let i of e.items){let s=vg(t,i,r);s>n&&(n=s)}return n}else if(uc.isPair(e)){let n=vg(t,e.key,r),i=vg(t,e.value,r);return Math.max(n,i)}return 1}QP.Alias=v_});var rr=V(b_=>{"use strict";var bJ=at(),SJ=yg(),wJ=To(),_J=t=>!t||typeof t!="function"&&typeof t!="object",$o=class extends SJ.NodeBase{constructor(e){super(bJ.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:wJ.toJS(this.value,e,r)}toString(){return String(this.value)}};$o.BLOCK_FOLDED="BLOCK_FOLDED";$o.BLOCK_LITERAL="BLOCK_LITERAL";$o.PLAIN="PLAIN";$o.QUOTE_DOUBLE="QUOTE_DOUBLE";$o.QUOTE_SINGLE="QUOTE_SINGLE";b_.Scalar=$o;b_.isScalarValue=_J});var Od=V(XP=>{"use strict";var RJ=qd(),el=at(),ZP=rr(),CJ="tag:yaml.org,2002:";function xJ(t,e,r){if(e){let n=r.filter(s=>s.tag===e),i=n.find(s=>!s.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function EJ(t,e,r){if(el.isDocument(t)&&(t=t.contents),el.isNode(t))return t;if(el.isPair(t)){let m=r.schema[el.MAP].createNode?.(r.schema,null,r);return m.items.push(t),m}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:s,schema:o,sourceObjects:l}=r,c;if(n&&t&&typeof t=="object"){if(c=l.get(t),c)return c.anchor??(c.anchor=i(t)),new RJ.Alias(c.anchor);c={anchor:null,node:null},l.set(t,c)}e?.startsWith("!!")&&(e=CJ+e.slice(2));let d=xJ(t,e,o.tags);if(!d){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let m=new ZP.Scalar(t);return c&&(c.node=m),m}d=t instanceof Map?o[el.MAP]:Symbol.iterator in Object(t)?o[el.SEQ]:o[el.MAP]}s&&(s(d),delete r.onTagObj);let p=d?.createNode?d.createNode(r.schema,t,r):typeof d?.nodeClass?.from=="function"?d.nodeClass.from(r.schema,t,r):new ZP.Scalar(t);return e?p.tag=e:d.default||(p.tag=d.tag),c&&(c.node=p),p}XP.createNode=EJ});var Sg=V(bg=>{"use strict";var qJ=Od(),Zi=at(),OJ=yg();function S_(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let s=e[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let o=[];o[s]=n,n=o}else n=new Map([[s,n]])}return qJ.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var ek=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,w_=class extends OJ.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Zi.isNode(n)||Zi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(ek(e))this.add(r);else{let[n,...i]=e,s=this.get(n,!0);if(Zi.isCollection(s))s.addIn(i,r);else if(s===void 0&&this.schema)this.set(n,S_(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Zi.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,s=this.get(n,!0);return i.length===0?!r&&Zi.isScalar(s)?s.value:s:Zi.isCollection(s)?s.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Zi.isPair(r))return!1;let n=r.value;return n==null||e&&Zi.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Zi.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let s=this.get(n,!0);if(Zi.isCollection(s))s.setIn(i,r);else if(s===void 0&&this.schema)this.set(n,S_(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};bg.Collection=w_;bg.collectionFromPath=S_;bg.isEmptyPath=ek});var Id=V(wg=>{"use strict";var IJ=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function __(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var PJ=(t,e,r)=>t.endsWith(`
|
|
99
99
|
`)?__(r,e):r.includes(`
|
|
100
100
|
`)?`
|
|
101
|
-
`+__(r,e):(t.endsWith(" ")?"":" ")+r;wg.indentComment=__;wg.lineComment=PJ;wg.stringifyComment=IJ});var rk=V(Pd=>{"use strict";var kJ="flow",R_="block",_g="quoted";function AJ(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:s=20,onFold:o,onOverflow:l}={}){if(!i||i<0)return t;i<s&&(s=0);let c=Math.max(1+s,1+i-e.length);if(t.length<=c)return t;let d=[],p={},m=i-e.length;typeof n=="number"&&(n>i-Math.max(2,s)?d.push(0):m=i-n);let y,b,
|
|
101
|
+
`+__(r,e):(t.endsWith(" ")?"":" ")+r;wg.indentComment=__;wg.lineComment=PJ;wg.stringifyComment=IJ});var rk=V(Pd=>{"use strict";var kJ="flow",R_="block",_g="quoted";function AJ(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:s=20,onFold:o,onOverflow:l}={}){if(!i||i<0)return t;i<s&&(s=0);let c=Math.max(1+s,1+i-e.length);if(t.length<=c)return t;let d=[],p={},m=i-e.length;typeof n=="number"&&(n>i-Math.max(2,s)?d.push(0):m=i-n);let y,b,q=!1,C=-1,v=-1,_=-1;r===R_&&(C=tk(t,C,e.length),C!==-1&&(m=C+c));for(let k;k=t[C+=1];){if(r===_g&&k==="\\"){switch(v=C,t[C+1]){case"x":C+=3;break;case"u":C+=5;break;case"U":C+=9;break;default:C+=1}_=C}if(k===`
|
|
102
102
|
`)r===R_&&(C=tk(t,C,e.length)),m=C+e.length+c,y=void 0;else{if(k===" "&&b&&b!==" "&&b!==`
|
|
103
103
|
`&&b!==" "){let O=t[C+1];O&&O!==" "&&O!==`
|
|
104
|
-
`&&O!==" "&&(y=C)}if(C>=m)if(y)d.push(y),m=y+c,y=void 0;else if(r===_g){for(;b===" "||b===" ";)b=k,k=t[C+=1],
|
|
105
|
-
${e}${t.slice(0,M)}`:(r===_g&&p[O]&&(
|
|
106
|
-
${e}${t.slice(O+1,M)}`)}return
|
|
104
|
+
`&&O!==" "&&(y=C)}if(C>=m)if(y)d.push(y),m=y+c,y=void 0;else if(r===_g){for(;b===" "||b===" ";)b=k,k=t[C+=1],q=!0;let O=C>_+1?C-2:v-1;if(p[O])return t;d.push(O),p[O]=!0,m=O+c,y=void 0}else q=!0}b=k}if(q&&l&&l(),d.length===0)return t;o&&o();let E=t.slice(0,d[0]);for(let k=0;k<d.length;++k){let O=d[k],M=d[k+1]||t.length;O===0?E=`
|
|
105
|
+
${e}${t.slice(0,M)}`:(r===_g&&p[O]&&(E+=`${t[O]}\\`),E+=`
|
|
106
|
+
${e}${t.slice(O+1,M)}`)}return E}function tk(t,e,r){let n=e,i=e+1,s=t[i];for(;s===" "||s===" ";)if(e<i+r)s=t[++e];else{do s=t[++e];while(s&&s!==`
|
|
107
107
|
`);n=e,i=e+1,s=t[i]}return n}Pd.FOLD_BLOCK=R_;Pd.FOLD_FLOW=kJ;Pd.FOLD_QUOTED=_g;Pd.foldFlowLines=AJ});var Ad=V(nk=>{"use strict";var yi=rr(),No=rk(),Cg=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),xg=t=>/^(%|---|\.\.\.)/m.test(t);function TJ(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let s=0,o=0;s<i;++s)if(t[s]===`
|
|
108
108
|
`){if(s-o>n)return!0;if(o=s+1,i-o<=n)return!1}return!0}function kd(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(xg(t)?" ":""),o="",l=0;for(let c=0,d=r[c];d;d=r[++c])if(d===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(o+=r.slice(l,c)+"\\ ",c+=1,l=c,d="\\"),d==="\\")switch(r[c+1]){case"u":{o+=r.slice(l,c);let p=r.substr(c+2,4);switch(p){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:p.substr(0,2)==="00"?o+="\\x"+p.substr(2):o+=r.substr(c,6)}c+=5,l=c+1}break;case"n":if(n||r[c+2]==='"'||r.length<i)c+=1;else{for(o+=r.slice(l,c)+`
|
|
109
109
|
|
|
@@ -116,20 +116,20 @@ ${r}`)+"'";return e.implicitKey?n:No.foldFlowLines(n,r,No.FOLD_FLOW,Cg(e,!1))}fu
|
|
|
116
116
|
|$)`,"g")}catch{x_=/\n+(?!\n|$)/g}function Rg({comment:t,type:e,value:r},n,i,s){let{blockQuote:o,commentString:l,lineWidth:c}=n.options;if(!o||/\n[\t ]+$/.test(r))return cc(r,n);let d=n.indent||(n.forceBlockIndent||xg(r)?" ":""),p=o==="literal"?!0:o==="folded"||e===yi.Scalar.BLOCK_FOLDED?!1:e===yi.Scalar.BLOCK_LITERAL?!0:!TJ(r,c,d.length);if(!r)return p?`|
|
|
117
117
|
`:`>
|
|
118
118
|
`;let m,y;for(y=r.length;y>0;--y){let M=r[y-1];if(M!==`
|
|
119
|
-
`&&M!==" "&&M!==" ")break}let b=r.substring(y),
|
|
120
|
-
`);
|
|
119
|
+
`&&M!==" "&&M!==" ")break}let b=r.substring(y),q=b.indexOf(`
|
|
120
|
+
`);q===-1?m="-":r===b||q!==b.length-1?(m="+",s&&s()):m="",b&&(r=r.slice(0,-b.length),b[b.length-1]===`
|
|
121
121
|
`&&(b=b.slice(0,-1)),b=b.replace(x_,`$&${d}`));let C=!1,v,_=-1;for(v=0;v<r.length;++v){let M=r[v];if(M===" ")C=!0;else if(M===`
|
|
122
|
-
`)_=v;else break}let
|
|
123
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${d}`),j=!1,I=Cg(n,!0);o!=="folded"&&e!==yi.Scalar.BLOCK_FOLDED&&(I.onOverflow=()=>{j=!0});let R=No.foldFlowLines(`${
|
|
122
|
+
`)_=v;else break}let E=r.substring(0,_<v?_+1:v);E&&(r=r.substring(E.length),E=E.replace(/\n+/g,`$&${d}`));let O=(C?d?"2":"1":"")+m;if(t&&(O+=" "+l(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!p){let M=r.replace(/\n+/g,`
|
|
123
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${d}`),j=!1,I=Cg(n,!0);o!=="folded"&&e!==yi.Scalar.BLOCK_FOLDED&&(I.onOverflow=()=>{j=!0});let R=No.foldFlowLines(`${E}${M}${b}`,d,No.FOLD_BLOCK,I);if(!j)return`>${O}
|
|
124
124
|
${d}${R}`}return r=r.replace(/\n+/g,`$&${d}`),`|${O}
|
|
125
|
-
${d}${
|
|
125
|
+
${d}${E}${r}${b}`}function $J(t,e,r,n){let{type:i,value:s}=t,{actualString:o,implicitKey:l,indent:c,indentStep:d,inFlow:p}=e;if(l&&s.includes(`
|
|
126
126
|
`)||p&&/[[\]{},]/.test(s))return cc(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return l||p||!s.includes(`
|
|
127
127
|
`)?cc(s,e):Rg(t,e,r,n);if(!l&&!p&&i!==yi.Scalar.PLAIN&&s.includes(`
|
|
128
128
|
`))return Rg(t,e,r,n);if(xg(s)){if(c==="")return e.forceBlockIndent=!0,Rg(t,e,r,n);if(l&&c===d)return cc(s,e)}let m=s.replace(/\n+/g,`$&
|
|
129
|
-
${c}`);if(o){let y=C=>C.default&&C.tag!=="tag:yaml.org,2002:str"&&C.test?.test(m),{compat:b,tags:
|
|
130
|
-
${e.indent}${l}`:l}E_.createStringifyContext=jJ;E_.stringify=HJ});var ak=V(ok=>{"use strict";var $s=at(),ik=rr(),sk=Td(),$d=Id();function BJ({key:t,value:e},r,n,i){let{allNullValues:s,doc:o,indent:l,indentStep:c,options:{commentString:d,indentSeq:p,simpleKeys:m}}=r,y=$s.isNode(t)&&t.comment||null;if(m){if(y)throw new Error("With simple keys, key nodes cannot have comments");if($s.isCollection(t)||!$s.isNode(t)&&typeof t=="object"){let I="With simple keys, collection cannot be used as a key value";throw new Error(I)}}let b=!m&&(!t||y&&e==null&&!r.inFlow||$s.isCollection(t)||($s.isScalar(t)?t.type===ik.Scalar.BLOCK_FOLDED||t.type===ik.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!b&&(m||!s),indent:l+c});let
|
|
131
|
-
${l}:`):(v=`${v}:`,y&&(v+=$d.lineComment(v,r.indent,d(y))));let _,
|
|
132
|
-
`:"",
|
|
129
|
+
${c}`);if(o){let y=C=>C.default&&C.tag!=="tag:yaml.org,2002:str"&&C.test?.test(m),{compat:b,tags:q}=e.doc.schema;if(q.some(y)||b?.some(y))return cc(s,e)}return l?m:No.foldFlowLines(m,c,No.FOLD_FLOW,Cg(e,!1))}function NJ(t,e,r,n){let{implicitKey:i,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:l}=t;l!==yi.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(l=yi.Scalar.QUOTE_DOUBLE);let c=p=>{switch(p){case yi.Scalar.BLOCK_FOLDED:case yi.Scalar.BLOCK_LITERAL:return i||s?cc(o.value,e):Rg(o,e,r,n);case yi.Scalar.QUOTE_DOUBLE:return kd(o.value,e);case yi.Scalar.QUOTE_SINGLE:return C_(o.value,e);case yi.Scalar.PLAIN:return $J(o,e,r,n);default:return null}},d=c(l);if(d===null){let{defaultKeyType:p,defaultStringType:m}=e.options,y=i&&p||m;if(d=c(y),d===null)throw new Error(`Unsupported default string type ${y}`)}return d}nk.stringifyString=NJ});var Td=V(E_=>{"use strict";var MJ=gg(),Mo=at(),FJ=Id(),DJ=Ad();function jJ(t,e){let r=Object.assign({blockQuote:!0,commentString:FJ.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function LJ(t,e){if(e.tag){let i=t.filter(s=>s.tag===e.tag);if(i.length>0)return i.find(s=>s.format===e.format)??i[0]}let r,n;if(Mo.isScalar(e)){n=e.value;let i=t.filter(s=>s.identify?.(n));if(i.length>1){let s=i.filter(o=>o.test);s.length>0&&(i=s)}r=i.find(s=>s.format===e.format)??i.find(s=>!s.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function UJ(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],s=(Mo.isScalar(t)||Mo.isCollection(t))&&t.anchor;s&&MJ.anchorIsValid(s)&&(r.add(s),i.push(`&${s}`));let o=t.tag??(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(" ")}function HJ(t,e,r,n){if(Mo.isPair(t))return t.toString(e,r,n);if(Mo.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,s=Mo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=LJ(e.doc.schema.tags,s));let o=UJ(s,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let l=typeof i.stringify=="function"?i.stringify(s,e,r,n):Mo.isScalar(s)?DJ.stringifyString(s,e,r,n):s.toString(e,r,n);return o?Mo.isScalar(s)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o}
|
|
130
|
+
${e.indent}${l}`:l}E_.createStringifyContext=jJ;E_.stringify=HJ});var ak=V(ok=>{"use strict";var $s=at(),ik=rr(),sk=Td(),$d=Id();function BJ({key:t,value:e},r,n,i){let{allNullValues:s,doc:o,indent:l,indentStep:c,options:{commentString:d,indentSeq:p,simpleKeys:m}}=r,y=$s.isNode(t)&&t.comment||null;if(m){if(y)throw new Error("With simple keys, key nodes cannot have comments");if($s.isCollection(t)||!$s.isNode(t)&&typeof t=="object"){let I="With simple keys, collection cannot be used as a key value";throw new Error(I)}}let b=!m&&(!t||y&&e==null&&!r.inFlow||$s.isCollection(t)||($s.isScalar(t)?t.type===ik.Scalar.BLOCK_FOLDED||t.type===ik.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!b&&(m||!s),indent:l+c});let q=!1,C=!1,v=sk.stringify(t,r,()=>q=!0,()=>C=!0);if(!b&&!r.inFlow&&v.length>1024){if(m)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");b=!0}if(r.inFlow){if(s||e==null)return q&&n&&n(),v===""?"?":b?`? ${v}`:v}else if(s&&!m||e==null&&b)return v=`? ${v}`,y&&!q?v+=$d.lineComment(v,r.indent,d(y)):C&&i&&i(),v;q&&(y=null),b?(y&&(v+=$d.lineComment(v,r.indent,d(y))),v=`? ${v}
|
|
131
|
+
${l}:`):(v=`${v}:`,y&&(v+=$d.lineComment(v,r.indent,d(y))));let _,E,k;$s.isNode(e)?(_=!!e.spaceBefore,E=e.commentBefore,k=e.comment):(_=!1,E=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),r.implicitKey=!1,!b&&!y&&$s.isScalar(e)&&(r.indentAtStart=v.length+1),C=!1,!p&&c.length>=2&&!r.inFlow&&!b&&$s.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let O=!1,M=sk.stringify(e,r,()=>O=!0,()=>C=!0),j=" ";if(y||_||E){if(j=_?`
|
|
132
|
+
`:"",E){let I=d(E);j+=`
|
|
133
133
|
${$d.indentComment(I,r.indent)}`}M===""&&!r.inFlow?j===`
|
|
134
134
|
`&&k&&(j=`
|
|
135
135
|
|
|
@@ -137,34 +137,34 @@ ${$d.indentComment(I,r.indent)}`}M===""&&!r.inFlow?j===`
|
|
|
137
137
|
${r.indent}`}else if(!b&&$s.isCollection(e)){let I=M[0],R=M.indexOf(`
|
|
138
138
|
`),A=R!==-1,F=r.inFlow??e.flow??e.items.length===0;if(A||!F){let U=!1;if(A&&(I==="&"||I==="!")){let D=M.indexOf(" ");I==="&"&&D!==-1&&D<R&&M[D+1]==="!"&&(D=M.indexOf(" ",D+1)),(D===-1||R<D)&&(U=!0)}U||(j=`
|
|
139
139
|
${r.indent}`)}}else(M===""||M[0]===`
|
|
140
|
-
`)&&(j="");return v+=j+M,r.inFlow?O&&n&&n():k&&!O?v+=$d.lineComment(v,r.indent,d(k)):C&&i&&i(),v}ok.stringifyPair=BJ});var O_=V(q_=>{"use strict";var lk=require("process");function VJ(t,...e){t==="debug"&&console.log(...e)}function WJ(t,e){(t==="debug"||t==="warn")&&(typeof lk.emitWarning=="function"?lk.emitWarning(e):console.warn(e))}q_.debug=VJ;q_.warn=WJ});var Pg=V(Ig=>{"use strict";var Og=at(),uk=rr(),Eg="<<",qg={identify:t=>t===Eg||typeof t=="symbol"&&t.description===Eg,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new uk.Scalar(Symbol(Eg)),{addToJSMap:ck}),stringify:()=>Eg},zJ=(t,e)=>(qg.identify(e)||Og.isScalar(e)&&(!e.type||e.type===uk.Scalar.PLAIN)&&qg.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===qg.tag&&r.default);function ck(t,e,r){let n=fk(t,r);if(Og.isSeq(n))for(let i of n.items)I_(t,e,i);else if(Array.isArray(n))for(let i of n)I_(t,e,i);else I_(t,e,n)}function I_(t,e,r){let n=fk(t,r);if(!Og.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[s,o]of i)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function fk(t,e){return t&&Og.isAlias(e)?e.resolve(t.doc,t):e}Ig.addMergeToJSMap=ck;Ig.isMergeKey=zJ;Ig.merge=qg});var k_=V(hk=>{"use strict";var JJ=O_(),dk=Pg(),GJ=Td(),pk=at(),P_=To();function YJ(t,e,{key:r,value:n}){if(pk.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(dk.isMergeKey(t,r))dk.addMergeToJSMap(t,e,n);else{let i=P_.toJS(r,"",t);if(e instanceof Map)e.set(i,P_.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let s=KJ(r,i,t),o=P_.toJS(n,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function KJ(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(pk.isNode(t)&&r?.doc){let n=GJ.createStringifyContext(r.doc,{});n.anchors=new Set;for(let s of r.anchors.keys())n.anchors.add(s.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),JJ.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}hk.addPairToJSMap=YJ});var Fo=V(A_=>{"use strict";var mk=Od(),QJ=ak(),ZJ=k_(),kg=at();function XJ(t,e,r){let n=mk.createNode(t,void 0,r),i=mk.createNode(e,void 0,r);return new Ag(n,i)}var Ag=class t{constructor(e,r=null){Object.defineProperty(this,kg.NODE_TYPE,{value:kg.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return kg.isNode(r)&&(r=r.clone(e)),kg.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return ZJ.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?QJ.stringifyPair(this,e,r,n):JSON.stringify(this)}};A_.Pair=Ag;A_.createPair=XJ});var T_=V(yk=>{"use strict";var tl=at(),gk=Td(),Tg=Id();function eG(t,e,r){return(e.inFlow??t.flow?rG:tG)(t,e,r)}function tG({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:s,onChompKeep:o,onComment:l}){let{indent:c,options:{commentString:d}}=r,p=Object.assign({},r,{indent:s,type:null}),m=!1,y=[];for(let
|
|
140
|
+
`)&&(j="");return v+=j+M,r.inFlow?O&&n&&n():k&&!O?v+=$d.lineComment(v,r.indent,d(k)):C&&i&&i(),v}ok.stringifyPair=BJ});var O_=V(q_=>{"use strict";var lk=require("process");function VJ(t,...e){t==="debug"&&console.log(...e)}function WJ(t,e){(t==="debug"||t==="warn")&&(typeof lk.emitWarning=="function"?lk.emitWarning(e):console.warn(e))}q_.debug=VJ;q_.warn=WJ});var Pg=V(Ig=>{"use strict";var Og=at(),uk=rr(),Eg="<<",qg={identify:t=>t===Eg||typeof t=="symbol"&&t.description===Eg,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new uk.Scalar(Symbol(Eg)),{addToJSMap:ck}),stringify:()=>Eg},zJ=(t,e)=>(qg.identify(e)||Og.isScalar(e)&&(!e.type||e.type===uk.Scalar.PLAIN)&&qg.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===qg.tag&&r.default);function ck(t,e,r){let n=fk(t,r);if(Og.isSeq(n))for(let i of n.items)I_(t,e,i);else if(Array.isArray(n))for(let i of n)I_(t,e,i);else I_(t,e,n)}function I_(t,e,r){let n=fk(t,r);if(!Og.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[s,o]of i)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function fk(t,e){return t&&Og.isAlias(e)?e.resolve(t.doc,t):e}Ig.addMergeToJSMap=ck;Ig.isMergeKey=zJ;Ig.merge=qg});var k_=V(hk=>{"use strict";var JJ=O_(),dk=Pg(),GJ=Td(),pk=at(),P_=To();function YJ(t,e,{key:r,value:n}){if(pk.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(dk.isMergeKey(t,r))dk.addMergeToJSMap(t,e,n);else{let i=P_.toJS(r,"",t);if(e instanceof Map)e.set(i,P_.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let s=KJ(r,i,t),o=P_.toJS(n,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function KJ(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(pk.isNode(t)&&r?.doc){let n=GJ.createStringifyContext(r.doc,{});n.anchors=new Set;for(let s of r.anchors.keys())n.anchors.add(s.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),JJ.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}hk.addPairToJSMap=YJ});var Fo=V(A_=>{"use strict";var mk=Od(),QJ=ak(),ZJ=k_(),kg=at();function XJ(t,e,r){let n=mk.createNode(t,void 0,r),i=mk.createNode(e,void 0,r);return new Ag(n,i)}var Ag=class t{constructor(e,r=null){Object.defineProperty(this,kg.NODE_TYPE,{value:kg.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return kg.isNode(r)&&(r=r.clone(e)),kg.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return ZJ.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?QJ.stringifyPair(this,e,r,n):JSON.stringify(this)}};A_.Pair=Ag;A_.createPair=XJ});var T_=V(yk=>{"use strict";var tl=at(),gk=Td(),Tg=Id();function eG(t,e,r){return(e.inFlow??t.flow?rG:tG)(t,e,r)}function tG({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:s,onChompKeep:o,onComment:l}){let{indent:c,options:{commentString:d}}=r,p=Object.assign({},r,{indent:s,type:null}),m=!1,y=[];for(let q=0;q<e.length;++q){let C=e[q],v=null;if(tl.isNode(C))!m&&C.spaceBefore&&y.push(""),$g(r,y,C.commentBefore,m),C.comment&&(v=C.comment);else if(tl.isPair(C)){let E=tl.isNode(C.key)?C.key:null;E&&(!m&&E.spaceBefore&&y.push(""),$g(r,y,E.commentBefore,m))}m=!1;let _=gk.stringify(C,p,()=>v=null,()=>m=!0);v&&(_+=Tg.lineComment(_,s,d(v))),m&&v&&(m=!1),y.push(n+_)}let b;if(y.length===0)b=i.start+i.end;else{b=y[0];for(let q=1;q<y.length;++q){let C=y[q];b+=C?`
|
|
141
141
|
${c}${C}`:`
|
|
142
142
|
`}}return t?(b+=`
|
|
143
|
-
`+Tg.indentComment(d(t),c),l&&l()):m&&o&&o(),b}function rG({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:s,flowCollectionPadding:o,options:{commentString:l}}=e;n+=s;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),d=!1,p=0,m=[];for(let
|
|
144
|
-
`)),
|
|
143
|
+
`+Tg.indentComment(d(t),c),l&&l()):m&&o&&o(),b}function rG({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:s,flowCollectionPadding:o,options:{commentString:l}}=e;n+=s;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),d=!1,p=0,m=[];for(let q=0;q<t.length;++q){let C=t[q],v=null;if(tl.isNode(C))C.spaceBefore&&m.push(""),$g(e,m,C.commentBefore,!1),C.comment&&(v=C.comment);else if(tl.isPair(C)){let E=tl.isNode(C.key)?C.key:null;E&&(E.spaceBefore&&m.push(""),$g(e,m,E.commentBefore,!1),E.comment&&(d=!0));let k=tl.isNode(C.value)?C.value:null;k?(k.comment&&(v=k.comment),k.commentBefore&&(d=!0)):C.value==null&&E?.comment&&(v=E.comment)}v&&(d=!0);let _=gk.stringify(C,c,()=>v=null);d||(d=m.length>p||_.includes(`
|
|
144
|
+
`)),q<t.length-1?_+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(d||(d=m.reduce((E,k)=>E+k.length+2,2)+(_.length+2)>e.options.lineWidth)),d&&(_+=",")),v&&(_+=Tg.lineComment(_,n,l(v))),m.push(_),p=m.length}let{start:y,end:b}=r;if(m.length===0)return y+b;if(!d){let q=m.reduce((C,v)=>C+v.length+2,2);d=e.options.lineWidth>0&&q>e.options.lineWidth}if(d){let q=y;for(let C of m)q+=C?`
|
|
145
145
|
${s}${i}${C}`:`
|
|
146
|
-
`;return`${
|
|
146
|
+
`;return`${q}
|
|
147
147
|
${i}${b}`}else return`${y}${o}${m.join(" ")}${o}${b}`}function $g({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let s=Tg.indentComment(e(n),t);r.push(s.trimStart())}}yk.stringifyCollection=eG});var jo=V(N_=>{"use strict";var nG=T_(),iG=k_(),sG=Sg(),Do=at(),Ng=Fo(),oG=rr();function Nd(t,e){let r=Do.isScalar(e)?e.value:e;for(let n of t)if(Do.isPair(n)&&(n.key===e||n.key===r||Do.isScalar(n.key)&&n.key.value===r))return n}var $_=class extends sG.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Do.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:s}=n,o=new this(e),l=(c,d)=>{if(typeof s=="function")d=s.call(r,c,d);else if(Array.isArray(s)&&!s.includes(c))return;(d!==void 0||i)&&o.items.push(Ng.createPair(c,d,n))};if(r instanceof Map)for(let[c,d]of r)l(c,d);else if(r&&typeof r=="object")for(let c of Object.keys(r))l(c,r[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,r){let n;Do.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Ng.Pair(e,e?.value):n=new Ng.Pair(e.key,e.value);let i=Nd(this.items,n.key),s=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Do.isScalar(i.value)&&oG.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(s){let o=this.items.findIndex(l=>s(n,l)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let r=Nd(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Nd(this.items,e)?.value;return(!r&&Do.isScalar(i)?i.value:i)??void 0}has(e){return!!Nd(this.items,e)}set(e,r){this.add(new Ng.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let s of this.items)iG.addPairToJSMap(r,i,s);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Do.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),nG.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};N_.YAMLMap=$_;N_.findPair=Nd});var fc=V(bk=>{"use strict";var aG=at(),vk=jo(),lG={collection:"map",default:!0,nodeClass:vk.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return aG.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>vk.YAMLMap.from(t,e,r)};bk.map=lG});var Lo=V(Sk=>{"use strict";var uG=Od(),cG=T_(),fG=Sg(),Fg=at(),dG=rr(),pG=To(),M_=class extends fG.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Fg.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Mg(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Mg(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Fg.isScalar(i)?i.value:i}has(e){let r=Mg(e);return typeof r=="number"&&r<this.items.length}set(e,r){let n=Mg(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[n];Fg.isScalar(i)&&dG.isScalarValue(r)?i.value=r:this.items[n]=r}toJSON(e,r){let n=[];r?.onCreate&&r.onCreate(n);let i=0;for(let s of this.items)n.push(pG.toJS(s,String(i++),r));return n}toString(e,r,n){return e?cG.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:r}):JSON.stringify(this)}static from(e,r,n){let{replacer:i}=n,s=new this(e);if(r&&Symbol.iterator in Object(r)){let o=0;for(let l of r){if(typeof i=="function"){let c=r instanceof Set?l:String(o++);l=i.call(r,c,l)}s.items.push(uG.createNode(l,void 0,n))}}return s}};function Mg(t){let e=Fg.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Sk.YAMLSeq=M_});var dc=V(_k=>{"use strict";var hG=at(),wk=Lo(),mG={collection:"seq",default:!0,nodeClass:wk.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return hG.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>wk.YAMLSeq.from(t,e,r)};_k.seq=mG});var Md=V(Rk=>{"use strict";var gG=Ad(),yG={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),gG.stringifyString(t,e,r,n)}};Rk.string=yG});var Dg=V(Ek=>{"use strict";var Ck=rr(),xk={identify:t=>t==null,createNode:()=>new Ck.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ck.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&xk.test.test(t)?t:e.options.nullStr};Ek.nullTag=xk});var F_=V(Ok=>{"use strict";var vG=rr(),qk={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new vG.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&qk.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};Ok.boolTag=qk});var pc=V(Ik=>{"use strict";function bG({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let s=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let l=e-(s.length-o-1);for(;l-- >0;)s+="0"}return s}Ik.stringifyNumber=bG});var j_=V(jg=>{"use strict";var SG=rr(),D_=pc(),wG={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D_.stringifyNumber},_G={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():D_.stringifyNumber(t)}},RG={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new SG.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:D_.stringifyNumber};jg.float=RG;jg.floatExp=_G;jg.floatNaN=wG});var U_=V(Ug=>{"use strict";var Pk=pc(),Lg=t=>typeof t=="bigint"||Number.isInteger(t),L_=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function kk(t,e,r){let{value:n}=t;return Lg(n)&&n>=0?r+n.toString(e):Pk.stringifyNumber(t)}var CG={identify:t=>Lg(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>L_(t,2,8,r),stringify:t=>kk(t,8,"0o")},xG={identify:Lg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>L_(t,0,10,r),stringify:Pk.stringifyNumber},EG={identify:t=>Lg(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>L_(t,2,16,r),stringify:t=>kk(t,16,"0x")};Ug.int=xG;Ug.intHex=EG;Ug.intOct=CG});var Tk=V(Ak=>{"use strict";var qG=fc(),OG=Dg(),IG=dc(),PG=Md(),kG=F_(),H_=j_(),B_=U_(),AG=[qG.map,IG.seq,PG.string,OG.nullTag,kG.boolTag,B_.intOct,B_.int,B_.intHex,H_.floatNaN,H_.floatExp,H_.float];Ak.schema=AG});var Mk=V(Nk=>{"use strict";var TG=rr(),$G=fc(),NG=dc();function $k(t){return typeof t=="bigint"||Number.isInteger(t)}var Hg=({value:t})=>JSON.stringify(t),MG=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Hg},{identify:t=>t==null,createNode:()=>new TG.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Hg},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Hg},{identify:$k,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>$k(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Hg}],FG={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},DG=[$G.map,NG.seq].concat(MG,FG);Nk.schema=DG});var W_=V(Fk=>{"use strict";var Fd=require("buffer"),V_=rr(),jG=Ad(),LG={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Fd.Buffer=="function")return Fd.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i<r.length;++i)n[i]=r.charCodeAt(i);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:r},n,i,s){if(!r)return"";let o=r,l;if(typeof Fd.Buffer=="function")l=o instanceof Fd.Buffer?o.toString("base64"):Fd.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let d=0;d<o.length;++d)c+=String.fromCharCode(o[d]);l=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=V_.Scalar.BLOCK_LITERAL),e!==V_.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),d=Math.ceil(l.length/c),p=new Array(d);for(let m=0,y=0;m<d;++m,y+=c)p[m]=l.substr(y,c);l=p.join(e===V_.Scalar.BLOCK_LITERAL?`
|
|
148
148
|
`:" ")}return jG.stringifyString({comment:t,type:e,value:l},n,i,s)}};Fk.binary=LG});var Wg=V(Vg=>{"use strict";var Bg=at(),z_=Fo(),UG=rr(),HG=Lo();function Dk(t,e){if(Bg.isSeq(t))for(let r=0;r<t.items.length;++r){let n=t.items[r];if(!Bg.isPair(n)){if(Bg.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new z_.Pair(new UG.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
|
|
149
149
|
${i.key.commentBefore}`:n.commentBefore),n.comment){let s=i.value??i.key;s.comment=s.comment?`${n.comment}
|
|
150
150
|
${s.comment}`:n.comment}n=i}t.items[r]=Bg.isPair(n)?n:new z_.Pair(n)}}else e("Expected a sequence for this tag");return t}function jk(t,e,r){let{replacer:n}=r,i=new HG.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(s++),o));let l,c;if(Array.isArray(o))if(o.length===2)l=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let d=Object.keys(o);if(d.length===1)l=d[0],c=o[l];else throw new TypeError(`Expected tuple with one key, not ${d.length} keys`)}else l=o;i.items.push(z_.createPair(l,c,r))}return i}var BG={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Dk,createNode:jk};Vg.createPairs=jk;Vg.pairs=BG;Vg.resolvePairs=Dk});var Y_=V(G_=>{"use strict";var Lk=at(),J_=To(),Dd=jo(),VG=Lo(),Uk=Wg(),rl=class t extends VG.YAMLSeq{constructor(){super(),this.add=Dd.YAMLMap.prototype.add.bind(this),this.delete=Dd.YAMLMap.prototype.delete.bind(this),this.get=Dd.YAMLMap.prototype.get.bind(this),this.has=Dd.YAMLMap.prototype.has.bind(this),this.set=Dd.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let s,o;if(Lk.isPair(i)?(s=J_.toJS(i.key,"",r),o=J_.toJS(i.value,s,r)):s=J_.toJS(i,"",r),n.has(s))throw new Error("Ordered maps must not include duplicate keys");n.set(s,o)}return n}static from(e,r,n){let i=Uk.createPairs(e,r,n),s=new this;return s.items=i.items,s}};rl.tag="tag:yaml.org,2002:omap";var WG={collection:"seq",identify:t=>t instanceof Map,nodeClass:rl,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=Uk.resolvePairs(t,e),n=[];for(let{key:i}of r.items)Lk.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new rl,r)},createNode:(t,e,r)=>rl.from(t,e,r)};G_.YAMLOMap=rl;G_.omap=WG});var zk=V(K_=>{"use strict";var Hk=rr();function Bk({value:t,source:e},r){return e&&(t?Vk:Wk).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var Vk={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Hk.Scalar(!0),stringify:Bk},Wk={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Hk.Scalar(!1),stringify:Bk};K_.falseTag=Wk;K_.trueTag=Vk});var Jk=V(zg=>{"use strict";var zG=rr(),Q_=pc(),JG={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Q_.stringifyNumber},GG={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Q_.stringifyNumber(t)}},YG={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new zG.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Q_.stringifyNumber};zg.float=YG;zg.floatExp=GG;zg.floatNaN=JG});var Yk=V(Ld=>{"use strict";var Gk=pc(),jd=t=>typeof t=="bigint"||Number.isInteger(t);function Jg(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return i==="-"?BigInt(-1)*o:o}let s=parseInt(t,r);return i==="-"?-1*s:s}function Z_(t,e,r){let{value:n}=t;if(jd(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return Gk.stringifyNumber(t)}var KG={identify:jd,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Jg(t,2,2,r),stringify:t=>Z_(t,2,"0b")},QG={identify:jd,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Jg(t,1,8,r),stringify:t=>Z_(t,8,"0")},ZG={identify:jd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Jg(t,0,10,r),stringify:Gk.stringifyNumber},XG={identify:jd,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Jg(t,2,16,r),stringify:t=>Z_(t,16,"0x")};Ld.int=ZG;Ld.intBin=KG;Ld.intHex=XG;Ld.intOct=QG});var eR=V(X_=>{"use strict";var Kg=at(),Gg=Fo(),Yg=jo(),nl=class t extends Yg.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Kg.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Gg.Pair(e.key,null):r=new Gg.Pair(e,null),Yg.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Yg.findPair(this.items,e);return!r&&Kg.isPair(n)?Kg.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=Yg.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Gg.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,s=new this(e);if(r&&Symbol.iterator in Object(r))for(let o of r)typeof i=="function"&&(o=i.call(r,o,o)),s.items.push(Gg.createPair(o,null,n));return s}};nl.tag="tag:yaml.org,2002:set";var eY={collection:"map",identify:t=>t instanceof Set,nodeClass:nl,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>nl.from(t,e,r),resolve(t,e){if(Kg.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new nl,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};X_.YAMLSet=nl;X_.set=eY});var rR=V(Qg=>{"use strict";var tY=pc();function tR(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),s=n.replace(/_/g,"").split(":").reduce((o,l)=>o*i(60)+i(l),i(0));return r==="-"?i(-1)*s:s}function Kk(t){let{value:e}=t,r=o=>o;if(typeof e=="bigint")r=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return tY.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),s=[e%i];return e<60?s.unshift(0):(e=(e-s[0])/i,s.unshift(e%i),e>=60&&(e=(e-s[0])/i,s.unshift(e))),n+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var rY={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>tR(t,r),stringify:Kk},nY={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>tR(t,!1),stringify:Kk},Qk={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Qk.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,s,o,l]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,d=Date.UTC(r,n-1,i,s||0,o||0,l||0,c),p=e[8];if(p&&p!=="Z"){let m=tR(p,!1);Math.abs(m)<30&&(m*=60),d-=6e4*m}return new Date(d)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Qg.floatTime=nY;Qg.intTime=rY;Qg.timestamp=Qk});var eA=V(Xk=>{"use strict";var iY=fc(),sY=Dg(),oY=dc(),aY=Md(),lY=W_(),Zk=zk(),nR=Jk(),Zg=Yk(),uY=Pg(),cY=Y_(),fY=Wg(),dY=eR(),iR=rR(),pY=[iY.map,oY.seq,aY.string,sY.nullTag,Zk.trueTag,Zk.falseTag,Zg.intBin,Zg.intOct,Zg.int,Zg.intHex,nR.floatNaN,nR.floatExp,nR.float,lY.binary,uY.merge,cY.omap,fY.pairs,dY.set,iR.intTime,iR.floatTime,iR.timestamp];Xk.schema=pY});var cA=V(aR=>{"use strict";var iA=fc(),hY=Dg(),sA=dc(),mY=Md(),gY=F_(),sR=j_(),oR=U_(),yY=Tk(),vY=Mk(),oA=W_(),Ud=Pg(),aA=Y_(),lA=Wg(),tA=eA(),uA=eR(),Xg=rR(),rA=new Map([["core",yY.schema],["failsafe",[iA.map,sA.seq,mY.string]],["json",vY.schema],["yaml11",tA.schema],["yaml-1.1",tA.schema]]),nA={binary:oA.binary,bool:gY.boolTag,float:sR.float,floatExp:sR.floatExp,floatNaN:sR.floatNaN,floatTime:Xg.floatTime,int:oR.int,intHex:oR.intHex,intOct:oR.intOct,intTime:Xg.intTime,map:iA.map,merge:Ud.merge,null:hY.nullTag,omap:aA.omap,pairs:lA.pairs,seq:sA.seq,set:uA.set,timestamp:Xg.timestamp},bY={"tag:yaml.org,2002:binary":oA.binary,"tag:yaml.org,2002:merge":Ud.merge,"tag:yaml.org,2002:omap":aA.omap,"tag:yaml.org,2002:pairs":lA.pairs,"tag:yaml.org,2002:set":uA.set,"tag:yaml.org,2002:timestamp":Xg.timestamp};function SY(t,e,r){let n=rA.get(e);if(n&&!t)return r&&!n.includes(Ud.merge)?n.concat(Ud.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let s=Array.from(rA.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)i=i.concat(s);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Ud.merge)),i.reduce((s,o)=>{let l=typeof o=="string"?nA[o]:o;if(!l){let c=JSON.stringify(o),d=Object.keys(nA).map(p=>JSON.stringify(p)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${d}`)}return s.includes(l)||s.push(l),s},[])}aR.coreKnownTags=bY;aR.getTags=SY});var cR=V(fA=>{"use strict";var lR=at(),wY=fc(),_Y=dc(),RY=Md(),ey=cA(),CY=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,uR=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:s,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(e)?ey.getTags(e,"compat"):e?ey.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?ey.coreKnownTags:{},this.tags=ey.getTags(r,this.name,n),this.toStringOptions=l??null,Object.defineProperty(this,lR.MAP,{value:wY.map}),Object.defineProperty(this,lR.SCALAR,{value:RY.string}),Object.defineProperty(this,lR.SEQ,{value:_Y.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?CY:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};fA.Schema=uR});var pA=V(dA=>{"use strict";var xY=at(),fR=Td(),Hd=Id();function EY(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=fR.createStringifyContext(t,e),{commentString:s}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=s(t.commentBefore);r.unshift(Hd.indentComment(c,""))}let o=!1,l=null;if(t.contents){if(xY.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let p=s(t.contents.commentBefore);r.push(Hd.indentComment(p,""))}i.forceBlockIndent=!!t.comment,l=t.contents.comment}let c=l?void 0:()=>o=!0,d=fR.stringify(t.contents,i,()=>l=null,c);l&&(d+=Hd.lineComment(d,"",s(l))),(d[0]==="|"||d[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${d}`:r.push(d)}else r.push(fR.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
|
|
151
151
|
`)?(r.push("..."),r.push(Hd.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||l)&&r[r.length-1]!==""&&r.push(""),r.push(Hd.indentComment(s(c),"")))}return r.join(`
|
|
152
152
|
`)+`
|
|
153
|
-
`}dA.stringifyDocument=EY});var Bd=V(hA=>{"use strict";var qY=qd(),hc=Sg(),Jn=at(),OY=Fo(),IY=To(),PY=cR(),kY=pA(),dR=gg(),AY=g_(),TY=Od(),pR=m_(),hR=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Jn.NODE_TYPE,{value:Jn.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=s;let{version:o}=s;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new pR.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[Jn.NODE_TYPE]:{value:Jn.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Jn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){mc(this.contents)&&this.contents.add(e)}addIn(e,r){mc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=dR.anchorNames(this);e.anchor=!r||n.has(r)?dR.findNewAnchor(r||"a",n):r}return new qY.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let v=
|
|
153
|
+
`}dA.stringifyDocument=EY});var Bd=V(hA=>{"use strict";var qY=qd(),hc=Sg(),Jn=at(),OY=Fo(),IY=To(),PY=cR(),kY=pA(),dR=gg(),AY=g_(),TY=Od(),pR=m_(),hR=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Jn.NODE_TYPE,{value:Jn.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=s;let{version:o}=s;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new pR.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[Jn.NODE_TYPE]:{value:Jn.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Jn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){mc(this.contents)&&this.contents.add(e)}addIn(e,r){mc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=dR.anchorNames(this);e.anchor=!r||n.has(r)?dR.findNewAnchor(r||"a",n):r}return new qY.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let v=E=>typeof E=="number"||E instanceof String||E instanceof Number,_=r.filter(v).map(String);_.length>0&&(r=r.concat(_)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:l,keepUndefined:c,onTagObj:d,tag:p}=n??{},{onAnchor:m,setAnchors:y,sourceObjects:b}=dR.createNodeAnchors(this,o||"a"),q={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:m,onTagObj:d,replacer:i,schema:this.schema,sourceObjects:b},C=TY.createNode(e,p,q);return l&&Jn.isCollection(C)&&(C.flow=!0),y(),C}createPair(e,r,n={}){let i=this.createNode(e,null,n),s=this.createNode(r,null,n);return new OY.Pair(i,s)}delete(e){return mc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return hc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):mc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Jn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return hc.isEmptyPath(e)?!r&&Jn.isScalar(this.contents)?this.contents.value:this.contents:Jn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Jn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return hc.isEmptyPath(e)?this.contents!==void 0:Jn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=hc.collectionFromPath(this.schema,[e],r):mc(this.contents)&&this.contents.set(e,r)}setIn(e,r){hc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=hc.collectionFromPath(this.schema,Array.from(e),r):mc(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new pR.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new pR.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new PY.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:s,reviver:o}={}){let l={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=IY.toJS(this.contents,r??"",l);if(typeof s=="function")for(let{count:d,res:p}of l.anchors.values())s(p,d);return typeof o=="function"?AY.applyReviver(o,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return kY.stringifyDocument(this,e)}};function mc(t){if(Jn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}hA.Document=hR});var zd=V(Wd=>{"use strict";var Vd=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},mR=class extends Vd{constructor(e,r,n){super("YAMLParseError",e,r,n)}},gR=class extends Vd{constructor(e,r,n){super("YAMLWarning",e,r,n)}},$Y=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(l=>e.linePos(l));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let s=i-1,o=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){let l=Math.min(s-39,o.length-79);o="\u2026"+o.substring(l),s-=l-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(o.substring(0,s))){let l=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);l.length>80&&(l=l.substring(0,79)+`\u2026
|
|
154
154
|
`),o=l+o}if(/[^ ]/.test(o)){let l=1,c=r.linePos[1];c?.line===n&&c.col>i&&(l=Math.max(1,Math.min(c.col-i,80-s)));let d=" ".repeat(s)+"^".repeat(l);r.message+=`:
|
|
155
155
|
|
|
156
156
|
${o}
|
|
157
157
|
${d}
|
|
158
|
-
`}};Wd.YAMLError=Vd;Wd.YAMLParseError=mR;Wd.YAMLWarning=gR;Wd.prettifyError=$Y});var Jd=V(mA=>{"use strict";function NY(t,{flow:e,indicator:r,next:n,offset:i,onError:s,parentIndent:o,startOnNewline:l}){let c=!1,d=l,p=l,m="",y="",b=!1,
|
|
159
|
-
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(yR(e.key)||yR(e.value))return!0}return!1;default:return!0}}gA.containsNewline=yR});var vR=V(yA=>{"use strict";var MY=ty();function FY(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&MY.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}yA.flowIndentCheck=FY});var bR=V(bA=>{"use strict";var vA=at();function DY(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(s,o)=>s===o||vA.isScalar(s)&&vA.isScalar(o)&&s.value===o.value;return e.some(s=>i(s.key,r))}bA.mapIncludes=DY});var xA=V(CA=>{"use strict";var SA=Fo(),jY=jo(),wA=Jd(),LY=ty(),_A=vR(),UY=bR(),RA="All mapping items must start at the same column";function HY({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=s?.nodeClass??jY.YAMLMap,l=new o(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,d=null;for(let p of n.items){let{start:m,key:y,sep:b,value:
|
|
160
|
-
`+C.comment:l.comment=C.comment);continue}(C.newlineAfterProp||LY.containsNewline(y))&&i(y??m[m.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else C.found?.indent!==n.indent&&i(c,"BAD_INDENT",RA);r.atKey=!0;let _=C.end,
|
|
161
|
-
`+k.comment:
|
|
162
|
-
`+j.comment:d.comment=j.comment),m=j.end;continue}!o&&r.options.strict&&ZY.containsNewline(k)&&i(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(v===0)j.comma&&i(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`);else if(j.comma||i(j.start,"MISSING_CHAR",`Missing , between ${l} items`),j.comment){let I="";e:for(let R of
|
|
163
|
-
`+I:R.comment=I,j.comment=j.comment.substring(I.length+1)}}if(!o&&!O&&!j.found){let I=M?t(r,M,j,i):e(r,j.end,O,null,j,i);d.items.push(I),m=I.range[2],wR(M)&&i(I.range,"BLOCK_IN_FLOW",SR)}else{r.atKey=!0;let I=j.end,R=k?t(r,k,j,i):e(r,I,
|
|
164
|
-
`+A.comment:R.comment=A.comment);let U=new YY.Pair(R,F);if(r.options.keepSourceTokens&&(U.srcToken=_),o){let D=d;XY.mapIncludes(r,D.items,R)&&i(I,"DUPLICATE_KEY","Map keys must be unique"),D.items.push(U)}else{let D=new IA.YAMLMap(r.schema);D.flow=!0,D.items.push(U);let J=(F??R).range;D.range=[R.range[0],J[1],J[2]],d.items.push(D)}m=F?F.range[2]:A.end}}let y=o?"}":"]",[b,...
|
|
165
|
-
`+v.comment:d.comment=v.comment),d.range=[n.offset,C,v.offset]}else d.range=[n.offset,C,C];return d}kA.resolveFlowCollection=eK});var $A=V(TA=>{"use strict";var tK=at(),rK=rr(),nK=jo(),iK=Lo(),sK=xA(),oK=qA(),aK=AA();function _R(t,e,r,n,i,s){let o=r.type==="block-map"?sK.resolveBlockMap(t,e,r,n,s):r.type==="block-seq"?oK.resolveBlockSeq(t,e,r,n,s):aK.resolveFlowCollection(t,e,r,n,s),l=o.constructor;return i==="!"||i===l.tagName?(o.tag=l.tagName,o):(i&&(o.tag=i),o)}function lK(t,e,r,n,i){let s=n.tag,o=s?e.directives.tagName(s.source,y=>i(s,"TAG_RESOLVE_FAILED",y)):null;if(r.type==="block-seq"){let{anchor:y,newlineAfterProp:b}=n,
|
|
158
|
+
`}};Wd.YAMLError=Vd;Wd.YAMLParseError=mR;Wd.YAMLWarning=gR;Wd.prettifyError=$Y});var Jd=V(mA=>{"use strict";function NY(t,{flow:e,indicator:r,next:n,offset:i,onError:s,parentIndent:o,startOnNewline:l}){let c=!1,d=l,p=l,m="",y="",b=!1,q=!1,C=null,v=null,_=null,E=null,k=null,O=null,M=null;for(let R of t)switch(q&&(R.type!=="space"&&R.type!=="newline"&&R.type!=="comma"&&s(R.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),q=!1),C&&(d&&R.type!=="comment"&&R.type!=="newline"&&s(C,"TAB_AS_INDENT","Tabs are not allowed as indentation"),C=null),R.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&R.source.includes(" ")&&(C=R),p=!0;break;case"comment":{p||s(R,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let A=R.source.substring(1)||" ";m?m+=y+A:m=A,y="",d=!1;break}case"newline":d?m?m+=R.source:(!O||r!=="seq-item-ind")&&(c=!0):y+=R.source,d=!0,b=!0,(v||_)&&(E=R),p=!0;break;case"anchor":v&&s(R,"MULTIPLE_ANCHORS","A node can have at most one anchor"),R.source.endsWith(":")&&s(R.offset+R.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),v=R,M??(M=R.offset),d=!1,p=!1,q=!0;break;case"tag":{_&&s(R,"MULTIPLE_TAGS","A node can have at most one tag"),_=R,M??(M=R.offset),d=!1,p=!1,q=!0;break}case r:(v||_)&&s(R,"BAD_PROP_ORDER",`Anchors and tags must be after the ${R.source} indicator`),O&&s(R,"UNEXPECTED_TOKEN",`Unexpected ${R.source} in ${e??"collection"}`),O=R,d=r==="seq-item-ind"||r==="explicit-key-ind",p=!1;break;case"comma":if(e){k&&s(R,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=R,d=!1,p=!1;break}default:s(R,"UNEXPECTED_TOKEN",`Unexpected ${R.type} token`),d=!1,p=!1}let j=t[t.length-1],I=j?j.offset+j.source.length:i;return q&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&s(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),C&&(d&&C.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&s(C,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:O,spaceBefore:c,comment:m,hasNewline:b,anchor:v,tag:_,newlineAfterProp:E,end:I,start:M??I}}mA.resolveProps=NY});var ty=V(gA=>{"use strict";function yR(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
159
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(yR(e.key)||yR(e.value))return!0}return!1;default:return!0}}gA.containsNewline=yR});var vR=V(yA=>{"use strict";var MY=ty();function FY(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&MY.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}yA.flowIndentCheck=FY});var bR=V(bA=>{"use strict";var vA=at();function DY(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(s,o)=>s===o||vA.isScalar(s)&&vA.isScalar(o)&&s.value===o.value;return e.some(s=>i(s.key,r))}bA.mapIncludes=DY});var xA=V(CA=>{"use strict";var SA=Fo(),jY=jo(),wA=Jd(),LY=ty(),_A=vR(),UY=bR(),RA="All mapping items must start at the same column";function HY({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=s?.nodeClass??jY.YAMLMap,l=new o(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,d=null;for(let p of n.items){let{start:m,key:y,sep:b,value:q}=p,C=wA.resolveProps(m,{indicator:"explicit-key-ind",next:y??b?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),v=!C.found;if(v){if(y&&(y.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in y&&y.indent!==n.indent&&i(c,"BAD_INDENT",RA)),!C.anchor&&!C.tag&&!b){d=C.end,C.comment&&(l.comment?l.comment+=`
|
|
160
|
+
`+C.comment:l.comment=C.comment);continue}(C.newlineAfterProp||LY.containsNewline(y))&&i(y??m[m.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else C.found?.indent!==n.indent&&i(c,"BAD_INDENT",RA);r.atKey=!0;let _=C.end,E=y?t(r,y,C,i):e(r,_,m,null,C,i);r.schema.compat&&_A.flowIndentCheck(n.indent,y,i),r.atKey=!1,UY.mapIncludes(r,l.items,E)&&i(_,"DUPLICATE_KEY","Map keys must be unique");let k=wA.resolveProps(b??[],{indicator:"map-value-ind",next:q,offset:E.range[2],onError:i,parentIndent:n.indent,startOnNewline:!y||y.type==="block-scalar"});if(c=k.end,k.found){v&&(q?.type==="block-map"&&!k.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&C.start<k.found.offset-1024&&i(E.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let O=q?t(r,q,k,i):e(r,c,b,null,k,i);r.schema.compat&&_A.flowIndentCheck(n.indent,q,i),c=O.range[2];let M=new SA.Pair(E,O);r.options.keepSourceTokens&&(M.srcToken=p),l.items.push(M)}else{v&&i(E.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(E.comment?E.comment+=`
|
|
161
|
+
`+k.comment:E.comment=k.comment);let O=new SA.Pair(E);r.options.keepSourceTokens&&(O.srcToken=p),l.items.push(O)}}return d&&d<c&&i(d,"IMPOSSIBLE","Map comment with trailing content"),l.range=[n.offset,c,d??c],l}CA.resolveBlockMap=HY});var qA=V(EA=>{"use strict";var BY=Lo(),VY=Jd(),WY=vR();function zY({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=s?.nodeClass??BY.YAMLSeq,l=new o(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,d=null;for(let{start:p,value:m}of n.items){let y=VY.resolveProps(p,{indicator:"seq-item-ind",next:m,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!y.found)if(y.anchor||y.tag||m)m?.type==="block-seq"?i(y.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{d=y.end,y.comment&&(l.comment=y.comment);continue}let b=m?t(r,m,y,i):e(r,y.end,p,null,y,i);r.schema.compat&&WY.flowIndentCheck(n.indent,m,i),c=b.range[2],l.items.push(b)}return l.range=[n.offset,c,d??c],l}EA.resolveBlockSeq=zY});var gc=V(OA=>{"use strict";function JY(t,e,r,n){let i="";if(t){let s=!1,o="";for(let l of t){let{source:c,type:d}=l;switch(d){case"space":s=!0;break;case"comment":{r&&!s&&n(l,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let p=c.substring(1)||" ";i?i+=o+p:i=p,o="";break}case"newline":i&&(o+=c),s=!0;break;default:n(l,"UNEXPECTED_TOKEN",`Unexpected ${d} at node end`)}e+=c.length}}return{comment:i,offset:e}}OA.resolveEnd=JY});var AA=V(kA=>{"use strict";var GY=at(),YY=Fo(),IA=jo(),KY=Lo(),QY=gc(),PA=Jd(),ZY=ty(),XY=bR(),SR="Block collections are not allowed within flow collections",wR=t=>t&&(t.type==="block-map"||t.type==="block-seq");function eK({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=n.start.source==="{",l=o?"flow map":"flow sequence",c=s?.nodeClass??(o?IA.YAMLMap:KY.YAMLSeq),d=new c(r.schema);d.flow=!0;let p=r.atRoot;p&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let m=n.offset+n.start.source.length;for(let v=0;v<n.items.length;++v){let _=n.items[v],{start:E,key:k,sep:O,value:M}=_,j=PA.resolveProps(E,{flow:l,indicator:"explicit-key-ind",next:k??O?.[0],offset:m,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!j.found){if(!j.anchor&&!j.tag&&!O&&!M){v===0&&j.comma?i(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`):v<n.items.length-1&&i(j.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${l}`),j.comment&&(d.comment?d.comment+=`
|
|
162
|
+
`+j.comment:d.comment=j.comment),m=j.end;continue}!o&&r.options.strict&&ZY.containsNewline(k)&&i(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(v===0)j.comma&&i(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`);else if(j.comma||i(j.start,"MISSING_CHAR",`Missing , between ${l} items`),j.comment){let I="";e:for(let R of E)switch(R.type){case"comma":case"space":break;case"comment":I=R.source.substring(1);break e;default:break e}if(I){let R=d.items[d.items.length-1];GY.isPair(R)&&(R=R.value??R.key),R.comment?R.comment+=`
|
|
163
|
+
`+I:R.comment=I,j.comment=j.comment.substring(I.length+1)}}if(!o&&!O&&!j.found){let I=M?t(r,M,j,i):e(r,j.end,O,null,j,i);d.items.push(I),m=I.range[2],wR(M)&&i(I.range,"BLOCK_IN_FLOW",SR)}else{r.atKey=!0;let I=j.end,R=k?t(r,k,j,i):e(r,I,E,null,j,i);wR(k)&&i(R.range,"BLOCK_IN_FLOW",SR),r.atKey=!1;let A=PA.resolveProps(O??[],{flow:l,indicator:"map-value-ind",next:M,offset:R.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(A.found){if(!o&&!j.found&&r.options.strict){if(O)for(let D of O){if(D===A.found)break;if(D.type==="newline"){i(D,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}j.start<A.found.offset-1024&&i(A.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else M&&("source"in M&&M.source?.[0]===":"?i(M,"MISSING_CHAR",`Missing space after : in ${l}`):i(A.start,"MISSING_CHAR",`Missing , or : between ${l} items`));let F=M?t(r,M,A,i):A.found?e(r,A.end,O,null,A,i):null;F?wR(M)&&i(F.range,"BLOCK_IN_FLOW",SR):A.comment&&(R.comment?R.comment+=`
|
|
164
|
+
`+A.comment:R.comment=A.comment);let U=new YY.Pair(R,F);if(r.options.keepSourceTokens&&(U.srcToken=_),o){let D=d;XY.mapIncludes(r,D.items,R)&&i(I,"DUPLICATE_KEY","Map keys must be unique"),D.items.push(U)}else{let D=new IA.YAMLMap(r.schema);D.flow=!0,D.items.push(U);let J=(F??R).range;D.range=[R.range[0],J[1],J[2]],d.items.push(D)}m=F?F.range[2]:A.end}}let y=o?"}":"]",[b,...q]=n.end,C=m;if(b?.source===y)C=b.offset+b.source.length;else{let v=l[0].toUpperCase()+l.substring(1),_=p?`${v} must end with a ${y}`:`${v} in block collection must be sufficiently indented and end with a ${y}`;i(m,p?"MISSING_CHAR":"BAD_INDENT",_),b&&b.source.length!==1&&q.unshift(b)}if(q.length>0){let v=QY.resolveEnd(q,C,r.options.strict,i);v.comment&&(d.comment?d.comment+=`
|
|
165
|
+
`+v.comment:d.comment=v.comment),d.range=[n.offset,C,v.offset]}else d.range=[n.offset,C,C];return d}kA.resolveFlowCollection=eK});var $A=V(TA=>{"use strict";var tK=at(),rK=rr(),nK=jo(),iK=Lo(),sK=xA(),oK=qA(),aK=AA();function _R(t,e,r,n,i,s){let o=r.type==="block-map"?sK.resolveBlockMap(t,e,r,n,s):r.type==="block-seq"?oK.resolveBlockSeq(t,e,r,n,s):aK.resolveFlowCollection(t,e,r,n,s),l=o.constructor;return i==="!"||i===l.tagName?(o.tag=l.tagName,o):(i&&(o.tag=i),o)}function lK(t,e,r,n,i){let s=n.tag,o=s?e.directives.tagName(s.source,y=>i(s,"TAG_RESOLVE_FAILED",y)):null;if(r.type==="block-seq"){let{anchor:y,newlineAfterProp:b}=n,q=y&&s?y.offset>s.offset?y:s:y??s;q&&(!b||b.offset<q.offset)&&i(q,"MISSING_CHAR","Missing newline after block sequence props")}let l=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!s||!o||o==="!"||o===nK.YAMLMap.tagName&&l==="map"||o===iK.YAMLSeq.tagName&&l==="seq")return _R(t,e,r,i,o);let c=e.schema.tags.find(y=>y.tag===o&&y.collection===l);if(!c){let y=e.schema.knownTags[o];if(y?.collection===l)e.schema.tags.push(Object.assign({},y,{default:!1})),c=y;else return y?i(s,"BAD_COLLECTION_TYPE",`${y.tag} used for ${l} collection, but expects ${y.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),_R(t,e,r,i,o)}let d=_R(t,e,r,i,o,c),p=c.resolve?.(d,y=>i(s,"TAG_RESOLVE_FAILED",y),e.options)??d,m=tK.isNode(p)?p:new rK.Scalar(p);return m.range=d.range,m.tag=o,c?.format&&(m.format=c.format),m}TA.composeCollection=lK});var CR=V(NA=>{"use strict";var RR=rr();function uK(t,e,r){let n=e.offset,i=cK(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let s=i.mode===">"?RR.Scalar.BLOCK_FOLDED:RR.Scalar.BLOCK_LITERAL,o=e.source?fK(e.source):[],l=o.length;for(let C=o.length-1;C>=0;--C){let v=o[C][1];if(v===""||v==="\r")l=C;else break}if(l===0){let C=i.chomp==="+"&&o.length>0?`
|
|
166
166
|
`.repeat(Math.max(1,o.length-1)):"",v=n+i.length;return e.source&&(v+=e.source.length),{value:C,type:s,comment:i.comment,range:[n,v,v]}}let c=e.indent+i.indent,d=e.offset+i.length,p=0;for(let C=0;C<l;++C){let[v,_]=o[C];if(_===""||_==="\r")i.indent===0&&v.length>c&&(c=v.length);else{v.length<c&&r(d+v.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(c=v.length),p=C,c===0&&!t.atRoot&&r(d,"BAD_INDENT","Block scalar values in collections must be indented");break}d+=v.length+_.length+1}for(let C=o.length-1;C>=l;--C)o[C][0].length>c&&(l=C+1);let m="",y="",b=!1;for(let C=0;C<p;++C)m+=o[C][0].slice(c)+`
|
|
167
|
-
`;for(let C=p;C<l;++C){let[v,_]=o[C];d+=v.length+_.length+1;let
|
|
167
|
+
`;for(let C=p;C<l;++C){let[v,_]=o[C];d+=v.length+_.length+1;let E=_[_.length-1]==="\r";if(E&&(_=_.slice(0,-1)),_&&v.length<c){let O=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;r(d-_.length-(E?2:1),"BAD_INDENT",O),v=""}s===RR.Scalar.BLOCK_LITERAL?(m+=y+v.slice(c)+_,y=`
|
|
168
168
|
`):v.length>c||_[0]===" "?(y===" "?y=`
|
|
169
169
|
`:!b&&y===`
|
|
170
170
|
`&&(y=`
|
|
@@ -177,7 +177,7 @@ ${d}
|
|
|
177
177
|
`+o[C][0].slice(c);m[m.length-1]!==`
|
|
178
178
|
`&&(m+=`
|
|
179
179
|
`);break;default:m+=`
|
|
180
|
-
`}let
|
|
180
|
+
`}let q=n+i.length+e.source.length;return{value:m,type:s,comment:i.comment,range:[n,q,q]}}function cK({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],s=i[0],o=0,l="",c=-1;for(let y=1;y<i.length;++y){let b=i[y];if(!l&&(b==="-"||b==="+"))l=b;else{let q=Number(b);!o&&q?o=q:c===-1&&(c=t+y)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let d=!1,p="",m=i.length;for(let y=1;y<e.length;++y){let b=e[y];switch(b.type){case"space":d=!0;case"newline":m+=b.source.length;break;case"comment":r&&!d&&n(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),m+=b.source.length,p=b.source.substring(1);break;case"error":n(b,"UNEXPECTED_TOKEN",b.message),m+=b.source.length;break;default:{let q=`Unexpected token in block scalar header: ${b.type}`;n(b,"UNEXPECTED_TOKEN",q);let C=b.source;C&&typeof C=="string"&&(m+=C.length)}}}return{mode:s,indent:o,chomp:l,comment:p,length:m}}function fK(t){let e=t.split(/\n( *)/),r=e[0],n=r.match(/^( *)/),s=[n?.[1]?[n[1],r.slice(n[1].length)]:["",r]];for(let o=1;o<e.length;o+=2)s.push([e[o],e[o+1]]);return s}NA.resolveBlockScalar=uK});var ER=V(FA=>{"use strict";var xR=rr(),dK=gc();function pK(t,e,r){let{offset:n,type:i,source:s,end:o}=t,l,c,d=(y,b,q)=>r(n+y,b,q);switch(i){case"scalar":l=xR.Scalar.PLAIN,c=hK(s,d);break;case"single-quoted-scalar":l=xR.Scalar.QUOTE_SINGLE,c=mK(s,d);break;case"double-quoted-scalar":l=xR.Scalar.QUOTE_DOUBLE,c=gK(s,d);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+s.length,n+s.length]}}let p=n+s.length,m=dK.resolveEnd(o,p,e,r);return{value:c,type:l,comment:m.comment,range:[n,p,m.offset]}}function hK(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),MA(t)}function mK(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),MA(t.slice(1,-1)).replace(/''/g,"'")}function MA(t){let e,r;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
181
181
|
`,"sy"),r=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
182
182
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(t);if(!n)return t;let i=n[1],s=" ",o=e.lastIndex;for(r.lastIndex=o;n=r.exec(t);)n[1]===""?s===`
|
|
183
183
|
`?i+=s:s=`
|
|
@@ -232,16 +232,16 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
|
|
|
232
232
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
233
233
|
`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){ly(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",s=[];if(i&&r.sep&&!r.value){let o=[];for(let l=0;l<r.sep.length;++l){let c=r.sep[l];switch(c.type){case"newline":o.push(l);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=r.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Uo(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(pT(r.key)&&!Uo(r.sep,"newline")){let o=yc(r.start),l=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:l,sep:c}]})}else s.length>0?r.sep=r.sep.concat(s,this.sourceToken):r.sep.push(this.sourceToken);else if(Uo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let o=yc(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:s,key:null,sep:[this.sourceToken]}):Uo(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);i||r.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(o):(Object.assign(r,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Uo(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){ly(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||Uo(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=ay(n),s=yc(i);dT(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let l={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(`
|
|
234
234
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
235
|
-
`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=ay(e),n=yc(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=ay(e),n=yc(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};hT.Parser=BR});var bT=V(Zd=>{"use strict";var mT=PR(),a4=Bd(),Qd=zd(),l4=O_(),u4=at(),c4=HR(),gT=VR();function yT(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new c4.LineCounter||null,prettyErrors:e}}function f4(t,e={}){let{lineCounter:r,prettyErrors:n}=yT(e),i=new gT.Parser(r?.addNewLine),s=new mT.Composer(e),o=Array.from(s.compose(i.parse(t)));if(n&&r)for(let l of o)l.errors.forEach(Qd.prettifyError(t,r)),l.warnings.forEach(Qd.prettifyError(t,r));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function vT(t,e={}){let{lineCounter:r,prettyErrors:n}=yT(e),i=new gT.Parser(r?.addNewLine),s=new mT.Composer(e),o=null;for(let l of s.compose(i.parse(t),!0,t.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new Qd.YAMLParseError(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(o.errors.forEach(Qd.prettifyError(t,r)),o.warnings.forEach(Qd.prettifyError(t,r))),o}function d4(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=vT(t,r);if(!i)return null;if(i.warnings.forEach(s=>l4.warn(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function p4(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return u4.isDocument(t)&&!n?t.toString(r):new a4.Document(t,n,r).toString(r)}Zd.parse=d4;Zd.parseAllDocuments=f4;Zd.parseDocument=vT;Zd.stringify=p4});var Xd=V(Ct=>{"use strict";var h4=PR(),m4=Bd(),g4=cR(),WR=zd(),y4=qd(),Ho=at(),v4=Fo(),b4=rr(),S4=jo(),w4=Lo(),_4=sy(),R4=LR(),C4=HR(),x4=VR(),uy=bT(),ST=Rd();Ct.Composer=h4.Composer;Ct.Document=m4.Document;Ct.Schema=g4.Schema;Ct.YAMLError=WR.YAMLError;Ct.YAMLParseError=WR.YAMLParseError;Ct.YAMLWarning=WR.YAMLWarning;Ct.Alias=y4.Alias;Ct.isAlias=Ho.isAlias;Ct.isCollection=Ho.isCollection;Ct.isDocument=Ho.isDocument;Ct.isMap=Ho.isMap;Ct.isNode=Ho.isNode;Ct.isPair=Ho.isPair;Ct.isScalar=Ho.isScalar;Ct.isSeq=Ho.isSeq;Ct.Pair=v4.Pair;Ct.Scalar=b4.Scalar;Ct.YAMLMap=S4.YAMLMap;Ct.YAMLSeq=w4.YAMLSeq;Ct.CST=_4;Ct.Lexer=R4.Lexer;Ct.LineCounter=C4.LineCounter;Ct.Parser=x4.Parser;Ct.parse=uy.parse;Ct.parseAllDocuments=uy.parseAllDocuments;Ct.parseDocument=uy.parseDocument;Ct.stringify=uy.stringify;Ct.visit=ST.visit;Ct.visitAsync=ST.visitAsync});var E4,q4,O4,I4,P4,k4,A4,Ns,cy=ae(()=>{"use strict";E4=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/,q4=/^\d{4}-\d{2}-\d{2}$/,O4=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,I4=/^https?:\/\/[^\s]+$/,P4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,k4=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,A4=/^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,Ns=class{inferFromValue(e){if(e==null)return{nullable:!0};if(Array.isArray(e))return this.inferArraySchema(e);switch(typeof e){case"string":return this.inferStringSchema(e);case"number":return Number.isInteger(e)?{type:"integer"}:{type:"number"};case"boolean":return{type:"boolean"};case"object":return this.inferObjectSchema(e);default:return{}}}mergeSchemas(e,r){if(!e||Object.keys(e).length===0)return{...r};if(!r||Object.keys(r).length===0)return{...e};let n=e.nullable||r.nullable;if(!e.type&&e.nullable)return{...r,nullable:!0};if(!r.type&&r.nullable)return{...e,nullable:!0};if(e.type!==r.type)return e.type==="integer"&&r.type==="number"||e.type==="number"&&r.type==="integer"?{type:"number",...n&&{nullable:!0}}:{...n&&{nullable:!0}};let i={type:e.type};return n&&(i.nullable=!0),e.type==="object"&&r.type==="object"?this.mergeObjectSchemas(e,r,n):e.type==="array"&&r.type==="array"?this.mergeArraySchemas(e,r,n):(e.format&&e.format===r.format&&(i.format=e.format),i)}inferStringFormat(e){if(E4.test(e))return"date-time";if(q4.test(e))return"date";if(O4.test(e))return"email";if(P4.test(e))return"uuid";if(I4.test(e))return"uri";if(k4.test(e))return"ipv4";if(A4.test(e))return"ipv6"}inferStringSchema(e){let r={type:"string"},n=this.inferStringFormat(e);return n&&(r.format=n),r}inferArraySchema(e){let r={type:"array"};if(e.length===0)return r;let n=this.inferFromValue(e[0]);for(let i=1;i<e.length;i++)n=this.mergeSchemas(n,this.inferFromValue(e[i]));return r.items=n,r}inferObjectSchema(e){let r={type:"object",properties:{}},n=Object.keys(e);for(let i of n)r.properties[i]=this.inferFromValue(e[i]);return r}mergeObjectSchemas(e,r,n){let i={type:"object",properties:{},...n&&{nullable:!0}},s=e.properties||{},o=r.properties||{},l=new Set([...Object.keys(s),...Object.keys(o)]);for(let m of l)s[m]&&o[m]?i.properties[m]=this.mergeSchemas(s[m],o[m]):s[m]?i.properties[m]={...s[m]}:i.properties[m]={...o[m]};let c=new Set(e.required||Object.keys(s)),d=new Set(r.required||Object.keys(o)),p=[...l].filter(m=>c.has(m)&&d.has(m));return p.length>0&&(i.required=p),i}mergeArraySchemas(e,r,n){let i={type:"array",...n&&{nullable:!0}};return e.items&&r.items?i.items=this.mergeSchemas(e.items,r.items):e.items?i.items={...e.items}:r.items&&(i.items={...r.items}),i}}});var wT,T4,ol,zR=ae(()=>{"use strict";wT=ve(Xd());cy();T4=new Set(["content-type","authorization","accept","cookie","host","content-length"]),ol=class{constructor(e,r,n){this.collectionService=e;this.envConfigService=r;this.inferenceService=n;this.inferrer=new Ns}collectionService;envConfigService;inferenceService;inferrer;async export(e,r){let n=this.collectionService.getCollection(e);if(!n)throw new Error(`Collection ${e} not found`);let i={openapi:"3.0.3",info:this.buildInfo(n,r),servers:this.buildServers(r),paths:{},components:{schemas:{},securitySchemes:{}},tags:[]},s=new Map;if(n.auth&&n.auth.type!=="none"&&n.auth.type!=="inherit"){let c=this.mapAuthToSecurityScheme(n.auth);if(c){let{schemeName:d,scheme:p,requirement:m}=c;s.set(d,p),i.security=[m]}}let o=new Set,l=new Set;if(await this.processItems(n.items,i,s,o,l,void 0,n,r),this.augmentServersFromHostVars(l,i.servers,r),s.size>0)for(let[c,d]of s)i.components.securitySchemes[c]=d;else delete i.components.securitySchemes;return i.tags=[...o].map(c=>({name:c})),i.tags.length===0&&delete i.tags,this.deduplicateComponents(i),Object.keys(i.components.schemas).length===0&&delete i.components.schemas,Object.keys(i.components).length===0&&delete i.components,r.format==="yaml"?wT.stringify(i,{indent:2}):JSON.stringify(i,null,2)}buildInfo(e,r){return{title:r.info?.title||e.name,description:r.info?.description||e.description||"",version:r.info?.version||e.version||"1.0.0"}}buildServers(e){let r=[],n=e.environments||[];if(n.length===0){let i=this.envConfigService.getSelectedEnvironment();if(i){let s=this.envConfigService.resolveVariables("{{baseUrl}}",i);s&&s!=="{{baseUrl}}"&&r.push({url:s,description:i})}}else{let i=new Set;for(let s of n){let o=this.envConfigService.resolveVariables("{{baseUrl}}",s);o&&o!=="{{baseUrl}}"&&!i.has(o)&&(i.add(o),r.push({url:o,description:s}))}}return r.length===0&&r.push({url:"http://localhost",description:"Default server"}),r}async processItems(e,r,n,i,s,o,l,c){for(let d of e)if(d.type==="folder"){let p=d,m=o||p.name;i.add(m),p.items&&await this.processItems(p.items,r,n,i,s,m,l,c)}else{let p=d;await this.processRequest(p,r,n,i,s,o,l,c)}}async processRequest(e,r,n,i,s,o,l,c){let{path:d,hostVar:p}=this.normalizeUrl(e.url);p&&s.add(p);let m=(e.method||"GET").toLowerCase();r.paths[d]||(r.paths[d]={});let y={};y.operationId=e.operationId||this.generateOperationId(e,m,d,r),y.summary=e.summary||this.cleanSummary(e.name),e.description&&(y.description=e.description),(e.deprecated||this.hasDeprecatedPrefix(e.name))&&(y.deprecated=!0,this.hasDeprecatedPrefix(e.name)&&(y.summary=e.name.replace(/^\[DEPRECATED\]\s*/i,"")));let b=e.tags;if(b&&b.length>0){y.tags=b;for(let k of b)i.add(k)}else o&&(y.tags=[o]);let E=this.buildParameters(e);E.length>0&&(y.parameters=E);let C=await this.buildRequestBody(e,c);C&&(y.requestBody=C);let v=e.responses;v&&Object.keys(v).length>0?y.responses=this.mapResponseDefinitions(v):y.responses=await this.buildResponses(e,l.id,c);let _=e.security;if(_&&_.length>0)y.security=_;else{let k=this.buildOperationSecurity(e,l,n);k!==void 0&&(y.security=k)}let q=r.paths[d][m];q?this.mergeOperation(q,y,e.name):r.paths[d][m]=y}mergeOperation(e,r,n){if(r.summary&&r.summary!==e.summary&&(e.description=(e.description||e.summary||"")+`
|
|
235
|
+
`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=ay(e),n=yc(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=ay(e),n=yc(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};hT.Parser=BR});var bT=V(Zd=>{"use strict";var mT=PR(),a4=Bd(),Qd=zd(),l4=O_(),u4=at(),c4=HR(),gT=VR();function yT(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new c4.LineCounter||null,prettyErrors:e}}function f4(t,e={}){let{lineCounter:r,prettyErrors:n}=yT(e),i=new gT.Parser(r?.addNewLine),s=new mT.Composer(e),o=Array.from(s.compose(i.parse(t)));if(n&&r)for(let l of o)l.errors.forEach(Qd.prettifyError(t,r)),l.warnings.forEach(Qd.prettifyError(t,r));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function vT(t,e={}){let{lineCounter:r,prettyErrors:n}=yT(e),i=new gT.Parser(r?.addNewLine),s=new mT.Composer(e),o=null;for(let l of s.compose(i.parse(t),!0,t.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new Qd.YAMLParseError(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(o.errors.forEach(Qd.prettifyError(t,r)),o.warnings.forEach(Qd.prettifyError(t,r))),o}function d4(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=vT(t,r);if(!i)return null;if(i.warnings.forEach(s=>l4.warn(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function p4(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return u4.isDocument(t)&&!n?t.toString(r):new a4.Document(t,n,r).toString(r)}Zd.parse=d4;Zd.parseAllDocuments=f4;Zd.parseDocument=vT;Zd.stringify=p4});var Xd=V(Ct=>{"use strict";var h4=PR(),m4=Bd(),g4=cR(),WR=zd(),y4=qd(),Ho=at(),v4=Fo(),b4=rr(),S4=jo(),w4=Lo(),_4=sy(),R4=LR(),C4=HR(),x4=VR(),uy=bT(),ST=Rd();Ct.Composer=h4.Composer;Ct.Document=m4.Document;Ct.Schema=g4.Schema;Ct.YAMLError=WR.YAMLError;Ct.YAMLParseError=WR.YAMLParseError;Ct.YAMLWarning=WR.YAMLWarning;Ct.Alias=y4.Alias;Ct.isAlias=Ho.isAlias;Ct.isCollection=Ho.isCollection;Ct.isDocument=Ho.isDocument;Ct.isMap=Ho.isMap;Ct.isNode=Ho.isNode;Ct.isPair=Ho.isPair;Ct.isScalar=Ho.isScalar;Ct.isSeq=Ho.isSeq;Ct.Pair=v4.Pair;Ct.Scalar=b4.Scalar;Ct.YAMLMap=S4.YAMLMap;Ct.YAMLSeq=w4.YAMLSeq;Ct.CST=_4;Ct.Lexer=R4.Lexer;Ct.LineCounter=C4.LineCounter;Ct.Parser=x4.Parser;Ct.parse=uy.parse;Ct.parseAllDocuments=uy.parseAllDocuments;Ct.parseDocument=uy.parseDocument;Ct.stringify=uy.stringify;Ct.visit=ST.visit;Ct.visitAsync=ST.visitAsync});var E4,q4,O4,I4,P4,k4,A4,Ns,cy=ae(()=>{"use strict";E4=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/,q4=/^\d{4}-\d{2}-\d{2}$/,O4=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,I4=/^https?:\/\/[^\s]+$/,P4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,k4=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,A4=/^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,Ns=class{inferFromValue(e){if(e==null)return{nullable:!0};if(Array.isArray(e))return this.inferArraySchema(e);switch(typeof e){case"string":return this.inferStringSchema(e);case"number":return Number.isInteger(e)?{type:"integer"}:{type:"number"};case"boolean":return{type:"boolean"};case"object":return this.inferObjectSchema(e);default:return{}}}mergeSchemas(e,r){if(!e||Object.keys(e).length===0)return{...r};if(!r||Object.keys(r).length===0)return{...e};let n=e.nullable||r.nullable;if(!e.type&&e.nullable)return{...r,nullable:!0};if(!r.type&&r.nullable)return{...e,nullable:!0};if(e.type!==r.type)return e.type==="integer"&&r.type==="number"||e.type==="number"&&r.type==="integer"?{type:"number",...n&&{nullable:!0}}:{...n&&{nullable:!0}};let i={type:e.type};return n&&(i.nullable=!0),e.type==="object"&&r.type==="object"?this.mergeObjectSchemas(e,r,n):e.type==="array"&&r.type==="array"?this.mergeArraySchemas(e,r,n):(e.format&&e.format===r.format&&(i.format=e.format),i)}inferStringFormat(e){if(E4.test(e))return"date-time";if(q4.test(e))return"date";if(O4.test(e))return"email";if(P4.test(e))return"uuid";if(I4.test(e))return"uri";if(k4.test(e))return"ipv4";if(A4.test(e))return"ipv6"}inferStringSchema(e){let r={type:"string"},n=this.inferStringFormat(e);return n&&(r.format=n),r}inferArraySchema(e){let r={type:"array"};if(e.length===0)return r;let n=this.inferFromValue(e[0]);for(let i=1;i<e.length;i++)n=this.mergeSchemas(n,this.inferFromValue(e[i]));return r.items=n,r}inferObjectSchema(e){let r={type:"object",properties:{}},n=Object.keys(e);for(let i of n)r.properties[i]=this.inferFromValue(e[i]);return r}mergeObjectSchemas(e,r,n){let i={type:"object",properties:{},...n&&{nullable:!0}},s=e.properties||{},o=r.properties||{},l=new Set([...Object.keys(s),...Object.keys(o)]);for(let m of l)s[m]&&o[m]?i.properties[m]=this.mergeSchemas(s[m],o[m]):s[m]?i.properties[m]={...s[m]}:i.properties[m]={...o[m]};let c=new Set(e.required||Object.keys(s)),d=new Set(r.required||Object.keys(o)),p=[...l].filter(m=>c.has(m)&&d.has(m));return p.length>0&&(i.required=p),i}mergeArraySchemas(e,r,n){let i={type:"array",...n&&{nullable:!0}};return e.items&&r.items?i.items=this.mergeSchemas(e.items,r.items):e.items?i.items={...e.items}:r.items&&(i.items={...r.items}),i}}});var wT,T4,ol,zR=ae(()=>{"use strict";wT=ve(Xd());cy();T4=new Set(["content-type","authorization","accept","cookie","host","content-length"]),ol=class{constructor(e,r,n){this.collectionService=e;this.envConfigService=r;this.inferenceService=n;this.inferrer=new Ns}collectionService;envConfigService;inferenceService;inferrer;async export(e,r){let n=this.collectionService.getCollection(e);if(!n)throw new Error(`Collection ${e} not found`);let i={openapi:"3.0.3",info:this.buildInfo(n,r),servers:this.buildServers(r),paths:{},components:{schemas:{},securitySchemes:{}},tags:[]},s=new Map;if(n.auth&&n.auth.type!=="none"&&n.auth.type!=="inherit"){let c=this.mapAuthToSecurityScheme(n.auth);if(c){let{schemeName:d,scheme:p,requirement:m}=c;s.set(d,p),i.security=[m]}}let o=new Set,l=new Set;if(await this.processItems(n.items,i,s,o,l,void 0,n,r),this.augmentServersFromHostVars(l,i.servers,r),s.size>0)for(let[c,d]of s)i.components.securitySchemes[c]=d;else delete i.components.securitySchemes;return i.tags=[...o].map(c=>({name:c})),i.tags.length===0&&delete i.tags,this.deduplicateComponents(i),Object.keys(i.components.schemas).length===0&&delete i.components.schemas,Object.keys(i.components).length===0&&delete i.components,r.format==="yaml"?wT.stringify(i,{indent:2}):JSON.stringify(i,null,2)}buildInfo(e,r){return{title:r.info?.title||e.name,description:r.info?.description||e.description||"",version:r.info?.version||e.version||"1.0.0"}}buildServers(e){let r=[],n=e.environments||[];if(n.length===0){let i=this.envConfigService.getSelectedEnvironment();if(i){let s=this.envConfigService.resolveVariables("{{baseUrl}}",i);s&&s!=="{{baseUrl}}"&&r.push({url:s,description:i})}}else{let i=new Set;for(let s of n){let o=this.envConfigService.resolveVariables("{{baseUrl}}",s);o&&o!=="{{baseUrl}}"&&!i.has(o)&&(i.add(o),r.push({url:o,description:s}))}}return r.length===0&&r.push({url:"http://localhost",description:"Default server"}),r}async processItems(e,r,n,i,s,o,l,c){for(let d of e)if(d.type==="folder"){let p=d,m=o||p.name;i.add(m),p.items&&await this.processItems(p.items,r,n,i,s,m,l,c)}else{let p=d;await this.processRequest(p,r,n,i,s,o,l,c)}}async processRequest(e,r,n,i,s,o,l,c){let{path:d,hostVar:p}=this.normalizeUrl(e.url);p&&s.add(p);let m=(e.method||"GET").toLowerCase();r.paths[d]||(r.paths[d]={});let y={};y.operationId=e.operationId||this.generateOperationId(e,m,d,r),y.summary=e.summary||this.cleanSummary(e.name),e.description&&(y.description=e.description),(e.deprecated||this.hasDeprecatedPrefix(e.name))&&(y.deprecated=!0,this.hasDeprecatedPrefix(e.name)&&(y.summary=e.name.replace(/^\[DEPRECATED\]\s*/i,"")));let b=e.tags;if(b&&b.length>0){y.tags=b;for(let k of b)i.add(k)}else o&&(y.tags=[o]);let q=this.buildParameters(e);q.length>0&&(y.parameters=q);let C=await this.buildRequestBody(e,c);C&&(y.requestBody=C);let v=e.responses;v&&Object.keys(v).length>0?y.responses=this.mapResponseDefinitions(v):y.responses=await this.buildResponses(e,l.id,c);let _=e.security;if(_&&_.length>0)y.security=_;else{let k=this.buildOperationSecurity(e,l,n);k!==void 0&&(y.security=k)}let E=r.paths[d][m];E?this.mergeOperation(E,y,e.name):r.paths[d][m]=y}mergeOperation(e,r,n){if(r.summary&&r.summary!==e.summary&&(e.description=(e.description||e.summary||"")+`
|
|
236
236
|
|
|
237
237
|
Variant: **${n}**`+(r.description?` \u2014 ${r.description}`:"")),r.tags){let i=new Set(e.tags||[]);for(let s of r.tags)i.add(s);e.tags=[...i]}if(r.parameters){e.parameters||(e.parameters=[]);for(let i of r.parameters){let s=e.parameters.find(o=>o.name===i.name&&o.in===i.in);s?this.mergeParameterSchema(s,i,n):e.parameters.push(i)}}if(r.responses){e.responses||(e.responses={});for(let[i,s]of Object.entries(r.responses))e.responses[i]||(e.responses[i]=s)}if(r.requestBody?.content&&e.requestBody?.content)for(let[i,s]of Object.entries(r.requestBody.content))e.requestBody.content[i]||(e.requestBody.content[i]=s);else r.requestBody&&!e.requestBody&&(e.requestBody=r.requestBody)}mergeParameterSchema(e,r,n){e.schema||(e.schema={});let i=e.schema,s=r.schema||{},o=this.getConstraintKind(i),l=this.getConstraintKind(s);if(o==="none"&&l==="none")this.widenType(i,s);else if(o==="none")Object.assign(i,this.extractConstraints(s)),this.widenType(i,s);else if(l==="none")this.widenType(i,s);else if(o===l)this.mergeSameKindConstraints(i,s,o),this.widenType(i,s);else{if(i.oneOf){let c=this.buildVariantSchema(s);i.oneOf.some(d=>JSON.stringify(d)===JSON.stringify(c))||i.oneOf.push(c)}else if(s.oneOf){let c=this.buildVariantSchema(i);i.oneOf=[c,...s.oneOf]}else{let c=this.buildVariantSchema(i),d=this.buildVariantSchema(s);i.oneOf=[c,d]}this.stripConstraints(i)}if(r.description&&r.description!==e.description&&(e.description=(e.description||"")+(e.description?"; ":"")+r.description),r.example!==void 0&&r.example!==e.example){e.examples||(e.examples={},e.example!==void 0&&(e.examples.variant1={value:e.example}));let c=`variant_${n.replace(/[^a-zA-Z0-9_]/g,"_")}`;e.examples[c]={value:r.example},delete e.example}}getConstraintKind(e){return e.oneOf?"oneOf":e.enum&&e.enum.length>0?"enum":e.pattern?"pattern":e.minimum!==void 0||e.maximum!==void 0||e.exclusiveMinimum!==void 0||e.exclusiveMaximum!==void 0||e.multipleOf!==void 0?"range":e.minLength!==void 0||e.maxLength!==void 0?"length":e.minItems!==void 0||e.maxItems!==void 0||e.uniqueItems?"array":e.format?"format":"none"}mergeSameKindConstraints(e,r,n){switch(n){case"enum":{let i=new Set(e.enum||[]);for(let s of r.enum||[])i.add(s);e.enum=[...i];break}case"pattern":{r.pattern&&r.pattern!==e.pattern&&(e.pattern=`(?:${e.pattern})|(?:${r.pattern})`);break}case"range":{r.minimum!==void 0&&(e.minimum=e.minimum!==void 0?Math.min(e.minimum,r.minimum):r.minimum),r.maximum!==void 0&&(e.maximum=e.maximum!==void 0?Math.max(e.maximum,r.maximum):r.maximum),r.exclusiveMinimum&&(e.exclusiveMinimum=!0),r.exclusiveMaximum&&(e.exclusiveMaximum=!0),r.multipleOf!==void 0&&(e.multipleOf=e.multipleOf!==void 0?Math.min(e.multipleOf,r.multipleOf):r.multipleOf);break}case"length":{r.minLength!==void 0&&(e.minLength=e.minLength!==void 0?Math.min(e.minLength,r.minLength):r.minLength),r.maxLength!==void 0&&(e.maxLength=e.maxLength!==void 0?Math.max(e.maxLength,r.maxLength):r.maxLength);break}case"array":{r.minItems!==void 0&&(e.minItems=e.minItems!==void 0?Math.min(e.minItems,r.minItems):r.minItems),r.maxItems!==void 0&&(e.maxItems=e.maxItems!==void 0?Math.max(e.maxItems,r.maxItems):r.maxItems),r.uniqueItems&&(e.uniqueItems=!0);break}case"format":{if(r.format&&r.format!==e.format){let i={type:e.type||"string",format:e.format},s={type:r.type||"string",format:r.format};delete e.format,e.oneOf=[i,s]}break}case"oneOf":{if(r.oneOf)for(let i of r.oneOf)e.oneOf.some(s=>JSON.stringify(s)===JSON.stringify(i))||e.oneOf.push(i);break}}}buildVariantSchema(e){let r={};return e.type&&(r.type=e.type),e.enum&&(r.enum=[...e.enum]),e.pattern&&(r.pattern=e.pattern),e.format&&(r.format=e.format),e.minimum!==void 0&&(r.minimum=e.minimum),e.maximum!==void 0&&(r.maximum=e.maximum),e.exclusiveMinimum!==void 0&&(r.exclusiveMinimum=e.exclusiveMinimum),e.exclusiveMaximum!==void 0&&(r.exclusiveMaximum=e.exclusiveMaximum),e.multipleOf!==void 0&&(r.multipleOf=e.multipleOf),e.minLength!==void 0&&(r.minLength=e.minLength),e.maxLength!==void 0&&(r.maxLength=e.maxLength),e.minItems!==void 0&&(r.minItems=e.minItems),e.maxItems!==void 0&&(r.maxItems=e.maxItems),e.uniqueItems&&(r.uniqueItems=!0),e.nullable&&(r.nullable=!0),r}stripConstraints(e){delete e.enum,delete e.pattern,delete e.format,delete e.minimum,delete e.maximum,delete e.exclusiveMinimum,delete e.exclusiveMaximum,delete e.multipleOf,delete e.minLength,delete e.maxLength,delete e.minItems,delete e.maxItems,delete e.uniqueItems,delete e.nullable}extractConstraints(e){let r={};return e.enum&&(r.enum=[...e.enum]),e.pattern&&(r.pattern=e.pattern),e.format&&(r.format=e.format),e.minimum!==void 0&&(r.minimum=e.minimum),e.maximum!==void 0&&(r.maximum=e.maximum),e.exclusiveMinimum!==void 0&&(r.exclusiveMinimum=e.exclusiveMinimum),e.exclusiveMaximum!==void 0&&(r.exclusiveMaximum=e.exclusiveMaximum),e.multipleOf!==void 0&&(r.multipleOf=e.multipleOf),e.minLength!==void 0&&(r.minLength=e.minLength),e.maxLength!==void 0&&(r.maxLength=e.maxLength),e.minItems!==void 0&&(r.minItems=e.minItems),e.maxItems!==void 0&&(r.maxItems=e.maxItems),e.uniqueItems&&(r.uniqueItems=!0),e.nullable&&(r.nullable=!0),r}widenType(e,r){!r.type||r.type===e.type||(e.type?(e.type==="integer"&&r.type==="number"||e.type==="number"&&r.type==="integer")&&(e.type="number"):e.type=r.type)}normalizeUrl(e){let r=e,n=null,i=r.match(/^\{\{(\w+)\}\}/);return i&&(n=i[1],r=r.slice(i[0].length)),r=r.replace(/:([a-zA-Z_]\w*)/g,"{$1}"),r=r.replace(/\{\{(\w+)\}\}/g,"{$1}"),r.startsWith("/")||(r="/"+r),r.length>1&&r.endsWith("/")&&(r=r.slice(0,-1)),r=r.replace(/\/\//g,"/"),{path:r,hostVar:n}}generateOperationId(e,r,n,i){let s=this.toCamelCase(e.name),o=this.collectOperationIds(i);if(o.has(s)&&(s=`${s}${r.charAt(0).toUpperCase()}${r.slice(1)}`),!s||o.has(s)){let l=n.split("/").filter(c=>c&&!c.startsWith("{"));s=r+l.map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join("")}return s}collectOperationIds(e){let r=new Set;if(e.paths)for(let n of Object.values(e.paths))for(let i of Object.values(n))i.operationId&&r.add(i.operationId);return r}toCamelCase(e){return e.replace(/[^a-zA-Z0-9]+(.)/g,(r,n)=>n.toUpperCase()).replace(/^[A-Z]/,r=>r.toLowerCase()).replace(/[^a-zA-Z0-9]/g,"")}buildParameters(e){let r=[];if(e.params)for(let[n,i]of Object.entries(e.params)){let s={name:n,in:"path",required:!0};if(typeof i=="string")s.schema={type:this.inferTypeFromValue(i)},s.example=this.coerceExample(i,s.schema.type);else{let o=i;o.oneOf?(s.schema={oneOf:o.oneOf},o.type&&(s.schema.type=o.type)):(s.schema={type:o.type||this.inferTypeFromValue(o.value)},o.format&&(s.schema.format=o.format),o.enum&&(s.schema.enum=o.enum),o.pattern&&(s.schema.pattern=o.pattern),o.minimum!==void 0&&(s.schema.minimum=o.minimum),o.maximum!==void 0&&(s.schema.maximum=o.maximum),o.exclusiveMinimum!==void 0&&(s.schema.exclusiveMinimum=o.exclusiveMinimum),o.exclusiveMaximum!==void 0&&(s.schema.exclusiveMaximum=o.exclusiveMaximum),o.multipleOf!==void 0&&(s.schema.multipleOf=o.multipleOf),o.minLength!==void 0&&(s.schema.minLength=o.minLength),o.maxLength!==void 0&&(s.schema.maxLength=o.maxLength),o.minItems!==void 0&&(s.schema.minItems=o.minItems),o.maxItems!==void 0&&(s.schema.maxItems=o.maxItems),o.uniqueItems&&(s.schema.uniqueItems=!0),o.nullable&&(s.schema.nullable=!0)),o.description&&(s.description=o.description),o.deprecated&&(s.deprecated=!0),s.example=this.coerceExample(o.value,s.schema.type||"string")}r.push(s)}if(e.query)for(let n of e.query){if(!n.key)continue;let i=this.buildKeyValueParam(n,"query");r.push(i)}if(e.headers){let n=e.headers.find(i=>i.key.toLowerCase()==="cookie");if(n){let i=this.parseCookieHeader(n.value);r.push(...i)}for(let i of e.headers){if(!i.key||T4.has(i.key.toLowerCase()))continue;let s=this.buildKeyValueParam(i,"header");r.push(s)}}return r}buildKeyValueParam(e,r){let n={name:e.key,in:r,schema:{}};return e.oneOf?(n.schema.oneOf=e.oneOf,e.type&&(n.schema.type=e.type)):(n.schema.type=e.type||"string",e.format&&(n.schema.format=e.format),e.enum&&(n.schema.enum=e.enum),e.pattern&&(n.schema.pattern=e.pattern),e.minimum!==void 0&&(n.schema.minimum=e.minimum),e.maximum!==void 0&&(n.schema.maximum=e.maximum),e.exclusiveMinimum!==void 0&&(n.schema.exclusiveMinimum=e.exclusiveMinimum),e.exclusiveMaximum!==void 0&&(n.schema.exclusiveMaximum=e.exclusiveMaximum),e.multipleOf!==void 0&&(n.schema.multipleOf=e.multipleOf),e.minLength!==void 0&&(n.schema.minLength=e.minLength),e.maxLength!==void 0&&(n.schema.maxLength=e.maxLength),e.minItems!==void 0&&(n.schema.minItems=e.minItems),e.maxItems!==void 0&&(n.schema.maxItems=e.maxItems),e.uniqueItems&&(n.schema.uniqueItems=!0),e.nullable&&(n.schema.nullable=!0)),e.required&&(n.required=!0),e.description&&(n.description=e.description),e.deprecated&&(n.deprecated=!0),e.value&&(n.example=this.coerceExample(e.value,n.schema.type||"string")),n}parseCookieHeader(e){let r=[],n=e.split(";").map(i=>i.trim()).filter(Boolean);for(let i of n){let s=i.indexOf("=");if(s>0){let o=i.substring(0,s).trim(),l=i.substring(s+1).trim();r.push({name:o,in:"cookie",schema:{type:"string"},example:l})}}return r}inferTypeFromValue(e){return/^-?\d+$/.test(e)?"integer":/^-?\d+\.\d+$/.test(e)?"number":e==="true"||e==="false"?"boolean":"string"}coerceExample(e,r){let n=this.sanitizeEnvVar(e);switch(r){case"integer":return parseInt(n,10)||n;case"number":return parseFloat(n)||n;case"boolean":return n==="true";default:return n}}sanitizeEnvVar(e){return e.replace(/\{\{(\w+)\}\}/g,"<$1>")}sanitizeObjectExamples(e){if(typeof e=="string")return this.sanitizeEnvVar(e);if(Array.isArray(e))return e.map(r=>this.sanitizeObjectExamples(r));if(e!==null&&typeof e=="object"){let r={};for(let[n,i]of Object.entries(e))r[n]=this.sanitizeObjectExamples(i);return r}return e}async buildRequestBody(e,r){if(!e.body||e.body.type==="none")return null;let n=e.body,i={required:!0,content:{}},s,o,l,c;if(e.bodySchema){if(e.bodySchema.content){for(let[m,y]of Object.entries(e.bodySchema.content)){let b={};y.schema&&(b.schema=y.schema),y.examples&&(b.examples=y.examples),y.encoding&&(b.encoding=y.encoding),i.content[m]=b}let p=e.bodySchema.contentType||Object.keys(e.bodySchema.content)[0];if(p&&n.content){let m=this.tryParseBodyContent(n);m!==void 0&&i.content[p]&&(i.content[p].example=m)}return i}s=e.bodySchema.contentType||this.getContentType(n),o=e.bodySchema.schema,e.bodySchema.components,l=this.tryParseBodyContent(n),e.bodySchema.encoding&&(c=e.bodySchema.encoding)}else switch(s=this.getContentType(n),n.type){case"raw":{if(n.format==="json"&&n.content){let p=this.tryParseBodyContent(n);p!==void 0?(o=this.inferrer.inferFromValue(p),l=p):o={type:"string"}}else o={type:"string"},l=typeof n.content=="string"?n.content:void 0;break}case"form-data":{o=this.buildFormDataSchemaFromBody(n);break}case"x-www-form-urlencoded":{o=this.buildFormDataSchemaFromBody(n);break}case"binary":{o={type:"string",format:"binary"};break}case"graphql":{o={type:"object",properties:{query:{type:"string"},variables:{type:"object"}}},l=this.tryParseBodyContent(n);break}default:return null}let d={};return o&&(d.schema=o),l!==void 0&&(d.example=l),c&&(d.encoding=c),i.content[s]=d,i}getContentType(e){if(!e)return"application/json";switch(e.type){case"raw":switch(e.format){case"json":return"application/json";case"xml":return"application/xml";case"html":return"text/html";case"text":return"text/plain";default:return"text/plain"}case"form-data":return"multipart/form-data";case"x-www-form-urlencoded":return"application/x-www-form-urlencoded";case"binary":return"application/octet-stream";case"graphql":return"application/json";default:return"application/json"}}tryParseBodyContent(e){if(!e||!e.content)return;let r;if(typeof e.content=="string")try{r=JSON.parse(e.content)}catch{r=e.content}else r=e.content;return this.sanitizeObjectExamples(r)}buildFormDataSchemaFromBody(e){let r={type:"object",properties:{}},n=e.formData||e.urlencoded||[];for(let i of n)i.enabled!==!1&&(i.type==="file"?r.properties[i.key]={type:"string",format:"binary"}:r.properties[i.key]={type:"string"});return r}async buildResponses(e,r,n){let i={};if(e.responseSchema)for(let[s,o]of Object.entries(e.responseSchema.responses)){let l={description:o.description||`Status ${s}`};if(o.content){l.content={};for(let[c,d]of Object.entries(o.content)){let p={};d.schema&&(p.schema=d.schema),d.examples&&(p.examples=d.examples),l.content[c]=p}}else if(o.schema){let c=o.contentType||"application/json",d={schema:o.schema};o.examples&&(d.examples=o.examples),l.content={[c]:d}}if(o.headers){l.headers={};for(let[c,d]of Object.entries(o.headers))l.headers[c]={...d.description&&{description:d.description},schema:d.schema}}i[s]=l}return Object.keys(i).length===0&&(i[200]={description:"Successful response"}),i}mapResponseDefinitions(e){let r={};for(let[n,i]of Object.entries(e)){let s={description:i.description||`Status ${n}`};if(i.schema||i.examples){let o=i.contentType||"application/json",l={};i.schema&&(l.schema=i.schema),i.examples&&Object.keys(i.examples).length>0&&(l.examples=i.examples),s.content={[o]:l}}if(i.headers&&Object.keys(i.headers).length>0){s.headers={};for(let[o,l]of Object.entries(i.headers)){let c=l;s.headers[o]={...c.description&&{description:c.description},...c.schema&&{schema:c.schema}}}}r[n]=s}return Object.keys(r).length===0&&(r[200]={description:"Successful response"}),r}buildOperationSecurity(e,r,n){if(!e.auth||e.auth.type==="inherit")return;if(e.auth.type==="none")return[];let i=this.mapAuthToSecurityScheme(e.auth);if(!i)return;let{schemeName:s,scheme:o,requirement:l}=i;return n.set(s,o),[l]}mapAuthToSecurityScheme(e){switch(e.type){case"bearer":return{schemeName:"BearerAuth",scheme:{type:"http",scheme:"bearer"},requirement:{BearerAuth:[]}};case"basic":return{schemeName:"BasicAuth",scheme:{type:"http",scheme:"basic"},requirement:{BasicAuth:[]}};case"apikey":{let r=e.apikey||{key:"X-Api-Key",value:"",in:"header"},n=`ApiKey_${r.key||"key"}`;return{schemeName:n,scheme:{type:"apiKey",in:r.in||"header",name:r.key||"X-Api-Key"},requirement:{[n]:[]}}}case"oauth2":{let r=e.oauth2;if(!r)return;let n={};switch(r.grantType){case"client_credentials":n.clientCredentials={tokenUrl:r.tokenUrl||"",scopes:r.scope?this.parseScopes(r.scope):{}};break;case"authorization_code":n.authorizationCode={authorizationUrl:r.authUrl||"",tokenUrl:r.tokenUrl||"",scopes:r.scope?this.parseScopes(r.scope):{}};break;case"password":n.password={tokenUrl:r.tokenUrl||"",scopes:r.scope?this.parseScopes(r.scope):{}};break;case"implicit":n.implicit={authorizationUrl:r.authUrl||"",scopes:r.scope?this.parseScopes(r.scope):{}};break;default:n.clientCredentials={tokenUrl:r.tokenUrl||"",scopes:{}}}return{schemeName:"OAuth2",scheme:{type:"oauth2",flows:n},requirement:{OAuth2:[]}}}default:return{schemeName:"BearerAuth",scheme:{type:"http",scheme:"bearer"},requirement:{BearerAuth:[]}}}}parseScopes(e){let r={};for(let n of e.split(/\s+/))n&&(r[n]="");return r}deduplicateComponents(e){let r=new Map,n=new Map;if(e.paths)for(let[i,s]of Object.entries(e.paths))for(let[o,l]of Object.entries(s)){let c=l;if(c.responses){for(let[d,p]of Object.entries(c.responses))if(p.content)for(let m of Object.values(p.content))m.schema&&this.trackSchema(m.schema,`${o}${i}Response${d}`,r,n)}if(c.requestBody?.content)for(let d of Object.values(c.requestBody.content))d.schema&&this.trackSchema(d.schema,`${o}${i}Request`,r,n)}for(let[i,s]of r)if((n.get(i)||0)>=2){let l=this.sanitizeComponentName(s.name);e.components.schemas[l]=s.schema,this.replaceInlineSchema(e,s.schema,`#/components/schemas/${l}`)}}trackSchema(e,r,n,i){if(!e||e.type!=="object"||!e.properties)return;let s=JSON.stringify(e);n.has(s)||n.set(s,{name:r,schema:e}),i.set(s,(i.get(s)||0)+1)}replaceInlineSchema(e,r,n){let i=JSON.stringify(r);if(e.paths)for(let s of Object.values(e.paths))for(let o of Object.values(s)){if(o.responses){for(let l of Object.values(o.responses))if(l.content)for(let c of Object.values(l.content))c.schema&&JSON.stringify(c.schema)===i&&(c.schema={$ref:n})}if(o.requestBody?.content)for(let l of Object.values(o.requestBody.content))l.schema&&JSON.stringify(l.schema)===i&&(l.schema={$ref:n})}}sanitizeComponentName(e){return e.replace(/[^a-zA-Z0-9._-]/g,"").replace(/^[^a-zA-Z]/,"Schema")}cleanSummary(e){return e.replace(/^\[DEPRECATED\]\s*/i,"")}hasDeprecatedPrefix(e){return/^\[DEPRECATED\]/i.test(e)}augmentServersFromHostVars(e,r,n){if(e.size===0)return;let i=new Set(r.map(o=>o.url)),s=n.environments?.length?n.environments:[this.envConfigService.getSelectedEnvironment()].filter(o=>!!o);for(let o of e){let l=`{{${o}}}`,c=!1;for(let d of s){let p=this.envConfigService.resolveVariables(l,d);p&&p!==l&&!i.has(p)&&(r.push({url:p,description:d}),i.add(p),c=!0)}if(!c){let d=`{${o}}`;i.has(d)||(r.push({url:d,variables:{[o]:{default:""}}}),i.add(d))}}}}});var al,JR=ae(()=>{"use strict";al=class{generate(e,r){if(!e)return;let n=r||{};if(e.$ref){let i=this.resolveLocalRef(e.$ref,n.components);return i?this.generate(i,n):{}}if(e.nullable&&!e.type)return null;if(e.enum&&e.enum.length>0)return e.enum[0];if(e.default!==void 0)return e.default;if(e.example!==void 0)return e.example;if(e.allOf)return this.generateFromAllOf(e.allOf,e.discriminator,n);if(e.oneOf)return this.generateFromOneOfAnyOf(e.oneOf,e.discriminator,n);if(e.anyOf)return this.generateFromOneOfAnyOf(e.anyOf,e.discriminator,n);switch(e.type){case"string":return this.generateString(e);case"integer":return this.generateInteger(e);case"number":return this.generateNumber(e);case"boolean":return!1;case"array":return this.generateArray(e,n);case"object":return this.generateObject(e,n);default:return e.properties?this.generateObject(e,n):{}}}generateString(e){switch(e.format){case"email":return"user@example.com";case"date-time":return"2026-01-01T00:00:00Z";case"date":return"2026-01-01";case"time":return"00:00:00";case"uri":case"url":return"https://example.com";case"uuid":return"00000000-0000-0000-0000-000000000000";case"ipv4":return"127.0.0.1";case"ipv6":return"::1";case"hostname":return"example.com";case"binary":return"";case"byte":return"c3RyaW5n";case"password":return"********";default:return"string"}}generateInteger(e){return e.minimum!==void 0?e.minimum:e.exclusiveMinimum!==void 0?e.exclusiveMinimum+1:0}generateNumber(e){return e.minimum!==void 0?e.minimum:e.exclusiveMinimum!==void 0?e.exclusiveMinimum+.1:0}generateArray(e,r){return e.items?[this.generate(e.items,r)]:[]}generateObject(e,r){let n={},i=e.properties||{};for(let[s,o]of Object.entries(i))r.omitReadOnly&&o.readOnly||(n[s]=this.generate(o,r));return n}generateFromAllOf(e,r,n){let i={type:"object",properties:{},required:[]};for(let o of e){let l=o.$ref?this.resolveLocalRef(o.$ref,n.components)||{}:o;l.properties&&Object.assign(i.properties,l.properties),l.required&&(i.required=[...i.required||[],...l.required])}let s=this.generateObject(i,n);return r?.propertyName&&(s[r.propertyName]=this.guessDiscriminatorValue(e,n)),s}generateFromOneOfAnyOf(e,r,n){if(e.length===0)return{};let i=e[0].$ref&&this.resolveLocalRef(e[0].$ref,n.components)||e[0],s=this.generate(i,n);return r?.propertyName&&typeof s=="object"&&s!==null&&(s[r.propertyName]=this.guessDiscriminatorValue(e,n)),s}guessDiscriminatorValue(e,r){if(e.length===0)return"unknown";let n=e[0];if(n.$ref){let i=n.$ref.split("/");return i[i.length-1]}return"variant1"}resolveLocalRef(e,r){if(!e||!r)return;let n=e.match(/^#\/components\/(?:schemas\/)?(.+)$/);if(n)return r[n[1]];let i=e.match(/^#\/components\/(.+)$/);if(i)return r[i[1]]}}});var fy=V(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});vc.getDeepKeys=vc.toJSON=void 0;var $4=["function","symbol","undefined"],N4=["constructor","prototype","__proto__"],M4=Object.getPrototypeOf({});function F4(){let t={},e=this;for(let r of _T(e))if(typeof r=="string"){let n=e[r],i=typeof n;$4.includes(i)||(t[r]=n)}return t}vc.toJSON=F4;function _T(t,e=[]){let r=[];for(;t&&t!==M4;)r=r.concat(Object.getOwnPropertyNames(t),Object.getOwnPropertySymbols(t)),t=Object.getPrototypeOf(t);let n=new Set(r);for(let i of e.concat(N4))n.delete(i);return n}vc.getDeepKeys=_T});var GR=V(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});bc.addInspectMethod=bc.format=void 0;var RT=require("util"),D4=fy(),CT=RT.inspect.custom||Symbol.for("nodejs.util.inspect.custom");bc.format=RT.format;function j4(t){t[CT]=L4}bc.addInspectMethod=j4;function L4(){let t={},e=this;for(let r of D4.getDeepKeys(e)){let n=e[r];t[r]=n}return delete t[CT],t}});var qT=V(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.lazyJoinStacks=Xi.joinStacks=Xi.isWritableStack=Xi.isLazyStack=void 0;var U4=/\r?\n/,H4=/\bono[ @]/;function B4(t){return!!(t&&t.configurable&&typeof t.get=="function")}Xi.isLazyStack=B4;function V4(t){return!!(!t||t.writable||typeof t.set=="function")}Xi.isWritableStack=V4;function xT(t,e){let r=ET(t.stack),n=e?e.stack:void 0;return r&&n?r+`
|
|
238
238
|
|
|
239
239
|
`+n:r||n}Xi.joinStacks=xT;function W4(t,e,r){r?Object.defineProperty(e,"stack",{get:()=>{let n=t.get.apply(e);return xT({stack:n},r)},enumerable:!1,configurable:!0}):z4(e,t)}Xi.lazyJoinStacks=W4;function ET(t){if(t){let e=t.split(U4),r;for(let n=0;n<e.length;n++){let i=e[n];if(H4.test(i))r===void 0&&(r=n);else if(r!==void 0){e.splice(r,n-r);break}}if(e.length>0)return e.join(`
|
|
240
240
|
`)}return t}function z4(t,e){Object.defineProperty(t,"stack",{get:()=>ET(e.get.apply(t)),enumerable:!1,configurable:!0})}});var PT=V(py=>{"use strict";Object.defineProperty(py,"__esModule",{value:!0});py.extendError=void 0;var OT=GR(),dy=qT(),IT=fy(),J4=["name","message","stack"];function G4(t,e,r){let n=t;return Y4(n,e),e&&typeof e=="object"&&K4(n,e),n.toJSON=IT.toJSON,OT.addInspectMethod&&OT.addInspectMethod(n),r&&typeof r=="object"&&Object.assign(n,r),n}py.extendError=G4;function Y4(t,e){let r=Object.getOwnPropertyDescriptor(t,"stack");dy.isLazyStack(r)?dy.lazyJoinStacks(r,t,e):dy.isWritableStack(r)&&(t.stack=dy.joinStacks(t,e))}function K4(t,e){let r=IT.getDeepKeys(e,J4),n=t,i=e;for(let s of r)if(n[s]===void 0)try{n[s]=i[s]}catch{}}});var kT=V(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});Sc.normalizeArgs=Sc.normalizeOptions=void 0;var Q4=GR();function Z4(t){return t=t||{},{concatMessages:t.concatMessages===void 0?!0:!!t.concatMessages,format:t.format===void 0?Q4.format:typeof t.format=="function"?t.format:!1}}Sc.normalizeOptions=Z4;function X4(t,e){let r,n,i,s="";return typeof t[0]=="string"?i=t:typeof t[1]=="string"?(t[0]instanceof Error?r=t[0]:n=t[0],i=t.slice(1)):(r=t[0],n=t[1],i=t.slice(2)),i.length>0&&(e.format?s=e.format.apply(void 0,i):s=i.join(" ")),e.concatMessages&&r&&r.message&&(s+=(s?`
|
|
241
|
-
`:"")+r.message),{originalError:r,props:n,message:s}}Sc.normalizeArgs=X4});var KR=V(my=>{"use strict";Object.defineProperty(my,"__esModule",{value:!0});my.Ono=void 0;var hy=PT(),AT=kT(),e3=fy(),t3=YR;my.Ono=t3;function YR(t,e){e=AT.normalizeOptions(e);function r(...n){let{originalError:i,props:s,message:o}=AT.normalizeArgs(n,e),l=new t(o);return hy.extendError(l,i,s)}return r[Symbol.species]=t,r}YR.toJSON=function(e){return e3.toJSON.call(e)};YR.extend=function(e,r,n){return n||r instanceof Error?hy.extendError(e,r,n):r?hy.extendError(e,void 0,r):hy.extendError(e)}});var TT=V(gy=>{"use strict";Object.defineProperty(gy,"__esModule",{value:!0});gy.ono=void 0;var ll=KR(),r3=es;gy.ono=r3;es.error=new ll.Ono(Error);es.eval=new ll.Ono(EvalError);es.range=new ll.Ono(RangeError);es.reference=new ll.Ono(ReferenceError);es.syntax=new ll.Ono(SyntaxError);es.type=new ll.Ono(TypeError);es.uri=new ll.Ono(URIError);var n3=es;function es(...t){let e=t[0];if(typeof e=="object"&&typeof e.name=="string"){for(let r of Object.values(n3))if(typeof r=="function"&&r.name==="ono"){let n=r[Symbol.species];if(n&&n!==Error&&(e instanceof n||e.name===n.name))return r.apply(void 0,t)}}return es.error.apply(void 0,t)}});var NT=V($T=>{"use strict";Object.defineProperty($T,"__esModule",{value:!0});var tre=require("util")});var Bo=V((bi,wc)=>{"use strict";var i3=bi&&bi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),s3=bi&&bi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&i3(e,t,r)};Object.defineProperty(bi,"__esModule",{value:!0});bi.ono=void 0;var MT=TT();Object.defineProperty(bi,"ono",{enumerable:!0,get:function(){return MT.ono}});var o3=KR();Object.defineProperty(bi,"Ono",{enumerable:!0,get:function(){return o3.Ono}});s3(NT(),bi);bi.default=MT.ono;typeof wc=="object"&&typeof wc.exports=="object"&&(wc.exports=Object.assign(wc.exports.default,wc.exports))});var QR=V(ep=>{"use strict";var a3=ep&&ep.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ep,"__esModule",{value:!0});ep.default=l3;var FT=a3(require("path"));function l3(t){return t.startsWith("\\\\?\\")?t:t.split(FT.default?.win32?.sep).join(FT.default?.posix?.sep??"/")}});var DT=V(yy=>{"use strict";Object.defineProperty(yy,"__esModule",{value:!0});yy.isWindows=void 0;var u3=/^win/.test(globalThis.process?globalThis.process.platform:""),c3=()=>u3;yy.isWindows=c3});var Gn=V(jt=>{"use strict";var f3=jt&&jt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),d3=jt&&jt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),p3=jt&&jt.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&f3(r,e,n[i]);return d3(r,e),r}})(),h3=jt&&jt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jt,"__esModule",{value:!0});jt.parse=void 0;jt.resolve=jT;jt.cwd=LT;jt.getProtocol=rC;jt.getExtension=_3;jt.stripQuery=UT;jt.getHash=HT;jt.stripHash=eC;jt.isHttp=R3;jt.isFileSystemPath=tC;jt.fromFileSystemPath=C3;jt.toFileSystemPath=x3;jt.safePointerToPath=E3;jt.relative=q3;var by=h3(QR()),XR=p3(require("path")),m3=/\//g,g3=/^(\w{2,}):\/\//i,y3=/~1/g,v3=/~0/g,b3=require("path"),vy=DT(),S3=[[/\?/g,"%3F"],[/#/g,"%23"]],ZR=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"],w3=t=>new URL(t);jt.parse=w3;function jT(t,e){let r=new URL((0,by.default)(t),"https://aaa.nonexistanturl.com"),n=new URL((0,by.default)(e),r),i=e.match(/(\s*)$/)?.[1]||"";if(n.hostname==="aaa.nonexistanturl.com"){let{pathname:s,search:o,hash:l}=n;return s+o+l+i}return n.toString()+i}function LT(){if(typeof window<"u")return location.href;let t=process.cwd(),e=t.slice(-1);return e==="/"||e==="\\"?t:t+"/"}function rC(t){let e=g3.exec(t||"");if(e)return e[1].toLowerCase()}function _3(t){let e=t.lastIndexOf(".");return e>=0?UT(t.substr(e).toLowerCase()):""}function UT(t){let e=t.indexOf("?");return e>=0&&(t=t.substr(0,e)),t}function HT(t){if(!t)return"#";let e=t.indexOf("#");return e>=0?t.substring(e):"#"}function eC(t){if(!t)return"";let e=t.indexOf("#");return e>=0&&(t=t.substring(0,e)),t}function R3(t){let e=rC(t);return e==="http"||e==="https"?!0:e===void 0?typeof window<"u":!1}function tC(t){if(typeof window<"u"||typeof process<"u"&&process.browser)return!1;let e=rC(t);return e===void 0||e==="file"}function C3(t){if((0,vy.isWindows)()){let e=LT(),r=t.toUpperCase(),i=(0,by.default)(e).toUpperCase(),s=r.includes(i),o=r.includes(i),l=XR.win32?.isAbsolute(t)||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("file://");!(s||o||l)&&!e.startsWith("http")&&(t=(0,b3.join)(e,t)),t=(0,by.default)(t)}t=encodeURI(t);for(let e of S3)t=t.replace(e[0],e[1]);return t}function x3(t,e){t=decodeURI(t);for(let n=0;n<ZR.length;n+=2)t=t.replace(ZR[n],ZR[n+1]);let r=t.substr(0,7).toLowerCase()==="file://";return r&&(t=t[7]==="/"?t.substr(8):t.substr(7),(0,vy.isWindows)()&&t[1]==="/"&&(t=t[0]+":"+t.substr(1)),e?t="file:///"+t:(r=!1,t=(0,vy.isWindows)()?t:"/"+t)),(0,vy.isWindows)()&&!r&&(t=t.replace(m3,"\\"),t.substr(1,2)===":\\"&&(t=t[0].toUpperCase()+t.substr(1))),t}function E3(t){return t.length<=1||t[0]!=="#"||t[1]!=="/"?[]:t.slice(2).split("/").map(e=>decodeURIComponent(e).replace(y3,"/").replace(v3,"~"))}function q3(t,e){if(!tC(t)||!tC(e))return jT(t,e);let r=XR.default.dirname(eC(t)),n=eC(e);return XR.default.relative(r,n)+HT(e)}});var Yn=V(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.InvalidPointerError=Jt.TimeoutError=Jt.MissingPointerError=Jt.UnmatchedResolverError=Jt.ResolverError=Jt.UnmatchedParserError=Jt.ParserError=Jt.JSONParserErrorGroup=Jt.JSONParserError=void 0;Jt.isHandledError=O3;Jt.normalizeError=I3;var BT=Bo(),Sy=Gn(),Si=class extends Error{constructor(e,r){super(),this.code="EUNKNOWN",this.name="JSONParserError",this.message=e,this.source=r,this.path=null,BT.Ono.extend(this)}get footprint(){return`${this.path}+${this.source}+${this.code}+${this.message}`}};Jt.JSONParserError=Si;var wy=class t extends Error{constructor(e){super(),this.files=e,this.name="JSONParserErrorGroup",this.message=`${this.errors.length} error${this.errors.length>1?"s":""} occurred while reading '${(0,Sy.toFileSystemPath)(e.$refs._root$Ref.path)}'`,BT.Ono.extend(this)}static getParserErrors(e){let r=[];for(let n of Object.values(e.$refs._$refs))n.errors&&r.push(...n.errors);return r}get errors(){return t.getParserErrors(this.files)}};Jt.JSONParserErrorGroup=wy;var nC=class extends Si{constructor(e,r){super(`Error parsing ${r}: ${e}`,r),this.code="EPARSER",this.name="ParserError"}};Jt.ParserError=nC;var iC=class extends Si{constructor(e){super(`Could not find parser for "${e}"`,e),this.code="EUNMATCHEDPARSER",this.name="UnmatchedParserError"}};Jt.UnmatchedParserError=iC;var sC=class extends Si{constructor(e,r){super(e.message||`Error reading file "${r}"`,r),this.code="ERESOLVER",this.name="ResolverError","code"in e&&(this.ioErrorCode=String(e.code))}};Jt.ResolverError=sC;var oC=class extends Si{constructor(e){super(`Could not find resolver for "${e}"`,e),this.code="EUNMATCHEDRESOLVER",this.name="UnmatchedResolverError"}};Jt.UnmatchedResolverError=oC;var aC=class extends Si{constructor(e,r,n,i,s){super(`Missing $ref pointer "${(0,Sy.getHash)(r)}". Token "${e}" does not exist.`,(0,Sy.stripHash)(r)),this.code="EMISSINGPOINTER",this.name="MissingPointerError",this.targetToken=e,this.targetRef=n,this.targetFound=i,this.parentPath=s}};Jt.MissingPointerError=aC;var lC=class extends Si{constructor(e){super(`Dereferencing timeout reached: ${e}ms`),this.code="ETIMEOUT",this.name="TimeoutError"}};Jt.TimeoutError=lC;var uC=class extends Si{constructor(e,r){super(`Invalid $ref pointer "${e}". Pointers must begin with "#/"`,(0,Sy.stripHash)(r)),this.code="EUNMATCHEDRESOLVER",this.name="InvalidPointerError"}};Jt.InvalidPointerError=uC;function O3(t){return t instanceof Si||t instanceof wy}function I3(t){return t.path===null&&(t.path=[]),t}});var tp=V(cn=>{"use strict";var P3=cn&&cn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),k3=cn&&cn.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),A3=cn&&cn.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&P3(r,e,n[i]);return k3(r,e),r}})(),T3=cn&&cn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cn,"__esModule",{value:!0});cn.nullSymbol=void 0;var cC=T3(_c()),fC=A3(Gn()),Ry=Yn();cn.nullSymbol=Symbol("null");var $3=/\//g,N3=/~/g,M3=/~1/g,F3=/~0/g,D3=t=>{try{return decodeURIComponent(t)}catch{return t}},Cy=class t{constructor(e,r,n){this.$ref=e,this.path=r,this.originalPath=n||r,this.value=void 0,this.circular=!1,this.indirections=0}resolve(e,r,n){let i=t.parse(this.path,this.originalPath),s=[];this.value=WT(e);for(let o=0;o<i.length;o++){if(_y(this,r,n)&&(this.path=t.join(this.path,i.slice(o))),typeof this.value=="object"&&this.value!==null&&!zT(n)&&"$ref"in this.value)return this;let l=i[o];if(this.value[l]===void 0||this.value[l]===null&&o===i.length-1){let c=!1;for(let b=i.length-1;b>o;b--){let E=i.slice(o,b+1).join("/");if(this.value[E]!==void 0){this.value=this.value[E],o=b,c=!0;break}}if(c)continue;if(l in this.value&&this.value[l]===null){this.value=cn.nullSymbol;continue}this.value=null;let d=this.$ref.path||"",p=this.path.replace(d,""),m=t.join("",s),y=n?.replace(d,"");throw new Ry.MissingPointerError(l,decodeURI(this.originalPath),p,m,y)}else this.value=this.value[l];s.push(l)}return(!this.value||this.value.$ref&&fC.resolve(this.path,this.value.$ref)!==n)&&_y(this,r,n),this}set(e,r,n){let i=t.parse(this.path),s;if(i.length===0)return this.value=r,r;this.value=WT(e);for(let o=0;o<i.length-1;o++)_y(this,n),s=i[o],this.value&&this.value[s]!==void 0?this.value=this.value[s]:this.value=VT(this,s,{});return _y(this,n),s=i[i.length-1],VT(this,s,r),e}static parse(e,r){let n=fC.getHash(e).substring(1);if(!n)return[];let i=n.split("/");for(let s=0;s<i.length;s++)i[s]=D3(i[s].replace(M3,"/").replace(F3,"~"));if(i[0]!=="")throw new Ry.InvalidPointerError(n,r===void 0?e:r);return i.slice(1)}static join(e,r){e.indexOf("#")===-1&&(e+="#"),r=Array.isArray(r)?r:[r];for(let n=0;n<r.length;n++){let i=r[n];e+="/"+encodeURIComponent(i.replace(N3,"~0").replace($3,"~1"))}return e}};function _y(t,e,r){if(cC.default.isAllowed$Ref(t.value,e)){let n=fC.resolve(t.path,t.value.$ref);if(n===t.path&&!zT(r))t.circular=!0;else{let i=t.$ref.$refs._resolve(n,t.path,e);return i===null?!1:(t.indirections+=i.indirections+1,cC.default.isExtended$Ref(t.value)?(t.value=cC.default.dereference(t.value,i.value),!1):(t.$ref=i.$ref,t.path=i.path,t.value=i.value,!0))}}}cn.default=Cy;function VT(t,e,r){if(t.value&&typeof t.value=="object")e==="-"&&Array.isArray(t.value)?t.value.push(r):t.value[e]=r;else throw new Ry.JSONParserError(`Error assigning $ref pointer "${t.path}".
|
|
241
|
+
`:"")+r.message),{originalError:r,props:n,message:s}}Sc.normalizeArgs=X4});var KR=V(my=>{"use strict";Object.defineProperty(my,"__esModule",{value:!0});my.Ono=void 0;var hy=PT(),AT=kT(),e3=fy(),t3=YR;my.Ono=t3;function YR(t,e){e=AT.normalizeOptions(e);function r(...n){let{originalError:i,props:s,message:o}=AT.normalizeArgs(n,e),l=new t(o);return hy.extendError(l,i,s)}return r[Symbol.species]=t,r}YR.toJSON=function(e){return e3.toJSON.call(e)};YR.extend=function(e,r,n){return n||r instanceof Error?hy.extendError(e,r,n):r?hy.extendError(e,void 0,r):hy.extendError(e)}});var TT=V(gy=>{"use strict";Object.defineProperty(gy,"__esModule",{value:!0});gy.ono=void 0;var ll=KR(),r3=es;gy.ono=r3;es.error=new ll.Ono(Error);es.eval=new ll.Ono(EvalError);es.range=new ll.Ono(RangeError);es.reference=new ll.Ono(ReferenceError);es.syntax=new ll.Ono(SyntaxError);es.type=new ll.Ono(TypeError);es.uri=new ll.Ono(URIError);var n3=es;function es(...t){let e=t[0];if(typeof e=="object"&&typeof e.name=="string"){for(let r of Object.values(n3))if(typeof r=="function"&&r.name==="ono"){let n=r[Symbol.species];if(n&&n!==Error&&(e instanceof n||e.name===n.name))return r.apply(void 0,t)}}return es.error.apply(void 0,t)}});var NT=V($T=>{"use strict";Object.defineProperty($T,"__esModule",{value:!0});var tre=require("util")});var Bo=V((bi,wc)=>{"use strict";var i3=bi&&bi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),s3=bi&&bi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&i3(e,t,r)};Object.defineProperty(bi,"__esModule",{value:!0});bi.ono=void 0;var MT=TT();Object.defineProperty(bi,"ono",{enumerable:!0,get:function(){return MT.ono}});var o3=KR();Object.defineProperty(bi,"Ono",{enumerable:!0,get:function(){return o3.Ono}});s3(NT(),bi);bi.default=MT.ono;typeof wc=="object"&&typeof wc.exports=="object"&&(wc.exports=Object.assign(wc.exports.default,wc.exports))});var QR=V(ep=>{"use strict";var a3=ep&&ep.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ep,"__esModule",{value:!0});ep.default=l3;var FT=a3(require("path"));function l3(t){return t.startsWith("\\\\?\\")?t:t.split(FT.default?.win32?.sep).join(FT.default?.posix?.sep??"/")}});var DT=V(yy=>{"use strict";Object.defineProperty(yy,"__esModule",{value:!0});yy.isWindows=void 0;var u3=/^win/.test(globalThis.process?globalThis.process.platform:""),c3=()=>u3;yy.isWindows=c3});var Gn=V(jt=>{"use strict";var f3=jt&&jt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),d3=jt&&jt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),p3=jt&&jt.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&f3(r,e,n[i]);return d3(r,e),r}})(),h3=jt&&jt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jt,"__esModule",{value:!0});jt.parse=void 0;jt.resolve=jT;jt.cwd=LT;jt.getProtocol=rC;jt.getExtension=_3;jt.stripQuery=UT;jt.getHash=HT;jt.stripHash=eC;jt.isHttp=R3;jt.isFileSystemPath=tC;jt.fromFileSystemPath=C3;jt.toFileSystemPath=x3;jt.safePointerToPath=E3;jt.relative=q3;var by=h3(QR()),XR=p3(require("path")),m3=/\//g,g3=/^(\w{2,}):\/\//i,y3=/~1/g,v3=/~0/g,b3=require("path"),vy=DT(),S3=[[/\?/g,"%3F"],[/#/g,"%23"]],ZR=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"],w3=t=>new URL(t);jt.parse=w3;function jT(t,e){let r=new URL((0,by.default)(t),"https://aaa.nonexistanturl.com"),n=new URL((0,by.default)(e),r),i=e.match(/(\s*)$/)?.[1]||"";if(n.hostname==="aaa.nonexistanturl.com"){let{pathname:s,search:o,hash:l}=n;return s+o+l+i}return n.toString()+i}function LT(){if(typeof window<"u")return location.href;let t=process.cwd(),e=t.slice(-1);return e==="/"||e==="\\"?t:t+"/"}function rC(t){let e=g3.exec(t||"");if(e)return e[1].toLowerCase()}function _3(t){let e=t.lastIndexOf(".");return e>=0?UT(t.substr(e).toLowerCase()):""}function UT(t){let e=t.indexOf("?");return e>=0&&(t=t.substr(0,e)),t}function HT(t){if(!t)return"#";let e=t.indexOf("#");return e>=0?t.substring(e):"#"}function eC(t){if(!t)return"";let e=t.indexOf("#");return e>=0&&(t=t.substring(0,e)),t}function R3(t){let e=rC(t);return e==="http"||e==="https"?!0:e===void 0?typeof window<"u":!1}function tC(t){if(typeof window<"u"||typeof process<"u"&&process.browser)return!1;let e=rC(t);return e===void 0||e==="file"}function C3(t){if((0,vy.isWindows)()){let e=LT(),r=t.toUpperCase(),i=(0,by.default)(e).toUpperCase(),s=r.includes(i),o=r.includes(i),l=XR.win32?.isAbsolute(t)||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("file://");!(s||o||l)&&!e.startsWith("http")&&(t=(0,b3.join)(e,t)),t=(0,by.default)(t)}t=encodeURI(t);for(let e of S3)t=t.replace(e[0],e[1]);return t}function x3(t,e){t=decodeURI(t);for(let n=0;n<ZR.length;n+=2)t=t.replace(ZR[n],ZR[n+1]);let r=t.substr(0,7).toLowerCase()==="file://";return r&&(t=t[7]==="/"?t.substr(8):t.substr(7),(0,vy.isWindows)()&&t[1]==="/"&&(t=t[0]+":"+t.substr(1)),e?t="file:///"+t:(r=!1,t=(0,vy.isWindows)()?t:"/"+t)),(0,vy.isWindows)()&&!r&&(t=t.replace(m3,"\\"),t.substr(1,2)===":\\"&&(t=t[0].toUpperCase()+t.substr(1))),t}function E3(t){return t.length<=1||t[0]!=="#"||t[1]!=="/"?[]:t.slice(2).split("/").map(e=>decodeURIComponent(e).replace(y3,"/").replace(v3,"~"))}function q3(t,e){if(!tC(t)||!tC(e))return jT(t,e);let r=XR.default.dirname(eC(t)),n=eC(e);return XR.default.relative(r,n)+HT(e)}});var Yn=V(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.InvalidPointerError=Jt.TimeoutError=Jt.MissingPointerError=Jt.UnmatchedResolverError=Jt.ResolverError=Jt.UnmatchedParserError=Jt.ParserError=Jt.JSONParserErrorGroup=Jt.JSONParserError=void 0;Jt.isHandledError=O3;Jt.normalizeError=I3;var BT=Bo(),Sy=Gn(),Si=class extends Error{constructor(e,r){super(),this.code="EUNKNOWN",this.name="JSONParserError",this.message=e,this.source=r,this.path=null,BT.Ono.extend(this)}get footprint(){return`${this.path}+${this.source}+${this.code}+${this.message}`}};Jt.JSONParserError=Si;var wy=class t extends Error{constructor(e){super(),this.files=e,this.name="JSONParserErrorGroup",this.message=`${this.errors.length} error${this.errors.length>1?"s":""} occurred while reading '${(0,Sy.toFileSystemPath)(e.$refs._root$Ref.path)}'`,BT.Ono.extend(this)}static getParserErrors(e){let r=[];for(let n of Object.values(e.$refs._$refs))n.errors&&r.push(...n.errors);return r}get errors(){return t.getParserErrors(this.files)}};Jt.JSONParserErrorGroup=wy;var nC=class extends Si{constructor(e,r){super(`Error parsing ${r}: ${e}`,r),this.code="EPARSER",this.name="ParserError"}};Jt.ParserError=nC;var iC=class extends Si{constructor(e){super(`Could not find parser for "${e}"`,e),this.code="EUNMATCHEDPARSER",this.name="UnmatchedParserError"}};Jt.UnmatchedParserError=iC;var sC=class extends Si{constructor(e,r){super(e.message||`Error reading file "${r}"`,r),this.code="ERESOLVER",this.name="ResolverError","code"in e&&(this.ioErrorCode=String(e.code))}};Jt.ResolverError=sC;var oC=class extends Si{constructor(e){super(`Could not find resolver for "${e}"`,e),this.code="EUNMATCHEDRESOLVER",this.name="UnmatchedResolverError"}};Jt.UnmatchedResolverError=oC;var aC=class extends Si{constructor(e,r,n,i,s){super(`Missing $ref pointer "${(0,Sy.getHash)(r)}". Token "${e}" does not exist.`,(0,Sy.stripHash)(r)),this.code="EMISSINGPOINTER",this.name="MissingPointerError",this.targetToken=e,this.targetRef=n,this.targetFound=i,this.parentPath=s}};Jt.MissingPointerError=aC;var lC=class extends Si{constructor(e){super(`Dereferencing timeout reached: ${e}ms`),this.code="ETIMEOUT",this.name="TimeoutError"}};Jt.TimeoutError=lC;var uC=class extends Si{constructor(e,r){super(`Invalid $ref pointer "${e}". Pointers must begin with "#/"`,(0,Sy.stripHash)(r)),this.code="EUNMATCHEDRESOLVER",this.name="InvalidPointerError"}};Jt.InvalidPointerError=uC;function O3(t){return t instanceof Si||t instanceof wy}function I3(t){return t.path===null&&(t.path=[]),t}});var tp=V(cn=>{"use strict";var P3=cn&&cn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),k3=cn&&cn.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),A3=cn&&cn.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&P3(r,e,n[i]);return k3(r,e),r}})(),T3=cn&&cn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cn,"__esModule",{value:!0});cn.nullSymbol=void 0;var cC=T3(_c()),fC=A3(Gn()),Ry=Yn();cn.nullSymbol=Symbol("null");var $3=/\//g,N3=/~/g,M3=/~1/g,F3=/~0/g,D3=t=>{try{return decodeURIComponent(t)}catch{return t}},Cy=class t{constructor(e,r,n){this.$ref=e,this.path=r,this.originalPath=n||r,this.value=void 0,this.circular=!1,this.indirections=0}resolve(e,r,n){let i=t.parse(this.path,this.originalPath),s=[];this.value=WT(e);for(let o=0;o<i.length;o++){if(_y(this,r,n)&&(this.path=t.join(this.path,i.slice(o))),typeof this.value=="object"&&this.value!==null&&!zT(n)&&"$ref"in this.value)return this;let l=i[o];if(this.value[l]===void 0||this.value[l]===null&&o===i.length-1){let c=!1;for(let b=i.length-1;b>o;b--){let q=i.slice(o,b+1).join("/");if(this.value[q]!==void 0){this.value=this.value[q],o=b,c=!0;break}}if(c)continue;if(l in this.value&&this.value[l]===null){this.value=cn.nullSymbol;continue}this.value=null;let d=this.$ref.path||"",p=this.path.replace(d,""),m=t.join("",s),y=n?.replace(d,"");throw new Ry.MissingPointerError(l,decodeURI(this.originalPath),p,m,y)}else this.value=this.value[l];s.push(l)}return(!this.value||this.value.$ref&&fC.resolve(this.path,this.value.$ref)!==n)&&_y(this,r,n),this}set(e,r,n){let i=t.parse(this.path),s;if(i.length===0)return this.value=r,r;this.value=WT(e);for(let o=0;o<i.length-1;o++)_y(this,n),s=i[o],this.value&&this.value[s]!==void 0?this.value=this.value[s]:this.value=VT(this,s,{});return _y(this,n),s=i[i.length-1],VT(this,s,r),e}static parse(e,r){let n=fC.getHash(e).substring(1);if(!n)return[];let i=n.split("/");for(let s=0;s<i.length;s++)i[s]=D3(i[s].replace(M3,"/").replace(F3,"~"));if(i[0]!=="")throw new Ry.InvalidPointerError(n,r===void 0?e:r);return i.slice(1)}static join(e,r){e.indexOf("#")===-1&&(e+="#"),r=Array.isArray(r)?r:[r];for(let n=0;n<r.length;n++){let i=r[n];e+="/"+encodeURIComponent(i.replace(N3,"~0").replace($3,"~1"))}return e}};function _y(t,e,r){if(cC.default.isAllowed$Ref(t.value,e)){let n=fC.resolve(t.path,t.value.$ref);if(n===t.path&&!zT(r))t.circular=!0;else{let i=t.$ref.$refs._resolve(n,t.path,e);return i===null?!1:(t.indirections+=i.indirections+1,cC.default.isExtended$Ref(t.value)?(t.value=cC.default.dereference(t.value,i.value),!1):(t.$ref=i.$ref,t.path=i.path,t.value=i.value,!0))}}}cn.default=Cy;function VT(t,e,r){if(t.value&&typeof t.value=="object")e==="-"&&Array.isArray(t.value)?t.value.push(r):t.value[e]=r;else throw new Ry.JSONParserError(`Error assigning $ref pointer "${t.path}".
|
|
242
242
|
Cannot set "${e}" of a non-object.`);return r}function WT(t){if((0,Ry.isHandledError)(t))throw t;return t}function zT(t){return typeof t=="string"&&Cy.parse(t).length==0}});var _c=V(Ms=>{"use strict";var j3=Ms&&Ms.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),L3=Ms&&Ms.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),U3=Ms&&Ms.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&j3(r,e,n[i]);return L3(r,e),r}})();Object.defineProperty(Ms,"__esModule",{value:!0});var xy=U3(tp()),Ey=Yn(),dC=Gn(),pC=class t{constructor(e){this.errors=[],this.$refs=e}addError(e){this.errors===void 0&&(this.errors=[]);let r=this.errors.map(({footprint:n})=>n);"errors"in e&&Array.isArray(e.errors)?this.errors.push(...e.errors.map(Ey.normalizeError).filter(({footprint:n})=>!r.includes(n))):(!("footprint"in e)||!r.includes(e.footprint))&&this.errors.push((0,Ey.normalizeError)(e))}exists(e,r){try{return this.resolve(e,r),!0}catch{return!1}}get(e,r){return this.resolve(e,r)?.value}resolve(e,r,n,i){let s=new xy.default(this,e,n);try{let o=s.resolve(this.value,r,i);return o.value===xy.nullSymbol&&(o.value=null),o}catch(o){if(!r||!r.continueOnError||!(0,Ey.isHandledError)(o))throw o;return o.path===null&&(o.path=(0,dC.safePointerToPath)((0,dC.getHash)(i))),o instanceof Ey.InvalidPointerError&&(o.source=decodeURI((0,dC.stripHash)(i))),this.addError(o),null}}set(e,r){let n=new xy.default(this,e);this.value=n.set(this.value,r),this.value===xy.nullSymbol&&(this.value=null)}static is$Ref(e){return!!e&&typeof e=="object"&&e!==null&&"$ref"in e&&typeof e.$ref=="string"&&e.$ref.length>0}static isExternal$Ref(e){return t.is$Ref(e)&&e.$ref[0]!=="#"}static isAllowed$Ref(e,r){if(this.is$Ref(e)){if(e.$ref.substring(0,2)==="#/"||e.$ref==="#")return!0;if(e.$ref[0]!=="#"&&(!r||r.resolve?.external))return!0}}static isExtended$Ref(e){return t.is$Ref(e)&&Object.keys(e).length>1}static dereference(e,r){if(r&&typeof r=="object"&&t.isExtended$Ref(e)){let n={};for(let i of Object.keys(e))i!=="$ref"&&(n[i]=e[i]);for(let i of Object.keys(r))i in n||(n[i]=r[i]);return n}else return r}};Ms.default=pC});var QT=V(wi=>{"use strict";var H3=wi&&wi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),B3=wi&&wi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),V3=wi&&wi.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&H3(r,e,n[i]);return B3(r,e),r}})(),KT=wi&&wi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wi,"__esModule",{value:!0});var JT=Bo(),W3=KT(_c()),Vo=V3(Gn()),GT=KT(QR()),hC=class{paths(...e){return YT(this._$refs,e.flat()).map(n=>(0,GT.default)(n.decoded))}values(...e){let r=this._$refs;return YT(r,e.flat()).reduce((i,s)=>(i[(0,GT.default)(s.decoded)]=r[s.encoded].value,i),{})}exists(e,r){try{return this._resolve(e,"",r),!0}catch{return!1}}get(e,r){return this._resolve(e,"",r).value}set(e,r){let n=Vo.resolve(this._root$Ref.path,e),i=Vo.stripHash(n),s=this._$refs[i];if(!s)throw(0,JT.ono)(`Error resolving $ref pointer "${e}".
|
|
243
243
|
"${i}" not found.`);s.set(n,r)}_get$Ref(e){e=Vo.resolve(this._root$Ref.path,e);let r=Vo.stripHash(e);return this._$refs[r]}_add(e){let r=Vo.stripHash(e),n=new W3.default(this);return n.path=r,this._$refs[r]=n,this._root$Ref=this._root$Ref||n,n}_resolve(e,r,n){let i=Vo.resolve(this._root$Ref.path,e),s=Vo.stripHash(i),o=this._$refs[s];if(!o)throw(0,JT.ono)(`Error resolving $ref pointer "${e}".
|
|
244
|
-
"${s}" not found.`);return o.resolve(i,n,e,r)}constructor(){this._$refs={},this.toJSON=this.values,this.circular=!1,this._$refs={},this._root$Ref=null}};wi.default=hC;function YT(t,e){let r=Object.keys(t);return e=Array.isArray(e[0])?e[0]:Array.prototype.slice.call(e),e.length>0&&e[0]&&(r=r.filter(n=>e.includes(t[n].pathType))),r.map(n=>({encoded:n,decoded:t[n].pathType==="file"?Vo.toFileSystemPath(n,!0):n}))}});var XT=V(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});Rc.all=z3;Rc.filter=J3;Rc.sort=G3;Rc.run=Y3;function z3(t){return Object.keys(t||{}).filter(e=>typeof t[e]=="object").map(e=>(t[e].name=e,t[e]))}function J3(t,e,r){return t.filter(n=>!!ZT(n,e,r))}function G3(t){for(let e of t)e.order=e.order||Number.MAX_SAFE_INTEGER;return t.sort((e,r)=>e.order-r.order)}async function Y3(t,e,r,n){let i,s,o=0;return new Promise((l,c)=>{d();function d(){if(i=t[o++],!i)return c(s);try{let b=ZT(i,e,r,p,n);if(b&&typeof b.then=="function")b.then(m,y);else if(b!==void 0)m(b);else if(o===t.length)throw new Error("No promise has been returned or callback has been called.")}catch(b){y(b)}}function p(b,
|
|
244
|
+
"${s}" not found.`);return o.resolve(i,n,e,r)}constructor(){this._$refs={},this.toJSON=this.values,this.circular=!1,this._$refs={},this._root$Ref=null}};wi.default=hC;function YT(t,e){let r=Object.keys(t);return e=Array.isArray(e[0])?e[0]:Array.prototype.slice.call(e),e.length>0&&e[0]&&(r=r.filter(n=>e.includes(t[n].pathType))),r.map(n=>({encoded:n,decoded:t[n].pathType==="file"?Vo.toFileSystemPath(n,!0):n}))}});var XT=V(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});Rc.all=z3;Rc.filter=J3;Rc.sort=G3;Rc.run=Y3;function z3(t){return Object.keys(t||{}).filter(e=>typeof t[e]=="object").map(e=>(t[e].name=e,t[e]))}function J3(t,e,r){return t.filter(n=>!!ZT(n,e,r))}function G3(t){for(let e of t)e.order=e.order||Number.MAX_SAFE_INTEGER;return t.sort((e,r)=>e.order-r.order)}async function Y3(t,e,r,n){let i,s,o=0;return new Promise((l,c)=>{d();function d(){if(i=t[o++],!i)return c(s);try{let b=ZT(i,e,r,p,n);if(b&&typeof b.then=="function")b.then(m,y);else if(b!==void 0)m(b);else if(o===t.length)throw new Error("No promise has been returned or callback has been called.")}catch(b){y(b)}}function p(b,q){b?y(b):m(q)}function m(b){l({plugin:i,result:b})}function y(b){s={plugin:i,error:b},d()}})}function ZT(t,e,r,n,i){let s=t[e];if(typeof s=="function")return s.apply(t,[r,n,i]);if(!n){if(s instanceof RegExp)return s.test(r.url);if(typeof s=="string")return s===r.extension;if(Array.isArray(s))return s.indexOf(r.extension)!==-1}return s}});var gC=V(Fs=>{"use strict";var K3=Fs&&Fs.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Q3=Fs&&Fs.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),e$=Fs&&Fs.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&K3(r,e,n[i]);return Q3(r,e),r}})();Object.defineProperty(Fs,"__esModule",{value:!0});var mC=Bo(),Z3=e$(Gn()),Wo=e$(XT()),ul=Yn();async function X3(t,e,r){let n=t.indexOf("#"),i="";n>=0&&(i=t.substring(n),t=t.substring(0,n));let s=e._add(t),o={url:t,hash:i,extension:Z3.getExtension(t)};try{let l=await e6(o,r,e);s.pathType=l.plugin.name,o.data=l.result;let c=await t6(o,r,e);return s.value=c.result,c.result}catch(l){throw(0,ul.isHandledError)(l)&&(s.value=l),l}}async function e6(t,e,r){let n=Wo.all(e.resolve);n=Wo.filter(n,"canRead",t),Wo.sort(n);try{return await Wo.run(n,"read",t,r)}catch(i){throw!i&&e.continueOnError?new ul.UnmatchedResolverError(t.url):!i||!("error"in i)?mC.ono.syntax(`Unable to resolve $ref pointer "${t.url}"`):i.error instanceof ul.ResolverError?i.error:new ul.ResolverError(i,t.url)}}async function t6(t,e,r){let n=Wo.all(e.parse),i=Wo.filter(n,"canParse",t),s=i.length>0?i:n;Wo.sort(s);try{let o=await Wo.run(s,"parse",t,r);if(!o.plugin.allowEmpty&&r6(o.result))throw mC.ono.syntax(`Error parsing "${t.url}" as ${o.plugin.name}.
|
|
245
245
|
Parsed value is empty`);return o}catch(o){throw!o&&e.continueOnError?new ul.UnmatchedParserError(t.url):o&&o.message&&o.message.startsWith("Error parsing")?o:!o||!("error"in o)?mC.ono.syntax(`Unable to parse ${t.url}`):o.error instanceof ul.ParserError?o.error:new ul.ParserError(o.error.message,t.url)}}function r6(t){return t===void 0||typeof t=="object"&&Object.keys(t).length===0||typeof t=="string"&&t.trim().length===0||Buffer.isBuffer(t)&&t.length===0}Fs.default=X3});var r$=V(yC=>{"use strict";Object.defineProperty(yC,"__esModule",{value:!0});var t$=Yn();yC.default={order:100,allowEmpty:!0,canParse:".json",allowBOM:!0,async parse(t){let e=t.data;if(Buffer.isBuffer(e)&&(e=e.toString()),typeof e=="string"){if(e.trim().length===0)return;try{return JSON.parse(e)}catch(r){if(this.allowBOM)try{let n=e.indexOf("{");return e=e.slice(n),JSON.parse(e)}catch(n){throw new t$.ParserError(n.message,t.url)}throw new t$.ParserError(r.message,t.url)}}else return e}}});var Cc=V((pre,cl)=>{"use strict";function n$(t){return typeof t>"u"||t===null}function n6(t){return typeof t=="object"&&t!==null}function i6(t){return Array.isArray(t)?t:n$(t)?[]:[t]}function s6(t,e){if(e){let r=Object.keys(e);for(let n=0,i=r.length;n<i;n+=1){let s=r[n];t[s]=e[s]}}return t}function o6(t,e){let r="";for(let n=0;n<e;n+=1)r+=t;return r}function a6(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}cl.exports.isNothing=n$;cl.exports.isObject=n6;cl.exports.toArray=i6;cl.exports.repeat=o6;cl.exports.isNegativeZero=a6;cl.exports.extend=s6});var xc=V((hre,s$)=>{"use strict";function i$(t,e){let r="",n=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(r+='in "'+t.mark.name+'" '),r+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!e&&t.mark.snippet&&(r+=`
|
|
246
246
|
|
|
247
247
|
`+t.mark.snippet),n+" "+r):n}function rp(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=i$(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}rp.prototype=Object.create(Error.prototype);rp.prototype.constructor=rp;rp.prototype.toString=function(e){return this.name+": "+i$(this,e)};s$.exports=rp});var a$=V((mre,o$)=>{"use strict";var np=Cc();function vC(t,e,r,n,i){let s="",o="",l=Math.floor(i/2)-1;return n-e>l&&(s=" ... ",e=n-l+s.length),r-n>l&&(o=" ...",r=n+l-o.length),{str:s+t.slice(e,r).replace(/\t/g,"\u2192")+o,pos:n-e+s.length}}function bC(t,e){return np.repeat(" ",e-t.length)+t}function l6(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);let r=/\r?\n|\r|\0/g,n=[0],i=[],s,o=-1;for(;s=r.exec(t.buffer);)i.push(s.index),n.push(s.index+s[0].length),t.position<=s.index&&o<0&&(o=n.length-2);o<0&&(o=n.length-1);let l="",c=Math.min(t.line+e.linesAfter,i.length).toString().length,d=e.maxLength-(e.indent+c+3);for(let m=1;m<=e.linesBefore&&!(o-m<0);m++){let y=vC(t.buffer,n[o-m],i[o-m],t.position-(n[o]-n[o-m]),d);l=np.repeat(" ",e.indent)+bC((t.line-m+1).toString(),c)+" | "+y.str+`
|
|
@@ -251,17 +251,17 @@ Parsed value is empty`);return o}catch(o){throw!o&&e.continueOnError?new ul.Unma
|
|
|
251
251
|
`}return l.replace(/\n$/,"")}o$.exports=l6});var Ir=V((gre,u$)=>{"use strict";var l$=xc(),u6=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],c6=["scalar","sequence","mapping"];function f6(t){let e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(n){e[String(n)]=r})}),e}function d6(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(u6.indexOf(r)===-1)throw new l$('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')}),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(r){return r},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=f6(e.styleAliases||null),c6.indexOf(this.kind)===-1)throw new l$('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}u$.exports=d6});var _C=V((yre,f$)=>{"use strict";var ip=xc(),SC=Ir();function c$(t,e){let r=[];return t[e].forEach(function(n){let i=r.length;r.forEach(function(s,o){s.tag===n.tag&&s.kind===n.kind&&s.multi===n.multi&&(i=o)}),r[i]=n}),r}function p6(){let t={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function e(r){r.multi?(t.multi[r.kind].push(r),t.multi.fallback.push(r)):t[r.kind][r.tag]=t.fallback[r.tag]=r}for(let r=0,n=arguments.length;r<n;r+=1)arguments[r].forEach(e);return t}function wC(t){return this.extend(t)}wC.prototype.extend=function(e){let r=[],n=[];if(e instanceof SC)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(r=r.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new ip("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(s){if(!(s instanceof SC))throw new ip("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new ip("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new ip("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(s){if(!(s instanceof SC))throw new ip("Specified list of YAML types (or a single Type object) contains a non-Type object.")});let i=Object.create(wC.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=c$(i,"implicit"),i.compiledExplicit=c$(i,"explicit"),i.compiledTypeMap=p6(i.compiledImplicit,i.compiledExplicit),i};f$.exports=wC});var RC=V((vre,d$)=>{"use strict";var h6=Ir();d$.exports=new h6("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}})});var CC=V((bre,p$)=>{"use strict";var m6=Ir();p$.exports=new m6("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}})});var xC=V((Sre,h$)=>{"use strict";var g6=Ir();h$.exports=new g6("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}})});var EC=V((wre,m$)=>{"use strict";var y6=_C();m$.exports=new y6({explicit:[RC(),CC(),xC()]})});var qC=V((_re,g$)=>{"use strict";var v6=Ir();function b6(t){if(t===null)return!0;let e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}function S6(){return null}function w6(t){return t===null}g$.exports=new v6("tag:yaml.org,2002:null",{kind:"scalar",resolve:b6,construct:S6,predicate:w6,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"})});var OC=V((Rre,y$)=>{"use strict";var _6=Ir();function R6(t){if(t===null)return!1;let e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}function C6(t){return t==="true"||t==="True"||t==="TRUE"}function x6(t){return Object.prototype.toString.call(t)==="[object Boolean]"}y$.exports=new _6("tag:yaml.org,2002:bool",{kind:"scalar",resolve:R6,construct:C6,predicate:x6,represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"})});var IC=V((Cre,v$)=>{"use strict";var E6=Cc(),q6=Ir();function O6(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function I6(t){return t>=48&&t<=55}function P6(t){return t>=48&&t<=57}function k6(t){if(t===null)return!1;let e=t.length,r=0,n=!1;if(!e)return!1;let i=t[r];if((i==="-"||i==="+")&&(i=t[++r]),i==="0"){if(r+1===e)return!0;if(i=t[++r],i==="b"){for(r++;r<e;r++){if(i=t[r],i!=="0"&&i!=="1")return!1;n=!0}return n&&Number.isFinite(sp(t))}if(i==="x"){for(r++;r<e;r++){if(!O6(t.charCodeAt(r)))return!1;n=!0}return n&&Number.isFinite(sp(t))}if(i==="o"){for(r++;r<e;r++){if(!I6(t.charCodeAt(r)))return!1;n=!0}return n&&Number.isFinite(sp(t))}}for(;r<e;r++){if(!P6(t.charCodeAt(r)))return!1;n=!0}return n?Number.isFinite(sp(t)):!1}function sp(t){let e=t,r=1,n=e[0];if((n==="-"||n==="+")&&(n==="-"&&(r=-1),e=e.slice(1),n=e[0]),e==="0")return 0;if(n==="0"){if(e[1]==="b")return r*parseInt(e.slice(2),2);if(e[1]==="x")return r*parseInt(e.slice(2),16);if(e[1]==="o")return r*parseInt(e.slice(2),8)}return r*parseInt(e,10)}function A6(t){return sp(t)}function T6(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!E6.isNegativeZero(t)}v$.exports=new q6("tag:yaml.org,2002:int",{kind:"scalar",resolve:k6,construct:A6,predicate:T6,represent:{binary:function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var PC=V((xre,S$)=>{"use strict";var b$=Cc(),$6=Ir(),N6=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),M6=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function F6(t){return t===null||!N6.test(t)?!1:Number.isFinite(parseFloat(t,10))?!0:M6.test(t)}function D6(t){let e=t.toLowerCase(),r=e[0]==="-"?-1:1;return"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:r*parseFloat(e,10)}var j6=/^[-+]?[0-9]+e/;function L6(t,e){if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(b$.isNegativeZero(t))return"-0.0";let r=t.toString(10);return j6.test(r)?r.replace("e",".e"):r}function U6(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||b$.isNegativeZero(t))}S$.exports=new $6("tag:yaml.org,2002:float",{kind:"scalar",resolve:F6,construct:D6,predicate:U6,represent:L6,defaultStyle:"lowercase"})});var kC=V((Ere,w$)=>{"use strict";w$.exports=EC().extend({implicit:[qC(),OC(),IC(),PC()]})});var AC=V((qre,_$)=>{"use strict";_$.exports=kC()});var TC=V((Ore,x$)=>{"use strict";var H6=Ir(),R$=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),C$=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function B6(t){return t===null?!1:R$.exec(t)!==null||C$.exec(t)!==null}function V6(t){let e=0,r=null,n=R$.exec(t);if(n===null&&(n=C$.exec(t)),n===null)throw new Error("Date resolve error");let i=+n[1],s=+n[2]-1,o=+n[3];if(!n[4])return new Date(Date.UTC(i,s,o));let l=+n[4],c=+n[5],d=+n[6];if(n[7]){for(e=n[7].slice(0,3);e.length<3;)e+="0";e=+e}if(n[9]){let m=+n[10],y=+(n[11]||0);r=(m*60+y)*6e4,n[9]==="-"&&(r=-r)}let p=new Date(Date.UTC(i,s,o,l,c,d,e));return r&&p.setTime(p.getTime()-r),p}function W6(t){return t.toISOString()}x$.exports=new H6("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:B6,construct:V6,instanceOf:Date,represent:W6})});var $C=V((Ire,E$)=>{"use strict";var z6=Ir();function J6(t){return t==="<<"||t===null}E$.exports=new z6("tag:yaml.org,2002:merge",{kind:"scalar",resolve:J6})});var MC=V((Pre,q$)=>{"use strict";var G6=Ir(),NC=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
252
252
|
\r`;function Y6(t){if(t===null)return!1;let e=0,r=t.length,n=NC;for(let i=0;i<r;i++){let s=n.indexOf(t.charAt(i));if(!(s>64)){if(s<0)return!1;e+=6}}return e%8===0}function K6(t){let e=t.replace(/[\r\n=]/g,""),r=e.length,n=NC,i=0,s=[];for(let l=0;l<r;l++)l%4===0&&l&&(s.push(i>>16&255),s.push(i>>8&255),s.push(i&255)),i=i<<6|n.indexOf(e.charAt(l));let o=r%4*6;return o===0?(s.push(i>>16&255),s.push(i>>8&255),s.push(i&255)):o===18?(s.push(i>>10&255),s.push(i>>2&255)):o===12&&s.push(i>>4&255),new Uint8Array(s)}function Q6(t){let e="",r=0,n=t.length,i=NC;for(let o=0;o<n;o++)o%3===0&&o&&(e+=i[r>>18&63],e+=i[r>>12&63],e+=i[r>>6&63],e+=i[r&63]),r=(r<<8)+t[o];let s=n%3;return s===0?(e+=i[r>>18&63],e+=i[r>>12&63],e+=i[r>>6&63],e+=i[r&63]):s===2?(e+=i[r>>10&63],e+=i[r>>4&63],e+=i[r<<2&63],e+=i[64]):s===1&&(e+=i[r>>2&63],e+=i[r<<4&63],e+=i[64],e+=i[64]),e}function Z6(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}q$.exports=new G6("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Y6,construct:K6,predicate:Z6,represent:Q6})});var FC=V((kre,O$)=>{"use strict";var X6=Ir(),e9=Object.prototype.hasOwnProperty,t9=Object.prototype.toString;function r9(t){if(t===null)return!0;let e=[],r=t;for(let n=0,i=r.length;n<i;n+=1){let s=r[n],o=!1;if(t9.call(s)!=="[object Object]")return!1;let l;for(l in s)if(e9.call(s,l))if(!o)o=!0;else return!1;if(!o)return!1;if(e.indexOf(l)===-1)e.push(l);else return!1}return!0}function n9(t){return t!==null?t:[]}O$.exports=new X6("tag:yaml.org,2002:omap",{kind:"sequence",resolve:r9,construct:n9})});var DC=V((Are,I$)=>{"use strict";var i9=Ir(),s9=Object.prototype.toString;function o9(t){if(t===null)return!0;let e=t,r=new Array(e.length);for(let n=0,i=e.length;n<i;n+=1){let s=e[n];if(s9.call(s)!=="[object Object]")return!1;let o=Object.keys(s);if(o.length!==1)return!1;r[n]=[o[0],s[o[0]]]}return!0}function a9(t){if(t===null)return[];let e=t,r=new Array(e.length);for(let n=0,i=e.length;n<i;n+=1){let s=e[n],o=Object.keys(s);r[n]=[o[0],s[o[0]]]}return r}I$.exports=new i9("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:o9,construct:a9})});var jC=V((Tre,P$)=>{"use strict";var l9=Ir(),u9=Object.prototype.hasOwnProperty;function c9(t){if(t===null)return!0;let e=t;for(let r in e)if(u9.call(e,r)&&e[r]!==null)return!1;return!0}function f9(t){return t!==null?t:{}}P$.exports=new l9("tag:yaml.org,2002:set",{kind:"mapping",resolve:c9,construct:f9})});var qy=V(($re,k$)=>{"use strict";k$.exports=AC().extend({implicit:[TC(),$C()],explicit:[MC(),FC(),DC(),jC()]})});var Q$=V((Nre,BC)=>{"use strict";var fl=Cc(),j$=xc(),d9=a$(),p9=qy(),_i=Object.prototype.hasOwnProperty,Oy=1,L$=2,U$=3,Iy=4,LC=1,h9=2,A$=3,m9=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,g9=/[\x85\u2028\u2029]/,y9=/[,\[\]{}]/,H$=/^(?:!|!!|![0-9A-Za-z-]+!)$/,B$=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function T$(t){return Object.prototype.toString.call(t)}function ts(t){return t===10||t===13}function Ds(t){return t===9||t===32}function fn(t){return t===9||t===32||t===10||t===13}function Ec(t){return t===44||t===91||t===93||t===123||t===125}function v9(t){if(t>=48&&t<=57)return t-48;let e=t|32;return e>=97&&e<=102?e-97+10:-1}function b9(t){return t===120?2:t===117?4:t===85?8:0}function S9(t){return t>=48&&t<=57?t-48:-1}function $$(t){switch(t){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
|
|
253
253
|
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function w9(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}function V$(t,e,r){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[e]=r}var W$=new Array(256),z$=new Array(256);for(let t=0;t<256;t++)W$[t]=$$(t)?1:0,z$[t]=$$(t);function _9(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||p9,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:100,this.maxMergeSeqLength=typeof e.maxMergeSeqLength=="number"?e.maxMergeSeqLength:20,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function J$(t,e){let r={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return r.snippet=d9(r),new j$(e,r)}function we(t,e){throw J$(t,e)}function Py(t,e){t.onWarning&&t.onWarning.call(null,J$(t,e))}function dl(t,e,r){let n=t.anchorMapTransactions;if(n.length!==0){let i=n[n.length-1];_i.call(i,e)||(i[e]={existed:_i.call(t.anchorMap,e),value:t.anchorMap[e]})}t.anchorMap[e]=r}function R9(t){t.anchorMapTransactions.push(Object.create(null))}function C9(t){let e=t.anchorMapTransactions.pop(),r=t.anchorMapTransactions;if(r.length===0)return;let n=r[r.length-1],i=Object.keys(e);for(let s=0,o=i.length;s<o;s+=1){let l=i[s];_i.call(n,l)||(n[l]=e[l])}}function x9(t){let e=t.anchorMapTransactions.pop(),r=Object.keys(e);for(let n=r.length-1;n>=0;n-=1){let i=e[r[n]];i.existed?t.anchorMap[r[n]]=i.value:delete t.anchorMap[r[n]]}}function G$(t){return{position:t.position,line:t.line,lineStart:t.lineStart,lineIndent:t.lineIndent,firstTabInLine:t.firstTabInLine,tag:t.tag,anchor:t.anchor,kind:t.kind,result:t.result}}function N$(t,e){t.position=e.position,t.line=e.line,t.lineStart=e.lineStart,t.lineIndent=e.lineIndent,t.firstTabInLine=e.firstTabInLine,t.tag=e.tag,t.anchor=e.anchor,t.kind=e.kind,t.result=e.result}var M$={YAML:function(e,r,n){e.version!==null&&we(e,"duplication of %YAML directive"),n.length!==1&&we(e,"YAML directive accepts exactly one argument");let i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]);i===null&&we(e,"ill-formed argument of the YAML directive");let s=parseInt(i[1],10),o=parseInt(i[2],10);s!==1&&we(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&Py(e,"unsupported YAML version of the document")},TAG:function(e,r,n){let i;n.length!==2&&we(e,"TAG directive accepts exactly two arguments");let s=n[0];i=n[1],H$.test(s)||we(e,"ill-formed tag handle (first argument) of the TAG directive"),_i.call(e.tagMap,s)&&we(e,'there is a previously declared suffix for "'+s+'" tag handle'),B$.test(i)||we(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch{we(e,"tag prefix is malformed: "+i)}e.tagMap[s]=i}};function zo(t,e,r,n){if(e<r){let i=t.input.slice(e,r);if(n)for(let s=0,o=i.length;s<o;s+=1){let l=i.charCodeAt(s);l===9||l>=32&&l<=1114111||we(t,"expected valid JSON character")}else m9.test(i)&&we(t,"the stream contains non-printable characters");t.result+=i}}function F$(t,e,r,n){fl.isObject(r)||we(t,"cannot merge mappings; the provided source object is unacceptable");let i=Object.keys(r);for(let s=0,o=i.length;s<o;s+=1){let l=i[s];_i.call(e,l)||(V$(e,l,r[l]),n[l]=!0)}}function qc(t,e,r,n,i,s,o,l,c){if(Array.isArray(i)){i=Array.prototype.slice.call(i);for(let d=0,p=i.length;d<p;d+=1)Array.isArray(i[d])&&we(t,"nested arrays are not supported inside keys"),typeof i=="object"&&T$(i[d])==="[object Object]"&&(i[d]="[object Object]")}if(typeof i=="object"&&T$(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(s)){s.length>t.maxMergeSeqLength&&we(t,"merge sequence length exceeded maxMergeSeqLength ("+t.maxMergeSeqLength+")");let d=new Set;for(let p=0,m=s.length;p<m;p+=1){let y=s[p];d.has(y)||(d.add(y),F$(t,e,y,r))}}else F$(t,e,s,r);else!t.json&&!_i.call(r,i)&&_i.call(e,i)&&(t.line=o||t.line,t.lineStart=l||t.lineStart,t.position=c||t.position,we(t,"duplicated mapping key")),V$(e,i,s),delete r[i];return e}function UC(t){let e=t.input.charCodeAt(t.position);e===10?t.position++:e===13?(t.position++,t.input.charCodeAt(t.position)===10&&t.position++):we(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}function nr(t,e,r){let n=0,i=t.input.charCodeAt(t.position);for(;i!==0;){for(;Ds(i);)i===9&&t.firstTabInLine===-1&&(t.firstTabInLine=t.position),i=t.input.charCodeAt(++t.position);if(e&&i===35)do i=t.input.charCodeAt(++t.position);while(i!==10&&i!==13&&i!==0);if(ts(i))for(UC(t),i=t.input.charCodeAt(t.position),n++,t.lineIndent=0;i===32;)t.lineIndent++,i=t.input.charCodeAt(++t.position);else break}return r!==-1&&n!==0&&t.lineIndent<r&&Py(t,"deficient indentation"),n}function ky(t){let e=t.position,r=t.input.charCodeAt(e);return!!((r===45||r===46)&&r===t.input.charCodeAt(e+1)&&r===t.input.charCodeAt(e+2)&&(e+=3,r=t.input.charCodeAt(e),r===0||fn(r)))}function HC(t,e){e===1?t.result+=" ":e>1&&(t.result+=fl.repeat(`
|
|
254
|
-
`,e-1))}function E9(t,e,r){let n,i,s,o,l,c,d=t.kind,p=t.result,m=t.input.charCodeAt(t.position);if(fn(m)||Ec(m)||m===35||m===38||m===42||m===33||m===124||m===62||m===39||m===34||m===37||m===64||m===96)return!1;if(m===63||m===45){let y=t.input.charCodeAt(t.position+1);if(fn(y)||r&&Ec(y))return!1}for(t.kind="scalar",t.result="",n=i=t.position,s=!1;m!==0;){if(m===58){let y=t.input.charCodeAt(t.position+1);if(fn(y)||r&&Ec(y))break}else if(m===35){let y=t.input.charCodeAt(t.position-1);if(fn(y))break}else{if(t.position===t.lineStart&&ky(t)||r&&Ec(m))break;if(ts(m))if(o=t.line,l=t.lineStart,c=t.lineIndent,nr(t,!1,-1),t.lineIndent>=e){s=!0,m=t.input.charCodeAt(t.position);continue}else{t.position=i,t.line=o,t.lineStart=l,t.lineIndent=c;break}}s&&(zo(t,n,i,!1),HC(t,t.line-o),n=i=t.position,s=!1),Ds(m)||(i=t.position+1),m=t.input.charCodeAt(++t.position)}return zo(t,n,i,!1),t.result?!0:(t.kind=d,t.result=p,!1)}function q9(t,e){let r,n,i=t.input.charCodeAt(t.position);if(i!==39)return!1;for(t.kind="scalar",t.result="",t.position++,r=n=t.position;(i=t.input.charCodeAt(t.position))!==0;)if(i===39)if(zo(t,r,t.position,!0),i=t.input.charCodeAt(++t.position),i===39)r=t.position,t.position++,n=t.position;else return!0;else ts(i)?(zo(t,r,n,!0),HC(t,nr(t,!1,e)),r=n=t.position):t.position===t.lineStart&&ky(t)?we(t,"unexpected end of the document within a single quoted scalar"):(t.position++,Ds(i)||(n=t.position));we(t,"unexpected end of the stream within a single quoted scalar")}function O9(t,e){let r,n,i,s=t.input.charCodeAt(t.position);if(s!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=n=t.position;(s=t.input.charCodeAt(t.position))!==0;){if(s===34)return zo(t,r,t.position,!0),t.position++,!0;if(s===92){if(zo(t,r,t.position,!0),s=t.input.charCodeAt(++t.position),ts(s))nr(t,!1,e);else if(s<256&&W$[s])t.result+=z$[s],t.position++;else if((i=b9(s))>0){let o=i,l=0;for(;o>0;o--)s=t.input.charCodeAt(++t.position),(i=v9(s))>=0?l=(l<<4)+i:we(t,"expected hexadecimal character");t.result+=w9(l),t.position++}else we(t,"unknown escape sequence");r=n=t.position}else ts(s)?(zo(t,r,n,!0),HC(t,nr(t,!1,e)),r=n=t.position):t.position===t.lineStart&&ky(t)?we(t,"unexpected end of the document within a double quoted scalar"):(t.position++,Ds(s)||(n=t.position))}we(t,"unexpected end of the stream within a double quoted scalar")}function I9(t,e){let r=!0,n,i,s,o=t.tag,l,c=t.anchor,d,p,m,y,b=Object.create(null),
|
|
254
|
+
`,e-1))}function E9(t,e,r){let n,i,s,o,l,c,d=t.kind,p=t.result,m=t.input.charCodeAt(t.position);if(fn(m)||Ec(m)||m===35||m===38||m===42||m===33||m===124||m===62||m===39||m===34||m===37||m===64||m===96)return!1;if(m===63||m===45){let y=t.input.charCodeAt(t.position+1);if(fn(y)||r&&Ec(y))return!1}for(t.kind="scalar",t.result="",n=i=t.position,s=!1;m!==0;){if(m===58){let y=t.input.charCodeAt(t.position+1);if(fn(y)||r&&Ec(y))break}else if(m===35){let y=t.input.charCodeAt(t.position-1);if(fn(y))break}else{if(t.position===t.lineStart&&ky(t)||r&&Ec(m))break;if(ts(m))if(o=t.line,l=t.lineStart,c=t.lineIndent,nr(t,!1,-1),t.lineIndent>=e){s=!0,m=t.input.charCodeAt(t.position);continue}else{t.position=i,t.line=o,t.lineStart=l,t.lineIndent=c;break}}s&&(zo(t,n,i,!1),HC(t,t.line-o),n=i=t.position,s=!1),Ds(m)||(i=t.position+1),m=t.input.charCodeAt(++t.position)}return zo(t,n,i,!1),t.result?!0:(t.kind=d,t.result=p,!1)}function q9(t,e){let r,n,i=t.input.charCodeAt(t.position);if(i!==39)return!1;for(t.kind="scalar",t.result="",t.position++,r=n=t.position;(i=t.input.charCodeAt(t.position))!==0;)if(i===39)if(zo(t,r,t.position,!0),i=t.input.charCodeAt(++t.position),i===39)r=t.position,t.position++,n=t.position;else return!0;else ts(i)?(zo(t,r,n,!0),HC(t,nr(t,!1,e)),r=n=t.position):t.position===t.lineStart&&ky(t)?we(t,"unexpected end of the document within a single quoted scalar"):(t.position++,Ds(i)||(n=t.position));we(t,"unexpected end of the stream within a single quoted scalar")}function O9(t,e){let r,n,i,s=t.input.charCodeAt(t.position);if(s!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=n=t.position;(s=t.input.charCodeAt(t.position))!==0;){if(s===34)return zo(t,r,t.position,!0),t.position++,!0;if(s===92){if(zo(t,r,t.position,!0),s=t.input.charCodeAt(++t.position),ts(s))nr(t,!1,e);else if(s<256&&W$[s])t.result+=z$[s],t.position++;else if((i=b9(s))>0){let o=i,l=0;for(;o>0;o--)s=t.input.charCodeAt(++t.position),(i=v9(s))>=0?l=(l<<4)+i:we(t,"expected hexadecimal character");t.result+=w9(l),t.position++}else we(t,"unknown escape sequence");r=n=t.position}else ts(s)?(zo(t,r,n,!0),HC(t,nr(t,!1,e)),r=n=t.position):t.position===t.lineStart&&ky(t)?we(t,"unexpected end of the document within a double quoted scalar"):(t.position++,Ds(s)||(n=t.position))}we(t,"unexpected end of the stream within a double quoted scalar")}function I9(t,e){let r=!0,n,i,s,o=t.tag,l,c=t.anchor,d,p,m,y,b=Object.create(null),q,C,v,_=t.input.charCodeAt(t.position);if(_===91)d=93,y=!1,l=[];else if(_===123)d=125,y=!0,l={};else return!1;for(t.anchor!==null&&dl(t,t.anchor,l),_=t.input.charCodeAt(++t.position);_!==0;){if(nr(t,!0,e),_=t.input.charCodeAt(t.position),_===d)return t.position++,t.tag=o,t.anchor=c,t.kind=y?"mapping":"sequence",t.result=l,!0;if(r?_===44&&we(t,"expected the node content, but found ','"):we(t,"missed comma between flow collection entries"),C=q=v=null,p=m=!1,_===63){let E=t.input.charCodeAt(t.position+1);fn(E)&&(p=m=!0,t.position++,nr(t,!0,e))}n=t.line,i=t.lineStart,s=t.position,Oc(t,e,Oy,!1,!0),C=t.tag,q=t.result,nr(t,!0,e),_=t.input.charCodeAt(t.position),(m||t.line===n)&&_===58&&(p=!0,_=t.input.charCodeAt(++t.position),nr(t,!0,e),Oc(t,e,Oy,!1,!0),v=t.result),y?qc(t,l,b,C,q,v,n,i,s):p?l.push(qc(t,null,b,C,q,v,n,i,s)):l.push(q),nr(t,!0,e),_=t.input.charCodeAt(t.position),_===44?(r=!0,_=t.input.charCodeAt(++t.position)):r=!1}we(t,"unexpected end of the stream within a flow collection")}function P9(t,e){let r,n=LC,i=!1,s=!1,o=e,l=0,c=!1,d,p=t.input.charCodeAt(t.position);if(p===124)r=!1;else if(p===62)r=!0;else return!1;for(t.kind="scalar",t.result="";p!==0;)if(p=t.input.charCodeAt(++t.position),p===43||p===45)LC===n?n=p===43?A$:h9:we(t,"repeat of a chomping mode identifier");else if((d=S9(p))>=0)d===0?we(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?we(t,"repeat of an indentation width identifier"):(o=e+d-1,s=!0);else break;if(Ds(p)){do p=t.input.charCodeAt(++t.position);while(Ds(p));if(p===35)do p=t.input.charCodeAt(++t.position);while(!ts(p)&&p!==0)}for(;p!==0;){for(UC(t),t.lineIndent=0,p=t.input.charCodeAt(t.position);(!s||t.lineIndent<o)&&p===32;)t.lineIndent++,p=t.input.charCodeAt(++t.position);if(!s&&t.lineIndent>o&&(o=t.lineIndent),ts(p)){l++;continue}if(!s&&o===0&&we(t,"missing indentation for block scalar"),t.lineIndent<o){n===A$?t.result+=fl.repeat(`
|
|
255
255
|
`,i?1+l:l):n===LC&&i&&(t.result+=`
|
|
256
256
|
`);break}r?Ds(p)?(c=!0,t.result+=fl.repeat(`
|
|
257
257
|
`,i?1+l:l)):c?(c=!1,t.result+=fl.repeat(`
|
|
258
258
|
`,l+1)):l===0?i&&(t.result+=" "):t.result+=fl.repeat(`
|
|
259
259
|
`,l):t.result+=fl.repeat(`
|
|
260
|
-
`,i?1+l:l),i=!0,s=!0,l=0;let m=t.position;for(;!ts(p)&&p!==0;)p=t.input.charCodeAt(++t.position);zo(t,m,t.position,!1)}return!0}function D$(t,e){let r=t.tag,n=t.anchor,i=[],s=!1;if(t.firstTabInLine!==-1)return!1;t.anchor!==null&&dl(t,t.anchor,i);let o=t.input.charCodeAt(t.position);for(;o!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,we(t,"tab characters must not be used in indentation")),o===45);){let l=t.input.charCodeAt(t.position+1);if(!fn(l))break;if(s=!0,t.position++,nr(t,!0,-1)&&t.lineIndent<=e){i.push(null),o=t.input.charCodeAt(t.position);continue}let c=t.line;if(Oc(t,e,U$,!1,!0),i.push(t.result),nr(t,!0,-1),o=t.input.charCodeAt(t.position),(t.line===c||t.lineIndent>e)&&o!==0)we(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return s?(t.tag=r,t.anchor=n,t.kind="sequence",t.result=i,!0):!1}function Y$(t,e,r){let n,i,s,o,l=t.tag,c=t.anchor,d={},p=Object.create(null),m=null,y=null,b=null,
|
|
260
|
+
`,i?1+l:l),i=!0,s=!0,l=0;let m=t.position;for(;!ts(p)&&p!==0;)p=t.input.charCodeAt(++t.position);zo(t,m,t.position,!1)}return!0}function D$(t,e){let r=t.tag,n=t.anchor,i=[],s=!1;if(t.firstTabInLine!==-1)return!1;t.anchor!==null&&dl(t,t.anchor,i);let o=t.input.charCodeAt(t.position);for(;o!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,we(t,"tab characters must not be used in indentation")),o===45);){let l=t.input.charCodeAt(t.position+1);if(!fn(l))break;if(s=!0,t.position++,nr(t,!0,-1)&&t.lineIndent<=e){i.push(null),o=t.input.charCodeAt(t.position);continue}let c=t.line;if(Oc(t,e,U$,!1,!0),i.push(t.result),nr(t,!0,-1),o=t.input.charCodeAt(t.position),(t.line===c||t.lineIndent>e)&&o!==0)we(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return s?(t.tag=r,t.anchor=n,t.kind="sequence",t.result=i,!0):!1}function Y$(t,e,r){let n,i,s,o,l=t.tag,c=t.anchor,d={},p=Object.create(null),m=null,y=null,b=null,q=!1,C=!1;if(t.firstTabInLine!==-1)return!1;t.anchor!==null&&dl(t,t.anchor,d);let v=t.input.charCodeAt(t.position);for(;v!==0;){!q&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,we(t,"tab characters must not be used in indentation"));let _=t.input.charCodeAt(t.position+1),E=t.line;if((v===63||v===58)&&fn(_))v===63?(q&&(qc(t,d,p,m,y,null,i,s,o),m=y=b=null),C=!0,q=!0,n=!0):q?(q=!1,n=!0):we(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,v=_;else{if(i=t.line,s=t.lineStart,o=t.position,!Oc(t,r,L$,!1,!0))break;if(t.line===E){for(v=t.input.charCodeAt(t.position);Ds(v);)v=t.input.charCodeAt(++t.position);if(v===58)v=t.input.charCodeAt(++t.position),fn(v)||we(t,"a whitespace character is expected after the key-value separator within a block mapping"),q&&(qc(t,d,p,m,y,null,i,s,o),m=y=b=null),C=!0,q=!1,n=!1,m=t.tag,y=t.result;else if(C)we(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=l,t.anchor=c,!0}else if(C)we(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=l,t.anchor=c,!0}if((t.line===E||t.lineIndent>e)&&(q&&(i=t.line,s=t.lineStart,o=t.position),Oc(t,e,Iy,!0,n)&&(q?y=t.result:b=t.result),q||(qc(t,d,p,m,y,b,i,s,o),m=y=b=null),nr(t,!0,-1),v=t.input.charCodeAt(t.position)),(t.line===E||t.lineIndent>e)&&v!==0)we(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return q&&qc(t,d,p,m,y,null,i,s,o),C&&(t.tag=l,t.anchor=c,t.kind="mapping",t.result=d),C}function k9(t){let e=!1,r=!1,n,i,s=t.input.charCodeAt(t.position);if(s!==33)return!1;t.tag!==null&&we(t,"duplication of a tag property"),s=t.input.charCodeAt(++t.position),s===60?(e=!0,s=t.input.charCodeAt(++t.position)):s===33?(r=!0,n="!!",s=t.input.charCodeAt(++t.position)):n="!";let o=t.position;if(e){do s=t.input.charCodeAt(++t.position);while(s!==0&&s!==62);t.position<t.length?(i=t.input.slice(o,t.position),s=t.input.charCodeAt(++t.position)):we(t,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!fn(s);)s===33&&(r?we(t,"tag suffix cannot contain exclamation marks"):(n=t.input.slice(o-1,t.position+1),H$.test(n)||we(t,"named tag handle cannot contain such characters"),r=!0,o=t.position+1)),s=t.input.charCodeAt(++t.position);i=t.input.slice(o,t.position),y9.test(i)&&we(t,"tag suffix cannot contain flow indicator characters")}i&&!B$.test(i)&&we(t,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch{we(t,"tag name is malformed: "+i)}return e?t.tag=i:_i.call(t.tagMap,n)?t.tag=t.tagMap[n]+i:n==="!"?t.tag="!"+i:n==="!!"?t.tag="tag:yaml.org,2002:"+i:we(t,'undeclared tag handle "'+n+'"'),!0}function A9(t){let e=t.input.charCodeAt(t.position);if(e!==38)return!1;t.anchor!==null&&we(t,"duplication of an anchor property"),e=t.input.charCodeAt(++t.position);let r=t.position;for(;e!==0&&!fn(e)&&!Ec(e);)e=t.input.charCodeAt(++t.position);return t.position===r&&we(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(r,t.position),!0}function T9(t){let e=t.input.charCodeAt(t.position);if(e!==42)return!1;e=t.input.charCodeAt(++t.position);let r=t.position;for(;e!==0&&!fn(e)&&!Ec(e);)e=t.input.charCodeAt(++t.position);t.position===r&&we(t,"name of an alias node must contain at least one character");let n=t.input.slice(r,t.position);return _i.call(t.anchorMap,n)||we(t,'unidentified alias "'+n+'"'),t.result=t.anchorMap[n],nr(t,!0,-1),!0}function $9(t,e,r,n){let i=G$(t);return R9(t),N$(t,e),t.tag=null,t.anchor=null,t.kind=null,t.result=null,Y$(t,r,n)&&t.kind==="mapping"?(C9(t),!0):(x9(t),N$(t,i),!1)}function Oc(t,e,r,n,i){let s,o,l=1,c=!1,d=!1,p=null,m,y,b;t.depth>=t.maxDepth&&we(t,"nesting exceeded maxDepth ("+t.maxDepth+")"),t.depth+=1,t.listener!==null&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null;let q=s=o=Iy===r||U$===r;if(n&&nr(t,!0,-1)&&(c=!0,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)),l===1)for(;;){let C=t.input.charCodeAt(t.position),v=G$(t);if(c&&(C===33&&t.tag!==null||C===38&&t.anchor!==null)||!k9(t)&&!A9(t))break;p===null&&(p=v),nr(t,!0,-1)?(c=!0,o=q,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)):o=!1}if(o&&(o=c||i),l===1||Iy===r)if(Oy===r||L$===r?y=e:y=e+1,b=t.position-t.lineStart,l===1)if(o&&(D$(t,b)||Y$(t,b,y))||I9(t,y))d=!0;else{let C=t.input.charCodeAt(t.position);p!==null&&q&&!o&&C!==124&&C!==62&&$9(t,p,p.position-p.lineStart,y)||s&&P9(t,y)||q9(t,y)||O9(t,y)?d=!0:T9(t)?(d=!0,(t.tag!==null||t.anchor!==null)&&we(t,"alias node should not have any properties")):E9(t,y,Oy===r)&&(d=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&dl(t,t.anchor,t.result)}else l===0&&(d=o&&D$(t,b));if(t.tag===null)t.anchor!==null&&dl(t,t.anchor,t.result);else if(t.tag==="?"){t.result!==null&&t.kind!=="scalar"&&we(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"');for(let C=0,v=t.implicitTypes.length;C<v;C+=1)if(m=t.implicitTypes[C],m.resolve(t.result)){t.result=m.construct(t.result),t.tag=m.tag,t.anchor!==null&&dl(t,t.anchor,t.result);break}}else if(t.tag!=="!"){if(_i.call(t.typeMap[t.kind||"fallback"],t.tag))m=t.typeMap[t.kind||"fallback"][t.tag];else{m=null;let C=t.typeMap.multi[t.kind||"fallback"];for(let v=0,_=C.length;v<_;v+=1)if(t.tag.slice(0,C[v].tag.length)===C[v].tag){m=C[v];break}}m||we(t,"unknown tag !<"+t.tag+">"),t.result!==null&&m.kind!==t.kind&&we(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+m.kind+'", not "'+t.kind+'"'),m.resolve(t.result,t.tag)?(t.result=m.construct(t.result,t.tag),t.anchor!==null&&dl(t,t.anchor,t.result)):we(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return t.listener!==null&&t.listener("close",t),t.depth-=1,t.tag!==null||t.anchor!==null||d}function N9(t){let e=t.position,r=!1,n;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);(n=t.input.charCodeAt(t.position))!==0&&(nr(t,!0,-1),n=t.input.charCodeAt(t.position),!(t.lineIndent>0||n!==37));){r=!0,n=t.input.charCodeAt(++t.position);let i=t.position;for(;n!==0&&!fn(n);)n=t.input.charCodeAt(++t.position);let s=t.input.slice(i,t.position),o=[];for(s.length<1&&we(t,"directive name must not be less than one character in length");n!==0;){for(;Ds(n);)n=t.input.charCodeAt(++t.position);if(n===35){do n=t.input.charCodeAt(++t.position);while(n!==0&&!ts(n));break}if(ts(n))break;for(i=t.position;n!==0&&!fn(n);)n=t.input.charCodeAt(++t.position);o.push(t.input.slice(i,t.position))}n!==0&&UC(t),_i.call(M$,s)?M$[s](t,s,o):Py(t,'unknown document directive "'+s+'"')}if(nr(t,!0,-1),t.lineIndent===0&&t.input.charCodeAt(t.position)===45&&t.input.charCodeAt(t.position+1)===45&&t.input.charCodeAt(t.position+2)===45?(t.position+=3,nr(t,!0,-1)):r&&we(t,"directives end mark is expected"),Oc(t,t.lineIndent-1,Iy,!1,!0),nr(t,!0,-1),t.checkLineBreaks&&g9.test(t.input.slice(e,t.position))&&Py(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&ky(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,nr(t,!0,-1));return}t.position<t.length-1&&we(t,"end of the stream or a document separator is expected")}function K$(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
|
|
261
261
|
`),t.charCodeAt(0)===65279&&(t=t.slice(1)));let r=new _9(t,e),n=t.indexOf("\0");for(n!==-1&&(r.position=n,we(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)N9(r);return r.documents}function M9(t,e,r){e!==null&&typeof e=="object"&&typeof r>"u"&&(r=e,e=null);let n=K$(t,r);if(typeof e!="function")return n;for(let i=0,s=n.length;i<s;i+=1)e(n[i])}function F9(t,e){let r=K$(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new j$("expected a single document in the stream, but found more")}}BC.exports.loadAll=M9;BC.exports.load=F9});var v1=V((Mre,y1)=>{"use strict";var $y=Cc(),cp=xc(),D9=qy(),o1=Object.prototype.toString,a1=Object.prototype.hasOwnProperty,GC=65279,j9=9,ap=10,L9=13,U9=32,H9=33,B9=34,VC=35,V9=37,W9=38,z9=39,J9=42,l1=44,G9=45,Ay=58,Y9=61,K9=62,Q9=63,Z9=64,u1=91,c1=93,X9=96,f1=123,e8=124,d1=125,Pr={};Pr[0]="\\0";Pr[7]="\\a";Pr[8]="\\b";Pr[9]="\\t";Pr[10]="\\n";Pr[11]="\\v";Pr[12]="\\f";Pr[13]="\\r";Pr[27]="\\e";Pr[34]='\\"';Pr[92]="\\\\";Pr[133]="\\N";Pr[160]="\\_";Pr[8232]="\\L";Pr[8233]="\\P";var t8=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],r8=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function n8(t,e){if(e===null)return{};let r={},n=Object.keys(e);for(let i=0,s=n.length;i<s;i+=1){let o=n[i],l=String(e[o]);o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2));let c=t.compiledTypeMap.fallback[o];c&&a1.call(c.styleAliases,l)&&(l=c.styleAliases[l]),r[o]=l}return r}function i8(t){let e,r,n=t.toString(16).toUpperCase();if(t<=255)e="x",r=2;else if(t<=65535)e="u",r=4;else if(t<=4294967295)e="U",r=8;else throw new cp("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+e+$y.repeat("0",r-n.length)+n}var s8=1,lp=2;function o8(t){this.schema=t.schema||D9,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=$y.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=n8(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType=t.quotingType==='"'?lp:s8,this.forceQuotes=t.forceQuotes||!1,this.replacer=typeof t.replacer=="function"?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Z$(t,e){let r=$y.repeat(" ",e),n=0,i="",s=t.length;for(;n<s;){let o,l=t.indexOf(`
|
|
262
262
|
`,n);l===-1?(o=t.slice(n),n=s):(o=t.slice(n,l+1),n=l+1),o.length&&o!==`
|
|
263
263
|
`&&(i+=r),i+=o}return i}function WC(t,e){return`
|
|
264
|
-
`+$y.repeat(" ",t.indent*e)}function a8(t,e){for(let r=0,n=t.implicitTypes.length;r<n;r+=1)if(t.implicitTypes[r].resolve(e))return!0;return!1}function Ty(t){return t===U9||t===j9}function up(t){return t>=32&&t<=126||t>=161&&t<=55295&&t!==8232&&t!==8233||t>=57344&&t<=65533&&t!==GC||t>=65536&&t<=1114111}function X$(t){return up(t)&&t!==GC&&t!==L9&&t!==ap}function e1(t,e,r){let n=X$(t),i=n&&!Ty(t);return(r?n:n&&t!==l1&&t!==u1&&t!==c1&&t!==f1&&t!==d1)&&t!==VC&&!(e===Ay&&!i)||X$(e)&&!Ty(e)&&t===VC||e===Ay&&i}function l8(t){return up(t)&&t!==GC&&!Ty(t)&&t!==G9&&t!==Q9&&t!==Ay&&t!==l1&&t!==u1&&t!==c1&&t!==f1&&t!==d1&&t!==VC&&t!==W9&&t!==J9&&t!==H9&&t!==e8&&t!==Y9&&t!==K9&&t!==z9&&t!==B9&&t!==V9&&t!==Z9&&t!==X9}function u8(t){return!Ty(t)&&t!==Ay}function op(t,e){let r=t.charCodeAt(e),n;return r>=55296&&r<=56319&&e+1<t.length&&(n=t.charCodeAt(e+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}function p1(t){return/^\n* /.test(t)}var h1=1,zC=2,m1=3,g1=4,Ic=5;function c8(t,e,r,n,i,s,o,l){let c,d=0,p=null,m=!1,y=!1,b=n!==-1,
|
|
264
|
+
`+$y.repeat(" ",t.indent*e)}function a8(t,e){for(let r=0,n=t.implicitTypes.length;r<n;r+=1)if(t.implicitTypes[r].resolve(e))return!0;return!1}function Ty(t){return t===U9||t===j9}function up(t){return t>=32&&t<=126||t>=161&&t<=55295&&t!==8232&&t!==8233||t>=57344&&t<=65533&&t!==GC||t>=65536&&t<=1114111}function X$(t){return up(t)&&t!==GC&&t!==L9&&t!==ap}function e1(t,e,r){let n=X$(t),i=n&&!Ty(t);return(r?n:n&&t!==l1&&t!==u1&&t!==c1&&t!==f1&&t!==d1)&&t!==VC&&!(e===Ay&&!i)||X$(e)&&!Ty(e)&&t===VC||e===Ay&&i}function l8(t){return up(t)&&t!==GC&&!Ty(t)&&t!==G9&&t!==Q9&&t!==Ay&&t!==l1&&t!==u1&&t!==c1&&t!==f1&&t!==d1&&t!==VC&&t!==W9&&t!==J9&&t!==H9&&t!==e8&&t!==Y9&&t!==K9&&t!==z9&&t!==B9&&t!==V9&&t!==Z9&&t!==X9}function u8(t){return!Ty(t)&&t!==Ay}function op(t,e){let r=t.charCodeAt(e),n;return r>=55296&&r<=56319&&e+1<t.length&&(n=t.charCodeAt(e+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}function p1(t){return/^\n* /.test(t)}var h1=1,zC=2,m1=3,g1=4,Ic=5;function c8(t,e,r,n,i,s,o,l){let c,d=0,p=null,m=!1,y=!1,b=n!==-1,q=-1,C=l8(op(t,0))&&u8(op(t,t.length-1));if(e||o)for(c=0;c<t.length;d>=65536?c+=2:c++){if(d=op(t,c),!up(d))return Ic;C=C&&e1(d,p,l),p=d}else{for(c=0;c<t.length;d>=65536?c+=2:c++){if(d=op(t,c),d===ap)m=!0,b&&(y=y||c-q-1>n&&t[q+1]!==" ",q=c);else if(!up(d))return Ic;C=C&&e1(d,p,l),p=d}y=y||b&&c-q-1>n&&t[q+1]!==" "}return!m&&!y?C&&!o&&!i(t)?h1:s===lp?Ic:zC:r>9&&p1(t)?Ic:o?s===lp?Ic:zC:y?g1:m1}function f8(t,e,r,n,i){t.dump=(function(){if(e.length===0)return t.quotingType===lp?'""':"''";if(!t.noCompatMode&&(t8.indexOf(e)!==-1||r8.test(e)))return t.quotingType===lp?'"'+e+'"':"'"+e+"'";let s=t.indent*Math.max(1,r),o=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-s),l=n||t.flowLevel>-1&&r>=t.flowLevel;function c(d){return a8(t,d)}switch(c8(e,l,t.indent,o,c,t.quotingType,t.forceQuotes&&!n,i)){case h1:return e;case zC:return"'"+e.replace(/'/g,"''")+"'";case m1:return"|"+t1(e,t.indent)+r1(Z$(e,s));case g1:return">"+t1(e,t.indent)+r1(Z$(d8(e,o),s));case Ic:return'"'+p8(e,o)+'"';default:throw new cp("impossible error: invalid scalar style")}})()}function t1(t,e){let r=p1(t)?String(e):"",n=t[t.length-1]===`
|
|
265
265
|
`,s=n&&(t[t.length-2]===`
|
|
266
266
|
`||t===`
|
|
267
267
|
`)?"+":n?"":"-";return r+s+`
|
|
@@ -276,7 +276,7 @@ Parsed value is empty`);return o}catch(o){throw!o&&e.continueOnError?new ul.Unma
|
|
|
276
276
|
`:""}y1.exports.dump=v8});var KC=V((Fre,Br)=>{"use strict";var b1=Q$(),b8=v1();function YC(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}Br.exports.Type=Ir();Br.exports.Schema=_C();Br.exports.FAILSAFE_SCHEMA=EC();Br.exports.JSON_SCHEMA=kC();Br.exports.CORE_SCHEMA=AC();Br.exports.DEFAULT_SCHEMA=qy();Br.exports.load=b1.load;Br.exports.loadAll=b1.loadAll;Br.exports.dump=b8.dump;Br.exports.YAMLException=xc();Br.exports.types={binary:MC(),float:PC(),map:xC(),null:qC(),pairs:DC(),set:jC(),timestamp:TC(),bool:OC(),int:IC(),merge:$C(),omap:FC(),seq:CC(),str:RC()};Br.exports.safeLoad=YC("safeLoad","load");Br.exports.safeLoadAll=YC("safeLoadAll","loadAll");Br.exports.safeDump=YC("safeDump","dump")});var S1=V(fp=>{"use strict";var S8=fp&&fp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(fp,"__esModule",{value:!0});var w8=Yn(),_8=S8(KC()),R8=KC();fp.default={order:200,allowEmpty:!0,canParse:[".yaml",".yml",".json"],async parse(t){let e=t.data;if(Buffer.isBuffer(e)&&(e=e.toString()),typeof e=="string")try{return _8.default.load(e,{schema:R8.JSON_SCHEMA})}catch(r){throw new w8.ParserError(r?.message||"Parser Error",t.url)}else return e}}});var w1=V(QC=>{"use strict";Object.defineProperty(QC,"__esModule",{value:!0});var C8=Yn(),x8=/\.(txt|htm|html|md|xml|js|min|map|css|scss|less|svg)$/i;QC.default={order:300,allowEmpty:!0,encoding:"utf8",canParse(t){return(typeof t.data=="string"||Buffer.isBuffer(t.data))&&x8.test(t.url)},parse(t){if(typeof t.data=="string")return t.data;if(Buffer.isBuffer(t.data))return t.data.toString(this.encoding);throw new C8.ParserError("data is not text",t.url)}}});var _1=V(ZC=>{"use strict";Object.defineProperty(ZC,"__esModule",{value:!0});var E8=/\.(jpeg|jpg|gif|png|bmp|ico)$/i;ZC.default={order:400,allowEmpty:!0,canParse(t){return Buffer.isBuffer(t.data)&&E8.test(t.url)},parse(t){return Buffer.isBuffer(t.data)?t.data:Buffer.from(t.data)}}});var E1=V(Ri=>{"use strict";var q8=Ri&&Ri.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),O8=Ri&&Ri.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),I8=Ri&&Ri.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&q8(r,e,n[i]);return O8(r,e),r}})(),P8=Ri&&Ri.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ri,"__esModule",{value:!0});var k8=P8(require("fs")),R1=Bo(),C1=I8(Gn()),x1=Yn();Ri.default={order:100,canRead(t){return C1.isFileSystemPath(t.url)},async read(t){let e;try{e=C1.toFileSystemPath(t.url)}catch(r){throw new x1.ResolverError(R1.ono.uri(r,`Malformed URI: ${t.url}`),t.url)}try{return await k8.default.promises.readFile(e)}catch(r){throw new x1.ResolverError((0,R1.ono)(r,`Error opening file "${e}"`),e)}}}});var I1=V(Ls=>{"use strict";var A8=Ls&&Ls.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),T8=Ls&&Ls.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),$8=Ls&&Ls.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&A8(r,e,n[i]);return T8(r,e),r}})();Object.defineProperty(Ls,"__esModule",{value:!0});var Ny=Bo(),dp=$8(Gn()),q1=Yn();Ls.default={order:200,headers:null,timeout:6e4,redirects:5,withCredentials:!1,canRead(t){return dp.isHttp(t.url)},read(t){let e=dp.parse(t.url);return typeof window<"u"&&!e.protocol&&(e.protocol=dp.parse(location.href).protocol),O1(e,this)}};async function O1(t,e,r){t=dp.parse(t);let n=r||[];n.push(t.href);try{let i=await N8(t,e);if(i.status>=400)throw(0,Ny.ono)({status:i.status},`HTTP ERROR ${i.status}`);if(i.status>=300){if(!Number.isNaN(e.redirects)&&n.length>e.redirects)throw new q1.ResolverError((0,Ny.ono)({status:i.status},`Error downloading ${n[0]}.
|
|
277
277
|
Too many redirects:
|
|
278
278
|
${n.join(`
|
|
279
|
-
`)}`));if(!("location"in i.headers)||!i.headers.location)throw(0,Ny.ono)({status:i.status},`HTTP ${i.status} redirect with no location header`);{let s=dp.resolve(t.href,i.headers.location);return O1(s,e,n)}}else{if(i.body){let s=await i.arrayBuffer();return Buffer.from(s)}return Buffer.alloc(0)}}catch(i){throw new q1.ResolverError((0,Ny.ono)(i,`Error downloading ${t.href}`),t.href)}}async function N8(t,e){let r,n;e.timeout&&(r=new AbortController,n=setTimeout(()=>r.abort(),e.timeout));let i=await fetch(t,{method:"GET",headers:e.headers||{},credentials:e.withCredentials?"include":"same-origin",signal:r?r.signal:null});return n&&clearTimeout(n),i}});var XC=V(Us=>{"use strict";var Pc=Us&&Us.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Us,"__esModule",{value:!0});Us.getNewOptions=Us.getJsonSchemaRefParserDefaultOptions=void 0;var M8=Pc(r$()),F8=Pc(S1()),D8=Pc(w1()),j8=Pc(_1()),L8=Pc(E1()),U8=Pc(I1()),H8=()=>({parse:{json:{...M8.default},yaml:{...F8.default},text:{...D8.default},binary:{...j8.default}},resolve:{file:{...L8.default},http:{...U8.default},external:!0},continueOnError:!1,dereference:{circular:!0,excludedPathMatcher:()=>!1,referenceResolution:"relative"},mutateInputSchema:!0});Us.getJsonSchemaRefParserDefaultOptions=H8;var B8=t=>{let e=(0,Us.getJsonSchemaRefParserDefaultOptions)();return t&&k1(e,t),e};Us.getNewOptions=B8;function k1(t,e){if(P1(e)){let r=Object.keys(e).filter(n=>!["__proto__","constructor","prototype"].includes(n));for(let n=0;n<r.length;n++){let i=r[n],s=e[i],o=t[i];P1(s)?t[i]=k1(o||{},s):s!==void 0&&(t[i]=s)}}return t}function P1(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}});var T1=V(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:!0});My.normalizeArgs=A1;var V8=XC();function A1(t){let e,r,n,i,s=Array.prototype.slice.call(t);typeof s[s.length-1]=="function"&&(i=s.pop()),typeof s[0]=="string"?(e=s[0],typeof s[2]=="object"?(r=s[1],n=s[2]):(r=void 0,n=s[1])):(e="",r=s[0],n=s[1]);try{n=(0,V8.getNewOptions)(n)}catch(o){console.error(`JSON Schema Ref Parser: Error normalizing options: ${o}`)}return!n.mutateInputSchema&&typeof r=="object"&&(r=JSON.parse(JSON.stringify(r))),{path:e,schema:r,options:n,callback:i}}My.default=A1});var $1=V(Ci=>{"use strict";var W8=Ci&&Ci.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),z8=Ci&&Ci.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),J8=Ci&&Ci.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&W8(r,e,n[i]);return z8(r,e),r}})(),ex=Ci&&Ci.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ci,"__esModule",{value:!0});var G8=ex(_c()),Y8=ex(tp()),K8=ex(gC()),kc=J8(Gn()),Q8=Yn();function Z8(t,e){if(!e.resolve?.external)return Promise.resolve();try{let r=tx(t.schema,t.$refs._root$Ref.path+"#",t.$refs,e);return Promise.all(r)}catch(r){return Promise.reject(r)}}function tx(t,e,r,n,i,s){i||(i=new Set);let o=[];if(t&&typeof t=="object"&&!ArrayBuffer.isView(t)&&!i.has(t)){i.add(t),G8.default.isExternal$Ref(t)&&o.push(X8(t,e,r,n));let l=Object.keys(t);for(let c of l){let d=Y8.default.join(e,c),p=t[c];o=o.concat(tx(p,d,r,n,i,s))}}return o}async function X8(t,e,r,n){let i=n.dereference?.externalReferenceResolution==="root",s=kc.resolve(i?kc.cwd():e,t.$ref),o=kc.stripHash(s),l=r._$refs[o];if(l)return Promise.resolve(l.value);try{let c=await(0,K8.default)(s,r,n),d=tx(c,o+"#",r,n,new Set,!0);return Promise.all(d)}catch(c){if(!n?.continueOnError||!(0,Q8.isHandledError)(c))throw c;return r._$refs[o]&&(c.source=decodeURI(kc.stripHash(e)),c.path=kc.safePointerToPath(kc.getHash(e))),[]}}Ci.default=Z8});var F1=V(xi=>{"use strict";var e5=xi&&xi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),t5=xi&&xi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),r5=xi&&xi.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&e5(r,e,n[i]);return t5(r,e),r}})(),M1=xi&&xi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xi,"__esModule",{value:!0});var Fy=M1(_c()),pp=M1(tp()),rx=r5(Gn());function n5(t,e){let r=[];nx(t,"schema",t.$refs._root$Ref.path+"#","#",0,r,t.$refs,e),i5(r)}function nx(t,e,r,n,i,s,o,l){let c=e===null?t:t[e];if(c&&typeof c=="object"&&!ArrayBuffer.isView(c))if(Fy.default.isAllowed$Ref(c))N1(t,e,r,n,i,s,o,l);else{let d=Object.keys(c).sort((p,m)=>p==="definitions"?-1:m==="definitions"?1:p.length-m.length);for(let p of d){let m=pp.default.join(r,p),y=pp.default.join(n,p),b=c[p];Fy.default.isAllowed$Ref(b)?N1(c,p,r,y,i,s,o,l):nx(c,p,m,y,i,s,o,l)}}}function N1(t,e,r,n,i,s,o,l){let c=e===null?t:t[e],d=rx.resolve(r,c.$ref),p=o._resolve(d,n,l);if(p===null)return;let y=pp.default.parse(n).length,b=rx.stripHash(p.path),E=rx.getHash(p.path),C=b!==o._root$Ref.path,v=Fy.default.isExtended$Ref(c);i+=p.indirections;let _=s5(s,t,e);if(_)if(y<_.depth||i<_.indirections)o5(s,_);else return;s.push({$ref:c,parent:t,key:e,pathFromRoot:n,depth:y,file:b,hash:E,value:p.value,circular:p.circular,extended:v,external:C,indirections:i}),(!_||C)&&nx(p.value,null,p.path,n,i+1,s,o,l)}function i5(t){t.sort((i,s)=>{if(i.file!==s.file)return i.file<s.file?-1:1;if(i.hash!==s.hash)return i.hash<s.hash?-1:1;if(i.circular!==s.circular)return i.circular?-1:1;if(i.extended!==s.extended)return i.extended?1:-1;if(i.indirections!==s.indirections)return i.indirections-s.indirections;if(i.depth!==s.depth)return i.depth-s.depth;{let o=i.pathFromRoot.lastIndexOf("/definitions"),l=s.pathFromRoot.lastIndexOf("/definitions");return o!==l?l-o:i.pathFromRoot.length-s.pathFromRoot.length}});let e,r,n;for(let i of t)i.external?i.file===e&&i.hash===r?i.$ref.$ref=n:i.file===e&&i.hash.indexOf(r+"/")===0?i.$ref.$ref=pp.default.join(n,pp.default.parse(i.hash.replace(r,"#"))):(e=i.file,r=i.hash,n=i.pathFromRoot,i.$ref=i.parent[i.key]=Fy.default.dereference(i.$ref,i.value),i.circular&&(i.$ref.$ref=i.pathFromRoot)):i.$ref.$ref=i.hash}function s5(t,e,r){for(let n of t)if(n&&n.parent===e&&n.key===r)return n}function o5(t,e){let r=t.indexOf(e);t.splice(r,1)}xi.default=n5});var B1=V(Ei=>{"use strict";var a5=Ei&&Ei.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),l5=Ei&&Ei.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),u5=Ei&&Ei.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&a5(r,e,n[i]);return l5(r,e),r}})(),U1=Ei&&Ei.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ei,"__esModule",{value:!0});var Dy=U1(_c()),D1=U1(tp()),c5=Bo(),j1=u5(Gn()),f5=Yn();Ei.default=d5;function d5(t,e){let r=Date.now(),n=ix(t.schema,t.$refs._root$Ref.path,"#",new Set,new Set,new Map,t.$refs,e,r);t.$refs.circular=n.circular,t.schema=n.value}function ix(t,e,r,n,i,s,o,l,c){let d,p={value:t,circular:!1};if(l&&l.timeoutMs&&Date.now()-c>l.timeoutMs)throw new f5.TimeoutError(l.timeoutMs);let m=l.dereference||{},y=m.excludedPathMatcher||(()=>!1);if((m?.circular==="ignore"||!i.has(t))&&t&&typeof t=="object"&&!ArrayBuffer.isView(t)&&!y(r)){if(n.add(t),i.add(t),Dy.default.isAllowed$Ref(t,l))d=L1(t,e,r,n,i,s,o,l,c),p.circular=d.circular,p.value=d.value;else for(let b of Object.keys(t)){let E=D1.default.join(e,b),C=D1.default.join(r,b);if(y(C))continue;let v=t[b],_=!1;if(Dy.default.isAllowed$Ref(v,l)){if(d=L1(v,E,C,n,i,s,o,l,c),_=d.circular,t[b]!==d.value){let q=new Map;m?.preservedProperties&&typeof t[b]=="object"&&!Array.isArray(t[b])&&m?.preservedProperties.forEach(k=>{k in t[b]&&q.set(k,t[b][k])}),t[b]=d.value,m?.preservedProperties&&q.size&&typeof t[b]=="object"&&!Array.isArray(t[b])&&q.forEach((k,O)=>{t[b][O]=k}),m?.onDereference?.(v.$ref,t[b],t,b)}}else n.has(v)?_=H1(E,o,l):(d=ix(v,E,C,n,i,s,o,l,c),_=d.circular,t[b]!==d.value&&(t[b]=d.value));p.circular=p.circular||_}n.delete(t)}return p}function L1(t,e,r,n,i,s,o,l,c){let p=Dy.default.isExternal$Ref(t)&&l?.dereference?.externalReferenceResolution==="root",m=j1.resolve(p?j1.cwd():e,t.$ref),y=s.get(m);if(y&&!y.circular){let q=Object.keys(t);if(q.length>1){let k={};for(let O of q)O!=="$ref"&&!(O in y.value)&&(k[O]=t[O]);return{circular:y.circular,value:Object.assign({},y.value,k)}}return y}let b=o._resolve(m,e,l);if(b===null)return{circular:!1,value:null};let E=b.circular,C=E||n.has(b.value);C&&H1(e,o,l);let v=Dy.default.dereference(t,b.value);if(!C){let q=ix(v,b.path,r,n,i,s,o,l,c);C=q.circular,v=q.value}C&&!E&&l.dereference?.circular==="ignore"&&(v=t),E&&(v.$ref=r);let _={circular:C,value:v};return Object.keys(t).length===1&&s.set(m,_),_}function H1(t,e,r){if(e.circular=!0,r?.dereference?.onCircular?.(t),!r.dereference.circular)throw c5.ono.reference(`Circular $ref pointer found at ${t}`);return!0}});var V1=V(sx=>{"use strict";Object.defineProperty(sx,"__esModule",{value:!0});function p5(){return typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:typeof setImmediate=="function"?setImmediate:function(e){setTimeout(e,0)}}sx.default=p5()});var z1=V(hp=>{"use strict";var h5=hp&&hp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(hp,"__esModule",{value:!0});hp.default=m5;var W1=h5(V1());function m5(t,e){if(t){e.then(function(r){(0,W1.default)(function(){t(null,r)})},function(r){(0,W1.default)(function(){t(r)})});return}else return e}});var K1=V($e=>{"use strict";var g5=$e&&$e.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),y5=$e&&$e.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),v5=$e&&$e.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&g5(r,e,n[i]);return y5(r,e),r}})(),hl=$e&&$e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty($e,"__esModule",{value:!0});$e.getJsonSchemaRefParserDefaultOptions=$e.jsonSchemaParserNormalizeArgs=$e.dereferenceInternal=$e.JSONParserErrorGroup=$e.isHandledError=$e.UnmatchedParserError=$e.ParserError=$e.ResolverError=$e.MissingPointerError=$e.InvalidPointerError=$e.JSONParserError=$e.UnmatchedResolverError=$e.dereference=$e.bundle=$e.resolve=$e.parse=$e.$RefParser=void 0;var J1=hl(QT()),b5=hl(gC()),mp=hl(T1());$e.jsonSchemaParserNormalizeArgs=mp.default;var S5=hl($1()),w5=hl(F1()),Y1=hl(B1());$e.dereferenceInternal=Y1.default;var pl=v5(Gn()),Kn=Yn();Object.defineProperty($e,"JSONParserError",{enumerable:!0,get:function(){return Kn.JSONParserError}});Object.defineProperty($e,"InvalidPointerError",{enumerable:!0,get:function(){return Kn.InvalidPointerError}});Object.defineProperty($e,"MissingPointerError",{enumerable:!0,get:function(){return Kn.MissingPointerError}});Object.defineProperty($e,"ResolverError",{enumerable:!0,get:function(){return Kn.ResolverError}});Object.defineProperty($e,"ParserError",{enumerable:!0,get:function(){return Kn.ParserError}});Object.defineProperty($e,"UnmatchedParserError",{enumerable:!0,get:function(){return Kn.UnmatchedParserError}});Object.defineProperty($e,"UnmatchedResolverError",{enumerable:!0,get:function(){return Kn.UnmatchedResolverError}});Object.defineProperty($e,"isHandledError",{enumerable:!0,get:function(){return Kn.isHandledError}});Object.defineProperty($e,"JSONParserErrorGroup",{enumerable:!0,get:function(){return Kn.JSONParserErrorGroup}});var G1=Bo(),qi=hl(z1()),_5=XC();Object.defineProperty($e,"getJsonSchemaRefParserDefaultOptions",{enumerable:!0,get:function(){return _5.getJsonSchemaRefParserDefaultOptions}});var Jo=class t{constructor(){this.schema=null,this.$refs=new J1.default}async parse(){let e=(0,mp.default)(arguments),r;if(!e.path&&!e.schema){let i=(0,G1.ono)(`Expected a file path, URL, or object. Got ${e.path||e.schema}`);return(0,qi.default)(e.callback,Promise.reject(i))}this.schema=null,this.$refs=new J1.default;let n="http";if(pl.isFileSystemPath(e.path))e.path=pl.fromFileSystemPath(e.path),n="file";else if(!e.path&&e.schema&&"$id"in e.schema&&e.schema.$id){let i=pl.parse(e.schema.$id),s=i.protocol==="https:"?443:80;e.path=`${i.protocol}//${i.hostname}:${s}`}if(e.path=pl.resolve(pl.cwd(),e.path),e.schema&&typeof e.schema=="object"){let i=this.$refs._add(e.path);i.value=e.schema,i.pathType=n,r=Promise.resolve(e.schema)}else r=(0,b5.default)(e.path,this.$refs,e.options);try{let i=await r;if(i!==null&&typeof i=="object"&&!Buffer.isBuffer(i))return this.schema=i,(0,qi.default)(e.callback,Promise.resolve(this.schema));if(e.options.continueOnError)return this.schema=null,(0,qi.default)(e.callback,Promise.resolve(this.schema));throw G1.ono.syntax(`"${this.$refs._root$Ref.path||i}" is not a valid JSON Schema`)}catch(i){return!e.options.continueOnError||!(0,Kn.isHandledError)(i)?(0,qi.default)(e.callback,Promise.reject(i)):(this.$refs._$refs[pl.stripHash(e.path)]&&this.$refs._$refs[pl.stripHash(e.path)].addError(i),(0,qi.default)(e.callback,Promise.resolve(null)))}}static parse(){let e=new t;return e.parse.apply(e,arguments)}async resolve(){let e=(0,mp.default)(arguments);try{return await this.parse(e.path,e.schema,e.options),await(0,S5.default)(this,e.options),ox(this),(0,qi.default)(e.callback,Promise.resolve(this.$refs))}catch(r){return(0,qi.default)(e.callback,Promise.reject(r))}}static resolve(){let e=new t;return e.resolve.apply(e,arguments)}static bundle(){let e=new t;return e.bundle.apply(e,arguments)}async bundle(){let e=(0,mp.default)(arguments);try{return await this.resolve(e.path,e.schema,e.options),(0,w5.default)(this,e.options),ox(this),(0,qi.default)(e.callback,Promise.resolve(this.schema))}catch(r){return(0,qi.default)(e.callback,Promise.reject(r))}}static dereference(){let e=new t;return e.dereference.apply(e,arguments)}async dereference(){let e=(0,mp.default)(arguments);try{return await this.resolve(e.path,e.schema,e.options),(0,Y1.default)(this,e.options),ox(this),(0,qi.default)(e.callback,Promise.resolve(this.schema))}catch(r){return(0,qi.default)(e.callback,Promise.reject(r))}}};$e.$RefParser=Jo;$e.default=Jo;function ox(t){if(Kn.JSONParserErrorGroup.getParserErrors(t).length>0)throw new Kn.JSONParserErrorGroup(t)}$e.parse=Jo.parse;$e.resolve=Jo.resolve;$e.bundle=Jo.bundle;$e.dereference=Jo.dereference});var jy,ml,ax=ae(()=>{"use strict";jy=ve(K1()),ml=class{async resolve(e){try{return await jy.default.dereference(e,{dereference:{circular:"ignore"}})}catch(r){return console.error("[RefResolver] Failed to fully resolve $ref pointers:",r),e}}async bundle(e){try{return await jy.default.bundle(e)}catch(r){return console.error("[RefResolver] Failed to bundle $ref pointers:",r),e}}async resolveFile(e){try{return await jy.default.dereference(e,{dereference:{circular:"ignore"}})}catch(r){throw console.error(`[RefResolver] Failed to resolve file ${e}:`,r),r}}}});var Q1,Z1,R5,Hs,Ly=ae(()=>{"use strict";Q1=ve(require("fs")),Z1=ve(Xd());Un();JR();ax();R5=["application/json","text/plain","text/html","multipart/form-data","application/x-www-form-urlencoded"],Hs=class{constructor(e,r){this.collectionService=e;this.envConfigService=r;this.exampleGenerator=new al,this.refResolver=new ml}collectionService;envConfigService;exampleGenerator;refResolver;async import(e,r){let n=await Q1.promises.readFile(e,"utf-8"),i;e.endsWith(".yaml")||e.endsWith(".yml")?i=Z1.parse(n):i=JSON.parse(n),i=await this.refResolver.resolve(i);let s=i.components?.schemas||{},o=r?.collectionName||i.info?.title||"Imported API",c={id:Ot(o),name:o,description:i.info?.description||"",version:i.info?.version||"1.0.0",variables:{},items:[]};if(i.servers&&i.servers.length>0&&(c.variables.baseUrl=i.servers[0].url),i.security&&i.security.length>0&&i.components?.securitySchemes){let m=this.mapSecurityToAuth(i.security[0],i.components.securitySchemes);m&&(c.auth=m)}let d=new Map;if(i.tags)for(let m of i.tags){let y={type:"folder",id:Ot(m.name),name:m.name,description:m.description,items:[]};d.set(m.name,y),c.items.push(y)}if(i.paths)for(let[m,y]of Object.entries(i.paths))for(let b of["get","post","put","patch","delete","head","options","trace"]){let E=y[b];if(!E)continue;let C=this.processOperation(b,m,E,y,i,s),v=E.tags?.[0];if(v&&d.has(v))d.get(v).items.push(C);else if(v){let _={type:"folder",id:Ot(v),name:v,items:[C]};d.set(v,_),c.items.push(_)}else c.items.push(C)}await this.collectionService.saveCollection(c);let p;return r?.environmentName&&i.servers&&(p=await this.createEnvironmentFromServers(i.servers,r.environmentName)),{collection:c,environmentCreated:p}}processOperation(e,r,n,i,s,o){let l=Ot(n.operationId||`${e}-${r}`),c=`{{baseUrl}}${this.convertPathParams(r)}`,d=n.summary||n.operationId||`${e.toUpperCase()} ${r}`,p=n.deprecated===!0;p&&(d=`[DEPRECATED] ${d}`);let m={type:"request",id:l,name:d,method:e.toUpperCase(),url:c,description:n.description||"",deprecated:p},y=[...i.parameters||[],...n.parameters||[]];if(this.processParameters(m,y,o),n.requestBody&&this.processRequestBody(m,n.requestBody,o),n.responses&&(m.responseSchema=this.processResponses(n.responses,o)),n.security!==void 0&&s.components?.securitySchemes){if(Array.isArray(n.security)&&n.security.length===0)m.auth={type:"none"};else if(n.security&&n.security.length>0){let b=this.mapSecurityToAuth(n.security[0],s.components.securitySchemes);b&&(m.auth=b)}}return m}convertPathParams(e){return e.replace(/\{(\w+)\}/g,":$1")}processParameters(e,r,n){let i=[],s=[],o={},l=[];for(let c of r){let d=c.name,p=c.in,m=c.schema||{},y=c.example!==void 0?String(c.example):this.generateExampleForParam(m,n),b=c.deprecated===!0;switch(p){case"path":{if(c.description||m.type||m.format||m.enum||b||m.pattern||m.minimum!==void 0||m.maximum!==void 0||m.minLength!==void 0||m.maxLength!==void 0||m.multipleOf!==void 0||m.minItems!==void 0||m.maxItems!==void 0||m.uniqueItems||m.nullable||m.oneOf){let C={value:y};m.oneOf?(C.oneOf=m.oneOf,this.applyOneOfHints(C,m.oneOf)):(m.type&&(C.type=m.type),m.format&&(C.format=m.format),m.enum&&(C.enum=m.enum.map(String)),m.pattern&&(C.pattern=m.pattern),m.minimum!==void 0&&(C.minimum=m.minimum),m.maximum!==void 0&&(C.maximum=m.maximum),m.exclusiveMinimum!==void 0&&(C.exclusiveMinimum=m.exclusiveMinimum),m.exclusiveMaximum!==void 0&&(C.exclusiveMaximum=m.exclusiveMaximum),m.multipleOf!==void 0&&(C.multipleOf=m.multipleOf),m.minLength!==void 0&&(C.minLength=m.minLength),m.maxLength!==void 0&&(C.maxLength=m.maxLength),m.minItems!==void 0&&(C.minItems=m.minItems),m.maxItems!==void 0&&(C.maxItems=m.maxItems),m.uniqueItems&&(C.uniqueItems=!0),m.nullable&&(C.nullable=!0)),c.description&&(C.description=c.description),b&&(C.deprecated=!0),o[d]=C}else o[d]=y;break}case"query":{let E={key:d,value:y};this.applySchemaConstraints(E,m,c,b),s.push(E);break}case"header":{let E={key:d,value:y};this.applySchemaConstraints(E,m,c,b),i.push(E);break}case"cookie":{l.push(`${d}={{${d}}}`);break}}}l.length>0&&i.push({key:"Cookie",value:l.join("; ")}),Object.keys(o).length>0&&(e.params=o),s.length>0&&(e.query=s),i.length>0&&(e.headers=i)}applySchemaConstraints(e,r,n,i){r.oneOf?(e.oneOf=r.oneOf,this.applyOneOfHints(e,r.oneOf)):(r.type&&(e.type=r.type),r.format&&(e.format=r.format),r.enum&&(e.enum=r.enum.map(String)),r.pattern&&(e.pattern=r.pattern),r.minimum!==void 0&&(e.minimum=r.minimum),r.maximum!==void 0&&(e.maximum=r.maximum),r.exclusiveMinimum!==void 0&&(e.exclusiveMinimum=r.exclusiveMinimum),r.exclusiveMaximum!==void 0&&(e.exclusiveMaximum=r.exclusiveMaximum),r.multipleOf!==void 0&&(e.multipleOf=r.multipleOf),r.minLength!==void 0&&(e.minLength=r.minLength),r.maxLength!==void 0&&(e.maxLength=r.maxLength),r.minItems!==void 0&&(e.minItems=r.minItems),r.maxItems!==void 0&&(e.maxItems=r.maxItems),r.uniqueItems&&(e.uniqueItems=!0),r.nullable&&(e.nullable=!0)),n.required&&(e.required=!0),n.description&&(e.description=n.description),i&&(e.deprecated=!0)}applyOneOfHints(e,r){let n=[],i=new Set;for(let s of r)s.type&&i.add(s.type),s.enum&&n.push(...s.enum.map(String));i.size===1&&(e.type=[...i][0]),n.length>0&&(e.enum=[...new Set(n)])}generateExampleForParam(e,r){if(!e)return"";let n=this.exampleGenerator.generate(e,{components:r});return n==null?"":String(n)}processRequestBody(e,r,n){if(!r.content)return;let i=Object.keys(r.content);if(i.length===0)return;let s=this.selectPrimaryContentType(i),o=r.content[s],{bodyType:l,bodyFormat:c}=this.mapContentTypeToBodyType(s);if(e.body={type:l,...c&&{format:c},content:""},o){let p=this.generateBodyContent(o,s,n);p!==void 0&&(e.body.content=typeof p=="string"?p:JSON.stringify(p,null,2)),l==="form-data"&&o.schema?.properties&&(e.body.content=this.buildFormDataEntries(o.schema,n)),l==="x-www-form-urlencoded"&&o.schema?.properties&&(e.body.content=this.buildFormDataEntries(o.schema,n))}let d=this.buildBodySchema(r,s,n);d&&(e.bodySchema=d)}selectPrimaryContentType(e){for(let i of R5)if(e.includes(i))return i;let r=e.find(i=>i.includes("json"));if(r)return r;let n=e.find(i=>i.startsWith("text/"));return n||e[0]}mapContentTypeToBodyType(e){return e.includes("json")?{bodyType:"raw",bodyFormat:"json"}:e==="application/xml"||e==="text/xml"?{bodyType:"raw",bodyFormat:"xml"}:e==="text/html"?{bodyType:"raw",bodyFormat:"html"}:e.startsWith("text/")?{bodyType:"raw",bodyFormat:"text"}:e==="multipart/form-data"?{bodyType:"form-data"}:e==="application/x-www-form-urlencoded"?{bodyType:"x-www-form-urlencoded"}:e==="application/octet-stream"?{bodyType:"binary"}:{bodyType:"raw",bodyFormat:"text"}}generateBodyContent(e,r,n){if(e.example!==void 0)return e.example;if(e.examples){let i=Object.values(e.examples)[0];if(i?.value!==void 0)return i.value}if(e.schema)return this.exampleGenerator.generate(e.schema,{omitReadOnly:!0,components:n})}buildFormDataEntries(e,r){let n=[],i=e.properties||{},s=new Set(e.required||[]);for(let[o,l]of Object.entries(i)){let c=l,d=c.type==="string"&&c.format==="binary",p={key:o,value:d?"":String(this.exampleGenerator.generate(c,{components:r})||""),type:d?"file":"text",enabled:!0};n.push(p)}return n}buildBodySchema(e,r,n){let i=Object.keys(e.content),s=e.content[r];if(!s?.schema)return;let o={contentType:r,schema:s.schema};if(i.length>1){o.content={};for(let c of i){let d=e.content[c],p={};d.schema&&(p.schema=d.schema),d.examples&&(p.examples=d.examples),d.encoding&&(p.encoding=d.encoding),o.content[c]=p}}s.encoding&&(o.encoding=s.encoding);let l=this.extractUsedComponents(s.schema,n);return Object.keys(l).length>0&&(o.components=l),o}processResponses(e,r){let n={responses:{}},i={};for(let[s,o]of Object.entries(e)){let l=o,c={description:l.description||`Status ${s}`};if(l.content){let d=Object.keys(l.content);if(d.length===1){let p=d[0],m=l.content[p];c.contentType=p,m.schema&&(c.schema=m.schema),m.examples&&(c.examples=m.examples),m.schema&&Object.assign(i,this.extractUsedComponents(m.schema,r))}else{c.content={};for(let p of d){let m=l.content[p],y={};m.schema&&(y.schema=m.schema),m.examples&&(y.examples=m.examples),c.content[p]=y,m.schema&&Object.assign(i,this.extractUsedComponents(m.schema,r))}}}if(l.headers){c.headers={};for(let[d,p]of Object.entries(l.headers)){let m=p;c.headers[d]={...m.description&&{description:m.description},schema:m.schema||{type:"string"}}}}n.responses[s]=c}return Object.keys(i).length>0&&(n.components=i),n}mapSecurityToAuth(e,r){let n=Object.keys(e)[0];if(!n)return;let i=r[n];if(i)switch(i.type){case"http":if(i.scheme==="bearer")return{type:"bearer",bearerToken:""};if(i.scheme==="basic")return{type:"basic",basicAuth:{username:"",password:""}};break;case"apiKey":return{type:"apikey",apikey:{key:i.name||"X-Api-Key",value:"",in:i.in||"header"}};case"oauth2":{let s=i.flows||{},o=s.authorizationCode||s.clientCredentials||s.password||s.implicit||{},l="client_credentials";return s.authorizationCode?l="authorization_code":s.password?l="password":s.implicit&&(l="implicit"),{type:"oauth2",oauth2:{grantType:l,tokenUrl:o.tokenUrl||"",authUrl:o.authorizationUrl||"",clientId:"",clientSecret:"",scope:Object.keys(o.scopes||{}).join(" ")}}}}}async createEnvironmentFromServers(e,r){if(e.length>0){let n=e[0].url;this.envConfigService.setEnvironmentVariable("baseUrl",n)}return r}extractUsedComponents(e,r,n){let i=n||{};if(!e)return i;if(e.$ref){let s=this.extractRefName(e.$ref);s&&r[s]&&!i[s]&&(i[s]=r[s],this.extractUsedComponents(r[s],r,i))}if(e.properties)for(let s of Object.values(e.properties))this.extractUsedComponents(s,r,i);e.items&&this.extractUsedComponents(e.items,r,i);for(let s of["allOf","oneOf","anyOf"])if(e[s])for(let o of e[s])this.extractUsedComponents(o,r,i);return e.additionalProperties&&typeof e.additionalProperties=="object"&&this.extractUsedComponents(e.additionalProperties,r,i),i}extractRefName(e){return e.match(/^#\/components\/schemas\/(.+)$/)?.[1]}}});var gl,lx=ae(()=>{"use strict";gl=class{constructor(e,r,n){this.historyAnalyzer=e;this.scriptAnalyzer=r;this.inferrer=n}historyAnalyzer;scriptAnalyzer;inferrer;async infer(e,r,n,i){let s=await this.historyAnalyzer.analyze(e,r,{environment:i?.environment}),o;return i?.postResponseScript&&(o=this.scriptAnalyzer.analyze(i.postResponseScript)),this.mergeResponseSchemas(n,s,o)}async inferBodySchema(e,r,n,i,s){let o,l;if(r==="raw"&&n==="json"&&e){let c=e;if(typeof e=="string")try{c=JSON.parse(e)}catch{return}o=this.inferrer.inferFromValue(c),l="application/json"}else r==="form-data"&&i?(o=this.buildFormDataSchema(i),l="multipart/form-data"):r==="x-www-form-urlencoded"&&i?(o=this.buildFormDataSchema(i),l="application/x-www-form-urlencoded"):r==="raw"&&n==="xml"?(o={type:"string"},l="application/xml"):r==="raw"&&(n==="text"||n==="html")?(o={type:"string"},l=n==="html"?"text/html":"text/plain"):r==="binary"?(o={type:"string",format:"binary"},l="application/octet-stream"):r==="graphql"&&(o={type:"object",properties:{query:{type:"string"},variables:{type:"object"}}},l="application/json");if(o)return s?this.mergeBodySchemaWithExisting(o,s):{contentType:l,schema:o}}buildFormDataSchema(e){let r={type:"object",properties:{}},n=[];for(let i of e){if(!i.enabled&&i.enabled!==void 0)continue;let s={};i.type?s.type=i.type:s.type="string",i.description&&(s.description=i.description),i.format&&(s.format=i.format),i.enum&&(s.enum=i.enum),i.type==="file"&&(s.type="string",s.format="binary"),r.properties[i.key]=s,i.required&&n.push(i.key)}return n.length>0&&(r.required=n),r}mergeResponseSchemas(e,r,n){let i={responses:{}};for(let[s,o]of Object.entries(r.responses))i.responses[s]={...o};if(n&&this.applyScriptHints(i,n),e){for(let[s,o]of Object.entries(e.responses))i.responses[s]?i.responses[s]=this.mergeResponseDefinitions(i.responses[s],o):i.responses[s]={...o};e.components&&(i.components={...e.components})}return i}applyScriptHints(e,r){for(let n of r.expectedStatuses){let i=String(n);e.responses[i]||(e.responses[i]={description:`Status ${n}`})}for(let[,n]of Object.entries(e.responses))n.schema&&this.augmentSchemaWithHints(n.schema,r)}augmentSchemaWithHints(e,r){if(!(e.type!=="object"||!e.properties))for(let n of r.fieldPaths){let i=n.split(".");this.ensureFieldPath(e,i,r)}}ensureFieldPath(e,r,n,i=""){if(r.length===0||e.type!=="object")return;e.properties||(e.properties={});let s=r[0],o=s.endsWith("[]"),l=o?s.slice(0,-2):s,c=i?`${i}.${s}`:s,d=r.slice(1);if(!e.properties[l])if(o)e.properties[l]={type:"array",items:{type:"object"}};else if(d.length>0)e.properties[l]={type:"object",properties:{}};else{let p=n.typeHints[c];e.properties[l]={type:p||"string"};return}if(d.length>0){let p=o?e.properties[l].items:e.properties[l];p&&this.ensureFieldPath(p,d,n,c)}}mergeResponseDefinitions(e,r){let n={...e};return r.description&&(n.description=r.description),r.contentType&&(n.contentType=r.contentType),r.schema&&e.schema?n.schema=this.inferrer.mergeSchemas(e.schema,r.schema):r.schema&&(n.schema=r.schema),r.examples&&(n.examples={...e.examples||{},...r.examples}),r.content&&(n.content={...e.content||{},...r.content}),r.headers&&(n.headers={...e.headers||{},...r.headers}),n}mergeBodySchemaWithExisting(e,r){let n={...r};return r.schema?n.schema=this.inferrer.mergeSchemas(e,r.schema):n.schema=e,n}}});var X1,Uy,eN,tN,rN,nN,iN,yl,ux=ae(()=>{"use strict";X1=/(?:jsonData|responseJson|data|json|body|response\.json\(\))\.([a-zA-Z_][\w.\[\]]*)/g,Uy="(?:pm|hf|ctx)",eN=new RegExp(`${Uy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.be\\.(?:a|an)\\(['"](\\w+)['"]\\)`,"g"),tN=new RegExp(`${Uy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.(?:equal|eql)\\((.+?)\\)`,"g"),rN=/(?:to\.have\.status|response\.code.*?equal)\((\d+)\)/g,nN=new RegExp(`${Uy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.be\\.(true|false)`,"g"),iN=new RegExp(`${Uy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.have\\.(?:lengthOf|length\\.above|length\\.below)`,"g"),yl=class{analyze(e){let r={fieldPaths:[],typeHints:{},valueHints:{},expectedStatuses:[]};if(!e||e.trim().length===0)return r;let n=this.stripComments(e);return this.extractFieldPaths(n,r),this.extractTypeAssertions(n,r),this.extractEqualityAssertions(n,r),this.extractBooleanAssertions(n,r),this.extractLengthAssertions(n,r),this.extractStatusAssertions(n,r),r.fieldPaths=[...new Set(r.fieldPaths)],r.expectedStatuses=[...new Set(r.expectedStatuses)],r}stripComments(e){let r=e.replace(/\/\*[\s\S]*?\*\//g,"");return r=r.replace(/\/\/.*$/gm,""),r}extractFieldPaths(e,r){let n,i=new RegExp(X1.source,X1.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]);s&&!this.isCommonMethodCall(s)&&r.fieldPaths.push(s)}}extractTypeAssertions(e,r){let n,i=new RegExp(eN.source,eN.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]),o=n[2].toLowerCase();s&&(r.typeHints[s]=this.mapAssertionType(o),r.fieldPaths.includes(s)||r.fieldPaths.push(s))}}extractEqualityAssertions(e,r){let n,i=new RegExp(tN.source,tN.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]),o=n[2].trim();if(s){let l=this.parseAssertionValue(o);l!==void 0&&(r.valueHints[s]=l,typeof l=="string"?r.typeHints[s]=r.typeHints[s]||"string":typeof l=="number"?r.typeHints[s]=r.typeHints[s]||(Number.isInteger(l)?"integer":"number"):typeof l=="boolean"&&(r.typeHints[s]=r.typeHints[s]||"boolean")),r.fieldPaths.includes(s)||r.fieldPaths.push(s)}}}extractBooleanAssertions(e,r){let n,i=new RegExp(nN.source,nN.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]);s&&(r.typeHints[s]="boolean",r.valueHints[s]=n[2]==="true",r.fieldPaths.includes(s)||r.fieldPaths.push(s))}}extractLengthAssertions(e,r){let n,i=new RegExp(iN.source,iN.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]);s&&(r.typeHints[s]=r.typeHints[s]||"array",r.fieldPaths.includes(s)||r.fieldPaths.push(s))}}extractStatusAssertions(e,r){let n,i=new RegExp(rN.source,rN.flags);for(;(n=i.exec(e))!==null;){let s=parseInt(n[1],10);!isNaN(s)&&s>=100&&s<600&&r.expectedStatuses.push(s)}}normalizeFieldPath(e){let r=e.replace(/^\./,"");return r=r.replace(/\[\d+\]/g,"[]"),r}isCommonMethodCall(e){return new Set(["to","be","have","not","deep","any","all","that","is","has","include","includes","equal","eql","above","below","least","most","within","length","lengthOf","match","string","keys","key","property","ownProperty","status","header","json","text"]).has(e.split(".")[0])}mapAssertionType(e){return{string:"string",number:"number",object:"object",array:"array",boolean:"boolean",null:"null",undefined:"null",int:"integer",integer:"integer",float:"number",double:"number"}[e]||"string"}parseAssertionValue(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let r=Number(e);return!isNaN(r)&&e.trim().length>0?r:e==="true"?!0:e==="false"?!1:e==="null"?null:e}}});var sN={};Rs(sN,{AwsSecretResolver:()=>gp});var gp,cx=ae(()=>{"use strict";gp=class{providerName="aws";region;moduleRequire;constructor(e,r){this.region=e.region??process.env.AWS_DEFAULT_REGION??process.env.AWS_REGION,this.moduleRequire=r??(n=>require(n))}async resolve(e){let r=e.lastIndexOf("#"),n=r>=0?e.slice(0,r):e,i=r>=0?e.slice(r+1):void 0;try{let{SecretsManagerClient:s,GetSecretValueCommand:o}=this.moduleRequire("@aws-sdk/client-secrets-manager"),c=await new s(this.region?{region:this.region}:{}).send(new o({SecretId:n})),d=c.SecretString??(c.SecretBinary?Buffer.from(c.SecretBinary).toString("utf-8"):void 0);if(d===void 0)return;if(i)try{let p=JSON.parse(d);return p[i]!==void 0?String(p[i]):void 0}catch{return}return d}catch(s){throw s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND"?new Error("[HTTP Forge] AWS secret resolver requires @aws-sdk/client-secrets-manager. Install it in your project: npm install @aws-sdk/client-secrets-manager"):s}}}});var oN={};Rs(oN,{AzureKeyVaultResolver:()=>yp});var yp,fx=ae(()=>{"use strict";yp=class{providerName="azure";vaultUrl;moduleRequire;constructor(e,r){let n=(e.vaultUrl||process.env.AZURE_KEYVAULT_URL)??"";this.vaultUrl=n.replace(/\/$/,""),this.moduleRequire=r??(i=>require(i))}async resolve(e){if(!this.vaultUrl)throw new Error("[HTTP Forge] Azure Key Vault resolver: no vault URL configured. Set secrets.providers.<alias>.vaultUrl or the AZURE_KEYVAULT_URL env var.");let r=e.split("/"),n=r[0],i=r[1];try{let{SecretClient:s}=this.moduleRequire("@azure/keyvault-secrets"),{DefaultAzureCredential:o}=this.moduleRequire("@azure/identity"),l=new o;return(await new s(this.vaultUrl,l).getSecret(n,i?{version:i}:{})).value}catch(s){throw s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND"?new Error("[HTTP Forge] Azure Key Vault resolver requires @azure/keyvault-secrets and @azure/identity. Install them: npm install @azure/keyvault-secrets @azure/identity"):s}}}});var aN={};Rs(aN,{HashiCorpVaultResolver:()=>vp});var vp,dx=ae(()=>{"use strict";vp=class{providerName="vault";address;mountPath;namespace;constructor(e){this.address=(e.address??process.env.VAULT_ADDR??"http://127.0.0.1:8200").replace(/\/$/,""),this.mountPath=e.mountPath??"secret",this.namespace=e.namespace??process.env.VAULT_NAMESPACE}async resolve(e){let r=e.lastIndexOf("#"),n=r>=0?e.slice(0,r):e,i=r>=0?e.slice(r+1):void 0,s=process.env.VAULT_TOKEN;if(!s)throw new Error("[HTTP Forge] HashiCorp Vault resolver requires VAULT_TOKEN environment variable to be set.");let o=`${this.address}/v1/${this.mountPath}/data/${n}`,l={"X-Vault-Token":s};this.namespace&&(l["X-Vault-Namespace"]=this.namespace);let c;try{c=await fetch(o,{headers:l})}catch(y){throw new Error(`[HTTP Forge] Vault request failed: ${y?.message??y}`)}if(c.status===404)return;if(!c.ok)throw new Error(`[HTTP Forge] Vault returned HTTP ${c.status} for path: ${n}`);let p=(await c.json())?.data?.data;if(!p)return;if(i)return p[i]!==void 0?String(p[i]):void 0;if("value"in p)return String(p.value);let m=Object.keys(p);return m.length===1?String(p[m[0]]):void 0}}});var cN={};Rs(cN,{OnePasswordResolver:()=>bp});var lN,uN,C5,bp,px=ae(()=>{"use strict";lN=require("child_process"),uN=require("util"),C5=(0,uN.promisify)(lN.execFile),bp=class{providerName="1password";defaultVault;constructor(e){this.defaultVault=e.vault}async resolve(e){let r=e.split("/"),n,i,s;if(this.defaultVault){if(r.length<2)throw new Error(`[HTTP Forge] 1Password path "${e}" must be "<item>/<field>" when vault is set in config.`);n=this.defaultVault,i=r.slice(0,r.length-1).join("/"),s=r[r.length-1]}else{if(r.length<3)throw new Error(`[HTTP Forge] 1Password path "${e}" must be "<vault>/<item>/<field>".`);n=r[0],i=r.slice(1,r.length-1).join("/"),s=r[r.length-1]}let o=await this.tryResolveSdk(n,i,s);return o!==null?o:this.resolveViaCli(n,i,s)}async tryResolveSdk(e,r,n){let i=process.env.OP_SERVICE_ACCOUNT_TOKEN;if(!i)return null;try{let{createClient:s}=require("@1password/sdk"),o=await s({auth:i,integrationName:"HTTP Forge",integrationVersion:"1.0.0"}),l=`op://${e}/${r}/${n}`;return await o.secrets.resolve(l)}catch(s){if(s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND")return null;throw new Error(`[HTTP Forge] 1Password SDK error for "${e}/${r}/${n}": ${s?.message??s}`)}}async resolveViaCli(e,r,n){try{let{stdout:i}=await C5("op",["item","get",r,"--vault",e,"--field",n,"--format","json"],{env:{...process.env},timeout:1e4}),s=JSON.parse(i.trim());return typeof s=="string"?s:s&&typeof s.value=="string"?s.value:void 0}catch(i){if(i?.code==="ENOENT")throw new Error("[HTTP Forge] 1Password resolver requires either the @1password/sdk npm package or the `op` CLI to be installed.\n Service Account: set OP_SERVICE_ACCOUNT_TOKEN and install @1password/sdk\n CLI: install 1Password CLI and run `op signin`");if(i?.stderr?.includes("not found")||i?.code===1)return;throw new Error(`[HTTP Forge] 1Password CLI error: ${i?.message??i}`)}}}});var fN={};Rs(fN,{GcpSecretResolver:()=>Sp});var Sp,hx=ae(()=>{"use strict";Sp=class{providerName="gcp";projectId;moduleRequire;constructor(e,r){this.projectId=e.projectId??process.env.GOOGLE_CLOUD_PROJECT??process.env.GCLOUD_PROJECT??process.env.GCP_PROJECT,this.moduleRequire=r??(n=>require(n))}async resolve(e){let r=e.split("/"),n=r[0],i=r[1]==="versions"&&r[2]?r[2]:"latest";if(!this.projectId)throw new Error("[HTTP Forge] GCP secret resolver: no projectId configured and GOOGLE_CLOUD_PROJECT env var is not set.");try{let{SecretManagerServiceClient:s}=this.moduleRequire("@google-cloud/secret-manager"),o=new s,l=`projects/${this.projectId}/secrets/${n}/versions/${i}`,[c]=await o.accessSecretVersion({name:l}),d=c.payload?.data;return d?Buffer.isBuffer(d)?d.toString("utf-8"):Buffer.from(d).toString("utf-8"):void 0}catch(s){throw s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND"?new Error("[HTTP Forge] GCP secret resolver requires @google-cloud/secret-manager. Install it: npm install @google-cloud/secret-manager"):s}}}});var pN={};Rs(pN,{DopplerResolver:()=>wp});var dN,wp,mx=ae(()=>{"use strict";dN=ve(require("https")),wp=class{providerName="doppler";token;constructor(e){this.token=e.serviceToken??process.env.DOPPLER_TOKEN}async resolve(e){let r=e.trim().toUpperCase(),n=this.token;if(!n)throw new Error("[HTTP Forge] Doppler secret resolver: no service token found. Set DOPPLER_TOKEN env var or add serviceToken to config.");let i=`https://api.doppler.com/v3/configs/config/secret?name=${encodeURIComponent(r)}`;return new Promise((s,o)=>{let l=dN.request(i,{method:"GET",headers:{Authorization:`Bearer ${n}`,Accept:"application/json"}},c=>{let d=[];c.on("data",p=>d.push(p)),c.on("end",()=>{let p=Buffer.concat(d).toString("utf-8");if(c.statusCode===404){s(void 0);return}if(c.statusCode!==200){o(new Error(`[HTTP Forge] Doppler API returned ${c.statusCode} for secret "${r}": ${p}`));return}try{let y=JSON.parse(p)?.value?.computed;s(y!=null?String(y):void 0)}catch{o(new Error(`[HTTP Forge] Doppler API returned non-JSON response for secret "${r}"`))}})});l.on("error",o),l.end()})}}});var Hy,hN,mN,Ac,gx=ae(()=>{"use strict";Hy=ve(require("fs")),hN=require("module"),mN=ve(require("path")),Ac=class{resolvers=new Map;moduleRequire;constructor(e){if(this.moduleRequire=this.buildModuleRequire(e),!e)return;let r;try{r=e.getConfig().secrets}catch{return}if(!(!r?.providers||typeof r.providers!="object"))for(let[n,i]of Object.entries(r.providers))try{let s=this.createResolver(i);s&&this.resolvers.set(n,s)}catch{}}async resolveSecretTokens(e,r){let n=r??new Map,i=new Set;if(this.collectTokens(e,i),i.size===0)return{};await Promise.all(Array.from(i).map(async o=>{if(n.has(o))return;let l=o.slice(7),c=l.indexOf("/");if(c<0)return;let d=l.slice(0,c),p=l.slice(c+1),m=this.resolvers.get(d);if(m)try{let y=await m.resolve(p);y!==void 0&&n.set(o,y)}catch(y){let b=y?.message??String(y);console.warn(`[HTTP Forge] {{${o}}} could not be resolved: ${b}`)}}));let s={};for(let[o,l]of n.entries())s[o]=l;return s}get hasProviders(){return this.resolvers.size>0}collectTokens(e,r){if(typeof e=="string"){let n=/\{\{(secret:[^}]+)\}\}/g,i;for(;(i=n.exec(e))!==null;)r.add(i[1])}else Array.isArray(e)?e.forEach(n=>this.collectTokens(n,r)):e!==null&&typeof e=="object"&&Object.values(e).forEach(n=>this.collectTokens(n,r))}createResolver(e){switch(e.provider){case"aws":{let{AwsSecretResolver:r}=(cx(),Oa(sN));return new r(e,this.moduleRequire)}case"azure":{let{AzureKeyVaultResolver:r}=(fx(),Oa(oN));return new r(e,this.moduleRequire)}case"vault":{let{HashiCorpVaultResolver:r}=(dx(),Oa(aN));return new r(e)}case"1password":{let{OnePasswordResolver:r}=(px(),Oa(cN));return new r(e)}case"gcp":{let{GcpSecretResolver:r}=(hx(),Oa(fN));return new r(e,this.moduleRequire)}case"doppler":{let{DopplerResolver:r}=(mx(),Oa(pN));return new r(e)}default:return}}buildModuleRequire(e){let r=i=>require(i);if(!e)return r;let n=[];try{n=e.getModulePaths()??[]}catch{return r}for(let i of n)try{let s=mN.resolve(i,"package.json");if(Hy.existsSync(s)){let o=Hy.realpathSync(s),l=(0,hN.createRequire)(o);return c=>{try{return l(c)}catch{return r(c)}}}}catch{}return r}}});function vr(t){return t.replace(/\//g,"%2F")}function yx(t){return t.replace(/%2F/gi,"/")}function rs(t){return t?t.split("/").map(yx).join(" / "):""}function _p(t){return t.includes(" / ")?t.split(" / ").map(e=>vr(e.trim())).join("/"):vr(t)}function nt(t,e=t.items,r=""){let n=[];for(let i of e)if(i.type==="request")n.push({request:i,folderPath:r});else{let s=i,o=vr(s.name),l=r?`${r}/${o}`:o;n.push(...nt(t,s.items??[],l))}return n}function Vr(t,e=t.items,r=""){let n=[];for(let i of e)if(i.type==="folder"){let s=i,o=vr(s.name),l=r?`${r}/${o}`:o;n.push({folderId:s.id,folderPath:l,requestCount:By(s.items??[])}),n.push(...Vr(t,s.items??[],l))}return n}function By(t){let e=0;for(let r of t)r.type==="request"?e++:e+=By(r.items??[]);return e}var Oi=ae(()=>{"use strict"});var Go,vx=ae(()=>{"use strict";Go={iterations:1,delayBetweenRequests:0,stopOnError:!1,readFromSharedSession:!1,writeToSharedSession:!1}});var St,Ii,Tc,bx=ae(()=>{"use strict";St=ve(require("fs")),Ii=ve(require("path"));Oi();Un();vx();Tc=class{constructor(e,r,n){this.collectionService=e;this.configService=r;this.suitesDir=r.getSuitesPath(),this.onSuitesChanged=n?.onSuitesChanged,this.ensureSuitesDir(),this.loadSuites(),n?.watch!==!1&&this.setupFileWatcher()}collectionService;configService;suitesDir;suites=new Map;fileWatcher=null;debounceTimer=null;onSuitesChanged;ensureSuitesDir(){St.existsSync(this.suitesDir)||St.mkdirSync(this.suitesDir,{recursive:!0})}setupFileWatcher(){try{this.fileWatcher=St.watch(this.suitesDir,(e,r)=>{r&&!r.endsWith(".suite.json")||(this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.loadSuites(),this.onSuitesChanged?.()},200))}),this.fileWatcher.on("error",()=>{})}catch{}}dispose(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.fileWatcher?.close(),this.fileWatcher=null}loadSuites(){if(this.suites.clear(),!St.existsSync(this.suitesDir))return;let e=St.readdirSync(this.suitesDir);for(let r of e)if(r.endsWith(".suite.json"))try{let n=Ii.join(this.suitesDir,r),i=St.readFileSync(n,"utf-8"),s=JSON.parse(i),o=Array.isArray(s.nodes)&&s.nodes.length>0?s.nodes:(Array.isArray(s.requests)?s.requests:[]).map(c=>({type:"request",name:c.description||c.name,request:c,enabled:c.enabled!==!1})),l={id:s.id,name:s.name,description:s.description,scripts:s.scripts,nodes:o,config:s.config??{...Go},isTemporary:s.isTemporary,createdAt:s.createdAt??Date.now(),updatedAt:s.updatedAt??Date.now()};l.id&&l.name&&this.suites.set(l.id,l)}catch(n){console.error(`[TestSuiteService] Failed to load ${r}:`,n)}}async getAllSuites(){return Array.from(this.suites.values())}async getSuite(e){return this.suites.get(e)}async createSuite(e){let r=Date.now(),n={id:Ot(e),name:e,nodes:[],config:{...Go},createdAt:r,updatedAt:r};return await this.saveSuiteToDisk(n),this.suites.set(n.id,n),n}async updateSuite(e){e.updatedAt=Date.now(),await this.saveSuiteToDisk(e),this.suites.set(e.id,e)}async duplicateSuite(e,r){let n=this.suites.get(e);if(!n)throw new Error(`Suite not found: ${e}`);let i=n.nodes||[],s=await this.createSuite(r);s.nodes=i.map(c=>({...c})),s.config={...n.config},s.description=n.description;let o=Ii.join(this.suitesDir,e),l=Ii.join(this.suitesDir,s.id);return St.existsSync(o)&&this.copyDirRecursive(o,l),await this.saveSuiteToDisk(s),this.suites.set(s.id,s),s}copyDirRecursive(e,r){St.existsSync(r)||St.mkdirSync(r,{recursive:!0});for(let n of St.readdirSync(e,{withFileTypes:!0})){let i=Ii.join(e,n.name),s=Ii.join(r,n.name);n.isDirectory()?this.copyDirRecursive(i,s):St.copyFileSync(i,s)}}async deleteSuite(e){let r=this.suites.get(e);if(!r)return!1;let n=`${r.id}.suite.json`,i=Ii.join(this.suitesDir,n),s=Ii.join(this.suitesDir,r.id);try{return St.existsSync(i)&&St.unlinkSync(i),St.existsSync(s)&&St.rmSync(s,{recursive:!0,force:!0}),this.suites.delete(e),!0}catch(o){return console.error("[TestSuiteService] Failed to delete suite:",o),!1}}async createTempSuiteFromCollection(e){let r=this.collectionService.getCollection(e);if(!r){console.error(`[TestSuiteService] Collection not found: ${e}`);return}let n=[];this.extractRequestsFromCollection(r,e,r.name,"",n);let i=n.map(l=>({type:"request",name:l.description||l.name,request:l,enabled:l.enabled!==!1})),s=Date.now();return{id:`temp-${e}`,name:r.name,nodes:i,config:{...Go},isTemporary:!0,createdAt:s,updatedAt:s}}async createTempSuiteFromFolder(e,r,n=!0){let i=this.collectionService.getCollection(e);if(!i){console.error(`[TestSuiteService] Collection not found: ${e}`);return}let s=[];this.extractRequestsFromCollection(i,e,i.name,"",s);let o=r.replace(/\/+$/,""),l=s.filter(m=>n?m.folderPath===o||m.folderPath.startsWith(`${o}/`):m.folderPath===o);if(l.length===0){console.error(`[TestSuiteService] No requests under folder "${r}" in collection: ${e}`);return}let c=l.map(m=>({type:"request",name:m.description||m.name,request:m,enabled:m.enabled!==!1})),d=Date.now();return{id:`temp-${e}-${this.slugifyFolderPath(o)}`,name:`${i.name} / ${rs(o)}`,nodes:c,config:{...Go},isTemporary:!0,createdAt:d,updatedAt:d}}slugifyFolderPath(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}async saveTempSuite(e,r){let n=Date.now(),i=Ii.join(this.suitesDir,e.id),s={...e,id:Ot(r),name:r,isTemporary:!1,createdAt:n,updatedAt:n},o=Ii.join(this.suitesDir,s.id);return St.existsSync(i)&&(St.existsSync(o)&&St.rmSync(o,{recursive:!0,force:!0}),St.renameSync(i,o)),await this.saveSuiteToDisk(s),this.suites.set(s.id,s),s}getAllAvailableRequests(){let e=[],r=this.collectionService.getAllCollections();for(let n of r)this.extractRequestsFromCollection(n,n.id,n.name,"",e);return e}extractRequestsFromCollection(e,r,n,i,s){if(e.requests)for(let o of e.requests)s.push({collectionId:r,collectionName:n,requestId:o.id,name:o.name||"Unnamed Request",method:o.method||"GET",folderPath:i});if(e.items)for(let o of e.items)if(o.items||o.folders||o.requests){let l=i?`${i}/${vr(o.name)}`:vr(o.name);this.extractRequestsFromCollection(o,r,n,l,s)}else s.push({collectionId:r,collectionName:n,requestId:o.id,name:o.name||"Unnamed Request",method:o.method||"GET",folderPath:i});if(e.folders)for(let o of e.folders){let l=i?`${i}/${vr(o.name)}`:vr(o.name);this.extractRequestsFromCollection(o,r,n,l,s)}}async saveSuiteToDisk(e){this.ensureSuitesDir();let r=`${e.id}.suite.json`,n=Ii.join(this.suitesDir,r),i=`${n}.tmp-${process.pid}-${Date.now()}`,s={id:e.id,name:e.name,description:e.description,scripts:e.scripts,nodes:Array.isArray(e.nodes)?e.nodes:[],config:e.config??{...Go},isTemporary:e.isTemporary,createdAt:e.createdAt??Date.now(),updatedAt:e.updatedAt??Date.now()},o=JSON.stringify(s,null,2);St.writeFileSync(i,o,"utf-8"),St.renameSync(i,n)}}});var oe,Vy=ae(()=>{"use strict";oe={Config:Symbol.for("IConfigService"),Console:Symbol.for("IConsoleService"),EnvironmentConfig:Symbol.for("IEnvironmentConfigService"),Collection:Symbol.for("ICollectionService"),HttpRequest:Symbol.for("IHttpRequestService"),HttpClient:Symbol.for("IHttpClient"),Cookie:Symbol.for("ICookieService"),RequestHistory:Symbol.for("IRequestHistoryService"),TestSuite:Symbol.for("ITestSuiteService"),UrlBuilder:Symbol.for("IUrlBuilder"),RequestPreprocessor:Symbol.for("IRequestPreprocessor"),RequestPreparer:Symbol.for("IRequestPreparer"),InterceptorChain:Symbol.for("IInterceptorChain"),ScriptExecutor:Symbol.for("IScriptExecutor"),DataFileParser:Symbol.for("IDataFileParser"),CollectionRequestExecutor:Symbol.for("ICollectionRequestExecutor"),WorkspaceFolder:Symbol.for("WorkspaceFolder"),PersistentCookieJar:Symbol.for("PersistentCookieJar"),OAuth2TokenManager:Symbol.for("IOAuth2TokenManager"),GraphQLSchemaService:Symbol.for("IGraphQLSchemaService"),SchemaInferrer:Symbol.for("SchemaInferrer"),HistoryAnalyzer:Symbol.for("HistoryAnalyzer"),ScriptAnalyzer:Symbol.for("ScriptAnalyzer"),SchemaInferenceService:Symbol.for("SchemaInferenceService"),OpenApiExporter:Symbol.for("OpenApiExporter"),OpenApiImporter:Symbol.for("OpenApiImporter"),SecretResolverRegistry:Symbol.for("SecretResolverRegistry")}});function Rp(t,e){let{workspaceFolder:r,fileWatcherFactory:n,notificationService:i,workspaceStore:s,globalStore:o,secretStore:l,browserService:c,applicationInfo:d,consoleService:p}=e;t.registerValue(oe.WorkspaceFolder,r),t.registerSingleton(oe.Config,()=>new ks(r,n,i)),t.registerSingleton(oe.Console,()=>p??x5),t.registerSingleton(oe.EnvironmentConfig,y=>new nc(r,s,y.resolve(oe.Config),n,l,e.persistOverrides??!0)),t.registerSingleton(oe.Cookie,()=>new tc(o)),t.registerSingleton(oe.Collection,y=>new ec(r,y.resolve(oe.Config),n)),t.registerSingleton(oe.TestSuite,y=>new Tc(y.resolve(oe.Collection),y.resolve(oe.Config))),t.registerSingleton(oe.HttpClient,y=>{let b=y.resolve(oe.Config);return new Eo(b.getRequestConfig(),r)}),t.registerSingleton(oe.UrlBuilder,()=>new Hn),t.registerSingleton(oe.InterceptorChain,()=>new zi),t.registerSingleton(oe.HttpRequest,y=>new Wi(y.resolve(oe.UrlBuilder),y.resolve(oe.InterceptorChain),y.resolve(oe.HttpClient))),t.registerSingleton(oe.RequestPreprocessor,()=>new qo),t.registerSingleton(oe.RequestHistory,y=>{let b=y.resolve(oe.EnvironmentConfig);return new oc(b.getHistoriesPath(),gN.join(b.getRootPath(),"shared-histories"))}),l&&c&&t.registerSingleton(oe.OAuth2TokenManager,y=>new Qu(l,c,y.resolve(oe.EnvironmentConfig),y.resolve(oe.HttpRequest))),t.registerSingleton(oe.GraphQLSchemaService,y=>new sc(y.resolve(oe.HttpClient))),t.registerSingleton(oe.SecretResolverRegistry,y=>new Ac(y.resolve(oe.Config)));let m=d??{name:"HttpForge",version:"0.0.0"};t.registerSingleton(oe.RequestPreparer,y=>new ic(y.resolve(oe.EnvironmentConfig),y.resolve(oe.HttpRequest),y.resolve(oe.RequestPreprocessor),y.has(oe.OAuth2TokenManager)?y.resolve(oe.OAuth2TokenManager):void 0,m,y.resolve(oe.SecretResolverRegistry))),t.registerSingleton(oe.ScriptExecutor,y=>{let b=y.resolve(oe.Config);return new Ki(y.resolve(oe.HttpRequest),b.getModulePaths(),y.resolve(oe.SecretResolverRegistry),b.getScriptScope(),b.getScriptTimeout())}),t.registerSingleton(oe.DataFileParser,()=>new Io),t.registerSingleton(oe.CollectionRequestExecutor,y=>new As(y.resolve(oe.HttpRequest),y.resolve(oe.ScriptExecutor),y.resolve(oe.EnvironmentConfig),y.resolve(oe.RequestPreparer),"")),t.registerSingleton(oe.PersistentCookieJar,y=>new rc(y.resolve(oe.Cookie))),t.registerSingleton(oe.SchemaInferrer,()=>new Ns),t.registerSingleton(oe.HistoryAnalyzer,y=>new Xa(y.resolve(oe.RequestHistory),y.resolve(oe.SchemaInferrer))),t.registerSingleton(oe.ScriptAnalyzer,()=>new yl),t.registerSingleton(oe.SchemaInferenceService,y=>new gl(y.resolve(oe.HistoryAnalyzer),y.resolve(oe.ScriptAnalyzer),y.resolve(oe.SchemaInferrer))),t.registerSingleton(oe.OpenApiExporter,y=>new ol(y.resolve(oe.Collection),y.resolve(oe.EnvironmentConfig),y.resolve(oe.SchemaInferenceService))),t.registerSingleton(oe.OpenApiImporter,y=>new Hs(y.resolve(oe.Collection),y.resolve(oe.EnvironmentConfig)))}var gN,x5,Sx=ae(()=>{"use strict";gN=ve(require("path"));Y0();e_();ig();r_();n_();s_();sg();o_();a_();c_();Tf();$f();gd();eg();_u();f_();zR();Ly();lx();cy();ux();tg();md();gx();bx();Vy();x5={log:()=>{},trace:()=>{},debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},logBatch:()=>{},logRawLines:()=>{},show:()=>{},clear:()=>{},dispose:()=>{}}});function wx(){return Yo.instance}var Yo,_x=ae(()=>{"use strict";Vy();Yo=class t{static _instance;services=new Map;primitives=new Map;constructor(){}static get instance(){return t._instance||(t._instance=new t),t._instance}static createFresh(){return new t}static reset(){t._instance&&t._instance.clear(),t._instance=void 0}registerValue(e,r){return this.primitives.set(e,r),this}registerSingleton(e,r){return this.services.set(e,{factory:r,singleton:!0}),this}registerTransient(e,r){return this.services.set(e,{factory:r,singleton:!1}),this}registerInstance(e,r){return this.services.set(e,{factory:()=>r,singleton:!0,instance:r}),this}resolve(e){if(this.primitives.has(e))return this.primitives.get(e);let r=this.services.get(e);if(!r)throw new Error(`Service not registered: ${e.toString()}`);return r.singleton?(r.instance||(r.instance=r.factory(this)),r.instance):r.factory(this)}has(e){return this.services.has(e)||this.primitives.has(e)}clear(){this.services.clear(),this.primitives.clear()}get config(){return this.resolve(oe.Config)}get console(){return this.resolve(oe.Console)}get environmentConfig(){return this.resolve(oe.EnvironmentConfig)}get collection(){return this.resolve(oe.Collection)}get httpRequest(){return this.resolve(oe.HttpRequest)}get httpClient(){return this.resolve(oe.HttpClient)}get cookie(){return this.resolve(oe.Cookie)}get requestHistory(){return this.resolve(oe.RequestHistory)}get dataFileParser(){return this.resolve(oe.DataFileParser)}get scriptExecutor(){return this.resolve(oe.ScriptExecutor)}get requestPreparer(){return this.resolve(oe.RequestPreparer)}get persistentCookieJar(){return this.resolve(oe.PersistentCookieJar)}get oauth2TokenManager(){return this.has(oe.OAuth2TokenManager)?this.resolve(oe.OAuth2TokenManager):void 0}get graphqlSchemaService(){return this.resolve(oe.GraphQLSchemaService)}get testSuite(){return this.resolve(oe.TestSuite)}}});function yN(t){return/\{\{[^}]+\}\}/.test(t)}function Cp(t,e=16){return!!t&&t.length>=e&&!yN(t)}function Rx(t){return t.toUpperCase().replace(/[^A-Z0-9]/g,"_")}function xp(t,e,r,n,i,s=10){let o=t.get(e);o||(o={varName:r,reason:n,occurrences:[],priority:s},t.set(e,o));let l=`${i.requestId}::${i.field}`;o.occurrences.some(c=>`${c.requestId}::${c.field}`===l)||o.occurrences.push(i)}function Ep(t,e=1){let r=nt(t),n=new Map;for(let{request:s}of r){let o=l=>({requestId:s.id,requestName:s.name,field:l});for(let l of s.headers??[]){if(l.enabled===!1)continue;let c=l.key.toLowerCase(),d=l.value;if(c==="authorization"){let p=d.match(/^(bearer|basic|token|digest)\s+(.+)$/i);p&&Cp(p[2])?xp(n,p[2],`${p[1].toUpperCase()}_TOKEN`,`Authorization ${p[1]} token`,o(`header:${l.key}`),1):Cp(d)&&xp(n,d,"AUTH_TOKEN","Authorization header value",o(`header:${l.key}`),1)}else E5.has(c)&&Cp(d)?xp(n,d,Rx(l.key),`Sensitive header: ${l.key}`,o(`header:${l.key}`),2):Cp(d,20)&&!d.includes(" ")&&/^[A-Za-z0-9+/=_.-]+$/.test(d)&&xp(n,d,Rx(l.key)||"HEADER_VALUE",`Long opaque value in header: ${l.key}`,o(`header:${l.key}`),5)}for(let l of s.query??[])l.enabled!==!1&&q5.has(l.key.toLowerCase())&&Cp(l.value)&&xp(n,l.value,Rx(l.key),`Sensitive query param: ${l.key}`,o(`query:${l.key}`),2)}let i=new Map;for(let{request:s}of r)if(!(!s.url||yN(s.url)))try{let o=new URL(s.url);if(!["localhost","127.0.0.1","0.0.0.0","::1"].includes(o.hostname)){let c=`${o.protocol}//${o.host}`,d=i.get(c)??[];d.push({requestId:s.id,requestName:s.name,field:"url"}),i.set(c,d)}}catch{}for(let[s,o]of i)o.length>=Math.max(e,2)&&!n.has(s)&&n.set(s,{varName:"BASE_URL",reason:`Shared base URL across ${o.length} requests`,occurrences:o,priority:3});return[...n.entries()].filter(([,s])=>s.occurrences.length>=e).sort((s,o)=>s[1].priority-o[1].priority||s[0].localeCompare(o[0])).map(([s,o])=>({varName:o.varName,value:s,reason:o.reason,occurrences:o.occurrences}))}function Wy(t,e){let r={};return vN(t,e,r),r}function vN(t,e,r){for(let n of t){if(n.type==="folder"){n.items&&vN(n.items,e,r);continue}let i=n;for(let s of e){let o=`{{${s.varName}}}`;i.url?.includes(s.value)&&(i.url=i.url.split(s.value).join(o),r[s.varName]=(r[s.varName]??0)+1);for(let l of i.headers??[]){let c=l.value.match(/^(bearer|basic|token|digest)\s+(.+)$/i);c&&c[2]===s.value?(l.value=`${c[1]} ${o}`,r[s.varName]=(r[s.varName]??0)+1):l.value===s.value&&(l.value=o,r[s.varName]=(r[s.varName]??0)+1)}for(let l of i.query??[])l.value===s.value&&(l.value=o,r[s.varName]=(r[s.varName]??0)+1)}}}var E5,q5,Cx=ae(()=>{"use strict";Oi();E5=new Set(["x-api-key","x-auth-token","x-access-token","x-token","x-secret","api-key","apikey","x-client-secret","x-rapidapi-key"]),q5=new Set(["api_key","apikey","api-key","access_token","token","auth_token","client_id","client_secret","key","secret"])});function Wr(t,e){let r={type:"string",description:t};return e.length>0&&(r.enum=[...e]),r}function zy(t,e,r){let n=i=>Wr("Name of the collection to act on."+(i?"":" Optional."),e);return[{name:`${t}${G.listCollections}`,description:"List all available HTTP Forge collections (name, description, and request count). Call this first to discover what collections exist, then use list_folders, list_requests or run_* tools.",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.listFolders}`,description:"List all folders in a collection with their full paths and request counts. Use this before run_folder to discover the exact folder path string to pass.",inputSchema:{type:"object",properties:{collection:n(!0)},required:["collection"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.listRequests}`,description:"List the saved requests in a collection (name, HTTP method, folder, and description). Use this to find the exact request name before calling run_request. For large collections use the folder filter and offset/limit to page through results.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:'Optional folder path to filter by (e.g. "Auth").'},offset:{type:"number",description:"Zero-based index to start from (default: 0)."},limit:{type:"number",description:"Maximum number of results to return (default: 50, max: 200)."}},required:["collection"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.searchRequests}`,description:"Search for requests across a collection by name, URL, method, or folder path. Returns matching requests with their folder location. Useful for large collections.",inputSchema:{type:"object",properties:{collection:n(!0),query:{type:"string",description:"Text to search for in request names, URLs, methods, and folder paths (case-insensitive)."}},required:["collection","query"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getRequest}`,description:"Get the full details of a single saved request: URL, method, headers, body, auth, and scripts. Use this to inspect a request before editing it, or to read a script before rewriting it.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id. Use list_requests to find names."}},required:["collection","request"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getEnvironment}`,description:"Show the current environment variable values (merged initial + runtime pm.environment.set overrides). Use this to inspect variable state before running a folder, or to debug {{variable}} resolution failures.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name to inspect (defaults to the currently selected environment)."}}},annotations:{readOnlyHint:!0}},{name:`${t}${G.setVariable}`,description:'Override an environment variable for the current session. In the VS Code extension the change is saved to VS Code workspace storage (survives restarts, but is not in the env JSON file and not source-controlled). In the standalone CLI/core runtime the change is in-memory only and lost when the server restarts. Use set_environment_variable with scope:"permanent" to write to the env JSON file (source-controlled, works in both runtimes).',inputSchema:{type:"object",properties:{key:{type:"string",description:"Variable name (the part inside {{...}})."},value:{type:"string",description:"New value to set."},environment:{type:"string",description:"Environment to update (defaults to the currently selected environment)."}},required:["key","value"]},annotations:{idempotentHint:!0}},{name:`${t}${G.getRunStatus}`,description:"Check whether an async run is still running, completed, or failed. Poll this after calling run_folder/run_collection/run_suite with async:true.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."}},required:["runId"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getRunSummary}`,description:'Get the pass/fail summary of a completed async run (total, passed, failed counts). Use after get_run_status shows "completed". When failures are present the response includes a failedRequests array with full details (method, url, requestBody, status, responseBody, failedTests) and a _nextStep directive. You MUST follow the _nextStep directive immediately \u2014 analyze the failures and provide diagnosis without waiting for the user to ask.',inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."}},required:["runId"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getFailedRequests}`,description:"Get the list of failed requests from a completed async run \u2014 the failures-first view. Never returns passing requests. Use this instead of get_run_summary when you need to see what broke.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."},offset:{type:"number",description:"Zero-based index to start from (default: 0)."},limit:{type:"number",description:"Maximum failures to return (default: 20, max: 100)."}},required:["runId"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getRequestResult}`,description:"Get the full result (status, body, assertions, console output) for one specific request from an async run. Use after get_failed_requests to drill into a single failure.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."},request:{type:"string",description:"Name of the request to look up."},iteration:{type:"number",description:"Iteration number (default: 1)."}},required:["runId","request"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.cancelRun}`,description:'Request cancellation of an in-progress async run. Cancellation is best-effort: the currently-executing HTTP request completes normally, but no further requests in the run are started. The run status changes to "cancelled". Has no effect on runs that are already completed, failed, or cancelled.',inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by run_collection, run_folder, or run_suite with async:true."}},required:["runId"]},annotations:{idempotentHint:!0}},{name:`${t}${G.runRequest}`,description:"Run a single saved request. Pick the collection, then the request name within it.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Name of the request to run. Use list_requests or search_requests to find names."},requestId:{type:"string",description:'ID of the request (from list_requests/search_requests). Preferred over "request" name when available \u2014 avoids ambiguity with duplicate names.'},...qp.properties},required:["collection","request"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.runFolder}`,description:"Run every request inside a folder of a collection.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:'Folder path within the collection (e.g. "Auth/Login").'},...Ip.properties},required:["collection","folder"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.runCollection}`,description:"Run every request in a collection.",inputSchema:{type:"object",properties:{collection:n(!0),...Op.properties},required:["collection"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.runSuite}`,description:"Run a saved test suite.",inputSchema:{type:"object",properties:{suite:Wr("Name of the test suite to run.",r),...Pp.properties},required:["suite"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.createCollection}`,description:"Create a new empty collection.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Display name for the new collection."}},required:["name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.renameCollection}`,description:"Rename an existing collection.",inputSchema:{type:"object",properties:{collection:n(!0),newName:{type:"string",description:"New display name for the collection."}},required:["collection","newName"]},annotations:{idempotentHint:!0}},{name:`${t}${G.deleteCollection}`,description:"Permanently delete a collection and all its contents. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{collection:n(!0),confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["collection","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.duplicateCollection}`,description:"Clone a collection under a new name (all folders, requests, and scripts are copied).",inputSchema:{type:"object",properties:{collection:n(!0),newName:{type:"string",description:"Name for the duplicated collection."}},required:["collection","newName"]},annotations:{idempotentHint:!1}},{name:`${t}${G.createFolder}`,description:"Create a folder inside a collection (optionally nested inside another folder).",inputSchema:{type:"object",properties:{collection:n(!0),name:{type:"string",description:"Display name for the new folder."},parentFolder:{type:"string",description:"Slash-separated folder path or folder id of the parent. Omit to create at collection root."}},required:["collection","name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.deleteFolder}`,description:"Delete a folder and all its requests. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:"Slash-separated folder path or folder id to delete."},confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["collection","folder","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.createRequest}`,description:"Create a new HTTP request inside a collection (optionally inside a folder).",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:"Folder path or id. Omit to add at collection root."},name:{type:"string",description:"Display name for the request."},method:{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],description:"HTTP method."},url:{type:"string",description:"Request URL, may include {{variable}} placeholders."},headers:{type:"object",description:"Key/value header map.",additionalProperties:{type:"string"}},body:{type:"string",description:"Raw request body (JSON, text, etc.)."},description:{type:"string",description:"Human-readable description."}},required:["collection","name","method","url"]},annotations:{idempotentHint:!1}},{name:`${t}${G.updateRequest}`,description:"Update fields on an existing request (partial update \u2014 omit fields to keep current values).",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id."},name:{type:"string",description:"New display name."},method:{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]},url:{type:"string"},headers:{type:"object",additionalProperties:{type:"string"}},body:{type:"string"},description:{type:"string"}},required:["collection","request"]},annotations:{idempotentHint:!0}},{name:`${t}${G.deleteRequest}`,description:"Remove a request from a collection. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id to delete."},confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["collection","request","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.getRequestScript}`,description:"Read the pre-request or post-response script of a request.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id."},phase:{type:"string",enum:["pre-request","post-response"],description:"Which script phase to read."}},required:["collection","request","phase"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.setRequestScript}`,description:"Write or replace the pre-request or post-response script of a request.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id."},phase:{type:"string",enum:["pre-request","post-response"],description:"Which script phase to write."},script:{type:"string",description:"Full JavaScript source to write."}},required:["collection","request","phase","script"]},annotations:{idempotentHint:!0}},{name:`${t}${G.reorderCollectionItems}`,description:"Set the execution/display order of direct children of a collection root or folder. Items not listed are appended at the end.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:"Folder path or id. Omit to reorder collection root."},order:{type:"array",items:{type:"string"},description:"Ordered list of item names or ids."}},required:["collection","order"]},annotations:{idempotentHint:!0}},{name:`${t}${G.listSuites}`,description:"List all test suites with name, id, request count, and configuration summary.",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.getSuite}`,description:"Get full details of a test suite including flow nodes (suite.nodes) and a flattened request list.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the test suite.",r)},required:["suite"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.createSuite}`,description:"Create a new test suite (empty, pre-populated from a collection/folder, or initialized with an explicit flow nodes graph).",inputSchema:{type:"object",properties:{name:{type:"string",description:"Display name for the new suite."},description:{type:"string",description:"Optional description."},fromCollection:{type:"string",description:"Collection name or id to seed the suite from (all requests in execution order)."},fromFolder:{type:"string",description:"Folder path within fromCollection to seed from."},nodes:{type:"array",items:{type:"object"},description:"Optional full suite.nodes graph. If provided, this becomes the suite flow definition."},iterations:{type:"number",description:"Number of iterations (default: 1)."},stopOnError:{type:"boolean",description:"Stop on first failure (default: false)."},delayBetweenRequests:{type:"number",description:"Milliseconds delay between requests (default: 0)."}},required:["name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.updateSuiteConfig}`,description:"Change a suite's name/description/run configuration and optionally replace the full suite.nodes flow graph.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite to update.",r),name:{type:"string",description:"New display name."},description:{type:"string",description:"New description."},nodes:{type:"array",items:{type:"object"},description:"Optional full suite.nodes graph replacement."},iterations:{type:"number"},stopOnError:{type:"boolean"},delayBetweenRequests:{type:"number"}},required:["suite"]},annotations:{idempotentHint:!0}},{name:`${t}${G.getSuiteNode}`,description:'Get a single suite flow node by path (for example: "2.then.0" or "1.cases.0.nodes.1").',inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),path:{type:"string",description:"Node path to read (dot notation)."}},required:["suite","path"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.listSuiteNodePaths}`,description:"List all node paths and editable branch-array paths for a suite flow graph. Use before add/update/remove/move_suite_node.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),includeBranches:{type:"boolean",description:"Include branch-array paths (default: true)."}},required:["suite"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.addSuiteNode}`,description:"Add a flow node to a suite. Insert at root or into a branch array of a parent node.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),node:{type:"object",description:"Node object to insert (request/script/if/switch/for/while/block)."},parentPath:{type:"string",description:'Optional parent node path (for example: "2" or "1.cases.0"). Omit to insert at root.'},branch:{type:"string",description:'Branch array on parent node (for example: "nodes", "then", "else", "default", "cases.0.nodes"). Required when parentPath is provided.'},index:{type:"number",description:"Optional insertion index inside target array. Omit to append."}},required:["suite","node"]},annotations:{idempotentHint:!1}},{name:`${t}${G.updateSuiteNode}`,description:"Replace a flow node at a specific path in suite.nodes.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),path:{type:"string",description:'Node path to replace (for example: "0" or "2.then.1").'},node:{type:"object",description:"Full replacement node object."}},required:["suite","path","node"]},annotations:{idempotentHint:!0}},{name:`${t}${G.removeSuiteNode}`,description:"Remove a flow node at a specific path from suite.nodes.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),path:{type:"string",description:'Node path to remove (for example: "0" or "2.else.0").'}},required:["suite","path"]},annotations:{destructiveHint:!0}},{name:`${t}${G.moveSuiteNode}`,description:"Move a flow node from one path to another parent/branch/index within suite.nodes.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),fromPath:{type:"string",description:'Source node path (for example: "1.then.0").'},toParentPath:{type:"string",description:"Optional destination parent node path. Omit to move to root."},toBranch:{type:"string",description:"Destination branch array on parent node. Required when toParentPath is provided."},toIndex:{type:"number",description:"Optional destination index in target array. Omit to append."}},required:["suite","fromPath"]},annotations:{idempotentHint:!1}},{name:`${t}${G.addSuiteRequests}`,description:'Legacy compatibility helper. Add one or more request nodes at the suite root, using the same insertion semantics as add_suite_node with type:"request".',inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),requests:{type:"array",items:{type:"object",properties:{collection:{type:"string",description:"Collection name or id."},request:{type:"string",description:"Request name or id."}},required:["collection","request"]},description:"Requests to add."},insertAt:{type:"number",description:"Zero-based root nodes-array index to insert at. Omit to append at end."}},required:["suite","requests"]},annotations:{idempotentHint:!1}},{name:`${t}${G.removeSuiteRequest}`,description:"Remove a request from a request-only root suite by position (0-based) or by name. For flow suites, edit nodes via get_suite/update_suite_config.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),index:{type:"number",description:"Zero-based position in the suite requests list."},request:{type:"string",description:"Request name to remove (used if index is not provided)."}},required:["suite"]},annotations:{destructiveHint:!0}},{name:`${t}${G.reorderSuiteRequests}`,description:"Reorder requests in a request-only root suite. Requests not listed are moved to the end. For flow suites, edit nodes via get_suite/update_suite_config.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),order:{type:"array",items:{type:"string"},description:"Ordered list of request names."}},required:["suite","order"]},annotations:{idempotentHint:!0}},{name:`${t}${G.duplicateSuite}`,description:"Clone an existing suite under a new name.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite to clone.",r),newName:{type:"string",description:"Name for the duplicated suite."}},required:["suite","newName"]},annotations:{idempotentHint:!1}},{name:`${t}${G.deleteSuite}`,description:"Delete a test suite permanently. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite to delete.",r),confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["suite","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.listEnvironments}`,description:"List all environments with their variable keys (values hidden). Use get_environment_variables to see values.",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.getEnvironmentVariables}`,description:"Get the resolved (merged file + session overrides) variables for an environment.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name (defaults to active environment)."}}},annotations:{readOnlyHint:!0}},{name:`${t}${G.selectEnvironment}`,description:"Set the active environment for all subsequent run_* calls in this session.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Name of the environment to activate."}},required:["environment"]},annotations:{idempotentHint:!0}},{name:`${t}${G.createEnvironment}`,description:"Create a new environment file, optionally pre-populated with variables.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Environment name (becomes the filename)."},variables:{type:"object",description:"Initial key/value variable map.",additionalProperties:{type:"string"}}},required:["name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.deleteEnvironment}`,description:"Delete an environment file permanently. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name to delete."},confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["environment","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.setEnvironmentVariable}`,description:'Set a variable in an environment. Scope "session" (default) is in-memory only and always temporary (both runtimes). Scope "permanent" writes to the env JSON config file \u2014 source-controlled and shared with the CLI runtime.',inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name (defaults to active environment)."},key:{type:"string",description:"Variable name."},value:{type:"string",description:"New value."},scope:{type:"string",enum:["session","permanent"],description:'Storage scope. "permanent" writes to disk.'}},required:["key","value"]},annotations:{idempotentHint:!0}},{name:`${t}${G.unsetEnvironmentVariable}`,description:"Remove a session-scoped variable override, restoring the file value.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name (defaults to active environment)."},key:{type:"string",description:"Variable name to unset."}},required:["key"]},annotations:{idempotentHint:!0}},{name:`${t}${G.setGlobalVariable}`,description:'Set a global variable visible across all environments. Scope "session" (default) is in-memory only and lost on restart (both runtimes). Scope "permanent" writes to _global.json \u2014 source-controlled and shared with the CLI runtime.',inputSchema:{type:"object",properties:{key:{type:"string",description:"Global variable name."},value:{type:"string",description:"Value to set."},scope:{type:"string",enum:["session","permanent"],description:'Storage scope. "permanent" writes to _global.json.'}},required:["key","value"]},annotations:{idempotentHint:!0}},{name:`${t}${G.getGlobals}`,description:"Return all global variables (merged _global.json + runtime pm.globals.set() values).",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.scaffoldCollectionFromOpenApi}`,description:"Import an OpenAPI 3.0 spec (JSON or YAML) and scaffold a complete HTTP Forge collection from it. All operations become requests grouped by tag/path. An optional environment is created from the server URL. Returns the new collection id and name. Use this to quickly bootstrap API testing from a spec file.",inputSchema:{type:"object",properties:{specPath:{type:"string",description:"Absolute or workspace-relative path to the OpenAPI 3.0 JSON or YAML file."},collectionName:{type:"string",description:"Override the collection name (defaults to the spec title)."},environmentName:{type:"string",description:"Name for the generated environment that contains the server base URL. Omit to skip environment creation."}},required:["specPath"]},annotations:{idempotentHint:!1}},{name:`${t}${G.suggestAssertions}`,description:"Analyse the last execution history for a request and suggest pm.test() assertions to add to its post-response script. Covers status code, response time, required JSON fields, Content-Type header, and schema conformance. Returns an array of ready-to-paste JavaScript test snippets and a rationale for each.",inputSchema:{type:"object",properties:{collection:{type:"string",description:"Collection name or id that owns the request."},request:{type:"string",description:"Request name or id to analyse."},environment:{type:"string",description:"Environment used when the run was recorded (defaults to active environment)."},maxSuggestions:{type:"number",description:"Cap the number of suggestions returned (default: 10)."}},required:["collection","request"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.explainFailure}`,description:"Explain why a specific request failed in a recent run. Returns the full request (URL, method, headers, body), the response received (status, headers, body), all assertion results, any script errors, and a plain-English diagnosis with suggested fixes. Provide either runId (from a prior run_suite/run_collection call) + request name, or the collection and request names to pull the most recent history entry.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"MCP run id (from run_suite or run_collection). Mutually exclusive with collection+request history lookup."},collection:{type:"string",description:"Collection name or id. Required when runId is omitted."},request:{type:"string",description:"Request name or id."},iteration:{type:"number",description:"Iteration number within the run (default: 1)."}}},annotations:{readOnlyHint:!0}},{name:`${t}${G.suggestEnvVars}`,description:`Scan a collection for hardcoded values (API keys, base URLs, tokens, tenant IDs) that should become environment variables.
|
|
279
|
+
`)}`));if(!("location"in i.headers)||!i.headers.location)throw(0,Ny.ono)({status:i.status},`HTTP ${i.status} redirect with no location header`);{let s=dp.resolve(t.href,i.headers.location);return O1(s,e,n)}}else{if(i.body){let s=await i.arrayBuffer();return Buffer.from(s)}return Buffer.alloc(0)}}catch(i){throw new q1.ResolverError((0,Ny.ono)(i,`Error downloading ${t.href}`),t.href)}}async function N8(t,e){let r,n;e.timeout&&(r=new AbortController,n=setTimeout(()=>r.abort(),e.timeout));let i=await fetch(t,{method:"GET",headers:e.headers||{},credentials:e.withCredentials?"include":"same-origin",signal:r?r.signal:null});return n&&clearTimeout(n),i}});var XC=V(Us=>{"use strict";var Pc=Us&&Us.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Us,"__esModule",{value:!0});Us.getNewOptions=Us.getJsonSchemaRefParserDefaultOptions=void 0;var M8=Pc(r$()),F8=Pc(S1()),D8=Pc(w1()),j8=Pc(_1()),L8=Pc(E1()),U8=Pc(I1()),H8=()=>({parse:{json:{...M8.default},yaml:{...F8.default},text:{...D8.default},binary:{...j8.default}},resolve:{file:{...L8.default},http:{...U8.default},external:!0},continueOnError:!1,dereference:{circular:!0,excludedPathMatcher:()=>!1,referenceResolution:"relative"},mutateInputSchema:!0});Us.getJsonSchemaRefParserDefaultOptions=H8;var B8=t=>{let e=(0,Us.getJsonSchemaRefParserDefaultOptions)();return t&&k1(e,t),e};Us.getNewOptions=B8;function k1(t,e){if(P1(e)){let r=Object.keys(e).filter(n=>!["__proto__","constructor","prototype"].includes(n));for(let n=0;n<r.length;n++){let i=r[n],s=e[i],o=t[i];P1(s)?t[i]=k1(o||{},s):s!==void 0&&(t[i]=s)}}return t}function P1(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}});var T1=V(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:!0});My.normalizeArgs=A1;var V8=XC();function A1(t){let e,r,n,i,s=Array.prototype.slice.call(t);typeof s[s.length-1]=="function"&&(i=s.pop()),typeof s[0]=="string"?(e=s[0],typeof s[2]=="object"?(r=s[1],n=s[2]):(r=void 0,n=s[1])):(e="",r=s[0],n=s[1]);try{n=(0,V8.getNewOptions)(n)}catch(o){console.error(`JSON Schema Ref Parser: Error normalizing options: ${o}`)}return!n.mutateInputSchema&&typeof r=="object"&&(r=JSON.parse(JSON.stringify(r))),{path:e,schema:r,options:n,callback:i}}My.default=A1});var $1=V(Ci=>{"use strict";var W8=Ci&&Ci.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),z8=Ci&&Ci.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),J8=Ci&&Ci.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&W8(r,e,n[i]);return z8(r,e),r}})(),ex=Ci&&Ci.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ci,"__esModule",{value:!0});var G8=ex(_c()),Y8=ex(tp()),K8=ex(gC()),kc=J8(Gn()),Q8=Yn();function Z8(t,e){if(!e.resolve?.external)return Promise.resolve();try{let r=tx(t.schema,t.$refs._root$Ref.path+"#",t.$refs,e);return Promise.all(r)}catch(r){return Promise.reject(r)}}function tx(t,e,r,n,i,s){i||(i=new Set);let o=[];if(t&&typeof t=="object"&&!ArrayBuffer.isView(t)&&!i.has(t)){i.add(t),G8.default.isExternal$Ref(t)&&o.push(X8(t,e,r,n));let l=Object.keys(t);for(let c of l){let d=Y8.default.join(e,c),p=t[c];o=o.concat(tx(p,d,r,n,i,s))}}return o}async function X8(t,e,r,n){let i=n.dereference?.externalReferenceResolution==="root",s=kc.resolve(i?kc.cwd():e,t.$ref),o=kc.stripHash(s),l=r._$refs[o];if(l)return Promise.resolve(l.value);try{let c=await(0,K8.default)(s,r,n),d=tx(c,o+"#",r,n,new Set,!0);return Promise.all(d)}catch(c){if(!n?.continueOnError||!(0,Q8.isHandledError)(c))throw c;return r._$refs[o]&&(c.source=decodeURI(kc.stripHash(e)),c.path=kc.safePointerToPath(kc.getHash(e))),[]}}Ci.default=Z8});var F1=V(xi=>{"use strict";var e5=xi&&xi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),t5=xi&&xi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),r5=xi&&xi.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&e5(r,e,n[i]);return t5(r,e),r}})(),M1=xi&&xi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xi,"__esModule",{value:!0});var Fy=M1(_c()),pp=M1(tp()),rx=r5(Gn());function n5(t,e){let r=[];nx(t,"schema",t.$refs._root$Ref.path+"#","#",0,r,t.$refs,e),i5(r)}function nx(t,e,r,n,i,s,o,l){let c=e===null?t:t[e];if(c&&typeof c=="object"&&!ArrayBuffer.isView(c))if(Fy.default.isAllowed$Ref(c))N1(t,e,r,n,i,s,o,l);else{let d=Object.keys(c).sort((p,m)=>p==="definitions"?-1:m==="definitions"?1:p.length-m.length);for(let p of d){let m=pp.default.join(r,p),y=pp.default.join(n,p),b=c[p];Fy.default.isAllowed$Ref(b)?N1(c,p,r,y,i,s,o,l):nx(c,p,m,y,i,s,o,l)}}}function N1(t,e,r,n,i,s,o,l){let c=e===null?t:t[e],d=rx.resolve(r,c.$ref),p=o._resolve(d,n,l);if(p===null)return;let y=pp.default.parse(n).length,b=rx.stripHash(p.path),q=rx.getHash(p.path),C=b!==o._root$Ref.path,v=Fy.default.isExtended$Ref(c);i+=p.indirections;let _=s5(s,t,e);if(_)if(y<_.depth||i<_.indirections)o5(s,_);else return;s.push({$ref:c,parent:t,key:e,pathFromRoot:n,depth:y,file:b,hash:q,value:p.value,circular:p.circular,extended:v,external:C,indirections:i}),(!_||C)&&nx(p.value,null,p.path,n,i+1,s,o,l)}function i5(t){t.sort((i,s)=>{if(i.file!==s.file)return i.file<s.file?-1:1;if(i.hash!==s.hash)return i.hash<s.hash?-1:1;if(i.circular!==s.circular)return i.circular?-1:1;if(i.extended!==s.extended)return i.extended?1:-1;if(i.indirections!==s.indirections)return i.indirections-s.indirections;if(i.depth!==s.depth)return i.depth-s.depth;{let o=i.pathFromRoot.lastIndexOf("/definitions"),l=s.pathFromRoot.lastIndexOf("/definitions");return o!==l?l-o:i.pathFromRoot.length-s.pathFromRoot.length}});let e,r,n;for(let i of t)i.external?i.file===e&&i.hash===r?i.$ref.$ref=n:i.file===e&&i.hash.indexOf(r+"/")===0?i.$ref.$ref=pp.default.join(n,pp.default.parse(i.hash.replace(r,"#"))):(e=i.file,r=i.hash,n=i.pathFromRoot,i.$ref=i.parent[i.key]=Fy.default.dereference(i.$ref,i.value),i.circular&&(i.$ref.$ref=i.pathFromRoot)):i.$ref.$ref=i.hash}function s5(t,e,r){for(let n of t)if(n&&n.parent===e&&n.key===r)return n}function o5(t,e){let r=t.indexOf(e);t.splice(r,1)}xi.default=n5});var B1=V(Ei=>{"use strict";var a5=Ei&&Ei.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),l5=Ei&&Ei.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),u5=Ei&&Ei.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&a5(r,e,n[i]);return l5(r,e),r}})(),U1=Ei&&Ei.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ei,"__esModule",{value:!0});var Dy=U1(_c()),D1=U1(tp()),c5=Bo(),j1=u5(Gn()),f5=Yn();Ei.default=d5;function d5(t,e){let r=Date.now(),n=ix(t.schema,t.$refs._root$Ref.path,"#",new Set,new Set,new Map,t.$refs,e,r);t.$refs.circular=n.circular,t.schema=n.value}function ix(t,e,r,n,i,s,o,l,c){let d,p={value:t,circular:!1};if(l&&l.timeoutMs&&Date.now()-c>l.timeoutMs)throw new f5.TimeoutError(l.timeoutMs);let m=l.dereference||{},y=m.excludedPathMatcher||(()=>!1);if((m?.circular==="ignore"||!i.has(t))&&t&&typeof t=="object"&&!ArrayBuffer.isView(t)&&!y(r)){if(n.add(t),i.add(t),Dy.default.isAllowed$Ref(t,l))d=L1(t,e,r,n,i,s,o,l,c),p.circular=d.circular,p.value=d.value;else for(let b of Object.keys(t)){let q=D1.default.join(e,b),C=D1.default.join(r,b);if(y(C))continue;let v=t[b],_=!1;if(Dy.default.isAllowed$Ref(v,l)){if(d=L1(v,q,C,n,i,s,o,l,c),_=d.circular,t[b]!==d.value){let E=new Map;m?.preservedProperties&&typeof t[b]=="object"&&!Array.isArray(t[b])&&m?.preservedProperties.forEach(k=>{k in t[b]&&E.set(k,t[b][k])}),t[b]=d.value,m?.preservedProperties&&E.size&&typeof t[b]=="object"&&!Array.isArray(t[b])&&E.forEach((k,O)=>{t[b][O]=k}),m?.onDereference?.(v.$ref,t[b],t,b)}}else n.has(v)?_=H1(q,o,l):(d=ix(v,q,C,n,i,s,o,l,c),_=d.circular,t[b]!==d.value&&(t[b]=d.value));p.circular=p.circular||_}n.delete(t)}return p}function L1(t,e,r,n,i,s,o,l,c){let p=Dy.default.isExternal$Ref(t)&&l?.dereference?.externalReferenceResolution==="root",m=j1.resolve(p?j1.cwd():e,t.$ref),y=s.get(m);if(y&&!y.circular){let E=Object.keys(t);if(E.length>1){let k={};for(let O of E)O!=="$ref"&&!(O in y.value)&&(k[O]=t[O]);return{circular:y.circular,value:Object.assign({},y.value,k)}}return y}let b=o._resolve(m,e,l);if(b===null)return{circular:!1,value:null};let q=b.circular,C=q||n.has(b.value);C&&H1(e,o,l);let v=Dy.default.dereference(t,b.value);if(!C){let E=ix(v,b.path,r,n,i,s,o,l,c);C=E.circular,v=E.value}C&&!q&&l.dereference?.circular==="ignore"&&(v=t),q&&(v.$ref=r);let _={circular:C,value:v};return Object.keys(t).length===1&&s.set(m,_),_}function H1(t,e,r){if(e.circular=!0,r?.dereference?.onCircular?.(t),!r.dereference.circular)throw c5.ono.reference(`Circular $ref pointer found at ${t}`);return!0}});var V1=V(sx=>{"use strict";Object.defineProperty(sx,"__esModule",{value:!0});function p5(){return typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:typeof setImmediate=="function"?setImmediate:function(e){setTimeout(e,0)}}sx.default=p5()});var z1=V(hp=>{"use strict";var h5=hp&&hp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(hp,"__esModule",{value:!0});hp.default=m5;var W1=h5(V1());function m5(t,e){if(t){e.then(function(r){(0,W1.default)(function(){t(null,r)})},function(r){(0,W1.default)(function(){t(r)})});return}else return e}});var K1=V($e=>{"use strict";var g5=$e&&$e.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),y5=$e&&$e.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),v5=$e&&$e.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&g5(r,e,n[i]);return y5(r,e),r}})(),hl=$e&&$e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty($e,"__esModule",{value:!0});$e.getJsonSchemaRefParserDefaultOptions=$e.jsonSchemaParserNormalizeArgs=$e.dereferenceInternal=$e.JSONParserErrorGroup=$e.isHandledError=$e.UnmatchedParserError=$e.ParserError=$e.ResolverError=$e.MissingPointerError=$e.InvalidPointerError=$e.JSONParserError=$e.UnmatchedResolverError=$e.dereference=$e.bundle=$e.resolve=$e.parse=$e.$RefParser=void 0;var J1=hl(QT()),b5=hl(gC()),mp=hl(T1());$e.jsonSchemaParserNormalizeArgs=mp.default;var S5=hl($1()),w5=hl(F1()),Y1=hl(B1());$e.dereferenceInternal=Y1.default;var pl=v5(Gn()),Kn=Yn();Object.defineProperty($e,"JSONParserError",{enumerable:!0,get:function(){return Kn.JSONParserError}});Object.defineProperty($e,"InvalidPointerError",{enumerable:!0,get:function(){return Kn.InvalidPointerError}});Object.defineProperty($e,"MissingPointerError",{enumerable:!0,get:function(){return Kn.MissingPointerError}});Object.defineProperty($e,"ResolverError",{enumerable:!0,get:function(){return Kn.ResolverError}});Object.defineProperty($e,"ParserError",{enumerable:!0,get:function(){return Kn.ParserError}});Object.defineProperty($e,"UnmatchedParserError",{enumerable:!0,get:function(){return Kn.UnmatchedParserError}});Object.defineProperty($e,"UnmatchedResolverError",{enumerable:!0,get:function(){return Kn.UnmatchedResolverError}});Object.defineProperty($e,"isHandledError",{enumerable:!0,get:function(){return Kn.isHandledError}});Object.defineProperty($e,"JSONParserErrorGroup",{enumerable:!0,get:function(){return Kn.JSONParserErrorGroup}});var G1=Bo(),qi=hl(z1()),_5=XC();Object.defineProperty($e,"getJsonSchemaRefParserDefaultOptions",{enumerable:!0,get:function(){return _5.getJsonSchemaRefParserDefaultOptions}});var Jo=class t{constructor(){this.schema=null,this.$refs=new J1.default}async parse(){let e=(0,mp.default)(arguments),r;if(!e.path&&!e.schema){let i=(0,G1.ono)(`Expected a file path, URL, or object. Got ${e.path||e.schema}`);return(0,qi.default)(e.callback,Promise.reject(i))}this.schema=null,this.$refs=new J1.default;let n="http";if(pl.isFileSystemPath(e.path))e.path=pl.fromFileSystemPath(e.path),n="file";else if(!e.path&&e.schema&&"$id"in e.schema&&e.schema.$id){let i=pl.parse(e.schema.$id),s=i.protocol==="https:"?443:80;e.path=`${i.protocol}//${i.hostname}:${s}`}if(e.path=pl.resolve(pl.cwd(),e.path),e.schema&&typeof e.schema=="object"){let i=this.$refs._add(e.path);i.value=e.schema,i.pathType=n,r=Promise.resolve(e.schema)}else r=(0,b5.default)(e.path,this.$refs,e.options);try{let i=await r;if(i!==null&&typeof i=="object"&&!Buffer.isBuffer(i))return this.schema=i,(0,qi.default)(e.callback,Promise.resolve(this.schema));if(e.options.continueOnError)return this.schema=null,(0,qi.default)(e.callback,Promise.resolve(this.schema));throw G1.ono.syntax(`"${this.$refs._root$Ref.path||i}" is not a valid JSON Schema`)}catch(i){return!e.options.continueOnError||!(0,Kn.isHandledError)(i)?(0,qi.default)(e.callback,Promise.reject(i)):(this.$refs._$refs[pl.stripHash(e.path)]&&this.$refs._$refs[pl.stripHash(e.path)].addError(i),(0,qi.default)(e.callback,Promise.resolve(null)))}}static parse(){let e=new t;return e.parse.apply(e,arguments)}async resolve(){let e=(0,mp.default)(arguments);try{return await this.parse(e.path,e.schema,e.options),await(0,S5.default)(this,e.options),ox(this),(0,qi.default)(e.callback,Promise.resolve(this.$refs))}catch(r){return(0,qi.default)(e.callback,Promise.reject(r))}}static resolve(){let e=new t;return e.resolve.apply(e,arguments)}static bundle(){let e=new t;return e.bundle.apply(e,arguments)}async bundle(){let e=(0,mp.default)(arguments);try{return await this.resolve(e.path,e.schema,e.options),(0,w5.default)(this,e.options),ox(this),(0,qi.default)(e.callback,Promise.resolve(this.schema))}catch(r){return(0,qi.default)(e.callback,Promise.reject(r))}}static dereference(){let e=new t;return e.dereference.apply(e,arguments)}async dereference(){let e=(0,mp.default)(arguments);try{return await this.resolve(e.path,e.schema,e.options),(0,Y1.default)(this,e.options),ox(this),(0,qi.default)(e.callback,Promise.resolve(this.schema))}catch(r){return(0,qi.default)(e.callback,Promise.reject(r))}}};$e.$RefParser=Jo;$e.default=Jo;function ox(t){if(Kn.JSONParserErrorGroup.getParserErrors(t).length>0)throw new Kn.JSONParserErrorGroup(t)}$e.parse=Jo.parse;$e.resolve=Jo.resolve;$e.bundle=Jo.bundle;$e.dereference=Jo.dereference});var jy,ml,ax=ae(()=>{"use strict";jy=ve(K1()),ml=class{async resolve(e){try{return await jy.default.dereference(e,{dereference:{circular:"ignore"}})}catch(r){return console.error("[RefResolver] Failed to fully resolve $ref pointers:",r),e}}async bundle(e){try{return await jy.default.bundle(e)}catch(r){return console.error("[RefResolver] Failed to bundle $ref pointers:",r),e}}async resolveFile(e){try{return await jy.default.dereference(e,{dereference:{circular:"ignore"}})}catch(r){throw console.error(`[RefResolver] Failed to resolve file ${e}:`,r),r}}}});var Q1,Z1,R5,Hs,Ly=ae(()=>{"use strict";Q1=ve(require("fs")),Z1=ve(Xd());Un();JR();ax();R5=["application/json","text/plain","text/html","multipart/form-data","application/x-www-form-urlencoded"],Hs=class{constructor(e,r){this.collectionService=e;this.envConfigService=r;this.exampleGenerator=new al,this.refResolver=new ml}collectionService;envConfigService;exampleGenerator;refResolver;async import(e,r){let n=await Q1.promises.readFile(e,"utf-8"),i;e.endsWith(".yaml")||e.endsWith(".yml")?i=Z1.parse(n):i=JSON.parse(n),i=await this.refResolver.resolve(i);let s=i.components?.schemas||{},o=r?.collectionName||i.info?.title||"Imported API",c={id:Ot(o),name:o,description:i.info?.description||"",version:i.info?.version||"1.0.0",variables:{},items:[]};if(i.servers&&i.servers.length>0&&(c.variables.baseUrl=i.servers[0].url),i.security&&i.security.length>0&&i.components?.securitySchemes){let m=this.mapSecurityToAuth(i.security[0],i.components.securitySchemes);m&&(c.auth=m)}let d=new Map;if(i.tags)for(let m of i.tags){let y={type:"folder",id:Ot(m.name),name:m.name,description:m.description,items:[]};d.set(m.name,y),c.items.push(y)}if(i.paths)for(let[m,y]of Object.entries(i.paths))for(let b of["get","post","put","patch","delete","head","options","trace"]){let q=y[b];if(!q)continue;let C=this.processOperation(b,m,q,y,i,s),v=q.tags?.[0];if(v&&d.has(v))d.get(v).items.push(C);else if(v){let _={type:"folder",id:Ot(v),name:v,items:[C]};d.set(v,_),c.items.push(_)}else c.items.push(C)}await this.collectionService.saveCollection(c);let p;return r?.environmentName&&i.servers&&(p=await this.createEnvironmentFromServers(i.servers,r.environmentName)),{collection:c,environmentCreated:p}}processOperation(e,r,n,i,s,o){let l=Ot(n.operationId||`${e}-${r}`),c=`{{baseUrl}}${this.convertPathParams(r)}`,d=n.summary||n.operationId||`${e.toUpperCase()} ${r}`,p=n.deprecated===!0;p&&(d=`[DEPRECATED] ${d}`);let m={type:"request",id:l,name:d,method:e.toUpperCase(),url:c,description:n.description||"",deprecated:p},y=[...i.parameters||[],...n.parameters||[]];if(this.processParameters(m,y,o),n.requestBody&&this.processRequestBody(m,n.requestBody,o),n.responses&&(m.responseSchema=this.processResponses(n.responses,o)),n.security!==void 0&&s.components?.securitySchemes){if(Array.isArray(n.security)&&n.security.length===0)m.auth={type:"none"};else if(n.security&&n.security.length>0){let b=this.mapSecurityToAuth(n.security[0],s.components.securitySchemes);b&&(m.auth=b)}}return m}convertPathParams(e){return e.replace(/\{(\w+)\}/g,":$1")}processParameters(e,r,n){let i=[],s=[],o={},l=[];for(let c of r){let d=c.name,p=c.in,m=c.schema||{},y=c.example!==void 0?String(c.example):this.generateExampleForParam(m,n),b=c.deprecated===!0;switch(p){case"path":{if(c.description||m.type||m.format||m.enum||b||m.pattern||m.minimum!==void 0||m.maximum!==void 0||m.minLength!==void 0||m.maxLength!==void 0||m.multipleOf!==void 0||m.minItems!==void 0||m.maxItems!==void 0||m.uniqueItems||m.nullable||m.oneOf){let C={value:y};m.oneOf?(C.oneOf=m.oneOf,this.applyOneOfHints(C,m.oneOf)):(m.type&&(C.type=m.type),m.format&&(C.format=m.format),m.enum&&(C.enum=m.enum.map(String)),m.pattern&&(C.pattern=m.pattern),m.minimum!==void 0&&(C.minimum=m.minimum),m.maximum!==void 0&&(C.maximum=m.maximum),m.exclusiveMinimum!==void 0&&(C.exclusiveMinimum=m.exclusiveMinimum),m.exclusiveMaximum!==void 0&&(C.exclusiveMaximum=m.exclusiveMaximum),m.multipleOf!==void 0&&(C.multipleOf=m.multipleOf),m.minLength!==void 0&&(C.minLength=m.minLength),m.maxLength!==void 0&&(C.maxLength=m.maxLength),m.minItems!==void 0&&(C.minItems=m.minItems),m.maxItems!==void 0&&(C.maxItems=m.maxItems),m.uniqueItems&&(C.uniqueItems=!0),m.nullable&&(C.nullable=!0)),c.description&&(C.description=c.description),b&&(C.deprecated=!0),o[d]=C}else o[d]=y;break}case"query":{let q={key:d,value:y};this.applySchemaConstraints(q,m,c,b),s.push(q);break}case"header":{let q={key:d,value:y};this.applySchemaConstraints(q,m,c,b),i.push(q);break}case"cookie":{l.push(`${d}={{${d}}}`);break}}}l.length>0&&i.push({key:"Cookie",value:l.join("; ")}),Object.keys(o).length>0&&(e.params=o),s.length>0&&(e.query=s),i.length>0&&(e.headers=i)}applySchemaConstraints(e,r,n,i){r.oneOf?(e.oneOf=r.oneOf,this.applyOneOfHints(e,r.oneOf)):(r.type&&(e.type=r.type),r.format&&(e.format=r.format),r.enum&&(e.enum=r.enum.map(String)),r.pattern&&(e.pattern=r.pattern),r.minimum!==void 0&&(e.minimum=r.minimum),r.maximum!==void 0&&(e.maximum=r.maximum),r.exclusiveMinimum!==void 0&&(e.exclusiveMinimum=r.exclusiveMinimum),r.exclusiveMaximum!==void 0&&(e.exclusiveMaximum=r.exclusiveMaximum),r.multipleOf!==void 0&&(e.multipleOf=r.multipleOf),r.minLength!==void 0&&(e.minLength=r.minLength),r.maxLength!==void 0&&(e.maxLength=r.maxLength),r.minItems!==void 0&&(e.minItems=r.minItems),r.maxItems!==void 0&&(e.maxItems=r.maxItems),r.uniqueItems&&(e.uniqueItems=!0),r.nullable&&(e.nullable=!0)),n.required&&(e.required=!0),n.description&&(e.description=n.description),i&&(e.deprecated=!0)}applyOneOfHints(e,r){let n=[],i=new Set;for(let s of r)s.type&&i.add(s.type),s.enum&&n.push(...s.enum.map(String));i.size===1&&(e.type=[...i][0]),n.length>0&&(e.enum=[...new Set(n)])}generateExampleForParam(e,r){if(!e)return"";let n=this.exampleGenerator.generate(e,{components:r});return n==null?"":String(n)}processRequestBody(e,r,n){if(!r.content)return;let i=Object.keys(r.content);if(i.length===0)return;let s=this.selectPrimaryContentType(i),o=r.content[s],{bodyType:l,bodyFormat:c}=this.mapContentTypeToBodyType(s);if(e.body={type:l,...c&&{format:c},content:""},o){let p=this.generateBodyContent(o,s,n);p!==void 0&&(e.body.content=typeof p=="string"?p:JSON.stringify(p,null,2)),l==="form-data"&&o.schema?.properties&&(e.body.content=this.buildFormDataEntries(o.schema,n)),l==="x-www-form-urlencoded"&&o.schema?.properties&&(e.body.content=this.buildFormDataEntries(o.schema,n))}let d=this.buildBodySchema(r,s,n);d&&(e.bodySchema=d)}selectPrimaryContentType(e){for(let i of R5)if(e.includes(i))return i;let r=e.find(i=>i.includes("json"));if(r)return r;let n=e.find(i=>i.startsWith("text/"));return n||e[0]}mapContentTypeToBodyType(e){return e.includes("json")?{bodyType:"raw",bodyFormat:"json"}:e==="application/xml"||e==="text/xml"?{bodyType:"raw",bodyFormat:"xml"}:e==="text/html"?{bodyType:"raw",bodyFormat:"html"}:e.startsWith("text/")?{bodyType:"raw",bodyFormat:"text"}:e==="multipart/form-data"?{bodyType:"form-data"}:e==="application/x-www-form-urlencoded"?{bodyType:"x-www-form-urlencoded"}:e==="application/octet-stream"?{bodyType:"binary"}:{bodyType:"raw",bodyFormat:"text"}}generateBodyContent(e,r,n){if(e.example!==void 0)return e.example;if(e.examples){let i=Object.values(e.examples)[0];if(i?.value!==void 0)return i.value}if(e.schema)return this.exampleGenerator.generate(e.schema,{omitReadOnly:!0,components:n})}buildFormDataEntries(e,r){let n=[],i=e.properties||{},s=new Set(e.required||[]);for(let[o,l]of Object.entries(i)){let c=l,d=c.type==="string"&&c.format==="binary",p={key:o,value:d?"":String(this.exampleGenerator.generate(c,{components:r})||""),type:d?"file":"text",enabled:!0};n.push(p)}return n}buildBodySchema(e,r,n){let i=Object.keys(e.content),s=e.content[r];if(!s?.schema)return;let o={contentType:r,schema:s.schema};if(i.length>1){o.content={};for(let c of i){let d=e.content[c],p={};d.schema&&(p.schema=d.schema),d.examples&&(p.examples=d.examples),d.encoding&&(p.encoding=d.encoding),o.content[c]=p}}s.encoding&&(o.encoding=s.encoding);let l=this.extractUsedComponents(s.schema,n);return Object.keys(l).length>0&&(o.components=l),o}processResponses(e,r){let n={responses:{}},i={};for(let[s,o]of Object.entries(e)){let l=o,c={description:l.description||`Status ${s}`};if(l.content){let d=Object.keys(l.content);if(d.length===1){let p=d[0],m=l.content[p];c.contentType=p,m.schema&&(c.schema=m.schema),m.examples&&(c.examples=m.examples),m.schema&&Object.assign(i,this.extractUsedComponents(m.schema,r))}else{c.content={};for(let p of d){let m=l.content[p],y={};m.schema&&(y.schema=m.schema),m.examples&&(y.examples=m.examples),c.content[p]=y,m.schema&&Object.assign(i,this.extractUsedComponents(m.schema,r))}}}if(l.headers){c.headers={};for(let[d,p]of Object.entries(l.headers)){let m=p;c.headers[d]={...m.description&&{description:m.description},schema:m.schema||{type:"string"}}}}n.responses[s]=c}return Object.keys(i).length>0&&(n.components=i),n}mapSecurityToAuth(e,r){let n=Object.keys(e)[0];if(!n)return;let i=r[n];if(i)switch(i.type){case"http":if(i.scheme==="bearer")return{type:"bearer",bearerToken:""};if(i.scheme==="basic")return{type:"basic",basicAuth:{username:"",password:""}};break;case"apiKey":return{type:"apikey",apikey:{key:i.name||"X-Api-Key",value:"",in:i.in||"header"}};case"oauth2":{let s=i.flows||{},o=s.authorizationCode||s.clientCredentials||s.password||s.implicit||{},l="client_credentials";return s.authorizationCode?l="authorization_code":s.password?l="password":s.implicit&&(l="implicit"),{type:"oauth2",oauth2:{grantType:l,tokenUrl:o.tokenUrl||"",authUrl:o.authorizationUrl||"",clientId:"",clientSecret:"",scope:Object.keys(o.scopes||{}).join(" ")}}}}}async createEnvironmentFromServers(e,r){if(e.length>0){let n=e[0].url;this.envConfigService.setEnvironmentVariable("baseUrl",n)}return r}extractUsedComponents(e,r,n){let i=n||{};if(!e)return i;if(e.$ref){let s=this.extractRefName(e.$ref);s&&r[s]&&!i[s]&&(i[s]=r[s],this.extractUsedComponents(r[s],r,i))}if(e.properties)for(let s of Object.values(e.properties))this.extractUsedComponents(s,r,i);e.items&&this.extractUsedComponents(e.items,r,i);for(let s of["allOf","oneOf","anyOf"])if(e[s])for(let o of e[s])this.extractUsedComponents(o,r,i);return e.additionalProperties&&typeof e.additionalProperties=="object"&&this.extractUsedComponents(e.additionalProperties,r,i),i}extractRefName(e){return e.match(/^#\/components\/schemas\/(.+)$/)?.[1]}}});var gl,lx=ae(()=>{"use strict";gl=class{constructor(e,r,n){this.historyAnalyzer=e;this.scriptAnalyzer=r;this.inferrer=n}historyAnalyzer;scriptAnalyzer;inferrer;async infer(e,r,n,i){let s=await this.historyAnalyzer.analyze(e,r,{environment:i?.environment}),o;return i?.postResponseScript&&(o=this.scriptAnalyzer.analyze(i.postResponseScript)),this.mergeResponseSchemas(n,s,o)}async inferBodySchema(e,r,n,i,s){let o,l;if(r==="raw"&&n==="json"&&e){let c=e;if(typeof e=="string")try{c=JSON.parse(e)}catch{return}o=this.inferrer.inferFromValue(c),l="application/json"}else r==="form-data"&&i?(o=this.buildFormDataSchema(i),l="multipart/form-data"):r==="x-www-form-urlencoded"&&i?(o=this.buildFormDataSchema(i),l="application/x-www-form-urlencoded"):r==="raw"&&n==="xml"?(o={type:"string"},l="application/xml"):r==="raw"&&(n==="text"||n==="html")?(o={type:"string"},l=n==="html"?"text/html":"text/plain"):r==="binary"?(o={type:"string",format:"binary"},l="application/octet-stream"):r==="graphql"&&(o={type:"object",properties:{query:{type:"string"},variables:{type:"object"}}},l="application/json");if(o)return s?this.mergeBodySchemaWithExisting(o,s):{contentType:l,schema:o}}buildFormDataSchema(e){let r={type:"object",properties:{}},n=[];for(let i of e){if(!i.enabled&&i.enabled!==void 0)continue;let s={};i.type?s.type=i.type:s.type="string",i.description&&(s.description=i.description),i.format&&(s.format=i.format),i.enum&&(s.enum=i.enum),i.type==="file"&&(s.type="string",s.format="binary"),r.properties[i.key]=s,i.required&&n.push(i.key)}return n.length>0&&(r.required=n),r}mergeResponseSchemas(e,r,n){let i={responses:{}};for(let[s,o]of Object.entries(r.responses))i.responses[s]={...o};if(n&&this.applyScriptHints(i,n),e){for(let[s,o]of Object.entries(e.responses))i.responses[s]?i.responses[s]=this.mergeResponseDefinitions(i.responses[s],o):i.responses[s]={...o};e.components&&(i.components={...e.components})}return i}applyScriptHints(e,r){for(let n of r.expectedStatuses){let i=String(n);e.responses[i]||(e.responses[i]={description:`Status ${n}`})}for(let[,n]of Object.entries(e.responses))n.schema&&this.augmentSchemaWithHints(n.schema,r)}augmentSchemaWithHints(e,r){if(!(e.type!=="object"||!e.properties))for(let n of r.fieldPaths){let i=n.split(".");this.ensureFieldPath(e,i,r)}}ensureFieldPath(e,r,n,i=""){if(r.length===0||e.type!=="object")return;e.properties||(e.properties={});let s=r[0],o=s.endsWith("[]"),l=o?s.slice(0,-2):s,c=i?`${i}.${s}`:s,d=r.slice(1);if(!e.properties[l])if(o)e.properties[l]={type:"array",items:{type:"object"}};else if(d.length>0)e.properties[l]={type:"object",properties:{}};else{let p=n.typeHints[c];e.properties[l]={type:p||"string"};return}if(d.length>0){let p=o?e.properties[l].items:e.properties[l];p&&this.ensureFieldPath(p,d,n,c)}}mergeResponseDefinitions(e,r){let n={...e};return r.description&&(n.description=r.description),r.contentType&&(n.contentType=r.contentType),r.schema&&e.schema?n.schema=this.inferrer.mergeSchemas(e.schema,r.schema):r.schema&&(n.schema=r.schema),r.examples&&(n.examples={...e.examples||{},...r.examples}),r.content&&(n.content={...e.content||{},...r.content}),r.headers&&(n.headers={...e.headers||{},...r.headers}),n}mergeBodySchemaWithExisting(e,r){let n={...r};return r.schema?n.schema=this.inferrer.mergeSchemas(e,r.schema):n.schema=e,n}}});var X1,Uy,eN,tN,rN,nN,iN,yl,ux=ae(()=>{"use strict";X1=/(?:jsonData|responseJson|data|json|body|response\.json\(\))\.([a-zA-Z_][\w.\[\]]*)/g,Uy="(?:pm|hf|ctx)",eN=new RegExp(`${Uy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.be\\.(?:a|an)\\(['"](\\w+)['"]\\)`,"g"),tN=new RegExp(`${Uy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.(?:equal|eql)\\((.+?)\\)`,"g"),rN=/(?:to\.have\.status|response\.code.*?equal)\((\d+)\)/g,nN=new RegExp(`${Uy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.be\\.(true|false)`,"g"),iN=new RegExp(`${Uy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.have\\.(?:lengthOf|length\\.above|length\\.below)`,"g"),yl=class{analyze(e){let r={fieldPaths:[],typeHints:{},valueHints:{},expectedStatuses:[]};if(!e||e.trim().length===0)return r;let n=this.stripComments(e);return this.extractFieldPaths(n,r),this.extractTypeAssertions(n,r),this.extractEqualityAssertions(n,r),this.extractBooleanAssertions(n,r),this.extractLengthAssertions(n,r),this.extractStatusAssertions(n,r),r.fieldPaths=[...new Set(r.fieldPaths)],r.expectedStatuses=[...new Set(r.expectedStatuses)],r}stripComments(e){let r=e.replace(/\/\*[\s\S]*?\*\//g,"");return r=r.replace(/\/\/.*$/gm,""),r}extractFieldPaths(e,r){let n,i=new RegExp(X1.source,X1.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]);s&&!this.isCommonMethodCall(s)&&r.fieldPaths.push(s)}}extractTypeAssertions(e,r){let n,i=new RegExp(eN.source,eN.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]),o=n[2].toLowerCase();s&&(r.typeHints[s]=this.mapAssertionType(o),r.fieldPaths.includes(s)||r.fieldPaths.push(s))}}extractEqualityAssertions(e,r){let n,i=new RegExp(tN.source,tN.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]),o=n[2].trim();if(s){let l=this.parseAssertionValue(o);l!==void 0&&(r.valueHints[s]=l,typeof l=="string"?r.typeHints[s]=r.typeHints[s]||"string":typeof l=="number"?r.typeHints[s]=r.typeHints[s]||(Number.isInteger(l)?"integer":"number"):typeof l=="boolean"&&(r.typeHints[s]=r.typeHints[s]||"boolean")),r.fieldPaths.includes(s)||r.fieldPaths.push(s)}}}extractBooleanAssertions(e,r){let n,i=new RegExp(nN.source,nN.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]);s&&(r.typeHints[s]="boolean",r.valueHints[s]=n[2]==="true",r.fieldPaths.includes(s)||r.fieldPaths.push(s))}}extractLengthAssertions(e,r){let n,i=new RegExp(iN.source,iN.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]);s&&(r.typeHints[s]=r.typeHints[s]||"array",r.fieldPaths.includes(s)||r.fieldPaths.push(s))}}extractStatusAssertions(e,r){let n,i=new RegExp(rN.source,rN.flags);for(;(n=i.exec(e))!==null;){let s=parseInt(n[1],10);!isNaN(s)&&s>=100&&s<600&&r.expectedStatuses.push(s)}}normalizeFieldPath(e){let r=e.replace(/^\./,"");return r=r.replace(/\[\d+\]/g,"[]"),r}isCommonMethodCall(e){return new Set(["to","be","have","not","deep","any","all","that","is","has","include","includes","equal","eql","above","below","least","most","within","length","lengthOf","match","string","keys","key","property","ownProperty","status","header","json","text"]).has(e.split(".")[0])}mapAssertionType(e){return{string:"string",number:"number",object:"object",array:"array",boolean:"boolean",null:"null",undefined:"null",int:"integer",integer:"integer",float:"number",double:"number"}[e]||"string"}parseAssertionValue(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let r=Number(e);return!isNaN(r)&&e.trim().length>0?r:e==="true"?!0:e==="false"?!1:e==="null"?null:e}}});var sN={};Rs(sN,{AwsSecretResolver:()=>gp});var gp,cx=ae(()=>{"use strict";gp=class{providerName="aws";region;moduleRequire;constructor(e,r){this.region=e.region??process.env.AWS_DEFAULT_REGION??process.env.AWS_REGION,this.moduleRequire=r??(n=>require(n))}async resolve(e){let r=e.lastIndexOf("#"),n=r>=0?e.slice(0,r):e,i=r>=0?e.slice(r+1):void 0;try{let{SecretsManagerClient:s,GetSecretValueCommand:o}=this.moduleRequire("@aws-sdk/client-secrets-manager"),c=await new s(this.region?{region:this.region}:{}).send(new o({SecretId:n})),d=c.SecretString??(c.SecretBinary?Buffer.from(c.SecretBinary).toString("utf-8"):void 0);if(d===void 0)return;if(i)try{let p=JSON.parse(d);return p[i]!==void 0?String(p[i]):void 0}catch{return}return d}catch(s){throw s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND"?new Error("[HTTP Forge] AWS secret resolver requires @aws-sdk/client-secrets-manager. Install it in your project: npm install @aws-sdk/client-secrets-manager"):s}}}});var oN={};Rs(oN,{AzureKeyVaultResolver:()=>yp});var yp,fx=ae(()=>{"use strict";yp=class{providerName="azure";vaultUrl;moduleRequire;constructor(e,r){let n=(e.vaultUrl||process.env.AZURE_KEYVAULT_URL)??"";this.vaultUrl=n.replace(/\/$/,""),this.moduleRequire=r??(i=>require(i))}async resolve(e){if(!this.vaultUrl)throw new Error("[HTTP Forge] Azure Key Vault resolver: no vault URL configured. Set secrets.providers.<alias>.vaultUrl or the AZURE_KEYVAULT_URL env var.");let r=e.split("/"),n=r[0],i=r[1];try{let{SecretClient:s}=this.moduleRequire("@azure/keyvault-secrets"),{DefaultAzureCredential:o}=this.moduleRequire("@azure/identity"),l=new o;return(await new s(this.vaultUrl,l).getSecret(n,i?{version:i}:{})).value}catch(s){throw s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND"?new Error("[HTTP Forge] Azure Key Vault resolver requires @azure/keyvault-secrets and @azure/identity. Install them: npm install @azure/keyvault-secrets @azure/identity"):s}}}});var aN={};Rs(aN,{HashiCorpVaultResolver:()=>vp});var vp,dx=ae(()=>{"use strict";vp=class{providerName="vault";address;mountPath;namespace;constructor(e){this.address=(e.address??process.env.VAULT_ADDR??"http://127.0.0.1:8200").replace(/\/$/,""),this.mountPath=e.mountPath??"secret",this.namespace=e.namespace??process.env.VAULT_NAMESPACE}async resolve(e){let r=e.lastIndexOf("#"),n=r>=0?e.slice(0,r):e,i=r>=0?e.slice(r+1):void 0,s=process.env.VAULT_TOKEN;if(!s)throw new Error("[HTTP Forge] HashiCorp Vault resolver requires VAULT_TOKEN environment variable to be set.");let o=`${this.address}/v1/${this.mountPath}/data/${n}`,l={"X-Vault-Token":s};this.namespace&&(l["X-Vault-Namespace"]=this.namespace);let c;try{c=await fetch(o,{headers:l})}catch(y){throw new Error(`[HTTP Forge] Vault request failed: ${y?.message??y}`)}if(c.status===404)return;if(!c.ok)throw new Error(`[HTTP Forge] Vault returned HTTP ${c.status} for path: ${n}`);let p=(await c.json())?.data?.data;if(!p)return;if(i)return p[i]!==void 0?String(p[i]):void 0;if("value"in p)return String(p.value);let m=Object.keys(p);return m.length===1?String(p[m[0]]):void 0}}});var cN={};Rs(cN,{OnePasswordResolver:()=>bp});var lN,uN,C5,bp,px=ae(()=>{"use strict";lN=require("child_process"),uN=require("util"),C5=(0,uN.promisify)(lN.execFile),bp=class{providerName="1password";defaultVault;constructor(e){this.defaultVault=e.vault}async resolve(e){let r=e.split("/"),n,i,s;if(this.defaultVault){if(r.length<2)throw new Error(`[HTTP Forge] 1Password path "${e}" must be "<item>/<field>" when vault is set in config.`);n=this.defaultVault,i=r.slice(0,r.length-1).join("/"),s=r[r.length-1]}else{if(r.length<3)throw new Error(`[HTTP Forge] 1Password path "${e}" must be "<vault>/<item>/<field>".`);n=r[0],i=r.slice(1,r.length-1).join("/"),s=r[r.length-1]}let o=await this.tryResolveSdk(n,i,s);return o!==null?o:this.resolveViaCli(n,i,s)}async tryResolveSdk(e,r,n){let i=process.env.OP_SERVICE_ACCOUNT_TOKEN;if(!i)return null;try{let{createClient:s}=require("@1password/sdk"),o=await s({auth:i,integrationName:"HTTP Forge",integrationVersion:"1.0.0"}),l=`op://${e}/${r}/${n}`;return await o.secrets.resolve(l)}catch(s){if(s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND")return null;throw new Error(`[HTTP Forge] 1Password SDK error for "${e}/${r}/${n}": ${s?.message??s}`)}}async resolveViaCli(e,r,n){try{let{stdout:i}=await C5("op",["item","get",r,"--vault",e,"--field",n,"--format","json"],{env:{...process.env},timeout:1e4}),s=JSON.parse(i.trim());return typeof s=="string"?s:s&&typeof s.value=="string"?s.value:void 0}catch(i){if(i?.code==="ENOENT")throw new Error("[HTTP Forge] 1Password resolver requires either the @1password/sdk npm package or the `op` CLI to be installed.\n Service Account: set OP_SERVICE_ACCOUNT_TOKEN and install @1password/sdk\n CLI: install 1Password CLI and run `op signin`");if(i?.stderr?.includes("not found")||i?.code===1)return;throw new Error(`[HTTP Forge] 1Password CLI error: ${i?.message??i}`)}}}});var fN={};Rs(fN,{GcpSecretResolver:()=>Sp});var Sp,hx=ae(()=>{"use strict";Sp=class{providerName="gcp";projectId;moduleRequire;constructor(e,r){this.projectId=e.projectId??process.env.GOOGLE_CLOUD_PROJECT??process.env.GCLOUD_PROJECT??process.env.GCP_PROJECT,this.moduleRequire=r??(n=>require(n))}async resolve(e){let r=e.split("/"),n=r[0],i=r[1]==="versions"&&r[2]?r[2]:"latest";if(!this.projectId)throw new Error("[HTTP Forge] GCP secret resolver: no projectId configured and GOOGLE_CLOUD_PROJECT env var is not set.");try{let{SecretManagerServiceClient:s}=this.moduleRequire("@google-cloud/secret-manager"),o=new s,l=`projects/${this.projectId}/secrets/${n}/versions/${i}`,[c]=await o.accessSecretVersion({name:l}),d=c.payload?.data;return d?Buffer.isBuffer(d)?d.toString("utf-8"):Buffer.from(d).toString("utf-8"):void 0}catch(s){throw s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND"?new Error("[HTTP Forge] GCP secret resolver requires @google-cloud/secret-manager. Install it: npm install @google-cloud/secret-manager"):s}}}});var pN={};Rs(pN,{DopplerResolver:()=>wp});var dN,wp,mx=ae(()=>{"use strict";dN=ve(require("https")),wp=class{providerName="doppler";token;constructor(e){this.token=e.serviceToken??process.env.DOPPLER_TOKEN}async resolve(e){let r=e.trim().toUpperCase(),n=this.token;if(!n)throw new Error("[HTTP Forge] Doppler secret resolver: no service token found. Set DOPPLER_TOKEN env var or add serviceToken to config.");let i=`https://api.doppler.com/v3/configs/config/secret?name=${encodeURIComponent(r)}`;return new Promise((s,o)=>{let l=dN.request(i,{method:"GET",headers:{Authorization:`Bearer ${n}`,Accept:"application/json"}},c=>{let d=[];c.on("data",p=>d.push(p)),c.on("end",()=>{let p=Buffer.concat(d).toString("utf-8");if(c.statusCode===404){s(void 0);return}if(c.statusCode!==200){o(new Error(`[HTTP Forge] Doppler API returned ${c.statusCode} for secret "${r}": ${p}`));return}try{let y=JSON.parse(p)?.value?.computed;s(y!=null?String(y):void 0)}catch{o(new Error(`[HTTP Forge] Doppler API returned non-JSON response for secret "${r}"`))}})});l.on("error",o),l.end()})}}});var Hy,hN,mN,Ac,gx=ae(()=>{"use strict";Hy=ve(require("fs")),hN=require("module"),mN=ve(require("path")),Ac=class{resolvers=new Map;moduleRequire;constructor(e){if(this.moduleRequire=this.buildModuleRequire(e),!e)return;let r;try{r=e.getConfig().secrets}catch{return}if(!(!r?.providers||typeof r.providers!="object"))for(let[n,i]of Object.entries(r.providers))try{let s=this.createResolver(i);s&&this.resolvers.set(n,s)}catch{}}async resolveSecretTokens(e,r){let n=r??new Map,i=new Set;if(this.collectTokens(e,i),i.size===0)return{};await Promise.all(Array.from(i).map(async o=>{if(n.has(o))return;let l=o.slice(7),c=l.indexOf("/");if(c<0)return;let d=l.slice(0,c),p=l.slice(c+1),m=this.resolvers.get(d);if(m)try{let y=await m.resolve(p);y!==void 0&&n.set(o,y)}catch(y){let b=y?.message??String(y);console.warn(`[HTTP Forge] {{${o}}} could not be resolved: ${b}`)}}));let s={};for(let[o,l]of n.entries())s[o]=l;return s}get hasProviders(){return this.resolvers.size>0}collectTokens(e,r){if(typeof e=="string"){let n=/\{\{(secret:[^}]+)\}\}/g,i;for(;(i=n.exec(e))!==null;)r.add(i[1])}else Array.isArray(e)?e.forEach(n=>this.collectTokens(n,r)):e!==null&&typeof e=="object"&&Object.values(e).forEach(n=>this.collectTokens(n,r))}createResolver(e){switch(e.provider){case"aws":{let{AwsSecretResolver:r}=(cx(),Oa(sN));return new r(e,this.moduleRequire)}case"azure":{let{AzureKeyVaultResolver:r}=(fx(),Oa(oN));return new r(e,this.moduleRequire)}case"vault":{let{HashiCorpVaultResolver:r}=(dx(),Oa(aN));return new r(e)}case"1password":{let{OnePasswordResolver:r}=(px(),Oa(cN));return new r(e)}case"gcp":{let{GcpSecretResolver:r}=(hx(),Oa(fN));return new r(e,this.moduleRequire)}case"doppler":{let{DopplerResolver:r}=(mx(),Oa(pN));return new r(e)}default:return}}buildModuleRequire(e){let r=i=>require(i);if(!e)return r;let n=[];try{n=e.getModulePaths()??[]}catch{return r}for(let i of n)try{let s=mN.resolve(i,"package.json");if(Hy.existsSync(s)){let o=Hy.realpathSync(s),l=(0,hN.createRequire)(o);return c=>{try{return l(c)}catch{return r(c)}}}}catch{}return r}}});function vr(t){return t.replace(/\//g,"%2F")}function yx(t){return t.replace(/%2F/gi,"/")}function rs(t){return t?t.split("/").map(yx).join(" / "):""}function _p(t){return t.includes(" / ")?t.split(" / ").map(e=>vr(e.trim())).join("/"):vr(t)}function nt(t,e=t.items,r=""){let n=[];for(let i of e)if(i.type==="request")n.push({request:i,folderPath:r});else{let s=i,o=vr(s.name),l=r?`${r}/${o}`:o;n.push(...nt(t,s.items??[],l))}return n}function Vr(t,e=t.items,r=""){let n=[];for(let i of e)if(i.type==="folder"){let s=i,o=vr(s.name),l=r?`${r}/${o}`:o;n.push({folderId:s.id,folderPath:l,requestCount:By(s.items??[])}),n.push(...Vr(t,s.items??[],l))}return n}function By(t){let e=0;for(let r of t)r.type==="request"?e++:e+=By(r.items??[]);return e}var Oi=ae(()=>{"use strict"});var Go,vx=ae(()=>{"use strict";Go={iterations:1,delayBetweenRequests:0,stopOnError:!1,readFromSharedSession:!1,writeToSharedSession:!1}});var St,Ii,Tc,bx=ae(()=>{"use strict";St=ve(require("fs")),Ii=ve(require("path"));Oi();Un();vx();Tc=class{constructor(e,r,n){this.collectionService=e;this.configService=r;this.suitesDir=r.getSuitesPath(),this.onSuitesChanged=n?.onSuitesChanged,this.ensureSuitesDir(),this.loadSuites(),n?.watch!==!1&&this.setupFileWatcher()}collectionService;configService;suitesDir;suites=new Map;fileWatcher=null;debounceTimer=null;onSuitesChanged;ensureSuitesDir(){St.existsSync(this.suitesDir)||St.mkdirSync(this.suitesDir,{recursive:!0})}setupFileWatcher(){try{this.fileWatcher=St.watch(this.suitesDir,(e,r)=>{r&&!r.endsWith(".suite.json")||(this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.loadSuites(),this.onSuitesChanged?.()},200))}),this.fileWatcher.on("error",()=>{})}catch{}}dispose(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.fileWatcher?.close(),this.fileWatcher=null}loadSuites(){if(this.suites.clear(),!St.existsSync(this.suitesDir))return;let e=St.readdirSync(this.suitesDir);for(let r of e)if(r.endsWith(".suite.json"))try{let n=Ii.join(this.suitesDir,r),i=St.readFileSync(n,"utf-8"),s=JSON.parse(i),o=Array.isArray(s.nodes)&&s.nodes.length>0?s.nodes:(Array.isArray(s.requests)?s.requests:[]).map(c=>({type:"request",name:c.description||c.name,request:c,enabled:c.enabled!==!1})),l={id:s.id,name:s.name,description:s.description,scripts:s.scripts,nodes:o,config:s.config??{...Go},isTemporary:s.isTemporary,createdAt:s.createdAt??Date.now(),updatedAt:s.updatedAt??Date.now()};l.id&&l.name&&this.suites.set(l.id,l)}catch(n){console.error(`[TestSuiteService] Failed to load ${r}:`,n)}}async getAllSuites(){return Array.from(this.suites.values())}async getSuite(e){return this.suites.get(e)}async createSuite(e){let r=Date.now(),n={id:Ot(e),name:e,nodes:[],config:{...Go},createdAt:r,updatedAt:r};return await this.saveSuiteToDisk(n),this.suites.set(n.id,n),n}async updateSuite(e){e.updatedAt=Date.now(),await this.saveSuiteToDisk(e),this.suites.set(e.id,e)}async duplicateSuite(e,r){let n=this.suites.get(e);if(!n)throw new Error(`Suite not found: ${e}`);let i=n.nodes||[],s=await this.createSuite(r);s.nodes=i.map(c=>({...c})),s.config={...n.config},s.description=n.description;let o=Ii.join(this.suitesDir,e),l=Ii.join(this.suitesDir,s.id);return St.existsSync(o)&&this.copyDirRecursive(o,l),await this.saveSuiteToDisk(s),this.suites.set(s.id,s),s}copyDirRecursive(e,r){St.existsSync(r)||St.mkdirSync(r,{recursive:!0});for(let n of St.readdirSync(e,{withFileTypes:!0})){let i=Ii.join(e,n.name),s=Ii.join(r,n.name);n.isDirectory()?this.copyDirRecursive(i,s):St.copyFileSync(i,s)}}async deleteSuite(e){let r=this.suites.get(e);if(!r)return!1;let n=`${r.id}.suite.json`,i=Ii.join(this.suitesDir,n),s=Ii.join(this.suitesDir,r.id);try{return St.existsSync(i)&&St.unlinkSync(i),St.existsSync(s)&&St.rmSync(s,{recursive:!0,force:!0}),this.suites.delete(e),!0}catch(o){return console.error("[TestSuiteService] Failed to delete suite:",o),!1}}async createTempSuiteFromCollection(e){let r=this.collectionService.getCollection(e);if(!r){console.error(`[TestSuiteService] Collection not found: ${e}`);return}let n=[];this.extractRequestsFromCollection(r,e,r.name,"",n);let i=n.map(l=>({type:"request",name:l.description||l.name,request:l,enabled:l.enabled!==!1})),s=Date.now();return{id:`temp-${e}`,name:r.name,nodes:i,config:{...Go},isTemporary:!0,createdAt:s,updatedAt:s}}async createTempSuiteFromFolder(e,r,n=!0){let i=this.collectionService.getCollection(e);if(!i){console.error(`[TestSuiteService] Collection not found: ${e}`);return}let s=[];this.extractRequestsFromCollection(i,e,i.name,"",s);let o=r.replace(/\/+$/,""),l=s.filter(m=>n?m.folderPath===o||m.folderPath.startsWith(`${o}/`):m.folderPath===o);if(l.length===0){console.error(`[TestSuiteService] No requests under folder "${r}" in collection: ${e}`);return}let c=l.map(m=>({type:"request",name:m.description||m.name,request:m,enabled:m.enabled!==!1})),d=Date.now();return{id:`temp-${e}-${this.slugifyFolderPath(o)}`,name:`${i.name} / ${rs(o)}`,nodes:c,config:{...Go},isTemporary:!0,createdAt:d,updatedAt:d}}slugifyFolderPath(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}async saveTempSuite(e,r){let n=Date.now(),i=Ii.join(this.suitesDir,e.id),s={...e,id:Ot(r),name:r,isTemporary:!1,createdAt:n,updatedAt:n},o=Ii.join(this.suitesDir,s.id);return St.existsSync(i)&&(St.existsSync(o)&&St.rmSync(o,{recursive:!0,force:!0}),St.renameSync(i,o)),await this.saveSuiteToDisk(s),this.suites.set(s.id,s),s}getAllAvailableRequests(){let e=[],r=this.collectionService.getAllCollections();for(let n of r)this.extractRequestsFromCollection(n,n.id,n.name,"",e);return e}extractRequestsFromCollection(e,r,n,i,s){if(e.requests)for(let o of e.requests)s.push({collectionId:r,collectionName:n,requestId:o.id,name:o.name||"Unnamed Request",method:o.method||"GET",folderPath:i});if(e.items)for(let o of e.items)if(o.items||o.folders||o.requests){let l=i?`${i}/${vr(o.name)}`:vr(o.name);this.extractRequestsFromCollection(o,r,n,l,s)}else s.push({collectionId:r,collectionName:n,requestId:o.id,name:o.name||"Unnamed Request",method:o.method||"GET",folderPath:i});if(e.folders)for(let o of e.folders){let l=i?`${i}/${vr(o.name)}`:vr(o.name);this.extractRequestsFromCollection(o,r,n,l,s)}}async saveSuiteToDisk(e){this.ensureSuitesDir();let r=`${e.id}.suite.json`,n=Ii.join(this.suitesDir,r),i=`${n}.tmp-${process.pid}-${Date.now()}`,s={id:e.id,name:e.name,description:e.description,scripts:e.scripts,nodes:Array.isArray(e.nodes)?e.nodes:[],config:e.config??{...Go},isTemporary:e.isTemporary,createdAt:e.createdAt??Date.now(),updatedAt:e.updatedAt??Date.now()},o=JSON.stringify(s,null,2);St.writeFileSync(i,o,"utf-8"),St.renameSync(i,n)}}});var oe,Vy=ae(()=>{"use strict";oe={Config:Symbol.for("IConfigService"),Console:Symbol.for("IConsoleService"),EnvironmentConfig:Symbol.for("IEnvironmentConfigService"),Collection:Symbol.for("ICollectionService"),HttpRequest:Symbol.for("IHttpRequestService"),HttpClient:Symbol.for("IHttpClient"),Cookie:Symbol.for("ICookieService"),RequestHistory:Symbol.for("IRequestHistoryService"),TestSuite:Symbol.for("ITestSuiteService"),UrlBuilder:Symbol.for("IUrlBuilder"),RequestPreprocessor:Symbol.for("IRequestPreprocessor"),RequestPreparer:Symbol.for("IRequestPreparer"),InterceptorChain:Symbol.for("IInterceptorChain"),ScriptExecutor:Symbol.for("IScriptExecutor"),DataFileParser:Symbol.for("IDataFileParser"),CollectionRequestExecutor:Symbol.for("ICollectionRequestExecutor"),WorkspaceFolder:Symbol.for("WorkspaceFolder"),PersistentCookieJar:Symbol.for("PersistentCookieJar"),OAuth2TokenManager:Symbol.for("IOAuth2TokenManager"),GraphQLSchemaService:Symbol.for("IGraphQLSchemaService"),SchemaInferrer:Symbol.for("SchemaInferrer"),HistoryAnalyzer:Symbol.for("HistoryAnalyzer"),ScriptAnalyzer:Symbol.for("ScriptAnalyzer"),SchemaInferenceService:Symbol.for("SchemaInferenceService"),OpenApiExporter:Symbol.for("OpenApiExporter"),OpenApiImporter:Symbol.for("OpenApiImporter"),SecretResolverRegistry:Symbol.for("SecretResolverRegistry")}});function Rp(t,e){let{workspaceFolder:r,fileWatcherFactory:n,notificationService:i,workspaceStore:s,globalStore:o,secretStore:l,browserService:c,applicationInfo:d,consoleService:p}=e;t.registerValue(oe.WorkspaceFolder,r),t.registerSingleton(oe.Config,()=>new ks(r,n,i)),t.registerSingleton(oe.Console,()=>p??x5),t.registerSingleton(oe.EnvironmentConfig,y=>new nc(r,s,y.resolve(oe.Config),n,l,e.persistOverrides??!0)),t.registerSingleton(oe.Cookie,()=>new tc(o)),t.registerSingleton(oe.Collection,y=>new ec(r,y.resolve(oe.Config),n)),t.registerSingleton(oe.TestSuite,y=>new Tc(y.resolve(oe.Collection),y.resolve(oe.Config))),t.registerSingleton(oe.HttpClient,y=>{let b=y.resolve(oe.Config);return new Eo(b.getRequestConfig(),r)}),t.registerSingleton(oe.UrlBuilder,()=>new Hn),t.registerSingleton(oe.InterceptorChain,()=>new zi),t.registerSingleton(oe.HttpRequest,y=>new Wi(y.resolve(oe.UrlBuilder),y.resolve(oe.InterceptorChain),y.resolve(oe.HttpClient))),t.registerSingleton(oe.RequestPreprocessor,()=>new qo),t.registerSingleton(oe.RequestHistory,y=>{let b=y.resolve(oe.EnvironmentConfig);return new oc(b.getHistoriesPath(),gN.join(b.getRootPath(),"shared-histories"))}),l&&c&&t.registerSingleton(oe.OAuth2TokenManager,y=>new Qu(l,c,y.resolve(oe.EnvironmentConfig),y.resolve(oe.HttpRequest))),t.registerSingleton(oe.GraphQLSchemaService,y=>new sc(y.resolve(oe.HttpClient))),t.registerSingleton(oe.SecretResolverRegistry,y=>new Ac(y.resolve(oe.Config)));let m=d??{name:"HttpForge",version:"0.0.0"};t.registerSingleton(oe.RequestPreparer,y=>new ic(y.resolve(oe.EnvironmentConfig),y.resolve(oe.HttpRequest),y.resolve(oe.RequestPreprocessor),y.has(oe.OAuth2TokenManager)?y.resolve(oe.OAuth2TokenManager):void 0,m,y.resolve(oe.SecretResolverRegistry))),t.registerSingleton(oe.ScriptExecutor,y=>{let b=y.resolve(oe.Config);return new Ki(y.resolve(oe.HttpRequest),b.getModulePaths(),y.resolve(oe.SecretResolverRegistry),b.getScriptScope(),b.getScriptTimeout())}),t.registerSingleton(oe.DataFileParser,()=>new Io),t.registerSingleton(oe.CollectionRequestExecutor,y=>new As(y.resolve(oe.HttpRequest),y.resolve(oe.ScriptExecutor),y.resolve(oe.EnvironmentConfig),y.resolve(oe.RequestPreparer),"")),t.registerSingleton(oe.PersistentCookieJar,y=>new rc(y.resolve(oe.Cookie))),t.registerSingleton(oe.SchemaInferrer,()=>new Ns),t.registerSingleton(oe.HistoryAnalyzer,y=>new Xa(y.resolve(oe.RequestHistory),y.resolve(oe.SchemaInferrer))),t.registerSingleton(oe.ScriptAnalyzer,()=>new yl),t.registerSingleton(oe.SchemaInferenceService,y=>new gl(y.resolve(oe.HistoryAnalyzer),y.resolve(oe.ScriptAnalyzer),y.resolve(oe.SchemaInferrer))),t.registerSingleton(oe.OpenApiExporter,y=>new ol(y.resolve(oe.Collection),y.resolve(oe.EnvironmentConfig),y.resolve(oe.SchemaInferenceService))),t.registerSingleton(oe.OpenApiImporter,y=>new Hs(y.resolve(oe.Collection),y.resolve(oe.EnvironmentConfig)))}var gN,x5,Sx=ae(()=>{"use strict";gN=ve(require("path"));Y0();e_();ig();r_();n_();s_();sg();o_();a_();c_();Tf();$f();gd();eg();_u();f_();zR();Ly();lx();cy();ux();tg();md();gx();bx();Vy();x5={log:()=>{},trace:()=>{},debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},logBatch:()=>{},logRawLines:()=>{},show:()=>{},clear:()=>{},dispose:()=>{}}});function wx(){return Yo.instance}var Yo,_x=ae(()=>{"use strict";Vy();Yo=class t{static _instance;services=new Map;primitives=new Map;constructor(){}static get instance(){return t._instance||(t._instance=new t),t._instance}static createFresh(){return new t}static reset(){t._instance&&t._instance.clear(),t._instance=void 0}registerValue(e,r){return this.primitives.set(e,r),this}registerSingleton(e,r){return this.services.set(e,{factory:r,singleton:!0}),this}registerTransient(e,r){return this.services.set(e,{factory:r,singleton:!1}),this}registerInstance(e,r){return this.services.set(e,{factory:()=>r,singleton:!0,instance:r}),this}resolve(e){if(this.primitives.has(e))return this.primitives.get(e);let r=this.services.get(e);if(!r)throw new Error(`Service not registered: ${e.toString()}`);return r.singleton?(r.instance||(r.instance=r.factory(this)),r.instance):r.factory(this)}has(e){return this.services.has(e)||this.primitives.has(e)}clear(){this.services.clear(),this.primitives.clear()}get config(){return this.resolve(oe.Config)}get console(){return this.resolve(oe.Console)}get environmentConfig(){return this.resolve(oe.EnvironmentConfig)}get collection(){return this.resolve(oe.Collection)}get httpRequest(){return this.resolve(oe.HttpRequest)}get httpClient(){return this.resolve(oe.HttpClient)}get cookie(){return this.resolve(oe.Cookie)}get requestHistory(){return this.resolve(oe.RequestHistory)}get dataFileParser(){return this.resolve(oe.DataFileParser)}get scriptExecutor(){return this.resolve(oe.ScriptExecutor)}get requestPreparer(){return this.resolve(oe.RequestPreparer)}get persistentCookieJar(){return this.resolve(oe.PersistentCookieJar)}get oauth2TokenManager(){return this.has(oe.OAuth2TokenManager)?this.resolve(oe.OAuth2TokenManager):void 0}get graphqlSchemaService(){return this.resolve(oe.GraphQLSchemaService)}get testSuite(){return this.resolve(oe.TestSuite)}}});function yN(t){return/\{\{[^}]+\}\}/.test(t)}function Cp(t,e=16){return!!t&&t.length>=e&&!yN(t)}function Rx(t){return t.toUpperCase().replace(/[^A-Z0-9]/g,"_")}function xp(t,e,r,n,i,s=10){let o=t.get(e);o||(o={varName:r,reason:n,occurrences:[],priority:s},t.set(e,o));let l=`${i.requestId}::${i.field}`;o.occurrences.some(c=>`${c.requestId}::${c.field}`===l)||o.occurrences.push(i)}function Ep(t,e=1){let r=nt(t),n=new Map;for(let{request:s}of r){let o=l=>({requestId:s.id,requestName:s.name,field:l});for(let l of s.headers??[]){if(l.enabled===!1)continue;let c=l.key.toLowerCase(),d=l.value;if(c==="authorization"){let p=d.match(/^(bearer|basic|token|digest)\s+(.+)$/i);p&&Cp(p[2])?xp(n,p[2],`${p[1].toUpperCase()}_TOKEN`,`Authorization ${p[1]} token`,o(`header:${l.key}`),1):Cp(d)&&xp(n,d,"AUTH_TOKEN","Authorization header value",o(`header:${l.key}`),1)}else E5.has(c)&&Cp(d)?xp(n,d,Rx(l.key),`Sensitive header: ${l.key}`,o(`header:${l.key}`),2):Cp(d,20)&&!d.includes(" ")&&/^[A-Za-z0-9+/=_.-]+$/.test(d)&&xp(n,d,Rx(l.key)||"HEADER_VALUE",`Long opaque value in header: ${l.key}`,o(`header:${l.key}`),5)}for(let l of s.query??[])l.enabled!==!1&&q5.has(l.key.toLowerCase())&&Cp(l.value)&&xp(n,l.value,Rx(l.key),`Sensitive query param: ${l.key}`,o(`query:${l.key}`),2)}let i=new Map;for(let{request:s}of r)if(!(!s.url||yN(s.url)))try{let o=new URL(s.url);if(!["localhost","127.0.0.1","0.0.0.0","::1"].includes(o.hostname)){let c=`${o.protocol}//${o.host}`,d=i.get(c)??[];d.push({requestId:s.id,requestName:s.name,field:"url"}),i.set(c,d)}}catch{}for(let[s,o]of i)o.length>=Math.max(e,2)&&!n.has(s)&&n.set(s,{varName:"BASE_URL",reason:`Shared base URL across ${o.length} requests`,occurrences:o,priority:3});return[...n.entries()].filter(([,s])=>s.occurrences.length>=e).sort((s,o)=>s[1].priority-o[1].priority||s[0].localeCompare(o[0])).map(([s,o])=>({varName:o.varName,value:s,reason:o.reason,occurrences:o.occurrences}))}function Wy(t,e){let r={};return vN(t,e,r),r}function vN(t,e,r){for(let n of t){if(n.type==="folder"){n.items&&vN(n.items,e,r);continue}let i=n;for(let s of e){let o=`{{${s.varName}}}`;i.url?.includes(s.value)&&(i.url=i.url.split(s.value).join(o),r[s.varName]=(r[s.varName]??0)+1);for(let l of i.headers??[]){let c=l.value.match(/^(bearer|basic|token|digest)\s+(.+)$/i);c&&c[2]===s.value?(l.value=`${c[1]} ${o}`,r[s.varName]=(r[s.varName]??0)+1):l.value===s.value&&(l.value=o,r[s.varName]=(r[s.varName]??0)+1)}for(let l of i.query??[])l.value===s.value&&(l.value=o,r[s.varName]=(r[s.varName]??0)+1)}}}var E5,q5,Cx=ae(()=>{"use strict";Oi();E5=new Set(["x-api-key","x-auth-token","x-access-token","x-token","x-secret","api-key","apikey","x-client-secret","x-rapidapi-key"]),q5=new Set(["api_key","apikey","api-key","access_token","token","auth_token","client_id","client_secret","key","secret"])});function Wr(t,e){let r={type:"string",description:t};return e.length>0&&(r.enum=[...e]),r}function zy(t,e,r){let n=i=>Wr("Name of the collection to act on."+(i?"":" Optional."),e);return[{name:`${t}${G.listCollections}`,description:"List all available HTTP Forge collections (name, description, and request count). Call this first to discover what collections exist, then use list_folders, list_requests or run_* tools.",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.listFolders}`,description:"List all folders in a collection with their full paths and request counts. Use this before run_folder to discover the exact folder path string to pass.",inputSchema:{type:"object",properties:{collection:n(!0)},required:["collection"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.listRequests}`,description:"List the saved requests in a collection (name, HTTP method, folder, and description). Use this to find the exact request name before calling run_request. For large collections use the folder filter and offset/limit to page through results.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:'Optional folder path to filter by (e.g. "Auth").'},offset:{type:"number",description:"Zero-based index to start from (default: 0)."},limit:{type:"number",description:"Maximum number of results to return (default: 50, max: 200)."}},required:["collection"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.searchRequests}`,description:"Search for requests across a collection by name, URL, method, or folder path. Returns matching requests with their folder location. Useful for large collections.",inputSchema:{type:"object",properties:{collection:n(!0),query:{type:"string",description:"Text to search for in request names, URLs, methods, and folder paths (case-insensitive)."}},required:["collection","query"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getRequest}`,description:"Get the full details of a single saved request: URL, method, headers, body, auth, and scripts. Use this to inspect a request before editing it, or to read a script before rewriting it.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id. Use list_requests to find names."}},required:["collection","request"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getEnvironment}`,description:"Show the current environment variable values (merged initial + runtime pm.environment.set overrides). Use this to inspect variable state before running a folder, or to debug {{variable}} resolution failures.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name to inspect (defaults to the currently selected environment)."}}},annotations:{readOnlyHint:!0}},{name:`${t}${G.setVariable}`,description:'Override an environment variable for the current session. In the VS Code extension the change is saved to VS Code workspace storage (survives restarts, but is not in the env JSON file and not source-controlled). In the standalone CLI/core runtime the change is in-memory only and lost when the server restarts. Use set_environment_variable with scope:"permanent" to write to the env JSON file (source-controlled, works in both runtimes).',inputSchema:{type:"object",properties:{key:{type:"string",description:"Variable name (the part inside {{...}})."},value:{type:"string",description:"New value to set."},environment:{type:"string",description:"Environment to update (defaults to the currently selected environment)."}},required:["key","value"]},annotations:{idempotentHint:!0}},{name:`${t}${G.getRunStatus}`,description:"Check whether an async run is still running, completed, or failed. Poll this after calling run_folder/run_collection/run_suite with async:true.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."}},required:["runId"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getRunSummary}`,description:'Get the pass/fail summary of a completed async run (total, passed, failed counts). Use after get_run_status shows "completed". When failures are present the response includes a failedRequests array with full details (method, url, requestBody, status, responseBody, failedTests) and a _nextStep directive. You MUST follow the _nextStep directive immediately \u2014 analyze the failures and provide diagnosis without waiting for the user to ask.',inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."}},required:["runId"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getFailedRequests}`,description:"Get the list of failed requests from a completed async run \u2014 the failures-first view. Never returns passing requests. Use this instead of get_run_summary when you need to see what broke.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."},offset:{type:"number",description:"Zero-based index to start from (default: 0)."},limit:{type:"number",description:"Maximum failures to return (default: 20, max: 100)."}},required:["runId"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getRequestResult}`,description:"Get the full result (status, body, assertions, console output) for one specific request from an async run. Use after get_failed_requests to drill into a single failure.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."},request:{type:"string",description:"Name of the request to look up."},iteration:{type:"number",description:"Iteration number (default: 1)."}},required:["runId","request"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.cancelRun}`,description:'Request cancellation of an in-progress async run. Cancellation is best-effort: the currently-executing HTTP request completes normally, but no further requests in the run are started. The run status changes to "cancelled". Has no effect on runs that are already completed, failed, or cancelled.',inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by run_collection, run_folder, or run_suite with async:true."}},required:["runId"]},annotations:{idempotentHint:!0}},{name:`${t}${G.runRequest}`,description:"Run a single saved request. Pick the collection, then the request name within it.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Name of the request to run. Use list_requests or search_requests to find names."},requestId:{type:"string",description:'ID of the request (from list_requests/search_requests). Preferred over "request" name when available \u2014 avoids ambiguity with duplicate names.'},...qp.properties},required:["collection","request"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.runFolder}`,description:"Run every request inside a folder of a collection.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:'Folder path within the collection (e.g. "Auth/Login").'},...Ip.properties},required:["collection","folder"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.runCollection}`,description:"Run every request in a collection.",inputSchema:{type:"object",properties:{collection:n(!0),...Op.properties},required:["collection"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.runSuite}`,description:"Run a saved test suite.",inputSchema:{type:"object",properties:{suite:Wr("Name of the test suite to run.",r),...Pp.properties},required:["suite"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.createCollection}`,description:"Create a new empty collection.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Display name for the new collection."}},required:["name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.renameCollection}`,description:"Rename an existing collection.",inputSchema:{type:"object",properties:{collection:n(!0),newName:{type:"string",description:"New display name for the collection."}},required:["collection","newName"]},annotations:{idempotentHint:!0}},{name:`${t}${G.deleteCollection}`,description:"Permanently delete a collection and all its contents. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{collection:n(!0),confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["collection","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.duplicateCollection}`,description:"Clone a collection under a new name (all folders, requests, and scripts are copied).",inputSchema:{type:"object",properties:{collection:n(!0),newName:{type:"string",description:"Name for the duplicated collection."}},required:["collection","newName"]},annotations:{idempotentHint:!1}},{name:`${t}${G.createFolder}`,description:"Create a folder inside a collection (optionally nested inside another folder).",inputSchema:{type:"object",properties:{collection:n(!0),name:{type:"string",description:"Display name for the new folder."},parentFolder:{type:"string",description:"Slash-separated folder path or folder id of the parent. Omit to create at collection root."}},required:["collection","name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.deleteFolder}`,description:"Delete a folder and all its requests. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:"Slash-separated folder path or folder id to delete."},confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["collection","folder","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.createRequest}`,description:"Create a new HTTP request inside a collection (optionally inside a folder).",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:"Folder path or id. Omit to add at collection root."},name:{type:"string",description:"Display name for the request."},method:{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],description:"HTTP method."},url:{type:"string",description:"Request URL, may include {{variable}} placeholders."},headers:{type:"object",description:"Key/value header map.",additionalProperties:{type:"string"}},body:{type:"string",description:"Raw request body (JSON, text, etc.)."},description:{type:"string",description:"Human-readable description."}},required:["collection","name","method","url"]},annotations:{idempotentHint:!1}},{name:`${t}${G.updateRequest}`,description:"Update fields on an existing request (partial update \u2014 omit fields to keep current values).",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id."},name:{type:"string",description:"New display name."},method:{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]},url:{type:"string"},headers:{type:"object",additionalProperties:{type:"string"}},body:{type:"string"},description:{type:"string"}},required:["collection","request"]},annotations:{idempotentHint:!0}},{name:`${t}${G.deleteRequest}`,description:"Remove a request from a collection. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id to delete."},confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["collection","request","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.getRequestScript}`,description:"Read the pre-request or post-response script of a request.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id."},phase:{type:"string",enum:["pre-request","post-response"],description:"Which script phase to read."}},required:["collection","request","phase"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.setRequestScript}`,description:"Write or replace the pre-request or post-response script of a request.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id."},phase:{type:"string",enum:["pre-request","post-response"],description:"Which script phase to write."},script:{type:"string",description:"Full JavaScript source to write."}},required:["collection","request","phase","script"]},annotations:{idempotentHint:!0}},{name:`${t}${G.reorderCollectionItems}`,description:"Set the execution/display order of direct children of a collection root or folder. Items not listed are appended at the end.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:"Folder path or id. Omit to reorder collection root."},order:{type:"array",items:{type:"string"},description:"Ordered list of item names or ids."}},required:["collection","order"]},annotations:{idempotentHint:!0}},{name:`${t}${G.listSuites}`,description:"List all test suites with name, id, request count, and configuration summary.",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.getSuite}`,description:"Get full details of a test suite including flow nodes (suite.nodes) and a flattened request list.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the test suite.",r)},required:["suite"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.createSuite}`,description:"Create a new test suite (empty, pre-populated from a collection/folder, or initialized with an explicit flow nodes graph).",inputSchema:{type:"object",properties:{name:{type:"string",description:"Display name for the new suite."},description:{type:"string",description:"Optional description."},fromCollection:{type:"string",description:"Collection name or id to seed the suite from (all requests in execution order)."},fromFolder:{type:"string",description:"Folder path within fromCollection to seed from."},nodes:{type:"array",items:{type:"object"},description:"Optional full suite.nodes graph. If provided, this becomes the suite flow definition."},iterations:{type:"number",description:"Number of iterations (default: 1)."},stopOnError:{type:"boolean",description:"Stop on first failure (default: false)."},delayBetweenRequests:{type:"number",description:"Milliseconds delay between requests (default: 0)."}},required:["name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.updateSuiteConfig}`,description:"Change a suite's name/description/run configuration and optionally replace the full suite.nodes flow graph.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite to update.",r),name:{type:"string",description:"New display name."},description:{type:"string",description:"New description."},nodes:{type:"array",items:{type:"object"},description:"Optional full suite.nodes graph replacement."},iterations:{type:"number"},stopOnError:{type:"boolean"},delayBetweenRequests:{type:"number"}},required:["suite"]},annotations:{idempotentHint:!0}},{name:`${t}${G.getSuiteNode}`,description:'Get a single suite flow node by path (for example: "2.then.0" or "1.cases.0.nodes.1").',inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),path:{type:"string",description:"Node path to read (dot notation)."}},required:["suite","path"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.listSuiteNodePaths}`,description:"List all node paths and editable branch-array paths for a suite flow graph. Use before add/update/remove/move_suite_node.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),includeBranches:{type:"boolean",description:"Include branch-array paths (default: true)."}},required:["suite"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.addSuiteNode}`,description:"Add a flow node to a suite. Insert at root or into a branch array of a parent node.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),node:{type:"object",description:"Node object to insert (request/script/if/switch/for/while/block)."},parentPath:{type:"string",description:'Optional parent node path (for example: "2" or "1.cases.0"). Omit to insert at root.'},branch:{type:"string",description:'Branch array on parent node (for example: "nodes", "then", "else", "default", "cases.0.nodes"). Required when parentPath is provided.'},index:{type:"number",description:"Optional insertion index inside target array. Omit to append."}},required:["suite","node"]},annotations:{idempotentHint:!1}},{name:`${t}${G.updateSuiteNode}`,description:"Replace a flow node at a specific path in suite.nodes.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),path:{type:"string",description:'Node path to replace (for example: "0" or "2.then.1").'},node:{type:"object",description:"Full replacement node object."}},required:["suite","path","node"]},annotations:{idempotentHint:!0}},{name:`${t}${G.removeSuiteNode}`,description:"Remove a flow node at a specific path from suite.nodes.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),path:{type:"string",description:'Node path to remove (for example: "0" or "2.else.0").'}},required:["suite","path"]},annotations:{destructiveHint:!0}},{name:`${t}${G.moveSuiteNode}`,description:"Move a flow node from one path to another parent/branch/index within suite.nodes.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),fromPath:{type:"string",description:'Source node path (for example: "1.then.0").'},toParentPath:{type:"string",description:"Optional destination parent node path. Omit to move to root."},toBranch:{type:"string",description:"Destination branch array on parent node. Required when toParentPath is provided."},toIndex:{type:"number",description:"Optional destination index in target array. Omit to append."}},required:["suite","fromPath"]},annotations:{idempotentHint:!1}},{name:`${t}${G.addSuiteRequests}`,description:'Legacy compatibility helper. Add one or more request nodes at the suite root, using the same insertion semantics as add_suite_node with type:"request".',inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),requests:{type:"array",items:{type:"object",properties:{collection:{type:"string",description:"Collection name or id."},request:{type:"string",description:"Request name or id."}},required:["collection","request"]},description:"Requests to add."},insertAt:{type:"number",description:"Zero-based root nodes-array index to insert at. Omit to append at end."}},required:["suite","requests"]},annotations:{idempotentHint:!1}},{name:`${t}${G.removeSuiteRequest}`,description:"Remove a request from a request-only root suite by position (0-based) or by name. For flow suites, edit nodes via get_suite/update_suite_config.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),index:{type:"number",description:"Zero-based position in the suite requests list."},request:{type:"string",description:"Request name to remove (used if index is not provided)."}},required:["suite"]},annotations:{destructiveHint:!0}},{name:`${t}${G.reorderSuiteRequests}`,description:"Reorder requests in a request-only root suite. Requests not listed are moved to the end. For flow suites, edit nodes via get_suite/update_suite_config.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite.",r),order:{type:"array",items:{type:"string"},description:"Ordered list of request names."}},required:["suite","order"]},annotations:{idempotentHint:!0}},{name:`${t}${G.duplicateSuite}`,description:"Clone an existing suite under a new name.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite to clone.",r),newName:{type:"string",description:"Name for the duplicated suite."}},required:["suite","newName"]},annotations:{idempotentHint:!1}},{name:`${t}${G.deleteSuite}`,description:"Delete a test suite permanently. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{suite:Wr("Name or id of the suite to delete.",r),confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["suite","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.listEnvironments}`,description:"List all environments with their variable keys (values hidden). Use get_environment_variables to see values.",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.getEnvironmentVariables}`,description:"Get the resolved (merged file + session overrides) variables for an environment.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name (defaults to active environment)."}}},annotations:{readOnlyHint:!0}},{name:`${t}${G.selectEnvironment}`,description:"Set the active environment for all subsequent run_* calls in this session.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Name of the environment to activate."}},required:["environment"]},annotations:{idempotentHint:!0}},{name:`${t}${G.createEnvironment}`,description:"Create a new environment file, optionally pre-populated with variables.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Environment name (becomes the filename)."},variables:{type:"object",description:"Initial key/value variable map.",additionalProperties:{type:"string"}}},required:["name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.deleteEnvironment}`,description:"Delete an environment file permanently. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name to delete."},confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["environment","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.setEnvironmentVariable}`,description:'Set a variable in an environment. Scope "session" (default) is in-memory only and always temporary (both runtimes). Scope "permanent" writes to the env JSON config file \u2014 source-controlled and shared with the CLI runtime.',inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name (defaults to active environment)."},key:{type:"string",description:"Variable name."},value:{type:"string",description:"New value."},scope:{type:"string",enum:["session","permanent"],description:'Storage scope. "permanent" writes to disk.'}},required:["key","value"]},annotations:{idempotentHint:!0}},{name:`${t}${G.unsetEnvironmentVariable}`,description:"Remove a session-scoped variable override, restoring the file value.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name (defaults to active environment)."},key:{type:"string",description:"Variable name to unset."}},required:["key"]},annotations:{idempotentHint:!0}},{name:`${t}${G.setGlobalVariable}`,description:'Set a global variable visible across all environments. Scope "session" (default) is in-memory only and lost on restart (both runtimes). Scope "permanent" writes to _global.json \u2014 source-controlled and shared with the CLI runtime.',inputSchema:{type:"object",properties:{key:{type:"string",description:"Global variable name."},value:{type:"string",description:"Value to set."},scope:{type:"string",enum:["session","permanent"],description:'Storage scope. "permanent" writes to _global.json.'}},required:["key","value"]},annotations:{idempotentHint:!0}},{name:`${t}${G.getGlobals}`,description:"Return all global variables (merged _global.json + runtime pm.globals.set() values).",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.scaffoldCollectionFromOpenApi}`,description:"Import an OpenAPI 3.0 spec (JSON or YAML) and scaffold a complete HTTP Forge collection from it. All operations become requests grouped by tag/path. An optional environment is created from the server URL. Returns the new collection id and name. Use this to quickly bootstrap API testing from a spec file.",inputSchema:{type:"object",properties:{specPath:{type:"string",description:"Absolute or workspace-relative path to the OpenAPI 3.0 JSON or YAML file."},collectionName:{type:"string",description:"Override the collection name (defaults to the spec title)."},environmentName:{type:"string",description:"Name for the generated environment that contains the server base URL. Omit to skip environment creation."}},required:["specPath"]},annotations:{idempotentHint:!1}},{name:`${t}${G.suggestAssertions}`,description:"Analyse the last execution history for a request and suggest pm.test() assertions to add to its post-response script. Covers status code, response time, required JSON fields, Content-Type header, and schema conformance. Returns an array of ready-to-paste JavaScript test snippets and a rationale for each.",inputSchema:{type:"object",properties:{collection:{type:"string",description:"Collection name or id that owns the request."},request:{type:"string",description:"Request name or id to analyse."},environment:{type:"string",description:"Environment used when the run was recorded (defaults to active environment)."},maxSuggestions:{type:"number",description:"Cap the number of suggestions returned (default: 10)."}},required:["collection","request"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.explainFailure}`,description:"Explain why a specific request failed in a recent run. Returns the full request (URL, method, headers, body), the response received (status, headers, body), all assertion results, any script errors, and a plain-English diagnosis with suggested fixes. Provide either runId (from a prior run_suite/run_collection call) + request name, or the collection and request names to pull the most recent history entry.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"MCP run id (from run_suite or run_collection). Mutually exclusive with collection+request history lookup."},collection:{type:"string",description:"Collection name or id. Required when runId is omitted."},request:{type:"string",description:"Request name or id."},iteration:{type:"number",description:"Iteration number within the run (default: 1)."}}},annotations:{readOnlyHint:!0}},{name:`${t}${G.suggestEnvVars}`,description:`Scan a collection for hardcoded values (API keys, base URLs, tokens, tenant IDs) that should become environment variables.
|
|
280
280
|
|
|
281
281
|
Returns:
|
|
282
282
|
\u2022 heuristicSuggestions \u2014 values identified by pattern-matching rules (ready to apply)
|
|
@@ -349,7 +349,7 @@ This tool returns request details AND a structured task. You MUST:
|
|
|
349
349
|
3. Return the rows as a JSON array under the key "iterationData" \u2014 each row is an object whose keys match the {{variable}} placeholders in the request.
|
|
350
350
|
4. Respond with the JSON array directly so the user can pass it to run_collection or the CLI --variables flag.
|
|
351
351
|
|
|
352
|
-
Example: for POST /users with body {"name":"{{name}}","email":"{{email}}"} and iterations=4, generate 4 rows: valid user, duplicate email, missing name, email with invalid format.`,inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name, slug, or id."},iterations:{type:"number",description:"Number of test data rows to generate (default: 5, max: 50)."}},required:["collection","request"]},annotations:{readOnlyHint:!0}}]}var qp,Op,Ip,Pp,G,kp=ae(()=>{"use strict";qp={type:"object",properties:{environment:{type:"string",description:"Environment name to use (defaults to the currently selected environment)"},variables:{type:"object",description:"Extra variables to inject \u2014 merged with environment variables, {{name}} syntax",additionalProperties:{type:"string"}},headers:{type:"object",description:"Override or add request headers",additionalProperties:{type:"string"}},query:{type:"object",description:"Override query parameters",additionalProperties:{type:"string"}},body:{type:"string",description:"Replace the request body (JSON string). Omit to use the saved body."},include:{type:"array",items:{type:"string",enum:["headers","cookies","tests","consoleOutput","report"]},description:"Extra fields to include in the response (default: status, ok, body, allPassed)"}}},Op={type:"object",properties:{environment:{type:"string",description:"Environment name to use"},variables:{type:"object",description:"Extra variables injected into every request",additionalProperties:{type:"string"}},iterations:{type:"number",description:"Number of iterations (default: 1)"},concurrency:{type:"number",description:"Number of parallel virtual users (1\u201350, default: 1). Each VU runs the full request sequence independently, preserving inter-request dependencies."},stopOnError:{type:"boolean",description:"Stop on first failure"},delay:{type:"number",description:"Delay between requests in ms"},include:{type:"array",items:{type:"string",enum:["perRequest","failedOnly","consoleOutput","report"]},description:"Result detail level"},async:{type:"boolean",description:"When true, start the run in the background and return a runId immediately. Use get_run_status / get_failed_requests to poll results. Recommended for folders with many requests."}}},Ip={type:"object",properties:{environment:{type:"string",description:"Environment name to use"},variables:{type:"object",description:"Extra variables injected into every request",additionalProperties:{type:"string"}},iterations:{type:"number",description:"Number of iterations (default: 1)"},concurrency:{type:"number",description:"Number of parallel virtual users (1\u201350, default: 1). Each VU runs the full request sequence independently."},stopOnError:{type:"boolean",description:"Stop on first failure"},delay:{type:"number",description:"Delay between requests in ms"},recursive:{type:"boolean",description:"Include requests in nested subfolders (default: true)"},include:{type:"array",items:{type:"string",enum:["perRequest","failedOnly","consoleOutput","report"]},description:"Result detail level"},async:{type:"boolean",description:"When true, start the run in the background and return a runId immediately. Use get_run_status / get_failed_requests to poll results. Recommended for folders with many requests."}}},Pp={type:"object",properties:{environment:{type:"string",description:"Environment name to use"},iterations:{type:"number",description:"Number of iterations (overrides suite default)"},concurrency:{type:"number",description:"Number of parallel virtual users (1\u201350, default: 1). Each VU runs the full request sequence independently."},stopOnError:{type:"boolean",description:"Stop on first failure"},delay:{type:"number",description:"Delay between requests in ms"},variables:{type:"object",description:"Extra variables injected into every request",additionalProperties:{type:"string"}},async:{type:"boolean",description:"When true, start the run in the background and return a runId immediately. Use get_run_status / get_failed_requests to poll results."},requestFilter:{type:"array",items:{type:"string"},description:"Run only requests whose names match one of these strings (case-insensitive)"},include:{type:"array",items:{type:"string",enum:["perRequest","failedOnly","consoleOutput","report"]},description:"Result detail level (default: summary + failedRequests)"}}},G={listCollections:"list_collections",listFolders:"list_folders",listRequests:"list_requests",searchRequests:"search_requests",getEnvironment:"get_environment",runRequest:"run_request",runFolder:"run_folder",runCollection:"run_collection",runSuite:"run_suite",getRunStatus:"get_run_status",getRunSummary:"get_run_summary",getFailedRequests:"get_failed_requests",getRequestResult:"get_request_result",cancelRun:"cancel_run",setVariable:"set_variable",createCollection:"create_collection",renameCollection:"rename_collection",deleteCollection:"delete_collection",duplicateCollection:"duplicate_collection",createFolder:"create_folder",deleteFolder:"delete_folder",getRequest:"get_request",createRequest:"create_request",updateRequest:"update_request",deleteRequest:"delete_request",getRequestScript:"get_request_script",setRequestScript:"set_request_script",reorderCollectionItems:"reorder_collection_items",listSuites:"list_suites",getSuite:"get_suite",createSuite:"create_suite",updateSuiteConfig:"update_suite_config",getSuiteNode:"get_suite_node",listSuiteNodePaths:"list_suite_node_paths",addSuiteNode:"add_suite_node",updateSuiteNode:"update_suite_node",removeSuiteNode:"remove_suite_node",moveSuiteNode:"move_suite_node",addSuiteRequests:"add_suite_requests",removeSuiteRequest:"remove_suite_request",reorderSuiteRequests:"reorder_suite_requests",duplicateSuite:"duplicate_suite",deleteSuite:"delete_suite",listEnvironments:"list_environments",getEnvironmentVariables:"get_environment_variables",selectEnvironment:"select_environment",createEnvironment:"create_environment",deleteEnvironment:"delete_environment",setEnvironmentVariable:"set_environment_variable",unsetEnvironmentVariable:"unset_environment_variable",setGlobalVariable:"set_global_variable",getGlobals:"get_globals",scaffoldCollectionFromOpenApi:"scaffold_collection_from_openapi",suggestAssertions:"suggest_assertions",explainFailure:"explain_failure",suggestEnvVars:"suggest_env_vars",applyEnvVars:"apply_env_vars",getRequestsForEnhancement:"get_requests_for_enhancement",applyRequestEnhancements:"apply_request_enhancements",aiSuggestEnvVars:"ai_suggest_env_vars",aiEnhanceCollection:"ai_enhance_collection",analyzeCoverage:"analyze_coverage",aiAnalyzeCoverage:"ai_analyze_coverage",generateRequestFromIntent:"generate_request_from_intent",validateAgainstSpec:"validate_against_spec",generateScenarios:"generate_scenarios",healAssertions:"heal_assertions",generateIterationData:"generate_iteration_data"}});function le(t){return new Error(`Bad request: ${t}`)}function lt(t,e){if(typeof t!="string"||!t.trim())throw le('the "collection" argument is required');let r=t.toLowerCase(),n=e.find(i=>i.id===t||i.name===t)??e.find(i=>i.name.toLowerCase()===r)??e.find(i=>i.name.toLowerCase().includes(r))??e.find(i=>i.id.toLowerCase().includes(r));if(!n){let i=e.map(s=>`"${s.name}"`).join(", ");throw le(`collection not found: "${t}". Available collections: ${i||"(none)"}. Call list_collections to see all.`)}return n}function ns(t,e){if(typeof t!="string"||!t.trim())throw le('the "request" argument is required');let r=nt(e),n=t.toLowerCase(),i=r.find(s=>s.request.id===t||s.request.name===t)??r.find(s=>s.request.name.toLowerCase()===n)??r.find(s=>s.request.name.toLowerCase().includes(n));if(!i){let s=r.slice(0,10).map(o=>`"${o.request.name}"`).join(", ");throw le(`request "${t}" not found in collection "${e.name}". First ${Math.min(r.length,10)} requests: ${s||"(none)"}. Call list_requests or search_requests to find the exact name.`)}return i.request}function bN(t,e){for(let r of t){if(r.type!=="folder")continue;let n=r;if(n.id===e)return n;let i=bN(n.items??[],e);if(i)return i}}async function En(t,e){if(typeof t!="string"||!t.trim())throw le('the "suite" argument is required');let r=await e.testSuite.getAllSuites(),n=t.toLowerCase(),i=r.find(s=>s.id===t||s.name===t)??r.find(s=>s.name.toLowerCase()===n);if(!i){let s=r.map(o=>`"${o.name}"`).join(", ");throw le(`suite "${t}" not found. Available suites: ${s||"(none)"}. Call list_suites to see all.`)}return i}async function Gy(t,e,r,n,i){let s=r.collection.getAllCollections();if(t===G.listCollections)return{collections:s.map(v=>({name:v.name,id:v.id,description:v.description??"",requestCount:nt(v).length}))};if(t===G.listFolders){let v=lt(e.collection,s);return{collection:v.name,folders:Vr(v).map(({folderPath:_,requestCount:q})=>({path:rs(_),requestCount:q}))}}if(t===G.listRequests){let v=lt(e.collection,s),_=typeof e.folder=="string"?e.folder.toLowerCase():void 0,q=typeof e.offset=="number"?Math.max(0,e.offset):0,k=typeof e.limit=="number"?Math.min(200,Math.max(1,e.limit)):50,O=nt(v).filter(({folderPath:M})=>!_||M.toLowerCase().includes(_)).map(({request:M,folderPath:j})=>({id:M.id,name:M.name,method:M.method,folder:rs(j),description:M.description??""}));return{collection:v.name,total:O.length,offset:q,limit:k,requests:O.slice(q,q+k)}}if(t===G.searchRequests){let v=lt(e.collection,s),_=typeof e.query=="string"?e.query.toLowerCase().trim():"";if(!_)throw le('the "query" argument is required');let q=nt(v).filter(({request:k,folderPath:O})=>k.name.toLowerCase().includes(_)||(k.url??"").toLowerCase().includes(_)||k.method.toLowerCase().includes(_)||O.toLowerCase().includes(_)||(k.description??"").toLowerCase().includes(_)).map(({request:k,folderPath:O})=>({id:k.id,name:k.name,method:k.method,url:k.url??"",folder:rs(O),description:k.description??""}));return{collection:v.name,query:e.query,total:q.length,requests:q}}if(t===G.getRequest){let v=lt(e.collection,s),_=ns(e.request,v),q=r.collection.getRequestScript(v.id,_.id,"pre-request")??"",k=r.collection.getRequestScript(v.id,_.id,"post-response")??"";return{id:_.id,name:_.name,method:_.method,url:_.url??"",description:_.description??"",headers:_.headers??[],body:_.body??null,auth:_.auth??null,scripts:{preRequest:q,postResponse:k},hint:"Use update_request to modify fields, set_request_script to modify scripts, or run_request to execute it."}}if(t===G.getEnvironment){let v=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment(),_=r.environmentConfig.getResolvedEnvironment(v);if(!_)throw le(`environment "${v}" not found`);return{name:_.name,variables:_.variables}}if(t===G.setVariable){let v=typeof e.key=="string"?e.key.trim():"",_=typeof e.value=="string"?e.value:String(e.value??"");if(!v)throw le('"key" is required');let q=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment();return r.environmentConfig.setEnvironmentVariable(v,_,q),{set:!0,key:v,environment:q}}if(t===G.getRunStatus){let v=n.require(e.runId);return{runId:v.id,status:v.status,suiteName:v.suiteName,progress:v.progress,...v.error?{error:v.error}:{}}}if(t===G.getRunSummary){let v=n.require(e.runId);if(v.status==="running")return{runId:v.id,status:"running",progress:v.progress};let _=(v.summary.failed??0)>0||v.summary.allPassed===!1,q=v.noAssertionExamples??[],k=q.length,O=v.summary.total,M=k>0?k/(O||1)>.5?`${k}/${O} requests have no pm.test() assertions. Invoke the "review-collection" prompt (collection="${v.suiteName}") for a full coverage analysis.`:`${k} request(s) have no pm.test() assertions (e.g. ${q.slice(0,3).map(j=>`"${j}"`).join(", ")}). Invoke the "suggest-assertions" prompt (collection="${v.suiteName}") to add test coverage.`:null;return{runId:v.id,status:v.status,suiteName:v.suiteName,summary:v.summary,...v.reportPath?{report:{uri:`file://${v.reportPath}`}}:{},..._?{failedRequests:v.failedRequests}:{},..._?{_nextStep:`REQUIRED ACTION: ${v.summary.failed} request(s) failed. The failedRequests array above contains the full details (method, url, requestBody, requestHeaders, status, responseBody, failedTests). Immediately analyze each failed request and provide: (1) root cause, (2) specific fix, (3) corrected pm.test() assertions if relevant. Do NOT wait for the user to ask \u2014 diagnose now.`}:{},...M?{_suggestions:[M]}:{}}}if(t===G.getFailedRequests){let v=n.require(e.runId);if(v.status==="running")return{runId:v.id,status:"running",progress:v.progress,failedSoFar:v.failedRequests.length};let _=typeof e.offset=="number"?Math.max(0,e.offset):0,q=typeof e.limit=="number"?Math.min(100,Math.max(1,e.limit)):20;return{runId:v.id,status:v.status,totalFailed:v.failedRequests.length,offset:_,limit:q,failedRequests:v.failedRequests.slice(_,_+q)}}if(t===G.getRequestResult){let v=n.require(e.runId),_=e.request;if(typeof _!="string"||!_)throw le('"request" is required');let q=typeof e.iteration=="number"?e.iteration:1,k=v.allResults.find(O=>O.iteration===q&&(O.name===_||O.name.toLowerCase()===_.toLowerCase()));if(!k){if(v.status==="running")return{runId:v.id,status:"running",message:`Request "${_}" has not completed yet.`};throw new Error(`Request "${_}" (iteration ${q}) not found in run "${v.id}".`)}return{runId:v.id,...k}}if(t===G.cancelRun){let v=n.require(e.runId);if(v.status!=="running")return{runId:v.id,status:v.status,cancelled:!1,message:`Run is already "${v.status}" \u2014 nothing to cancel.`};let _=n.cancel(String(e.runId));return{runId:v.id,status:"cancelled",cancelled:_,progress:v.progress,message:"Cancellation requested. The currently-executing request will finish; remaining requests will be skipped."}}if(t===G.runRequest){let v=lt(e.collection,s),_=nt(v),q=typeof e.requestId=="string"?e.requestId.trim():void 0,k=e.request,O;if(q){if(O=_.find(M=>M.request.id===q),!O)throw le(`request with id "${q}" not found in collection "${v.name}"`)}else{if(typeof k!="string"||!k.trim())throw le('the "request" or "requestId" argument is required');if(O=_.find(M=>M.request.name===k)??_.find(M=>M.request.name.toLowerCase()===k.toLowerCase()),!O)throw le(`request "${k}" not found in collection "${v.name}"`)}return i.runRequest(v,O.request.id,e)}if(t===G.runFolder){let v=lt(e.collection,s);if(typeof e.folder!="string"||!e.folder.trim())throw le('the "folder" argument is required');let _=e.folder.toLowerCase(),q=_p(e.folder),k=q.toLowerCase(),O=Vr(v).map(j=>j.folderPath),M=O.find(j=>j===q)??O.find(j=>j.toLowerCase()===k)??O.find(j=>j.toLowerCase().includes(k))??O.find(j=>j.split("/").some(I=>I.toLowerCase().includes(k)));if(!M){let j=O.map(I=>`"${I}"`).join(", ");throw le(`folder "${e.folder}" not found in collection "${v.name}". Available folders: ${j||"(none)"}. Call list_folders to see all.`)}return i.runFolder(v,M,e)}if(t===G.runCollection){let v=lt(e.collection,s);return i.runCollection(v,e)}if(t===G.createCollection){let v=typeof e.name=="string"?e.name.trim():"";if(!v)throw le('"name" is required');let _=await r.collection.createCollection(v);return{id:_.id,name:_.name,created:!0,hint:"Collection is empty. Call create_folder to add folders, or create_request to add requests directly."}}if(t===G.renameCollection){let v=lt(e.collection,s),_=typeof e.newName=="string"?e.newName.trim():"";if(!_)throw le('"newName" is required');return await r.collection.renameCollection(v.id,_),{id:v.id,oldName:v.name,newName:_,renamed:!0}}if(t===G.deleteCollection){if(e.confirm!==!0)throw le('"confirm" must be true to delete a collection');let v=lt(e.collection,s);return await r.collection.deleteCollection(v.id),{deleted:!0,collection:v.name}}if(t===G.duplicateCollection){let v=lt(e.collection,s),_=typeof e.newName=="string"?e.newName.trim():"";if(!_)throw le('"newName" is required');let q=await r.collection.duplicateCollection(v.id,_);return{id:q.id,name:q.name,duplicatedFrom:v.name}}if(t===G.createFolder){let v=lt(e.collection,s),_=typeof e.name=="string"?e.name.trim():"";if(!_)throw le('"name" is required');let q;if(typeof e.parentFolder=="string"&&e.parentFolder.trim()){let O=e.parentFolder.toLowerCase(),M=Vr(v);if(nt(v).map(I=>I.folderPath)&&M.find(I=>I.folderPath===e.parentFolder||I.folderPath.toLowerCase()===O)){let R=Vr(v).find(A=>A.folderPath===e.parentFolder||A.folderPath.toLowerCase()===O);if(R){let A=v.items,F=(D,J)=>{for(let Q of D)if(Q.type==="folder"){let se=Q;if(se.name===J||J.endsWith("/"+se.name))return se;let ce=F(se.items??[],J);if(ce)return ce}};q=F(A,R.folderPath)?.id}}}let k=await r.collection.createFolder({collectionId:v.id,name:_,parentId:q});return{id:k.id,name:k.name,created:!0,collection:v.name}}if(t===G.deleteFolder){if(e.confirm!==!0)throw le('"confirm" must be true to delete a folder');let v=lt(e.collection,s);if(typeof e.folder!="string"||!e.folder.trim())throw le('"folder" is required');let _=e.folder.toLowerCase(),q=Vr(v).find(M=>M.folderPath===e.folder||M.folderPath.toLowerCase()===_);if(!q)throw le(`folder "${e.folder}" not found in collection "${v.name}"`);let k=bN(v.items,q.folderId);if(!k)throw le(`folder "${e.folder}" could not be resolved`);let O=q.requestCount;return await r.collection.deleteFolder(v.id,k.id),{deleted:!0,folder:q.folderPath,requestsRemoved:O}}if(t===G.createRequest){let v=lt(e.collection,s),_=typeof e.name=="string"?e.name.trim():"";if(!_)throw le('"name" is required');let q=typeof e.method=="string"?e.method.toUpperCase():"GET",k=typeof e.url=="string"?e.url:"";if(!k)throw le('"url" is required');let O;if(typeof e.folder=="string"&&e.folder.trim()){let I=e.folder.toLowerCase(),R=Vr(v).find(A=>A.folderPath===e.folder||A.folderPath.toLowerCase()===I);R&&(O=R.folderId)}let M={collectionId:v.id,parentId:O,name:_,method:q,url:k,headers:void 0,body:e.body?{type:"raw",raw:String(e.body),contentType:"application/json"}:void 0,description:typeof e.description=="string"?e.description:void 0},j=await r.collection.createRequest(M);return{id:j.id,name:j.name,created:!0,collection:v.name,hint:"Request created. Call run_request to execute it, or set_request_script to add pre-request/post-response scripts."}}if(t===G.updateRequest){let v=lt(e.collection,s),_=ns(e.request,v),q={};return typeof e.name=="string"&&(q.name=e.name),typeof e.method=="string"&&(q.method=e.method.toUpperCase()),typeof e.url=="string"&&(q.url=e.url),e.headers&&typeof e.headers=="object"&&!Array.isArray(e.headers)&&(q.headers=Object.entries(e.headers).map(([k,O])=>({name:k,value:String(O),enabled:!0}))),typeof e.body=="string"&&(q.body={type:"raw",raw:e.body,contentType:"application/json"}),typeof e.description=="string"&&(q.description=e.description),await r.collection.updateRequest(v.id,_.id,q),{updated:!0,request:_.name}}if(t===G.deleteRequest){if(e.confirm!==!0)throw le('"confirm" must be true to delete a request');let v=lt(e.collection,s),_=ns(e.request,v);return await r.collection.deleteRequest(v.id,_.id),{deleted:!0,request:_.name}}if(t===G.getRequestScript){let v=lt(e.collection,s),_=ns(e.request,v),q=e.phase;if(q!=="pre-request"&&q!=="post-response")throw le('"phase" must be "pre-request" or "post-response"');let k=r.collection.getRequestScript(v.id,_.id,q);return{collection:v.name,request:_.name,phase:q,script:k??""}}if(t===G.setRequestScript){let v=lt(e.collection,s),_=ns(e.request,v),q=e.phase;if(q!=="pre-request"&&q!=="post-response")throw le('"phase" must be "pre-request" or "post-response"');if(typeof e.script!="string")throw le('"script" is required');return await r.collection.setRequestScript(v.id,_.id,q,e.script),{updated:!0,collection:v.name,request:_.name,phase:q}}if(t===G.reorderCollectionItems){let v=lt(e.collection,s);if(!Array.isArray(e.order))throw le('"order" must be an array');let _;if(typeof e.folder=="string"&&e.folder.trim()){let O=e.folder.toLowerCase(),M=Vr(v).find(j=>j.folderPath===e.folder||j.folderPath.toLowerCase()===O);if(!M)throw le(`folder "${e.folder}" not found in collection "${v.name}"`);_=M.folderId}let q=_?v.items.find(O=>O.id===_)?.items??[]:v.items,k=e.order.map(O=>q.find(j=>j.id===O||j.name===O)?.id??O);return await r.collection.reorderItems(v.id,_,k),{reordered:!0,collection:v.name,order:e.order}}let o=v=>(Array.isArray(v.nodes)?v.nodes:[]).every(q=>q?.type==="request"),l=(v,_="")=>{let q=[];if(!Array.isArray(v))return q;for(let k=0;k<v.length;k+=1){let O=v[k],M=_?`${_}.${k}`:`${k}`;!O||typeof O!="object"||(O.type==="request"&&q.push({node:O,path:M}),Array.isArray(O.nodes)&&q.push(...l(O.nodes,`${M}.nodes`)),Array.isArray(O.then)&&q.push(...l(O.then,`${M}.then`)),Array.isArray(O.else)&&q.push(...l(O.else,`${M}.else`)),Array.isArray(O.default)&&q.push(...l(O.default,`${M}.default`)),Array.isArray(O.elseif)&&O.elseif.forEach((j,I)=>{Array.isArray(j?.nodes)&&q.push(...l(j.nodes,`${M}.elseif.${I}.nodes`)),Array.isArray(j?.then)&&q.push(...l(j.then,`${M}.elseif.${I}.then`))}),Array.isArray(O.cases)&&O.cases.forEach((j,I)=>{Array.isArray(j?.nodes)&&q.push(...l(j.nodes,`${M}.cases.${I}.nodes`)),Array.isArray(j?.then)&&q.push(...l(j.then,`${M}.cases.${I}.then`))}))}return q},c=(v,_)=>{if(typeof v!="string"||!v.trim())throw le(`"${_}" is required`);let q=v.trim(),k=q.split(".");if(k.some(O=>O===""))throw le(`"${_}" is invalid: "${q}"`);return k.map(O=>/^\d+$/.test(O)?Number(O):O)},d=(v,_)=>{let q=c(_,"path"),k=v;for(let O of q)if(typeof O=="number"){if(!Array.isArray(k)||O<0||O>=k.length)throw le(`node path not found: "${String(_)}"`);k=k[O]}else{if(!k||typeof k!="object"||!(O in k))throw le(`node path not found: "${String(_)}"`);k=k[O]}return k},p=(v,_)=>{let q=c(_,"path"),k=q[q.length-1];if(typeof k!="number")throw le(`"path" must end with a numeric index: "${String(_)}"`);let O=v;for(let M=0;M<q.length-1;M+=1){let j=q[M];if(typeof j=="number"){if(!Array.isArray(O)||j<0||j>=O.length)throw le(`node path not found: "${String(_)}"`);O=O[j]}else{if(!O||typeof O!="object"||!(j in O))throw le(`node path not found: "${String(_)}"`);O=O[j]}}if(!Array.isArray(O)||k<0||k>=O.length)throw le(`node path not found: "${String(_)}"`);return{array:O,index:k}},m=(v,_,q,k)=>{if(_==null||_===""){if(q!=null&&q!=="")throw le(`"${k}" is only valid when a parent path is provided`);return{array:v,pathPrefix:""}}if(typeof q!="string"||!q.trim())throw le(`"${k}" is required when parent path is provided`);let O=String(_).trim(),M=q.trim(),j=d(v,O),I=c(M,k),R=j;for(let A=0;A<I.length;A+=1){let F=I[A],U=A===I.length-1;if(typeof F=="number"){if(!Array.isArray(R)||F<0||F>=R.length)throw le(`branch path not found: "${M}"`);R=R[F]}else{if(!R||typeof R!="object")throw le(`branch path not found: "${M}"`);if(!(F in R))if(U)R[F]=[];else throw le(`branch path not found: "${M}"`);R=R[F]}}if(!Array.isArray(R))throw le(`target branch must be an array: "${M}"`);return{array:R,pathPrefix:`${O}.${M}`}},y=(v,_="")=>{let q=[],k=[],O=(M,j)=>{if(Array.isArray(M)){j&&k.push(j);for(let I=0;I<M.length;I+=1){let R=M[I],A=j?`${j}.${I}`:`${I}`;q.push({path:A,type:R?.type,name:R?.name}),!(!R||typeof R!="object")&&(Array.isArray(R.nodes)&&O(R.nodes,`${A}.nodes`),Array.isArray(R.then)&&O(R.then,`${A}.then`),Array.isArray(R.else)&&O(R.else,`${A}.else`),Array.isArray(R.default)&&O(R.default,`${A}.default`),Array.isArray(R.cases)&&R.cases.forEach((F,U)=>{Array.isArray(F?.nodes)&&O(F.nodes,`${A}.cases.${U}.nodes`),Array.isArray(F?.then)&&O(F.then,`${A}.cases.${U}.then`)}),Array.isArray(R.elseif)&&R.elseif.forEach((F,U)=>{Array.isArray(F?.nodes)&&O(F.nodes,`${A}.elseif.${U}.nodes`),Array.isArray(F?.then)&&O(F.then,`${A}.elseif.${U}.then`)}))}}};return O(v,_),{nodePaths:q,branchPaths:k}};if(t===G.listSuites)return{suites:(await r.testSuite.getAllSuites()).map(_=>({id:_.id,name:_.name,description:_.description??"",requestCount:l(_.nodes||[]).length,flowNodeCount:_.nodes?.length??0,iterations:_.config?.iterations??1}))};if(t===G.getSuite){let v=await En(e.suite,r),_=l(v.nodes||[]);return{id:v.id,name:v.name,description:v.description??"",config:{iterations:v.config?.iterations??1,delayBetweenRequests:v.config?.delayBetweenRequests??0,stopOnError:v.config?.stopOnError??!1},nodes:v.nodes||[],requests:_.map(({node:q,path:k})=>{let O=q.request;return{nodePath:k,slug:O.slug??O.requestId,collectionId:O.collectionId,requestId:O.requestId,name:O.name,method:O.method,folderPath:O.folderPath??"",enabled:q.enabled!==!1}})}}if(t===G.createSuite){let v=typeof e.name=="string"?e.name.trim():"";if(!v)throw le('"name" is required');let _;if(typeof e.fromCollection=="string"&&e.fromCollection.trim()){let q=lt(e.fromCollection,s),k=await r.testSuite.createTempSuiteFromCollection(q.id);if(!k)throw new Error(`Could not build suite from collection "${q.name}"`);if(typeof e.fromFolder=="string"&&e.fromFolder.trim()){let O=_p(e.fromFolder),M=k.nodes||[];k.nodes=M.filter(j=>{if(j.type!=="request")return!0;let I=j.request?.folderPath||"";return I===O||I.startsWith(`${O}/`)})}_=await r.testSuite.saveTempSuite(k,v)}else _=await r.testSuite.createSuite(v);if(e.iterations!==void 0||e.stopOnError!==void 0||e.delayBetweenRequests!==void 0||e.description!==void 0||e.nodes!==void 0){if(e.description!==void 0&&(_.description=String(e.description)),e.nodes!==void 0){if(!Array.isArray(e.nodes))throw le('"nodes" must be an array when provided');_.nodes=e.nodes}_.config={..._.config,...typeof e.iterations=="number"?{iterations:e.iterations}:{},...typeof e.stopOnError=="boolean"?{stopOnError:e.stopOnError}:{},...typeof e.delayBetweenRequests=="number"?{delayBetweenRequests:e.delayBetweenRequests}:{}},await r.testSuite.updateSuite(_)}return{id:_.id,name:_.name,requestCount:_.nodes?.filter(q=>q.type==="request").length??0,created:!0,hint:(_.nodes?.filter(q=>q.type==="request").length??0)===0?"Suite is empty. Call add_suite_requests to populate it with requests from a collection.":"Suite created. Call run_suite to execute it."}}if(t===G.updateSuiteConfig){let v=await En(e.suite,r);if(typeof e.name=="string"&&e.name.trim()&&(v.name=e.name.trim()),typeof e.description=="string"&&(v.description=e.description),e.nodes!==void 0){if(!Array.isArray(e.nodes))throw le('"nodes" must be an array when provided');v.nodes=e.nodes}return v.config={...v.config,...typeof e.iterations=="number"?{iterations:e.iterations}:{},...typeof e.stopOnError=="boolean"?{stopOnError:e.stopOnError}:{},...typeof e.delayBetweenRequests=="number"?{delayBetweenRequests:e.delayBetweenRequests}:{}},await r.testSuite.updateSuite(v),{updated:!0,suite:v.name}}if(t===G.getSuiteNode){let v=await En(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=d(v.nodes,e.path);return{suite:v.name,path:String(e.path),node:_}}if(t===G.listSuiteNodePaths){let v=await En(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=e.includeBranches!==!1,q=y(v.nodes);return{suite:v.name,nodeCount:q.nodePaths.length,nodePaths:q.nodePaths,branchPaths:_?q.branchPaths:void 0,rootBranchPath:""}}if(t===G.addSuiteNode){let v=await En(e.suite,r);if(Array.isArray(v.nodes)||(v.nodes=[]),!e.node||typeof e.node!="object"||Array.isArray(e.node))throw le('"node" must be an object');let{array:_,pathPrefix:q}=m(v.nodes,e.parentPath,e.branch,"branch"),k=typeof e.index=="number"?Math.max(0,Math.min(e.index,_.length)):_.length;_.splice(k,0,e.node),await r.testSuite.updateSuite(v);let O=q?`${q}.${k}`:`${k}`;return{added:!0,suite:v.name,path:O}}if(t===G.updateSuiteNode){let v=await En(e.suite,r);if(Array.isArray(v.nodes)||(v.nodes=[]),!e.node||typeof e.node!="object"||Array.isArray(e.node))throw le('"node" must be an object');let _=p(v.nodes,e.path);return _.array[_.index]=e.node,await r.testSuite.updateSuite(v),{updated:!0,suite:v.name,path:String(e.path)}}if(t===G.removeSuiteNode){let v=await En(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=p(v.nodes,e.path),[q]=_.array.splice(_.index,1);return await r.testSuite.updateSuite(v),{removed:!0,suite:v.name,path:String(e.path),removedType:q?.type}}if(t===G.moveSuiteNode){let v=await En(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=p(v.nodes,e.fromPath),q=_.array[_.index];_.array.splice(_.index,1);let{array:k,pathPrefix:O}=m(v.nodes,e.toParentPath,e.toBranch,"toBranch"),M=typeof e.toIndex=="number"?Math.max(0,Math.min(e.toIndex,k.length)):k.length;_.array===k&&_.index<M&&(M-=1),k.splice(M,0,q),await r.testSuite.updateSuite(v);let j=O?`${O}.${M}`:`${M}`;return{moved:!0,suite:v.name,fromPath:String(e.fromPath),toPath:j}}if(t===G.addSuiteRequests){let v=await En(e.suite,r),_=Array.isArray(e.requests)?e.requests:[];if(_.length===0)throw le('"requests" array is required and must not be empty');let q=[];for(let M of _){let j=lt(M.collection,s),I=ns(M.request,j),R=nt(j).find(A=>A.request.id===I.id)?.folderPath??"";q.push({slug:I.id,collectionId:j.id,requestId:I.id,name:I.name,method:I.method,collectionName:j.name,folderPath:R,enabled:!0})}v.nodes||(v.nodes=[]);let k=q.map(M=>({type:"request",name:M.name,request:M,enabled:!0})),O=typeof e.insertAt=="number"?Math.max(0,Math.min(e.insertAt,v.nodes.length)):v.nodes.length;return v.nodes.splice(O,0,...k),await r.testSuite.updateSuite(v),{added:q.length,suite:v.name,insertAt:O,addedPaths:k.map((M,j)=>`${O+j}`),newRequestCount:l(v.nodes||[]).length}}if(t===G.removeSuiteRequest){let v=await En(e.suite,r);if(!o(v))throw le('remove_suite_request currently supports request-only root suites. For flow suites, use get_suite/update_suite_config with the full "nodes" graph.');v.nodes||(v.nodes=[]);let _=v.nodes.filter(k=>k.type==="request"),q;if(typeof e.index=="number"){if(e.index<0||e.index>=_.length)throw le(`index ${e.index} is out of range`);let k=_[e.index];q=k.name||k.request?.name,v.nodes=v.nodes.filter(O=>O!==k)}else if(typeof e.request=="string"){let k=e.request.toLowerCase(),O=_.find(M=>{let j=M.request?.name||M.name||"";return j===e.request||j.toLowerCase()===k});if(!O)throw le(`request "${e.request}" not found in suite "${v.name}"`);q=O.name||O.request?.name,v.nodes=v.nodes.filter(M=>M!==O)}else throw le('either "index" or "request" is required');return await r.testSuite.updateSuite(v),{removed:!0,request:q,newRequestCount:v.nodes.filter(k=>k.type==="request").length}}if(t===G.reorderSuiteRequests){let v=await En(e.suite,r);if(!o(v))throw le('reorder_suite_requests currently supports request-only root suites. For flow suites, use get_suite/update_suite_config with the full "nodes" graph.');if(!Array.isArray(e.order))throw le('"order" must be an array of request names');let _=e.order,q=(v.nodes||[]).filter(M=>M.type==="request"),k=(v.nodes||[]).filter(M=>M.type!=="request"),O=[...q].sort((M,j)=>{let I=M.request?.name||M.name||"",R=j.request?.name||j.name||"",A=_.findIndex(J=>J===I||J.toLowerCase()===I.toLowerCase()),F=_.findIndex(J=>J===R||J.toLowerCase()===R.toLowerCase());return(A===-1?1/0:A)-(F===-1?1/0:F)});return v.nodes=[...O,...k],await r.testSuite.updateSuite(v),{reordered:!0,suite:v.name,newOrder:O.map(M=>M.request?.name||M.name)}}if(t===G.duplicateSuite){let v=await En(e.suite,r),_=typeof e.newName=="string"?e.newName.trim():"";if(!_)throw le('"newName" is required');let q=await r.testSuite.duplicateSuite(v.id,_);return{id:q.id,name:q.name,duplicatedFrom:v.name,requestCount:q.nodes?.filter(k=>k.type==="request").length??0}}if(t===G.deleteSuite){if(e.confirm!==!0)throw le('"confirm" must be true to delete a suite');let v=await En(e.suite,r);return await r.testSuite.deleteSuite(v.id),{deleted:!0,suite:v.name}}if(t===G.listEnvironments){let v=r.environmentConfig.getAllEnvironments(),_=r.environmentConfig.getSelectedEnvironment();return{environments:v.map(q=>({name:q.name,active:q.active,variableKeys:Object.keys(q.variables)})),active:_}}if(t===G.getEnvironmentVariables){let v=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment(),_=r.environmentConfig.getResolvedEnvironment(v);if(!_)throw le(`environment "${v}" not found`);let k=r.environmentConfig.getSharedConfig()?.environments?.[v]?.variables??{},O=r.environmentConfig.getEnvironmentVariableLocals();return{environment:v,active:r.environmentConfig.getSelectedEnvironment()===v,fileVariables:k,sessionOverrides:O,resolved:_.variables}}if(t===G.selectEnvironment){let v=typeof e.environment=="string"?e.environment.trim():"";if(!v)throw le('"environment" is required');return await r.environmentConfig.setSelectedEnvironment(v),{selected:!0,environment:v}}if(t===G.createEnvironment){let v=typeof e.name=="string"?e.name.trim():"";if(!v)throw le('"name" is required');if(await r.environmentConfig.createEnvironment(v),e.variables&&typeof e.variables=="object"){let _=e.variables,q=r.environmentConfig.getSharedConfig();q&&(q.environments=q.environments??{},q.environments[v]={...q.environments[v]??{},variables:{...q.environments[v]?.variables??{},..._}},r.environmentConfig.saveSharedConfig(q))}return{created:!0,environment:v}}if(t===G.deleteEnvironment){if(e.confirm!==!0)throw le('"confirm" must be true to delete an environment');let v=typeof e.environment=="string"?e.environment.trim():"";if(!v)throw le('"environment" is required');let _=r.environmentConfig.getSelectedEnvironment();return await r.environmentConfig.deleteEnvironment(v),{deleted:!0,environment:v,newActive:_===v?void 0:_}}if(t===G.setEnvironmentVariable){let v=typeof e.key=="string"?e.key.trim():"",_=typeof e.value=="string"?e.value:String(e.value??"");if(!v)throw le('"key" is required');let q=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment(),k=e.scope==="permanent"?"permanent":"session";if(k==="permanent"){let O=r.environmentConfig.getSharedConfig();O&&(O.environments=O.environments??{},O.environments[q]=O.environments[q]??{variables:{}},O.environments[q].variables=O.environments[q].variables??{},O.environments[q].variables[v]=_,r.environmentConfig.saveSharedConfig(O))}else r.environmentConfig.setEnvironmentVariable(v,_,q);return{set:!0,key:v,environment:q,scope:k}}if(t===G.unsetEnvironmentVariable){let v=typeof e.key=="string"?e.key.trim():"";if(!v)throw le('"key" is required');let _=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment();return r.environmentConfig.deleteEnvironmentVariable(v,_),{unset:!0,key:v,environment:_}}if(t===G.setGlobalVariable){let v=typeof e.key=="string"?e.key.trim():"",_=typeof e.value=="string"?e.value:String(e.value??"");if(!v)throw le('"key" is required');let q=e.scope==="permanent"?"permanent":"session";if(q==="permanent"){let k=r.environmentConfig.getSharedConfig();k&&(k.globalVariables=k.globalVariables??{},k.globalVariables[v]=_,r.environmentConfig.saveSharedConfig(k))}else r.environmentConfig.setGlobalVariable(v,_);return{set:!0,key:v,scope:q}}if(t===G.getGlobals)return{globals:r.environmentConfig.getGlobalVariables()};if(t===G.scaffoldCollectionFromOpenApi){let v=typeof e.specPath=="string"?e.specPath.trim():"";if(!v)throw le('"specPath" is required');let _=r.workspaceFolder&&!is.isAbsolute(v)?is.join(r.workspaceFolder,v):v;if(!Ap.existsSync(_))throw le(`OpenAPI spec file not found: "${_}"`);let k=await new Hs(r.collection,r.environmentConfig).import(_,{collectionName:typeof e.collectionName=="string"?e.collectionName:void 0,environmentName:typeof e.environmentName=="string"?e.environmentName:void 0});return{collectionId:k.collection.id,collectionName:k.collection.name,requestCount:k.collection.items.filter(O=>O.type==="request").length,environmentCreated:k.environmentCreated??null,hint:"Use list_requests to browse the scaffolded collection, then run_request to test individual endpoints."}}if(t===G.suggestAssertions){let v=e.collection;if(!(typeof e.request=="string"?e.request.trim():""))throw le('"request" is required');let q=lt(v,s),k=ns(e.request,q),O=typeof e.maxSuggestions=="number"?Math.min(20,Math.max(1,e.maxSuggestions)):10,M=[],I=Array.from(n.values()).filter(U=>U.status!=="running").flatMap(U=>U.allResults??[]).filter(U=>U.name===k.name||typeof U.name=="string"&&U.name.toLowerCase()===k.name.toLowerCase()),R=I[I.length-1],A=R?.status;A?M.push({snippet:`pm.test("Status code is ${A}", function () {
|
|
352
|
+
Example: for POST /users with body {"name":"{{name}}","email":"{{email}}"} and iterations=4, generate 4 rows: valid user, duplicate email, missing name, email with invalid format.`,inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name, slug, or id."},iterations:{type:"number",description:"Number of test data rows to generate (default: 5, max: 50)."}},required:["collection","request"]},annotations:{readOnlyHint:!0}}]}var qp,Op,Ip,Pp,G,kp=ae(()=>{"use strict";qp={type:"object",properties:{environment:{type:"string",description:"Environment name to use (defaults to the currently selected environment)"},variables:{type:"object",description:"Extra variables to inject \u2014 merged with environment variables, {{name}} syntax",additionalProperties:{type:"string"}},headers:{type:"object",description:"Override or add request headers",additionalProperties:{type:"string"}},query:{type:"object",description:"Override query parameters",additionalProperties:{type:"string"}},body:{type:"string",description:"Replace the request body (JSON string). Omit to use the saved body."},include:{type:"array",items:{type:"string",enum:["headers","cookies","tests","consoleOutput","report"]},description:"Extra fields to include in the response (default: status, ok, body, allPassed)"}}},Op={type:"object",properties:{environment:{type:"string",description:"Environment name to use"},variables:{type:"object",description:"Extra variables injected into every request",additionalProperties:{type:"string"}},iterations:{type:"number",description:"Number of iterations (default: 1)"},concurrency:{type:"number",description:"Number of parallel virtual users (1\u201350, default: 1). Each VU runs the full request sequence independently, preserving inter-request dependencies."},stopOnError:{type:"boolean",description:"Stop on first failure"},delay:{type:"number",description:"Delay between requests in ms"},include:{type:"array",items:{type:"string",enum:["perRequest","failedOnly","consoleOutput","report"]},description:"Result detail level"},async:{type:"boolean",description:"When true, start the run in the background and return a runId immediately. Use get_run_status / get_failed_requests to poll results. Recommended for folders with many requests."}}},Ip={type:"object",properties:{environment:{type:"string",description:"Environment name to use"},variables:{type:"object",description:"Extra variables injected into every request",additionalProperties:{type:"string"}},iterations:{type:"number",description:"Number of iterations (default: 1)"},concurrency:{type:"number",description:"Number of parallel virtual users (1\u201350, default: 1). Each VU runs the full request sequence independently."},stopOnError:{type:"boolean",description:"Stop on first failure"},delay:{type:"number",description:"Delay between requests in ms"},recursive:{type:"boolean",description:"Include requests in nested subfolders (default: true)"},include:{type:"array",items:{type:"string",enum:["perRequest","failedOnly","consoleOutput","report"]},description:"Result detail level"},async:{type:"boolean",description:"When true, start the run in the background and return a runId immediately. Use get_run_status / get_failed_requests to poll results. Recommended for folders with many requests."}}},Pp={type:"object",properties:{environment:{type:"string",description:"Environment name to use"},iterations:{type:"number",description:"Number of iterations (overrides suite default)"},concurrency:{type:"number",description:"Number of parallel virtual users (1\u201350, default: 1). Each VU runs the full request sequence independently."},stopOnError:{type:"boolean",description:"Stop on first failure"},delay:{type:"number",description:"Delay between requests in ms"},variables:{type:"object",description:"Extra variables injected into every request",additionalProperties:{type:"string"}},async:{type:"boolean",description:"When true, start the run in the background and return a runId immediately. Use get_run_status / get_failed_requests to poll results."},requestFilter:{type:"array",items:{type:"string"},description:"Run only requests whose names match one of these strings (case-insensitive)"},include:{type:"array",items:{type:"string",enum:["perRequest","failedOnly","consoleOutput","report"]},description:"Result detail level (default: summary + failedRequests)"}}},G={listCollections:"list_collections",listFolders:"list_folders",listRequests:"list_requests",searchRequests:"search_requests",getEnvironment:"get_environment",runRequest:"run_request",runFolder:"run_folder",runCollection:"run_collection",runSuite:"run_suite",getRunStatus:"get_run_status",getRunSummary:"get_run_summary",getFailedRequests:"get_failed_requests",getRequestResult:"get_request_result",cancelRun:"cancel_run",setVariable:"set_variable",createCollection:"create_collection",renameCollection:"rename_collection",deleteCollection:"delete_collection",duplicateCollection:"duplicate_collection",createFolder:"create_folder",deleteFolder:"delete_folder",getRequest:"get_request",createRequest:"create_request",updateRequest:"update_request",deleteRequest:"delete_request",getRequestScript:"get_request_script",setRequestScript:"set_request_script",reorderCollectionItems:"reorder_collection_items",listSuites:"list_suites",getSuite:"get_suite",createSuite:"create_suite",updateSuiteConfig:"update_suite_config",getSuiteNode:"get_suite_node",listSuiteNodePaths:"list_suite_node_paths",addSuiteNode:"add_suite_node",updateSuiteNode:"update_suite_node",removeSuiteNode:"remove_suite_node",moveSuiteNode:"move_suite_node",addSuiteRequests:"add_suite_requests",removeSuiteRequest:"remove_suite_request",reorderSuiteRequests:"reorder_suite_requests",duplicateSuite:"duplicate_suite",deleteSuite:"delete_suite",listEnvironments:"list_environments",getEnvironmentVariables:"get_environment_variables",selectEnvironment:"select_environment",createEnvironment:"create_environment",deleteEnvironment:"delete_environment",setEnvironmentVariable:"set_environment_variable",unsetEnvironmentVariable:"unset_environment_variable",setGlobalVariable:"set_global_variable",getGlobals:"get_globals",scaffoldCollectionFromOpenApi:"scaffold_collection_from_openapi",suggestAssertions:"suggest_assertions",explainFailure:"explain_failure",suggestEnvVars:"suggest_env_vars",applyEnvVars:"apply_env_vars",getRequestsForEnhancement:"get_requests_for_enhancement",applyRequestEnhancements:"apply_request_enhancements",aiSuggestEnvVars:"ai_suggest_env_vars",aiEnhanceCollection:"ai_enhance_collection",analyzeCoverage:"analyze_coverage",aiAnalyzeCoverage:"ai_analyze_coverage",generateRequestFromIntent:"generate_request_from_intent",validateAgainstSpec:"validate_against_spec",generateScenarios:"generate_scenarios",healAssertions:"heal_assertions",generateIterationData:"generate_iteration_data"}});function le(t){return new Error(`Bad request: ${t}`)}function lt(t,e){if(typeof t!="string"||!t.trim())throw le('the "collection" argument is required');let r=t.toLowerCase(),n=e.find(i=>i.id===t||i.name===t)??e.find(i=>i.name.toLowerCase()===r)??e.find(i=>i.name.toLowerCase().includes(r))??e.find(i=>i.id.toLowerCase().includes(r));if(!n){let i=e.map(s=>`"${s.name}"`).join(", ");throw le(`collection not found: "${t}". Available collections: ${i||"(none)"}. Call list_collections to see all.`)}return n}function ns(t,e){if(typeof t!="string"||!t.trim())throw le('the "request" argument is required');let r=nt(e),n=t.toLowerCase(),i=r.find(s=>s.request.id===t||s.request.name===t)??r.find(s=>s.request.name.toLowerCase()===n)??r.find(s=>s.request.name.toLowerCase().includes(n));if(!i){let s=r.slice(0,10).map(o=>`"${o.request.name}"`).join(", ");throw le(`request "${t}" not found in collection "${e.name}". First ${Math.min(r.length,10)} requests: ${s||"(none)"}. Call list_requests or search_requests to find the exact name.`)}return i.request}function bN(t,e){for(let r of t){if(r.type!=="folder")continue;let n=r;if(n.id===e)return n;let i=bN(n.items??[],e);if(i)return i}}async function En(t,e){if(typeof t!="string"||!t.trim())throw le('the "suite" argument is required');let r=await e.testSuite.getAllSuites(),n=t.toLowerCase(),i=r.find(s=>s.id===t||s.name===t)??r.find(s=>s.name.toLowerCase()===n);if(!i){let s=r.map(o=>`"${o.name}"`).join(", ");throw le(`suite "${t}" not found. Available suites: ${s||"(none)"}. Call list_suites to see all.`)}return i}async function Gy(t,e,r,n,i){let s=r.collection.getAllCollections();if(t===G.listCollections)return{collections:s.map(v=>({name:v.name,id:v.id,description:v.description??"",requestCount:nt(v).length}))};if(t===G.listFolders){let v=lt(e.collection,s);return{collection:v.name,folders:Vr(v).map(({folderPath:_,requestCount:E})=>({path:rs(_),requestCount:E}))}}if(t===G.listRequests){let v=lt(e.collection,s),_=typeof e.folder=="string"?e.folder.toLowerCase():void 0,E=typeof e.offset=="number"?Math.max(0,e.offset):0,k=typeof e.limit=="number"?Math.min(200,Math.max(1,e.limit)):50,O=nt(v).filter(({folderPath:M})=>!_||M.toLowerCase().includes(_)).map(({request:M,folderPath:j})=>({id:M.id,name:M.name,method:M.method,folder:rs(j),description:M.description??""}));return{collection:v.name,total:O.length,offset:E,limit:k,requests:O.slice(E,E+k)}}if(t===G.searchRequests){let v=lt(e.collection,s),_=typeof e.query=="string"?e.query.toLowerCase().trim():"";if(!_)throw le('the "query" argument is required');let E=nt(v).filter(({request:k,folderPath:O})=>k.name.toLowerCase().includes(_)||(k.url??"").toLowerCase().includes(_)||k.method.toLowerCase().includes(_)||O.toLowerCase().includes(_)||(k.description??"").toLowerCase().includes(_)).map(({request:k,folderPath:O})=>({id:k.id,name:k.name,method:k.method,url:k.url??"",folder:rs(O),description:k.description??""}));return{collection:v.name,query:e.query,total:E.length,requests:E}}if(t===G.getRequest){let v=lt(e.collection,s),_=ns(e.request,v),E=r.collection.getRequestScript(v.id,_.id,"pre-request")??"",k=r.collection.getRequestScript(v.id,_.id,"post-response")??"";return{id:_.id,name:_.name,method:_.method,url:_.url??"",description:_.description??"",headers:_.headers??[],body:_.body??null,auth:_.auth??null,scripts:{preRequest:E,postResponse:k},hint:"Use update_request to modify fields, set_request_script to modify scripts, or run_request to execute it."}}if(t===G.getEnvironment){let v=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment(),_=r.environmentConfig.getResolvedEnvironment(v);if(!_)throw le(`environment "${v}" not found`);return{name:_.name,variables:_.variables}}if(t===G.setVariable){let v=typeof e.key=="string"?e.key.trim():"",_=typeof e.value=="string"?e.value:String(e.value??"");if(!v)throw le('"key" is required');let E=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment();return r.environmentConfig.setEnvironmentVariable(v,_,E),{set:!0,key:v,environment:E}}if(t===G.getRunStatus){let v=n.require(e.runId);return{runId:v.id,status:v.status,suiteName:v.suiteName,progress:v.progress,...v.error?{error:v.error}:{}}}if(t===G.getRunSummary){let v=n.require(e.runId);if(v.status==="running")return{runId:v.id,status:"running",progress:v.progress};let _=(v.summary.failed??0)>0||v.summary.allPassed===!1,E=v.noAssertionExamples??[],k=E.length,O=v.summary.total,M=k>0?k/(O||1)>.5?`${k}/${O} requests have no pm.test() assertions. Invoke the "review-collection" prompt (collection="${v.suiteName}") for a full coverage analysis.`:`${k} request(s) have no pm.test() assertions (e.g. ${E.slice(0,3).map(j=>`"${j}"`).join(", ")}). Invoke the "suggest-assertions" prompt (collection="${v.suiteName}") to add test coverage.`:null;return{runId:v.id,status:v.status,suiteName:v.suiteName,summary:v.summary,...v.reportPath?{report:{uri:`file://${v.reportPath}`}}:{},..._?{failedRequests:v.failedRequests}:{},..._?{_nextStep:`REQUIRED ACTION: ${v.summary.failed} request(s) failed. The failedRequests array above contains the full details (method, url, requestBody, requestHeaders, status, responseBody, failedTests). Immediately analyze each failed request and provide: (1) root cause, (2) specific fix, (3) corrected pm.test() assertions if relevant. Do NOT wait for the user to ask \u2014 diagnose now.`}:{},...M?{_suggestions:[M]}:{}}}if(t===G.getFailedRequests){let v=n.require(e.runId);if(v.status==="running")return{runId:v.id,status:"running",progress:v.progress,failedSoFar:v.failedRequests.length};let _=typeof e.offset=="number"?Math.max(0,e.offset):0,E=typeof e.limit=="number"?Math.min(100,Math.max(1,e.limit)):20;return{runId:v.id,status:v.status,totalFailed:v.failedRequests.length,offset:_,limit:E,failedRequests:v.failedRequests.slice(_,_+E)}}if(t===G.getRequestResult){let v=n.require(e.runId),_=e.request;if(typeof _!="string"||!_)throw le('"request" is required');let E=typeof e.iteration=="number"?e.iteration:1,k=v.allResults.find(O=>O.iteration===E&&(O.name===_||O.name.toLowerCase()===_.toLowerCase()));if(!k){if(v.status==="running")return{runId:v.id,status:"running",message:`Request "${_}" has not completed yet.`};throw new Error(`Request "${_}" (iteration ${E}) not found in run "${v.id}".`)}return{runId:v.id,...k}}if(t===G.cancelRun){let v=n.require(e.runId);if(v.status!=="running")return{runId:v.id,status:v.status,cancelled:!1,message:`Run is already "${v.status}" \u2014 nothing to cancel.`};let _=n.cancel(String(e.runId));return{runId:v.id,status:"cancelled",cancelled:_,progress:v.progress,message:"Cancellation requested. The currently-executing request will finish; remaining requests will be skipped."}}if(t===G.runRequest){let v=lt(e.collection,s),_=nt(v),E=typeof e.requestId=="string"?e.requestId.trim():void 0,k=e.request,O;if(E){if(O=_.find(M=>M.request.id===E),!O)throw le(`request with id "${E}" not found in collection "${v.name}"`)}else{if(typeof k!="string"||!k.trim())throw le('the "request" or "requestId" argument is required');if(O=_.find(M=>M.request.name===k)??_.find(M=>M.request.name.toLowerCase()===k.toLowerCase()),!O)throw le(`request "${k}" not found in collection "${v.name}"`)}return i.runRequest(v,O.request.id,e)}if(t===G.runFolder){let v=lt(e.collection,s);if(typeof e.folder!="string"||!e.folder.trim())throw le('the "folder" argument is required');let _=e.folder.toLowerCase(),E=_p(e.folder),k=E.toLowerCase(),O=Vr(v).map(j=>j.folderPath),M=O.find(j=>j===E)??O.find(j=>j.toLowerCase()===k)??O.find(j=>j.toLowerCase().includes(k))??O.find(j=>j.split("/").some(I=>I.toLowerCase().includes(k)));if(!M){let j=O.map(I=>`"${I}"`).join(", ");throw le(`folder "${e.folder}" not found in collection "${v.name}". Available folders: ${j||"(none)"}. Call list_folders to see all.`)}return i.runFolder(v,M,e)}if(t===G.runCollection){let v=lt(e.collection,s);return i.runCollection(v,e)}if(t===G.createCollection){let v=typeof e.name=="string"?e.name.trim():"";if(!v)throw le('"name" is required');let _=await r.collection.createCollection(v);return{id:_.id,name:_.name,created:!0,hint:"Collection is empty. Call create_folder to add folders, or create_request to add requests directly."}}if(t===G.renameCollection){let v=lt(e.collection,s),_=typeof e.newName=="string"?e.newName.trim():"";if(!_)throw le('"newName" is required');return await r.collection.renameCollection(v.id,_),{id:v.id,oldName:v.name,newName:_,renamed:!0}}if(t===G.deleteCollection){if(e.confirm!==!0)throw le('"confirm" must be true to delete a collection');let v=lt(e.collection,s);return await r.collection.deleteCollection(v.id),{deleted:!0,collection:v.name}}if(t===G.duplicateCollection){let v=lt(e.collection,s),_=typeof e.newName=="string"?e.newName.trim():"";if(!_)throw le('"newName" is required');let E=await r.collection.duplicateCollection(v.id,_);return{id:E.id,name:E.name,duplicatedFrom:v.name}}if(t===G.createFolder){let v=lt(e.collection,s),_=typeof e.name=="string"?e.name.trim():"";if(!_)throw le('"name" is required');let E;if(typeof e.parentFolder=="string"&&e.parentFolder.trim()){let O=e.parentFolder.toLowerCase(),M=Vr(v);if(nt(v).map(I=>I.folderPath)&&M.find(I=>I.folderPath===e.parentFolder||I.folderPath.toLowerCase()===O)){let R=Vr(v).find(A=>A.folderPath===e.parentFolder||A.folderPath.toLowerCase()===O);if(R){let A=v.items,F=(D,J)=>{for(let Q of D)if(Q.type==="folder"){let se=Q;if(se.name===J||J.endsWith("/"+se.name))return se;let ce=F(se.items??[],J);if(ce)return ce}};E=F(A,R.folderPath)?.id}}}let k=await r.collection.createFolder({collectionId:v.id,name:_,parentId:E});return{id:k.id,name:k.name,created:!0,collection:v.name}}if(t===G.deleteFolder){if(e.confirm!==!0)throw le('"confirm" must be true to delete a folder');let v=lt(e.collection,s);if(typeof e.folder!="string"||!e.folder.trim())throw le('"folder" is required');let _=e.folder.toLowerCase(),E=Vr(v).find(M=>M.folderPath===e.folder||M.folderPath.toLowerCase()===_);if(!E)throw le(`folder "${e.folder}" not found in collection "${v.name}"`);let k=bN(v.items,E.folderId);if(!k)throw le(`folder "${e.folder}" could not be resolved`);let O=E.requestCount;return await r.collection.deleteFolder(v.id,k.id),{deleted:!0,folder:E.folderPath,requestsRemoved:O}}if(t===G.createRequest){let v=lt(e.collection,s),_=typeof e.name=="string"?e.name.trim():"";if(!_)throw le('"name" is required');let E=typeof e.method=="string"?e.method.toUpperCase():"GET",k=typeof e.url=="string"?e.url:"";if(!k)throw le('"url" is required');let O;if(typeof e.folder=="string"&&e.folder.trim()){let I=e.folder.toLowerCase(),R=Vr(v).find(A=>A.folderPath===e.folder||A.folderPath.toLowerCase()===I);R&&(O=R.folderId)}let M={collectionId:v.id,parentId:O,name:_,method:E,url:k,headers:void 0,body:e.body?{type:"raw",raw:String(e.body),contentType:"application/json"}:void 0,description:typeof e.description=="string"?e.description:void 0},j=await r.collection.createRequest(M);return{id:j.id,name:j.name,created:!0,collection:v.name,hint:"Request created. Call run_request to execute it, or set_request_script to add pre-request/post-response scripts."}}if(t===G.updateRequest){let v=lt(e.collection,s),_=ns(e.request,v),E={};return typeof e.name=="string"&&(E.name=e.name),typeof e.method=="string"&&(E.method=e.method.toUpperCase()),typeof e.url=="string"&&(E.url=e.url),e.headers&&typeof e.headers=="object"&&!Array.isArray(e.headers)&&(E.headers=Object.entries(e.headers).map(([k,O])=>({name:k,value:String(O),enabled:!0}))),typeof e.body=="string"&&(E.body={type:"raw",raw:e.body,contentType:"application/json"}),typeof e.description=="string"&&(E.description=e.description),await r.collection.updateRequest(v.id,_.id,E),{updated:!0,request:_.name}}if(t===G.deleteRequest){if(e.confirm!==!0)throw le('"confirm" must be true to delete a request');let v=lt(e.collection,s),_=ns(e.request,v);return await r.collection.deleteRequest(v.id,_.id),{deleted:!0,request:_.name}}if(t===G.getRequestScript){let v=lt(e.collection,s),_=ns(e.request,v),E=e.phase;if(E!=="pre-request"&&E!=="post-response")throw le('"phase" must be "pre-request" or "post-response"');let k=r.collection.getRequestScript(v.id,_.id,E);return{collection:v.name,request:_.name,phase:E,script:k??""}}if(t===G.setRequestScript){let v=lt(e.collection,s),_=ns(e.request,v),E=e.phase;if(E!=="pre-request"&&E!=="post-response")throw le('"phase" must be "pre-request" or "post-response"');if(typeof e.script!="string")throw le('"script" is required');return await r.collection.setRequestScript(v.id,_.id,E,e.script),{updated:!0,collection:v.name,request:_.name,phase:E}}if(t===G.reorderCollectionItems){let v=lt(e.collection,s);if(!Array.isArray(e.order))throw le('"order" must be an array');let _;if(typeof e.folder=="string"&&e.folder.trim()){let O=e.folder.toLowerCase(),M=Vr(v).find(j=>j.folderPath===e.folder||j.folderPath.toLowerCase()===O);if(!M)throw le(`folder "${e.folder}" not found in collection "${v.name}"`);_=M.folderId}let E=_?v.items.find(O=>O.id===_)?.items??[]:v.items,k=e.order.map(O=>E.find(j=>j.id===O||j.name===O)?.id??O);return await r.collection.reorderItems(v.id,_,k),{reordered:!0,collection:v.name,order:e.order}}let o=v=>(Array.isArray(v.nodes)?v.nodes:[]).every(E=>E?.type==="request"),l=(v,_="")=>{let E=[];if(!Array.isArray(v))return E;for(let k=0;k<v.length;k+=1){let O=v[k],M=_?`${_}.${k}`:`${k}`;!O||typeof O!="object"||(O.type==="request"&&E.push({node:O,path:M}),Array.isArray(O.nodes)&&E.push(...l(O.nodes,`${M}.nodes`)),Array.isArray(O.then)&&E.push(...l(O.then,`${M}.then`)),Array.isArray(O.else)&&E.push(...l(O.else,`${M}.else`)),Array.isArray(O.default)&&E.push(...l(O.default,`${M}.default`)),Array.isArray(O.elseif)&&O.elseif.forEach((j,I)=>{Array.isArray(j?.nodes)&&E.push(...l(j.nodes,`${M}.elseif.${I}.nodes`)),Array.isArray(j?.then)&&E.push(...l(j.then,`${M}.elseif.${I}.then`))}),Array.isArray(O.cases)&&O.cases.forEach((j,I)=>{Array.isArray(j?.nodes)&&E.push(...l(j.nodes,`${M}.cases.${I}.nodes`)),Array.isArray(j?.then)&&E.push(...l(j.then,`${M}.cases.${I}.then`))}))}return E},c=(v,_)=>{if(typeof v!="string"||!v.trim())throw le(`"${_}" is required`);let E=v.trim(),k=E.split(".");if(k.some(O=>O===""))throw le(`"${_}" is invalid: "${E}"`);return k.map(O=>/^\d+$/.test(O)?Number(O):O)},d=(v,_)=>{let E=c(_,"path"),k=v;for(let O of E)if(typeof O=="number"){if(!Array.isArray(k)||O<0||O>=k.length)throw le(`node path not found: "${String(_)}"`);k=k[O]}else{if(!k||typeof k!="object"||!(O in k))throw le(`node path not found: "${String(_)}"`);k=k[O]}return k},p=(v,_)=>{let E=c(_,"path"),k=E[E.length-1];if(typeof k!="number")throw le(`"path" must end with a numeric index: "${String(_)}"`);let O=v;for(let M=0;M<E.length-1;M+=1){let j=E[M];if(typeof j=="number"){if(!Array.isArray(O)||j<0||j>=O.length)throw le(`node path not found: "${String(_)}"`);O=O[j]}else{if(!O||typeof O!="object"||!(j in O))throw le(`node path not found: "${String(_)}"`);O=O[j]}}if(!Array.isArray(O)||k<0||k>=O.length)throw le(`node path not found: "${String(_)}"`);return{array:O,index:k}},m=(v,_,E,k)=>{if(_==null||_===""){if(E!=null&&E!=="")throw le(`"${k}" is only valid when a parent path is provided`);return{array:v,pathPrefix:""}}if(typeof E!="string"||!E.trim())throw le(`"${k}" is required when parent path is provided`);let O=String(_).trim(),M=E.trim(),j=d(v,O),I=c(M,k),R=j;for(let A=0;A<I.length;A+=1){let F=I[A],U=A===I.length-1;if(typeof F=="number"){if(!Array.isArray(R)||F<0||F>=R.length)throw le(`branch path not found: "${M}"`);R=R[F]}else{if(!R||typeof R!="object")throw le(`branch path not found: "${M}"`);if(!(F in R))if(U)R[F]=[];else throw le(`branch path not found: "${M}"`);R=R[F]}}if(!Array.isArray(R))throw le(`target branch must be an array: "${M}"`);return{array:R,pathPrefix:`${O}.${M}`}},y=(v,_="")=>{let E=[],k=[],O=(M,j)=>{if(Array.isArray(M)){j&&k.push(j);for(let I=0;I<M.length;I+=1){let R=M[I],A=j?`${j}.${I}`:`${I}`;E.push({path:A,type:R?.type,name:R?.name}),!(!R||typeof R!="object")&&(Array.isArray(R.nodes)&&O(R.nodes,`${A}.nodes`),Array.isArray(R.then)&&O(R.then,`${A}.then`),Array.isArray(R.else)&&O(R.else,`${A}.else`),Array.isArray(R.default)&&O(R.default,`${A}.default`),Array.isArray(R.cases)&&R.cases.forEach((F,U)=>{Array.isArray(F?.nodes)&&O(F.nodes,`${A}.cases.${U}.nodes`),Array.isArray(F?.then)&&O(F.then,`${A}.cases.${U}.then`)}),Array.isArray(R.elseif)&&R.elseif.forEach((F,U)=>{Array.isArray(F?.nodes)&&O(F.nodes,`${A}.elseif.${U}.nodes`),Array.isArray(F?.then)&&O(F.then,`${A}.elseif.${U}.then`)}))}}};return O(v,_),{nodePaths:E,branchPaths:k}};if(t===G.listSuites)return{suites:(await r.testSuite.getAllSuites()).map(_=>({id:_.id,name:_.name,description:_.description??"",requestCount:l(_.nodes||[]).length,flowNodeCount:_.nodes?.length??0,iterations:_.config?.iterations??1}))};if(t===G.getSuite){let v=await En(e.suite,r),_=l(v.nodes||[]);return{id:v.id,name:v.name,description:v.description??"",config:{iterations:v.config?.iterations??1,delayBetweenRequests:v.config?.delayBetweenRequests??0,stopOnError:v.config?.stopOnError??!1},nodes:v.nodes||[],requests:_.map(({node:E,path:k})=>{let O=E.request;return{nodePath:k,slug:O.slug??O.requestId,collectionId:O.collectionId,requestId:O.requestId,name:O.name,method:O.method,folderPath:O.folderPath??"",enabled:E.enabled!==!1}})}}if(t===G.createSuite){let v=typeof e.name=="string"?e.name.trim():"";if(!v)throw le('"name" is required');let _;if(typeof e.fromCollection=="string"&&e.fromCollection.trim()){let E=lt(e.fromCollection,s),k=await r.testSuite.createTempSuiteFromCollection(E.id);if(!k)throw new Error(`Could not build suite from collection "${E.name}"`);if(typeof e.fromFolder=="string"&&e.fromFolder.trim()){let O=_p(e.fromFolder),M=k.nodes||[];k.nodes=M.filter(j=>{if(j.type!=="request")return!0;let I=j.request?.folderPath||"";return I===O||I.startsWith(`${O}/`)})}_=await r.testSuite.saveTempSuite(k,v)}else _=await r.testSuite.createSuite(v);if(e.iterations!==void 0||e.stopOnError!==void 0||e.delayBetweenRequests!==void 0||e.description!==void 0||e.nodes!==void 0){if(e.description!==void 0&&(_.description=String(e.description)),e.nodes!==void 0){if(!Array.isArray(e.nodes))throw le('"nodes" must be an array when provided');_.nodes=e.nodes}_.config={..._.config,...typeof e.iterations=="number"?{iterations:e.iterations}:{},...typeof e.stopOnError=="boolean"?{stopOnError:e.stopOnError}:{},...typeof e.delayBetweenRequests=="number"?{delayBetweenRequests:e.delayBetweenRequests}:{}},await r.testSuite.updateSuite(_)}return{id:_.id,name:_.name,requestCount:_.nodes?.filter(E=>E.type==="request").length??0,created:!0,hint:(_.nodes?.filter(E=>E.type==="request").length??0)===0?"Suite is empty. Call add_suite_requests to populate it with requests from a collection.":"Suite created. Call run_suite to execute it."}}if(t===G.updateSuiteConfig){let v=await En(e.suite,r);if(typeof e.name=="string"&&e.name.trim()&&(v.name=e.name.trim()),typeof e.description=="string"&&(v.description=e.description),e.nodes!==void 0){if(!Array.isArray(e.nodes))throw le('"nodes" must be an array when provided');v.nodes=e.nodes}return v.config={...v.config,...typeof e.iterations=="number"?{iterations:e.iterations}:{},...typeof e.stopOnError=="boolean"?{stopOnError:e.stopOnError}:{},...typeof e.delayBetweenRequests=="number"?{delayBetweenRequests:e.delayBetweenRequests}:{}},await r.testSuite.updateSuite(v),{updated:!0,suite:v.name}}if(t===G.getSuiteNode){let v=await En(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=d(v.nodes,e.path);return{suite:v.name,path:String(e.path),node:_}}if(t===G.listSuiteNodePaths){let v=await En(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=e.includeBranches!==!1,E=y(v.nodes);return{suite:v.name,nodeCount:E.nodePaths.length,nodePaths:E.nodePaths,branchPaths:_?E.branchPaths:void 0,rootBranchPath:""}}if(t===G.addSuiteNode){let v=await En(e.suite,r);if(Array.isArray(v.nodes)||(v.nodes=[]),!e.node||typeof e.node!="object"||Array.isArray(e.node))throw le('"node" must be an object');let{array:_,pathPrefix:E}=m(v.nodes,e.parentPath,e.branch,"branch"),k=typeof e.index=="number"?Math.max(0,Math.min(e.index,_.length)):_.length;_.splice(k,0,e.node),await r.testSuite.updateSuite(v);let O=E?`${E}.${k}`:`${k}`;return{added:!0,suite:v.name,path:O}}if(t===G.updateSuiteNode){let v=await En(e.suite,r);if(Array.isArray(v.nodes)||(v.nodes=[]),!e.node||typeof e.node!="object"||Array.isArray(e.node))throw le('"node" must be an object');let _=p(v.nodes,e.path);return _.array[_.index]=e.node,await r.testSuite.updateSuite(v),{updated:!0,suite:v.name,path:String(e.path)}}if(t===G.removeSuiteNode){let v=await En(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=p(v.nodes,e.path),[E]=_.array.splice(_.index,1);return await r.testSuite.updateSuite(v),{removed:!0,suite:v.name,path:String(e.path),removedType:E?.type}}if(t===G.moveSuiteNode){let v=await En(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=p(v.nodes,e.fromPath),E=_.array[_.index];_.array.splice(_.index,1);let{array:k,pathPrefix:O}=m(v.nodes,e.toParentPath,e.toBranch,"toBranch"),M=typeof e.toIndex=="number"?Math.max(0,Math.min(e.toIndex,k.length)):k.length;_.array===k&&_.index<M&&(M-=1),k.splice(M,0,E),await r.testSuite.updateSuite(v);let j=O?`${O}.${M}`:`${M}`;return{moved:!0,suite:v.name,fromPath:String(e.fromPath),toPath:j}}if(t===G.addSuiteRequests){let v=await En(e.suite,r),_=Array.isArray(e.requests)?e.requests:[];if(_.length===0)throw le('"requests" array is required and must not be empty');let E=[];for(let M of _){let j=lt(M.collection,s),I=ns(M.request,j),R=nt(j).find(A=>A.request.id===I.id)?.folderPath??"";E.push({slug:I.id,collectionId:j.id,requestId:I.id,name:I.name,method:I.method,collectionName:j.name,folderPath:R,enabled:!0})}v.nodes||(v.nodes=[]);let k=E.map(M=>({type:"request",name:M.name,request:M,enabled:!0})),O=typeof e.insertAt=="number"?Math.max(0,Math.min(e.insertAt,v.nodes.length)):v.nodes.length;return v.nodes.splice(O,0,...k),await r.testSuite.updateSuite(v),{added:E.length,suite:v.name,insertAt:O,addedPaths:k.map((M,j)=>`${O+j}`),newRequestCount:l(v.nodes||[]).length}}if(t===G.removeSuiteRequest){let v=await En(e.suite,r);if(!o(v))throw le('remove_suite_request currently supports request-only root suites. For flow suites, use get_suite/update_suite_config with the full "nodes" graph.');v.nodes||(v.nodes=[]);let _=v.nodes.filter(k=>k.type==="request"),E;if(typeof e.index=="number"){if(e.index<0||e.index>=_.length)throw le(`index ${e.index} is out of range`);let k=_[e.index];E=k.name||k.request?.name,v.nodes=v.nodes.filter(O=>O!==k)}else if(typeof e.request=="string"){let k=e.request.toLowerCase(),O=_.find(M=>{let j=M.request?.name||M.name||"";return j===e.request||j.toLowerCase()===k});if(!O)throw le(`request "${e.request}" not found in suite "${v.name}"`);E=O.name||O.request?.name,v.nodes=v.nodes.filter(M=>M!==O)}else throw le('either "index" or "request" is required');return await r.testSuite.updateSuite(v),{removed:!0,request:E,newRequestCount:v.nodes.filter(k=>k.type==="request").length}}if(t===G.reorderSuiteRequests){let v=await En(e.suite,r);if(!o(v))throw le('reorder_suite_requests currently supports request-only root suites. For flow suites, use get_suite/update_suite_config with the full "nodes" graph.');if(!Array.isArray(e.order))throw le('"order" must be an array of request names');let _=e.order,E=(v.nodes||[]).filter(M=>M.type==="request"),k=(v.nodes||[]).filter(M=>M.type!=="request"),O=[...E].sort((M,j)=>{let I=M.request?.name||M.name||"",R=j.request?.name||j.name||"",A=_.findIndex(J=>J===I||J.toLowerCase()===I.toLowerCase()),F=_.findIndex(J=>J===R||J.toLowerCase()===R.toLowerCase());return(A===-1?1/0:A)-(F===-1?1/0:F)});return v.nodes=[...O,...k],await r.testSuite.updateSuite(v),{reordered:!0,suite:v.name,newOrder:O.map(M=>M.request?.name||M.name)}}if(t===G.duplicateSuite){let v=await En(e.suite,r),_=typeof e.newName=="string"?e.newName.trim():"";if(!_)throw le('"newName" is required');let E=await r.testSuite.duplicateSuite(v.id,_);return{id:E.id,name:E.name,duplicatedFrom:v.name,requestCount:E.nodes?.filter(k=>k.type==="request").length??0}}if(t===G.deleteSuite){if(e.confirm!==!0)throw le('"confirm" must be true to delete a suite');let v=await En(e.suite,r);return await r.testSuite.deleteSuite(v.id),{deleted:!0,suite:v.name}}if(t===G.listEnvironments){let v=r.environmentConfig.getAllEnvironments(),_=r.environmentConfig.getSelectedEnvironment();return{environments:v.map(E=>({name:E.name,active:E.active,variableKeys:Object.keys(E.variables)})),active:_}}if(t===G.getEnvironmentVariables){let v=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment(),_=r.environmentConfig.getResolvedEnvironment(v);if(!_)throw le(`environment "${v}" not found`);let k=r.environmentConfig.getSharedConfig()?.environments?.[v]?.variables??{},O=r.environmentConfig.getEnvironmentVariableLocals();return{environment:v,active:r.environmentConfig.getSelectedEnvironment()===v,fileVariables:k,sessionOverrides:O,resolved:_.variables}}if(t===G.selectEnvironment){let v=typeof e.environment=="string"?e.environment.trim():"";if(!v)throw le('"environment" is required');return await r.environmentConfig.setSelectedEnvironment(v),{selected:!0,environment:v}}if(t===G.createEnvironment){let v=typeof e.name=="string"?e.name.trim():"";if(!v)throw le('"name" is required');if(await r.environmentConfig.createEnvironment(v),e.variables&&typeof e.variables=="object"){let _=e.variables,E=r.environmentConfig.getSharedConfig();E&&(E.environments=E.environments??{},E.environments[v]={...E.environments[v]??{},variables:{...E.environments[v]?.variables??{},..._}},r.environmentConfig.saveSharedConfig(E))}return{created:!0,environment:v}}if(t===G.deleteEnvironment){if(e.confirm!==!0)throw le('"confirm" must be true to delete an environment');let v=typeof e.environment=="string"?e.environment.trim():"";if(!v)throw le('"environment" is required');let _=r.environmentConfig.getSelectedEnvironment();return await r.environmentConfig.deleteEnvironment(v),{deleted:!0,environment:v,newActive:_===v?void 0:_}}if(t===G.setEnvironmentVariable){let v=typeof e.key=="string"?e.key.trim():"",_=typeof e.value=="string"?e.value:String(e.value??"");if(!v)throw le('"key" is required');let E=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment(),k=e.scope==="permanent"?"permanent":"session";if(k==="permanent"){let O=r.environmentConfig.getSharedConfig();O&&(O.environments=O.environments??{},O.environments[E]=O.environments[E]??{variables:{}},O.environments[E].variables=O.environments[E].variables??{},O.environments[E].variables[v]=_,r.environmentConfig.saveSharedConfig(O))}else r.environmentConfig.setEnvironmentVariable(v,_,E);return{set:!0,key:v,environment:E,scope:k}}if(t===G.unsetEnvironmentVariable){let v=typeof e.key=="string"?e.key.trim():"";if(!v)throw le('"key" is required');let _=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment();return r.environmentConfig.deleteEnvironmentVariable(v,_),{unset:!0,key:v,environment:_}}if(t===G.setGlobalVariable){let v=typeof e.key=="string"?e.key.trim():"",_=typeof e.value=="string"?e.value:String(e.value??"");if(!v)throw le('"key" is required');let E=e.scope==="permanent"?"permanent":"session";if(E==="permanent"){let k=r.environmentConfig.getSharedConfig();k&&(k.globalVariables=k.globalVariables??{},k.globalVariables[v]=_,r.environmentConfig.saveSharedConfig(k))}else r.environmentConfig.setGlobalVariable(v,_);return{set:!0,key:v,scope:E}}if(t===G.getGlobals)return{globals:r.environmentConfig.getGlobalVariables()};if(t===G.scaffoldCollectionFromOpenApi){let v=typeof e.specPath=="string"?e.specPath.trim():"";if(!v)throw le('"specPath" is required');let _=r.workspaceFolder&&!is.isAbsolute(v)?is.join(r.workspaceFolder,v):v;if(!Ap.existsSync(_))throw le(`OpenAPI spec file not found: "${_}"`);let k=await new Hs(r.collection,r.environmentConfig).import(_,{collectionName:typeof e.collectionName=="string"?e.collectionName:void 0,environmentName:typeof e.environmentName=="string"?e.environmentName:void 0});return{collectionId:k.collection.id,collectionName:k.collection.name,requestCount:k.collection.items.filter(O=>O.type==="request").length,environmentCreated:k.environmentCreated??null,hint:"Use list_requests to browse the scaffolded collection, then run_request to test individual endpoints."}}if(t===G.suggestAssertions){let v=e.collection;if(!(typeof e.request=="string"?e.request.trim():""))throw le('"request" is required');let E=lt(v,s),k=ns(e.request,E),O=typeof e.maxSuggestions=="number"?Math.min(20,Math.max(1,e.maxSuggestions)):10,M=[],I=Array.from(n.values()).filter(U=>U.status!=="running").flatMap(U=>U.allResults??[]).filter(U=>U.name===k.name||typeof U.name=="string"&&U.name.toLowerCase()===k.name.toLowerCase()),R=I[I.length-1],A=R?.status;A?M.push({snippet:`pm.test("Status code is ${A}", function () {
|
|
353
353
|
pm.response.to.have.status(${A});
|
|
354
354
|
});`,rationale:`Observed status ${A} in the most recent run.`}):M.push({snippet:`pm.test("Status code is 2xx", function () {
|
|
355
355
|
pm.expect(pm.response.code).to.be.within(200, 299);
|
|
@@ -362,7 +362,7 @@ Example: for POST /users with body {"name":"{{name}}","email":"{{email}}"} and i
|
|
|
362
362
|
pm.expect(${Q}).to.have.property("${J}");
|
|
363
363
|
});`,rationale:`Field "${J}" was present in the observed response body.`})}}}catch{M.push({snippet:`pm.test("Response body is not empty", function () {
|
|
364
364
|
pm.expect(pm.response.text()).to.not.be.empty;
|
|
365
|
-
});`,rationale:"Response body was non-JSON text."})}return{collection:q.name,request:k.name,suggestions:M.slice(0,O),hint:"Paste the snippets into the request's post-response script using set_request_script."}}if(t===G.explainFailure){let v=typeof e.runId=="string"?e.runId.trim():void 0,_=typeof e.request=="string"?e.request.trim():"",q=typeof e.iteration=="number"?e.iteration:1;if(v){let j=n.require(v);if(j.status==="running")return{runId:v,status:"running",message:"The run has not completed yet. Try again in a moment."};if(!_)throw le('"request" is required when "runId" is provided');let I=j.allResults.find(D=>D.iteration===q&&(D.name===_||typeof D.name=="string"&&D.name.toLowerCase()===_.toLowerCase()));if(!I)throw new Error(`Request "${_}" (iteration ${q}) not found in run "${v}".`);let R=I.assertions?.every(D=>D.passed)??!0,A=I.error,F=I.assertions?.filter(D=>!D.passed)??[],U="";return A?U=`The request itself failed to execute: ${A}. Check the URL, network access, authentication, and that the environment variables are set correctly.`:F.length>0?U=`${F.length} assertion(s) failed. Review the expected vs actual values below and verify the API contract.`:R?U="No failures detected. The request appears to have passed.":U="The request was marked as failed but no specific errors were captured.",{runId:v,request:I.name,iteration:q,status:I.status??"unknown",passed:I.passed??!0,error:A??null,failedAssertions:F,allAssertions:I.assertions??[],requestDetails:{method:I.method,url:I.url,requestBody:I.requestBody},responseDetails:{status:I.responseStatus,headers:I.responseHeaders,body:I.responseBody},diagnosis:U,suggestedFixes:A?["Verify the URL is correct and reachable","Check all required environment variables are set","Inspect authentication headers"]:F.map(D=>`Fix assertion "${D.name}": ${D.message??"expected value mismatch"}`)}}let k=e.collection;if(!_)throw le('"request" is required');let O=lt(k,s);return{request:ns(e.request,O).name,collection:O.name,message:"No live run id provided. Run the request first using run_request, then call explain_failure with the runId from the result.",hint:'Use run_request or run_collection with include:["consoleOutput"] to capture a fresh run, then pass the runId here.'}}if(t===G.aiSuggestEnvVars){let v=lt(e.collection,s),_=typeof e.minOccurrences=="number"?Math.max(1,e.minOccurrences):1,k=(typeof e.environment=="string"?e.environment:void 0)??r.environmentConfig.getSelectedEnvironment()??void 0,O=Ep(v,_),M=nt(v).map(({request:j,folderPath:I})=>({id:j.id,name:j.name,folder:I,method:j.method,url:j.url,headers:(j.headers??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),query:(j.query??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),bodyExcerpt:j.body?.type==="raw"&&typeof j.body.content=="string"?j.body.content.slice(0,300):void 0}));return{task:{action:"analyze_and_apply_env_vars",instructions:["Review requestSummary. Find ALL hardcoded values: base URLs, API keys/tokens, tenant IDs, user IDs, secrets, repeated hostnames.","Skip placeholders ({{...}}), HTTP methods, standard header names, empty strings, booleans, short numbers.","Combine heuristicSuggestions with your own findings into one list.",`Call apply_env_vars immediately with: { collection: "${v.name}", suggestions: [...], ${k?`environment: "${k}"`:""} }`,"Do NOT ask for confirmation. Apply everything at once."],collection:v.name,heuristicSuggestions:O.map(j=>({varName:j.varName,value:j.value,reason:j.reason})),requestSummary:M,expectedCallAfterThis:"apply_env_vars"}}}if(t===G.aiEnhanceCollection){let v=lt(e.collection,s),_=typeof e.offset=="number"?Math.max(0,e.offset):0,q=typeof e.limit=="number"?Math.min(20,Math.max(1,e.limit)):10,k=typeof e.folder=="string"?e.folder.toLowerCase():void 0,O=nt(v).filter(({folderPath:I})=>!k||I.toLowerCase().includes(k)),M=O.slice(_,_+q).map(({request:I,folderPath:R})=>({id:I.id,name:I.name,folder:R,method:I.method,url:I.url,headers:(I.headers??[]).filter(A=>A.enabled!==!1).map(A=>({key:A.key,value:A.value})),query:(I.query??[]).filter(A=>A.enabled!==!1).map(A=>({key:A.key,value:A.value})),currentBody:I.body?.type==="raw"&&typeof I.body.content=="string"?I.body.content:void 0,currentTestScript:r.collection.getRequestScript(v.id,I.id,"post-response")??void 0})),j=_+q<O.length;return{task:{action:"enhance_requests",instructions:["For each request in requests, produce body and/or testScript as appropriate:"," body: realistic JSON (or form) example matching the endpoint purpose. Only for POST/PUT/PATCH."," testScript: pm.test() assertions \u2014 check status code, response schema, key fields. Always provide this.",`Call apply_request_enhancements immediately with: { collection: "${v.name}", enhancements: [{ requestId, body?, testScript }] }`,j?`After applying, call ai_enhance_collection again with: { collection: "${v.name}", offset: ${_+q}, limit: ${q} } to continue.`:"This is the last batch \u2014 no further calls needed after applying.","Do NOT ask for confirmation. Apply everything at once."],collection:v.name,total:O.length,offset:_,hasMore:j,nextOffset:j?_+q:void 0,requests:M,expectedCallAfterThis:"apply_request_enhancements"}}}if(t===G.suggestEnvVars){let v=lt(e.collection,s),_=typeof e.minOccurrences=="number"?Math.max(1,e.minOccurrences):1,q=Ep(v,_),k=nt(v).map(({request:O,folderPath:M})=>({id:O.id,name:O.name,folder:M,method:O.method,url:O.url,headers:(O.headers??[]).filter(j=>j.enabled!==!1).map(j=>({key:j.key,value:j.value})),query:(O.query??[]).filter(j=>j.enabled!==!1).map(j=>({key:j.key,value:j.value})),bodyExcerpt:O.body?.type==="raw"&&typeof O.body.content=="string"?O.body.content.slice(0,300):void 0}));return{collection:v.name,heuristicSuggestions:q.map(O=>({varName:O.varName,value:O.value,reason:O.reason,occurrences:O.occurrences.length})),requestSummary:k,hint:"Review requestSummary for additional hardcoded values, then call apply_env_vars with your combined {value, varName} list."}}if(t===G.applyEnvVars){let v=lt(e.collection,s),_=e.suggestions;if(!Array.isArray(_)||_.length===0)throw le('"suggestions" must be a non-empty array of {value, varName} objects');let q=_,k=Wy(v.items,q);await r.collection.saveCollection(v);let M=(typeof e.environment=="string"?e.environment:void 0)??r.environmentConfig.getSelectedEnvironment();if(M)for(let I of q)r.environmentConfig.setEnvironmentVariable(I.varName,I.value,M);let j=Object.values(k).reduce((I,R)=>I+R,0);return{collection:v.name,applied:q.map(I=>({varName:I.varName,replacements:k[I.varName]??0})),totalReplacements:j,...M?{writtenToEnvironment:M}:{}}}if(t===G.getRequestsForEnhancement){let v=lt(e.collection,s),_=typeof e.offset=="number"?Math.max(0,e.offset):0,q=typeof e.limit=="number"?Math.min(30,Math.max(1,e.limit)):10,k=typeof e.folder=="string"?e.folder.toLowerCase():void 0,O=nt(v).filter(({folderPath:j})=>!k||j.toLowerCase().includes(k)),M=O.slice(_,_+q).map(({request:j,folderPath:I})=>({id:j.id,name:j.name,folder:I,method:j.method,url:j.url,headers:(j.headers??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),query:(j.query??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),currentBody:j.body?.type==="raw"&&typeof j.body.content=="string"?j.body.content:void 0,currentTestScript:r.collection.getRequestScript(v.id,j.id,"post-response")??void 0}));return{collection:v.name,total:O.length,offset:_,limit:q,requests:M,hasMore:_+q<O.length,hint:"For each request write a realistic body and pm.test() assertions, then call apply_request_enhancements."}}if(t===G.applyRequestEnhancements){let v=lt(e.collection,s),_=e.enhancements;if(!Array.isArray(_)||_.length===0)throw le('"enhancements" must be a non-empty array');let q=[];for(let k of _){let{requestId:O,body:M,testScript:j}=k;if(!nt(v).find(({request:A})=>A.id===O)){q.push({requestId:O,applied:["skipped: request not found"]});continue}let R=[];typeof M=="string"&&(await r.collection.updateRequest(v.id,O,{body:{type:"raw",content:M,format:"json"}}),R.push("body")),typeof j=="string"&&(await r.collection.setRequestScript(v.id,O,"post-response",j),R.push("testScript")),q.push({requestId:O,applied:R})}return{collection:v.name,results:q,totalUpdated:q.filter(k=>k.applied.length>0&&!k.applied[0].startsWith("skipped")).length}}if(t===G.analyzeCoverage||t===G.aiAnalyzeCoverage){let v=lt(e.collection,s),_=typeof e.folder=="string"?e.folder.toLowerCase():void 0,q=nt(v).filter(({folderPath:F})=>!_||F.toLowerCase().includes(_)),k=q.map(({request:F,folderPath:U})=>{let J=((r.collection.getRequestScript(v.id,F.id,"post-response")??"").match(/pm\.test\s*\(/g)??[]).length;return{id:F.id,name:F.name,method:F.method,folder:U,hasAssertions:J>0,assertionCount:J}}),O=k.filter(F=>F.hasAssertions).length,M=k.length,j=M===0?100:Math.round(O/M*100),I=[],R=typeof e.specPath=="string"?e.specPath.trim():"";if(R)try{let F=r.workspaceFolder&&!is.isAbsolute(R)?is.join(r.workspaceFolder,R):R,U=Ap.readFileSync(F,"utf8"),{parse:D}=await Promise.resolve().then(()=>ve(Xd())),Q=(R.endsWith(".json")?JSON.parse(U):D(U)).paths??{},se=["get","post","put","patch","delete","head","options"];for(let[ce,Ve]of Object.entries(Q))for(let Re of se){if(!(Re in Ve))continue;let me=Re.toUpperCase();q.some(({request:gt})=>gt.method.toUpperCase()===me&&(gt.url??"").replace(/\{\{[^}]+\}\}/g,"{param}").includes(ce.replace(/\{[^}]+\}/g,"{param}").replace(/^\//,"")))||I.push({method:me,path:ce})}}catch{}let A=k.filter(F=>!F.hasAssertions);if(t===G.aiAnalyzeCoverage){let F=[];return A.length>0&&F.push(`${A.length} request(s) have no pm.test() assertions. Call ai_enhance_collection (collection="${v.name}") to add assertions to all of them.`),I.length>0&&F.push(`${I.length} spec operation(s) have no matching collection request. Call generate_scenarios (collection="${v.name}") to generate negative and edge-case requests for them.`),F.length===0&&F.push(`Coverage is ${j}% \u2014 all requests have assertions and all spec operations are covered.`),{task:{action:"ai_analyze_coverage",instructions:["Review the coverage data below.",...F,"Address the highest-impact gap first. Do NOT ask for confirmation \u2014 proceed immediately."],collection:v.name,coveragePct:j,covered:O,total:M,untestedRequests:A,untestedOperations:I,expectedCallAfterThis:A.length>0?"ai_enhance_collection":I.length>0?"generate_scenarios":null}}}return{collection:v.name,coveragePct:j,covered:O,total:M,requests:k,...I.length>0?{untestedOperations:I}:{}}}if(t===G.generateRequestFromIntent){let v=lt(e.collection,s),_=typeof e.intent=="string"?e.intent.trim():"";if(!_)throw le('"intent" is required \u2014 describe what to test in plain English');let k=nt(v).slice(0,20).map(({request:M,folderPath:j})=>({name:M.name,method:M.method,url:M.url??"",folder:j})),O=Object.keys(r.environmentConfig.getResolvedEnvironment(r.environmentConfig.getSelectedEnvironment())?.variables??{});return{task:{action:"generate_request_from_intent",instructions:[`Intent: "${_}"`,"Using the collection context below, determine: method, full URL (reuse existing {{vars}} where possible), headers, request body (if applicable), and expected HTTP status.","Then immediately:"," 1. Call create_request with name, method, url, and body.",' 2. Call set_request_script (phase: "post-response") with pm.test() assertions that verify the intent.',"Do NOT ask for confirmation \u2014 implement the full request + assertions in one shot."],collection:v.name,intent:_,existingRequests:k,availableEnvVars:O,targetFolder:typeof e.folder=="string"?e.folder:void 0,expectedCallAfterThis:"create_request"}}}if(t===G.validateAgainstSpec){let v=lt(e.collection,s),_=typeof e.specPath=="string"?e.specPath.trim():"";if(!_)throw le('"specPath" is required');let q=r.workspaceFolder&&!is.isAbsolute(_)?is.join(r.workspaceFolder,_):_,k;try{let D=Ap.readFileSync(q,"utf8"),{parse:J}=await Promise.resolve().then(()=>ve(Xd()));k=_.endsWith(".json")?JSON.parse(D):J(D)}catch(D){throw new Error(`Could not load spec at "${q}": ${D instanceof Error?D.message:String(D)}`)}let O=k.paths??{},M=["get","post","put","patch","delete","head","options"],j=nt(v),I=[],R=[],A=[],F=D=>D.replace(/\{\{[^}]+\}\}/g,"{p}").replace(/\{[^}]+\}/g,"{p}").replace(/\/+$/,"");for(let[D,J]of Object.entries(O))for(let Q of M){if(!(Q in J))continue;let se=J[Q],ce=Q.toUpperCase(),Ve=F(D),Re=j.find(({request:me})=>me.method.toUpperCase()===ce&&F(me.url??"").includes(Ve));if(!Re)I.push({method:ce,path:D,operationId:se.operationId});else{let me=r.collection.getRequestScript(v.id,Re.request.id,"post-response")??"";/pm\.test\s*\(/.test(me)||R.push({method:ce,path:D,requestName:Re.request.name})}}let U=new Set(Object.entries(O).flatMap(([D,J])=>M.filter(Q=>Q in J).map(Q=>`${Q.toUpperCase()}:${F(D)}`)));for(let{request:D}of j){let J=F(D.url??""),Q=`${D.method.toUpperCase()}:`;[...U].some(ce=>ce.startsWith(Q)&&J.includes(ce.split(":")[1]))||A.push({method:D.method,url:D.url??"",requestName:D.name})}return{collection:v.name,spec:is.basename(_),summary:{untestedOperations:I.length,matchedWithoutAssertions:R.length,extraRequests:A.length},untestedOperations:I,matchedWithoutAssertions:R,extraRequests:A,hint:I.length>0?`Call generate_scenarios (collection="${v.name}") to create negative/edge-case requests for untested operations.`:"All spec operations have matching collection requests."}}if(t===G.generateScenarios){let v=lt(e.collection,s),_=typeof e.request=="string"?e.request.trim().toLowerCase():void 0,q=typeof e.folder=="string"?e.folder.toLowerCase():void 0,k=typeof e.offset=="number"?Math.max(0,e.offset):0,O=typeof e.limit=="number"?Math.min(10,Math.max(1,e.limit)):5,M=nt(v).filter(({request:I,folderPath:R})=>!(_&&I.name.toLowerCase()!==_&&!I.name.toLowerCase().includes(_)||q&&!R.toLowerCase().includes(q))),j=M.slice(k,k+O).map(({request:I,folderPath:R})=>({id:I.id,name:I.name,method:I.method,url:I.url??"",folder:R,headers:(I.headers??[]).filter(A=>A.enabled!==!1).map(A=>({key:A.key,value:A.value})),body:I.body?.type==="raw"&&typeof I.body.content=="string"?I.body.content:void 0,currentTestScript:r.collection.getRequestScript(v.id,I.id,"post-response")??void 0}));return{task:{action:"generate_scenarios",instructions:["For each request below, generate negative and edge-case test scenario variants.","Scenarios to generate per request (as applicable):"," - Missing required fields \u2192 expect 400 or 422"," - Invalid field type or format (e.g. string where number expected) \u2192 expect 400"," - No Authorization header (remove it) \u2192 expect 401"," - Valid auth but insufficient scope/role \u2192 expect 403"," - Non-existent resource ID in URL \u2192 expect 404"," - Boundary values: empty string, max-length string, 0, -1, very large number","For each scenario:",' 1. Call create_request with a descriptive name (e.g. "Create User - Missing Email \u2192 422"), method, url, and body.',' 2. Immediately call set_request_script (phase: "post-response") with the status assertion.'," 3. Place the new request in the same folder as the original (use folder argument in create_request).","If task.hasMore is true, call generate_scenarios again with task.nextOffset after finishing this batch.","Do NOT ask for confirmation \u2014 generate all scenarios autonomously."],collection:v.name,requests:j,total:M.length,offset:k,hasMore:k+O<M.length,nextOffset:k+O,expectedCallAfterThis:"create_request"}}}if(t===G.healAssertions){let v=lt(e.collection,s),_=ns(e.request,v),q=r.collection.getRequestScript(v.id,_.id,"post-response")??"",k,O=typeof e.runId=="string"?e.runId.trim():void 0;if(O)try{let j=n.require(O).allResults.find(I=>typeof I.name=="string"&&I.name.toLowerCase()===_.name.toLowerCase());j&&(k={status:j.status,responseBody:j.responseBody,responseHeaders:j.responseHeaders,failedTests:j.failedTests})}catch{}return{task:{action:"heal_assertions",instructions:[`Request: ${_.method} ${_.url??""}`,"The current test script may have stale or incorrect assertions (e.g. wrong status code, missing/renamed fields).","Compare task.currentScript against task.lastResponse (if available).","Rewrite the complete post-response script so all assertions match the observed response while keeping valid checks.",'Call set_request_script (phase: "post-response") with the updated script immediately.',"Do NOT ask for confirmation."],collection:v.name,request:_.name,method:_.method,url:_.url??"",currentScript:q,lastResponse:k??null,note:k?"Last response data available \u2014 use it to align assertions with actual behavior.":"No run data available \u2014 run the request first with run_request, then call heal_assertions again with the runId.",expectedCallAfterThis:"set_request_script"}}}if(t===G.generateIterationData){let v=lt(e.collection,s),_=ns(e.request,v),q=typeof e.iterations=="number"?Math.min(50,Math.max(1,e.iterations)):5,k=_.body?.type==="raw"&&typeof _.body.content=="string"?_.body.content:void 0,O=(_.headers??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),M=(_.query??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),j=/\{\{([^}]+)\}\}/g,I=new Set;for(let R of[_.url??"",k??"",...O.map(A=>A.value),...M.map(A=>A.value)]){let A;for(j.lastIndex=0;(A=j.exec(R))!==null;)I.add(A[1])}return{task:{action:"generate_iteration_data",instructions:[`Generate ${q} test data rows for: ${_.method} ${_.url??""}`,`The request uses these {{variable}} placeholders: ${[...I].join(", ")||"(none detected)"}`,"Each row must be a JSON object whose keys match the placeholder names.","Cover a mix of: (1) valid happy-path data, (2) boundary values, (3) invalid inputs that should fail, (4) edge cases.",'Return the rows as a JSON array in a code block labeled "iterationData".',"This data can be used with: http-forge run-request --collection ... --variables '[...]' or passed to run_request via the variables argument."],collection:v.name,request:_.name,method:_.method,url:_.url??"",body:k??null,headers:O,queryParams:M,placeholders:[...I],iterations:q}}}let b=e.suite;if(typeof b!="string"||!b.trim())throw le('the "suite" argument is required');let E=await r.testSuite.getAllSuites(),C=E.find(v=>v.id===b||v.name===b)??E.find(v=>v.name.toLowerCase()===b.toLowerCase());if(!C)throw le(`test suite not found: "${b}"`);return i.runSuite(C.id,C.name,e)}var Ap,is,Jy,xx=ae(()=>{"use strict";Ap=ve(require("fs")),is=ve(require("path"));Cx();Ly();Oi();kp();Jy=new Set([G.createCollection,G.renameCollection,G.deleteCollection,G.duplicateCollection,G.createFolder,G.deleteFolder,G.createRequest,G.updateRequest,G.deleteRequest,G.reorderCollectionItems,G.createSuite,G.updateSuiteConfig,G.addSuiteNode,G.updateSuiteNode,G.removeSuiteNode,G.moveSuiteNode,G.duplicateSuite,G.deleteSuite])});function Ko(t,e=2e3){return!t||t.length<=e?t:t.slice(0,e)+`
|
|
365
|
+
});`,rationale:"Response body was non-JSON text."})}return{collection:E.name,request:k.name,suggestions:M.slice(0,O),hint:"Paste the snippets into the request's post-response script using set_request_script."}}if(t===G.explainFailure){let v=typeof e.runId=="string"?e.runId.trim():void 0,_=typeof e.request=="string"?e.request.trim():"",E=typeof e.iteration=="number"?e.iteration:1;if(v){let j=n.require(v);if(j.status==="running")return{runId:v,status:"running",message:"The run has not completed yet. Try again in a moment."};if(!_)throw le('"request" is required when "runId" is provided');let I=j.allResults.find(D=>D.iteration===E&&(D.name===_||typeof D.name=="string"&&D.name.toLowerCase()===_.toLowerCase()));if(!I)throw new Error(`Request "${_}" (iteration ${E}) not found in run "${v}".`);let R=I.assertions?.every(D=>D.passed)??!0,A=I.error,F=I.assertions?.filter(D=>!D.passed)??[],U="";return A?U=`The request itself failed to execute: ${A}. Check the URL, network access, authentication, and that the environment variables are set correctly.`:F.length>0?U=`${F.length} assertion(s) failed. Review the expected vs actual values below and verify the API contract.`:R?U="No failures detected. The request appears to have passed.":U="The request was marked as failed but no specific errors were captured.",{runId:v,request:I.name,iteration:E,status:I.status??"unknown",passed:I.passed??!0,error:A??null,failedAssertions:F,allAssertions:I.assertions??[],requestDetails:{method:I.method,url:I.url,requestBody:I.requestBody},responseDetails:{status:I.responseStatus,headers:I.responseHeaders,body:I.responseBody},diagnosis:U,suggestedFixes:A?["Verify the URL is correct and reachable","Check all required environment variables are set","Inspect authentication headers"]:F.map(D=>`Fix assertion "${D.name}": ${D.message??"expected value mismatch"}`)}}let k=e.collection;if(!_)throw le('"request" is required');let O=lt(k,s);return{request:ns(e.request,O).name,collection:O.name,message:"No live run id provided. Run the request first using run_request, then call explain_failure with the runId from the result.",hint:'Use run_request or run_collection with include:["consoleOutput"] to capture a fresh run, then pass the runId here.'}}if(t===G.aiSuggestEnvVars){let v=lt(e.collection,s),_=typeof e.minOccurrences=="number"?Math.max(1,e.minOccurrences):1,k=(typeof e.environment=="string"?e.environment:void 0)??r.environmentConfig.getSelectedEnvironment()??void 0,O=Ep(v,_),M=nt(v).map(({request:j,folderPath:I})=>({id:j.id,name:j.name,folder:I,method:j.method,url:j.url,headers:(j.headers??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),query:(j.query??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),bodyExcerpt:j.body?.type==="raw"&&typeof j.body.content=="string"?j.body.content.slice(0,300):void 0}));return{task:{action:"analyze_and_apply_env_vars",instructions:["Review requestSummary. Find ALL hardcoded values: base URLs, API keys/tokens, tenant IDs, user IDs, secrets, repeated hostnames.","Skip placeholders ({{...}}), HTTP methods, standard header names, empty strings, booleans, short numbers.","Combine heuristicSuggestions with your own findings into one list.",`Call apply_env_vars immediately with: { collection: "${v.name}", suggestions: [...], ${k?`environment: "${k}"`:""} }`,"Do NOT ask for confirmation. Apply everything at once."],collection:v.name,heuristicSuggestions:O.map(j=>({varName:j.varName,value:j.value,reason:j.reason})),requestSummary:M,expectedCallAfterThis:"apply_env_vars"}}}if(t===G.aiEnhanceCollection){let v=lt(e.collection,s),_=typeof e.offset=="number"?Math.max(0,e.offset):0,E=typeof e.limit=="number"?Math.min(20,Math.max(1,e.limit)):10,k=typeof e.folder=="string"?e.folder.toLowerCase():void 0,O=nt(v).filter(({folderPath:I})=>!k||I.toLowerCase().includes(k)),M=O.slice(_,_+E).map(({request:I,folderPath:R})=>({id:I.id,name:I.name,folder:R,method:I.method,url:I.url,headers:(I.headers??[]).filter(A=>A.enabled!==!1).map(A=>({key:A.key,value:A.value})),query:(I.query??[]).filter(A=>A.enabled!==!1).map(A=>({key:A.key,value:A.value})),currentBody:I.body?.type==="raw"&&typeof I.body.content=="string"?I.body.content:void 0,currentTestScript:r.collection.getRequestScript(v.id,I.id,"post-response")??void 0})),j=_+E<O.length;return{task:{action:"enhance_requests",instructions:["For each request in requests, produce body and/or testScript as appropriate:"," body: realistic JSON (or form) example matching the endpoint purpose. Only for POST/PUT/PATCH."," testScript: pm.test() assertions \u2014 check status code, response schema, key fields. Always provide this.",`Call apply_request_enhancements immediately with: { collection: "${v.name}", enhancements: [{ requestId, body?, testScript }] }`,j?`After applying, call ai_enhance_collection again with: { collection: "${v.name}", offset: ${_+E}, limit: ${E} } to continue.`:"This is the last batch \u2014 no further calls needed after applying.","Do NOT ask for confirmation. Apply everything at once."],collection:v.name,total:O.length,offset:_,hasMore:j,nextOffset:j?_+E:void 0,requests:M,expectedCallAfterThis:"apply_request_enhancements"}}}if(t===G.suggestEnvVars){let v=lt(e.collection,s),_=typeof e.minOccurrences=="number"?Math.max(1,e.minOccurrences):1,E=Ep(v,_),k=nt(v).map(({request:O,folderPath:M})=>({id:O.id,name:O.name,folder:M,method:O.method,url:O.url,headers:(O.headers??[]).filter(j=>j.enabled!==!1).map(j=>({key:j.key,value:j.value})),query:(O.query??[]).filter(j=>j.enabled!==!1).map(j=>({key:j.key,value:j.value})),bodyExcerpt:O.body?.type==="raw"&&typeof O.body.content=="string"?O.body.content.slice(0,300):void 0}));return{collection:v.name,heuristicSuggestions:E.map(O=>({varName:O.varName,value:O.value,reason:O.reason,occurrences:O.occurrences.length})),requestSummary:k,hint:"Review requestSummary for additional hardcoded values, then call apply_env_vars with your combined {value, varName} list."}}if(t===G.applyEnvVars){let v=lt(e.collection,s),_=e.suggestions;if(!Array.isArray(_)||_.length===0)throw le('"suggestions" must be a non-empty array of {value, varName} objects');let E=_,k=Wy(v.items,E);await r.collection.saveCollection(v);let M=(typeof e.environment=="string"?e.environment:void 0)??r.environmentConfig.getSelectedEnvironment();if(M)for(let I of E)r.environmentConfig.setEnvironmentVariable(I.varName,I.value,M);let j=Object.values(k).reduce((I,R)=>I+R,0);return{collection:v.name,applied:E.map(I=>({varName:I.varName,replacements:k[I.varName]??0})),totalReplacements:j,...M?{writtenToEnvironment:M}:{}}}if(t===G.getRequestsForEnhancement){let v=lt(e.collection,s),_=typeof e.offset=="number"?Math.max(0,e.offset):0,E=typeof e.limit=="number"?Math.min(30,Math.max(1,e.limit)):10,k=typeof e.folder=="string"?e.folder.toLowerCase():void 0,O=nt(v).filter(({folderPath:j})=>!k||j.toLowerCase().includes(k)),M=O.slice(_,_+E).map(({request:j,folderPath:I})=>({id:j.id,name:j.name,folder:I,method:j.method,url:j.url,headers:(j.headers??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),query:(j.query??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),currentBody:j.body?.type==="raw"&&typeof j.body.content=="string"?j.body.content:void 0,currentTestScript:r.collection.getRequestScript(v.id,j.id,"post-response")??void 0}));return{collection:v.name,total:O.length,offset:_,limit:E,requests:M,hasMore:_+E<O.length,hint:"For each request write a realistic body and pm.test() assertions, then call apply_request_enhancements."}}if(t===G.applyRequestEnhancements){let v=lt(e.collection,s),_=e.enhancements;if(!Array.isArray(_)||_.length===0)throw le('"enhancements" must be a non-empty array');let E=[];for(let k of _){let{requestId:O,body:M,testScript:j}=k;if(!nt(v).find(({request:A})=>A.id===O)){E.push({requestId:O,applied:["skipped: request not found"]});continue}let R=[];typeof M=="string"&&(await r.collection.updateRequest(v.id,O,{body:{type:"raw",content:M,format:"json"}}),R.push("body")),typeof j=="string"&&(await r.collection.setRequestScript(v.id,O,"post-response",j),R.push("testScript")),E.push({requestId:O,applied:R})}return{collection:v.name,results:E,totalUpdated:E.filter(k=>k.applied.length>0&&!k.applied[0].startsWith("skipped")).length}}if(t===G.analyzeCoverage||t===G.aiAnalyzeCoverage){let v=lt(e.collection,s),_=typeof e.folder=="string"?e.folder.toLowerCase():void 0,E=nt(v).filter(({folderPath:F})=>!_||F.toLowerCase().includes(_)),k=E.map(({request:F,folderPath:U})=>{let J=((r.collection.getRequestScript(v.id,F.id,"post-response")??"").match(/pm\.test\s*\(/g)??[]).length;return{id:F.id,name:F.name,method:F.method,folder:U,hasAssertions:J>0,assertionCount:J}}),O=k.filter(F=>F.hasAssertions).length,M=k.length,j=M===0?100:Math.round(O/M*100),I=[],R=typeof e.specPath=="string"?e.specPath.trim():"";if(R)try{let F=r.workspaceFolder&&!is.isAbsolute(R)?is.join(r.workspaceFolder,R):R,U=Ap.readFileSync(F,"utf8"),{parse:D}=await Promise.resolve().then(()=>ve(Xd())),Q=(R.endsWith(".json")?JSON.parse(U):D(U)).paths??{},se=["get","post","put","patch","delete","head","options"];for(let[ce,Ve]of Object.entries(Q))for(let Re of se){if(!(Re in Ve))continue;let me=Re.toUpperCase();E.some(({request:gt})=>gt.method.toUpperCase()===me&&(gt.url??"").replace(/\{\{[^}]+\}\}/g,"{param}").includes(ce.replace(/\{[^}]+\}/g,"{param}").replace(/^\//,"")))||I.push({method:me,path:ce})}}catch{}let A=k.filter(F=>!F.hasAssertions);if(t===G.aiAnalyzeCoverage){let F=[];return A.length>0&&F.push(`${A.length} request(s) have no pm.test() assertions. Call ai_enhance_collection (collection="${v.name}") to add assertions to all of them.`),I.length>0&&F.push(`${I.length} spec operation(s) have no matching collection request. Call generate_scenarios (collection="${v.name}") to generate negative and edge-case requests for them.`),F.length===0&&F.push(`Coverage is ${j}% \u2014 all requests have assertions and all spec operations are covered.`),{task:{action:"ai_analyze_coverage",instructions:["Review the coverage data below.",...F,"Address the highest-impact gap first. Do NOT ask for confirmation \u2014 proceed immediately."],collection:v.name,coveragePct:j,covered:O,total:M,untestedRequests:A,untestedOperations:I,expectedCallAfterThis:A.length>0?"ai_enhance_collection":I.length>0?"generate_scenarios":null}}}return{collection:v.name,coveragePct:j,covered:O,total:M,requests:k,...I.length>0?{untestedOperations:I}:{}}}if(t===G.generateRequestFromIntent){let v=lt(e.collection,s),_=typeof e.intent=="string"?e.intent.trim():"";if(!_)throw le('"intent" is required \u2014 describe what to test in plain English');let k=nt(v).slice(0,20).map(({request:M,folderPath:j})=>({name:M.name,method:M.method,url:M.url??"",folder:j})),O=Object.keys(r.environmentConfig.getResolvedEnvironment(r.environmentConfig.getSelectedEnvironment())?.variables??{});return{task:{action:"generate_request_from_intent",instructions:[`Intent: "${_}"`,"Using the collection context below, determine: method, full URL (reuse existing {{vars}} where possible), headers, request body (if applicable), and expected HTTP status.","Then immediately:"," 1. Call create_request with name, method, url, and body.",' 2. Call set_request_script (phase: "post-response") with pm.test() assertions that verify the intent.',"Do NOT ask for confirmation \u2014 implement the full request + assertions in one shot."],collection:v.name,intent:_,existingRequests:k,availableEnvVars:O,targetFolder:typeof e.folder=="string"?e.folder:void 0,expectedCallAfterThis:"create_request"}}}if(t===G.validateAgainstSpec){let v=lt(e.collection,s),_=typeof e.specPath=="string"?e.specPath.trim():"";if(!_)throw le('"specPath" is required');let E=r.workspaceFolder&&!is.isAbsolute(_)?is.join(r.workspaceFolder,_):_,k;try{let D=Ap.readFileSync(E,"utf8"),{parse:J}=await Promise.resolve().then(()=>ve(Xd()));k=_.endsWith(".json")?JSON.parse(D):J(D)}catch(D){throw new Error(`Could not load spec at "${E}": ${D instanceof Error?D.message:String(D)}`)}let O=k.paths??{},M=["get","post","put","patch","delete","head","options"],j=nt(v),I=[],R=[],A=[],F=D=>D.replace(/\{\{[^}]+\}\}/g,"{p}").replace(/\{[^}]+\}/g,"{p}").replace(/\/+$/,"");for(let[D,J]of Object.entries(O))for(let Q of M){if(!(Q in J))continue;let se=J[Q],ce=Q.toUpperCase(),Ve=F(D),Re=j.find(({request:me})=>me.method.toUpperCase()===ce&&F(me.url??"").includes(Ve));if(!Re)I.push({method:ce,path:D,operationId:se.operationId});else{let me=r.collection.getRequestScript(v.id,Re.request.id,"post-response")??"";/pm\.test\s*\(/.test(me)||R.push({method:ce,path:D,requestName:Re.request.name})}}let U=new Set(Object.entries(O).flatMap(([D,J])=>M.filter(Q=>Q in J).map(Q=>`${Q.toUpperCase()}:${F(D)}`)));for(let{request:D}of j){let J=F(D.url??""),Q=`${D.method.toUpperCase()}:`;[...U].some(ce=>ce.startsWith(Q)&&J.includes(ce.split(":")[1]))||A.push({method:D.method,url:D.url??"",requestName:D.name})}return{collection:v.name,spec:is.basename(_),summary:{untestedOperations:I.length,matchedWithoutAssertions:R.length,extraRequests:A.length},untestedOperations:I,matchedWithoutAssertions:R,extraRequests:A,hint:I.length>0?`Call generate_scenarios (collection="${v.name}") to create negative/edge-case requests for untested operations.`:"All spec operations have matching collection requests."}}if(t===G.generateScenarios){let v=lt(e.collection,s),_=typeof e.request=="string"?e.request.trim().toLowerCase():void 0,E=typeof e.folder=="string"?e.folder.toLowerCase():void 0,k=typeof e.offset=="number"?Math.max(0,e.offset):0,O=typeof e.limit=="number"?Math.min(10,Math.max(1,e.limit)):5,M=nt(v).filter(({request:I,folderPath:R})=>!(_&&I.name.toLowerCase()!==_&&!I.name.toLowerCase().includes(_)||E&&!R.toLowerCase().includes(E))),j=M.slice(k,k+O).map(({request:I,folderPath:R})=>({id:I.id,name:I.name,method:I.method,url:I.url??"",folder:R,headers:(I.headers??[]).filter(A=>A.enabled!==!1).map(A=>({key:A.key,value:A.value})),body:I.body?.type==="raw"&&typeof I.body.content=="string"?I.body.content:void 0,currentTestScript:r.collection.getRequestScript(v.id,I.id,"post-response")??void 0}));return{task:{action:"generate_scenarios",instructions:["For each request below, generate negative and edge-case test scenario variants.","Scenarios to generate per request (as applicable):"," - Missing required fields \u2192 expect 400 or 422"," - Invalid field type or format (e.g. string where number expected) \u2192 expect 400"," - No Authorization header (remove it) \u2192 expect 401"," - Valid auth but insufficient scope/role \u2192 expect 403"," - Non-existent resource ID in URL \u2192 expect 404"," - Boundary values: empty string, max-length string, 0, -1, very large number","For each scenario:",' 1. Call create_request with a descriptive name (e.g. "Create User - Missing Email \u2192 422"), method, url, and body.',' 2. Immediately call set_request_script (phase: "post-response") with the status assertion.'," 3. Place the new request in the same folder as the original (use folder argument in create_request).","If task.hasMore is true, call generate_scenarios again with task.nextOffset after finishing this batch.","Do NOT ask for confirmation \u2014 generate all scenarios autonomously."],collection:v.name,requests:j,total:M.length,offset:k,hasMore:k+O<M.length,nextOffset:k+O,expectedCallAfterThis:"create_request"}}}if(t===G.healAssertions){let v=lt(e.collection,s),_=ns(e.request,v),E=r.collection.getRequestScript(v.id,_.id,"post-response")??"",k,O=typeof e.runId=="string"?e.runId.trim():void 0;if(O)try{let j=n.require(O).allResults.find(I=>typeof I.name=="string"&&I.name.toLowerCase()===_.name.toLowerCase());j&&(k={status:j.status,responseBody:j.responseBody,responseHeaders:j.responseHeaders,failedTests:j.failedTests})}catch{}return{task:{action:"heal_assertions",instructions:[`Request: ${_.method} ${_.url??""}`,"The current test script may have stale or incorrect assertions (e.g. wrong status code, missing/renamed fields).","Compare task.currentScript against task.lastResponse (if available).","Rewrite the complete post-response script so all assertions match the observed response while keeping valid checks.",'Call set_request_script (phase: "post-response") with the updated script immediately.',"Do NOT ask for confirmation."],collection:v.name,request:_.name,method:_.method,url:_.url??"",currentScript:E,lastResponse:k??null,note:k?"Last response data available \u2014 use it to align assertions with actual behavior.":"No run data available \u2014 run the request first with run_request, then call heal_assertions again with the runId.",expectedCallAfterThis:"set_request_script"}}}if(t===G.generateIterationData){let v=lt(e.collection,s),_=ns(e.request,v),E=typeof e.iterations=="number"?Math.min(50,Math.max(1,e.iterations)):5,k=_.body?.type==="raw"&&typeof _.body.content=="string"?_.body.content:void 0,O=(_.headers??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),M=(_.query??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),j=/\{\{([^}]+)\}\}/g,I=new Set;for(let R of[_.url??"",k??"",...O.map(A=>A.value),...M.map(A=>A.value)]){let A;for(j.lastIndex=0;(A=j.exec(R))!==null;)I.add(A[1])}return{task:{action:"generate_iteration_data",instructions:[`Generate ${E} test data rows for: ${_.method} ${_.url??""}`,`The request uses these {{variable}} placeholders: ${[...I].join(", ")||"(none detected)"}`,"Each row must be a JSON object whose keys match the placeholder names.","Cover a mix of: (1) valid happy-path data, (2) boundary values, (3) invalid inputs that should fail, (4) edge cases.",'Return the rows as a JSON array in a code block labeled "iterationData".',"This data can be used with: http-forge run-request --collection ... --variables '[...]' or passed to run_request via the variables argument."],collection:v.name,request:_.name,method:_.method,url:_.url??"",body:k??null,headers:O,queryParams:M,placeholders:[...I],iterations:E}}}let b=e.suite;if(typeof b!="string"||!b.trim())throw le('the "suite" argument is required');let q=await r.testSuite.getAllSuites(),C=q.find(v=>v.id===b||v.name===b)??q.find(v=>v.name.toLowerCase()===b.toLowerCase());if(!C)throw le(`test suite not found: "${b}"`);return i.runSuite(C.id,C.name,e)}var Ap,is,Jy,xx=ae(()=>{"use strict";Ap=ve(require("fs")),is=ve(require("path"));Cx();Ly();Oi();kp();Jy=new Set([G.createCollection,G.renameCollection,G.deleteCollection,G.duplicateCollection,G.createFolder,G.deleteFolder,G.createRequest,G.updateRequest,G.deleteRequest,G.reorderCollectionItems,G.createSuite,G.updateSuiteConfig,G.addSuiteNode,G.updateSuiteNode,G.removeSuiteNode,G.moveSuiteNode,G.duplicateSuite,G.deleteSuite])});function Ko(t,e=2e3){return!t||t.length<=e?t:t.slice(0,e)+`
|
|
366
366
|
\u2026 (truncated, ${t.length-e} chars omitted)`}function Tp(t){return t.replace(/"(Authorization|authorization)"\s*:\s*"[^"]+"/g,'"Authorization": "[REDACTED]"').replace(/Bearer\s+[A-Za-z0-9\-._~+/]+=*/g,"Bearer [REDACTED]").replace(/"(password|secret|token|api[-_]?key)"\s*:\s*"[^"]+"/gi,'"$1": "[REDACTED]"')}function SN(t,e){let r=e.getAllCollections(),n=t.toLowerCase(),i=r.find(s=>s.id===t||s.name===t)??r.find(s=>s.name.toLowerCase()===n)??r.find(s=>s.name.toLowerCase().includes(n));if(!i){let s=r.map(o=>`"${o.name}"`).join(", ");throw new Error(`Collection "${t}" not found. Available: ${s||"(none)"}`)}return i}function O5(t,e){let r=t.runId,n=t.request?.toLowerCase(),i=e.get(r);if(!i)throw new Error(`Run "${r}" not found. It may have expired or never existed. Use get_run_status to see recent runs.`);if(i.status==="running")throw new Error(`Run "${r}" is still in progress. Wait for it to complete before analyzing.`);let o=(i.allResults??[]).filter(p=>n&&typeof p.name=="string"&&!p.name.toLowerCase().includes(n)?!1:p.passed===!1||Array.isArray(p.assertions)&&p.assertions.some(m=>!m.passed)),l=i.summary,c=o.length,d=`I ran an HTTP API test suite and got failures. Please analyze the results and provide:
|
|
367
367
|
|
|
368
368
|
1. **Root cause** for each failure
|
|
@@ -378,15 +378,15 @@ Example: for POST /users with body {"name":"{{name}}","email":"{{email}}"} and i
|
|
|
378
378
|
## Failed Requests
|
|
379
379
|
`;if(c===0)d+=`
|
|
380
380
|
(No failures found`,n&&(d+=` matching "${t.request}"`),d+=`. The run may have passed entirely or the filter matched nothing.)
|
|
381
|
-
`;else{for(let p of o.slice(0,20)){let m=String(p.name??"(unknown)"),y=String(p.method??""),b=String(p.url??""),
|
|
381
|
+
`;else{for(let p of o.slice(0,20)){let m=String(p.name??"(unknown)"),y=String(p.method??""),b=String(p.url??""),q=p.responseStatus??p.status??"?",C=p.error,_=(p.assertions??[]).filter(M=>!M.passed),E=p.failedTests??_,k=typeof p.body=="string"?Ko(Tp(p.body),600):p.body?Ko(Tp(JSON.stringify(p.body)),600):"",O=typeof p.requestBody=="string"?Ko(Tp(p.requestBody),400):p.requestBody?Ko(Tp(JSON.stringify(p.requestBody)),400):"";if(d+=`
|
|
382
382
|
### ${m}`,(y||b)&&(d+=` [${y} ${b}]`),d+=`
|
|
383
|
-
- HTTP status received: ${
|
|
383
|
+
- HTTP status received: ${q}`,C&&(d+=`
|
|
384
384
|
- Request error: ${C}`),O&&(d+=`
|
|
385
385
|
- Request body sent:
|
|
386
386
|
\`\`\`json
|
|
387
387
|
${O}
|
|
388
|
-
\`\`\``),
|
|
389
|
-
- Failed assertions:`;for(let M of
|
|
388
|
+
\`\`\``),E.length>0){d+=`
|
|
389
|
+
- Failed assertions:`;for(let M of E)d+=`
|
|
390
390
|
- \`${M.name}\`: ${M.message??"assertion failed"}`}k&&(d+=`
|
|
391
391
|
- Response body:
|
|
392
392
|
\`\`\`json
|
|
@@ -395,18 +395,18 @@ ${k}
|
|
|
395
395
|
`}c>20&&(d+=`
|
|
396
396
|
_(${c-20} more failures omitted \u2014 fix the above first)_
|
|
397
397
|
`)}return d+=`
|
|
398
|
-
Please diagnose each failure and provide concrete, actionable fixes.`,{description:`Analyze ${c} failure(s) from run "${r}"`,messages:[{role:"user",content:{type:"text",text:d}}]}}async function I5(t,e,r){let n=SN(t.collection,e),i=nt(n),s=t.request.toLowerCase(),o=i.find(
|
|
398
|
+
Please diagnose each failure and provide concrete, actionable fixes.`,{description:`Analyze ${c} failure(s) from run "${r}"`,messages:[{role:"user",content:{type:"text",text:d}}]}}async function I5(t,e,r){let n=SN(t.collection,e),i=nt(n),s=t.request.toLowerCase(),o=i.find(q=>q.request.id===t.request||q.request.name===t.request)??i.find(q=>q.request.name.toLowerCase()===s)??i.find(q=>q.request.name.toLowerCase().includes(s));if(!o)throw new Error(`Request "${t.request}" not found in collection "${n.name}"`);let l=o.request,c=e.getRequestScript(n.id,l.id,"pre-request")??"",d=e.getRequestScript(n.id,l.id,"post-response")??"",p="";if(t.runId){let q=r.get(t.runId);if(q&&q.status!=="running"){let v=(q.allResults??[]).find(_=>typeof _.name=="string"&&_.name.toLowerCase()===l.name.toLowerCase());if(v){let _=v.responseStatus??v.status,E=typeof v.responseBody=="string"?Ko(Tp(v.responseBody),1500):"",k=v.responseHeaders?Ko(JSON.stringify(v.responseHeaders,null,2),500):"";p=`
|
|
399
399
|
## Observed Response (run ${t.runId})
|
|
400
400
|
- Status: ${_}
|
|
401
401
|
`,k&&(p+=`- Headers:
|
|
402
402
|
\`\`\`json
|
|
403
403
|
${k}
|
|
404
404
|
\`\`\`
|
|
405
|
-
`),
|
|
405
|
+
`),E&&(p+=`- Body:
|
|
406
406
|
\`\`\`json
|
|
407
|
-
${
|
|
407
|
+
${E}
|
|
408
408
|
\`\`\`
|
|
409
|
-
`)}}}let m=l.headers?.filter(
|
|
409
|
+
`)}}}let m=l.headers?.filter(q=>q.enabled!==!1).map(q=>` ${q.name}: ${q.value}`).join(`
|
|
410
410
|
`)||" (none)",y=l.body?Ko(JSON.stringify(l.body,null,2),600):"(no body)",b=`Please write pm.test() assertion scripts for the following HTTP API request.
|
|
411
411
|
|
|
412
412
|
## Request: ${l.name}
|
|
@@ -441,7 +441,7 @@ Write comprehensive pm.test() assertions for the **post-response script**. Cover
|
|
|
441
441
|
4. Key response body fields (existence, type, value constraints)
|
|
442
442
|
5. Business logic validations specific to this endpoint
|
|
443
443
|
|
|
444
|
-
Use Chai-style assertions (\`pm.expect(...).to...\`). Output only the JavaScript code block, ready to paste into the post-response script.`;return{description:`Suggest assertions for "${l.name}" in "${n.name}"`,messages:[{role:"user",content:{type:"text",text:b}}]}}async function P5(t,e){let r=SN(t.collection,e),n=nt(r),i=Vr(r),s=n.slice(0,60).map(({request:m,folderPath:y})=>{let b=e.getRequestScript(r.id,m.id,"post-response")??"",
|
|
444
|
+
Use Chai-style assertions (\`pm.expect(...).to...\`). Output only the JavaScript code block, ready to paste into the post-response script.`;return{description:`Suggest assertions for "${l.name}" in "${n.name}"`,messages:[{role:"user",content:{type:"text",text:b}}]}}async function P5(t,e){let r=SN(t.collection,e),n=nt(r),i=Vr(r),s=n.slice(0,60).map(({request:m,folderPath:y})=>{let b=e.getRequestScript(r.id,m.id,"post-response")??"",q=b.includes("pm.test")||b.includes("pm.expect"),C=!!e.getRequestScript(r.id,m.id,"pre-request");return{name:m.name,method:m.method,url:m.url??"",folder:y||"(root)",hasPreScript:C,hasAssertions:q}}),o=s.filter(m=>!m.hasAssertions),l=s.reduce((m,y)=>(m[y.method]=(m[y.method]??0)+1,m),{}),c=i.map(m=>` ${m.folderPath} (${m.requestCount} requests)`).join(`
|
|
445
445
|
`),d=s.map(m=>` [${m.method}] ${m.folder!=="(root)"?m.folder+" / ":""}${m.name}${m.hasAssertions?" \u2713":" \u26A0 no assertions"}`).join(`
|
|
446
446
|
`),p=`Please review the following HTTP Forge API collection and provide actionable recommendations.
|
|
447
447
|
|
|
@@ -473,13 +473,13 @@ Please provide recommendations for:
|
|
|
473
473
|
5. **Authentication** \u2014 is auth consistent across requests that need it?
|
|
474
474
|
6. **Environment variables** \u2014 are URLs and credentials properly parameterized?
|
|
475
475
|
|
|
476
|
-
Be specific: name the exact requests or folders that need attention.`;return{description:`Review collection "${r.name}" (${n.length} requests, ${o.length} without assertions)`,messages:[{role:"user",content:{type:"text",text:p}}]}}async function Yy(t,e,r,n){switch(t){case"analyze-test-failure":return O5(e,n);case"suggest-assertions":return I5(e,r,n);case"review-collection":return P5(e,r);default:throw new Error(`Unknown prompt: "${t}". Available: ${$p.map(i=>i.name).join(", ")}`)}}var $p,Ex=ae(()=>{"use strict";Oi();$p=[{name:"analyze-test-failure",description:"Analyze a failed API test run. Returns a structured prompt the LLM uses to diagnose each failure and suggest concrete fixes \u2014 no extra AI configuration needed.",arguments:[{name:"runId",description:"Run ID returned by run_suite, run_collection, or run_folder",required:!0},{name:"request",description:"Filter analysis to a specific request name (omit to analyze all failures)",required:!1}]},{name:"suggest-assertions",description:"Generate pm.test() assertion scripts for a request. The LLM writes Chai-style assertions based on the request definition and optionally an observed response.",arguments:[{name:"collection",description:"Collection name or id",required:!0},{name:"request",description:"Request name or id",required:!0},{name:"runId",description:"Run ID to use observed response data for more accurate assertions (optional)",required:!1}]},{name:"review-collection",description:"Get an AI review of a collection's structure, naming conventions, test coverage gaps, and assertion quality.",arguments:[{name:"collection",description:"Collection name or id",required:!0}]}]});var $c,qx=ae(()=>{"use strict";$c=class{store=new Map;newId(){return`run_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}create(e,r){this.prune();let n={id:this.newId(),status:"running",suiteName:e,startedAt:Date.now(),progress:{completed:0,total:r},summary:{passed:0,failed:0,total:0,allPassed:!1},failedRequests:[],allResults:[],reportPath:null};return this.store.set(n.id,n),n}get(e){return this.store.get(e)}require(e){if(typeof e!="string"||!e)throw new Error('"runId" is required');let r=this.store.get(e);if(!r)throw new Error(`Run "${e}" not found. It may have expired (1-hour TTL) or never existed.`);return r}prune(){let e=Date.now()-36e5;for(let[r,n]of this.store)n.startedAt<e&&this.store.delete(r)}values(){return this.store.values()}cancel(e){let r=this.store.get(e);return!r||r.status!=="running"?!1:(r.status="cancelled",r.completedAt=Date.now(),!0)}}});function _N(t){return(0,wN.createHash)("sha256").update(t,"utf8").digest("hex").slice(0,k5)}function $5(t){let e=t.replace(/[^a-zA-Z0-9_-]+/g,"_").replace(/__+/g,"_").replace(/^_+|_+$/g,"").toLowerCase();return e?e.slice(0,A5):"id"}function ss(t){return`${$5(t)}_${_N(t)}`}function N5(t,e){return t.length>0&&t.length<=e&&/^[a-zA-Z0-9_-]+$/.test(t)&&!t.includes("__")}function Qo(t,e=T5){return N5(t,e)?t:ss(t)}function Qy(t,e,r){let n=`${t}request__${Qo(e)}__${Qo(r)}`;return n.length<=Ky?n:`${t}request__${ss(e)}__${ss(r)}`}function Zy(t,e){let r=`${t}collection__${Qo(e,100)}`;return r.length<=Ky?r:`${t}collection__${ss(e)}`}function Xy(t,e,r){let n=`${t}folder__${Qo(e)}__${Qo(r)}`;return n.length<=Ky?n:`${t}folder__${ss(e)}__${ss(r)}`}function ev(t,e){let r=`${t}suite__${Qo(e,100)}`;return r.length<=Ky?r:`${t}suite__${ss(e)}`}function tv(t){for(let e of["request","collection","folder","suite"]){let r=`${e}__`;if(t.startsWith(r))return{kind:e,tokens:t.slice(r.length).split("__")}}throw new Error(`Unknown MCP tool name: ${t}`)}function vl(t,e){let r=t.includes("_")?t.slice(t.lastIndexOf("_")+1):t;for(let n of e)if(_N(n)===r)return n;for(let n of e)if(ss(n)===t)return n;for(let n of e)if(n===t)return n}function rv(t,e){let r=vl(t,e);if(r!==void 0)return r;try{let n=Buffer.from(t,"base64url").toString("utf8");if(e.includes(n))return n}catch{}}function nv(t,e,r,n){let i=n?` in folder "${n}"`:"";return`Run the "${e}" request [${t}]${i} of the "${r}" collection.`}function iv(t,e){return`Run all ${e} requests in the "${t}" collection.`}function sv(t,e,r){return`Run all ${r} requests in folder "${t}" of the "${e}" collection.`}function ov(t,e,r){return`Run the "${t}" test suite (${e} requests, ${r} iteration(s) by default).`}var wN,k5,A5,T5,Ky,av=ae(()=>{"use strict";wN=require("crypto"),k5=12,A5=16,T5=60,Ky=126});function lv(t){let e=new Set,r=[];for(let n of t)e.has(n.name)||(e.add(n.name),r.push(n));return r}function uv(t){return Buffer.from(String(t)).toString("base64url")}function cv(t){if(!t)return 0;try{let e=parseInt(Buffer.from(t,"base64url").toString(),10);return Number.isFinite(e)&&e>=0?e:0}catch{return 0}}function fv(t,e,r){let n=r.toolPrefix??"",i=r.toolMode??"auto",s=r.drilldownThreshold??100,o=0;for(let d of t)o+=nt(d).length;let l=i==="drilldown"||i==="auto"&&o>s;if(i==="flat"&&o>500&&console.warn(`[http-forge MCP] WARNING: toolMode is "flat" but ${o} requests would produce ${o}+ tools. This will likely degrade AI tool-selection quality and bloat the context window. Consider setting toolMode to "auto" or "drilldown" in http-forge.config.json.`),l)return lv(zy(n,t.map(d=>d.name),e.map(d=>d.name)).map(d=>({name:d.name,description:d.description,inputSchema:d.inputSchema,...d.annotations&&{annotations:d.annotations}})));let c=[];for(let d of t){let p=nt(d);for(let{request:m,folderPath:y}of p)c.push({name:Qy(n,d.id,m.id),description:nv(m.method,m.name,d.name,y),inputSchema:qp});c.push({name:Zy(n,d.id),description:iv(d.name,p.length),inputSchema:Op});for(let{folderPath:m,requestCount:y}of Vr(d))y!==0&&c.push({name:Xy(n,d.id,m),description:sv(m,d.name,y),inputSchema:Ip})}for(let d of e)c.push({name:ev(n,d.id),description:ov(d.name,d.nodes.filter(p=>p.type==="request").length,d.config.iterations),inputSchema:Pp});return lv(c)}var Ox=ae(()=>{"use strict";Oi();av();kp()});var bl,Ix=ae(()=>{"use strict";ka();bl=class{cookies=new Map;getCookieKey(e,r,n){return`${r||"*"}|${n||"/"}|${e}`}getCookiesForDomain(e){let r=[];for(let n of this.cookies.values())Rt.isExpired(n)||(!n.domain||Rt.domainMatches(e,n.domain))&&r.push(n);return r}has(e,r){return this.get(e,r)!==void 0}get(e,r){let n=this.getCookieKey(e,r),i=this.cookies.get(n);if(i&&!Rt.isExpired(i))return i}set(e){let r=this.getCookieKey(e.name,e.domain,e.path);this.cookies.set(r,e)}delete(e,r,n){let i=this.getCookieKey(e,r,n);return this.cookies.delete(i)}getAll(e){if(e)return this.getCookiesForDomain(e);let r=[];for(let n of this.cookies.values())Rt.isExpired(n)||r.push(n);return r}setCookiesFromResponse(e,r){let n=Rt.extractDomain(e),i=Rt.parseCookieHeaders(r,n);for(let s of i){let o=this.getCookieKey(s.name,s.domain,s.path);this.cookies.set(o,s)}}getCookieHeader(e){let r=Rt.extractDomain(e),n=Rt.extractPath(e),s=this.getCookiesForDomain(r).filter(o=>o.path?n.startsWith(o.path):!0);if(s.length!==0)return Rt.formatCookieHeader(s)}clear(){this.cookies.clear()}}});function Sl(t,e,r){let n=String(t).padStart(6,"0"),i=String(e).padStart(4,"0");return`result-${n}-iter-${i}-${r}.json`}function RN(t){return{index:t.i,iteration:t.it,name:t.n,method:Bs[t.m]||"GET",status:t.s,duration:t.d,passed:t.p,assertionsPassed:t.ap,assertionsFailed:t.af,requestId:t.r,resultFile:Sl(t.i,t.it,t.r),error:t.e}}var dv,Bs,Np=ae(()=>{"use strict";dv={GET:0,POST:1,PUT:2,DELETE:3,PATCH:4,HEAD:5,OPTIONS:6,TRACE:7,CONNECT:8},Bs={0:"GET",1:"POST",2:"PUT",3:"DELETE",4:"PATCH",5:"HEAD",6:"OPTIONS",7:"TRACE",8:"CONNECT"}});function os(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"")}function Px(t){return(Math.max(0,t)/1e3).toFixed(3)}var Mc,Nc,wl,kx=ae(()=>{"use strict";Mc=ve(require("fs/promises")),Nc=ve(require("path"));Np();wl=class{constructor(e){this.basePath=e}basePath;async generate(e,r){let n=Nc.join(this.basePath,e,r),i=JSON.parse(await Mc.readFile(Nc.join(n,"manifest.json"),"utf-8")),s=await this.loadAllSummaries(n,i.totalIndexPages),o=await this.loadAllDetails(n,s),l=this.buildXml(i,s,o),c=Nc.join(n,"junit.xml");return await Mc.writeFile(c,l,"utf-8"),c}async loadAllSummaries(e,r){let n=[];for(let i=1;i<=r;i++){let s=Nc.join(e,"index",`page-${String(i).padStart(4,"0")}.json`);try{let o=JSON.parse(await Mc.readFile(s,"utf-8"));n.push(...o.summaries)}catch{}}return n}async loadAllDetails(e,r){let n=new Map;for(let i of r){let s=Sl(i.i,i.it,i.r),o=`${i.i}-${i.it}`;try{let l=JSON.parse(await Mc.readFile(Nc.join(e,"results",s),"utf-8"));n.set(o,l)}catch{}}return n}buildGroups(e,r,n){let i=e.config?.iterations>1,s=[],o=new Map;for(let l of r){let c=n.get(`${l.i}-${l.it}`),d=l.cn||c?.collectionName||e.suiteName||"",p=l.fp||c?.folderPath||"",m=`${d}\0${p}`;if(!o.has(m)){let C=[d,p].filter(Boolean).join(" / ")||e.suiteName||"Requests";o.set(m,{label:C,cases:[]}),s.push(m)}let y=l.n||c?.name||Bs[l.m]||"request",b=i?`${y} (iteration ${l.it})`:y,
|
|
476
|
+
Be specific: name the exact requests or folders that need attention.`;return{description:`Review collection "${r.name}" (${n.length} requests, ${o.length} without assertions)`,messages:[{role:"user",content:{type:"text",text:p}}]}}async function Yy(t,e,r,n){switch(t){case"analyze-test-failure":return O5(e,n);case"suggest-assertions":return I5(e,r,n);case"review-collection":return P5(e,r);default:throw new Error(`Unknown prompt: "${t}". Available: ${$p.map(i=>i.name).join(", ")}`)}}var $p,Ex=ae(()=>{"use strict";Oi();$p=[{name:"analyze-test-failure",description:"Analyze a failed API test run. Returns a structured prompt the LLM uses to diagnose each failure and suggest concrete fixes \u2014 no extra AI configuration needed.",arguments:[{name:"runId",description:"Run ID returned by run_suite, run_collection, or run_folder",required:!0},{name:"request",description:"Filter analysis to a specific request name (omit to analyze all failures)",required:!1}]},{name:"suggest-assertions",description:"Generate pm.test() assertion scripts for a request. The LLM writes Chai-style assertions based on the request definition and optionally an observed response.",arguments:[{name:"collection",description:"Collection name or id",required:!0},{name:"request",description:"Request name or id",required:!0},{name:"runId",description:"Run ID to use observed response data for more accurate assertions (optional)",required:!1}]},{name:"review-collection",description:"Get an AI review of a collection's structure, naming conventions, test coverage gaps, and assertion quality.",arguments:[{name:"collection",description:"Collection name or id",required:!0}]}]});var $c,qx=ae(()=>{"use strict";$c=class{store=new Map;newId(){return`run_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}create(e,r){this.prune();let n={id:this.newId(),status:"running",suiteName:e,startedAt:Date.now(),progress:{completed:0,total:r},summary:{passed:0,failed:0,total:0,allPassed:!1},failedRequests:[],allResults:[],reportPath:null};return this.store.set(n.id,n),n}get(e){return this.store.get(e)}require(e){if(typeof e!="string"||!e)throw new Error('"runId" is required');let r=this.store.get(e);if(!r)throw new Error(`Run "${e}" not found. It may have expired (1-hour TTL) or never existed.`);return r}prune(){let e=Date.now()-36e5;for(let[r,n]of this.store)n.startedAt<e&&this.store.delete(r)}values(){return this.store.values()}cancel(e){let r=this.store.get(e);return!r||r.status!=="running"?!1:(r.status="cancelled",r.completedAt=Date.now(),!0)}}});function _N(t){return(0,wN.createHash)("sha256").update(t,"utf8").digest("hex").slice(0,k5)}function $5(t){let e=t.replace(/[^a-zA-Z0-9_-]+/g,"_").replace(/__+/g,"_").replace(/^_+|_+$/g,"").toLowerCase();return e?e.slice(0,A5):"id"}function ss(t){return`${$5(t)}_${_N(t)}`}function N5(t,e){return t.length>0&&t.length<=e&&/^[a-zA-Z0-9_-]+$/.test(t)&&!t.includes("__")}function Qo(t,e=T5){return N5(t,e)?t:ss(t)}function Qy(t,e,r){let n=`${t}request__${Qo(e)}__${Qo(r)}`;return n.length<=Ky?n:`${t}request__${ss(e)}__${ss(r)}`}function Zy(t,e){let r=`${t}collection__${Qo(e,100)}`;return r.length<=Ky?r:`${t}collection__${ss(e)}`}function Xy(t,e,r){let n=`${t}folder__${Qo(e)}__${Qo(r)}`;return n.length<=Ky?n:`${t}folder__${ss(e)}__${ss(r)}`}function ev(t,e){let r=`${t}suite__${Qo(e,100)}`;return r.length<=Ky?r:`${t}suite__${ss(e)}`}function tv(t){for(let e of["request","collection","folder","suite"]){let r=`${e}__`;if(t.startsWith(r))return{kind:e,tokens:t.slice(r.length).split("__")}}throw new Error(`Unknown MCP tool name: ${t}`)}function vl(t,e){let r=t.includes("_")?t.slice(t.lastIndexOf("_")+1):t;for(let n of e)if(_N(n)===r)return n;for(let n of e)if(ss(n)===t)return n;for(let n of e)if(n===t)return n}function rv(t,e){let r=vl(t,e);if(r!==void 0)return r;try{let n=Buffer.from(t,"base64url").toString("utf8");if(e.includes(n))return n}catch{}}function nv(t,e,r,n){let i=n?` in folder "${n}"`:"";return`Run the "${e}" request [${t}]${i} of the "${r}" collection.`}function iv(t,e){return`Run all ${e} requests in the "${t}" collection.`}function sv(t,e,r){return`Run all ${r} requests in folder "${t}" of the "${e}" collection.`}function ov(t,e,r){return`Run the "${t}" test suite (${e} requests, ${r} iteration(s) by default).`}var wN,k5,A5,T5,Ky,av=ae(()=>{"use strict";wN=require("crypto"),k5=12,A5=16,T5=60,Ky=126});function lv(t){let e=new Set,r=[];for(let n of t)e.has(n.name)||(e.add(n.name),r.push(n));return r}function uv(t){return Buffer.from(String(t)).toString("base64url")}function cv(t){if(!t)return 0;try{let e=parseInt(Buffer.from(t,"base64url").toString(),10);return Number.isFinite(e)&&e>=0?e:0}catch{return 0}}function fv(t,e,r){let n=r.toolPrefix??"",i=r.toolMode??"auto",s=r.drilldownThreshold??100,o=0;for(let d of t)o+=nt(d).length;let l=i==="drilldown"||i==="auto"&&o>s;if(i==="flat"&&o>500&&console.warn(`[http-forge MCP] WARNING: toolMode is "flat" but ${o} requests would produce ${o}+ tools. This will likely degrade AI tool-selection quality and bloat the context window. Consider setting toolMode to "auto" or "drilldown" in http-forge.config.json.`),l)return lv(zy(n,t.map(d=>d.name),e.map(d=>d.name)).map(d=>({name:d.name,description:d.description,inputSchema:d.inputSchema,...d.annotations&&{annotations:d.annotations}})));let c=[];for(let d of t){let p=nt(d);for(let{request:m,folderPath:y}of p)c.push({name:Qy(n,d.id,m.id),description:nv(m.method,m.name,d.name,y),inputSchema:qp});c.push({name:Zy(n,d.id),description:iv(d.name,p.length),inputSchema:Op});for(let{folderPath:m,requestCount:y}of Vr(d))y!==0&&c.push({name:Xy(n,d.id,m),description:sv(m,d.name,y),inputSchema:Ip})}for(let d of e)c.push({name:ev(n,d.id),description:ov(d.name,d.nodes.filter(p=>p.type==="request").length,d.config.iterations),inputSchema:Pp});return lv(c)}var Ox=ae(()=>{"use strict";Oi();av();kp()});var bl,Ix=ae(()=>{"use strict";ka();bl=class{cookies=new Map;getCookieKey(e,r,n){return`${r||"*"}|${n||"/"}|${e}`}getCookiesForDomain(e){let r=[];for(let n of this.cookies.values())Rt.isExpired(n)||(!n.domain||Rt.domainMatches(e,n.domain))&&r.push(n);return r}has(e,r){return this.get(e,r)!==void 0}get(e,r){let n=this.getCookieKey(e,r),i=this.cookies.get(n);if(i&&!Rt.isExpired(i))return i}set(e){let r=this.getCookieKey(e.name,e.domain,e.path);this.cookies.set(r,e)}delete(e,r,n){let i=this.getCookieKey(e,r,n);return this.cookies.delete(i)}getAll(e){if(e)return this.getCookiesForDomain(e);let r=[];for(let n of this.cookies.values())Rt.isExpired(n)||r.push(n);return r}setCookiesFromResponse(e,r){let n=Rt.extractDomain(e),i=Rt.parseCookieHeaders(r,n);for(let s of i){let o=this.getCookieKey(s.name,s.domain,s.path);this.cookies.set(o,s)}}getCookieHeader(e){let r=Rt.extractDomain(e),n=Rt.extractPath(e),s=this.getCookiesForDomain(r).filter(o=>o.path?n.startsWith(o.path):!0);if(s.length!==0)return Rt.formatCookieHeader(s)}clear(){this.cookies.clear()}}});function Sl(t,e,r){let n=String(t).padStart(6,"0"),i=String(e).padStart(4,"0");return`result-${n}-iter-${i}-${r}.json`}function RN(t){return{index:t.i,iteration:t.it,name:t.n,method:Bs[t.m]||"GET",status:t.s,duration:t.d,passed:t.p,assertionsPassed:t.ap,assertionsFailed:t.af,requestId:t.r,resultFile:Sl(t.i,t.it,t.r),error:t.e}}var dv,Bs,Np=ae(()=>{"use strict";dv={GET:0,POST:1,PUT:2,DELETE:3,PATCH:4,HEAD:5,OPTIONS:6,TRACE:7,CONNECT:8},Bs={0:"GET",1:"POST",2:"PUT",3:"DELETE",4:"PATCH",5:"HEAD",6:"OPTIONS",7:"TRACE",8:"CONNECT"}});function os(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"")}function Px(t){return(Math.max(0,t)/1e3).toFixed(3)}var Mc,Nc,wl,kx=ae(()=>{"use strict";Mc=ve(require("fs/promises")),Nc=ve(require("path"));Np();wl=class{constructor(e){this.basePath=e}basePath;async generate(e,r){let n=Nc.join(this.basePath,e,r),i=JSON.parse(await Mc.readFile(Nc.join(n,"manifest.json"),"utf-8")),s=await this.loadAllSummaries(n,i.totalIndexPages),o=await this.loadAllDetails(n,s),l=this.buildXml(i,s,o),c=Nc.join(n,"junit.xml");return await Mc.writeFile(c,l,"utf-8"),c}async loadAllSummaries(e,r){let n=[];for(let i=1;i<=r;i++){let s=Nc.join(e,"index",`page-${String(i).padStart(4,"0")}.json`);try{let o=JSON.parse(await Mc.readFile(s,"utf-8"));n.push(...o.summaries)}catch{}}return n}async loadAllDetails(e,r){let n=new Map;for(let i of r){let s=Sl(i.i,i.it,i.r),o=`${i.i}-${i.it}`;try{let l=JSON.parse(await Mc.readFile(Nc.join(e,"results",s),"utf-8"));n.set(o,l)}catch{}}return n}buildGroups(e,r,n){let i=e.config?.iterations>1,s=[],o=new Map;for(let l of r){let c=n.get(`${l.i}-${l.it}`),d=l.cn||c?.collectionName||e.suiteName||"",p=l.fp||c?.folderPath||"",m=`${d}\0${p}`;if(!o.has(m)){let C=[d,p].filter(Boolean).join(" / ")||e.suiteName||"Requests";o.set(m,{label:C,cases:[]}),s.push(m)}let y=l.n||c?.name||Bs[l.m]||"request",b=i?`${y} (iteration ${l.it})`:y,q=(c?.assertions??[]).filter(C=>!C.passed).map(C=>({name:C.name,message:C.message}));q.length===0&&l.af>0&&q.push({name:`${l.af} assertion(s) failed`,message:null}),o.get(m).cases.push({name:b,classname:[d,p].filter(Boolean).join(".")||e.suiteName||"http-forge",durationMs:l.d,status:l.s,passed:l.p,error:l.e??c?.error??null,failedAssertions:q,consoleOutput:c?.consoleOutput})}return s.map(l=>o.get(l))}buildXml(e,r,n){let i=this.buildGroups(e,r,n),s=0,o=0,l=0,c=0,d=[];i.forEach((y,b)=>{let q=0,C=0,v=0,_=0,E=[];for(let k of y.cases){q++,_+=k.durationMs;let O=!k.passed&&k.failedAssertions.length===0&&!!k.error,M=!k.passed&&!O;O&&v++,M&&C++;let j=[];if(M){let R=k.failedAssertions.length>0?k.failedAssertions.map(F=>F.name).join("; "):k.error||"Assertion failed",A=k.failedAssertions.map(F=>F.message?`${F.name}: ${F.message}`:F.name).join(`
|
|
477
477
|
`);j.push(` <failure message="${os(R)}" type="AssertionFailure">${os(A)}</failure>`)}O&&j.push(` <error message="${os(k.error)}" type="RequestError">${os(k.error)}</error>`),k.consoleOutput&&k.consoleOutput.length>0&&j.push(` <system-out>${os(k.consoleOutput.join(`
|
|
478
|
-
`))}</system-out>`);let I=` <testcase name="${os(k.name)}" classname="${os(k.classname)}" time="${Px(k.durationMs)}"`;j.length===0?
|
|
478
|
+
`))}</system-out>`);let I=` <testcase name="${os(k.name)}" classname="${os(k.classname)}" time="${Px(k.durationMs)}"`;j.length===0?E.push(`${I} />`):E.push(`${I}>
|
|
479
479
|
${j.join(`
|
|
480
480
|
`)}
|
|
481
|
-
</testcase>`)}s+=
|
|
482
|
-
${
|
|
481
|
+
</testcase>`)}s+=q,o+=C,l+=v,c+=_,d.push(` <testsuite name="${os(y.label)}" tests="${q}" failures="${C}" errors="${v}" skipped="0" time="${Px(_)}" timestamp="${os(e.startTime)}" id="${b}">
|
|
482
|
+
${E.join(`
|
|
483
483
|
`)}
|
|
484
484
|
</testsuite>`)});let p='<?xml version="1.0" encoding="UTF-8"?>',m=`<testsuites name="${os(e.suiteName)}" tests="${s}" failures="${o}" errors="${l}" skipped="0" time="${Px(c)}">`;return`${p}
|
|
485
485
|
${m}
|
|
@@ -494,13 +494,13 @@ ${d.join(`
|
|
|
494
494
|
<tr>
|
|
495
495
|
<td class="kv-key">${$t(r.name??"(unnamed)")}</td>
|
|
496
496
|
<td class="kv-val">${$t(r.value??"")}</td>
|
|
497
|
-
</tr>`).join("")}</table>`}function xN(t,e){if(t==null||t==="")return'<span class="dim">\u2014 empty \u2014</span>';let r=EN(t);return`<pre class="code">${$t(r)}</pre>`}var Dc,Fc,jc,$x=ae(()=>{"use strict";Dc=ve(require("fs/promises")),Fc=ve(require("path"));Np();jc=class{constructor(e){this.basePath=e}basePath;async generate(e,r){let n=Fc.join(this.basePath,e,r),i=JSON.parse(await Dc.readFile(Fc.join(n,"manifest.json"),"utf-8")),s=await this.loadAllSummaries(n,i.totalIndexPages),o=await this.loadAllDetails(n,s),l=this.buildHtml(i,s,o),c=Fc.join(n,"report.html");return await Dc.writeFile(c,l,"utf-8"),c}async loadAllSummaries(e,r){let n=[];for(let i=1;i<=r;i++){let s=Fc.join(e,"index",`page-${String(i).padStart(4,"0")}.json`);try{let o=JSON.parse(await Dc.readFile(s,"utf-8"));n.push(...o.summaries)}catch{}}return n}async loadAllDetails(e,r){let n=new Map;for(let i of r){let s=Sl(i.i,i.it,i.r),o=`${i.i}-${i.it}`;try{let l=JSON.parse(await Dc.readFile(Fc.join(e,"results",s),"utf-8"));n.set(o,l)}catch{}}return n}groupByIterCollectionFolder(e){let r=[],n=new Map;for(let i of e){n.has(i.it)||(n.set(i.it,{order:[],map:new Map}),r.push(i.it));let s=n.get(i.it),o=i.cn||"",l=i.fp||"",c=`${o}\0${l}`;s.map.has(c)||(s.map.set(c,{cn:o,fp:l,items:[]}),s.order.push(c)),s.map.get(c).items.push(i)}return r.map(i=>{let s=n.get(i);return{it:i,groups:s.order.map(o=>s.map.get(o))}})}groupLabel(e,r,n){let i=String(n).padStart(2,"0"),s=e?$t(e):"";if(r){let o=r.split("/").map(l=>$t(l.replace(/^\s*\d+\s*-\s*/,""))).join("/");s=s?`${s}: ${o}`:o}return s||(s="(root)"),`${i} - ${s}`}renderGroupedDetails(e,r,n){let i=r.config.iterations>1;return this.groupByIterCollectionFolder(e).map(s=>{let o=s.groups.map((d,p)=>{let m=d.items.filter(C=>C.p).length,y=d.items.length,b=m<y,
|
|
497
|
+
</tr>`).join("")}</table>`}function xN(t,e){if(t==null||t==="")return'<span class="dim">\u2014 empty \u2014</span>';let r=EN(t);return`<pre class="code">${$t(r)}</pre>`}var Dc,Fc,jc,$x=ae(()=>{"use strict";Dc=ve(require("fs/promises")),Fc=ve(require("path"));Np();jc=class{constructor(e){this.basePath=e}basePath;async generate(e,r){let n=Fc.join(this.basePath,e,r),i=JSON.parse(await Dc.readFile(Fc.join(n,"manifest.json"),"utf-8")),s=await this.loadAllSummaries(n,i.totalIndexPages),o=await this.loadAllDetails(n,s),l=this.buildHtml(i,s,o),c=Fc.join(n,"report.html");return await Dc.writeFile(c,l,"utf-8"),c}async loadAllSummaries(e,r){let n=[];for(let i=1;i<=r;i++){let s=Fc.join(e,"index",`page-${String(i).padStart(4,"0")}.json`);try{let o=JSON.parse(await Dc.readFile(s,"utf-8"));n.push(...o.summaries)}catch{}}return n}async loadAllDetails(e,r){let n=new Map;for(let i of r){let s=Sl(i.i,i.it,i.r),o=`${i.i}-${i.it}`;try{let l=JSON.parse(await Dc.readFile(Fc.join(e,"results",s),"utf-8"));n.set(o,l)}catch{}}return n}groupByIterCollectionFolder(e){let r=[],n=new Map;for(let i of e){n.has(i.it)||(n.set(i.it,{order:[],map:new Map}),r.push(i.it));let s=n.get(i.it),o=i.cn||"",l=i.fp||"",c=`${o}\0${l}`;s.map.has(c)||(s.map.set(c,{cn:o,fp:l,items:[]}),s.order.push(c)),s.map.get(c).items.push(i)}return r.map(i=>{let s=n.get(i);return{it:i,groups:s.order.map(o=>s.map.get(o))}})}groupLabel(e,r,n){let i=String(n).padStart(2,"0"),s=e?$t(e):"";if(r){let o=r.split("/").map(l=>$t(l.replace(/^\s*\d+\s*-\s*/,""))).join("/");s=s?`${s}: ${o}`:o}return s||(s="(root)"),`${i} - ${s}`}renderGroupedDetails(e,r,n){let i=r.config.iterations>1;return this.groupByIterCollectionFolder(e).map(s=>{let o=s.groups.map((d,p)=>{let m=d.items.filter(C=>C.p).length,y=d.items.length,b=m<y,q=d.items.map(n).join("");return`
|
|
498
498
|
<details class="group-block${b?" group-fail":""}" open>
|
|
499
499
|
<summary class="group-head">
|
|
500
500
|
<span class="group-title">\u{1F4C1} ${this.groupLabel(d.cn,d.fp,p+1)}</span>
|
|
501
501
|
<span class="group-count ${b?"fail":"dim"}">(${m}/${y})</span>
|
|
502
502
|
</summary>
|
|
503
|
-
<div class="group-body">${
|
|
503
|
+
<div class="group-body">${q}</div>
|
|
504
504
|
</details>`}).join("");if(!i)return o;let l=s.groups.reduce((d,p)=>d+p.items.filter(m=>m.p).length,0),c=s.groups.reduce((d,p)=>d+p.items.length,0);return`
|
|
505
505
|
<details class="iter-block" open>
|
|
506
506
|
<summary class="iter-head">
|
|
@@ -508,7 +508,7 @@ ${d.join(`
|
|
|
508
508
|
<span class="dim iter-count">(${l}/${c} passed)</span>
|
|
509
509
|
</summary>
|
|
510
510
|
<div class="iter-body">${o}</div>
|
|
511
|
-
</details>`}).join("")}renderGroupedTimeline(e,r,n){let i=r.config.iterations>1,s=8;return this.groupByIterCollectionFolder(e).map(o=>{let l="";return i&&(l+=`<tr class="group-row iter-row"><td colspan="${s}">Iteration ${o.it}</td></tr>`),o.groups.forEach((c,d)=>{l+=`<tr class="group-row folder-row"><td colspan="${s}">\u{1F4C1} ${this.groupLabel(c.cn,c.fp,d+1)}</td></tr>`,l+=c.items.map(n).join("")}),l}).join("")}buildHtml(e,r,n){let i=_l(e.stats.totalDuration),s=e.stats.failed===0,o=Object.entries(e.requestStats).map(([,b])=>{let
|
|
511
|
+
</details>`}).join("")}renderGroupedTimeline(e,r,n){let i=r.config.iterations>1,s=8;return this.groupByIterCollectionFolder(e).map(o=>{let l="";return i&&(l+=`<tr class="group-row iter-row"><td colspan="${s}">Iteration ${o.it}</td></tr>`),o.groups.forEach((c,d)=>{l+=`<tr class="group-row folder-row"><td colspan="${s}">\u{1F4C1} ${this.groupLabel(c.cn,c.fp,d+1)}</td></tr>`,l+=c.items.map(n).join("")}),l}).join("")}buildHtml(e,r,n){let i=_l(e.stats.totalDuration),s=e.stats.failed===0,o=Object.entries(e.requestStats).map(([,b])=>{let q=M5(b.passed,b.count);return`
|
|
512
512
|
<tr${b.failed>0?' class="row-fail"':""}>
|
|
513
513
|
<td>${$t(b.name)}</td>
|
|
514
514
|
<td>${b.count}</td>
|
|
@@ -517,18 +517,18 @@ ${d.join(`
|
|
|
517
517
|
<td>${_l(b.avgDuration)}</td>
|
|
518
518
|
<td>${b.p90!==void 0?_l(b.p90):"\u2014"}</td>
|
|
519
519
|
<td>${b.p99!==void 0?_l(b.p99):"\u2014"}</td>
|
|
520
|
-
<td class="${b.failed>0?"fail":"pass"}">${
|
|
521
|
-
</tr>`}).join(""),l=Math.max(...r.map(b=>b.d),1),c=b=>{let
|
|
520
|
+
<td class="${b.failed>0?"fail":"pass"}">${q}</td>
|
|
521
|
+
</tr>`}).join(""),l=Math.max(...r.map(b=>b.d),1),c=b=>{let q=Bs[b.m]??"GET",C=Math.max(2,Math.round(b.d/l*100)),v=b.p?"bar-pass":"bar-fail",_=b.p?"":' class="row-fail"',E=`req-${b.i}-${b.it}`;return`
|
|
522
522
|
<tr${_}>
|
|
523
523
|
<td class="dim">${b.i}</td>
|
|
524
524
|
<td>${b.it}</td>
|
|
525
|
-
<td><span class="method method-${
|
|
526
|
-
<td><a href="#${
|
|
525
|
+
<td><span class="method method-${q.toLowerCase()}">${q}</span></td>
|
|
526
|
+
<td><a href="#${E}" class="req-link">${$t(b.n)}</a></td>
|
|
527
527
|
<td class="${pv(b.s)}">${b.s}</td>
|
|
528
528
|
<td>${_l(b.d)}</td>
|
|
529
529
|
<td><div class="bar-wrap"><div class="${v}" style="width:${C}%"></div></div></td>
|
|
530
530
|
<td class="${b.p?"pass":"fail"}">${b.p?"\u2713":"\u2717"}</td>
|
|
531
|
-
</tr>`},d=this.renderGroupedTimeline(r,e,c),p=b=>{let
|
|
531
|
+
</tr>`},d=this.renderGroupedTimeline(r,e,c),p=b=>{let q=`${b.i}-${b.it}`,C=n.get(q),v=Bs[b.m]??"GET",_=`req-${b.i}-${b.it}`,E=b.p,k=E?"#1f6feb40":"#f8514940",O=C?.assertions?.length?`<ul class="assert-list">${C.assertions.map(xt=>`
|
|
532
532
|
<li class="${xt.passed?"pass":"fail"}">
|
|
533
533
|
<span class="assert-icon">${xt.passed?"\u2713":"\u2717"}</span>
|
|
534
534
|
${$t(xt.name)}
|
|
@@ -584,7 +584,7 @@ ${d.join(`
|
|
|
584
584
|
${Q}
|
|
585
585
|
</div>`,gt=me.length<=Ae.length,Nt=gt?Re:"",pe=gt?"":Re,Gt=C?.consoleOutput?.length?`<div class="console-block"><pre class="code console-code">${C.consoleOutput.map(xt=>$t(typeof xt=="string"?xt:JSON.stringify(xt))).join(`
|
|
586
586
|
`)}</pre></div>`:"",kr=C?.error?`<div class="error-box">\u26A0 ${$t(C.error)}</div>`:"",ut=C?`<span class="${pv(C.status)} status-badge">${C.status} ${$t(C.statusText??"")}</span>`:"",Ar=`<span class="dur-badge">${_l(b.d)}</span>`,br=e.config.iterations>1?`<span class="iter-badge">iter ${b.it}</span>`:"";return`
|
|
587
|
-
<details class="req-detail ${
|
|
587
|
+
<details class="req-detail ${E?"req-pass":"req-fail"}" id="${_}" style="--border:${k}">
|
|
588
588
|
<summary class="req-summary">
|
|
589
589
|
<span class="toggle-icon">\u25B6</span>
|
|
590
590
|
<span class="req-index dim">#${b.i}</span>
|
|
@@ -593,7 +593,7 @@ ${d.join(`
|
|
|
593
593
|
${ut}
|
|
594
594
|
${Ar}
|
|
595
595
|
${br}
|
|
596
|
-
<span class="req-outcome ${
|
|
596
|
+
<span class="req-outcome ${E?"pass":"fail"}">${E?"\u2713":"\u2717"}</span>
|
|
597
597
|
</summary>
|
|
598
598
|
<div class="req-body">
|
|
599
599
|
${kr}
|
|
@@ -913,11 +913,11 @@ ${d.join(`
|
|
|
913
913
|
<div id="tab-failures" class="tab-content">
|
|
914
914
|
<p class="dim" style="margin-bottom:12px">Jump to failing request details:</p>
|
|
915
915
|
<ul style="list-style:none;display:flex;flex-direction:column;gap:6px">
|
|
916
|
-
${r.filter(b=>!b.p).map(b=>{let
|
|
916
|
+
${r.filter(b=>!b.p).map(b=>{let q=Bs[b.m]??"GET";return`<li>
|
|
917
917
|
<a href="#req-${b.i}-${b.it}" onclick="jumpToRequest('req-${b.i}-${b.it}')"
|
|
918
918
|
style="display:flex;align-items:center;gap:8px;background:#1c0f12;
|
|
919
919
|
border:1px solid #f8514940;border-radius:6px;padding:8px 12px">
|
|
920
|
-
<span class="method method-${
|
|
920
|
+
<span class="method method-${q.toLowerCase()}">${q}</span>
|
|
921
921
|
<strong>${$t(b.n)}</strong>
|
|
922
922
|
<span class="status-badge ${pv(b.s)}">${b.s}</span>
|
|
923
923
|
<span class="dur-badge">${_l(b.d)}</span>
|
|
@@ -1015,10 +1015,10 @@ ${d.join(`
|
|
|
1015
1015
|
</html>`}}});function Rl(t,e){if(t.length===0)return 0;let r=Math.ceil(e/100*t.length)-1;return t[Math.max(0,Math.min(r,t.length-1))]}var ir,dn,Cl,Nx=ae(()=>{"use strict";ir=ve(require("fs/promises")),dn=ve(require("path"));Un();_d();$x();Np();Cl=class{constructor(e){this.configService=e;let r=e.getRunnerConfig();this.basePath=e.getResultsPath(),this.indexPageSize=r.indexPageSize,this.recentErrorsLimit=r.recentErrorsLimit}configService;basePath;currentRunPath=null;currentRunId=null;currentSuiteId=null;currentManifest=null;currentIndexPage=[];currentPageNumber=1;indexPageSize;recentErrors=[];recentErrorsLimit;resultIndex=0;requestDurations={};getBasePath(){return this.basePath}async initializeRun(e,r,n,i){let s=this.generateRunId();return this.currentRunId=s,this.currentSuiteId=e,this.currentRunPath=dn.join(this.basePath,e,s),await ir.mkdir(dn.join(this.currentRunPath,"results"),{recursive:!0}),await ir.mkdir(dn.join(this.currentRunPath,"index"),{recursive:!0}),this.currentManifest={version:"1.0",runId:s,suiteId:e,suiteName:r,environment:n,startTime:new Date().toISOString(),status:"running",config:i,stats:{totalRequests:0,passed:0,failed:0,skipped:0,totalDuration:0,avgDuration:0,minDuration:Number.MAX_SAFE_INTEGER,maxDuration:0},requestStats:{},totalIndexPages:0,indexPageSize:this.indexPageSize},this.currentIndexPage=[],this.currentPageNumber=1,this.recentErrors=[],this.resultIndex=0,this.requestDurations={},await this.saveManifest(),s}async saveResult(e,r){if(!this.currentRunPath||!this.currentManifest)throw new Error("No active run. Call initializeRun first.");this.resultIndex++;let n=Date.now(),i=String(e).padStart(4,"0"),s=String(this.resultIndex).padStart(6,"0"),o=Ht(r.requestId),l=`result-${s}-iter-${i}-${o}.json`,c=dn.join(this.currentRunPath,"results",l),d={index:this.resultIndex,iteration:e,requestId:r.requestId,name:r.name,method:r.executedRequest.method,url:r.executedRequest.url,folderPath:r.folderPath||"",collectionName:r.collectionName||"",status:r.response.status,statusText:r.response.statusText||"",duration:r.duration,passed:r.passed,timestamp:n,request:{method:r.executedRequest.method,url:r.executedRequest.url,headers:r.executedRequest.headers,query:r.executedRequest.query,params:r.executedRequest.params,body:r.executedRequest.body},response:{headers:r.response.headers,body:r.response.body,time:r.response.time,size:r.response.size,cookies:r.response.cookies},assertions:r.assertions.map(b=>({name:b.name,passed:b.passed,message:b.message||null})),error:r.error||null,consoleOutput:r.consoleOutput,modifiedVariables:r.modifiedVariables,modifiedEnvironmentVariables:r.modifiedEnvironmentVariables,modifiedCollectionVariables:r.modifiedCollectionVariables,nextRequest:r.nextRequest??null,visualizerData:r.visualizerData};await ir.writeFile(c,JSON.stringify(fg(d),null,2),"utf-8");let p=r.assertions.filter(b=>b.passed).length,m=r.assertions.filter(b=>!b.passed).length,y={i:this.resultIndex,it:e,n:r.name,m:dv[r.executedRequest.method.toUpperCase()]??0,s:r.response.status,d:r.duration,p:r.passed,ap:p,af:m,r:r.requestId,e:r.passed?null:r.error||null,fp:r.folderPath||"",cn:r.collectionName||""};return this.currentIndexPage.push(y),this.currentIndexPage.length>=this.indexPageSize&&await this.writeCurrentIndexPage(),this.updateStats(r),this.requestDurations[r.requestId]||(this.requestDurations[r.requestId]=[]),this.requestDurations[r.requestId].push(r.duration),r.passed||(this.recentErrors.unshift({timestamp:n,iteration:e,requestName:r.name,status:r.response.status,error:r.error||`Status ${r.response.status}`,resultFile:l}),this.recentErrors.length>this.recentErrorsLimit&&this.recentErrors.pop()),y}async finalizeRun(e="completed",r=!0){if(!this.currentManifest)return null;this.currentIndexPage.length>0&&await this.writeCurrentIndexPage(),this.currentManifest.endTime=new Date().toISOString(),this.currentManifest.status=e,this.currentManifest.totalIndexPages=this.currentPageNumber-1,this.currentManifest.stats.totalRequests>0&&(this.currentManifest.stats.avgDuration=Math.round(this.currentManifest.stats.totalDuration/this.currentManifest.stats.totalRequests)),this.currentManifest.stats.minDuration===Number.MAX_SAFE_INTEGER&&(this.currentManifest.stats.minDuration=0);for(let c in this.currentManifest.requestStats){let d=this.currentManifest.requestStats[c],p=this.requestDurations[c]||[];d.count>0&&(d.avgDuration=Math.round(d.totalDuration/d.count)),d.minDuration===Number.MAX_SAFE_INTEGER&&(d.minDuration=0),p.length>0&&(p.sort((m,y)=>m-y),d.p50=Rl(p,50),d.p90=Rl(p,90),d.p95=Rl(p,95),d.p99=Rl(p,99))}let n=Object.values(this.requestDurations).flat();n.length>0&&(n.sort((c,d)=>c-d),this.currentManifest.stats.p50=Rl(n,50),this.currentManifest.stats.p95=Rl(n,95),this.currentManifest.stats.p99=Rl(n,99)),this.requestDurations={},await this.saveManifest();let i=null,s=this.currentRunPath,o=this.currentSuiteId,l=this.currentRunId;if(this.currentRunPath=null,this.currentRunId=null,this.currentSuiteId=null,this.currentManifest=null,this.currentIndexPage=[],this.recentErrors=[],this.resultIndex=0,r&&o&&l&&s)try{i=await new jc(this.basePath).generate(o,l)}catch(c){console.warn("[ResultStorage] HTML report generation failed:",c)}return i}getCurrentStats(){return this.currentManifest?{stats:{...this.currentManifest.stats},requestStats:{...this.currentManifest.requestStats},recentErrors:[...this.recentErrors]}:null}getCurrentRunId(){return this.currentRunId}getCurrentSuiteId(){return this.currentSuiteId}async getResultDetails(e,r,n){let i=dn.join(this.basePath,e,r,"results",n),s=await ir.readFile(i,"utf-8");return JSON.parse(s)}async getIndexPage(e,r,n){let i=dn.join(this.basePath,e,r,"index",`page-${String(n).padStart(4,"0")}.json`),s=await ir.readFile(i,"utf-8");return JSON.parse(s)}async getManifest(e,r){let n=dn.join(this.basePath,e,r,"manifest.json"),i=await ir.readFile(n,"utf-8");return JSON.parse(i)}async listRuns(e){let r=dn.join(this.basePath,e);try{let n=await ir.readdir(r),i=[];for(let s of n.sort().reverse())try{let o=await this.getManifest(e,s);i.push(o)}catch{}return i}catch{return[]}}async listSuites(){try{return(await ir.readdir(this.basePath,{withFileTypes:!0})).filter(r=>r.isDirectory()).map(r=>r.name)}catch{return[]}}async deleteRun(e,r){let n=dn.join(this.basePath,e,r);await ir.rm(n,{recursive:!0,force:!0})}async cleanupOldRuns(){let r=this.configService.getRunnerConfig().resultsRetentionDays;if(r===0)return{deleted:0,freed:0};let n=new Date;n.setDate(n.getDate()-r);let i=0,s=0,o=await this.listSuites();for(let l of o){let c=await this.listRuns(l);for(let d of c)if(new Date(d.startTime)<n){let p=dn.join(this.basePath,l,d.runId),m=await this.getDirectorySize(p);await ir.rm(p,{recursive:!0,force:!0}),i++,s+=m}}return{deleted:i,freed:s}}generateRunId(){let e=new Date,r=e.toISOString().slice(0,10).replace(/-/g,""),n=e.toTimeString().slice(0,8).replace(/:/g,""),i=String(e.getMilliseconds()).padStart(3,"0");return`run-${r}-${n}-${i}`}async saveManifest(){if(!this.currentRunPath||!this.currentManifest)return;let e=dn.join(this.currentRunPath,"manifest.json");await ir.writeFile(e,JSON.stringify(this.currentManifest,null,2),"utf-8")}async writeCurrentIndexPage(){if(!this.currentRunPath||this.currentIndexPage.length===0)return;let e=`page-${String(this.currentPageNumber).padStart(4,"0")}.json`,r=dn.join(this.currentRunPath,"index",e),n={page:this.currentPageNumber,startIndex:(this.currentPageNumber-1)*this.indexPageSize+1,count:this.currentIndexPage.length,summaries:this.currentIndexPage};await ir.writeFile(r,JSON.stringify(n),"utf-8"),this.currentPageNumber++,this.currentIndexPage=[]}updateStats(e){if(!this.currentManifest)return;let r=this.currentManifest.stats,n=this.currentManifest.requestStats;r.totalRequests++,r.totalDuration+=e.duration,r.minDuration=Math.min(r.minDuration,e.duration),r.maxDuration=Math.max(r.maxDuration,e.duration),e.passed?r.passed++:r.failed++,n[e.requestId]||(n[e.requestId]={name:e.name,count:0,passed:0,failed:0,totalDuration:0,avgDuration:0,minDuration:Number.MAX_SAFE_INTEGER,maxDuration:0});let i=n[e.requestId];i.count++,i.totalDuration+=e.duration,i.minDuration=Math.min(i.minDuration,e.duration),i.maxDuration=Math.max(i.maxDuration,e.duration),e.passed?i.passed++:i.failed++}async getDirectorySize(e){let r=0;try{let n=await ir.readdir(e,{withFileTypes:!0});for(let i of n){let s=dn.join(e,i.name);if(i.isDirectory())r+=await this.getDirectorySize(s);else{let o=await ir.stat(s);r+=o.size}}}catch{}return r}}});function Lc(t){return typeof t=="string"?t:""+JSON.stringify(t)}function xl(t){if(typeof t=="string"&&t.charCodeAt(0)===30)try{return JSON.parse(t.slice(1))}catch{return t}return t}function hv(t){if(!t)return{};let e={};for(let[r,n]of Object.entries(t))e[r]=xl(n);return e}var Mx=ae(()=>{"use strict"});var as,Mp,Fx,mv,gv,yv,qN=ae(()=>{"use strict";as=ve(require("fs")),Mp=ve(require("path")),Fx=class{watchers=[];constructor(e,r){let n=this.globToPath(e,r);try{let i=as.watch(n,{recursive:!0},(s,o)=>{if(o){let l=Mp.join(n,o);this.notifyChange(l)}});this.watchers.push(i)}catch{}}globToPath(e,r){return r.includes("**")?e:Mp.join(e,r.replace(/\*/g,""))}notifyChange(e){}onDidChange(e){return{dispose:()=>{}}}onDidCreate(e){return{dispose:()=>{}}}onDidDelete(e){return{dispose:()=>{}}}dispose(){for(let e of this.watchers)e.close();this.watchers=[]}},mv=class{createFileWatcher(e,r){return new Fx(e,r)}},gv=class{data={};storeFile;constructor(e){this.storeFile=e,this.load()}load(){try{if(as.existsSync(this.storeFile)){let e=as.readFileSync(this.storeFile,"utf-8");this.data=JSON.parse(e)}}catch{}}save(){try{let e=Mp.dirname(this.storeFile);as.mkdirSync(e,{recursive:!0}),as.writeFileSync(this.storeFile,JSON.stringify(this.data,null,2),"utf-8")}catch{}}get(e,r){let n=this.data[e];return n!==void 0?n:r}async update(e,r){r===void 0?delete this.data[e]:this.data[e]=r,this.save()}},yv=class{async showInformation(e){console.log(`[INFO] ${e}`)}async showWarning(e){console.warn(`[WARN] ${e}`)}async showError(e){console.error(`[ERROR] ${e}`)}}});function Dx(t){let e=El.resolve(t.workspaceFolder),{appInfo:r}=t,n=Yo.createFresh(),i=El.join(e,".http-forge",".cache","stores","global-state.json"),s=t.globalStorePath?El.isAbsolute(t.globalStorePath)?t.globalStorePath:El.resolve(e,t.globalStorePath):i,o={workspaceFolder:e,fileWatcherFactory:new mv,notificationService:new yv,globalStore:new gv(s),applicationInfo:r||{name:"http-forge-cli",version:"0.1.0"},persistOverrides:!1};return Rp(n,o),n}function qn(t){return Dx({workspaceFolder:t})}var El,vv=ae(()=>{"use strict";El=ve(require("path"));Sx();_x();qN()});function j5(t){let e=[];return t.map(r=>{let n=_n(r,e);return e.push(n),n})}function ON(t,e,r,n){let i=t.find(d=>d.id===e);if(i)return{item:i,tier:"id"};let s=j5(t.map(d=>d.name)),o=t.filter((d,p)=>s[p]===e);if(o.length===1)return{item:o[0],tier:"slug"};if(o.length>1)throw new Zo(r,e,o.map(d=>({id:d.id,name:d.name,path:n(d)})));let l=e.toLowerCase(),c=t.filter(d=>d.name.toLowerCase()===l);if(c.length===1)return{item:c[0],tier:"name"};throw c.length>1?new Zo(r,e,c.map(d=>({id:d.id,name:d.name,path:n(d)}))):new Error(`${r.charAt(0).toUpperCase()}${r.slice(1)} "${e}" not found`)}function bv(t,e){let{item:r,tier:n}=ON(t,e,"collection",()=>"");return{collection:r,tier:n}}function Sv(t,e){let r=e.split("/").map(o=>o.trim()).filter(o=>o.length>0),n=t.items,i=[],s=[];for(let o of r){let l=n.filter(m=>m.type==="folder"),c=i.join("/"),{item:d,tier:p}=ON(l,o,"folder",m=>c?`${c}/${m.name}`:m.name);i.push(d.name),s.push(p),n=d.items??[]}return{folderPath:i.map(vr).join("/"),tiers:s}}function IN(t,e,r){let n=[];for(let i of t)if(i.type==="request"){let s=_n(i.name,n);n.push(s),r.push({item:i,folderPath:e,slug:s})}for(let i of t)if(i.type==="folder"){let s=i,o=e?`${e}/${vr(s.name)}`:vr(s.name);IN(s.items??[],o,r)}}function wv(t,e,r){let n=[];IN(t.items,"",n);let i=r?r.replace(/\/+$/,""):void 0,s=i?n.filter(y=>y.folderPath===i||y.folderPath.startsWith(`${i}/`)):n,o=y=>y.folderPath?`${y.folderPath}/${y.item.name}`:y.item.name,l=s.find(y=>y.item.id===e);if(l)return{request:l.item,tier:"id",folderPath:l.folderPath};let c=s.filter(y=>y.slug===e);if(c.length===1)return{request:c[0].item,tier:"slug",folderPath:c[0].folderPath};if(c.length>1)throw new Zo("request",e,c.map(y=>({id:y.item.id,name:y.item.name,path:o(y)})));let d=e.toLowerCase(),p=s.filter(y=>y.item.name.toLowerCase()===d);if(p.length===1)return{request:p[0].item,tier:"name",folderPath:p[0].folderPath};if(p.length>1)throw new Zo("request",e,p.map(y=>({id:y.item.id,name:y.item.name,path:o(y)})));let m=i?` under folder "${i}"`:"";throw new Error(`Request "${e}" not found in collection "${t.name}"${m}`)}var Zo,jx=ae(()=>{"use strict";Pa();Oi();Zo=class extends Error{constructor(r,n,i){super(`Ambiguous ${r} reference "${n}" matches ${i.length} items:
|
|
1016
1016
|
`+i.map(s=>` - ${s.name} (id: ${s.id}, path: ${s.path||"/"})`).join(`
|
|
1017
1017
|
`)+`
|
|
1018
|
-
Disambiguate by passing the id or slug.`);this.kind=r;this.value=n;this.candidates=i;this.name="AmbiguousRefError"}kind;value;candidates}});var Dp={};Rs(Dp,{runCollection:()=>Vs,runFolder:()=>W5,runRequest:()=>Rv,runSuite:()=>Fp});function Ux(t){let e=[t.testSuite,t.collection,t.environmentConfig,t.config,t.console];for(let r of e)try{r?.dispose?.()}catch{}}function kN(t){return t==="1"||t==="true"||t==="yes"||t==="on"}function L5(){return kN(process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS)}function U5(){let t=process.env.HTTP_FORGE_MAX_REQUESTS;if(!t||t.trim()==="")return 50;let e=Number(t);if(!Number.isFinite(e)||e<=0)throw new Error("HTTP_FORGE_MAX_REQUESTS must be a positive number when provided");return Math.floor(e)}function AN(t,e=[]){return kN(process.env.HTTP_FORGE_GENERATE_REPORTS)||e.includes("html")?!0:t.includes("report")}function Lx(t){if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}}function H5(t){return t?Object.fromEntries(Object.entries(t).filter(([e])=>e.toLowerCase()!=="set-cookie")):{}}function TN(t){return gi(H5(t))}function $N(t){return u_((t??[]).map(e=>({name:e.name,value:e.value})))}function PN(t){return t.replace(/[^a-zA-Z0-9_-]/g,"_")}function NN(t){let e=["none","inherit","basic","bearer","apikey","oauth2"],r=t.auth?.type&&e.includes(t.auth.type)?t.auth.type:void 0;return{id:t.id,name:t.name,method:t.method,url:t.url,headers:Array.isArray(t.headers)?t.headers.reduce((n,i)=>(i.enabled&&i.key&&(n[i.key]=i.value??""),n),{}):t.headers,query:Array.isArray(t.query)?t.query.reduce((n,i)=>(i.enabled&&i.key&&(n[i.key]=i.value??""),n),{}):t.query,params:t.params?Object.entries(t.params).reduce((n,[i,s])=>(n[i]=typeof s=="string"?s:s.value??"",n),{}):void 0,body:t.body??null,scripts:t.scripts,settings:t.settings,auth:{type:r==="inherit"?"none":r,bearerToken:t.auth?.bearerToken,basicAuth:t.auth?.basicAuth,apikey:t.auth?.apikey,oauth2:t.auth?.oauth2}}}function MN(t,e){let r={...t};return e.headers&&(r.headers={...t.headers??{},...e.headers}),e.query&&(r.query=e.query),e.body!==void 0&&(r.body={type:"raw",raw:e.body,contentType:"application/json"}),r}function _v(t){return t?Object.fromEntries(Object.entries(t).map(([e,r])=>[e,String(r)])):{}}function FN(t,e,r){if(t&&t.type&&t.type!=="inherit")return t.type==="none"?void 0:t;for(let n=e.length-1;n>=0;n--){let i=e[n];if(i?.type&&i.type!=="inherit")return i.type==="none"?void 0:i}if(r&&r.type&&r.type!=="inherit")return r.type==="none"?void 0:r}function Hx(t,e,r=t.items,n=[],i=[]){for(let s of r){if(s.type==="request"&&s.id===e)return{request:s,folderScriptsChain:[...n],folderAuthChain:[...i]};if(s.type==="folder"){let o=s,l=o.scripts?[...n,o.scripts]:[...n],c=o.auth?[...i,o.auth]:[...i],d=Hx(t,e,o.items??[],l,c);if(d)return d}}}function DN(t,e=t.items,r=[],n=[]){let i=[];for(let s of e)if(s.type==="request")i.push({request:s,folderScriptsChain:[...r],folderPath:n.map(vr).join("/")});else{let o=s,l=o.scripts?[...r,o.scripts]:[...r],c=[...n,o.name];i.push(...DN(t,o.items??[],l,c))}return i}function B5(t,e,r=!0){if(!e)return t;let n=e.replace(/\/+$/,"");return t.filter(({folderPath:i})=>r?i===n||i.startsWith(`${n}/`):i===n)}function V5(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function jN(t,e){if(e.collectionId){let r=t.getCollection(e.collectionId);if(!r)throw new Error(`Collection "${e.collectionId}" not found`);return r}if(e.collectionRef){let{collection:r,tier:n}=bv(t.getAllCollections(),e.collectionRef);return e.onResolve?.({kind:"collection",value:e.collectionRef,tier:n,id:r.id}),r}throw new Error("A collection reference is required (collectionId or collectionRef)")}function LN(t,e){if(e.folderPath)return e.folderPath;if(e.folderRef){let{folderPath:r}=Sv(t,e.folderRef);return e.onResolve?.({kind:"folder",value:e.folderRef,tier:"name",id:r,path:r}),r}}async function UN(t,e,r,n){let i=r.environment??t.environmentConfig.getSelectedEnvironment(),s=r.iterations??e.config?.iterations??1,o=r.stopOnError??e.config?.stopOnError??!1,l=r.delay??e.config?.delayBetweenRequests??0,c=Math.max(1,Math.min(50,r.concurrency??1)),d=r.requestFilter,p=r.include??[],m=r.reporters??[],y=m.includes("junit"),b=_v(r.variables),
|
|
1019
|
-
`)}function k(te){if(!(!te||typeof te!="object")){if(te.script!==void 0)return te.script;if(typeof te.scriptRef=="string"&&te.scriptRef.trim()){let ne=e?.scripts;if(ne&&typeof ne=="object")return ne[te.scriptRef]}}}function O(te){return te?.name||te?.label||te?.id||"flow-node"}function M(te,ne){let Pe=t.environmentConfig.getResolvedEnvironment(i),ye=hv(_.vars),Te={variables:{get:ge=>xl(_.vars[ge]),set:(ge,In)=>{typeof ge=="string"&&ge.trim()&&(_.vars[ge]=Lc(In))},unset:ge=>{typeof ge=="string"&&ge.trim()&&delete _.vars[ge]},has:ge=>Object.prototype.hasOwnProperty.call(_.vars,ge),toObject:()=>({...ye})},environment:{get:ge=>xl(Pe?.variables?.[ge]),set:(ge,In)=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.setEnvironmentVariable(ge,Lc(In),i)},unset:ge=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.deleteEnvironmentVariable(ge,i)},clear:()=>{t.environmentConfig.clearEnvironmentVariables(i)}},globals:{get:ge=>xl(t.environmentConfig.getGlobalVariables()?.[ge]),set:(ge,In)=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.setGlobalVariable(ge,Lc(In))},unset:ge=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.deleteGlobalVariable(ge)},clear:()=>{t.environmentConfig.clearGlobalVariables()}}};return{vars:ye,lastResult:_.lastResult,iteration:ne,node:te,pm:Te,ctx:Te,hf:Te}}function j(te,ne,Pe){return typeof te!="string"||!te.trim()?!0:!!ui(te,M(ne,Pe))}function I(te){if(!te)return{};let ne={};for(let[Pe,ye]of Object.entries(te))ne[Pe]=Array.isArray(ye)?ye.join("; "):String(ye);return ne}function R(te){return{executedRequest:te.executedRequest,status:te.response?.status??0,statusText:te.response?.statusText??"",headers:I(te.response?.headers),body:te.response?.body,cookies:te.response?.cookies,responseTime:te.duration,responseSize:typeof te.response?.body=="string"?Buffer.byteLength(te.response.body,"utf8"):0}}async function A(te,ne,Pe,ye,be){let Ke=q(te);if(!Ke||!Ke.trim())return;let ur=t.environmentConfig.getResolvedEnvironment(i),Te=t.environmentConfig.getGlobalVariables(),In={request:{url:be?.request?.url??_.lastResult?.executedRequest?.url??"http://flow.local/node",method:be?.request?.method??_.lastResult?.executedRequest?.method??"GET",headers:I(be?.request?.headers),body:be?.request?.body??null,params:be?.request?.params??{},query:be?.request?.query??{}},variables:_v(_.vars),environmentVariables:ur?.variables||{},globals:{...Te},environmentName:i,info:{eventName:ye==="post"?"test":"prerequest",requestName:O(ne),requestId:String(ne?.id??O(ne)),collectionName:e.name,iteration:Pe,iterationCount:s},onEnvironmentChange:(yt,qe,Pn)=>{yt==="set"&&qe&&Pn!==void 0?t.environmentConfig.setEnvironmentVariable(qe,Pn,i):yt==="unset"&&qe?t.environmentConfig.deleteEnvironmentVariable(qe,i):yt==="clear"&&t.environmentConfig.clearEnvironmentVariables(i)},onGlobalsChange:(yt,qe,Pn)=>{yt==="set"&&qe&&Pn!==void 0?t.environmentConfig.setGlobalVariable(qe,Pn):yt==="unset"&&qe?t.environmentConfig.deleteGlobalVariable(qe):yt==="clear"&&t.environmentConfig.clearGlobalVariables()}},pn=t.scriptExecutor.createRequestSession(In);try{if(ye==="post"&&be?.response){let yt=await pn.executePostResponse(Ke,be.response),qe=yt.localVariables??yt.modifiedVariables;qe&&typeof qe=="object"&&Object.assign(_.vars,qe)}else{let yt=await pn.executePreRequest(Ke);if(!yt.success)throw new Error(yt.error||"Script execution failed");let qe=yt.localVariables??yt.modifiedVariables;qe&&typeof qe=="object"&&Object.assign(_.vars,qe)}}catch(yt){let qe=yt instanceof Error?yt.message:String(yt);throw new Error(`Suite ${ye}-script failed on node "${O(ne)}": ${qe}`)}finally{pn.dispose?.()}}function F(te){let ne=te?.type==="request"&&te?.request?te.request:te;if(!(!ne||typeof ne!="object")&&!(!ne.collectionId||!ne.requestId||!ne.name))return{collectionId:ne.collectionId,requestId:ne.requestId,name:ne.name,folderPath:ne.folderPath,enabled:ne.enabled}}function U(te){return!te||typeof te!="object"?!1:te.type==="request"?!!F(te):!!(te.collectionId&&te.requestId&&te.name)}function D(te,ne){for(let Pe of ne){let ye=te?.[Pe];if(Array.isArray(ye))return ye}return[]}async function J(te,ne){if(ut.signal.aborted||ne.enabled===!1||d&&!d.some(ge=>ne.name.toLowerCase().includes(ge.toLowerCase())))return;let Pe=t.collection.getCollection(ne.collectionId);if(!Pe)return;let ye=Hx(Pe,ne.requestId);if(!ye)return;let be=FN(ye.request.auth,ye.folderAuthChain,Pe.auth),Ke=new As(t.httpRequest,t.scriptExecutor,t.environmentConfig,t.requestPreparer,i,Ar,Pe.scripts,ye.folderScriptsChain,void 0,Pe.name,Pe.auth,te,s),ur=MN(NN({...ye.request,auth:be}),{headers:r.headers,query:r.query,body:r.body,variables:{..._.vars,...r.variables}}),Te=await Ke.execute(ur,_v(_.vars),ut.signal);_.lastResult=Te,Te.modifiedVariables&&typeof Te.modifiedVariables=="object"&&Object.assign(_.vars,Te.modifiedVariables),Te.folderPath=ne.folderPath??"",Te.collectionName=Pe.name,await me.saveResult(te,Te),Te.assertions?.length||kr.add(ne.name),Te.passed?pe++:Gt++,p.includes("perRequest")&>.push({name:ne.name,iteration:te,status:Te.response?.status,ok:(Te.response?.status??0)>=200&&(Te.response?.status??0)<300,duration:`${Te.duration}ms`,allPassed:Te.passed,...p.includes("consoleOutput")&&Te.consoleOutput?.length?{consoleOutput:Te.consoleOutput}:{}}),Te.passed||(Nt.push({name:ne.name,iteration:te,method:Te.executedRequest?.method,url:Te.executedRequest?.url,requestBody:Lx(Te.executedRequest?.body?.content)??Te.executedRequest?.body?.content??null,requestHeaders:gi(Te.executedRequest?.headers??{}),status:Te.response?.status,duration:`${Te.duration}ms`,body:Lx(Te.response?.body),headers:TN(Te.response?.headers),cookies:$N(Te.response?.cookies),failedTests:Te.assertions?.filter(ge=>!ge.passed).map(ge=>({name:ge.name,...ge.message?{message:ge.message}:{}})),...Te.error?{error:Te.error}:{},...p.includes("consoleOutput")&&Te.consoleOutput?.length?{consoleOutput:Te.consoleOutput}:{}}),o&&ut.abort()),l>0&&!ut.signal.aborted&&await new Promise(ge=>setTimeout(ge,l))}async function Q(te,ne){for(let Pe of ne){if(ut.signal.aborted)break;await se(te,Pe)}}async function se(te,ne){if(!ne||typeof ne!="object"||ne.enabled===!1||!j(ne.condition,ne,te))return;if(U(ne)){let be=F(ne);be&&await J(te,be);return}let Pe=typeof ne.type=="string"?ne.type.toLowerCase():"",ye=D(ne,["then","nodes","body"]);if(Pe==="block"){await Q(te,ye);return}if(Pe==="script"){let be=k(ne),Ke=ne.phase==="post"?"post":"pre";await A(be,ne,te,Ke);return}if(Pe==="if"){let be=typeof ne.if=="string"?ne.if:ne.condition;if(j(be,ne,te)){await Q(te,ye);return}if(Array.isArray(ne.elseif)){for(let Ke of ne.elseif)if(j(Ke?.condition,Ke,te)){await Q(te,D(Ke,["then","nodes","body"]));return}}await Q(te,D(ne,["else","elseNodes"]));return}if(Pe==="switch"){let be=ui(String(ne.expression??""),M(ne,te));if(Array.isArray(ne.cases)){for(let Ke of ne.cases)if(Object.prototype.hasOwnProperty.call(Ke??{},"equals")?Ke.equals===be:j(Ke?.condition,Ke,te)){await Q(te,D(Ke,["then","nodes","body"]));return}}await Q(te,D(ne,["default","defaultNodes"]));return}if(Pe==="while"){let be=typeof ne.while=="string"?ne.while:ne.condition,Ke=Math.max(1,Math.min(1e4,Number(ne.maxIterations??v))),ur=0;for(;j(be,ne,te);){if(ur+=1,ur>Ke)throw new Error(`Suite while loop exceeded maxIterations (${Ke}) on node "${O(ne)}"`);if(await Q(te,ye),ut.signal.aborted)break}return}if(Pe==="for"){let be=Math.max(1,Math.min(1e4,Number(ne.maxIterations??v))),Ke=q(ne.init),ur=q(ne.update),Te=typeof ne.loopCondition=="string"&&ne.loopCondition.trim()?ne.loopCondition:typeof ne.condition=="string"&&ne.condition.trim()?ne.condition:"true";Ke&&await A(Ke,ne,te,"pre");let ge=0;for(;j(Te,ne,te);){if(ge+=1,ge>be)throw new Error(`Suite for loop exceeded maxIterations (${be}) on node "${O(ne)}"`);if(await Q(te,ye),ut.signal.aborted)break;ur&&await A(ur,ne,te,"post")}return}ye.length>0&&await Q(te,ye)}function ce(te){let ne=0,Pe=[...te];for(;Pe.length>0;){let ye=Pe.pop();if(!(!ye||typeof ye!="object"||ye.enabled===!1)){if(U(ye)){let be=F(ye);be&&(!d||d.some(Ke=>be.name.toLowerCase().includes(Ke.toLowerCase())))&&(ne+=1);continue}for(let be of["nodes","then","body","else","elseNodes","default","defaultNodes"])Array.isArray(ye[be])&&Pe.push(...ye[be]);if(Array.isArray(ye.elseif))for(let be of ye.elseif)Array.isArray(be?.nodes)&&Pe.push(...be.nodes),Array.isArray(be?.then)&&Pe.push(...be.then);if(Array.isArray(ye.cases))for(let be of ye.cases)Array.isArray(be?.nodes)&&Pe.push(...be.nodes),Array.isArray(be?.then)&&Pe.push(...be.then)}}return ne}let Ve=Array.isArray(e.nodes)?e.nodes:Array.isArray(e.requests)?e.requests.map(te=>({type:"request",request:te})):[],Re=ce(Ve);if(E){let te=U5(),ne=Re*s;if(ne>te)throw new Error(`Suite "${e.name}" would execute ${ne} request calls (${Re} requests \xD7 ${s} iterations), which exceeds HTTP_FORGE_MAX_REQUESTS (${te}). Reduce iterations, use requestFilter, or increase HTTP_FORGE_MAX_REQUESTS.`)}let me=new Cl(t.config),Ae=await me.initializeRun(e.id,e.name,i,{iterations:s,delayBetweenRequests:l,stopOnError:o}),gt=[],Nt=[],pe=0,Gt=0,kr=new Set,ut=new AbortController,Ar=new bl;async function br(te){await Q(te,Ve)}for(let te=1;te<=s&&!ut.signal.aborted;te+=c){let ne=Math.min(te+c-1,s),Pe=Array.from({length:ne-te+1},(ye,be)=>te+be);await Promise.all(Pe.map(br))}let xt=await me.finalizeRun("completed",C),wt=null;if(y)try{wt=await new wl(me.getBasePath()).generate(e.id,Ae)}catch(te){console.warn("[direct-execution] JUnit report generation failed:",te)}let zr=n==="collection"?"collection":"suite",At=me.getCurrentStats()?.stats,Ai=At?{min:At.minDuration,max:At.maxDuration,avg:At.avgDuration,p50:At.p50??null,p95:At.p95??null,p99:At.p99??null}:null,On={[zr]:e.name,environment:i,summary:{total:pe+Gt,passed:pe,failed:Gt,...s>1?{iterations:s}:{},...c>1?{concurrency:c}:{},allPassed:Gt===0,...Ai?{durationMs:Ai}:{}}};if((Gt>0||p.includes("failedOnly"))&&(On.failedRequests=Nt),p.includes("perRequest")&&(On.results=gt),xt!==null&&(On.report={uri:`file://${xt}`,hint:"Click the URI to open the HTML report in your browser"}),wt!==null&&(On.junitReport={path:wt}),kr.size>0){let te=Math.max(Re,1),ne=kr.size,Pe=Array.from(kr).slice(0,5);On.noAssertionExamples=Pe;let ye=e.name;if(ne/te>.5)On._suggestions=[`${ne}/${te} requests have no pm.test() assertions. Invoke the "review-collection" prompt (collection="${ye}") for a full coverage analysis and to identify assertion gaps.`];else{let be=Pe.map(Ke=>`"${Ke}"`).join(", ");On._suggestions=[`${ne} request(s) have no pm.test() assertions: ${be}. Invoke the "suggest-assertions" prompt (collection="${ye}") to generate test coverage for them.`]}}return On}async function Rv(t){let e=qn(t.workspaceFolder),r=t.include??[],n=t.reporters??[],i=n.includes("junit"),s=AN(r,n);try{let o=e.collection,l=jN(o,t),c=LN(l,t),d=t.requestId;if(!d){if(!t.requestRef)throw new Error("A request reference is required (requestId or requestRef)");let O=wv(l,t.requestRef,c);d=O.request.id,t.onResolve?.({kind:"request",value:t.requestRef,tier:O.tier,id:d,path:O.folderPath?`${O.folderPath}/${O.request.name}`:O.request.name})}let p=Hx(l,d);if(!p)throw new Error(`Request "${d}" not found in collection "${l.name}"`);let m=FN(p.request.auth,p.folderAuthChain,l.auth),y=t.environment||e.environmentConfig.getSelectedEnvironment(),b=MN(NN({...p.request,auth:m}),{headers:t.headers,query:t.query,body:t.body,variables:t.variables}),C=await new As(e.httpRequest,e.scriptExecutor,e.environmentConfig,e.requestPreparer,y,new bl,l.scripts,p.folderScriptsChain,void 0,l.name,l.auth).execute(b,_v(t.variables)),v=null,_=null;if(s||i){let O=new Cl(e.config),M=`request-${PN(l.id)}-${PN(d)}`,j=`Request: ${p.request.name}`,I=await O.initializeRun(M,j,y,{iterations:1,delayBetweenRequests:0,stopOnError:!0});if(await O.saveResult(1,C),v=await O.finalizeRun("completed",s),i)try{_=await new wl(O.getBasePath()).generate(M,I)}catch(R){console.warn("[direct-execution] JUnit report generation failed:",R)}}let q=TN(C.response?.headers),k=$N(C.response?.cookies);return{request:p.request.name,status:C.response?.status||0,ok:(C.response?.status??0)>=200&&(C.response?.status??0)<300,duration:`${C.duration}ms`,body:Lx(C.response?.body),allPassed:C.passed,assertions:C.assertions?.map(O=>({name:O.name,passed:O.passed,message:O.message})),...r.includes("headers")?{headers:q}:{},...r.includes("cookies")?{cookies:k}:{},...r.includes("tests")?{tests:C.assertions?.map(O=>({name:O.name,passed:O.passed,...O.message?{message:O.message}:{}}))}:{},...Object.keys(C.modifiedVariables??{}).length?{modifiedVariables:C.modifiedVariables}:{},...r.includes("consoleOutput")&&C.consoleOutput?.length?{consoleOutput:C.consoleOutput}:{},...v!==null?{report:{uri:`file://${v}`,hint:"Click the URI to open the HTML report in your browser"}}:{},..._!==null?{junitReport:{path:_}}:{},...C.error?{error:C.error}:{}}}catch(o){throw o}finally{Ux(e)}}async function Vs(t){let e=qn(t.workspaceFolder);try{let r=e.collection,n=jN(r,t),i=LN(n,t),s=DN(n),o=B5(s,i,t.recursive);if(o.length===0&&i)throw new Error(`No requests found under folder "${i}" in collection "${n.name}"`);let l=o.map(({request:d,folderPath:p})=>({id:d.id,slug:d.id.toLowerCase().replace(/\s+/g,"-"),collectionId:n.id,requestId:d.id,name:d.name,method:d.method,collectionName:n.name,folderPath:p,enabled:!0})),c={id:i?`temp-${n.id}-${V5(i)}`:`temp-${n.id}`,name:i?`${n.name} / ${i}`:n.name,requests:l,config:{iterations:1,delay:0,stopOnError:t.stopOnError??!1,readFromSharedSession:!1,writeToSharedSession:!1},isTemporary:!0,createdAt:Date.now(),updatedAt:Date.now()};return UN(e,c,{environment:t.environment,iterations:t.iterations,stopOnError:t.stopOnError,delay:t.delay,requestFilter:void 0,include:t.include,reporters:t.reporters,concurrency:t.concurrency,variables:t.variables},"collection")}catch(r){throw r}finally{Ux(e)}}async function W5(t){return Vs({recursive:!0,...t})}async function Fp(t){let e=qn(t.workspaceFolder);try{let n=await e.testSuite.getSuite(t.suiteId);if(!n)throw new Error(`Test suite "${t.suiteId}" not found`);return UN(e,n,{environment:t.environment,iterations:t.iterations,stopOnError:t.stopOnError,delay:t.delay,requestFilter:t.requestFilter,include:t.include,reporters:t.reporters,concurrency:t.concurrency,variables:t.variables},"suite")}catch(r){throw r}finally{Ux(e)}}var Uc=ae(()=>{"use strict";Ix();sg();_d();kx();Nx();Pf();Mx();Oi();vv();jx()});var zN={};Rs(zN,{createMcpRuntime:()=>s7});async function Pi(t){let e=process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS,r=process.env.HTTP_FORGE_GENERATE_REPORTS;process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS="true",process.env.HTTP_FORGE_GENERATE_REPORTS="true";try{return await t()}finally{e===void 0?delete process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS:process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS=e,r===void 0?delete process.env.HTTP_FORGE_GENERATE_REPORTS:process.env.HTTP_FORGE_GENERATE_REPORTS=r}}function Hc(t){let e=[t.testSuite,t.collection,t.environmentConfig,t.config,t.console];for(let r of e)try{r?.dispose?.()}catch{}}async function G5(t,e){let r=Wx.get(t);if(r&&r.expiresAt>Date.now())return r.tools;let n=Bx.get(t);if(n)return n;let i=(async()=>{let s=e.config.getMcpConfig(),o=(d,p)=>!!d?.length&&(d.includes(p.id)||d.includes(p.name)),l=e.collection.getAllCollections().filter(d=>!o(s.excludedCollections,d)),c=(await e.testSuite.getAllSuites()).filter(d=>!o(s.excludedSuites,d));return fv(l,c,s)})().then(s=>(Wx.set(t,{tools:s,expiresAt:Date.now()+J5}),s)).finally(()=>Bx.delete(t));return Bx.set(t,i),i}function Y5(t,e){let r=t.config.getMcpConfig().toolPrefix??"";return r&&e.startsWith(r)?e.slice(r.length):e}function K5(t,e,r){return t.replace(/"uri"\s*:\s*"file:\/\/([^"]+)"/g,(n,i)=>`"uri":"http://${e}:${r}/report?path=${encodeURIComponent(i)}"`)}function HN(t,e,r,n){ql(t,200,{jsonrpc:"2.0",id:e,error:{code:r,message:n}})}function Q5(t){return t.config.getMcpConfig().toolPageSize??200}async function Z5(t,e){switch(e.method){case"initialize":return{protocolVersion:"2024-11-05",capabilities:{tools:{},prompts:{}},serverInfo:{name:"http-forge",version:"1.0.0"},instructions:"You are assisting with HTTP API testing via HTTP Forge. When a run_suite, run_collection, or run_folder call completes with failures (summary.failed > 0 or allPassed === false), automatically analyze the 'failedRequests' in the response and provide: (1) root cause for each failure, (2) specific fix recommendations, (3) updated pm.test() assertion scripts where relevant. Do not wait for the user to ask \u2014 proactively diagnose and suggest fixes. For async runs (status: 'running'), poll with get_run_status until complete, then call get_run_summary. When get_run_summary returns a _nextStep field you MUST execute it immediately \u2014 the failedRequests array is already included inline so no extra tool call is needed. Analyze the failures and provide diagnosis without waiting for the user."};case"tools/list":{let r=await G5(t.workspaceFolder,t.container),n=e.params??{},i=typeof n.cursor=="string"?n.cursor:void 0,s=Q5(t.container);if(s<=0||r.length<=s)return{tools:r};let o=cv(i),l=r.slice(o,o+s),c=o+s,d={tools:l};return c<r.length&&(d.nextCursor=uv(c)),d}case"tools/call":{let r=e.params??{},n=r.name,i=r.arguments;if(!n)throw new Error("Missing tool name");let s=await zx(t,n,i??{}),o=s,l=o?.summary;l&&((l.failed??0)>0||l.allPassed===!1)&&(o._nextStep=`${l.failed??"Some"} request(s) failed. Please analyze the 'failedRequests' above: identify the root cause of each failure, suggest specific fixes (URL, auth, body, environment variables), and provide updated pm.test() assertion scripts where the assertions are incorrect.`);let c=JSON.stringify(s,null,2),d=K5(c,t.host,t.port),p=d.match(/"uri"\s*:\s*"(http:\/\/[^"]+\/report\?[^"]+)"/),m=p?`
|
|
1018
|
+
Disambiguate by passing the id or slug.`);this.kind=r;this.value=n;this.candidates=i;this.name="AmbiguousRefError"}kind;value;candidates}});var Dp={};Rs(Dp,{runCollection:()=>Vs,runFolder:()=>W5,runRequest:()=>Rv,runSuite:()=>Fp});function Ux(t){let e=[t.testSuite,t.collection,t.environmentConfig,t.config,t.console];for(let r of e)try{r?.dispose?.()}catch{}}function kN(t){return t==="1"||t==="true"||t==="yes"||t==="on"}function L5(){return kN(process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS)}function U5(){let t=process.env.HTTP_FORGE_MAX_REQUESTS;if(!t||t.trim()==="")return 50;let e=Number(t);if(!Number.isFinite(e)||e<=0)throw new Error("HTTP_FORGE_MAX_REQUESTS must be a positive number when provided");return Math.floor(e)}function AN(t,e=[]){return kN(process.env.HTTP_FORGE_GENERATE_REPORTS)||e.includes("html")?!0:t.includes("report")}function Lx(t){if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}}function H5(t){return t?Object.fromEntries(Object.entries(t).filter(([e])=>e.toLowerCase()!=="set-cookie")):{}}function TN(t){return gi(H5(t))}function $N(t){return u_((t??[]).map(e=>({name:e.name,value:e.value})))}function PN(t){return t.replace(/[^a-zA-Z0-9_-]/g,"_")}function NN(t){let e=["none","inherit","basic","bearer","apikey","oauth2"],r=t.auth?.type&&e.includes(t.auth.type)?t.auth.type:void 0;return{id:t.id,name:t.name,method:t.method,url:t.url,headers:Array.isArray(t.headers)?t.headers.reduce((n,i)=>(i.enabled&&i.key&&(n[i.key]=i.value??""),n),{}):t.headers,query:Array.isArray(t.query)?t.query.reduce((n,i)=>(i.enabled&&i.key&&(n[i.key]=i.value??""),n),{}):t.query,params:t.params?Object.entries(t.params).reduce((n,[i,s])=>(n[i]=typeof s=="string"?s:s.value??"",n),{}):void 0,body:t.body??null,scripts:t.scripts,settings:t.settings,auth:{type:r==="inherit"?"none":r,bearerToken:t.auth?.bearerToken,basicAuth:t.auth?.basicAuth,apikey:t.auth?.apikey,oauth2:t.auth?.oauth2}}}function MN(t,e){let r={...t};return e.headers&&(r.headers={...t.headers??{},...e.headers}),e.query&&(r.query=e.query),e.body!==void 0&&(r.body={type:"raw",raw:e.body,contentType:"application/json"}),r}function _v(t){return t?Object.fromEntries(Object.entries(t).map(([e,r])=>[e,String(r)])):{}}function FN(t,e,r){if(t&&t.type&&t.type!=="inherit")return t.type==="none"?void 0:t;for(let n=e.length-1;n>=0;n--){let i=e[n];if(i?.type&&i.type!=="inherit")return i.type==="none"?void 0:i}if(r&&r.type&&r.type!=="inherit")return r.type==="none"?void 0:r}function Hx(t,e,r=t.items,n=[],i=[]){for(let s of r){if(s.type==="request"&&s.id===e)return{request:s,folderScriptsChain:[...n],folderAuthChain:[...i]};if(s.type==="folder"){let o=s,l=o.scripts?[...n,o.scripts]:[...n],c=o.auth?[...i,o.auth]:[...i],d=Hx(t,e,o.items??[],l,c);if(d)return d}}}function DN(t,e=t.items,r=[],n=[]){let i=[];for(let s of e)if(s.type==="request")i.push({request:s,folderScriptsChain:[...r],folderPath:n.map(vr).join("/")});else{let o=s,l=o.scripts?[...r,o.scripts]:[...r],c=[...n,o.name];i.push(...DN(t,o.items??[],l,c))}return i}function B5(t,e,r=!0){if(!e)return t;let n=e.replace(/\/+$/,"");return t.filter(({folderPath:i})=>r?i===n||i.startsWith(`${n}/`):i===n)}function V5(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function jN(t,e){if(e.collectionId){let r=t.getCollection(e.collectionId);if(!r)throw new Error(`Collection "${e.collectionId}" not found`);return r}if(e.collectionRef){let{collection:r,tier:n}=bv(t.getAllCollections(),e.collectionRef);return e.onResolve?.({kind:"collection",value:e.collectionRef,tier:n,id:r.id}),r}throw new Error("A collection reference is required (collectionId or collectionRef)")}function LN(t,e){if(e.folderPath)return e.folderPath;if(e.folderRef){let{folderPath:r}=Sv(t,e.folderRef);return e.onResolve?.({kind:"folder",value:e.folderRef,tier:"name",id:r,path:r}),r}}async function UN(t,e,r,n){let i=r.environment??t.environmentConfig.getSelectedEnvironment(),s=r.iterations??e.config?.iterations??1,o=r.stopOnError??e.config?.stopOnError??!1,l=r.delay??e.config?.delayBetweenRequests??0,c=Math.max(1,Math.min(50,r.concurrency??1)),d=r.requestFilter,p=r.include??[],m=r.reporters??[],y=m.includes("junit"),b=_v(r.variables),q=L5(),C=AN(p,m),v=Math.max(1,Math.min(1e4,Number(r.maxNodeLoopIterations??100))),_={vars:{...b}};function E(te){if(typeof te=="string")return te;if(Array.isArray(te))return te.filter(Pe=>typeof Pe=="string").join(`
|
|
1019
|
+
`)}function k(te){if(!(!te||typeof te!="object")){if(te.script!==void 0)return te.script;if(typeof te.scriptRef=="string"&&te.scriptRef.trim()){let ne=e?.scripts;if(ne&&typeof ne=="object")return ne[te.scriptRef]}}}function O(te){return te?.name||te?.label||te?.id||"flow-node"}function M(te,ne){let Pe=t.environmentConfig.getResolvedEnvironment(i),ye=hv(_.vars),Te={variables:{get:ge=>xl(_.vars[ge]),set:(ge,In)=>{typeof ge=="string"&&ge.trim()&&(_.vars[ge]=Lc(In))},unset:ge=>{typeof ge=="string"&&ge.trim()&&delete _.vars[ge]},has:ge=>Object.prototype.hasOwnProperty.call(_.vars,ge),toObject:()=>({...ye})},environment:{get:ge=>xl(Pe?.variables?.[ge]),set:(ge,In)=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.setEnvironmentVariable(ge,Lc(In),i)},unset:ge=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.deleteEnvironmentVariable(ge,i)},clear:()=>{t.environmentConfig.clearEnvironmentVariables(i)}},globals:{get:ge=>xl(t.environmentConfig.getGlobalVariables()?.[ge]),set:(ge,In)=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.setGlobalVariable(ge,Lc(In))},unset:ge=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.deleteGlobalVariable(ge)},clear:()=>{t.environmentConfig.clearGlobalVariables()}}};return{vars:ye,lastResult:_.lastResult,iteration:ne,node:te,pm:Te,ctx:Te,hf:Te}}function j(te,ne,Pe){return typeof te!="string"||!te.trim()?!0:!!ui(te,M(ne,Pe))}function I(te){if(!te)return{};let ne={};for(let[Pe,ye]of Object.entries(te))ne[Pe]=Array.isArray(ye)?ye.join("; "):String(ye);return ne}function R(te){return{executedRequest:te.executedRequest,status:te.response?.status??0,statusText:te.response?.statusText??"",headers:I(te.response?.headers),body:te.response?.body,cookies:te.response?.cookies,responseTime:te.duration,responseSize:typeof te.response?.body=="string"?Buffer.byteLength(te.response.body,"utf8"):0}}async function A(te,ne,Pe,ye,be){let Ke=E(te);if(!Ke||!Ke.trim())return;let ur=t.environmentConfig.getResolvedEnvironment(i),Te=t.environmentConfig.getGlobalVariables(),In={request:{url:be?.request?.url??_.lastResult?.executedRequest?.url??"http://flow.local/node",method:be?.request?.method??_.lastResult?.executedRequest?.method??"GET",headers:I(be?.request?.headers),body:be?.request?.body??null,params:be?.request?.params??{},query:be?.request?.query??{}},variables:_v(_.vars),environmentVariables:ur?.variables||{},globals:{...Te},environmentName:i,info:{eventName:ye==="post"?"test":"prerequest",requestName:O(ne),requestId:String(ne?.id??O(ne)),collectionName:e.name,iteration:Pe,iterationCount:s},onEnvironmentChange:(yt,qe,Pn)=>{yt==="set"&&qe&&Pn!==void 0?t.environmentConfig.setEnvironmentVariable(qe,Pn,i):yt==="unset"&&qe?t.environmentConfig.deleteEnvironmentVariable(qe,i):yt==="clear"&&t.environmentConfig.clearEnvironmentVariables(i)},onGlobalsChange:(yt,qe,Pn)=>{yt==="set"&&qe&&Pn!==void 0?t.environmentConfig.setGlobalVariable(qe,Pn):yt==="unset"&&qe?t.environmentConfig.deleteGlobalVariable(qe):yt==="clear"&&t.environmentConfig.clearGlobalVariables()}},pn=t.scriptExecutor.createRequestSession(In);try{if(ye==="post"&&be?.response){let yt=await pn.executePostResponse(Ke,be.response),qe=yt.localVariables??yt.modifiedVariables;qe&&typeof qe=="object"&&(_.vars={...qe})}else{let yt=await pn.executePreRequest(Ke);if(!yt.success)throw new Error(yt.error||"Script execution failed");let qe=yt.localVariables??yt.modifiedVariables;qe&&typeof qe=="object"&&(_.vars={...qe})}}catch(yt){let qe=yt instanceof Error?yt.message:String(yt);throw new Error(`Suite ${ye}-script failed on node "${O(ne)}": ${qe}`)}finally{pn.dispose?.()}}function F(te){let ne=te?.type==="request"&&te?.request?te.request:te;if(!(!ne||typeof ne!="object")&&!(!ne.collectionId||!ne.requestId||!ne.name))return{collectionId:ne.collectionId,requestId:ne.requestId,name:ne.name,folderPath:ne.folderPath,enabled:ne.enabled}}function U(te){return!te||typeof te!="object"?!1:te.type==="request"?!!F(te):!!(te.collectionId&&te.requestId&&te.name)}function D(te,ne){for(let Pe of ne){let ye=te?.[Pe];if(Array.isArray(ye))return ye}return[]}async function J(te,ne){if(ut.signal.aborted||ne.enabled===!1||d&&!d.some(ge=>ne.name.toLowerCase().includes(ge.toLowerCase())))return;let Pe=t.collection.getCollection(ne.collectionId);if(!Pe)return;let ye=Hx(Pe,ne.requestId);if(!ye)return;let be=FN(ye.request.auth,ye.folderAuthChain,Pe.auth),Ke=new As(t.httpRequest,t.scriptExecutor,t.environmentConfig,t.requestPreparer,i,Ar,Pe.scripts,ye.folderScriptsChain,void 0,Pe.name,Pe.auth,te,s),ur=MN(NN({...ye.request,auth:be}),{headers:r.headers,query:r.query,body:r.body,variables:{..._.vars,...r.variables}}),Te=await Ke.execute(ur,_v(_.vars),ut.signal);_.lastResult=Te,Te.modifiedVariables&&typeof Te.modifiedVariables=="object"&&(_.vars={...Te.modifiedVariables}),Te.folderPath=ne.folderPath??"",Te.collectionName=Pe.name,await me.saveResult(te,Te),Te.assertions?.length||kr.add(ne.name),Te.passed?pe++:Gt++,p.includes("perRequest")&>.push({name:ne.name,iteration:te,status:Te.response?.status,ok:(Te.response?.status??0)>=200&&(Te.response?.status??0)<300,duration:`${Te.duration}ms`,allPassed:Te.passed,...p.includes("consoleOutput")&&Te.consoleOutput?.length?{consoleOutput:Te.consoleOutput}:{}}),Te.passed||(Nt.push({name:ne.name,iteration:te,method:Te.executedRequest?.method,url:Te.executedRequest?.url,requestBody:Lx(Te.executedRequest?.body?.content)??Te.executedRequest?.body?.content??null,requestHeaders:gi(Te.executedRequest?.headers??{}),status:Te.response?.status,duration:`${Te.duration}ms`,body:Lx(Te.response?.body),headers:TN(Te.response?.headers),cookies:$N(Te.response?.cookies),failedTests:Te.assertions?.filter(ge=>!ge.passed).map(ge=>({name:ge.name,...ge.message?{message:ge.message}:{}})),...Te.error?{error:Te.error}:{},...p.includes("consoleOutput")&&Te.consoleOutput?.length?{consoleOutput:Te.consoleOutput}:{}}),o&&ut.abort()),l>0&&!ut.signal.aborted&&await new Promise(ge=>setTimeout(ge,l))}async function Q(te,ne){for(let Pe of ne){if(ut.signal.aborted)break;await se(te,Pe)}}async function se(te,ne){if(!ne||typeof ne!="object"||ne.enabled===!1||!j(ne.condition,ne,te))return;if(U(ne)){let be=F(ne);be&&await J(te,be);return}let Pe=typeof ne.type=="string"?ne.type.toLowerCase():"",ye=D(ne,["then","nodes","body"]);if(Pe==="block"){await Q(te,ye);return}if(Pe==="script"){let be=k(ne),Ke=ne.phase==="post"?"post":"pre";await A(be,ne,te,Ke);return}if(Pe==="if"){let be=typeof ne.if=="string"?ne.if:ne.condition;if(j(be,ne,te)){await Q(te,ye);return}if(Array.isArray(ne.elseif)){for(let Ke of ne.elseif)if(j(Ke?.condition,Ke,te)){await Q(te,D(Ke,["then","nodes","body"]));return}}await Q(te,D(ne,["else","elseNodes"]));return}if(Pe==="switch"){let be=ui(String(ne.expression??""),M(ne,te));if(Array.isArray(ne.cases)){for(let Ke of ne.cases)if(Object.prototype.hasOwnProperty.call(Ke??{},"equals")?Ke.equals===be:j(Ke?.condition,Ke,te)){await Q(te,D(Ke,["then","nodes","body"]));return}}await Q(te,D(ne,["default","defaultNodes"]));return}if(Pe==="while"){let be=typeof ne.while=="string"?ne.while:ne.condition,Ke=Math.max(1,Math.min(1e4,Number(ne.maxIterations??v))),ur=0;for(;j(be,ne,te);){if(ur+=1,ur>Ke)throw new Error(`Suite while loop exceeded maxIterations (${Ke}) on node "${O(ne)}"`);if(await Q(te,ye),ut.signal.aborted)break}return}if(Pe==="for"){let be=Math.max(1,Math.min(1e4,Number(ne.maxIterations??v))),Ke=E(ne.init),ur=E(ne.update),Te=typeof ne.loopCondition=="string"&&ne.loopCondition.trim()?ne.loopCondition:typeof ne.condition=="string"&&ne.condition.trim()?ne.condition:"true";Ke&&await A(Ke,ne,te,"pre");let ge=0;for(;j(Te,ne,te);){if(ge+=1,ge>be)throw new Error(`Suite for loop exceeded maxIterations (${be}) on node "${O(ne)}"`);if(await Q(te,ye),ut.signal.aborted)break;ur&&await A(ur,ne,te,"post")}return}ye.length>0&&await Q(te,ye)}function ce(te){let ne=0,Pe=[...te];for(;Pe.length>0;){let ye=Pe.pop();if(!(!ye||typeof ye!="object"||ye.enabled===!1)){if(U(ye)){let be=F(ye);be&&(!d||d.some(Ke=>be.name.toLowerCase().includes(Ke.toLowerCase())))&&(ne+=1);continue}for(let be of["nodes","then","body","else","elseNodes","default","defaultNodes"])Array.isArray(ye[be])&&Pe.push(...ye[be]);if(Array.isArray(ye.elseif))for(let be of ye.elseif)Array.isArray(be?.nodes)&&Pe.push(...be.nodes),Array.isArray(be?.then)&&Pe.push(...be.then);if(Array.isArray(ye.cases))for(let be of ye.cases)Array.isArray(be?.nodes)&&Pe.push(...be.nodes),Array.isArray(be?.then)&&Pe.push(...be.then)}}return ne}let Ve=Array.isArray(e.nodes)?e.nodes:Array.isArray(e.requests)?e.requests.map(te=>({type:"request",request:te})):[],Re=ce(Ve);if(q){let te=U5(),ne=Re*s;if(ne>te)throw new Error(`Suite "${e.name}" would execute ${ne} request calls (${Re} requests \xD7 ${s} iterations), which exceeds HTTP_FORGE_MAX_REQUESTS (${te}). Reduce iterations, use requestFilter, or increase HTTP_FORGE_MAX_REQUESTS.`)}let me=new Cl(t.config),Ae=await me.initializeRun(e.id,e.name,i,{iterations:s,delayBetweenRequests:l,stopOnError:o}),gt=[],Nt=[],pe=0,Gt=0,kr=new Set,ut=new AbortController,Ar=new bl;async function br(te){await Q(te,Ve)}for(let te=1;te<=s&&!ut.signal.aborted;te+=c){let ne=Math.min(te+c-1,s),Pe=Array.from({length:ne-te+1},(ye,be)=>te+be);await Promise.all(Pe.map(br))}let xt=await me.finalizeRun("completed",C),wt=null;if(y)try{wt=await new wl(me.getBasePath()).generate(e.id,Ae)}catch(te){console.warn("[direct-execution] JUnit report generation failed:",te)}let zr=n==="collection"?"collection":"suite",At=me.getCurrentStats()?.stats,Ai=At?{min:At.minDuration,max:At.maxDuration,avg:At.avgDuration,p50:At.p50??null,p95:At.p95??null,p99:At.p99??null}:null,On={[zr]:e.name,environment:i,summary:{total:pe+Gt,passed:pe,failed:Gt,...s>1?{iterations:s}:{},...c>1?{concurrency:c}:{},allPassed:Gt===0,...Ai?{durationMs:Ai}:{}}};if((Gt>0||p.includes("failedOnly"))&&(On.failedRequests=Nt),p.includes("perRequest")&&(On.results=gt),xt!==null&&(On.report={uri:`file://${xt}`,hint:"Click the URI to open the HTML report in your browser"}),wt!==null&&(On.junitReport={path:wt}),kr.size>0){let te=Math.max(Re,1),ne=kr.size,Pe=Array.from(kr).slice(0,5);On.noAssertionExamples=Pe;let ye=e.name;if(ne/te>.5)On._suggestions=[`${ne}/${te} requests have no pm.test() assertions. Invoke the "review-collection" prompt (collection="${ye}") for a full coverage analysis and to identify assertion gaps.`];else{let be=Pe.map(Ke=>`"${Ke}"`).join(", ");On._suggestions=[`${ne} request(s) have no pm.test() assertions: ${be}. Invoke the "suggest-assertions" prompt (collection="${ye}") to generate test coverage for them.`]}}return On}async function Rv(t){let e=qn(t.workspaceFolder),r=t.include??[],n=t.reporters??[],i=n.includes("junit"),s=AN(r,n);try{let o=e.collection,l=jN(o,t),c=LN(l,t),d=t.requestId;if(!d){if(!t.requestRef)throw new Error("A request reference is required (requestId or requestRef)");let O=wv(l,t.requestRef,c);d=O.request.id,t.onResolve?.({kind:"request",value:t.requestRef,tier:O.tier,id:d,path:O.folderPath?`${O.folderPath}/${O.request.name}`:O.request.name})}let p=Hx(l,d);if(!p)throw new Error(`Request "${d}" not found in collection "${l.name}"`);let m=FN(p.request.auth,p.folderAuthChain,l.auth),y=t.environment||e.environmentConfig.getSelectedEnvironment(),b=MN(NN({...p.request,auth:m}),{headers:t.headers,query:t.query,body:t.body,variables:t.variables}),C=await new As(e.httpRequest,e.scriptExecutor,e.environmentConfig,e.requestPreparer,y,new bl,l.scripts,p.folderScriptsChain,void 0,l.name,l.auth).execute(b,_v(t.variables)),v=null,_=null;if(s||i){let O=new Cl(e.config),M=`request-${PN(l.id)}-${PN(d)}`,j=`Request: ${p.request.name}`,I=await O.initializeRun(M,j,y,{iterations:1,delayBetweenRequests:0,stopOnError:!0});if(await O.saveResult(1,C),v=await O.finalizeRun("completed",s),i)try{_=await new wl(O.getBasePath()).generate(M,I)}catch(R){console.warn("[direct-execution] JUnit report generation failed:",R)}}let E=TN(C.response?.headers),k=$N(C.response?.cookies);return{request:p.request.name,status:C.response?.status||0,ok:(C.response?.status??0)>=200&&(C.response?.status??0)<300,duration:`${C.duration}ms`,body:Lx(C.response?.body),allPassed:C.passed,assertions:C.assertions?.map(O=>({name:O.name,passed:O.passed,message:O.message})),...r.includes("headers")?{headers:E}:{},...r.includes("cookies")?{cookies:k}:{},...r.includes("tests")?{tests:C.assertions?.map(O=>({name:O.name,passed:O.passed,...O.message?{message:O.message}:{}}))}:{},...Object.keys(C.modifiedVariables??{}).length?{modifiedVariables:C.modifiedVariables}:{},...r.includes("consoleOutput")&&C.consoleOutput?.length?{consoleOutput:C.consoleOutput}:{},...v!==null?{report:{uri:`file://${v}`,hint:"Click the URI to open the HTML report in your browser"}}:{},..._!==null?{junitReport:{path:_}}:{},...C.error?{error:C.error}:{}}}catch(o){throw o}finally{Ux(e)}}async function Vs(t){let e=qn(t.workspaceFolder);try{let r=e.collection,n=jN(r,t),i=LN(n,t),s=DN(n),o=B5(s,i,t.recursive);if(o.length===0&&i)throw new Error(`No requests found under folder "${i}" in collection "${n.name}"`);let l=o.map(({request:d,folderPath:p})=>({id:d.id,slug:d.id.toLowerCase().replace(/\s+/g,"-"),collectionId:n.id,requestId:d.id,name:d.name,method:d.method,collectionName:n.name,folderPath:p,enabled:!0})),c={id:i?`temp-${n.id}-${V5(i)}`:`temp-${n.id}`,name:i?`${n.name} / ${i}`:n.name,requests:l,config:{iterations:1,delay:0,stopOnError:t.stopOnError??!1,readFromSharedSession:!1,writeToSharedSession:!1},isTemporary:!0,createdAt:Date.now(),updatedAt:Date.now()};return UN(e,c,{environment:t.environment,iterations:t.iterations,stopOnError:t.stopOnError,delay:t.delay,requestFilter:void 0,include:t.include,reporters:t.reporters,concurrency:t.concurrency,variables:t.variables},"collection")}catch(r){throw r}finally{Ux(e)}}async function W5(t){return Vs({recursive:!0,...t})}async function Fp(t){let e=qn(t.workspaceFolder);try{let n=await e.testSuite.getSuite(t.suiteId);if(!n)throw new Error(`Test suite "${t.suiteId}" not found`);return UN(e,n,{environment:t.environment,iterations:t.iterations,stopOnError:t.stopOnError,delay:t.delay,requestFilter:t.requestFilter,include:t.include,reporters:t.reporters,concurrency:t.concurrency,variables:t.variables},"suite")}catch(r){throw r}finally{Ux(e)}}var Uc=ae(()=>{"use strict";Ix();sg();_d();kx();Nx();Pf();Mx();Oi();vv();jx()});var zN={};Rs(zN,{createMcpRuntime:()=>s7});async function Pi(t){let e=process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS,r=process.env.HTTP_FORGE_GENERATE_REPORTS;process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS="true",process.env.HTTP_FORGE_GENERATE_REPORTS="true";try{return await t()}finally{e===void 0?delete process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS:process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS=e,r===void 0?delete process.env.HTTP_FORGE_GENERATE_REPORTS:process.env.HTTP_FORGE_GENERATE_REPORTS=r}}function Hc(t){let e=[t.testSuite,t.collection,t.environmentConfig,t.config,t.console];for(let r of e)try{r?.dispose?.()}catch{}}async function G5(t,e){let r=Wx.get(t);if(r&&r.expiresAt>Date.now())return r.tools;let n=Bx.get(t);if(n)return n;let i=(async()=>{let s=e.config.getMcpConfig(),o=(d,p)=>!!d?.length&&(d.includes(p.id)||d.includes(p.name)),l=e.collection.getAllCollections().filter(d=>!o(s.excludedCollections,d)),c=(await e.testSuite.getAllSuites()).filter(d=>!o(s.excludedSuites,d));return fv(l,c,s)})().then(s=>(Wx.set(t,{tools:s,expiresAt:Date.now()+J5}),s)).finally(()=>Bx.delete(t));return Bx.set(t,i),i}function Y5(t,e){let r=t.config.getMcpConfig().toolPrefix??"";return r&&e.startsWith(r)?e.slice(r.length):e}function K5(t,e,r){return t.replace(/"uri"\s*:\s*"file:\/\/([^"]+)"/g,(n,i)=>`"uri":"http://${e}:${r}/report?path=${encodeURIComponent(i)}"`)}function HN(t,e,r,n){ql(t,200,{jsonrpc:"2.0",id:e,error:{code:r,message:n}})}function Q5(t){return t.config.getMcpConfig().toolPageSize??200}async function Z5(t,e){switch(e.method){case"initialize":return{protocolVersion:"2024-11-05",capabilities:{tools:{},prompts:{}},serverInfo:{name:"http-forge",version:"1.0.0"},instructions:"You are assisting with HTTP API testing via HTTP Forge. When a run_suite, run_collection, or run_folder call completes with failures (summary.failed > 0 or allPassed === false), automatically analyze the 'failedRequests' in the response and provide: (1) root cause for each failure, (2) specific fix recommendations, (3) updated pm.test() assertion scripts where relevant. Do not wait for the user to ask \u2014 proactively diagnose and suggest fixes. For async runs (status: 'running'), poll with get_run_status until complete, then call get_run_summary. When get_run_summary returns a _nextStep field you MUST execute it immediately \u2014 the failedRequests array is already included inline so no extra tool call is needed. Analyze the failures and provide diagnosis without waiting for the user."};case"tools/list":{let r=await G5(t.workspaceFolder,t.container),n=e.params??{},i=typeof n.cursor=="string"?n.cursor:void 0,s=Q5(t.container);if(s<=0||r.length<=s)return{tools:r};let o=cv(i),l=r.slice(o,o+s),c=o+s,d={tools:l};return c<r.length&&(d.nextCursor=uv(c)),d}case"tools/call":{let r=e.params??{},n=r.name,i=r.arguments;if(!n)throw new Error("Missing tool name");let s=await zx(t,n,i??{}),o=s,l=o?.summary;l&&((l.failed??0)>0||l.allPassed===!1)&&(o._nextStep=`${l.failed??"Some"} request(s) failed. Please analyze the 'failedRequests' above: identify the root cause of each failure, suggest specific fixes (URL, auth, body, environment variables), and provide updated pm.test() assertion scripts where the assertions are incorrect.`);let c=JSON.stringify(s,null,2),d=K5(c,t.host,t.port),p=d.match(/"uri"\s*:\s*"(http:\/\/[^"]+\/report\?[^"]+)"/),m=p?`
|
|
1020
1020
|
|
|
1021
|
-
[View HTML Report](${p[1]})`:"";return{content:[{type:"text",text:d+m}]}}case"prompts/list":return{prompts:$p};case"prompts/get":{let r=e.params??{},n=r.name,i=r.arguments??{};if(!n)throw new Error("Missing prompt name");let s=qn(t.workspaceFolder);try{return await Yy(n,i,s.collection,t.runStore)}finally{Hc(s)}}default:throw new Error(`Method not found: ${e.method}`)}}function X5(t,e,r){let n=!t.container,i=t.container??qn(t.workspaceFolder),s;try{s=i.config.getMcpConfig().cors.allowedOrigins??["http://localhost","http://127.0.0.1"]}finally{n&&Hc(i)}let o=e.headers.origin??"",l=s.includes(o)?o:s[0]??"http://localhost";r.setHeader("Access-Control-Allow-Origin",l),r.setHeader("Access-Control-Allow-Methods","POST, GET, OPTIONS"),r.setHeader("Access-Control-Allow-Headers","Content-Type, Mcp-Session-Id")}function e7(t,e,r){let i=new URL(e.url,`http://${t.host}:${t.port}`).searchParams.get("path");if(!i){r.statusCode=400,r.end("Missing path parameter");return}let s=Xo.resolve(i),o=t.container?.config.getResultsPath(),l=o?Xo.dirname(o):Xo.resolve(t.workspaceFolder,".http-forge",".cache");if(!s.startsWith(l+Xo.sep)||!s.endsWith(".html")){r.statusCode=403,r.end("Forbidden");return}VN.readFile(s,"utf-8",(c,d)=>{if(c){r.statusCode=404,r.end("Report not found");return}r.statusCode=200,r.setHeader("content-type","text/html; charset=utf-8"),r.end(d)})}function Vx(t,e,r,n){let i=t.create(e,r);return n().then(s=>{i.status!=="cancelled"&&(i.status="completed",i.completedAt=Date.now(),i.summary=s?.summary??i.summary,s?.failedRequests&&(i.failedRequests=s.failedRequests),s?.noAssertionExamples&&(i.noAssertionExamples=s.noAssertionExamples),i.reportPath=s?.report?.uri?.replace("file://","")??null,i.progress.completed=i.progress.total)}).catch(s=>{i.status!=="cancelled"&&(i.status="failed",i.completedAt=Date.now(),i.error=s.message)}),{runId:i.id,status:"running",total:r,message:"Run started. Use get_run_status to poll."}}function t7(t){let e=t.workspaceFolder;return{async runRequest(r,n,i){return Pi(()=>Rv({workspaceFolder:e,collectionId:r.id,requestId:n,environment:i.environment,variables:i.variables,headers:i.headers,query:i.query,body:i.body,include:i.include}))},async runFolder(r,n,i){let s=nt(r).filter(({folderPath:o})=>o===n||o.startsWith(`${n}/`)).length;return i.async===!0?Vx(t.runStore,`${r.name} / ${rs(n)}`,s,()=>Pi(()=>Vs({workspaceFolder:e,collectionId:r.id,folderPath:n,recursive:i.recursive,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,include:i.include}))):Pi(()=>Vs({workspaceFolder:e,collectionId:r.id,folderPath:n,recursive:i.recursive,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,include:i.include}))},async runCollection(r,n){let i=nt(r).length;return n.async===!0?Vx(t.runStore,r.name,i,()=>Pi(()=>Vs({workspaceFolder:e,collectionId:r.id,environment:n.environment,variables:n.variables,iterations:n.iterations,stopOnError:n.stopOnError,delay:n.delay,include:n.include}))):Pi(()=>Vs({workspaceFolder:e,collectionId:r.id,environment:n.environment,variables:n.variables,iterations:n.iterations,stopOnError:n.stopOnError,delay:n.delay,include:n.include}))},async runSuite(r,n,i){let s=qn(e),o=0;try{let l=await s.testSuite.getSuite(r);o=(l?.nodes.filter(d=>d.type==="request").length??0)*(i.iterations??l?.config?.iterations??1)}finally{Hc(s)}return i.async===!0?Vx(t.runStore,n,o,()=>Pi(()=>Fp({workspaceFolder:e,suiteId:r,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,requestFilter:i.requestFilter,include:i.include}))):Pi(()=>Fp({workspaceFolder:e,suiteId:r,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,requestFilter:i.requestFilter,include:i.include}))}}}async function zx(t,e,r={}){let n=t.workspaceFolder,i=Y5(t.container,e);if(Object.values(G).includes(i)){let l=qn(n);try{let c=await Gy(i,r,{collection:l.collection,testSuite:l.testSuite,environmentConfig:l.environmentConfig,workspaceFolder:n},t.runStore,t7(t));return r7.has(i)&&Wx.delete(n),c}finally{Hc(l)}}let s=tv(i),o=qn(n);try{let l=o.collection.getAllCollections(),c=l.map(b=>b.id),d=b=>{let E=vl(b,c),C=E?l.find(v=>v.id===E):void 0;if(!C)throw new Error(`Collection not found for tool: ${e}`);return C};if(s.kind==="request"){let[b,E]=s.tokens;if(!b||!E)throw new Error(`Malformed request tool: ${e}`);let C=d(b),v=nt(C).map(q=>q.request.id),_=vl(E,v);if(!_)throw new Error(`Request not found in collection "${C.name}" for tool: ${e}`);return Pi(()=>Rv({workspaceFolder:n,collectionId:C.id,requestId:_,environment:r.environment,variables:r.variables,headers:r.headers,query:r.query,body:r.body,include:r.include}))}if(s.kind==="collection"){let[b]=s.tokens;if(!b)throw new Error(`Malformed collection tool: ${e}`);let E=d(b);return Pi(()=>Vs({workspaceFolder:n,collectionId:E.id,environment:r.environment,variables:r.variables,iterations:r.iterations,stopOnError:r.stopOnError,delay:r.delay,include:r.include}))}if(s.kind==="folder"){let[b,E]=s.tokens;if(!b||!E)throw new Error(`Malformed folder tool: ${e}`);let C=d(b),v=(o.collection.getAllCollections().find(k=>k.id===C.id),void 0),_=nt(C).map(k=>k.folderPath).filter((k,O,M)=>k&&M.indexOf(k)===O),q=rv(E,_);if(!q)throw new Error(`Folder not found in collection "${C.name}" for tool: ${e}`);return Pi(()=>Vs({workspaceFolder:n,collectionId:C.id,folderPath:q,recursive:r.recursive,environment:r.environment,variables:r.variables,iterations:r.iterations,stopOnError:r.stopOnError,delay:r.delay,include:r.include}))}let[p]=s.tokens;if(!p)throw new Error(`Malformed suite tool: ${e}`);let m=await o.testSuite.getAllSuites(),y=vl(p,m.map(b=>b.id));if(!y)throw new Error(`Test suite not found for tool: ${e}`);return Pi(()=>Fp({workspaceFolder:n,suiteId:y,environment:r.environment,variables:r.variables,iterations:r.iterations,stopOnError:r.stopOnError,delay:r.delay,requestFilter:r.requestFilter,include:r.include}))}finally{Hc(o)}}function ql(t,e,r){t.statusCode=e,t.setHeader("content-type","application/json; charset=utf-8"),t.end(JSON.stringify(r))}function BN(t){return new Promise((e,r)=>{let n="";t.on("data",i=>{n+=i,n.length>1024*1024&&r(new Error("Request body too large (max 1MB)"))}),t.on("end",()=>{if(!n){e({});return}try{e(JSON.parse(n))}catch{r(new Error("Invalid JSON body"))}}),t.on("error",r)})}function n7(t){return(0,WN.createServer)(async(e,r)=>{try{if(X5(t,e,r),e.method==="OPTIONS"){r.statusCode=204,r.end();return}if(e.method==="GET"&&e.url==="/health"){ql(r,200,{status:"ok",port:t.port});return}if(e.method==="GET"&&e.url?.startsWith("/report?")){e7(t,e,r);return}if(e.method==="POST"&&(e.url==="/"||e.url==="/mcp")){let n;try{n=await BN(e)}catch{HN(r,null,-32700,"Parse error");return}try{let i=await Z5(t,n);ql(r,200,{jsonrpc:"2.0",id:n.id??null,result:i})}catch(i){HN(r,n.id??null,-32603,i.message||"Internal error")}return}if(e.method==="POST"&&e.url==="/tools/execute"){let n=await BN(e);if(!n||typeof n.name!="string"||n.name.trim()===""){ql(r,400,{error:'Field "name" is required'});return}let i=await zx(t,n.name,n.args??{});ql(r,200,{result:i});return}ql(r,405,{error:"Method not allowed"})}catch(n){ql(r,500,{error:n.message})}})}function i7(t){if(typeof t.port=="number"&&Number.isFinite(t.port))return Math.min(65535,Math.max(1,Math.floor(t.port)));let r=new ks(Xo.resolve(t.workspaceFolder)).getMcpConfig().port;return Math.min(65535,Math.max(1,Math.floor(r||3100)))}async function s7(t){let e=i7(t),r=t.host||"127.0.0.1",n=`${r}:${e}`,i={workspaceFolder:t.workspaceFolder,port:e,host:r,isRunning:!1,runStore:new $c};return z5.set(n,i),{async start(){if(i.isRunning)return;i.container||(i.container=qn(i.workspaceFolder));let s=n7(i);await new Promise((o,l)=>{s.once("error",l),s.listen(i.port,i.host,()=>{s.off("error",l),o()})}),i.server=s,i.isRunning=!0},async stop(){if(i.container&&(Hc(i.container),i.container=void 0),!i.server){i.isRunning=!1;return}await new Promise((s,o)=>{i.server.close(l=>{if(l){o(l);return}s()})}),i.server=void 0,i.isRunning=!1},isRunning(){return i.isRunning},getPort(){return i.port},async executeTool(s,o){return zx(i,s,o??{})}}}var VN,WN,Xo,z5,J5,Wx,Bx,r7,JN=ae(()=>{"use strict";VN=ve(require("fs")),WN=require("http"),Xo=ve(require("path"));ig();Uc();Oi();xx();Ex();qx();Ox();av();kp();vv();z5=new Map;J5=3e3,Wx=new Map,Bx=new Map;r7=Jy});var I7={};Rs(I7,{AmbiguousRefError:()=>Zo,AwsSecretResolver:()=>gp,AzureKeyVaultResolver:()=>yp,BODY_FILE_MAP:()=>BS,CACHE_BUSTING_TOOLS:()=>Jy,COLLECTION_INPUT_SCHEMA:()=>Op,CONFIG_FILES:()=>ko,CollectionLoader:()=>Ia,CollectionLoaderFactory:()=>Xu,CollectionRequestExecutor:()=>As,CollectionService:()=>ec,ConfigService:()=>ks,CookieJar:()=>Su,CookieService:()=>tc,CookieUtils:()=>Rt,DEFAULT_CONFIG:()=>tr,DEFAULT_REQUEST_SETTINGS:()=>on,DEFAULT_SUITE_CONFIG:()=>Go,DYNAMIC_VARIABLES:()=>ew,DataFileParser:()=>Io,DopplerResolver:()=>wp,EnvironmentConfigService:()=>nc,EnvironmentResolver:()=>Bi,ExampleGenerator:()=>al,FOLDER_INPUT_SCHEMA:()=>Ip,FetchHttpClient:()=>Ju,FolderCollectionLoader:()=>vu,FolderCollectionStore:()=>Cs,ForgeContainer:()=>rg,ForgeEnv:()=>xs,GENERIC_TOOL_NAMES:()=>G,GcpSecretResolver:()=>Sp,GraphQLSchemaService:()=>sc,HTTP_METHOD_MAP:()=>dv,HTTP_METHOD_REVERSE:()=>Bs,HashiCorpVaultResolver:()=>vp,HistoryAnalyzer:()=>Xa,HtmlReportGenerator:()=>jc,HttpForgeParser:()=>Oo,HttpRequestService:()=>Wi,InMemoryCookieJar:()=>bl,InterceptorChain:()=>zi,JUnitReportGenerator:()=>wl,JsonCollectionLoader:()=>Qa,LoggingRequestInterceptor:()=>um,MCP_PROMPTS:()=>$p,METADATA_FILES:()=>Rr,McpRunStore:()=>$c,ModuleLoader:()=>cd,NodeFileSystem:()=>Gu,NodeHttpClient:()=>Eo,OAuth2TokenManager:()=>Qu,OnePasswordResolver:()=>bp,OpenApiExporter:()=>ol,OpenApiImporter:()=>Hs,ParserRegistry:()=>bu,PersistentCookieJar:()=>rc,REQUEST_INPUT_SCHEMA:()=>qp,ROOT_DIRECTORIES:()=>Ps,RefResolver:()=>ml,RequestExecutor:()=>Ga,RequestHistoryService:()=>oc,RequestHistoryStore:()=>zu,RequestPreparer:()=>ic,RequestPreprocessor:()=>qo,RequestScriptSession:()=>Wu,ResultStorageService:()=>Cl,RetryErrorInterceptor:()=>fm,SCHEMA_FILES:()=>yu,SCRIPTS_DIR:()=>en,SCRIPT_FILES:()=>Ef,SUITE_INPUT_SCHEMA:()=>Pp,SchemaInferenceService:()=>gl,SchemaInferrer:()=>Ns,ScriptAnalyzer:()=>yl,ScriptExecutor:()=>Ki,SecretResolverRegistry:()=>Ac,ServiceContainer:()=>Yo,ServiceIdentifiers:()=>oe,StatisticsService:()=>Ev,TestSuiteService:()=>Tc,TestSuiteStore:()=>qv,TimingResponseInterceptor:()=>cm,UrlBuilder:()=>Hn,VariableInterpolator:()=>vo,VariableResolver:()=>yo,applyEnvSuggestionsToItems:()=>Wy,applyExtractionPlan:()=>AP,applyFilterChain:()=>xu,augmentWithDynamicVars:()=>mo,bootstrapNodeRuntime:()=>Dx,buildCollectionToolDescription:()=>iv,buildCollectionToolName:()=>Zy,buildExtractionPlan:()=>kP,buildFolderToolDescription:()=>sv,buildFolderToolName:()=>Xy,buildGenericTools:()=>zy,buildMcpToolList:()=>fv,buildPromptResult:()=>Yy,buildRequestToolDescription:()=>nv,buildRequestToolName:()=>Qy,buildResultFileName:()=>Sl,buildSuiteToolDescription:()=>ov,buildSuiteToolName:()=>ev,cleanupOldBodyFiles:()=>zS,concatenateScripts:()=>pd,countRequests:()=>By,createExpectChain:()=>za,createLodashShim:()=>U0,createMcpRuntime:()=>GN,createModuleLoader:()=>zm,createMomentShim:()=>fd,createNodeContainer:()=>qn,createResponseObject:()=>dd,createScriptConsole:()=>vP,createTestFunction:()=>Ym,createVariableResolver:()=>kq,decodeCursor:()=>cv,decodeFolderName:()=>yx,decodeFolderPath:()=>rs,dedupeToolsByName:()=>lv,deepClone:()=>yq,deleteItemFromTree:()=>Xh,deserializeTypedRecord:()=>hv,deserializeTypedValue:()=>xl,detectEnvSuggestions:()=>Ep,detectSensitiveData:()=>PP,dispatchGenericTool:()=>Gy,encodeCursor:()=>uv,encodeFolderName:()=>vr,enhanceCollection:()=>nM,enumerateFolders:()=>Vr,evaluateExpression:()=>ui,expandSummary:()=>RN,exportCollectionToRestClient:()=>xP,findItemById:()=>Zh,flattenRequests:()=>nt,formatBytes:()=>Sq,formatConsoleOutput:()=>Ja,formatDuration:()=>wq,generateId:()=>Ot,generateSlug:()=>_n,generateUUID:()=>Qh,getCompletions:()=>uM,getRestClientExportFolder:()=>CP,getServiceContainer:()=>wx,hasChanged:()=>Vu,isExpression:()=>go,isPlainObject:()=>vq,isSystemEnvironmentFile:()=>If,loadEnvironmentsFromFolder:()=>wu,mcpToolSegment:()=>Qo,mcpToolToken:()=>ss,mergeHeadersCaseInsensitive:()=>gu,mergeRequestSettings:()=>XN,normalizeFolderInput:()=>_p,normalizeHeaders:()=>Km,parseCurlCommand:()=>rM,parseFilterChain:()=>Cu,parseMcpToolName:()=>tv,parsePostmanEnvironment:()=>vd,parsePostmanEnvironmentFile:()=>OP,parseQueryContext:()=>lM,prepareBodyForSave:()=>WS,readBodyFromDir:()=>VS,readSchemaFile:()=>JS,readScriptsFromDir:()=>qf,redactBody:()=>lg,redactFullResponse:()=>cg,redactFullResultDetails:()=>fg,redactHeaders:()=>gi,redactHistoryEntry:()=>ug,redactUrl:()=>wd,registerCoreServices:()=>Rp,resolveCollectionRef:()=>bv,resolveDynamicVariable:()=>Vi,resolveDynamicVariablesInString:()=>Iq,resolveFolderRef:()=>Sv,resolveFolderToken:()=>rv,resolveRequestRef:()=>wv,resolveToken:()=>vl,runCollection:()=>KN,runFolder:()=>QN,runRequest:()=>YN,runSuite:()=>ZN,safeJsonParse:()=>bq,sanitizeName:()=>Ht,scanCollectionForEnvVarsWithAi:()=>sM,searchForItemPath:()=>em,searchForItemPathById:()=>tm,serializeTypedValue:()=>Lc,sortItemsByOrder:()=>YS,writeEnvFile:()=>Ka,writeFolderItems:()=>yd,writeSchemaFiles:()=>GS,writeScriptFile:()=>Zu,writeScriptsToDir:()=>Of});module.exports=Oa(I7);var Ia=class{constructor(e,r){this.fileSystem=e;this.parserRegistry=r}fileSystem;parserRegistry;directory;setDirectory(e){this.directory=e}async loadAll(){return this.directory?this.loadDirectory(this.directory):[]}async load(e,r={}){let n=await this.fileSystem.readFile(e);if(r.format){let s=this.parserRegistry.get(r.format);if(!s)throw new Error(`No parser registered for format: ${r.format}`);return s.parse(n,e)}let i=this.parserRegistry.detect(n);if(!i)throw new Error(`Could not detect collection format for: ${e}. Supported formats: ${this.parserRegistry.getFormats().join(", ")}`);return i.parser.parse(n,e)}async loadDirectory(e,r=["*.json","*.forge.json"]){let n=[],i=await this.fileSystem.glob(r,e);for(let s of i)try{let o=await this.load(s);n.push(o)}catch{}return n}async canLoad(e){try{if(!await this.fileSystem.exists(e))return!1;let r=await this.fileSystem.readFile(e);return this.parserRegistry.detect(r)!==null}catch{return!1}}getSupportedFormats(){return this.parserRegistry.getFormats()}};rm();Pa();function KS(t,e){return{id:t.id,name:t.name,description:t.description,variables:t.variables||{},auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(_q),source:{format:"folder",filePath:e,version:t.version}}}function _q(t){if(t.type==="folder")return{type:"folder",id:t.id,name:t.name,description:t.description,auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(_q)};let e=t;return{type:"request",id:e.id,name:e.name,description:e.description,method:e.method||"GET",url:e.url||"",headers:e.headers||[],query:e.query||[],params:e.params,body:e.body??void 0,auth:e.auth,settings:e.settings,scripts:e.scripts,...e.deprecated&&{deprecated:e.deprecated},...e.doc&&{doc:e.doc},...e.responseSchema&&{responseSchema:e.responseSchema},...e.bodySchema&&{bodySchema:e.bodySchema},...e.operationId&&{operationId:e.operationId},...e.summary&&{summary:e.summary},...e.tags&&e.tags.length>0&&{tags:e.tags},...e.examples&&e.examples.length>0&&{examples:e.examples},...e.responses&&Object.keys(e.responses).length>0&&{responses:e.responses},...e.security&&e.security.length>0&&{security:e.security}}}function h2(t){return{id:t.id,name:t.name,description:t.description,version:t.source?.version,variables:t.variables,auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(QS)}}function QS(t){return t.type==="folder"?{type:"folder",id:t.id,name:t.name,description:t.description,auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(QS)}:{type:"request",id:t.id,name:t.name,description:t.description,method:t.method,url:t.url,headers:t.headers,query:t.query,params:t.params,body:t.body,auth:t.auth,settings:t.settings,scripts:t.scripts,...t.deprecated&&{deprecated:t.deprecated},...t.doc&&{doc:t.doc},...t.responseSchema&&{responseSchema:t.responseSchema},...t.bodySchema&&{bodySchema:t.bodySchema},...t.operationId&&{operationId:t.operationId},...t.summary&&{summary:t.summary},...t.tags&&{tags:t.tags},...t.examples&&{examples:t.examples},...t.responses&&{responses:t.responses},...t.security&&{security:t.security}}}var vu=class{store;constructor(e){this.store=new Cs(e)}loadAll(){return this.store.loadAll().map(r=>KS(r,this.store.getCollectionPath(r.id)))}getSlugById(e){return this.store.getSlugById(e)}getIdBySlug(e){return this.store.getIdBySlug(e)}load(e){let r=this.store.load(e);if(r)return KS(r,this.store.getCollectionPath(r.id))}async create(e,r){let n=await this.store.create(e,r);return KS(n,this.store.getCollectionPath(n.id))}async save(e){return this.store.save(h2(e))}async delete(e){return this.store.delete(e)}exists(e){return this.store.exists(e)}getCollectionPath(e){return this.store.getCollectionPath(e)}async updateCollectionMetadata(e,r){return this.store.updateCollectionMetadata(e,r)}async saveItem(e,r,n){return this.store.saveItem(e,QS(r),n)}async updateItem(e,r,n){let i={...n};return this.store.updateItem(e,r,i)}async deleteItem(e,r){return this.store.deleteItem(e,r)}async moveItem(e,r,n){return this.store.moveItem(e,r,n)}async reorderItems(e,r,n){return this.store.reorderItems(e,r,n)}async saveScripts(e,r,n){return this.store.saveScripts(e,r,n)}loadScripts(e,r){return this.store.loadScripts(e,r)}};var bu=class{parsers=new Map;register(e,r){this.parsers.set(e.toLowerCase(),r)}get(e){return this.parsers.get(e.toLowerCase())}has(e){return this.parsers.has(e.toLowerCase())}getFormats(){return Array.from(this.parsers.keys())}detect(e){for(let[r,n]of this.parsers)if(n.canParse(e))return{parser:n,format:r};return null}clear(){this.parsers.clear()}};ka();var Su=class{cookies=new Map;getCookieKey(e,r,n){return`${r||"*"}|${n||"/"}|${e}`}get(e,r){if(r){let s=this.getCookieKey(e,r),o=this.cookies.get(s);if(o&&!this.isExpired(o))return o}let n=this.getCookieKey(e,"*"),i=this.cookies.get(n);if(i&&!this.isExpired(i))return i;for(let s of this.cookies.values())if(s.name===e&&!this.isExpired(s))if(r&&s.domain){if(this.domainMatches(r,s.domain))return s}else return s}set(e){let r=this.getCookieKey(e.name,e.domain,e.path);this.cookies.set(r,e)}setFromResponse(e){for(let r of e){let n=this.getCookieKey(r.name,r.domain,r.path);this.cookies.set(n,r)}}has(e,r){return this.get(e,r)!==void 0}delete(e,r,n){let i=this.getCookieKey(e,r,n);return this.cookies.delete(i)}getAll(e){let r=[];for(let n of this.cookies.values())this.isExpired(n)||(e?(!n.domain||this.domainMatches(e,n.domain))&&r.push(n):r.push(n));return r}getCookieHeader(e){let r=this.getAll(e);return Rt.formatCookieHeader(r)}clear(){this.cookies.clear()}clearDomain(e){let r=[];for(let[n,i]of this.cookies.entries())i.domain&&this.domainMatches(e,i.domain)&&r.push(n);for(let n of r)this.cookies.delete(n)}parseCookieHeaders(e,r){return Rt.parseCookieHeaders(e,r)}isExpired(e){return Rt.isExpired(e)}domainMatches(e,r){return Rt.domainMatches(e,r)}get count(){return this.cookies.size}cleanExpiredCookies(){let e=[];for(let[r,n]of this.cookies.entries())this.isExpired(n)&&e.push(r);for(let r of e)this.cookies.delete(r)}};im();var Bi=class t{config;selectedEnvironment;sessionGlobals={};sessionEnvironmentValues=new Map;constructor(e){this.config=e,this.selectedEnvironment=e.selectedEnvironment||Object.keys(e.environments)[0]||"default"}get(e){return this.getVariables()[e]}set(e,r){let n=this.sessionEnvironmentValues.get(this.selectedEnvironment);n||(n={},this.sessionEnvironmentValues.set(this.selectedEnvironment,n)),n[e]=r}getAll(){return this.getVariables()}getEnvironments(){return Object.keys(this.config.environments)}getActive(){return this.selectedEnvironment}setActive(e){if(!this.config.environments[e])throw new Error(`Environment not found: ${e}`);this.selectedEnvironment=e}getVariables(e){let r=e||this.selectedEnvironment,n=this.config.environments[r],i={...this.config.globalVariables||{},...this.sessionGlobals};if(n){if(n.inherits&&this.config.environments[n.inherits]){let o=this.getEnvironmentVariables(n.inherits);i={...i,...o}}i={...i,...n.variables};let s=this.sessionEnvironmentValues.get(r);s&&(i={...i,...s})}return i}getEnvironmentVariables(e){let r=this.config.environments[e];if(!r)return{};let n={};return r.inherits&&this.config.environments[r.inherits]&&(n={...this.getEnvironmentVariables(r.inherits)}),{...n,...r.variables}}getGlobals(){return{...this.config.globalVariables||{},...this.sessionGlobals}}setGlobal(e,r){this.sessionGlobals[e]=r}unsetGlobal(e){delete this.sessionGlobals[e]}clearGlobals(){this.sessionGlobals={}}resolve(e){let r=e||this.selectedEnvironment;return{name:r,merged:this.getVariables(r),globals:this.getGlobals()}}static fromVariables(e,r="default"){return new t({environments:{[r]:{name:r,variables:e}},selectedEnvironment:r})}};_u();Af();var xs=class t{envStore;interpolator;urlBuilder;constructor(e,r){this.envStore=e,this.interpolator=r||new vo,this.urlBuilder=new Hn}get(e){return this.envStore.get(e)}set(e,r){this.envStore.set(e,r)}has(e){return this.envStore.get(e)!==void 0}delete(e){this.envStore.set(e,"")}getAll(){return this.envStore.getAll()}getActiveEnvironment(){return this.envStore.getActive()}setActiveEnvironment(e){this.envStore.setActive(e)}getEnvironments(){let e=this.envStore;return typeof e.getEnvironments=="function"?e.getEnvironments():[]}getGlobals(){let e=this.envStore;return typeof e.getGlobals=="function"?e.getGlobals():{}}setGlobal(e,r){let n=this.envStore;typeof n.setGlobal=="function"&&n.setGlobal(e,r)}unsetGlobal(e){let r=this.envStore;typeof r.unsetGlobal=="function"&&r.unsetGlobal(e)}clearGlobals(){let e=this.envStore;typeof e.clearGlobals=="function"&&e.clearGlobals()}resolve(e){return this.interpolator.interpolate(e,this.getAll())}resolvePath(e,r={}){let n=this.interpolator.interpolate(e,this.getAll());return this.urlBuilder.buildUrl(n,r)}buildUrl(e,r={}){let n=this.interpolator.interpolate(e,this.getAll());return this.urlBuilder.buildUrl(n,r.params||{},r.query||{})}resolveObject(e){return this.interpolator.interpolateObject(e,this.getAll())}extractVariables(e){return this.interpolator.extractVariables(e)}extractPathParams(e){return this.urlBuilder.extractPathParams(e)}static create(e={}){let r=Bi.fromVariables(e);return new t(r)}static fromResolver(e){return new t(e)}};Af();Tf();$f();_u();md();hd();var Ga=class{constructor(e,r,n,i,s){this.httpClient=e;this.forgeEnv=r;this.cookieJar=n;this.preprocessor=i;if(s?.scriptExecutor)this.scriptExecutor=s.scriptExecutor;else{let o=s?.forgeRoot?[require("path").join(s.forgeRoot,"modules")]:[],l=new Wi(new Hn,new zi,e);this.scriptExecutor=new Ki(l,o,void 0,s?.scriptScope??"shared",s?.scriptTimeout??5e3)}}httpClient;forgeEnv;cookieJar;preprocessor;scriptExecutor;async execute(e,r,n={}){let i=Date.now(),s={...this.forgeEnv.getAll()},o={...this.forgeEnv.getGlobals()},l={...n.additionalVariables||{}},c={...s},d=this.buildHttpRequest(e,n.overrides),p=n.overrides?.body||e.body,m=this.findFolderPath(r,e.id),y=this.buildScriptChain(e,r,m),b={request:{url:d.url,method:d.method,headers:{...d.headers},body:p?typeof p=="string"?{type:"raw",content:p}:p:void 0},variables:l,collectionVariables:r.variables||{},globals:{...o},environmentVariables:c,environmentName:this.forgeEnv.getActiveEnvironment?.()||void 0,cookieJar:this.cookieJar,info:{eventName:"prerequest",requestName:e.name,requestId:e.id,collectionName:r?.name},onEnvironmentChange:n.onEnvironmentChange,onGlobalsChange:(_,q,k)=>{_==="set"&&q&&k!==void 0?this.forgeEnv.setGlobal(q,k):_==="unset"&&q?this.forgeEnv.unsetGlobal(q):_==="clear"&&this.forgeEnv.clearGlobals()}},E=this.scriptExecutor.createRequestSession(b),C,v;try{if(!n.skipPreRequest&&y.preRequest.length>0){let O=await E.executePreRequest(y.preRequest);if(C={success:O.success,error:O.error,modifiedVariables:O.modifiedVariables,modifiedEnvironment:O.modifiedEnvironmentVariables,modifiedGlobals:O.modifiedGlobals,modifiedCollectionVariables:O.modifiedCollectionVariables,consoleOutput:O.consoleOutput,modifiedRequest:O.modifiedRequest?{url:O.modifiedRequest.url,method:O.modifiedRequest.method,headers:O.modifiedRequest.headers,body:O.modifiedRequest.body?.content}:void 0},O.modifiedVariables&&(l={...l,...O.localVariables??O.modifiedVariables}),O.modifiedEnvironmentVariables&&(c={...c,...O.modifiedEnvironmentVariables}),O.modifiedRequest){let M=O.modifiedRequest;M.url&&(d.url=M.url),M.method&&(d.method=M.method),M.headers&&(d.headers={...d.headers,...M.headers}),M.body!==void 0&&(d.body=M.body?.content||M.body)}if(!O.success)throw new Error(`Pre-request script failed: ${O.error}`)}let _={...c,...l};d=this.interpolateRequest(d,_);let q=n.overrides?.body||e.body;if(this.preprocessor&&q&&typeof q!="string"&&q.type==="graphql"&&d.body!==void 0){let O=this.preprocessor.encodeBody({type:"graphql",content:d.body});O!=null&&(d.body=typeof O=="string"?O:JSON.stringify(O))}if(p&&typeof p=="object"&&p.type==="form-data"&&Array.isArray(d.body)){let O=this.buildMultipartFormData({type:"form-data",content:d.body});O&&(d.body=O)}let k=await this.httpClient.send(d);if(!n.skipPostResponse&&y.postResponse.length>0){let O=await E.executePostResponse(y.postResponse,{status:k.status,statusText:k.statusText,headers:k.headers,body:k.body,cookies:Qm(k.headers,k.cookies,d.url),responseTime:k.time,responseSize:k.size,executedRequest:{url:d.url,method:d.method,headers:d.headers||{},body:d.body?typeof d.body=="string"?{type:"raw",content:d.body}:d.body:{type:"none",content:""},params:{},query:{}}});v={success:!0,assertions:O.testResults,consoleOutput:O.consoleOutput,modifiedEnvironment:O.modifiedEnvironmentVariables},O.modifiedEnvironmentVariables&&(c={...c,...O.modifiedEnvironmentVariables})}return{response:k,preRequestResult:C,postResponseResult:v,totalTime:Date.now()-i,finalRequest:d,variables:{environment:c,local:l}}}finally{E.dispose?.()}}async executeSimple(e,r={}){let n=e,i={...this.forgeEnv.getAll(),...r.variables||{}};return n=this.interpolateRequest(e,i),r.timeout&&(n={...n,timeout:r.timeout}),this.httpClient.send(n)}buildHttpRequest(e,r){let n=e.url;if(e.query&&e.query.length>0){let p=new URLSearchParams;for(let m of e.query)m.enabled!==!1&&p.append(m.key,m.value);n+=(n.includes("?")?"&":"?")+p.toString()}let i=r?.url||n,s=r?.method||e.method,o={};if(e.headers&&Array.isArray(e.headers))for(let p of e.headers)p.enabled!==!1&&(o[p.key]=p.value);let l={...o,...r?.headers||{}},c,d=r?.body||e.body;if(d)if(typeof d=="string")c=d;else if(this.preprocessor&&d.type)if(d.type==="graphql")c=typeof d.content=="string"?d.content:JSON.stringify(d.content);else if(d.type==="form-data")c=this.buildMultipartFormData(d);else{let p=this.preprocessor.encodeBody(d);c=p!=null?String(p):void 0}else d.content&&(c=typeof d.content=="string"?d.content:JSON.stringify(d.content));return this.preprocessor&&d&&d.type!=="form-data"&&this.preprocessor.setContentTypeHeader(l,d),{url:i,method:s,headers:l,body:c,timeout:r?.timeout||e.settings?.timeout,settings:{...e.settings,...r?.settings}}}interpolateRequest(e,r){let n=xs.create(r),i=e.body,s=i;return typeof i=="string"?s=n.resolve(i):i instanceof FormData||i instanceof URLSearchParams?s=i:i&&typeof i=="object"&&(s=n.resolve(i)),{...e,url:n.resolvePath(e.url),headers:n.resolveObject(e.headers),body:s}}buildMultipartFormData(e){if(!e||e.type!=="form-data"||!Array.isArray(e.content))return;let r=new FormData;for(let n of e.content)!n?.key||n.enabled===!1||r.append(n.key,n.value==null?"":String(n.value));return r}buildScriptChain(e,r,n=[]){let i=[],s=[];r.scripts?.preRequest&&i.push(r.scripts.preRequest),r.scripts?.postResponse&&s.push(r.scripts.postResponse);for(let o of n)o.scripts?.preRequest&&i.push(o.scripts.preRequest),o.scripts?.postResponse&&s.push(o.scripts.postResponse);return e.scripts?.preRequest&&i.push(e.scripts.preRequest),e.scripts?.postResponse&&s.push(e.scripts.postResponse),{preRequest:i,postResponse:s}}findFolderPath(e,r){let n=[],i=(s,o)=>{for(let l of s){if(l.type==="request"&&l.id===r)return n.push(...o),!0;if(l.type==="folder"){let c=[...o,l];if(i(l.items,c))return!0}}return!1};return i(e.items,[]),n}};function Mz(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}var zu=class{entries=new Map;requestIndex=new Map;fullResponses=new Map;maxEntriesPerRequest;storeFullResponses;constructor(e={}){this.maxEntriesPerRequest=e.maxEntriesPerRequest??100,this.storeFullResponses=e.storeFullResponses??!0}getEntries(e,r){let n=this.requestIndex.get(e)||[],i=[];for(let s of n){let o=this.entries.get(s);o&&(!r||o.environment===r)&&i.push(o)}return i}getEntry(e){return this.entries.get(e)}getFullResponse(e){return this.fullResponses.get(e)}get count(){return this.entries.size}addEntry(e,r,n,i,s){let o=Mz(),l=Date.now(),c={id:o,timestamp:l,environment:i,method:r.method,ticket:s?.ticket,branch:s?.branch,note:s?.note,sentRequest:{url:r.url,method:r.method,headers:{...r.headers},body:r.body},response:{status:n.status,statusText:n.statusText,time:n.time}};this.entries.set(o,c);let d=this.requestIndex.get(e)||[];for(d.unshift(o);d.length>this.maxEntriesPerRequest;){let p=d.pop();p&&(this.entries.delete(p),this.fullResponses.delete(p))}if(this.requestIndex.set(e,d),this.storeFullResponses){let p={timestamp:l,status:n.status,statusText:n.statusText,headers:{...n.headers},cookies:n.cookies||[],body:n.body,time:n.time};this.fullResponses.set(o,p)}return c}deleteEntry(e){if(!this.entries.get(e))return!1;this.entries.delete(e),this.fullResponses.delete(e);for(let[n,i]of this.requestIndex.entries()){let s=i.indexOf(e);if(s!==-1){i.splice(s,1),i.length===0&&this.requestIndex.delete(n);break}}return!0}clearHistory(e){let r=this.requestIndex.get(e);if(r){for(let n of r)this.entries.delete(n),this.fullResponses.delete(n);this.requestIndex.delete(e)}}clearAll(){this.entries.clear(),this.requestIndex.clear(),this.fullResponses.clear()}};var Ju=class{async send(e){let r=Date.now(),n=new AbortController,i=e.timeout??3e4,s=setTimeout(()=>n.abort(),i);try{let o={method:e.method,headers:e.headers,signal:n.signal};e.body!==void 0&&!["GET","HEAD"].includes(e.method.toUpperCase())&&(typeof e.body=="string"||e.body instanceof FormData||e.body instanceof URLSearchParams?o.body=e.body:typeof e.body=="object"&&(o.body=JSON.stringify(e.body),!e.headers?.["Content-Type"]&&!e.headers?.["content-type"]&&(o.headers["Content-Type"]="application/json"))),e.settings?.followRedirects===!1&&(o.redirect="manual");let l=await fetch(e.url,o),c=Date.now(),d;try{d=await l.text()}catch{d=null}let p={};return l.headers.forEach((m,y)=>{let b=p[y];b!==void 0?p[y]=Array.isArray(b)?[...b,m]:[b,m]:p[y]=m}),{status:l.status,statusText:l.statusText,headers:p,cookies:[],body:d,time:c-r}}catch(o){throw o.name==="AbortError"?new Error(`Request timeout after ${i}ms`):o}finally{clearTimeout(s)}}};Tf();$f();gd();eg();_u();var Oo=class{format="http-forge";canParse(e){try{let r=JSON.parse(e);return typeof r=="object"&&r!==null&&"id"in r&&"name"in r&&"items"in r&&Array.isArray(r.items)&&!r.info?.schema?.includes("postman")&&!r._type}catch{return!1}}parse(e,r){let n=JSON.parse(e);return{id:n.id,name:n.name,description:n.description,variables:n.variables||{},auth:n.auth,scripts:n.scripts?{preRequest:n.scripts.preRequest,postResponse:n.scripts.postResponse}:void 0,items:this.convertItems(n.items),source:{format:"http-forge",filePath:r,version:n.version}}}convertItems(e){return e.map(r=>r.type==="folder"?this.convertFolder(r):this.convertRequest(r))}convertFolder(e){return{type:"folder",id:e.id,name:e.name,description:e.description,auth:e.auth,scripts:e.scripts?{preRequest:e.scripts.preRequest,postResponse:e.scripts.postResponse}:void 0,items:e.items?this.convertItems(e.items):[]}}convertRequest(e){let r={};if(e.headers)for(let i of e.headers)i.enabled!==!1&&(r[i.key]=i.value);let n={};if(e.query)for(let i of e.query)i.enabled!==!1&&(n[i.key]=i.value);return{type:"request",id:e.id,name:e.name,description:e.description,method:e.method||"GET",url:e.url||"",headers:Object.entries(r).map(([i,s])=>({key:i,value:s,enabled:!0})),query:Object.entries(n).map(([i,s])=>({key:i,value:s,enabled:!0})),params:e.params,body:e.body,auth:e.auth,settings:e.settings,scripts:e.scripts?{preRequest:e.scripts.preRequest,postResponse:e.scripts.postResponse}:void 0}}};tg();var Rn=ve(require("fs/promises")),Yu=ve(require("path")),Gu=class{async readFile(e){return Rn.readFile(e,"utf-8")}async writeFile(e,r){let n=Yu.dirname(e);await this.mkdir(n),await Rn.writeFile(e,r,"utf-8")}async exists(e){try{return await Rn.access(e),!0}catch{return!1}}async mkdir(e){await Rn.mkdir(e,{recursive:!0})}async glob(e,r){let n=r||process.cwd(),i=[];try{await this.walkDirectory(n,s=>{let o=Yu.basename(s);for(let l of e)if(this.matchPattern(o,l)){i.push(s);break}})}catch{}return i}async readDir(e){return Rn.readdir(e)}async isDirectory(e){try{return(await Rn.stat(e)).isDirectory()}catch{return!1}}async walkDirectory(e,r){let n=await Rn.readdir(e,{withFileTypes:!0});for(let i of n){let s=Yu.join(e,i.name);i.isDirectory()?await this.walkDirectory(s,r):i.isFile()&&r(s)}}matchPattern(e,r){let n=r.replace(/\./g,"\\.").replace(/\*/g,".*");return new RegExp(`^${n}$`,"i").test(e)}};md();var rg=class t{httpClient;fileSystem;scriptExecutor;interpolator;cookieJar;interceptorChain;preprocessor;dataFileParser;requestHistory;parserRegistry;collectionLoader;environmentStore;forgeEnv;requestExecutor;options;constructor(e={}){if(this.options=e,this.interpolator=e.interpolator||new vo,this.fileSystem=e.fileSystem||new Gu,this.preprocessor=e.preprocessor||new qo,this.dataFileParser=e.dataFileParser||new Io,this.cookieJar=e.cookieJar||new Su,e.enableHistory?this.requestHistory=e.requestHistory||new zu({maxEntriesPerRequest:e.maxHistoryEntries??100}):this.requestHistory=null,this.interceptorChain=e.interceptorChain||this.createInterceptorChain(e),e.httpClient)this.httpClient=e.httpClient;else if(e.useNativeHttp!==!1){let s={...e.httpSettings,timeout:e.requestTimeout??e.httpSettings?.timeout};this.httpClient=new Eo(s)}else this.httpClient=new Ju;let r=e.forgeRoot?[require("path").join(e.forgeRoot,"modules")]:[],n=new Wi(new Hn,this.interceptorChain,this.httpClient);if(this.scriptExecutor=e.scriptExecutor||new Ki(n,r,void 0,e.scriptScope??"shared",e.scriptTimeout??5e3),this.parserRegistry=new bu,this.parserRegistry.register("http-forge",new Oo),(e.storageFormat??"folder")==="folder"&&e.forgeRoot){let s=require("path").join(e.forgeRoot,"collections");this.collectionLoader=new vu(s)}else this.collectionLoader=new Ia(this.fileSystem,this.parserRegistry);this.environmentStore=e.environmentConfig?new Bi(e.environmentConfig):Bi.fromVariables({}),this.forgeEnv=xs.fromResolver(this.environmentStore),this.requestExecutor=new Ga(this.httpClient,this.forgeEnv,this.cookieJar,this.preprocessor,{forgeRoot:e.forgeRoot,scriptExecutor:this.scriptExecutor})}createInterceptorChain(e){let r=new zi;if(e.requestInterceptors)for(let n of e.requestInterceptors)r.addRequestInterceptor(n);if(e.responseInterceptors)for(let n of e.responseInterceptors)r.addResponseInterceptor(n);if(e.errorInterceptors)for(let n of e.errorInterceptors)r.addErrorInterceptor(n);return r}async loadCollection(e){if(this.collectionLoader instanceof Ia)return this.collectionLoader.load(e);throw new Error("loadCollection(filePath) is not supported with folder storage format. Use loadAllCollections() instead.")}async loadAllCollections(){return this.collectionLoader.loadAll()}async execute(e,r,n){return this.requestExecutor.execute(e,r,n)}async executeSimple(e,r){return this.requestExecutor.executeSimple(e,r)}registerParser(e,r){this.parserRegistry.register(e,r)}setEnvironmentConfig(e){this.environmentStore=new Bi(e),this.forgeEnv=xs.fromResolver(this.environmentStore),this.requestExecutor=new Ga(this.httpClient,this.forgeEnv,this.cookieJar,this.preprocessor,{forgeRoot:this.options.forgeRoot,scriptExecutor:this.scriptExecutor})}static create(e){return new t(e)}static fromForgeRoot(e="./http-forge",r={}){let n=require("path"),i=n.join(e,"environments"),s,o=wu(i);if(Object.keys(o.environments).length>0||Object.keys(o.globalVariables).length>0){s={globalVariables:{...o.globalVariables,...o.localVariables},environments:{},selectedEnvironment:void 0};for(let[c,d]of Object.entries(o.environments)){let p=o.localCredentials[c]?.variables||{};s.environments[c]={name:c,variables:{...d.variables,...p}}}}else{let c=require("fs"),d=n.join(i,"environments.json");if(c.existsSync(d))try{let p=c.readFileSync(d,"utf-8"),m=JSON.parse(p);if(s={globalVariables:m.globalVariables||{},environments:{},selectedEnvironment:m.selectedEnvironment},m.environments)for(let[y,b]of Object.entries(m.environments)){let E=b;s.environments[y]={name:E.name||y,variables:E.variables||{}}}}catch(p){console.warn(`[ForgeContainer] Failed to load environments from ${d}:`,p)}}return new t({...r,forgeRoot:e,storageFormat:r.storageFormat??"folder",environmentConfig:s})}};Sx();_x();Vy();Oi();xx();Ex();qx();Ox();av();kp();async function GN(t){let{createMcpRuntime:e}=await Promise.resolve().then(()=>(JN(),zN));return e(t)}async function YN(t){let{runRequest:e}=await Promise.resolve().then(()=>(Uc(),Dp));return e(t)}async function KN(t){let{runCollection:e}=await Promise.resolve().then(()=>(Uc(),Dp));return e(t)}async function QN(t){let{runFolder:e}=await Promise.resolve().then(()=>(Uc(),Dp));return e(t)}async function ZN(t){let{runSuite:e}=await Promise.resolve().then(()=>(Uc(),Dp));return e(t)}vv();r_();ka();Ix();n_();Tf();$f();gd();function XN(t){return{timeout:t?.timeout??on.timeout,followRedirects:t?.followRedirects??on.followRedirects,followOriginalMethod:t?.followOriginalMethod??on.followOriginalMethod,followAuthHeader:t?.followAuthHeader??on.followAuthHeader,maxRedirects:t?.maxRedirects??on.maxRedirects,strictSSL:t?.strictSSL??on.strictSSL,decompress:t?.decompress??on.decompress,includeCookies:t?.includeCookies??on.includeCookies,tls:t?.tls??on.tls,certificates:t?.certificates??on.certificates}}gd();eg();_u();H0();V0();md();Gm();hd();_d();Z0();e_();rm();Pa();Pa();Q0();function o7(t){let e=t.replace(/\\\n/g," "),r=[],n="",i=0;for(;i<e.length;){let s=e[i];if(s==="\\"&&i+1<e.length)n+=e[++i],i++;else if(s==="'"){for(i++;i<e.length&&e[i]!=="'";)n+=e[i++];i++}else if(s==='"'){for(i++;i<e.length&&e[i]!=='"';)if(e[i]==="\\"&&i+1<e.length){let o=e[i+1];o==='"'||o==="\\"||o==="$"||o==="`"?(n+=o,i+=2):n+=e[i++]}else n+=e[i++];i++}else/\s/.test(s)?(n.length>0&&(r.push(n),n=""),i++):(n+=s,i++)}return n.length>0&&r.push(n),r}function a7(t){try{let e="__FV__",r=[],n=t.replace(/\{\{[^}]+\}\}/g,p=>(r.push(p),`${e}${r.length-1}`)),i=n.indexOf("?");if(i===-1)return{cleanUrl:t,params:[]};let s=n.slice(0,i),o=n.slice(i+1),l=p=>p.replace(new RegExp(`${e}(\\d+)`,"g"),(m,y)=>r[parseInt(y,10)]),c=l(s),d=o.split("&").filter(Boolean).map(p=>{let m=l(p),y=m.indexOf("=");return y===-1?{key:m,value:"",enabled:!0}:{key:decodeURIComponent(m.slice(0,y)),value:decodeURIComponent(m.slice(y+1)),enabled:!0}});return{cleanUrl:c,params:d}}catch{return{cleanUrl:t,params:[]}}}function l7(t){try{let e=new URL(t.replace(/\{\{[^}]+\}\}/g,"placeholder")),r=e.pathname.split("/").filter(Boolean),n=r[r.length-1];return n&&!/^\d+$/.test(n)&&!n.startsWith("{")?n.replace(/[-_]/g," ").replace(/\b\w/g,i=>i.toUpperCase()):r.length>1?r[r.length-2].replace(/[-_]/g," ").replace(/\b\w/g,i=>i.toUpperCase()):e.hostname.replace(/^www\./,"").split(".")[0]??"Request"}catch{return"Request"}}var u7=new Set(["x-api-key","x-auth-token","x-access-token","x-token","x-secret","api-key","apikey","x-client-secret","x-rapidapi-key"]),c7=new Set(["api_key","apikey","api-key","access_token","token","auth_token","client_id","client_secret","key","secret"]);function eM(t){return t.toUpperCase().replace(/[^A-Z0-9]/g,"_")}function tM(t){return/\{\{[^}]+\}\}/.test(t)}function Cv(t,e=16){return t.length>=e&&!tM(t)}function f7(t,e,r){let n=[],i=new Set,s=(o,l)=>{i.has(l)||(i.add(l),n.push({key:o,value:l}))};for(let o of t){let l=o.key.toLowerCase();if(l==="authorization"){let c=o.value.match(/^(bearer|basic|token|digest)\s+(.+)$/i);c&&Cv(c[2])?s(`${c[1].toUpperCase()}_TOKEN`,c[2]):Cv(o.value)&&s("AUTH_TOKEN",o.value)}else u7.has(l)&&Cv(o.value)&&s(eM(o.key),o.value)}for(let o of e)c7.has(o.key.toLowerCase())&&Cv(o.value)&&s(eM(o.key),o.value);try{let o=new URL(r.replace(/\{\{[^}]+\}\}/g,"placeholder"));if(!["localhost","127.0.0.1","0.0.0.0","::1"].includes(o.hostname)&&!tM(r)){let c=`${o.protocol}//${o.host}`;s("BASE_URL",c)}}catch{}return n}function rM(t){let e=o7(t.trim()),r=0;for(;r<e.length&&e[r].toLowerCase()==="curl";)r++;let n=e.slice(r),i="",s="",o=[],l=null,c=!1,d=!1,p=[],m=[],y=0;for(;y<n.length;){let q=n[y];if(q==="-X"||q==="--request")i=n[++y]??"";else if(q==="-H"||q==="--header"){let k=n[++y]??"",O=k.indexOf(":");O>0&&o.push({key:k.slice(0,O).trim(),value:k.slice(O+1).trim()})}else if(q==="-d"||q==="--data"||q==="--data-raw"||q==="--data-binary"||q==="--data-ascii")l=n[++y]??"";else if(q==="--json")l=n[++y]??"",c=!0;else if(q==="-u"||q==="--user"){let k=n[++y]??"",O=btoa(k);o.push({key:"Authorization",value:`Basic ${O}`})}else if(q==="-b"||q==="--cookie")o.push({key:"Cookie",value:n[++y]??""});else if(q==="--url")s=n[++y]??"";else if(q==="-G"||q==="--get")d=!0;else if(q==="-F"||q==="--form"){let k=n[++y]??"",O=k.indexOf("=");O>0&&p.push({key:k.slice(0,O),value:k.slice(O+1)})}else q==="--data-urlencode"?m.push(n[++y]??""):q==="-A"||q==="--user-agent"?o.push({key:"User-Agent",value:n[++y]??""}):q==="-e"||q==="--referer"||q==="--referrer"?o.push({key:"Referer",value:n[++y]??""}):q==="--compressed"||q==="-L"||q==="--location"||q==="-v"||q==="--verbose"||q==="-s"||q==="--silent"||q==="-i"||q==="--include"||q==="-k"||q==="--insecure"||q==="--http1.1"||q==="--http2"||q==="--http3"||(q==="-o"||q==="--output"||q==="--max-time"||q==="--connect-timeout"||q==="-m"||q==="--limit-rate"||q==="--proxy"||q==="-x"?y++:!q.startsWith("-")&&!s&&(s=q));y++}d?i="GET":i||(i=l!==null||p.length>0||m.length>0?"POST":"GET");let{cleanUrl:b,params:E}=a7(s),C=null;if(p.length>0)C={type:"raw",format:"text",content:p.map(k=>`${encodeURIComponent(k.key)}=${encodeURIComponent(k.value)}`).join("&")},o.some(k=>k.key.toLowerCase()==="content-type")||o.push({key:"Content-Type",value:"multipart/form-data"});else if(m.length>0)C={type:"raw",format:"text",content:m.join("&")},o.some(q=>q.key.toLowerCase()==="content-type")||o.push({key:"Content-Type",value:"application/x-www-form-urlencoded"});else if(l!==null){let q=l.trim(),k=c||q.startsWith("{")||q.startsWith("[");C={type:"raw",format:k?"json":"text",content:l},k&&!o.some(O=>O.key.toLowerCase()==="content-type")&&o.push({key:"Content-Type",value:"application/json"})}let v=o.map(q=>({...q,enabled:!0})),_=f7(o,E,b||s);return{name:l7(b||s),method:i.toUpperCase(),url:b||s,headers:v,queryParams:E,body:C,suggestedVars:_}}async function nM(t,e,r,n){let i=iM(t.items);if(i.length===0)return;let s=Math.ceil(i.length/10);for(let o=0;o<i.length;o+=10){let l=i.slice(o,o+10),c=Math.floor(o/10)+1;n?.(`Enhancing requests (batch ${c}/${s})\u2026`,1/s*100);let d=l.map(p=>({id:p.id,name:p.name,method:p.method??"GET",url:p.url??"",bodyContent:m7(p),responseSchema:p.responseSchema?JSON.stringify(p.responseSchema).slice(0,500):void 0,description:p.description?.slice(0,200)}));try{let p=await r.complete(d7(d)),m=p7(p);h7(l,m)}catch{}}await e.saveCollection(t)}function d7(t){return`You are an API testing expert. For each HTTP request below, return two improvements:
|
|
1021
|
+
[View HTML Report](${p[1]})`:"";return{content:[{type:"text",text:d+m}]}}case"prompts/list":return{prompts:$p};case"prompts/get":{let r=e.params??{},n=r.name,i=r.arguments??{};if(!n)throw new Error("Missing prompt name");let s=qn(t.workspaceFolder);try{return await Yy(n,i,s.collection,t.runStore)}finally{Hc(s)}}default:throw new Error(`Method not found: ${e.method}`)}}function X5(t,e,r){let n=!t.container,i=t.container??qn(t.workspaceFolder),s;try{s=i.config.getMcpConfig().cors.allowedOrigins??["http://localhost","http://127.0.0.1"]}finally{n&&Hc(i)}let o=e.headers.origin??"",l=s.includes(o)?o:s[0]??"http://localhost";r.setHeader("Access-Control-Allow-Origin",l),r.setHeader("Access-Control-Allow-Methods","POST, GET, OPTIONS"),r.setHeader("Access-Control-Allow-Headers","Content-Type, Mcp-Session-Id")}function e7(t,e,r){let i=new URL(e.url,`http://${t.host}:${t.port}`).searchParams.get("path");if(!i){r.statusCode=400,r.end("Missing path parameter");return}let s=Xo.resolve(i),o=t.container?.config.getResultsPath(),l=o?Xo.dirname(o):Xo.resolve(t.workspaceFolder,".http-forge",".cache");if(!s.startsWith(l+Xo.sep)||!s.endsWith(".html")){r.statusCode=403,r.end("Forbidden");return}VN.readFile(s,"utf-8",(c,d)=>{if(c){r.statusCode=404,r.end("Report not found");return}r.statusCode=200,r.setHeader("content-type","text/html; charset=utf-8"),r.end(d)})}function Vx(t,e,r,n){let i=t.create(e,r);return n().then(s=>{i.status!=="cancelled"&&(i.status="completed",i.completedAt=Date.now(),i.summary=s?.summary??i.summary,s?.failedRequests&&(i.failedRequests=s.failedRequests),s?.noAssertionExamples&&(i.noAssertionExamples=s.noAssertionExamples),i.reportPath=s?.report?.uri?.replace("file://","")??null,i.progress.completed=i.progress.total)}).catch(s=>{i.status!=="cancelled"&&(i.status="failed",i.completedAt=Date.now(),i.error=s.message)}),{runId:i.id,status:"running",total:r,message:"Run started. Use get_run_status to poll."}}function t7(t){let e=t.workspaceFolder;return{async runRequest(r,n,i){return Pi(()=>Rv({workspaceFolder:e,collectionId:r.id,requestId:n,environment:i.environment,variables:i.variables,headers:i.headers,query:i.query,body:i.body,include:i.include}))},async runFolder(r,n,i){let s=nt(r).filter(({folderPath:o})=>o===n||o.startsWith(`${n}/`)).length;return i.async===!0?Vx(t.runStore,`${r.name} / ${rs(n)}`,s,()=>Pi(()=>Vs({workspaceFolder:e,collectionId:r.id,folderPath:n,recursive:i.recursive,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,include:i.include}))):Pi(()=>Vs({workspaceFolder:e,collectionId:r.id,folderPath:n,recursive:i.recursive,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,include:i.include}))},async runCollection(r,n){let i=nt(r).length;return n.async===!0?Vx(t.runStore,r.name,i,()=>Pi(()=>Vs({workspaceFolder:e,collectionId:r.id,environment:n.environment,variables:n.variables,iterations:n.iterations,stopOnError:n.stopOnError,delay:n.delay,include:n.include}))):Pi(()=>Vs({workspaceFolder:e,collectionId:r.id,environment:n.environment,variables:n.variables,iterations:n.iterations,stopOnError:n.stopOnError,delay:n.delay,include:n.include}))},async runSuite(r,n,i){let s=qn(e),o=0;try{let l=await s.testSuite.getSuite(r);o=(l?.nodes.filter(d=>d.type==="request").length??0)*(i.iterations??l?.config?.iterations??1)}finally{Hc(s)}return i.async===!0?Vx(t.runStore,n,o,()=>Pi(()=>Fp({workspaceFolder:e,suiteId:r,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,requestFilter:i.requestFilter,include:i.include}))):Pi(()=>Fp({workspaceFolder:e,suiteId:r,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,requestFilter:i.requestFilter,include:i.include}))}}}async function zx(t,e,r={}){let n=t.workspaceFolder,i=Y5(t.container,e);if(Object.values(G).includes(i)){let l=qn(n);try{let c=await Gy(i,r,{collection:l.collection,testSuite:l.testSuite,environmentConfig:l.environmentConfig,workspaceFolder:n},t.runStore,t7(t));return r7.has(i)&&Wx.delete(n),c}finally{Hc(l)}}let s=tv(i),o=qn(n);try{let l=o.collection.getAllCollections(),c=l.map(b=>b.id),d=b=>{let q=vl(b,c),C=q?l.find(v=>v.id===q):void 0;if(!C)throw new Error(`Collection not found for tool: ${e}`);return C};if(s.kind==="request"){let[b,q]=s.tokens;if(!b||!q)throw new Error(`Malformed request tool: ${e}`);let C=d(b),v=nt(C).map(E=>E.request.id),_=vl(q,v);if(!_)throw new Error(`Request not found in collection "${C.name}" for tool: ${e}`);return Pi(()=>Rv({workspaceFolder:n,collectionId:C.id,requestId:_,environment:r.environment,variables:r.variables,headers:r.headers,query:r.query,body:r.body,include:r.include}))}if(s.kind==="collection"){let[b]=s.tokens;if(!b)throw new Error(`Malformed collection tool: ${e}`);let q=d(b);return Pi(()=>Vs({workspaceFolder:n,collectionId:q.id,environment:r.environment,variables:r.variables,iterations:r.iterations,stopOnError:r.stopOnError,delay:r.delay,include:r.include}))}if(s.kind==="folder"){let[b,q]=s.tokens;if(!b||!q)throw new Error(`Malformed folder tool: ${e}`);let C=d(b),v=(o.collection.getAllCollections().find(k=>k.id===C.id),void 0),_=nt(C).map(k=>k.folderPath).filter((k,O,M)=>k&&M.indexOf(k)===O),E=rv(q,_);if(!E)throw new Error(`Folder not found in collection "${C.name}" for tool: ${e}`);return Pi(()=>Vs({workspaceFolder:n,collectionId:C.id,folderPath:E,recursive:r.recursive,environment:r.environment,variables:r.variables,iterations:r.iterations,stopOnError:r.stopOnError,delay:r.delay,include:r.include}))}let[p]=s.tokens;if(!p)throw new Error(`Malformed suite tool: ${e}`);let m=await o.testSuite.getAllSuites(),y=vl(p,m.map(b=>b.id));if(!y)throw new Error(`Test suite not found for tool: ${e}`);return Pi(()=>Fp({workspaceFolder:n,suiteId:y,environment:r.environment,variables:r.variables,iterations:r.iterations,stopOnError:r.stopOnError,delay:r.delay,requestFilter:r.requestFilter,include:r.include}))}finally{Hc(o)}}function ql(t,e,r){t.statusCode=e,t.setHeader("content-type","application/json; charset=utf-8"),t.end(JSON.stringify(r))}function BN(t){return new Promise((e,r)=>{let n="";t.on("data",i=>{n+=i,n.length>1024*1024&&r(new Error("Request body too large (max 1MB)"))}),t.on("end",()=>{if(!n){e({});return}try{e(JSON.parse(n))}catch{r(new Error("Invalid JSON body"))}}),t.on("error",r)})}function n7(t){return(0,WN.createServer)(async(e,r)=>{try{if(X5(t,e,r),e.method==="OPTIONS"){r.statusCode=204,r.end();return}if(e.method==="GET"&&e.url==="/health"){ql(r,200,{status:"ok",port:t.port});return}if(e.method==="GET"&&e.url?.startsWith("/report?")){e7(t,e,r);return}if(e.method==="POST"&&(e.url==="/"||e.url==="/mcp")){let n;try{n=await BN(e)}catch{HN(r,null,-32700,"Parse error");return}try{let i=await Z5(t,n);ql(r,200,{jsonrpc:"2.0",id:n.id??null,result:i})}catch(i){HN(r,n.id??null,-32603,i.message||"Internal error")}return}if(e.method==="POST"&&e.url==="/tools/execute"){let n=await BN(e);if(!n||typeof n.name!="string"||n.name.trim()===""){ql(r,400,{error:'Field "name" is required'});return}let i=await zx(t,n.name,n.args??{});ql(r,200,{result:i});return}ql(r,405,{error:"Method not allowed"})}catch(n){ql(r,500,{error:n.message})}})}function i7(t){if(typeof t.port=="number"&&Number.isFinite(t.port))return Math.min(65535,Math.max(1,Math.floor(t.port)));let r=new ks(Xo.resolve(t.workspaceFolder)).getMcpConfig().port;return Math.min(65535,Math.max(1,Math.floor(r||3100)))}async function s7(t){let e=i7(t),r=t.host||"127.0.0.1",n=`${r}:${e}`,i={workspaceFolder:t.workspaceFolder,port:e,host:r,isRunning:!1,runStore:new $c};return z5.set(n,i),{async start(){if(i.isRunning)return;i.container||(i.container=qn(i.workspaceFolder));let s=n7(i);await new Promise((o,l)=>{s.once("error",l),s.listen(i.port,i.host,()=>{s.off("error",l),o()})}),i.server=s,i.isRunning=!0},async stop(){if(i.container&&(Hc(i.container),i.container=void 0),!i.server){i.isRunning=!1;return}await new Promise((s,o)=>{i.server.close(l=>{if(l){o(l);return}s()})}),i.server=void 0,i.isRunning=!1},isRunning(){return i.isRunning},getPort(){return i.port},async executeTool(s,o){return zx(i,s,o??{})}}}var VN,WN,Xo,z5,J5,Wx,Bx,r7,JN=ae(()=>{"use strict";VN=ve(require("fs")),WN=require("http"),Xo=ve(require("path"));ig();Uc();Oi();xx();Ex();qx();Ox();av();kp();vv();z5=new Map;J5=3e3,Wx=new Map,Bx=new Map;r7=Jy});var I7={};Rs(I7,{AmbiguousRefError:()=>Zo,AwsSecretResolver:()=>gp,AzureKeyVaultResolver:()=>yp,BODY_FILE_MAP:()=>BS,CACHE_BUSTING_TOOLS:()=>Jy,COLLECTION_INPUT_SCHEMA:()=>Op,CONFIG_FILES:()=>ko,CollectionLoader:()=>Ia,CollectionLoaderFactory:()=>Xu,CollectionRequestExecutor:()=>As,CollectionService:()=>ec,ConfigService:()=>ks,CookieJar:()=>Su,CookieService:()=>tc,CookieUtils:()=>Rt,DEFAULT_CONFIG:()=>tr,DEFAULT_REQUEST_SETTINGS:()=>on,DEFAULT_SUITE_CONFIG:()=>Go,DYNAMIC_VARIABLES:()=>ew,DataFileParser:()=>Io,DopplerResolver:()=>wp,EnvironmentConfigService:()=>nc,EnvironmentResolver:()=>Bi,ExampleGenerator:()=>al,FOLDER_INPUT_SCHEMA:()=>Ip,FetchHttpClient:()=>Ju,FolderCollectionLoader:()=>vu,FolderCollectionStore:()=>Cs,ForgeContainer:()=>rg,ForgeEnv:()=>xs,GENERIC_TOOL_NAMES:()=>G,GcpSecretResolver:()=>Sp,GraphQLSchemaService:()=>sc,HTTP_METHOD_MAP:()=>dv,HTTP_METHOD_REVERSE:()=>Bs,HashiCorpVaultResolver:()=>vp,HistoryAnalyzer:()=>Xa,HtmlReportGenerator:()=>jc,HttpForgeParser:()=>Oo,HttpRequestService:()=>Wi,InMemoryCookieJar:()=>bl,InterceptorChain:()=>zi,JUnitReportGenerator:()=>wl,JsonCollectionLoader:()=>Qa,LoggingRequestInterceptor:()=>um,MCP_PROMPTS:()=>$p,METADATA_FILES:()=>Rr,McpRunStore:()=>$c,ModuleLoader:()=>cd,NodeFileSystem:()=>Gu,NodeHttpClient:()=>Eo,OAuth2TokenManager:()=>Qu,OnePasswordResolver:()=>bp,OpenApiExporter:()=>ol,OpenApiImporter:()=>Hs,ParserRegistry:()=>bu,PersistentCookieJar:()=>rc,REQUEST_INPUT_SCHEMA:()=>qp,ROOT_DIRECTORIES:()=>Ps,RefResolver:()=>ml,RequestExecutor:()=>Ga,RequestHistoryService:()=>oc,RequestHistoryStore:()=>zu,RequestPreparer:()=>ic,RequestPreprocessor:()=>qo,RequestScriptSession:()=>Wu,ResultStorageService:()=>Cl,RetryErrorInterceptor:()=>fm,SCHEMA_FILES:()=>yu,SCRIPTS_DIR:()=>en,SCRIPT_FILES:()=>Ef,SUITE_INPUT_SCHEMA:()=>Pp,SchemaInferenceService:()=>gl,SchemaInferrer:()=>Ns,ScriptAnalyzer:()=>yl,ScriptExecutor:()=>Ki,SecretResolverRegistry:()=>Ac,ServiceContainer:()=>Yo,ServiceIdentifiers:()=>oe,StatisticsService:()=>Ev,TestSuiteService:()=>Tc,TestSuiteStore:()=>qv,TimingResponseInterceptor:()=>cm,UrlBuilder:()=>Hn,VariableInterpolator:()=>vo,VariableResolver:()=>yo,applyEnvSuggestionsToItems:()=>Wy,applyExtractionPlan:()=>AP,applyFilterChain:()=>xu,augmentWithDynamicVars:()=>mo,bootstrapNodeRuntime:()=>Dx,buildCollectionToolDescription:()=>iv,buildCollectionToolName:()=>Zy,buildExtractionPlan:()=>kP,buildFolderToolDescription:()=>sv,buildFolderToolName:()=>Xy,buildGenericTools:()=>zy,buildMcpToolList:()=>fv,buildPromptResult:()=>Yy,buildRequestToolDescription:()=>nv,buildRequestToolName:()=>Qy,buildResultFileName:()=>Sl,buildSuiteToolDescription:()=>ov,buildSuiteToolName:()=>ev,cleanupOldBodyFiles:()=>zS,concatenateScripts:()=>pd,countRequests:()=>By,createExpectChain:()=>za,createLodashShim:()=>U0,createMcpRuntime:()=>GN,createModuleLoader:()=>zm,createMomentShim:()=>fd,createNodeContainer:()=>qn,createResponseObject:()=>dd,createScriptConsole:()=>vP,createTestFunction:()=>Ym,createVariableResolver:()=>kq,decodeCursor:()=>cv,decodeFolderName:()=>yx,decodeFolderPath:()=>rs,dedupeToolsByName:()=>lv,deepClone:()=>yq,deleteItemFromTree:()=>Xh,deserializeTypedRecord:()=>hv,deserializeTypedValue:()=>xl,detectEnvSuggestions:()=>Ep,detectSensitiveData:()=>PP,dispatchGenericTool:()=>Gy,encodeCursor:()=>uv,encodeFolderName:()=>vr,enhanceCollection:()=>nM,enumerateFolders:()=>Vr,evaluateExpression:()=>ui,expandSummary:()=>RN,exportCollectionToRestClient:()=>xP,findItemById:()=>Zh,flattenRequests:()=>nt,formatBytes:()=>Sq,formatConsoleOutput:()=>Ja,formatDuration:()=>wq,generateId:()=>Ot,generateSlug:()=>_n,generateUUID:()=>Qh,getCompletions:()=>uM,getRestClientExportFolder:()=>CP,getServiceContainer:()=>wx,hasChanged:()=>Vu,isExpression:()=>go,isPlainObject:()=>vq,isSystemEnvironmentFile:()=>If,loadEnvironmentsFromFolder:()=>wu,mcpToolSegment:()=>Qo,mcpToolToken:()=>ss,mergeHeadersCaseInsensitive:()=>gu,mergeRequestSettings:()=>XN,normalizeFolderInput:()=>_p,normalizeHeaders:()=>Km,parseCurlCommand:()=>rM,parseFilterChain:()=>Cu,parseMcpToolName:()=>tv,parsePostmanEnvironment:()=>vd,parsePostmanEnvironmentFile:()=>OP,parseQueryContext:()=>lM,prepareBodyForSave:()=>WS,readBodyFromDir:()=>VS,readSchemaFile:()=>JS,readScriptsFromDir:()=>qf,redactBody:()=>lg,redactFullResponse:()=>cg,redactFullResultDetails:()=>fg,redactHeaders:()=>gi,redactHistoryEntry:()=>ug,redactUrl:()=>wd,registerCoreServices:()=>Rp,resolveCollectionRef:()=>bv,resolveDynamicVariable:()=>Vi,resolveDynamicVariablesInString:()=>Iq,resolveFolderRef:()=>Sv,resolveFolderToken:()=>rv,resolveRequestRef:()=>wv,resolveToken:()=>vl,runCollection:()=>KN,runFolder:()=>QN,runRequest:()=>YN,runSuite:()=>ZN,safeJsonParse:()=>bq,sanitizeName:()=>Ht,scanCollectionForEnvVarsWithAi:()=>sM,searchForItemPath:()=>em,searchForItemPathById:()=>tm,serializeTypedValue:()=>Lc,sortItemsByOrder:()=>YS,writeEnvFile:()=>Ka,writeFolderItems:()=>yd,writeSchemaFiles:()=>GS,writeScriptFile:()=>Zu,writeScriptsToDir:()=>Of});module.exports=Oa(I7);var Ia=class{constructor(e,r){this.fileSystem=e;this.parserRegistry=r}fileSystem;parserRegistry;directory;setDirectory(e){this.directory=e}async loadAll(){return this.directory?this.loadDirectory(this.directory):[]}async load(e,r={}){let n=await this.fileSystem.readFile(e);if(r.format){let s=this.parserRegistry.get(r.format);if(!s)throw new Error(`No parser registered for format: ${r.format}`);return s.parse(n,e)}let i=this.parserRegistry.detect(n);if(!i)throw new Error(`Could not detect collection format for: ${e}. Supported formats: ${this.parserRegistry.getFormats().join(", ")}`);return i.parser.parse(n,e)}async loadDirectory(e,r=["*.json","*.forge.json"]){let n=[],i=await this.fileSystem.glob(r,e);for(let s of i)try{let o=await this.load(s);n.push(o)}catch{}return n}async canLoad(e){try{if(!await this.fileSystem.exists(e))return!1;let r=await this.fileSystem.readFile(e);return this.parserRegistry.detect(r)!==null}catch{return!1}}getSupportedFormats(){return this.parserRegistry.getFormats()}};rm();Pa();function KS(t,e){return{id:t.id,name:t.name,description:t.description,variables:t.variables||{},auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(_q),source:{format:"folder",filePath:e,version:t.version}}}function _q(t){if(t.type==="folder")return{type:"folder",id:t.id,name:t.name,description:t.description,auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(_q)};let e=t;return{type:"request",id:e.id,name:e.name,description:e.description,method:e.method||"GET",url:e.url||"",headers:e.headers||[],query:e.query||[],params:e.params,body:e.body??void 0,auth:e.auth,settings:e.settings,scripts:e.scripts,...e.deprecated&&{deprecated:e.deprecated},...e.doc&&{doc:e.doc},...e.responseSchema&&{responseSchema:e.responseSchema},...e.bodySchema&&{bodySchema:e.bodySchema},...e.operationId&&{operationId:e.operationId},...e.summary&&{summary:e.summary},...e.tags&&e.tags.length>0&&{tags:e.tags},...e.examples&&e.examples.length>0&&{examples:e.examples},...e.responses&&Object.keys(e.responses).length>0&&{responses:e.responses},...e.security&&e.security.length>0&&{security:e.security}}}function h2(t){return{id:t.id,name:t.name,description:t.description,version:t.source?.version,variables:t.variables,auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(QS)}}function QS(t){return t.type==="folder"?{type:"folder",id:t.id,name:t.name,description:t.description,auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(QS)}:{type:"request",id:t.id,name:t.name,description:t.description,method:t.method,url:t.url,headers:t.headers,query:t.query,params:t.params,body:t.body,auth:t.auth,settings:t.settings,scripts:t.scripts,...t.deprecated&&{deprecated:t.deprecated},...t.doc&&{doc:t.doc},...t.responseSchema&&{responseSchema:t.responseSchema},...t.bodySchema&&{bodySchema:t.bodySchema},...t.operationId&&{operationId:t.operationId},...t.summary&&{summary:t.summary},...t.tags&&{tags:t.tags},...t.examples&&{examples:t.examples},...t.responses&&{responses:t.responses},...t.security&&{security:t.security}}}var vu=class{store;constructor(e){this.store=new Cs(e)}loadAll(){return this.store.loadAll().map(r=>KS(r,this.store.getCollectionPath(r.id)))}getSlugById(e){return this.store.getSlugById(e)}getIdBySlug(e){return this.store.getIdBySlug(e)}load(e){let r=this.store.load(e);if(r)return KS(r,this.store.getCollectionPath(r.id))}async create(e,r){let n=await this.store.create(e,r);return KS(n,this.store.getCollectionPath(n.id))}async save(e){return this.store.save(h2(e))}async delete(e){return this.store.delete(e)}exists(e){return this.store.exists(e)}getCollectionPath(e){return this.store.getCollectionPath(e)}async updateCollectionMetadata(e,r){return this.store.updateCollectionMetadata(e,r)}async saveItem(e,r,n){return this.store.saveItem(e,QS(r),n)}async updateItem(e,r,n){let i={...n};return this.store.updateItem(e,r,i)}async deleteItem(e,r){return this.store.deleteItem(e,r)}async moveItem(e,r,n){return this.store.moveItem(e,r,n)}async reorderItems(e,r,n){return this.store.reorderItems(e,r,n)}async saveScripts(e,r,n){return this.store.saveScripts(e,r,n)}loadScripts(e,r){return this.store.loadScripts(e,r)}};var bu=class{parsers=new Map;register(e,r){this.parsers.set(e.toLowerCase(),r)}get(e){return this.parsers.get(e.toLowerCase())}has(e){return this.parsers.has(e.toLowerCase())}getFormats(){return Array.from(this.parsers.keys())}detect(e){for(let[r,n]of this.parsers)if(n.canParse(e))return{parser:n,format:r};return null}clear(){this.parsers.clear()}};ka();var Su=class{cookies=new Map;getCookieKey(e,r,n){return`${r||"*"}|${n||"/"}|${e}`}get(e,r){if(r){let s=this.getCookieKey(e,r),o=this.cookies.get(s);if(o&&!this.isExpired(o))return o}let n=this.getCookieKey(e,"*"),i=this.cookies.get(n);if(i&&!this.isExpired(i))return i;for(let s of this.cookies.values())if(s.name===e&&!this.isExpired(s))if(r&&s.domain){if(this.domainMatches(r,s.domain))return s}else return s}set(e){let r=this.getCookieKey(e.name,e.domain,e.path);this.cookies.set(r,e)}setFromResponse(e){for(let r of e){let n=this.getCookieKey(r.name,r.domain,r.path);this.cookies.set(n,r)}}has(e,r){return this.get(e,r)!==void 0}delete(e,r,n){let i=this.getCookieKey(e,r,n);return this.cookies.delete(i)}getAll(e){let r=[];for(let n of this.cookies.values())this.isExpired(n)||(e?(!n.domain||this.domainMatches(e,n.domain))&&r.push(n):r.push(n));return r}getCookieHeader(e){let r=this.getAll(e);return Rt.formatCookieHeader(r)}clear(){this.cookies.clear()}clearDomain(e){let r=[];for(let[n,i]of this.cookies.entries())i.domain&&this.domainMatches(e,i.domain)&&r.push(n);for(let n of r)this.cookies.delete(n)}parseCookieHeaders(e,r){return Rt.parseCookieHeaders(e,r)}isExpired(e){return Rt.isExpired(e)}domainMatches(e,r){return Rt.domainMatches(e,r)}get count(){return this.cookies.size}cleanExpiredCookies(){let e=[];for(let[r,n]of this.cookies.entries())this.isExpired(n)&&e.push(r);for(let r of e)this.cookies.delete(r)}};im();var Bi=class t{config;selectedEnvironment;sessionGlobals={};sessionEnvironmentValues=new Map;constructor(e){this.config=e,this.selectedEnvironment=e.selectedEnvironment||Object.keys(e.environments)[0]||"default"}get(e){return this.getVariables()[e]}set(e,r){let n=this.sessionEnvironmentValues.get(this.selectedEnvironment);n||(n={},this.sessionEnvironmentValues.set(this.selectedEnvironment,n)),n[e]=r}getAll(){return this.getVariables()}getEnvironments(){return Object.keys(this.config.environments)}getActive(){return this.selectedEnvironment}setActive(e){if(!this.config.environments[e])throw new Error(`Environment not found: ${e}`);this.selectedEnvironment=e}getVariables(e){let r=e||this.selectedEnvironment,n=this.config.environments[r],i={...this.config.globalVariables||{},...this.sessionGlobals};if(n){if(n.inherits&&this.config.environments[n.inherits]){let o=this.getEnvironmentVariables(n.inherits);i={...i,...o}}i={...i,...n.variables};let s=this.sessionEnvironmentValues.get(r);s&&(i={...i,...s})}return i}getEnvironmentVariables(e){let r=this.config.environments[e];if(!r)return{};let n={};return r.inherits&&this.config.environments[r.inherits]&&(n={...this.getEnvironmentVariables(r.inherits)}),{...n,...r.variables}}getGlobals(){return{...this.config.globalVariables||{},...this.sessionGlobals}}setGlobal(e,r){this.sessionGlobals[e]=r}unsetGlobal(e){delete this.sessionGlobals[e]}clearGlobals(){this.sessionGlobals={}}resolve(e){let r=e||this.selectedEnvironment;return{name:r,merged:this.getVariables(r),globals:this.getGlobals()}}static fromVariables(e,r="default"){return new t({environments:{[r]:{name:r,variables:e}},selectedEnvironment:r})}};_u();Af();var xs=class t{envStore;interpolator;urlBuilder;constructor(e,r){this.envStore=e,this.interpolator=r||new vo,this.urlBuilder=new Hn}get(e){return this.envStore.get(e)}set(e,r){this.envStore.set(e,r)}has(e){return this.envStore.get(e)!==void 0}delete(e){this.envStore.set(e,"")}getAll(){return this.envStore.getAll()}getActiveEnvironment(){return this.envStore.getActive()}setActiveEnvironment(e){this.envStore.setActive(e)}getEnvironments(){let e=this.envStore;return typeof e.getEnvironments=="function"?e.getEnvironments():[]}getGlobals(){let e=this.envStore;return typeof e.getGlobals=="function"?e.getGlobals():{}}setGlobal(e,r){let n=this.envStore;typeof n.setGlobal=="function"&&n.setGlobal(e,r)}unsetGlobal(e){let r=this.envStore;typeof r.unsetGlobal=="function"&&r.unsetGlobal(e)}clearGlobals(){let e=this.envStore;typeof e.clearGlobals=="function"&&e.clearGlobals()}resolve(e){return this.interpolator.interpolate(e,this.getAll())}resolvePath(e,r={}){let n=this.interpolator.interpolate(e,this.getAll());return this.urlBuilder.buildUrl(n,r)}buildUrl(e,r={}){let n=this.interpolator.interpolate(e,this.getAll());return this.urlBuilder.buildUrl(n,r.params||{},r.query||{})}resolveObject(e){return this.interpolator.interpolateObject(e,this.getAll())}extractVariables(e){return this.interpolator.extractVariables(e)}extractPathParams(e){return this.urlBuilder.extractPathParams(e)}static create(e={}){let r=Bi.fromVariables(e);return new t(r)}static fromResolver(e){return new t(e)}};Af();Tf();$f();_u();md();hd();var Ga=class{constructor(e,r,n,i,s){this.httpClient=e;this.forgeEnv=r;this.cookieJar=n;this.preprocessor=i;if(s?.scriptExecutor)this.scriptExecutor=s.scriptExecutor;else{let o=s?.forgeRoot?[require("path").join(s.forgeRoot,"modules")]:[],l=new Wi(new Hn,new zi,e);this.scriptExecutor=new Ki(l,o,void 0,s?.scriptScope??"shared",s?.scriptTimeout??5e3)}}httpClient;forgeEnv;cookieJar;preprocessor;scriptExecutor;async execute(e,r,n={}){let i=Date.now(),s={...this.forgeEnv.getAll()},o={...this.forgeEnv.getGlobals()},l={...n.additionalVariables||{}},c={...s},d=this.buildHttpRequest(e,n.overrides),p=n.overrides?.body||e.body,m=this.findFolderPath(r,e.id),y=this.buildScriptChain(e,r,m),b={request:{url:d.url,method:d.method,headers:{...d.headers},body:p?typeof p=="string"?{type:"raw",content:p}:p:void 0},variables:l,collectionVariables:r.variables||{},globals:{...o},environmentVariables:c,environmentName:this.forgeEnv.getActiveEnvironment?.()||void 0,cookieJar:this.cookieJar,info:{eventName:"prerequest",requestName:e.name,requestId:e.id,collectionName:r?.name},onEnvironmentChange:n.onEnvironmentChange,onGlobalsChange:(_,E,k)=>{_==="set"&&E&&k!==void 0?this.forgeEnv.setGlobal(E,k):_==="unset"&&E?this.forgeEnv.unsetGlobal(E):_==="clear"&&this.forgeEnv.clearGlobals()}},q=this.scriptExecutor.createRequestSession(b),C,v;try{if(!n.skipPreRequest&&y.preRequest.length>0){let O=await q.executePreRequest(y.preRequest);if(C={success:O.success,error:O.error,modifiedVariables:O.modifiedVariables,modifiedEnvironment:O.modifiedEnvironmentVariables,modifiedGlobals:O.modifiedGlobals,modifiedCollectionVariables:O.modifiedCollectionVariables,consoleOutput:O.consoleOutput,modifiedRequest:O.modifiedRequest?{url:O.modifiedRequest.url,method:O.modifiedRequest.method,headers:O.modifiedRequest.headers,body:O.modifiedRequest.body?.content}:void 0},O.modifiedVariables&&(l={...l,...O.localVariables??O.modifiedVariables}),O.modifiedEnvironmentVariables&&(c={...c,...O.modifiedEnvironmentVariables}),O.modifiedRequest){let M=O.modifiedRequest;M.url&&(d.url=M.url),M.method&&(d.method=M.method),M.headers&&(d.headers={...d.headers,...M.headers}),M.body!==void 0&&(d.body=M.body?.content||M.body)}if(!O.success)throw new Error(`Pre-request script failed: ${O.error}`)}let _={...c,...l};d=this.interpolateRequest(d,_);let E=n.overrides?.body||e.body;if(this.preprocessor&&E&&typeof E!="string"&&E.type==="graphql"&&d.body!==void 0){let O=this.preprocessor.encodeBody({type:"graphql",content:d.body});O!=null&&(d.body=typeof O=="string"?O:JSON.stringify(O))}if(p&&typeof p=="object"&&p.type==="form-data"&&Array.isArray(d.body)){let O=this.buildMultipartFormData({type:"form-data",content:d.body});O&&(d.body=O)}let k=await this.httpClient.send(d);if(!n.skipPostResponse&&y.postResponse.length>0){let O=await q.executePostResponse(y.postResponse,{status:k.status,statusText:k.statusText,headers:k.headers,body:k.body,cookies:Qm(k.headers,k.cookies,d.url),responseTime:k.time,responseSize:k.size,executedRequest:{url:d.url,method:d.method,headers:d.headers||{},body:d.body?typeof d.body=="string"?{type:"raw",content:d.body}:d.body:{type:"none",content:""},params:{},query:{}}});v={success:!0,assertions:O.testResults,consoleOutput:O.consoleOutput,modifiedEnvironment:O.modifiedEnvironmentVariables},O.modifiedEnvironmentVariables&&(c={...c,...O.modifiedEnvironmentVariables})}return{response:k,preRequestResult:C,postResponseResult:v,totalTime:Date.now()-i,finalRequest:d,variables:{environment:c,local:l}}}finally{q.dispose?.()}}async executeSimple(e,r={}){let n=e,i={...this.forgeEnv.getAll(),...r.variables||{}};return n=this.interpolateRequest(e,i),r.timeout&&(n={...n,timeout:r.timeout}),this.httpClient.send(n)}buildHttpRequest(e,r){let n=e.url;if(e.query&&e.query.length>0){let p=new URLSearchParams;for(let m of e.query)m.enabled!==!1&&p.append(m.key,m.value);n+=(n.includes("?")?"&":"?")+p.toString()}let i=r?.url||n,s=r?.method||e.method,o={};if(e.headers&&Array.isArray(e.headers))for(let p of e.headers)p.enabled!==!1&&(o[p.key]=p.value);let l={...o,...r?.headers||{}},c,d=r?.body||e.body;if(d)if(typeof d=="string")c=d;else if(this.preprocessor&&d.type)if(d.type==="graphql")c=typeof d.content=="string"?d.content:JSON.stringify(d.content);else if(d.type==="form-data")c=this.buildMultipartFormData(d);else{let p=this.preprocessor.encodeBody(d);c=p!=null?String(p):void 0}else d.content&&(c=typeof d.content=="string"?d.content:JSON.stringify(d.content));return this.preprocessor&&d&&d.type!=="form-data"&&this.preprocessor.setContentTypeHeader(l,d),{url:i,method:s,headers:l,body:c,timeout:r?.timeout||e.settings?.timeout,settings:{...e.settings,...r?.settings}}}interpolateRequest(e,r){let n=xs.create(r),i=e.body,s=i;return typeof i=="string"?s=n.resolve(i):i instanceof FormData||i instanceof URLSearchParams?s=i:i&&typeof i=="object"&&(s=n.resolve(i)),{...e,url:n.resolvePath(e.url),headers:n.resolveObject(e.headers),body:s}}buildMultipartFormData(e){if(!e||e.type!=="form-data"||!Array.isArray(e.content))return;let r=new FormData;for(let n of e.content)!n?.key||n.enabled===!1||r.append(n.key,n.value==null?"":String(n.value));return r}buildScriptChain(e,r,n=[]){let i=[],s=[];r.scripts?.preRequest&&i.push(r.scripts.preRequest),r.scripts?.postResponse&&s.push(r.scripts.postResponse);for(let o of n)o.scripts?.preRequest&&i.push(o.scripts.preRequest),o.scripts?.postResponse&&s.push(o.scripts.postResponse);return e.scripts?.preRequest&&i.push(e.scripts.preRequest),e.scripts?.postResponse&&s.push(e.scripts.postResponse),{preRequest:i,postResponse:s}}findFolderPath(e,r){let n=[],i=(s,o)=>{for(let l of s){if(l.type==="request"&&l.id===r)return n.push(...o),!0;if(l.type==="folder"){let c=[...o,l];if(i(l.items,c))return!0}}return!1};return i(e.items,[]),n}};function Mz(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}var zu=class{entries=new Map;requestIndex=new Map;fullResponses=new Map;maxEntriesPerRequest;storeFullResponses;constructor(e={}){this.maxEntriesPerRequest=e.maxEntriesPerRequest??100,this.storeFullResponses=e.storeFullResponses??!0}getEntries(e,r){let n=this.requestIndex.get(e)||[],i=[];for(let s of n){let o=this.entries.get(s);o&&(!r||o.environment===r)&&i.push(o)}return i}getEntry(e){return this.entries.get(e)}getFullResponse(e){return this.fullResponses.get(e)}get count(){return this.entries.size}addEntry(e,r,n,i,s){let o=Mz(),l=Date.now(),c={id:o,timestamp:l,environment:i,method:r.method,ticket:s?.ticket,branch:s?.branch,note:s?.note,sentRequest:{url:r.url,method:r.method,headers:{...r.headers},body:r.body},response:{status:n.status,statusText:n.statusText,time:n.time}};this.entries.set(o,c);let d=this.requestIndex.get(e)||[];for(d.unshift(o);d.length>this.maxEntriesPerRequest;){let p=d.pop();p&&(this.entries.delete(p),this.fullResponses.delete(p))}if(this.requestIndex.set(e,d),this.storeFullResponses){let p={timestamp:l,status:n.status,statusText:n.statusText,headers:{...n.headers},cookies:n.cookies||[],body:n.body,time:n.time};this.fullResponses.set(o,p)}return c}deleteEntry(e){if(!this.entries.get(e))return!1;this.entries.delete(e),this.fullResponses.delete(e);for(let[n,i]of this.requestIndex.entries()){let s=i.indexOf(e);if(s!==-1){i.splice(s,1),i.length===0&&this.requestIndex.delete(n);break}}return!0}clearHistory(e){let r=this.requestIndex.get(e);if(r){for(let n of r)this.entries.delete(n),this.fullResponses.delete(n);this.requestIndex.delete(e)}}clearAll(){this.entries.clear(),this.requestIndex.clear(),this.fullResponses.clear()}};var Ju=class{async send(e){let r=Date.now(),n=new AbortController,i=e.timeout??3e4,s=setTimeout(()=>n.abort(),i);try{let o={method:e.method,headers:e.headers,signal:n.signal};e.body!==void 0&&!["GET","HEAD"].includes(e.method.toUpperCase())&&(typeof e.body=="string"||e.body instanceof FormData||e.body instanceof URLSearchParams?o.body=e.body:typeof e.body=="object"&&(o.body=JSON.stringify(e.body),!e.headers?.["Content-Type"]&&!e.headers?.["content-type"]&&(o.headers["Content-Type"]="application/json"))),e.settings?.followRedirects===!1&&(o.redirect="manual");let l=await fetch(e.url,o),c=Date.now(),d;try{d=await l.text()}catch{d=null}let p={};return l.headers.forEach((m,y)=>{let b=p[y];b!==void 0?p[y]=Array.isArray(b)?[...b,m]:[b,m]:p[y]=m}),{status:l.status,statusText:l.statusText,headers:p,cookies:[],body:d,time:c-r}}catch(o){throw o.name==="AbortError"?new Error(`Request timeout after ${i}ms`):o}finally{clearTimeout(s)}}};Tf();$f();gd();eg();_u();var Oo=class{format="http-forge";canParse(e){try{let r=JSON.parse(e);return typeof r=="object"&&r!==null&&"id"in r&&"name"in r&&"items"in r&&Array.isArray(r.items)&&!r.info?.schema?.includes("postman")&&!r._type}catch{return!1}}parse(e,r){let n=JSON.parse(e);return{id:n.id,name:n.name,description:n.description,variables:n.variables||{},auth:n.auth,scripts:n.scripts?{preRequest:n.scripts.preRequest,postResponse:n.scripts.postResponse}:void 0,items:this.convertItems(n.items),source:{format:"http-forge",filePath:r,version:n.version}}}convertItems(e){return e.map(r=>r.type==="folder"?this.convertFolder(r):this.convertRequest(r))}convertFolder(e){return{type:"folder",id:e.id,name:e.name,description:e.description,auth:e.auth,scripts:e.scripts?{preRequest:e.scripts.preRequest,postResponse:e.scripts.postResponse}:void 0,items:e.items?this.convertItems(e.items):[]}}convertRequest(e){let r={};if(e.headers)for(let i of e.headers)i.enabled!==!1&&(r[i.key]=i.value);let n={};if(e.query)for(let i of e.query)i.enabled!==!1&&(n[i.key]=i.value);return{type:"request",id:e.id,name:e.name,description:e.description,method:e.method||"GET",url:e.url||"",headers:Object.entries(r).map(([i,s])=>({key:i,value:s,enabled:!0})),query:Object.entries(n).map(([i,s])=>({key:i,value:s,enabled:!0})),params:e.params,body:e.body,auth:e.auth,settings:e.settings,scripts:e.scripts?{preRequest:e.scripts.preRequest,postResponse:e.scripts.postResponse}:void 0}}};tg();var Rn=ve(require("fs/promises")),Yu=ve(require("path")),Gu=class{async readFile(e){return Rn.readFile(e,"utf-8")}async writeFile(e,r){let n=Yu.dirname(e);await this.mkdir(n),await Rn.writeFile(e,r,"utf-8")}async exists(e){try{return await Rn.access(e),!0}catch{return!1}}async mkdir(e){await Rn.mkdir(e,{recursive:!0})}async glob(e,r){let n=r||process.cwd(),i=[];try{await this.walkDirectory(n,s=>{let o=Yu.basename(s);for(let l of e)if(this.matchPattern(o,l)){i.push(s);break}})}catch{}return i}async readDir(e){return Rn.readdir(e)}async isDirectory(e){try{return(await Rn.stat(e)).isDirectory()}catch{return!1}}async walkDirectory(e,r){let n=await Rn.readdir(e,{withFileTypes:!0});for(let i of n){let s=Yu.join(e,i.name);i.isDirectory()?await this.walkDirectory(s,r):i.isFile()&&r(s)}}matchPattern(e,r){let n=r.replace(/\./g,"\\.").replace(/\*/g,".*");return new RegExp(`^${n}$`,"i").test(e)}};md();var rg=class t{httpClient;fileSystem;scriptExecutor;interpolator;cookieJar;interceptorChain;preprocessor;dataFileParser;requestHistory;parserRegistry;collectionLoader;environmentStore;forgeEnv;requestExecutor;options;constructor(e={}){if(this.options=e,this.interpolator=e.interpolator||new vo,this.fileSystem=e.fileSystem||new Gu,this.preprocessor=e.preprocessor||new qo,this.dataFileParser=e.dataFileParser||new Io,this.cookieJar=e.cookieJar||new Su,e.enableHistory?this.requestHistory=e.requestHistory||new zu({maxEntriesPerRequest:e.maxHistoryEntries??100}):this.requestHistory=null,this.interceptorChain=e.interceptorChain||this.createInterceptorChain(e),e.httpClient)this.httpClient=e.httpClient;else if(e.useNativeHttp!==!1){let s={...e.httpSettings,timeout:e.requestTimeout??e.httpSettings?.timeout};this.httpClient=new Eo(s)}else this.httpClient=new Ju;let r=e.forgeRoot?[require("path").join(e.forgeRoot,"modules")]:[],n=new Wi(new Hn,this.interceptorChain,this.httpClient);if(this.scriptExecutor=e.scriptExecutor||new Ki(n,r,void 0,e.scriptScope??"shared",e.scriptTimeout??5e3),this.parserRegistry=new bu,this.parserRegistry.register("http-forge",new Oo),(e.storageFormat??"folder")==="folder"&&e.forgeRoot){let s=require("path").join(e.forgeRoot,"collections");this.collectionLoader=new vu(s)}else this.collectionLoader=new Ia(this.fileSystem,this.parserRegistry);this.environmentStore=e.environmentConfig?new Bi(e.environmentConfig):Bi.fromVariables({}),this.forgeEnv=xs.fromResolver(this.environmentStore),this.requestExecutor=new Ga(this.httpClient,this.forgeEnv,this.cookieJar,this.preprocessor,{forgeRoot:e.forgeRoot,scriptExecutor:this.scriptExecutor})}createInterceptorChain(e){let r=new zi;if(e.requestInterceptors)for(let n of e.requestInterceptors)r.addRequestInterceptor(n);if(e.responseInterceptors)for(let n of e.responseInterceptors)r.addResponseInterceptor(n);if(e.errorInterceptors)for(let n of e.errorInterceptors)r.addErrorInterceptor(n);return r}async loadCollection(e){if(this.collectionLoader instanceof Ia)return this.collectionLoader.load(e);throw new Error("loadCollection(filePath) is not supported with folder storage format. Use loadAllCollections() instead.")}async loadAllCollections(){return this.collectionLoader.loadAll()}async execute(e,r,n){return this.requestExecutor.execute(e,r,n)}async executeSimple(e,r){return this.requestExecutor.executeSimple(e,r)}registerParser(e,r){this.parserRegistry.register(e,r)}setEnvironmentConfig(e){this.environmentStore=new Bi(e),this.forgeEnv=xs.fromResolver(this.environmentStore),this.requestExecutor=new Ga(this.httpClient,this.forgeEnv,this.cookieJar,this.preprocessor,{forgeRoot:this.options.forgeRoot,scriptExecutor:this.scriptExecutor})}static create(e){return new t(e)}static fromForgeRoot(e="./http-forge",r={}){let n=require("path"),i=n.join(e,"environments"),s,o=wu(i);if(Object.keys(o.environments).length>0||Object.keys(o.globalVariables).length>0){s={globalVariables:{...o.globalVariables,...o.localVariables},environments:{},selectedEnvironment:void 0};for(let[c,d]of Object.entries(o.environments)){let p=o.localCredentials[c]?.variables||{};s.environments[c]={name:c,variables:{...d.variables,...p}}}}else{let c=require("fs"),d=n.join(i,"environments.json");if(c.existsSync(d))try{let p=c.readFileSync(d,"utf-8"),m=JSON.parse(p);if(s={globalVariables:m.globalVariables||{},environments:{},selectedEnvironment:m.selectedEnvironment},m.environments)for(let[y,b]of Object.entries(m.environments)){let q=b;s.environments[y]={name:q.name||y,variables:q.variables||{}}}}catch(p){console.warn(`[ForgeContainer] Failed to load environments from ${d}:`,p)}}return new t({...r,forgeRoot:e,storageFormat:r.storageFormat??"folder",environmentConfig:s})}};Sx();_x();Vy();Oi();xx();Ex();qx();Ox();av();kp();async function GN(t){let{createMcpRuntime:e}=await Promise.resolve().then(()=>(JN(),zN));return e(t)}async function YN(t){let{runRequest:e}=await Promise.resolve().then(()=>(Uc(),Dp));return e(t)}async function KN(t){let{runCollection:e}=await Promise.resolve().then(()=>(Uc(),Dp));return e(t)}async function QN(t){let{runFolder:e}=await Promise.resolve().then(()=>(Uc(),Dp));return e(t)}async function ZN(t){let{runSuite:e}=await Promise.resolve().then(()=>(Uc(),Dp));return e(t)}vv();r_();ka();Ix();n_();Tf();$f();gd();function XN(t){return{timeout:t?.timeout??on.timeout,followRedirects:t?.followRedirects??on.followRedirects,followOriginalMethod:t?.followOriginalMethod??on.followOriginalMethod,followAuthHeader:t?.followAuthHeader??on.followAuthHeader,maxRedirects:t?.maxRedirects??on.maxRedirects,strictSSL:t?.strictSSL??on.strictSSL,decompress:t?.decompress??on.decompress,includeCookies:t?.includeCookies??on.includeCookies,tls:t?.tls??on.tls,certificates:t?.certificates??on.certificates}}gd();eg();_u();H0();V0();md();Gm();hd();_d();Z0();e_();rm();Pa();Pa();Q0();function o7(t){let e=t.replace(/\\\n/g," "),r=[],n="",i=0;for(;i<e.length;){let s=e[i];if(s==="\\"&&i+1<e.length)n+=e[++i],i++;else if(s==="'"){for(i++;i<e.length&&e[i]!=="'";)n+=e[i++];i++}else if(s==='"'){for(i++;i<e.length&&e[i]!=='"';)if(e[i]==="\\"&&i+1<e.length){let o=e[i+1];o==='"'||o==="\\"||o==="$"||o==="`"?(n+=o,i+=2):n+=e[i++]}else n+=e[i++];i++}else/\s/.test(s)?(n.length>0&&(r.push(n),n=""),i++):(n+=s,i++)}return n.length>0&&r.push(n),r}function a7(t){try{let e="__FV__",r=[],n=t.replace(/\{\{[^}]+\}\}/g,p=>(r.push(p),`${e}${r.length-1}`)),i=n.indexOf("?");if(i===-1)return{cleanUrl:t,params:[]};let s=n.slice(0,i),o=n.slice(i+1),l=p=>p.replace(new RegExp(`${e}(\\d+)`,"g"),(m,y)=>r[parseInt(y,10)]),c=l(s),d=o.split("&").filter(Boolean).map(p=>{let m=l(p),y=m.indexOf("=");return y===-1?{key:m,value:"",enabled:!0}:{key:decodeURIComponent(m.slice(0,y)),value:decodeURIComponent(m.slice(y+1)),enabled:!0}});return{cleanUrl:c,params:d}}catch{return{cleanUrl:t,params:[]}}}function l7(t){try{let e=new URL(t.replace(/\{\{[^}]+\}\}/g,"placeholder")),r=e.pathname.split("/").filter(Boolean),n=r[r.length-1];return n&&!/^\d+$/.test(n)&&!n.startsWith("{")?n.replace(/[-_]/g," ").replace(/\b\w/g,i=>i.toUpperCase()):r.length>1?r[r.length-2].replace(/[-_]/g," ").replace(/\b\w/g,i=>i.toUpperCase()):e.hostname.replace(/^www\./,"").split(".")[0]??"Request"}catch{return"Request"}}var u7=new Set(["x-api-key","x-auth-token","x-access-token","x-token","x-secret","api-key","apikey","x-client-secret","x-rapidapi-key"]),c7=new Set(["api_key","apikey","api-key","access_token","token","auth_token","client_id","client_secret","key","secret"]);function eM(t){return t.toUpperCase().replace(/[^A-Z0-9]/g,"_")}function tM(t){return/\{\{[^}]+\}\}/.test(t)}function Cv(t,e=16){return t.length>=e&&!tM(t)}function f7(t,e,r){let n=[],i=new Set,s=(o,l)=>{i.has(l)||(i.add(l),n.push({key:o,value:l}))};for(let o of t){let l=o.key.toLowerCase();if(l==="authorization"){let c=o.value.match(/^(bearer|basic|token|digest)\s+(.+)$/i);c&&Cv(c[2])?s(`${c[1].toUpperCase()}_TOKEN`,c[2]):Cv(o.value)&&s("AUTH_TOKEN",o.value)}else u7.has(l)&&Cv(o.value)&&s(eM(o.key),o.value)}for(let o of e)c7.has(o.key.toLowerCase())&&Cv(o.value)&&s(eM(o.key),o.value);try{let o=new URL(r.replace(/\{\{[^}]+\}\}/g,"placeholder"));if(!["localhost","127.0.0.1","0.0.0.0","::1"].includes(o.hostname)&&!tM(r)){let c=`${o.protocol}//${o.host}`;s("BASE_URL",c)}}catch{}return n}function rM(t){let e=o7(t.trim()),r=0;for(;r<e.length&&e[r].toLowerCase()==="curl";)r++;let n=e.slice(r),i="",s="",o=[],l=null,c=!1,d=!1,p=[],m=[],y=0;for(;y<n.length;){let E=n[y];if(E==="-X"||E==="--request")i=n[++y]??"";else if(E==="-H"||E==="--header"){let k=n[++y]??"",O=k.indexOf(":");O>0&&o.push({key:k.slice(0,O).trim(),value:k.slice(O+1).trim()})}else if(E==="-d"||E==="--data"||E==="--data-raw"||E==="--data-binary"||E==="--data-ascii")l=n[++y]??"";else if(E==="--json")l=n[++y]??"",c=!0;else if(E==="-u"||E==="--user"){let k=n[++y]??"",O=btoa(k);o.push({key:"Authorization",value:`Basic ${O}`})}else if(E==="-b"||E==="--cookie")o.push({key:"Cookie",value:n[++y]??""});else if(E==="--url")s=n[++y]??"";else if(E==="-G"||E==="--get")d=!0;else if(E==="-F"||E==="--form"){let k=n[++y]??"",O=k.indexOf("=");O>0&&p.push({key:k.slice(0,O),value:k.slice(O+1)})}else E==="--data-urlencode"?m.push(n[++y]??""):E==="-A"||E==="--user-agent"?o.push({key:"User-Agent",value:n[++y]??""}):E==="-e"||E==="--referer"||E==="--referrer"?o.push({key:"Referer",value:n[++y]??""}):E==="--compressed"||E==="-L"||E==="--location"||E==="-v"||E==="--verbose"||E==="-s"||E==="--silent"||E==="-i"||E==="--include"||E==="-k"||E==="--insecure"||E==="--http1.1"||E==="--http2"||E==="--http3"||(E==="-o"||E==="--output"||E==="--max-time"||E==="--connect-timeout"||E==="-m"||E==="--limit-rate"||E==="--proxy"||E==="-x"?y++:!E.startsWith("-")&&!s&&(s=E));y++}d?i="GET":i||(i=l!==null||p.length>0||m.length>0?"POST":"GET");let{cleanUrl:b,params:q}=a7(s),C=null;if(p.length>0)C={type:"raw",format:"text",content:p.map(k=>`${encodeURIComponent(k.key)}=${encodeURIComponent(k.value)}`).join("&")},o.some(k=>k.key.toLowerCase()==="content-type")||o.push({key:"Content-Type",value:"multipart/form-data"});else if(m.length>0)C={type:"raw",format:"text",content:m.join("&")},o.some(E=>E.key.toLowerCase()==="content-type")||o.push({key:"Content-Type",value:"application/x-www-form-urlencoded"});else if(l!==null){let E=l.trim(),k=c||E.startsWith("{")||E.startsWith("[");C={type:"raw",format:k?"json":"text",content:l},k&&!o.some(O=>O.key.toLowerCase()==="content-type")&&o.push({key:"Content-Type",value:"application/json"})}let v=o.map(E=>({...E,enabled:!0})),_=f7(o,q,b||s);return{name:l7(b||s),method:i.toUpperCase(),url:b||s,headers:v,queryParams:q,body:C,suggestedVars:_}}async function nM(t,e,r,n){let i=iM(t.items);if(i.length===0)return;let s=Math.ceil(i.length/10);for(let o=0;o<i.length;o+=10){let l=i.slice(o,o+10),c=Math.floor(o/10)+1;n?.(`Enhancing requests (batch ${c}/${s})\u2026`,1/s*100);let d=l.map(p=>({id:p.id,name:p.name,method:p.method??"GET",url:p.url??"",bodyContent:m7(p),responseSchema:p.responseSchema?JSON.stringify(p.responseSchema).slice(0,500):void 0,description:p.description?.slice(0,200)}));try{let p=await r.complete(d7(d)),m=p7(p);h7(l,m)}catch{}}await e.saveCollection(t)}function d7(t){return`You are an API testing expert. For each HTTP request below, return two improvements:
|
|
1022
1022
|
1. "body" \u2014 a realistic, human-readable JSON request body string (not schema placeholders like "string" or 0). If the request has no body or is a GET/HEAD/DELETE, return null.
|
|
1023
1023
|
2. "testScript" \u2014 a JavaScript postResponse test using pm.test() syntax. Always include a status code check. Add response body assertions if a responseSchema is provided.
|
|
1024
1024
|
|