halife 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/polyfill/esm/miniprog.js +1 -1
- package/dist/polyfill/esm/textcoder.polyfill.js +188 -196
- package/dist/polyfill/esm/url.polyfill.js +483 -488
- package/package.json +1 -1
- package/dist/polyfill/esm/chunk-N6xyN86N.js +0 -5
- package/dist/polyfill/esm/text_decoder.polyfill.js +0 -54
- package/dist/polyfill/esm/text_encoder.polyfill.js +0 -93
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=(e,t)=>()=>(e&&(t=e(e=0)),t),t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),n=t(((e,t)=>{let n,r;if(Object.defineProperty(e,`__esModule`,{value:!0}),typeof TextEncoder>`u`||typeof TextDecoder>`u`){var i=String.fromCharCode,a={}.toString,o=a(),s=Uint8Array,c=s||Array,l=s?ArrayBuffer:c,u=l.isView||function(e){return e&&`length`in e},d=a.call(l.prototype),f=/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,p=new(s?Uint16Array:c)(32);function e(e){}class t{encoding=`utf-8`;constructor(){}encode(e){let t=e===void 0?``:``+e,n=t.length|0,r=new c((n<<1)+8|0),i,a=0,o=0,l=0,u=0,d=!s;for(a=0;a<n;a=a+1|0,o=o+1|0)if(l=t.charCodeAt(a)|0,l<=127)r[o]=l;else if(l<=2047)r[o]=192|l>>6,r[o=o+1|0]=128|l&63;else{widenCheck:{if(55296<=l)if(l<=56319){if(u=t.charCodeAt(a=a+1|0)|0,56320<=u&&u<=57343){if(l=(l<<10)+u-56613888|0,l>65535){r[o]=240|l>>18,r[o=o+1|0]=128|l>>12&63,r[o=o+1|0]=128|l>>6&63,r[o=o+1|0]=128|l&63;continue}break widenCheck}l=65533}else l<=57343&&(l=65533);!d&&a<<1<o&&a<<1<(o-7|0)&&(d=!0,i=new c(n*3),i.set(r),r=i)}r[o]=224|l>>12,r[o=o+1|0]=128|l>>6&63,r[o=o+1|0]=128|l&63}return s?r.subarray(0,o):r.slice(0,o)}encodeInto(t,n){var r=t===void 0?``:(``+t).replace(f,e),i=r.length|0,a=0,o=0,s=0,c=n.length|0,l=t.length|0;c<i&&(i=c);putChars:for(;a<i;a=a+1|0){switch(o=r.charCodeAt(a)|0,o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:s=s+1|0;case 8:case 9:case 10:case 11:break;case 12:case 13:if((a+1|0)<c){s=s+1|0;break}case 14:if((a+2|0)<c){s=s+1|0;break}case 15:if((a+3|0)<c){s=s+1|0;break}default:break putChars}n[a]=o}return{written:a,read:l<s?l:s}}}class m{constructor(){this.encoding=`utf-8`,this.fatal=!1,this.ignoreBOM=!1}decode(e){var t=e,n;if(!u(t)){if(n=a.call(t),n!==d&&n!==o)throw TypeError(`Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'`);t=s?new c(t):t||[]}for(var r=``,l=``,f=0,m=t.length|0,h=m-32|0,g=0,_=0,v=0,y=0,b=0,x=0,S=-1;f<m;){for(g=f<=h?32:m-f|0;x<g;f=f+1|0,x=x+1|0){switch(_=t[f]&255,_>>4){case 15:if(b=t[f=f+1|0]&255,b>>6!=2||247<_){f=f-1|0;break}v=(_&7)<<6|b&63,y=5,_=256;case 14:b=t[f=f+1|0]&255,v<<=6,v|=(_&15)<<6|b&63,y=b>>6==2?y+4|0:24,_=_+256&768;case 13:case 12:b=t[f=f+1|0]&255,v<<=6,v|=(_&31)<<6|b&63,y=y+7|0,f<m&&b>>6==2&&v>>y&&v<1114112?(_=v,v=v-65536|0,0<=v?(S=(v>>10)+55296|0,_=(v&1023)+56320|0,x<31?(p[x]=S,x=x+1|0,S=-1):(b=S,S=_,_=b)):g=g+1|0):(_>>=8,f=f-_-1|0,_=65533),y=0,v=0,g=f<=h?32:m-f|0;default:p[x]=_;continue;case 11:case 10:case 9:case 8:}p[x]=65533}if(l+=i(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15],p[16],p[17],p[18],p[19],p[20],p[21],p[22],p[23],p[24],p[25],p[26],p[27],p[28],p[29],p[30],p[31]),x<32&&(l=l.slice(0,x-32|0)),f<m){if(p[0]=S,x=~S>>>31,S=-1,l.length<r.length)continue}else S!==-1&&(l+=i(S));r+=l,l=``}return r}}n=t,r=m,globalThis!=`undefined`&&(globalThis.TextDecoder=r,globalThis.TextEncoder=n)}else r=TextDecoder,n=TextEncoder;e.default={TextEncoderPolyfill:n,TextDecoderPolyfill:r},t.exports=e.default})),r=t(((e,t)=>{let n;if(Object.defineProperty(e,`__esModule`,{value:!0}),typeof URL>`u`){let e=function(e,t){if(t=t.split(`:`)[0],e=+e,!e)return!1;switch(t){case`http`:case`ws`:return e!==80;case`https`:case`wss`:return e!==443;case`ftp`:return e!==21;case`gopher`:return e!==70;case`file`:return!1}return e!==0};var r=Object.prototype.hasOwnProperty,i;let t=function(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return null}},p=function(e){try{return encodeURIComponent(e)}catch{return null}},m=function(e){for(var n=/([^=?#&]+)=?([^&]*)/g,r={},i;i=n.exec(e);){var a=t(i[1]),o=t(i[2]);a===null||o===null||a in r||(r[a]=o)}return r},h=function(e,t){t||=``;var n=[],a,o;for(o in typeof t!=`string`&&(t=`?`),e)if(r.call(e,o)){if(a=e[o],!a&&(a===null||a===i||isNaN(a))&&(a=``),o=p(o),a=p(a),o===null||a===null)continue;n.push(o+`=`+a)}return n.length?t+n.join(`&`):``};var a=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,o=/[\n\r\t]/g,s=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,c=/:\d+$/,l=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,u=/^[a-zA-Z]:/;let g=function(e){return(e||``).toString().replace(a,``)},_=function(e){var t=g(e),n=t.length;if(n===0)return t;for(;n&&!(t.charCodeAt(n-1)>32);)--n;return t.slice(0,n)};var d=[[`#`,`hash`],[`?`,`query`],function(e,t){return y(t.protocol)?e.replace(/\\/g,`/`):e},[`/`,`pathname`],[`@`,`auth`,1],[NaN,`host`,void 0,1,1],[/:(\d*)$/,`port`,void 0,1],[NaN,`hostname`,void 0,1,1]],f={hash:1,query:1};let v=function(e){var t=(typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{}).location||{};e||=t;var n={},r=typeof e,i;if(e.protocol===`blob:`)n=new S(unescape(e.pathname),{});else if(r===`string`)for(i in n=new S(e,{}),f)delete n[i];else if(r===`object`){for(i in e)i in f||(n[i]=e[i]);n.slashes===void 0&&(n.slashes=s.test(e.href))}return n},y=function(e){return e===`file:`||e===`ftp:`||e===`http:`||e===`https:`||e===`ws:`||e===`wss:`},b=function(e,t){e=_(e),e=e.replace(o,``),t||={};var n=l.exec(e),r=n[1]?n[1].toLowerCase():``,i=!!n[2],a=!!n[3],s=0,c;return i?a?(c=n[2]+n[3]+n[4],s=n[2].length+n[3].length):(c=n[2]+n[4],s=n[2].length):a?(c=n[3]+n[4],s=n[3].length):c=n[4],r===`file:`?s>=2&&(c=c.slice(2)):y(r)?c=n[4]:r?i&&(c=c.slice(2)):s>=2&&y(t.protocol)&&(c=n[4]),{protocol:r,slashes:i||y(r),slashesCount:s,rest:c}},x=function(e,t){if(e===``)return t;for(var n=(t||`/`).split(`/`).slice(0,-1).concat(e.split(`/`)),r=n.length,i=n[r-1],a=!1,o=0;r--;)n[r]===`.`?n.splice(r,1):n[r]===`..`?(n.splice(r,1),o++):o&&(r===0&&(a=!0),n.splice(r,1),o--);return a&&n.unshift(``),(i===`.`||i===`..`)&&n.push(``),n.join(`/`)};function S(t,n,r){if(!(this instanceof S))return new S(t,n,r);var i,a,o,s,c,l,f=d.slice(),p=typeof n,h=this,g=0;for(p!==`object`&&p!==`string`&&(r=n,n=null),r&&typeof r!=`function`&&(r=m),n=v(n),a=b(t||``,n),i=!a.protocol&&!a.slashes,h.slashes=a.slashes||i&&n.slashes,h.protocol=a.protocol||n.protocol||``,t=a.rest,(a.protocol===`file:`&&(a.slashesCount!==2||u.test(t))||!a.slashes&&(a.protocol||a.slashesCount<2||!y(h.protocol)))&&(f[3]=[/(.*)/,`pathname`]);g<f.length;g++){if(s=f[g],typeof s==`function`){t=s(t,h);continue}o=s[0],l=s[1],o===o?typeof o==`string`?(c=o===`@`?t.lastIndexOf(o):t.indexOf(o),~c&&(typeof s[2]==`number`?(h[l]=t.slice(0,c),t=t.slice(c+s[2])):(h[l]=t.slice(c),t=t.slice(0,c)))):(c=o.exec(t))&&(h[l]=c[1],t=t.slice(0,c.index)):h[l]=t,h[l]=h[l]||i&&s[3]&&n[l]||``,s[4]&&(h[l]=h[l].toLowerCase())}r&&(h.query=r(h.query)),i&&n.slashes&&h.pathname.charAt(0)!==`/`&&(h.pathname!==``||n.pathname!==``)&&(h.pathname=x(h.pathname,n.pathname)),h.pathname.charAt(0)!==`/`&&y(h.protocol)&&(h.pathname=`/`+h.pathname),e(h.port,h.protocol)||(h.host=h.hostname,h.port=``),h.username=h.password=``,h.auth&&=(c=h.auth.indexOf(`:`),~c?(h.username=h.auth.slice(0,c),h.username=encodeURIComponent(decodeURIComponent(h.username)),h.password=h.auth.slice(c+1),h.password=encodeURIComponent(decodeURIComponent(h.password))):h.username=encodeURIComponent(decodeURIComponent(h.auth)),h.password?h.username+`:`+h.password:h.username),h.origin=h.protocol!==`file:`&&y(h.protocol)&&h.host?h.protocol+`//`+h.host:`null`,h.href=h.toString()}S.prototype={set:function(t,n,r){var i=this;switch(t){case`query`:typeof n==`string`&&n.length&&(n=(r||m)(n)),i[t]=n;break;case`port`:i[t]=n,e(n,i.protocol)?n&&(i.host=i.hostname+`:`+n):(i.host=i.hostname,i[t]=``);break;case`hostname`:i[t]=n,i.port&&(n+=`:`+i.port),i.host=n;break;case`host`:i[t]=n,c.test(n)?(n=n.split(`:`),i.port=n.pop(),i.hostname=n.join(`:`)):(i.hostname=n,i.port=``);break;case`protocol`:i.protocol=n.toLowerCase(),i.protocol&&i.protocol.charAt(i.protocol.length-1)!==`:`&&(i.protocol+=`:`),i.slashes=!r;break;case`pathname`:case`hash`:if(n&&!r){var a=t===`pathname`?`/`:`#`;i[t]=n.charAt(0)===a?n:a+n}else i[t]=n;break;case`username`:case`password`:i[t]=encodeURIComponent(n);break;case`auth`:var o=n.indexOf(`:`);~o?(i.username=n.slice(0,o),i.username=encodeURIComponent(decodeURIComponent(i.username)),i.password=n.slice(o+1),i.password=encodeURIComponent(decodeURIComponent(i.password))):i.username=encodeURIComponent(decodeURIComponent(n))}for(var s=0;s<d.length;s++){var l=d[s];l[4]&&(i[l[1]]=i[l[1]].toLowerCase())}return i.auth=i.password?i.username+`:`+i.password:i.username,i.origin=i.protocol!==`file:`&&y(i.protocol)&&i.host?i.protocol+`//`+i.host:`null`,i.href=i.toString(),i},toString:function(e){(!e||typeof e!=`function`)&&(e=h);var t,n=this,r=n.host,i=n.protocol;i&&i.charAt(i.length-1)!==`:`&&(i+=`:`);var a=i+(i&&n.slashes||y(i)?`//`:``);return n.username?(a+=n.username,n.password&&(a+=`:`+n.password),a+=`@`):n.password?(a+=`:`+n.password,a+=`@`):i!==`file:`&&y(i)&&!r&&n.pathname!==`/`&&(a+=`@`),(r[r.length-1]===`:`||c.test(n.hostname)&&!n.port)&&(r+=`:`),a+=r+n.pathname,t=typeof n.query==`object`?e(n.query):n.query,t&&(a+=t.charAt(0)===`?`?t:`?`+t),n.hash&&(a+=n.hash),a}},S.extractProtocol=b,S.location=v,S.trimLeft=g,S.stringify=h,S.parse=m,S.canParse=()=>{},S.createObjectURL=()=>{},S.revokeObjectURL=()=>{},n=S,globalThis!=`undefined`&&(globalThis.URL=n)}else n=URL;e.default=n,t.exports=e.default})),i,a=e((()=>{i=class{constructor(){this.listeners=new Map}addEventListener(e,t,n){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}removeEventListener(e,t,n){this.listeners.get(e)?.delete(t)}dispatchEvent(e){let t=this.listeners.get(e.type);if(!t)return!0;for(let n of t)typeof n==`function`?n(e):n&&typeof n.handleEvent==`function`&&n.handleEvent(e);return!0}}})),o=t(((e,t)=>{a();let n;if(Object.defineProperty(e,`__esModule`,{value:!0}),typeof WebSocket>`u`){class e extends i{static{this.CONNECTING=0}static{this.OPEN=1}static{this.CLOSING=2}static{this.CLOSED=3}constructor(t,n){if(super(),this.CONNECTING=0,this.OPEN=1,this.CLOSING=2,this.CLOSED=3,this.binaryType=`arraybuffer`,this.readyState=0,this.url=``,this.extensions=``,this.bufferedAmount=0,typeof wx>`u`||!wx.connectSocket)throw Error(`This Function MUST be used in MotherFucker WeChat, you know what I mean?`);if(!(this instanceof e))throw TypeError(`Constructor WebSocket requires 'new'`);this.url=t.toString(),this.protocol=n?.[0]||``,this.readyState=e.CONNECTING;let r=wx.connectSocket({url:this.url,protocols:n,success:()=>{},complete:()=>{},fail:t=>{this.readyState=e.CLOSED,this.dispatchEvent({type:`error`,message:t.errMsg})}});r.onOpen(t=>{this.readyState=e.OPEN,this.extensions=t.header?.[`Sec-WebSocket-Extensions`]||``,this.protocol=t.header?.[`Sec-WebSocket-Protocol`],this.dispatchEvent({type:`open`})}),r.onMessage(e=>{this.dispatchEvent({type:`message`,data:e})}),r.onClose(t=>{this.readyState=e.CLOSED,this.dispatchEvent({type:`close`,detial:t.code,message:t.reason})}),r.onError(t=>{this.readyState=e.CLOSED,this.dispatchEvent({type:`error`,message:t.errMsg}),this.dispatchEvent({type:`close`,message:t.errMsg})})}send(t){if(this.readyState!==e.OPEN)return this.dispatchEvent({type:`error`,message:`Socket is not open`});wx.sendSocketMessage({data:t,success:()=>{},fail:()=>{},complete:()=>{}})}close(t=1e3,n=``){this.readyState!==e.CLOSED&&(this.readyState=e.CLOSING,wx.closeSocket({code:t,reason:n,success:()=>{},fail:()=>{},complete:()=>{}}))}onclose(){}onerror(){}onmessage(){}onopen(){}}globalThis!=`undefined`&&(globalThis.WebSocket=e)}else n=WebSocket;e.default=n,t.exports=e.default})),s=t(((e,t)=>{let n;if(Object.defineProperty(e,`__esModule`,{value:!0}),typeof fetch>`u`){function e(e,t){return new Promise((n,r)=>{if(typeof wx>`u`||!wx.request)return r(Error(`This Function MUST be used in MotherFucker WeChat, you know what I mean?`));let{method:i,headers:a,body:o}=t||{},s=e instanceof URL?e.href:e.toString();wx.request({url:s,method:i,header:a,data:o?.buffer,dataType:`other`,responseType:`arraybuffer`,success:e=>{let t={ok:e.statusCode>=200&&e.statusCode<300,status:e.statusCode,statusText:e.errMsg,headers:e.header,arrayBuffer:()=>Promise.resolve(e.data),blob:()=>Promise.resolve(e.data),redirected:!1,url:s,clone:()=>t,type:`default`,body:e.data,bodyUsed:!1,formData:()=>Promise.resolve(e.data),json:()=>Promise.resolve(e.data),text:()=>Promise.resolve(e.data)};n(t)},fail:e=>{r(Error(e.errMsg))}})})}e.preconnect=()=>{},globalThis!=`undefined`&&(globalThis.fetch=e)}else n=fetch;e.default=n,t.exports=e.default}));n(),r(),o(),s(),a();export{i as EventTarget};
|
|
1
|
+
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n&&e(r,Symbol.toStringTag,{value:`Module`}),r};let n,r;if(Object.defineProperty(exports,`__esModule`,{value:!0}),typeof TextEncoder>`u`||typeof TextDecoder>`u`){var i=String.fromCharCode,a={}.toString,o=a(),s=Uint8Array,c=s||Array,l=s?ArrayBuffer:c,u=l.isView||function(e){return e&&`length`in e},d=a.call(l.prototype),f=/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,p=new(s?Uint16Array:c)(32);function e(e){}class t{encoding=`utf-8`;constructor(){}encode(e){let t=e===void 0?``:``+e,n=t.length|0,r=new c((n<<1)+8|0),i,a=0,o=0,l=0,u=0,d=!s;for(a=0;a<n;a=a+1|0,o=o+1|0)if(l=t.charCodeAt(a)|0,l<=127)r[o]=l;else if(l<=2047)r[o]=192|l>>6,r[o=o+1|0]=128|l&63;else{widenCheck:{if(55296<=l)if(l<=56319){if(u=t.charCodeAt(a=a+1|0)|0,56320<=u&&u<=57343){if(l=(l<<10)+u-56613888|0,l>65535){r[o]=240|l>>18,r[o=o+1|0]=128|l>>12&63,r[o=o+1|0]=128|l>>6&63,r[o=o+1|0]=128|l&63;continue}break widenCheck}l=65533}else l<=57343&&(l=65533);!d&&a<<1<o&&a<<1<(o-7|0)&&(d=!0,i=new c(n*3),i.set(r),r=i)}r[o]=224|l>>12,r[o=o+1|0]=128|l>>6&63,r[o=o+1|0]=128|l&63}return s?r.subarray(0,o):r.slice(0,o)}encodeInto(t,n){var r=t===void 0?``:(``+t).replace(f,e),i=r.length|0,a=0,o=0,s=0,c=n.length|0,l=t.length|0;c<i&&(i=c);putChars:for(;a<i;a=a+1|0){switch(o=r.charCodeAt(a)|0,o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:s=s+1|0;case 8:case 9:case 10:case 11:break;case 12:case 13:if((a+1|0)<c){s=s+1|0;break}case 14:if((a+2|0)<c){s=s+1|0;break}case 15:if((a+3|0)<c){s=s+1|0;break}default:break putChars}n[a]=o}return{written:a,read:l<s?l:s}}}class m{constructor(){this.encoding=`utf-8`,this.fatal=!1,this.ignoreBOM=!1}decode(e){var t=e,n;if(!u(t)){if(n=a.call(t),n!==d&&n!==o)throw TypeError(`Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'`);t=s?new c(t):t||[]}for(var r=``,l=``,f=0,m=t.length|0,h=m-32|0,g=0,_=0,v=0,y=0,b=0,x=0,S=-1;f<m;){for(g=f<=h?32:m-f|0;x<g;f=f+1|0,x=x+1|0){switch(_=t[f]&255,_>>4){case 15:if(b=t[f=f+1|0]&255,b>>6!=2||247<_){f=f-1|0;break}v=(_&7)<<6|b&63,y=5,_=256;case 14:b=t[f=f+1|0]&255,v<<=6,v|=(_&15)<<6|b&63,y=b>>6==2?y+4|0:24,_=_+256&768;case 13:case 12:b=t[f=f+1|0]&255,v<<=6,v|=(_&31)<<6|b&63,y=y+7|0,f<m&&b>>6==2&&v>>y&&v<1114112?(_=v,v=v-65536|0,0<=v?(S=(v>>10)+55296|0,_=(v&1023)+56320|0,x<31?(p[x]=S,x=x+1|0,S=-1):(b=S,S=_,_=b)):g=g+1|0):(_>>=8,f=f-_-1|0,_=65533),y=0,v=0,g=f<=h?32:m-f|0;default:p[x]=_;continue;case 11:case 10:case 9:case 8:}p[x]=65533}if(l+=i(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15],p[16],p[17],p[18],p[19],p[20],p[21],p[22],p[23],p[24],p[25],p[26],p[27],p[28],p[29],p[30],p[31]),x<32&&(l=l.slice(0,x-32|0)),f<m){if(p[0]=S,x=~S>>>31,S=-1,l.length<r.length)continue}else S!==-1&&(l+=i(S));r+=l,l=``}return r}}n=t,r=m,globalThis!=`undefined`&&(globalThis.TextDecoder=r,globalThis.TextEncoder=n)}else r=TextDecoder,n=TextEncoder;let m;if(Object.defineProperty(exports,`__esModule`,{value:!0}),typeof URL>`u`){let e=function(e,t){if(t=t.split(`:`)[0],e=+e,!e)return!1;switch(t){case`http`:case`ws`:return e!==80;case`https`:case`wss`:return e!==443;case`ftp`:return e!==21;case`gopher`:return e!==70;case`file`:return!1}return e!==0};var h=Object.prototype.hasOwnProperty,g;let t=function(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return null}},n=function(e){try{return encodeURIComponent(e)}catch{return null}},r=function(e){for(var n=/([^=?#&]+)=?([^&]*)/g,r={},i;i=n.exec(e);){var a=t(i[1]),o=t(i[2]);a===null||o===null||a in r||(r[a]=o)}return r},i=function(e,t){t||=``;var r=[],i,a;for(a in typeof t!=`string`&&(t=`?`),e)if(h.call(e,a)){if(i=e[a],!i&&(i===null||i===g||isNaN(i))&&(i=``),a=n(a),i=n(i),a===null||i===null)continue;r.push(a+`=`+i)}return r.length?t+r.join(`&`):``};var _=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,v=/[\n\r\t]/g,y=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,b=/:\d+$/,x=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,S=/^[a-zA-Z]:/;let a=function(e){return(e||``).toString().replace(_,``)},o=function(e){var t=a(e),n=t.length;if(n===0)return t;for(;n&&!(t.charCodeAt(n-1)>32);)--n;return t.slice(0,n)};var C=[[`#`,`hash`],[`?`,`query`],function(e,t){return c(t.protocol)?e.replace(/\\/g,`/`):e},[`/`,`pathname`],[`@`,`auth`,1],[NaN,`host`,void 0,1,1],[/:(\d*)$/,`port`,void 0,1],[NaN,`hostname`,void 0,1,1]],w={hash:1,query:1};let s=function(e){var t=(typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{}).location||{};e||=t;var n={},r=typeof e,i;if(e.protocol===`blob:`)n=new d(unescape(e.pathname),{});else if(r===`string`)for(i in n=new d(e,{}),w)delete n[i];else if(r===`object`){for(i in e)i in w||(n[i]=e[i]);n.slashes===void 0&&(n.slashes=y.test(e.href))}return n},c=function(e){return e===`file:`||e===`ftp:`||e===`http:`||e===`https:`||e===`ws:`||e===`wss:`},l=function(e,t){e=o(e),e=e.replace(v,``),t||={};var n=x.exec(e),r=n[1]?n[1].toLowerCase():``,i=!!n[2],a=!!n[3],s=0,l;return i?a?(l=n[2]+n[3]+n[4],s=n[2].length+n[3].length):(l=n[2]+n[4],s=n[2].length):a?(l=n[3]+n[4],s=n[3].length):l=n[4],r===`file:`?s>=2&&(l=l.slice(2)):c(r)?l=n[4]:r?i&&(l=l.slice(2)):s>=2&&c(t.protocol)&&(l=n[4]),{protocol:r,slashes:i||c(r),slashesCount:s,rest:l}},u=function(e,t){if(e===``)return t;for(var n=(t||`/`).split(`/`).slice(0,-1).concat(e.split(`/`)),r=n.length,i=n[r-1],a=!1,o=0;r--;)n[r]===`.`?n.splice(r,1):n[r]===`..`?(n.splice(r,1),o++):o&&(r===0&&(a=!0),n.splice(r,1),o--);return a&&n.unshift(``),(i===`.`||i===`..`)&&n.push(``),n.join(`/`)};function d(t,n,i){if(!(this instanceof d))return new d(t,n,i);var a,o,f,p,m,h,g=C.slice(),_=typeof n,v=this,y=0;for(_!==`object`&&_!==`string`&&(i=n,n=null),i&&typeof i!=`function`&&(i=r),n=s(n),o=l(t||``,n),a=!o.protocol&&!o.slashes,v.slashes=o.slashes||a&&n.slashes,v.protocol=o.protocol||n.protocol||``,t=o.rest,(o.protocol===`file:`&&(o.slashesCount!==2||S.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!c(v.protocol)))&&(g[3]=[/(.*)/,`pathname`]);y<g.length;y++){if(p=g[y],typeof p==`function`){t=p(t,v);continue}f=p[0],h=p[1],f===f?typeof f==`string`?(m=f===`@`?t.lastIndexOf(f):t.indexOf(f),~m&&(typeof p[2]==`number`?(v[h]=t.slice(0,m),t=t.slice(m+p[2])):(v[h]=t.slice(m),t=t.slice(0,m)))):(m=f.exec(t))&&(v[h]=m[1],t=t.slice(0,m.index)):v[h]=t,v[h]=v[h]||a&&p[3]&&n[h]||``,p[4]&&(v[h]=v[h].toLowerCase())}i&&(v.query=i(v.query)),a&&n.slashes&&v.pathname.charAt(0)!==`/`&&(v.pathname!==``||n.pathname!==``)&&(v.pathname=u(v.pathname,n.pathname)),v.pathname.charAt(0)!==`/`&&c(v.protocol)&&(v.pathname=`/`+v.pathname),e(v.port,v.protocol)||(v.host=v.hostname,v.port=``),v.username=v.password=``,v.auth&&=(m=v.auth.indexOf(`:`),~m?(v.username=v.auth.slice(0,m),v.username=encodeURIComponent(decodeURIComponent(v.username)),v.password=v.auth.slice(m+1),v.password=encodeURIComponent(decodeURIComponent(v.password))):v.username=encodeURIComponent(decodeURIComponent(v.auth)),v.password?v.username+`:`+v.password:v.username),v.origin=v.protocol!==`file:`&&c(v.protocol)&&v.host?v.protocol+`//`+v.host:`null`,v.href=v.toString()}d.prototype={set:function(t,n,i){var a=this;switch(t){case`query`:typeof n==`string`&&n.length&&(n=(i||r)(n)),a[t]=n;break;case`port`:a[t]=n,e(n,a.protocol)?n&&(a.host=a.hostname+`:`+n):(a.host=a.hostname,a[t]=``);break;case`hostname`:a[t]=n,a.port&&(n+=`:`+a.port),a.host=n;break;case`host`:a[t]=n,b.test(n)?(n=n.split(`:`),a.port=n.pop(),a.hostname=n.join(`:`)):(a.hostname=n,a.port=``);break;case`protocol`:a.protocol=n.toLowerCase(),a.protocol&&a.protocol.charAt(a.protocol.length-1)!==`:`&&(a.protocol+=`:`),a.slashes=!i;break;case`pathname`:case`hash`:if(n&&!i){var o=t===`pathname`?`/`:`#`;a[t]=n.charAt(0)===o?n:o+n}else a[t]=n;break;case`username`:case`password`:a[t]=encodeURIComponent(n);break;case`auth`:var s=n.indexOf(`:`);~s?(a.username=n.slice(0,s),a.username=encodeURIComponent(decodeURIComponent(a.username)),a.password=n.slice(s+1),a.password=encodeURIComponent(decodeURIComponent(a.password))):a.username=encodeURIComponent(decodeURIComponent(n))}for(var l=0;l<C.length;l++){var u=C[l];u[4]&&(a[u[1]]=a[u[1]].toLowerCase())}return a.auth=a.password?a.username+`:`+a.password:a.username,a.origin=a.protocol!==`file:`&&c(a.protocol)&&a.host?a.protocol+`//`+a.host:`null`,a.href=a.toString(),a},toString:function(e){(!e||typeof e!=`function`)&&(e=i);var t,n=this,r=n.host,a=n.protocol;a&&a.charAt(a.length-1)!==`:`&&(a+=`:`);var o=a+(a&&n.slashes||c(a)?`//`:``);return n.username?(o+=n.username,n.password&&(o+=`:`+n.password),o+=`@`):n.password?(o+=`:`+n.password,o+=`@`):a!==`file:`&&c(a)&&!r&&n.pathname!==`/`&&(o+=`@`),(r[r.length-1]===`:`||b.test(n.hostname)&&!n.port)&&(r+=`:`),o+=r+n.pathname,t=typeof n.query==`object`?e(n.query):n.query,t&&(o+=t.charAt(0)===`?`?t:`?`+t),n.hash&&(o+=n.hash),o}},d.extractProtocol=l,d.location=s,d.trimLeft=a,d.stringify=i,d.parse=r,d.canParse=()=>{},d.createObjectURL=()=>{},d.revokeObjectURL=()=>{},m=d,globalThis!=`undefined`&&(globalThis.URL=m)}else m=URL;var T=class{constructor(){this.listeners=new Map}addEventListener(e,t,n){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}removeEventListener(e,t,n){this.listeners.get(e)?.delete(t)}dispatchEvent(e){let t=this.listeners.get(e.type);if(!t)return!0;for(let n of t)typeof n==`function`?n(e):n&&typeof n.handleEvent==`function`&&n.handleEvent(e);return!0}},E=t({default:()=>O});let D;if(Object.defineProperty(exports,`__esModule`,{value:!0}),typeof WebSocket>`u`){class e extends T{static{this.CONNECTING=0}static{this.OPEN=1}static{this.CLOSING=2}static{this.CLOSED=3}constructor(t,n){if(super(),this.CONNECTING=0,this.OPEN=1,this.CLOSING=2,this.CLOSED=3,this.binaryType=`arraybuffer`,this.readyState=0,this.url=``,this.extensions=``,this.bufferedAmount=0,typeof wx>`u`||!wx.connectSocket)throw Error(`This Function MUST be used in MotherFucker WeChat, you know what I mean?`);if(!(this instanceof e))throw TypeError(`Constructor WebSocket requires 'new'`);this.url=t.toString(),this.protocol=n?.[0]||``,this.readyState=e.CONNECTING;let r=wx.connectSocket({url:this.url,protocols:n,success:()=>{},complete:()=>{},fail:t=>{this.readyState=e.CLOSED,this.dispatchEvent({type:`error`,message:t.errMsg})}});r.onOpen(t=>{this.readyState=e.OPEN,this.extensions=t.header?.[`Sec-WebSocket-Extensions`]||``,this.protocol=t.header?.[`Sec-WebSocket-Protocol`],this.dispatchEvent({type:`open`})}),r.onMessage(e=>{this.dispatchEvent({type:`message`,data:e})}),r.onClose(t=>{this.readyState=e.CLOSED,this.dispatchEvent({type:`close`,detial:t.code,message:t.reason})}),r.onError(t=>{this.readyState=e.CLOSED,this.dispatchEvent({type:`error`,message:t.errMsg}),this.dispatchEvent({type:`close`,message:t.errMsg})})}send(t){if(this.readyState!==e.OPEN)return this.dispatchEvent({type:`error`,message:`Socket is not open`});wx.sendSocketMessage({data:t,success:()=>{},fail:()=>{},complete:()=>{}})}close(t=1e3,n=``){this.readyState!==e.CLOSED&&(this.readyState=e.CLOSING,wx.closeSocket({code:t,reason:n,success:()=>{},fail:()=>{},complete:()=>{}}))}onclose(){}onerror(){}onmessage(){}onopen(){}}globalThis!=`undefined`&&(globalThis.WebSocket=e)}else D=WebSocket;var O=D,k=t({default:()=>j});let A;if(Object.defineProperty(exports,`__esModule`,{value:!0}),typeof fetch>`u`){function e(e,t){return new Promise((n,r)=>{if(typeof wx>`u`||!wx.request)return r(Error(`This Function MUST be used in MotherFucker WeChat, you know what I mean?`));let{method:i,headers:a,body:o}=t||{},s=e instanceof URL?e.href:e.toString();wx.request({url:s,method:i,header:a,data:o?.buffer,dataType:`other`,responseType:`arraybuffer`,success:e=>{let t={ok:e.statusCode>=200&&e.statusCode<300,status:e.statusCode,statusText:e.errMsg,headers:e.header,arrayBuffer:()=>Promise.resolve(e.data),blob:()=>Promise.resolve(e.data),redirected:!1,url:s,clone:()=>t,type:`default`,body:e.data,bodyUsed:!1,formData:()=>Promise.resolve(e.data),json:()=>Promise.resolve(e.data),text:()=>Promise.resolve(e.data)};n(t)},fail:e=>{r(Error(e.errMsg))}})})}e.preconnect=()=>{},globalThis!=`undefined`&&(globalThis.fetch=e)}else A=fetch;var j=A;export{T as EventTarget,k as MiniProgramFetch,E as MiniProgramWebSocket,r as TextDecoderPolyfill,n as TextEncoderPolyfill,m as URLPolyfill};
|
|
@@ -1,213 +1,205 @@
|
|
|
1
|
-
import { t as __commonJSMin } from "./chunk-N6xyN86N.js";
|
|
2
|
-
|
|
3
1
|
//#region jspolyfill/textcoder.js
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
break widenCheck;
|
|
2
|
+
let TextEncoderPolyfill;
|
|
3
|
+
let TextDecoderPolyfill;
|
|
4
|
+
if (Object.defineProperty(exports, "__esModule", { value: !0 }), "undefined" == typeof TextEncoder || "undefined" == typeof TextDecoder) {
|
|
5
|
+
var fromCharCode = String.fromCharCode;
|
|
6
|
+
var Object_prototype_toString = {}.toString;
|
|
7
|
+
var undefinedObjectString = Object_prototype_toString();
|
|
8
|
+
var NativeUint8Array = Uint8Array;
|
|
9
|
+
var patchedU8Array = NativeUint8Array || Array;
|
|
10
|
+
var nativeArrayBuffer = NativeUint8Array ? ArrayBuffer : patchedU8Array;
|
|
11
|
+
var arrayBuffer_isView = nativeArrayBuffer.isView || function(x) {
|
|
12
|
+
return x && "length" in x;
|
|
13
|
+
};
|
|
14
|
+
var arrayBufferString = Object_prototype_toString.call(nativeArrayBuffer.prototype);
|
|
15
|
+
var encoderRegexp = /[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g;
|
|
16
|
+
var tmpBufferU16 = new (NativeUint8Array ? Uint16Array : patchedU8Array)(32);
|
|
17
|
+
function encoderReplacer(nonAsciiChars) {}
|
|
18
|
+
class TextEncoderImpl {
|
|
19
|
+
encoding = "utf-8";
|
|
20
|
+
constructor() {}
|
|
21
|
+
encode(input) {
|
|
22
|
+
let inputStr = input === void 0 ? "" : "" + input;
|
|
23
|
+
let len = inputStr.length | 0;
|
|
24
|
+
let result = new patchedU8Array((len << 1) + 8 | 0), tmpResult;
|
|
25
|
+
let i = 0, pos = 0, point = 0, nextcode = 0;
|
|
26
|
+
let upgradededArraySize = !NativeUint8Array;
|
|
27
|
+
for (i = 0; i < len; i = i + 1 | 0, pos = pos + 1 | 0) {
|
|
28
|
+
point = inputStr.charCodeAt(i) | 0;
|
|
29
|
+
if (point <= 127) result[pos] = point;
|
|
30
|
+
else if (point <= 2047) {
|
|
31
|
+
result[pos] = 192 | point >> 6;
|
|
32
|
+
result[pos = pos + 1 | 0] = 128 | point & 63;
|
|
33
|
+
} else {
|
|
34
|
+
widenCheck: {
|
|
35
|
+
if (55296 <= point) {
|
|
36
|
+
if (point <= 56319) {
|
|
37
|
+
nextcode = inputStr.charCodeAt(i = i + 1 | 0) | 0;
|
|
38
|
+
if (56320 <= nextcode && nextcode <= 57343) {
|
|
39
|
+
point = (point << 10) + nextcode - 56613888 | 0;
|
|
40
|
+
if (point > 65535) {
|
|
41
|
+
result[pos] = 240 | point >> 18;
|
|
42
|
+
result[pos = pos + 1 | 0] = 128 | point >> 12 & 63;
|
|
43
|
+
result[pos = pos + 1 | 0] = 128 | point >> 6 & 63;
|
|
44
|
+
result[pos = pos + 1 | 0] = 128 | point & 63;
|
|
45
|
+
continue;
|
|
51
46
|
}
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
break widenCheck;
|
|
48
|
+
}
|
|
49
|
+
point = 65533;
|
|
50
|
+
} else if (point <= 57343) point = 65533;
|
|
51
|
+
}
|
|
52
|
+
if (!upgradededArraySize && i << 1 < pos && i << 1 < (pos - 7 | 0)) {
|
|
53
|
+
upgradededArraySize = true;
|
|
54
|
+
tmpResult = new patchedU8Array(len * 3);
|
|
55
|
+
tmpResult.set(result);
|
|
56
|
+
result = tmpResult;
|
|
61
57
|
}
|
|
62
|
-
result[pos] = 224 | point >> 12;
|
|
63
|
-
result[pos = pos + 1 | 0] = 128 | point >> 6 & 63;
|
|
64
|
-
result[pos = pos + 1 | 0] = 128 | point & 63;
|
|
65
58
|
}
|
|
59
|
+
result[pos] = 224 | point >> 12;
|
|
60
|
+
result[pos = pos + 1 | 0] = 128 | point >> 6 & 63;
|
|
61
|
+
result[pos = pos + 1 | 0] = 128 | point & 63;
|
|
66
62
|
}
|
|
67
|
-
return NativeUint8Array ? result.subarray(0, pos) : result.slice(0, pos);
|
|
68
63
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
read = read + 1 | 0;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
default: break putChars;
|
|
64
|
+
return NativeUint8Array ? result.subarray(0, pos) : result.slice(0, pos);
|
|
65
|
+
}
|
|
66
|
+
encodeInto(input, u8Arr) {
|
|
67
|
+
var encodedString = input === void 0 ? "" : ("" + input).replace(encoderRegexp, encoderReplacer);
|
|
68
|
+
var len = encodedString.length | 0, i = 0, char = 0, read = 0, u8ArrLen = u8Arr.length | 0, inputLength = input.length | 0;
|
|
69
|
+
if (u8ArrLen < len) len = u8ArrLen;
|
|
70
|
+
putChars: for (; i < len; i = i + 1 | 0) {
|
|
71
|
+
char = encodedString.charCodeAt(i) | 0;
|
|
72
|
+
switch (char >> 4) {
|
|
73
|
+
case 0:
|
|
74
|
+
case 1:
|
|
75
|
+
case 2:
|
|
76
|
+
case 3:
|
|
77
|
+
case 4:
|
|
78
|
+
case 5:
|
|
79
|
+
case 6:
|
|
80
|
+
case 7: read = read + 1 | 0;
|
|
81
|
+
case 8:
|
|
82
|
+
case 9:
|
|
83
|
+
case 10:
|
|
84
|
+
case 11: break;
|
|
85
|
+
case 12:
|
|
86
|
+
case 13: if ((i + 1 | 0) < u8ArrLen) {
|
|
87
|
+
read = read + 1 | 0;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
case 14: if ((i + 2 | 0) < u8ArrLen) {
|
|
91
|
+
read = read + 1 | 0;
|
|
92
|
+
break;
|
|
102
93
|
}
|
|
103
|
-
|
|
94
|
+
case 15: if ((i + 3 | 0) < u8ArrLen) {
|
|
95
|
+
read = read + 1 | 0;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
default: break putChars;
|
|
104
99
|
}
|
|
105
|
-
|
|
106
|
-
written: i,
|
|
107
|
-
read: inputLength < read ? inputLength : read
|
|
108
|
-
};
|
|
100
|
+
u8Arr[i] = char;
|
|
109
101
|
}
|
|
102
|
+
return {
|
|
103
|
+
written: i,
|
|
104
|
+
read: inputLength < read ? inputLength : read
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
class TextDecoderImpl {
|
|
109
|
+
constructor() {
|
|
110
|
+
this.encoding = "utf-8";
|
|
111
|
+
this.fatal = false;
|
|
112
|
+
this.ignoreBOM = false;
|
|
110
113
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
decode(inputArrayOrBuffer) {
|
|
115
|
+
var inputAs8 = inputArrayOrBuffer, asObjectString;
|
|
116
|
+
if (!arrayBuffer_isView(inputAs8)) {
|
|
117
|
+
asObjectString = Object_prototype_toString.call(inputAs8);
|
|
118
|
+
if (asObjectString !== arrayBufferString && asObjectString !== undefinedObjectString) throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");
|
|
119
|
+
inputAs8 = NativeUint8Array ? new patchedU8Array(inputAs8) : inputAs8 || [];
|
|
116
120
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
default:
|
|
176
|
-
tmpBufferU16[pos] = cp0;
|
|
177
|
-
continue;
|
|
178
|
-
case 11:
|
|
179
|
-
case 10:
|
|
180
|
-
case 9:
|
|
181
|
-
case 8:
|
|
182
|
-
}
|
|
183
|
-
tmpBufferU16[pos] = 65533;
|
|
121
|
+
var resultingString = "", tmpStr = "", index = 0, len = inputAs8.length | 0, lenMinus32 = len - 32 | 0, nextEnd = 0, cp0 = 0, codePoint = 0, minBits = 0, cp1 = 0, pos = 0, tmp = -1;
|
|
122
|
+
for (; index < len;) {
|
|
123
|
+
nextEnd = index <= lenMinus32 ? 32 : len - index | 0;
|
|
124
|
+
for (; pos < nextEnd; index = index + 1 | 0, pos = pos + 1 | 0) {
|
|
125
|
+
cp0 = inputAs8[index] & 255;
|
|
126
|
+
switch (cp0 >> 4) {
|
|
127
|
+
case 15:
|
|
128
|
+
cp1 = inputAs8[index = index + 1 | 0] & 255;
|
|
129
|
+
if (cp1 >> 6 !== 2 || 247 < cp0) {
|
|
130
|
+
index = index - 1 | 0;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
codePoint = (cp0 & 7) << 6 | cp1 & 63;
|
|
134
|
+
minBits = 5;
|
|
135
|
+
cp0 = 256;
|
|
136
|
+
case 14:
|
|
137
|
+
cp1 = inputAs8[index = index + 1 | 0] & 255;
|
|
138
|
+
codePoint <<= 6;
|
|
139
|
+
codePoint |= (cp0 & 15) << 6 | cp1 & 63;
|
|
140
|
+
minBits = cp1 >> 6 === 2 ? minBits + 4 | 0 : 24;
|
|
141
|
+
cp0 = cp0 + 256 & 768;
|
|
142
|
+
case 13:
|
|
143
|
+
case 12:
|
|
144
|
+
cp1 = inputAs8[index = index + 1 | 0] & 255;
|
|
145
|
+
codePoint <<= 6;
|
|
146
|
+
codePoint |= (cp0 & 31) << 6 | cp1 & 63;
|
|
147
|
+
minBits = minBits + 7 | 0;
|
|
148
|
+
if (index < len && cp1 >> 6 === 2 && codePoint >> minBits && codePoint < 1114112) {
|
|
149
|
+
cp0 = codePoint;
|
|
150
|
+
codePoint = codePoint - 65536 | 0;
|
|
151
|
+
if (0 <= codePoint) {
|
|
152
|
+
tmp = (codePoint >> 10) + 55296 | 0;
|
|
153
|
+
cp0 = (codePoint & 1023) + 56320 | 0;
|
|
154
|
+
if (pos < 31) {
|
|
155
|
+
tmpBufferU16[pos] = tmp;
|
|
156
|
+
pos = pos + 1 | 0;
|
|
157
|
+
tmp = -1;
|
|
158
|
+
} else {
|
|
159
|
+
cp1 = tmp;
|
|
160
|
+
tmp = cp0;
|
|
161
|
+
cp0 = cp1;
|
|
162
|
+
}
|
|
163
|
+
} else nextEnd = nextEnd + 1 | 0;
|
|
164
|
+
} else {
|
|
165
|
+
cp0 >>= 8;
|
|
166
|
+
index = index - cp0 - 1 | 0;
|
|
167
|
+
cp0 = 65533;
|
|
168
|
+
}
|
|
169
|
+
minBits = 0;
|
|
170
|
+
codePoint = 0;
|
|
171
|
+
nextEnd = index <= lenMinus32 ? 32 : len - index | 0;
|
|
172
|
+
default:
|
|
173
|
+
tmpBufferU16[pos] = cp0;
|
|
174
|
+
continue;
|
|
175
|
+
case 11:
|
|
176
|
+
case 10:
|
|
177
|
+
case 9:
|
|
178
|
+
case 8:
|
|
184
179
|
}
|
|
185
|
-
|
|
186
|
-
if (pos < 32) tmpStr = tmpStr.slice(0, pos - 32 | 0);
|
|
187
|
-
if (index < len) {
|
|
188
|
-
tmpBufferU16[0] = tmp;
|
|
189
|
-
pos = ~tmp >>> 31;
|
|
190
|
-
tmp = -1;
|
|
191
|
-
if (tmpStr.length < resultingString.length) continue;
|
|
192
|
-
} else if (tmp !== -1) tmpStr += fromCharCode(tmp);
|
|
193
|
-
resultingString += tmpStr;
|
|
194
|
-
tmpStr = "";
|
|
180
|
+
tmpBufferU16[pos] = 65533;
|
|
195
181
|
}
|
|
196
|
-
|
|
182
|
+
tmpStr += fromCharCode(tmpBufferU16[0], tmpBufferU16[1], tmpBufferU16[2], tmpBufferU16[3], tmpBufferU16[4], tmpBufferU16[5], tmpBufferU16[6], tmpBufferU16[7], tmpBufferU16[8], tmpBufferU16[9], tmpBufferU16[10], tmpBufferU16[11], tmpBufferU16[12], tmpBufferU16[13], tmpBufferU16[14], tmpBufferU16[15], tmpBufferU16[16], tmpBufferU16[17], tmpBufferU16[18], tmpBufferU16[19], tmpBufferU16[20], tmpBufferU16[21], tmpBufferU16[22], tmpBufferU16[23], tmpBufferU16[24], tmpBufferU16[25], tmpBufferU16[26], tmpBufferU16[27], tmpBufferU16[28], tmpBufferU16[29], tmpBufferU16[30], tmpBufferU16[31]);
|
|
183
|
+
if (pos < 32) tmpStr = tmpStr.slice(0, pos - 32 | 0);
|
|
184
|
+
if (index < len) {
|
|
185
|
+
tmpBufferU16[0] = tmp;
|
|
186
|
+
pos = ~tmp >>> 31;
|
|
187
|
+
tmp = -1;
|
|
188
|
+
if (tmpStr.length < resultingString.length) continue;
|
|
189
|
+
} else if (tmp !== -1) tmpStr += fromCharCode(tmp);
|
|
190
|
+
resultingString += tmpStr;
|
|
191
|
+
tmpStr = "";
|
|
197
192
|
}
|
|
193
|
+
return resultingString;
|
|
198
194
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
TextEncoderPolyfill,
|
|
208
|
-
TextDecoderPolyfill
|
|
209
|
-
}, module.exports = exports.default;
|
|
210
|
-
}));
|
|
195
|
+
}
|
|
196
|
+
TextEncoderPolyfill = TextEncoderImpl;
|
|
197
|
+
TextDecoderPolyfill = TextDecoderImpl;
|
|
198
|
+
if ("undefined" != globalThis) {
|
|
199
|
+
globalThis.TextDecoder = TextDecoderPolyfill;
|
|
200
|
+
globalThis.TextEncoder = TextEncoderPolyfill;
|
|
201
|
+
}
|
|
202
|
+
} else TextDecoderPolyfill = TextDecoder, TextEncoderPolyfill = TextEncoder;
|
|
211
203
|
|
|
212
204
|
//#endregion
|
|
213
|
-
export
|
|
205
|
+
export { TextDecoderPolyfill, TextEncoderPolyfill };
|