Module 382811

1,645 characters · in no known chunk
Dependencies
Required by (2)
Lazily required by (0)none
Requires (1)
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";var r=n(549412),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var a=new r.Buf8(256),o=0;o<256;o++)a[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function l(e,t){if(t<65534&&(e.subarray&&s||!e.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",a=0;a<t;a++)n+=String.fromCharCode(e[a]);return n}a[254]=a[254]=1,t.string2buf=function(e){var t,n,i,s,a,o=e.length,l=0;for(s=0;s<o;s++)(64512&(n=e.charCodeAt(s)))==55296&&s+1<o&&(64512&(i=e.charCodeAt(s+1)))==56320&&(n=65536+(n-55296<<10)+(i-56320),s++),l+=n<128?1:n<2048?2:n<65536?3:4;for(a=0,t=new r.Buf8(l),s=0;a<l;s++)(64512&(n=e.charCodeAt(s)))==55296&&s+1<o&&(64512&(i=e.charCodeAt(s+1)))==56320&&(n=65536+(n-55296<<10)+(i-56320),s++),n<128?t[a++]=n:(n<2048?t[a++]=192|n>>>6:(n<65536?t[a++]=224|n>>>12:(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63),t[a++]=128|n>>>6&63),t[a++]=128|63&n);return t},t.buf2binstring=function(e){return l(e,e.length)},t.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t},t.buf2string=function(e,t){var n,r,i,s,o=t||e.length,u=Array(2*o);for(r=0,n=0;n<o;){if((i=e[n++])<128){u[r++]=i;continue}if((s=a[i])>4){u[r++]=65533,n+=s-1;continue}for(i&=2===s?31:3===s?15:7;s>1&&n<o;)i=i<<6|63&e[n++],s--;if(s>1){u[r++]=65533;continue}i<65536?u[r++]=i:(i-=65536,u[r++]=55296|i>>10&1023,u[r++]=56320|1023&i)}return l(u,r)},t.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&(192&e[n])==128;)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t}}