-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.min.js
1 lines (1 loc) · 2.08 KB
/
index.min.js
1
const r=128,e=1114111;function t(r){return r<26?97+r:22+r}function n(r){if(r<=90){if(r>=65)return r-65;if(r>=48&&r<=57)return r-22}else if(r>=97&&r<=122)return r-97;throw new Error(`not alphanumeric ASCII: 0x${r.toString(16)}`)}function o(r,e){let t=r-e;return t<=0?1:t>=26?26:t}function i(r,e,t){r=Math.floor(r/(t?700:2)),r+=Math.floor(r/e);let n=0;for(;r>455;)r=Math.floor(r/35),n+=36;return n+Math.floor(36*r/(r+38))}function f(r){return[...r].map((r=>r.codePointAt(0)))}function l(r,e){return Array.isArray(r)&&r.every((r=>Number.isSafeInteger(r)&&r>=0&&r<=e))}function u(r){if("string"==typeof r){let e=f(r),t=h(e);return e===t?r:String.fromCharCode(...t)}return String.fromCharCode(...c(r))}function c(r){if("string"==typeof r)return h(f(r));if(l(r,1114111)){let e=h(r);return r==e?r.slice():e}throw new Error("expected Unicode")}function h(r){let e=r.filter((r=>r<128)),n=e.length;if(n==r.length)return r;e.splice(0,0,120,110,45,45),n&&e.push(45);let f=128,l=72,u=0,c=n;for(;c<r.length;){let h=r.reduce(((r,e)=>e>=f&&e<r?e:r),1114111);u+=(h-f)*(c+1);for(let f of r)if(f<h)u++;else if(f==h){let r=u;for(let n=36;;n+=36){let i=o(n,l),f=r-i;if(f<0)break;let u=36-i;e.push(t(i+f%u)),r=Math.floor(f/u)}e.push(t(r)),l=i(u,c+1,c==n),u=0,c++}u++,f=h+1}return e}function a(r){let e;if(e="string"==typeof r?f(r):ArrayBuffer.isView(r)?Array.from(r):r,!l(e,127))throw new TypeError("expected ASCII");return e}function s(r){let e=a(r);return!((t=e).length>=4)||120!=t[0]&&88!=t[0]||110!=t[1]&&78!=t[1]||45!=t[2]||45!=t[3]?e===r?e.slice():e:p(e.slice(4));var t}function g(r){return p(a(r))}function p(r){let e=r.lastIndexOf(45)+1,t=Math.max(0,e-1),f=r.slice(0,t),l=0,u=128,c=72;for(;e<r.length;){let t=l,h=1,a=36;for(;;){let t=n(r[e++]);l+=t*h;let i=o(a,c);if(t<i)break;if(e>=r.length)throw new Error("invalid encoding");h*=36-i,a+=36}let s=f.length+1;if(c=i(l-t,s,0==t),u+=Math.floor(l/s),u>1114111)throw new Error("invalid encoding");l%=s,f.splice(l++,0,u)}return f}function d(r){return r>=55296&&r<=57343}export{e as MAX_CP,r as MIN_CP,d as is_surrogate,g as puny_decode,s as puny_decoded,u as puny_encoded,c as puny_encoded_bytes};