halife 0.1.6 → 0.1.7

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.
@@ -1 +1 @@
1
- var e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),t=e(((e,t)=>{let n;if(Object.defineProperty(e,`__esModule`,{value:!0}),typeof TextEncoder<`u`&&TextEncoder.prototype.encodeInto)n=TextEncoder;else{let e=String.fromCharCode,t=function(t){let n=0|t.charCodeAt(0);if(55296<=n)if(n<56320){let r=0|t.charCodeAt(1);if(56320<=r&&r<=57343){if(n=(n<<10)+r-56613888|0,n>65535)return e(240|n>>>18,128|n>>>12&63,128|n>>>6&63,128|63&n)}else n=65533}else n<=57343&&(n=65533);return n<=2047?e(192|n>>>6,128|63&n):e(224|n>>>12,128|n>>>6&63,128|63&n)},r=function(e){return e===void 0?``:(``+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,t)};class i{constructor(){this.encoding=`utf-8`}encode(e){let t=r(e),n=0|t.length,i=new Uint8Array(n),a=0;for(;a<n;a=a+1|0)i[a]=0|t.charCodeAt(a);return i}encodeInto(e,t){let n=r(e),i=0|t.length,a=0|e.length,o=0|n.length,s=0,c=0,l=0;i<o&&(o=i);e:for(;s<o;s=s+1|0){switch(c=0|n.charCodeAt(s),c>>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l=l+1|0;case 8:case 9:case 10:case 11:break;case 12:case 13:if((s+1|0)<i){l=l+1|0;break}case 14:if((s+2|0)<i){l=l+1|0;break}case 15:if((s+3|0)<i){l=l+1|0;break}default:break e}t[s]=c}return{written:s,read:a<l?a:l}}toString(){return`[object TextEncoder]`}}if(typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(i.prototype,Symbol.toStringTag,{value:`TextEncoder`}),typeof TextEncoder>`u`&&(n=i),!n.prototype.encodeInto){let e=new TextEncoder;TextEncoder.prototype.encodeInto=function(t,n){let r=0|t.length,a=0|n.length;if(r<(3+(a>>1)|0)){let i=e.encode(t);if((0|i.length)<a)return n.set(i),{read:r,written:0|i.length}}return i.prototype.encodeInto(t,n)}}}e.default=n,t.exports=e.default})),n=e(((e,t)=>{let n;if(Object.defineProperty(e,`__esModule`,{value:!0}),typeof TextDecoder>`u`){let e=String.fromCharCode,t=Object.prototype.toString,r=t.call(ArrayBuffer.prototype),i=typeof SharedArrayBuffer<`u`?t.call(SharedArrayBuffer):``,a=function(t){let n=t.charCodeAt(0),r=0|t.length,i=1114112,a=0,o=``;switch(n>>>4){case 12:case 13:i=(31&n)<<6|63&t.charCodeAt(1),a=i<128?0:2;break;case 14:i=(15&n)<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2),a=i<2048?0:3;break;case 15:n>>>3==30&&(i=(7&n)<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|t.charCodeAt(3),a=i<65536?0:4)}for(a&&(r<a?a=0:i<65536?o=e(i):i<1114112?(i=i-65664|0,o=e(55296+(i>>>10)|0,56320+(1023&i)|0)):a=0);a<r;a=a+1|0)o+=` `;return o},o=[`utf-8`,`utf8`,`unicode-1-1-utf-8`];class s{constructor(e,t){if(this.encoding=`utf-8`,this.fatal=!1,this.ignoreBOM=!1,e&&o.indexOf(e.toLowerCase())===-1)throw RangeError(`Failed to construct 'TextDecoder': The encoding label provided ('${e}') is invalid.`);if(t){if(t.fatal)throw Error(`Failed to construct 'TextDecoder': the 'fatal' option is unsupported.`);if(t.ignoreBOM)throw Error(`Failed to construct 'TextDecoder': the 'ignoreBOM' option is unsupported.`)}}decode(n,o){if(o&&o.stream)throw Error(`Failed to decode: the 'stream' option is unsupported.`);let s=n&&n.buffer||n,c=t.call(s);if(c!==r&&c!==i&&n!==void 0)throw TypeError(`Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'`);let l=new Uint8Array(s),u=``;for(let t=0,n=0|l.length;t<n;t=t+32768|0)u+=e.apply(0,l.subarray(t,t+32768|0));return u.replace(/[\xc0-\xff][\x80-\xbf]+|[\x80-\xff]/g,a)}toString(){return`[object TextDecoder]`}}typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(s.prototype,Symbol.toStringTag,{value:`TextDecoder`}),n=s}else n=TextDecoder;e.default=n,t.exports=e.default})),r=e(((e,t)=>{let n;if(Object.defineProperty(e,`__esModule`,{value:!0}),typeof EventTarget>`u`){class e{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}}typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e.prototype,Symbol.toStringTag,{value:`EventTarget`}),n=e}else n=EventTarget;e.default={EventTargetPolyfill:n},t.exports=e.default}));e(((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=()=>{},typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(S.prototype,Symbol.toStringTag,{value:`URL`}),n=S}else n=URL;e.default=n,t.exports=e.default}))(),n(),t();var i=r();(class e extends i.EventTarget{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(){}});function a(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))}})})}a.preconnect=()=>{};
1
+ var e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),t=e(((e,t)=>{let n;if(Object.defineProperty(e,`__esModule`,{value:!0}),typeof TextEncoder<`u`&&TextEncoder.prototype.encodeInto)n=TextEncoder;else{let e=String.fromCharCode,t=function(t){let n=0|t.charCodeAt(0);if(55296<=n)if(n<56320){let r=0|t.charCodeAt(1);if(56320<=r&&r<=57343){if(n=(n<<10)+r-56613888|0,n>65535)return e(240|n>>>18,128|n>>>12&63,128|n>>>6&63,128|63&n)}else n=65533}else n<=57343&&(n=65533);return n<=2047?e(192|n>>>6,128|63&n):e(224|n>>>12,128|n>>>6&63,128|63&n)},r=function(e){return e===void 0?``:(``+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,t)};class i{constructor(){this.encoding=`utf-8`}encode(e){let t=r(e),n=0|t.length,i=new Uint8Array(n),a=0;for(;a<n;a=a+1|0)i[a]=0|t.charCodeAt(a);return i}encodeInto(e,t){let n=r(e),i=0|t.length,a=0|e.length,o=0|n.length,s=0,c=0,l=0;i<o&&(o=i);e:for(;s<o;s=s+1|0){switch(c=0|n.charCodeAt(s),c>>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l=l+1|0;case 8:case 9:case 10:case 11:break;case 12:case 13:if((s+1|0)<i){l=l+1|0;break}case 14:if((s+2|0)<i){l=l+1|0;break}case 15:if((s+3|0)<i){l=l+1|0;break}default:break e}t[s]=c}return{written:s,read:a<l?a:l}}toString(){return`[object TextEncoder]`}}if(typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(i.prototype,Symbol.toStringTag,{value:`TextEncoder`}),typeof TextEncoder>`u`&&(n=i),!n.prototype.encodeInto){let e=new TextEncoder;TextEncoder.prototype.encodeInto=function(t,n){let r=0|t.length,a=0|n.length;if(r<(3+(a>>1)|0)){let i=e.encode(t);if((0|i.length)<a)return n.set(i),{read:r,written:0|i.length}}return i.prototype.encodeInto(t,n)}}}e.default=n,t.exports=e.default})),n=e(((e,t)=>{let n;if(Object.defineProperty(e,`__esModule`,{value:!0}),typeof TextDecoder>`u`){let e=String.fromCharCode,t=Object.prototype.toString,r=t.call(ArrayBuffer.prototype),i=typeof SharedArrayBuffer<`u`?t.call(SharedArrayBuffer):``,a=function(t){let n=t.charCodeAt(0),r=0|t.length,i=1114112,a=0,o=``;switch(n>>>4){case 12:case 13:i=(31&n)<<6|63&t.charCodeAt(1),a=i<128?0:2;break;case 14:i=(15&n)<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2),a=i<2048?0:3;break;case 15:n>>>3==30&&(i=(7&n)<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|t.charCodeAt(3),a=i<65536?0:4)}for(a&&(r<a?a=0:i<65536?o=e(i):i<1114112?(i=i-65664|0,o=e(55296+(i>>>10)|0,56320+(1023&i)|0)):a=0);a<r;a=a+1|0)o+=` `;return o},o=[`utf-8`,`utf8`,`unicode-1-1-utf-8`];class s{constructor(e,t){if(this.encoding=`utf-8`,this.fatal=!1,this.ignoreBOM=!1,e&&o.indexOf(e.toLowerCase())===-1)throw RangeError(`Failed to construct 'TextDecoder': The encoding label provided ('${e}') is invalid.`);if(t){if(t.fatal)throw Error(`Failed to construct 'TextDecoder': the 'fatal' option is unsupported.`);if(t.ignoreBOM)throw Error(`Failed to construct 'TextDecoder': the 'ignoreBOM' option is unsupported.`)}}decode(n,o){if(o&&o.stream)throw Error(`Failed to decode: the 'stream' option is unsupported.`);let s=n&&n.buffer||n,c=t.call(s);if(c!==r&&c!==i&&n!==void 0)throw TypeError(`Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'`);let l=new Uint8Array(s),u=``;for(let t=0,n=0|l.length;t<n;t=t+32768|0)u+=e.apply(0,l.subarray(t,t+32768|0));return u.replace(/[\xc0-\xff][\x80-\xbf]+|[\x80-\xff]/g,a)}toString(){return`[object TextDecoder]`}}typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(s.prototype,Symbol.toStringTag,{value:`TextDecoder`}),n=s}else n=TextDecoder;e.default=n,t.exports=e.default})),r=e(((e,t)=>{let n;if(Object.defineProperty(e,`__esModule`,{value:!0}),typeof EventTarget>`u`){class e{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}}typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e.prototype,Symbol.toStringTag,{value:`EventTarget`}),n=e}else n=EventTarget;e.default={EventTargetPolyfill:n},t.exports=e.default}));e(((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=()=>{},typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(S.prototype,Symbol.toStringTag,{value:`URL`}),n=S}else n=URL;e.default=n,t.exports=e.default}))(),r(),n(),t(),class e extends EventTarget{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(){}};function i(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))}})})}i.preconnect=()=>{};
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "type": "git",
23
23
  "url": "https://codeberg.org/y0z0ng/halife.git"
24
24
  },
25
- "version": "0.1.6",
25
+ "version": "0.1.7",
26
26
  "workspaces": [
27
27
  "examples/*"
28
28
  ],