sentry 0.2.0 → 0.3.0
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/README.md +42 -3
- package/dist/bin.cjs +497 -0
- package/package.json +11 -4
- package/dist/bin.mjs +0 -218
package/dist/bin.mjs
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
var Uc=Object.create;var kn=Object.defineProperty;var zc=Object.getOwnPropertyDescriptor;var qc=Object.getOwnPropertyNames;var Wc=Object.getPrototypeOf,Vc=Object.prototype.hasOwnProperty;var Q=(t,e)=>()=>(t&&(e=t(t=0)),e);var oe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pn=(t,e)=>{for(var r in e)kn(t,r,{get:e[r],enumerable:!0})},Gc=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of qc(e))!Vc.call(t,s)&&s!==r&&kn(t,s,{get:()=>e[s],enumerable:!(n=zc(e,s))||n.enumerable});return t};var Zs=(t,e,r)=>(r=t!=null?Uc(Wc(t)):{},Gc(e||!t||!t.__esModule?kn(r,"default",{value:t,enumerable:!0}):r,t));import{createRequire as Yc}from"module";import{basename as Zc,dirname as $n,normalize as Kc,relative as Jc,resolve as Qc,sep as Qs}from"path";import*as Xc from"fs";function eu(t){let e=Kc(t);return e.length>1&&e[e.length-1]===Qs&&(e=e.substring(0,e.length-1)),e}function Xs(t,e){return t.replace(tu,e)}function nu(t){return t==="/"||ru.test(t)}function Dn(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:s}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=Qc(t)),(n||o)&&(t=eu(t)),t===".")return"";let i=t[t.length-1]!==s;return Xs(i?t+s:t,s)}function eo(t,e){return e+t}function su(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:Xs(Jc(t,n),e.pathSeparator)+e.pathSeparator+r}}function ou(t){return t}function iu(t,e,r){return e+t+r}function au(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?su(t,e):n?eo:ou}function cu(t){return function(e,r){r.push(e.substring(t.length)||".")}}function uu(t){return function(e,r,n){let s=e.substring(t.length)||".";n.every(o=>o(s,!0))&&r.push(s)}}function pu(t,e){let{includeDirs:r,filters:n,relativePaths:s}=e;return r?s?n&&n.length?uu(t):cu(t):n&&n.length?fu:lu:du}function xu(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?vu:r&&r.length?n?hu:mu:n?gu:yu}function _u(t){return t.group?bu:wu}function Ru(t){return t.group?Su:Eu}function Cu(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?Au:Tu}function to(t,e,r){if(r.options.useRealPaths)return ku(e,r);let n=$n(t),s=1;for(;n!==r.root&&s<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?s++:n=$n(n)}return r.symlinks.set(t,e),s>1}function ku(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Nr(t,e,r,n){e(t&&!n?t:null,r)}function Fu(t,e){let{onlyCounts:r,group:n,maxFiles:s}=t;return r?e?Pu:Ou:n?e?Du:Lu:s?e?ju:Nu:e?$u:Iu}function Hu(t){return t?Bu:Mu}function Wu(t,e){return new Promise((r,n)=>{so(t,e,(s,o)=>{if(s)return n(s);r(o)})})}function so(t,e,r){new no(t,e,r).start()}function Vu(t,e){return new no(t,e).start()}var Ks,tu,ru,lu,fu,du,hu,mu,gu,yu,vu,wu,bu,Su,Eu,Tu,Au,Pu,Du,$u,ju,Ou,Iu,Nu,Lu,ro,Mu,Bu,Uu,zu,qu,no,Js,oo,io,ao=Q(()=>{f();Ks=Yc(import.meta.url);tu=/[\\/]/g;ru=/^[a-z]:[\\/]$/i;lu=(t,e)=>{e.push(t||".")},fu=(t,e,r)=>{let n=t||".";r.every(s=>s(n,!0))&&e.push(n)},du=()=>{};hu=(t,e,r,n)=>{n.every(s=>s(t,!1))&&r.files++},mu=(t,e,r,n)=>{n.every(s=>s(t,!1))&&e.push(t)},gu=(t,e,r,n)=>{r.files++},yu=(t,e)=>{e.push(t)},vu=()=>{};wu=t=>t,bu=()=>[""].slice(0,0);Su=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},Eu=()=>{};Tu=function(t,e,r){let{queue:n,fs:s,options:{suppressErrors:o}}=e;n.enqueue(),s.realpath(t,(i,a)=>{if(i)return n.dequeue(o?null:i,e);s.stat(a,(c,u)=>{if(c)return n.dequeue(o?null:c,e);if(u.isDirectory()&&to(t,a,e))return n.dequeue(null,e);r(u,a),n.dequeue(null,e)})})},Au=function(t,e,r){let{queue:n,fs:s,options:{suppressErrors:o}}=e;n.enqueue();try{let i=s.realpathSync(t),a=s.statSync(i);if(a.isDirectory()&&to(t,i,e))return;r(a,i)}catch(i){if(!o)throw i}};Pu=t=>t.counts,Du=t=>t.groups,$u=t=>t.paths,ju=t=>t.paths.slice(0,t.options.maxFiles),Ou=(t,e,r)=>(Nr(e,r,t.counts,t.options.suppressErrors),null),Iu=(t,e,r)=>(Nr(e,r,t.paths,t.options.suppressErrors),null),Nu=(t,e,r)=>(Nr(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),Lu=(t,e,r)=>(Nr(e,r,t.groups,t.options.suppressErrors),null);ro={withFileTypes:!0},Mu=(t,e,r,n,s)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",ro,(i,a=[])=>{s(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},Bu=(t,e,r,n,s)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let i=[];try{i=o.readdirSync(e||".",ro)}catch(a){if(!t.options.suppressErrors)throw a}s(i,r,n)};Uu=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},zu=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},qu=class{aborted=!1;abort(){this.aborted=!0}},no=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=Fu(e,this.isSynchronous),this.root=Dn(t,e),this.state={root:nu(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new zu,options:e,queue:new Uu((n,s)=>this.callbackInvoker(s,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new qu,fs:e.fs||Xc},this.joinPath=au(this.root,e),this.pushDirectory=pu(this.root,e),this.pushFile=xu(e),this.getArray=_u(e),this.groupFiles=Ru(e),this.resolveSymlink=Cu(e,this.isSynchronous),this.walkDirectory=Hu(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:s,resolveSymlinks:o,excludeSymlinks:i,exclude:a,maxFiles:c,signal:u,useRealPaths:l,pathSeparator:d},controller:h}=this.state;if(h.aborted||u&&u.aborted||c&&n.length>c)return;let v=this.getArray(this.state.paths);for(let w=0;w<t.length;++w){let T=t[w];if(T.isFile()||T.isSymbolicLink()&&!o&&!i){let C=this.joinPath(T.name,e);this.pushFile(C,v,this.state.counts,s)}else if(T.isDirectory()){let C=iu(T.name,e,this.state.options.pathSeparator);if(a&&a(T.name,C))continue;this.pushDirectory(C,n,s),this.walkDirectory(this.state,C,C,r-1,this.walk)}else if(this.resolveSymlink&&T.isSymbolicLink()){let C=eo(T.name,e);this.resolveSymlink(C,this.state,(O,b)=>{if(O.isDirectory()){if(b=Dn(b,this.state.options),a&&a(T.name,l?b:C+d))return;this.walkDirectory(this.state,b,l?b:C+d,r-1,this.walk)}else{b=l?b:C;let N=Zc(b),I=Dn($n(b),this.state.options);b=this.joinPath(N,I),this.pushFile(b,v,this.state.counts,s)}})}}this.groupFiles(this.state.groups,e,v)}};Js=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return Wu(this.root,this.options)}withCallback(t){so(this.root,this.options,t)}sync(){return Vu(this.root,this.options)}},oo=null;try{Ks.resolve("picomatch"),oo=Ks("picomatch")}catch{}io=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:Qs,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new Js(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new Js(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||oo;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(s=>n(s)),this}}});var ir=oe((Om,po)=>{"use strict";f();var co="[^\\\\/]",Gu="(?=.)",uo="[^/]",jn="(?:\\/|$)",lo="(?:^|\\/)",On=`\\.{1,2}${jn}`,Yu="(?!\\.)",Zu=`(?!${lo}${On})`,Ku=`(?!\\.{0,1}${jn})`,Ju=`(?!${On})`,Qu="[^.\\/]",Xu=`${uo}*?`,el="/",fo={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:Gu,QMARK:uo,END_ANCHOR:jn,DOTS_SLASH:On,NO_DOT:Yu,NO_DOTS:Zu,NO_DOT_SLASH:Ku,NO_DOTS_SLASH:Ju,QMARK_NO_DOT:Qu,STAR:Xu,START_ANCHOR:lo,SEP:el},tl={...fo,SLASH_LITERAL:"[\\\\/]",QMARK:co,STAR:`${co}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},rl={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};po.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:rl,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?tl:fo}}});var ar=oe(he=>{"use strict";f();var{REGEX_BACKSLASH:nl,REGEX_REMOVE_BACKSLASH:sl,REGEX_SPECIAL_CHARS:ol,REGEX_SPECIAL_CHARS_GLOBAL:il}=ir();he.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);he.hasRegexChars=t=>ol.test(t);he.isRegexChar=t=>t.length===1&&he.hasRegexChars(t);he.escapeRegex=t=>t.replace(il,"\\$1");he.toPosixSlashes=t=>t.replace(nl,"/");he.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};he.removeBackslashes=t=>t.replace(sl,e=>e==="\\"?"":e);he.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?he.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};he.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};he.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",s=r.contains?"":"$",o=`${n}(?:${t})${s}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};he.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var bo=oe((Fm,wo)=>{"use strict";f();var ho=ar(),{CHAR_ASTERISK:In,CHAR_AT:al,CHAR_BACKWARD_SLASH:cr,CHAR_COMMA:cl,CHAR_DOT:Nn,CHAR_EXCLAMATION_MARK:Ln,CHAR_FORWARD_SLASH:xo,CHAR_LEFT_CURLY_BRACE:Fn,CHAR_LEFT_PARENTHESES:Mn,CHAR_LEFT_SQUARE_BRACKET:ul,CHAR_PLUS:ll,CHAR_QUESTION_MARK:mo,CHAR_RIGHT_CURLY_BRACE:fl,CHAR_RIGHT_PARENTHESES:go,CHAR_RIGHT_SQUARE_BRACKET:dl}=ir(),yo=t=>t===xo||t===cr,vo=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},pl=(t,e)=>{let r=e||{},n=t.length-1,s=r.parts===!0||r.scanToEnd===!0,o=[],i=[],a=[],c=t,u=-1,l=0,d=0,h=!1,v=!1,w=!1,T=!1,C=!1,O=!1,b=!1,N=!1,I=!1,H=!1,U=0,q,$,M={value:"",depth:0,isGlob:!1},y=()=>u>=n,pe=()=>c.charCodeAt(u+1),te=()=>(q=$,c.charCodeAt(++u));for(;u<n;){$=te();let z;if($===cr){b=M.backslashes=!0,$=te(),$===Fn&&(O=!0);continue}if(O===!0||$===Fn){for(U++;y()!==!0&&($=te());){if($===cr){b=M.backslashes=!0,te();continue}if($===Fn){U++;continue}if(O!==!0&&$===Nn&&($=te())===Nn){if(h=M.isBrace=!0,w=M.isGlob=!0,H=!0,s===!0)continue;break}if(O!==!0&&$===cl){if(h=M.isBrace=!0,w=M.isGlob=!0,H=!0,s===!0)continue;break}if($===fl&&(U--,U===0)){O=!1,h=M.isBrace=!0,H=!0;break}}if(s===!0)continue;break}if($===xo){if(o.push(u),i.push(M),M={value:"",depth:0,isGlob:!1},H===!0)continue;if(q===Nn&&u===l+1){l+=2;continue}d=u+1;continue}if(r.noext!==!0&&($===ll||$===al||$===In||$===mo||$===Ln)===!0&&pe()===Mn){if(w=M.isGlob=!0,T=M.isExtglob=!0,H=!0,$===Ln&&u===l&&(I=!0),s===!0){for(;y()!==!0&&($=te());){if($===cr){b=M.backslashes=!0,$=te();continue}if($===go){w=M.isGlob=!0,H=!0;break}}continue}break}if($===In){if(q===In&&(C=M.isGlobstar=!0),w=M.isGlob=!0,H=!0,s===!0)continue;break}if($===mo){if(w=M.isGlob=!0,H=!0,s===!0)continue;break}if($===ul){for(;y()!==!0&&(z=te());){if(z===cr){b=M.backslashes=!0,te();continue}if(z===dl){v=M.isBracket=!0,w=M.isGlob=!0,H=!0;break}}if(s===!0)continue;break}if(r.nonegate!==!0&&$===Ln&&u===l){N=M.negated=!0,l++;continue}if(r.noparen!==!0&&$===Mn){if(w=M.isGlob=!0,s===!0){for(;y()!==!0&&($=te());){if($===Mn){b=M.backslashes=!0,$=te();continue}if($===go){H=!0;break}}continue}break}if(w===!0){if(H=!0,s===!0)continue;break}}r.noext===!0&&(T=!1,w=!1);let J=c,m="",g="";l>0&&(m=c.slice(0,l),c=c.slice(l),d-=l),J&&w===!0&&d>0?(J=c.slice(0,d),g=c.slice(d)):w===!0?(J="",g=c):J=c,J&&J!==""&&J!=="/"&&J!==c&&yo(J.charCodeAt(J.length-1))&&(J=J.slice(0,-1)),r.unescape===!0&&(g&&(g=ho.removeBackslashes(g)),J&&b===!0&&(J=ho.removeBackslashes(J)));let ve={prefix:m,input:t,start:l,base:J,glob:g,isBrace:h,isBracket:v,isGlob:w,isExtglob:T,isGlobstar:C,negated:N,negatedExtglob:I};if(r.tokens===!0&&(ve.maxDepth=0,yo($)||i.push(M),ve.tokens=i),r.parts===!0||r.tokens===!0){let z;for(let Z=0;Z<o.length;Z++){let We=z?z+1:l,xe=o[Z],rt=t.slice(We,xe);r.tokens&&(Z===0&&l!==0?(i[Z].isPrefix=!0,i[Z].value=m):i[Z].value=rt,vo(i[Z]),ve.maxDepth+=i[Z].depth),(Z!==0||rt!=="")&&a.push(rt),z=xe}if(z&&z+1<t.length){let Z=t.slice(z+1);a.push(Z),r.tokens&&(i[i.length-1].value=Z,vo(i[i.length-1]),ve.maxDepth+=i[i.length-1].depth)}ve.slashes=o,ve.parts=a}return ve};wo.exports=pl});var Eo=oe((Bm,So)=>{"use strict";f();var Lr=ir(),Ie=ar(),{MAX_LENGTH:Fr,POSIX_REGEX_SOURCE:hl,REGEX_NON_SPECIAL_CHARS:ml,REGEX_SPECIAL_CHARS_BACKREF:gl,REPLACEMENTS:_o}=Lr,yl=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(s=>Ie.escapeRegex(s)).join("..")}return r},Nt=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Bn=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=_o[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Fr,r.maxLength):Fr,s=t.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},i=[o],a=r.capture?"":"?:",c=Lr.globChars(r.windows),u=Lr.extglobChars(c),{DOT_LITERAL:l,PLUS_LITERAL:d,SLASH_LITERAL:h,ONE_CHAR:v,DOTS_SLASH:w,NO_DOT:T,NO_DOT_SLASH:C,NO_DOTS_SLASH:O,QMARK:b,QMARK_NO_DOT:N,STAR:I,START_ANCHOR:H}=c,U=R=>`(${a}(?:(?!${H}${R.dot?w:l}).)*?)`,q=r.dot?"":T,$=r.dot?b:N,M=r.bash===!0?U(r):I;r.capture&&(M=`(${M})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let y={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=Ie.removePrefix(t,y),s=t.length;let pe=[],te=[],J=[],m=o,g,ve=()=>y.index===s-1,z=y.peek=(R=1)=>t[y.index+R],Z=y.advance=()=>t[++y.index]||"",We=()=>t.slice(y.index+1),xe=(R="",W=0)=>{y.consumed+=R,y.index+=W},rt=R=>{y.output+=R.output!=null?R.output:R.value,xe(R.value)},Bc=()=>{let R=1;for(;z()==="!"&&(z(2)!=="("||z(3)==="?");)Z(),y.start++,R++;return R%2===0?!1:(y.negated=!0,y.start++,!0)},jr=R=>{y[R]++,J.push(R)},ft=R=>{y[R]--,J.pop()},B=R=>{if(m.type==="globstar"){let W=y.braces>0&&(R.type==="comma"||R.type==="brace"),_=R.extglob===!0||pe.length&&(R.type==="pipe"||R.type==="paren");R.type!=="slash"&&R.type!=="paren"&&!W&&!_&&(y.output=y.output.slice(0,-m.output.length),m.type="star",m.value="*",m.output=M,y.output+=m.output)}if(pe.length&&R.type!=="paren"&&(pe[pe.length-1].inner+=R.value),(R.value||R.output)&&rt(R),m&&m.type==="text"&&R.type==="text"){m.output=(m.output||m.value)+R.value,m.value+=R.value;return}R.prev=m,i.push(R),m=R},Or=(R,W)=>{let _={...u[W],conditions:1,inner:""};_.prev=m,_.parens=y.parens,_.output=y.output;let L=(r.capture?"(":"")+_.open;jr("parens"),B({type:R,value:W,output:y.output?"":v}),B({type:"paren",extglob:!0,value:Z(),output:L}),pe.push(_)},Hc=R=>{let W=R.close+(r.capture?")":""),_;if(R.type==="negate"){let L=M;if(R.inner&&R.inner.length>1&&R.inner.includes("/")&&(L=U(r)),(L!==M||ve()||/^\)+$/.test(We()))&&(W=R.close=`)$))${L}`),R.inner.includes("*")&&(_=We())&&/^\.[^\\/.]+$/.test(_)){let K=Bn(_,{...e,fastpaths:!1}).output;W=R.close=`)${K})${L})`}R.prev.type==="bos"&&(y.negatedExtglob=!0)}B({type:"paren",extglob:!0,value:g,output:W}),ft("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let R=!1,W=t.replace(gl,(_,L,K,le,ne,Cn)=>le==="\\"?(R=!0,_):le==="?"?L?L+le+(ne?b.repeat(ne.length):""):Cn===0?$+(ne?b.repeat(ne.length):""):b.repeat(K.length):le==="."?l.repeat(K.length):le==="*"?L?L+le+(ne?M:""):M:L?_:`\\${_}`);return R===!0&&(r.unescape===!0?W=W.replace(/\\/g,""):W=W.replace(/\\+/g,_=>_.length%2===0?"\\\\":_?"\\":"")),W===t&&r.contains===!0?(y.output=t,y):(y.output=Ie.wrapOutput(W,y,e),y)}for(;!ve();){if(g=Z(),g==="\0")continue;if(g==="\\"){let _=z();if(_==="/"&&r.bash!==!0||_==="."||_===";")continue;if(!_){g+="\\",B({type:"text",value:g});continue}let L=/^\\+/.exec(We()),K=0;if(L&&L[0].length>2&&(K=L[0].length,y.index+=K,K%2!==0&&(g+="\\")),r.unescape===!0?g=Z():g+=Z(),y.brackets===0){B({type:"text",value:g});continue}}if(y.brackets>0&&(g!=="]"||m.value==="["||m.value==="[^")){if(r.posix!==!1&&g===":"){let _=m.value.slice(1);if(_.includes("[")&&(m.posix=!0,_.includes(":"))){let L=m.value.lastIndexOf("["),K=m.value.slice(0,L),le=m.value.slice(L+2),ne=hl[le];if(ne){m.value=K+ne,y.backtrack=!0,Z(),!o.output&&i.indexOf(m)===1&&(o.output=v);continue}}}(g==="["&&z()!==":"||g==="-"&&z()==="]")&&(g=`\\${g}`),g==="]"&&(m.value==="["||m.value==="[^")&&(g=`\\${g}`),r.posix===!0&&g==="!"&&m.value==="["&&(g="^"),m.value+=g,rt({value:g});continue}if(y.quotes===1&&g!=='"'){g=Ie.escapeRegex(g),m.value+=g,rt({value:g});continue}if(g==='"'){y.quotes=y.quotes===1?0:1,r.keepQuotes===!0&&B({type:"text",value:g});continue}if(g==="("){jr("parens"),B({type:"paren",value:g});continue}if(g===")"){if(y.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Nt("opening","("));let _=pe[pe.length-1];if(_&&y.parens===_.parens+1){Hc(pe.pop());continue}B({type:"paren",value:g,output:y.parens?")":"\\)"}),ft("parens");continue}if(g==="["){if(r.nobracket===!0||!We().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Nt("closing","]"));g=`\\${g}`}else jr("brackets");B({type:"bracket",value:g});continue}if(g==="]"){if(r.nobracket===!0||m&&m.type==="bracket"&&m.value.length===1){B({type:"text",value:g,output:`\\${g}`});continue}if(y.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Nt("opening","["));B({type:"text",value:g,output:`\\${g}`});continue}ft("brackets");let _=m.value.slice(1);if(m.posix!==!0&&_[0]==="^"&&!_.includes("/")&&(g=`/${g}`),m.value+=g,rt({value:g}),r.literalBrackets===!1||Ie.hasRegexChars(_))continue;let L=Ie.escapeRegex(m.value);if(y.output=y.output.slice(0,-m.value.length),r.literalBrackets===!0){y.output+=L,m.value=L;continue}m.value=`(${a}${L}|${m.value})`,y.output+=m.value;continue}if(g==="{"&&r.nobrace!==!0){jr("braces");let _={type:"brace",value:g,output:"(",outputIndex:y.output.length,tokensIndex:y.tokens.length};te.push(_),B(_);continue}if(g==="}"){let _=te[te.length-1];if(r.nobrace===!0||!_){B({type:"text",value:g,output:g});continue}let L=")";if(_.dots===!0){let K=i.slice(),le=[];for(let ne=K.length-1;ne>=0&&(i.pop(),K[ne].type!=="brace");ne--)K[ne].type!=="dots"&&le.unshift(K[ne].value);L=yl(le,r),y.backtrack=!0}if(_.comma!==!0&&_.dots!==!0){let K=y.output.slice(0,_.outputIndex),le=y.tokens.slice(_.tokensIndex);_.value=_.output="\\{",g=L="\\}",y.output=K;for(let ne of le)y.output+=ne.output||ne.value}B({type:"brace",value:g,output:L}),ft("braces"),te.pop();continue}if(g==="|"){pe.length>0&&pe[pe.length-1].conditions++,B({type:"text",value:g});continue}if(g===","){let _=g,L=te[te.length-1];L&&J[J.length-1]==="braces"&&(L.comma=!0,_="|"),B({type:"comma",value:g,output:_});continue}if(g==="/"){if(m.type==="dot"&&y.index===y.start+1){y.start=y.index+1,y.consumed="",y.output="",i.pop(),m=o;continue}B({type:"slash",value:g,output:h});continue}if(g==="."){if(y.braces>0&&m.type==="dot"){m.value==="."&&(m.output=l);let _=te[te.length-1];m.type="dots",m.output+=g,m.value+=g,_.dots=!0;continue}if(y.braces+y.parens===0&&m.type!=="bos"&&m.type!=="slash"){B({type:"text",value:g,output:l});continue}B({type:"dot",value:g,output:l});continue}if(g==="?"){if(!(m&&m.value==="(")&&r.noextglob!==!0&&z()==="("&&z(2)!=="?"){Or("qmark",g);continue}if(m&&m.type==="paren"){let L=z(),K=g;(m.value==="("&&!/[!=<:]/.test(L)||L==="<"&&!/<([!=]|\w+>)/.test(We()))&&(K=`\\${g}`),B({type:"text",value:g,output:K});continue}if(r.dot!==!0&&(m.type==="slash"||m.type==="bos")){B({type:"qmark",value:g,output:N});continue}B({type:"qmark",value:g,output:b});continue}if(g==="!"){if(r.noextglob!==!0&&z()==="("&&(z(2)!=="?"||!/[!=<:]/.test(z(3)))){Or("negate",g);continue}if(r.nonegate!==!0&&y.index===0){Bc();continue}}if(g==="+"){if(r.noextglob!==!0&&z()==="("&&z(2)!=="?"){Or("plus",g);continue}if(m&&m.value==="("||r.regex===!1){B({type:"plus",value:g,output:d});continue}if(m&&(m.type==="bracket"||m.type==="paren"||m.type==="brace")||y.parens>0){B({type:"plus",value:g});continue}B({type:"plus",value:d});continue}if(g==="@"){if(r.noextglob!==!0&&z()==="("&&z(2)!=="?"){B({type:"at",extglob:!0,value:g,output:""});continue}B({type:"text",value:g});continue}if(g!=="*"){(g==="$"||g==="^")&&(g=`\\${g}`);let _=ml.exec(We());_&&(g+=_[0],y.index+=_[0].length),B({type:"text",value:g});continue}if(m&&(m.type==="globstar"||m.star===!0)){m.type="star",m.star=!0,m.value+=g,m.output=M,y.backtrack=!0,y.globstar=!0,xe(g);continue}let R=We();if(r.noextglob!==!0&&/^\([^?]/.test(R)){Or("star",g);continue}if(m.type==="star"){if(r.noglobstar===!0){xe(g);continue}let _=m.prev,L=_.prev,K=_.type==="slash"||_.type==="bos",le=L&&(L.type==="star"||L.type==="globstar");if(r.bash===!0&&(!K||R[0]&&R[0]!=="/")){B({type:"star",value:g,output:""});continue}let ne=y.braces>0&&(_.type==="comma"||_.type==="brace"),Cn=pe.length&&(_.type==="pipe"||_.type==="paren");if(!K&&_.type!=="paren"&&!ne&&!Cn){B({type:"star",value:g,output:""});continue}for(;R.slice(0,3)==="/**";){let Ir=t[y.index+4];if(Ir&&Ir!=="/")break;R=R.slice(3),xe("/**",3)}if(_.type==="bos"&&ve()){m.type="globstar",m.value+=g,m.output=U(r),y.output=m.output,y.globstar=!0,xe(g);continue}if(_.type==="slash"&&_.prev.type!=="bos"&&!le&&ve()){y.output=y.output.slice(0,-(_.output+m.output).length),_.output=`(?:${_.output}`,m.type="globstar",m.output=U(r)+(r.strictSlashes?")":"|$)"),m.value+=g,y.globstar=!0,y.output+=_.output+m.output,xe(g);continue}if(_.type==="slash"&&_.prev.type!=="bos"&&R[0]==="/"){let Ir=R[1]!==void 0?"|$":"";y.output=y.output.slice(0,-(_.output+m.output).length),_.output=`(?:${_.output}`,m.type="globstar",m.output=`${U(r)}${h}|${h}${Ir})`,m.value+=g,y.output+=_.output+m.output,y.globstar=!0,xe(g+Z()),B({type:"slash",value:"/",output:""});continue}if(_.type==="bos"&&R[0]==="/"){m.type="globstar",m.value+=g,m.output=`(?:^|${h}|${U(r)}${h})`,y.output=m.output,y.globstar=!0,xe(g+Z()),B({type:"slash",value:"/",output:""});continue}y.output=y.output.slice(0,-m.output.length),m.type="globstar",m.output=U(r),m.value+=g,y.output+=m.output,y.globstar=!0,xe(g);continue}let W={type:"star",value:g,output:M};if(r.bash===!0){W.output=".*?",(m.type==="bos"||m.type==="slash")&&(W.output=q+W.output),B(W);continue}if(m&&(m.type==="bracket"||m.type==="paren")&&r.regex===!0){W.output=g,B(W);continue}(y.index===y.start||m.type==="slash"||m.type==="dot")&&(m.type==="dot"?(y.output+=C,m.output+=C):r.dot===!0?(y.output+=O,m.output+=O):(y.output+=q,m.output+=q),z()!=="*"&&(y.output+=v,m.output+=v)),B(W)}for(;y.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Nt("closing","]"));y.output=Ie.escapeLast(y.output,"["),ft("brackets")}for(;y.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Nt("closing",")"));y.output=Ie.escapeLast(y.output,"("),ft("parens")}for(;y.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Nt("closing","}"));y.output=Ie.escapeLast(y.output,"{"),ft("braces")}if(r.strictSlashes!==!0&&(m.type==="star"||m.type==="bracket")&&B({type:"maybe_slash",value:"",output:`${h}?`}),y.backtrack===!0){y.output="";for(let R of y.tokens)y.output+=R.output!=null?R.output:R.value,R.suffix&&(y.output+=R.suffix)}return y};Bn.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Fr,r.maxLength):Fr,s=t.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);t=_o[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:i,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:u,NO_DOTS:l,NO_DOTS_SLASH:d,STAR:h,START_ANCHOR:v}=Lr.globChars(r.windows),w=r.dot?l:u,T=r.dot?d:u,C=r.capture?"":"?:",O={negated:!1,prefix:""},b=r.bash===!0?".*?":h;r.capture&&(b=`(${b})`);let N=q=>q.noglobstar===!0?b:`(${C}(?:(?!${v}${q.dot?c:o}).)*?)`,I=q=>{switch(q){case"*":return`${w}${a}${b}`;case".*":return`${o}${a}${b}`;case"*.*":return`${w}${b}${o}${a}${b}`;case"*/*":return`${w}${b}${i}${a}${T}${b}`;case"**":return w+N(r);case"**/*":return`(?:${w}${N(r)}${i})?${T}${a}${b}`;case"**/*.*":return`(?:${w}${N(r)}${i})?${T}${b}${o}${a}${b}`;case"**/.*":return`(?:${w}${N(r)}${i})?${o}${a}${b}`;default:{let $=/^(.*?)\.(\w+)$/.exec(q);if(!$)return;let M=I($[1]);return M?M+o+$[2]:void 0}}},H=Ie.removePrefix(t,O),U=I(H);return U&&r.strictSlashes!==!0&&(U+=`${i}?`),U};So.exports=Bn});var Ao=oe((Um,To)=>{"use strict";f();var vl=bo(),Hn=Eo(),Ro=ar(),xl=ir(),wl=t=>t&&typeof t=="object"&&!Array.isArray(t),X=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(h=>X(h,e,r));return h=>{for(let v of l){let w=v(h);if(w)return w}return!1}}let n=wl(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let s=e||{},o=s.windows,i=n?X.compileRe(t,e):X.makeRe(t,e,!1,!0),a=i.state;delete i.state;let c=()=>!1;if(s.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};c=X(s.ignore,l,r)}let u=(l,d=!1)=>{let{isMatch:h,match:v,output:w}=X.test(l,i,e,{glob:t,posix:o}),T={glob:t,state:a,regex:i,posix:o,input:l,output:w,match:v,isMatch:h};return typeof s.onResult=="function"&&s.onResult(T),h===!1?(T.isMatch=!1,d?T:!1):c(l)?(typeof s.onIgnore=="function"&&s.onIgnore(T),T.isMatch=!1,d?T:!1):(typeof s.onMatch=="function"&&s.onMatch(T),d?T:!0)};return r&&(u.state=a),u};X.test=(t,e,r,{glob:n,posix:s}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},i=o.format||(s?Ro.toPosixSlashes:null),a=t===n,c=a&&i?i(t):t;return a===!1&&(c=i?i(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=X.matchBase(t,e,r,s):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};X.matchBase=(t,e,r)=>(e instanceof RegExp?e:X.makeRe(e,r)).test(Ro.basename(t));X.isMatch=(t,e,r)=>X(e,r)(t);X.parse=(t,e)=>Array.isArray(t)?t.map(r=>X.parse(r,e)):Hn(t,{...e,fastpaths:!1});X.scan=(t,e)=>vl(t,e);X.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let s=e||{},o=s.contains?"":"^",i=s.contains?"":"$",a=`${o}(?:${t.output})${i}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=X.toRegex(a,e);return n===!0&&(c.state=t),c};X.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(s.output=Hn.fastpaths(t,e)),s.output||(s=Hn(t,e)),X.compileRe(s,e,r,n)};X.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};X.constants=xl;To.exports=X});var Do=oe((qm,Po)=>{"use strict";f();var Co=Ao(),bl=ar();function ko(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:bl.isWindows()}),Co(t,e,r)}Object.assign(ko,Co);Po.exports=ko});import Lt from"fs";import jo,{posix as dt}from"path";import{fileURLToPath as _l}from"url";function Rl(t,e={}){let r=t.length,n=Array(r),s=Array(r),o=!e.noglobstar;for(let i=0;i<r;i++){let a=Io(t[i]);n[i]=a;let c=a.length,u=Array(c);for(let l=0;l<c;l++)u[l]=(0,Mt.default)(a[l],e);s[i]=u}return i=>{let a=i.split("/");if(a[0]===".."&&El.test(i))return!0;for(let c=0;c<t.length;c++){let u=n[c],l=s[c],d=a.length,h=Math.min(d,u.length),v=0;for(;v<h;){let w=u[v];if(w.includes("/"))return!0;if(!l[v](a[v]))break;if(o&&w==="**")return!0;v++}if(v===d)return!0}return!1}}function $o(t,e,r){if(t===e||e.startsWith(`${t}/`)){if(r){let s=Al(t)?t.length:t.length+1;return(o,i)=>o.slice(s,i?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(s,o)=>{if(s===".")return n;let i=`${n}/${s}`;return o?i.slice(0,-1):i}:(s,o)=>o&&s!=="."?s.slice(0,-1):s}return r?n=>dt.relative(t,n)||".":n=>dt.relative(t,`${e}/${n}`)||"."}function Cl(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=dt.relative(t,`${e}/${r}`);return r.endsWith("/")&&n!==""?`${n}/`:n||"."}}function Io(t){var e;let r=Mt.default.scan(t,kl);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function Il(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Mt.default.scan(t);return r.isGlob||r.negated}function Ft(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function Un(t,e,r,n,s){let o=t;t.endsWith("/")&&(o=t.slice(0,-1)),!o.endsWith("*")&&e&&(o+="/**");let i=Ol(r);jo.isAbsolute(o.replace(Ll,""))?o=dt.relative(i,o):o=dt.normalize(o);let a=Nl.exec(o),c=Io(o);if(a?.[0]){let l=(a[0].length+1)/3,d=0,h=i.split("/");for(;d<l&&c[d+l]===h[h.length+d-l];)o=o.slice(0,(l-d-1)*3)+o.slice((l-d)*3+c[d+l].length+1)||".",d++;let v=dt.join(r,a[0].slice(d*3));!v.startsWith(".")&&n.root.length>v.length&&(n.root=v,n.depthOffset=-l+d)}if(!s&&n.depthOffset>=0){var u;(u=n.commonPath)!==null&&u!==void 0||(n.commonPath=c);let l=[],d=Math.min(n.commonPath.length,c.length);for(let h=0;h<d;h++){let v=c[h];if(v==="**"&&!c[h+1]){l.pop();break}if(v!==n.commonPath[h]||Il(v)||h===c.length-1)break;l.push(v)}n.depthOffset=l.length,n.commonPath=l,n.root=l.length>0?dt.join(r,...l):r}return o}function Fl({patterns:t=["**/*"],ignore:e=[],expandDirectories:r=!0},n,s){typeof t=="string"&&(t=[t]),typeof e=="string"&&(e=[e]);let o=[],i=[];for(let a of e)a&&(a[0]!=="!"||a[1]==="(")&&i.push(Un(a,r,n,s,!0));for(let a of t)a&&(a[0]!=="!"||a[1]==="("?o.push(Un(a,r,n,s,!1)):(a[1]!=="!"||a[2]==="(")&&i.push(Un(a.slice(1),r,n,s,!0)));return{match:o,ignore:i}}function Ml(t,e){for(let r=t.length-1;r>=0;r--){let n=t[r];t[r]=e(n)}return t}function Bl(t){return t?t instanceof URL?_l(t).replace(Mr,"/"):jo.resolve(t).replace(Mr,"/"):process.cwd().replace(Mr,"/")}function Hl(t,e={}){let r=process.env.TINYGLOBBY_DEBUG?{...e,debug:!0}:e,n=Bl(r.cwd);if(r.debug&&Ft("globbing with:",{patterns:t,options:r,cwd:n}),Array.isArray(t)&&t.length===0)return[{sync:()=>[],withPromise:async()=>[]},!1];let s={root:n,commonPath:null,depthOffset:0},o=Fl({...r,patterns:t},n,s);r.debug&&Ft("internal processing patterns:",o);let i={dot:r.dot,nobrace:r.braceExpansion===!1,nocase:r.caseSensitiveMatch===!1,noextglob:r.extglob===!1,noglobstar:r.globstar===!1,posix:!0},a=(0,Mt.default)(o.match,{...i,ignore:o.ignore}),c=(0,Mt.default)(o.ignore,i),u=Rl(o.match,i),l=$o(n,s.root,r.absolute),d=r.absolute?l:$o(n,s.root,!0),h={filters:[r.debug?(T,C)=>{let O=l(T,C),b=a(O);return b&&Ft(`matched ${O}`),b}:(T,C)=>a(l(T,C))],exclude:r.debug?(T,C)=>{let O=d(C,!0),b=O!=="."&&!u(O)||c(O);return Ft(b?`skipped ${C}`:`crawling ${C}`),b}:(T,C)=>{let O=d(C,!0);return O!=="."&&!u(O)||c(O)},fs:r.fs?{readdir:r.fs.readdir||Lt.readdir,readdirSync:r.fs.readdirSync||Lt.readdirSync,realpath:r.fs.realpath||Lt.realpath,realpathSync:r.fs.realpathSync||Lt.realpathSync,stat:r.fs.stat||Lt.stat,statSync:r.fs.statSync||Lt.statSync}:void 0,pathSeparator:"/",relativePaths:!0,resolveSymlinks:!0,signal:r.signal};r.deep!==void 0&&(h.maxDepth=Math.round(r.deep-s.depthOffset)),r.absolute&&(h.relativePaths=!1,h.resolvePaths=!0,h.includeBasePath=!0),r.followSymbolicLinks===!1&&(h.resolveSymlinks=!1,h.excludeSymlinks=!0),r.onlyDirectories?(h.excludeFiles=!0,h.includeDirs=!0):r.onlyFiles===!1&&(h.includeDirs=!0),s.root=s.root.replace(Mr,"");let v=s.root;r.debug&&Ft("internal properties:",s);let w=n!==v&&!r.absolute&&Cl(n,s.root);return[new io(h).crawl(v),w]}async function No(t,e){if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let r=Sl(t)||typeof t=="string",n=r?e:t,s=r?t:t.patterns,[o,i]=Hl(s,n);return i?Ml(await o.withPromise(),i):o.withPromise()}var Mt,Sl,Oo,El,Tl,Al,kl,Pl,Dl,$l,jl,Ol,Nl,Ll,Mr,Lo=Q(()=>{f();ao();Mt=Zs(Do(),1),Sl=Array.isArray,Oo=process.platform==="win32",El=/^(\/?\.\.)+$/;Tl=/^[A-Z]:\/$/i,Al=Oo?t=>Tl.test(t):t=>t==="/";kl={parts:!0};Pl=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Dl=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,$l=t=>t.replace(Pl,"\\$&"),jl=t=>t.replace(Dl,"\\$&"),Ol=Oo?jl:$l;Nl=/^(\/?\.\.)+/,Ll=/\\(?=[()[\]{}!*+?@|])/g,Mr=/\\/g});import{execSync as Ul,spawn as zl}from"node:child_process";import{access as ql,readFile as Fo,writeFile as Wl}from"node:fs/promises";var Vl,f=Q(()=>{"use strict";Lo();Vl={file(t){return{async exists(){try{return await ql(t),!0}catch{return!1}},text(){return Fo(t,"utf-8")},async json(){let e=await Fo(t,"utf-8");return JSON.parse(e)}}},async write(t,e){await Wl(t,e,"utf-8")},which(t){try{let r=process.platform==="win32"?`where ${t}`:`which ${t}`;return Ul(r,{encoding:"utf-8",stdio:["pipe","pipe","ignore"]}).trim().split(`
|
|
3
|
-
`)[0]||null}catch{return null}},spawn(t,e){let[r,...n]=t,s=["ignore",e?.stdout??"ignore",e?.stderr??"ignore"],o=zl(r,n,{detached:!0,stdio:s});return{unref(){o.unref()}}},sleep(t){return new Promise(e=>setTimeout(e,t))},Glob:class{pattern;constructor(e){this.pattern=e}async*scan(e){let r=await No(this.pattern,{cwd:e?.cwd||process.cwd()});for(let n of r)yield n}}};globalThis.Bun=Vl});var F,is,E,Me,mr=Q(()=>{f();(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{let o={};for(let i of s)o[i]=i;return o},t.getValidEnumValues=s=>{let o=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(let a of o)i[a]=s[a];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(o){return s[o]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let o=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},t.find=(s,o)=>{for(let i of s)if(o(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(F||(F={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(is||(is={}));E=F.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Me=t=>{switch(typeof t){case"undefined":return E.undefined;case"string":return E.string;case"number":return Number.isNaN(t)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":return Array.isArray(t)?E.array:t===null?E.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?E.promise:typeof Map<"u"&&t instanceof Map?E.map:typeof Set<"u"&&t instanceof Set?E.set:typeof Date<"u"&&t instanceof Date?E.date:E.object;default:return E.unknown}}});var x,Bf,me,Zr=Q(()=>{f();mr();x=F.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Bf=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),me=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},s=o=>{for(let i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,F.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let s of this.issues)if(s.path.length>0){let o=s.path[0];r[o]=r[o]||[],r[o].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};me.create=t=>new me(t)});var Hf,Ze,as=Q(()=>{f();Zr();mr();Hf=(t,e)=>{let r;switch(t.code){case x.invalid_type:t.received===E.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,F.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${F.joinValues(t.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${F.joinValues(t.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${F.joinValues(t.options)}, received '${t.received}'`;break;case x.invalid_arguments:r="Invalid function arguments";break;case x.invalid_return_type:r="Invalid function return type";break;case x.invalid_date:r="Invalid date";break;case x.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:F.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case x.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case x.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case x.custom:r="Invalid input";break;case x.invalid_intersection_types:r="Intersection results could not be merged";break;case x.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case x.not_finite:r="Number must be finite";break;default:r=e.defaultError,F.assertNever(t)}return{message:r}},Ze=Hf});function Uf(t){_i=t}function zt(){return _i}var _i,Kr=Q(()=>{f();as();_i=Ze});function S(t,e){let r=zt(),n=gr({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ze?void 0:Ze].filter(s=>!!s)});t.common.issues.push(n)}var gr,zf,ie,k,gt,ce,Jr,Qr,st,qt,cs=Q(()=>{f();Kr();as();gr=t=>{let{data:e,path:r,errorMaps:n,issueData:s}=t,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(i,{data:e,defaultError:a}).message;return{...s,path:o,message:a}},zf=[];ie=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let s of r){if(s.status==="aborted")return k;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let s of r){let o=await s.key,i=await s.value;n.push({key:o,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let s of r){let{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return k;o.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:e.value,value:n}}},k=Object.freeze({status:"aborted"}),gt=t=>({status:"dirty",value:t}),ce=t=>({status:"valid",value:t}),Jr=t=>t.status==="aborted",Qr=t=>t.status==="dirty",st=t=>t.status==="valid",qt=t=>typeof Promise<"u"&&t instanceof Promise});var Si=Q(()=>{f()});var A,Ei=Q(()=>{f();(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(A||(A={}))});function D(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:s}}function Ci(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function id(t){return new RegExp(`^${Ci(t)}$`)}function ki(t){let e=`${Ai}T${Ci(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function ad(t,e){return!!((e==="v4"||!e)&&Xf.test(t)||(e==="v6"||!e)&&td.test(t))}function cd(t,e){if(!Zf.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function ud(t,e){return!!((e==="v4"||!e)&&ed.test(t)||(e==="v6"||!e)&&rd.test(t))}function ld(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return o%i/10**s}function Wt(t){if(t instanceof ge){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=be.create(Wt(n))}return new ge({...t._def,shape:()=>e})}else return t instanceof Qe?new Qe({...t._def,type:Wt(t.element)}):t instanceof be?be.create(Wt(t.unwrap())):t instanceof He?He.create(Wt(t.unwrap())):t instanceof Be?Be.create(t.items.map(e=>Wt(e))):t}function ls(t,e){let r=Me(t),n=Me(e);if(t===e)return{valid:!0,data:t};if(r===E.object&&n===E.object){let s=F.objectKeys(e),o=F.objectKeys(t).filter(a=>s.indexOf(a)!==-1),i={...t,...e};for(let a of o){let c=ls(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===E.array&&n===E.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let o=0;o<t.length;o++){let i=t[o],a=e[o],c=ls(i,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===E.date&&n===E.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function Pi(t,e){return new At({values:t,typeName:P.ZodEnum,...D(e)})}function Ti(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Di(t,e={},r){return t?it.create().superRefine((n,s)=>{let o=t(n);if(o instanceof Promise)return o.then(i=>{if(!i){let a=Ti(e,n),c=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!o){let i=Ti(e,n),a=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:a})}}):it.create()}var _e,Ri,j,qf,Wf,Vf,Gf,Yf,Zf,Kf,Jf,Qf,us,Xf,ed,td,rd,nd,sd,Ai,od,ot,yt,vt,xt,wt,Vt,bt,_t,it,Je,Pe,Gt,Qe,ge,St,Ke,Xr,Et,Be,en,Yt,Zt,tn,Rt,Tt,At,Ct,at,Se,be,He,kt,Pt,Kt,fd,yr,vr,Dt,dd,P,pd,$i,ji,hd,md,Oi,gd,yd,vd,xd,wd,bd,_d,Sd,Ed,Rd,Td,Ad,Cd,kd,Pd,Dd,$d,jd,Od,Id,Nd,Ld,Fd,Md,Bd,Hd,Ud,zd,qd,Wd,Vd,Gd,Yd,Zd,Ii=Q(()=>{f();Zr();Kr();Ei();cs();mr();_e=class{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ri=(t,e)=>{if(st(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new me(t.common.issues);return this._error=r,this._error}}};j=class{get description(){return this._def.description}_getType(e){return Me(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ie,ctx:{common:e.parent.common,data:e.data,parsedType:Me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(qt(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Me(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Ri(n,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Me(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return st(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>st(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Me(e)},s=this._parse({data:e,path:n.path,parent:n}),o=await(qt(s)?s:Promise.resolve(s));return Ri(n,o)}refine(e,r){let n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{let i=e(s),a=()=>o.addIssue({code:x.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new Se({schema:this,typeName:P.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return be.create(this,this._def)}nullable(){return He.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Qe.create(this)}promise(){return at.create(this,this._def)}or(e){return St.create([this,e],this._def)}and(e){return Et.create(this,e,this._def)}transform(e){return new Se({...D(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new kt({...D(this._def),innerType:this,defaultValue:r,typeName:P.ZodDefault})}brand(){return new yr({typeName:P.ZodBranded,type:this,...D(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Pt({...D(this._def),innerType:this,catchValue:r,typeName:P.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return vr.create(this,e)}readonly(){return Dt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},qf=/^c[^\s-]{8,}$/i,Wf=/^[0-9a-z]+$/,Vf=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Gf=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Yf=/^[a-z0-9_-]{21}$/i,Zf=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Kf=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Jf=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Xf=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ed=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,td=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,rd=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nd=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sd=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ai="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",od=new RegExp(`^${Ai}$`);ot=class t extends j{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==E.string){let o=this._getOrReturnCtx(e);return S(o,{code:x.invalid_type,expected:E.string,received:o.parsedType}),k}let n=new ie,s;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:x.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:x.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let i=e.data.length>o.value,a=e.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(e,s),i?S(s,{code:x.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&S(s,{code:x.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")Jf.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"email",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")us||(us=new RegExp(Qf,"u")),us.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"emoji",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")Gf.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"uuid",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")Yf.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"nanoid",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")qf.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cuid",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")Wf.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cuid2",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")Vf.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"ulid",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),S(s,{validation:"url",code:x.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"regex",code:x.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(e,s),S(s,{code:x.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(s=this._getOrReturnCtx(e,s),S(s,{code:x.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(s=this._getOrReturnCtx(e,s),S(s,{code:x.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?ki(o).test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{code:x.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?od.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{code:x.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?id(o).test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{code:x.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Kf.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"duration",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?ad(e.data,o.version)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"ip",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?cd(e.data,o.alg)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"jwt",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?ud(e.data,o.version)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cidr",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?nd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"base64",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?sd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"base64url",code:x.invalid_string,message:o.message}),n.dirty()):F.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:x.invalid_string,...A.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...A.errToObj(e)})}url(e){return this._addCheck({kind:"url",...A.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...A.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...A.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...A.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...A.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...A.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...A.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...A.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...A.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...A.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...A.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...A.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...A.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...A.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...A.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...A.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...A.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...A.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...A.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...A.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...A.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...A.errToObj(r)})}nonempty(e){return this.min(1,A.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};ot.create=t=>new ot({checks:[],typeName:P.ZodString,coerce:t?.coerce??!1,...D(t)});yt=class t extends j{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==E.number){let o=this._getOrReturnCtx(e);return S(o,{code:x.invalid_type,expected:E.number,received:o.parsedType}),k}let n,s=new ie;for(let o of this._def.checks)o.kind==="int"?F.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:x.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?ld(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:x.not_finite,message:o.message}),s.dirty()):F.assertNever(o);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,A.toString(r))}gt(e,r){return this.setLimit("min",e,!1,A.toString(r))}lte(e,r){return this.setLimit("max",e,!0,A.toString(r))}lt(e,r){return this.setLimit("max",e,!1,A.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:A.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:A.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:A.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&F.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};yt.create=t=>new yt({checks:[],typeName:P.ZodNumber,coerce:t?.coerce||!1,...D(t)});vt=class t extends j{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==E.bigint)return this._getInvalidInput(e);let n,s=new ie;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):F.assertNever(o);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return S(r,{code:x.invalid_type,expected:E.bigint,received:r.parsedType}),k}gte(e,r){return this.setLimit("min",e,!0,A.toString(r))}gt(e,r){return this.setLimit("min",e,!1,A.toString(r))}lte(e,r){return this.setLimit("max",e,!0,A.toString(r))}lt(e,r){return this.setLimit("max",e,!1,A.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:A.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};vt.create=t=>new vt({checks:[],typeName:P.ZodBigInt,coerce:t?.coerce??!1,...D(t)});xt=class extends j{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==E.boolean){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:E.boolean,received:n.parsedType}),k}return ce(e.data)}};xt.create=t=>new xt({typeName:P.ZodBoolean,coerce:t?.coerce||!1,...D(t)});wt=class t extends j{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==E.date){let o=this._getOrReturnCtx(e);return S(o,{code:x.invalid_type,expected:E.date,received:o.parsedType}),k}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return S(o,{code:x.invalid_date}),k}let n=new ie,s;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:x.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:x.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):F.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:A.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:A.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};wt.create=t=>new wt({checks:[],coerce:t?.coerce||!1,typeName:P.ZodDate,...D(t)});Vt=class extends j{_parse(e){if(this._getType(e)!==E.symbol){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:E.symbol,received:n.parsedType}),k}return ce(e.data)}};Vt.create=t=>new Vt({typeName:P.ZodSymbol,...D(t)});bt=class extends j{_parse(e){if(this._getType(e)!==E.undefined){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:E.undefined,received:n.parsedType}),k}return ce(e.data)}};bt.create=t=>new bt({typeName:P.ZodUndefined,...D(t)});_t=class extends j{_parse(e){if(this._getType(e)!==E.null){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:E.null,received:n.parsedType}),k}return ce(e.data)}};_t.create=t=>new _t({typeName:P.ZodNull,...D(t)});it=class extends j{constructor(){super(...arguments),this._any=!0}_parse(e){return ce(e.data)}};it.create=t=>new it({typeName:P.ZodAny,...D(t)});Je=class extends j{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ce(e.data)}};Je.create=t=>new Je({typeName:P.ZodUnknown,...D(t)});Pe=class extends j{_parse(e){let r=this._getOrReturnCtx(e);return S(r,{code:x.invalid_type,expected:E.never,received:r.parsedType}),k}};Pe.create=t=>new Pe({typeName:P.ZodNever,...D(t)});Gt=class extends j{_parse(e){if(this._getType(e)!==E.undefined){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:E.void,received:n.parsedType}),k}return ce(e.data)}};Gt.create=t=>new Gt({typeName:P.ZodVoid,...D(t)});Qe=class t extends j{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==E.array)return S(r,{code:x.invalid_type,expected:E.array,received:r.parsedType}),k;if(s.exactLength!==null){let i=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(i||a)&&(S(r,{code:i?x.too_big:x.too_small,minimum:a?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(S(r,{code:x.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(S(r,{code:x.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new _e(r,i,r.path,a)))).then(i=>ie.mergeArray(n,i));let o=[...r.data].map((i,a)=>s.type._parseSync(new _e(r,i,r.path,a)));return ie.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:A.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:A.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:A.toString(r)}})}nonempty(e){return this.min(1,e)}};Qe.create=(t,e)=>new Qe({type:t,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...D(e)});ge=class t extends j{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=F.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==E.object){let u=this._getOrReturnCtx(e);return S(u,{code:x.invalid_type,expected:E.object,received:u.parsedType}),k}let{status:n,ctx:s}=this._processInputParams(e),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Pe&&this._def.unknownKeys==="strip"))for(let u in s.data)i.includes(u)||a.push(u);let c=[];for(let u of i){let l=o[u],d=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new _e(s,d,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Pe){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(u==="strict")a.length>0&&(S(s,{code:x.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new _e(s,d,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,h=await l.value;u.push({key:d,value:h,alwaysSet:l.alwaysSet})}return u}).then(u=>ie.mergeObjectSync(n,u)):ie.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return A.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:A.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:P.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of F.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of F.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Wt(this)}partial(e){let r={};for(let n of F.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of F.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof be;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return Pi(F.objectKeys(this.shape))}};ge.create=(t,e)=>new ge({shape:()=>t,unknownKeys:"strip",catchall:Pe.create(),typeName:P.ZodObject,...D(e)});ge.strictCreate=(t,e)=>new ge({shape:()=>t,unknownKeys:"strict",catchall:Pe.create(),typeName:P.ZodObject,...D(e)});ge.lazycreate=(t,e)=>new ge({shape:t,unknownKeys:"strip",catchall:Pe.create(),typeName:P.ZodObject,...D(e)});St=class extends j{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function s(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(a=>new me(a.ctx.common.issues));return S(r,{code:x.invalid_union,unionErrors:i}),k}if(r.common.async)return Promise.all(n.map(async o=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(c=>new me(c));return S(r,{code:x.invalid_union,unionErrors:a}),k}}get options(){return this._def.options}};St.create=(t,e)=>new St({options:t,typeName:P.ZodUnion,...D(e)});Ke=t=>t instanceof Rt?Ke(t.schema):t instanceof Se?Ke(t.innerType()):t instanceof Tt?[t.value]:t instanceof At?t.options:t instanceof Ct?F.objectValues(t.enum):t instanceof kt?Ke(t._def.innerType):t instanceof bt?[void 0]:t instanceof _t?[null]:t instanceof be?[void 0,...Ke(t.unwrap())]:t instanceof He?[null,...Ke(t.unwrap())]:t instanceof yr||t instanceof Dt?Ke(t.unwrap()):t instanceof Pt?Ke(t._def.innerType):[],Xr=class t extends j{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==E.object)return S(r,{code:x.invalid_type,expected:E.object,received:r.parsedType}),k;let n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(S(r,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),k)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let s=new Map;for(let o of r){let i=Ke(o.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,o)}}return new t({typeName:P.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...D(n)})}};Et=class extends j{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=(o,i)=>{if(Jr(o)||Jr(i))return k;let a=ls(o.value,i.value);return a.valid?((Qr(o)||Qr(i))&&r.dirty(),{status:r.value,value:a.data}):(S(n,{code:x.invalid_intersection_types}),k)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Et.create=(t,e,r)=>new Et({left:t,right:e,typeName:P.ZodIntersection,...D(r)});Be=class t extends j{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.array)return S(n,{code:x.invalid_type,expected:E.array,received:n.parsedType}),k;if(n.data.length<this._def.items.length)return S(n,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),k;!this._def.rest&&n.data.length>this._def.items.length&&(S(n,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new _e(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>ie.mergeArray(r,i)):ie.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Be.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Be({items:t,typeName:P.ZodTuple,rest:null,...D(e)})};en=class t extends j{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.object)return S(n,{code:x.invalid_type,expected:E.object,received:n.parsedType}),k;let s=[],o=this._def.keyType,i=this._def.valueType;for(let a in n.data)s.push({key:o._parse(new _e(n,a,n.path,a)),value:i._parse(new _e(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?ie.mergeObjectAsync(r,s):ie.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof j?new t({keyType:e,valueType:r,typeName:P.ZodRecord,...D(n)}):new t({keyType:ot.create(),valueType:e,typeName:P.ZodRecord,...D(r)})}},Yt=class extends j{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.map)return S(n,{code:x.invalid_type,expected:E.map,received:n.parsedType}),k;let s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new _e(n,a,n.path,[u,"key"])),value:o._parse(new _e(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return k;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return k;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};Yt.create=(t,e,r)=>new Yt({valueType:e,keyType:t,typeName:P.ZodMap,...D(r)});Zt=class t extends j{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.set)return S(n,{code:x.invalid_type,expected:E.set,received:n.parsedType}),k;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(S(n,{code:x.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(S(n,{code:x.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let o=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return k;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new _e(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:A.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:A.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Zt.create=(t,e)=>new Zt({valueType:t,minSize:null,maxSize:null,typeName:P.ZodSet,...D(e)});tn=class t extends j{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==E.function)return S(r,{code:x.invalid_type,expected:E.function,received:r.parsedType}),k;function n(a,c){return gr({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zt(),Ze].filter(u=>!!u),issueData:{code:x.invalid_arguments,argumentsError:c}})}function s(a,c){return gr({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zt(),Ze].filter(u=>!!u),issueData:{code:x.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof at){let a=this;return ce(async function(...c){let u=new me([]),l=await a._def.args.parseAsync(c,o).catch(v=>{throw u.addIssue(n(c,v)),u}),d=await Reflect.apply(i,this,l);return await a._def.returns._def.type.parseAsync(d,o).catch(v=>{throw u.addIssue(s(d,v)),u})})}else{let a=this;return ce(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new me([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=a._def.returns.safeParse(l,o);if(!d.success)throw new me([s(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Be.create(e).rest(Je.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Be.create([]).rest(Je.create()),returns:r||Je.create(),typeName:P.ZodFunction,...D(n)})}},Rt=class extends j{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Rt.create=(t,e)=>new Rt({getter:t,typeName:P.ZodLazy,...D(e)});Tt=class extends j{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return S(r,{received:r.data,code:x.invalid_literal,expected:this._def.value}),k}return{status:"valid",value:e.data}}get value(){return this._def.value}};Tt.create=(t,e)=>new Tt({value:t,typeName:P.ZodLiteral,...D(e)});At=class t extends j{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return S(r,{expected:F.joinValues(n),received:r.parsedType,code:x.invalid_type}),k}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return S(r,{received:r.data,code:x.invalid_enum_value,options:n}),k}return ce(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};At.create=Pi;Ct=class extends j{_parse(e){let r=F.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==E.string&&n.parsedType!==E.number){let s=F.objectValues(r);return S(n,{expected:F.joinValues(s),received:n.parsedType,code:x.invalid_type}),k}if(this._cache||(this._cache=new Set(F.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=F.objectValues(r);return S(n,{received:n.data,code:x.invalid_enum_value,options:s}),k}return ce(e.data)}get enum(){return this._def.values}};Ct.create=(t,e)=>new Ct({values:t,typeName:P.ZodNativeEnum,...D(e)});at=class extends j{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==E.promise&&r.common.async===!1)return S(r,{code:x.invalid_type,expected:E.promise,received:r.parsedType}),k;let n=r.parsedType===E.promise?r.data:Promise.resolve(r.data);return ce(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};at.create=(t,e)=>new at({type:t,typeName:P.ZodPromise,...D(e)});Se=class extends j{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,o={addIssue:i=>{S(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){let i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return k;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?k:c.status==="dirty"?gt(c.value):r.value==="dirty"?gt(c.value):c});{if(r.value==="aborted")return k;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?k:a.status==="dirty"?gt(a.value):r.value==="dirty"?gt(a.value):a}}if(s.type==="refinement"){let i=a=>{let c=s.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?k:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?k:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!st(i))return k;let a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>st(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):k);F.assertNever(s)}};Se.create=(t,e,r)=>new Se({schema:t,typeName:P.ZodEffects,effect:e,...D(r)});Se.createWithPreprocess=(t,e,r)=>new Se({schema:e,effect:{type:"preprocess",transform:t},typeName:P.ZodEffects,...D(r)});be=class extends j{_parse(e){return this._getType(e)===E.undefined?ce(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};be.create=(t,e)=>new be({innerType:t,typeName:P.ZodOptional,...D(e)});He=class extends j{_parse(e){return this._getType(e)===E.null?ce(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};He.create=(t,e)=>new He({innerType:t,typeName:P.ZodNullable,...D(e)});kt=class extends j{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===E.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};kt.create=(t,e)=>new kt({innerType:t,typeName:P.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...D(e)});Pt=class extends j{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return qt(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new me(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new me(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Pt.create=(t,e)=>new Pt({innerType:t,typeName:P.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...D(e)});Kt=class extends j{_parse(e){if(this._getType(e)!==E.nan){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:E.nan,received:n.parsedType}),k}return{status:"valid",value:e.data}}};Kt.create=t=>new Kt({typeName:P.ZodNaN,...D(t)});fd=Symbol("zod_brand"),yr=class extends j{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},vr=class t extends j{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?k:o.status==="dirty"?(r.dirty(),gt(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?k:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:P.ZodPipeline})}},Dt=class extends j{_parse(e){let r=this._def.innerType._parse(e),n=s=>(st(s)&&(s.value=Object.freeze(s.value)),s);return qt(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}};Dt.create=(t,e)=>new Dt({innerType:t,typeName:P.ZodReadonly,...D(e)});dd={object:ge.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(P||(P={}));pd=(t,e={message:`Input not instance of ${t.name}`})=>Di(r=>r instanceof t,e),$i=ot.create,ji=yt.create,hd=Kt.create,md=vt.create,Oi=xt.create,gd=wt.create,yd=Vt.create,vd=bt.create,xd=_t.create,wd=it.create,bd=Je.create,_d=Pe.create,Sd=Gt.create,Ed=Qe.create,Rd=ge.create,Td=ge.strictCreate,Ad=St.create,Cd=Xr.create,kd=Et.create,Pd=Be.create,Dd=en.create,$d=Yt.create,jd=Zt.create,Od=tn.create,Id=Rt.create,Nd=Tt.create,Ld=At.create,Fd=Ct.create,Md=at.create,Bd=Se.create,Hd=be.create,Ud=He.create,zd=Se.createWithPreprocess,qd=vr.create,Wd=()=>$i().optional(),Vd=()=>ji().optional(),Gd=()=>Oi().optional(),Yd={string:(t=>ot.create({...t,coerce:!0})),number:(t=>yt.create({...t,coerce:!0})),boolean:(t=>xt.create({...t,coerce:!0})),bigint:(t=>vt.create({...t,coerce:!0})),date:(t=>wt.create({...t,coerce:!0}))},Zd=k});var p={};Pn(p,{BRAND:()=>fd,DIRTY:()=>gt,EMPTY_PATH:()=>zf,INVALID:()=>k,NEVER:()=>Zd,OK:()=>ce,ParseStatus:()=>ie,Schema:()=>j,ZodAny:()=>it,ZodArray:()=>Qe,ZodBigInt:()=>vt,ZodBoolean:()=>xt,ZodBranded:()=>yr,ZodCatch:()=>Pt,ZodDate:()=>wt,ZodDefault:()=>kt,ZodDiscriminatedUnion:()=>Xr,ZodEffects:()=>Se,ZodEnum:()=>At,ZodError:()=>me,ZodFirstPartyTypeKind:()=>P,ZodFunction:()=>tn,ZodIntersection:()=>Et,ZodIssueCode:()=>x,ZodLazy:()=>Rt,ZodLiteral:()=>Tt,ZodMap:()=>Yt,ZodNaN:()=>Kt,ZodNativeEnum:()=>Ct,ZodNever:()=>Pe,ZodNull:()=>_t,ZodNullable:()=>He,ZodNumber:()=>yt,ZodObject:()=>ge,ZodOptional:()=>be,ZodParsedType:()=>E,ZodPipeline:()=>vr,ZodPromise:()=>at,ZodReadonly:()=>Dt,ZodRecord:()=>en,ZodSchema:()=>j,ZodSet:()=>Zt,ZodString:()=>ot,ZodSymbol:()=>Vt,ZodTransformer:()=>Se,ZodTuple:()=>Be,ZodType:()=>j,ZodUndefined:()=>bt,ZodUnion:()=>St,ZodUnknown:()=>Je,ZodVoid:()=>Gt,addIssueToContext:()=>S,any:()=>wd,array:()=>Ed,bigint:()=>md,boolean:()=>Oi,coerce:()=>Yd,custom:()=>Di,date:()=>gd,datetimeRegex:()=>ki,defaultErrorMap:()=>Ze,discriminatedUnion:()=>Cd,effect:()=>Bd,enum:()=>Ld,function:()=>Od,getErrorMap:()=>zt,getParsedType:()=>Me,instanceof:()=>pd,intersection:()=>kd,isAborted:()=>Jr,isAsync:()=>qt,isDirty:()=>Qr,isValid:()=>st,late:()=>dd,lazy:()=>Id,literal:()=>Nd,makeIssue:()=>gr,map:()=>$d,nan:()=>hd,nativeEnum:()=>Fd,never:()=>_d,null:()=>xd,nullable:()=>Ud,number:()=>ji,object:()=>Rd,objectUtil:()=>is,oboolean:()=>Gd,onumber:()=>Vd,optional:()=>Hd,ostring:()=>Wd,pipeline:()=>qd,preprocess:()=>zd,promise:()=>Md,quotelessJson:()=>Bf,record:()=>Dd,set:()=>jd,setErrorMap:()=>Uf,strictObject:()=>Td,string:()=>$i,symbol:()=>yd,transformer:()=>Bd,tuple:()=>Pd,undefined:()=>vd,union:()=>Ad,unknown:()=>bd,util:()=>F,void:()=>Sd});var fs=Q(()=>{f();Kr();cs();Si();mr();Ii();Zr()});var $t=Q(()=>{f();fs();fs()});var Kd,Ni,rn,nn=Q(()=>{"use strict";f();$t();Kd=p.object({orgSlug:p.string(),orgName:p.string(),projectSlug:p.string(),projectName:p.string()}),Ni=p.object({dsn:p.string(),projectId:p.string(),orgId:p.string().optional(),source:p.enum(["env","env_file","config","code"]),sourcePath:p.string().optional(),resolved:Kd.optional(),cachedAt:p.number()}),rn=["packages","apps","libs","services","modules"]});var Jd,Qd,Xd,ds,Li=Q(()=>{"use strict";f();$t();nn();Jd=p.object({orgSlug:p.string(),orgName:p.string(),projectSlug:p.string(),projectName:p.string(),cachedAt:p.number()}),Qd=p.object({token:p.string().optional(),refreshToken:p.string().optional(),expiresAt:p.number().optional(),issuedAt:p.number().optional()}),Xd=p.object({organization:p.string().optional(),project:p.string().optional()}),ds=p.object({auth:Qd.optional(),defaults:Xd.optional(),projectCache:p.record(Jd).optional(),dsnCache:p.record(Ni).optional()})});var ps,sn,on,Fi=Q(()=>{"use strict";f();$t();ps=p.object({device_code:p.string(),user_code:p.string(),verification_uri:p.string(),verification_uri_complete:p.string().optional(),expires_in:p.number(),interval:p.number()}).passthrough(),sn=p.object({access_token:p.string(),token_type:p.string(),expires_in:p.number(),expires_at:p.string().optional(),refresh_token:p.string().optional(),scope:p.string().optional(),user:p.object({id:p.string(),name:p.string(),email:p.string()}).passthrough().optional()}).passthrough(),on=p.object({error:p.string(),error_description:p.string().optional()}).passthrough()});var an,cn,Mi,xr,un,Bi=Q(()=>{"use strict";f();$t();an=p.object({id:p.string(),slug:p.string(),name:p.string(),dateCreated:p.string().optional(),isEarlyAdopter:p.boolean().optional(),require2FA:p.boolean().optional(),avatar:p.object({avatarType:p.string(),avatarUuid:p.string().nullable()}).passthrough().optional(),features:p.array(p.string()).optional()}).passthrough(),cn=p.object({id:p.string(),slug:p.string(),name:p.string(),platform:p.string().nullable().optional(),dateCreated:p.string().optional(),isBookmarked:p.boolean().optional(),isMember:p.boolean().optional(),features:p.array(p.string()).optional(),firstEvent:p.string().nullable().optional(),firstTransactionEvent:p.boolean().optional(),access:p.array(p.string()).optional(),hasAccess:p.boolean().optional(),hasMinifiedStackTrace:p.boolean().optional(),hasMonitors:p.boolean().optional(),hasProfiles:p.boolean().optional(),hasReplays:p.boolean().optional(),hasSessions:p.boolean().optional(),isInternal:p.boolean().optional(),isPublic:p.boolean().optional(),avatar:p.object({avatarType:p.string(),avatarUuid:p.string().nullable()}).passthrough().optional(),color:p.string().optional(),status:p.string().optional(),organization:p.object({id:p.string(),slug:p.string(),name:p.string()}).passthrough().optional()}).passthrough(),Mi=["resolved","unresolved","ignored"],xr=p.object({id:p.string(),shortId:p.string(),title:p.string(),culprit:p.string().optional(),permalink:p.string().optional(),logger:p.string().nullable().optional(),level:p.string().optional(),status:p.enum(Mi).optional(),statusDetails:p.record(p.unknown()).optional(),isPublic:p.boolean().optional(),platform:p.string().optional(),project:p.object({id:p.string(),name:p.string(),slug:p.string(),platform:p.string().nullable().optional()}).passthrough().optional(),type:p.string().optional(),metadata:p.object({value:p.string().optional(),type:p.string().optional(),filename:p.string().optional(),function:p.string().optional(),display_title_with_tree_label:p.boolean().optional()}).passthrough().optional(),numComments:p.number().optional(),assignedTo:p.object({id:p.string(),name:p.string(),type:p.string()}).passthrough().nullable().optional(),isBookmarked:p.boolean().optional(),isSubscribed:p.boolean().optional(),subscriptionDetails:p.object({reason:p.string().optional()}).passthrough().nullable().optional(),hasSeen:p.boolean().optional(),annotations:p.array(p.string()).optional(),isUnhandled:p.boolean().optional(),count:p.string().optional(),userCount:p.number().optional(),firstSeen:p.string().datetime({offset:!0}).optional(),lastSeen:p.string().datetime({offset:!0}).optional()}).passthrough(),un=p.object({eventID:p.string(),id:p.string().optional(),projectID:p.string().optional(),context:p.record(p.unknown()).optional(),contexts:p.record(p.unknown()).optional(),dateCreated:p.string().optional(),dateReceived:p.string().optional(),entries:p.array(p.unknown()).optional(),errors:p.array(p.unknown()).optional(),fingerprints:p.array(p.string()).optional(),groupID:p.string().optional(),message:p.string().optional(),metadata:p.record(p.unknown()).optional(),platform:p.string().optional(),sdk:p.object({name:p.string(),version:p.string()}).passthrough().nullable().optional(),tags:p.array(p.object({key:p.string(),value:p.string()})).optional(),title:p.string().optional(),type:p.string().optional(),user:p.object({id:p.string().optional(),email:p.string().optional(),username:p.string().optional(),ip_address:p.string().optional()}).passthrough().nullable().optional()}).passthrough()});var ln=Q(()=>{"use strict";f();Li();Fi();Bi()});var ys={};Pn(ys,{ApiError:()=>Ee,AuthError:()=>ee,CliError:()=>De,ConfigError:()=>Jt,ContextError:()=>se,DeviceFlowError:()=>Xe,ValidationError:()=>hs,formatError:()=>ms,getExitCode:()=>gs});function tp(t,e,r){let n=[`${t} is required.`,"","Specify it using:",` ${e}`];if(r.length>0){n.push("","Or:");for(let s of r)n.push(` - ${s}`)}return n.join(`
|
|
4
|
-
`)}function ms(t){return t instanceof De?t.format():t instanceof Error?t.message:String(t)}function gs(t){return t instanceof De?t.exitCode:1}var De,Ee,ee,Jt,ep,se,hs,Xe,ue=Q(()=>{"use strict";f();De=class extends Error{exitCode;constructor(e,r=1){super(e),this.name="CliError",this.exitCode=r}format(){return this.message}},Ee=class extends De{status;detail;endpoint;constructor(e,r,n,s){super(e),this.name="ApiError",this.status=r,this.detail=n,this.endpoint=s}format(){let e=this.message;return this.detail&&this.detail!==this.message&&(e+=`
|
|
5
|
-
${this.detail}`),e}},ee=class extends De{reason;constructor(e,r){let n={not_authenticated:"Not authenticated. Run 'sentry auth login' first.",expired:"Authentication expired. Run 'sentry auth login' to re-authenticate.",invalid:"Invalid authentication token."};super(r??n[e]),this.name="AuthError",this.reason=e}},Jt=class extends De{suggestion;constructor(e,r){super(e),this.name="ConfigError",this.suggestion=r}format(){let e=this.message;return this.suggestion&&(e+=`
|
|
6
|
-
|
|
7
|
-
Suggestion: ${this.suggestion}`),e}},ep=["Run from a directory with a Sentry-configured project","Set SENTRY_DSN environment variable"];se=class extends De{resource;command;alternatives;constructor(e,r,n=[...ep]){super(tp(e,r,n)),this.name="ContextError",this.resource=e,this.command=r,this.alternatives=n}format(){return this.message}},hs=class extends De{field;constructor(e,r){super(e),this.name="ValidationError",this.field=r}},Xe=class extends De{code;constructor(e,r){super(r??e),this.name="DeviceFlowError",this.code=e}}});var Hi={};Pn(Hi,{completeOAuthFlow:()=>xs,performDeviceFlow:()=>vs,refreshAccessToken:()=>cp,setApiToken:()=>ap});function np(t){return new Promise(e=>setTimeout(e,t))}async function sp(){if(!br)throw new Jt("SENTRY_CLIENT_ID is required for authentication","Set SENTRY_CLIENT_ID environment variable or use a pre-built binary");let t;try{t=await fetch(`${wr}/oauth/device/code/`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:br,scope:rp})})}catch(n){throw n instanceof Error&&(n.message.includes("ECONNREFUSED")||n.message.includes("fetch failed")||n.message.includes("network"))?new Ee(`Cannot connect to Sentry at ${wr}`,0,"Check your network connection and SENTRY_URL configuration"):n}if(!t.ok){let n=await t.text();throw new Ee("Failed to initiate device flow",t.status,n,"/oauth/device/code/")}let e=await t.json(),r=ps.safeParse(e);if(!r.success)throw new Ee("Invalid response from device authorization endpoint",t.status,r.error.errors.map(n=>n.message).join(", "),"/oauth/device/code/");return r.data}async function op(t){let e=await fetch(`${wr}/oauth/token/`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:br,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})}),r=await e.json(),n=sn.safeParse(r);if(n.success)return n.data;let s=on.safeParse(r);throw s.success?new Xe(s.data.error,s.data.error_description):new Ee("Unexpected response from token endpoint",e.status,JSON.stringify(r),"/oauth/token/")}async function ip(t){try{return{status:"success",token:await op(t)}}catch(e){if(!(e instanceof Xe))throw e;switch(e.code){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down"};case"expired_token":return{status:"error",message:"Device code expired. Please run 'sentry auth login' again."};case"access_denied":return{status:"error",message:"Authorization was denied. Please try again."};default:return{status:"error",message:e.message}}}}async function vs(t,e=6e5){let{device_code:r,user_code:n,verification_uri:s,verification_uri_complete:o,interval:i,expires_in:a}=await sp();await t.onUserCode(n,s,o??`${s}?user_code=${n}`);let c=Date.now()+Math.min(e,a*1e3),u=i;for(;Date.now()<c;){await np(u*1e3),t.onPolling?.();let l=await ip(r);switch(l.status){case"success":return l.token;case"pending":continue;case"slow_down":u+=5;continue;case"error":throw new Xe("authorization_failed",l.message);default:throw new Xe("unexpected_error","Unexpected poll result")}}throw new Xe("expired_token","Authentication timed out. Please try again.")}async function xs(t){await Qt(t.access_token,t.expires_in,t.refresh_token)}async function ap(t){await Qt(t)}async function cp(t){if(!br)throw new Jt("SENTRY_CLIENT_ID is required for token refresh","Set SENTRY_CLIENT_ID environment variable or use a pre-built binary");let e;try{e=await fetch(`${wr}/oauth/token/`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:br,grant_type:"refresh_token",refresh_token:t})})}catch(s){throw s instanceof Error&&(s.message.includes("ECONNREFUSED")||s.message.includes("fetch failed")||s.message.includes("network"))?new Ee(`Cannot connect to Sentry at ${wr}`,0,"Check your network connection and SENTRY_URL configuration"):s}if(!e.ok){let s="Token refresh failed";try{let o=await e.json(),i=on.safeParse(o);i.success&&(s=i.data.error_description??i.data.error)}catch{}throw new ee("expired",`Session expired: ${s}. Run 'sentry auth login' to re-authenticate.`)}let r=await e.json(),n=sn.safeParse(r);if(!n.success)throw new Ee("Invalid response from token refresh endpoint",e.status,n.error.errors.map(s=>s.message).join(", "),"/oauth/token/");return n.data}var wr,br,rp,ws=Q(()=>{"use strict";f();ln();Ue();ue();wr=process.env.SENTRY_URL??"https://sentry.io",br=process.env.SENTRY_CLIENT_ID??"1d673b81d60ef84c951359c36296972ca6fd41bd8f45acd2d3a783a3b3c28e41",rp=["project:read","project:write","org:read","event:read","event:write","member:read","team:read"].join(" ")});import{mkdirSync as up}from"node:fs";import{homedir as lp}from"node:os";import{join as Ui}from"node:path";function zi(){return process.env.SENTRY_CLI_CONFIG_DIR||Ui(lp(),".sentry-cli-next")}function bs(){return Ui(zi(),"config.json")}function fp(){up(zi(),{recursive:!0,mode:448})}async function de(){try{let t=bs(),e=Bun.file(t);if(!await e.exists())return{};let r=await e.json(),n=ds.safeParse(r);return n.success?n.data:(console.error("Warning: Config file has invalid format, using defaults"),{})}catch{return{}}}async function Sr(t){fp(),await Bun.write(bs(),JSON.stringify(t,null,2))}async function dp(t){let r={...await de(),...t};return await Sr(r),r}async function pp(){let t=await de();if(!(t.auth?.expiresAt&&Date.now()>t.auth.expiresAt))return t.auth?.token}async function gp(t){let{refreshAccessToken:e}=await Promise.resolve().then(()=>(ws(),Hi)),{AuthError:r}=await Promise.resolve().then(()=>(ue(),ys));try{let n=await e(t),o=Date.now()+n.expires_in*1e3;return await Qt(n.access_token,n.expires_in,n.refresh_token??t),{token:n.access_token,refreshed:!0,expiresAt:o,expiresIn:n.expires_in}}catch(n){throw n instanceof r&&await Xt(),n}}async function Er(t={}){let{force:e=!1}=t,{AuthError:r}=await Promise.resolve().then(()=>(ue(),ys)),n=await de();if(!n.auth?.token)throw new r("not_authenticated");let s=Date.now(),o=n.auth.expiresAt;if(!o)return{token:n.auth.token,refreshed:!1};let i=n.auth.issuedAt??o-mp,a=o-i,c=o-s,u=c/a,l=Math.max(0,Math.floor(c/1e3));if(!e&&u>hp&&s<o)return{token:n.auth.token,refreshed:!1,expiresAt:o,expiresIn:l};if(!n.auth.refreshToken)throw await Xt(),new r("expired","Session expired and no refresh token available. Run 'sentry auth login'.");if(_r)return _r;_r=gp(n.auth.refreshToken);try{return await _r}finally{_r=null}}async function Qt(t,e,r){let n=Date.now(),s=e?n+e*1e3:void 0;await dp({auth:{token:t,refreshToken:r,expiresAt:s,issuedAt:e?n:void 0}})}async function Xt(){let t=await de();t.auth=void 0,await Sr(t)}async function ct(){return(await de()).defaults?.organization}async function Rr(){return(await de()).defaults?.project}async function er(){return!!await pp()}function jt(){return bs()}function qi(t,e){return`${t}:${e}`}async function fn(t,e){let r=await de(),n=qi(t,e);return r.projectCache?.[n]}async function _s(t,e,r){let n=await de(),s=qi(t,e);n.projectCache={...n.projectCache,[s]:{...r,cachedAt:Date.now()}},await Sr(n)}var hp,mp,_r,Ue=Q(()=>{"use strict";f();ln();hp=.1,mp=3600*1e3,_r=null});var Is=oe((ux,$a)=>{f();$a.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var Ia=oe((fx,Oa)=>{f();var th=Is();function ja(t){this.mode=th.MODE_8BIT_BYTE,this.data=t}ja.prototype={getLength:function(){return this.data.length},write:function(t){for(var e=0;e<this.data.length;e++)t.put(this.data.charCodeAt(e),8)}};Oa.exports=ja});var Ns=oe((px,Na)=>{f();var Oe={glog:function(t){if(t<1)throw new Error("glog("+t+")");return Oe.LOG_TABLE[t]},gexp:function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return Oe.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(re=0;re<8;re++)Oe.EXP_TABLE[re]=1<<re;var re;for(re=8;re<256;re++)Oe.EXP_TABLE[re]=Oe.EXP_TABLE[re-4]^Oe.EXP_TABLE[re-5]^Oe.EXP_TABLE[re-6]^Oe.EXP_TABLE[re-8];var re;for(re=0;re<255;re++)Oe.LOG_TABLE[Oe.EXP_TABLE[re]]=re;var re;Na.exports=Oe});var Ls=oe((mx,La)=>{f();var Ot=Ns();function yn(t,e){if(t.length===void 0)throw new Error(t.length+"/"+e);for(var r=0;r<t.length&&t[r]===0;)r++;this.num=new Array(t.length-r+e);for(var n=0;n<t.length-r;n++)this.num[n]=t[n+r]}yn.prototype={get:function(t){return this.num[t]},getLength:function(){return this.num.length},multiply:function(t){for(var e=new Array(this.getLength()+t.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<t.getLength();n++)e[r+n]^=Ot.gexp(Ot.glog(this.get(r))+Ot.glog(t.get(n)));return new yn(e,0)},mod:function(t){if(this.getLength()-t.getLength()<0)return this;for(var e=Ot.glog(this.get(0))-Ot.glog(t.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(var s=0;s<t.getLength();s++)r[s]^=Ot.gexp(Ot.glog(t.get(s))+e);return new yn(r,0).mod(t)}};La.exports=yn});var Ma=oe((yx,Fa)=>{f();Fa.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var Ua=oe((xx,Ha)=>{f();var Ae=Is(),Ba=Ls(),rh=Ns(),ut=Ma(),ae={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(t){for(var e=t<<10;ae.getBCHDigit(e)-ae.getBCHDigit(ae.G15)>=0;)e^=ae.G15<<ae.getBCHDigit(e)-ae.getBCHDigit(ae.G15);return(t<<10|e)^ae.G15_MASK},getBCHTypeNumber:function(t){for(var e=t<<12;ae.getBCHDigit(e)-ae.getBCHDigit(ae.G18)>=0;)e^=ae.G18<<ae.getBCHDigit(e)-ae.getBCHDigit(ae.G18);return t<<12|e},getBCHDigit:function(t){for(var e=0;t!==0;)e++,t>>>=1;return e},getPatternPosition:function(t){return ae.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case ut.PATTERN000:return(e+r)%2===0;case ut.PATTERN001:return e%2===0;case ut.PATTERN010:return r%3===0;case ut.PATTERN011:return(e+r)%3===0;case ut.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case ut.PATTERN101:return e*r%2+e*r%3===0;case ut.PATTERN110:return(e*r%2+e*r%3)%2===0;case ut.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new Ba([1],0),r=0;r<t;r++)e=e.multiply(new Ba([1,rh.gexp(r)],0));return e},getLengthInBits:function(t,e){if(1<=e&&e<10)switch(t){case Ae.MODE_NUMBER:return 10;case Ae.MODE_ALPHA_NUM:return 9;case Ae.MODE_8BIT_BYTE:return 8;case Ae.MODE_KANJI:return 8;default:throw new Error("mode:"+t)}else if(e<27)switch(t){case Ae.MODE_NUMBER:return 12;case Ae.MODE_ALPHA_NUM:return 11;case Ae.MODE_8BIT_BYTE:return 16;case Ae.MODE_KANJI:return 10;default:throw new Error("mode:"+t)}else if(e<41)switch(t){case Ae.MODE_NUMBER:return 14;case Ae.MODE_ALPHA_NUM:return 13;case Ae.MODE_8BIT_BYTE:return 16;case Ae.MODE_KANJI:return 12;default:throw new Error("mode:"+t)}else throw new Error("type:"+e)},getLostPoint:function(t){var e=t.getModuleCount(),r=0,n=0,s=0;for(n=0;n<e;n++)for(s=0;s<e;s++){for(var o=0,i=t.isDark(n,s),a=-1;a<=1;a++)if(!(n+a<0||e<=n+a))for(var c=-1;c<=1;c++)s+c<0||e<=s+c||a===0&&c===0||i===t.isDark(n+a,s+c)&&o++;o>5&&(r+=3+o-5)}for(n=0;n<e-1;n++)for(s=0;s<e-1;s++){var u=0;t.isDark(n,s)&&u++,t.isDark(n+1,s)&&u++,t.isDark(n,s+1)&&u++,t.isDark(n+1,s+1)&&u++,(u===0||u===4)&&(r+=3)}for(n=0;n<e;n++)for(s=0;s<e-6;s++)t.isDark(n,s)&&!t.isDark(n,s+1)&&t.isDark(n,s+2)&&t.isDark(n,s+3)&&t.isDark(n,s+4)&&!t.isDark(n,s+5)&&t.isDark(n,s+6)&&(r+=40);for(s=0;s<e;s++)for(n=0;n<e-6;n++)t.isDark(n,s)&&!t.isDark(n+1,s)&&t.isDark(n+2,s)&&t.isDark(n+3,s)&&t.isDark(n+4,s)&&!t.isDark(n+5,s)&&t.isDark(n+6,s)&&(r+=40);var l=0;for(s=0;s<e;s++)for(n=0;n<e;n++)t.isDark(n,s)&&l++;var d=Math.abs(100*l/e/e-50)/5;return r+=d*10,r}};Ha.exports=ae});var Fs=oe((bx,za)=>{f();za.exports={L:1,M:0,Q:3,H:2}});var Wa=oe((Sx,qa)=>{f();var vn=Fs();function ze(t,e){this.totalCount=t,this.dataCount=e}ze.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];ze.getRSBlocks=function(t,e){var r=ze.getRsBlockTable(t,e);if(r===void 0)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);for(var n=r.length/3,s=[],o=0;o<n;o++)for(var i=r[o*3+0],a=r[o*3+1],c=r[o*3+2],u=0;u<i;u++)s.push(new ze(a,c));return s};ze.getRsBlockTable=function(t,e){switch(e){case vn.L:return ze.RS_BLOCK_TABLE[(t-1)*4+0];case vn.M:return ze.RS_BLOCK_TABLE[(t-1)*4+1];case vn.Q:return ze.RS_BLOCK_TABLE[(t-1)*4+2];case vn.H:return ze.RS_BLOCK_TABLE[(t-1)*4+3];default:return}};qa.exports=ze});var Ya=oe((Rx,Ga)=>{f();function Va(){this.buffer=[],this.length=0}Va.prototype={get:function(t){var e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)==1},put:function(t,e){for(var r=0;r<e;r++)this.putBit((t>>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};Ga.exports=Va});var Qa=oe((Ax,Ja)=>{f();var nh=Ia(),lt=Ua(),sh=Ls(),Za=Wa(),Ka=Ya();function qe(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}qe.prototype={addData:function(t){var e=new nh(t);this.dataList.push(e),this.dataCache=null},isDark:function(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var t=1;for(t=1;t<40;t++){for(var e=Za.getRSBlocks(t,this.errorCorrectLevel),r=new Ka,n=0,s=0;s<e.length;s++)n+=e[s].dataCount;for(var o=0;o<this.dataList.length;o++){var i=this.dataList[o];r.put(i.mode,4),r.put(i.getLength(),lt.getLengthInBits(i.mode,t)),i.write(r)}if(r.getLengthInBits()<=n*8)break}this.typeNumber=t}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(t,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++)this.modules[r][n]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),this.typeNumber>=7&&this.setupTypeNumber(t),this.dataCache===null&&(this.dataCache=qe.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=r&&r<=6&&(n===0||n===6)||0<=n&&n<=6&&(r===0||r===6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[t+r][e+n]=!0:this.modules[t+r][e+n]=!1)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=lt.getLostPoint(this);(r===0||t>n)&&(t=n,e=r)}return e},createMovieClip:function(t,e,r){var n=t.createEmptyMovieClip(e,r),s=1;this.make();for(var o=0;o<this.modules.length;o++)for(var i=o*s,a=0;a<this.modules[o].length;a++){var c=a*s,u=this.modules[o][a];u&&(n.beginFill(0,100),n.moveTo(c,i),n.lineTo(c+s,i),n.lineTo(c+s,i+s),n.lineTo(c,i+s),n.endFill())}return n},setupTimingPattern:function(){for(var t=8;t<this.moduleCount-8;t++)this.modules[t][6]===null&&(this.modules[t][6]=t%2===0);for(var e=8;e<this.moduleCount-8;e++)this.modules[6][e]===null&&(this.modules[6][e]=e%2===0)},setupPositionAdjustPattern:function(){for(var t=lt.getPatternPosition(this.typeNumber),e=0;e<t.length;e++)for(var r=0;r<t.length;r++){var n=t[e],s=t[r];if(this.modules[n][s]===null)for(var o=-2;o<=2;o++)for(var i=-2;i<=2;i++)Math.abs(o)===2||Math.abs(i)===2||o===0&&i===0?this.modules[n+o][s+i]=!0:this.modules[n+o][s+i]=!1}},setupTypeNumber:function(t){for(var e=lt.getBCHTypeNumber(this.typeNumber),r,n=0;n<18;n++)r=!t&&(e>>n&1)===1,this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r;for(var s=0;s<18;s++)r=!t&&(e>>s&1)===1,this.modules[s%3+this.moduleCount-8-3][Math.floor(s/3)]=r},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,n=lt.getBCHTypeInfo(r),s,o=0;o<15;o++)s=!t&&(n>>o&1)===1,o<6?this.modules[o][8]=s:o<8?this.modules[o+1][8]=s:this.modules[this.moduleCount-15+o][8]=s;for(var i=0;i<15;i++)s=!t&&(n>>i&1)===1,i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s;this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,n=this.moduleCount-1,s=7,o=0,i=this.moduleCount-1;i>0;i-=2)for(i===6&&i--;;){for(var a=0;a<2;a++)if(this.modules[n][i-a]===null){var c=!1;o<t.length&&(c=(t[o]>>>s&1)===1);var u=lt.getMask(e,n,i-a);u&&(c=!c),this.modules[n][i-a]=c,s--,s===-1&&(o++,s=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};qe.PAD0=236;qe.PAD1=17;qe.createData=function(t,e,r){for(var n=Za.getRSBlocks(t,e),s=new Ka,o=0;o<r.length;o++){var i=r[o];s.put(i.mode,4),s.put(i.getLength(),lt.getLengthInBits(i.mode,t)),i.write(s)}for(var a=0,c=0;c<n.length;c++)a+=n[c].dataCount;if(s.getLengthInBits()>a*8)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+a*8+")");for(s.getLengthInBits()+4<=a*8&&s.put(0,4);s.getLengthInBits()%8!==0;)s.putBit(!1);for(;!(s.getLengthInBits()>=a*8||(s.put(qe.PAD0,8),s.getLengthInBits()>=a*8));)s.put(qe.PAD1,8);return qe.createBytes(s,n)};qe.createBytes=function(t,e){for(var r=0,n=0,s=0,o=new Array(e.length),i=new Array(e.length),a=0;a<e.length;a++){var c=e[a].dataCount,u=e[a].totalCount-c;n=Math.max(n,c),s=Math.max(s,u),o[a]=new Array(c);for(var l=0;l<o[a].length;l++)o[a][l]=255&t.buffer[l+r];r+=c;var d=lt.getErrorCorrectPolynomial(u),h=new sh(o[a],d.getLength()-1),v=h.mod(d);i[a]=new Array(d.getLength()-1);for(var w=0;w<i[a].length;w++){var T=w+v.getLength()-i[a].length;i[a][w]=T>=0?v.get(T):0}}for(var C=0,O=0;O<e.length;O++)C+=e[O].totalCount;for(var b=new Array(C),N=0,I=0;I<n;I++)for(var H=0;H<e.length;H++)I<o[H].length&&(b[N++]=o[H][I]);for(var U=0;U<s;U++)for(var q=0;q<e.length;q++)U<i[q].length&&(b[N++]=i[q][U]);return b};Ja.exports=qe});var tc=oe((kx,ec)=>{f();var oh=Qa(),Xa=Fs(),ih="\x1B[40m \x1B[0m",xn="\x1B[47m \x1B[0m",ah=function(t){return t?ih:xn},Ms=function(t){return{times:function(e){return new Array(e).join(t)}}},ch=function(t,e){for(var r=new Array(t),n=0;n<t;n++)r[n]=e;return r};ec.exports={error:Xa.L,generate:function(t,e,r){typeof e=="function"&&(r=e,e={});var n=new oh(-1,this.error);n.addData(t),n.make();var s="";if(e&&e.small){var o=!0,i=!1,a=n.getModuleCount(),c=n.modules.slice(),u=a%2===1;u&&c.push(ch(a,i));var l={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},d=Ms(l.BLACK_WHITE).times(a+3),h=Ms(l.WHITE_BLACK).times(a+3);s+=d+`
|
|
8
|
-
`;for(var v=0;v<a;v+=2){s+=l.WHITE_ALL;for(var w=0;w<a;w++)c[v][w]===i&&c[v+1][w]===i?s+=l.WHITE_ALL:c[v][w]===i&&c[v+1][w]===o?s+=l.WHITE_BLACK:c[v][w]===o&&c[v+1][w]===i?s+=l.BLACK_WHITE:s+=l.BLACK_ALL;s+=l.WHITE_ALL+`
|
|
9
|
-
`}u||(s+=h)}else{var T=Ms(xn).times(n.getModuleCount()+3);s+=T+`
|
|
10
|
-
`,n.modules.forEach(function(C){s+=xn,s+=C.map(ah).join(""),s+=xn+`
|
|
11
|
-
`}),s+=T}r?r(s):console.log(s)},setErrorLevel:function(t){this.error=Xa[t]||this.error}}});f();f();function Vo(t,e){let r=t.env?.[e];return typeof r=="string"&&r!=="0"}var Ne={UnknownCommand:-5,InvalidArgument:-4,ContextLoadError:-3,CommandLoadError:-2,InternalError:-1,Success:0,CommandRunError:1};function Yn(t){return t.replace(/-./g,e=>e[1].toUpperCase())}function ke(t){return Array.from(t).map((e,r)=>{let n=e.toUpperCase(),s=e.toLowerCase();return r===0||n!==e||n===s?e:`-${s}`}).join("")}function Gl(t){let e=new Map;return{get:(...r)=>e.get(r.join(","))??t,set:(r,...n)=>{e.set(n.join(","),r)}}}function Yl(t,e,r){let{threshold:n,weights:s}=r;if(t===e)return 0;let o=Math.abs(t.length-e.length);if(typeof n=="number"&&o>n)return 1/0;let i=Gl(1/0);i.set(0,-1,-1);for(let u=0;u<e.length;++u)i.set((u+1)*s.insertion,-1,u);for(let u=0;u<t.length;++u)i.set((u+1)*s.deletion,u,-1);let a=-1/0;for(let u=0;u<t.length;++u){let l=1/0;for(let d=0;d<=e.length-1;++d){let h=t[u]===e[d]?0:1,v=[i.get(u-1,d)+s.deletion,i.get(u,d-1)+s.insertion,i.get(u-1,d-1)+h*s.substitution];t[u]===e[d-1]&&t[u-1]===e[d]&&v.push(i.get(u-2,d-2)+h*s.transposition);let w=Math.min(...v);i.set(w,u,d),w<l&&(l=w)}if(l>n){if(a>n)return 1/0;a=l}else a=-1/0}let c=i.get(t.length-1,e.length-1);return c>n?1/0:c}function Zl(t,e,r){let n=t[1]-e[1];if(n!==0)return n;let s=t[0].startsWith(r),o=e[0].startsWith(r);return s&&!o?-1:!s&&o?1:t[0].localeCompare(e[0])}function lr(t,e,r){let n=e.map(o=>[o,Yl(t,o,r)]).filter(([,o])=>o<=r.threshold),s=Math.min(...n.map(([,o])=>o));return n.filter(([,o])=>o===s).sort((o,i)=>Zl(o,i,t)).map(([o])=>o)}var fe=class extends Error{};function Br(t){return t instanceof Error?t.stack??String(t):String(t)}function Kl(t,e){let r=[],n=Math.max(t.length,e.length);for(let s=0;s<n;++s)r[s]=Math.max(t[s],e[s]);return r}function Hr(t,e){if(t.length===0)return[];let r=Array(Math.max(...t.map(s=>s.length))).fill(0,0),n=t.reduce((s,o)=>{let i=o.map(a=>a.length);return Kl(s,i)},r);return t.map(s=>{let o=(s[0]??"").padEnd(n[0]);return s.slice(1).reduce((i,a,c,u)=>{let l=u.length===c+1?a:a.padEnd(n[c+1]);return[...i,e?.[c]??" ",l]},[o]).join("").trimEnd()})}function Zn(t,e){if(t.length<=1)return t[0]??"";if(t.length===2)return t.join(` ${e.conjunction} `);let r=t.slice(0,t.length-1).join(", ");return e.serialComma&&(r+=","),[r,e.conjunction,t[t.length-1]].join(" ")}function Jl(t,e){return t.reduce((r,n)=>{let s=e(n),o=r[s]??[];return o.push(n),r[s]=o,r},{})}function Ql(t,e){return Jl(t,r=>r[e])}async function zn(t){let e=await Promise.allSettled(t),r=Ql(e,"status");return r.rejected&&r.rejected.length>0?{status:"rejected",reasons:r.rejected.map(n=>n.reason)}:{status:"fulfilled",value:r.fulfilled?.map(n=>n.value)??[]}}var Xl=new Set(["true","t","yes","y","on","1"]),ef=new Set(["false","f","no","n","off","0"]),tf=t=>{let e=t.toLowerCase();if(Xl.has(e))return!0;if(ef.has(e))return!1;throw new SyntaxError(`Cannot convert ${t} to a boolean`)},Ye=t=>{let e=Number(t);if(Number.isNaN(e))throw new SyntaxError(`Cannot convert ${t} to a number`);return e},Fe=class extends fe{_brand};function rf(t,e){let r=t.constructor.name,n=e[r];return n?n(t):t.message}function nf(t,e,r){return Object.fromEntries(Object.entries(e).map(([n,s])=>{let o=s,i=t[o];if(!i){let a=Ge(o,r);throw new ur(a,[],n)}return[n,[o,i]]}))}var ur=class extends Fe{input;corrections;aliasName;constructor(t,e,r){let n=`No flag registered for --${t}`;if(r)n+=` (aliased from -${r})`;else if(e.length>0){let s=Zn(e.map(o=>`--${o}`),{kind:"conjunctive",conjunction:"or",serialComma:!0});n+=`, did you mean ${s}?`}super(n),this.input=t,this.corrections=e,this.aliasName=r}},Kn=class extends Fe{input;constructor(t){super(`No alias registered for -${t}`),this.input=t}};function qn(t,e){return t.placeholder?t.placeholder:typeof e=="number"?`arg${e}`:"args"}function Ge(t,e){return e==="allow-kebab-for-camel"?ke(t):t}var Gn=class extends Fe{externalFlagNameOrPlaceholder;input;exception;constructor(t,e,r){super(`Failed to parse "${e}" for ${t}: ${r instanceof Error?r.message:String(r)}`),this.externalFlagNameOrPlaceholder=t,this.input=e,this.exception=r}};function pt(t,e,r,n){try{return e.parse.call(n,r)}catch(s){throw new Gn(t,r,s)}}var Wn=class extends Fe{externalFlagName;input;values;constructor(t,e,r,n){let s=`Expected "${e}" to be one of (${r.join("|")})`;if(n.length>0){let o=Zn(n.map(i=>`"${i}"`),{kind:"conjunctive",conjunction:"or",serialComma:!0});s+=`, did you mean ${o}?`}super(s),this.externalFlagName=t,this.input=e,this.values=r}},Bt=class extends Fe{externalFlagName;nextFlagName;constructor(t,e){let r=`Expected input for flag --${t}`;e&&(r+=` but encountered --${e} instead`),super(r),this.externalFlagName=t,this.nextFlagName=e}},Mo=class extends Fe{expectedCount;input;constructor(t,e){super(`Too many arguments, expected ${t} but encountered "${e}"`),this.expectedCount=t,this.input=e}},Bo=class extends Fe{placeholder;limit;constructor(t,e){let r;e?(r=`Expected at least ${e[0]} argument(s) for ${t}`,e[1]===0?r+=" but found none":r+=` but only found ${e[1]}`):r=`Expected argument for ${t}`,super(r),this.placeholder=t,this.limit=e}};function Ho(t){if(t.startsWith("no")&&t.length>2){if(t[2]==="-")return t.slice(4);let e=t[2],r=e.toUpperCase();return e!==r?void 0:e.toLowerCase()+t.slice(3)}}function Go(t,e,r){let n=t,s=e[n],o,i=!1;if(!s){let c=Ho(n);if(c&&(s=e[c],s&&s.kind=="boolean")){if(s.withNegated!==!1)return{namedFlag:[c,s],negated:!0};o=c,s=void 0}}let a=Yn(t);if(r.caseStyle==="allow-kebab-for-camel"&&!s){if(s=e[a],s)return{namedFlag:[a,s]};let c=Ho(a);if(c&&(s=e[c],s&&s.kind=="boolean")){if(s.withNegated!==!1)return{namedFlag:[c,s],negated:!0};o=c,i=!0,s=void 0}}if(!s){if(o){let l=o;throw i&&t.includes("-")&&(l=ke(o)),new ur(t,[l])}if(a in e)throw new ur(t,[a]);let c=ke(t);if(c in e)throw new ur(t,[c]);let u=lr(n,Object.keys(e),r.distanceOptions);throw new ur(t,u)}return{namedFlag:[n,s]}}function Uo(t){return t.namedFlag[1].kind==="boolean"||t.namedFlag[1].kind==="counter"}var Yo=/^-([a-z]+)$/i,sf=/^--([a-z][a-z-.\d_]+)$/i;function of(t,e,r,n){let s=Yo.exec(t);if(s){let i=s[1];return Array.from(i).map(a=>{let c=a,u=r[c];if(!u)throw new Kn(c);return{namedFlag:u}})}let o=sf.exec(t);if(o){let i=o[1];return[Go(i,e,n)]}return[]}var af=/^--([a-z][a-z-.\d_]+)=(.+)$/i,cf=/^-([a-z])=(.+)$/i,uf=class extends Fe{externalFlagName;valueText;constructor(t,e){super(`Cannot negate flag --${t} and pass "${e}" as value`),this.externalFlagName=t,this.valueText=e}};function lf(t,e,r,n){let s=af.exec(t);if(s){let i=s[1],{namedFlag:a,negated:c}=Go(i,e,n),u=s[2];if(c)throw new uf(i,u);return[a,u]}let o=cf.exec(t);if(o){let i=o[1],a=r[i];if(!a)throw new Kn(i);let c=o[2];return[a,c]}}async function ff(t,e,r,n,s){if(!r){if("default"in e&&typeof e.default<"u"){if(e.kind==="boolean")return e.default;if(e.kind==="enum"){if("variadic"in e&&e.variadic&&Array.isArray(e.default)){let i=e.default;for(let a of i)if(!e.values.includes(a)){let c=lr(a,e.values,n.distanceOptions);throw new Wn(t,a,e.values,c)}return e.default}return e.default}if("variadic"in e&&e.variadic&&Array.isArray(e.default)){let i=e.default;return Promise.all(i.map(a=>pt(t,e,a,s)))}return pt(t,e,e.default,s)}if(e.optional)return;if(e.kind==="boolean")return!1;if(e.kind==="counter")return 0;throw new Bt(t)}if(e.kind==="counter")return r.reduce((i,a)=>{try{return i+Ye.call(s,a)}catch(c){throw new Gn(t,a,c)}},0);if("variadic"in e&&e.variadic){if(e.kind==="enum"){for(let i of r)if(!e.values.includes(i)){let a=lr(i,e.values,n.distanceOptions);throw new Wn(t,i,e.values,a)}return r}return Promise.all(r.map(i=>pt(t,e,i,s)))}let o=r[0];if(e.kind==="boolean")try{return tf.call(s,o)}catch(i){throw new Gn(t,o,i)}if(e.kind==="enum"){if(!e.values.includes(o)){let i=lr(o,e.values,n.distanceOptions);throw new Wn(t,o,e.values,i)}return o}return pt(t,e,o,s)}var df=class extends Fe{externalFlagName;previousInput;input;constructor(t,e,r){super(`Too many arguments for --${t}, encountered "${r}" after "${e}"`),this.externalFlagName=t,this.previousInput=e,this.input=r}};function Zo(t){return t.kind==="counter"?!0:"variadic"in t?!!t.variadic:!1}function Ve(t,e,[r,n],s){let o=t.get(r)??[];if(o.length>0&&!Zo(n)){let i=Ge(r,e);throw new df(i,o[0],s)}if("variadic"in n&&typeof n.variadic=="string"){let i=s.split(n.variadic);t.set(r,[...o,...i])}else t.set(r,[...o,s])}function Vn(t,e,r){if(e.get(r)){let s=t[r];return!Zo(s)}return!1}function pf(t,e){let{flags:r={},aliases:n={},positional:s={kind:"tuple",parameters:[]}}=t,o=nf(r,n,e.caseStyle),i=[],a=new Map,c=0,u,l=!1;return{next:d=>{if(!l&&e.allowArgumentEscapeSequence&&d==="--"){if(u)if(u[1].kind==="parsed"&&u[1].inferEmpty)Ve(a,e.caseStyle,u,""),u=void 0;else{let h=Ge(u[0],e.caseStyle);throw new Bt(h)}l=!0;return}if(!l){let h=lf(d,r,o,e);if(h){if(u)if(u[1].kind==="parsed"&&u[1].inferEmpty)Ve(a,e.caseStyle,u,""),u=void 0;else{let w=Ge(u[0],e.caseStyle),T=Ge(h[0][0],e.caseStyle);throw new Bt(w,T)}Ve(a,e.caseStyle,...h);return}let v=of(d,r,o,e);if(v.length>0){if(u)if(u[1].kind==="parsed"&&u[1].inferEmpty)Ve(a,e.caseStyle,u,""),u=void 0;else{let w=Ge(u[0],e.caseStyle),T=Ge(v[0].namedFlag[0],e.caseStyle);throw new Bt(w,T)}if(v.every(Uo))for(let w of v)w.namedFlag[1].kind==="boolean"?Ve(a,e.caseStyle,w.namedFlag,w.negated?"false":"true"):Ve(a,e.caseStyle,w.namedFlag,"1");else if(v.length>1){let w=v.find(C=>!Uo(C)),T=Ge(w.namedFlag[0],e.caseStyle);throw new Bt(T)}else u=v[0].namedFlag;return}}if(u)Ve(a,e.caseStyle,u,d),u=void 0;else{if(s.kind==="tuple"){if(c>=s.parameters.length)throw new Mo(s.parameters.length,d)}else if(typeof s.maximum=="number"&&c>=s.maximum)throw new Mo(s.maximum,d);i[c]=d,++c}},parseArguments:async d=>{let h=[],v;s.kind==="array"?(typeof s.minimum=="number"&&c<s.minimum&&h.push(new Bo(qn(s.parameter),[s.minimum,c])),v=zn(i.map(async(b,N)=>{let I=qn(s.parameter,N+1);return pt(I,s.parameter,b,d)}))):v=zn(s.parameters.map(async(b,N)=>{let I=qn(b,N+1),H=i[N];if(typeof H!="string"){if(typeof b.default=="string")return pt(I,b,b.default,d);if(b.optional)return;throw new Bo(I)}return pt(I,b,H,d)})),u&&u[1].kind==="parsed"&&u[1].inferEmpty&&(Ve(a,e.caseStyle,u,""),u=void 0);let w=zn(Object.entries(r).map(async b=>{let[N,I]=b,H=Ge(N,e.caseStyle);if(u&&u[0]===N)throw new Bt(H);let U=a.get(N),q=await ff(H,I,U,e,d);return[N,q]})),[T,C]=await Promise.all([v,w]);if(T.status==="rejected")for(let b of T.reasons)h.push(b);if(C.status==="rejected")for(let b of C.reasons)h.push(b);if(h.length>0)return{success:!1,errors:h};if(T.status==="rejected")throw new fe("Unknown failure while scanning positional arguments");if(C.status==="rejected")throw new fe("Unknown failure while scanning flag arguments");return{success:!0,arguments:[Object.fromEntries(C.value),...T.value]}},proposeCompletions:async({partial:d,completionConfig:h,text:v,context:w,includeVersionFlag:T})=>{if(u)return Ko(u[1],w,d);let C=[];if(!l){let O=Yo.exec(d);if(h.includeAliases){if(d===""||d==="-"){let b=Object.entries(n).filter(N=>!Vn(r,a,N[1]));for(let[N]of b){let I=o[N];I&&C.push({kind:"argument:flag",completion:`-${N}`,brief:I[1].brief})}}else if(O){let b=Array.from(O[1]);if(b.includes("h"))return[];if(T&&b.includes("v"))return[];let N=new Map(a);for(let U of b){let q=o[U];if(!q)throw new Kn(U);Ve(N,e.caseStyle,q,q[1].kind==="boolean"?"true":"1")}let I=b[b.length-1];if(I){let U=o[I];U&&C.push({kind:"argument:flag",completion:d,brief:U[1].brief})}let H=Object.entries(n).filter(U=>!Vn(r,N,U[1]));for(let[U]of H){let q=o[U];q&&C.push({kind:"argument:flag",completion:`${d}${U}`,brief:q[1].brief})}}}if(d===""||d==="-"||d.startsWith("--")){e.allowArgumentEscapeSequence&&C.push({kind:"argument:flag",completion:"--",brief:v.briefs.argumentEscapeSequence});let b=Object.entries(r).filter(([I])=>!Vn(r,a,I));e.caseStyle==="allow-kebab-for-camel"&&(b=b.map(([I,H])=>[ke(I),H]));let N=b.map(([I,H])=>[`--${I}`,H]).filter(([I])=>I.startsWith(d));C.push(...N.map(([I,H])=>({kind:"argument:flag",completion:I,brief:H.brief})))}}if(s.kind==="array"){if(s.parameter.proposeCompletions&&(typeof s.maximum!="number"||c<s.maximum)){let O=await s.parameter.proposeCompletions.call(w,d);C.push(...O.map(b=>({kind:"argument:value",completion:b,brief:s.parameter.brief})))}}else{let O=s.parameters[c];if(O?.proposeCompletions){let b=await O.proposeCompletions.call(w,d);C.push(...b.map(N=>({kind:"argument:value",completion:N,brief:O.brief})))}}return C.filter(({completion:O})=>O.startsWith(d))}}}async function Ko(t,e,r){if(typeof t.variadic=="string"&&r.endsWith(t.variadic))return Ko(t,e,"");let n;return t.kind==="enum"?n=t.values:t.proposeCompletions?n=await t.proposeCompletions.call(e,r):n=[],n.map(s=>({kind:"argument:value",completion:s,brief:t.brief})).filter(({completion:s})=>s.startsWith(r))}function hf(t,e,r){let n=e==="allow-kebab-for-camel"?"convert-camel-to-kebab":e,s=t.getAllEntries();return r.includeHiddenRoutes||(s=s.filter(o=>!o.hidden)),s.flatMap(o=>{let i=o.name[n];return r.includeAliases?[i,...o.aliases]:[i]})}var mf={headers:{usage:"USAGE",aliases:"ALIASES",commands:"COMMANDS",flags:"FLAGS",arguments:"ARGUMENTS"},keywords:{default:"default =",separator:"separator ="},briefs:{help:"Print help information and exit",helpAll:"Print help information (including hidden commands/flags) and exit",version:"Print version information and exit",argumentEscapeSequence:"All subsequent inputs should be interpreted as arguments"},noCommandRegisteredForInput:({input:t,corrections:e})=>{let r=`No command registered for \`${t}\``;if(e.length>0){let n=Zn(e,{kind:"conjunctive",conjunction:"or",serialComma:!0});return`${r}, did you mean ${n}?`}else return r},noTextAvailableForLocale:({requestedLocale:t,defaultLocale:e})=>`Application does not support "${t}" locale, defaulting to "${e}"`,exceptionWhileParsingArguments:t=>t instanceof Fe?rf(t,{}):`Unable to parse arguments, ${Br(t)}`,exceptionWhileLoadingCommandFunction:t=>`Unable to load command function, ${Br(t)}`,exceptionWhileLoadingCommandContext:t=>`Unable to load command context, ${Br(t)}`,exceptionWhileRunningCommand:t=>`Command failed, ${Br(t)}`,commandErrorResult:t=>t.message,currentVersionIsNotLatest:({currentVersion:t,latestVersion:e,upgradeCommand:r})=>r?`Latest available version is ${e} (currently running ${t}), upgrade with "${r}"`:`Latest available version is ${e} (currently running ${t})`};function gf(t){if(t.startsWith("en"))return mf}function Le(t,e,r){return!r.disableAnsiColor&&!Vo(t,"STRICLI_NO_COLOR")&&(e.getColorDepth?.(t.env)??1)>=4}async function yf({loader:t,parameters:e},{context:r,inputs:n,scannerConfig:s,errorFormatting:o,documentationConfig:i,determineExitCode:a}){let c;try{let l=pf(e,s);for(let h of n)l.next(h);let d=await l.parseArguments(r);if(d.success)c=d.arguments;else{let h=Le(r.process,r.process.stderr,i);for(let v of d.errors){let w=o.exceptionWhileParsingArguments(v,h);r.process.stderr.write(h?`\x1B[1m\x1B[31m${w}\x1B[39m\x1B[22m
|
|
12
|
-
`:`${w}
|
|
13
|
-
`)}return Ne.InvalidArgument}}catch(l){let d=Le(r.process,r.process.stderr,i),h=o.exceptionWhileParsingArguments(l,d);return r.process.stderr.write(d?`\x1B[1m\x1B[31m${h}\x1B[39m\x1B[22m
|
|
14
|
-
`:`${h}
|
|
15
|
-
`),Ne.InvalidArgument}let u;try{let l=await t();typeof l=="function"?u=l:u=l.default}catch(l){let d=Le(r.process,r.process.stderr,i),h=o.exceptionWhileLoadingCommandFunction(l,d);return r.process.stderr.write(d?`\x1B[1m\x1B[31m${h}\x1B[39m\x1B[22m
|
|
16
|
-
`:`${h}
|
|
17
|
-
`),Ne.CommandLoadError}try{let l=await u.call(r,...c);if(l instanceof Error){let d=Le(r.process,r.process.stderr,i),h=o.commandErrorResult(l,d);return r.process.stderr.write(d?`\x1B[1m\x1B[31m${h}\x1B[39m\x1B[22m
|
|
18
|
-
`:`${h}
|
|
19
|
-
`),a?a(l):Ne.CommandRunError}}catch(l){let d=Le(r.process,r.process.stderr,i),h=o.exceptionWhileRunningCommand(l,d);return r.process.stderr.write(d?`\x1B[1m\x1B[31m${h}\x1B[39m\x1B[22m
|
|
20
|
-
`:`${h}
|
|
21
|
-
`),a?a(l):Ne.CommandRunError}return Ne.Success}var Ur=Symbol("RouteMap"),Jn=Symbol("Command");function vf(t,e,r){let n=[...r],s=[],o,i=t,a,c=!0,u=!1;return{next:l=>{if(l==="--help"||l==="-h"){u=!0,a||(a=i);return}else if(l==="--helpAll"||l==="--help-all"||l==="-H"){u="all",a||(a=i);return}if(a){s.push(l);return}if(i.kind===Jn){a=i,s.push(l);return}let d=Yn(l),h=l,v=i.getRoutingTargetForInput(h);if(e.caseStyle==="allow-kebab-for-camel"&&!v&&(v=i.getRoutingTargetForInput(d),v&&(h=d)),!v){let w=i.getDefaultCommand();if(w){c=!1,o=[i,""],s.push(l),i=w;return}return{input:l,routeMap:i}}c=!1,o=[i,l],i=v,n.push(l)},finish:()=>{if(a=a??i,a.kind===Ur&&!u){let d=a.getDefaultCommand();d&&(o=[a,""],a=d,c=!1)}let l=o?o[0].getOtherAliasesForInput(o[1],e.caseStyle):{original:[],"convert-camel-to-kebab":[]};return{target:a,unprocessedInputs:s,helpRequested:u,prefix:n,rootLevel:c,aliases:l}}}}async function xf({root:t,defaultText:e,config:r},n,s){let o=e;if(s.locale){let d=r.localization.loadText(s.locale);if(d)o=d;else{let h=Le(s.process,s.process.stderr,r.documentation),v=o.noTextAvailableForLocale({requestedLocale:s.locale,defaultLocale:r.localization.defaultLocale,ansiColor:h});s.process.stderr.write(h?`\x1B[1m\x1B[33m${v}\x1B[39m\x1B[22m
|
|
22
|
-
`:`${v}
|
|
23
|
-
`)}}if(r.versionInfo?.getLatestVersion&&!Vo(s.process,"STRICLI_SKIP_VERSION_CHECK")){let d;"currentVersion"in r.versionInfo?d=r.versionInfo.currentVersion:d=await r.versionInfo.getCurrentVersion.call(s);let h=await r.versionInfo.getLatestVersion.call(s,d);if(h&&d!==h){let v=Le(s.process,s.process.stderr,r.documentation),w=o.currentVersionIsNotLatest({currentVersion:d,latestVersion:h,upgradeCommand:r.versionInfo.upgradeCommand,ansiColor:v});s.process.stderr.write(v?`\x1B[1m\x1B[33m${w}\x1B[39m\x1B[22m
|
|
24
|
-
`:`${w}
|
|
25
|
-
`)}}let i=n.slice();if(r.versionInfo&&(i[0]==="--version"||i[0]==="-v")){let d;return"currentVersion"in r.versionInfo?d=r.versionInfo.currentVersion:d=await r.versionInfo.getCurrentVersion.call(s),s.process.stdout.write(d+`
|
|
26
|
-
`),Ne.Success}let a=vf(t,r.scanner,[r.name]),c;for(;i.length>0&&!c;){let d=i.shift();c=a.next(d)}if(c){let d=hf(c.routeMap,r.scanner.caseStyle,r.completion),h=lr(c.input,d,r.scanner.distanceOptions).map(T=>`\`${T}\``),v=Le(s.process,s.process.stderr,r.documentation),w=o.noCommandRegisteredForInput({input:c.input,corrections:h,ansiColor:v});return s.process.stderr.write(v?`\x1B[1m\x1B[31m${w}\x1B[39m\x1B[22m
|
|
27
|
-
`:`${w}
|
|
28
|
-
`),Ne.UnknownCommand}let u=a.finish();if(u.helpRequested||u.target.kind===Ur){let d=Le(s.process,s.process.stdout,r.documentation);return s.process.stdout.write(u.target.formatHelp({prefix:u.prefix,includeVersionFlag:!!r.versionInfo&&u.rootLevel,includeArgumentEscapeSequenceFlag:r.scanner.allowArgumentEscapeSequence,includeHelpAllFlag:u.helpRequested==="all"||r.documentation.alwaysShowHelpAllFlag,includeHidden:u.helpRequested==="all",config:r.documentation,aliases:u.aliases[r.documentation.caseStyle],text:o,ansiColor:d})),Ne.Success}let l;if("forCommand"in s)try{l=await s.forCommand({prefix:u.prefix})}catch(d){let h=Le(s.process,s.process.stderr,r.documentation),v=o.exceptionWhileLoadingCommandContext(d,h);return s.process.stderr.write(h?`\x1B[1m\x1B[31m${v}\x1B[39m\x1B[22m`:v),Ne.ContextLoadError}else l=s;return yf(u.target,{context:l,inputs:u.unprocessedInputs,scannerConfig:r.scanner,documentationConfig:r.documentation,errorFormatting:o,determineExitCode:r.determineExitCode})}function zr(t,e){return e==="convert-camel-to-kebab"?ke(t):t}function wf(t,e){return e==="convert-camel-to-kebab"?`no-${ke(t)}`:`no${t[0].toUpperCase()}${t.slice(1)}`}function bf(t){let e=t.scanner?.caseStyle??"original",r;if(t.documentation?.caseStyle){if(e==="original"&&t.documentation.caseStyle==="convert-camel-to-kebab")throw new fe("Cannot convert route and flag names on display but scan as original");r=t.documentation.caseStyle}else e==="allow-kebab-for-camel"?r="convert-camel-to-kebab":r=e;let n={caseStyle:e,allowArgumentEscapeSequence:t.scanner?.allowArgumentEscapeSequence??!1,distanceOptions:t.scanner?.distanceOptions??{threshold:7,weights:{insertion:1,deletion:3,substitution:2,transposition:0}}},s={alwaysShowHelpAllFlag:t.documentation?.alwaysShowHelpAllFlag??!1,useAliasInUsageLine:t.documentation?.useAliasInUsageLine??!1,onlyRequiredInUsageLine:t.documentation?.onlyRequiredInUsageLine??!1,caseStyle:r,disableAnsiColor:t.documentation?.disableAnsiColor??!1},o={includeAliases:t.completion?.includeAliases??s.useAliasInUsageLine,includeHiddenRoutes:t.completion?.includeHiddenRoutes??!1,...t.completion};return{...t,scanner:n,completion:o,documentation:s,localization:{defaultLocale:"en",loadText:gf,...t.localization}}}function Jo(t,e){let r=bf(e);if(t.kind===Jn&&r.versionInfo){if(t.usesFlag("version"))throw new fe("Unable to use command with flag --version as root when version info is supplied");if(t.usesFlag("v"))throw new fe("Unable to use command with alias -v as root when version info is supplied")}let n=r.localization.loadText(r.localization.defaultLocale);if(!n)throw new fe(`No text available for the default locale "${r.localization.defaultLocale}"`);return{root:t,config:r,defaultText:n}}function Qo(t){return"default"in t&&typeof t.default<"u"}function fr(t){return t.optional??Qo(t)}function zo(t){return`(${t})`}function qo(t){return`[${t}]`}function Wo(t){return`${t}...`}function _f(t){return`<${t}>`}function Sf(t){return`[<${t}>]`}function Ef(t){return`<${t}>...`}function Xo(t,e){let r=Object.entries(t.flags??{}).filter(([,o])=>!(o.hidden||e.config.onlyRequiredInUsageLine&&fr(o))).map(([o,i])=>{let a=e.config.caseStyle==="convert-camel-to-kebab"?`--${ke(o)}`:`--${o}`;if(t.aliases&&e.config.useAliasInUsageLine){let u=Object.entries(t.aliases).filter(l=>l[1]===o);u.length===1&&u[0]&&(a=`-${u[0][0]}`)}if(i.kind==="boolean")return[i,a];if(i.kind==="enum"&&typeof i.placeholder!="string")return[i,`${a} ${i.values.join("|")}`];let c=i.placeholder??"value";return[i,`${a} ${c}`]}).map(([o,i])=>o.kind==="parsed"&&o.variadic?fr(o)?Wo(qo(i)):Wo(zo(i)):fr(o)?qo(i):zo(i)),n=[],s=t.positional;if(s)if(s.kind==="array")n=[Ef(s.parameter.placeholder??"args")];else{let o=s.parameters;e.config.onlyRequiredInUsageLine&&(o=o.filter(i=>!i.optional&&typeof i.default>"u")),n=o.map((i,a)=>{let c=i.placeholder??`arg${a+1}`;return i.optional||typeof i.default<"u"?Sf(c):_f(c)})}return[...e.prefix,...r,...n].join(" ")}function ei(t,e,r){let{keywords:n,briefs:s}=r.text,o=Object.entries(t).filter(([,c])=>!(c.hidden&&!r.includeHidden)),i=o.some(([,c])=>fr(c)),a=o.map(([c,u])=>{let l=Object.entries(e).filter(w=>w[1]===c).map(([w])=>`-${w}`),d="--"+zr(c,r.config.caseStyle);if(u.kind==="boolean"&&u.default!==!1&&u.withNegated!==!1){let w=wf(c,r.config.caseStyle);d=`${d}/--${w}`}fr(u)?d=`[${d}]`:i&&(d=` ${d}`),u.kind==="parsed"&&u.variadic&&(d=`${d}...`);let h=[];if(u.kind==="enum"){let w=u.values.join("|");h.push(w)}if(Qo(u)){let w=r.ansiColor?`\x1B[90m${n.default}\x1B[39m`:n.default,T;if(Array.isArray(u.default))if(u.default.length===0)T="[]";else{let C="variadic"in u&&typeof u.variadic=="string"?u.variadic:" ";T=u.default.join(C)}else T=u.default===""?'""':String(u.default);h.push(`${w} ${T}`)}if("variadic"in u&&typeof u.variadic=="string"){let w=r.ansiColor?`\x1B[90m${n.separator}\x1B[39m`:n.separator;h.push(`${w} ${u.variadic}`)}let v=h.length>0?`[${h.join(", ")}]`:void 0;return{aliases:l.join(" "),flagName:d,brief:u.brief,suffix:v,hidden:u.hidden}});if(a.push({aliases:"-h",flagName:i?" --help":"--help",brief:s.help}),r.includeHelpAllFlag){let c=zr("helpAll",r.config.caseStyle);a.push({aliases:"-H",flagName:i?` --${c}`:`--${c}`,brief:s.helpAll,hidden:!r.config.alwaysShowHelpAllFlag})}return r.includeVersionFlag&&a.push({aliases:"-v",flagName:i?" --version":"--version",brief:s.version}),r.includeArgumentEscapeSequenceFlag&&a.push({aliases:"",flagName:i?" --":"--",brief:s.argumentEscapeSequence}),Hr(a.map(c=>r.ansiColor?[c.hidden?`\x1B[90m${c.aliases}\x1B[39m`:`\x1B[97m${c.aliases}\x1B[39m`,c.hidden?`\x1B[90m${c.flagName}\x1B[39m`:`\x1B[97m${c.flagName}\x1B[39m`,c.hidden?`\x1B[90m${c.brief}\x1B[39m`:`\x1B[03m${c.brief}\x1B[23m`,c.suffix??""]:[c.aliases,c.flagName,c.brief,c.suffix??""]),[" "," "," "])}function*ti(t){if(yield t.config.useAliasInUsageLine?"-h":"--help",t.includeHelpAllFlag){let e=zr("helpAll",t.config.caseStyle);yield t.config.useAliasInUsageLine?"-H":`--${e}`}t.includeVersionFlag&&(yield t.config.useAliasInUsageLine?"-v":"--version")}function Rf(t,e){if(t.kind==="array"){let s=t.parameter.placeholder??"args",o=e.ansiColor?`\x1B[97m${s}...\x1B[39m`:`${s}...`,i=e.ansiColor?`\x1B[3m${t.parameter.brief}\x1B[23m`:t.parameter.brief;return Hr([[o,i]],[" "])}let{keywords:r}=e.text,n=t.parameters.some(s=>s.optional);return Hr(t.parameters.map((s,o)=>{let i=s.placeholder??`arg${o+1}`,a;return s.optional?i=`[${i}]`:n&&(i=` ${i}`),s.default&&(a=`[${e.ansiColor?`\x1B[90m${r.default}\x1B[39m`:r.default} ${s.default}]`),[e.ansiColor?`\x1B[97m${i}\x1B[39m`:i,e.ansiColor?`\x1B[3m${s.brief}\x1B[23m`:s.brief,a??""]}),[" "," "])}function*Tf(t,e,r){let{brief:n,fullDescription:s,customUsage:o}=e,{headers:i}=r.text,a=r.prefix.join(" ");if(yield r.ansiColor?`\x1B[1m${i.usage}\x1B[22m`:i.usage,o)for(let u of o)if(typeof u=="string")yield` ${a} ${u}`;else{let l=r.ansiColor?`\x1B[3m${u.brief}\x1B[23m`:u.brief;yield` ${a} ${u.input}
|
|
29
|
-
${l}`}else yield` ${Xo(t,r)}`;for(let u of ti(r))yield` ${a} ${u}`;if(yield"",yield s??n,r.aliases&&r.aliases.length>0){let u=r.prefix.slice(0,-1).join(" ");yield"",yield r.ansiColor?`\x1B[1m${i.aliases}\x1B[22m`:i.aliases;for(let l of r.aliases)yield` ${u} ${l}`}yield"",yield r.ansiColor?`\x1B[1m${i.flags}\x1B[22m`:i.flags;for(let u of ei(t.flags??{},t.aliases??{},r))yield` ${u}`;let c=t.positional??{kind:"tuple",parameters:[]};if(c.kind==="array"||c.parameters.length>0){yield"",yield r.ansiColor?`\x1B[1m${i.arguments}\x1B[22m`:i.arguments;for(let u of Rf(c,r))yield` ${u}`}}function Af(t,e){for(let r of e)if(r in t)throw new fe(`Unable to use reserved flag --${r}`)}function Cf(t,e){for(let r of e)if(r in t)throw new fe(`Unable to use reserved alias -${r}`)}function*kf(t){yield`no-${ke(t)}`,yield`no${t[0].toUpperCase()}${t.slice(1)}`}function Pf(t){let e=Object.entries(t).filter(([,r])=>r.kind==="boolean"&&!r.optional);for(let[r]of e)for(let n of kf(r))if(n in t)throw new fe(`Unable to allow negation for --${r} as it conflicts with --${n}`)}function Df(t){for(let[e,r]of Object.entries(t))if("variadic"in r&&typeof r.variadic=="string"){if(r.variadic.length<1)throw new fe(`Unable to use "" as variadic separator for --${e} as it is empty`);if(/\s/.test(r.variadic))throw new fe(`Unable to use "${r.variadic}" as variadic separator for --${e} as it contains whitespace`)}}function V(t){let{flags:e={},aliases:r={}}=t.parameters;Af(e,["help","helpAll","help-all"]),Cf(r,["h","H"]),Pf(e),Df(e);let n;return"func"in t?n=async()=>t.func:n=t.loader,{kind:Jn,loader:n,parameters:t.parameters,get brief(){return t.docs.brief},get fullDescription(){return t.docs.fullDescription},formatUsageLine:s=>Xo(t.parameters,s),formatHelp:s=>[...Tf(t.parameters,t.docs,s)].join(`
|
|
30
|
-
`)+`
|
|
31
|
-
`,usesFlag:s=>s in e||s in r}}function*$f(t,e,r){let{brief:n,fullDescription:s,hideRoute:o}=e,{headers:i}=r.text;yield r.ansiColor?`\x1B[1m${i.usage}\x1B[22m`:i.usage;for(let[d,h]of Object.entries(t))if(!o||!o[d]||r.includeHidden){let v=r.config.caseStyle==="convert-camel-to-kebab"?ke(d):d;yield` ${h.formatUsageLine({...r,prefix:[...r.prefix,v]})}`}let a=r.prefix.join(" ");for(let d of ti(r))yield` ${a} ${d}`;if(yield"",yield s??n,r.aliases&&r.aliases.length>0){let d=r.prefix.slice(0,-1).join(" ");yield"",yield r.ansiColor?`\x1B[1m${i.aliases}\x1B[22m`:i.aliases;for(let h of r.aliases)yield` ${d} ${h}`}yield"",yield r.ansiColor?`\x1B[1m${i.flags}\x1B[22m`:i.flags;for(let d of ei({},{},r))yield` ${d}`;yield"",yield r.ansiColor?`\x1B[1m${i.commands}\x1B[22m`:i.commands;let u=Object.entries(t).filter(([d])=>!o||!o[d]||r.includeHidden).map(([d,h])=>({routeName:zr(d,r.config.caseStyle),brief:h.brief,hidden:o&&o[d]})),l=Hr(u.map(d=>r.ansiColor?[d.hidden?`\x1B[90m${d.routeName}\x1B[39m`:`\x1B[97m${d.routeName}\x1B[39m`,d.hidden?`\x1B[90m${d.brief}\x1B[39m`:`\x1B[03m${d.brief}\x1B[23m`]:[d.routeName,d.brief]),[" "]);for(let d of l)yield` ${d}`}function we({routes:t,defaultCommand:e,docs:r,aliases:n}){if(Object.entries(t).length===0)throw new fe("Route map must contain at least one route");let s=n??{},o=new Map;for(let[c,u]of Object.entries(s)){if(c in t)throw new fe(`Cannot use "${c}" as an alias when a route with that name already exists`);let l=o.get(u)??[];o.set(u,[...l,c])}let i=e?t[e]:void 0;if(i&&i.kind===Ur)throw new fe(`Cannot use "${e}" as the default command because it is not a Command`);let a=c=>{if(c in s)return s[c];if(c in t)return c};return{kind:Ur,get brief(){return r.brief},get fullDescription(){return r.fullDescription},formatUsageLine(c){let u=this.getAllEntries().filter(l=>!l.hidden).map(l=>l.name[c.config.caseStyle]);return`${c.prefix.join(" ")} ${u.join("|")} ...`},formatHelp:c=>[...$f(t,r,c)].join(`
|
|
32
|
-
`)+`
|
|
33
|
-
`,getDefaultCommand:()=>i,getOtherAliasesForInput:(c,u)=>{if(e){if(c===e)return{original:[""],"convert-camel-to-kebab":[""]};if(c==="")return{original:[e],"convert-camel-to-kebab":[e]}}let l=Yn(c),d=a(c);if(!d&&u==="allow-kebab-for-camel"&&(d=a(l)),!d)return{original:[],"convert-camel-to-kebab":[]};let h=[d,...o.get(d)??[]].filter(v=>v!==c&&v!==l);return{original:h,"convert-camel-to-kebab":h.map(ke)}},getRoutingTargetForInput:c=>{let u=c in s?s[c]:c;return t[u]},getAllEntries(){let c=r.hideRoute;return Object.entries(t).map(([u,l])=>({name:{original:u,"convert-camel-to-kebab":ke(u)},target:l,aliases:o.get(u)??[],hidden:c?.[u]??!1}))}}}async function ri(t,e,r){let n=await xf(t,e,r);r.process.exitCode=n}f();f();f();f();f();f();var ht=class extends Error{response;request;options;constructor(e,r,n){let s=e.status||e.status===0?e.status:"",o=e.statusText??"",i=`${s} ${o}`.trim(),a=i?`status code ${i}`:"an unknown error";super(`Request failed with ${a}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=e,this.request=r,this.options=n}};f();var Ht=class extends Error{name="NonError";value;constructor(e){let r="Non-error value was thrown";try{typeof e=="string"?r=e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"&&(r=e.message)}catch{}super(r),this.value=e}};f();var Ut=class extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(e){let r=e?.cause?e.cause instanceof Error?e.cause:new Ht(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",r?{cause:r}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}};f();f();var Qn=(()=>{let t=!1,e=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(s){if(s instanceof Error&&s.message==="unsupported BodyInit type")return!1;throw s}return t&&!e})(),ni=typeof globalThis.AbortController=="function",qr=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",si=typeof globalThis.ReadableStream=="function",oi=typeof globalThis.FormData=="function",Wr=["get","post","put","patch","head","delete"],jf=()=>{};jf();var ii={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Vr=2147483647,ai=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Gr=Symbol("stop"),dr=class{options;constructor(e){this.options=e}},ci=t=>new dr(t),ui={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},li={next:!0},fi={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var Of=t=>{if(!t)return 0;if(t instanceof FormData){let e=0;for(let[r,n]of t)e+=ai,e+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,e+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return e}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength;if(typeof t=="string")return new TextEncoder().encode(t).length;if(t instanceof URLSearchParams)return new TextEncoder().encode(t.toString()).length;if("byteLength"in t)return t.byteLength;if(typeof t=="object"&&t!==null)try{let e=JSON.stringify(t);return new TextEncoder().encode(e).length}catch{return 0}return 0},di=(t,e,r)=>{let n,s=0;return t.pipeThrough(new TransformStream({transform(o,i){if(i.enqueue(o),n){s+=n.byteLength;let a=e===0?0:s/e;a>=1&&(a=1-Number.EPSILON),r?.({percent:a,totalBytes:Math.max(e,s),transferredBytes:s},n)}n=o},flush(){n&&(s+=n.byteLength,r?.({percent:1,totalBytes:Math.max(e,s),transferredBytes:s},n))}}))},pi=(t,e)=>{if(!t.body)return t;if(t.status===204)return new Response(null,{status:t.status,statusText:t.statusText,headers:t.headers});let r=Math.max(0,Number(t.headers.get("content-length"))||0);return new Response(di(t.body,r,e),{status:t.status,statusText:t.statusText,headers:t.headers})},hi=(t,e,r)=>{if(!t.body)return t;let n=Of(r??t.body);return new Request(t,{duplex:"half",body:di(t.body,n,e)})};f();f();var nt=t=>t!==null&&typeof t=="object";var pr=(...t)=>{for(let e of t)if((!nt(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return ts({},...t)},Xn=(t={},e={})=>{let r=new globalThis.Headers(t),n=e instanceof globalThis.Headers,s=new globalThis.Headers(e);for(let[o,i]of s.entries())n&&i==="undefined"||i===void 0?r.delete(o):r.set(o,i);return r};function Yr(t,e,r){return Object.hasOwn(e,r)&&e[r]===void 0?[]:ts(t[r]??[],e[r]??[])}var es=(t={},e={})=>({beforeRequest:Yr(t,e,"beforeRequest"),beforeRetry:Yr(t,e,"beforeRetry"),afterResponse:Yr(t,e,"afterResponse"),beforeError:Yr(t,e,"beforeError")}),If=(t,e)=>{let r=new URLSearchParams;for(let n of[t,e])if(n!==void 0)if(n instanceof URLSearchParams)for(let[s,o]of n.entries())r.append(s,o);else if(Array.isArray(n))for(let s of n){if(!Array.isArray(s)||s.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");r.append(String(s[0]),String(s[1]))}else if(nt(n))for(let[s,o]of Object.entries(n))o!==void 0&&r.append(s,String(o));else{let s=new URLSearchParams(n);for(let[o,i]of s.entries())r.append(o,i)}return r},ts=(...t)=>{let e={},r={},n={},s,o=[];for(let i of t)if(Array.isArray(i))Array.isArray(e)||(e=[]),e=[...e,...i];else if(nt(i)){for(let[a,c]of Object.entries(i)){if(a==="signal"&&c instanceof globalThis.AbortSignal){o.push(c);continue}if(a==="context"){if(c!=null&&(!nt(c)||Array.isArray(c)))throw new TypeError("The `context` option must be an object");e={...e,context:c==null?{}:{...e.context,...c}};continue}if(a==="searchParams"){c==null?s=void 0:s=s===void 0?c:If(s,c);continue}nt(c)&&a in e&&(c=ts(e[a],c)),e={...e,[a]:c}}nt(i.hooks)&&(n=es(n,i.hooks),e.hooks=n),nt(i.headers)&&(r=Xn(r,i.headers),e.headers=r)}return s!==void 0&&(e.searchParams=s),o.length>0&&(o.length===1?e.signal=o[0]:qr?e.signal=AbortSignal.any(o):e.signal=o.at(-1)),e.context===void 0&&(e.context={}),e};f();var gi=t=>Wr.includes(t)?t.toUpperCase():t,Nf=["get","put","head","delete","options","trace"],Lf=[408,413,429,500,502,503,504],Ff=[413,429,503],mi={limit:2,methods:Nf,statusCodes:Lf,afterStatusCodes:Ff,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3,jitter:void 0,retryOnTimeout:!1},yi=(t={})=>{if(typeof t=="number")return{...mi,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.methods&&=t.methods.map(r=>r.toLowerCase()),t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");let e=Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0));return{...mi,...e}};f();f();var mt=class extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}};async function rs(t,e,r,n){return new Promise((s,o)=>{let i=setTimeout(()=>{r&&r.abort(),o(new mt(t))},n.timeout);n.fetch(t,e).then(s).catch(o).then(()=>{clearTimeout(i)})})}f();async function ns(t,{signal:e}){return new Promise((r,n)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",s,{once:!0}));function s(){clearTimeout(o),n(e.reason)}let o=setTimeout(()=>{e?.removeEventListener("abort",s),r()},t)})}f();var vi=(t,e)=>{let r={};for(let n in e)Object.hasOwn(e,n)&&!(n in fi)&&!(n in ui)&&(!(n in t)||n in li)&&(r[n]=e[n]);return r},xi=t=>t===void 0?!1:Array.isArray(t)?t.length>0:t instanceof URLSearchParams?t.size>0:typeof t=="object"?Object.keys(t).length>0:typeof t=="string"?t.trim().length>0:!!t;f();function wi(t){return t instanceof ht||t?.name===ht.name}function bi(t){return t instanceof mt||t?.name===mt.name}var hr=class t{static create(e,r){let n=new t(e,r),s=async()=>{if(typeof n.#e.timeout=="number"&&n.#e.timeout>Vr)throw new RangeError(`The \`timeout\` option cannot be greater than ${Vr}`);await Promise.resolve();let i=await n.#y();for(let a of n.#e.hooks.afterResponse){let c=n.#d(i.clone()),u;try{u=await a(n.request,n.#c(),c,{retryCount:n.#r})}catch(d){throw n.#o(c),n.#o(i),d}if(u instanceof dr)throw n.#o(c),n.#o(i),new Ut(u.options);let l=u instanceof globalThis.Response?u:i;c!==l&&n.#o(c),i!==l&&n.#o(i),i=l}if(n.#d(i),!i.ok&&(typeof n.#e.throwHttpErrors=="function"?n.#e.throwHttpErrors(i.status):n.#e.throwHttpErrors)){let a=new ht(i,n.request,n.#c());for(let c of n.#e.hooks.beforeError)a=await c(a,{retryCount:n.#r});throw a}if(n.#e.onDownloadProgress){if(typeof n.#e.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!si)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");let a=i.clone();return n.#o(i),pi(a,n.#e.onDownloadProgress)}return i},o=n.#p(s).finally(()=>{let i=n.#i;n.#l(i?.body??void 0),n.#l(n.request.body??void 0)});for(let[i,a]of Object.entries(ii))i==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[i]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||a);let c=await o;if(i==="json"){if(c.status===204)return"";let u=await c.text();return u===""?"":r.parseJson?r.parseJson(u):JSON.parse(u)}return c[i]()});return o}static#m(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0)):e}request;#n;#r=0;#t;#e;#i;#s;#a;constructor(e,r={}){if(this.#t=e,this.#e={...r,headers:Xn(this.#t.headers,r.headers),hooks:es({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:gi(r.method??this.#t.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:yi(r.retry),throwHttpErrors:r.throwHttpErrors??!0,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis),context:r.context??{}},typeof this.#t!="string"&&!(this.#t instanceof URL||this.#t instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this.#e.prefixUrl&&typeof this.#t=="string"){if(this.#t.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#e.prefixUrl.endsWith("/")||(this.#e.prefixUrl+="/"),this.#t=this.#e.prefixUrl+this.#t}ni&&qr&&(this.#s=this.#e.signal??this.#t.signal,this.#n=new globalThis.AbortController,this.#e.signal=this.#s?AbortSignal.any([this.#s,this.#n.signal]):this.#n.signal),Qn&&(this.#e.duplex="half"),this.#e.json!==void 0&&(this.#e.body=this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));let n=r.headers&&new globalThis.Headers(r.headers).has("content-type");if(this.#t instanceof globalThis.Request&&(oi&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!n&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#t,this.#e),xi(this.#e.searchParams)){let o="?"+(typeof this.#e.searchParams=="string"?this.#e.searchParams.replace(/^\?/,""):new URLSearchParams(t.#m(this.#e.searchParams)).toString()),i=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,o);this.request=new globalThis.Request(i,this.#e)}if(this.#e.onUploadProgress){if(typeof this.#e.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!Qn)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#h(this.request,this.#e.body??void 0)}}#u(){let e=this.#e.retry.delay(this.#r),r=e;this.#e.retry.jitter===!0?r=Math.random()*e:typeof this.#e.retry.jitter=="function"&&(r=this.#e.retry.jitter(e),(!Number.isFinite(r)||r<0)&&(r=e));let n=this.#e.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(n,r)}async#g(e){if(this.#r++,this.#r>this.#e.retry.limit)throw e;let r=e instanceof Error?e:new Ht(e);if(r instanceof Ut)return r.customDelay??this.#u();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#e.retry.shouldRetry!==void 0){let n=await this.#e.retry.shouldRetry({error:r,retryCount:this.#r});if(n===!1)throw e;if(n===!0)return this.#u()}if(bi(e)&&!this.#e.retry.retryOnTimeout)throw e;if(wi(e)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;let n=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(n&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let s=Number(n)*1e3;Number.isNaN(s)?s=Date.parse(n)-Date.now():s>=Date.parse("2024-01-01")&&(s-=Date.now());let o=this.#e.retry.maxRetryAfter??s;return s<o?s:o}if(e.response.status===413)throw e}return this.#u()}#d(e){return this.#e.parseJson&&(e.json=async()=>this.#e.parseJson(await e.text())),e}#l(e){e&&e.cancel().catch(()=>{})}#o(e){this.#l(e.body??void 0)}async#p(e){try{return await e()}catch(r){let n=Math.min(await this.#g(r),Vr);if(this.#r<1)throw r;if(await ns(n,this.#s?{signal:this.#s}:{}),r instanceof Ut&&r.customRequest){let s=this.#e.signal?new globalThis.Request(r.customRequest,{signal:this.#e.signal}):new globalThis.Request(r.customRequest);this.#f(s)}for(let s of this.#e.hooks.beforeRetry){let o=await s({request:this.request,options:this.#c(),error:r,retryCount:this.#r});if(o instanceof globalThis.Request){this.#f(o);break}if(o instanceof globalThis.Response)return o;if(o===Gr)return}return this.#p(e)}}async#y(){this.#n?.signal.aborted&&(this.#n=new globalThis.AbortController,this.#e.signal=this.#s?AbortSignal.any([this.#s,this.#n.signal]):this.#n.signal,this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));for(let r of this.#e.hooks.beforeRequest){let n=await r(this.request,this.#c(),{retryCount:this.#r});if(n instanceof Response)return n;if(n instanceof globalThis.Request){this.#f(n);break}}let e=vi(this.request,this.#e);return this.#i=this.request,this.request=this.#i.clone(),this.#e.timeout===!1?this.#e.fetch(this.#i,e):rs(this.#i,e,this.#n,this.#e)}#c(){if(!this.#a){let{hooks:e,...r}=this.#e;this.#a=Object.freeze(r)}return this.#a}#f(e){this.#a=void 0,this.request=this.#h(e)}#h(e,r){return!this.#e.onUploadProgress||!e.body?e:hi(e,this.#e.onUploadProgress,r??this.#e.body??void 0)}};var ss=t=>{let e=(r,n)=>hr.create(r,pr(t,n));for(let r of Wr)e[r]=(n,s)=>hr.create(n,pr(t,s,{method:r}));return e.create=r=>ss(pr(r)),e.extend=r=>(typeof r=="function"&&(r=r(t??{})),ss(pr(t,r))),e.stop=Gr,e.retry=ci,e},Mf=ss(),os=Mf;$t();ln();Ue();ue();var yp="https://sentry.io",vp=3e4,xp=2,wp=1e4,bp=[408,429,500,502,503,504];function _p(){return`${process.env.SENTRY_URL||yp}/api/0/`}function Vi(t){return t.startsWith("/")?t.slice(1):t}var Sp=/[a-zA-Z]/,Wi="x-sentry-cli-retry";async function Gi(){let{token:t}=await Er();return os.create({prefixUrl:_p(),timeout:vp,retry:{limit:xp,methods:["get","put","delete","patch"],statusCodes:bp,backoffLimit:wp},headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},hooks:{afterResponse:[async(e,r,n)=>{let s=e.headers.get(Wi)==="1";if(n.status===401&&!s)try{let{token:o,refreshed:i}=await Er({force:!0});if(!i)return n;let a=new Headers(r.headers);a.set("Authorization",`Bearer ${o}`),a.set(Wi,"1");let{prefixUrl:c,...u}=r;return os(e.url,{...u,headers:a,retry:0})}catch{return n}return n}]}})}function Yi(t){if(!t)return;let e=new URLSearchParams;for(let[r,n]of Object.entries(t))n!==void 0&&e.set(r,String(n));return e.toString()?e:void 0}async function et(t,e={}){let{method:r="GET",body:n,params:s,schema:o}=e,i=await Gi(),a;try{a=await i(Vi(t),{method:r,json:n,searchParams:Yi(s)})}catch(u){if(u&&typeof u=="object"&&"response"in u){let l=u,d=await l.response.text(),h;try{let v=JSON.parse(d);h=v.detail??JSON.stringify(v)}catch{h=d}throw new Ee(`API request failed: ${l.response.status} ${l.response.statusText}`,l.response.status,h)}throw u}let c=await a.json();return o?o.parse(c):c}async function Zi(t,e={}){let{method:r="GET",body:n,params:s,headers:o={}}=e,a=await(await Gi())(Vi(t),{method:r,json:n,searchParams:Yi(s),headers:o,throwHttpErrors:!1}),c=await a.text(),u;try{u=JSON.parse(c)}catch{u=c}return{status:a.status,headers:a.headers,body:u}}function tt(){return et("/organizations/",{schema:p.array(an)})}function Ki(t){return et(`/organizations/${t}/`,{schema:an})}function Ss(t){return et(`/organizations/${t}/projects/`,{schema:p.array(cn)})}function Tr(t,e){return et(`/projects/${t}/${e}/`,{schema:cn})}function Ji(t,e,r={}){return et(`/projects/${t}/${e}/issues/`,{params:{query:r.query,cursor:r.cursor,limit:r.limit,sort:r.sort,statsPeriod:r.statsPeriod},schema:p.array(xr)})}function Qi(t){return et(`/issues/${t}/`,{schema:xr})}function Xi(t,e){return et(`/organizations/${t}/issues/${e}/`,{schema:xr})}function ea(t){return Sp.test(t)}function ta(t){return et(`/issues/${t}/events/latest/`,{schema:un})}function ra(t,e,r){return et(`/projects/${t}/${e}/events/${r}/`,{schema:un})}var na=["GET","POST","PUT","DELETE","PATCH"];function Ep(t){let e=t.toUpperCase();if(!na.includes(e))throw new Error(`Invalid method: ${t}. Must be one of: ${na.join(", ")}`);return e}function Rp(t){try{return JSON.parse(t)}catch{return t}}var Tp=new Set(["__proto__","constructor","prototype"]);function Ap(t,e,r){let n=e.split(".");for(let i of n)if(Tp.has(i))throw new Error(`Invalid field key: "${i}" is not allowed`);let s=t;for(let i=0;i<n.length-1;i++){let a=n[i];a&&(Object.hasOwn(s,a)||(s[a]={}),s=s[a])}let o=n.at(-1);o&&(s[o]=r)}function Cp(t){let e={};for(let r of t){let n=r.indexOf("=");if(n===-1)throw new Error(`Invalid field format: ${r}. Expected key=value`);let s=r.substring(0,n),o=r.substring(n+1),i=Rp(o);Ap(e,s,i)}return e}function kp(t){let e={};for(let r of t){let n=r.indexOf(":");if(n===-1)throw new Error(`Invalid header format: ${r}. Expected Key: Value`);let s=r.substring(0,n).trim(),o=r.substring(n+1).trim();e[s]=o}return e}function Pp(t,e,r){t.write(`HTTP ${e}
|
|
34
|
-
`),r.forEach((n,s)=>{t.write(`${s}: ${n}
|
|
35
|
-
`)}),t.write(`
|
|
36
|
-
`)}function Dp(t,e){e!=null&&(typeof e=="object"?t.write(`${JSON.stringify(e,null,2)}
|
|
37
|
-
`):t.write(`${String(e)}
|
|
38
|
-
`))}var sa=V({docs:{brief:"Make an authenticated API request",fullDescription:`Make a raw API request to the Sentry API. Similar to 'gh api' for GitHub. The endpoint is relative to /api/0/ (do not include the prefix). Authentication is handled automatically using your stored credentials.
|
|
39
|
-
|
|
40
|
-
Examples:
|
|
41
|
-
sentry api organizations/
|
|
42
|
-
sentry api issues/123/ --method PUT --field status=resolved
|
|
43
|
-
sentry api projects/my-org/my-project/issues/`},parameters:{positional:{kind:"tuple",parameters:[{brief:"API endpoint relative to /api/0/ (e.g., organizations/)",parse:String}]},flags:{method:{kind:"parsed",parse:Ep,brief:"HTTP method (GET, POST, PUT, DELETE, PATCH)",default:"GET",placeholder:"METHOD"},field:{kind:"parsed",parse:String,brief:"Request body field (key=value). Can be repeated.",variadic:!0,optional:!0},header:{kind:"parsed",parse:String,brief:"Additional header (Key: Value). Can be repeated.",variadic:!0,optional:!0},include:{kind:"boolean",brief:"Include response headers in output",default:!1},silent:{kind:"boolean",brief:"Suppress output, only set exit code",default:!1}}},async func(t,e){let{stdout:r}=this,n=t.field&&t.field.length>0?Cp(t.field):void 0,s=t.header&&t.header.length>0?kp(t.header):void 0,o=await Zi(e,{method:t.method,body:n,headers:s}),i=o.status>=400;if(t.silent){i&&process.exit(1);return}t.include&&Pp(r,o.status,o.headers),Dp(r,o.body),i&&process.exit(1)}});f();f();f();async function oa(t){let{platform:e}=process,r=null,n;if(e==="darwin")r=Bun.which("open"),n=[t];else if(e==="win32")r=Bun.which("cmd"),n=["/c","start","",t];else{let s=["xdg-open","sensible-browser","x-www-browser","gnome-open","kde-open"];for(let o of s)if(r=Bun.which(o),r)break;n=[t]}if(!r)return!1;try{let s=Bun.spawn([r,...n],{stdout:"ignore",stderr:"ignore"});return await Bun.sleep(500),s.unref(),!0}catch{return!1}}Ue();ue();f();f();f();var ia=(t=0)=>e=>`\x1B[${e+t}m`,aa=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,ca=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,G={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Mv=Object.keys(G.modifier),$p=Object.keys(G.color),jp=Object.keys(G.bgColor),Bv=[...$p,...jp];function Op(){let t=new Map;for(let[e,r]of Object.entries(G)){for(let[n,s]of Object.entries(r))G[n]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},r[n]=G[n],t.set(s[0],s[1]);Object.defineProperty(G,e,{value:r,enumerable:!1})}return Object.defineProperty(G,"codes",{value:t,enumerable:!1}),G.color.close="\x1B[39m",G.bgColor.close="\x1B[49m",G.color.ansi=ia(),G.color.ansi256=aa(),G.color.ansi16m=ca(),G.bgColor.ansi=ia(10),G.bgColor.ansi256=aa(10),G.bgColor.ansi16m=ca(10),Object.defineProperties(G,{rgbToAnsi256:{value(e,r,n){return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(o=>o+o).join(""));let s=Number.parseInt(n,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:e=>G.rgbToAnsi256(...G.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,s;if(e>=232)r=((e-232)*10+8)/255,n=r,s=r;else{e-=16;let a=e%36;r=Math.floor(e/36)/5,n=Math.floor(a/6)/5,s=a%6/5}let o=Math.max(r,n,s)*2;if(o===0)return 30;let i=30+(Math.round(s)<<2|Math.round(n)<<1|Math.round(r));return o===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>G.ansi256ToAnsi(G.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>G.ansi256ToAnsi(G.hexToAnsi256(e)),enumerable:!1}}),G}var Ip=Op(),$e=Ip;f();import Es from"node:process";import Np from"node:os";import ua from"node:tty";function Re(t,e=globalThis.Deno?globalThis.Deno.args:Es.argv){let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),s=e.indexOf("--");return n!==-1&&(s===-1||n<s)}var{env:Y}=Es,dn;Re("no-color")||Re("no-colors")||Re("color=false")||Re("color=never")?dn=0:(Re("color")||Re("colors")||Re("color=true")||Re("color=always"))&&(dn=1);function Lp(){if("FORCE_COLOR"in Y)return Y.FORCE_COLOR==="true"?1:Y.FORCE_COLOR==="false"?0:Y.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Y.FORCE_COLOR,10),3)}function Fp(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function Mp(t,{streamIsTTY:e,sniffFlags:r=!0}={}){let n=Lp();n!==void 0&&(dn=n);let s=r?dn:n;if(s===0)return 0;if(r){if(Re("color=16m")||Re("color=full")||Re("color=truecolor"))return 3;if(Re("color=256"))return 2}if("TF_BUILD"in Y&&"AGENT_NAME"in Y)return 1;if(t&&!e&&s===void 0)return 0;let o=s||0;if(Y.TERM==="dumb")return o;if(Es.platform==="win32"){let i=Np.release().split(".");return Number(i[0])>=10&&Number(i[2])>=10586?Number(i[2])>=14931?3:2:1}if("CI"in Y)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(i=>i in Y)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(i=>i in Y)||Y.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in Y)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Y.TEAMCITY_VERSION)?1:0;if(Y.COLORTERM==="truecolor"||Y.TERM==="xterm-kitty"||Y.TERM==="xterm-ghostty"||Y.TERM==="wezterm")return 3;if("TERM_PROGRAM"in Y){let i=Number.parseInt((Y.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Y.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Y.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Y.TERM)||"COLORTERM"in Y?1:o}function la(t,e={}){let r=Mp(t,{streamIsTTY:t&&t.isTTY,...e});return Fp(r)}var Bp={stdout:la({isTTY:ua.isatty(1)}),stderr:la({isTTY:ua.isatty(2)})},fa=Bp;f();function da(t,e,r){let n=t.indexOf(e);if(n===-1)return t;let s=e.length,o=0,i="";do i+=t.slice(o,n)+e+r,o=n+s,n=t.indexOf(e,o);while(n!==-1);return i+=t.slice(o),i}function pa(t,e,r,n){let s=0,o="";do{let i=t[n-1]==="\r";o+=t.slice(s,i?n-1:n)+e+(i?`\r
|
|
44
|
-
`:`
|
|
45
|
-
`)+r,s=n+1,n=t.indexOf(`
|
|
46
|
-
`,s)}while(n!==-1);return o+=t.slice(s),o}var{stdout:ha,stderr:ma}=fa,Rs=Symbol("GENERATOR"),tr=Symbol("STYLER"),Ar=Symbol("IS_EMPTY"),ga=["ansi","ansi","ansi256","ansi16m"],rr=Object.create(null),Hp=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=ha?ha.level:0;t.level=e.level===void 0?r:e.level};var Up=t=>{let e=(...r)=>r.join(" ");return Hp(e,t),Object.setPrototypeOf(e,Cr.prototype),e};function Cr(t){return Up(t)}Object.setPrototypeOf(Cr.prototype,Function.prototype);for(let[t,e]of Object.entries($e))rr[t]={get(){let r=pn(this,As(e.open,e.close,this[tr]),this[Ar]);return Object.defineProperty(this,t,{value:r}),r}};rr.visible={get(){let t=pn(this,this[tr],!0);return Object.defineProperty(this,"visible",{value:t}),t}};var Ts=(t,e,r,...n)=>t==="rgb"?e==="ansi16m"?$e[r].ansi16m(...n):e==="ansi256"?$e[r].ansi256($e.rgbToAnsi256(...n)):$e[r].ansi($e.rgbToAnsi(...n)):t==="hex"?Ts("rgb",e,r,...$e.hexToRgb(...n)):$e[r][t](...n),zp=["rgb","hex","ansi256"];for(let t of zp){rr[t]={get(){let{level:r}=this;return function(...n){let s=As(Ts(t,ga[r],"color",...n),$e.color.close,this[tr]);return pn(this,s,this[Ar])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);rr[e]={get(){let{level:r}=this;return function(...n){let s=As(Ts(t,ga[r],"bgColor",...n),$e.bgColor.close,this[tr]);return pn(this,s,this[Ar])}}}}var qp=Object.defineProperties(()=>{},{...rr,level:{enumerable:!0,get(){return this[Rs].level},set(t){this[Rs].level=t}}}),As=(t,e,r)=>{let n,s;return r===void 0?(n=t,s=e):(n=r.openAll+t,s=e+r.closeAll),{open:t,close:e,openAll:n,closeAll:s,parent:r}},pn=(t,e,r)=>{let n=(...s)=>Wp(n,s.length===1?""+s[0]:s.join(" "));return Object.setPrototypeOf(n,qp),n[Rs]=t,n[tr]=e,n[Ar]=r,n},Wp=(t,e)=>{if(t.level<=0||!e)return t[Ar]?"":e;let r=t[tr];if(r===void 0)return e;let{openAll:n,closeAll:s}=r;if(e.includes("\x1B"))for(;r!==void 0;)e=da(e,r.close,r.open),r=r.parent;let o=e.indexOf(`
|
|
47
|
-
`);return o!==-1&&(e=pa(e,s,n,o)),n+e+s};Object.defineProperties(Cr.prototype,rr);var Vp=Cr(),Xv=Cr({level:ma?ma.level:0});var nr=Vp;var kr={red:"#fe4144",green:"#83da90",yellow:"#FDB81B",blue:"#226DFC",magenta:"#FF45A8",white:"#f9f8f9",cyan:"#79B8FF",muted:"#898294"},Cs=t=>nr.hex(kr.red)(t),Pr=t=>nr.hex(kr.green)(t),Dr=t=>nr.hex(kr.yellow)(t);var Gp=t=>nr.hex(kr.cyan)(t),Te=t=>nr.hex(kr.muted)(t),je=t=>Pr(t),hn=t=>Cs(t);var ya={resolved:Pr,unresolved:Dr,ignored:Te};function ks(t,e){let r=e?.toLowerCase();return(ya[r]??ya.unresolved)(t)}var Yp={fatal:Cs,error:Cs,warning:Dr,info:Gp,debug:Te};function va(t,e){let r=e?.toLowerCase(),n=Yp[r];return n?n(t):t}f();var ix={resolved:Pr("\u2713"),unresolved:Dr("\u25CF"),ignored:Te("\u2212")},Zp={resolved:`${Pr("\u2713")} Resolved`,unresolved:`${Dr("\u25CF")} Unresolved`,ignored:`${Te("\u2212")} Ignored`},Ps=10;function xa(t){if(!t||t.length===0)return[];let e=["",`Features (${t.length}):`],r=t.slice(0,Ps);return e.push(` ${r.join(", ")}`),t.length>Ps&&e.push(` ... and ${t.length-Ps} more`),e}var Kp=20;function wa(t,e){let s=`${t||"(no slug)"}: ${e||"(unnamed)"}`,o=Math.max(Kp,Math.min(80,s.length));return[s,Te("\u2550".repeat(o))]}function Jp(t){return t?Zp[t]??`${ks("\u25CF",t)} Unknown`:`${ks("\u25CF",t)} Unknown`}function mn(t=80,e="\u2500"){return Te(e.repeat(t))}function Qp(t){if(!t)return Te("\u2014").padEnd(10);let e=new Date(t),n=Date.now()-e.getTime(),s=Math.floor(n/6e4),o=Math.floor(n/36e5),i=Math.floor(n/864e5),a;return s<60?a=`${s}m ago`:o<24?a=`${o}h ago`:i<3?a=`${i}d ago`:a=e.toLocaleDateString("en-US",{month:"short",day:"numeric"}),a.padEnd(10)}var Ds=7,$s=22,js=5,ba=10,Xp=Ds+1+$s+1+js+2+ba+2;function _a(){return"LEVEL".padEnd(Ds)+" "+"SHORT ID".padEnd($s)+" "+"COUNT".padStart(js)+" "+"SEEN".padEnd(ba)+" TITLE"}function eh(t,e,r){let n=r-e;if(t.length<=n||n<20)return t;let s=" ".repeat(e),o=[],i=t;for(;i.length>0;){if(i.length<=n){o.push(i);break}let a=n,c=i.lastIndexOf(" ",n);c>n*.5&&(a=c),o.push(i.slice(0,a).trimEnd()),i=i.slice(a).trimStart()}return o.join(`
|
|
48
|
-
${s}`)}function Sa(t,e=80){let r=(t.level??"unknown").toUpperCase().padEnd(Ds),n=va(r,t.level),s=t.shortId.padEnd($s),o=`${t.count}`.padStart(js),i=Qp(t.lastSeen),a=eh(t.title,Xp,e);return`${n} ${s} ${o} ${i} ${a}`}function Ea(t){let e=[];return e.push(`${t.shortId}: ${t.title}`),e.push(Te("\u2550".repeat(Math.min(80,t.title.length+t.shortId.length+2)))),e.push(""),e.push(`Status: ${Jp(t.status)}`),e.push(`Level: ${t.level??"unknown"}`),e.push(`Platform: ${t.platform}`),e.push(`Type: ${t.type}`),e.push(""),t.project&&(e.push(`Project: ${t.project.name} (${t.project.slug})`),e.push("")),e.push(`Events: ${t.count}`),e.push(`Users: ${t.userCount}`),t.firstSeen&&e.push(`First seen: ${new Date(t.firstSeen).toLocaleString()}`),t.lastSeen&&e.push(`Last seen: ${new Date(t.lastSeen).toLocaleString()}`),e.push(""),t.culprit&&(e.push(`Culprit: ${t.culprit}`),e.push("")),t.metadata?.value&&(e.push("Message:"),e.push(` ${t.metadata.value}`),e.push("")),t.metadata?.filename&&e.push(`File: ${t.metadata.filename}`),t.metadata?.function&&e.push(`Function: ${t.metadata.function}`),t.assignedTo&&(e.push(""),e.push(`Assigned: ${t.assignedTo.name}`)),e.push(""),e.push(`Link: ${t.permalink}`),e}function gn(t,e="Latest Event"){let r=[];if(r.push(""),r.push(Te(`\u2500\u2500\u2500 ${e} \u2500\u2500\u2500`)),r.push(""),r.push(`Event ID: ${t.eventID}`),t.dateReceived&&r.push(`Received: ${new Date(t.dateReceived).toLocaleString()}`),t.user&&(r.push(""),r.push("User:"),t.user.email&&r.push(` Email: ${t.user.email}`),t.user.username&&r.push(` Username: ${t.user.username}`),t.user.id&&r.push(` ID: ${t.user.id}`),t.user.ip_address&&r.push(` IP: ${t.user.ip_address}`)),t.sdk&&(r.push(""),r.push(`SDK: ${t.sdk.name} ${t.sdk.version}`)),t.tags?.length){r.push(""),r.push("Tags:");let n=10;for(let s of t.tags.slice(0,n))r.push(` ${s.key}: ${s.value}`);t.tags.length>n&&r.push(` ... and ${t.tags.length-n} more`)}return r}function Ra(t,e){return`${t.slug.padEnd(e)} ${t.name}`}function Ta(t){return Math.max(...t.map(e=>e.slug.length),4)}function Aa(t){let e=[],[r,n]=wa(t.slug,t.name);return e.push(r,n,""),e.push(`Slug: ${t.slug||"(none)"}`),e.push(`Name: ${t.name||"(unnamed)"}`),e.push(`ID: ${t.id}`),t.dateCreated&&e.push(`Created: ${new Date(t.dateCreated).toLocaleString()}`),e.push(""),e.push(`2FA: ${t.require2FA?"Required":"Not required"}`),e.push(`Early Adopter: ${t.isEarlyAdopter?"Yes":"No"}`),e.push(...xa(t.features)),e}function Ca(t,e){let{showOrg:r,orgSlug:n,slugWidth:s}=e,o=r?`${n}/${t.slug}`.padEnd(s):t.slug.padEnd(s),i=(t.platform||"").padEnd(20);return`${o} ${i} ${t.name}`}function ka(t,e){return Math.max(...t.map(r=>e?`${r.orgSlug}/${r.slug}`.length:r.slug.length),4)}function Os(t){let e=[],[r,n]=wa(t.slug,t.name);return e.push(r,n,""),e.push(`Slug: ${t.slug||"(none)"}`),e.push(`Name: ${t.name||"(unnamed)"}`),e.push(`ID: ${t.id}`),e.push(`Platform: ${t.platform||"Not set"}`),e.push(`Status: ${t.status}`),t.dateCreated&&e.push(`Created: ${new Date(t.dateCreated).toLocaleString()}`),t.organization&&(e.push(""),e.push(`Organization: ${t.organization.name} (${t.organization.slug})`)),e.push(""),t.firstEvent?e.push(`First Event: ${new Date(t.firstEvent).toLocaleString()}`):e.push("First Event: No events yet"),e.push(""),e.push("Capabilities:"),e.push(` Sessions: ${t.hasSessions?"Yes":"No"}`),e.push(` Replays: ${t.hasReplays?"Yes":"No"}`),e.push(` Profiles: ${t.hasProfiles?"Yes":"No"}`),e.push(` Monitors: ${t.hasMonitors?"Yes":"No"}`),e.push(...xa(t.features)),e}function Pa(t){return t.length<=12?"****":`${t.substring(0,8)}...${t.substring(t.length-4)}`}function sr(t){let e=Math.floor(t/60);if(e<60)return`${e} minute${e!==1?"s":""}`;let r=Math.floor(e/60),n=e%60;return n===0?`${r} hour${r!==1?"s":""}`:`${r} hour${r!==1?"s":""} and ${n} minute${n!==1?"s":""}`}function Da(t){let e=new Date(t),r=new Date;if(e<=r)return"Expired";let n=Math.round((e.getTime()-r.getTime())/1e3);return`${e.toLocaleString()} (${sr(n)} remaining)`}ws();f();var rc=Zs(tc(),1);$t();var uh=p.object({small:p.boolean().default(!0)});function nc(t,e){let r=uh.parse(e??{});return new Promise(n=>{rc.default.generate(t,{small:r.small},s=>{n(s)})})}var sc=V({docs:{brief:"Authenticate with Sentry",fullDescription:`Log in to Sentry using OAuth or an API token.
|
|
49
|
-
|
|
50
|
-
The OAuth flow uses a device code - you'll be given a code to enter at a URL.
|
|
51
|
-
Alternatively, use --token to authenticate with an existing API token.`},parameters:{flags:{token:{kind:"parsed",parse:String,brief:"Authenticate using an API token instead of OAuth",optional:!0},timeout:{kind:"parsed",parse:Ye,brief:"Timeout for OAuth flow in seconds (default: 900)",default:"900"},qr:{kind:"boolean",brief:"Show QR code for mobile scanning",default:!0}}},async func(t){let{stdout:e}=this;if(await er()){e.write(`You are already authenticated. Use 'sentry auth logout' first to re-authenticate.
|
|
52
|
-
`);return}if(t.token){await Qt(t.token);try{await tt()}catch{throw await Xt(),new ee("invalid","Invalid API token. Please check your token and try again.")}e.write(`${je("\u2713")} Authenticated with API token
|
|
53
|
-
`),e.write(` Config saved to: ${jt()}
|
|
54
|
-
`);return}e.write(`Starting authentication...
|
|
55
|
-
|
|
56
|
-
`);let r=await vs({onUserCode:async(n,s,o)=>{if(await oa(o)&&e.write(`Opening browser...
|
|
57
|
-
|
|
58
|
-
`),t.qr){e.write(`Scan this QR code or visit the URL below:
|
|
59
|
-
|
|
60
|
-
`);let a=await nc(o);e.write(a),e.write(`
|
|
61
|
-
`)}e.write(`URL: ${s}
|
|
62
|
-
`),e.write(`Code: ${n}
|
|
63
|
-
|
|
64
|
-
`),e.write(`Waiting for authorization...
|
|
65
|
-
`)},onPolling:()=>{e.write(".")}},t.timeout*1e3);e.write(`
|
|
66
|
-
|
|
67
|
-
`),await xs(r),e.write(`${je("\u2713")} Authentication successful!
|
|
68
|
-
`),e.write(` Config saved to: ${jt()}
|
|
69
|
-
`),r.expires_in&&e.write(` Token expires in: ${sr(r.expires_in)}
|
|
70
|
-
`)}});f();Ue();var oc=V({docs:{brief:"Log out of Sentry",fullDescription:"Remove stored authentication credentials from the configuration file."},parameters:{flags:{}},async func(){let{stdout:t}=this;if(!await er()){t.write(`Not currently authenticated.
|
|
71
|
-
`);return}await Xt(),t.write(`${je("\u2713")} Logged out successfully.
|
|
72
|
-
`),t.write(` Credentials removed from: ${jt()}
|
|
73
|
-
`)}});f();Ue();ue();var ic=V({docs:{brief:"Refresh your authentication token",fullDescription:`
|
|
74
|
-
Manually refresh your authentication token using the stored refresh token.
|
|
75
|
-
|
|
76
|
-
Token refresh normally happens automatically when making API requests.
|
|
77
|
-
Use this command to force an immediate refresh or to verify the refresh
|
|
78
|
-
mechanism is working correctly.
|
|
79
|
-
|
|
80
|
-
Examples:
|
|
81
|
-
$ sentry auth refresh
|
|
82
|
-
Token refreshed successfully. Expires in 59 minutes.
|
|
83
|
-
|
|
84
|
-
$ sentry auth refresh --force
|
|
85
|
-
Token refreshed successfully. Expires in 60 minutes.
|
|
86
|
-
|
|
87
|
-
$ sentry auth refresh --json
|
|
88
|
-
{"success":true,"refreshed":true,"expiresIn":3600,"expiresAt":"..."}
|
|
89
|
-
`.trim()},parameters:{flags:{json:{kind:"boolean",brief:"Output result as JSON",default:!1},force:{kind:"boolean",brief:"Force refresh even if token is still valid",default:!1}}},async func(t){let{stdout:e}=this,r=await de();if(!r.auth?.refreshToken&&r.auth?.token)throw new ee("invalid",`No refresh token available. You may be using a manual API token.
|
|
90
|
-
Run 'sentry auth login' to authenticate with OAuth and enable auto-refresh.`);let n=await Er({force:t.force}),s={success:!0,refreshed:n.refreshed,message:n.refreshed?"Token refreshed successfully":"Token still valid",expiresIn:n.expiresIn,expiresAt:n.expiresAt?new Date(n.expiresAt).toISOString():void 0};t.json?e.write(`${JSON.stringify(s)}
|
|
91
|
-
`):n.refreshed?e.write(`${je("\u2713")} Token refreshed successfully. Expires in ${sr(n.expiresIn??0)}.
|
|
92
|
-
`):e.write(`Token still valid (expires in ${sr(n.expiresIn??0)}).
|
|
93
|
-
Use --force to refresh anyway.
|
|
94
|
-
`)}});f();Ue();ue();function lh(t,e,r){if(!e.auth?.token)return;let n=r?e.auth.token:Pa(e.auth.token);t.write(`Token: ${n}
|
|
95
|
-
`),e.auth.expiresAt&&t.write(`Expires: ${Da(e.auth.expiresAt)}
|
|
96
|
-
`),e.auth.refreshToken?t.write(`Auto-refresh: ${je("enabled")}
|
|
97
|
-
`):t.write(`Auto-refresh: disabled (no refresh token)
|
|
98
|
-
`)}async function fh(t){let e=await ct(),r=await Rr();(e||r)&&(t.write(`
|
|
99
|
-
Defaults:
|
|
100
|
-
`),e&&t.write(` Organization: ${e}
|
|
101
|
-
`),r&&t.write(` Project: ${r}
|
|
102
|
-
`))}async function dh(t,e){t.write(`
|
|
103
|
-
Verifying credentials...
|
|
104
|
-
`);try{let r=await tt();t.write(`
|
|
105
|
-
${je("\u2713")} Access verified. You have access to ${r.length} organization(s):
|
|
106
|
-
`);let n=5;for(let s of r.slice(0,n))t.write(` - ${s.name} (${s.slug})
|
|
107
|
-
`);r.length>n&&t.write(` ... and ${r.length-n} more
|
|
108
|
-
`)}catch(r){let n=r instanceof Error?r.message:String(r);e.write(`
|
|
109
|
-
${hn("\u2717")} Could not verify credentials: ${n}
|
|
110
|
-
`)}}var ac=V({docs:{brief:"View authentication status",fullDescription:"Display information about your current authentication status, including whether you're logged in and your default organization/project settings."},parameters:{flags:{showToken:{kind:"boolean",brief:"Show the stored token (masked by default)",default:!1}}},async func(t){let{stdout:e,stderr:r}=this,n=await de(),s=await er();if(e.write(`Config file: ${jt()}
|
|
111
|
-
|
|
112
|
-
`),!s)throw new ee("not_authenticated");e.write(`Status: Authenticated ${je("\u2713")}
|
|
113
|
-
|
|
114
|
-
`),lh(e,n,t.showToken),await fh(e),await dh(e,r)}});var cc=we({routes:{login:sc,logout:oc,refresh:ic,status:ac},docs:{brief:"Authenticate with Sentry",fullDescription:"Manage authentication with Sentry. Use 'sentry auth login' to authenticate, 'sentry auth logout' to remove credentials, 'sentry auth refresh' to manually refresh your token, and 'sentry auth status' to check your authentication status.",hideRoute:{}}});f();f();ue();f();f();function ph(t){return JSON.stringify(t,null,2)}function ye(t,e){t.write(`${ph(e)}
|
|
115
|
-
`)}f();function wn(t,e,r){if(r.json){ye(t,e);return}let n=r.formatHuman(e);t.write(`${n.join(`
|
|
116
|
-
`)}
|
|
117
|
-
`),r.detectedFrom&&t.write(`
|
|
118
|
-
Detected from ${r.detectedFrom}
|
|
119
|
-
`)}f();Ue();f();f();import{join as Gh}from"node:path";f();Ue();async function bn(t){return(await de()).dsnCache?.[t]}async function _n(t,e){let r=await de();r.dsnCache={...r.dsnCache,[t]:{...e,cachedAt:Date.now()}},await Sr(r)}f();f();nn();var hh=/^o(\d+)\.ingest(?:\.[a-z]+)?\.sentry\.io$/,mh=/:$/;function uc(t){return t.match(hh)?.[1]??null}function Sn(t){try{let e=new URL(t),r=e.protocol.replace(mh,""),n=e.username;if(!n)return null;let s=e.host;if(!s)return null;let i=e.pathname.split("/").filter(Boolean).at(-1);if(!i)return null;let a=uc(s)??void 0;return{protocol:r,publicKey:n,host:s,projectId:i,orgId:a}}catch{return null}}function Ce(t,e,r,n){let s=Sn(t);return s?{...s,raw:t,source:e,sourcePath:r,packagePath:n}:null}function Bs(t){let e=t.split("/"),r=e[0],n=e[1];if(r&&n&&rn.includes(r))return`${r}/${n}`}var En="SENTRY_DSN";function Hs(){let t=process.env[En];return t?Ce(t,"env"):null}f();import{stat as yh}from"node:fs/promises";import{join as lc}from"node:path";f();import{join as gh}from"node:path";async function Rn(t,e,r){let{stopOnFirst:n=!1,processFile:s,createDsn:o}=r,i=[];for(let a of e){let c=gh(t,a),u=Bun.file(c);if(await u.exists())try{let l=await u.text(),d=s(a,l);if(d?.dsn){let h=o(d.dsn,a,d.metadata);if(h&&(i.push(h),n))return i}}catch{}}return i}nn();var Us=[".env.local",".env.development.local",".env.production.local",".env",".env.development",".env.production"],vh=/^SENTRY_DSN\s*=\s*(['"]?)(.+?)\1\s*(?:#.*)?$/;function $r(t){let e=t.split(`
|
|
120
|
-
`);for(let r of e){let n=r.trim();if(!n||n.startsWith("#"))continue;let s=n.match(vh);if(s?.[2])return s[2]}return null}async function fc(t){return(await Rn(t,[...Us],{stopOnFirst:!0,processFile:(r,n)=>{let s=$r(n);return s?{dsn:s}:null},createDsn:(r,n)=>Ce(r,"env_file",n)}))[0]??null}async function dc(t){let e=[],r=await Rn(t,[...Us],{stopOnFirst:!1,processFile:(s,o)=>{let i=$r(o);return i?{dsn:i}:null},createDsn:(s,o)=>Ce(s,"env_file",o)});e.push(...r);let n=await xh(t);return e.push(...n),e}async function xh(t){let e=[],r=new Bun.Glob("*");for(let n of rn){let s=lc(t,n);try{for await(let o of r.scan({cwd:s,onlyFiles:!1})){let i=lc(s,o);try{if(!(await yh(i)).isDirectory())continue}catch{continue}let a=`${n}/${o}`,c=await wh(i,a);c&&e.push(c)}}catch{}}return e}async function wh(t,e){return(await Rn(t,[...Us],{stopOnFirst:!0,processFile:(n,s)=>{let o=$r(s);return o?{dsn:o,metadata:{packagePath:e}}:null},createDsn:(n,s,o)=>{let i=`${e}/${s}`;return Ce(n,"env_file",i,o?.packagePath)}}))[0]??null}f();import{extname as Bh,join as Hh}from"node:path";f();var bh=/Dsn:\s*["'](https?:\/\/[^"']+@[^"']+)["']/s,_h=/dsn\s*:?=\s*["`](https?:\/\/[^"`]+@[^"`]+)["`]/is;function Sh(t){let e=t.match(bh);if(e?.[1])return e[1];let r=t.match(_h);return r?.[1]?r[1]:null}var pc={name:"Go",extensions:[".go"],skipDirs:["vendor",".git","testdata"],extractDsn:Sh};f();var Eh=/\.setDsn\s*\(\s*["']([^"']+)["']\s*\)/s,Rh=/^dsn\s*=\s*(.+)$/m,Th=/["']?dsn["']?\s*[=,]\s*["'](https?:\/\/[^"']+@[^"']+)["']/s;function Ah(t){let e=t.match(Eh);if(e?.[1])return e[1];let r=t.match(Rh);if(r?.[1]){let s=r[1].trim();if(s.startsWith("https://")&&s.includes("@"))return s}let n=t.match(Th);return n?.[1]?n[1]:null}var hc={name:"Java",extensions:[".java",".kt",".properties"],skipDirs:["target","build",".gradle",".idea",".git","out","bin",".mvn"],extractDsn:Ah};f();var Ch=/Sentry\.init\s*\(\s*\{[^}]*dsn\s*:\s*["'`]([^"'`]+)["'`]/s,kh=/dsn\s*:\s*["'`](https?:\/\/[^"'`]+@[^"'`]+)["'`]/s;function Ph(t){let e=t.match(Ch);if(e?.[1])return e[1];let r=t.match(kh);return r?.[1]?r[1]:null}var mc={name:"JavaScript",extensions:[".ts",".tsx",".js",".jsx",".mjs",".cjs"],skipDirs:["node_modules",".git","dist","build",".next",".nuxt",".output","coverage",".turbo",".cache",".vercel",".netlify"],extractDsn:Ph};f();var Dh=/\\?Sentry\\init\s*\(\s*\[[^\]]*['"]dsn['"]\s*=>\s*['"]([^'"]+)['"]/s,$h=/['"]dsn['"]\s*=>\s*['"](https?:\/\/[^'"]+@[^'"]+)['"]/s;function jh(t){let e=t.match(Dh);if(e?.[1])return e[1];let r=t.match($h);return r?.[1]?r[1]:null}var gc={name:"PHP",extensions:[".php"],skipDirs:["vendor",".git","cache","storage/framework"],extractDsn:jh};f();var Oh=/sentry_sdk\.init\s*\([^)]*dsn\s*=\s*["']([^"']+)["']/s,Ih=/["']?dsn["']?\s*[:=]\s*["'](https?:\/\/[^"']+@[^"']+)["']/s;function Nh(t){let e=t.match(Oh);if(e?.[1])return e[1];let r=t.match(Ih);return r?.[1]?r[1]:null}var yc={name:"Python",extensions:[".py"],skipDirs:["venv",".venv","env",".env","__pycache__",".tox",".nox","site-packages",".pytest_cache",".mypy_cache",".ruff_cache","dist","build"],extractDsn:Nh};f();var Lh=/config\.dsn\s*=\s*['"]([^'"]+)['"]/s,Fh=/(?:dsn:|:dsn\s*=>)\s*['"](https?:\/\/[^'"]+@[^'"]+)['"]/s;function Mh(t){let e=t.match(Lh);if(e?.[1])return e[1];let r=t.match(Fh);return r?.[1]?r[1]:null}var vc={name:"Ruby",extensions:[".rb"],skipDirs:["vendor/bundle",".bundle","tmp","log",".git","coverage","pkg"],extractDsn:Mh};var zs=[mc,yc,gc,vc,pc,hc],xc=new Map;for(let t of zs)for(let e of t.extensions)xc.set(e,t);var wc=new Set;for(let t of zs)for(let e of t.skipDirs)wc.add(e);var Uh=zs.flatMap(t=>t.extensions),zh=`**/*{${Uh.join(",")}}`,qh=new Bun.Glob(zh);function qs(t){let e=Bh(t);return xc.get(e)}async function bc(t){return(await Sc(t,!0))[0]??null}function _c(t){return Sc(t,!1)}function Wh(t){return t.split("/").some(r=>wc.has(r))}async function Vh(t,e){let r=qs(e);if(!r)return null;let n=Hh(t,e);try{let s=await Bun.file(n).text(),o=r.extractDsn(s);if(!o)return null;let i=Bs(e);return Ce(o,"code",e,i)}catch{return null}}async function Sc(t,e){let r=[];for await(let n of qh.scan({cwd:t,onlyFiles:!0})){if(Wh(n))continue;let s=await Vh(t,n);if(s&&(r.push(s),e))return r}return r}async function Tn(t){let e=await bn(t);if(e){let n=await Yh(t,e);if(n)return n.raw!==e.dsn?(await _n(t,{dsn:n.raw,projectId:n.projectId,orgId:n.orgId,source:n.source,sourcePath:n.sourcePath}),n):{...n,resolved:e.resolved}}let r=await Kh(t);return r&&await _n(t,{dsn:r.raw,projectId:r.projectId,orgId:r.orgId,source:r.source,sourcePath:r.sourcePath}),r}async function Ws(t){let e=[],r=new Set,n=c=>{r.has(c.raw)||(e.push(c),r.add(c.raw))},s=await _c(t);for(let c of s)n(c);let o=await dc(t);for(let c of o)n(c);let i=Hs();i&&n(i);let a=e.length>1;return{primary:e[0]??null,all:e,hasMultiple:a}}async function Yh(t,e){if(e.source==="env"||!e.sourcePath)return null;let r=Gh(t,e.sourcePath);try{let n=await Bun.file(r).text(),s=Zh(n,e.source,e.sourcePath);if(s===e.dsn)return Ce(e.dsn,e.source,e.sourcePath);if(s&&Sn(s))return Ce(s,e.source,e.sourcePath)}catch{}return null}function Zh(t,e,r){switch(e){case"env_file":return $r(t);case"code":return r?qs(r)?.extractDsn(t)??null:null;default:return null}}async function Kh(t){let e=await bc(t);if(e)return e;let r=await fc(t);if(r)return r;let n=Hs();return n||null}function It(t){switch(t.source){case"env":return`${En} environment variable`;case"env_file":return t.sourcePath??".env file";case"config":return t.sourcePath??"config file";case"code":return t.sourcePath??"source code";default:return"unknown source"}}f();f();function Vs(t){if(t.length<=1)return"";let e=[`Found ${t.length} Sentry projects:`];for(let r of t){let n=r.detectedFrom?` (from ${r.detectedFrom})`:"";e.push(` \u2022 ${r.orgDisplay} / ${r.projectDisplay}${n}`)}return e.push("Use --org and --project to target a specific project."),e.join(`
|
|
121
|
-
`)}ue();async function Xh(t){let e=await Tn(t);if(!(e?.orgId&&e.projectId))return null;let r=It(e),n=await fn(e.orgId,e.projectId);if(n)return{org:n.orgSlug,project:n.projectSlug,orgDisplay:n.orgName,projectDisplay:n.projectName,detectedFrom:r};let s=await Tr(e.orgId,e.projectId);return s.organization?(await _s(e.orgId,e.projectId,{orgSlug:s.organization.slug,orgName:s.organization.name,projectSlug:s.slug,projectName:s.name}),{org:s.organization.slug,project:s.slug,orgDisplay:s.organization.name,projectDisplay:s.name,detectedFrom:r}):{org:e.orgId,project:e.projectId,orgDisplay:e.orgId,projectDisplay:s.name,detectedFrom:r}}async function em(t){let e=await Tn(t);if(!e?.orgId)return null;let r=It(e);if(e.projectId){let n=await fn(e.orgId,e.projectId);if(n)return{org:n.orgSlug,detectedFrom:r}}return{org:e.orgId,detectedFrom:r}}async function tm(t){if(!(t.orgId&&t.projectId))return null;let e=It(t),r=await fn(t.orgId,t.projectId);if(r)return{org:r.orgSlug,project:r.projectSlug,orgDisplay:r.orgName,projectDisplay:r.projectName,detectedFrom:e,packagePath:t.packagePath};try{let n=await Tr(t.orgId,t.projectId);return n.organization?(await _s(t.orgId,t.projectId,{orgSlug:n.organization.slug,orgName:n.organization.name,projectSlug:n.slug,projectName:n.name}),{org:n.organization.slug,project:n.slug,orgDisplay:n.organization.name,projectDisplay:n.name,detectedFrom:e,packagePath:t.packagePath}):{org:t.orgId,project:t.projectId,orgDisplay:t.orgId,projectDisplay:n.name,detectedFrom:e,packagePath:t.packagePath}}catch(n){if(n instanceof ee)throw n;return null}}async function or(t){let{org:e,project:r,cwd:n}=t;if(e&&r)return{targets:[{org:e,project:r,orgDisplay:e,projectDisplay:r}]};if(e||r)throw new se("Organization and project",t.usageHint??"sentry <command> --org <org> --project <project>");let s=await ct(),o=await Rr();if(s&&o)return{targets:[{org:s,project:o,orgDisplay:s,projectDisplay:o}]};let i=await Ws(n);if(i.all.length===0)return{targets:[]};let a=i.all.filter(h=>!h.orgId).length,c=await Promise.all(i.all.map(h=>tm(h))),u=new Set,l=c.filter(h=>{if(h===null)return!1;let v=`${h.org}:${h.project}`;return u.has(v)?!1:(u.add(v),!0)});if(l.length===0)return{targets:[],skippedSelfHosted:a>0?a:void 0};let d=l.length>1?Vs(l):void 0;return{targets:l,footer:d,skippedSelfHosted:a>0?a:void 0}}async function Ec(t){let{org:e,project:r,cwd:n}=t;if(e&&r)return{org:e,project:r,orgDisplay:e,projectDisplay:r};if(e||r)throw new se("Organization and project",t.usageHint??"sentry <command> --org <org> --project <project>");let s=await ct(),o=await Rr();if(s&&o)return{org:s,project:o,orgDisplay:s,projectDisplay:o};try{return await Xh(n)}catch{return null}}async function An(t){let{org:e,cwd:r}=t;if(e)return{org:e};let n=await ct();if(n)return{org:n};try{return await em(r)}catch{return null}}function rm(t,e,r){let s=gn(e,`Event ${e.eventID}`).slice(1);t.write(`${s.join(`
|
|
122
|
-
`)}
|
|
123
|
-
`),r&&t.write(`
|
|
124
|
-
Detected from ${r}
|
|
125
|
-
`)}var Rc=V({docs:{brief:"Get details of a specific event",fullDescription:`Retrieve detailed information about a Sentry event by its ID.
|
|
126
|
-
|
|
127
|
-
The organization and project are resolved from:
|
|
128
|
-
1. --org and --project flags
|
|
129
|
-
2. Config defaults
|
|
130
|
-
3. SENTRY_DSN environment variable or source code detection`},parameters:{positional:{kind:"tuple",parameters:[{brief:"Event ID (hexadecimal, e.g., 9999aaaaca8b46d797c23c6077c6ff01)",parse:String}]},flags:{org:{kind:"parsed",parse:String,brief:"Organization slug",optional:!0},project:{kind:"parsed",parse:String,brief:"Project slug",optional:!0},json:{kind:"boolean",brief:"Output as JSON",default:!1}}},async func(t,e){let{stdout:r,cwd:n}=this,s=await Ec({org:t.org,project:t.project,cwd:n,usageHint:`sentry event get ${e} --org <org> --project <project>`});if(!s)throw new se("Organization and project",`sentry event get ${e} --org <org-slug> --project <project-slug>`);let o=await ra(s.org,s.project,e);if(t.json){ye(r,o);return}rm(r,o,s.detectedFrom)}});var Tc=we({routes:{get:Rc},docs:{brief:"View Sentry events",fullDescription:"View detailed event data from Sentry. Use 'sentry event get <event-id>' to view a specific event.",hideRoute:{}}});f();f();ue();async function nm(t){try{return await ta(t)}catch{return}}function sm(t,e,r){let n=Ea(e);if(t.write(`${n.join(`
|
|
131
|
-
`)}
|
|
132
|
-
`),r){let s=gn(r);t.write(`${s.join(`
|
|
133
|
-
`)}
|
|
134
|
-
`)}}var Ac=V({docs:{brief:"Get details of a specific issue",fullDescription:`Retrieve detailed information about a Sentry issue by its ID or short ID. The latest event is automatically included for full context.
|
|
135
|
-
|
|
136
|
-
For short IDs (e.g., SPOTLIGHT-ELECTRON-4D), the organization is resolved from:
|
|
137
|
-
1. --org flag
|
|
138
|
-
2. Config defaults
|
|
139
|
-
3. SENTRY_DSN environment variable`},parameters:{positional:{kind:"tuple",parameters:[{brief:"Issue ID or short ID (e.g., JAVASCRIPT-ABC or 123456)",parse:String}]},flags:{org:{kind:"parsed",parse:String,brief:"Organization slug (required for short IDs if not auto-detected)",optional:!0},json:{kind:"boolean",brief:"Output as JSON",default:!1}}},async func(t,e){let{stdout:r,cwd:n}=this,s;if(ea(e)){let i=await An({org:t.org,cwd:n});if(!i)throw new se("Organization",`sentry issue get ${e} --org <org-slug>`);s=await Xi(i.org,e)}else s=await Qi(e);let o=await nm(s.id);if(t.json){ye(r,o?{issue:s,event:o}:{issue:s});return}sm(r,s,o)}});f();ue();var Cc=["date","new","freq","user"],Gs="sentry issue list --org <org> --project <project>";function om(t){if(!Cc.includes(t))throw new Error(`Invalid sort value. Must be one of: ${Cc.join(", ")}`);return t}function im(t,e){t.write(`${e}:
|
|
140
|
-
|
|
141
|
-
`),t.write(Te(`${_a()}
|
|
142
|
-
`)),t.write(`${mn(80)}
|
|
143
|
-
`)}function am(t,e,r){for(let n of e)t.write(`${Sa(n,r)}
|
|
144
|
-
`)}function cm(t){t.write(`
|
|
145
|
-
Tip: Use 'sentry issue get <SHORT_ID>' to view issue details.
|
|
146
|
-
`)}function Ys(t,e){let r=t?new Date(t).getTime():0;return(e?new Date(e).getTime():0)-r}function um(t){switch(t){case"date":return(e,r)=>Ys(e.lastSeen,r.lastSeen);case"new":return(e,r)=>Ys(e.firstSeen,r.firstSeen);case"freq":return(e,r)=>Number.parseInt(r.count??"0",10)-Number.parseInt(e.count??"0",10);case"user":return(e,r)=>(r.userCount??0)-(e.userCount??0);default:return(e,r)=>Ys(e.lastSeen,r.lastSeen)}}async function lm(t,e){try{let r=await Ji(t.org,t.project,e);return{target:t,issues:r}}catch(r){if(r instanceof ee)throw r;return null}}var kc=V({docs:{brief:"List issues in a project",fullDescription:`List issues from Sentry projects. Use --org and --project to specify the target, or set defaults with 'sentry config set'.
|
|
147
|
-
|
|
148
|
-
In monorepos with multiple Sentry projects, shows issues from all detected projects.`},parameters:{flags:{org:{kind:"parsed",parse:String,brief:"Organization slug",optional:!0},project:{kind:"parsed",parse:String,brief:"Project slug",optional:!0},query:{kind:"parsed",parse:String,brief:"Search query (Sentry search syntax)",optional:!0},limit:{kind:"parsed",parse:Ye,brief:"Maximum number of issues to return",default:"10"},sort:{kind:"parsed",parse:om,brief:"Sort by: date, new, freq, user",default:"date"},json:{kind:"boolean",brief:"Output as JSON",default:!1}}},async func(t){let{stdout:e,cwd:r}=this,{targets:n,footer:s,skippedSelfHosted:o}=await or({org:t.org,project:t.project,cwd:r,usageHint:Gs});if(n.length===0)throw o?new se("Organization and project",`${Gs}
|
|
149
|
-
|
|
150
|
-
Note: Found ${o} self-hosted DSN(s) that cannot be resolved automatically.
|
|
151
|
-
Self-hosted Sentry instances require explicit --org and --project flags.`):new se("Organization and project",Gs);let a=(await Promise.all(n.map(h=>lm(h,{query:t.query,limit:t.limit,sort:t.sort})))).filter(h=>h!==null);if(a.length===0)throw new Error(`Failed to fetch issues from ${n.length} project(s). Check your network connection and project permissions.`);let c=a.flatMap(h=>h.issues);if(c.sort(um(t.sort)),t.json){ye(e,c);return}if(c.length===0){e.write(`No issues found.
|
|
152
|
-
`),s&&e.write(`
|
|
153
|
-
${s}
|
|
154
|
-
`);return}let u=a[0]?.target,l=a.length===1&&u?`Issues in ${u.orgDisplay}/${u.projectDisplay}`:`Issues from ${a.length} projects`;im(e,l);let d=process.stdout.columns||80;am(e,c,d),cm(e),s&&e.write(`
|
|
155
|
-
${s}
|
|
156
|
-
`)}});var Pc=we({routes:{list:kc,get:Ac},docs:{brief:"Manage Sentry issues",fullDescription:"View and manage issues from your Sentry projects. Use 'sentry issue list' to list issues and 'sentry issue get <id>' to view issue details.",hideRoute:{}}});f();f();ue();var Dc=V({docs:{brief:"Get details of an organization",fullDescription:`Retrieve detailed information about a Sentry organization.
|
|
157
|
-
|
|
158
|
-
The organization is resolved from:
|
|
159
|
-
1. Positional argument <org-slug>
|
|
160
|
-
2. Config defaults
|
|
161
|
-
3. SENTRY_DSN environment variable or source code detection`},parameters:{positional:{kind:"tuple",parameters:[{brief:"Organization slug (optional if auto-detected)",parse:String,optional:!0}]},flags:{json:{kind:"boolean",brief:"Output as JSON",default:!1}}},async func(t,e){let{stdout:r,cwd:n}=this,s=await An({org:e,cwd:n});if(!s)throw new se("Organization","sentry org get <org-slug>");let o=await Ki(s.org);wn(r,o,{json:t.json,formatHuman:Aa,detectedFrom:s.detectedFrom})}});f();var $c=V({docs:{brief:"List organizations",fullDescription:`List organizations that you have access to.
|
|
162
|
-
|
|
163
|
-
Examples:
|
|
164
|
-
sentry org list
|
|
165
|
-
sentry org list --limit 10
|
|
166
|
-
sentry org list --json`},parameters:{flags:{limit:{kind:"parsed",parse:Ye,brief:"Maximum number of organizations to list",default:"30"},json:{kind:"boolean",brief:"Output JSON",default:!1}}},async func(t){let{stdout:e}=this,r=await tt(),n=r.slice(0,t.limit);if(t.json){ye(e,n);return}if(n.length===0){e.write(`No organizations found.
|
|
167
|
-
`);return}let s=Ta(n);e.write(`${"SLUG".padEnd(s)} NAME
|
|
168
|
-
`);for(let o of n)e.write(`${Ra(o,s)}
|
|
169
|
-
`);r.length>t.limit&&e.write(`
|
|
170
|
-
Showing ${t.limit} of ${r.length} organizations
|
|
171
|
-
`)}});var jc=we({routes:{list:$c,get:Dc},docs:{brief:"Work with Sentry organizations",fullDescription:"List and manage Sentry organizations you have access to.",hideRoute:{}}});f();f();ue();async function fm(t){try{return await Tr(t.org,t.project)}catch(e){if(e instanceof ee)throw e;return null}}async function dm(t){let e=await Promise.all(t.map(fm)),r=[],n=[];for(let s=0;s<e.length;s++){let o=e[s],i=t[s];o&&i&&(r.push(o),n.push(i))}return{projects:r,targets:n}}function pm(t,e,r){for(let n=0;n<e.length;n++){let s=e[n],o=r[n];if(n>0&&t.write(`
|
|
172
|
-
${mn(60)}
|
|
173
|
-
|
|
174
|
-
`),s){let i=Os(s);t.write(i.join(`
|
|
175
|
-
`)),t.write(`
|
|
176
|
-
`),o?.detectedFrom&&t.write(`
|
|
177
|
-
Detected from: ${o.detectedFrom}
|
|
178
|
-
`)}}}var Oc=V({docs:{brief:"Get details of a project",fullDescription:`Retrieve detailed information about Sentry projects.
|
|
179
|
-
|
|
180
|
-
The organization and project are resolved from:
|
|
181
|
-
1. Positional argument <project-slug> and --org flag
|
|
182
|
-
2. Config defaults
|
|
183
|
-
3. SENTRY_DSN environment variable or source code detection
|
|
184
|
-
|
|
185
|
-
In monorepos with multiple Sentry projects, shows details for all detected projects.`},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project slug (optional if auto-detected)",parse:String,optional:!0}]},flags:{org:{kind:"parsed",parse:String,brief:"Organization slug",optional:!0},json:{kind:"boolean",brief:"Output as JSON",default:!1}}},async func(t,e){let{stdout:r,cwd:n}=this,{targets:s,footer:o,skippedSelfHosted:i}=await or({org:t.org,project:e,cwd:n,usageHint:"sentry project get <project-slug> --org <org-slug>"});if(s.length===0)throw i?new se("Organization and project",`sentry project get <project-slug> --org <org-slug>
|
|
186
|
-
|
|
187
|
-
Note: Found ${i} self-hosted DSN(s) that cannot be resolved automatically.
|
|
188
|
-
Self-hosted Sentry instances require explicit --org and --project flags.`):new se("Organization and project","sentry project get <project-slug> --org <org-slug>");let{projects:a,targets:c}=await dm(s);if(a.length===0)throw new se("Organization and project","sentry project get <project-slug> --org <org-slug>");if(t.json){ye(r,a.length===1?a[0]:a);return}let u=a[0],l=c[0];a.length===1&&u?wn(r,u,{json:!1,formatHuman:Os,detectedFrom:l?.detectedFrom}):pm(r,a,c),o&&r.write(`
|
|
189
|
-
${o}
|
|
190
|
-
`)}});f();Ue();ue();async function Ic(t){return(await Ss(t)).map(r=>({...r,orgSlug:t}))}async function hm(t){try{return await Ic(t)}catch(e){if(e instanceof ee)throw e;return[]}}async function mm(){let t=await tt(),e=[];for(let r of t)try{let n=await Ic(r.slug);e.push(...n)}catch(n){if(n instanceof ee)throw n}return e}function gm(t,e){if(!e)return t;let r=e.toLowerCase();return t.filter(n=>n.platform?.toLowerCase().includes(r))}function ym(t,e){t.write(`${"SLUG".padEnd(e)} ${"PLATFORM".padEnd(20)} NAME
|
|
191
|
-
`)}function vm(t,e,r,n){for(let s of e)t.write(`${Ca(s,{showOrg:n,orgSlug:s.orgSlug,slugWidth:r})}
|
|
192
|
-
`)}async function xm(t,e){if(t)return{orgs:[t],showOrg:!1};let r=await ct();if(r)return{orgs:[r],showOrg:!1};try{let{targets:n,footer:s,skippedSelfHosted:o}=await or({cwd:e});if(n.length>0){let i=[...new Set(n.map(a=>a.org))];return{orgs:i,footer:s,showOrg:i.length>1,skippedSelfHosted:o}}return{orgs:[],showOrg:!0,skippedSelfHosted:o}}catch(n){if(n instanceof ee)throw n}return{orgs:[],showOrg:!0}}var Nc=V({docs:{brief:"List projects",fullDescription:`List projects in an organization. If no organization is specified, uses the default organization or lists projects from all accessible organizations.
|
|
193
|
-
|
|
194
|
-
Examples:
|
|
195
|
-
sentry project list
|
|
196
|
-
sentry project list --org my-org
|
|
197
|
-
sentry project list --limit 10
|
|
198
|
-
sentry project list --json
|
|
199
|
-
sentry project list --platform javascript`},parameters:{flags:{org:{kind:"parsed",parse:String,brief:"Organization slug",optional:!0},limit:{kind:"parsed",parse:Ye,brief:"Maximum number of projects to list",default:"30"},json:{kind:"boolean",brief:"Output JSON",default:!1},platform:{kind:"parsed",parse:String,brief:"Filter by platform (e.g., javascript, python)",optional:!0}}},async func(t){let{stdout:e,cwd:r}=this,{orgs:n,footer:s,showOrg:o,skippedSelfHosted:i}=await xm(t.org,r),a;n.length>0?a=(await Promise.all(n.map(v=>hm(v)))).flat():a=await mm();let c=gm(a,t.platform),u=n.length>1?t.limit*n.length:t.limit,l=c.slice(0,u);if(t.json){ye(e,l);return}if(l.length===0){let h=n.length===1?`No projects found in organization '${n[0]}'.
|
|
200
|
-
`:`No projects found.
|
|
201
|
-
`;e.write(h);return}let d=ka(l,o);ym(e,d),vm(e,l,d,o),c.length>l.length&&e.write(`
|
|
202
|
-
Showing ${l.length} of ${c.length} projects
|
|
203
|
-
`),s&&e.write(`
|
|
204
|
-
${s}
|
|
205
|
-
`),i&&e.write(`
|
|
206
|
-
Note: Skipped ${i} self-hosted DSN(s). Use --org to specify organization explicitly.
|
|
207
|
-
`)}});var Lc=we({routes:{list:Nc,get:Oc},docs:{brief:"Work with Sentry projects",fullDescription:"List and manage Sentry projects in your organizations.",hideRoute:{}}});var wm=we({routes:{auth:cc,org:jc,project:Lc,issue:Pc,event:Tc,api:sa},docs:{brief:"A gh-like CLI for Sentry",fullDescription:"sentry is a command-line interface for interacting with Sentry. It provides commands for authentication, viewing issues, and making API calls.",hideRoute:{}}}),Fc=Jo(wm,{name:"sentry",versionInfo:{currentVersion:"0.2.0"}});f();import{homedir as bm}from"node:os";import{join as _m}from"node:path";function Mc(t){let e=bm(),r=_m(e,".sentry-cli-next");return{process:t,env:t.env,cwd:t.cwd(),homeDir:e,configDir:r,stdout:t.stdout,stderr:t.stderr}}ue();try{await ri(Fc,process.argv.slice(2),Mc(process))}catch(t){process.stderr.write(`${hn("Error:")} ${ms(t)}
|
|
208
|
-
`),process.exit(gs(t))}
|
|
209
|
-
/*! Bundled license information:
|
|
210
|
-
|
|
211
|
-
@stricli/core/dist/index.js:
|
|
212
|
-
(* v8 ignore next -- @preserve *)
|
|
213
|
-
(* v8 ignore if -- @preserve *)
|
|
214
|
-
(* v8 ignore else -- @preserve *)
|
|
215
|
-
|
|
216
|
-
ky/distribution/index.js:
|
|
217
|
-
(*! MIT License © Sindre Sorhus *)
|
|
218
|
-
*/
|