import{isDigit as t,isName as r,isValidEscape as n,isWhiteSpace as e,isHexDigit as o,isUppercaseLetter as c}from"./char-code-definitions.mjs";function f(t,r){return r<t.length?t.charCodeAt(r):0}function i(t,r,n){return 13===n&&10===f(t,r+1)?2:1}function u(t,r,n){let e=t.charCodeAt(r);return c(e)&&(e|=32),e===n}function h(t,r,n,e){if(n-r!==e.length)return!1;if(r<0||n>t.length)return!1;for(let o=r;o<n;o++){const n=e.charCodeAt(o-r);let f=t.charCodeAt(o);if(c(f)&&(f|=32),f!==n)return!1}return!0}function a(t,r){for(;r>=0&&e(t.charCodeAt(r));r--);return r+1}function d(t,r){for(;r<t.length&&e(t.charCodeAt(r));r++);return r}function C(r,n){for(;n<r.length&&t(r.charCodeAt(n));n++);return n}function A(t,r){if(o(f(t,(r+=2)-1))){for(const n=Math.min(t.length,r+5);r<n&&o(f(t,r));r++);const n=f(t,r);e(n)&&(r+=i(t,r,n))}return r}function l(t,e){for(;e<t.length;e++){const o=t.charCodeAt(e);if(!r(o)){if(!n(o,f(t,e+1)))break;e=A(t,e)-1}}return e}function g(r,n){let e=r.charCodeAt(n);if(43!==e&&45!==e||(e=r.charCodeAt(n+=1)),t(e)&&(n=C(r,n+1),e=r.charCodeAt(n)),46===e&&t(r.charCodeAt(n+1))&&(n=C(r,n+=2)),u(r,n,101)){let o=0;e=r.charCodeAt(n+1),45!==e&&43!==e||(o=1,e=r.charCodeAt(n+2)),t(e)&&(n=C(r,n+1+o+1))}return n}function s(t,r){for(;r<t.length;r++){const e=t.charCodeAt(r);if(41===e){r++;break}n(e,f(t,r+1))&&(r=A(t,r))}return r}function m(t){if(1===t.length&&!o(t.charCodeAt(0)))return t[0];let r=parseInt(t,16);return(0===r||r>=55296&&r<=57343||r>1114111)&&(r=65533),String.fromCodePoint(r)}export{u as cmpChar,h as cmpStr,s as consumeBadUrlRemnants,A as consumeEscaped,l as consumeName,g as consumeNumber,m as decodeEscaped,C as findDecimalNumberEnd,d as findWhiteSpaceEnd,a as findWhiteSpaceStart,i as getNewlineLength};