Files
cdnjs/ajax/libs/punycode/0.1.2/punycode.min.js
T

1 line
2.6 KiB
JavaScript

!function(e){function o(e){throw RangeError(F[e])}function n(e,o){for(var n=e.length;n--;)e[n]=o(e[n]);return e}function t(e,o){var t=".";return n(e.split(t),o).join(t)}function r(e){for(var n,t,r=[],u=0,f=e.length;f>u;)n=e.charCodeAt(u++),55296==(63488&n)&&(t=e.charCodeAt(u++),(55296!=(64512&n)||56320!=(64512&t))&&o("utf16decode"),n=((1023&n)<<10)+(1023&t)+65536),r.push(n);return r}function u(e){return n(e,function(e){var n="";return 55296==(63488&e)&&o("utf16encode"),e>65535&&(e-=65536,n+=P(e>>>10&1023|55296),e=56320|1023&e),n+=P(e)}).join("")}function f(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:b}function i(e,o){return e+22+75*(26>e)-((0!=o)<<5)}function c(e,o,n){var t=0;for(e=n?O(e/j):e>>1,e+=O(e/o);e>T*w>>1;t+=b)e=O(e/T);return O(t+(T+1)*e/(e+C))}function l(e){var n,t,r,i,l,d,a,s,p,h,v=[],C=e.length,j=0,I=y,U=m;for(t=e.lastIndexOf(A),0>t&&(t=0),r=0;t>r;++r)e.charCodeAt(r)>=128&&o("not-basic"),v.push(e.charCodeAt(r));for(i=t>0?t+1:0;C>i;){for(l=j,d=1,a=b;i>=C&&o("invalid-input"),s=f(e.charCodeAt(i++)),(s>=b||s>O((g-j)/d))&&o("overflow"),j+=s*d,p=U>=a?x:a>=U+w?w:a-U,!(p>s);a+=b)h=b-p,d>O(g/h)&&o("overflow"),d*=h;n=v.length+1,U=c(j-l,n,0==l),O(j/n)>g-I&&o("overflow"),I+=O(j/n),j%=n,v.splice(j++,0,I)}return u(v)}function d(e){var n,t,u,f,l,d,a,s,p,h,v,C,j,I,U,F=[];for(e=r(e),C=e.length,n=y,t=0,l=m,d=0;C>d;++d)v=e[d],128>v&&F.push(P(v));for(u=f=F.length,f&&F.push(A);C>u;){for(a=g,d=0;C>d;++d)v=e[d],v>=n&&a>v&&(a=v);for(j=u+1,a-n>O((g-t)/j)&&o("overflow"),t+=(a-n)*j,n=a,d=0;C>d;++d)if(v=e[d],n>v&&++t>g&&o("overflow"),v==n){for(s=t,p=b;h=l>=p?x:p>=l+w?w:p-l,!(h>s);p+=b)U=s-h,I=b-h,F.push(P(i(h+U%I,0))),s=O(U/I);F.push(P(i(s,0))),l=c(t,j,u==f),t=0,++u}++t,++n}return F.join("")}function a(e){return t(e,function(e){return U.test(e)?l(e.slice(4).toLowerCase()):e})}function s(e){return t(e,function(e){return I.test(e)?"xn--"+d(e):e})}var p,h="function"==typeof define&&"object"==typeof define.amd&&define.amd&&define,v="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(e=global),exports),g=2147483647,b=36,x=1,w=26,C=38,j=700,m=72,y=128,A="-",I=/[^\x20-\x7e]/,U=/^xn--/,F={overflow:"Overflow: input needs wider integers to process.",utf16decode:"UTF-16(decode): illegal UTF-16 sequence",utf16encode:"UTF-16(encode): illegal UTF-16 value","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=b-x,O=Math.floor,P=String.fromCharCode;p={version:"0.1.2",utf16:{decode:r,encode:u},decode:l,encode:d,toASCII:s,toUnicode:a},v?"object"==typeof module&&module&&module.exports==v?module.exports=p:v.Punycode=p:h?h(function(){return p}):e.Punycode=p}(this);