Created
April 15, 2025 05:39
-
-
Save wayou/3fa3b02a6ce554d545523467905afd75 to your computer and use it in GitHub Desktop.
autocorrect-esm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const A="https://huacnlee.github.io/autocorrect/assets/autocorrect_bg-46190a73.wasm",C=async(e={},n)=>{let o;if(n.startsWith("data:")){const _=n.replace(/^data:.*?base64,/,"");let r;if(typeof Buffer=="function"&&typeof Buffer.from=="function")r=Buffer.from(_,"base64");else if(typeof atob=="function"){const c=atob(_);r=new Uint8Array(c.length);for(let i=0;i<c.length;i++)r[i]=c.charCodeAt(i)}else throw new Error("Cannot decode base64-encoded data URL");o=await WebAssembly.instantiate(r,e)}else{const _=await fetch(n),r=_.headers.get("Content-Type")||"";if("instantiateStreaming"in WebAssembly&&r.startsWith("application/wasm"))o=await WebAssembly.instantiateStreaming(_,e);else{const c=await _.arrayBuffer();o=await WebAssembly.instantiate(c,e)}}return o.instance.exports};let t;function v(e){t=e}const E=typeof TextDecoder>"u"?(0,module.require)("util").TextDecoder:TextDecoder;let x=new E("utf-8",{ignoreBOM:!0,fatal:!0});x.decode();let b=null;function p(){return(b===null||b.byteLength===0)&&(b=new Uint8Array(t.memory.buffer)),b}function T(e,n){return e=e>>>0,x.decode(p().subarray(e,e+n))}const d=new Array(128).fill(void 0);d.push(void 0,null,!0,!1);let u=d.length;function F(e){u===d.length&&d.push(d.length+1);const n=u;return u=d[n],d[n]=e,n}let l=0;const I=typeof TextEncoder>"u"?(0,module.require)("util").TextEncoder:TextEncoder;let y=new I("utf-8");const S=typeof y.encodeInto=="function"?function(e,n){return y.encodeInto(e,n)}:function(e,n){const o=y.encode(e);return n.set(o),{read:e.length,written:o.length}};function f(e,n,o){if(o===void 0){const a=y.encode(e),g=n(a.length,1)>>>0;return p().subarray(g,g+a.length).set(a),l=a.length,g}let _=e.length,r=n(_,1)>>>0;const c=p();let i=0;for(;i<_;i++){const a=e.charCodeAt(i);if(a>127)break;c[r+i]=a}if(i!==_){i!==0&&(e=e.slice(i)),r=o(r,_,_=i+e.length*3,1)>>>0;const a=p().subarray(r+i,r+_),g=S(e,a);i+=g.written}return l=i,r}let m=null;function w(){return(m===null||m.byteLength===0)&&(m=new Int32Array(t.memory.buffer)),m}function W(e){return d[e]}function j(e){e<132||(d[e]=u,u=e)}function h(e){const n=W(e);return j(e),n}function G(e){try{const r=t.__wbindgen_add_to_stack_pointer(-16),c=f(e,t.__wbindgen_malloc,t.__wbindgen_realloc),i=l;t.loadConfig(r,c,i);var n=w()[r/4+0],o=w()[r/4+1],_=w()[r/4+2];if(_)throw h(o);return h(n)}finally{t.__wbindgen_add_to_stack_pointer(16)}}function K(e){let n,o;try{const c=t.__wbindgen_add_to_stack_pointer(-16),i=f(e,t.__wbindgen_malloc,t.__wbindgen_realloc),a=l;t.format(c,i,a);var _=w()[c/4+0],r=w()[c/4+1];return n=_,o=r,T(_,r)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_free(n,o,1)}}function Q(e,n){const o=f(e,t.__wbindgen_malloc,t.__wbindgen_realloc),_=l,r=f(n,t.__wbindgen_malloc,t.__wbindgen_realloc),c=l,i=t.formatFor(o,_,r,c);return h(i)}function X(e,n){const o=f(e,t.__wbindgen_malloc,t.__wbindgen_realloc),_=l,r=f(n,t.__wbindgen_malloc,t.__wbindgen_realloc),c=l,i=t.lintFor(o,_,r,c);return h(i)}class Y{__destroy_into_raw(){const n=this.__wbg_ptr;return this.__wbg_ptr=0,n}free(){const n=this.__destroy_into_raw();t.__wbg_ignorer_free(n)}constructor(n){const o=f(n,t.__wbindgen_malloc,t.__wbindgen_realloc),_=l,r=t.ignorer_new(o,_);return this.__wbg_ptr=r>>>0,this}isIgnored(n){const o=f(n,t.__wbindgen_malloc,t.__wbindgen_realloc),_=l;return t.ignorer_isIgnored(this.__wbg_ptr,o,_)!==0}}function O(e,n){const o=JSON.parse(T(e,n));return F(o)}function k(e,n){const o=new Error(T(e,n));return F(o)}function M(e,n){throw new Error(T(e,n))}URL=globalThis.URL;const s=await C({"./autocorrect_bg.js":{__wbindgen_json_parse:O,__wbindgen_error_new:k,__wbindgen_throw:M}},A),U=s.memory,L=s.__wbg_ignorer_free,B=s.ignorer_new,D=s.ignorer_isIgnored,$=s.loadConfig,R=s.format,q=s.formatFor,N=s.lintFor,z=s.__wbindgen_malloc,H=s.__wbindgen_realloc,J=s.__wbindgen_add_to_stack_pointer,P=s.__wbindgen_free,V=Object.freeze(Object.defineProperty({__proto__:null,__wbg_ignorer_free:L,__wbindgen_add_to_stack_pointer:J,__wbindgen_free:P,__wbindgen_malloc:z,__wbindgen_realloc:H,format:R,formatFor:q,ignorer_isIgnored:D,ignorer_new:B,lintFor:N,loadConfig:$,memory:U},Symbol.toStringTag,{value:"Module"}));v(V);export{Y as Ignorer,v as __wbg_set_wasm,k as __wbindgen_error_new,O as __wbindgen_json_parse,M as __wbindgen_throw,K as format,Q as formatFor,X as lintFor,G as loadConfig}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment