4NK_IA_front/public/assets/index-DF5I3ljw.js
2025-09-18 15:31:16 +00:00

2 lines
17 KiB
JavaScript

function or(o,s){for(var t=0;t<s.length;t++){const c=s[t];if(typeof c!="string"&&!Array.isArray(c)){for(const a in c)if(a!=="default"&&!(a in o)){const u=Object.getOwnPropertyDescriptor(c,a);u&&Object.defineProperty(o,a,u.get?u:{enumerable:!0,get:()=>c[a]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}var ne={exports:{}},Te;function ir(){return Te||(Te=1,(function(o){var s=(function(t){var c=Object.prototype,a=c.hasOwnProperty,u=Object.defineProperty||function(r,e,n){r[e]=n.value},h,v=typeof Symbol=="function"?Symbol:{},_=v.iterator||"@@iterator",I=v.asyncIterator||"@@asyncIterator",q=v.toStringTag||"@@toStringTag";function b(r,e,n){return Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),r[e]}try{b({},"")}catch{b=function(e,n,l){return e[n]=l}}function F(r,e,n,l){var i=e&&e.prototype instanceof G?e:G,p=Object.create(i.prototype),E=new J(l||[]);return u(p,"_invoke",{value:X(r,n,E)}),p}t.wrap=F;function M(r,e,n){try{return{type:"normal",arg:r.call(e,n)}}catch(l){return{type:"throw",arg:l}}}var z="suspendedStart",g="suspendedYield",S="executing",C="completed",O={};function G(){}function y(){}function P(){}var Y={};b(Y,_,function(){return this});var K=Object.getPrototypeOf,W=K&&K(K(V([])));W&&W!==c&&a.call(W,_)&&(Y=W);var j=P.prototype=G.prototype=Object.create(Y);y.prototype=P,u(j,"constructor",{value:P,configurable:!0}),u(P,"constructor",{value:y,configurable:!0}),y.displayName=b(P,q,"GeneratorFunction");function H(r){["next","throw","return"].forEach(function(e){b(r,e,function(n){return this._invoke(e,n)})})}t.isGeneratorFunction=function(r){var e=typeof r=="function"&&r.constructor;return e?e===y||(e.displayName||e.name)==="GeneratorFunction":!1},t.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,P):(r.__proto__=P,b(r,q,"GeneratorFunction")),r.prototype=Object.create(j),r},t.awrap=function(r){return{__await:r}};function U(r,e){function n(p,E,m,T){var w=M(r[p],r,E);if(w.type==="throw")T(w.arg);else{var Z=w.arg,B=Z.value;return B&&typeof B=="object"&&a.call(B,"__await")?e.resolve(B.__await).then(function(D){n("next",D,m,T)},function(D){n("throw",D,m,T)}):e.resolve(B).then(function(D){Z.value=D,m(Z)},function(D){return n("throw",D,m,T)})}}var l;function i(p,E){function m(){return new e(function(T,w){n(p,E,T,w)})}return l=l?l.then(m,m):m()}u(this,"_invoke",{value:i})}H(U.prototype),b(U.prototype,I,function(){return this}),t.AsyncIterator=U,t.async=function(r,e,n,l,i){i===void 0&&(i=Promise);var p=new U(F(r,e,n,l),i);return t.isGeneratorFunction(e)?p:p.next().then(function(E){return E.done?E.value:p.next()})};function X(r,e,n){var l=z;return function(p,E){if(l===S)throw new Error("Generator is already running");if(l===C){if(p==="throw")throw E;return k()}for(n.method=p,n.arg=E;;){var m=n.delegate;if(m){var T=x(m,n);if(T){if(T===O)continue;return T}}if(n.method==="next")n.sent=n._sent=n.arg;else if(n.method==="throw"){if(l===z)throw l=C,n.arg;n.dispatchException(n.arg)}else n.method==="return"&&n.abrupt("return",n.arg);l=S;var w=M(r,e,n);if(w.type==="normal"){if(l=n.done?C:g,w.arg===O)continue;return{value:w.arg,done:n.done}}else w.type==="throw"&&(l=C,n.method="throw",n.arg=w.arg)}}}function x(r,e){var n=e.method,l=r.iterator[n];if(l===h)return e.delegate=null,n==="throw"&&r.iterator.return&&(e.method="return",e.arg=h,x(r,e),e.method==="throw")||n!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),O;var i=M(l,r.iterator,e.arg);if(i.type==="throw")return e.method="throw",e.arg=i.arg,e.delegate=null,O;var p=i.arg;if(!p)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,O;if(p.done)e[r.resultName]=p.value,e.next=r.nextLoc,e.method!=="return"&&(e.method="next",e.arg=h);else return p;return e.delegate=null,O}H(j),b(j,q,"Generator"),b(j,_,function(){return this}),b(j,"toString",function(){return"[object Generator]"});function re(r){var e={tryLoc:r[0]};1 in r&&(e.catchLoc=r[1]),2 in r&&(e.finallyLoc=r[2],e.afterLoc=r[3]),this.tryEntries.push(e)}function N(r){var e=r.completion||{};e.type="normal",delete e.arg,r.completion=e}function J(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(re,this),this.reset(!0)}t.keys=function(r){var e=Object(r),n=[];for(var l in e)n.push(l);return n.reverse(),function i(){for(;n.length;){var p=n.pop();if(p in e)return i.value=p,i.done=!1,i}return i.done=!0,i}};function V(r){if(r){var e=r[_];if(e)return e.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var n=-1,l=function i(){for(;++n<r.length;)if(a.call(r,n))return i.value=r[n],i.done=!1,i;return i.value=h,i.done=!0,i};return l.next=l}}return{next:k}}t.values=V;function k(){return{value:h,done:!0}}return J.prototype={constructor:J,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=h,this.done=!1,this.delegate=null,this.method="next",this.arg=h,this.tryEntries.forEach(N),!r)for(var e in this)e.charAt(0)==="t"&&a.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=h)},stop:function(){this.done=!0;var r=this.tryEntries[0],e=r.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(T,w){return p.type="throw",p.arg=r,e.next=T,w&&(e.method="next",e.arg=h),!!w}for(var l=this.tryEntries.length-1;l>=0;--l){var i=this.tryEntries[l],p=i.completion;if(i.tryLoc==="root")return n("end");if(i.tryLoc<=this.prev){var E=a.call(i,"catchLoc"),m=a.call(i,"finallyLoc");if(E&&m){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(E){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else if(m){if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(r,e){for(var n=this.tryEntries.length-1;n>=0;--n){var l=this.tryEntries[n];if(l.tryLoc<=this.prev&&a.call(l,"finallyLoc")&&this.prev<l.finallyLoc){var i=l;break}}i&&(r==="break"||r==="continue")&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var p=i?i.completion:{};return p.type=r,p.arg=e,i?(this.method="next",this.next=i.finallyLoc,O):this.complete(p)},complete:function(r,e){if(r.type==="throw")throw r.arg;return r.type==="break"||r.type==="continue"?this.next=r.arg:r.type==="return"?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):r.type==="normal"&&e&&(this.next=e),O},finish:function(r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===r)return this.complete(n.completion,n.afterLoc),N(n),O}},catch:function(r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===r){var l=n.completion;if(l.type==="throw"){var i=l.arg;N(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:V(r),resultName:e,nextLoc:n},this.method==="next"&&(this.arg=h),O}},t})(o.exports);try{regeneratorRuntime=s}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=s:Function("r","regeneratorRuntime = r")(s)}})(ne)),ne.exports}var oe,Ae;function be(){return Ae||(Ae=1,oe=(o,s)=>`${o}-${s}-${Math.random().toString(16).slice(3,8)}`),oe}var ie,_e;function Ze(){if(_e)return ie;_e=1;const o=be();let s=0;return ie=({id:t,action:c,payload:a={}})=>{let u=t;return typeof u>"u"&&(u=o("Job",s),s+=1),{id:u,action:c,payload:a}},ie}var Q={},qe;function ke(){if(qe)return Q;qe=1;let o=!1;return Q.logging=o,Q.setLogging=s=>{o=s},Q.log=(...s)=>o?console.log.apply(this,s):null,Q}var ae,Pe;function ar(){if(Pe)return ae;Pe=1;const o=Ze(),{log:s}=ke(),t=be();let c=0;return ae=()=>{const a=t("Scheduler",c),u={},h={};let v=[];c+=1;const _=()=>v.length,I=()=>Object.keys(u).length,q=()=>{if(v.length!==0){const g=Object.keys(u);for(let S=0;S<g.length;S+=1)if(typeof h[g[S]]>"u"){v[0](u[g[S]]);break}}},b=(g,S)=>new Promise((C,O)=>{const G=o({action:g,payload:S});v.push(async y=>{v.shift(),h[y.id]=G;try{C(await y[g].apply(this,[...S,G.id]))}catch(P){O(P)}finally{delete h[y.id],q()}}),s(`[${a}]: Add ${G.id} to JobQueue`),s(`[${a}]: JobQueue length=${v.length}`),q()});return{addWorker:g=>(u[g.id]=g,s(`[${a}]: Add ${g.id}`),s(`[${a}]: Number of workers=${I()}`),q(),g.id),addJob:async(g,...S)=>{if(I()===0)throw Error(`[${a}]: You need to have at least one worker before adding jobs`);return b(g,S)},terminate:async()=>{Object.keys(u).forEach(async g=>{await u[g].terminate()}),v=[]},getQueueLen:_,getNumWorkers:I}},ae}function sr(o){throw new Error('Could not dynamically require "'+o+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var se,Ie;function ur(){if(Ie)return se;Ie=1;function o(){return!!(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&process.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0)}return se=o,se}var ue,Ne;function cr(){if(Ne)return ue;Ne=1;const o=ur();return ue=s=>{const t={};return typeof WorkerGlobalScope<"u"?t.type="webworker":o()?t.type="electron":typeof document=="object"?t.type="browser":typeof process=="object"&&typeof sr=="function"&&(t.type="node"),typeof s>"u"?t:t[s]},ue}var ce,Me;function lr(){if(Me)return ce;Me=1;const s=cr()("type")==="browser"?t=>new URL(t,window.location.href).href:t=>t;return ce=t=>{const c={...t};return["corePath","workerPath","langPath"].forEach(a=>{t[a]&&(c[a]=s(c[a]))}),c},ce}var le,Ce;function fr(){return Ce||(Ce=1,le=o=>{const s=[],t=[],c=[],a=[],u=[];return o.blocks&&o.blocks.forEach(h=>{h.paragraphs.forEach(v=>{v.lines.forEach(_=>{_.words.forEach(I=>{I.symbols.forEach(q=>{u.push({...q,page:o,block:h,paragraph:v,line:_,word:I})}),a.push({...I,page:o,block:h,paragraph:v,line:_})}),c.push({..._,page:o,block:h,paragraph:v})}),t.push({...v,page:o,block:h})}),s.push({...h,page:o})}),{...o,blocks:s,paragraphs:t,lines:c,words:a,symbols:u}}),le}var fe,Ge;function Qe(){return Ge||(Ge=1,fe={TESSERACT_ONLY:0,LSTM_ONLY:1,TESSERACT_LSTM_COMBINED:2,DEFAULT:3}),fe}const dr="5.1.0",hr={version:dr};var de,je;function pr(){return je||(je=1,de={workerBlobURL:!0,logger:()=>{}}),de}var he,De;function vr(){if(De)return he;De=1;const o=hr.version;return he={...pr(),workerPath:`https://cdn.jsdelivr.net/npm/tesseract.js@v${o}/dist/worker.min.js`},he}var pe,$e;function gr(){return $e||($e=1,pe=({workerPath:o,workerBlobURL:s})=>{let t;if(Blob&&URL&&s){const c=new Blob([`importScripts("${o}");`],{type:"application/javascript"});t=new Worker(URL.createObjectURL(c))}else t=new Worker(o);return t}),pe}var ve,We;function yr(){return We||(We=1,ve=o=>{o.terminate()}),ve}var ge,Ue;function wr(){return Ue||(Ue=1,ge=(o,s)=>{o.onmessage=({data:t})=>{s(t)}}),ge}var ye,ze;function mr(){return ze||(ze=1,ye=async(o,s)=>{o.postMessage(s)}),ye}var we,Be;function Lr(){if(Be)return we;Be=1;const o=t=>new Promise((c,a)=>{const u=new FileReader;u.onload=()=>{c(u.result)},u.onerror=({target:{error:{code:h}}})=>{a(Error(`File could not be read! Code=${h}`))},u.readAsArrayBuffer(t)}),s=async t=>{let c=t;if(typeof t>"u")return"undefined";if(typeof t=="string")/data:image\/([a-zA-Z]*);base64,([^"]*)/.test(t)?c=atob(t.split(",")[1]).split("").map(a=>a.charCodeAt(0)):c=await(await fetch(t)).arrayBuffer();else if(typeof HTMLElement<"u"&&t instanceof HTMLElement)t.tagName==="IMG"&&(c=await s(t.src)),t.tagName==="VIDEO"&&(c=await s(t.poster)),t.tagName==="CANVAS"&&await new Promise(a=>{t.toBlob(async u=>{c=await o(u),a()})});else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas){const a=await t.convertToBlob();c=await o(a)}else(t instanceof File||t instanceof Blob)&&(c=await o(t));return new Uint8Array(c)};return we=s,we}var me,Fe;function Er(){if(Fe)return me;Fe=1;const o=vr(),s=gr(),t=yr(),c=wr(),a=mr(),u=Lr();return me={defaultOptions:o,spawnWorker:s,terminateWorker:t,onMessage:c,send:a,loadImage:u},me}var Le,Ye;function Xe(){if(Ye)return Le;Ye=1;const o=lr(),s=fr(),t=Ze(),{log:c}=ke(),a=be(),u=Qe(),{defaultOptions:h,spawnWorker:v,terminateWorker:_,onMessage:I,loadImage:q,send:b}=Er();let F=0;return Le=async(M="eng",z=u.LSTM_ONLY,g={},S={})=>{const C=a("Worker",F),{logger:O,errorHandler:G,...y}=o({...h,...g}),P={},Y={},K=typeof M=="string"?M.split("+"):M;let W=z,j=S;const H=[u.DEFAULT,u.LSTM_ONLY].includes(z)&&!y.legacyCore;let U,X;const x=new Promise((f,d)=>{X=f,U=d}),re=f=>{U(f.message)};let N=v(y);N.onerror=re,F+=1;const J=(f,d)=>{P[f]=d},V=(f,d)=>{Y[f]=d},k=({id:f,action:d,payload:L})=>new Promise((A,R)=>{c(`[${C}]: Start ${f}, action=${d}`);const $=`${d}-${f}`;J($,A),V($,R),b(N,{workerId:C,jobId:f,action:d,payload:L})}),r=()=>console.warn("`load` is depreciated and should be removed from code (workers now come pre-loaded)"),e=f=>k(t({id:f,action:"load",payload:{options:{lstmOnly:H,corePath:y.corePath,logging:y.logging}}})),n=(f,d,L)=>k(t({id:L,action:"FS",payload:{method:"writeFile",args:[f,d]}})),l=(f,d)=>k(t({id:d,action:"FS",payload:{method:"readFile",args:[f,{encoding:"utf8"}]}})),i=(f,d)=>k(t({id:d,action:"FS",payload:{method:"unlink",args:[f]}})),p=(f,d,L)=>k(t({id:L,action:"FS",payload:{method:f,args:d}})),E=()=>console.warn("`loadLanguage` is depreciated and should be removed from code (workers now come with language pre-loaded)"),m=(f,d)=>k(t({id:d,action:"loadLanguage",payload:{langs:f,options:{langPath:y.langPath,dataPath:y.dataPath,cachePath:y.cachePath,cacheMethod:y.cacheMethod,gzip:y.gzip,lstmOnly:[u.LSTM_ONLY,u.TESSERACT_LSTM_COMBINED].includes(W)&&!y.legacyLang}}})),T=()=>console.warn("`initialize` is depreciated and should be removed from code (workers now come pre-initialized)"),w=(f,d,L,A)=>k(t({id:A,action:"initialize",payload:{langs:f,oem:d,config:L}})),Z=(f="eng",d,L,A)=>{if(H&&[u.TESSERACT_ONLY,u.TESSERACT_LSTM_COMBINED].includes(d))throw Error("Legacy model requested but code missing.");const R=d||W;W=R;const $=L||j;j=$;const te=(typeof f=="string"?f.split("+"):f).filter(nr=>!K.includes(nr));return K.push(...te),te.length>0?m(te,A).then(()=>w(f,R,$,A)):w(f,R,$,A)},B=(f={},d)=>k(t({id:d,action:"setParameters",payload:{params:f}})),D=async(f,d={},L={blocks:!0,text:!0,hocr:!0,tsv:!0},A)=>k(t({id:A,action:"recognize",payload:{image:await q(f),options:d,output:L}})),xe=(f="Tesseract OCR Result",d=!1,L)=>(console.log("`getPDF` function is depreciated. `recognize` option `savePDF` should be used instead."),k(t({id:L,action:"getPDF",payload:{title:f,textonly:d}}))),er=async(f,d)=>{if(H)throw Error("`worker.detect` requires Legacy model, which was not loaded.");return k(t({id:d,action:"detect",payload:{image:await q(f)}}))},rr=async()=>(N!==null&&(_(N),N=null),Promise.resolve());I(N,({workerId:f,jobId:d,status:L,action:A,data:R})=>{const $=`${A}-${d}`;if(L==="resolve"){c(`[${f}]: Complete ${d}`);let ee=R;A==="recognize"?ee=s(R):A==="getPDF"&&(ee=Array.from({...R,length:Object.keys(R).length})),P[$]({jobId:d,data:ee})}else if(L==="reject")if(Y[$](R),A==="load"&&U(R),G)G(R);else throw Error(R);else L==="progress"&&O({...R,userJobId:d})});const tr={id:C,worker:N,setResolve:J,setReject:V,load:r,writeText:n,readText:l,removeFile:i,FS:p,loadLanguage:E,initialize:T,reinitialize:Z,setParameters:B,recognize:D,getPDF:xe,detect:er,terminate:rr};return e().then(()=>m(M)).then(()=>w(M,z,S)).then(()=>X(tr)).catch(()=>{}),x},Le}var Ee,Ke;function Sr(){if(Ke)return Ee;Ke=1;const o=Xe();return Ee={recognize:async(c,a,u)=>{const h=await o(a,1,u);return h.recognize(c).finally(async()=>{await h.terminate()})},detect:async(c,a)=>{const u=await o("osd",0,a);return u.detect(c).finally(async()=>{await u.terminate()})}},Ee}var Se,He;function Or(){return He||(He=1,Se={AFR:"afr",AMH:"amh",ARA:"ara",ASM:"asm",AZE:"aze",AZE_CYRL:"aze_cyrl",BEL:"bel",BEN:"ben",BOD:"bod",BOS:"bos",BUL:"bul",CAT:"cat",CEB:"ceb",CES:"ces",CHI_SIM:"chi_sim",CHI_TRA:"chi_tra",CHR:"chr",CYM:"cym",DAN:"dan",DEU:"deu",DZO:"dzo",ELL:"ell",ENG:"eng",ENM:"enm",EPO:"epo",EST:"est",EUS:"eus",FAS:"fas",FIN:"fin",FRA:"fra",FRK:"frk",FRM:"frm",GLE:"gle",GLG:"glg",GRC:"grc",GUJ:"guj",HAT:"hat",HEB:"heb",HIN:"hin",HRV:"hrv",HUN:"hun",IKU:"iku",IND:"ind",ISL:"isl",ITA:"ita",ITA_OLD:"ita_old",JAV:"jav",JPN:"jpn",KAN:"kan",KAT:"kat",KAT_OLD:"kat_old",KAZ:"kaz",KHM:"khm",KIR:"kir",KOR:"kor",KUR:"kur",LAO:"lao",LAT:"lat",LAV:"lav",LIT:"lit",MAL:"mal",MAR:"mar",MKD:"mkd",MLT:"mlt",MSA:"msa",MYA:"mya",NEP:"nep",NLD:"nld",NOR:"nor",ORI:"ori",PAN:"pan",POL:"pol",POR:"por",PUS:"pus",RON:"ron",RUS:"rus",SAN:"san",SIN:"sin",SLK:"slk",SLV:"slv",SPA:"spa",SPA_OLD:"spa_old",SQI:"sqi",SRP:"srp",SRP_LATN:"srp_latn",SWA:"swa",SWE:"swe",SYR:"syr",TAM:"tam",TEL:"tel",TGK:"tgk",TGL:"tgl",THA:"tha",TIR:"tir",TUR:"tur",UIG:"uig",UKR:"ukr",URD:"urd",UZB:"uzb",UZB_CYRL:"uzb_cyrl",VIE:"vie",YID:"yid"}),Se}var Oe,Je;function Rr(){return Je||(Je=1,Oe={OSD_ONLY:"0",AUTO_OSD:"1",AUTO_ONLY:"2",AUTO:"3",SINGLE_COLUMN:"4",SINGLE_BLOCK_VERT_TEXT:"5",SINGLE_BLOCK:"6",SINGLE_LINE:"7",SINGLE_WORD:"8",CIRCLE_WORD:"9",SINGLE_CHAR:"10",SPARSE_TEXT:"11",SPARSE_TEXT_OSD:"12",RAW_LINE:"13"}),Oe}var Re,Ve;function br(){if(Ve)return Re;Ve=1,ir();const o=ar(),s=Xe(),t=Sr(),c=Or(),a=Qe(),u=Rr(),{setLogging:h}=ke();return Re={languages:c,OEM:a,PSM:u,createScheduler:o,createWorker:s,setLogging:h,...t},Re}var kr=br();const Tr=or({__proto__:null},[kr]);export{Tr as i};