diff --git a/AGENTS.md b/AGENTS.md index a4c8e79..24bff21 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -76,6 +76,7 @@ and dark, at desktop and phone width, with `scripts/dev.sh` running. | `src/documents.rs` | documents of people and companies: kinds, records, SQL, `files-check`, `files-migrate` | | `src/papers/` | the Immigration Bureau's forms filled in (`layout.rs` is generated by `scripts/gen_layout.py`) | | `src/pack/` | the extension pack: its rules as a pure function (`assess`), and the pack as one PDF (`pdf.rs`) | +| `static/mrz-photo.js` | the passport photo reader in the browser (camera view, Tesseract.js from `static/vendor/tesseract/`, see its README.txt); the server's half is `mrz::from_ocr` | | `src/web/` | routes, the login gate, pages | | `templates/` | minijinja templates, compiled in by `build.rs` | | `static/` | CSS and JavaScript, compiled in; the URL carries a content hash | diff --git a/README.md b/README.md index 09aadb7..527c9f1 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,12 @@ Data Protection Act (PDPA) asks. windows online and in person, the window for the next extension of stay, a decision to collect, overstay, TM.30 after each arrival, the passport's and the work permit's expiry, and visas still to be used. +- The passport's zone from a photo: on the new person and new passport + forms, "Take a photo" opens a camera view with a frame for the photo page + and a band for the two lines, says when there is glare or too little + light, and takes the photo once the lines look readable; "Choose a + picture" reads any image. The reading happens in the browser, so the + photo stays on the device, and the check digits catch a misread. - A list of people with a filter and each person's next deadline, and a page per person with six tabs: the overview with personal details, passports and addresses; "Visa and stay" with arrivals and departures, diff --git a/docs/PLAN.md b/docs/PLAN.md index cbf19e5..38ba42f 100644 --- a/docs/PLAN.md +++ b/docs/PLAN.md @@ -40,6 +40,7 @@ The first round of questions was answered on November 17, 2026. | Client link (Nov 20) | staff make a link for a person, often a new and empty record; the client fills in personal details, the passport (with the MRZ reader, also from a photo taken on the phone), the address in Thailand and contact, and uploads scans (passport pages, photo, TDAC) | | Client input (Nov 20) | goes straight into the person's record, logged as coming from the link; staff check it | | Link lifetime (Nov 20) | 14 days, or until the client presses Send or staff close the link | +| Passport photo (Nov 20) | read in the browser with Tesseract.js and an MRZ model served by the app; the photo never leaves the device, only the lines it finds are sent, and the server checks them like typed ones | | Client agreement (later) | a box on the client link where the client signs the agreement with B4L to keep and work with their data; its text comes from B4L | Kanidm keeps persons, groups and OAuth2 clients in one namespace, so the @@ -446,13 +447,28 @@ Planned on November 20, 2026, from Alex's answers (decisions table). saved on its own; the link's own form token and the same-site check; nothing about anyone else. After Send, or 14 days, or once staff close it, the link shows only that it is closed. -- [ ] 7.3 The passport from a photo: on a phone the camera takes the MRZ - (``); the - two lines it reads go into the MRZ field, whose check digits then fill - in the form. The same on the staff's new person and new passport forms. - To settle when building it: reading in the browser (the photo stays on - the phone; Tesseract.js with a model trained for the MRZ, served by the - app, needs `'wasm-unsafe-eval'` in the policy) or on the server. +- [x] 7.3 The passport from a photo, built ahead on November 20, 2026 on + the staff's new person and new passport forms (the client's pages + reuse `templates/_mrz_photo.html`). "Take a photo" opens a camera view: + a frame of the photo page's shape and a band for the two lines, with + a hint that says when it is too dark, when there is glare on the + lines, when no lines are in the band or the picture is not sharp, and + that takes the photo by itself once the band has looked readable for + a second. "Choose a picture" reads any image (EXIF orientation, the + four quarter turns, a tilt either way). Reading happens in the browser + (`static/mrz-photo.js`): Tesseract.js 7 with Doubango's MRZ model, all + served by the app (`static/vendor/tesseract/README.txt`, about 6 MB, + loaded at the first photo), so the photo stays on the device. Only + those pages and those files allow WebAssembly (`'wasm-unsafe-eval'`) + and the camera (`camera=(self)`). The lines found go into the zone's + field and Read is pressed; `mrz::from_ocr` picks the first line and + the second whose check digits match best among them, cuts or fills a + miscounted filler run, and swaps look-alikes (O for 0) only where a + check digit asks for it. The note then asks to compare the names, + which have no check digit. Tried on 12 made-up phone photos and 16 + specimen pages: every readable zone read, except under a hard shadow + across the lines; the specimens that failed have their zone blanked + out. - [ ] 7.4 Uploads from the client into the encrypted store: the passport's photo page, the photo, the TDAC and other scans, each tied to its record where there is one. diff --git a/src/embedded.rs b/src/embedded.rs index c30e4a7..7d8af40 100644 --- a/src/embedded.rs +++ b/src/embedded.rs @@ -40,6 +40,8 @@ pub fn content_type(path: &str) -> &'static str { "ico" => "image/x-icon", "txt" => "text/plain; charset=utf-8", "woff2" => "font/woff2", + "wasm" => "application/wasm", + "gz" => "application/gzip", _ => "application/octet-stream", } } diff --git a/src/mrz.rs b/src/mrz.rs index 7ed3b35..3b4c4c3 100644 --- a/src/mrz.rs +++ b/src/mrz.rs @@ -228,6 +228,266 @@ fn date(s: &str, past: bool, today: NaiveDate) -> Option { NaiveDate::from_ymd_opt(year, mm, dd) } +// ------------------------------------------------------------ from a photo + +/// Letters OCR reads where the zone has a digit, and the digit meant. +const AS_DIGIT: &[(u8, u8)] = &[ + (b'O', b'0'), + (b'Q', b'0'), + (b'D', b'0'), + (b'U', b'0'), + (b'I', b'1'), + (b'L', b'1'), + (b'Z', b'2'), + (b'A', b'4'), + (b'S', b'5'), + (b'G', b'6'), + (b'T', b'7'), + (b'B', b'8'), +]; + +/// Characters OCR mixes up in the fields that hold letters and digits. +const ALIKE: &[&[u8]] = &[b"0OQD", b"1I", b"2Z", b"5S", b"6G", b"8B"]; + +fn as_digit(b: u8) -> u8 { + AS_DIGIT + .iter() + .find(|(l, _)| *l == b) + .map_or(b, |(_, d)| *d) +} + +/// The first letter for a digit: 0 is O, 1 is I, 8 is B. +fn as_letter(b: u8) -> u8 { + AS_DIGIT + .iter() + .find(|(_, d)| *d == b) + .map_or(b, |(l, _)| *l) +} + +fn alike(b: u8) -> Option<&'static [u8]> { + ALIKE.iter().find(|g| g.contains(&b)).copied() +} + +fn as_str(b: &[u8]) -> &str { + std::str::from_utf8(b).unwrap_or("") +} + +fn ok_bytes(field: &[u8], check: u8) -> bool { + digit_ok(as_str(field), check) +} + +/// What OCR gives, upper case, only the zone's characters; `«` is `<<`. +fn clean_line(line: &str) -> Vec { + line.to_uppercase() + .replace('«', "<<") + .replace('‹', "<") + .bytes() + .filter(|b| b.is_ascii_uppercase() || b.is_ascii_digit() || *b == b'<') + .collect() +} + +/// The first line holds the names: it starts with P (perhaps after a speck +/// read as a letter), has filler and few digits. +fn first_line(l: &[u8]) -> Option> { + let digits = l.iter().filter(|b| b.is_ascii_digit()).count(); + let filler = l.iter().filter(|b| **b == b'<').count(); + if l.len() < 30 || digits >= 8 || filler < 2 { + return None; + } + let l = match l { + [b'P', ..] => l, + [_, b'P', ..] => &l[1..], + _ => return None, + }; + let mut l = l.to_vec(); + l.resize(44, b'<'); + for b in &mut l[1..] { + *b = as_letter(*b); + } + // a `<` among filler is often read as K, C or E + for i in 5..44 { + let left = i >= 7 && l[i - 2..i] == *b"<<"; + let right = i + 2 >= 44 || l[i + 1..(i + 3).min(44)].iter().all(|b| *b == b'<'); + if l[i] != b'<' && left && right && b"KCEL".contains(&l[i]) { + l[i] = b'<'; + } + } + Some(l) +} + +/// A second line read a character too long or short, cut or filled to 44: +/// in a run of filler first, where OCR most often miscounts, then at its +/// ends. +fn fitted(l: &[u8]) -> Vec> { + let d = l.len() as i64 - 44; + if d == 0 { + return vec![l.to_vec()]; + } + if d.abs() > 3 { + return Vec::new(); + } + let n = d.unsigned_abs() as usize; + let mut out = Vec::new(); + let mut i = 0; + while i < l.len() { + if l[i] != b'<' { + i += 1; + continue; + } + let start = i; + while i < l.len() && l[i] == b'<' { + i += 1; + } + let mut v = l.to_vec(); + if d > 0 && i - start > n { + v.drain(start..start + n); + } else if d < 0 { + v.splice(start..start, std::iter::repeat_n(b'<', n)); + } else { + continue; + } + out.push(v); + } + if d > 0 { + out.push(l[n..].to_vec()); + out.push(l[..44].to_vec()); + } else { + let mut v = l.to_vec(); + v.resize(44, b'<'); + out.push(v); + } + out +} + +/// The readings of a field of letters and digits whose check digit +/// matches, with the fewest characters swapped for a look-alike (at most +/// two), each with what the swaps cost: a letter read where a digit was +/// printed is the likelier mistake, so a swap to a digit costs 1 and one to +/// a letter 2. The field as read when no reading matches. +fn readings(field: &[u8], check: u8) -> Vec<(usize, Vec)> { + if ok_bytes(field, check) { + return vec![(0, field.to_vec())]; + } + let spots: Vec = (0..field.len()) + .filter(|&i| alike(field[i]).is_some()) + .collect(); + let one = |f: &[u8], i: usize| -> Vec<(usize, Vec)> { + alike(f[i]) + .unwrap_or_default() + .iter() + .filter(|c| **c != f[i]) + .map(|c| { + let mut v = f.to_vec(); + v[i] = *c; + (if c.is_ascii_digit() { 1 } else { 2 }, v) + }) + .collect() + }; + let mut found: Vec<(usize, Vec)> = spots + .iter() + .flat_map(|&i| one(field, i)) + .filter(|(_, v)| ok_bytes(v, check)) + .collect(); + if found.is_empty() { + for (k, &i) in spots.iter().enumerate() { + for (c1, v) in one(field, i) { + for &j in &spots[k + 1..] { + found.extend( + one(&v, j) + .into_iter() + .filter(|(_, w)| ok_bytes(w, check)) + .map(|(c2, w)| (c1 + c2, w)), + ); + } + } + } + } + if found.is_empty() { + found.push((usize::MAX, field.to_vec())); + } + found +} + +/// The second line with digits where the zone has digits and letters where +/// it has letters, and the look-alikes in the number and the personal +/// number that make the check digits match; with the number of checks that +/// match and of characters swapped. +fn second_line(l: &[u8]) -> (usize, usize, Vec) { + let mut l = l.to_vec(); + for i in [ + 9, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 43, + ] { + l[i] = as_digit(l[i]); + } + if l[42] != b'<' { + l[42] = as_digit(l[42]); + } + for b in &mut l[10..13] { + *b = as_letter(*b); + } + let mut best = (0, usize::MAX, l.clone()); + for (dn, number) in readings(&l[0..9], l[9]) { + for (dp, personal) in readings(&l[28..42], l[42]) { + let mut v = l.clone(); + v[0..9].copy_from_slice(&number); + v[28..42].copy_from_slice(&personal); + let checks = checks_ok(&v); + let swapped = dn.saturating_add(dp); + if checks > best.0 || (checks == best.0 && swapped < best.1) { + best = (checks, swapped, v); + } + } + } + best +} + +/// How many of the five check digits of a second line match. +fn checks_ok(l: &[u8]) -> usize { + let composite = [&l[0..10], &l[13..20], &l[21..43]].concat(); + [ + ok_bytes(&l[0..9], l[9]), + ok_bytes(&l[13..19], l[19]), + ok_bytes(&l[21..27], l[27]), + ok_bytes(&l[28..42], l[42]), + ok_bytes(&composite, l[43]), + ] + .iter() + .filter(|ok| **ok) + .count() +} + +/// The zone among lines read from a photo of the passport. OCR misreads +/// a few characters (O for 0, one `<` too many), so this puts letters where +/// the zone has letters and digits where it has digits, tries the readings +/// a check digit asks for, and keeps the second line whose check digits +/// match best (the lines may come in any order, more than once). None when +/// no line looks like a passport's first line, or none like its second. +pub fn from_ocr(text: &str) -> Option { + let lines: Vec> = text.lines().map(clean_line).collect(); + let first = lines.iter().find_map(|l| first_line(l))?; + let mut best: Option<(usize, usize, Vec)> = None; + for l in &lines { + if l.iter().filter(|b| b.is_ascii_digit()).count() < 10 { + continue; + } + for v in fitted(l) { + let c = second_line(&v); + if best + .as_ref() + .is_none_or(|b| c.0 > b.0 || (c.0 == b.0 && c.1 < b.1)) + { + best = Some(c); + } + } + } + let (_, _, second) = best?; + Some(format!("{}\n{}", text_of(&first), text_of(&second))) +} + +fn text_of(b: &[u8]) -> String { + String::from_utf8_lossy(b).into_owned() +} + /// The fields of a zone to write, for demo data and tests. pub struct Compose<'a> { pub issuing_state: &'a str, @@ -334,6 +594,71 @@ mod tests { ); } + /// Each case: what OCR read in a photo, and the zone it holds. + #[test] + fn finds_the_zone_in_what_ocr_read() { + let erika = "P bool { } } +/// Every page's policy: nothing but the app's own files, no inline script. +pub const PAGE_CSP: &str = "default-src 'self'; img-src 'self' data:; style-src 'self'; \ + script-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'; \ + form-action 'self'"; + +/// The policy of the pages that read a passport from a photo, and of the +/// reader's own files: WebAssembly may run (a worker takes the policy of +/// its script, in some browsers the page's), and a picture may be shown +/// from a `blob:` address. +pub const READER_CSP: &str = "default-src 'self'; img-src 'self' data: blob:; style-src 'self'; \ + script-src 'self' 'wasm-unsafe-eval'; worker-src 'self'; connect-src 'self'; \ + frame-ancestors 'none'; base-uri 'none'; form-action 'self'"; + +/// A page with the passport photo reader, or one of its files: its policy, +/// and the camera allowed to this site for the camera view. +pub fn with_reader(mut resp: Response) -> Response { + let h = resp.headers_mut(); + h.insert( + header::CONTENT_SECURITY_POLICY, + HeaderValue::from_static(READER_CSP), + ); + h.insert( + HeaderName::from_static("permissions-policy"), + HeaderValue::from_static("camera=(self), microphone=(), geolocation=()"), + ); + resp +} + async fn security_headers(req: Request, next: Next) -> Response { let mut resp = next.run(req).await; let h = resp.headers_mut(); @@ -485,10 +513,7 @@ async fn security_headers(req: Request, next: Next) -> Response { if !h.contains_key(header::CONTENT_SECURITY_POLICY) { h.insert( header::CONTENT_SECURITY_POLICY, - HeaderValue::from_static( - "default-src 'self'; img-src 'self' data:; style-src 'self'; script-src 'self'; \ - connect-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'", - ), + HeaderValue::from_static(PAGE_CSP), ); } h.insert( @@ -504,10 +529,14 @@ async fn security_headers(req: Request, next: Next) -> Response { HeaderName::from_static("x-robots-tag"), HeaderValue::from_static("noindex, nofollow"), ); - h.insert( - HeaderName::from_static("permissions-policy"), - HeaderValue::from_static("camera=(), microphone=(), geolocation=()"), - ); + // the photo reader's pages allow the camera (`with_reader`) + let policy = HeaderName::from_static("permissions-policy"); + if !h.contains_key(&policy) { + h.insert( + policy, + HeaderValue::from_static("camera=(), microphone=(), geolocation=()"), + ); + } resp } @@ -647,14 +676,22 @@ async fn version() -> Response { async fn static_file(Path(path): Path) -> Response { match embedded::static_file(&path) { - Some(bytes) => ( - [ - (header::CONTENT_TYPE, embedded::content_type(&path)), - (header::CACHE_CONTROL, "public, max-age=86400"), - ], - bytes, - ) - .into_response(), + Some(bytes) => { + let resp = ( + [ + (header::CONTENT_TYPE, embedded::content_type(&path)), + (header::CACHE_CONTROL, "public, max-age=86400"), + ], + bytes, + ) + .into_response(); + // the photo reader's worker compiles WebAssembly + if path.starts_with("vendor/tesseract/") { + with_reader(resp) + } else { + resp + } + } None => StatusCode::NOT_FOUND.into_response(), } } diff --git a/src/web/people.rs b/src/web/people.rs index 83d836c..390bf70 100644 --- a/src/web/people.rs +++ b/src/web/people.rs @@ -10,7 +10,7 @@ use chrono::NaiveDate; use minijinja::context; use serde::{Deserialize, Serialize}; -use super::{AppState, Res, not_found_page, page}; +use super::{AppState, Res, not_found_page, page, with_reader}; use crate::audit::{self, Action, Entity, Entry}; use crate::countries; use crate::dates::{self, Status}; @@ -198,13 +198,27 @@ fn log<'a>( } } -/// Reads the zone typed into a form; a text that is no zone becomes a -/// field error. -fn read_zone(text: &str, today: NaiveDate, errors: &mut Errors) -> Option { +/// Reads the zone typed into a form or read from a photo. When the text is +/// no zone whose check digits all match, the zone in it as OCR read it +/// (`mrz::from_ocr`: lines in any order, look-alike characters) replaces +/// it, if that one matches or the text was no zone at all. A text that +/// holds no zone becomes a field error. +fn read_zone(text: &mut String, today: NaiveDate, errors: &mut Errors) -> Option { if text.is_empty() { return None; } - match mrz::parse(text, today) { + let typed = mrz::parse(text, today); + if typed.as_ref().is_ok_and(Mrz::all_ok) { + return typed.ok(); + } + if let Some(found) = mrz::from_ocr(text) + && let Ok(m) = mrz::parse(&found, today) + && (m.all_ok() || typed.is_err()) + { + *text = found; + return Some(m); + } + match typed { Ok(m) => Some(m), Err(msg) => { err(errors, "mrz", msg); @@ -213,20 +227,40 @@ fn read_zone(text: &str, today: NaiveDate, errors: &mut Errors) -> Option { } } -fn zone_note(m: &Mrz, errors: &mut Errors) -> Option { - if m.all_ok() { - Some("Filled in from the machine-readable zone; every check digit matches.".into()) - } else { - err( - errors, - "mrz", - format!( - "Filled in, but the check digits do not match for: {}. Compare the lines with \ - the passport.", - m.failed().join(", ") - ), - ); - None +/// `photo`: the lines came from the photo reader (the form's +/// `mrz_source`), whose names have no check digit to catch a misread. +fn zone_note(m: &Mrz, photo: bool, errors: &mut Errors) -> Option { + match (m.all_ok(), photo) { + (true, false) => { + Some("Filled in from the machine-readable zone; every check digit matches.".into()) + } + (true, true) => Some( + "Read from the photo; every check digit matches. The names have no check digit: \ + compare them with the passport." + .into(), + ), + (false, _) => { + let what = if photo { + "Read from the photo" + } else { + "Filled in" + }; + err( + errors, + "mrz", + format!( + "{what}, but the check digits do not match for: {}. Compare the lines \ + with the passport and correct them{}.", + m.failed().join(", "), + if photo { + ", or take the photo again" + } else { + "" + } + ), + ); + None + } } } @@ -365,7 +399,7 @@ fn person_form_page( ), None => ("New person".to_string(), "new", "/people".to_string()), }; - page( + with_reader(page( st, user, "person_form.html", @@ -376,7 +410,7 @@ fn person_form_page( p, tab => "overview", f, pf, errors, mrz_note, mode, action, companies, ..select_lists() }, - ) + )) } /// The companies the employer is chosen from (the active ones and the one @@ -415,7 +449,8 @@ pub async fn create( let mut pf = PersonForm::from_fields(&f); let mut ppf = PassportForm::from_fields(&f); let mut errors = Errors::new(); - let zone = read_zone(&ppf.mrz, today, &mut errors); + let zone = read_zone(&mut ppf.mrz, today, &mut errors); + let photo = get(&f, "mrz_source") == "photo"; if get(&f, "action") == "read-mrz" { let mut note = None; @@ -423,7 +458,7 @@ pub async fn create( Some(m) => { pf.take_mrz(m, true); ppf.take_mrz(m, true); - note = zone_note(m, &mut errors); + note = zone_note(m, photo, &mut errors); } None if ppf.mrz.is_empty() => { err(&mut errors, "mrz", "Paste the two lines first."); @@ -640,7 +675,7 @@ fn passport_form_page( ), None => ("New passport", "new", format!("/people/{}/passports", p.id)), }; - page( + with_reader(page( st, user, "passport_form.html", @@ -648,7 +683,7 @@ fn passport_form_page( "people", status, context! { p, tab => "overview", pf, errors, mrz_note, name_hint, mode, action, heading => title, ..select_lists() }, - ) + )) } pub async fn passport_new( @@ -710,14 +745,15 @@ async fn passport_save( let today = dates::today(); let mut pf = PassportForm::from_fields(f); let mut errors = Errors::new(); - let zone = read_zone(&pf.mrz, today, &mut errors); + let zone = read_zone(&mut pf.mrz, today, &mut errors); + let photo = get(f, "mrz_source") == "photo"; let mut notes = Notes::default(); if get(f, "action") == "read-mrz" { match &zone { Some(m) => { pf.take_mrz(m, true); - notes.mrz_note = zone_note(m, &mut errors); + notes.mrz_note = zone_note(m, photo, &mut errors); notes.name_hint = name_hint(m, &person); } None if pf.mrz.is_empty() => err(&mut errors, "mrz", "Paste the two lines first."), diff --git a/static/app.css b/static/app.css index f7fa72c..5d29475 100644 --- a/static/app.css +++ b/static/app.css @@ -1271,3 +1271,121 @@ textarea.mrz { margin-top: 8px; } } + +/* the passport photo reader: a camera button, and a picture button whose + file input covers it, so a tap or a click lands on it */ +.mrzphoto { + display: inline-flex; + flex-wrap: wrap; + gap: 8px; +} +.mrzphoto[hidden], +.mrzphoto [hidden], +.mrz-status[hidden] { + display: none; +} +.mrzphoto.busy { + opacity: 0.6; + pointer-events: none; +} +.filebtn { + position: relative; + overflow: hidden; +} +.filebtn input[type="file"] { + position: absolute; + inset: 0; + width: 100%; + height: 100%; + opacity: 0; + cursor: pointer; +} +.filebtn:focus-within { + outline: 2px solid var(--accent); + outline-offset: 2px; +} +.mrz-status { + margin: 0; + flex-basis: 100%; +} +.mrz-status[data-state="error"] { + color: var(--bad); +} + +/* the camera view: the video fills the screen, the frame of the photo page + darkens what lies outside it, the band marks the two lines */ +.cam-open, +.cam-open body { + overflow: hidden; +} +.cam { + position: fixed; + inset: 0; + z-index: 1000; + background: #000; + color: #fff; +} +.cam-video { + position: absolute; + inset: 0; + width: 100%; + height: 100%; + object-fit: cover; +} +.cam-frame { + position: absolute; + border: 2px solid rgba(255, 255, 255, 0.9); + border-radius: 14px; + box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.5); +} +.cam-band { + position: absolute; + left: 3%; + top: 70%; + width: 94%; + height: 27%; + border: 2px dashed #f5c000; + border-radius: 6px; +} +.cam-band span { + position: absolute; + top: -24px; + left: 0; + font-size: 13px; + font-weight: 600; + color: #f5c000; +} +.cam.good .cam-frame { + border-color: #3ccf6e; +} +.cam.good .cam-band { + border-style: solid; + border-color: #3ccf6e; +} +.cam.good .cam-band span { + color: #3ccf6e; +} +.cam-hint { + position: absolute; + left: 50%; + bottom: 84px; + transform: translateX(-50%); + width: max-content; + max-width: calc(100% - 32px); + margin: 0; + padding: 8px 14px; + border-radius: 8px; + background: rgba(0, 0, 0, 0.7); + font-size: 15px; + text-align: center; +} +.cam-bar { + position: absolute; + left: 0; + right: 0; + bottom: 0; + display: flex; + justify-content: center; + gap: 12px; + padding: 16px 16px max(16px, env(safe-area-inset-bottom)); +} diff --git a/static/mrz-photo.js b/static/mrz-photo.js new file mode 100644 index 0000000..13826d1 --- /dev/null +++ b/static/mrz-photo.js @@ -0,0 +1,749 @@ +// The passport's machine-readable zone from a photo: taken in a camera view +// with a frame for the photo page and a band for the two lines, which says +// when there is glare, too little light or no sharp picture yet; or any +// picture of the page. Tesseract.js reads it in the browser with a model +// trained on MRZ lines, so the photo stays on the device; only the lines it +// finds go into the zone's field, and the server reads them as if they +// were typed (check digits and all). +(function () { + "use strict"; + + var ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789<"; + // the longest side kept of a photo, and the one of the first look for the + // lines + var KEEP = 3200; + var LOOK = 1600; + // the height of a letter for the second, closer read + var LETTER = 40; + + var reader = null; + var onProgress = function () {}; + + function supported() { + return ( + typeof WebAssembly === "object" && + typeof Worker === "function" && + typeof Promise === "function" && + !!document.createElement("canvas").getContext + ); + } + + // WebAssembly SIMD (the test of wasm-feature-detect): the faster core + function simd() { + try { + return WebAssembly.validate( + new Uint8Array([ + 0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, + 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11, + ]) + ); + } catch (e) { + return false; + } + } + + function loadScript(src) { + return new Promise(function (resolve, reject) { + if (window.Tesseract) return resolve(); + var s = document.createElement("script"); + s.src = src; + s.onload = function () { + resolve(); + }; + s.onerror = function () { + reject(new Error("could not load " + src)); + }; + document.head.appendChild(s); + }); + } + + // One worker per page, made at the first photo: the core (about 3 MB) and + // the model (about 1 MB) load once, then stay in the browser's cache. + function startReader(input) { + if (reader) return reader; + var vendor = input.getAttribute("data-vendor"); + var lang = input.getAttribute("data-lang"); + reader = loadScript(vendor + "/tesseract.min.js") + .then(function () { + return window.Tesseract.createWorker(lang, 1, { + workerPath: vendor + "/worker.min.js", + // a file of its own rather than the directory: the worker then + // fetches the .wasm beside it instead of a build with it inlined + corePath: + vendor + (simd() ? "/tesseract-core-simd-lstm.js" : "/tesseract-core-lstm.js"), + langPath: input.getAttribute("data-langpath"), + gzip: input.getAttribute("data-gzip") === "1", + cachePath: "visa-mrz-" + (input.getAttribute("data-model") || lang), + // a worker from a blob: URL would take the page's policy + workerBlobURL: false, + logger: function (m) { + onProgress(m); + }, + }); + }) + .then(function (w) { + return w + .setParameters({ tessedit_char_whitelist: ALPHABET }) + .then(function () { + return w; + }); + }); + reader.catch(function () { + reader = null; + }); + return reader; + } + + function viaImg(file) { + return new Promise(function (resolve, reject) { + var url = URL.createObjectURL(file); + var img = new Image(); + img.onload = function () { + URL.revokeObjectURL(url); + resolve(img); + }; + img.onerror = function () { + URL.revokeObjectURL(url); + reject(new Error("not a picture")); + }; + img.src = url; + }); + } + + // The picture upright as the camera's EXIF orientation says. + function loadImage(file) { + if (window.createImageBitmap) { + return createImageBitmap(file, { imageOrientation: "from-image" }).catch(function () { + return viaImg(file); + }); + } + return viaImg(file); + } + + function canvas(w, h) { + var c = document.createElement("canvas"); + c.width = Math.max(1, Math.round(w)); + c.height = Math.max(1, Math.round(h)); + return c; + } + + // The picture turned by quarter turns and `tilt` degrees more, and scaled + // to fit `max`. + function turned(src, w, h, quarter, max, tilt) { + var s = Math.min(1, max / Math.max(w, h)); + var side = quarter % 2 === 1; + var c = canvas(side ? h * s : w * s, side ? w * s : h * s); + var ctx = c.getContext("2d"); + ctx.fillStyle = "#fff"; + ctx.fillRect(0, 0, c.width, c.height); + ctx.translate(c.width / 2, c.height / 2); + ctx.rotate((quarter * Math.PI) / 2 + ((tilt || 0) * Math.PI) / 180); + ctx.drawImage(src, (-w * s) / 2, (-h * s) / 2, w * s, h * s); + return c; + } + + // Even light: each pixel against the mean of the square of radius `r` + // around it, so a shadow or a bright corner does not swallow the letters; + // ink becomes black, paper and its pattern white. + function flatten(c, r) { + var w = c.width; + var h = c.height; + var ctx = c.getContext("2d"); + var img = ctx.getImageData(0, 0, w, h); + var d = img.data; + var g = new Float32Array(w * h); + var i, p, x, y; + for (i = 0, p = 0; i < g.length; i++, p += 4) { + g[i] = 0.299 * d[p] + 0.587 * d[p + 1] + 0.114 * d[p + 2]; + } + var W = w + 1; + var sum = new Float64Array(W * (h + 1)); + for (y = 0; y < h; y++) { + var row = 0; + for (x = 0; x < w; x++) { + row += g[y * w + x]; + sum[(y + 1) * W + x + 1] = sum[y * W + x + 1] + row; + } + } + for (y = 0; y < h; y++) { + var y0 = Math.max(0, y - r); + var y1 = Math.min(h, y + r + 1); + for (x = 0; x < w; x++) { + var x0 = Math.max(0, x - r); + var x1 = Math.min(w, x + r + 1); + var mean = + (sum[y1 * W + x1] - sum[y0 * W + x1] - sum[y1 * W + x0] + sum[y0 * W + x0]) / + ((y1 - y0) * (x1 - x0)); + var ratio = g[y * w + x] / (mean + 1); + var v = ratio >= 0.95 ? 255 : Math.max(0, Math.min(255, (255 * (ratio - 0.5)) / 0.45)); + p = (y * w + x) * 4; + d[p] = d[p + 1] = d[p + 2] = v; + d[p + 3] = 255; + } + } + ctx.putImageData(img, 0, 0); + return c; + } + + // The lines found, with the pieces of one line joined: a shadow or a + // fold across the zone makes the reader see a line as several blocks. + function linesOf(data) { + var all = []; + (data.blocks || []).forEach(function (b) { + (b.paragraphs || []).forEach(function (p) { + (p.lines || []).forEach(function (l) { + all.push({ text: clean(l.text), bbox: l.bbox, baseline: l.baseline }); + }); + }); + }); + all.sort(function (a, b) { + return a.bbox.x0 - b.bbox.x0; + }); + var rows = []; + all.forEach(function (l) { + var h = l.bbox.y1 - l.bbox.y0; + var row = rows.find(function (r) { + var overlap = Math.min(r.bbox.y1, l.bbox.y1) - Math.max(r.bbox.y0, l.bbox.y0); + return ( + overlap > 0.5 * Math.min(h, r.bbox.y1 - r.bbox.y0) && + l.bbox.x0 - r.bbox.x1 < 3 * h && + l.bbox.x0 >= r.bbox.x1 - h + ); + }); + if (!row) { + rows.push({ + text: l.text, + bbox: { x0: l.bbox.x0, y0: l.bbox.y0, x1: l.bbox.x1, y1: l.bbox.y1 }, + baseline: l.baseline, + }); + return; + } + row.text += l.text; + row.bbox.y0 = Math.min(row.bbox.y0, l.bbox.y0); + row.bbox.y1 = Math.max(row.bbox.y1, l.bbox.y1); + row.bbox.x1 = Math.max(row.bbox.x1, l.bbox.x1); + }); + return rows; + } + + function clean(t) { + return (t || "") + .toUpperCase() + .replace(/«/g, "<<") + .replace(/[^A-Z0-9<]/g, ""); + } + + function count(s, re) { + var m = s.match(re); + return m ? m.length : 0; + } + + // A line that may belong to the zone: long, of filler or of digits. + function zoneLike(t) { + var c = clean(t); + return c.length >= 28 && (count(c, /= 2 || count(c, /[0-9]/g) >= 14); + } + + // The first line starts with P and holds names: filler, few digits. + function firstLine(t) { + var c = clean(t); + return /^.?P/.test(c) && count(c, /= 2 && count(c, /[0-9]/g) < 8; + } + + // The zone's lines among those found, lying across the picture: the + // first line (it starts with P) and the line below it, or the one there + // is. `sure` says whether the first line is among them. + function pickLines(lines) { + var z = lines + .filter(function (l) { + return zoneLike(l.text) && l.bbox.x1 - l.bbox.x0 > 2 * (l.bbox.y1 - l.bbox.y0); + }) + .sort(function (a, b) { + return a.bbox.y0 - b.bbox.y0; + }); + if (!z.length) return null; + for (var i = z.length - 1; i >= 0; i--) { + if (firstLine(z[i].text)) { + return { lines: z[i + 1] ? [z[i], z[i + 1]] : [z[i]], sure: true }; + } + } + return { lines: z.slice(-2), sure: false }; + } + + // The band of the zone cut from `base` (the turned picture; the lines + // were found at `scale` of it), levelled along the lines' baselines and + // scaled so a letter is LETTER pixels high. + function cutBand(lines, base, scale) { + var x0 = Infinity; + var y0 = Infinity; + var x1 = -Infinity; + var y1 = -Infinity; + var angle = 0; + var n = 0; + lines.forEach(function (l) { + x0 = Math.min(x0, l.bbox.x0); + y0 = Math.min(y0, l.bbox.y0); + x1 = Math.max(x1, l.bbox.x1); + y1 = Math.max(y1, l.bbox.y1); + var b = l.baseline; + if (b && b.x1 > b.x0) { + angle += Math.atan2(b.y1 - b.y0, b.x1 - b.x0); + n++; + } + }); + if (n) angle /= n; + var first = lines[0].bbox; + var lh = Math.max( + 6, + first.y1 - first.y0 - Math.abs(Math.sin(angle)) * (first.x1 - first.x0) + ); + if (lines.length === 1) { + // the other line lies below the first, above the second + if (firstLine(lines[0].text)) y1 += 1.8 * lh; + else y0 -= 1.8 * lh; + } + var cx = (x0 + x1) / 2 / scale; + var cy = (y0 + y1) / 2 / scale; + var bw = ((x1 - x0) * 1.08) / scale; + var bh = (y1 - y0 + 1.4 * lh) / scale; + var s = Math.min(LETTER / (lh / scale), 2600 / bw); + var c = canvas(bw * s, bh * s); + var ctx = c.getContext("2d"); + ctx.fillStyle = "#fff"; + ctx.fillRect(0, 0, c.width, c.height); + ctx.translate(c.width / 2, c.height / 2); + ctx.rotate(-angle); + ctx.scale(s, s); + ctx.translate(-cx, -cy); + ctx.drawImage(base, 0, 0); + return flatten(c, Math.round(1.5 * LETTER)); + } + + // How the picture is tried: as it came, the quarter turns, then slightly + // tilted either way (a long line on a tilted page breaks apart). + var TRIES = [ + [0, 0], + [1, 0], + [3, 0], + [2, 0], + [0, -7], + [0, 7], + ]; + + // The zone's lines in a picture of `w` by `h`, or null: those of the + // closer read first, then those of the first look. The server picks the + // two that make a zone, by their check digits. + async function readZone(worker, img, w, h, say, debug) { + var fallback = null; + for (var k = 0; k < TRIES.length; k++) { + say(k ? "Turning the photo..." : "Looking for the two lines..."); + var base = turned(img, w, h, TRIES[k][0], KEEP, TRIES[k][1]); + var look = turned(base, base.width, base.height, 0, LOOK); + var scale = look.width / base.width; + flatten(look, Math.max(8, Math.round(Math.min(look.width, look.height) / 16))); + await worker.setParameters({ tessedit_pageseg_mode: "3" }); + var first = await worker.recognize(look, {}, { text: true, blocks: true }); + var found = pickLines(linesOf(first.data)); + debug( + "try " + TRIES[k] + ": " + + (found ? found.lines.map(function (l) { return l.text; }).join(" / ") : "nothing") + ); + if (!found) continue; + say("Reading the two lines..."); + var lines = (await readBand(worker, cutBand(found.lines, base, scale))).concat( + found.lines.map(function (l) { + return l.text; + }) + ); + debug("lines: " + lines.join(" / ")); + if (found.sure) return lines; + fallback = fallback || lines; + } + return fallback; + } + + // The lines of a band that holds the zone, read as one block. + async function readBand(worker, band) { + await worker.setParameters({ tessedit_pageseg_mode: "6" }); + var r = await worker.recognize(band, {}, { text: true, blocks: true }); + return linesOf(r.data) + .map(function (l) { + return l.text; + }) + .filter(function (t) { + return t.length >= 20; + }); + } + + // Whether lines hold a zone: a first line and one with the digits. + function zoneIn(lines) { + return ( + lines.some(firstLine) && + lines.some(function (t) { + return count(t, /[0-9]/g) >= 10; + }) + ); + } + + // The share of near-white pixels: glare on the laminate. + function glare(c) { + var small = turned(c, c.width, c.height, 0, 400); + var d = small.getContext("2d").getImageData(0, 0, small.width, small.height).data; + var n = 0; + for (var p = 0; p < d.length; p += 4) { + if (d[p] > 248 && d[p + 1] > 248 && d[p + 2] > 248) n++; + } + return n / (d.length / 4); + } + + var NOT_FOUND = + "No passport lines found in this photo. Take it again with the two lines at the " + + "bottom of the photo page sharp, straight and without glare, or type them in."; + var GLARE = + "No passport lines found: there is glare on the photo. Take it again with the passport " + + "tilted a little or away from the lamp, or type the lines in."; + + // ---- the form: runs `work` (which gives the lines, or null) with the + // reader's status shown, then puts the lines in the zone's field and + // presses Read. + function run(form, wrap, work) { + var status = form.querySelector("[data-mrz-status]"); + var input = wrap.querySelector("input[data-mrz-photo]"); + var debug = input.hasAttribute("data-debug") + ? function (m) { + console.log("mrz: " + m); + } + : function () {}; + function say(text, state) { + if (!status) return; + status.textContent = text; + status.setAttribute("data-state", state || "busy"); + status.hidden = false; + } + onProgress = function (m) { + if (/^loading/.test(m.status) && m.progress < 1) { + say("Loading the reader (about 4 MB, the first time)..."); + } + }; + wrap.classList.add("busy"); + var started = Date.now(); + say("Loading the reader..."); + return startReader(input) + .then(function (worker) { + return work(worker, say, debug); + }) + .then(function (lines) { + debug("took " + (Date.now() - started) + " ms"); + if (typeof lines === "string") { + say(lines, "error"); + return; + } + form.querySelector("textarea[name=mrz]").value = lines.join("\n"); + var source = form.querySelector("input[name=mrz_source]"); + if (source) source.value = "photo"; + say("Read. Filling in the form...", "done"); + var read = form.querySelector("button[value=read-mrz]"); + if (form.requestSubmit) form.requestSubmit(read); + else read.click(); + }) + .catch(function (e) { + debug("error " + (e && e.stack ? e.stack : e)); + say( + "This browser could not read the photo (" + + (e && e.message ? e.message : e) + + "). Type the two lines in instead.", + "error" + ); + }) + .then(function () { + input.value = ""; + wrap.classList.remove("busy"); + }); + } + + // A picture chosen from the device. + function readPicture(form, wrap, file) { + return run(form, wrap, async function (worker, say, debug) { + var img = await loadImage(file); + var w = img.naturalWidth || img.width; + var h = img.naturalHeight || img.height; + var lines = await readZone(worker, img, w, h, say, debug); + if (lines) return lines; + return glare(turned(img, w, h, 0, 800)) > 0.01 ? GLARE : NOT_FOUND; + }); + } + + // ---- the camera view + + // The photo page is 125 by 88 mm; its zone is the band at the bottom. + var PAGE = 88 / 125; + var BAND = { x: 0.03, y: 0.7, w: 0.94, h: 0.27 }; + // the variance of the band's Laplacian below which it is not sharp yet, + // measured on the band scaled to 320 pixels across + var SHARP = 150; + + // What is wrong with the band in the picture, or "" when it looks + // readable: too dark, glare, no lines in it, or not sharp. + function judge(ctx, w, h) { + var d = ctx.getImageData(0, 0, w, h).data; + var g = new Float32Array(w * h); + var sum = 0; + var bright = 0; + for (var i = 0, p = 0; i < g.length; i++, p += 4) { + var v = 0.299 * d[p] + 0.587 * d[p + 1] + 0.114 * d[p + 2]; + g[i] = v; + sum += v; + if (v > 248) bright++; + } + var mean = sum / g.length; + var ink = 0; + for (i = 0; i < g.length; i++) if (g[i] < 0.6 * mean) ink++; + var s1 = 0; + var s2 = 0; + var n = 0; + for (var y = 1; y < h - 1; y++) { + for (var x = 1; x < w - 1; x++) { + var k = y * w + x; + var lap = 4 * g[k] - g[k - 1] - g[k + 1] - g[k - w] - g[k + w]; + s1 += lap; + s2 += lap * lap; + n++; + } + } + var sharp = n ? s2 / n - (s1 / n) * (s1 / n) : 0; + var m = { mean: Math.round(mean), glare: bright / g.length, ink: ink / g.length, sharp: Math.round(sharp) }; + if (mean < 50) return { why: "Too dark: find more light.", m: m }; + if (m.glare > 0.02) { + return { + why: "Glare on the two lines: tilt the passport a little, or turn away from the lamp.", + m: m, + }; + } + if (m.ink < 0.04) { + return { why: "Put the two lines at the bottom of the photo page into the yellow band.", m: m }; + } + if (sharp < SHARP) return { why: "Hold still: the lines are not sharp yet.", m: m }; + return { why: "", m: m }; + } + + function el(tag, cls, text) { + var e = document.createElement(tag); + if (cls) e.className = cls; + if (text) e.textContent = text; + return e; + } + + function cameraWorks() { + return !!( + window.isSecureContext && + navigator.mediaDevices && + navigator.mediaDevices.getUserMedia + ); + } + + // Opens the camera view over the page. Its photo goes to the reader; + // closing it, or the browser refusing the camera, leaves the form as it + // was. + async function openCamera(form, wrap, opener) { + var status = form.querySelector("[data-mrz-status]"); + var stream; + try { + stream = await navigator.mediaDevices.getUserMedia({ + audio: false, + video: { + facingMode: { ideal: "environment" }, + width: { ideal: 2560 }, + height: { ideal: 1440 }, + }, + }); + } catch (e) { + if (status) { + status.textContent = + "The camera is not available (" + + (e && e.name ? e.name : e) + + "). Choose a picture instead, or allow the camera in the browser's settings."; + status.setAttribute("data-state", "error"); + status.hidden = false; + } + return; + } + var root = el("div", "cam"); + root.setAttribute("role", "dialog"); + root.setAttribute("aria-modal", "true"); + root.setAttribute("aria-label", "Photo of the passport"); + var video = el("video", "cam-video"); + video.setAttribute("playsinline", ""); + video.muted = true; + var frame = el("div", "cam-frame"); + var band = el("div", "cam-band"); + band.appendChild(el("span", "", "the two lines")); + frame.appendChild(band); + var hint = el("p", "cam-hint", "Fit the photo page into the frame, the two lines into the yellow band."); + hint.setAttribute("role", "status"); + var bar = el("div", "cam-bar"); + var cancel = el("button", "btn", "Cancel"); + cancel.type = "button"; + var shot = el("button", "btn pri", "Take the photo"); + shot.type = "button"; + bar.appendChild(cancel); + bar.appendChild(shot); + root.appendChild(video); + root.appendChild(frame); + root.appendChild(hint); + root.appendChild(bar); + document.body.appendChild(root); + document.documentElement.classList.add("cam-open"); + + var box = null; + function layout() { + var W = root.clientWidth; + var H = root.clientHeight; + var room = bar.offsetHeight + hint.offsetHeight + 48; + var fw = Math.min(W * 0.92, ((H - room) * 0.92) / PAGE); + var fh = fw * PAGE; + var left = (W - fw) / 2; + var top = Math.max(12, (H - room - fh) / 2); + frame.style.left = left + "px"; + frame.style.top = top + "px"; + frame.style.width = fw + "px"; + frame.style.height = fh + "px"; + box = { W: W, H: H, left: left, top: top, fw: fw, fh: fh }; + } + // the frame in the video's own pixels (the video covers the view) + function inVideo() { + var vw = video.videoWidth; + var vh = video.videoHeight; + var s = Math.max(box.W / vw, box.H / vh); + var ox = (box.W - vw * s) / 2; + var oy = (box.H - vh * s) / 2; + return { x: (box.left - ox) / s, y: (box.top - oy) / s, w: box.fw / s, h: box.fh / s }; + } + + var timer = 0; + var good = 0; + var done = false; + var small = canvas(320, 80); + var sctx = small.getContext("2d", { willReadFrequently: true }); + function close() { + done = true; + clearTimeout(timer); + stream.getTracks().forEach(function (t) { + t.stop(); + }); + window.removeEventListener("resize", layout); + document.removeEventListener("keydown", onKey); + root.remove(); + document.documentElement.classList.remove("cam-open"); + if (opener) opener.focus(); + } + function onKey(ev) { + if (ev.key === "Escape") close(); + } + function take() { + if (done || !video.videoWidth) return; + var f = inVideo(); + var photo = canvas(video.videoWidth, video.videoHeight); + photo.getContext("2d").drawImage(video, 0, 0); + close(); + readShot(form, wrap, photo, f); + } + function check() { + if (done) return; + if (video.videoWidth && box) { + var f = inVideo(); + var bx = f.x + f.w * BAND.x; + var by = f.y + f.h * BAND.y; + var bw = f.w * BAND.w; + var bh = f.h * BAND.h; + small.height = Math.max(8, Math.round((bh * 320) / bw)); + sctx.drawImage(video, bx, by, bw, bh, 0, 0, 320, small.height); + var j = judge(sctx, 320, small.height); + hint.textContent = j.why || "Good. Hold still..."; + root.classList.toggle("good", !j.why); + root.setAttribute("data-measure", JSON.stringify(j.m)); + good = j.why ? 0 : good + 1; + // a steady, readable band for about a second takes the photo + if (good >= 4) { + take(); + return; + } + } + timer = setTimeout(check, 250); + } + cancel.addEventListener("click", close); + shot.addEventListener("click", take); + window.addEventListener("resize", layout); + document.addEventListener("keydown", onKey); + layout(); + video.srcObject = stream; + try { + await video.play(); + } catch (e) { + /* autoplay of a muted video is allowed; check() waits for frames */ + } + shot.focus(); + check(); + } + + // The camera's photo: the band where the frame showed it is read first; + // when that holds no zone, the whole frame is searched as a picture. + function readShot(form, wrap, photo, f) { + return run(form, wrap, async function (worker, say, debug) { + say("Reading the two lines..."); + // the band with room on every side: a page is never held exactly in + // the frame + var bx = Math.max(0, f.x - f.w * 0.06); + var by = Math.max(0, f.y + f.h * 0.6); + var bw = Math.min(photo.width - bx, f.w * 1.12); + var bh = Math.min(photo.height - by, f.h * 0.46); + // a letter of the zone is about 2.4 mm of the page's 88 + var s = Math.min(LETTER / ((f.h * 2.4) / 88), 2600 / bw); + var band = canvas(bw * s, bh * s); + var ctx = band.getContext("2d"); + ctx.fillStyle = "#fff"; + ctx.fillRect(0, 0, band.width, band.height); + ctx.drawImage(photo, bx, by, bw, bh, 0, 0, band.width, band.height); + var lines = await readBand(worker, flatten(band, Math.round(1.5 * LETTER))); + debug("band: " + lines.join(" / ")); + if (zoneIn(lines)) return lines; + // the page around the frame, with room for a page held off centre + var mx = f.w * 0.15; + var my = f.h * 0.15; + var x0 = Math.max(0, f.x - mx); + var y0 = Math.max(0, f.y - my); + var x1 = Math.min(photo.width, f.x + f.w + mx); + var y1 = Math.min(photo.height, f.y + f.h + my); + var page = canvas(x1 - x0, y1 - y0); + page.getContext("2d").drawImage(photo, x0, y0, x1 - x0, y1 - y0, 0, 0, page.width, page.height); + var found = await readZone(worker, page, page.width, page.height, say, debug); + if (found) return lines.concat(found); + return glare(page) > 0.01 ? GLARE : NOT_FOUND; + }); + } + + document.addEventListener("DOMContentLoaded", function () { + if (!supported()) return; + document.querySelectorAll("[data-mrz-photo-wrap]").forEach(function (wrap) { + wrap.hidden = false; + var cam = wrap.querySelector("[data-mrz-camera]"); + if (cam && !cameraWorks()) cam.hidden = true; + }); + }); + + document.addEventListener("click", function (ev) { + var b = ev.target.closest && ev.target.closest("[data-mrz-camera]"); + if (!b || !b.form) return; + var wrap = b.closest("[data-mrz-photo-wrap]"); + if (wrap.classList.contains("busy")) return; + openCamera(b.form, wrap, b); + }); + + document.addEventListener("change", function (ev) { + var input = ev.target; + if (!input || !input.matches || !input.matches("input[data-mrz-photo]")) return; + var file = input.files && input.files[0]; + var wrap = input.closest("[data-mrz-photo-wrap]"); + if (!file || !input.form || !wrap) return; + readPicture(input.form, wrap, file); + }); +})(); diff --git a/static/vendor/tesseract/LICENSE-mrz-model.txt b/static/vendor/tesseract/LICENSE-mrz-model.txt new file mode 100644 index 0000000..da36a5d --- /dev/null +++ b/static/vendor/tesseract/LICENSE-mrz-model.txt @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2019, DoubangoTelecom +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/tesseract/LICENSE-tesseract.js.txt b/static/vendor/tesseract/LICENSE-tesseract.js.txt new file mode 100644 index 0000000..8f71f43 --- /dev/null +++ b/static/vendor/tesseract/LICENSE-tesseract.js.txt @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/static/vendor/tesseract/README.txt b/static/vendor/tesseract/README.txt new file mode 100644 index 0000000..895db98 --- /dev/null +++ b/static/vendor/tesseract/README.txt @@ -0,0 +1,31 @@ +The passport photo reader (static/mrz-photo.js) runs these files in the +browser. They are served by the app itself, never from a CDN. + +tesseract.min.js, worker.min.js + tesseract.js 7.0.0, npm, files dist/ of + https://registry.npmjs.org/tesseract.js/-/tesseract.js-7.0.0.tgz + (sha512-exPBkd+z+wM1BuMkx/Bjv43OeLBxhL5kKWsz/9JY+DXcXdiBjiAch0V49QR3oAJqCaL5qURE0vx9Eo+G5YE7mA==) + Apache License 2.0, LICENSE-tesseract.js.txt. + +tesseract-core-simd-lstm.js/.wasm, tesseract-core-lstm.js/.wasm + tesseract.js-core 7.0.0 (Tesseract 5 built for WebAssembly), npm, + https://registry.npmjs.org/tesseract.js-core/-/tesseract.js-core-7.0.0.tgz + (sha512-WnNH518NzmbSq9zgTPeoF8c+xmilS8rFIl1YKbk/ptuuc7p6cLNELNuPAzcmsYw450ca6bLa8j3t0VAtq435Vw==) + Only the two builds for the LSTM engine: with SIMD, and without for + older browsers. Apache License 2.0, LICENSE-tesseract.js.txt. + +mrz.traineddata.gz + tessdata_fast/mrz.traineddata of https://github.com/DoubangoTelecom/tesseractMRZ + (sha256 ece2a54f125a73792f9cec74e6f8e62f6e5e00c7f19153ba865af689be5b5f01), a Tesseract 4 LSTM model trained + on MRZ lines, compressed with gzip. BSD 3-Clause, LICENSE-mrz-model.txt. + Chosen over Shreeshrii/tessdata_ocrb (ocrb_int) after both read the same + 28 photos and specimens: it matched more check digits. + +SHA-256 of the files: +df5b3b32c8a3213b3f256dbbfec3285fb6f14d4b987dc742c36b65f7a985cad5 mrz.traineddata.gz +6510efc4e8b45c5465df30679b9911ffe0071cd2ee982fa064e6f5136ef2de85 tesseract-core-lstm.js +66b17df6e20c5329a17ffa9c202a47eaa3e32500b253d4c7f38e7f2bc01457c3 tesseract-core-lstm.wasm +e48e2f02ddae3716c8dd24bf41cd290d4efa96892d689cdc4013c2545d63f469 tesseract-core-simd-lstm.js +34e8d50cac216427d86bf397d610fdd9f49492539bbcdfbfccc4eda20c810bea tesseract-core-simd-lstm.wasm +000c27d9cd0def655f77b36c72a389c0ab13793aa31cb4d7aab56d09c0afbc7e tesseract.min.js +576b7df7e3393e137e51849357c9adb53fe7ac1bb69bfa06cf3d61520f182c6d worker.min.js diff --git a/static/vendor/tesseract/mrz.traineddata.gz b/static/vendor/tesseract/mrz.traineddata.gz new file mode 100644 index 0000000..7bbb01c Binary files /dev/null and b/static/vendor/tesseract/mrz.traineddata.gz differ diff --git a/static/vendor/tesseract/tesseract-core-lstm.js b/static/vendor/tesseract/tesseract-core-lstm.js new file mode 100644 index 0000000..6cdede2 --- /dev/null +++ b/static/vendor/tesseract/tesseract-core-lstm.js @@ -0,0 +1,191 @@ +var TesseractCore=(()=>{var _scriptName=typeof document!="undefined"?document.currentScript?.src:undefined;return async function(moduleArg={}){var moduleRtn;var e=moduleArg,aa="object"==typeof window,ba="undefined"!=typeof WorkerGlobalScope,ca="object"==typeof process&&process.versions?.node&&"renderer"!=process.type,da="./this.program",ea=(a,b)=>{throw b;};"undefined"!=typeof __filename?_scriptName=__filename:ba&&(_scriptName=self.location.href);var fa="",ha,ia; +if(ca){var fs=require("fs");fa=__dirname+"/";ia=a=>{a=ja(a)?new URL(a):a;return fs.readFileSync(a)};ha=async a=>{a=ja(a)?new URL(a):a;return fs.readFileSync(a,void 0)};1{process.exitCode=a;throw b;}}else if(aa||ba){try{fa=(new URL(".",_scriptName)).href}catch{}ba&&(ia=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});ha=async a=> +{if(ja(a))return new Promise((c,d)=>{var f=new XMLHttpRequest;f.open("GET",a,!0);f.responseType="arraybuffer";f.onload=()=>{200==f.status||0==f.status&&f.response?c(f.response):d(f.status)};f.onerror=d;f.send(null)});var b=await fetch(a,{credentials:"same-origin"});if(b.ok)return b.arrayBuffer();throw Error(b.status+" : "+b.url);}}var ka=console.log.bind(console),la=console.error.bind(console),ma,na=!1,ja=a=>a.startsWith("file://"),oa,pa,qa,g,l,ra,n,p,sa,ta,ua,va=!1; +function wa(){var a=qa.buffer;g=new Int8Array(a);ra=new Int16Array(a);l=new Uint8Array(a);new Uint16Array(a);n=new Int32Array(a);p=new Uint32Array(a);sa=new Float32Array(a);ta=new Float64Array(a);ua=new BigInt64Array(a);new BigUint64Array(a)}function r(a){e.onAbort?.(a);a="Aborted("+a+")";la(a);na=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");pa?.(a);throw a;}var xa; +async function ya(a){if(!ma)try{var b=await ha(a);return new Uint8Array(b)}catch{}if(a==xa&&ma)a=new Uint8Array(ma);else if(ia)a=ia(a);else throw"both async and sync fetching of the wasm failed";return a}async function za(a,b){try{var c=await ya(a);return await WebAssembly.instantiate(c,b)}catch(d){la(`failed to asynchronously prepare wasm: ${d}`),r(d)}} +async function Aa(a){var b=xa;if(!ma&&!ja(b)&&!ca)try{var c=fetch(b,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(c,a)}catch(d){la(`wasm streaming compile failed: ${d}`),la("falling back to ArrayBuffer instantiation")}return za(b,a)}class Ba{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`;this.status=a}}var Ca=a=>{for(;0{var a=e.preRun.shift();Ea.push(a)}; +function Ga(a,b="i8"){b.endsWith("*")&&(b="*");switch(b){case "i1":return g[a];case "i8":return g[a];case "i16":return ra[a>>1];case "i32":return n[a>>2];case "i64":return ua[a>>3];case "float":return sa[a>>2];case "double":return ta[a>>3];case "*":return p[a>>2];default:r(`invalid type for getValue: ${b}`)}}var Ha=!0; +function Ia(a,b,c="i8"){c.endsWith("*")&&(c="*");switch(c){case "i1":g[a]=b;break;case "i8":g[a]=b;break;case "i16":ra[a>>1]=b;break;case "i32":n[a>>2]=b;break;case "i64":ua[a>>3]=BigInt(b);break;case "float":sa[a>>2]=b;break;case "double":ta[a>>3]=b;break;case "*":p[a>>2]=b;break;default:r(`invalid type for setValue: ${c}`)}} +var Ja="undefined"!=typeof TextDecoder?new TextDecoder:void 0,v=(a,b=0)=>{var c=b;for(var d=c+void 0;a[c]&&!(c>=d);)++c;if(16f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d}, +w=a=>a?v(l,a):"";class Ka{constructor(a){this.Df=a-24}hg(a,b){p[this.Df+16>>2]=0;p[this.Df+4>>2]=a;p[this.Df+8>>2]=b}} +var La=0,Ma=0,Qa=()=>{var a=n[+Pa>>2];Pa+=4;return a},Ra=(a,b)=>{for(var c=0,d=a.length-1;0<=d;d--){var f=a[d];"."===f?a.splice(d,1):".."===f?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a},Sa=a=>{var b="/"===a.charAt(0),c="/"===a.slice(-1);(a=Ra(a.split("/").filter(d=>!!d),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},Ta=a=>{var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return"."; +b&&=b.slice(0,-1);return a+b},Ua=a=>a&&a.match(/([^\/]+|\/)\/*$/)[1],Va=(a,b)=>Sa(a+"/"+b),Wa=()=>{if(ca){var a=require("crypto");return b=>a.randomFillSync(b)}return b=>crypto.getRandomValues(b)},Ya=a=>{(Ya=Wa())(a)},Za=(...a)=>{for(var b="",c=!1,d=a.length-1;-1<=d&&!c;d--){c=0<=d?a[d]:x.cwd();if("string"!=typeof c)throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";b=c+"/"+b;c="/"===c.charAt(0)}b=Ra(b.split("/").filter(f=>!!f),!c).join("/");return(c?"/":"")+b||"."},$a= +(a,b)=>{function c(k){for(var m=0;mu?[]:k.slice(m,u-m+1)}a=Za(a).slice(1);b=Za(b).slice(1);a=c(a.split("/"));b=c(b.split("/"));for(var d=Math.min(a.length,b.length),f=d,h=0;h{for(var b=0,c=0;c=d?b++:2047>=d?b+=2:55296<=d&&57343>=d?(b+=4,++c):b+=3}return b}, +cb=(a,b,c,d)=>{if(!(0=k){if(c>=d)break;b[c++]=k}else if(2047>=k){if(c+1>=d)break;b[c++]=192|k>>6;b[c++]=128|k&63}else if(65535>=k){if(c+2>=d)break;b[c++]=224|k>>12;b[c++]=128|k>>6&63;b[c++]=128|k&63}else{if(c+3>=d)break;b[c++]=240|k>>18;b[c++]=128|k>>12&63;b[c++]=128|k>>6&63;b[c++]=128|k&63;h++}}b[c]=0;return c-f},db=(a,b)=>{var c=Array(bb(a)+1);a=cb(a,c,0,c.length);b&&(c.length=a);return c},eb=[]; +function fb(a,b){eb[a]={input:[],output:[],Xf:b};gb(a,hb)} +var hb={open(a){var b=eb[a.node.rdev];if(!b)throw new x.Ef(43);a.tty=b;a.seekable=!1},close(a){a.tty.Xf.fsync(a.tty)},fsync(a){a.tty.Xf.fsync(a.tty)},read(a,b,c,d){if(!a.tty||!a.tty.Xf.Fg)throw new x.Ef(60);for(var f=0,h=0;h{a=65536*Math.ceil(a/65536);var b=kb(65536,a);b&&l.fill(0,b,b+a);return b}, +y={Tf:null,Kf(){return y.createNode(null,"/",16895,0)},createNode(a,b,c,d){if(24576===(c&61440)||x.isFIFO(c))throw new x.Ef(63);y.Tf||(y.Tf={dir:{node:{Pf:y.Ff.Pf,Rf:y.Ff.Rf,lookup:y.Ff.lookup,Wf:y.Ff.Wf,rename:y.Ff.rename,unlink:y.Ff.unlink,rmdir:y.Ff.rmdir,readdir:y.Ff.readdir,symlink:y.Ff.symlink},stream:{Nf:y.Gf.Nf}},file:{node:{Pf:y.Ff.Pf,Rf:y.Ff.Rf},stream:{Nf:y.Gf.Nf,read:y.Gf.read,write:y.Gf.write,bg:y.Gf.bg,eg:y.Gf.eg}},link:{node:{Pf:y.Ff.Pf,Rf:y.Ff.Rf,readlink:y.Ff.readlink},stream:{}}, +Bg:{node:{Pf:y.Ff.Pf,Rf:y.Ff.Rf},stream:x.Pg}});c=x.createNode(a,b,c,d);z(c.mode)?(c.Ff=y.Tf.dir.node,c.Gf=y.Tf.dir.stream,c.Hf={}):x.isFile(c.mode)?(c.Ff=y.Tf.file.node,c.Gf=y.Tf.file.stream,c.Mf=0,c.Hf=null):40960===(c.mode&61440)?(c.Ff=y.Tf.link.node,c.Gf=y.Tf.link.stream):8192===(c.mode&61440)&&(c.Ff=y.Tf.Bg.node,c.Gf=y.Tf.Bg.stream);c.atime=c.mtime=c.ctime=Date.now();a&&(a.Hf[b]=c,a.atime=a.mtime=a.ctime=c.atime);return c},Nh(a){return a.Hf?a.Hf.subarray?a.Hf.subarray(0,a.Mf):new Uint8Array(a.Hf): +new Uint8Array(0)},Ff:{Pf(a){var b={};b.dev=8192===(a.mode&61440)?a.id:1;b.ino=a.id;b.mode=a.mode;b.nlink=1;b.uid=0;b.gid=0;b.rdev=a.rdev;z(a.mode)?b.size=4096:x.isFile(a.mode)?b.size=a.Mf:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.atime=new Date(a.atime);b.mtime=new Date(a.mtime);b.ctime=new Date(a.ctime);b.blksize=4096;b.blocks=Math.ceil(b.size/b.blksize);return b},Rf(a,b){for(var c of["mode","atime","mtime","ctime"])null!=b[c]&&(a[c]=b[c]);void 0!==b.size&&(b=b.size,a.Mf!=b&&(0==b? +(a.Hf=null,a.Mf=0):(c=a.Hf,a.Hf=new Uint8Array(b),c&&a.Hf.set(c.subarray(0,Math.min(b,a.Mf))),a.Mf=b)))},lookup(){y.lg||(y.lg=new x.Ef(44),y.lg.stack="");throw y.lg;},Wf(a,b,c,d){return y.createNode(a,b,c,d)},rename(a,b,c){try{var d=mb(b,c)}catch(h){}if(d){if(z(a.mode))for(var f in d.Hf)throw new x.Ef(55);nb(d)}delete a.parent.Hf[a.name];b.Hf[c]=a;a.name=c;b.ctime=b.mtime=a.parent.ctime=a.parent.mtime=Date.now()},unlink(a,b){delete a.Hf[b];a.ctime=a.mtime=Date.now()},rmdir(a, +b){var c=mb(a,b),d;for(d in c.Hf)throw new x.Ef(55);delete a.Hf[b];a.ctime=a.mtime=Date.now()},readdir(a){return[".","..",...Object.keys(a.Hf)]},symlink(a,b,c){a=y.createNode(a,b,41471,0);a.link=c;return a},readlink(a){if(40960!==(a.mode&61440))throw new x.Ef(28);return a.link}},Gf:{read(a,b,c,d,f){var h=a.node.Hf;if(f>=a.node.Mf)return 0;a=Math.min(a.node.Mf-f,d);if(8=h||(h=Math.max(h,k*(1048576>k?2:1.125)>>>0),0!=k&&(h=Math.max(h,256)),k=a.Hf,a.Hf=new Uint8Array(h),0b)throw new x.Ef(28);return b},bg(a,b,c,d,f){if(!x.isFile(a.node.mode))throw new x.Ef(43);a=a.node.Hf;if(f&2||!a||a.buffer!==g.buffer){d=!0;f=lb(b);if(!f)throw new x.Ef(48);if(a){if(0{var c=0;a&&(c|=365);b&&(c|=146);return c},pb=async a=>{a=await ha(a);return new Uint8Array(a)},qb=0,rb=null,sb=()=>{qb--;e.monitorRunDependencies?.(qb);if(0==qb&&rb){var a=rb;rb=null;a()}},tb=()=>{qb++;e.monitorRunDependencies?.(qb)},ub=[],vb=async(a,b)=>{"undefined"!=typeof Browser&&Browser.hg();for(var c of ub)if(c.canHandle(b))return c.handle(a,b);return a},xb=async(a,b,c,d,f,h,k,m)=>{var u=b?Za(Sa(a+"/"+b)):a,t=`cp ${u}`;tb(t);try{var C=c;"string"==typeof c&&(C=await pb(c));C=await vb(C, +u);m?.();h||wb(a,b,C,d,f,k)}finally{sb(t)}};function gb(a,b){x.Dg[a]={Gf:b}}function z(a){return 16384===(a&61440)}function mb(a,b){var c=z(a.mode)?(c=yb(a,"x"))?c:a.Ff.lookup?0:2:54;if(c)throw new x.Ef(c);for(c=x.Sf[zb(a.id,b)];c;c=c.cg){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return x.lookup(a,b)}function nb(a){var b=zb(a.parent.id,a.name);if(x.Sf[b]===a)x.Sf[b]=a.cg;else for(b=x.Sf[b];b;){if(b.cg===a){b.cg=a.cg;break}b=b.cg}} +function wb(a,b,c,d,f,h){var k=b;a&&(a="string"==typeof a?a:Ab(a),k=b?Sa(a+"/"+b):a);a=ob(d,f);k=x.create(k,a);if(c){if("string"==typeof c){b=Array(c.length);d=0;for(f=c.length;dc;c++){a=a.split("/").filter(m=>!!m);for(var d=x.root,f="/",h=0;h>>0)%x.Sf.length}function Bb(a){var b=zb(a.parent.id,a.name);a.cg=x.Sf[b];x.Sf[b]=a} +function Cb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}function yb(a,b){if(x.Gg)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function Db(a,b){if(!z(a.mode))return 54;try{return mb(a,b),20}catch(c){}return yb(a,"wx")} +function Eb(a,b,c){try{var d=mb(a,b)}catch(f){return f.Lf}if(a=yb(a,"wx"))return a;if(c){if(!z(d.mode))return 54;if(x.tg(d)||Ab(d)===x.cwd())return 10}else if(z(d.mode))return 31;return 0}function Fb(a,b){if(!a)throw new x.Ef(b);return a}function B(a){a=x.Tg(a);if(!a)throw new x.Ef(8);return a}function Gb(a,b=-1){a=Object.assign(new x.Mg,a);if(-1==b)a:{for(b=0;b<=x.Og;b++)if(!x.streams[b])break a;throw new x.Ef(33);}a.fd=b;return x.streams[b]=a} +function Hb(a,b=-1){a=Gb(a,b);a.Gf?.Hh?.(a);return a}function Ib(a,b,c){var d=a?.Gf.Rf;a=d?a:b;d??=b.Ff.Rf;Fb(d,63);d(a,c)}function Jb(a){var b=[];for(a=[a];a.length;){var c=a.pop();b.push(c);a.push(...c.fg)}return b}function Kb(a){var b={zh:4096,Kh:4096,blocks:1E6,yh:5E5,xh:5E5,files:x.vg,Ih:x.vg-1,Lh:42,flags:2,Qh:255};a.Ff.Jg&&Object.assign(b,a.Ff.Jg(a.Kf.vh.root));return b}function Lb(a,b,c){"undefined"==typeof c&&(c=b,b=438);return x.Wf(a,b|8192,c)} +function Mb(a,b,c,d){Ib(a,b,{mode:c&4095|b.mode&-4096,ctime:Date.now(),Eg:d})}function Nb(a,b,c){if(z(b.mode))throw new x.Ef(31);if(!x.isFile(b.mode))throw new x.Ef(28);var d=yb(b,"w");if(d)throw new x.Ef(d);Ib(a,b,{size:c,timestamp:Date.now()})}function Ob(a,b){a="string"==typeof a?a:Ab(a);for(b=b.split("/").reverse();b.length;){var c=b.pop();if(c){var d=Sa(a+"/"+c);try{x.mkdir(d)}catch(f){if(20!=f.Lf)throw f;}a=d}}return d} +function Pb(a,b,c,d){a="string"==typeof a?a:Ab(a);b=Sa(a+"/"+b);return x.create(b,ob(c,d))}function Qb(a){if(!(a.sh||a.th||a.link||a.Hf))if("undefined"!=typeof XMLHttpRequest)r("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");else try{a.Hf=ia(a.url)}catch(b){throw new x.Ef(29);}} +function Rb(a,b,c,d,f){function h(q,K,X,Y,W){q=q.node.Hf;if(W>=q.length)return 0;Y=Math.min(q.length-W,Y);if(q.slice)for(var U=0;Uthis.length-1||0>q)){var K=q%this.chunkSize;return this.jg(q/this.chunkSize|0)[K]}}Ng(q){this.jg=q}zg(){var q=new XMLHttpRequest;q.open("HEAD",c,!1);q.send(null);200<=q.status&&300>q.status||304===q.status||r("Couldn't load "+c+". Status: "+q.status); +var K=Number(q.getResponseHeader("Content-length")),X,Y=(X=q.getResponseHeader("Accept-Ranges"))&&"bytes"===X;q=(X=q.getResponseHeader("Content-Encoding"))&&"gzip"===X;var W=1048576;Y||(W=K);var U=this;U.Ng(Na=>{var Xa=Na*W,Oa=(Na+1)*W-1;Oa=Math.min(Oa,K-1);if("undefined"==typeof U.Uf[Na]){var li=U.Uf;Xa>Oa&&r("invalid range ("+Xa+", "+Oa+") or no bytes requested!");Oa>K-1&&r("only "+K+" bytes available! programmer error!");var Z=new XMLHttpRequest;Z.open("GET",c,!1);K!==W&&Z.setRequestHeader("Range", +"bytes="+Xa+"-"+Oa);Z.responseType="arraybuffer";Z.overrideMimeType&&Z.overrideMimeType("text/plain; charset=x-user-defined");Z.send(null);200<=Z.status&&300>Z.status||304===Z.status||r("Couldn't load "+c+". Status: "+Z.status);Xa=void 0!==Z.response?new Uint8Array(Z.response||[]):db(Z.responseText||"",!0);li[Na]=Xa}"undefined"==typeof U.Uf[Na]&&r("doXHR failed!");return U.Uf[Na]});if(q||!K)W=K=1,W=K=this.jg(0).length,ka("LazyFiles on gzip forces download of the whole file when length is accessed"); +this.yg=K;this.xg=W;this.kg=!0}get length(){this.kg||this.zg();return this.yg}get chunkSize(){this.kg||this.zg();return this.xg}}if("undefined"!=typeof XMLHttpRequest){ba||r("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var m=new k;var u=void 0}else u=c,m=void 0;var t=Pb(a,b,d,f);m?t.Hf=m:u&&(t.Hf=null,t.url=u);Object.defineProperties(t,{Mf:{get:function(){return this.Hf.length}}});var C={};Object.keys(t.Gf).forEach(q=>{var K= +t.Gf[q];C[q]=(...X)=>{Qb(t);return K(...X)}});C.read=(q,K,X,Y,W)=>{Qb(t);return h(q,K,X,Y,W)};C.bg=(q,K,X)=>{Qb(t);var Y=lb(K);if(!Y)throw new x.Ef(48);h(q,g,Y,K,X);return{Df:Y,Ag:!0}};t.Gf=C;return t} +var x={root:null,fg:[],Dg:{},streams:[],vg:1,Sf:null,Cg:"/",rg:!1,Gg:!0,Rg:null,ig:0,Ig:{},Ef:class{name="ErrnoError";constructor(a){this.Lf=a}},Mg:class{Uf={};node=null;get object(){return this.node}set object(a){this.node=a}get flags(){return this.Uf.flags}set flags(a){this.Uf.flags=a}get position(){return this.Uf.position}set position(a){this.Uf.position=a}},Lg:class{Ff={};Gf={};Qf=null;constructor(a,b,c,d){a||=this;this.parent=a;this.Kf=a.Kf;this.id=x.vg++;this.name=b;this.mode=c;this.rdev=d; +this.atime=this.mtime=this.ctime=Date.now()}get read(){return 365===(this.mode&365)}set read(a){a?this.mode|=365:this.mode&=-366}get write(){return 146===(this.mode&146)}set write(a){a?this.mode|=146:this.mode&=-147}get th(){return z(this.mode)}get sh(){return 8192===(this.mode&61440)}},createNode(a,b,c,d){a=new x.Lg(a,b,c,d);Bb(a);return a},tg(a){return a===a.parent},isFile(a){return 32768===(a&61440)},isFIFO(a){return 4096===(a&61440)},isSocket(a){return 49152===(a&49152)},Og:4096,Tg:a=>x.streams[a], +Pg:{open(a){a.Gf=x.Sg(a.node.rdev).Gf;a.Gf.open?.(a)},Nf(){throw new x.Ef(70);}},ug:a=>a>>8,Oh:a=>a&255,ag:(a,b)=>a<<8|b,Sg:a=>x.Dg[a],Kg(a,b){function c(k){x.ig--;return b(k)}function d(k){if(k){if(!d.Qg)return d.Qg=!0,c(k)}else++h>=f.length&&c(null)}"function"==typeof a&&(b=a,a=!1);x.ig++;1{if(!k.type.Kg)return d(null);k.type.Kg(k,a,d)})},Kf(a,b,c){var d="/"=== +c;if(d&&x.root)throw new x.Ef(10);if(!d&&c){var f=A(c,{gg:!1});c=f.path;f=f.node;if(f.Qf)throw new x.Ef(10);if(!z(f.mode))throw new x.Ef(54);}b={type:a,vh:b,Hg:c,fg:[]};a=a.Kf(b);a.Kf=b;b.root=a;d?x.root=a:f&&(f.Qf=b,f.Kf&&f.Kf.fg.push(b));return a},Uh(a){a=A(a,{gg:!1});if(!a.node.Qf)throw new x.Ef(28);a=a.node;var b=a.Qf,c=Jb(b);Object.keys(x.Sf).forEach(d=>{for(d=x.Sf[d];d;){var f=d.cg;c.includes(d.Kf)&&nb(d);d=f}});a.Qf=null;a.Kf.fg.splice(a.Kf.fg.indexOf(b),1)},lookup(a,b){return a.Ff.lookup(a, +b)},Wf(a,b,c){var d=A(a,{parent:!0}).node;a=Ua(a);if(!a)throw new x.Ef(28);if("."===a||".."===a)throw new x.Ef(20);var f=Db(d,a);if(f)throw new x.Ef(f);if(!d.Ff.Wf)throw new x.Ef(63);return d.Ff.Wf(d,a,b,c)},Jg(a){return Kb(A(a,{Of:!0}).node)},Th(a){return Kb(a.node)},create(a,b=438){return x.Wf(a,b&4095|32768,0)},mkdir(a,b=511){return x.Wf(a,b&1023|16384,0)},Ph(a,b){var c=a.split("/"),d="",f;for(f of c)if(f){if(d||"/"===a.charAt(0))d+="/";d+=f;try{x.mkdir(d,b)}catch(h){if(20!=h.Lf)throw h;}}},symlink(a, +b){if(!Za(a))throw new x.Ef(44);var c=A(b,{parent:!0}).node;if(!c)throw new x.Ef(44);b=Ua(b);var d=Db(c,b);if(d)throw new x.Ef(d);if(!c.Ff.symlink)throw new x.Ef(63);return c.Ff.symlink(c,b,a)},rename(a,b){var c=Ta(a),d=Ta(b),f=Ua(a),h=Ua(b);var k=A(a,{parent:!0});var m=k.node;k=A(b,{parent:!0});k=k.node;if(!m||!k)throw new x.Ef(44);if(m.Kf!==k.Kf)throw new x.Ef(75);var u=mb(m,f);a=$a(a,d);if("."!==a.charAt(0))throw new x.Ef(28);a=$a(b,c);if("."!==a.charAt(0))throw new x.Ef(55);try{var t=mb(k,h)}catch(C){}if(u!== +t){b=z(u.mode);if(f=Eb(m,f,b))throw new x.Ef(f);if(f=t?Eb(k,h,b):Db(k,h))throw new x.Ef(f);if(!m.Ff.rename)throw new x.Ef(63);if(u.Qf||t&&t.Qf)throw new x.Ef(10);if(k!==m&&(f=yb(m,"w")))throw new x.Ef(f);nb(u);try{m.Ff.rename(u,k,h),u.parent=k}catch(C){throw C;}finally{Bb(u)}}},rmdir(a){var b=A(a,{parent:!0}).node;a=Ua(a);var c=mb(b,a),d=Eb(b,a,!0);if(d)throw new x.Ef(d);if(!b.Ff.rmdir)throw new x.Ef(63);if(c.Qf)throw new x.Ef(10);b.Ff.rmdir(b,a);nb(c)},readdir(a){a=A(a,{Of:!0}).node;return Fb(a.Ff.readdir, +54)(a)},unlink(a){var b=A(a,{parent:!0}).node;if(!b)throw new x.Ef(44);a=Ua(a);var c=mb(b,a),d=Eb(b,a,!1);if(d)throw new x.Ef(d);if(!b.Ff.unlink)throw new x.Ef(63);if(c.Qf)throw new x.Ef(10);b.Ff.unlink(b,a);nb(c)},readlink(a){a=A(a).node;if(!a)throw new x.Ef(44);if(!a.Ff.readlink)throw new x.Ef(28);return a.Ff.readlink(a)},stat(a,b){a=A(a,{Of:!b}).node;return Fb(a.Ff.Pf,63)(a)},fstat(a){var b=B(a);a=b.node;var c=b.Gf.Pf;b=c?b:a;c??=a.Ff.Pf;Fb(c,63);return c(b)},lstat(a){return x.stat(a,!0)},chmod(a, +b,c){a="string"==typeof a?A(a,{Of:!c}).node:a;Mb(null,a,b,c)},lchmod(a,b){x.chmod(a,b,!0)},fchmod(a,b){a=B(a);Mb(a,a.node,b,!1)},chown(a,b,c,d){a="string"==typeof a?A(a,{Of:!d}).node:a;Ib(null,a,{timestamp:Date.now(),Eg:d})},lchown(a,b,c){x.chown(a,b,c,!0)},fchown(a){a=B(a);Ib(a,a.node,{timestamp:Date.now(),Eg:!1})},truncate(a,b){if(0>b)throw new x.Ef(28);a="string"==typeof a?A(a,{Of:!0}).node:a;Nb(null,a,b)},Mh(a,b){a=B(a);if(0>b||0===(a.flags&2097155))throw new x.Ef(28);Nb(a,a.node,b)},Vh(a,b,c){a= +A(a,{Of:!0}).node;Fb(a.Ff.Rf,63)(a,{atime:b,mtime:c})},open(a,b,c=438){if(""===a)throw new x.Ef(44);if("string"==typeof b){var d={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[b];if("undefined"==typeof d)throw Error(`Unknown file open mode: ${b}`);b=d}c=b&64?c&4095|32768:0;if("object"==typeof a)d=a;else{var f=a.endsWith("/");a=A(a,{Of:!(b&131072),uh:!0});d=a.node;a=a.path}var h=!1;if(b&64)if(d){if(b&128)throw new x.Ef(20);}else{if(f)throw new x.Ef(31);d=x.Wf(a,c|511,0);h=!0}if(!d)throw new x.Ef(44); +8192===(d.mode&61440)&&(b&=-513);if(b&65536&&!z(d.mode))throw new x.Ef(54);if(!h&&(f=d?40960===(d.mode&61440)?32:z(d.mode)&&("r"!==Cb(b)||b&576)?31:yb(d,Cb(b)):44))throw new x.Ef(f);b&512&&!h&&x.truncate(d,0);b&=-131713;f=Gb({node:d,path:Ab(d),flags:b,seekable:!0,position:0,Gf:d.Gf,wh:[],error:!1});f.Gf.open&&f.Gf.open(f);h&&x.chmod(d,c&511);!e.logReadFiles||b&1||a in x.Ig||(x.Ig[a]=1);return f},close(a){if(null===a.fd)throw new x.Ef(8);a.qg&&(a.qg=null);try{a.Gf.close&&a.Gf.close(a)}catch(b){throw b; +}finally{x.streams[a.fd]=null}a.fd=null},Nf(a,b,c){if(null===a.fd)throw new x.Ef(8);if(!a.seekable||!a.Gf.Nf)throw new x.Ef(70);if(0!=c&&1!=c&&2!=c)throw new x.Ef(28);a.position=a.Gf.Nf(a,b,c);a.wh=[];return a.position},read(a,b,c,d,f){if(0>d||0>f)throw new x.Ef(28);if(null===a.fd)throw new x.Ef(8);if(1===(a.flags&2097155))throw new x.Ef(8);if(z(a.node.mode))throw new x.Ef(31);if(!a.Gf.read)throw new x.Ef(28);var h="undefined"!=typeof f;if(!h)f=a.position;else if(!a.seekable)throw new x.Ef(70);b= +a.Gf.read(a,b,c,d,f);h||(a.position+=b);return b},write(a,b,c,d,f,h){if(0>d||0>f)throw new x.Ef(28);if(null===a.fd)throw new x.Ef(8);if(0===(a.flags&2097155))throw new x.Ef(8);if(z(a.node.mode))throw new x.Ef(31);if(!a.Gf.write)throw new x.Ef(28);a.seekable&&a.flags&1024&&x.Nf(a,0,2);var k="undefined"!=typeof f;if(!k)f=a.position;else if(!a.seekable)throw new x.Ef(70);b=a.Gf.write(a,b,c,d,f,h);k||(a.position+=b);return b},bg(a,b,c,d,f){if(0!==(d&2)&&0===(f&2)&&2!==(a.flags&2097155))throw new x.Ef(2); +if(1===(a.flags&2097155))throw new x.Ef(2);if(!a.Gf.bg)throw new x.Ef(43);if(!b)throw new x.Ef(28);return a.Gf.bg(a,b,c,d,f)},eg(a,b,c,d,f){return a.Gf.eg?a.Gf.eg(a,b,c,d,f):0},sg(a,b,c){if(!a.Gf.sg)throw new x.Ef(59);return a.Gf.sg(a,b,c)},readFile(a,b={}){b.flags=b.flags||0;b.encoding=b.encoding||"binary";"utf8"!==b.encoding&&"binary"!==b.encoding&&r(`Invalid encoding type "${b.encoding}"`);var c=x.open(a,b.flags);a=x.stat(a).size;var d=new Uint8Array(a);x.read(c,d,0,a,0);"utf8"===b.encoding&&(d= +v(d));x.close(c);return d},writeFile(a,b,c={}){c.flags=c.flags||577;a=x.open(a,c.flags,c.mode);"string"==typeof b&&(b=new Uint8Array(db(b,!0)));ArrayBuffer.isView(b)?x.write(a,b,0,b.byteLength,void 0,c.Fh):r("Unsupported data type");x.close(a)},cwd:()=>x.Cg,chdir(a){a=A(a,{Of:!0});if(null===a.node)throw new x.Ef(44);if(!z(a.node.mode))throw new x.Ef(54);var b=yb(a.node,"x");if(b)throw new x.Ef(b);x.Cg=a.path},hg(a,b,c){x.rg=!0;a??=e.stdin;b??=e.stdout;c??=e.stderr;a?x.Yf("/dev","stdin",a):x.symlink("/dev/tty", +"/dev/stdin");b?x.Yf("/dev","stdout",null,b):x.symlink("/dev/tty","/dev/stdout");c?x.Yf("/dev","stderr",null,c):x.symlink("/dev/tty1","/dev/stderr");x.open("/dev/stdin",0);x.open("/dev/stdout",1);x.open("/dev/stderr",1)},Sh(){x.rg=!1;for(var a of x.streams)a&&x.close(a)},Jh(a,b){try{var c=A(a,{Of:!b});a=c.path}catch(h){}var d=!1,f=null;try{c=A(a,{parent:!0}),Ua(a),c=A(a,{Of:!b}),d=!0,f=c.node}catch(h){}return d?f:null},Yf(a,b,c,d){a=Va("string"==typeof a?a:Ab(a),b);b=ob(!!c,!!d);var f;(f=x.Yf).ug?? +(f.ug=64);f=x.ag(x.Yf.ug++,0);gb(f,{open(h){h.seekable=!1},close(){d?.buffer?.length&&d(10)},read(h,k,m,u){for(var t=0,C=0;C>2]=b.dev;p[a+4>>2]=b.mode;p[a+8>>2]=b.nlink;p[a+12>>2]=b.uid;p[a+16>>2]=b.gid;p[a+20>>2]=b.rdev;ua[a+24>>3]=BigInt(b.size);n[a+32>>2]=4096;n[a+36>>2]=b.blocks;var c=b.atime.getTime(),d=b.mtime.getTime(),f=b.ctime.getTime();ua[a+40>>3]=BigInt(Math.floor(c/1E3));p[a+48>>2]=c%1E3*1E6;ua[a+56>>3]=BigInt(Math.floor(d/1E3));p[a+64>>2]=d%1E3*1E6;ua[a+72>>3]=BigInt(Math.floor(f/1E3));p[a+80>>2]=f%1E3*1E6;ua[a+88>>3]=BigInt(b.ino);return 0} +var Pa=void 0,Ub=a=>0===a%4&&(0!==a%100||0===a%400),Vb=[0,31,60,91,121,152,182,213,244,274,305,335],Wb=[0,31,59,90,120,151,181,212,243,273,304,334],Xb=[],Yb={},$b=()=>{if(!Zb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.language||"C").replace("-","_")+".UTF-8",_:da||"./this.program"},b;for(b in Yb)void 0===Yb[b]?delete a[b]:a[b]=Yb[b];var c=[];for(b in a)c.push(`${b}=${a[b]}`);Zb=c}return Zb},Zb,ac=[],bc,cc=a=>{var b= +ac[a];b||(ac[a]=b=bc.get(a));return b};x.Gh=(a,b,c,d,f,h,k,m,u,t)=>{xb(a,b,c,d,f,m,u,t).then(h).catch(k)};x.Rh=xb;x.Sf=Array(4096);x.Kf(y,{},"/");x.mkdir("/tmp");x.mkdir("/home");x.mkdir("/home/web_user"); +(function(){x.mkdir("/dev");gb(x.ag(1,3),{read:()=>0,write:(d,f,h,k)=>k,Nf:()=>0});Lb("/dev/null",x.ag(1,3));fb(x.ag(5,0),ib);fb(x.ag(6,0),jb);Lb("/dev/tty",x.ag(5,0));Lb("/dev/tty1",x.ag(6,0));var a=new Uint8Array(1024),b=0,c=()=>{0===b&&(Ya(a),b=a.byteLength);return a[--b]};x.Yf("/dev","random",c);x.Yf("/dev","urandom",c);x.mkdir("/dev/shm");x.mkdir("/dev/shm/tmp")})(); +(function(){x.mkdir("/proc");var a=x.mkdir("/proc/self");x.mkdir("/proc/self/fd");x.Kf({Kf(){var b=x.createNode(a,"fd",16895,73);b.Gf={Nf:y.Gf.Nf};b.Ff={lookup(c,d){c=+d;var f=B(c);c={parent:null,Kf:{Hg:"fake"},Ff:{readlink:()=>f.path},id:c+1};return c.parent=c},readdir(){return Array.from(x.streams.entries()).filter(([,c])=>c).map(([c])=>c.toString())}};return b}},{},"/proc/self/fd")})();x.Rg={MEMFS:y};e.noExitRuntime&&(Ha=e.noExitRuntime);e.preloadPlugins&&(ub=e.preloadPlugins);e.print&&(ka=e.print); +e.printErr&&(la=e.printErr);e.wasmBinary&&(ma=e.wasmBinary);e.thisProgram&&(da=e.thisProgram);if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0x.unlink(...a);e.FS_createPath=(...a)=>Ob(...a);e.FS_createDevice=(...a)=>x.Yf(...a);e.FS=x;e.FS_createDataFile=(...a)=>wb(...a);e.FS_createLazyFile=(...a)=>Rb(...a); +var dc={408524:a=>{e.TesseractProgress&&e.TesseractProgress(a)},408593:a=>{e.TesseractProgress&&e.TesseractProgress(a)}},ec,fc,gc,hc,ic,jc,kc,lc,mc,nc,oc,pc,qc,rc,sc,tc,uc,vc,wc,xc,yc,zc,Ac,Bc,Cc,Dc,Ec,Fc,Gc,Hc,Ic,Jc,Kc,Lc,Mc,Nc,Oc,Pc,Qc,Rc,Sc,Tc,Uc,Vc,Wc,Xc,Yc,Zc,$c,ad,bd,cd,dd,ed,fd,gd,hd,jd,kd,ld,md,nd,od,pd,qd,rd,sd,td,ud,vd,wd,xd,yd,zd,Ad,Bd,Cd,Dd,Ed,Fd,Gd,Hd,Id,Jd,Kd,Ld,Md,Nd,Od,Pd,Qd,Rd,Sd,Td,Ud,Vd,Wd,Xd,Yd,Zd,$d,ae,be,ce,de,ee,fe,ge,he,ie,je,ke,le,me,ne,oe,pe,qe,re,se,te,ue,ve,we,xe,ye,ze, +Ae,Be,Ce,De,Ee,Fe,Ge,He,Ie,Je,Ke,Le,Me,Ne,Oe,Pe,Qe,Re,Se,Te,Ue,Ve,We,Xe,Ye,Ze,$e,af,bf,cf,df,ef,ff,gf,hf,jf,kf,lf,mf,nf,of,pf,qf,rf,sf,tf,uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng,Og,Pg,Qg,Rg,Sg,Tg,Ug,Vg,Wg,Xg,Yg,Zg,$g,ah,bh,ch,dh,eh,fh,gh,hh,ih,jh,kh,lh,mh,nh,oh,ph,qh,rh,sh,th,uh,vh,wh,xh,yh,zh,Ah,Bh,Ch,Dh,Eh,Fh,Gh,Hh,Ih, +kb,Jh,Kh,Lh,Xh={P:function(){r("missing function: _ZN9tesseract11TessBaseAPI10GetOsdTextEi")},S:function(){r("missing function: _ZN9tesseract11TessBaseAPI23ClearAdaptiveClassifierEv")},J:function(){r("missing function: _ZN9tesseract11TessBaseAPI8DetectOSEPNS_9OSResultsE")},y:function(){r("missing function: _ZNK9tesseract9OSResults12print_scoresEv")},a:(a,b,c,d)=>r(`Assertion failed: ${a?v(l,a):""}, at: `+[b?b?v(l,b):"":"unknown filename",c,d?d?v(l,d):"":"unknown function"]),k:(a,b,c)=>{(new Ka(a)).hg(b, +c);La=a;Ma++;throw La;},p:function(a,b,c){Pa=c;try{var d=B(a);switch(b){case 0:var f=Qa();if(0>f)break;for(;x.streams[f];)f++;return Hb(d,f).fd;case 1:case 2:return 0;case 3:return d.flags;case 4:return f=Qa(),d.flags|=f,0;case 12:return f=Qa(),ra[f+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(h){if("undefined"==typeof x||"ErrnoError"!==h.name)throw h;return-h.Lf}},K:function(a,b){try{return Tb(b,x.fstat(a))}catch(c){if("undefined"==typeof x||"ErrnoError"!==c.name)throw c;return-c.Lf}},H:function(a, +b){try{if(0===b)return-28;var c=x.cwd(),d=bb(c)+1;if(b>2]=25856;n[f+4>>2]=5;n[f+8>>2]=191;n[f+12>>2]=35387;for(var h=0;32>h;h++)g[f+h+17]=a[h]||0}return 0;case 21510:case 21511:case 21512:return d.tty? +0:-59;case 21506:case 21507:case 21508:if(!d.tty)return-59;if(d.tty.Xf.qh)for(f=Qa(),a=[],h=0;32>h;h++)a.push(g[f+h+17]);return 0;case 21519:if(!d.tty)return-59;f=Qa();return n[f>>2]=0;case 21520:return d.tty?-28:-59;case 21537:case 21531:return f=Qa(),x.sg(d,b,f);case 21523:if(!d.tty)return-59;d.tty.Xf.rh&&(h=[24,80],f=Qa(),ra[f>>1]=h[0],ra[f+2>>1]=h[1]);return 0;case 21524:return d.tty?0:-59;case 21515:return d.tty?0:-59;default:return-28}}catch(k){if("undefined"==typeof x||"ErrnoError"!==k.name)throw k; +return-k.Lf}},I:function(a,b,c,d){try{b=b?v(l,b):"";var f=d&256;b=Sb(a,b,d&4096);return Tb(c,f?x.lstat(b):x.stat(b))}catch(h){if("undefined"==typeof x||"ErrnoError"!==h.name)throw h;return-h.Lf}},n:function(a,b,c,d){Pa=d;try{b=b?v(l,b):"";b=Sb(a,b);var f=d?Qa():0;return x.open(b,c,f).fd}catch(h){if("undefined"==typeof x||"ErrnoError"!==h.name)throw h;return-h.Lf}},v:function(a){try{return a=a?v(l,a):"",x.rmdir(a),0}catch(b){if("undefined"==typeof x||"ErrnoError"!==b.name)throw b;return-b.Lf}},w:function(a, +b,c){try{b=b?v(l,b):"";b=Sb(a,b);if(c)if(512===c)x.rmdir(b);else return-28;else x.unlink(b);return 0}catch(d){if("undefined"==typeof x||"ErrnoError"!==d.name)throw d;return-d.Lf}},N:()=>r(""),Q:a=>{do{var b=p[a>>2];a+=4;var c=p[a>>2];a+=4;var d=p[a>>2];a+=4;b=b?v(l,b):"";Ob("/",Ta(b));wb(b,null,g.subarray(d,d+c),!0,!0,!0)}while(p[a>>2])},t:()=>{throw Infinity;},A:function(a,b){a=-9007199254740992>a||9007199254740992>2]=a.getUTCSeconds();n[b+4>>2]=a.getUTCMinutes(); +n[b+8>>2]=a.getUTCHours();n[b+12>>2]=a.getUTCDate();n[b+16>>2]=a.getUTCMonth();n[b+20>>2]=a.getUTCFullYear()-1900;n[b+24>>2]=a.getUTCDay();n[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0},B:function(a,b){a=-9007199254740992>a||9007199254740992>2]=a.getSeconds();n[b+4>>2]=a.getMinutes();n[b+8>>2]=a.getHours();n[b+12>>2]=a.getDate();n[b+16>>2]=a.getMonth();n[b+20>>2]=a.getFullYear()-1900;n[b+24>>2]=a.getDay();n[b+28>>2]=(Ub(a.getFullYear())? +Vb:Wb)[a.getMonth()]+a.getDate()-1|0;n[b+36>>2]=-(60*a.getTimezoneOffset());var c=(new Date(a.getFullYear(),6,1)).getTimezoneOffset(),d=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();n[b+32>>2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},C:function(a){var b=new Date(n[a+20>>2]+1900,n[a+16>>2],n[a+12>>2],n[a+8>>2],n[a+4>>2],n[a>>2],0),c=n[a+32>>2],d=b.getTimezoneOffset(),f=(new Date(b.getFullYear(),6,1)).getTimezoneOffset(),h=(new Date(b.getFullYear(),0,1)).getTimezoneOffset(),k=Math.min(h, +f);0>c?n[a+32>>2]=Number(f!=h&&k==d):0>2]=b.getDay();n[a+28>>2]=(Ub(b.getFullYear())?Vb:Wb)[b.getMonth()]+b.getDate()-1|0;n[a>>2]=b.getSeconds();n[a+4>>2]=b.getMinutes();n[a+8>>2]=b.getHours();n[a+12>>2]=b.getDate();n[a+16>>2]=b.getMonth();n[a+20>>2]=b.getYear();a=b.getTime();return BigInt(isNaN(a)?-1:a/1E3)},x:function(a,b,c,d,f,h,k){f=-9007199254740992>f||9007199254740992>2]=u.Ag;p[k>>2]=t;return 0}catch(C){if("undefined"==typeof x||"ErrnoError"!==C.name)throw C;return-C.Lf}},z:function(a,b,c,d,f,h){h=-9007199254740992>h||9007199254740992{var f=(new Date).getFullYear(),h=(new Date(f,0,1)).getTimezoneOffset();f=(new Date(f, +6,1)).getTimezoneOffset();p[a>>2]=60*Math.max(h,f);n[b>>2]=Number(h!=f);b=k=>{var m=Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(m/60)).padStart(2,"0")}${String(m%60).padStart(2,"0")}`};a=b(h);b=b(f);f=a))return 28;ua[c>>3]=BigInt(Math.round(1E6*(0===a?Date.now():performance.now())));return 0},s:(a,b,c)=>{Xb.length=0;for(var d;d=l[b++];){var f=105!=d;f&=112!=d;c+=f&&c%8?4:0;Xb.push(112==d?p[c>>2]: +106==d?ua[c>>3]:105==d?n[c>>2]:ta[c>>3]);c+=f?8:4}return dc[a](...Xb)},L:()=>Date.now(),u:a=>{var b=l.length;a>>>=0;if(2147483648=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);a:{d=(Math.min(2147483648,65536*Math.ceil(Math.max(a,d)/65536))-qa.buffer.byteLength+65535)/65536|0;try{qa.grow(d);wa();var f=1;break a}catch(h){}f=void 0}if(f)return!0}return!1},F:(a,b)=>{var c=0,d=0,f;for(f of $b()){var h=b+c;p[a+d>>2]=h;c+=cb(f,l,h,Infinity)+1;d+=4}return 0},G:(a,b)=>{var c= +$b();p[a>>2]=c.length;a=0;for(var d of c)a+=bb(d)+1;p[b>>2]=a;return 0},R:a=>{Ha||(e.onExit?.(a),na=!0);ea(a,new Ba(a))},m:function(a){try{var b=B(a);x.close(b);return 0}catch(c){if("undefined"==typeof x||"ErrnoError"!==c.name)throw c;return c.Lf}},o:function(a,b,c,d){try{a:{var f=B(a);a=b;for(var h,k=b=0;k>2],u=p[a+4>>2];a+=8;var t=x.read(f,g,m,u,h);if(0>t){var C=-1;break a}b+=t;if(t>2]=C;return 0}catch(q){if("undefined"==typeof x|| +"ErrnoError"!==q.name)throw q;return q.Lf}},E:function(a,b,c,d){b=-9007199254740992>b||9007199254740992>3]=BigInt(f.position);f.qg&&0===b&&0===c&&(f.qg=null);return 0}catch(h){if("undefined"==typeof x||"ErrnoError"!==h.name)throw h;return h.Lf}},l:function(a,b,c,d){try{a:{var f=B(a);a=b;for(var h,k=b=0;k>2],u=p[a+4>>2];a+=8;var t=x.write(f,g,m,u,h);if(0>t){var C=-1;break a}b+=t;if(t>2]=C;return 0}catch(q){if("undefined"==typeof x||"ErrnoError"!==q.name)throw q;return q.Lf}},c:Mh,e:Nh,b:Oh,h:Ph,i:Qh,d:Rh,f:Sh,g:Th,j:Uh,q:Vh,r:Wh};function Oh(a,b,c,d){var f=Lh();try{return cc(a)(b,c,d)}catch(h){Kh(f);if(h!==h+0)throw h;Jh(1,0)}}function Rh(a,b){var c=Lh();try{cc(a)(b)}catch(d){Kh(c);if(d!==d+0)throw d;Jh(1,0)}}function Mh(a,b){var c=Lh();try{return cc(a)(b)}catch(d){Kh(c);if(d!==d+0)throw d;Jh(1,0)}} +function Th(a,b,c,d){var f=Lh();try{cc(a)(b,c,d)}catch(h){Kh(f);if(h!==h+0)throw h;Jh(1,0)}}function Sh(a,b,c){var d=Lh();try{cc(a)(b,c)}catch(f){Kh(d);if(f!==f+0)throw f;Jh(1,0)}}function Nh(a,b,c){var d=Lh();try{return cc(a)(b,c)}catch(f){Kh(d);if(f!==f+0)throw f;Jh(1,0)}}function Ph(a,b,c,d,f){var h=Lh();try{return cc(a)(b,c,d,f)}catch(k){Kh(h);if(k!==k+0)throw k;Jh(1,0)}}function Uh(a,b,c,d,f){var h=Lh();try{cc(a)(b,c,d,f)}catch(k){Kh(h);if(k!==k+0)throw k;Jh(1,0)}} +function Qh(a,b,c,d,f,h){var k=Lh();try{return cc(a)(b,c,d,f,h)}catch(m){Kh(k);if(m!==m+0)throw m;Jh(1,0)}}function Wh(a,b,c,d,f,h,k,m,u,t){var C=Lh();try{cc(a)(b,c,d,f,h,k,m,u,t)}catch(q){Kh(C);if(q!==q+0)throw q;Jh(1,0)}}function Vh(a,b,c,d,f,h){var k=Lh();try{cc(a)(b,c,d,f,h)}catch(m){Kh(k);if(m!==m+0)throw m;Jh(1,0)}} +function Yh(){function a(){e.calledRun=!0;if(!na){va=!0;e.noFSInit||x.rg||x.hg();Zh.U();x.Gg=!1;oa?.(e);e.onRuntimeInitialized?.();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();Da.push(b)}Ca(Da)}}if(0{setTimeout(()=>e.setStatus(""),1);a()},1)):a()}}var Zh; +Zh=await (async function(){function a(c){Zh=c.exports;qa=Zh.T;wa();bc=Zh.da;c=Zh;e._emscripten_bind_ParagraphJustification___destroy___0=ec=c.V;e._emscripten_bind_BoolPtr___destroy___0=fc=c.W;e._emscripten_bind_TessResultRenderer_BeginDocument_1=gc=c.X;e._emscripten_bind_TessResultRenderer_AddImage_1=hc=c.Y;e._emscripten_bind_TessResultRenderer_EndDocument_0=ic=c.Z;e._emscripten_bind_TessResultRenderer_happy_0=jc=c._;e._emscripten_bind_TessResultRenderer_file_extension_0=kc=c.$;e._emscripten_bind_TessResultRenderer_title_0= +lc=c.aa;e._emscripten_bind_TessResultRenderer_imagenum_0=mc=c.ba;e._emscripten_bind_TessResultRenderer___destroy___0=nc=c.ca;e._emscripten_bind_LongStarPtr___destroy___0=oc=c.ea;e._emscripten_bind_VoidPtr___destroy___0=pc=c.fa;e._emscripten_bind_ResultIterator_ResultIterator_1=qc=c.ga;e._emscripten_bind_ResultIterator_Begin_0=rc=c.ha;e._emscripten_bind_ResultIterator_RestartParagraph_0=sc=c.ia;e._emscripten_bind_ResultIterator_IsWithinFirstTextlineOfParagraph_0=tc=c.ja;e._emscripten_bind_ResultIterator_RestartRow_0= +uc=c.ka;e._emscripten_bind_ResultIterator_Next_1=vc=c.la;e._emscripten_bind_ResultIterator_IsAtBeginningOf_1=wc=c.ma;e._emscripten_bind_ResultIterator_IsAtFinalElement_2=xc=c.na;e._emscripten_bind_ResultIterator_Cmp_1=yc=c.oa;e._emscripten_bind_ResultIterator_SetBoundingBoxComponents_2=zc=c.pa;e._emscripten_bind_ResultIterator_BoundingBox_5=Ac=c.qa;e._emscripten_bind_ResultIterator_BoundingBox_6=Bc=c.ra;e._emscripten_bind_ResultIterator_BoundingBoxInternal_5=Cc=c.sa;e._emscripten_bind_ResultIterator_Empty_1= +Dc=c.ta;e._emscripten_bind_ResultIterator_BlockType_0=Ec=c.ua;e._emscripten_bind_ResultIterator_BlockPolygon_0=Fc=c.va;e._emscripten_bind_ResultIterator_GetBinaryImage_1=Gc=c.wa;e._emscripten_bind_ResultIterator_GetImage_5=Hc=c.xa;e._emscripten_bind_ResultIterator_Baseline_5=Ic=c.ya;e._emscripten_bind_ResultIterator_RowAttributes_3=Jc=c.za;e._emscripten_bind_ResultIterator_Orientation_4=Kc=c.Aa;e._emscripten_bind_ResultIterator_ParagraphInfo_4=Lc=c.Ba;e._emscripten_bind_ResultIterator_ParagraphIsLtr_0= +Mc=c.Ca;e._emscripten_bind_ResultIterator_GetUTF8Text_1=Nc=c.Da;e._emscripten_bind_ResultIterator_SetLineSeparator_1=Oc=c.Ea;e._emscripten_bind_ResultIterator_SetParagraphSeparator_1=Pc=c.Fa;e._emscripten_bind_ResultIterator_Confidence_1=Qc=c.Ga;e._emscripten_bind_ResultIterator_WordFontAttributes_8=Rc=c.Ha;e._emscripten_bind_ResultIterator_WordRecognitionLanguage_0=Sc=c.Ia;e._emscripten_bind_ResultIterator_WordDirection_0=Tc=c.Ja;e._emscripten_bind_ResultIterator_WordIsFromDictionary_0=Uc=c.Ka;e._emscripten_bind_ResultIterator_WordIsNumeric_0= +Vc=c.La;e._emscripten_bind_ResultIterator_HasBlamerInfo_0=Wc=c.Ma;e._emscripten_bind_ResultIterator_HasTruthString_0=Xc=c.Na;e._emscripten_bind_ResultIterator_EquivalentToTruth_1=Yc=c.Oa;e._emscripten_bind_ResultIterator_WordTruthUTF8Text_0=Zc=c.Pa;e._emscripten_bind_ResultIterator_WordNormedUTF8Text_0=$c=c.Qa;e._emscripten_bind_ResultIterator_WordLattice_1=ad=c.Ra;e._emscripten_bind_ResultIterator_SymbolIsSuperscript_0=bd=c.Sa;e._emscripten_bind_ResultIterator_SymbolIsSubscript_0=cd=c.Ta;e._emscripten_bind_ResultIterator_SymbolIsDropcap_0= +dd=c.Ua;e._emscripten_bind_ResultIterator___destroy___0=ed=c.Va;e._emscripten_bind_TextlineOrder___destroy___0=fd=c.Wa;e._emscripten_bind_ETEXT_DESC___destroy___0=gd=c.Xa;e._emscripten_bind_PageIterator_Begin_0=hd=c.Ya;e._emscripten_bind_PageIterator_RestartParagraph_0=jd=c.Za;e._emscripten_bind_PageIterator_IsWithinFirstTextlineOfParagraph_0=kd=c._a;e._emscripten_bind_PageIterator_RestartRow_0=ld=c.$a;e._emscripten_bind_PageIterator_Next_1=md=c.ab;e._emscripten_bind_PageIterator_IsAtBeginningOf_1= +nd=c.bb;e._emscripten_bind_PageIterator_IsAtFinalElement_2=od=c.cb;e._emscripten_bind_PageIterator_Cmp_1=pd=c.db;e._emscripten_bind_PageIterator_SetBoundingBoxComponents_2=qd=c.eb;e._emscripten_bind_PageIterator_BoundingBox_5=rd=c.fb;e._emscripten_bind_PageIterator_BoundingBox_6=sd=c.gb;e._emscripten_bind_PageIterator_BoundingBoxInternal_5=td=c.hb;e._emscripten_bind_PageIterator_Empty_1=ud=c.ib;e._emscripten_bind_PageIterator_BlockType_0=vd=c.jb;e._emscripten_bind_PageIterator_BlockPolygon_0=wd=c.kb; +e._emscripten_bind_PageIterator_GetBinaryImage_1=xd=c.lb;e._emscripten_bind_PageIterator_GetImage_5=yd=c.mb;e._emscripten_bind_PageIterator_Baseline_5=zd=c.nb;e._emscripten_bind_PageIterator_Orientation_4=Ad=c.ob;e._emscripten_bind_PageIterator_ParagraphInfo_4=Bd=c.pb;e._emscripten_bind_PageIterator___destroy___0=Cd=c.qb;e._emscripten_bind_WritingDirection___destroy___0=Dd=c.rb;e._emscripten_bind_WordChoiceIterator_WordChoiceIterator_1=Ed=c.sb;e._emscripten_bind_WordChoiceIterator_Next_0=Fd=c.tb; +e._emscripten_bind_WordChoiceIterator_GetUTF8Text_0=Gd=c.ub;e._emscripten_bind_WordChoiceIterator_Confidence_0=Hd=c.vb;e._emscripten_bind_WordChoiceIterator___destroy___0=Id=c.wb;e._emscripten_bind_Box_get_x_0=Jd=c.xb;e._emscripten_bind_Box_get_y_0=Kd=c.yb;e._emscripten_bind_Box_get_w_0=Ld=c.zb;e._emscripten_bind_Box_get_h_0=Md=c.Ab;e._emscripten_bind_Box_get_refcount_0=Nd=c.Bb;e._emscripten_bind_Box___destroy___0=Od=c.Cb;e._emscripten_bind_TessPDFRenderer_TessPDFRenderer_3=Pd=c.Db;e._emscripten_bind_TessPDFRenderer_BeginDocument_1= +Qd=c.Eb;e._emscripten_bind_TessPDFRenderer_AddImage_1=Rd=c.Fb;e._emscripten_bind_TessPDFRenderer_EndDocument_0=Sd=c.Gb;e._emscripten_bind_TessPDFRenderer_happy_0=Td=c.Hb;e._emscripten_bind_TessPDFRenderer_file_extension_0=Ud=c.Ib;e._emscripten_bind_TessPDFRenderer_title_0=Vd=c.Jb;e._emscripten_bind_TessPDFRenderer_imagenum_0=Wd=c.Kb;e._emscripten_bind_TessPDFRenderer___destroy___0=Xd=c.Lb;e._emscripten_bind_PixaPtr___destroy___0=Yd=c.Mb;e._emscripten_bind_FloatPtr___destroy___0=Zd=c.Nb;e._emscripten_bind_ChoiceIterator_ChoiceIterator_1= +$d=c.Ob;e._emscripten_bind_ChoiceIterator_Next_0=ae=c.Pb;e._emscripten_bind_ChoiceIterator_GetUTF8Text_0=be=c.Qb;e._emscripten_bind_ChoiceIterator_Confidence_0=ce=c.Rb;e._emscripten_bind_ChoiceIterator___destroy___0=de=c.Sb;e._emscripten_bind_PixPtr___destroy___0=ee=c.Tb;e._emscripten_bind_UNICHARSET_get_script_from_script_id_1=fe=c.Ub;e._emscripten_bind_UNICHARSET_get_script_id_from_name_1=ge=c.Vb;e._emscripten_bind_UNICHARSET_get_script_table_size_0=he=c.Wb;e._emscripten_bind_UNICHARSET___destroy___0= +ie=c.Xb;e._emscripten_bind_IntPtr___destroy___0=je=c.Yb;e._emscripten_bind_Orientation___destroy___0=ke=c.Zb;e._emscripten_bind_OSBestResult_get_orientation_id_0=le=c._b;e._emscripten_bind_OSBestResult_get_script_id_0=me=c.$b;e._emscripten_bind_OSBestResult_get_sconfidence_0=ne=c.ac;e._emscripten_bind_OSBestResult_get_oconfidence_0=oe=c.bc;e._emscripten_bind_OSBestResult___destroy___0=pe=c.cc;e._emscripten_bind_Boxa_get_n_0=qe=c.dc;e._emscripten_bind_Boxa_get_nalloc_0=re=c.ec;e._emscripten_bind_Boxa_get_refcount_0= +se=c.fc;e._emscripten_bind_Boxa_get_box_0=te=c.gc;e._emscripten_bind_Boxa___destroy___0=ue=c.hc;e._emscripten_bind_PixColormap_get_array_0=ve=c.ic;e._emscripten_bind_PixColormap_get_depth_0=we=c.jc;e._emscripten_bind_PixColormap_get_nalloc_0=xe=c.kc;e._emscripten_bind_PixColormap_get_n_0=ye=c.lc;e._emscripten_bind_PixColormap___destroy___0=ze=c.mc;e._emscripten_bind_Pta_get_n_0=Ae=c.nc;e._emscripten_bind_Pta_get_nalloc_0=Be=c.oc;e._emscripten_bind_Pta_get_refcount_0=Ce=c.pc;e._emscripten_bind_Pta_get_x_0= +De=c.qc;e._emscripten_bind_Pta_get_y_0=Ee=c.rc;e._emscripten_bind_Pta___destroy___0=Fe=c.sc;e._emscripten_bind_Pix_get_w_0=Ge=c.tc;e._emscripten_bind_Pix_get_h_0=He=c.uc;e._emscripten_bind_Pix_get_d_0=Ie=c.vc;e._emscripten_bind_Pix_get_spp_0=Je=c.wc;e._emscripten_bind_Pix_get_wpl_0=Ke=c.xc;e._emscripten_bind_Pix_get_refcount_0=Le=c.yc;e._emscripten_bind_Pix_get_xres_0=Me=c.zc;e._emscripten_bind_Pix_get_yres_0=Ne=c.Ac;e._emscripten_bind_Pix_get_informat_0=Oe=c.Bc;e._emscripten_bind_Pix_get_special_0= +Pe=c.Cc;e._emscripten_bind_Pix_get_text_0=Qe=c.Dc;e._emscripten_bind_Pix_get_colormap_0=Re=c.Ec;e._emscripten_bind_Pix_get_data_0=Se=c.Fc;e._emscripten_bind_Pix___destroy___0=Te=c.Gc;e._emscripten_bind_DoublePtr___destroy___0=Ue=c.Hc;e._emscripten_bind_Dawg___destroy___0=Ve=c.Ic;e._emscripten_bind_BoxPtr___destroy___0=We=c.Jc;e._emscripten_bind_TessBaseAPI_TessBaseAPI_0=Xe=c.Kc;e._emscripten_bind_TessBaseAPI_Version_0=Ye=c.Lc;e._emscripten_bind_TessBaseAPI_SetInputName_1=Ze=c.Mc;e._emscripten_bind_TessBaseAPI_GetInputName_0= +$e=c.Nc;e._emscripten_bind_TessBaseAPI_SetInputImage_1=af=c.Oc;e._emscripten_bind_TessBaseAPI_GetInputImage_0=bf=c.Pc;e._emscripten_bind_TessBaseAPI_GetSourceYResolution_0=cf=c.Qc;e._emscripten_bind_TessBaseAPI_GetDatapath_0=df=c.Rc;e._emscripten_bind_TessBaseAPI_SetOutputName_1=ef=c.Sc;e._emscripten_bind_TessBaseAPI_SetVariable_2=ff=c.Tc;e._emscripten_bind_TessBaseAPI_SetDebugVariable_2=gf=c.Uc;e._emscripten_bind_TessBaseAPI_GetIntVariable_2=hf=c.Vc;e._emscripten_bind_TessBaseAPI_GetBoolVariable_2= +jf=c.Wc;e._emscripten_bind_TessBaseAPI_GetDoubleVariable_2=kf=c.Xc;e._emscripten_bind_TessBaseAPI_GetStringVariable_1=lf=c.Yc;e._emscripten_bind_TessBaseAPI_SaveParameters_1=mf=c.Zc;e._emscripten_bind_TessBaseAPI_RestoreParameters_1=nf=c._c;e._emscripten_bind_TessBaseAPI_Init_2=of=c.$c;e._emscripten_bind_TessBaseAPI_Init_3=pf=c.ad;e._emscripten_bind_TessBaseAPI_Init_4=qf=c.bd;e._emscripten_bind_TessBaseAPI_GetInitLanguagesAsString_0=rf=c.cd;e._emscripten_bind_TessBaseAPI_InitForAnalysePage_0=sf=c.dd; +e._emscripten_bind_TessBaseAPI_ReadConfigFile_1=tf=c.ed;e._emscripten_bind_TessBaseAPI_ReadDebugConfigFile_1=uf=c.fd;e._emscripten_bind_TessBaseAPI_SetPageSegMode_1=vf=c.gd;e._emscripten_bind_TessBaseAPI_GetPageSegMode_0=wf=c.hd;e._emscripten_bind_TessBaseAPI_TesseractRect_7=xf=c.id;e._emscripten_bind_TessBaseAPI_ClearAdaptiveClassifier_0=yf=c.jd;e._emscripten_bind_TessBaseAPI_SetImage_1=zf=c.kd;e._emscripten_bind_TessBaseAPI_SetImage_5=Af=c.ld;e._emscripten_bind_TessBaseAPI_SetImageFile_1=Bf=c.md; +e._emscripten_bind_TessBaseAPI_SetSourceResolution_1=Cf=c.nd;e._emscripten_bind_TessBaseAPI_SetRectangle_4=Df=c.od;e._emscripten_bind_TessBaseAPI_GetThresholdedImage_0=Ef=c.pd;e._emscripten_bind_TessBaseAPI_WriteImage_0=Ff=c.qd;e._emscripten_bind_TessBaseAPI_FindLines_0=Gf=c.rd;e._emscripten_bind_TessBaseAPI_GetGradient_0=Hf=c.sd;e._emscripten_bind_TessBaseAPI_GetRegions_1=If=c.td;e._emscripten_bind_TessBaseAPI_GetTextlines_2=Jf=c.ud;e._emscripten_bind_TessBaseAPI_GetTextlines_5=Kf=c.vd;e._emscripten_bind_TessBaseAPI_GetStrips_2= +Lf=c.wd;e._emscripten_bind_TessBaseAPI_GetWords_1=Mf=c.xd;e._emscripten_bind_TessBaseAPI_GetConnectedComponents_1=Nf=c.yd;e._emscripten_bind_TessBaseAPI_GetComponentImages_4=Of=c.zd;e._emscripten_bind_TessBaseAPI_GetComponentImages_7=Pf=c.Ad;e._emscripten_bind_TessBaseAPI_GetThresholdedImageScaleFactor_0=Qf=c.Bd;e._emscripten_bind_TessBaseAPI_AnalyseLayout_0=Rf=c.Cd;e._emscripten_bind_TessBaseAPI_AnalyseLayout_1=Sf=c.Dd;e._emscripten_bind_TessBaseAPI_Recognize_1=Tf=c.Ed;e._emscripten_bind_TessBaseAPI_ProcessPages_4= +Uf=c.Fd;e._emscripten_bind_TessBaseAPI_ProcessPage_6=Vf=c.Gd;e._emscripten_bind_TessBaseAPI_GetIterator_0=Wf=c.Hd;e._emscripten_bind_TessBaseAPI_GetUTF8Text_0=Xf=c.Id;e._emscripten_bind_TessBaseAPI_GetHOCRText_1=Yf=c.Jd;e._emscripten_bind_TessBaseAPI_GetJSONText_1=Zf=c.Kd;e._emscripten_bind_TessBaseAPI_GetTSVText_1=$f=c.Ld;e._emscripten_bind_TessBaseAPI_GetBoxText_1=ag=c.Md;e._emscripten_bind_TessBaseAPI_GetUNLVText_0=bg=c.Nd;e._emscripten_bind_TessBaseAPI_GetOsdText_1=cg=c.Od;e._emscripten_bind_TessBaseAPI_MeanTextConf_0= +dg=c.Pd;e._emscripten_bind_TessBaseAPI_AllWordConfidences_0=eg=c.Qd;e._emscripten_bind_TessBaseAPI_Clear_0=fg=c.Rd;e._emscripten_bind_TessBaseAPI_End_0=gg=c.Sd;e._emscripten_bind_TessBaseAPI_ClearPersistentCache_0=hg=c.Td;e._emscripten_bind_TessBaseAPI_IsValidWord_1=ig=c.Ud;e._emscripten_bind_TessBaseAPI_IsValidCharacter_1=jg=c.Vd;e._emscripten_bind_TessBaseAPI_DetectOS_1=kg=c.Wd;e._emscripten_bind_TessBaseAPI_GetUnichar_1=lg=c.Xd;e._emscripten_bind_TessBaseAPI_GetDawg_1=mg=c.Yd;e._emscripten_bind_TessBaseAPI_NumDawgs_0= +ng=c.Zd;e._emscripten_bind_TessBaseAPI_oem_0=og=c._d;e._emscripten_bind_TessBaseAPI___destroy___0=pg=c.$d;e._emscripten_bind_OSResults_OSResults_0=qg=c.ae;e._emscripten_bind_OSResults_print_scores_0=rg=c.be;e._emscripten_bind_OSResults_get_best_result_0=sg=c.ce;e._emscripten_bind_OSResults_get_unicharset_0=tg=c.de;e._emscripten_bind_OSResults___destroy___0=ug=c.ee;e._emscripten_bind_Pixa_get_n_0=vg=c.fe;e._emscripten_bind_Pixa_get_nalloc_0=wg=c.ge;e._emscripten_bind_Pixa_get_refcount_0=xg=c.he;e._emscripten_bind_Pixa_get_pix_0= +yg=c.ie;e._emscripten_bind_Pixa_get_boxa_0=zg=c.je;e._emscripten_bind_Pixa___destroy___0=Ag=c.ke;e._emscripten_enum_PageIteratorLevel_RIL_BLOCK=Bg=c.le;e._emscripten_enum_PageIteratorLevel_RIL_PARA=Cg=c.me;e._emscripten_enum_PageIteratorLevel_RIL_TEXTLINE=Dg=c.ne;e._emscripten_enum_PageIteratorLevel_RIL_WORD=Eg=c.oe;e._emscripten_enum_PageIteratorLevel_RIL_SYMBOL=Fg=c.pe;e._emscripten_enum_OcrEngineMode_OEM_TESSERACT_ONLY=Gg=c.qe;e._emscripten_enum_OcrEngineMode_OEM_LSTM_ONLY=Hg=c.re;e._emscripten_enum_OcrEngineMode_OEM_TESSERACT_LSTM_COMBINED= +Ig=c.se;e._emscripten_enum_OcrEngineMode_OEM_DEFAULT=Jg=c.te;e._emscripten_enum_OcrEngineMode_OEM_COUNT=Kg=c.ue;e._emscripten_enum_WritingDirection__WRITING_DIRECTION_LEFT_TO_RIGHT=Lg=c.ve;e._emscripten_enum_WritingDirection__WRITING_DIRECTION_RIGHT_TO_LEFT=Mg=c.we;e._emscripten_enum_WritingDirection__WRITING_DIRECTION_TOP_TO_BOTTOM=Ng=c.xe;e._emscripten_enum_PolyBlockType_PT_UNKNOWN=Og=c.ye;e._emscripten_enum_PolyBlockType_PT_FLOWING_TEXT=Pg=c.ze;e._emscripten_enum_PolyBlockType_PT_HEADING_TEXT= +Qg=c.Ae;e._emscripten_enum_PolyBlockType_PT_PULLOUT_TEXT=Rg=c.Be;e._emscripten_enum_PolyBlockType_PT_EQUATION=Sg=c.Ce;e._emscripten_enum_PolyBlockType_PT_INLINE_EQUATION=Tg=c.De;e._emscripten_enum_PolyBlockType_PT_TABLE=Ug=c.Ee;e._emscripten_enum_PolyBlockType_PT_VERTICAL_TEXT=Vg=c.Fe;e._emscripten_enum_PolyBlockType_PT_CAPTION_TEXT=Wg=c.Ge;e._emscripten_enum_PolyBlockType_PT_FLOWING_IMAGE=Xg=c.He;e._emscripten_enum_PolyBlockType_PT_HEADING_IMAGE=Yg=c.Ie;e._emscripten_enum_PolyBlockType_PT_PULLOUT_IMAGE= +Zg=c.Je;e._emscripten_enum_PolyBlockType_PT_HORZ_LINE=$g=c.Ke;e._emscripten_enum_PolyBlockType_PT_VERT_LINE=ah=c.Le;e._emscripten_enum_PolyBlockType_PT_NOISE=bh=c.Me;e._emscripten_enum_PolyBlockType_PT_COUNT=ch=c.Ne;e._emscripten_enum_StrongScriptDirection_DIR_NEUTRAL=dh=c.Oe;e._emscripten_enum_StrongScriptDirection_DIR_LEFT_TO_RIGHT=eh=c.Pe;e._emscripten_enum_StrongScriptDirection_DIR_RIGHT_TO_LEFT=fh=c.Qe;e._emscripten_enum_StrongScriptDirection_DIR_MIX=gh=c.Re;e._emscripten_enum_ParagraphJustification__JUSTIFICATION_UNKNOWN= +hh=c.Se;e._emscripten_enum_ParagraphJustification__JUSTIFICATION_LEFT=ih=c.Te;e._emscripten_enum_ParagraphJustification__JUSTIFICATION_CENTER=jh=c.Ue;e._emscripten_enum_ParagraphJustification__JUSTIFICATION_RIGHT=kh=c.Ve;e._emscripten_enum_TextlineOrder__TEXTLINE_ORDER_LEFT_TO_RIGHT=lh=c.We;e._emscripten_enum_TextlineOrder__TEXTLINE_ORDER_RIGHT_TO_LEFT=mh=c.Xe;e._emscripten_enum_TextlineOrder__TEXTLINE_ORDER_TOP_TO_BOTTOM=nh=c.Ye;e._emscripten_enum_Orientation__ORIENTATION_PAGE_UP=oh=c.Ze;e._emscripten_enum_Orientation__ORIENTATION_PAGE_RIGHT= +ph=c._e;e._emscripten_enum_Orientation__ORIENTATION_PAGE_DOWN=qh=c.$e;e._emscripten_enum_Orientation__ORIENTATION_PAGE_LEFT=rh=c.af;e._emscripten_enum_PageSegMode_PSM_OSD_ONLY=sh=c.bf;e._emscripten_enum_PageSegMode_PSM_AUTO_OSD=th=c.cf;e._emscripten_enum_PageSegMode_PSM_AUTO_ONLY=uh=c.df;e._emscripten_enum_PageSegMode_PSM_AUTO=vh=c.ef;e._emscripten_enum_PageSegMode_PSM_SINGLE_COLUMN=wh=c.ff;e._emscripten_enum_PageSegMode_PSM_SINGLE_BLOCK_VERT_TEXT=xh=c.gf;e._emscripten_enum_PageSegMode_PSM_SINGLE_BLOCK= +yh=c.hf;e._emscripten_enum_PageSegMode_PSM_SINGLE_LINE=zh=c.jf;e._emscripten_enum_PageSegMode_PSM_SINGLE_WORD=Ah=c.kf;e._emscripten_enum_PageSegMode_PSM_CIRCLE_WORD=Bh=c.lf;e._emscripten_enum_PageSegMode_PSM_SINGLE_CHAR=Ch=c.mf;e._emscripten_enum_PageSegMode_PSM_SPARSE_TEXT=Dh=c.nf;e._emscripten_enum_PageSegMode_PSM_SPARSE_TEXT_OSD=Eh=c.of;e._emscripten_enum_PageSegMode_PSM_RAW_LINE=Fh=c.pf;e._emscripten_enum_PageSegMode_PSM_COUNT=Gh=c.qf;e._pixDestroy=c.rf;e._ptaDestroy=c.sf;e._boxaDestroy=c.tf; +e._pixaDestroy=c.uf;e._pixReadMem=c.vf;e._free=Hh=c.wf;e._malloc=Ih=c.xf;e._pixReadHeaderMem=c.yf;kb=c.zf;Jh=c.Af;Kh=c.Bf;Lh=c.Cf;return Zh}var b={a:Xh};if(e.instantiateWasm)return new Promise(c=>{e.instantiateWasm(b,(d,f)=>{c(a(d,f))})});xa??=e.locateFile?e.locateFile("tesseract-core-lstm.wasm",fa):fa+"tesseract-core-lstm.wasm";return a((await Aa(b)).instance)}());Yh();function D(){}D.prototype=Object.create(D.prototype);D.prototype.constructor=D;D.prototype.If=D;D.Jf={};e.WrapperObject=D; +function $h(a){return(a||D).Jf}e.getCache=$h;function E(a,b){var c=$h(b),d=c[a];if(d)return d;d=Object.create((b||D).prototype);d.Df=a;return c[a]=d}e.wrapPointer=E;e.castObject=function(a,b){return E(a.Df,b)};e.NULL=E(0);e.destroy=function(a){if(!a.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";a.__destroy__();delete $h(a.If)[a.Df]};e.compare=function(a,b){return a.Df===b.Df};e.getPointer=function(a){return a.Df};e.getClass=function(a){return a.If}; +var ai=0,bi=0,ci=0,di=[],ei=0;function F(){if(ei){for(var a=0;a=bi){0>=1;break;case 4:d>>=2;break;case 8:d>>=3}for(var f=0;f{oa=a;pa=b}); +;return moduleRtn}})();if(typeof exports==="object"&&typeof module==="object"){module.exports=TesseractCore;module.exports.default=TesseractCore}else if(typeof define==="function"&&define["amd"])define([],()=>TesseractCore); diff --git a/static/vendor/tesseract/tesseract-core-lstm.wasm b/static/vendor/tesseract/tesseract-core-lstm.wasm new file mode 100644 index 0000000..4732364 Binary files /dev/null and b/static/vendor/tesseract/tesseract-core-lstm.wasm differ diff --git a/static/vendor/tesseract/tesseract-core-simd-lstm.js b/static/vendor/tesseract/tesseract-core-simd-lstm.js new file mode 100644 index 0000000..7722640 --- /dev/null +++ b/static/vendor/tesseract/tesseract-core-simd-lstm.js @@ -0,0 +1,191 @@ +var TesseractCore=(()=>{var _scriptName=typeof document!="undefined"?document.currentScript?.src:undefined;return async function(moduleArg={}){var moduleRtn;var e=moduleArg,aa="object"==typeof window,ba="undefined"!=typeof WorkerGlobalScope,ca="object"==typeof process&&process.versions?.node&&"renderer"!=process.type,da="./this.program",ea=(a,b)=>{throw b;};"undefined"!=typeof __filename?_scriptName=__filename:ba&&(_scriptName=self.location.href);var fa="",ha,ia; +if(ca){var fs=require("fs");fa=__dirname+"/";ia=a=>{a=ja(a)?new URL(a):a;return fs.readFileSync(a)};ha=async a=>{a=ja(a)?new URL(a):a;return fs.readFileSync(a,void 0)};1{process.exitCode=a;throw b;}}else if(aa||ba){try{fa=(new URL(".",_scriptName)).href}catch{}ba&&(ia=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});ha=async a=> +{if(ja(a))return new Promise((c,d)=>{var f=new XMLHttpRequest;f.open("GET",a,!0);f.responseType="arraybuffer";f.onload=()=>{200==f.status||0==f.status&&f.response?c(f.response):d(f.status)};f.onerror=d;f.send(null)});var b=await fetch(a,{credentials:"same-origin"});if(b.ok)return b.arrayBuffer();throw Error(b.status+" : "+b.url);}}var ka=console.log.bind(console),la=console.error.bind(console),ma,na=!1,ja=a=>a.startsWith("file://"),oa,pa,qa,g,l,ra,n,p,sa,ta,ua,va=!1; +function wa(){var a=qa.buffer;g=new Int8Array(a);ra=new Int16Array(a);l=new Uint8Array(a);new Uint16Array(a);n=new Int32Array(a);p=new Uint32Array(a);sa=new Float32Array(a);ta=new Float64Array(a);ua=new BigInt64Array(a);new BigUint64Array(a)}function r(a){e.onAbort?.(a);a="Aborted("+a+")";la(a);na=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");pa?.(a);throw a;}var xa; +async function ya(a){if(!ma)try{var b=await ha(a);return new Uint8Array(b)}catch{}if(a==xa&&ma)a=new Uint8Array(ma);else if(ia)a=ia(a);else throw"both async and sync fetching of the wasm failed";return a}async function za(a,b){try{var c=await ya(a);return await WebAssembly.instantiate(c,b)}catch(d){la(`failed to asynchronously prepare wasm: ${d}`),r(d)}} +async function Aa(a){var b=xa;if(!ma&&!ja(b)&&!ca)try{var c=fetch(b,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(c,a)}catch(d){la(`wasm streaming compile failed: ${d}`),la("falling back to ArrayBuffer instantiation")}return za(b,a)}class Ba{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`;this.status=a}}var Ca=a=>{for(;0{var a=e.preRun.shift();Ea.push(a)}; +function Ga(a,b="i8"){b.endsWith("*")&&(b="*");switch(b){case "i1":return g[a];case "i8":return g[a];case "i16":return ra[a>>1];case "i32":return n[a>>2];case "i64":return ua[a>>3];case "float":return sa[a>>2];case "double":return ta[a>>3];case "*":return p[a>>2];default:r(`invalid type for getValue: ${b}`)}}var Ha=!0; +function Ia(a,b,c="i8"){c.endsWith("*")&&(c="*");switch(c){case "i1":g[a]=b;break;case "i8":g[a]=b;break;case "i16":ra[a>>1]=b;break;case "i32":n[a>>2]=b;break;case "i64":ua[a>>3]=BigInt(b);break;case "float":sa[a>>2]=b;break;case "double":ta[a>>3]=b;break;case "*":p[a>>2]=b;break;default:r(`invalid type for setValue: ${c}`)}} +var Ja="undefined"!=typeof TextDecoder?new TextDecoder:void 0,v=(a,b=0)=>{var c=b;for(var d=c+void 0;a[c]&&!(c>=d);)++c;if(16f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d}, +w=a=>a?v(l,a):"";class Ka{constructor(a){this.Df=a-24}hg(a,b){p[this.Df+16>>2]=0;p[this.Df+4>>2]=a;p[this.Df+8>>2]=b}} +var La=0,Ma=0,Qa=()=>{var a=n[+Pa>>2];Pa+=4;return a},Ra=(a,b)=>{for(var c=0,d=a.length-1;0<=d;d--){var f=a[d];"."===f?a.splice(d,1):".."===f?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a},Sa=a=>{var b="/"===a.charAt(0),c="/"===a.slice(-1);(a=Ra(a.split("/").filter(d=>!!d),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},Ta=a=>{var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return"."; +b&&=b.slice(0,-1);return a+b},Ua=a=>a&&a.match(/([^\/]+|\/)\/*$/)[1],Va=(a,b)=>Sa(a+"/"+b),Wa=()=>{if(ca){var a=require("crypto");return b=>a.randomFillSync(b)}return b=>crypto.getRandomValues(b)},Ya=a=>{(Ya=Wa())(a)},Za=(...a)=>{for(var b="",c=!1,d=a.length-1;-1<=d&&!c;d--){c=0<=d?a[d]:x.cwd();if("string"!=typeof c)throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";b=c+"/"+b;c="/"===c.charAt(0)}b=Ra(b.split("/").filter(f=>!!f),!c).join("/");return(c?"/":"")+b||"."},$a= +(a,b)=>{function c(k){for(var m=0;mu?[]:k.slice(m,u-m+1)}a=Za(a).slice(1);b=Za(b).slice(1);a=c(a.split("/"));b=c(b.split("/"));for(var d=Math.min(a.length,b.length),f=d,h=0;h{for(var b=0,c=0;c=d?b++:2047>=d?b+=2:55296<=d&&57343>=d?(b+=4,++c):b+=3}return b}, +cb=(a,b,c,d)=>{if(!(0=k){if(c>=d)break;b[c++]=k}else if(2047>=k){if(c+1>=d)break;b[c++]=192|k>>6;b[c++]=128|k&63}else if(65535>=k){if(c+2>=d)break;b[c++]=224|k>>12;b[c++]=128|k>>6&63;b[c++]=128|k&63}else{if(c+3>=d)break;b[c++]=240|k>>18;b[c++]=128|k>>12&63;b[c++]=128|k>>6&63;b[c++]=128|k&63;h++}}b[c]=0;return c-f},db=(a,b)=>{var c=Array(bb(a)+1);a=cb(a,c,0,c.length);b&&(c.length=a);return c},eb=[]; +function fb(a,b){eb[a]={input:[],output:[],Xf:b};gb(a,hb)} +var hb={open(a){var b=eb[a.node.rdev];if(!b)throw new x.Ef(43);a.tty=b;a.seekable=!1},close(a){a.tty.Xf.fsync(a.tty)},fsync(a){a.tty.Xf.fsync(a.tty)},read(a,b,c,d){if(!a.tty||!a.tty.Xf.Fg)throw new x.Ef(60);for(var f=0,h=0;h{a=65536*Math.ceil(a/65536);var b=kb(65536,a);b&&l.fill(0,b,b+a);return b}, +y={Tf:null,Kf(){return y.createNode(null,"/",16895,0)},createNode(a,b,c,d){if(24576===(c&61440)||x.isFIFO(c))throw new x.Ef(63);y.Tf||(y.Tf={dir:{node:{Pf:y.Ff.Pf,Rf:y.Ff.Rf,lookup:y.Ff.lookup,Wf:y.Ff.Wf,rename:y.Ff.rename,unlink:y.Ff.unlink,rmdir:y.Ff.rmdir,readdir:y.Ff.readdir,symlink:y.Ff.symlink},stream:{Nf:y.Gf.Nf}},file:{node:{Pf:y.Ff.Pf,Rf:y.Ff.Rf},stream:{Nf:y.Gf.Nf,read:y.Gf.read,write:y.Gf.write,bg:y.Gf.bg,eg:y.Gf.eg}},link:{node:{Pf:y.Ff.Pf,Rf:y.Ff.Rf,readlink:y.Ff.readlink},stream:{}}, +Bg:{node:{Pf:y.Ff.Pf,Rf:y.Ff.Rf},stream:x.Pg}});c=x.createNode(a,b,c,d);z(c.mode)?(c.Ff=y.Tf.dir.node,c.Gf=y.Tf.dir.stream,c.Hf={}):x.isFile(c.mode)?(c.Ff=y.Tf.file.node,c.Gf=y.Tf.file.stream,c.Mf=0,c.Hf=null):40960===(c.mode&61440)?(c.Ff=y.Tf.link.node,c.Gf=y.Tf.link.stream):8192===(c.mode&61440)&&(c.Ff=y.Tf.Bg.node,c.Gf=y.Tf.Bg.stream);c.atime=c.mtime=c.ctime=Date.now();a&&(a.Hf[b]=c,a.atime=a.mtime=a.ctime=c.atime);return c},Nh(a){return a.Hf?a.Hf.subarray?a.Hf.subarray(0,a.Mf):new Uint8Array(a.Hf): +new Uint8Array(0)},Ff:{Pf(a){var b={};b.dev=8192===(a.mode&61440)?a.id:1;b.ino=a.id;b.mode=a.mode;b.nlink=1;b.uid=0;b.gid=0;b.rdev=a.rdev;z(a.mode)?b.size=4096:x.isFile(a.mode)?b.size=a.Mf:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.atime=new Date(a.atime);b.mtime=new Date(a.mtime);b.ctime=new Date(a.ctime);b.blksize=4096;b.blocks=Math.ceil(b.size/b.blksize);return b},Rf(a,b){for(var c of["mode","atime","mtime","ctime"])null!=b[c]&&(a[c]=b[c]);void 0!==b.size&&(b=b.size,a.Mf!=b&&(0==b? +(a.Hf=null,a.Mf=0):(c=a.Hf,a.Hf=new Uint8Array(b),c&&a.Hf.set(c.subarray(0,Math.min(b,a.Mf))),a.Mf=b)))},lookup(){y.lg||(y.lg=new x.Ef(44),y.lg.stack="");throw y.lg;},Wf(a,b,c,d){return y.createNode(a,b,c,d)},rename(a,b,c){try{var d=mb(b,c)}catch(h){}if(d){if(z(a.mode))for(var f in d.Hf)throw new x.Ef(55);nb(d)}delete a.parent.Hf[a.name];b.Hf[c]=a;a.name=c;b.ctime=b.mtime=a.parent.ctime=a.parent.mtime=Date.now()},unlink(a,b){delete a.Hf[b];a.ctime=a.mtime=Date.now()},rmdir(a, +b){var c=mb(a,b),d;for(d in c.Hf)throw new x.Ef(55);delete a.Hf[b];a.ctime=a.mtime=Date.now()},readdir(a){return[".","..",...Object.keys(a.Hf)]},symlink(a,b,c){a=y.createNode(a,b,41471,0);a.link=c;return a},readlink(a){if(40960!==(a.mode&61440))throw new x.Ef(28);return a.link}},Gf:{read(a,b,c,d,f){var h=a.node.Hf;if(f>=a.node.Mf)return 0;a=Math.min(a.node.Mf-f,d);if(8=h||(h=Math.max(h,k*(1048576>k?2:1.125)>>>0),0!=k&&(h=Math.max(h,256)),k=a.Hf,a.Hf=new Uint8Array(h),0b)throw new x.Ef(28);return b},bg(a,b,c,d,f){if(!x.isFile(a.node.mode))throw new x.Ef(43);a=a.node.Hf;if(f&2||!a||a.buffer!==g.buffer){d=!0;f=lb(b);if(!f)throw new x.Ef(48);if(a){if(0{var c=0;a&&(c|=365);b&&(c|=146);return c},pb=async a=>{a=await ha(a);return new Uint8Array(a)},qb=0,rb=null,sb=()=>{qb--;e.monitorRunDependencies?.(qb);if(0==qb&&rb){var a=rb;rb=null;a()}},tb=()=>{qb++;e.monitorRunDependencies?.(qb)},ub=[],vb=async(a,b)=>{"undefined"!=typeof Browser&&Browser.hg();for(var c of ub)if(c.canHandle(b))return c.handle(a,b);return a},xb=async(a,b,c,d,f,h,k,m)=>{var u=b?Za(Sa(a+"/"+b)):a,t=`cp ${u}`;tb(t);try{var C=c;"string"==typeof c&&(C=await pb(c));C=await vb(C, +u);m?.();h||wb(a,b,C,d,f,k)}finally{sb(t)}};function gb(a,b){x.Dg[a]={Gf:b}}function z(a){return 16384===(a&61440)}function mb(a,b){var c=z(a.mode)?(c=yb(a,"x"))?c:a.Ff.lookup?0:2:54;if(c)throw new x.Ef(c);for(c=x.Sf[zb(a.id,b)];c;c=c.cg){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return x.lookup(a,b)}function nb(a){var b=zb(a.parent.id,a.name);if(x.Sf[b]===a)x.Sf[b]=a.cg;else for(b=x.Sf[b];b;){if(b.cg===a){b.cg=a.cg;break}b=b.cg}} +function wb(a,b,c,d,f,h){var k=b;a&&(a="string"==typeof a?a:Ab(a),k=b?Sa(a+"/"+b):a);a=ob(d,f);k=x.create(k,a);if(c){if("string"==typeof c){b=Array(c.length);d=0;for(f=c.length;dc;c++){a=a.split("/").filter(m=>!!m);for(var d=x.root,f="/",h=0;h>>0)%x.Sf.length}function Bb(a){var b=zb(a.parent.id,a.name);a.cg=x.Sf[b];x.Sf[b]=a} +function Cb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}function yb(a,b){if(x.Gg)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function Db(a,b){if(!z(a.mode))return 54;try{return mb(a,b),20}catch(c){}return yb(a,"wx")} +function Eb(a,b,c){try{var d=mb(a,b)}catch(f){return f.Lf}if(a=yb(a,"wx"))return a;if(c){if(!z(d.mode))return 54;if(x.tg(d)||Ab(d)===x.cwd())return 10}else if(z(d.mode))return 31;return 0}function Fb(a,b){if(!a)throw new x.Ef(b);return a}function B(a){a=x.Tg(a);if(!a)throw new x.Ef(8);return a}function Gb(a,b=-1){a=Object.assign(new x.Mg,a);if(-1==b)a:{for(b=0;b<=x.Og;b++)if(!x.streams[b])break a;throw new x.Ef(33);}a.fd=b;return x.streams[b]=a} +function Hb(a,b=-1){a=Gb(a,b);a.Gf?.Hh?.(a);return a}function Ib(a,b,c){var d=a?.Gf.Rf;a=d?a:b;d??=b.Ff.Rf;Fb(d,63);d(a,c)}function Jb(a){var b=[];for(a=[a];a.length;){var c=a.pop();b.push(c);a.push(...c.fg)}return b}function Kb(a){var b={zh:4096,Kh:4096,blocks:1E6,yh:5E5,xh:5E5,files:x.vg,Ih:x.vg-1,Lh:42,flags:2,Qh:255};a.Ff.Jg&&Object.assign(b,a.Ff.Jg(a.Kf.vh.root));return b}function Lb(a,b,c){"undefined"==typeof c&&(c=b,b=438);return x.Wf(a,b|8192,c)} +function Mb(a,b,c,d){Ib(a,b,{mode:c&4095|b.mode&-4096,ctime:Date.now(),Eg:d})}function Nb(a,b,c){if(z(b.mode))throw new x.Ef(31);if(!x.isFile(b.mode))throw new x.Ef(28);var d=yb(b,"w");if(d)throw new x.Ef(d);Ib(a,b,{size:c,timestamp:Date.now()})}function Ob(a,b){a="string"==typeof a?a:Ab(a);for(b=b.split("/").reverse();b.length;){var c=b.pop();if(c){var d=Sa(a+"/"+c);try{x.mkdir(d)}catch(f){if(20!=f.Lf)throw f;}a=d}}return d} +function Pb(a,b,c,d){a="string"==typeof a?a:Ab(a);b=Sa(a+"/"+b);return x.create(b,ob(c,d))}function Qb(a){if(!(a.sh||a.th||a.link||a.Hf))if("undefined"!=typeof XMLHttpRequest)r("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");else try{a.Hf=ia(a.url)}catch(b){throw new x.Ef(29);}} +function Rb(a,b,c,d,f){function h(q,K,X,Y,W){q=q.node.Hf;if(W>=q.length)return 0;Y=Math.min(q.length-W,Y);if(q.slice)for(var U=0;Uthis.length-1||0>q)){var K=q%this.chunkSize;return this.jg(q/this.chunkSize|0)[K]}}Ng(q){this.jg=q}zg(){var q=new XMLHttpRequest;q.open("HEAD",c,!1);q.send(null);200<=q.status&&300>q.status||304===q.status||r("Couldn't load "+c+". Status: "+q.status); +var K=Number(q.getResponseHeader("Content-length")),X,Y=(X=q.getResponseHeader("Accept-Ranges"))&&"bytes"===X;q=(X=q.getResponseHeader("Content-Encoding"))&&"gzip"===X;var W=1048576;Y||(W=K);var U=this;U.Ng(Na=>{var Xa=Na*W,Oa=(Na+1)*W-1;Oa=Math.min(Oa,K-1);if("undefined"==typeof U.Uf[Na]){var li=U.Uf;Xa>Oa&&r("invalid range ("+Xa+", "+Oa+") or no bytes requested!");Oa>K-1&&r("only "+K+" bytes available! programmer error!");var Z=new XMLHttpRequest;Z.open("GET",c,!1);K!==W&&Z.setRequestHeader("Range", +"bytes="+Xa+"-"+Oa);Z.responseType="arraybuffer";Z.overrideMimeType&&Z.overrideMimeType("text/plain; charset=x-user-defined");Z.send(null);200<=Z.status&&300>Z.status||304===Z.status||r("Couldn't load "+c+". Status: "+Z.status);Xa=void 0!==Z.response?new Uint8Array(Z.response||[]):db(Z.responseText||"",!0);li[Na]=Xa}"undefined"==typeof U.Uf[Na]&&r("doXHR failed!");return U.Uf[Na]});if(q||!K)W=K=1,W=K=this.jg(0).length,ka("LazyFiles on gzip forces download of the whole file when length is accessed"); +this.yg=K;this.xg=W;this.kg=!0}get length(){this.kg||this.zg();return this.yg}get chunkSize(){this.kg||this.zg();return this.xg}}if("undefined"!=typeof XMLHttpRequest){ba||r("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var m=new k;var u=void 0}else u=c,m=void 0;var t=Pb(a,b,d,f);m?t.Hf=m:u&&(t.Hf=null,t.url=u);Object.defineProperties(t,{Mf:{get:function(){return this.Hf.length}}});var C={};Object.keys(t.Gf).forEach(q=>{var K= +t.Gf[q];C[q]=(...X)=>{Qb(t);return K(...X)}});C.read=(q,K,X,Y,W)=>{Qb(t);return h(q,K,X,Y,W)};C.bg=(q,K,X)=>{Qb(t);var Y=lb(K);if(!Y)throw new x.Ef(48);h(q,g,Y,K,X);return{Df:Y,Ag:!0}};t.Gf=C;return t} +var x={root:null,fg:[],Dg:{},streams:[],vg:1,Sf:null,Cg:"/",rg:!1,Gg:!0,Rg:null,ig:0,Ig:{},Ef:class{name="ErrnoError";constructor(a){this.Lf=a}},Mg:class{Uf={};node=null;get object(){return this.node}set object(a){this.node=a}get flags(){return this.Uf.flags}set flags(a){this.Uf.flags=a}get position(){return this.Uf.position}set position(a){this.Uf.position=a}},Lg:class{Ff={};Gf={};Qf=null;constructor(a,b,c,d){a||=this;this.parent=a;this.Kf=a.Kf;this.id=x.vg++;this.name=b;this.mode=c;this.rdev=d; +this.atime=this.mtime=this.ctime=Date.now()}get read(){return 365===(this.mode&365)}set read(a){a?this.mode|=365:this.mode&=-366}get write(){return 146===(this.mode&146)}set write(a){a?this.mode|=146:this.mode&=-147}get th(){return z(this.mode)}get sh(){return 8192===(this.mode&61440)}},createNode(a,b,c,d){a=new x.Lg(a,b,c,d);Bb(a);return a},tg(a){return a===a.parent},isFile(a){return 32768===(a&61440)},isFIFO(a){return 4096===(a&61440)},isSocket(a){return 49152===(a&49152)},Og:4096,Tg:a=>x.streams[a], +Pg:{open(a){a.Gf=x.Sg(a.node.rdev).Gf;a.Gf.open?.(a)},Nf(){throw new x.Ef(70);}},ug:a=>a>>8,Oh:a=>a&255,ag:(a,b)=>a<<8|b,Sg:a=>x.Dg[a],Kg(a,b){function c(k){x.ig--;return b(k)}function d(k){if(k){if(!d.Qg)return d.Qg=!0,c(k)}else++h>=f.length&&c(null)}"function"==typeof a&&(b=a,a=!1);x.ig++;1{if(!k.type.Kg)return d(null);k.type.Kg(k,a,d)})},Kf(a,b,c){var d="/"=== +c;if(d&&x.root)throw new x.Ef(10);if(!d&&c){var f=A(c,{gg:!1});c=f.path;f=f.node;if(f.Qf)throw new x.Ef(10);if(!z(f.mode))throw new x.Ef(54);}b={type:a,vh:b,Hg:c,fg:[]};a=a.Kf(b);a.Kf=b;b.root=a;d?x.root=a:f&&(f.Qf=b,f.Kf&&f.Kf.fg.push(b));return a},Uh(a){a=A(a,{gg:!1});if(!a.node.Qf)throw new x.Ef(28);a=a.node;var b=a.Qf,c=Jb(b);Object.keys(x.Sf).forEach(d=>{for(d=x.Sf[d];d;){var f=d.cg;c.includes(d.Kf)&&nb(d);d=f}});a.Qf=null;a.Kf.fg.splice(a.Kf.fg.indexOf(b),1)},lookup(a,b){return a.Ff.lookup(a, +b)},Wf(a,b,c){var d=A(a,{parent:!0}).node;a=Ua(a);if(!a)throw new x.Ef(28);if("."===a||".."===a)throw new x.Ef(20);var f=Db(d,a);if(f)throw new x.Ef(f);if(!d.Ff.Wf)throw new x.Ef(63);return d.Ff.Wf(d,a,b,c)},Jg(a){return Kb(A(a,{Of:!0}).node)},Th(a){return Kb(a.node)},create(a,b=438){return x.Wf(a,b&4095|32768,0)},mkdir(a,b=511){return x.Wf(a,b&1023|16384,0)},Ph(a,b){var c=a.split("/"),d="",f;for(f of c)if(f){if(d||"/"===a.charAt(0))d+="/";d+=f;try{x.mkdir(d,b)}catch(h){if(20!=h.Lf)throw h;}}},symlink(a, +b){if(!Za(a))throw new x.Ef(44);var c=A(b,{parent:!0}).node;if(!c)throw new x.Ef(44);b=Ua(b);var d=Db(c,b);if(d)throw new x.Ef(d);if(!c.Ff.symlink)throw new x.Ef(63);return c.Ff.symlink(c,b,a)},rename(a,b){var c=Ta(a),d=Ta(b),f=Ua(a),h=Ua(b);var k=A(a,{parent:!0});var m=k.node;k=A(b,{parent:!0});k=k.node;if(!m||!k)throw new x.Ef(44);if(m.Kf!==k.Kf)throw new x.Ef(75);var u=mb(m,f);a=$a(a,d);if("."!==a.charAt(0))throw new x.Ef(28);a=$a(b,c);if("."!==a.charAt(0))throw new x.Ef(55);try{var t=mb(k,h)}catch(C){}if(u!== +t){b=z(u.mode);if(f=Eb(m,f,b))throw new x.Ef(f);if(f=t?Eb(k,h,b):Db(k,h))throw new x.Ef(f);if(!m.Ff.rename)throw new x.Ef(63);if(u.Qf||t&&t.Qf)throw new x.Ef(10);if(k!==m&&(f=yb(m,"w")))throw new x.Ef(f);nb(u);try{m.Ff.rename(u,k,h),u.parent=k}catch(C){throw C;}finally{Bb(u)}}},rmdir(a){var b=A(a,{parent:!0}).node;a=Ua(a);var c=mb(b,a),d=Eb(b,a,!0);if(d)throw new x.Ef(d);if(!b.Ff.rmdir)throw new x.Ef(63);if(c.Qf)throw new x.Ef(10);b.Ff.rmdir(b,a);nb(c)},readdir(a){a=A(a,{Of:!0}).node;return Fb(a.Ff.readdir, +54)(a)},unlink(a){var b=A(a,{parent:!0}).node;if(!b)throw new x.Ef(44);a=Ua(a);var c=mb(b,a),d=Eb(b,a,!1);if(d)throw new x.Ef(d);if(!b.Ff.unlink)throw new x.Ef(63);if(c.Qf)throw new x.Ef(10);b.Ff.unlink(b,a);nb(c)},readlink(a){a=A(a).node;if(!a)throw new x.Ef(44);if(!a.Ff.readlink)throw new x.Ef(28);return a.Ff.readlink(a)},stat(a,b){a=A(a,{Of:!b}).node;return Fb(a.Ff.Pf,63)(a)},fstat(a){var b=B(a);a=b.node;var c=b.Gf.Pf;b=c?b:a;c??=a.Ff.Pf;Fb(c,63);return c(b)},lstat(a){return x.stat(a,!0)},chmod(a, +b,c){a="string"==typeof a?A(a,{Of:!c}).node:a;Mb(null,a,b,c)},lchmod(a,b){x.chmod(a,b,!0)},fchmod(a,b){a=B(a);Mb(a,a.node,b,!1)},chown(a,b,c,d){a="string"==typeof a?A(a,{Of:!d}).node:a;Ib(null,a,{timestamp:Date.now(),Eg:d})},lchown(a,b,c){x.chown(a,b,c,!0)},fchown(a){a=B(a);Ib(a,a.node,{timestamp:Date.now(),Eg:!1})},truncate(a,b){if(0>b)throw new x.Ef(28);a="string"==typeof a?A(a,{Of:!0}).node:a;Nb(null,a,b)},Mh(a,b){a=B(a);if(0>b||0===(a.flags&2097155))throw new x.Ef(28);Nb(a,a.node,b)},Vh(a,b,c){a= +A(a,{Of:!0}).node;Fb(a.Ff.Rf,63)(a,{atime:b,mtime:c})},open(a,b,c=438){if(""===a)throw new x.Ef(44);if("string"==typeof b){var d={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[b];if("undefined"==typeof d)throw Error(`Unknown file open mode: ${b}`);b=d}c=b&64?c&4095|32768:0;if("object"==typeof a)d=a;else{var f=a.endsWith("/");a=A(a,{Of:!(b&131072),uh:!0});d=a.node;a=a.path}var h=!1;if(b&64)if(d){if(b&128)throw new x.Ef(20);}else{if(f)throw new x.Ef(31);d=x.Wf(a,c|511,0);h=!0}if(!d)throw new x.Ef(44); +8192===(d.mode&61440)&&(b&=-513);if(b&65536&&!z(d.mode))throw new x.Ef(54);if(!h&&(f=d?40960===(d.mode&61440)?32:z(d.mode)&&("r"!==Cb(b)||b&576)?31:yb(d,Cb(b)):44))throw new x.Ef(f);b&512&&!h&&x.truncate(d,0);b&=-131713;f=Gb({node:d,path:Ab(d),flags:b,seekable:!0,position:0,Gf:d.Gf,wh:[],error:!1});f.Gf.open&&f.Gf.open(f);h&&x.chmod(d,c&511);!e.logReadFiles||b&1||a in x.Ig||(x.Ig[a]=1);return f},close(a){if(null===a.fd)throw new x.Ef(8);a.qg&&(a.qg=null);try{a.Gf.close&&a.Gf.close(a)}catch(b){throw b; +}finally{x.streams[a.fd]=null}a.fd=null},Nf(a,b,c){if(null===a.fd)throw new x.Ef(8);if(!a.seekable||!a.Gf.Nf)throw new x.Ef(70);if(0!=c&&1!=c&&2!=c)throw new x.Ef(28);a.position=a.Gf.Nf(a,b,c);a.wh=[];return a.position},read(a,b,c,d,f){if(0>d||0>f)throw new x.Ef(28);if(null===a.fd)throw new x.Ef(8);if(1===(a.flags&2097155))throw new x.Ef(8);if(z(a.node.mode))throw new x.Ef(31);if(!a.Gf.read)throw new x.Ef(28);var h="undefined"!=typeof f;if(!h)f=a.position;else if(!a.seekable)throw new x.Ef(70);b= +a.Gf.read(a,b,c,d,f);h||(a.position+=b);return b},write(a,b,c,d,f,h){if(0>d||0>f)throw new x.Ef(28);if(null===a.fd)throw new x.Ef(8);if(0===(a.flags&2097155))throw new x.Ef(8);if(z(a.node.mode))throw new x.Ef(31);if(!a.Gf.write)throw new x.Ef(28);a.seekable&&a.flags&1024&&x.Nf(a,0,2);var k="undefined"!=typeof f;if(!k)f=a.position;else if(!a.seekable)throw new x.Ef(70);b=a.Gf.write(a,b,c,d,f,h);k||(a.position+=b);return b},bg(a,b,c,d,f){if(0!==(d&2)&&0===(f&2)&&2!==(a.flags&2097155))throw new x.Ef(2); +if(1===(a.flags&2097155))throw new x.Ef(2);if(!a.Gf.bg)throw new x.Ef(43);if(!b)throw new x.Ef(28);return a.Gf.bg(a,b,c,d,f)},eg(a,b,c,d,f){return a.Gf.eg?a.Gf.eg(a,b,c,d,f):0},sg(a,b,c){if(!a.Gf.sg)throw new x.Ef(59);return a.Gf.sg(a,b,c)},readFile(a,b={}){b.flags=b.flags||0;b.encoding=b.encoding||"binary";"utf8"!==b.encoding&&"binary"!==b.encoding&&r(`Invalid encoding type "${b.encoding}"`);var c=x.open(a,b.flags);a=x.stat(a).size;var d=new Uint8Array(a);x.read(c,d,0,a,0);"utf8"===b.encoding&&(d= +v(d));x.close(c);return d},writeFile(a,b,c={}){c.flags=c.flags||577;a=x.open(a,c.flags,c.mode);"string"==typeof b&&(b=new Uint8Array(db(b,!0)));ArrayBuffer.isView(b)?x.write(a,b,0,b.byteLength,void 0,c.Fh):r("Unsupported data type");x.close(a)},cwd:()=>x.Cg,chdir(a){a=A(a,{Of:!0});if(null===a.node)throw new x.Ef(44);if(!z(a.node.mode))throw new x.Ef(54);var b=yb(a.node,"x");if(b)throw new x.Ef(b);x.Cg=a.path},hg(a,b,c){x.rg=!0;a??=e.stdin;b??=e.stdout;c??=e.stderr;a?x.Yf("/dev","stdin",a):x.symlink("/dev/tty", +"/dev/stdin");b?x.Yf("/dev","stdout",null,b):x.symlink("/dev/tty","/dev/stdout");c?x.Yf("/dev","stderr",null,c):x.symlink("/dev/tty1","/dev/stderr");x.open("/dev/stdin",0);x.open("/dev/stdout",1);x.open("/dev/stderr",1)},Sh(){x.rg=!1;for(var a of x.streams)a&&x.close(a)},Jh(a,b){try{var c=A(a,{Of:!b});a=c.path}catch(h){}var d=!1,f=null;try{c=A(a,{parent:!0}),Ua(a),c=A(a,{Of:!b}),d=!0,f=c.node}catch(h){}return d?f:null},Yf(a,b,c,d){a=Va("string"==typeof a?a:Ab(a),b);b=ob(!!c,!!d);var f;(f=x.Yf).ug?? +(f.ug=64);f=x.ag(x.Yf.ug++,0);gb(f,{open(h){h.seekable=!1},close(){d?.buffer?.length&&d(10)},read(h,k,m,u){for(var t=0,C=0;C>2]=b.dev;p[a+4>>2]=b.mode;p[a+8>>2]=b.nlink;p[a+12>>2]=b.uid;p[a+16>>2]=b.gid;p[a+20>>2]=b.rdev;ua[a+24>>3]=BigInt(b.size);n[a+32>>2]=4096;n[a+36>>2]=b.blocks;var c=b.atime.getTime(),d=b.mtime.getTime(),f=b.ctime.getTime();ua[a+40>>3]=BigInt(Math.floor(c/1E3));p[a+48>>2]=c%1E3*1E6;ua[a+56>>3]=BigInt(Math.floor(d/1E3));p[a+64>>2]=d%1E3*1E6;ua[a+72>>3]=BigInt(Math.floor(f/1E3));p[a+80>>2]=f%1E3*1E6;ua[a+88>>3]=BigInt(b.ino);return 0} +var Pa=void 0,Ub=a=>0===a%4&&(0!==a%100||0===a%400),Vb=[0,31,60,91,121,152,182,213,244,274,305,335],Wb=[0,31,59,90,120,151,181,212,243,273,304,334],Xb=[],Yb={},$b=()=>{if(!Zb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.language||"C").replace("-","_")+".UTF-8",_:da||"./this.program"},b;for(b in Yb)void 0===Yb[b]?delete a[b]:a[b]=Yb[b];var c=[];for(b in a)c.push(`${b}=${a[b]}`);Zb=c}return Zb},Zb,ac=[],bc,cc=a=>{var b= +ac[a];b||(ac[a]=b=bc.get(a));return b};x.Gh=(a,b,c,d,f,h,k,m,u,t)=>{xb(a,b,c,d,f,m,u,t).then(h).catch(k)};x.Rh=xb;x.Sf=Array(4096);x.Kf(y,{},"/");x.mkdir("/tmp");x.mkdir("/home");x.mkdir("/home/web_user"); +(function(){x.mkdir("/dev");gb(x.ag(1,3),{read:()=>0,write:(d,f,h,k)=>k,Nf:()=>0});Lb("/dev/null",x.ag(1,3));fb(x.ag(5,0),ib);fb(x.ag(6,0),jb);Lb("/dev/tty",x.ag(5,0));Lb("/dev/tty1",x.ag(6,0));var a=new Uint8Array(1024),b=0,c=()=>{0===b&&(Ya(a),b=a.byteLength);return a[--b]};x.Yf("/dev","random",c);x.Yf("/dev","urandom",c);x.mkdir("/dev/shm");x.mkdir("/dev/shm/tmp")})(); +(function(){x.mkdir("/proc");var a=x.mkdir("/proc/self");x.mkdir("/proc/self/fd");x.Kf({Kf(){var b=x.createNode(a,"fd",16895,73);b.Gf={Nf:y.Gf.Nf};b.Ff={lookup(c,d){c=+d;var f=B(c);c={parent:null,Kf:{Hg:"fake"},Ff:{readlink:()=>f.path},id:c+1};return c.parent=c},readdir(){return Array.from(x.streams.entries()).filter(([,c])=>c).map(([c])=>c.toString())}};return b}},{},"/proc/self/fd")})();x.Rg={MEMFS:y};e.noExitRuntime&&(Ha=e.noExitRuntime);e.preloadPlugins&&(ub=e.preloadPlugins);e.print&&(ka=e.print); +e.printErr&&(la=e.printErr);e.wasmBinary&&(ma=e.wasmBinary);e.thisProgram&&(da=e.thisProgram);if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0x.unlink(...a);e.FS_createPath=(...a)=>Ob(...a);e.FS_createDevice=(...a)=>x.Yf(...a);e.FS=x;e.FS_createDataFile=(...a)=>wb(...a);e.FS_createLazyFile=(...a)=>Rb(...a); +var dc={408364:a=>{e.TesseractProgress&&e.TesseractProgress(a)},408433:a=>{e.TesseractProgress&&e.TesseractProgress(a)}},ec,fc,gc,hc,ic,jc,kc,lc,mc,nc,oc,pc,qc,rc,sc,tc,uc,vc,wc,xc,yc,zc,Ac,Bc,Cc,Dc,Ec,Fc,Gc,Hc,Ic,Jc,Kc,Lc,Mc,Nc,Oc,Pc,Qc,Rc,Sc,Tc,Uc,Vc,Wc,Xc,Yc,Zc,$c,ad,bd,cd,dd,ed,fd,gd,hd,jd,kd,ld,md,nd,od,pd,qd,rd,sd,td,ud,vd,wd,xd,yd,zd,Ad,Bd,Cd,Dd,Ed,Fd,Gd,Hd,Id,Jd,Kd,Ld,Md,Nd,Od,Pd,Qd,Rd,Sd,Td,Ud,Vd,Wd,Xd,Yd,Zd,$d,ae,be,ce,de,ee,fe,ge,he,ie,je,ke,le,me,ne,oe,pe,qe,re,se,te,ue,ve,we,xe,ye,ze, +Ae,Be,Ce,De,Ee,Fe,Ge,He,Ie,Je,Ke,Le,Me,Ne,Oe,Pe,Qe,Re,Se,Te,Ue,Ve,We,Xe,Ye,Ze,$e,af,bf,cf,df,ef,ff,gf,hf,jf,kf,lf,mf,nf,of,pf,qf,rf,sf,tf,uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng,Og,Pg,Qg,Rg,Sg,Tg,Ug,Vg,Wg,Xg,Yg,Zg,$g,ah,bh,ch,dh,eh,fh,gh,hh,ih,jh,kh,lh,mh,nh,oh,ph,qh,rh,sh,th,uh,vh,wh,xh,yh,zh,Ah,Bh,Ch,Dh,Eh,Fh,Gh,Hh,Ih, +kb,Jh,Kh,Lh,Xh={P:function(){r("missing function: _ZN9tesseract11TessBaseAPI10GetOsdTextEi")},S:function(){r("missing function: _ZN9tesseract11TessBaseAPI23ClearAdaptiveClassifierEv")},J:function(){r("missing function: _ZN9tesseract11TessBaseAPI8DetectOSEPNS_9OSResultsE")},y:function(){r("missing function: _ZNK9tesseract9OSResults12print_scoresEv")},a:(a,b,c,d)=>r(`Assertion failed: ${a?v(l,a):""}, at: `+[b?b?v(l,b):"":"unknown filename",c,d?d?v(l,d):"":"unknown function"]),k:(a,b,c)=>{(new Ka(a)).hg(b, +c);La=a;Ma++;throw La;},p:function(a,b,c){Pa=c;try{var d=B(a);switch(b){case 0:var f=Qa();if(0>f)break;for(;x.streams[f];)f++;return Hb(d,f).fd;case 1:case 2:return 0;case 3:return d.flags;case 4:return f=Qa(),d.flags|=f,0;case 12:return f=Qa(),ra[f+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(h){if("undefined"==typeof x||"ErrnoError"!==h.name)throw h;return-h.Lf}},K:function(a,b){try{return Tb(b,x.fstat(a))}catch(c){if("undefined"==typeof x||"ErrnoError"!==c.name)throw c;return-c.Lf}},H:function(a, +b){try{if(0===b)return-28;var c=x.cwd(),d=bb(c)+1;if(b>2]=25856;n[f+4>>2]=5;n[f+8>>2]=191;n[f+12>>2]=35387;for(var h=0;32>h;h++)g[f+h+17]=a[h]||0}return 0;case 21510:case 21511:case 21512:return d.tty? +0:-59;case 21506:case 21507:case 21508:if(!d.tty)return-59;if(d.tty.Xf.qh)for(f=Qa(),a=[],h=0;32>h;h++)a.push(g[f+h+17]);return 0;case 21519:if(!d.tty)return-59;f=Qa();return n[f>>2]=0;case 21520:return d.tty?-28:-59;case 21537:case 21531:return f=Qa(),x.sg(d,b,f);case 21523:if(!d.tty)return-59;d.tty.Xf.rh&&(h=[24,80],f=Qa(),ra[f>>1]=h[0],ra[f+2>>1]=h[1]);return 0;case 21524:return d.tty?0:-59;case 21515:return d.tty?0:-59;default:return-28}}catch(k){if("undefined"==typeof x||"ErrnoError"!==k.name)throw k; +return-k.Lf}},I:function(a,b,c,d){try{b=b?v(l,b):"";var f=d&256;b=Sb(a,b,d&4096);return Tb(c,f?x.lstat(b):x.stat(b))}catch(h){if("undefined"==typeof x||"ErrnoError"!==h.name)throw h;return-h.Lf}},n:function(a,b,c,d){Pa=d;try{b=b?v(l,b):"";b=Sb(a,b);var f=d?Qa():0;return x.open(b,c,f).fd}catch(h){if("undefined"==typeof x||"ErrnoError"!==h.name)throw h;return-h.Lf}},v:function(a){try{return a=a?v(l,a):"",x.rmdir(a),0}catch(b){if("undefined"==typeof x||"ErrnoError"!==b.name)throw b;return-b.Lf}},w:function(a, +b,c){try{b=b?v(l,b):"";b=Sb(a,b);if(c)if(512===c)x.rmdir(b);else return-28;else x.unlink(b);return 0}catch(d){if("undefined"==typeof x||"ErrnoError"!==d.name)throw d;return-d.Lf}},N:()=>r(""),Q:a=>{do{var b=p[a>>2];a+=4;var c=p[a>>2];a+=4;var d=p[a>>2];a+=4;b=b?v(l,b):"";Ob("/",Ta(b));wb(b,null,g.subarray(d,d+c),!0,!0,!0)}while(p[a>>2])},t:()=>{throw Infinity;},A:function(a,b){a=-9007199254740992>a||9007199254740992>2]=a.getUTCSeconds();n[b+4>>2]=a.getUTCMinutes(); +n[b+8>>2]=a.getUTCHours();n[b+12>>2]=a.getUTCDate();n[b+16>>2]=a.getUTCMonth();n[b+20>>2]=a.getUTCFullYear()-1900;n[b+24>>2]=a.getUTCDay();n[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0},B:function(a,b){a=-9007199254740992>a||9007199254740992>2]=a.getSeconds();n[b+4>>2]=a.getMinutes();n[b+8>>2]=a.getHours();n[b+12>>2]=a.getDate();n[b+16>>2]=a.getMonth();n[b+20>>2]=a.getFullYear()-1900;n[b+24>>2]=a.getDay();n[b+28>>2]=(Ub(a.getFullYear())? +Vb:Wb)[a.getMonth()]+a.getDate()-1|0;n[b+36>>2]=-(60*a.getTimezoneOffset());var c=(new Date(a.getFullYear(),6,1)).getTimezoneOffset(),d=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();n[b+32>>2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},C:function(a){var b=new Date(n[a+20>>2]+1900,n[a+16>>2],n[a+12>>2],n[a+8>>2],n[a+4>>2],n[a>>2],0),c=n[a+32>>2],d=b.getTimezoneOffset(),f=(new Date(b.getFullYear(),6,1)).getTimezoneOffset(),h=(new Date(b.getFullYear(),0,1)).getTimezoneOffset(),k=Math.min(h, +f);0>c?n[a+32>>2]=Number(f!=h&&k==d):0>2]=b.getDay();n[a+28>>2]=(Ub(b.getFullYear())?Vb:Wb)[b.getMonth()]+b.getDate()-1|0;n[a>>2]=b.getSeconds();n[a+4>>2]=b.getMinutes();n[a+8>>2]=b.getHours();n[a+12>>2]=b.getDate();n[a+16>>2]=b.getMonth();n[a+20>>2]=b.getYear();a=b.getTime();return BigInt(isNaN(a)?-1:a/1E3)},x:function(a,b,c,d,f,h,k){f=-9007199254740992>f||9007199254740992>2]=u.Ag;p[k>>2]=t;return 0}catch(C){if("undefined"==typeof x||"ErrnoError"!==C.name)throw C;return-C.Lf}},z:function(a,b,c,d,f,h){h=-9007199254740992>h||9007199254740992{var f=(new Date).getFullYear(),h=(new Date(f,0,1)).getTimezoneOffset();f=(new Date(f, +6,1)).getTimezoneOffset();p[a>>2]=60*Math.max(h,f);n[b>>2]=Number(h!=f);b=k=>{var m=Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(m/60)).padStart(2,"0")}${String(m%60).padStart(2,"0")}`};a=b(h);b=b(f);f=a))return 28;ua[c>>3]=BigInt(Math.round(1E6*(0===a?Date.now():performance.now())));return 0},s:(a,b,c)=>{Xb.length=0;for(var d;d=l[b++];){var f=105!=d;f&=112!=d;c+=f&&c%8?4:0;Xb.push(112==d?p[c>>2]: +106==d?ua[c>>3]:105==d?n[c>>2]:ta[c>>3]);c+=f?8:4}return dc[a](...Xb)},L:()=>Date.now(),u:a=>{var b=l.length;a>>>=0;if(2147483648=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);a:{d=(Math.min(2147483648,65536*Math.ceil(Math.max(a,d)/65536))-qa.buffer.byteLength+65535)/65536|0;try{qa.grow(d);wa();var f=1;break a}catch(h){}f=void 0}if(f)return!0}return!1},F:(a,b)=>{var c=0,d=0,f;for(f of $b()){var h=b+c;p[a+d>>2]=h;c+=cb(f,l,h,Infinity)+1;d+=4}return 0},G:(a,b)=>{var c= +$b();p[a>>2]=c.length;a=0;for(var d of c)a+=bb(d)+1;p[b>>2]=a;return 0},R:a=>{Ha||(e.onExit?.(a),na=!0);ea(a,new Ba(a))},m:function(a){try{var b=B(a);x.close(b);return 0}catch(c){if("undefined"==typeof x||"ErrnoError"!==c.name)throw c;return c.Lf}},o:function(a,b,c,d){try{a:{var f=B(a);a=b;for(var h,k=b=0;k>2],u=p[a+4>>2];a+=8;var t=x.read(f,g,m,u,h);if(0>t){var C=-1;break a}b+=t;if(t>2]=C;return 0}catch(q){if("undefined"==typeof x|| +"ErrnoError"!==q.name)throw q;return q.Lf}},E:function(a,b,c,d){b=-9007199254740992>b||9007199254740992>3]=BigInt(f.position);f.qg&&0===b&&0===c&&(f.qg=null);return 0}catch(h){if("undefined"==typeof x||"ErrnoError"!==h.name)throw h;return h.Lf}},l:function(a,b,c,d){try{a:{var f=B(a);a=b;for(var h,k=b=0;k>2],u=p[a+4>>2];a+=8;var t=x.write(f,g,m,u,h);if(0>t){var C=-1;break a}b+=t;if(t>2]=C;return 0}catch(q){if("undefined"==typeof x||"ErrnoError"!==q.name)throw q;return q.Lf}},c:Mh,e:Nh,b:Oh,h:Ph,i:Qh,d:Rh,f:Sh,g:Th,j:Uh,q:Vh,r:Wh};function Oh(a,b,c,d){var f=Lh();try{return cc(a)(b,c,d)}catch(h){Kh(f);if(h!==h+0)throw h;Jh(1,0)}}function Rh(a,b){var c=Lh();try{cc(a)(b)}catch(d){Kh(c);if(d!==d+0)throw d;Jh(1,0)}}function Mh(a,b){var c=Lh();try{return cc(a)(b)}catch(d){Kh(c);if(d!==d+0)throw d;Jh(1,0)}} +function Th(a,b,c,d){var f=Lh();try{cc(a)(b,c,d)}catch(h){Kh(f);if(h!==h+0)throw h;Jh(1,0)}}function Sh(a,b,c){var d=Lh();try{cc(a)(b,c)}catch(f){Kh(d);if(f!==f+0)throw f;Jh(1,0)}}function Nh(a,b,c){var d=Lh();try{return cc(a)(b,c)}catch(f){Kh(d);if(f!==f+0)throw f;Jh(1,0)}}function Ph(a,b,c,d,f){var h=Lh();try{return cc(a)(b,c,d,f)}catch(k){Kh(h);if(k!==k+0)throw k;Jh(1,0)}}function Uh(a,b,c,d,f){var h=Lh();try{cc(a)(b,c,d,f)}catch(k){Kh(h);if(k!==k+0)throw k;Jh(1,0)}} +function Qh(a,b,c,d,f,h){var k=Lh();try{return cc(a)(b,c,d,f,h)}catch(m){Kh(k);if(m!==m+0)throw m;Jh(1,0)}}function Wh(a,b,c,d,f,h,k,m,u,t){var C=Lh();try{cc(a)(b,c,d,f,h,k,m,u,t)}catch(q){Kh(C);if(q!==q+0)throw q;Jh(1,0)}}function Vh(a,b,c,d,f,h){var k=Lh();try{cc(a)(b,c,d,f,h)}catch(m){Kh(k);if(m!==m+0)throw m;Jh(1,0)}} +function Yh(){function a(){e.calledRun=!0;if(!na){va=!0;e.noFSInit||x.rg||x.hg();Zh.U();x.Gg=!1;oa?.(e);e.onRuntimeInitialized?.();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();Da.push(b)}Ca(Da)}}if(0{setTimeout(()=>e.setStatus(""),1);a()},1)):a()}}var Zh; +Zh=await (async function(){function a(c){Zh=c.exports;qa=Zh.T;wa();bc=Zh.da;c=Zh;e._emscripten_bind_ParagraphJustification___destroy___0=ec=c.V;e._emscripten_bind_BoolPtr___destroy___0=fc=c.W;e._emscripten_bind_TessResultRenderer_BeginDocument_1=gc=c.X;e._emscripten_bind_TessResultRenderer_AddImage_1=hc=c.Y;e._emscripten_bind_TessResultRenderer_EndDocument_0=ic=c.Z;e._emscripten_bind_TessResultRenderer_happy_0=jc=c._;e._emscripten_bind_TessResultRenderer_file_extension_0=kc=c.$;e._emscripten_bind_TessResultRenderer_title_0= +lc=c.aa;e._emscripten_bind_TessResultRenderer_imagenum_0=mc=c.ba;e._emscripten_bind_TessResultRenderer___destroy___0=nc=c.ca;e._emscripten_bind_LongStarPtr___destroy___0=oc=c.ea;e._emscripten_bind_VoidPtr___destroy___0=pc=c.fa;e._emscripten_bind_ResultIterator_ResultIterator_1=qc=c.ga;e._emscripten_bind_ResultIterator_Begin_0=rc=c.ha;e._emscripten_bind_ResultIterator_RestartParagraph_0=sc=c.ia;e._emscripten_bind_ResultIterator_IsWithinFirstTextlineOfParagraph_0=tc=c.ja;e._emscripten_bind_ResultIterator_RestartRow_0= +uc=c.ka;e._emscripten_bind_ResultIterator_Next_1=vc=c.la;e._emscripten_bind_ResultIterator_IsAtBeginningOf_1=wc=c.ma;e._emscripten_bind_ResultIterator_IsAtFinalElement_2=xc=c.na;e._emscripten_bind_ResultIterator_Cmp_1=yc=c.oa;e._emscripten_bind_ResultIterator_SetBoundingBoxComponents_2=zc=c.pa;e._emscripten_bind_ResultIterator_BoundingBox_5=Ac=c.qa;e._emscripten_bind_ResultIterator_BoundingBox_6=Bc=c.ra;e._emscripten_bind_ResultIterator_BoundingBoxInternal_5=Cc=c.sa;e._emscripten_bind_ResultIterator_Empty_1= +Dc=c.ta;e._emscripten_bind_ResultIterator_BlockType_0=Ec=c.ua;e._emscripten_bind_ResultIterator_BlockPolygon_0=Fc=c.va;e._emscripten_bind_ResultIterator_GetBinaryImage_1=Gc=c.wa;e._emscripten_bind_ResultIterator_GetImage_5=Hc=c.xa;e._emscripten_bind_ResultIterator_Baseline_5=Ic=c.ya;e._emscripten_bind_ResultIterator_RowAttributes_3=Jc=c.za;e._emscripten_bind_ResultIterator_Orientation_4=Kc=c.Aa;e._emscripten_bind_ResultIterator_ParagraphInfo_4=Lc=c.Ba;e._emscripten_bind_ResultIterator_ParagraphIsLtr_0= +Mc=c.Ca;e._emscripten_bind_ResultIterator_GetUTF8Text_1=Nc=c.Da;e._emscripten_bind_ResultIterator_SetLineSeparator_1=Oc=c.Ea;e._emscripten_bind_ResultIterator_SetParagraphSeparator_1=Pc=c.Fa;e._emscripten_bind_ResultIterator_Confidence_1=Qc=c.Ga;e._emscripten_bind_ResultIterator_WordFontAttributes_8=Rc=c.Ha;e._emscripten_bind_ResultIterator_WordRecognitionLanguage_0=Sc=c.Ia;e._emscripten_bind_ResultIterator_WordDirection_0=Tc=c.Ja;e._emscripten_bind_ResultIterator_WordIsFromDictionary_0=Uc=c.Ka;e._emscripten_bind_ResultIterator_WordIsNumeric_0= +Vc=c.La;e._emscripten_bind_ResultIterator_HasBlamerInfo_0=Wc=c.Ma;e._emscripten_bind_ResultIterator_HasTruthString_0=Xc=c.Na;e._emscripten_bind_ResultIterator_EquivalentToTruth_1=Yc=c.Oa;e._emscripten_bind_ResultIterator_WordTruthUTF8Text_0=Zc=c.Pa;e._emscripten_bind_ResultIterator_WordNormedUTF8Text_0=$c=c.Qa;e._emscripten_bind_ResultIterator_WordLattice_1=ad=c.Ra;e._emscripten_bind_ResultIterator_SymbolIsSuperscript_0=bd=c.Sa;e._emscripten_bind_ResultIterator_SymbolIsSubscript_0=cd=c.Ta;e._emscripten_bind_ResultIterator_SymbolIsDropcap_0= +dd=c.Ua;e._emscripten_bind_ResultIterator___destroy___0=ed=c.Va;e._emscripten_bind_TextlineOrder___destroy___0=fd=c.Wa;e._emscripten_bind_ETEXT_DESC___destroy___0=gd=c.Xa;e._emscripten_bind_PageIterator_Begin_0=hd=c.Ya;e._emscripten_bind_PageIterator_RestartParagraph_0=jd=c.Za;e._emscripten_bind_PageIterator_IsWithinFirstTextlineOfParagraph_0=kd=c._a;e._emscripten_bind_PageIterator_RestartRow_0=ld=c.$a;e._emscripten_bind_PageIterator_Next_1=md=c.ab;e._emscripten_bind_PageIterator_IsAtBeginningOf_1= +nd=c.bb;e._emscripten_bind_PageIterator_IsAtFinalElement_2=od=c.cb;e._emscripten_bind_PageIterator_Cmp_1=pd=c.db;e._emscripten_bind_PageIterator_SetBoundingBoxComponents_2=qd=c.eb;e._emscripten_bind_PageIterator_BoundingBox_5=rd=c.fb;e._emscripten_bind_PageIterator_BoundingBox_6=sd=c.gb;e._emscripten_bind_PageIterator_BoundingBoxInternal_5=td=c.hb;e._emscripten_bind_PageIterator_Empty_1=ud=c.ib;e._emscripten_bind_PageIterator_BlockType_0=vd=c.jb;e._emscripten_bind_PageIterator_BlockPolygon_0=wd=c.kb; +e._emscripten_bind_PageIterator_GetBinaryImage_1=xd=c.lb;e._emscripten_bind_PageIterator_GetImage_5=yd=c.mb;e._emscripten_bind_PageIterator_Baseline_5=zd=c.nb;e._emscripten_bind_PageIterator_Orientation_4=Ad=c.ob;e._emscripten_bind_PageIterator_ParagraphInfo_4=Bd=c.pb;e._emscripten_bind_PageIterator___destroy___0=Cd=c.qb;e._emscripten_bind_WritingDirection___destroy___0=Dd=c.rb;e._emscripten_bind_WordChoiceIterator_WordChoiceIterator_1=Ed=c.sb;e._emscripten_bind_WordChoiceIterator_Next_0=Fd=c.tb; +e._emscripten_bind_WordChoiceIterator_GetUTF8Text_0=Gd=c.ub;e._emscripten_bind_WordChoiceIterator_Confidence_0=Hd=c.vb;e._emscripten_bind_WordChoiceIterator___destroy___0=Id=c.wb;e._emscripten_bind_Box_get_x_0=Jd=c.xb;e._emscripten_bind_Box_get_y_0=Kd=c.yb;e._emscripten_bind_Box_get_w_0=Ld=c.zb;e._emscripten_bind_Box_get_h_0=Md=c.Ab;e._emscripten_bind_Box_get_refcount_0=Nd=c.Bb;e._emscripten_bind_Box___destroy___0=Od=c.Cb;e._emscripten_bind_TessPDFRenderer_TessPDFRenderer_3=Pd=c.Db;e._emscripten_bind_TessPDFRenderer_BeginDocument_1= +Qd=c.Eb;e._emscripten_bind_TessPDFRenderer_AddImage_1=Rd=c.Fb;e._emscripten_bind_TessPDFRenderer_EndDocument_0=Sd=c.Gb;e._emscripten_bind_TessPDFRenderer_happy_0=Td=c.Hb;e._emscripten_bind_TessPDFRenderer_file_extension_0=Ud=c.Ib;e._emscripten_bind_TessPDFRenderer_title_0=Vd=c.Jb;e._emscripten_bind_TessPDFRenderer_imagenum_0=Wd=c.Kb;e._emscripten_bind_TessPDFRenderer___destroy___0=Xd=c.Lb;e._emscripten_bind_PixaPtr___destroy___0=Yd=c.Mb;e._emscripten_bind_FloatPtr___destroy___0=Zd=c.Nb;e._emscripten_bind_ChoiceIterator_ChoiceIterator_1= +$d=c.Ob;e._emscripten_bind_ChoiceIterator_Next_0=ae=c.Pb;e._emscripten_bind_ChoiceIterator_GetUTF8Text_0=be=c.Qb;e._emscripten_bind_ChoiceIterator_Confidence_0=ce=c.Rb;e._emscripten_bind_ChoiceIterator___destroy___0=de=c.Sb;e._emscripten_bind_PixPtr___destroy___0=ee=c.Tb;e._emscripten_bind_UNICHARSET_get_script_from_script_id_1=fe=c.Ub;e._emscripten_bind_UNICHARSET_get_script_id_from_name_1=ge=c.Vb;e._emscripten_bind_UNICHARSET_get_script_table_size_0=he=c.Wb;e._emscripten_bind_UNICHARSET___destroy___0= +ie=c.Xb;e._emscripten_bind_IntPtr___destroy___0=je=c.Yb;e._emscripten_bind_Orientation___destroy___0=ke=c.Zb;e._emscripten_bind_OSBestResult_get_orientation_id_0=le=c._b;e._emscripten_bind_OSBestResult_get_script_id_0=me=c.$b;e._emscripten_bind_OSBestResult_get_sconfidence_0=ne=c.ac;e._emscripten_bind_OSBestResult_get_oconfidence_0=oe=c.bc;e._emscripten_bind_OSBestResult___destroy___0=pe=c.cc;e._emscripten_bind_Boxa_get_n_0=qe=c.dc;e._emscripten_bind_Boxa_get_nalloc_0=re=c.ec;e._emscripten_bind_Boxa_get_refcount_0= +se=c.fc;e._emscripten_bind_Boxa_get_box_0=te=c.gc;e._emscripten_bind_Boxa___destroy___0=ue=c.hc;e._emscripten_bind_PixColormap_get_array_0=ve=c.ic;e._emscripten_bind_PixColormap_get_depth_0=we=c.jc;e._emscripten_bind_PixColormap_get_nalloc_0=xe=c.kc;e._emscripten_bind_PixColormap_get_n_0=ye=c.lc;e._emscripten_bind_PixColormap___destroy___0=ze=c.mc;e._emscripten_bind_Pta_get_n_0=Ae=c.nc;e._emscripten_bind_Pta_get_nalloc_0=Be=c.oc;e._emscripten_bind_Pta_get_refcount_0=Ce=c.pc;e._emscripten_bind_Pta_get_x_0= +De=c.qc;e._emscripten_bind_Pta_get_y_0=Ee=c.rc;e._emscripten_bind_Pta___destroy___0=Fe=c.sc;e._emscripten_bind_Pix_get_w_0=Ge=c.tc;e._emscripten_bind_Pix_get_h_0=He=c.uc;e._emscripten_bind_Pix_get_d_0=Ie=c.vc;e._emscripten_bind_Pix_get_spp_0=Je=c.wc;e._emscripten_bind_Pix_get_wpl_0=Ke=c.xc;e._emscripten_bind_Pix_get_refcount_0=Le=c.yc;e._emscripten_bind_Pix_get_xres_0=Me=c.zc;e._emscripten_bind_Pix_get_yres_0=Ne=c.Ac;e._emscripten_bind_Pix_get_informat_0=Oe=c.Bc;e._emscripten_bind_Pix_get_special_0= +Pe=c.Cc;e._emscripten_bind_Pix_get_text_0=Qe=c.Dc;e._emscripten_bind_Pix_get_colormap_0=Re=c.Ec;e._emscripten_bind_Pix_get_data_0=Se=c.Fc;e._emscripten_bind_Pix___destroy___0=Te=c.Gc;e._emscripten_bind_DoublePtr___destroy___0=Ue=c.Hc;e._emscripten_bind_Dawg___destroy___0=Ve=c.Ic;e._emscripten_bind_BoxPtr___destroy___0=We=c.Jc;e._emscripten_bind_TessBaseAPI_TessBaseAPI_0=Xe=c.Kc;e._emscripten_bind_TessBaseAPI_Version_0=Ye=c.Lc;e._emscripten_bind_TessBaseAPI_SetInputName_1=Ze=c.Mc;e._emscripten_bind_TessBaseAPI_GetInputName_0= +$e=c.Nc;e._emscripten_bind_TessBaseAPI_SetInputImage_1=af=c.Oc;e._emscripten_bind_TessBaseAPI_GetInputImage_0=bf=c.Pc;e._emscripten_bind_TessBaseAPI_GetSourceYResolution_0=cf=c.Qc;e._emscripten_bind_TessBaseAPI_GetDatapath_0=df=c.Rc;e._emscripten_bind_TessBaseAPI_SetOutputName_1=ef=c.Sc;e._emscripten_bind_TessBaseAPI_SetVariable_2=ff=c.Tc;e._emscripten_bind_TessBaseAPI_SetDebugVariable_2=gf=c.Uc;e._emscripten_bind_TessBaseAPI_GetIntVariable_2=hf=c.Vc;e._emscripten_bind_TessBaseAPI_GetBoolVariable_2= +jf=c.Wc;e._emscripten_bind_TessBaseAPI_GetDoubleVariable_2=kf=c.Xc;e._emscripten_bind_TessBaseAPI_GetStringVariable_1=lf=c.Yc;e._emscripten_bind_TessBaseAPI_SaveParameters_1=mf=c.Zc;e._emscripten_bind_TessBaseAPI_RestoreParameters_1=nf=c._c;e._emscripten_bind_TessBaseAPI_Init_2=of=c.$c;e._emscripten_bind_TessBaseAPI_Init_3=pf=c.ad;e._emscripten_bind_TessBaseAPI_Init_4=qf=c.bd;e._emscripten_bind_TessBaseAPI_GetInitLanguagesAsString_0=rf=c.cd;e._emscripten_bind_TessBaseAPI_InitForAnalysePage_0=sf=c.dd; +e._emscripten_bind_TessBaseAPI_ReadConfigFile_1=tf=c.ed;e._emscripten_bind_TessBaseAPI_ReadDebugConfigFile_1=uf=c.fd;e._emscripten_bind_TessBaseAPI_SetPageSegMode_1=vf=c.gd;e._emscripten_bind_TessBaseAPI_GetPageSegMode_0=wf=c.hd;e._emscripten_bind_TessBaseAPI_TesseractRect_7=xf=c.id;e._emscripten_bind_TessBaseAPI_ClearAdaptiveClassifier_0=yf=c.jd;e._emscripten_bind_TessBaseAPI_SetImage_1=zf=c.kd;e._emscripten_bind_TessBaseAPI_SetImage_5=Af=c.ld;e._emscripten_bind_TessBaseAPI_SetImageFile_1=Bf=c.md; +e._emscripten_bind_TessBaseAPI_SetSourceResolution_1=Cf=c.nd;e._emscripten_bind_TessBaseAPI_SetRectangle_4=Df=c.od;e._emscripten_bind_TessBaseAPI_GetThresholdedImage_0=Ef=c.pd;e._emscripten_bind_TessBaseAPI_WriteImage_0=Ff=c.qd;e._emscripten_bind_TessBaseAPI_FindLines_0=Gf=c.rd;e._emscripten_bind_TessBaseAPI_GetGradient_0=Hf=c.sd;e._emscripten_bind_TessBaseAPI_GetRegions_1=If=c.td;e._emscripten_bind_TessBaseAPI_GetTextlines_2=Jf=c.ud;e._emscripten_bind_TessBaseAPI_GetTextlines_5=Kf=c.vd;e._emscripten_bind_TessBaseAPI_GetStrips_2= +Lf=c.wd;e._emscripten_bind_TessBaseAPI_GetWords_1=Mf=c.xd;e._emscripten_bind_TessBaseAPI_GetConnectedComponents_1=Nf=c.yd;e._emscripten_bind_TessBaseAPI_GetComponentImages_4=Of=c.zd;e._emscripten_bind_TessBaseAPI_GetComponentImages_7=Pf=c.Ad;e._emscripten_bind_TessBaseAPI_GetThresholdedImageScaleFactor_0=Qf=c.Bd;e._emscripten_bind_TessBaseAPI_AnalyseLayout_0=Rf=c.Cd;e._emscripten_bind_TessBaseAPI_AnalyseLayout_1=Sf=c.Dd;e._emscripten_bind_TessBaseAPI_Recognize_1=Tf=c.Ed;e._emscripten_bind_TessBaseAPI_ProcessPages_4= +Uf=c.Fd;e._emscripten_bind_TessBaseAPI_ProcessPage_6=Vf=c.Gd;e._emscripten_bind_TessBaseAPI_GetIterator_0=Wf=c.Hd;e._emscripten_bind_TessBaseAPI_GetUTF8Text_0=Xf=c.Id;e._emscripten_bind_TessBaseAPI_GetHOCRText_1=Yf=c.Jd;e._emscripten_bind_TessBaseAPI_GetJSONText_1=Zf=c.Kd;e._emscripten_bind_TessBaseAPI_GetTSVText_1=$f=c.Ld;e._emscripten_bind_TessBaseAPI_GetBoxText_1=ag=c.Md;e._emscripten_bind_TessBaseAPI_GetUNLVText_0=bg=c.Nd;e._emscripten_bind_TessBaseAPI_GetOsdText_1=cg=c.Od;e._emscripten_bind_TessBaseAPI_MeanTextConf_0= +dg=c.Pd;e._emscripten_bind_TessBaseAPI_AllWordConfidences_0=eg=c.Qd;e._emscripten_bind_TessBaseAPI_Clear_0=fg=c.Rd;e._emscripten_bind_TessBaseAPI_End_0=gg=c.Sd;e._emscripten_bind_TessBaseAPI_ClearPersistentCache_0=hg=c.Td;e._emscripten_bind_TessBaseAPI_IsValidWord_1=ig=c.Ud;e._emscripten_bind_TessBaseAPI_IsValidCharacter_1=jg=c.Vd;e._emscripten_bind_TessBaseAPI_DetectOS_1=kg=c.Wd;e._emscripten_bind_TessBaseAPI_GetUnichar_1=lg=c.Xd;e._emscripten_bind_TessBaseAPI_GetDawg_1=mg=c.Yd;e._emscripten_bind_TessBaseAPI_NumDawgs_0= +ng=c.Zd;e._emscripten_bind_TessBaseAPI_oem_0=og=c._d;e._emscripten_bind_TessBaseAPI___destroy___0=pg=c.$d;e._emscripten_bind_OSResults_OSResults_0=qg=c.ae;e._emscripten_bind_OSResults_print_scores_0=rg=c.be;e._emscripten_bind_OSResults_get_best_result_0=sg=c.ce;e._emscripten_bind_OSResults_get_unicharset_0=tg=c.de;e._emscripten_bind_OSResults___destroy___0=ug=c.ee;e._emscripten_bind_Pixa_get_n_0=vg=c.fe;e._emscripten_bind_Pixa_get_nalloc_0=wg=c.ge;e._emscripten_bind_Pixa_get_refcount_0=xg=c.he;e._emscripten_bind_Pixa_get_pix_0= +yg=c.ie;e._emscripten_bind_Pixa_get_boxa_0=zg=c.je;e._emscripten_bind_Pixa___destroy___0=Ag=c.ke;e._emscripten_enum_PageIteratorLevel_RIL_BLOCK=Bg=c.le;e._emscripten_enum_PageIteratorLevel_RIL_PARA=Cg=c.me;e._emscripten_enum_PageIteratorLevel_RIL_TEXTLINE=Dg=c.ne;e._emscripten_enum_PageIteratorLevel_RIL_WORD=Eg=c.oe;e._emscripten_enum_PageIteratorLevel_RIL_SYMBOL=Fg=c.pe;e._emscripten_enum_OcrEngineMode_OEM_TESSERACT_ONLY=Gg=c.qe;e._emscripten_enum_OcrEngineMode_OEM_LSTM_ONLY=Hg=c.re;e._emscripten_enum_OcrEngineMode_OEM_TESSERACT_LSTM_COMBINED= +Ig=c.se;e._emscripten_enum_OcrEngineMode_OEM_DEFAULT=Jg=c.te;e._emscripten_enum_OcrEngineMode_OEM_COUNT=Kg=c.ue;e._emscripten_enum_WritingDirection__WRITING_DIRECTION_LEFT_TO_RIGHT=Lg=c.ve;e._emscripten_enum_WritingDirection__WRITING_DIRECTION_RIGHT_TO_LEFT=Mg=c.we;e._emscripten_enum_WritingDirection__WRITING_DIRECTION_TOP_TO_BOTTOM=Ng=c.xe;e._emscripten_enum_PolyBlockType_PT_UNKNOWN=Og=c.ye;e._emscripten_enum_PolyBlockType_PT_FLOWING_TEXT=Pg=c.ze;e._emscripten_enum_PolyBlockType_PT_HEADING_TEXT= +Qg=c.Ae;e._emscripten_enum_PolyBlockType_PT_PULLOUT_TEXT=Rg=c.Be;e._emscripten_enum_PolyBlockType_PT_EQUATION=Sg=c.Ce;e._emscripten_enum_PolyBlockType_PT_INLINE_EQUATION=Tg=c.De;e._emscripten_enum_PolyBlockType_PT_TABLE=Ug=c.Ee;e._emscripten_enum_PolyBlockType_PT_VERTICAL_TEXT=Vg=c.Fe;e._emscripten_enum_PolyBlockType_PT_CAPTION_TEXT=Wg=c.Ge;e._emscripten_enum_PolyBlockType_PT_FLOWING_IMAGE=Xg=c.He;e._emscripten_enum_PolyBlockType_PT_HEADING_IMAGE=Yg=c.Ie;e._emscripten_enum_PolyBlockType_PT_PULLOUT_IMAGE= +Zg=c.Je;e._emscripten_enum_PolyBlockType_PT_HORZ_LINE=$g=c.Ke;e._emscripten_enum_PolyBlockType_PT_VERT_LINE=ah=c.Le;e._emscripten_enum_PolyBlockType_PT_NOISE=bh=c.Me;e._emscripten_enum_PolyBlockType_PT_COUNT=ch=c.Ne;e._emscripten_enum_StrongScriptDirection_DIR_NEUTRAL=dh=c.Oe;e._emscripten_enum_StrongScriptDirection_DIR_LEFT_TO_RIGHT=eh=c.Pe;e._emscripten_enum_StrongScriptDirection_DIR_RIGHT_TO_LEFT=fh=c.Qe;e._emscripten_enum_StrongScriptDirection_DIR_MIX=gh=c.Re;e._emscripten_enum_ParagraphJustification__JUSTIFICATION_UNKNOWN= +hh=c.Se;e._emscripten_enum_ParagraphJustification__JUSTIFICATION_LEFT=ih=c.Te;e._emscripten_enum_ParagraphJustification__JUSTIFICATION_CENTER=jh=c.Ue;e._emscripten_enum_ParagraphJustification__JUSTIFICATION_RIGHT=kh=c.Ve;e._emscripten_enum_TextlineOrder__TEXTLINE_ORDER_LEFT_TO_RIGHT=lh=c.We;e._emscripten_enum_TextlineOrder__TEXTLINE_ORDER_RIGHT_TO_LEFT=mh=c.Xe;e._emscripten_enum_TextlineOrder__TEXTLINE_ORDER_TOP_TO_BOTTOM=nh=c.Ye;e._emscripten_enum_Orientation__ORIENTATION_PAGE_UP=oh=c.Ze;e._emscripten_enum_Orientation__ORIENTATION_PAGE_RIGHT= +ph=c._e;e._emscripten_enum_Orientation__ORIENTATION_PAGE_DOWN=qh=c.$e;e._emscripten_enum_Orientation__ORIENTATION_PAGE_LEFT=rh=c.af;e._emscripten_enum_PageSegMode_PSM_OSD_ONLY=sh=c.bf;e._emscripten_enum_PageSegMode_PSM_AUTO_OSD=th=c.cf;e._emscripten_enum_PageSegMode_PSM_AUTO_ONLY=uh=c.df;e._emscripten_enum_PageSegMode_PSM_AUTO=vh=c.ef;e._emscripten_enum_PageSegMode_PSM_SINGLE_COLUMN=wh=c.ff;e._emscripten_enum_PageSegMode_PSM_SINGLE_BLOCK_VERT_TEXT=xh=c.gf;e._emscripten_enum_PageSegMode_PSM_SINGLE_BLOCK= +yh=c.hf;e._emscripten_enum_PageSegMode_PSM_SINGLE_LINE=zh=c.jf;e._emscripten_enum_PageSegMode_PSM_SINGLE_WORD=Ah=c.kf;e._emscripten_enum_PageSegMode_PSM_CIRCLE_WORD=Bh=c.lf;e._emscripten_enum_PageSegMode_PSM_SINGLE_CHAR=Ch=c.mf;e._emscripten_enum_PageSegMode_PSM_SPARSE_TEXT=Dh=c.nf;e._emscripten_enum_PageSegMode_PSM_SPARSE_TEXT_OSD=Eh=c.of;e._emscripten_enum_PageSegMode_PSM_RAW_LINE=Fh=c.pf;e._emscripten_enum_PageSegMode_PSM_COUNT=Gh=c.qf;e._pixDestroy=c.rf;e._ptaDestroy=c.sf;e._boxaDestroy=c.tf; +e._pixaDestroy=c.uf;e._pixReadMem=c.vf;e._free=Hh=c.wf;e._malloc=Ih=c.xf;e._pixReadHeaderMem=c.yf;kb=c.zf;Jh=c.Af;Kh=c.Bf;Lh=c.Cf;return Zh}var b={a:Xh};if(e.instantiateWasm)return new Promise(c=>{e.instantiateWasm(b,(d,f)=>{c(a(d,f))})});xa??=e.locateFile?e.locateFile("tesseract-core-simd-lstm.wasm",fa):fa+"tesseract-core-simd-lstm.wasm";return a((await Aa(b)).instance)}());Yh();function D(){}D.prototype=Object.create(D.prototype);D.prototype.constructor=D;D.prototype.If=D;D.Jf={}; +e.WrapperObject=D;function $h(a){return(a||D).Jf}e.getCache=$h;function E(a,b){var c=$h(b),d=c[a];if(d)return d;d=Object.create((b||D).prototype);d.Df=a;return c[a]=d}e.wrapPointer=E;e.castObject=function(a,b){return E(a.Df,b)};e.NULL=E(0);e.destroy=function(a){if(!a.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";a.__destroy__();delete $h(a.If)[a.Df]};e.compare=function(a,b){return a.Df===b.Df};e.getPointer=function(a){return a.Df};e.getClass=function(a){return a.If}; +var ai=0,bi=0,ci=0,di=[],ei=0;function F(){if(ei){for(var a=0;a=bi){0>=1;break;case 4:d>>=2;break;case 8:d>>=3}for(var f=0;f{oa=a;pa=b}); +;return moduleRtn}})();if(typeof exports==="object"&&typeof module==="object"){module.exports=TesseractCore;module.exports.default=TesseractCore}else if(typeof define==="function"&&define["amd"])define([],()=>TesseractCore); diff --git a/static/vendor/tesseract/tesseract-core-simd-lstm.wasm b/static/vendor/tesseract/tesseract-core-simd-lstm.wasm new file mode 100644 index 0000000..d32a8b0 Binary files /dev/null and b/static/vendor/tesseract/tesseract-core-simd-lstm.wasm differ diff --git a/static/vendor/tesseract/tesseract.min.js b/static/vendor/tesseract/tesseract.min.js new file mode 100644 index 0000000..449da3b --- /dev/null +++ b/static/vendor/tesseract/tesseract.min.js @@ -0,0 +1,3 @@ +/*! For license information please see tesseract.min.js.LICENSE.txt */ +!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.Tesseract=r():t.Tesseract=r()}(self,(()=>(()=>{var t={30:(t,r,e)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}var o=function(t){"use strict";var r,e=Object.prototype,o=e.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function s(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{s({},"")}catch(t){s=function(t,r,e){return t[r]=e}}function l(t,r,e,n){var o=r&&r.prototype instanceof m?r:m,a=Object.create(o.prototype),c=new N(n||[]);return i(a,"_invoke",{value:P(t,e,c)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var p="suspendedStart",y="suspendedYield",v="executing",d="completed",g={};function m(){}function b(){}function w(){}var L={};s(L,c,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(A([])));E&&E!==e&&o.call(E,c)&&(L=E);var O=w.prototype=m.prototype=Object.create(L);function S(t){["next","throw","return"].forEach((function(r){s(t,r,(function(t){return this._invoke(r,t)}))}))}function j(t,r){function e(i,a,c,u){var f=h(t[i],t,a);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"===n(l)&&o.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,c,u)}),(function(t){e("throw",t,c,u)})):r.resolve(l).then((function(t){s.value=t,c(s)}),(function(t){return e("throw",t,c,u)}))}u(f.arg)}var a;i(this,"_invoke",{value:function(t,n){function o(){return new r((function(r,o){e(t,n,r,o)}))}return a=a?a.then(o,o):o()}})}function P(t,r,e){var n=p;return function(o,i){if(n===v)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return G()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=_(a,e);if(c){if(c===g)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===p)throw n=d,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=v;var u=h(t,r,e);if("normal"===u.type){if(n=e.done?d:y,u.arg===g)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=d,e.method="throw",e.arg=u.arg)}}}function _(t,e){var n=e.method,o=t.iterator[n];if(o===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,_(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var a=i.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,g):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function k(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function T(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function A(t){if(t){var e=t[c];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),f=o.call(a,"finallyLoc");if(u&&f){if(this.prev=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),T(e),g}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;T(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:A(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),g}},t}("object"===n(t=e.nmd(t))?t.exports:{});try{regeneratorRuntime=o}catch(t){"object"===("undefined"==typeof globalThis?"undefined":n(globalThis))?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}},35:(t,r,e)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function i(t,r,e){return(r=function(t){var r=function(t){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=n(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}var a="browser"===e(938)("type")?function(t){return new URL(t,window.location.href).href}:function(t){return t};t.exports=function(t){var r=function(t){for(var r=1;r{"use strict";t.exports=function(t,r){return"".concat(t,"-").concat(r,"-").concat(Math.random().toString(16).slice(3,8))}},130:t=>{"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function e(){e=function(){return n};var t,n={},o=Object.prototype,i=o.hasOwnProperty,a=Object.defineProperty||function(t,r,e){t[r]=e.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",f=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=r&&r.prototype instanceof b?r:b,i=Object.create(o.prototype),c=new A(n||[]);return a(i,"_invoke",{value:_(t,e,c)}),i}function p(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}n.wrap=h;var y="suspendedStart",v="suspendedYield",d="executing",g="completed",m={};function b(){}function w(){}function L(){}var x={};l(x,u,(function(){return this}));var E=Object.getPrototypeOf,O=E&&E(E(G([])));O&&O!==o&&i.call(O,u)&&(x=O);var S=L.prototype=b.prototype=Object.create(x);function j(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function P(t,e){function n(o,a,c,u){var f=p(t[o],t,a);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==r(l)&&i.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,c,u)}),(function(t){n("throw",t,c,u)})):e.resolve(l).then((function(t){s.value=t,c(s)}),(function(t){return n("throw",t,c,u)}))}u(f.arg)}var o;a(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}})}function _(r,e,n){var o=y;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=k(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var f=p(r,e,n);if("normal"===f.type){if(o=n.done?g:v,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=g,n.method="throw",n.arg=f.arg)}}}function k(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,k(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=p(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,m):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function T(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function N(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function G(e){if(e||""===e){var n=e[u];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),f=i.call(a,"finallyLoc");if(u&&f){if(this.prev=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),N(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;N(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:G(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),m}},n}function n(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function o(t){return function(){var r=this,e=arguments;return new Promise((function(o,i){var a=t.apply(r,e);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))}}var i=function(t){return new Promise((function(r,e){var n=new FileReader;n.onload=function(){r(n.result)},n.onerror=function(t){var r=t.target.error.code;e(Error("File could not be read! Code=".concat(r)))},n.readAsArrayBuffer(t)}))},a=function(){var t=o(e().mark((function t(r){var n,c,u;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r,void 0!==r){t.next=3;break}return t.abrupt("return","undefined");case 3:if("string"!=typeof r){t.next=16;break}if(!/data:image\/([a-zA-Z]*);base64,([^"]*)/.test(r)){t.next=8;break}n=atob(r.split(",")[1]).split("").map((function(t){return t.charCodeAt(0)})),t.next=14;break;case 8:return t.next=10,fetch(r);case 10:return c=t.sent,t.next=13,c.arrayBuffer();case 13:n=t.sent;case 14:t.next=43;break;case 16:if(!("undefined"!=typeof HTMLElement&&r instanceof HTMLElement)){t.next=30;break}if("IMG"!==r.tagName){t.next=21;break}return t.next=20,a(r.src);case 20:n=t.sent;case 21:if("VIDEO"!==r.tagName){t.next=25;break}return t.next=24,a(r.poster);case 24:n=t.sent;case 25:if("CANVAS"!==r.tagName){t.next=28;break}return t.next=28,new Promise((function(t){r.toBlob(function(){var r=o(e().mark((function r(o){return e().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,i(o);case 2:n=r.sent,t();case 4:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}())}));case 28:t.next=43;break;case 30:if(!("undefined"!=typeof OffscreenCanvas&&r instanceof OffscreenCanvas)){t.next=39;break}return t.next=33,r.convertToBlob();case 33:return u=t.sent,t.next=36,i(u);case 36:n=t.sent,t.next=43;break;case 39:if(!(r instanceof File||r instanceof Blob)){t.next=43;break}return t.next=42,i(r);case 42:n=t.sent;case 43:return t.abrupt("return",new Uint8Array(n));case 44:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}();t.exports=a},192:t=>{"use strict";t.exports={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"}},286:t=>{"use strict";t.exports={workerBlobURL:!0,logger:function(){}}},318:t=>{"use strict";t.exports=function(t){var r,e=t.workerPath,n=t.workerBlobURL;if(Blob&&URL&&n){var o=new Blob(['importScripts("'.concat(e,'");')],{type:"application/javascript"});r=new Worker(URL.createObjectURL(o))}else r=new Worker(e);return r}},330:t=>{"use strict";t.exports={rE:"7.0.0"}},364:function(t,r,e){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}var o=this;function i(){i=function(){return r};var t,r={},e=Object.prototype,o=e.hasOwnProperty,a=Object.defineProperty||function(t,r,e){t[r]=e.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",f=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=r&&r.prototype instanceof b?r:b,i=Object.create(o.prototype),c=new A(n||[]);return a(i,"_invoke",{value:_(t,e,c)}),i}function p(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var y="suspendedStart",v="suspendedYield",d="executing",g="completed",m={};function b(){}function w(){}function L(){}var x={};l(x,u,(function(){return this}));var E=Object.getPrototypeOf,O=E&&E(E(G([])));O&&O!==e&&o.call(O,u)&&(x=O);var S=L.prototype=b.prototype=Object.create(x);function j(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function P(t,r){function e(i,a,c,u){var f=p(t[i],t,a);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==n(l)&&o.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,c,u)}),(function(t){e("throw",t,c,u)})):r.resolve(l).then((function(t){s.value=t,c(s)}),(function(t){return e("throw",t,c,u)}))}u(f.arg)}var i;a(this,"_invoke",{value:function(t,n){function o(){return new r((function(r,o){e(t,n,r,o)}))}return i=i?i.then(o,o):o()}})}function _(r,e,n){var o=y;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=k(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var f=p(r,e,n);if("normal"===f.type){if(o=n.done?g:v,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=g,n.method="throw",n.arg=f.arg)}}}function k(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,k(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=p(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,m):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function T(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function N(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function G(r){if(r||""===r){var e=r[u];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var i=-1,a=function e(){for(;++i=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),f=o.call(a,"finallyLoc");if(u&&f){if(this.prev=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),N(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;N(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:G(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}function a(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e1?n-1:0),a=1;a{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){o=function(){return r};var t,r={},e=Object.prototype,i=e.hasOwnProperty,a=Object.defineProperty||function(t,r,e){t[r]=e.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",f=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=r&&r.prototype instanceof b?r:b,i=Object.create(o.prototype),c=new A(n||[]);return a(i,"_invoke",{value:_(t,e,c)}),i}function p(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var y="suspendedStart",v="suspendedYield",d="executing",g="completed",m={};function b(){}function w(){}function L(){}var x={};l(x,u,(function(){return this}));var E=Object.getPrototypeOf,O=E&&E(E(G([])));O&&O!==e&&i.call(O,u)&&(x=O);var S=L.prototype=b.prototype=Object.create(x);function j(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function P(t,r){function e(o,a,c,u){var f=p(t[o],t,a);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==n(l)&&i.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,c,u)}),(function(t){e("throw",t,c,u)})):r.resolve(l).then((function(t){s.value=t,c(s)}),(function(t){return e("throw",t,c,u)}))}u(f.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new r((function(r,o){e(t,n,r,o)}))}return o=o?o.then(i,i):i()}})}function _(r,e,n){var o=y;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=k(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var f=p(r,e,n);if("normal"===f.type){if(o=n.done?g:v,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=g,n.method="throw",n.arg=f.arg)}}}function k(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,k(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=p(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,m):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function T(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function N(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function G(r){if(r||""===r){var e=r[u];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),f=i.call(a,"finallyLoc");if(u&&f){if(this.prev=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),N(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;N(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:G(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}function i(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function a(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var a=t.apply(r,e);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)}))}}var c=e(603),u=function(){var t=a(o().mark((function t(r,e,n){var i;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,c(e,1,n);case 2:return i=t.sent,t.abrupt("return",i.recognize(r).finally(a(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i.terminate();case 2:case"end":return t.stop()}}),t)})))));case 4:case"end":return t.stop()}}),t)})));return function(r,e,n){return t.apply(this,arguments)}}(),f=function(){var t=a(o().mark((function t(r,e){var n;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,c("osd",0,e);case 2:return n=t.sent,t.abrupt("return",n.detect(r).finally(a(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.terminate();case 2:case"end":return t.stop()}}),t)})))));case 4:case"end":return t.stop()}}),t)})));return function(r,e){return t.apply(this,arguments)}}();t.exports={recognize:u,detect:f}},603:(t,r,e)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}var o=["logger","errorHandler"];function i(){i=function(){return r};var t,r={},e=Object.prototype,o=e.hasOwnProperty,a=Object.defineProperty||function(t,r,e){t[r]=e.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",f=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=r&&r.prototype instanceof b?r:b,i=Object.create(o.prototype),c=new A(n||[]);return a(i,"_invoke",{value:_(t,e,c)}),i}function p(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var y="suspendedStart",v="suspendedYield",d="executing",g="completed",m={};function b(){}function w(){}function L(){}var x={};l(x,u,(function(){return this}));var E=Object.getPrototypeOf,O=E&&E(E(G([])));O&&O!==e&&o.call(O,u)&&(x=O);var S=L.prototype=b.prototype=Object.create(x);function j(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function P(t,r){function e(i,a,c,u){var f=p(t[i],t,a);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==n(l)&&o.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,c,u)}),(function(t){e("throw",t,c,u)})):r.resolve(l).then((function(t){s.value=t,c(s)}),(function(t){return e("throw",t,c,u)}))}u(f.arg)}var i;a(this,"_invoke",{value:function(t,n){function o(){return new r((function(r,o){e(t,n,r,o)}))}return i=i?i.then(o,o):o()}})}function _(r,e,n){var o=y;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=k(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var f=p(r,e,n);if("normal"===f.type){if(o=n.done?g:v,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=g,n.method="throw",n.arg=f.arg)}}}function k(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,k(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=p(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,m):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function T(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function N(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function G(r){if(r||""===r){var e=r[u];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var i=-1,a=function e(){for(;++i=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),f=o.call(a,"finallyLoc");if(u&&f){if(this.prev=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),N(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;N(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:G(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}function a(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e0&&void 0!==$[0]?$[0]:"eng",e=$.length>1&&void 0!==$[1]?$[1]:g.LSTM_ONLY,n=$.length>2&&void 0!==$[2]?$[2]:{},c=$.length>3&&void 0!==$[3]?$[3]:{},f=d("Worker",S),l=p(u(u({},b),n)),m=l.logger,j=l.errorHandler,P=s(l,o),_={},k="string"==typeof r?r.split("+"):r,T=e,N=c,A=[g.DEFAULT,g.LSTM_ONLY].includes(e)&&!P.legacyCore,F=new Promise((function(t,r){I=t,G=r})),R=function(t){G(t.message)},(D=w(P)).onerror=R,S+=1,M=function(t){var r=t.id,e=t.action,n=t.payload;return new Promise((function(t,o){v("[".concat(f,"]: Start ").concat(r,", action=").concat(e));var i="".concat(e,"-").concat(r);_[i]={resolve:t,reject:o},O(D,{workerId:f,jobId:r,action:e,payload:n})}))},C=function(){return console.warn("`load` is depreciated and should be removed from code (workers now come pre-loaded)")},U=function(t){return M(y({id:t,action:"load",payload:{options:{lstmOnly:A,corePath:P.corePath,logging:P.logging}}}))},Y=function(t,r,e){return M(y({id:e,action:"FS",payload:{method:"writeFile",args:[t,r]}}))},B=function(t,r){return M(y({id:r,action:"FS",payload:{method:"readFile",args:[t,{encoding:"utf8"}]}}))},H=function(t,r){return M(y({id:r,action:"FS",payload:{method:"unlink",args:[t]}}))},K=function(t,r,e){return M(y({id:e,action:"FS",payload:{method:t,args:r}}))},W=function(t,r){return M(y({id:r,action:"loadLanguage",payload:{langs:t,options:{langPath:P.langPath,dataPath:P.dataPath,cachePath:P.cachePath,cacheMethod:P.cacheMethod,gzip:P.gzip,lstmOnly:[g.DEFAULT,g.LSTM_ONLY].includes(T)&&!P.legacyLang}}}))},z=function(t,r,e,n){return M(y({id:n,action:"initialize",payload:{langs:t,oem:r,config:e}}))},J=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"eng",r=arguments.length>1?arguments[1]:void 0,e=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;if(A&&[g.TESSERACT_ONLY,g.TESSERACT_LSTM_COMBINED].includes(r))throw Error("Legacy model requested but code missing.");var o=r||T;T=o;var i=e||N;N=i;var c,u=("string"==typeof t?t.split("+"):t).filter((function(t){return!k.includes(t)}));return k.push.apply(k,function(t){if(Array.isArray(t))return a(t)}(c=u)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(c)||function(t,r){if(t){if("string"==typeof t)return a(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?a(t,r):void 0}}(c)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u.length>0?W(u,n).then((function(){return z(t,o,i,n)})):z(t,o,i,n)},V=function(){return M(y({id:arguments.length>1?arguments[1]:void 0,action:"setParameters",payload:{params:arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}}}))},Z=function(){var t=h(i().mark((function t(r){var e,n,o,a=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=a.length>1&&void 0!==a[1]?a[1]:{},n=a.length>2&&void 0!==a[2]?a[2]:{text:!0},o=a.length>3?a[3]:void 0,t.t0=M,t.t1=y,t.t2=o,t.next=8,E(r);case 8:return t.t3=t.sent,t.t4=e,t.t5=n,t.t6={image:t.t3,options:t.t4,output:t.t5},t.t7={id:t.t2,action:"recognize",payload:t.t6},t.t8=(0,t.t1)(t.t7),t.abrupt("return",(0,t.t0)(t.t8));case 15:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}(),Q=function(){var t=h(i().mark((function t(r,e){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!A){t.next=2;break}throw Error("`worker.detect` requires Legacy model, which was not loaded.");case 2:return t.t0=M,t.t1=y,t.t2=e,t.next=7,E(r);case 7:return t.t3=t.sent,t.t4={image:t.t3},t.t5={id:t.t2,action:"detect",payload:t.t4},t.t6=(0,t.t1)(t.t5),t.abrupt("return",(0,t.t0)(t.t6));case 12:case"end":return t.stop()}}),t)})));return function(r,e){return t.apply(this,arguments)}}(),q=function(){var t=h(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return null!==D&&(L(D),D=null),t.abrupt("return",Promise.resolve());case 2:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),x(D,(function(t){var r=t.workerId,e=t.jobId,n=t.status,o=t.action,i=t.data,a="".concat(o,"-").concat(e);if("resolve"===n)v("[".concat(r,"]: Complete ").concat(e)),_[a].resolve({jobId:e,data:i}),delete _[a];else if("reject"===n){if(_[a].reject(i),delete _[a],"load"===o&&G(i),!j)throw Error(i);j(i)}else"progress"===n&&m(u(u({},i),{},{userJobId:e}))})),X={id:f,worker:D,load:C,writeText:Y,readText:B,removeFile:H,FS:K,reinitialize:J,setParameters:V,recognize:Z,detect:Q,terminate:q},U().then((function(){return W(r)})).then((function(){return z(r,e,c)})).then((function(){return I(X)})).catch((function(){})),t.abrupt("return",F);case 34:case"end":return t.stop()}}),t)})))},727:t=>{"use strict";t.exports=function(t,r){t.onmessage=function(t){var e=t.data;r(e)}}},753:t=>{"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function e(){e=function(){return n};var t,n={},o=Object.prototype,i=o.hasOwnProperty,a=Object.defineProperty||function(t,r,e){t[r]=e.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",f=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=r&&r.prototype instanceof b?r:b,i=Object.create(o.prototype),c=new A(n||[]);return a(i,"_invoke",{value:_(t,e,c)}),i}function p(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}n.wrap=h;var y="suspendedStart",v="suspendedYield",d="executing",g="completed",m={};function b(){}function w(){}function L(){}var x={};l(x,u,(function(){return this}));var E=Object.getPrototypeOf,O=E&&E(E(G([])));O&&O!==o&&i.call(O,u)&&(x=O);var S=L.prototype=b.prototype=Object.create(x);function j(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function P(t,e){function n(o,a,c,u){var f=p(t[o],t,a);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==r(l)&&i.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,c,u)}),(function(t){n("throw",t,c,u)})):e.resolve(l).then((function(t){s.value=t,c(s)}),(function(t){return n("throw",t,c,u)}))}u(f.arg)}var o;a(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}})}function _(r,e,n){var o=y;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=k(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var f=p(r,e,n);if("normal"===f.type){if(o=n.done?g:v,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=g,n.method="throw",n.arg=f.arg)}}}function k(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,k(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=p(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,m):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function T(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function N(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function G(e){if(e||""===e){var n=e[u];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),f=i.call(a,"finallyLoc");if(u&&f){if(this.prev=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),N(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;N(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:G(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),m}},n}function n(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}t.exports=function(){var t,r=(t=e().mark((function t(r,n){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r.postMessage(n);case 1:case"end":return t.stop()}}),t)})),function(){var r=this,e=arguments;return new Promise((function(o,i){var a=t.apply(r,e);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))});return function(t,e){return r.apply(this,arguments)}}()},830:(t,r,e)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function i(t){for(var r=1;r{"use strict";t.exports=function(t){t.terminate()}},877:(t,r,e)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function i(t,r,e){return(r=function(t){var r=function(t){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=n(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}e(30);var a=e(364),c=e(603),u=e(535),f=e(192),s=e(972),l=e(971),h=e(65).setLogging;t.exports=function(t){for(var r=1;r{"use strict";var n=e(70),o=0;t.exports=function(t){var r=t.id,e=t.action,i=t.payload,a=void 0===i?{}:i,c=r;return void 0===c&&(c=n("Job",o),o+=1),{id:c,action:e,payload:a}}},938:t=>{"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}t.exports=function(t){var e={};return"undefined"!=typeof WorkerGlobalScope?e.type="webworker":"object"===("undefined"==typeof document?"undefined":r(document))?e.type="browser":"object"===("undefined"==typeof process?"undefined":r(process))&&(e.type="node"),void 0===t?e:e[t]}},971:t=>{"use strict";t.exports={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"}},972:t=>{"use strict";t.exports={TESSERACT_ONLY:0,LSTM_ONLY:1,TESSERACT_LSTM_COMBINED:2,DEFAULT:3}}},r={};function e(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={id:n,loaded:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}return e.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),e(877)})())); +//# sourceMappingURL=tesseract.min.js.map \ No newline at end of file diff --git a/static/vendor/tesseract/worker.min.js b/static/vendor/tesseract/worker.min.js new file mode 100644 index 0000000..de4a93b --- /dev/null +++ b/static/vendor/tesseract/worker.min.js @@ -0,0 +1,3 @@ +/*! For license information please see worker.min.js.LICENSE.txt */ +(()=>{var t={30:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}var i=function(t){"use strict";var e,r=Object.prototype,i=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",h=a.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),s=new _(n||[]);return o(a,"_invoke",{value:U(t,r,s)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var p="suspendedStart",y="suspendedYield",d="executing",g="completed",b={};function v(){}function w(){}function m(){}var A={};f(A,s,(function(){return this}));var E=Object.getPrototypeOf,x=E&&E(E(j([])));x&&x!==r&&i.call(x,s)&&(A=x);var k=m.prototype=v.prototype=Object.create(A);function O(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function r(o,a,s,u){var h=l(t[o],t,a);if("throw"!==h.type){var f=h.arg,c=f.value;return c&&"object"===n(c)&&i.call(c,"__await")?e.resolve(c.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):e.resolve(c).then((function(t){f.value=t,s(f)}),(function(t){return r("throw",t,s,u)}))}u(h.arg)}var a;o(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return a=a?a.then(i,i):i()}})}function U(t,e,r){var n=p;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===g){if("throw"===i)throw o;return P()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=S(a,r);if(s){if(s===b)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===p)throw n=g,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=l(t,e,r);if("normal"===u.type){if(n=r.done?g:y,u.arg===b)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=g,r.method="throw",r.arg=u.arg)}}}function S(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var o=l(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,b;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,b):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function B(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function j(t){if(t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),h=i.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),B(r),b}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;B(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:j(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),b}},t}("object"===n(t=r.nmd(t))?t.exports:{});try{regeneratorRuntime=i}catch(t){"object"===("undefined"==typeof globalThis?"undefined":n(globalThis))?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}},54:t=>{"use strict";t.exports={COLOR:0,GREY:1,BINARY:2}},65:function(t,e){"use strict";var r=this,n=!1;e.logging=n,e.setLogging=function(t){n=t},e.log=function(){for(var t=arguments.length,e=new Array(t),i=0;i>>8&255]<<16|l[t>>>16&255]<<8|l[t>>>24&255])>>32-e:l[t]>>8-e),8>e+a)s=s<>e-n-1&1,8==++a&&(a=0,i[o++]=l[s],s=0,o===i.length&&(i=this.f()));i[o]=s,this.buffer=i,this.m=a,this.index=o},a.prototype.finish=function(){var t,e=this.buffer,r=this.index;return 0s;++s){for(var h=c=s,f=7,c=c>>>1;c;c>>>=1)h<<=1,h|=1&c,--f;u[s]=(h<>>0}var l=u;function p(t,e,r){var n,i="number"==typeof e?e:e=0,o="number"==typeof r?r:t.length;for(n=-1,i=7&o;i--;++e)n=n>>>8^d[255&(n^t[e])];for(i=o>>3;i--;e+=8)n=(n=(n=(n=(n=(n=(n=(n=n>>>8^d[255&(n^t[e])])>>>8^d[255&(n^t[e+1])])>>>8^d[255&(n^t[e+2])])>>>8^d[255&(n^t[e+3])])>>>8^d[255&(n^t[e+4])])>>>8^d[255&(n^t[e+5])])>>>8^d[255&(n^t[e+6])])>>>8^d[255&(n^t[e+7])];return(4294967295^n)>>>0}var y=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],d=o?new Uint32Array(y):y;function g(){}function b(t){this.buffer=new(o?Uint16Array:Array)(2*t),this.length=0}function v(t){var e,r,n,i,a,s,u,h,f,c,l=t.length,p=0,y=Number.POSITIVE_INFINITY;for(h=0;hp&&(p=t[h]),t[h]>=1;for(c=n<<16|h,f=s;fo[n]);)i=o[r],o[r]=o[n],o[n]=i,i=o[r+1],o[r+1]=o[n+1],o[n+1]=i,r=n;return this.length},b.prototype.pop=function(){var t,e,r,n,i,o=this.buffer;for(e=o[0],t=o[1],this.length-=2,o[0]=o[this.length],o[1]=o[this.length+1],i=0;!((n=2*i+2)>=this.length)&&(n+2o[n]&&(n+=2),o[n]>o[i]);)r=o[i],o[i]=o[n],o[n]=r,r=o[i+1],o[i+1]=o[n+1],o[n+1]=r,i=n;return{index:t,value:e,length:this.length}};var m,A=2,E={NONE:0,L:1,t:A,X:3},x=[];for(m=0;288>m;m++)switch(i){case 143>=m:x.push([m+48,8]);break;case 255>=m:x.push([m-144+400,9]);break;case 279>=m:x.push([m-256+0,7]);break;case 287>=m:x.push([m-280+192,8]);break;default:t("invalid literal: "+m)}function k(t,e){this.length=t,this.N=e}w.prototype.h=function(){var e,n,s,u,h=this.input;switch(this.k){case 0:for(s=0,u=h.length;s>>8&255,b[v++]=255&l,b[v++]=l>>>8&255,o)b.set(p,v),v+=p.length,b=b.subarray(0,v);else{for(d=0,g=p.length;dX)for(;0X?X:138)>X-3&&$=$?(rt[K++]=17,rt[K++]=$-3,nt[17]++):(rt[K++]=18,rt[K++]=$-11,nt[18]++),X-=$;else if(rt[K++]=et[J],nt[et[J]]++,3>--X)for(;0X?X:6)>X-3&&$D;D++)q[D]=N[V[D]];for(P=19;4=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:t("invalid length: "+e)}}var r,n,o=[];for(r=3;258>=r;r++)n=e(r),o[r]=n[2]<<24|n[1]<<16|n[0];return o}(),I=o?new Uint32Array(O):O;function U(e,n){function a(e,r){var n,o,a,s,u=e.N,h=[],f=0;switch(n=I[e.length],h[f++]=65535&n,h[f++]=n>>16&255,h[f++]=n>>24,i){case 1===u:o=[0,u-1,0];break;case 2===u:o=[1,u-2,0];break;case 3===u:o=[2,u-3,0];break;case 4===u:o=[3,u-4,0];break;case 6>=u:o=[4,u-5,1];break;case 8>=u:o=[5,u-7,1];break;case 12>=u:o=[6,u-9,2];break;case 16>=u:o=[7,u-13,2];break;case 24>=u:o=[8,u-17,3];break;case 32>=u:o=[9,u-25,3];break;case 48>=u:o=[10,u-33,4];break;case 64>=u:o=[11,u-49,4];break;case 96>=u:o=[12,u-65,5];break;case 128>=u:o=[13,u-97,5];break;case 192>=u:o=[14,u-129,6];break;case 256>=u:o=[15,u-193,6];break;case 384>=u:o=[16,u-257,7];break;case 512>=u:o=[17,u-385,7];break;case 768>=u:o=[18,u-513,8];break;case 1024>=u:o=[19,u-769,8];break;case 1536>=u:o=[20,u-1025,9];break;case 2048>=u:o=[21,u-1537,9];break;case 3072>=u:o=[22,u-2049,10];break;case 4096>=u:o=[23,u-3073,10];break;case 6144>=u:o=[24,u-4097,11];break;case 8192>=u:o=[25,u-6145,11];break;case 12288>=u:o=[26,u-8193,12];break;case 16384>=u:o=[27,u-12289,12];break;case 24576>=u:o=[28,u-16385,13];break;case 32768>=u:o=[29,u-24577,13];break;default:t("invalid distance")}for(n=o,h[f++]=n[0],h[f++]=n[1],h[f++]=n[2],a=0,s=h.length;a=h;)m[h++]=0;for(h=0;29>=h;)A[h++]=0}for(m[256]=1,s=0,u=n.length;s=u){for(y&&a(y,-1),h=0,f=u-s;ho&&e+oh&&(i=n,h=o),258===o)break}return new k(h,e-i)}function L(t,e){var r,n,i,a,s,u=t.length,h=new b(572),f=new(o?Uint8Array:Array)(u);if(!o)for(a=0;a2*f[a-1]+c[a]&&(f[a]=2*f[a-1]+c[a]),p[a]=Array(f[a]),y[a]=Array(f[a]);for(i=0;it[i]?(p[a][s]=u,y[a][s]=e,h+=2):(p[a][s]=t[i],y[a][s]=i,++i);d[a]=0,1===c[a]&&n(a)}return l}(n,n.length,e),a=0,s=r.length;a>>=1;return a}function _(t,e){this.input=t,this.b=this.c=0,this.g={},e&&(e.flags&&(this.g=e.flags),"string"==typeof e.filename&&(this.filename=e.filename),"string"==typeof e.comment&&(this.w=e.comment),e.deflateOptions&&(this.l=e.deflateOptions)),this.l||(this.l={})}_.prototype.h=function(){var t,e,n,i,a,s,u,h,f=new(o?Uint8Array:Array)(32768),c=0,l=this.input,y=this.c,d=this.filename,g=this.w;if(f[c++]=31,f[c++]=139,f[c++]=8,t=0,this.g.fname&&(t|=T),this.g.fcomment&&(t|=R),this.g.fhcrc&&(t|=P),f[c++]=t,e=(Date.now?Date.now():+new Date)/1e3|0,f[c++]=255&e,f[c++]=e>>>8&255,f[c++]=e>>>16&255,f[c++]=e>>>24&255,f[c++]=0,f[c++]=j,this.g.fname!==r){for(u=0,h=d.length;u>>8&255),f[c++]=255&s;f[c++]=0}if(this.g.comment){for(u=0,h=g.length;u>>8&255),f[c++]=255&s;f[c++]=0}return this.g.fhcrc&&(n=65535&p(f,0,c),f[c++]=255&n,f[c++]=n>>>8&255),this.l.outputBuffer=f,this.l.outputIndex=c,f=(a=new w(l,this.l)).h(),c=a.b,o&&(c+8>f.buffer.byteLength?(this.a=new Uint8Array(c+8),this.a.set(new Uint8Array(f.buffer)),f=this.a):f=new Uint8Array(f.buffer)),i=p(l,r,r),f[c++]=255&i,f[c++]=i>>>8&255,f[c++]=i>>>16&255,f[c++]=i>>>24&255,h=l.length,f[c++]=255&h,f[c++]=h>>>8&255,f[c++]=h>>>16&255,f[c++]=h>>>24&255,this.c=y,o&&c>>=1){case 0:var n=this.input,a=this.c,s=this.a,u=this.b,h=n.length,f=r,c=s.length,l=r;switch(this.e=this.j=0,a+1>=h&&t(Error("invalid uncompressed block header: LEN")),f=n[a++]|n[a++]<<8,a+1>=h&&t(Error("invalid uncompressed block header: NLEN")),f===~(n[a++]|n[a++]<<8)&&t(Error("invalid uncompressed block header: length verify")),a+f>n.length&&t(Error("input buffer is broken")),this.q){case M:for(;u+f>s.length;){if(f-=l=c-u,o)s.set(n.subarray(a,a+l),u),u+=l,a+=l;else for(;l--;)s[u++]=n[a++];this.b=u,s=this.f(),u=this.b}break;case N:for(;u+f>s.length;)s=this.f({B:2});break;default:t(Error("invalid inflate mode"))}if(o)s.set(n.subarray(a,a+f),u),u+=f,a+=f;else for(;f--;)s[u++]=n[a++];this.c=a,this.b=u,this.a=s;break;case 1:this.r(tt,rt);break;case 2:var p,y,d,g,b=nt(this,5)+257,w=nt(this,5)+1,m=nt(this,4)+4,A=new(o?Uint8Array:Array)(D.length),E=r,x=r,k=r,O=r,I=r;for(I=0;I=F?8:255>=F?9:279>=F?7:8;var $,Z,tt=v(K),et=new(o?Uint8Array:Array)(30);for($=0,Z=et.length;$=u&&t(Error("input buffer is broken")),i|=a[s++]<>>r,e.e=o-r,e.c=s,n}function it(e,r){for(var n,i,o=e.j,a=e.e,s=e.input,u=e.c,h=s.length,f=r[0],c=r[1];a=h);)o|=s[u++]<>>16)>a&&t(Error("invalid code length: "+i)),e.j=o>>i,e.e=a-i,e.c=u,65535&n}function ot(t){this.input=t,this.c=0,this.G=[],this.R=!1}function at(t){if("string"==typeof t){var e,r,n=t.split("");for(e=0,r=n.length;e>>0;t=n}for(var i,o=1,a=0,s=t.length,u=0;0>>0}function st(e,r){var n,i;this.input=e,this.c=0,!r&&(r={})||(r.index&&(this.c=r.index),r.verify&&(this.V=r.verify)),n=e[this.c++],i=e[this.c++],(15&n)===ut?this.method=ut:t(Error("unsupported compression method")),0!=((n<<8)+i)%31&&t(Error("invalid fcheck flag:"+((n<<8)+i)%31)),32&i&&t(Error("fdict flag is not supported")),this.J=new C(e,{index:this.c,bufferSize:r.bufferSize,bufferType:r.bufferType,resize:r.resize})}C.prototype.r=function(t,e){var r=this.a,n=this.b;this.A=t;for(var i,o,a,s,u=r.length-258;256!==(i=it(this,t));)if(256>i)n>=u&&(this.b=n,r=this.f(),n=this.b),r[n++]=i;else for(s=Y[o=i-257],0=u&&(this.b=n,r=this.f(),n=this.b);s--;)r[n]=r[n++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},C.prototype.Q=function(t,e){var r=this.a,n=this.b;this.A=t;for(var i,o,a,s,u=r.length;256!==(i=it(this,t));)if(256>i)n>=u&&(u=(r=this.f()).length),r[n++]=i;else for(s=Y[o=i-257],0u&&(u=(r=this.f()).length);s--;)r[n]=r[n++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},C.prototype.f=function(){var t,e,r=new(o?Uint8Array:Array)(this.b-32768),n=this.b-32768,i=this.a;if(o)r.set(i.subarray(32768,r.length));else for(t=0,e=r.length;tt;++t)i[t]=i[n+t];return this.b=32768,i},C.prototype.S=function(t){var e,r,n,i=this.input.length/this.c+1|0,a=this.input,s=this.a;return t&&("number"==typeof t.B&&(i=t.B),"number"==typeof t.M&&(i+=t.M)),r=2>i?(n=(a.length-this.c)/this.A[2]/2*258|0)e&&(this.a.length=e),t=this.a),this.buffer=t},ot.prototype.i=function(){for(var e=this.input.length;this.c>>0,p(n,r,r)!==d&&t(Error("invalid CRC-32 checksum: 0x"+p(n,r,r).toString(16)+" / 0x"+d.toString(16))),s.Z=u=(b[v++]|b[v++]<<8|b[v++]<<16|b[v++]<<24)>>>0,(4294967295&n.length)!==u&&t(Error("invalid input size: "+(4294967295&n.length)+" / "+u)),this.G.push(s),this.c=v}this.R=i;var w,m,A,E=this.G,x=0,k=0;for(w=0,m=E.length;w>>0!==at(e)&&t(Error("invalid adler-32 checksum")),e};var ut=8;function ht(t,e){this.input=t,this.a=new(o?Uint8Array:Array)(32768),this.k=ft.t;var r,n={};for(r in!e&&(e={})||"number"!=typeof e.compressionType||(this.k=e.compressionType),e)n[r]=e[r];n.outputBuffer=this.a,this.I=new w(this.input,n)}var ft=E;function ct(t,e){var r;return r=new ht(t).h(),e||(e={}),e.H?r:dt(r)}function lt(t,e){var r;return t.subarray=t.slice,r=new st(t).i(),e||(e={}),e.noBuffer?r:dt(r)}function pt(t,e){var r;return t.subarray=t.slice,r=new _(t).h(),e||(e={}),e.H?r:dt(r)}function yt(t,e){var r;return t.subarray=t.slice,r=new ot(t).i(),e||(e={}),e.H?r:dt(r)}function dt(t){var e,r,i=new n(t.length);for(e=0,r=t.length;e>24&255,u[h++]=s>>16&255,u[h++]=s>>8&255,u[h++]=255&s,u},e.deflate=function(t,e,r){process.nextTick((function(){var n,i;try{i=ct(t,r)}catch(t){n=t}e(n,i)}))},e.deflateSync=ct,e.inflate=function(t,e,r){process.nextTick((function(){var n,i;try{i=lt(t,r)}catch(t){n=t}e(n,i)}))},e.inflateSync=lt,e.gzip=function(t,e,r){process.nextTick((function(){var n,i;try{i=pt(t,r)}catch(t){n=t}e(n,i)}))},e.gzipSync=pt,e.gunzip=function(t,e,r){process.nextTick((function(){var n,i;try{i=yt(t,r)}catch(t){n=t}e(n,i)}))},e.gunzipSync=yt}).call(this)},242:t=>{"use strict";const e={bigInt:()=>(async t=>{try{return(await WebAssembly.instantiate(t)).instance.exports.b(BigInt(0))===BigInt(0)}catch(t){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,126,1,126,3,2,1,0,7,5,1,1,98,0,0,10,6,1,4,0,32,0,11])),bulkMemory:async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),exceptions:async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),exceptionsFinal:()=>(async()=>{try{return new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABBAFgAAADAgEAChABDgACaR9AAQMAAAsACxoL"),(t=>t.codePointAt(0)))),!0}catch(t){return!1}})(),extendedConst:async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,5,3,1,0,1,11,9,1,0,65,1,65,2,106,11,0])),gc:()=>(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,95,1,120,0])))(),jsStringBuiltins:()=>(async()=>{try{return await WebAssembly.instantiate(Uint8Array.from(atob("AGFzbQEAAAABBgFgAW8BfwIXAQ53YXNtOmpzLXN0cmluZwR0ZXN0AAA="),(t=>t.codePointAt(0))),{},{builtins:["js-string"]}),!0}catch(t){return!1}})(),jspi:()=>(async()=>"Suspending"in WebAssembly)(),memory64:async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,5,3,1,4,1])),multiMemory:()=>(async()=>{try{return new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,5,5,2,0,0,0,0])),!0}catch(t){return!1}})(),multiValue:async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,0,2,127,127,3,2,1,0,10,8,1,6,0,65,0,65,0,11])),mutableGlobals:async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,2,8,1,1,97,1,98,3,127,1,6,6,1,127,1,65,0,11,7,5,1,1,97,3,1])),referenceTypes:async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,7,1,5,0,208,112,26,11])),relaxedSimd:async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,15,1,13,0,65,1,253,15,65,2,253,15,253,128,2,11])),saturatedFloatToInt:async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,12,1,10,0,67,0,0,0,0,252,0,26,11])),signExtensions:async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,65,0,192,26,11])),simd:async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),streamingCompilation:()=>(async()=>"compileStreaming"in WebAssembly)(),tailCall:async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,6,1,4,0,18,0,11])),threads:()=>(async t=>{try{return"undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(t)}catch(t){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),typeReflection:()=>(async()=>"Function"in WebAssembly)(),typedFunctionReferences:()=>(async()=>{try{return new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABEANgAX8Bf2ABZAABf2AAAX8DBAMBAAIJBQEDAAEBChwDCwBBCkEqIAAUAGoLBwAgAEEBagsGANIBEAAL"),(t=>t.codePointAt(0)))),!0}catch(t){return!1}})()};t.exports=e},258:(t,e,r)=>{"use strict";t.exports=r(133).gunzipSync},329:(t,e,r)=>{"use strict";var n=r(545).hp;function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e3&&void 0!==arguments[3]?arguments[3]:0,s=66===r[0]&&77===r[1]||66===r[1]&&77===r[0],h=parseInt(null===(i=r.slice(0,500).join(" ").match(/1 18 0 3 0 0 0 1 0 (\d)/))||void 0===i?void 0:i[1],10)||1;if(s){var f=n.from(Array.from(a(a({},r),{},{length:Object.keys(r).length}))),c=u.decode(f);t.FS.writeFile("/input",u.encode(c).data)}else t.FS.writeFile("/input",r);if(1===e.SetImageFile(h,o))throw Error("Error attempting to read image.")}},330:t=>{"use strict";t.exports=JSON.parse('{"El":{"QE":"^7.0.0"}}')},334:(t,e,r)=>{"use strict";var n=r(535),i=r(54),o=function(t){var e=t.split("\n");if(" "===e[0].substring(0,2))for(var r=0;r{var n=r(545).hp;function i(t){this.buffer=t.data,this.width=t.width,this.height=t.height,this.extraBytes=this.width%4,this.rgbSize=this.height*(3*this.width+this.extraBytes),this.headerInfoSize=40,this.data=[],this.flag="BM",this.reserved=0,this.offset=54,this.fileSize=this.rgbSize+this.offset,this.planes=1,this.bitPP=24,this.compress=0,this.hr=0,this.vr=0,this.colors=0,this.importantColors=0}i.prototype.encode=function(){var t=new n(this.offset+this.rgbSize);this.pos=0,t.write(this.flag,this.pos,2),this.pos+=2,t.writeUInt32LE(this.fileSize,this.pos),this.pos+=4,t.writeUInt32LE(this.reserved,this.pos),this.pos+=4,t.writeUInt32LE(this.offset,this.pos),this.pos+=4,t.writeUInt32LE(this.headerInfoSize,this.pos),this.pos+=4,t.writeUInt32LE(this.width,this.pos),this.pos+=4,t.writeInt32LE(-this.height,this.pos),this.pos+=4,t.writeUInt16LE(this.planes,this.pos),this.pos+=2,t.writeUInt16LE(this.bitPP,this.pos),this.pos+=2,t.writeUInt32LE(this.compress,this.pos),this.pos+=4,t.writeUInt32LE(this.rgbSize,this.pos),this.pos+=4,t.writeUInt32LE(this.hr,this.pos),this.pos+=4,t.writeUInt32LE(this.vr,this.pos),this.pos+=4,t.writeUInt32LE(this.colors,this.pos),this.pos+=4,t.writeUInt32LE(this.importantColors,this.pos),this.pos+=4;for(var e=0,r=3*this.width+this.extraBytes,i=0;i0){var s=this.pos+i*r+3*this.width;t.fill(0,s,s+this.extraBytes)}}return t},t.exports=function(t,e){return void 0===e&&(e=100),{data:new i(t).encode(),width:t.width,height:t.height}}},443:t=>{t.exports=function(t){if("string"!=typeof t)return!1;var i=t.match(e);if(!i)return!1;var o=i[1];return!!o&&!(!r.test(o)&&!n.test(o))};var e=/^(?:\w+:)?\/\/(\S+)$/,r=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,n=/^[^\s\.]+\.\S{2,}$/},450:(t,e,r)=>{var n=r(398),i=r(834);t.exports={encode:n,decode:i}},535:t=>{"use strict";t.exports=function(t){for(var e,r="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=new Uint8Array(t),o=i.byteLength,a=o%3,s=o-a,u=0;u>18]+n[(258048&e)>>12]+n[(4032&e)>>6]+n[63&e];return 1===a?(e=i[s],r+="".concat(n[(252&e)>>2]+n[(3&e)<<4],"==")):2===a&&(e=i[s]<<8|i[s+1],r+="".concat(n[(64512&e)>>10]+n[(1008&e)>>4]+n[(15&e)<<2],"=")),r}},545:(t,e,r)=>{"use strict";function n(t,e){for(var r=0;rl)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,y.prototype),e}function y(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return b(t)}return d(t,e,r)}function d(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!y.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|A(t,e),n=p(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(et(t,Uint8Array)){var e=new Uint8Array(t);return w(e.buffer,e.byteOffset,e.byteLength)}return v(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+u(t));if(et(t,ArrayBuffer)||t&&et(t.buffer,ArrayBuffer))return w(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(et(t,SharedArrayBuffer)||t&&et(t.buffer,SharedArrayBuffer)))return w(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return y.from(n,e,r);var i=function(t){if(y.isBuffer(t)){var e=0|m(t.length),r=p(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||rt(t.length)?p(0):v(t):"Buffer"===t.type&&Array.isArray(t.data)?v(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return y.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+u(t))}function g(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function b(t){return g(t),p(t<0?0:0|m(t))}function v(t){for(var e=t.length<0?0:0|m(t.length),r=p(e),n=0;n=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return 0|t}function A(t,e){if(y.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||et(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+u(t));var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Z(t).length;default:if(i)return n?-1:$(t).length;e=(""+e).toLowerCase(),i=!0}}function E(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return C(this,e,r);case"utf8":case"utf-8":return j(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return _(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function x(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function k(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),rt(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=y.from(e,n)),y.isBuffer(e))return 0===e.length?-1:O(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):O(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function O(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function h(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var f=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var c=!0,l=0;li&&(n=i):n=i;var o,a=e.length;for(n>a/2&&(n=a/2),o=0;o>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function _(t,e,r){return 0===e&&r===t.length?h.fromByteArray(t):h.fromByteArray(t.slice(e,r))}function j(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:o>223?3:o>191?2:1;if(i+s<=r){var u=void 0,h=void 0,f=void 0,c=void 0;switch(s){case 1:o<128&&(a=o);break;case 2:128==(192&(u=t[i+1]))&&(c=(31&o)<<6|63&u)>127&&(a=c);break;case 3:u=t[i+1],h=t[i+2],128==(192&u)&&128==(192&h)&&(c=(15&o)<<12|(63&u)<<6|63&h)>2047&&(c<55296||c>57343)&&(a=c);break;case 4:u=t[i+1],h=t[i+2],f=t[i+3],128==(192&u)&&128==(192&h)&&128==(192&f)&&(c=(15&o)<<18|(63&u)<<12|(63&h)<<6|63&f)>65535&&c<1114112&&(a=c)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=s}return function(t){var e=t.length;if(e<=P)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn.length?(y.isBuffer(o)||(o=y.from(o)),o.copy(n,i)):Uint8Array.prototype.set.call(n,o,i);else{if(!y.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},y.byteLength=A,y.prototype._isBuffer=!0,y.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;er&&(t+=" ... "),""},c&&(y.prototype[c]=y.prototype.inspect),y.prototype.compare=function(t,e,r,n,i){if(et(t,Uint8Array)&&(t=y.from(t,t.offset,t.byteLength)),!y.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+u(t));if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),h=this.slice(n,i),f=t.slice(e,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return I(this,t,e,r);case"utf8":case"utf-8":return U(this,t,e,r);case"ascii":case"latin1":case"binary":return S(this,t,e,r);case"base64":return L(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function T(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function F(t,e,r,n,i,o){if(!y.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function G(t,e,r,n,i){Q(e,n,i,t,r,7);var o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;var a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a>>=8,t[r++]=a,a>>=8,t[r++]=a,a>>=8,t[r++]=a,r}function z(t,e,r,n,i){Q(e,n,i,t,r,7);var o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;var a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a>>=8,t[r+2]=a,a>>=8,t[r+1]=a,a>>=8,t[r]=a,r+8}function D(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function W(t,e,r,n,i){return e=+e,r>>>=0,i||D(t,0,r,4),f.write(t,e,r,n,23,4),r+4}function Y(t,e,r,n,i){return e=+e,r>>>=0,i||D(t,0,r,8),f.write(t,e,r,n,52,8),r+8}y.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||N(t,e,this.length);for(var n=this[t],i=1,o=0;++o>>=0,e>>>=0,r||N(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},y.prototype.readUint8=y.prototype.readUInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),this[t]},y.prototype.readUint16LE=y.prototype.readUInt16LE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]|this[t+1]<<8},y.prototype.readUint16BE=y.prototype.readUInt16BE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]<<8|this[t+1]},y.prototype.readUint32LE=y.prototype.readUInt32LE=function(t,e){return t>>>=0,e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},y.prototype.readUint32BE=y.prototype.readUInt32BE=function(t,e){return t>>>=0,e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},y.prototype.readBigUInt64LE=it((function(t){X(t>>>=0,"offset");var e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);var n=e+this[++t]*Math.pow(2,8)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,24),i=this[++t]+this[++t]*Math.pow(2,8)+this[++t]*Math.pow(2,16)+r*Math.pow(2,24);return BigInt(n)+(BigInt(i)<>>=0,"offset");var e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);var n=e*Math.pow(2,24)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,8)+this[++t],i=this[++t]*Math.pow(2,24)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,8)+r;return(BigInt(n)<>>=0,e>>>=0,r||N(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},y.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||N(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},y.prototype.readInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},y.prototype.readInt16LE=function(t,e){t>>>=0,e||N(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},y.prototype.readInt16BE=function(t,e){t>>>=0,e||N(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},y.prototype.readInt32LE=function(t,e){return t>>>=0,e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},y.prototype.readInt32BE=function(t,e){return t>>>=0,e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},y.prototype.readBigInt64LE=it((function(t){X(t>>>=0,"offset");var e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);var n=this[t+4]+this[t+5]*Math.pow(2,8)+this[t+6]*Math.pow(2,16)+(r<<24);return(BigInt(n)<>>=0,"offset");var e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);var n=(e<<24)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,8)+this[++t];return(BigInt(n)<>>=0,e||N(t,4,this.length),f.read(this,t,!0,23,4)},y.prototype.readFloatBE=function(t,e){return t>>>=0,e||N(t,4,this.length),f.read(this,t,!1,23,4)},y.prototype.readDoubleLE=function(t,e){return t>>>=0,e||N(t,8,this.length),f.read(this,t,!0,52,8)},y.prototype.readDoubleBE=function(t,e){return t>>>=0,e||N(t,8,this.length),f.read(this,t,!1,52,8)},y.prototype.writeUintLE=y.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||F(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,n||F(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},y.prototype.writeUint8=y.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,255,0),this[e]=255&t,e+1},y.prototype.writeUint16LE=y.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},y.prototype.writeUint16BE=y.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},y.prototype.writeUint32LE=y.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},y.prototype.writeUint32BE=y.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},y.prototype.writeBigUInt64LE=it((function(t){return G(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),y.prototype.writeBigUInt64BE=it((function(t){return z(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),y.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);F(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>>=0,!n){var i=Math.pow(2,8*r-1);F(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a|0)-s&255;return e+r},y.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},y.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},y.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},y.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},y.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},y.prototype.writeBigInt64LE=it((function(t){return G(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),y.prototype.writeBigInt64BE=it((function(t){return z(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),y.prototype.writeFloatLE=function(t,e,r){return W(this,t,e,!0,r)},y.prototype.writeFloatBE=function(t,e,r){return W(this,t,e,!1,r)},y.prototype.writeDoubleLE=function(t,e,r){return Y(this,t,e,!0,r)},y.prototype.writeDoubleBE=function(t,e,r){return Y(this,t,e,!1,r)},y.prototype.copy=function(t,e,r,n){if(!y.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o=n+4;r-=3)e="_".concat(t.slice(r-3,r)).concat(e);return"".concat(t.slice(0,r)).concat(e)}function Q(t,e,r,n,i,o){if(t>r||t3?0===e||e===BigInt(0)?">= 0".concat(s," and < 2").concat(s," ** ").concat(8*(o+1)).concat(s):">= -(2".concat(s," ** ").concat(8*(o+1)-1).concat(s,") and < 2 ** ")+"".concat(8*(o+1)-1).concat(s):">= ".concat(e).concat(s," and <= ").concat(r).concat(s),new V.ERR_OUT_OF_RANGE("value",a,t)}!function(t,e,r){X(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||H(e,t.length-(r+1))}(n,i,o)}function X(t,e){if("number"!=typeof t)throw new V.ERR_INVALID_ARG_TYPE(e,"number",t)}function H(t,e,r){if(Math.floor(t)!==t)throw X(t,r),new V.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new V.ERR_BUFFER_OUT_OF_BOUNDS;throw new V.ERR_OUT_OF_RANGE(r||"offset",">= ".concat(r?1:0," and <= ").concat(e),t)}q("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?"".concat(t," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),q("ERR_INVALID_ARG_TYPE",(function(t,e){return'The "'.concat(t,'" argument must be of type number. Received type ').concat(u(e))}),TypeError),q("ERR_OUT_OF_RANGE",(function(t,e,r){var n='The value of "'.concat(t,'" is out of range.'),i=r;return Number.isInteger(r)&&Math.abs(r)>Math.pow(2,32)?i=J(String(r)):"bigint"==typeof r&&(i=String(r),(r>Math.pow(BigInt(2),BigInt(32))||r<-Math.pow(BigInt(2),BigInt(32)))&&(i=J(i)),i+="n"),n+" It must be ".concat(e,". Received ").concat(i)}),RangeError);var K=/[^+/0-9A-Za-z-_]/g;function $(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Z(t){return h.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function tt(t,e,r,n){var i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function et(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function rt(t){return t!=t}var nt=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}();function it(t){return"undefined"==typeof BigInt?ot:t}function ot(){throw new Error("BigInt not supported")}},613:(t,e,r)=>{"use strict";function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r1&&void 0!==arguments[1]?arguments[1]:s())("readonly",(function(e){return i(e.get(t))}))}function h(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:s())("readwrite",(function(r){return r.put(e,t),i(r.transaction)}))}function f(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:s())("readwrite",(function(e){return t.forEach((function(t){return e.put(t[1],t[0])})),i(e.transaction)}))}function c(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:s())("readonly",(function(e){return Promise.all(t.map((function(t){return i(e.get(t))})))}))}function l(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:s())("readwrite",(function(r){return new Promise((function(n,o){r.get(t).onsuccess=function(){try{r.put(e(this.result),t),n(i(r.transaction))}catch(t){o(t)}}}))}))}function p(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:s())("readwrite",(function(e){return e.delete(t),i(e.transaction)}))}function y(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:s())("readwrite",(function(e){return t.forEach((function(t){return e.delete(t)})),i(e.transaction)}))}function d(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:s())("readwrite",(function(t){return t.clear(),i(t.transaction)}))}function g(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},i(t.transaction)}function b(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:s())("readonly",(function(t){if(t.getAllKeys)return i(t.getAllKeys());var e=[];return g(t,(function(t){return e.push(t.key)})).then((function(){return e}))}))}function v(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:s())("readonly",(function(t){if(t.getAll)return i(t.getAll());var e=[];return g(t,(function(t){return e.push(t.value)})).then((function(){return e}))}))}function w(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s();return t("readonly",(function(e){if(e.getAll&&e.getAllKeys)return Promise.all([i(e.getAllKeys()),i(e.getAll())]).then((function(t){var e,r,i=(r=2,function(t){if(Array.isArray(t))return t}(e=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,h=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){h=!0,i=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw i}}return s}}(e,r)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=i[0],a=i[1];return o.map((function(t,e){return[t,a[e]]}))}));var r=[];return t("readonly",(function(t){return g(t,(function(t){return r.push([t.key,t.value])})).then((function(){return r}))}))}))}r.r(e),r.d(e,{clear:()=>d,createStore:()=>o,del:()=>p,delMany:()=>y,entries:()=>w,get:()=>u,getMany:()=>c,keys:()=>b,promisifyRequest:()=>i,set:()=>h,setMany:()=>f,update:()=>l,values:()=>v})},670:t=>{"use strict";t.exports={text:!0,blocks:!1,layoutBlocks:!1,hocr:!1,tsv:!1,box:!1,unlv:!1,osd:!1,pdf:!1,imageColor:!1,imageGrey:!1,imageBinary:!1,debug:!1}},768:(t,e)=>{"use strict";e.byteLength=function(t){var e=s(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=s(t),a=o[0],u=o[1],h=new i(function(t,e,r){return 3*(e+r)/4-r}(0,a,u)),f=0,c=u>0?a-4:a;for(r=0;r>16&255,h[f++]=e>>8&255,h[f++]=255&e;return 2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,h[f++]=255&e),1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,h[f++]=e>>8&255,h[f++]=255&e),h},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],a=16383,s=0,h=n-i;sh?h:s+a));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],n[o.charCodeAt(a)]=a;function s(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t,e,n){for(var i,o,a=[],s=e;s>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},773:(t,e)=>{e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,f=-7,c=r?i-1:0,l=r?-1:1,p=t[e+c];for(c+=l,o=p&(1<<-f)-1,p>>=-f,f+=s;f>0;o=256*o+t[e+c],c+=l,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=256*a+t[e+c],c+=l,f-=8);if(0===o)o=1-h;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=h}return(p?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,h=8*o-i-1,f=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,y=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=f?(s=0,a=f):a+c>=1?(s=(e*u-1)*Math.pow(2,i),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&s,p+=y,s/=256,i-=8);for(a=a<0;t[r+p]=255&a,p+=y,a/=256,h-=8);t[r+p-y]|=128*d}},797:(t,e,r)=>{"use strict";var n=r(613),i=n.set,o=n.get,a=n.del;t.exports={readCache:o,writeCache:i,deleteCache:a,checkCache:function(t){return o(t).then((function(t){return void 0!==t}))}}},834:(t,e,r)=>{var n=r(545).hp;function i(t,e){if(this.pos=0,this.buffer=t,this.is_with_alpha=!!e,this.bottom_up=!0,this.flag=this.buffer.toString("utf-8",0,this.pos+=2),"BM"!=this.flag)throw new Error("Invalid BMP File");this.parseHeader(),this.parseRGBA()}i.prototype.parseHeader=function(){if(this.fileSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.reserved=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.offset=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.headerSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.width=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.height=this.buffer.readInt32LE(this.pos),this.pos+=4,this.planes=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.bitPP=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.compress=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.rawSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.hr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.vr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.colors=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.importantColors=this.buffer.readUInt32LE(this.pos),this.pos+=4,16===this.bitPP&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var t=0===this.colors?1<=0?this.height-1:-this.height;for(r=this.height-1;r>=0;r--){for(var n=this.bottom_up?r:this.height-1-r,i=0;i>7-s&1];this.data[a+4*s]=0,this.data[a+4*s+1]=u.blue,this.data[a+4*s+2]=u.green,this.data[a+4*s+3]=u.red}0!=e&&(this.pos+=4-e)}},i.prototype.bit4=function(){if(2==this.compress){var t=function(t){var r=this.palette[t];this.data[e]=0,this.data[e+1]=r.blue,this.data[e+2]=r.green,this.data[e+3]=r.red,e+=4};this.data.fill(255);for(var e=0,r=this.bottom_up?this.height-1:0,n=!1;e>4),1&h&&h+1>1&1)&&this.pos++}}else for(h=0;h>4),n=!n}}else{var f=Math.ceil(this.width/2),c=f%4;for(s=this.height-1;s>=0;s--){var l=this.bottom_up?s:this.height-1-s;for(a=0;a>4,y=15&o,d=this.palette[p];if(this.data[e]=0,this.data[e+1]=d.blue,this.data[e+2]=d.green,this.data[e+3]=d.red,2*a+1>=this.width)break;d=this.palette[y],this.data[e+4]=0,this.data[e+4+1]=d.blue,this.data[e+4+2]=d.green,this.data[e+4+3]=d.red}0!=c&&(this.pos+=4-c)}}},i.prototype.bit8=function(){if(1==this.compress){var t=function(t){var r=this.palette[t];this.data[e]=0,this.data[e+1]=r.blue,this.data[e+2]=r.green,this.data[e+3]=r.red,e+=4};this.data.fill(255);for(var e=0,r=this.bottom_up?this.height-1:0;e=0;a--){var f=this.bottom_up?a:this.height-1-a;for(o=0;o=0;r--){for(var n=this.bottom_up?r:this.height-1-r,i=0;i>5&e)/e*255|0,u=(o>>10&e)/e*255|0,h=o>>15?255:0,f=n*this.width*4+4*i;this.data[f]=h,this.data[f+1]=a,this.data[f+2]=s,this.data[f+3]=u}this.pos+=t}},i.prototype.bit16=function(){var t=this.width%2*2;this.maskRed=31744,this.maskGreen=992,this.maskBlue=31,this.mask0=0,3==this.compress&&(this.maskRed=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.maskGreen=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.maskBlue=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.mask0=this.buffer.readUInt32LE(this.pos),this.pos+=4);for(var e=[0,0,0],r=0;r<16;r++)this.maskRed>>r&1&&e[0]++,this.maskGreen>>r&1&&e[1]++,this.maskBlue>>r&1&&e[2]++;e[1]+=e[0],e[2]+=e[1],e[0]=8-e[0],e[1]-=8,e[2]-=8;for(var n=this.height-1;n>=0;n--){for(var i=this.bottom_up?n:this.height-1-n,o=0;o>e[1],h=(a&this.maskRed)>>e[2],f=i*this.width*4+4*o;this.data[f]=0,this.data[f+1]=s,this.data[f+2]=u,this.data[f+3]=h}this.pos+=t}},i.prototype.bit24=function(){for(var t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,r=0;r=0;t--)for(var e=this.bottom_up?t:this.height-1-t,r=0;r=0;t--)for(e=this.bottom_up?t:this.height-1-t,r=0;r{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}t.exports=function(t){var r={};return"undefined"!=typeof WorkerGlobalScope?r.type="webworker":"object"===("undefined"==typeof document?"undefined":e(document))?r.type="browser":"object"===("undefined"==typeof process?"undefined":e(process))&&(r.type="node"),void 0===t?r:r[t]}},968:function(t,e,r){"use strict";var n=this;function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;_(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:P(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function f(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function c(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){f(o,n,i,a,s,"next",t)}function s(t){f(o,n,i,a,s,"throw",t)}a(void 0)}))}}r(30);var l,p,y,d,g=r(443),b=r(334),v=r(938)("type"),w=r(329),m=r(670),A=r(65),E=A.log,x=A.setLogging,k=r(971),O=null,I={},U={},S=!1,L=function(){var t=c(h().mark((function t(e,r){var n,i,o,a,s,u,f,c;return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.workerId,i=e.jobId,o=e.payload.options,a=o.lstmOnly,s=o.corePath,u=o.logging,x(u),f="initializing tesseract",l){t.next=11;break}return t.next=6,I.getCore(a,s,r);case 6:c=t.sent,r.progress({workerId:n,status:f,progress:0}),c({TesseractProgress:function(t){p.progress({workerId:n,jobId:i,status:"recognizing text",progress:Math.max(0,(t-30)/70)})}}).then((function(t){l=t,r.progress({workerId:n,status:f,progress:1}),r.resolve({loaded:!0})})),t.next=12;break;case 11:r.resolve({loaded:!0});case 12:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),B=function(){var t=c(h().mark((function t(e,r){var n,i,o,a,s;return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=e.workerId,o=e.payload,a=o.method,s=o.args,E("[".concat(i,"]: FS.").concat(a)),r.resolve((n=l.FS)[a].apply(n,function(t){if(Array.isArray(t))return u(t)}(h=s)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(h)||function(t,e){if(t){if("string"==typeof t)return u(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(h)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()));case 3:case"end":return t.stop()}var h}),t)})));return function(e,r){return t.apply(this,arguments)}}(),_=function(){var t=c(h().mark((function t(e,r){var n,i,o,a,s,u,f,p,b,w,m,A,x,k,O;return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.workerId,i=e.payload,o=i.langs,a=i.options,s=a.langPath,u=a.dataPath,f=a.cachePath,p=a.cacheMethod,b=a.gzip,w=void 0===b||b,m=a.lstmOnly,y=o,d={langPath:s,dataPath:u,cachePath:f,cacheMethod:p,gzip:w,lstmOnly:m},A="loading language traineddata",x="string"==typeof o?o.split("+"):o,k=0,O=function(){var t=c(h().mark((function t(e){var i,o,a,c,y,d,b,O,U;return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i="string"==typeof e?e:e.code,o=["refresh","none"].includes(p)?function(){return Promise.resolve()}:I.readCache,a=null,c=!1,t.prev=4,t.next=7,o("".concat(f||".","/").concat(i,".traineddata"));case 7:if(void 0===(y=t.sent)){t.next=14;break}E("[".concat(n,"]: Load ").concat(i,".traineddata from cache")),a=y,S=!0,t.next=15;break;case 14:throw Error("Not found in cache");case 15:t.next=45;break;case 17:if(t.prev=17,t.t0=t.catch(4),c=!0,E("[".concat(n,"]: Load ").concat(i,".traineddata from ").concat(s)),"string"!=typeof e){t.next=44;break}if(d=null,b=s||"https://cdn.jsdelivr.net/npm/@tesseract.js-data/".concat(i,m?"/4.0.0_best_int":"/4.0.0"),("node"!==v||g(b)||b.startsWith("moz-extension://")||b.startsWith("chrome-extension://")||b.startsWith("file://"))&&(d=b.replace(/\/$/,"")),null===d){t.next=39;break}return O="".concat(d,"/").concat(i,".traineddata").concat(w?".gz":""),t.next=29,("webworker"===v?fetch:I.fetch)(O);case 29:if((U=t.sent).ok){t.next=32;break}throw Error("Network error while fetching ".concat(O,". Response code: ").concat(U.status));case 32:return t.t1=Uint8Array,t.next=35,U.arrayBuffer();case 35:t.t2=t.sent,a=new t.t1(t.t2),t.next=42;break;case 39:return t.next=41,I.readCache("".concat(b,"/").concat(i,".traineddata").concat(w?".gz":""));case 41:a=t.sent;case 42:t.next=45;break;case 44:a=e.data;case 45:if(k+=.5/x.length,r&&r.progress({workerId:n,status:A,progress:k}),(31===a[0]&&139===a[1]||31===a[1]&&139===a[0])&&(a=I.gunzip(a)),l){if(u)try{l.FS.mkdir(u)}catch(t){r&&r.reject(t.toString())}l.FS.writeFile("".concat(u||".","/").concat(i,".traineddata"),a)}if(!c||!["write","refresh",void 0].includes(p)){t.next=60;break}return t.prev=51,t.next=54,I.writeCache("".concat(f||".","/").concat(i,".traineddata"),a);case 54:t.next=60;break;case 56:t.prev=56,t.t3=t.catch(51),E("[".concat(n,"]: Failed to write ").concat(i,".traineddata to cache due to error:")),E(t.t3.toString());case 60:k+=.5/x.length,100===Math.round(100*k)&&(k=1),r&&r.progress({workerId:n,status:A,progress:k});case 63:case"end":return t.stop()}}),t,null,[[4,17],[51,56]])})));return function(e){return t.apply(this,arguments)}}(),r&&r.progress({workerId:n,status:A,progress:0}),t.prev=8,t.next=11,Promise.all(x.map(O));case 11:r&&r.resolve(o),t.next=17;break;case 14:t.prev=14,t.t0=t.catch(8),r&&r.reject(t.t0.toString());case 17:case"end":return t.stop()}}),t,null,[[8,14]])})));return function(e,r){return t.apply(this,arguments)}}(),j=function(){var t=c(h().mark((function t(e,r){var n,i,o;return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.payload.params,i=["ambigs_debug_level","user_words_suffix","user_patterns_suffix","user_patterns_suffix","load_system_dawg","load_freq_dawg","load_unambig_dawg","load_punc_dawg","load_number_dawg","load_bigram_dawg","tessedit_ocr_engine_mode","tessedit_init_config_only","language_model_ngram_on","language_model_use_sigmoidal_certainty"],(o=Object.keys(n).filter((function(t){return i.includes(t)})).join(", ")).length>0&&console.log("Attempted to set parameters that can only be set during initialization: ".concat(o)),Object.keys(n).filter((function(t){return!t.startsWith("tessjs_")})).forEach((function(t){O.SetVariable(t,n[t])})),U=a(a({},U),n),void 0!==r&&r.resolve(U);case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),P=function(){var t=c(h().mark((function t(e,r){var n,o,a,s,u,f,c,p,g,b,v,w,m,A;return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.workerId,o=e.payload,a=o.langs,s=o.oem,u=o.config,f="string"==typeof a?a:a.map((function(t){return"string"==typeof t?t:t.data})).join("+"),c="initializing api",t.prev=3,r.progress({workerId:n,status:c,progress:0}),null!==O&&O.End(),u&&"object"===i(u)&&Object.keys(u).length>0?g=JSON.stringify(u).replace(/,/g,"\n").replace(/:/g," ").replace(/["'{}]/g,""):u&&"string"==typeof u&&(g=u),"string"==typeof g&&(p="/config",l.FS.writeFile(p,g)),O=new l.TessBaseAPI,-1!==(b=O.Init(null,f,s,p))){t.next=30;break}if(!["write","refresh",void 0].includes(d.cacheMethod)){t.next=30;break}return v=f.split("+"),w=v.map((function(t){return I.deleteCache("".concat(d.cachePath||".","/").concat(t,".traineddata"))})),t.next=16,Promise.all(w);case 16:if(m=l.FS.readFile("/debugDev.txt",{encoding:"utf8",flags:"a+"}),!S||!/components are not present/.test(m)){t.next=30;break}return E("Data from cache missing requested OEM model. Attempting to refresh cache with new language data."),t.next=21,_({workerId:n,payload:{langs:y,options:d}});case 21:if(-1!==(b=O.Init(null,f,s,p))){t.next=29;break}return E("Language data refresh failed."),A=v.map((function(t){return I.deleteCache("".concat(d.cachePath||".","/").concat(t,".traineddata"))})),t.next=27,Promise.all(A);case 27:t.next=30;break;case 29:E("Language data refresh successful.");case 30:-1===b&&r.reject("initialization failed"),r.progress({workerId:n,status:c,progress:1}),r.resolve(),t.next=38;break;case 35:t.prev=35,t.t0=t.catch(3),r.reject(t.t0.toString());case 38:case"end":return t.stop()}}),t,null,[[3,35]])})));return function(e,r){return t.apply(this,arguments)}}(),T=function(t){for(var e=JSON.parse(JSON.stringify(m)),r=["imageColor","imageGrey","imageBinary","layoutBlocks","debug"],n=0,i=0,o=Object.keys(t);i0)for(f=0,c=Object.keys(a);f0)for(O.SaveParameters(),y=0,d=Object.keys(u);y=.005?w(l,O,o,x=S):(U&&w(l,O,o),x=0)):(x=a.rotateRadians||0,w(l,O,o,x)),"object"===i(L=a.rectangle)&&O.SetRectangle(L.left,L.top,L.width,L.height),A?(s.layoutBlocks&&O.AnalyseLayout(),E("Skipping recognition: all output options requiring recognition are disabled.")):O.Recognize(null),B=a.pdfTitle,_=a.pdfTextOnly,(j=b(l,O,m,{pdfTitle:B,pdfTextOnly:_,skipRecognition:A})).rotateRadians=x,s.debug&&l.FS.unlink("/debugInternal.txt"),Object.keys(u).length>0&&O.RestoreParameters(),r.resolve(j)}catch(t){r.reject(t.toString())}case 2:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),M=function(){var t=c(h().mark((function t(e,r){var n,i,o,a,s;return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.payload.image;try{w(l,O,n),i=new l.OSResults,O.DetectOS(i)?(o=i.best_result,a=o.orientation_id,s=o.script_id,r.resolve({tesseract_script_id:s,script:i.unicharset.get_script_from_script_id(s),script_confidence:o.sconfidence,orientation_degrees:[0,270,180,90][a],orientation_confidence:o.oconfidence})):r.resolve({tesseract_script_id:null,script:null,script_confidence:null,orientation_degrees:null,orientation_confidence:null})}catch(t){r.reject(t.toString())}case 2:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),N=function(){var t=c(h().mark((function t(e,r){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:try{null!==O&&O.End(),r.resolve({terminated:!0})}catch(t){r.reject(t.toString())}case 1:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}();e.dispatchHandlers=function(t,e){var r=function(r,n){var i={jobId:t.jobId,workerId:t.workerId,action:t.action};e(a(a({},i),{},{status:r,data:n}))};r.resolve=r.bind(n,"resolve"),r.reject=r.bind(n,"reject"),r.progress=r.bind(n,"progress"),p=r,{load:L,FS:B,loadLanguage:_,initialize:P,setParameters:j,recognize:C,detect:M,terminate:N}[t.action](t,r).catch((function(t){return r.reject(t.toString())}))},e.setAdapter=function(t){I=t}},971:t=>{"use strict";t.exports={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"}},976:(t,e,r)=>{"use strict";function n(){n=function(){return e};var t,e={},r=Object.prototype,o=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",h=s.asyncIterator||"@@asyncIterator",f=s.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof w?e:w,o=Object.create(i.prototype),s=new j(n||[]);return a(o,"_invoke",{value:S(t,r,s)}),o}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var y="suspendedStart",d="suspendedYield",g="executing",b="completed",v={};function w(){}function m(){}function A(){}var E={};c(E,u,(function(){return this}));var x=Object.getPrototypeOf,k=x&&x(x(P([])));k&&k!==r&&o.call(k,u)&&(E=k);var O=A.prototype=w.prototype=Object.create(E);function I(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function U(t,e){function r(n,a,s,u){var h=p(t[n],t,a);if("throw"!==h.type){var f=h.arg,c=f.value;return c&&"object"==i(c)&&o.call(c,"__await")?e.resolve(c.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):e.resolve(c).then((function(t){f.value=t,s(f)}),(function(t){return r("throw",t,s,u)}))}u(h.arg)}var n;a(this,"_invoke",{value:function(t,i){function o(){return new e((function(e,n){r(t,i,e,n)}))}return n=n?n.then(o,o):o()}})}function S(e,r,n){var i=y;return function(o,a){if(i===g)throw Error("Generator is already running");if(i===b){if("throw"===o)throw a;return{value:t,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var u=L(s,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===y)throw i=b,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=g;var h=p(e,r,n);if("normal"===h.type){if(i=n.done?b:d,h.arg===v)continue;return{value:h.arg,done:n.done}}"throw"===h.type&&(i=b,n.method="throw",n.arg=h.arg)}}}function L(e,r){var n=r.method,i=e.iterator[n];if(i===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,L(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var o=p(i,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function B(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(B,this),this.reset(!0)}function P(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function r(){for(;++n=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),h=o.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;_(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:P(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}var a=r(242),s=a.simd,u=a.relaxedSimd,h=r(330).El.QE;t.exports=function(){var t,e=(t=n().mark((function t(e,o,a){var f,c,l,p,y;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==r.g.TesseractCore){t.next=23;break}if(f="loading tesseract core",a.progress({status:f,progress:0}),"js"!==(c=o||"https://cdn.jsdelivr.net/npm/tesseract.js-core@v".concat(h.substring(1))).slice(-2)){t.next=8;break}l=c,t.next=15;break;case 8:return t.next=10,s();case 10:return p=t.sent,t.next=13,u();case 13:y=t.sent,l="".concat(c.replace(/\/$/,""),y?e?"/tesseract-core-relaxedsimd-lstm.wasm.js":"/tesseract-core-relaxedsimd.wasm.js":p?e?"/tesseract-core-simd-lstm.wasm.js":"/tesseract-core-simd.wasm.js":e?"/tesseract-core-lstm.wasm.js":"/tesseract-core.wasm.js");case 15:if(r.g.importScripts(l),void 0!==r.g.TesseractCore||void 0===r.g.TesseractCoreWASM||"object"!==("undefined"==typeof WebAssembly?"undefined":i(WebAssembly))){t.next=20;break}r.g.TesseractCore=r.g.TesseractCoreWASM,t.next=22;break;case 20:if(void 0!==r.g.TesseractCore){t.next=22;break}throw Error("Failed to load TesseractCore");case 22:a.progress({status:f,progress:1});case 23:return t.abrupt("return",r.g.TesseractCore);case 24:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function s(t){o(a,n,i,s,u,"next",t)}function u(t){o(a,n,i,s,u,"throw",t)}s(void 0)}))});return function(t,r,n){return e.apply(this,arguments)}}()}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function n(e,r,n){return(r=function(e){var r=function(e){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var i=r(968),o=r(976),a=r(258),s=r(797);r.g.addEventListener("message",(function(t){var e=t.data;i.dispatchHandlers(e,(function(t){return postMessage(t)}))})),i.setAdapter(function(t){for(var r=1;r