diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 04fdf03e..f1475e42 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -582,7 +582,7 @@ jobs: with: node-version: latest - name: Setup wasm-pack - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + run: cargo install wasm-pack - name: Build wasm working-directory: bindings/wasm run: | diff --git a/bindings/wasm/bin/decancer.min.js b/bindings/wasm/bin/decancer.min.js index dce5c27f..3ab0d660 100644 --- a/bindings/wasm/bin/decancer.min.js +++ b/bindings/wasm/bin/decancer.min.js @@ -1 +1 @@ -let wasm,output;const cachedTextDecoder="undefined"!=typeof TextDecoder?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};"undefined"!=typeof TextDecoder&&cachedTextDecoder.decode();let cachedUint8Memory0=null;function getUint8Memory0(){return null!==cachedUint8Memory0&&0!==cachedUint8Memory0.byteLength||(cachedUint8Memory0=new Uint8Array(wasm.memory.buffer)),cachedUint8Memory0}function getStringFromWasm0(e,t){return e>>>=0,cachedTextDecoder.decode(getUint8Memory0().subarray(e,e+t))}const heap=new Array(128).fill(void 0);heap.push(void 0,null,!0,!1);let heap_next=heap.length;function addHeapObject(e){heap_next===heap.length&&heap.push(heap.length+1);const t=heap_next;return heap_next=heap[t],heap[t]=e,t}let WASM_VECTOR_LEN=0;const cachedTextEncoder="undefined"!=typeof TextEncoder?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},encodeString="function"==typeof cachedTextEncoder.encodeInto?function(e,t){return cachedTextEncoder.encodeInto(e,t)}:function(e,t){const n=cachedTextEncoder.encode(e);return t.set(n),{read:e.length,written:n.length}};function passStringToWasm0(e,t,n){if(void 0===n){const n=cachedTextEncoder.encode(e),r=t(n.length,1)>>>0;return getUint8Memory0().subarray(r,r+n.length).set(n),WASM_VECTOR_LEN=n.length,r}let r=e.length,a=t(r,1)>>>0;const _=getUint8Memory0();let i=0;for(;i127)break;_[a+i]=t}if(i!==r){0!==i&&(e=e.slice(i)),a=n(a,r,r=i+3*e.length,1)>>>0;const t=getUint8Memory0().subarray(a+i,a+r);i+=encodeString(e,t).written}return WASM_VECTOR_LEN=i,a}let cachedInt32Memory0=null;function getInt32Memory0(){return null!==cachedInt32Memory0&&0!==cachedInt32Memory0.byteLength||(cachedInt32Memory0=new Int32Array(wasm.memory.buffer)),cachedInt32Memory0}let cachedUint32Memory0=null;function getUint32Memory0(){return null!==cachedUint32Memory0&&0!==cachedUint32Memory0.byteLength||(cachedUint32Memory0=new Uint32Array(wasm.memory.buffer)),cachedUint32Memory0}function dropObject(e){e<132||(heap[e]=heap_next,heap_next=e)}function takeObject(e){const t=heap[e];return dropObject(e),t}function getArrayJsValueFromWasm0(e,t){e>>>=0;const n=getUint32Memory0().subarray(e/4,e/4+t),r=[];for(let e=0;e>>0,r=getUint32Memory0();for(let t=0;t=1114112||e>=55296&&e<57344))throw new Error(`expected a valid Unicode scalar value, found ${e}`)}const OPTIONS={k:["retainCapitalization","disableBidi","retainDiacritics","retainGreek","retainCyrillic","retainHebrew","retainArabic","retainDevanagari","retainBengali","retainArmenian","retainGujarati","retainTamil","retainThai","retainLao","retainBurmese","retainKhmer","retainMongolian","retainChinese","retainJapanese","retainKorean","retainBraille","retainEmojis","retainTurkish","asciiOnly","alphanumericOnly"],o:{all:33554431,pureHomoglyph:4194300}};function options(e){e||(e={});let t=0;for(let n=0;n{},unregister:()=>{}}:new FinalizationRegistry((e=>wasm.__wbg_curedstring_free(e>>>0)));export class CuredString{static __wrap(e){e>>>=0;const t=Object.create(CuredString.prototype);return t.__wbg_ptr=e,CuredStringFinalization.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,CuredStringFinalization.unregister(this),e}free(){const e=this.__destroy_into_raw();wasm.__wbg_curedstring_free(e)}find(e){try{const a=wasm.__wbindgen_add_to_stack_pointer(-16),_=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),i=WASM_VECTOR_LEN;wasm.curedstring_find(a,this.__wbg_ptr,_,i);var t=getInt32Memory0()[a/4+0],n=getInt32Memory0()[a/4+1],r=getArrayJsValueFromWasm0(t,n).slice();return wasm.__wbindgen_free(t,4*n,4),r}finally{wasm.__wbindgen_add_to_stack_pointer(16)}}findMultiple(e){try{const a=wasm.__wbindgen_add_to_stack_pointer(-16),_=passArrayJsValueToWasm0(e,wasm.__wbindgen_malloc),i=WASM_VECTOR_LEN;wasm.curedstring_findMultiple(a,this.__wbg_ptr,_,i);var t=getInt32Memory0()[a/4+0],n=getInt32Memory0()[a/4+1],r=getArrayJsValueFromWasm0(t,n).slice();return wasm.__wbindgen_free(t,4*n,4),r}finally{wasm.__wbindgen_add_to_stack_pointer(16)}}censor(e,t){const n=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),r=WASM_VECTOR_LEN,a=t.codePointAt(0);_assertChar(a),wasm.curedstring_censor(this.__wbg_ptr,n,r,a)}censorMultiple(e,t){const n=passArrayJsValueToWasm0(e,wasm.__wbindgen_malloc),r=WASM_VECTOR_LEN,a=t.codePointAt(0);_assertChar(a),wasm.curedstring_censorMultiple(this.__wbg_ptr,n,r,a)}replace(e,t){const n=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),r=WASM_VECTOR_LEN,a=passStringToWasm0(t,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),_=WASM_VECTOR_LEN;wasm.curedstring_replace(this.__wbg_ptr,n,r,a,_)}replaceMultiple(e,t){const n=passArrayJsValueToWasm0(e,wasm.__wbindgen_malloc),r=WASM_VECTOR_LEN,a=passStringToWasm0(t,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),_=WASM_VECTOR_LEN;wasm.curedstring_replaceMultiple(this.__wbg_ptr,n,r,a,_)}startsWith(e){const t=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),n=WASM_VECTOR_LEN;return 0!==wasm.curedstring_startsWith(this.__wbg_ptr,t,n)}endsWith(e){const t=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),n=WASM_VECTOR_LEN;return 0!==wasm.curedstring_endsWith(this.__wbg_ptr,t,n)}contains(e){const t=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),n=WASM_VECTOR_LEN;return 0!==wasm.curedstring_contains(this.__wbg_ptr,t,n)}equals(e){const t=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),n=WASM_VECTOR_LEN;return 0!==wasm.curedstring_equals(this.__wbg_ptr,t,n)}toString(){let e,t;try{const a=wasm.__wbindgen_add_to_stack_pointer(-16);wasm.curedstring_toString(a,this.__wbg_ptr);var n=getInt32Memory0()[a/4+0],r=getInt32Memory0()[a/4+1];return e=n,t=r,getStringFromWasm0(n,r)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_free(e,t,1)}}}const MatchFinalization="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((e=>wasm.__wbg_match_free(e>>>0)));export class Match{static __wrap(e){e>>>=0;const t=Object.create(Match.prototype);return t.__wbg_ptr=e,MatchFinalization.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,MatchFinalization.unregister(this),e}free(){const e=this.__destroy_into_raw();wasm.__wbg_match_free(e)}get start(){return wasm.__wbg_get_match_start(this.__wbg_ptr)>>>0}get end(){return wasm.__wbg_get_match_end(this.__wbg_ptr)>>>0}toString(){let e,t;try{const a=wasm.__wbindgen_add_to_stack_pointer(-16);wasm.match_toString(a,this.__wbg_ptr);var n=getInt32Memory0()[a/4+0],r=getInt32Memory0()[a/4+1];return e=n,t=r,getStringFromWasm0(n,r)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_free(e,t,1)}}}async function __wbg_load(e,t){if("function"==typeof Response&&e instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if("application/wasm"==e.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function __wbg_get_imports(){return{wbg:{__wbindgen_error_new:function(e,t){return addHeapObject(new Error(getStringFromWasm0(e,t)))},__wbindgen_throw:function(e,t){throw new Error(getStringFromWasm0(e,t))},__wbg_match_new:function(e){return addHeapObject(Match.__wrap(e))},__wbindgen_string_get:function(e,t){const n=heap[t],r="string"==typeof n?n:void 0;var a=null==r?0:passStringToWasm0(r,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),_=WASM_VECTOR_LEN;getInt32Memory0()[e/4+1]=_,getInt32Memory0()[e/4+0]=a},__wbindgen_object_drop_ref:function(e){takeObject(e)}}}}function __wbg_finalize_init(e,t){return wasm=e.exports,cachedInt32Memory0=null,cachedUint32Memory0=null,cachedUint8Memory0=null,output=Object.assign(cure,{options}),output}export default async function init({local:e}={}){if(void 0!==wasm)return output;const t=__wbg_get_imports(),n=fetch(e?new URL("decancer.wasm",import.meta.url):"https://cdn.jsdelivr.net/gh/null8626/decancer@v3.2.4/bindings/wasm/bin/decancer.wasm"),{instance:r,module:a}=await __wbg_load(await n,t);return __wbg_finalize_init(r,a)} \ No newline at end of file +let wasm,output;const cachedTextDecoder="undefined"!=typeof TextDecoder?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};"undefined"!=typeof TextDecoder&&cachedTextDecoder.decode();let cachedUint8ArrayMemory0=null;function getUint8ArrayMemory0(){return null!==cachedUint8ArrayMemory0&&0!==cachedUint8ArrayMemory0.byteLength||(cachedUint8ArrayMemory0=new Uint8Array(wasm.memory.buffer)),cachedUint8ArrayMemory0}function getStringFromWasm0(e,t){return e>>>=0,cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(e,e+t))}let WASM_VECTOR_LEN=0;const cachedTextEncoder="undefined"!=typeof TextEncoder?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},encodeString="function"==typeof cachedTextEncoder.encodeInto?function(e,t){return cachedTextEncoder.encodeInto(e,t)}:function(e,t){const n=cachedTextEncoder.encode(e);return t.set(n),{read:e.length,written:n.length}};function passStringToWasm0(e,t,n){if(void 0===n){const n=cachedTextEncoder.encode(e),r=t(n.length,1)>>>0;return getUint8ArrayMemory0().subarray(r,r+n.length).set(n),WASM_VECTOR_LEN=n.length,r}let r=e.length,a=t(r,1)>>>0;const i=getUint8ArrayMemory0();let _=0;for(;_127)break;i[a+_]=t}if(_!==r){0!==_&&(e=e.slice(_)),a=n(a,r,r=_+3*e.length,1)>>>0;const t=getUint8ArrayMemory0().subarray(a+_,a+r);_+=encodeString(e,t).written,a=n(a,r,_,1)>>>0}return WASM_VECTOR_LEN=_,a}let cachedDataViewMemory0=null;function getDataViewMemory0(){return(null===cachedDataViewMemory0||!0===cachedDataViewMemory0.buffer.detached||void 0===cachedDataViewMemory0.buffer.detached&&cachedDataViewMemory0.buffer!==wasm.memory.buffer)&&(cachedDataViewMemory0=new DataView(wasm.memory.buffer)),cachedDataViewMemory0}function getArrayJsValueFromWasm0(e,t){e>>>=0;const n=getDataViewMemory0(),r=[];for(let a=e;a>>0,r=getDataViewMemory0();for(let t=0;t=1114112||e>=55296&&e<57344))throw new Error(`expected a valid Unicode scalar value, found ${e}`)}function takeFromExternrefTable0(e){const t=wasm.__wbindgen_export_2.get(e);return wasm.__externref_table_dealloc(e),t}const OPTIONS={k:["retainCapitalization","disableBidi","retainDiacritics","retainGreek","retainCyrillic","retainHebrew","retainArabic","retainDevanagari","retainBengali","retainArmenian","retainGujarati","retainTamil","retainThai","retainLao","retainBurmese","retainKhmer","retainMongolian","retainChinese","retainJapanese","retainKorean","retainBraille","retainEmojis","retainTurkish","asciiOnly","alphanumericOnly"],o:{all:33554431,pureHomoglyph:4194300}};function options(e){e||(e={});let t=0;for(let n=0;n{},unregister:()=>{}}:new FinalizationRegistry((e=>wasm.__wbg_curedstring_free(e>>>0,1)));export class CuredString{static __wrap(e){e>>>=0;const t=Object.create(CuredString.prototype);return t.__wbg_ptr=e,CuredStringFinalization.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,CuredStringFinalization.unregister(this),e}free(){const e=this.__destroy_into_raw();wasm.__wbg_curedstring_free(e,0)}find(e){const t=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),n=WASM_VECTOR_LEN,r=wasm.curedstring_find(this.__wbg_ptr,t,n);var a=getArrayJsValueFromWasm0(r[0],r[1]).slice();return wasm.__wbindgen_free(r[0],4*r[1],4),a}findMultiple(e){const t=passArrayJsValueToWasm0(e,wasm.__wbindgen_malloc),n=WASM_VECTOR_LEN,r=wasm.curedstring_findMultiple(this.__wbg_ptr,t,n);var a=getArrayJsValueFromWasm0(r[0],r[1]).slice();return wasm.__wbindgen_free(r[0],4*r[1],4),a}censor(e,t){const n=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),r=WASM_VECTOR_LEN,a=t.codePointAt(0);_assertChar(a),wasm.curedstring_censor(this.__wbg_ptr,n,r,a)}censorMultiple(e,t){const n=passArrayJsValueToWasm0(e,wasm.__wbindgen_malloc),r=WASM_VECTOR_LEN,a=t.codePointAt(0);_assertChar(a),wasm.curedstring_censorMultiple(this.__wbg_ptr,n,r,a)}replace(e,t){const n=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),r=WASM_VECTOR_LEN,a=passStringToWasm0(t,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),i=WASM_VECTOR_LEN;wasm.curedstring_replace(this.__wbg_ptr,n,r,a,i)}replaceMultiple(e,t){const n=passArrayJsValueToWasm0(e,wasm.__wbindgen_malloc),r=WASM_VECTOR_LEN,a=passStringToWasm0(t,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),i=WASM_VECTOR_LEN;wasm.curedstring_replaceMultiple(this.__wbg_ptr,n,r,a,i)}startsWith(e){const t=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),n=WASM_VECTOR_LEN;return 0!==wasm.curedstring_startsWith(this.__wbg_ptr,t,n)}endsWith(e){const t=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),n=WASM_VECTOR_LEN;return 0!==wasm.curedstring_endsWith(this.__wbg_ptr,t,n)}contains(e){const t=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),n=WASM_VECTOR_LEN;return 0!==wasm.curedstring_contains(this.__wbg_ptr,t,n)}equals(e){const t=passStringToWasm0(e,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),n=WASM_VECTOR_LEN;return 0!==wasm.curedstring_equals(this.__wbg_ptr,t,n)}toString(){let e,t;try{const n=wasm.curedstring_toString(this.__wbg_ptr);return e=n[0],t=n[1],getStringFromWasm0(n[0],n[1])}finally{wasm.__wbindgen_free(e,t,1)}}}const MatchFinalization="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((e=>wasm.__wbg_match_free(e>>>0,1)));export class Match{static __wrap(e){e>>>=0;const t=Object.create(Match.prototype);return t.__wbg_ptr=e,MatchFinalization.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,MatchFinalization.unregister(this),e}free(){const e=this.__destroy_into_raw();wasm.__wbg_match_free(e,0)}get start(){return wasm.__wbg_get_match_start(this.__wbg_ptr)>>>0}set start(e){wasm.__wbg_set_match_start(this.__wbg_ptr,e)}get end(){return wasm.__wbg_get_match_end(this.__wbg_ptr)>>>0}set end(e){wasm.__wbg_set_match_end(this.__wbg_ptr,e)}toString(){let e,t;try{const n=wasm.match_toString(this.__wbg_ptr);return e=n[0],t=n[1],getStringFromWasm0(n[0],n[1])}finally{wasm.__wbindgen_free(e,t,1)}}}async function __wbg_load(e,t){if("function"==typeof Response&&e instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if("application/wasm"==e.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function __wbg_get_imports(){const e={wbg:{}};return e.wbg.__wbg_match_new=function(e){return Match.__wrap(e)},e.wbg.__wbindgen_error_new=function(e,t){return new Error(getStringFromWasm0(e,t))},e.wbg.__wbg_new_abda76e883ba8a5f=function(){return new Error},e.wbg.__wbg_stack_658279fe44541cf6=function(e,t){const n=passStringToWasm0(t.stack,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),r=WASM_VECTOR_LEN;getDataViewMemory0().setInt32(e+4,r,!0),getDataViewMemory0().setInt32(e+0,n,!0)},e.wbg.__wbg_error_f851667af71bcfc6=function(e,t){let n,r;try{n=e,r=t,console.error(getStringFromWasm0(e,t))}finally{wasm.__wbindgen_free(n,r,1)}},e.wbg.__wbindgen_string_get=function(e,t){const n="string"==typeof t?t:void 0;var r=null==n?0:passStringToWasm0(n,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),a=WASM_VECTOR_LEN;getDataViewMemory0().setInt32(e+4,a,!0),getDataViewMemory0().setInt32(e+0,r,!0)},e.wbg.__wbindgen_throw=function(e,t){throw new Error(getStringFromWasm0(e,t))},e.wbg.__wbindgen_init_externref_table=function(){const e=wasm.__wbindgen_export_2,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)},e}export default async function init({local:e}={}){if(void 0!==wasm)return output;const{instance:t,module:n}=await __wbg_load(await fetch(e?new URL("decancer.wasm",import.meta.url):"https://cdn.jsdelivr.net/gh/null8626/decancer@v3.2.4/bindings/wasm/bin/decancer.wasm"),__wbg_get_imports());return wasm=t.exports,cachedDataViewMemory0=null,cachedUint8ArrayMemory0=null,output=Object.assign(cure,{options:options}),wasm.__wbindgen_start(),output} \ No newline at end of file diff --git a/bindings/wasm/bin/decancer.wasm b/bindings/wasm/bin/decancer.wasm index 1037c28d..e8b792c5 100644 Binary files a/bindings/wasm/bin/decancer.wasm and b/bindings/wasm/bin/decancer.wasm differ