client-side-ocr
Version:
High-performance client-side OCR with ONNX Runtime, RapidOCR and PPU PaddleOCR integration. 100+ language support. Process text from images entirely in the browser with state-of-the-art accuracy and complete privacy.
18 lines (17 loc) • 12.3 kB
JavaScript
function ne(y){return y&&y.__esModule&&Object.prototype.hasOwnProperty.call(y,"default")?y.default:y}function ue(y){if(Object.prototype.hasOwnProperty.call(y,"__esModule"))return y;var g=y.default;if(typeof g=="function"){var d=function l(){var m=!1;try{m=this instanceof l}catch{}return m?Reflect.construct(g,arguments,this.constructor):g.apply(this,arguments)};d.prototype=g.prototype}else d={};return Object.defineProperty(d,"__esModule",{value:!0}),Object.keys(y).forEach(function(l){var m=Object.getOwnPropertyDescriptor(y,l);Object.defineProperty(d,l,m.get?m:{enumerable:!0,get:function(){return y[l]}})}),d}var M={exports:{}},o={};/**
* @license React
* react.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var z;function ee(){if(z)return o;z=1;var y=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),T=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),t=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),E=Symbol.iterator;function A(e){return e===null||typeof e!="object"?null:(e=E&&e[E]||e["@@iterator"],typeof e=="function"?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,I={};function S(e,r,n){this.props=e,this.context=r,this.refs=I,this.updater=n||h}S.prototype.isReactComponent={},S.prototype.setState=function(e,r){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,r,"setState")},S.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function U(){}U.prototype=S.prototype;function N(e,r,n){this.props=e,this.context=r,this.refs=I,this.updater=n||h}var D=N.prototype=new U;D.constructor=N,b(D,S.prototype),D.isPureReactComponent=!0;var Y=Array.isArray,a={H:null,A:null,T:null,S:null,V:null},k=Object.prototype.hasOwnProperty;function j(e,r,n,u,f,p){return n=p.ref,{$$typeof:y,type:e,key:r,ref:n!==void 0?n:null,props:p}}function X(e,r){return j(e.type,r,void 0,void 0,void 0,e.props)}function H(e){return typeof e=="object"&&e!==null&&e.$$typeof===y}function Q(e){var r={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return r[n]})}var q=/\/+/g;function L(e,r){return typeof e=="object"&&e!==null&&e.key!=null?Q(""+e.key):r.toString(36)}function x(){}function Z(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(x,x):(e.status="pending",e.then(function(r){e.status==="pending"&&(e.status="fulfilled",e.value=r)},function(r){e.status==="pending"&&(e.status="rejected",e.reason=r)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function C(e,r,n,u,f){var p=typeof e;(p==="undefined"||p==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(p){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case y:case g:s=!0;break;case c:return s=e._init,C(s(e._payload),r,n,u,f)}}if(s)return f=f(e),s=u===""?"."+L(e,0):u,Y(f)?(n="",s!=null&&(n=s.replace(q,"$&/")+"/"),C(f,r,n,"",function(F){return F})):f!=null&&(H(f)&&(f=X(f,n+(f.key==null||e&&e.key===f.key?"":(""+f.key).replace(q,"$&/")+"/")+s)),r.push(f)),1;s=0;var R=u===""?".":u+":";if(Y(e))for(var _=0;_<e.length;_++)u=e[_],p=R+L(u,_),s+=C(u,r,n,p,f);else if(_=A(e),typeof _=="function")for(e=_.call(e),_=0;!(u=e.next()).done;)u=u.value,p=R+L(u,_++),s+=C(u,r,n,p,f);else if(p==="object"){if(typeof e.then=="function")return C(Z(e),r,n,u,f);throw r=String(e),Error("Objects are not valid as a React child (found: "+(r==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.")}return s}function P(e,r,n){if(e==null)return e;var u=[],f=0;return C(e,u,"","",function(p){return r.call(n,p,f++)}),u}function J(e){if(e._status===-1){var r=e._result;r=r(),r.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=r)}if(e._status===1)return e._result.default;throw e._result}var G=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function V(){}return o.Children={map:P,forEach:function(e,r,n){P(e,function(){r.apply(this,arguments)},n)},count:function(e){var r=0;return P(e,function(){r++}),r},toArray:function(e){return P(e,function(r){return r})||[]},only:function(e){if(!H(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},o.Component=S,o.Fragment=d,o.Profiler=m,o.PureComponent=N,o.StrictMode=l,o.Suspense=i,o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,o.__COMPILER_RUNTIME={__proto__:null,c:function(e){return a.H.useMemoCache(e)}},o.cache=function(e){return function(){return e.apply(null,arguments)}},o.cloneElement=function(e,r,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var u=b({},e.props),f=e.key,p=void 0;if(r!=null)for(s in r.ref!==void 0&&(p=void 0),r.key!==void 0&&(f=""+r.key),r)!k.call(r,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&r.ref===void 0||(u[s]=r[s]);var s=arguments.length-2;if(s===1)u.children=n;else if(1<s){for(var R=Array(s),_=0;_<s;_++)R[_]=arguments[_+2];u.children=R}return j(e.type,f,void 0,void 0,p,u)},o.createContext=function(e){return e={$$typeof:T,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:w,_context:e},e},o.createElement=function(e,r,n){var u,f={},p=null;if(r!=null)for(u in r.key!==void 0&&(p=""+r.key),r)k.call(r,u)&&u!=="key"&&u!=="__self"&&u!=="__source"&&(f[u]=r[u]);var s=arguments.length-2;if(s===1)f.children=n;else if(1<s){for(var R=Array(s),_=0;_<s;_++)R[_]=arguments[_+2];f.children=R}if(e&&e.defaultProps)for(u in s=e.defaultProps,s)f[u]===void 0&&(f[u]=s[u]);return j(e,p,void 0,void 0,null,f)},o.createRef=function(){return{current:null}},o.forwardRef=function(e){return{$$typeof:O,render:e}},o.isValidElement=H,o.lazy=function(e){return{$$typeof:c,_payload:{_status:-1,_result:e},_init:J}},o.memo=function(e,r){return{$$typeof:t,type:e,compare:r===void 0?null:r}},o.startTransition=function(e){var r=a.T,n={};a.T=n;try{var u=e(),f=a.S;f!==null&&f(n,u),typeof u=="object"&&u!==null&&typeof u.then=="function"&&u.then(V,G)}catch(p){G(p)}finally{a.T=r}},o.unstable_useCacheRefresh=function(){return a.H.useCacheRefresh()},o.use=function(e){return a.H.use(e)},o.useActionState=function(e,r,n){return a.H.useActionState(e,r,n)},o.useCallback=function(e,r){return a.H.useCallback(e,r)},o.useContext=function(e){return a.H.useContext(e)},o.useDebugValue=function(){},o.useDeferredValue=function(e,r){return a.H.useDeferredValue(e,r)},o.useEffect=function(e,r,n){var u=a.H;if(typeof n=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return u.useEffect(e,r)},o.useId=function(){return a.H.useId()},o.useImperativeHandle=function(e,r,n){return a.H.useImperativeHandle(e,r,n)},o.useInsertionEffect=function(e,r){return a.H.useInsertionEffect(e,r)},o.useLayoutEffect=function(e,r){return a.H.useLayoutEffect(e,r)},o.useMemo=function(e,r){return a.H.useMemo(e,r)},o.useOptimistic=function(e,r){return a.H.useOptimistic(e,r)},o.useReducer=function(e,r,n){return a.H.useReducer(e,r,n)},o.useRef=function(e){return a.H.useRef(e)},o.useState=function(e){return a.H.useState(e)},o.useSyncExternalStore=function(e,r,n){return a.H.useSyncExternalStore(e,r,n)},o.useTransition=function(){return a.H.useTransition()},o.version="19.1.0",o}var K;function te(){return K||(K=1,M.exports=ee()),M.exports}var $={exports:{}},v={};/**
* @license React
* react-dom.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var B;function re(){if(B)return v;B=1;var y=te();function g(i){var t="https://react.dev/errors/"+i;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)t+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+i+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(){}var l={d:{f:d,r:function(){throw Error(g(522))},D:d,C:d,L:d,m:d,X:d,S:d,M:d},p:0,findDOMNode:null},m=Symbol.for("react.portal");function w(i,t,c){var E=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:m,key:E==null?null:""+E,children:i,containerInfo:t,implementation:c}}var T=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function O(i,t){if(i==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}return v.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,v.createPortal=function(i,t){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(g(299));return w(i,t,null,c)},v.flushSync=function(i){var t=T.T,c=l.p;try{if(T.T=null,l.p=2,i)return i()}finally{T.T=t,l.p=c,l.d.f()}},v.preconnect=function(i,t){typeof i=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,l.d.C(i,t))},v.prefetchDNS=function(i){typeof i=="string"&&l.d.D(i)},v.preinit=function(i,t){if(typeof i=="string"&&t&&typeof t.as=="string"){var c=t.as,E=O(c,t.crossOrigin),A=typeof t.integrity=="string"?t.integrity:void 0,h=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;c==="style"?l.d.S(i,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:E,integrity:A,fetchPriority:h}):c==="script"&&l.d.X(i,{crossOrigin:E,integrity:A,fetchPriority:h,nonce:typeof t.nonce=="string"?t.nonce:void 0})}},v.preinitModule=function(i,t){if(typeof i=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var c=O(t.as,t.crossOrigin);l.d.M(i,{crossOrigin:c,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&l.d.M(i)},v.preload=function(i,t){if(typeof i=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var c=t.as,E=O(c,t.crossOrigin);l.d.L(i,c,{crossOrigin:E,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}},v.preloadModule=function(i,t){if(typeof i=="string")if(t){var c=O(t.as,t.crossOrigin);l.d.m(i,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:c,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else l.d.m(i)},v.requestFormReset=function(i){l.d.r(i)},v.unstable_batchedUpdates=function(i,t){return i(t)},v.useFormState=function(i,t,c){return T.H.useFormState(i,t,c)},v.useFormStatus=function(){return T.H.useHostTransitionStatus()},v.version="19.1.0",v}var W;function oe(){if(W)return $.exports;W=1;function y(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(y)}catch(g){console.error(g)}}return y(),$.exports=re(),$.exports}export{oe as a,ue as b,ne as g,te as r};