From 330386e0af508cead771ab1dcdaea4df4bcdab09 Mon Sep 17 00:00:00 2001 From: Samuel Kopp <62482066+boywithkeyboard@users.noreply.github.com> Date: Thu, 10 Aug 2023 20:49:19 +0200 Subject: [PATCH] refactor: remove js file --- mod.js | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 mod.js diff --git a/mod.js b/mod.js deleted file mode 100644 index 1af0499..0000000 --- a/mod.js +++ /dev/null @@ -1,9 +0,0 @@ -// deno-fmt-ignore-file -// deno-lint-ignore-file -var J=class extends Error{name="AssertionError";constructor(t){super(t)}};function T(e,t=""){if(!e)throw new J(t)}var{hasOwn:ae}=Object;function y(e,t){if(ae(e,t))return e[t]}function _(e,t){let n=y(e,t);return T(n!=null),n}function oe(e){return typeof e=="number"||/^0x[0-9a-f]+$/i.test(String(e))?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(String(e))}function H(e,t){let n=e;t.slice(0,-1).forEach(i=>{n=y(n,i)??{}});let r=t[t.length-1];return ae(n,r)}function De(e,{"--":t=!1,alias:n={},boolean:r=!1,default:i={},stopEarly:s=!1,string:l=[],collect:o=[],negatable:u=[],unknown:d=a=>a}={}){let a={},f={bools:{},strings:{},unknownFn:d,allBools:!1,collect:{},negatable:{}};if(n!==void 0)for(let g in n){let h=_(n,g);typeof h=="string"?a[g]=[h]:a[g]=h;for(let m of _(a,g))a[m]=[g].concat(a[g].filter(w=>m!==w))}if(r!==void 0)if(typeof r=="boolean")f.allBools=!!r;else{let g=typeof r=="string"?[r]:r;for(let h of g.filter(Boolean)){f.bools[h]=!0;let m=y(a,h);if(m)for(let w of m)f.bools[w]=!0}}if(l!==void 0){let g=typeof l=="string"?[l]:l;for(let h of g.filter(Boolean)){f.strings[h]=!0;let m=y(a,h);if(m)for(let w of m)f.strings[w]=!0}}if(o!==void 0){let g=typeof o=="string"?[o]:o;for(let h of g.filter(Boolean)){f.collect[h]=!0;let m=y(a,h);if(m)for(let w of m)f.collect[w]=!0}}if(u!==void 0){let g=typeof u=="string"?[u]:u;for(let h of g.filter(Boolean)){f.negatable[h]=!0;let m=y(a,h);if(m)for(let w of m)f.negatable[w]=!0}}let c={_:[]};function C(g,h){return f.allBools&&/^--[^=]+$/.test(h)||y(f.bools,g)||!!y(f.strings,g)||!!y(a,g)}function S(g,h,m,w=!0){let A=g,$=h.split(".");$.slice(0,-1).forEach(function(X){y(A,X)===void 0&&(A[X]={}),A=y(A,X)});let R=$[$.length-1];w&&!!y(f.collect,h)?y(A,R)===void 0?A[R]=[m]:Array.isArray(y(A,R))?A[R].push(m):A[R]=[y(A,R),m]:A[R]=m}function v(g,h,m=void 0,w){if(m&&f.unknownFn&&!C(g,m)&&f.unknownFn(m,g,h)===!1)return;let A=!y(f.strings,g)&&oe(h)?Number(h):h;S(c,g,A,w);let $=y(a,g);if($)for(let R of $)S(c,R,A,w)}function se(g){return _(a,g).some(h=>typeof y(f.bools,h)=="boolean")}let Z=[];e.includes("--")&&(Z=e.slice(e.indexOf("--")+1),e=e.slice(0,e.indexOf("--")));for(let g=0;g{let{Deno:e}=globalThis;if(typeof e?.build?.os=="string")return e.build.os;let{navigator:t}=globalThis;return t?.appVersion?.includes?.("Win")?"windows":"linux"})(),ue=Ie==="windows",Pe=47;function j(e){if(typeof e!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(e)}`)}function E(e){return e===47}function b(e){return E(e)||e===92}function N(e){return e>=97&&e<=122||e>=65&&e<=90}function O(e,t,n,r){let i="",s=0,l=-1,o=0,u;for(let d=0,a=e.length;d<=a;++d){if(d2){let f=i.lastIndexOf(n);f===-1?(i="",s=0):(i=i.slice(0,f),s=i.length-1-i.lastIndexOf(n)),l=d,o=0;continue}else if(i.length===2||i.length===1){i="",s=0,l=d,o=0;continue}}t&&(i.length>0?i+=`${n}..`:i="..",s=2)}else i.length>0?i+=n+e.slice(l+1,d):i=e.slice(l+1,d),s=d-l-1;l=d,o=0}else u===46&&o!==-1?++o:o=-1}return i}function de(e,t){let n=t.dir||t.root,r=t.base||(t.name||"")+(t.ext||"");return n?r===e?n:n===t.root?n+r:n+e+r:r}var Fe={" ":"%09","\n":"%0A","\v":"%0B","\f":"%0C","\r":"%0D"," ":"%20"};function he(e){return e.replaceAll(/[\s]/g,t=>Fe[t]??t)}function ge(e,t,n=0){let r=!1,i=e.length;for(let s=e.length-1;s>=n;--s)if(t(e.charCodeAt(s))){if(r){n=s+1;break}}else r||(r=!0,i=s+1);return e.slice(n,i)}function F(e,t){if(e.length<=1)return e;let n=e.length;for(let r=e.length-1;r>0&&t(e.charCodeAt(r));r--)n=r;return e.slice(0,n)}function me(e,t){if(t.length>=e.length)return e;let n=e.length-t.length;for(let r=t.length-1;r>=0;--r)if(e.charCodeAt(n+r)!==t.charCodeAt(r))return e;return e.slice(0,-t.length)}var Ue="\\",Le=";";function x(...e){let t="",n="",r=!1;for(let i=e.length-1;i>=-1;i--){let s,{Deno:l}=globalThis;if(i>=0)s=e[i];else if(t){if(typeof l?.env?.get!="function"||typeof l?.cwd!="function")throw new TypeError("Resolved a relative path without a CWD.");s=l.cwd(),(s===void 0||s.slice(0,3).toLowerCase()!==`${t.toLowerCase()}\\`)&&(s=`${t}\\`)}else{if(typeof l?.cwd!="function")throw new TypeError("Resolved a drive-letter-less path without a CWD.");s=l.cwd()}j(s);let o=s.length;if(o===0)continue;let u=0,d="",a=!1,f=s.charCodeAt(0);if(o>1)if(b(f))if(a=!0,b(s.charCodeAt(1))){let c=2,C=c;for(;c2&&b(s.charCodeAt(2))&&(a=!0,u=3));else b(f)&&(u=1,a=!0);if(!(d.length>0&&t.length>0&&d.toLowerCase()!==t.toLowerCase())&&(t.length===0&&d.length>0&&(t=d),r||(n=`${s.slice(u)}\\${n}`,r=a),r&&t.length>0))break}return n=O(n,!r,"\\",b),t+(r?"\\":"")+n||"."}function pe(e){j(e);let t=e.length;if(t===0)return".";let n=0,r,i=!1,s=e.charCodeAt(0);if(t>1)if(b(s))if(i=!0,b(e.charCodeAt(1))){let o=2,u=o;for(;o2&&b(e.charCodeAt(2))&&(i=!0,n=3));else if(b(s))return"\\";let l;return n0&&b(e.charCodeAt(t-1))&&(l+="\\"),r===void 0?i?l.length>0?`\\${l}`:"\\":l.length>0?l:"":i?l.length>0?`${r}\\${l}`:`${r}\\`:l.length>0?r+l:r}function be(e){j(e);let t=e.length;if(t===0)return!1;let n=e.charCodeAt(0);return b(n)?!0:!!(N(n)&&t>2&&e.charCodeAt(1)===58&&b(e.charCodeAt(2)))}function xe(...e){let t=e.length;if(t===0)return".";let n,r=null;for(let l=0;l0&&(n===void 0?n=r=o:n+=`\\${o}`)}if(n===void 0)return".";let i=!0,s=0;if(T(r!=null),b(r.charCodeAt(0))){++s;let l=r.length;l>1&&b(r.charCodeAt(1))&&(++s,l>2&&(b(r.charCodeAt(2))?++s:i=!1))}if(i){for(;s=2&&(n=`\\${n.slice(s)}`)}return pe(n)}function ze(e,t){if(j(e),j(t),e===t)return"";let n=x(e),r=x(t);if(n===r||(e=n.toLowerCase(),t=r.toLowerCase(),e===t))return"";let i=0,s=e.length;for(;ii&&e.charCodeAt(s-1)===92;--s);let l=s-i,o=0,u=t.length;for(;oo&&t.charCodeAt(u-1)===92;--u);let d=u-o,a=la){if(t.charCodeAt(o+c)===92)return r.slice(o+c+1);if(c===2)return r.slice(o+c)}l>a&&(e.charCodeAt(i+c)===92?f=c:c===2&&(f=3));break}let S=e.charCodeAt(i+c),v=t.charCodeAt(o+c);if(S!==v)break;S===92&&(f=c)}if(c!==a&&f===-1)return r;let C="";for(f===-1&&(f=0),c=i+f+1;c<=s;++c)(c===s||e.charCodeAt(c)===92)&&(C.length===0?C+="..":C+="\\..");return C.length>0?C+r.slice(o+f,u):(o+=f,r.charCodeAt(o)===92&&++o,r.slice(o,u))}function We(e){if(typeof e!="string")return e;if(e.length===0)return"";let t=x(e);if(t.length>=3){if(t.charCodeAt(0)===92){if(t.charCodeAt(1)===92){let n=t.charCodeAt(2);if(n!==63&&n!==46)return`\\\\?\\UNC\\${t.slice(2)}`}}else if(N(t.charCodeAt(0))&&t.charCodeAt(1)===58&&t.charCodeAt(2)===92)return`\\\\?\\${t}`}return e}function Oe(e){j(e);let t=e.length;if(t===0)return".";let n=-1,r=-1,i=!0,s=0,l=e.charCodeAt(0);if(t>1)if(b(l)){if(n=s=1,b(e.charCodeAt(1))){let o=2,u=o;for(;o2&&b(e.charCodeAt(2))&&(n=s=3));else if(b(l))return e;for(let o=t-1;o>=s;--o)if(b(e.charCodeAt(o))){if(!i){r=o;break}}else i=!1;if(r===-1){if(n===-1)return".";r=n}return F(e.slice(0,r),E)}function Be(e,t=""){if(j(e),e.length===0)return e;if(typeof t!="string")throw new TypeError(`Suffix must be a string. Received ${JSON.stringify(t)}`);let n=0;if(e.length>=2){let s=e.charCodeAt(0);N(s)&&e.charCodeAt(1)===58&&(n=2)}let r=ge(e,b,n),i=F(r,b);return t?me(i,t):i}function Me(e){j(e);let t=0,n=-1,r=0,i=-1,s=!0,l=0;e.length>=2&&e.charCodeAt(1)===58&&N(e.charCodeAt(0))&&(t=r=2);for(let o=e.length-1;o>=t;--o){let u=e.charCodeAt(o);if(b(u)){if(!s){r=o+1;break}continue}i===-1&&(s=!1,i=o+1),u===46?n===-1?n=o:l!==1&&(l=1):n!==-1&&(l=-1)}return n===-1||i===-1||l===0||l===1&&n===i-1&&n===r+1?"":e.slice(n,i)}function Ge(e){if(e===null||typeof e!="object")throw new TypeError(`The "pathObject" argument must be of type Object. Received type ${typeof e}`);return de("\\",e)}function Ze(e){j(e);let t={root:"",dir:"",base:"",ext:"",name:""},n=e.length;if(n===0)return t;let r=0,i=e.charCodeAt(0);if(n>1){if(b(i)){if(r=1,b(e.charCodeAt(1))){let f=2,c=f;for(;f2){if(b(e.charCodeAt(2))){if(n===3)return t.root=t.dir=e,t.base="\\",t;r=3}}else return t.root=t.dir=e,t}else if(b(i))return t.root=t.dir=e,t.base="\\",t;r>0&&(t.root=e.slice(0,r));let s=-1,l=r,o=-1,u=!0,d=e.length-1,a=0;for(;d>=r;--d){if(i=e.charCodeAt(d),b(i)){if(!u){l=d+1;break}continue}o===-1&&(u=!1,o=d+1),i===46?s===-1?s=d:a!==1&&(a=1):s!==-1&&(a=-1)}return s===-1||o===-1||a===0||a===1&&s===o-1&&s===l+1?o!==-1&&(t.base=t.name=e.slice(l,o)):(t.name=e.slice(l,s),t.base=e.slice(l,o),t.ext=e.slice(s,o)),t.base=t.base||"\\",l>0&&l!==r?t.dir=e.slice(0,l-1):t.dir=t.root,t}function Xe(e){if(e=e instanceof URL?e:new URL(e),e.protocol!="file:")throw new TypeError("Must be a file URL.");let t=decodeURIComponent(e.pathname.replace(/\//g,"\\").replace(/%(?![0-9A-Fa-f]{2})/g,"%25")).replace(/^\\*([A-Za-z]:)(\\|$)/,"$1\\");return e.hostname!=""&&(t=`\\\\${e.hostname}${t}`),t}function _e(e){if(!be(e))throw new TypeError("Must be an absolute path.");let[,t,n]=e.match(/^(?:[/\\]{2}([^/\\]+)(?=[/\\](?:[^/\\]|$)))?(.*)/),r=new URL("file:///");if(r.pathname=he(n.replace(/%/g,"%25")),t!=null&&t!="localhost"&&(r.hostname=t,!r.hostname))throw new TypeError("Invalid hostname.");return r}var Ae={sep:Ue,delimiter:Le,resolve:x,normalize:pe,isAbsolute:be,join:xe,relative:ze,toNamespacedPath:We,dirname:Oe,basename:Be,extname:Me,format:Ge,parse:Ze,fromFileUrl:Xe,toFileUrl:_e},He="/",Ve=":";function q(...e){let t="",n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i;if(r>=0)i=e[r];else{let{Deno:s}=globalThis;if(typeof s?.cwd!="function")throw new TypeError("Resolved a relative path without a CWD.");i=s.cwd()}j(i),i.length!==0&&(t=`${i}/${t}`,n=E(i.charCodeAt(0)))}return t=O(t,!n,"/",E),n?t.length>0?`/${t}`:"/":t.length>0?t:"."}function we(e){if(j(e),e.length===0)return".";let t=E(e.charCodeAt(0)),n=E(e.charCodeAt(e.length-1));return e=O(e,!t,"/",E),e.length===0&&!t&&(e="."),e.length>0&&n&&(e+="/"),t?`/${e}`:e}function ye(e){return j(e),e.length>0&&E(e.charCodeAt(0))}function Je(...e){if(e.length===0)return".";let t;for(let n=0,r=e.length;n0&&(t?t+=`/${i}`:t=i)}return t?we(t):"."}function qe(e,t){if(j(e),j(t),e===t||(e=q(e),t=q(t),e===t))return"";let n=1,r=e.length;for(;nu){if(E(t.charCodeAt(s+a)))return t.slice(s+a+1);if(a===0)return t.slice(s+a)}else i>u&&(E(e.charCodeAt(n+a))?d=a:a===0&&(d=0));break}let c=e.charCodeAt(n+a),C=t.charCodeAt(s+a);if(c!==C)break;E(c)&&(d=a)}let f="";for(a=n+d+1;a<=r;++a)(a===r||E(e.charCodeAt(a)))&&(f.length===0?f+="..":f+="/..");return f.length>0?f+t.slice(s+d):(s+=d,E(t.charCodeAt(s))&&++s,t.slice(s))}function Ke(e){return e}function Ye(e){if(e.length===0)return".";let t=-1,n=!1;for(let r=e.length-1;r>=1;--r)if(E(e.charCodeAt(r))){if(n){t=r;break}}else n=!0;return t===-1?E(e.charCodeAt(0))?"/":".":F(e.slice(0,t),E)}function Qe(e,t=""){if(j(e),e.length===0)return e;if(typeof t!="string")throw new TypeError(`Suffix must be a string. Received ${JSON.stringify(t)}`);let n=ge(e,E),r=F(n,E);return t?me(r,t):r}function et(e){j(e);let t=-1,n=0,r=-1,i=!0,s=0;for(let l=e.length-1;l>=0;--l){let o=e.charCodeAt(l);if(E(o)){if(!i){n=l+1;break}continue}r===-1&&(i=!1,r=l+1),o===46?t===-1?t=l:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||r===-1||s===0||s===1&&t===r-1&&t===n+1?"":e.slice(t,r)}function tt(e){if(e===null||typeof e!="object")throw new TypeError(`The "pathObject" argument must be of type Object. Received type ${typeof e}`);return de("/",e)}function nt(e){j(e);let t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;let n=E(e.charCodeAt(0)),r;n?(t.root="/",r=1):r=0;let i=-1,s=0,l=-1,o=!0,u=e.length-1,d=0;for(;u>=r;--u){let a=e.charCodeAt(u);if(E(a)){if(!o){s=u+1;break}continue}l===-1&&(o=!1,l=u+1),a===46?i===-1?i=u:d!==1&&(d=1):i!==-1&&(d=-1)}return i===-1||l===-1||d===0||d===1&&i===l-1&&i===s+1?(l!==-1&&(s===0&&n?t.base=t.name=e.slice(1,l):t.base=t.name=e.slice(s,l)),t.base=t.base||"/"):(s===0&&n?(t.name=e.slice(1,i),t.base=e.slice(1,l)):(t.name=e.slice(s,i),t.base=e.slice(s,l)),t.ext=e.slice(i,l)),s>0?t.dir=F(e.slice(0,s-1),E):n&&(t.dir="/"),t}function rt(e){if(e=e instanceof URL?e:new URL(e),e.protocol!="file:")throw new TypeError("Must be a file URL.");return decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function it(e){if(!ye(e))throw new TypeError("Must be an absolute path.");let t=new URL("file:///");return t.pathname=he(e.replace(/%/g,"%25").replace(/\\/g,"%5C")),t}var Ce={sep:He,delimiter:Ve,resolve:q,normalize:we,isAbsolute:ye,join:Je,relative:qe,toNamespacedPath:Ke,dirname:Ye,basename:Qe,extname:et,format:tt,parse:nt,fromFileUrl:rt,toFileUrl:it},st=ue?Ae:Ce,{join:Lt,normalize:xt}=st,ot=ue?Ae:Ce,{basename:lt,delimiter:zt,dirname:Wt,extname:Ot,format:Bt,fromFileUrl:ft,isAbsolute:Mt,join:ct,normalize:Ee,parse:Gt,relative:Zt,resolve:Xt,toFileUrl:_t,toNamespacedPath:Ht}=ot;async function at(e){e=$e(e),e=Ee(e);let t=lt(e),n=await Deno.stat(e);return{path:e,name:t,isFile:n.isFile,isDirectory:n.isDirectory,isSymlink:n.isSymlink}}function $e(e){return e instanceof URL?ft(e):e}var z=class extends Error{cause;name="WalkError";path;constructor(t,n){super(`${t instanceof Error?t.message:t} for path "${n}"`),this.path=n,this.cause=t}};function U(e,t,n,r){return!(t&&!t.some(i=>e.endsWith(i))||n&&!n.some(i=>!!e.match(i))||r&&r.some(i=>!!e.match(i)))}function ut(e,t){return e instanceof z?e:new z(e,t)}async function*ke(e,{maxDepth:t=1/0,includeFiles:n=!0,includeDirs:r=!0,includeSymlinks:i=!0,followSymlinks:s=!1,exts:l=void 0,match:o=void 0,skip:u=void 0}={}){if(!(t<0)&&(e=$e(e),r&&U(e,l,o,u)&&(yield await at(e)),!(t<1||!U(e,void 0,void 0,u))))try{for await(let d of Deno.readDir(e)){T(d.name!=null);let a=ct(e,d.name),{isSymlink:f,isDirectory:c}=d;if(f){if(!s){i&&U(a,l,o,u)&&(yield{path:a,...d});continue}a=await Deno.realPath(a),{isSymlink:f,isDirectory:c}=await Deno.lstat(a)}f||c?yield*ke(a,{maxDepth:t-1,includeFiles:n,includeDirs:r,includeSymlinks:i,followSymlinks:s,exts:l,match:o,skip:u}):n&&U(a,l,o,u)&&(yield{path:a,...d})}}catch(d){throw ut(d,Ee(e))}}var dt={registryName:"deno.land",urlPrefix:"https://deno.land/",async fetchReleases(e){let t=await fetch(`https://apiland.deno.dev/v2/modules/${e}`);return t.ok?(await t.json()).versions:void 0},async fetchRepositoryUrl(e){let t=await fetch(`https://apiland.deno.dev/v2/modules/${e}`);return t.ok?`https://github.com/${(await t.json()).info.upload_options.repository}`:void 0},parseUrl(e){return e=e.replace("https://",""),{moduleName:e.startsWith("https://deno.land/std")?"std":e.split("/")[2].split("@")[0],version:e.startsWith("https://deno.land/std")?e.split("/")[1].split("@")[1]:e.split("/")[2].split("@")[1]}}},ht={registryName:"esm.sh",urlPrefix:"https://esm.sh/",async fetchReleases(e){let t=await fetch(`https://registry.npmjs.org/${e}`);if(!t.ok)return;let n=await t.json();return Object.keys(n.versions)},async fetchRepositoryUrl(e){let t=await fetch(`https://registry.npmjs.org/${e}`);return t.ok?(await t.json()).repository.url.slice(0,-4):void 0},parseUrl(e){e=e.replace("https://","");let t=e.split("/")[1].split("@")[0];t.length===0&&(t=e.split("/")[1]+"/"+e.split("/")[2].split("@")[0]);let r=e.split("/")[1].split("@")[0].length===0?e.split("/")[2].split("@")[1]:e.split("/")[1].split("@")[1];return{moduleName:t,version:r}}},gt={registryName:"cdn.jsdelivr.net",urlPrefix:"https://cdn.jsdelivr.net/",async fetchReleases(e){if(e.includes("/")&&!e.startsWith("@")){let t=await fetch(`https://api.github.com/repos/${e}/releases`);return t.ok?(await t.json()).map(r=>r.tag_name):void 0}else{let t=await fetch(`https://registry.npmjs.org/${e}`);if(!t.ok)return;let n=await t.json();return Object.keys(n.versions)}},async fetchRepositoryUrl(e){if(e.includes("/")&&!e.startsWith("@"))return`https://github.com/${e}`;let t=await fetch(`https://registry.npmjs.org/${e}`);return t.ok?(await t.json()).repository.url.slice(0,-4):void 0},parseUrl(e){if(e=e.replace("https://",""),e.startsWith("https://cdn.jsdelivr.net/gh/"))return{moduleName:e.split("/")[2]+"/"+e.split("/")[3].split("@")[0],version:e.split("/")[3].split("@")[1]};{let t=e.split("/")[2].split("@")[0],n=e.split("/")[2].split("@")[1];return t.length===0&&(t=e.split("/")[2]+"/"+e.split("/")[3].split("@")[0],n=e.split("/")[3].split("@")[1]),{moduleName:t,version:n}}}},K=[dt,ht,gt];async function mt(...e){let t=[];for(let n of e)try{let{isFile:r,isDirectory:i}=await Deno.stat(n);if(r){let s=await le(n);if(!s)continue;t.push({filePath:n,urls:s})}else if(i)for await(let s of ke(n)){let l=await le(s.path);l&&t.push({filePath:s.path,urls:l})}}catch{continue}return t}async function le(e){let t=/(?:(?:(?:[a-z]+:)?\/\/)|www\.)(?:\S+(?::\S*)?@)?(?:localhost|(?:(?:[a-z\u00a1-\uffff0-9][-_]*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#][^\s"]*)?/gi;try{let r=(await Deno.readTextFile(e)).match(t);if(!r)return;let i=[];for(let s of r){if(s=s.replaceAll("'","").replaceAll('"',"").replace(")",""),K.some(o=>s===o.urlPrefix))continue;let l=K.filter(o=>s.startsWith(o.urlPrefix))[0];s.includes("${")||!l||i.push(s)}return i.length===0?void 0:i}catch{return}}var W=[],p=[],k=0,B=k++;p[B]="0|[1-9]\\d*";var je=k++;p[je]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var ve=k++,V=p[B];p[ve]=`(${V})\\.(${V})\\.(${V})`;var Y=k++;p[Y]="(?:"+p[B]+"|"+p[je]+")";var te=k++;p[te]="(?:-("+p[Y]+"(?:\\."+p[Y]+")*))";var Q=k++;p[Q]="[0-9A-Za-z-]+";var ne=k++;p[ne]="(?:\\+("+p[Q]+"(?:\\."+p[Q]+")*))";var re=k++,Re="v?"+p[ve]+p[te]+"?"+p[ne]+"?";p[re]="^"+Re+"$";var ie=k++;p[ie]="((?:<|>)?=?)";var L=k++;p[L]=p[B]+"|x|X|\\*";var D=k++;p[D]="[v=\\s]*("+p[L]+")(?:\\.("+p[L]+")(?:\\.("+p[L]+")(?:"+p[te]+")?"+p[ne]+"?)?)?";var pt=k++;p[pt]="^"+p[ie]+"\\s*"+p[D]+"$";var Se=k++;p[Se]="(?:~>?)";var bt=k++;p[bt]="^"+p[Se]+p[D]+"$";var Ne=k++;p[Ne]="(?:\\^)";var At=k++;p[At]="^"+p[Ne]+p[D]+"$";var wt=k++;p[wt]="^"+p[ie]+"\\s*("+Re+")$|^$";var yt=k++;p[yt]="^\\s*("+p[D]+")\\s+-\\s+("+p[D]+")\\s*$";var Ct=k++;p[Ct]="(<|>)?=?\\s*\\*";for(let e=0;e256||!W[re].test(e))return null;try{return new I(e,t)}catch{return null}}function Et(e,t){if(e===null)return null;let n=ee(e,t);return n?n.version:null}var I=class e{raw;options;major;minor;patch;version;build;prerelease;constructor(t,n){if(typeof n!="object"&&(n={includePrerelease:!1}),t instanceof e)t=t.version;else if(typeof t!="string")throw new TypeError("Invalid Version: "+t);if(t.length>256)throw new TypeError("version is longer than 256 characters");if(!(this instanceof e))return new e(t,n);this.options=n;let r=t.trim().match(W[re]);if(!r)throw new TypeError("Invalid Version: "+t);if(this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>Number.MAX_SAFE_INTEGER||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Number.MAX_SAFE_INTEGER||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Number.MAX_SAFE_INTEGER||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&si).join("+");case"full":return[this.version,this.build.join(".")].filter(i=>i).join("+");case"release":return r;case"prerelease":return this.version;default:return this.version}}compare(t){return t instanceof e||(t=new e(t,this.options)),this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),P(this.major,t.major)||P(this.minor,t.minor)||P(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{let r=this.prerelease[n],i=t.prerelease[n];if(r===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(r===void 0)return-1;if(r===i)continue;return P(r,i)}while(++n);return 1}compareBuild(t){t instanceof e||(t=new e(t,this.options));let n=0;do{let r=this.build[n],i=t.build[n];if(r===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(r===void 0)return-1;if(r===i)continue;return P(r,i)}while(++n);return 1}increment(t,n,r){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.increment("pre",n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.increment("pre",n);break;case"prepatch":this.prerelease.length=0,this.increment("patch",n),this.increment("pre",n);break;case"prerelease":this.prerelease.length===0&&this.increment("patch",n),this.increment("pre",n);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);i===-1&&this.prerelease.push(0)}n&&(this.prerelease[0]===n?isNaN(this.prerelease[1])&&(this.prerelease=[n,0]):this.prerelease=[n,0]);break;default:throw new Error("invalid increment argument: "+t)}return this.build=r===void 0?this.build:r.split("."),this.format(),this.raw=this.version,this}toString(){return this.version}};function $t(e,t,n){if(jt(e,t,n))return null;{let r=ee(e),i=ee(t),s="",l=null;if(r&&i){(r.prerelease.length||i.prerelease.length)&&(s="pre",l="prerelease");for(let o in r)if((o==="major"||o==="minor"||o==="patch")&&r[o]!==i[o])return s+o}return l}}var fe=/^[0-9]+$/;function P(e,t){let n=fe.test(e),r=fe.test(t);if(e===null||t===null)throw"Comparison against null invalid";return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:e<~]))"].join("|"),"g");async function Pt({allowBreaking:e=!1,allowUnstable:t=!1,createChangelog:n=!1,files:r}){let i={"esm.sh":{},"deno.land":{},"cdn.jsdelivr.net":{}};for(let l of r)for(let o of l.urls)try{if(o.endsWith("#pin"))continue;let u=K.filter(S=>o.startsWith(S.urlPrefix))[0],d=u.parseUrl(o);if(!d)continue;let{moduleName:a,version:f}=d;if(!Et(f))continue;let c=await u.fetchReleases(a);if(!c)continue;c=c.sort(kt);let C=$t(f,c[0]);if(C===null||!e&&C==="major"||!t&&C==="prerelease")continue;i[u.registryName][a]?i[u.registryName][a].push([f,c[0]]):i[u.registryName][a]=[[f,c[0]]]}catch{continue}let s="";for(let[l,o]of Object.entries(i)){s===""?s+=`- **${l}** - -`:s+=` -- **${l}** - -`;let u=[];for(let[d,a]of Object.entries(o))for(let f of a){let c=u.findIndex(C=>C.name===d&&C.from===f[0]&&C.to===f[1]);c>-1?u[c].count++:u.push({name:d,from:f[0],to:f[1],count:1})}for(let{name:d,from:a,to:f,count:c}of u)s+=` - ${d} \xD7 \`${a}\` \u2192 \`${f}\`${c>1?` (x${c})`:""} -`,console.log(Tt(`${Nt(d)} \xD7 ${St(a)} \u2192 ${It(a)}`))}return n&&await Deno.writeTextFile("./update_changelog.md",s),i}var Ft={url:"file:///C:/Users/Samuel/code/.deaddeno/updater/mod.ts",main:import.meta.main};if(Ft.main){let e=De(Deno.args),t=await mt(e._[0]??Deno.cwd());await Pt({files:t,allowBreaking:e.breaking??e.b??!1,allowUnstable:e.unstable??e.u??!1,createChangelog:e.changelog??e.c??!1})}export{mt as analyze,Pt as update};