import{h as n,j as h}from"./chunk-7DHJDT2N.js";var v=h(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BLANK_URL=e.relativeFirstCharacters=e.whitespaceEscapeCharsRegex=e.urlSchemeRegex=e.ctrlCharactersRegex=e.htmlCtrlEntityRegex=e.htmlEntitiesRegex=e.invalidProtocolRegex=void 0,e.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,e.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,e.htmlCtrlEntityRegex=/&(newline|tab);/gi,e.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,e.urlSchemeRegex=/^.+(:|&colon;)/gim,e.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,e.relativeFirstCharacters=[".","/"],e.BLANK_URL="about:blank"}),f=h(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sanitizeUrl=void 0;var t=v();function R(r){return t.relativeFirstCharacters.indexOf(r[0])>-1}n(R,"isRelativeUrlWithoutProtocol");function g(r){var c=r.replace(t.ctrlCharactersRegex,"");return c.replace(t.htmlEntitiesRegex,function(a,i){return String.fromCharCode(i)})}n(g,"decodeHtmlCharacters");function m(r){return URL.canParse(r)}n(m,"isValidUrl");function u(r){try{return decodeURIComponent(r)}catch(c){return r}}n(u,"decodeURI");function p(r){if(!r)return t.BLANK_URL;var c,a=u(r.trim());do a=g(a).replace(t.htmlCtrlEntityRegex,"").replace(t.ctrlCharactersRegex,"").replace(t.whitespaceEscapeCharsRegex,"").trim(),a=u(a),c=a.match(t.ctrlCharactersRegex)||a.match(t.htmlEntitiesRegex)||a.match(t.htmlCtrlEntityRegex)||a.match(t.whitespaceEscapeCharsRegex);while(c&&c.length>0);var i=a;if(!i)return t.BLANK_URL;if(R(i))return i;var x=i.trimStart(),C=x.match(t.urlSchemeRegex);if(!C)return i;var l=C[0].toLowerCase().trim();if(t.invalidProtocolRegex.test(l))return t.BLANK_URL;var o=x.replace(/\\/g,"/");if(l==="mailto:"||l.includes("://"))return o;if(l==="http:"||l==="https:"){if(!m(o))return t.BLANK_URL;var s=new URL(o);return s.protocol=s.protocol.toLowerCase(),s.hostname=s.hostname.toLowerCase(),s.toString()}return o}n(p,"sanitizeUrl"),e.sanitizeUrl=p});export{f as a};
