import{t as e}from"./rolldown-runtime-iuO8RvI4.js";var t=Math.abs,r=Math.atan2,a=Math.cos,i=Math.max,n=Math.min,s=Math.sin,c=Math.sqrt,o=1e-12,l=Math.PI,h=l/2,u=2*l;function m(e){return e>1?0:e<-1?l:Math.acos(e)}function g(e){return e>=1?h:e<=-1?-h:Math.asin(e)}var R=e(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"}),p=e(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.sanitizeUrl=function(e){if(!e)return t.BLANK_URL;var i,n=a(e.trim());do{i=(n=a(n=r(n).replace(t.htmlCtrlEntityRegex,"").replace(t.ctrlCharactersRegex,"").replace(t.whitespaceEscapeCharsRegex,"").trim())).match(t.ctrlCharactersRegex)||n.match(t.htmlEntitiesRegex)||n.match(t.htmlCtrlEntityRegex)||n.match(t.whitespaceEscapeCharsRegex)}while(i&&i.length>0);var s=n;if(!s)return t.BLANK_URL;if(function(e){return t.relativeFirstCharacters.indexOf(e[0])>-1}(s))return s;var c=s.trimStart(),o=c.match(t.urlSchemeRegex);if(!o)return s;var l=o[0].toLowerCase().trim();if(t.invalidProtocolRegex.test(l))return t.BLANK_URL;var h=c.replace(/\\/g,"/");if("mailto:"===l||l.includes("://"))return h;if("http:"===l||"https:"===l){if(!function(e){return URL.canParse(e)}(h))return t.BLANK_URL;var u=new URL(h);return u.protocol=u.protocol.toLowerCase(),u.hostname=u.hostname.toLowerCase(),u.toString()}return h};var t=R();function r(e){return e.replace(t.ctrlCharactersRegex,"").replace(t.htmlEntitiesRegex,function(e,t){return String.fromCharCode(t)})}function a(e){try{return decodeURIComponent(e)}catch(t){return e}}});export{r as a,h as c,l as d,s as f,g as i,i as l,u as m,t as n,a as o,c as p,m as r,o as s,p as t,n as u};