import{t as g}from"./chunk-LvLJmgfZ.js";var p=g((e=>{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=g((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.sanitizeUrl=void 0;var t=p();function R(r){return t.relativeFirstCharacters.indexOf(r[0])>-1}function m(r){return r.replace(t.ctrlCharactersRegex,"").replace(t.htmlEntitiesRegex,function(l,a){return String.fromCharCode(a)})}function x(r){return URL.canParse(r)}function s(r){try{return decodeURIComponent(r)}catch{return r}}function C(r){if(!r)return t.BLANK_URL;var l,a=s(r.trim());do a=m(a).replace(t.htmlCtrlEntityRegex,"").replace(t.ctrlCharactersRegex,"").replace(t.whitespaceEscapeCharsRegex,"").trim(),a=s(a),l=a.match(t.ctrlCharactersRegex)||a.match(t.htmlEntitiesRegex)||a.match(t.htmlCtrlEntityRegex)||a.match(t.whitespaceEscapeCharsRegex);while(l&&l.length>0);var i=a;if(!i)return t.BLANK_URL;if(R(i))return i;var h=i.trimStart(),u=h.match(t.urlSchemeRegex);if(!u)return i;var n=u[0].toLowerCase().trim();if(t.invalidProtocolRegex.test(n))return t.BLANK_URL;var o=h.replace(/\\/g,"/");if(n==="mailto:"||n.includes("://"))return o;if(n==="http:"||n==="https:"){if(!x(o))return t.BLANK_URL;var c=new URL(o);return c.protocol=c.protocol.toLowerCase(),c.hostname=c.hostname.toLowerCase(),c.toString()}return o}e.sanitizeUrl=C}));export{f as t};
