{"version":3,"sources":["webpack://Tesseract/webpack/universalModuleDefinition","webpack://Tesseract/webpack/bootstrap","webpack://Tesseract/./src/browser/index.js","webpack://Tesseract/./src/index.js","webpack://Tesseract/./node_modules/check-types/src/check-types.js","webpack://Tesseract/./node_modules/is-url/index.js","webpack://Tesseract/./src/common/circularize.js","webpack://Tesseract/./src/common/job.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","isURL","defaultOptions","corePath","WebAssembly","langPath","version","workerPath","spawnWorker","instance","workerOptions","worker","Blob","URL","blob","Worker","createObjectURL","onmessage","data","_recv","terminateWorker","terminate","sendPacket","packet","imageURI","fetch","then","resp","buffer","Promise","loadImage","payload","image","buf","Uint8Array","img","postMessage","Array","from","check","adapter","circularize","TesseractJob","TesseractWorker","[object Object]","this","assign","_currentJob","_queue","options","lang","_delay","job","_send","string","fn","null","push","shift","_dequeue","length","id","jobId","_handle","status","action","console","warn","__WEBPACK_AMD_DEFINE_RESULT__","globals","strings","messages","predicates","functions","assert","not","maybe","collections","slice","neginf","posinf","isArray","haveSymbols","assigned","number","integer","greater","lhs","rhs","less","greaterOrEqual","lessOrEqual","nonEmptyString","toString","instanceStrict","error","like","archetype","array","arrayLike","isFunction","testArray","result","testObject","mixin","target","source","keys","forEach","assertModifier","predicate","defaultMessage","args","argCount","message","ErrorType","assertImpl","apply","TypeError","assertPredicate","arguments","Error","notModifier","modifiedPredicate","notImpl","ofModifier","type","collection","map","coerceCollection","item","concat","ignore","createModifiedPredicates","modifier","createModifiedFunctions","pop","configurable","writable","createModifiedModifier","modified","createOfModifiers","base","of","v","b","a","al","f","undefined","iterator","iteration","values","next","done","x","y","substring","indexOf","regex","match","constructor","Date","getTime","hasLength","index","mapSimple","mapComplex","all","any","Number","NEGATIVE_INFINITY","POSITIVE_INFINITY","exportFunctions","matcher","test","iPage","page","paragraphs","lines","words","symbols","blocks","iBlock","block","iPara","para","iLine","line","paragraph","iWord","word","iSym","sym","jobCounter","Math","random","_instance","_resolve","_reject","_progress","_finally","resolve","reject","catch","runFinallyCbs","log","ret"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,OAAA,GAAAH,GACA,iBAAAC,QACAA,QAAA,UAAAD,IAEAD,EAAA,UAAAC,IARA,CASCK,OAAA,WACD,mBCTA,IAAAC,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAP,QAGA,IAAAC,EAAAI,EAAAE,GAAA,CACAC,EAAAD,EACAE,GAAA,EACAT,QAAA,IAUA,OANAU,EAAAH,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAQ,GAAA,EAGAR,EAAAD,QA0DA,OArDAM,EAAAM,EAAAF,EAGAJ,EAAAO,EAAAR,EAGAC,EAAAQ,EAAA,SAAAd,EAAAe,EAAAC,GACAV,EAAAW,EAAAjB,EAAAe,IACAG,OAAAC,eAAAnB,EAAAe,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CV,EAAAgB,EAAA,SAAAtB,GACA,oBAAAuB,eAAAC,aACAN,OAAAC,eAAAnB,EAAAuB,OAAAC,YAAA,CAAwDC,MAAA,WAExDP,OAAAC,eAAAnB,EAAA,cAAiDyB,OAAA,KAQjDnB,EAAAoB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAAnB,EAAAmB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFAxB,EAAAgB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,EAAAE,G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file":"tesseract.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Tesseract\"] = factory();\n\telse\n\t\troot[\"Tesseract\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","const isURL = require('is-url');\n\nconst defaultOptions = {\n // workerPath: 'https://cdn.jsdelivr.net/gh/naptha/tesseract.js@0.2.0/dist/worker.js',\n corePath: `https://cdn.jsdelivr.net/gh/naptha/tesseract.js-core@2.0.0-beta.4/tesseract${typeof WebAssembly === 'object' ? '' : 'asm'}.js`,\n langPath: 'https://cdn.jsdelivr.net/gh/naptha/tessdata@gh-pages/3.02/',\n};\n\nif (process.env.NODE_ENV === 'development') {\n console.debug('Using Development Configuration');\n // eslint-disable-next-line\n const { protocol, host } = location;\n defaultOptions.workerPath = `${protocol}://${host}/dist/worker.dev.js?nocache=${Math.random().toString(36).slice(3)}`;\n} else {\n const { version } = require('../../package.json');\n defaultOptions.workerPath = `https://cdn.jsdelivr.net/gh/naptha/tesseract.js@${version}/dist/worker.js`;\n}\n\nconst loadImage = (imageURI) => {\n if (isURL(imageURI)) {\n return fetch(imageURI)\n .then(resp => resp.buffer());\n }\n return new Promise();\n};\n\nexports.defaultOptions = defaultOptions;\n\nexports.spawnWorker = (instance, workerOptions) => {\n let worker;\n if (window.Blob && window.URL) {\n const blob = new Blob([`importScripts(\"${workerOptions.workerPath}\");`]);\n worker = new Worker(window.URL.createObjectURL(blob));\n } else {\n worker = new Worker(workerOptions.workerPath);\n }\n\n worker.onmessage = ({ data }) => {\n instance._recv(data);\n };\n\n return worker;\n};\n\nexports.terminateWorker = (instance) => {\n instance.worker.terminate();\n};\n\nexports.sendPacket = (instance, packet) => {\n loadImage(packet.payload.image)\n .then(buf => new Uint8Array(buf))\n .then((img) => {\n instance.worker.postMessage({\n ...packet,\n payload: {\n ...packet.payload,\n image: Array.from(img),\n },\n });\n });\n};\n","const check = require('check-types');\nconst adapter = require('./node');\nconst circularize = require('./common/circularize');\nconst TesseractJob = require('./common/job');\n\nclass TesseractWorker {\n constructor(workerOptions = {}) {\n this.worker = null;\n this.workerOptions = Object.assign({}, adapter.defaultOptions, workerOptions);\n this._currentJob = null;\n this._queue = [];\n }\n\n recognize(image, options = { lang: 'eng' }) {\n return this._delay((job) => {\n job._send(\n 'recognize',\n {\n image,\n options: check.string(options)\n ? { lang: options || 'eng' }\n : options,\n workerOptions: this.workerOptions,\n },\n );\n });\n }\n\n detect(image, options = {}) {\n return this._delay((job) => {\n job._send(\n 'detect',\n {\n image,\n options,\n workerOptions: this.workerOptions,\n },\n );\n });\n }\n\n terminate() {\n if (this.worker) {\n adapter.terminateWorker(this);\n }\n this.worker = null;\n this._currentJob = null;\n this._queue = [];\n }\n\n _delay(fn) {\n if (check.null(this.worker)) {\n this.worker = adapter.spawnWorker(this, this.workerOptions);\n }\n\n const job = new TesseractJob(this);\n this._queue.push(() => {\n this._queue.shift();\n this._currentJob = job;\n fn(job);\n });\n if (check.null(this._currentJob)) {\n this._dequeue();\n }\n return job;\n }\n\n _dequeue() {\n this._currentJob = null;\n if (this._queue.length) {\n this._queue[0]();\n }\n }\n\n _recv(packet) {\n if (this._currentJob.id === packet.jobId) {\n this._currentJob._handle({\n ...packet,\n data: packet.status === 'resolve' && packet.action === 'recognize'\n ? circularize(packet.data)\n : packet.data,\n });\n } else {\n console.warn(`Job ID ${packet.jobId} not known.`);\n }\n }\n}\n\nmodule.exports = {\n TesseractWorker,\n};\n","/*globals define, module, Symbol */\n/*jshint -W056 */\n\n(function (globals) {\n 'use strict';\n\n var strings, messages, predicates, functions, assert, not, maybe,\n collections, slice, neginf, posinf, isArray, haveSymbols;\n\n strings = {\n v: 'value',\n n: 'number',\n s: 'string',\n b: 'boolean',\n o: 'object',\n t: 'type',\n a: 'array',\n al: 'array-like',\n i: 'iterable',\n d: 'date',\n f: 'function',\n l: 'length'\n };\n\n messages = {};\n predicates = {};\n\n [\n { n: 'equal', f: equal, s: 'v' },\n { n: 'undefined', f: isUndefined, s: 'v' },\n { n: 'null', f: isNull, s: 'v' },\n { n: 'assigned', f: assigned, s: 'v' },\n { n: 'primitive', f: primitive, s: 'v' },\n { n: 'includes', f: includes, s: 'v' },\n { n: 'zero', f: zero },\n { n: 'infinity', f: infinity },\n { n: 'number', f: number },\n { n: 'integer', f: integer },\n { n: 'even', f: even },\n { n: 'odd', f: odd },\n { n: 'greater', f: greater },\n { n: 'less', f: less },\n { n: 'between', f: between },\n { n: 'greaterOrEqual', f: greaterOrEqual },\n { n: 'lessOrEqual', f: lessOrEqual },\n { n: 'inRange', f: inRange },\n { n: 'positive', f: positive },\n { n: 'negative', f: negative },\n { n: 'string', f: string, s: 's' },\n { n: 'emptyString', f: emptyString, s: 's' },\n { n: 'nonEmptyString', f: nonEmptyString, s: 's' },\n { n: 'contains', f: contains, s: 's' },\n { n: 'match', f: match, s: 's' },\n { n: 'boolean', f: boolean, s: 'b' },\n { n: 'object', f: object, s: 'o' },\n { n: 'emptyObject', f: emptyObject, s: 'o' },\n { n: 'nonEmptyObject', f: nonEmptyObject, s: 'o' },\n { n: 'instanceStrict', f: instanceStrict, s: 't' },\n { n: 'instance', f: instance, s: 't' },\n { n: 'like', f: like, s: 't' },\n { n: 'array', f: array, s: 'a' },\n { n: 'emptyArray', f: emptyArray, s: 'a' },\n { n: 'nonEmptyArray', f: nonEmptyArray, s: 'a' },\n { n: 'arrayLike', f: arrayLike, s: 'al' },\n { n: 'iterable', f: iterable, s: 'i' },\n { n: 'date', f: date, s: 'd' },\n { n: 'function', f: isFunction, s: 'f' },\n { n: 'hasLength', f: hasLength, s: 'l' },\n ].map(function (data) {\n var n = data.n;\n messages[n] = 'Invalid ' + strings[data.s || 'n'];\n predicates[n] = data.f;\n });\n\n functions = {\n apply: apply,\n map: map,\n all: all,\n any: any\n };\n\n collections = [ 'array', 'arrayLike', 'iterable', 'object' ];\n slice = Array.prototype.slice;\n neginf = Number.NEGATIVE_INFINITY;\n posinf = Number.POSITIVE_INFINITY;\n isArray = Array.isArray;\n haveSymbols = typeof Symbol === 'function';\n\n functions = mixin(functions, predicates);\n assert = createModifiedPredicates(assertModifier, assertImpl);\n not = createModifiedPredicates(notModifier, notImpl);\n maybe = createModifiedPredicates(maybeModifier, maybeImpl);\n assert.not = createModifiedModifier(assertModifier, not);\n assert.maybe = createModifiedModifier(assertModifier, maybe);\n\n collections.forEach(createOfPredicates);\n createOfModifiers(assert, assertModifier);\n createOfModifiers(not, notModifier);\n collections.forEach(createMaybeOfModifiers);\n\n exportFunctions(mixin(functions, {\n assert: assert,\n not: not,\n maybe: maybe\n }));\n\n /**\n * Public function `equal`.\n *\n * Returns true if `lhs` and `rhs` are strictly equal, without coercion.\n * Returns false otherwise.\n */\n function equal (lhs, rhs) {\n return lhs === rhs;\n }\n\n /**\n * Public function `undefined`.\n *\n * Returns true if `data` is undefined, false otherwise.\n */\n function isUndefined (data) {\n return data === undefined;\n }\n\n /**\n * Public function `null`.\n *\n * Returns true if `data` is null, false otherwise.\n */\n function isNull (data) {\n return data === null;\n }\n\n /**\n * Public function `assigned`.\n *\n * Returns true if `data` is not null or undefined, false otherwise.\n */\n function assigned (data) {\n return data !== undefined && data !== null;\n }\n\n /**\n * Public function `primitive`.\n *\n * Returns true if `data` is a primitive type, false otherwise.\n */\n function primitive (data) {\n var type;\n\n switch (data) {\n case null:\n case undefined:\n case false:\n case true:\n return true;\n }\n\n type = typeof data;\n return type === 'string' || type === 'number' || (haveSymbols && type === 'symbol');\n }\n\n /**\n * Public function `zero`.\n *\n * Returns true if `data` is zero, false otherwise.\n */\n function zero (data) {\n return data === 0;\n }\n\n /**\n * Public function `infinity`.\n *\n * Returns true if `data` is positive or negative infinity, false otherwise.\n */\n function infinity (data) {\n return data === neginf || data === posinf;\n }\n\n /**\n * Public function `number`.\n *\n * Returns true if `data` is a number, false otherwise.\n */\n function number (data) {\n return typeof data === 'number' && data > neginf && data < posinf;\n }\n\n /**\n * Public function `integer`.\n *\n * Returns true if `data` is an integer, false otherwise.\n */\n function integer (data) {\n return typeof data === 'number' && data % 1 === 0;\n }\n\n /**\n * Public function `even`.\n *\n * Returns true if `data` is an even number, false otherwise.\n */\n function even (data) {\n return typeof data === 'number' && data % 2 === 0;\n }\n\n /**\n * Public function `odd`.\n *\n * Returns true if `data` is an odd number, false otherwise.\n */\n function odd (data) {\n return integer(data) && data % 2 !== 0;\n }\n\n /**\n * Public function `greater`.\n *\n * Returns true if `lhs` is a number greater than `rhs`, false otherwise.\n */\n function greater (lhs, rhs) {\n return number(lhs) && lhs > rhs;\n }\n\n /**\n * Public function `less`.\n *\n * Returns true if `lhs` is a number less than `rhs`, false otherwise.\n */\n function less (lhs, rhs) {\n return number(lhs) && lhs < rhs;\n }\n\n /**\n * Public function `between`.\n *\n * Returns true if `data` is a number between `x` and `y`, false otherwise.\n */\n function between (data, x, y) {\n if (x < y) {\n return greater(data, x) && data < y;\n }\n\n return less(data, x) && data > y;\n }\n\n /**\n * Public function `greaterOrEqual`.\n *\n * Returns true if `lhs` is a number greater than or equal to `rhs`, false\n * otherwise.\n */\n function greaterOrEqual (lhs, rhs) {\n return number(lhs) && lhs >= rhs;\n }\n\n /**\n * Public function `lessOrEqual`.\n *\n * Returns true if `lhs` is a number less than or equal to `rhs`, false\n * otherwise.\n */\n function lessOrEqual (lhs, rhs) {\n return number(lhs) && lhs <= rhs;\n }\n\n /**\n * Public function `inRange`.\n *\n * Returns true if `data` is a number in the range `x..y`, false otherwise.\n */\n function inRange (data, x, y) {\n if (x < y) {\n return greaterOrEqual(data, x) && data <= y;\n }\n\n return lessOrEqual(data, x) && data >= y;\n }\n\n /**\n * Public function `positive`.\n *\n * Returns true if `data` is a positive number, false otherwise.\n */\n function positive (data) {\n return greater(data, 0);\n }\n\n /**\n * Public function `negative`.\n *\n * Returns true if `data` is a negative number, false otherwise.\n */\n function negative (data) {\n return less(data, 0);\n }\n\n /**\n * Public function `string`.\n *\n * Returns true if `data` is a string, false otherwise.\n */\n function string (data) {\n return typeof data === 'string';\n }\n\n /**\n * Public function `emptyString`.\n *\n * Returns true if `data` is the empty string, false otherwise.\n */\n function emptyString (data) {\n return data === '';\n }\n\n /**\n * Public function `nonEmptyString`.\n *\n * Returns true if `data` is a non-empty string, false otherwise.\n */\n function nonEmptyString (data) {\n return string(data) && data !== '';\n }\n\n /**\n * Public function `contains`.\n *\n * Returns true if `data` is a string that contains `substring`, false\n * otherwise.\n */\n function contains (data, substring) {\n return string(data) && data.indexOf(substring) !== -1;\n }\n\n /**\n * Public function `match`.\n *\n * Returns true if `data` is a string that matches `regex`, false otherwise.\n */\n function match (data, regex) {\n return string(data) && !! data.match(regex);\n }\n\n /**\n * Public function `boolean`.\n *\n * Returns true if `data` is a boolean value, false otherwise.\n */\n function boolean (data) {\n return data === false || data === true;\n }\n\n /**\n * Public function `object`.\n *\n * Returns true if `data` is a plain-old JS object, false otherwise.\n */\n function object (data) {\n return Object.prototype.toString.call(data) === '[object Object]';\n }\n\n /**\n * Public function `emptyObject`.\n *\n * Returns true if `data` is an empty object, false otherwise.\n */\n function emptyObject (data) {\n return object(data) && Object.keys(data).length === 0;\n }\n\n /**\n * Public function `nonEmptyObject`.\n *\n * Returns true if `data` is a non-empty object, false otherwise.\n */\n function nonEmptyObject (data) {\n return object(data) && Object.keys(data).length > 0;\n }\n\n /**\n * Public function `instanceStrict`.\n *\n * Returns true if `data` is an instance of `prototype`, false otherwise.\n */\n function instanceStrict (data, prototype) {\n try {\n return data instanceof prototype;\n } catch (error) {\n return false;\n }\n }\n\n /**\n * Public function `instance`.\n *\n * Returns true if `data` is an instance of `prototype`, false otherwise.\n * Falls back to testing constructor.name and Object.prototype.toString\n * if the initial instanceof test fails.\n */\n function instance (data, prototype) {\n try {\n return instanceStrict(data, prototype) ||\n data.constructor.name === prototype.name ||\n Object.prototype.toString.call(data) === '[object ' + prototype.name + ']';\n } catch (error) {\n return false;\n }\n }\n\n /**\n * Public function `like`.\n *\n * Tests whether `data` 'quacks like a duck'. Returns true if `data` has all\n * of the properties of `archetype` (the 'duck'), false otherwise.\n */\n function like (data, archetype) {\n var name;\n\n for (name in archetype) {\n if (archetype.hasOwnProperty(name)) {\n if (data.hasOwnProperty(name) === false || typeof data[name] !== typeof archetype[name]) {\n return false;\n }\n\n if (object(data[name]) && like(data[name], archetype[name]) === false) {\n return false;\n }\n }\n }\n\n return true;\n }\n\n /**\n * Public function `array`.\n *\n * Returns true if `data` is an array, false otherwise.\n */\n function array (data) {\n return isArray(data);\n }\n\n /**\n * Public function `emptyArray`.\n *\n * Returns true if `data` is an empty array, false otherwise.\n */\n function emptyArray (data) {\n return array(data) && data.length === 0;\n }\n\n /**\n * Public function `nonEmptyArray`.\n *\n * Returns true if `data` is a non-empty array, false otherwise.\n */\n function nonEmptyArray (data) {\n return array(data) && greater(data.length, 0);\n }\n\n /**\n * Public function `arrayLike`.\n *\n * Returns true if `data` is an array-like object, false otherwise.\n */\n function arrayLike (data) {\n return assigned(data) && greaterOrEqual(data.length, 0);\n }\n\n /**\n * Public function `iterable`.\n *\n * Returns true if `data` is an iterable, false otherwise.\n */\n function iterable (data) {\n if (! haveSymbols) {\n // Fall back to `arrayLike` predicate in pre-ES6 environments.\n return arrayLike(data);\n }\n\n return assigned(data) && isFunction(data[Symbol.iterator]);\n }\n\n /**\n * Public function `includes`.\n *\n * Returns true if `data` contains `value`, false otherwise.\n */\n function includes (data, value) {\n var iterator, iteration, keys, length, i;\n\n if (! assigned(data)) {\n return false;\n }\n\n if (haveSymbols && data[Symbol.iterator] && isFunction(data.values)) {\n iterator = data.values();\n\n do {\n iteration = iterator.next();\n\n if (iteration.value === value) {\n return true;\n }\n } while (! iteration.done);\n\n return false;\n }\n\n keys = Object.keys(data);\n length = keys.length;\n for (i = 0; i < length; ++i) {\n if (data[keys[i]] === value) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Public function `hasLength`.\n *\n * Returns true if `data` has a length property that equals `length`, false\n * otherwise.\n */\n function hasLength (data, length) {\n return assigned(data) && data.length === length;\n }\n\n /**\n * Public function `date`.\n *\n * Returns true if `data` is a valid date, false otherwise.\n */\n function date (data) {\n return instanceStrict(data, Date) && integer(data.getTime());\n }\n\n /**\n * Public function `function`.\n *\n * Returns true if `data` is a function, false otherwise.\n */\n function isFunction (data) {\n return typeof data === 'function';\n }\n\n /**\n * Public function `apply`.\n *\n * Maps each value from the `data` to the corresponding predicate and returns\n * the result array. If the same function is to be applied across all of the\n * data, a single predicate function may be passed in.\n *\n */\n function apply (data, predicates) {\n assert.array(data);\n\n if (isFunction(predicates)) {\n return data.map(function (value) {\n return predicates(value);\n });\n }\n\n assert.array(predicates);\n assert.hasLength(data, predicates.length);\n\n return data.map(function (value, index) {\n return predicates[index](value);\n });\n }\n\n /**\n * Public function `map`.\n *\n * Maps each value from the `data` to the corresponding predicate and returns\n * the result object. Supports nested objects. If the `data` is not nested and\n * the same function is to be applied across all of it, a single predicate\n * function may be passed in.\n *\n */\n function map (data, predicates) {\n assert.object(data);\n\n if (isFunction(predicates)) {\n return mapSimple(data, predicates);\n }\n\n assert.object(predicates);\n\n return mapComplex(data, predicates);\n }\n\n function mapSimple (data, predicate) {\n var result = {};\n\n Object.keys(data).forEach(function (key) {\n result[key] = predicate(data[key]);\n });\n\n return result;\n }\n\n function mapComplex (data, predicates) {\n var result = {};\n\n Object.keys(predicates).forEach(function (key) {\n var predicate = predicates[key];\n\n if (isFunction(predicate)) {\n if (not.assigned(data)) {\n result[key] = !!predicate.m;\n } else {\n result[key] = predicate(data[key]);\n }\n } else if (object(predicate)) {\n result[key] = mapComplex(data[key], predicate);\n }\n });\n\n return result;\n }\n\n /**\n * Public function `all`\n *\n * Check that all boolean values are true\n * in an array (returned from `apply`)\n * or object (returned from `map`).\n *\n */\n function all (data) {\n if (array(data)) {\n return testArray(data, false);\n }\n\n assert.object(data);\n\n return testObject(data, false);\n }\n\n function testArray (data, result) {\n var i;\n\n for (i = 0; i < data.length; i += 1) {\n if (data[i] === result) {\n return result;\n }\n }\n\n return !result;\n }\n\n function testObject (data, result) {\n var key, value;\n\n for (key in data) {\n if (data.hasOwnProperty(key)) {\n value = data[key];\n\n if (object(value) && testObject(value, result) === result) {\n return result;\n }\n\n if (value === result) {\n return result;\n }\n }\n }\n\n return !result;\n }\n\n /**\n * Public function `any`\n *\n * Check that at least one boolean value is true\n * in an array (returned from `apply`)\n * or object (returned from `map`).\n *\n */\n function any (data) {\n if (array(data)) {\n return testArray(data, true);\n }\n\n assert.object(data);\n\n return testObject(data, true);\n }\n\n function mixin (target, source) {\n Object.keys(source).forEach(function (key) {\n target[key] = source[key];\n });\n\n return target;\n }\n\n /**\n * Public modifier `assert`.\n *\n * Throws if `predicate` returns false.\n */\n function assertModifier (predicate, defaultMessage) {\n return function () {\n return assertPredicate(predicate, arguments, defaultMessage);\n };\n }\n\n function assertPredicate (predicate, args, defaultMessage) {\n var argCount = predicate.l || predicate.length;\n var message = args[argCount];\n var ErrorType = args[argCount + 1];\n assertImpl(\n predicate.apply(null, args),\n nonEmptyString(message) ? message : defaultMessage,\n isFunction(ErrorType) ? ErrorType : TypeError\n );\n return args[0];\n }\n\n function assertImpl (value, message, ErrorType) {\n if (value) {\n return value;\n }\n throw new (ErrorType || Error)(message || 'Assertion failed');\n }\n\n /**\n * Public modifier `not`.\n *\n * Negates `predicate`.\n */\n function notModifier (predicate) {\n var modifiedPredicate = function () {\n return notImpl(predicate.apply(null, arguments));\n };\n modifiedPredicate.l = predicate.length;\n return modifiedPredicate;\n }\n\n function notImpl (value) {\n return !value;\n }\n\n /**\n * Public modifier `maybe`.\n *\n * Returns true if predicate argument is null or undefined,\n * otherwise propagates the return value from `predicate`.\n */\n function maybeModifier (predicate) {\n var modifiedPredicate = function () {\n if (not.assigned(arguments[0])) {\n return true;\n }\n\n return predicate.apply(null, arguments);\n };\n modifiedPredicate.l = predicate.length;\n\n // Hackishly indicate that this is a maybe.xxx predicate.\n // Without this flag, the alternative would be to iterate\n // through the maybe predicates or use indexOf to check,\n // which would be time-consuming.\n modifiedPredicate.m = true;\n\n return modifiedPredicate;\n }\n\n function maybeImpl (value) {\n if (assigned(value) === false) {\n return true;\n }\n\n return value;\n }\n\n /**\n * Public modifier `of`.\n *\n * Applies the chained predicate to members of the collection.\n */\n function ofModifier (target, type, predicate) {\n var modifiedPredicate = function () {\n var collection, args;\n\n collection = arguments[0];\n\n if (target === 'maybe' && not.assigned(collection)) {\n return true;\n }\n\n if (!type(collection)) {\n return false;\n }\n\n collection = coerceCollection(type, collection);\n args = slice.call(arguments, 1);\n\n try {\n collection.forEach(function (item) {\n if (\n (target !== 'maybe' || assigned(item)) &&\n !predicate.apply(null, [ item ].concat(args))\n ) {\n // TODO: Replace with for...of when ES6 is required.\n throw 0;\n }\n });\n } catch (ignore) {\n return false;\n }\n\n return true;\n };\n modifiedPredicate.l = predicate.length;\n return modifiedPredicate;\n }\n\n function coerceCollection (type, collection) {\n switch (type) {\n case arrayLike:\n return slice.call(collection);\n case object:\n return Object.keys(collection).map(function (key) {\n return collection[key];\n });\n default:\n return collection;\n }\n }\n\n function createModifiedPredicates (modifier, object) {\n return createModifiedFunctions([ modifier, predicates, object ]);\n }\n\n function createModifiedFunctions (args) {\n var modifier, object, functions, result;\n\n modifier = args.shift();\n object = args.pop();\n functions = args.pop();\n\n result = object || {};\n\n Object.keys(functions).forEach(function (key) {\n Object.defineProperty(result, key, {\n configurable: false,\n enumerable: true,\n writable: false,\n value: modifier.apply(null, args.concat(functions[key], messages[key]))\n });\n });\n\n return result;\n }\n\n function createModifiedModifier (modifier, modified) {\n return createModifiedFunctions([ modifier, modified, null ]);\n }\n\n function createOfPredicates (key) {\n predicates[key].of = createModifiedFunctions(\n [ ofModifier.bind(null, null), predicates[key], predicates, null ]\n );\n }\n\n function createOfModifiers (base, modifier) {\n collections.forEach(function (key) {\n base[key].of = createModifiedModifier(modifier, predicates[key].of);\n });\n }\n\n function createMaybeOfModifiers (key) {\n maybe[key].of = createModifiedFunctions(\n [ ofModifier.bind(null, 'maybe'), predicates[key], predicates, null ]\n );\n assert.maybe[key].of = createModifiedModifier(assertModifier, maybe[key].of);\n assert.not[key].of = createModifiedModifier(assertModifier, not[key].of);\n }\n\n function exportFunctions (functions) {\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return functions;\n });\n } else if (typeof module !== 'undefined' && module !== null && module.exports) {\n module.exports = functions;\n } else {\n globals.check = functions;\n }\n }\n}(this));\n","\n/**\n * Expose `isUrl`.\n */\n\nmodule.exports = isUrl;\n\n/**\n * Matcher.\n */\n\nvar matcher = /^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$/;\n\n/**\n * Loosely validate a URL `string`.\n *\n * @param {String} string\n * @return {Boolean}\n */\n\nfunction isUrl(string){\n return matcher.test(string);\n}\n","// The result of dump.js is a big JSON tree\n// which can be easily serialized (for instance\n// to be sent from a webworker to the main app\n// or through Node's IPC), but we want\n// a (circular) DOM-like interface for walking\n// through the data.\n\nmodule.exports = (iPage) => {\n const page = {\n ...iPage,\n paragraphs: [],\n lines: [],\n words: [],\n symbols: [],\n };\n\n page.blocks.forEach((iBlock) => {\n const block = {\n ...iBlock,\n page,\n lines: [],\n words: [],\n symbols: [],\n };\n\n block.paragraphs.forEach((iPara) => {\n const para = {\n ...iPara,\n block,\n page,\n words: [],\n symbols: [],\n };\n\n para.lines.forEach((iLine) => {\n const line = {\n ...iLine,\n paragraph: para,\n block,\n page,\n symbols: [],\n };\n\n line.words.forEach((iWord) => {\n const word = {\n ...iWord,\n line,\n paragraph: para,\n block,\n page,\n };\n\n word.symbols.forEach((iSym) => {\n const sym = {\n ...iSym,\n word,\n line,\n paragraph: para,\n block,\n page,\n };\n\n sym.line.symbols.push(sym);\n sym.paragraph.symbols.push(sym);\n sym.block.symbols.push(sym);\n sym.page.symbols.push(sym);\n });\n word.paragraph.words.push(word);\n word.block.words.push(word);\n word.page.words.push(word);\n });\n line.block.lines.push(line);\n line.page.lines.push(line);\n });\n para.page.paragraphs.push(para);\n });\n });\n return page;\n};\n","const adapter = require('../node/');\n\nlet jobCounter = 0;\n\nmodule.exports = class TesseractJob {\n constructor(instance) {\n jobCounter += 1;\n this.id = `Job-${jobCounter}-${Math.random().toString(16).slice(3, 8)}`;\n\n this._instance = instance;\n this._resolve = [];\n this._reject = [];\n this._progress = [];\n this._finally = [];\n }\n\n then(resolve, reject) {\n if (this._resolve.push) {\n this._resolve.push(resolve);\n } else {\n resolve(this._resolve);\n }\n\n if (reject) this.catch(reject);\n return this;\n }\n\n catch(reject) {\n if (this._reject.push) {\n this._reject.push(reject);\n } else {\n reject(this._reject);\n }\n return this;\n }\n\n progress(fn) {\n this._progress.push(fn);\n return this;\n }\n\n finally(fn) {\n this._finally.push(fn);\n return this;\n }\n\n _send(action, payload) {\n adapter.sendPacket(this._instance, {\n jobId: this.id,\n action,\n payload,\n });\n }\n\n _handle(packet) {\n const { data } = packet;\n let runFinallyCbs = false;\n\n if (packet.status === 'resolve') {\n if (this._resolve.length === 0) console.log(data);\n this._resolve.forEach((fn) => {\n const ret = fn(data);\n if (ret && typeof ret.then === 'function') {\n console.warn('TesseractJob instances do not chain like ES6 Promises. To convert it into a real promise, use Promise.resolve.');\n }\n });\n this._resolve = data;\n this._instance._dequeue();\n runFinallyCbs = true;\n } else if (packet.status === 'reject') {\n if (this._reject.length === 0) console.error(data);\n this._reject.forEach(fn => fn(data));\n this._reject = data;\n this._instance._dequeue();\n runFinallyCbs = true;\n } else if (packet.status === 'progress') {\n this._progress.forEach(fn => fn(data));\n } else {\n console.warn('Message type unknown', packet.status);\n }\n\n if (runFinallyCbs) {\n this._finally.forEach(fn => fn(data));\n }\n }\n};\n"],"sourceRoot":""}