From 7c77d040da7c5f9986a35277bbbb443a267fd1d1 Mon Sep 17 00:00:00 2001 From: Christian Anetzberger Date: Tue, 22 Mar 2022 18:26:28 +0100 Subject: [PATCH] fixed gitignore --- node_modules/.bin/JsBarcode.js | 1 - node_modules/.bin/barcodes | 1 - node_modules/.bin/exceptions | 1 - node_modules/.bin/help | 1 - node_modules/.bin/options | 1 - node_modules/.bin/renderers | 1 - node_modules/.yarn-integrity | 23 - node_modules/fs/README.md | 9 - node_modules/fs/package.json | 20 - node_modules/inherits/LICENSE | 16 - node_modules/inherits/README.md | 42 - node_modules/inherits/inherits.js | 7 - node_modules/inherits/inherits_browser.js | 23 - node_modules/inherits/package.json | 29 - node_modules/jsbarcode/.dockerignore | 1 - node_modules/jsbarcode/.eslintignore | 4 - node_modules/jsbarcode/.eslintrc | 24 - node_modules/jsbarcode/.travis.yml | 16 - node_modules/jsbarcode/CONTRIBUTING.md | 84 - node_modules/jsbarcode/Dockerfile | 13 - node_modules/jsbarcode/MIT-LICENSE.txt | 7 - node_modules/jsbarcode/README.md | 255 - .../automation/barcode-building.json | 37 - node_modules/jsbarcode/automation/building.js | 132 - node_modules/jsbarcode/automation/linting.js | 9 - node_modules/jsbarcode/automation/misc.js | 30 - .../jsbarcode/automation/releasing.js | 163 - .../jsbarcode/automation/settings.json | 6 - node_modules/jsbarcode/automation/shared.js | 5 - node_modules/jsbarcode/bin/JsBarcode.js | 252 - .../jsbarcode/bin/barcodes/Barcode.js | 17 - .../jsbarcode/bin/barcodes/CODE128/CODE128.js | 167 - .../bin/barcodes/CODE128/CODE128A.js | 42 - .../bin/barcodes/CODE128/CODE128B.js | 42 - .../bin/barcodes/CODE128/CODE128C.js | 42 - .../bin/barcodes/CODE128/CODE128_AUTO.js | 41 - .../jsbarcode/bin/barcodes/CODE128/auto.js | 73 - .../bin/barcodes/CODE128/constants.js | 54 - .../jsbarcode/bin/barcodes/CODE128/index.js | 29 - .../jsbarcode/bin/barcodes/CODE39/index.js | 105 - .../jsbarcode/bin/barcodes/EAN_UPC/EAN.js | 92 - .../jsbarcode/bin/barcodes/EAN_UPC/EAN13.js | 119 - .../jsbarcode/bin/barcodes/EAN_UPC/EAN2.js | 58 - .../jsbarcode/bin/barcodes/EAN_UPC/EAN5.js | 65 - .../jsbarcode/bin/barcodes/EAN_UPC/EAN8.js | 81 - .../jsbarcode/bin/barcodes/EAN_UPC/UPC.js | 165 - .../jsbarcode/bin/barcodes/EAN_UPC/UPCE.js | 185 - .../bin/barcodes/EAN_UPC/constants.js | 30 - .../jsbarcode/bin/barcodes/EAN_UPC/encoder.js | 27 - .../jsbarcode/bin/barcodes/EAN_UPC/index.js | 39 - .../bin/barcodes/GenericBarcode/index.js | 55 - .../jsbarcode/bin/barcodes/ITF/ITF.js | 69 - .../jsbarcode/bin/barcodes/ITF/ITF14.js | 55 - .../jsbarcode/bin/barcodes/ITF/constants.js | 9 - .../jsbarcode/bin/barcodes/ITF/index.js | 19 - .../jsbarcode/bin/barcodes/MSI/MSI.js | 74 - .../jsbarcode/bin/barcodes/MSI/MSI10.js | 33 - .../jsbarcode/bin/barcodes/MSI/MSI1010.js | 35 - .../jsbarcode/bin/barcodes/MSI/MSI11.js | 33 - .../jsbarcode/bin/barcodes/MSI/MSI1110.js | 35 - .../jsbarcode/bin/barcodes/MSI/checksums.js | 29 - .../jsbarcode/bin/barcodes/MSI/index.js | 34 - .../jsbarcode/bin/barcodes/codabar/index.js | 92 - node_modules/jsbarcode/bin/barcodes/index.js | 33 - .../jsbarcode/bin/barcodes/index.tmp.js | 33 - .../bin/barcodes/pharmacode/index.js | 73 - .../jsbarcode/bin/exceptions/ErrorHandler.js | 54 - .../jsbarcode/bin/exceptions/exceptions.js | 67 - node_modules/jsbarcode/bin/help/fixOptions.js | 17 - .../bin/help/getOptionsFromElement.js | 41 - .../jsbarcode/bin/help/getRenderProperties.js | 108 - .../jsbarcode/bin/help/linearizeEncodings.js | 27 - node_modules/jsbarcode/bin/help/merge.js | 11 - .../jsbarcode/bin/help/optionsFromStrings.js | 27 - .../jsbarcode/bin/options/defaults.js | 28 - .../jsbarcode/bin/renderers/canvas.js | 158 - node_modules/jsbarcode/bin/renderers/index.js | 21 - .../jsbarcode/bin/renderers/object.js | 30 - .../jsbarcode/bin/renderers/shared.js | 101 - node_modules/jsbarcode/bin/renderers/svg.js | 189 - node_modules/jsbarcode/bower.json | 35 - node_modules/jsbarcode/dist/JsBarcode.all.js | 3670 ------ .../jsbarcode/dist/JsBarcode.all.min.js | 2 - .../dist/barcodes/JsBarcode.codabar.min.js | 2 - .../dist/barcodes/JsBarcode.code128.min.js | 2 - .../dist/barcodes/JsBarcode.code39.min.js | 2 - .../dist/barcodes/JsBarcode.ean-upc.min.js | 2 - .../dist/barcodes/JsBarcode.itf.min.js | 2 - .../dist/barcodes/JsBarcode.msi.min.js | 2 - .../dist/barcodes/JsBarcode.pharmacode.min.js | 2 - node_modules/jsbarcode/docker-compose.yml | 10 - node_modules/jsbarcode/example/index.html | 68 - node_modules/jsbarcode/example/toBase64.html | 21 - node_modules/jsbarcode/gulpfile.js | 19 - node_modules/jsbarcode/jsbarcode.d.ts | 74 - node_modules/jsbarcode/package.json | 80 - node_modules/jsbarcode/src/JsBarcode.js | 225 - .../jsbarcode/src/barcodes/Barcode.js | 9 - .../jsbarcode/src/barcodes/CODE128/CODE128.js | 127 - .../src/barcodes/CODE128/CODE128A.js | 14 - .../src/barcodes/CODE128/CODE128B.js | 14 - .../src/barcodes/CODE128/CODE128C.js | 14 - .../src/barcodes/CODE128/CODE128_AUTO.js | 15 - .../jsbarcode/src/barcodes/CODE128/auto.js | 68 - .../src/barcodes/CODE128/constants.js | 71 - .../jsbarcode/src/barcodes/CODE128/index.js | 6 - .../jsbarcode/src/barcodes/CODE39/index.js | 105 - .../jsbarcode/src/barcodes/EAN_UPC/EAN.js | 72 - .../jsbarcode/src/barcodes/EAN_UPC/EAN13.js | 90 - .../jsbarcode/src/barcodes/EAN_UPC/EAN2.js | 30 - .../jsbarcode/src/barcodes/EAN_UPC/EAN5.js | 40 - .../jsbarcode/src/barcodes/EAN_UPC/EAN8.js | 57 - .../jsbarcode/src/barcodes/EAN_UPC/UPC.js | 132 - .../jsbarcode/src/barcodes/EAN_UPC/UPCE.js | 177 - .../src/barcodes/EAN_UPC/constants.js | 41 - .../jsbarcode/src/barcodes/EAN_UPC/encoder.js | 20 - .../jsbarcode/src/barcodes/EAN_UPC/index.js | 8 - .../src/barcodes/GenericBarcode/index.js | 22 - .../jsbarcode/src/barcodes/ITF/ITF.js | 37 - .../jsbarcode/src/barcodes/ITF/ITF14.js | 33 - .../jsbarcode/src/barcodes/ITF/constants.js | 7 - .../jsbarcode/src/barcodes/ITF/index.js | 4 - .../jsbarcode/src/barcodes/MSI/MSI.js | 48 - .../jsbarcode/src/barcodes/MSI/MSI10.js | 10 - .../jsbarcode/src/barcodes/MSI/MSI1010.js | 12 - .../jsbarcode/src/barcodes/MSI/MSI11.js | 10 - .../jsbarcode/src/barcodes/MSI/MSI1110.js | 12 - .../jsbarcode/src/barcodes/MSI/checksums.js | 23 - .../jsbarcode/src/barcodes/MSI/index.js | 7 - .../jsbarcode/src/barcodes/codabar/index.js | 63 - node_modules/jsbarcode/src/barcodes/index.js | 20 - .../src/barcodes/pharmacode/index.js | 43 - .../jsbarcode/src/exceptions/ErrorHandler.js | 39 - .../jsbarcode/src/exceptions/exceptions.js | 29 - node_modules/jsbarcode/src/help/fixOptions.js | 11 - .../src/help/getOptionsFromElement.js | 28 - .../jsbarcode/src/help/getRenderProperties.js | 102 - .../jsbarcode/src/help/linearizeEncodings.js | 22 - node_modules/jsbarcode/src/help/merge.js | 1 - .../jsbarcode/src/help/optionsFromStrings.js | 31 - .../jsbarcode/src/options/defaults.js | 23 - .../jsbarcode/src/renderers/canvas.js | 137 - node_modules/jsbarcode/src/renderers/index.js | 5 - .../jsbarcode/src/renderers/object.js | 14 - .../jsbarcode/src/renderers/shared.js | 94 - node_modules/jsbarcode/src/renderers/svg.js | 171 - .../jsbarcode/test/browser/canvasTest.html | 18 - .../jsbarcode/test/browser/canvasTest.js | 30 - .../test/browser/help/jquery-2.2.3.js | 9842 ----------------- .../jsbarcode/test/browser/initTest.html | 80 - .../jsbarcode/test/browser/jQueryTest.html | 20 - .../jsbarcode/test/browser/jQueryTest.js | 30 - .../jsbarcode/test/browser/svgTest.html | 18 - .../jsbarcode/test/browser/svgTest.js | 30 - node_modules/jsbarcode/test/browser/test.css | 20 - node_modules/jsbarcode/test/browser/tests.js | 45 - node_modules/jsbarcode/test/coverage.html | 359 - .../jsbarcode/test/node/CODE128.test.js | 109 - .../jsbarcode/test/node/CODE39.test.js | 37 - .../jsbarcode/test/node/EAN-UPC.test.js | 220 - .../jsbarcode/test/node/ITF-14.test.js | 68 - node_modules/jsbarcode/test/node/ITF.test.js | 34 - .../jsbarcode/test/node/JsBarcode.test.js | 132 - node_modules/jsbarcode/test/node/MSI.test.js | 77 - .../jsbarcode/test/node/Object-Render.test.js | 41 - .../jsbarcode/test/node/codabar.test.js | 73 - node_modules/jsbarcode/test/node/help/help.js | 72 - .../jsbarcode/test/node/nodesvg.test.js | 20 - .../jsbarcode/test/node/pharmacode.test.js | 37 - node_modules/path/.npmignore | 1 - node_modules/path/LICENSE | 18 - node_modules/path/README.md | 15 - node_modules/path/package.json | 24 - node_modules/path/path.js | 628 -- node_modules/process/.eslintrc | 21 - node_modules/process/LICENSE | 22 - node_modules/process/README.md | 26 - node_modules/process/browser.js | 184 - node_modules/process/index.js | 2 - node_modules/process/package.json | 27 - node_modules/process/test.js | 199 - node_modules/util/LICENSE | 18 - node_modules/util/README.md | 15 - node_modules/util/package.json | 35 - node_modules/util/support/isBuffer.js | 3 - node_modules/util/support/isBufferBrowser.js | 6 - node_modules/util/util.js | 586 - 187 files changed, 23904 deletions(-) delete mode 120000 node_modules/.bin/JsBarcode.js delete mode 120000 node_modules/.bin/barcodes delete mode 120000 node_modules/.bin/exceptions delete mode 120000 node_modules/.bin/help delete mode 120000 node_modules/.bin/options delete mode 120000 node_modules/.bin/renderers delete mode 100644 node_modules/.yarn-integrity delete mode 100644 node_modules/fs/README.md delete mode 100644 node_modules/fs/package.json delete mode 100644 node_modules/inherits/LICENSE delete mode 100644 node_modules/inherits/README.md delete mode 100644 node_modules/inherits/inherits.js delete mode 100644 node_modules/inherits/inherits_browser.js delete mode 100644 node_modules/inherits/package.json delete mode 100644 node_modules/jsbarcode/.dockerignore delete mode 100644 node_modules/jsbarcode/.eslintignore delete mode 100644 node_modules/jsbarcode/.eslintrc delete mode 100644 node_modules/jsbarcode/.travis.yml delete mode 100644 node_modules/jsbarcode/CONTRIBUTING.md delete mode 100644 node_modules/jsbarcode/Dockerfile delete mode 100644 node_modules/jsbarcode/MIT-LICENSE.txt delete mode 100644 node_modules/jsbarcode/README.md delete mode 100644 node_modules/jsbarcode/automation/barcode-building.json delete mode 100644 node_modules/jsbarcode/automation/building.js delete mode 100644 node_modules/jsbarcode/automation/linting.js delete mode 100644 node_modules/jsbarcode/automation/misc.js delete mode 100644 node_modules/jsbarcode/automation/releasing.js delete mode 100644 node_modules/jsbarcode/automation/settings.json delete mode 100644 node_modules/jsbarcode/automation/shared.js delete mode 100755 node_modules/jsbarcode/bin/JsBarcode.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/Barcode.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/CODE128/CODE128.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/CODE128/CODE128A.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/CODE128/CODE128B.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/CODE128/CODE128C.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/CODE128/CODE128_AUTO.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/CODE128/auto.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/CODE128/constants.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/CODE128/index.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/CODE39/index.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN13.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN2.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN5.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN8.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/EAN_UPC/UPC.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/EAN_UPC/UPCE.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/EAN_UPC/constants.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/EAN_UPC/encoder.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/EAN_UPC/index.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/GenericBarcode/index.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/ITF/ITF.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/ITF/ITF14.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/ITF/constants.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/ITF/index.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/MSI/MSI.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/MSI/MSI10.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/MSI/MSI1010.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/MSI/MSI11.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/MSI/MSI1110.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/MSI/checksums.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/MSI/index.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/codabar/index.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/index.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/index.tmp.js delete mode 100644 node_modules/jsbarcode/bin/barcodes/pharmacode/index.js delete mode 100644 node_modules/jsbarcode/bin/exceptions/ErrorHandler.js delete mode 100644 node_modules/jsbarcode/bin/exceptions/exceptions.js delete mode 100644 node_modules/jsbarcode/bin/help/fixOptions.js delete mode 100644 node_modules/jsbarcode/bin/help/getOptionsFromElement.js delete mode 100644 node_modules/jsbarcode/bin/help/getRenderProperties.js delete mode 100644 node_modules/jsbarcode/bin/help/linearizeEncodings.js delete mode 100644 node_modules/jsbarcode/bin/help/merge.js delete mode 100644 node_modules/jsbarcode/bin/help/optionsFromStrings.js delete mode 100644 node_modules/jsbarcode/bin/options/defaults.js delete mode 100644 node_modules/jsbarcode/bin/renderers/canvas.js delete mode 100644 node_modules/jsbarcode/bin/renderers/index.js delete mode 100644 node_modules/jsbarcode/bin/renderers/object.js delete mode 100644 node_modules/jsbarcode/bin/renderers/shared.js delete mode 100644 node_modules/jsbarcode/bin/renderers/svg.js delete mode 100644 node_modules/jsbarcode/bower.json delete mode 100644 node_modules/jsbarcode/dist/JsBarcode.all.js delete mode 100644 node_modules/jsbarcode/dist/JsBarcode.all.min.js delete mode 100644 node_modules/jsbarcode/dist/barcodes/JsBarcode.codabar.min.js delete mode 100644 node_modules/jsbarcode/dist/barcodes/JsBarcode.code128.min.js delete mode 100644 node_modules/jsbarcode/dist/barcodes/JsBarcode.code39.min.js delete mode 100644 node_modules/jsbarcode/dist/barcodes/JsBarcode.ean-upc.min.js delete mode 100644 node_modules/jsbarcode/dist/barcodes/JsBarcode.itf.min.js delete mode 100644 node_modules/jsbarcode/dist/barcodes/JsBarcode.msi.min.js delete mode 100644 node_modules/jsbarcode/dist/barcodes/JsBarcode.pharmacode.min.js delete mode 100644 node_modules/jsbarcode/docker-compose.yml delete mode 100644 node_modules/jsbarcode/example/index.html delete mode 100644 node_modules/jsbarcode/example/toBase64.html delete mode 100644 node_modules/jsbarcode/gulpfile.js delete mode 100644 node_modules/jsbarcode/jsbarcode.d.ts delete mode 100644 node_modules/jsbarcode/package.json delete mode 100644 node_modules/jsbarcode/src/JsBarcode.js delete mode 100644 node_modules/jsbarcode/src/barcodes/Barcode.js delete mode 100644 node_modules/jsbarcode/src/barcodes/CODE128/CODE128.js delete mode 100644 node_modules/jsbarcode/src/barcodes/CODE128/CODE128A.js delete mode 100644 node_modules/jsbarcode/src/barcodes/CODE128/CODE128B.js delete mode 100644 node_modules/jsbarcode/src/barcodes/CODE128/CODE128C.js delete mode 100644 node_modules/jsbarcode/src/barcodes/CODE128/CODE128_AUTO.js delete mode 100644 node_modules/jsbarcode/src/barcodes/CODE128/auto.js delete mode 100644 node_modules/jsbarcode/src/barcodes/CODE128/constants.js delete mode 100644 node_modules/jsbarcode/src/barcodes/CODE128/index.js delete mode 100644 node_modules/jsbarcode/src/barcodes/CODE39/index.js delete mode 100644 node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN.js delete mode 100644 node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN13.js delete mode 100644 node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN2.js delete mode 100644 node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN5.js delete mode 100644 node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN8.js delete mode 100644 node_modules/jsbarcode/src/barcodes/EAN_UPC/UPC.js delete mode 100644 node_modules/jsbarcode/src/barcodes/EAN_UPC/UPCE.js delete mode 100644 node_modules/jsbarcode/src/barcodes/EAN_UPC/constants.js delete mode 100644 node_modules/jsbarcode/src/barcodes/EAN_UPC/encoder.js delete mode 100644 node_modules/jsbarcode/src/barcodes/EAN_UPC/index.js delete mode 100644 node_modules/jsbarcode/src/barcodes/GenericBarcode/index.js delete mode 100644 node_modules/jsbarcode/src/barcodes/ITF/ITF.js delete mode 100644 node_modules/jsbarcode/src/barcodes/ITF/ITF14.js delete mode 100644 node_modules/jsbarcode/src/barcodes/ITF/constants.js delete mode 100644 node_modules/jsbarcode/src/barcodes/ITF/index.js delete mode 100644 node_modules/jsbarcode/src/barcodes/MSI/MSI.js delete mode 100644 node_modules/jsbarcode/src/barcodes/MSI/MSI10.js delete mode 100644 node_modules/jsbarcode/src/barcodes/MSI/MSI1010.js delete mode 100644 node_modules/jsbarcode/src/barcodes/MSI/MSI11.js delete mode 100644 node_modules/jsbarcode/src/barcodes/MSI/MSI1110.js delete mode 100644 node_modules/jsbarcode/src/barcodes/MSI/checksums.js delete mode 100644 node_modules/jsbarcode/src/barcodes/MSI/index.js delete mode 100644 node_modules/jsbarcode/src/barcodes/codabar/index.js delete mode 100644 node_modules/jsbarcode/src/barcodes/index.js delete mode 100644 node_modules/jsbarcode/src/barcodes/pharmacode/index.js delete mode 100644 node_modules/jsbarcode/src/exceptions/ErrorHandler.js delete mode 100644 node_modules/jsbarcode/src/exceptions/exceptions.js delete mode 100644 node_modules/jsbarcode/src/help/fixOptions.js delete mode 100644 node_modules/jsbarcode/src/help/getOptionsFromElement.js delete mode 100644 node_modules/jsbarcode/src/help/getRenderProperties.js delete mode 100644 node_modules/jsbarcode/src/help/linearizeEncodings.js delete mode 100644 node_modules/jsbarcode/src/help/merge.js delete mode 100644 node_modules/jsbarcode/src/help/optionsFromStrings.js delete mode 100644 node_modules/jsbarcode/src/options/defaults.js delete mode 100644 node_modules/jsbarcode/src/renderers/canvas.js delete mode 100644 node_modules/jsbarcode/src/renderers/index.js delete mode 100644 node_modules/jsbarcode/src/renderers/object.js delete mode 100644 node_modules/jsbarcode/src/renderers/shared.js delete mode 100644 node_modules/jsbarcode/src/renderers/svg.js delete mode 100644 node_modules/jsbarcode/test/browser/canvasTest.html delete mode 100644 node_modules/jsbarcode/test/browser/canvasTest.js delete mode 100644 node_modules/jsbarcode/test/browser/help/jquery-2.2.3.js delete mode 100644 node_modules/jsbarcode/test/browser/initTest.html delete mode 100644 node_modules/jsbarcode/test/browser/jQueryTest.html delete mode 100644 node_modules/jsbarcode/test/browser/jQueryTest.js delete mode 100644 node_modules/jsbarcode/test/browser/svgTest.html delete mode 100644 node_modules/jsbarcode/test/browser/svgTest.js delete mode 100644 node_modules/jsbarcode/test/browser/test.css delete mode 100644 node_modules/jsbarcode/test/browser/tests.js delete mode 100644 node_modules/jsbarcode/test/coverage.html delete mode 100644 node_modules/jsbarcode/test/node/CODE128.test.js delete mode 100644 node_modules/jsbarcode/test/node/CODE39.test.js delete mode 100644 node_modules/jsbarcode/test/node/EAN-UPC.test.js delete mode 100644 node_modules/jsbarcode/test/node/ITF-14.test.js delete mode 100644 node_modules/jsbarcode/test/node/ITF.test.js delete mode 100644 node_modules/jsbarcode/test/node/JsBarcode.test.js delete mode 100644 node_modules/jsbarcode/test/node/MSI.test.js delete mode 100644 node_modules/jsbarcode/test/node/Object-Render.test.js delete mode 100644 node_modules/jsbarcode/test/node/codabar.test.js delete mode 100644 node_modules/jsbarcode/test/node/help/help.js delete mode 100644 node_modules/jsbarcode/test/node/nodesvg.test.js delete mode 100644 node_modules/jsbarcode/test/node/pharmacode.test.js delete mode 100644 node_modules/path/.npmignore delete mode 100644 node_modules/path/LICENSE delete mode 100644 node_modules/path/README.md delete mode 100644 node_modules/path/package.json delete mode 100644 node_modules/path/path.js delete mode 100644 node_modules/process/.eslintrc delete mode 100644 node_modules/process/LICENSE delete mode 100644 node_modules/process/README.md delete mode 100644 node_modules/process/browser.js delete mode 100644 node_modules/process/index.js delete mode 100644 node_modules/process/package.json delete mode 100644 node_modules/process/test.js delete mode 100644 node_modules/util/LICENSE delete mode 100644 node_modules/util/README.md delete mode 100644 node_modules/util/package.json delete mode 100644 node_modules/util/support/isBuffer.js delete mode 100644 node_modules/util/support/isBufferBrowser.js delete mode 100644 node_modules/util/util.js diff --git a/node_modules/.bin/JsBarcode.js b/node_modules/.bin/JsBarcode.js deleted file mode 120000 index 38e2e94..0000000 --- a/node_modules/.bin/JsBarcode.js +++ /dev/null @@ -1 +0,0 @@ -../jsbarcode/bin/JsBarcode.js \ No newline at end of file diff --git a/node_modules/.bin/barcodes b/node_modules/.bin/barcodes deleted file mode 120000 index 8f0ca42..0000000 --- a/node_modules/.bin/barcodes +++ /dev/null @@ -1 +0,0 @@ -../jsbarcode/bin/barcodes \ No newline at end of file diff --git a/node_modules/.bin/exceptions b/node_modules/.bin/exceptions deleted file mode 120000 index caf74a2..0000000 --- a/node_modules/.bin/exceptions +++ /dev/null @@ -1 +0,0 @@ -../jsbarcode/bin/exceptions \ No newline at end of file diff --git a/node_modules/.bin/help b/node_modules/.bin/help deleted file mode 120000 index 9a662ac..0000000 --- a/node_modules/.bin/help +++ /dev/null @@ -1 +0,0 @@ -../jsbarcode/bin/help \ No newline at end of file diff --git a/node_modules/.bin/options b/node_modules/.bin/options deleted file mode 120000 index 7535643..0000000 --- a/node_modules/.bin/options +++ /dev/null @@ -1 +0,0 @@ -../jsbarcode/bin/options \ No newline at end of file diff --git a/node_modules/.bin/renderers b/node_modules/.bin/renderers deleted file mode 120000 index ac7840c..0000000 --- a/node_modules/.bin/renderers +++ /dev/null @@ -1 +0,0 @@ -../jsbarcode/bin/renderers \ No newline at end of file diff --git a/node_modules/.yarn-integrity b/node_modules/.yarn-integrity deleted file mode 100644 index 77cfa51..0000000 --- a/node_modules/.yarn-integrity +++ /dev/null @@ -1,23 +0,0 @@ -{ - "systemParams": "darwin-x64-83", - "modulesFolders": [ - "node_modules" - ], - "flags": [], - "linkedModules": [], - "topLevelPatterns": [ - "fs@^0.0.1-security", - "jsbarcode@^3.11.5", - "path@^0.12.7" - ], - "lockfileEntries": { - "fs@^0.0.1-security": "https://registry.yarnpkg.com/fs/-/fs-0.0.1-security.tgz#8a7bd37186b6dddf3813f23858b57ecaaf5e41d4", - "inherits@2.0.3": "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de", - "jsbarcode@^3.11.5": "https://registry.yarnpkg.com/jsbarcode/-/jsbarcode-3.11.5.tgz#390b3efd0271f35b9d68c7b8af6e972445969014", - "path@^0.12.7": "https://registry.yarnpkg.com/path/-/path-0.12.7.tgz#d4dc2a506c4ce2197eb481ebfcd5b36c0140b10f", - "process@^0.11.1": "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182", - "util@^0.10.3": "https://registry.yarnpkg.com/util/-/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901" - }, - "files": [], - "artifacts": {} -} \ No newline at end of file diff --git a/node_modules/fs/README.md b/node_modules/fs/README.md deleted file mode 100644 index 5e9a74c..0000000 --- a/node_modules/fs/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Security holding package - -This package name is not currently in use, but was formerly occupied -by another package. To avoid malicious use, npm is hanging on to the -package name, but loosely, and we'll probably give it to you if you -want it. - -You may adopt this package by contacting support@npmjs.com and -requesting the name. diff --git a/node_modules/fs/package.json b/node_modules/fs/package.json deleted file mode 100644 index 11661b0..0000000 --- a/node_modules/fs/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "fs", - "version": "0.0.1-security", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/npm/security-holder.git" - }, - "keywords": [], - "author": "", - "license": "ISC", - "bugs": { - "url": "https://github.com/npm/security-holder/issues" - }, - "homepage": "https://github.com/npm/security-holder#readme" -} diff --git a/node_modules/inherits/LICENSE b/node_modules/inherits/LICENSE deleted file mode 100644 index dea3013..0000000 --- a/node_modules/inherits/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - diff --git a/node_modules/inherits/README.md b/node_modules/inherits/README.md deleted file mode 100644 index b1c5665..0000000 --- a/node_modules/inherits/README.md +++ /dev/null @@ -1,42 +0,0 @@ -Browser-friendly inheritance fully compatible with standard node.js -[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). - -This package exports standard `inherits` from node.js `util` module in -node environment, but also provides alternative browser-friendly -implementation through [browser -field](https://gist.github.com/shtylman/4339901). Alternative -implementation is a literal copy of standard one located in standalone -module to avoid requiring of `util`. It also has a shim for old -browsers with no `Object.create` support. - -While keeping you sure you are using standard `inherits` -implementation in node.js environment, it allows bundlers such as -[browserify](https://github.com/substack/node-browserify) to not -include full `util` package to your client code if all you need is -just `inherits` function. It worth, because browser shim for `util` -package is large and `inherits` is often the single function you need -from it. - -It's recommended to use this package instead of -`require('util').inherits` for any code that has chances to be used -not only in node.js but in browser too. - -## usage - -```js -var inherits = require('inherits'); -// then use exactly as the standard one -``` - -## note on version ~1.0 - -Version ~1.0 had completely different motivation and is not compatible -neither with 2.0 nor with standard node.js `inherits`. - -If you are using version ~1.0 and planning to switch to ~2.0, be -careful: - -* new version uses `super_` instead of `super` for referencing - superclass -* new version overwrites current prototype while old one preserves any - existing fields on it diff --git a/node_modules/inherits/inherits.js b/node_modules/inherits/inherits.js deleted file mode 100644 index 3b94763..0000000 --- a/node_modules/inherits/inherits.js +++ /dev/null @@ -1,7 +0,0 @@ -try { - var util = require('util'); - if (typeof util.inherits !== 'function') throw ''; - module.exports = util.inherits; -} catch (e) { - module.exports = require('./inherits_browser.js'); -} diff --git a/node_modules/inherits/inherits_browser.js b/node_modules/inherits/inherits_browser.js deleted file mode 100644 index c1e78a7..0000000 --- a/node_modules/inherits/inherits_browser.js +++ /dev/null @@ -1,23 +0,0 @@ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} diff --git a/node_modules/inherits/package.json b/node_modules/inherits/package.json deleted file mode 100644 index 7cf62b9..0000000 --- a/node_modules/inherits/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "inherits", - "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", - "version": "2.0.3", - "keywords": [ - "inheritance", - "class", - "klass", - "oop", - "object-oriented", - "inherits", - "browser", - "browserify" - ], - "main": "./inherits.js", - "browser": "./inherits_browser.js", - "repository": "git://github.com/isaacs/inherits", - "license": "ISC", - "scripts": { - "test": "node test" - }, - "devDependencies": { - "tap": "^7.1.0" - }, - "files": [ - "inherits.js", - "inherits_browser.js" - ] -} diff --git a/node_modules/jsbarcode/.dockerignore b/node_modules/jsbarcode/.dockerignore deleted file mode 100644 index cf70988..0000000 --- a/node_modules/jsbarcode/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -**/node_modules diff --git a/node_modules/jsbarcode/.eslintignore b/node_modules/jsbarcode/.eslintignore deleted file mode 100644 index 3f7af04..0000000 --- a/node_modules/jsbarcode/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -test -bin -dist -example diff --git a/node_modules/jsbarcode/.eslintrc b/node_modules/jsbarcode/.eslintrc deleted file mode 100644 index f024580..0000000 --- a/node_modules/jsbarcode/.eslintrc +++ /dev/null @@ -1,24 +0,0 @@ -{ - "env": { - "browser": true, - "node": true - }, - "parserOptions": { - "ecmaVersion": 7, - "sourceType": "module", - "ecmaFeatures": { - "experimentalObjectRestSpread": true - } - }, - "extends": "eslint:recommended", - "predef": "jQuery", - "rules": { - "curly": "error", - "semi": [1, "always"], - "no-console": 2, - "no-control-regex": 0, - "indent": [1, "tab", {"SwitchCase": 1}], - "space-infix-ops": ["error"], - "comma-spacing": ["error"] - } -} diff --git a/node_modules/jsbarcode/.travis.yml b/node_modules/jsbarcode/.travis.yml deleted file mode 100644 index 7ba862c..0000000 --- a/node_modules/jsbarcode/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: node_js -sudo: required -before_install: - - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - - sudo apt-get update - - npm install -g gulp -install: - - sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++-4.8 - - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50 - - npm install -after_success: npm run coveralls -node_js: - - "node" - - "14" - - "12" - - "10" diff --git a/node_modules/jsbarcode/CONTRIBUTING.md b/node_modules/jsbarcode/CONTRIBUTING.md deleted file mode 100644 index e6a2857..0000000 --- a/node_modules/jsbarcode/CONTRIBUTING.md +++ /dev/null @@ -1,84 +0,0 @@ -Getting Started ----- -We would :heart: to have pull requests for you. So here is how you start development with JsBarcode. - -First fork and clone the repo: -````bash -git clone git@github.com:your-username/JsBarcode.git -```` - -Then run ``npm install`` to set everything up. Make sure you have all dependencies of [node-canvas](https://github.com/Automattic/node-canvas) installed before doing this, or check **Using Docker** section. - -You are now ready to start doing your changes. - -JsBarcode is using [gulp](http://gulpjs.com/) in the building step. Here comes some commands that will come handy when developing. - -````bash -gulp compile # Compile the code (for nodejs) -gulp compile-web # Compiles down to JsBarcode.all.js -gulp compress # Compiles and compresses all individual barcode files - -gulp watch # Listens to file changes and re-compiles automatically -gulp watch-web # Listens to file changes and re-compiles to JsBarcode.all.js automatically - -gulp lint # Checking the code according to the code style specified in .eslintrc -```` - -Testing ----- -JsBarcode has tests on all barcode symbologies (and more). If you want to test your changes just run ``npm test`` and the code will be compiled and tested. - -There are also visual tests located under ``test/browser/``. - -Using Docker ----- -If you have installed [Docker](https://www.docker.com), you can avoid local installation of dependencies for [node-canvas](https://github.com/Automattic/node-canvas). For doing that, run ``npm install --ignore-scripts`` instead of ``npm install``. Then you can run tests by ``docker-compose up`` - -Symbologies and The Core ----- -JsBarcode is divided up in two distinct parts. The barcode symbologies (EAN-13, CODE128, ITF, ...) and the core. - -### Symbologies -Implementing a new symbology is the easiest way to contribute. Just follow the standard for that symbology and create a class that generate the correct binary data. - -The structure of such a class is as follows: - -````javascript -import Barcode from "../Barcode.js"; - -class GenericBarcode extends Barcode{ - constructor(data, options){ - super(data, options); // Sets this.data and this.text - } - - // Return the corresponding binary numbers for the data provided - encode(){ - return { - data: "10101010101010101010101010101010101010101", - text: this.text - }; - } - - // Resturn true/false if the string provided is valid for this encoder - valid(){ - return true; - } -} -```` - -It might be a good idea to check one of the already implemented barcodes (such as [ITF14](https://github.com/lindell/JsBarcode/blob/master/src/barcodes/ITF14/index.js)) for inspiration. - -### The Core / Renderers -The core part handles the API requests and calls the renderers. If you want to do any structural changes please [create an issue](https://github.com/lindell/JsBarcode/issues/new) or ask about it in the [gitter chat](https://gitter.im/lindell/JsBarcode) first. - -Bug fixes is of course welcome at any time :+1: - -Pull Requests ----- -So you are ready to make a PR? Great! :smile: - -But first make sure you have checked some things. - -* Your code should follow the code style guide provided by [.eslintrc](https://github.com/lindell/JsBarcode/blob/master/.eslintrc) by running ``gulp lint`` -* If you implemented a new symbology, make sure you have tests for it -* Don't commit build changes. No `dist/` or `bin/` changes in the PR. diff --git a/node_modules/jsbarcode/Dockerfile b/node_modules/jsbarcode/Dockerfile deleted file mode 100644 index a5e9969..0000000 --- a/node_modules/jsbarcode/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:8 - -RUN apt-get update && apt-get install -qq libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++ - -RUN mkdir -p /jsbarcode -WORKDIR /jsbarcode -COPY ./ ./ - -RUN npm install - -CMD npm test - -EXPOSE 3000 diff --git a/node_modules/jsbarcode/MIT-LICENSE.txt b/node_modules/jsbarcode/MIT-LICENSE.txt deleted file mode 100644 index c376a52..0000000 --- a/node_modules/jsbarcode/MIT-LICENSE.txt +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2016 Johan Lindell (johan@lindell.me) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/jsbarcode/README.md b/node_modules/jsbarcode/README.md deleted file mode 100644 index bd2e2e9..0000000 --- a/node_modules/jsbarcode/README.md +++ /dev/null @@ -1,255 +0,0 @@ -

- JsBarcode -

- Build Status - Scrutinizer Code Quality - CDN - License -

- -Introduction ----- -**JsBarcode** is a **barcode generator** written in JavaScript. It supports multiple barcode formats and works in browsers and with *Node.js*. It has *no dependencies* when it is used for the web but works with *jQuery* if you are into that. - - - -Demo ----- -#### [Barcode Generator](http://lindell.github.io/JsBarcode/generator/) -#### [Simple CodePen Demo](http://codepen.io/lindell/pen/eZKBdO?editors=1010) -#### [Settings CodePen Demo](http://codepen.io/lindell/pen/mPvLXx?editors=1010) - -Supported barcodes: ----- -* [CODE128](https://github.com/lindell/JsBarcode/wiki/CODE128) - * CODE128 (automatic mode switching) - * CODE128 A/B/C (force mode) -* [EAN](https://github.com/lindell/JsBarcode/wiki/EAN) - * EAN-13 - * EAN-8 - * EAN-5 - * EAN-2 - * UPC (A) - * UPC (E) -* [CODE39](https://github.com/lindell/JsBarcode/wiki/CODE39) -* [ITF](https://github.com/lindell/JsBarcode/wiki/ITF-14) - * ITF - * ITF-14 -* [MSI](https://github.com/lindell/JsBarcode/wiki/MSI) - * MSI10 - * MSI11 - * MSI1010 - * MSI1110 -* [Pharmacode](https://github.com/lindell/JsBarcode/wiki/pharmacode) -* [Codabar](https://github.com/lindell/JsBarcode/wiki/codabar) - -Examples for browsers: ----- - -#### First create a canvas (or image) -````html - - - - - -```` - - - -#### Simple example: -````javascript -JsBarcode("#barcode", "Hi!"); -// or with jQuery -$("#barcode").JsBarcode("Hi!"); -```` - -##### Result: -![Result](https://s3-eu-west-1.amazonaws.com/js-barcode/barcodes/simple.svg) - - -#### Example with options: -````javascript -JsBarcode("#barcode", "1234", { - format: "pharmacode", - lineColor: "#0aa", - width:4, - height:40, - displayValue: false -}); -```` -##### Result: -![Result](https://s3-eu-west-1.amazonaws.com/js-barcode/barcodes/advanced.svg) - - -#### More advanced use case: -````javascript -JsBarcode("#barcode") - .options({font: "OCR-B"}) // Will affect all barcodes - .EAN13("1234567890128", {fontSize: 18, textMargin: 0}) - .blank(20) // Create space between the barcodes - .EAN5("12345", {height: 85, textPosition: "top", fontSize: 16, marginTop: 15}) - .render(); -```` -##### Result: -![Result](https://s3-eu-west-1.amazonaws.com/js-barcode/barcodes/simple.svg) - - - -#### Or define the value and options in the HTML element: -Use any `jsbarcode-*` or `data-*` as attributes where `*` is any option. -````html - - -```` - -And then initialize it with: -````javascript -JsBarcode(".barcode").init(); -```` - -##### Result: -![Result](https://s3-eu-west-1.amazonaws.com/js-barcode/barcodes/init.svg) - - - -#### Retrieve the barcode values so you can render it any way you'd like -Pass in an object which will be filled with data. -```javascript -const data = {}; -JsBarcode(data, 'text', {...options}); -``` -data will be filled with a ``` encodings ``` property which has all the needed values. -See wiki for an example of what data looks like. - - -Setup for browsers: ----- -### Step 1: -Download or get the CDN link to the script: - -| Name | Supported barcodes | Size (gzip) | CDN / Download | -|------|--------------------|:-----------:|---------------:| -| *All* | *All the barcodes!* | *10.1 kB* | *[JsBarcode.all.min.js][1]* | -| CODE128 | CODE128 (auto and force mode) | 6.2 kB | [JsBarcode.code128.min.js][2] | -| CODE39 | CODE39 | 5.1 kB | [JsBarcode.code39.min.js][3] | -| EAN / UPC | EAN-13, EAN-8, EAN-5, EAN-2, UPC (A) | 6.7 kB | [JsBarcode.ean-upc.min.js][4] | -| ITF | ITF, ITF-14 | 5 kB | [JsBarcode.itf.min.js][5] | -| MSI | MSI, MSI10, MSI11, MSI1010, MSI1110 | 5 kB | [JsBarcode.msi.min.js][6] | -| Pharmacode | Pharmacode | 4.7 kB | [JsBarcode.pharmacode.min.js][7] | -| Codabar | Codabar | 4.9 kB | [JsBarcode.codabar.min.js][8] | - - -### Step 2: -Include the script in your code: - - -````html - -```` - -### Step 3: -You are done! Go generate some barcodes :smile: - -Bower and npm: ----- -You can also use [Bower](http://bower.io) or [npm](https://www.npmjs.com) to install and manage the library. -````bash -bower install jsbarcode --save -```` -````bash -npm install jsbarcode --save -```` - -Node.js: ----- - -#### With canvas: -```` javascript -var JsBarcode = require('jsbarcode'); - -// Canvas v1 -var Canvas = require("canvas"); -// Canvas v2 -var { createCanvas } = require("canvas"); - -// Canvas v1 -var canvas = new Canvas(); -// Canvas v2 -var canvas = createCanvas(); - -JsBarcode(canvas, "Hello"); - -// Do what you want with the canvas -// See https://github.com/Automattic/node-canvas for more information -```` - -#### With svg: -```` javascript -const { DOMImplementation, XMLSerializer } = require('xmldom'); -const xmlSerializer = new XMLSerializer(); -const document = new DOMImplementation().createDocument('http://www.w3.org/1999/xhtml', 'html', null); -const svgNode = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); - -JsBarcode(svgNode, 'test', { - xmlDocument: document, -}); - -const svgText = xmlSerializer.serializeToString(svgNode); -```` - - -Options: ----- -For information about how to use the options, see [the wiki page](https://github.com/lindell/JsBarcode/wiki/Options). - -| Option | Default value | Type | -|--------|---------------|------| -| [`format`](https://github.com/lindell/JsBarcode/wiki/Options#format) | `"auto" (CODE128)` | `String` | -| [`width`](https://github.com/lindell/JsBarcode/wiki/Options#width) | `2` | `Number` | -| [`height`](https://github.com/lindell/JsBarcode/wiki/Options#height) | `100` | `Number` | -| [`displayValue`](https://github.com/lindell/JsBarcode/wiki/Options#display-value) | `true` | `Boolean` | -| [`text`](https://github.com/lindell/JsBarcode/wiki/Options#text) | `undefined` | `String` | -| [`fontOptions`](https://github.com/lindell/JsBarcode/wiki/Options#font-options) | `""` | `String` | -| [`font`](https://github.com/lindell/JsBarcode/wiki/Options#font) | `"monospace"` | `String` | -| [`textAlign`](https://github.com/lindell/JsBarcode/wiki/Options#text-align) | `"center"` | `String` | -| [`textPosition`](https://github.com/lindell/JsBarcode/wiki/Options#text-position) | `"bottom"` | `String` | -| [`textMargin`](https://github.com/lindell/JsBarcode/wiki/Options#text-margin) | `2` | `Number` | -| [`fontSize`](https://github.com/lindell/JsBarcode/wiki/Options#font-size) | `20` | `Number` | -| [`background`](https://github.com/lindell/JsBarcode/wiki/Options#background) | `"#ffffff"` | `String (CSS color)` | -| [`lineColor`](https://github.com/lindell/JsBarcode/wiki/Options#line-color) | `"#000000"` | `String (CSS color)` | -| [`margin`](https://github.com/lindell/JsBarcode/wiki/Options#margins) | `10` | `Number` | -| [`marginTop`](https://github.com/lindell/JsBarcode/wiki/Options#margins) | `undefined` | `Number` | -| [`marginBottom`](https://github.com/lindell/JsBarcode/wiki/Options#margins) | `undefined` | `Number` | -| [`marginLeft`](https://github.com/lindell/JsBarcode/wiki/Options#margins) | `undefined` | `Number` | -| [`marginRight`](https://github.com/lindell/JsBarcode/wiki/Options#margins) | `undefined` | `Number` | -| [`valid`](https://github.com/lindell/JsBarcode/wiki/Options#valid) | `function(valid){}` | `Function` | - -Contributions and feedback: ----- -We :heart: contributions and feedback. - -If you want to contribute, please check out the [CONTRIBUTING.md](https://github.com/lindell/JsBarcode/blob/master/CONTRIBUTING.md) file. - -If you have any question or suggestion [create an issue](https://github.com/lindell/JsBarcode/issues/new) or ask about it in the [gitter chat](https://gitter.im/lindell/JsBarcode). - -Bug reports should always be done with a [new issue](https://github.com/lindell/JsBarcode/issues/new). - -License: ----- -JsBarcode is shared under the [MIT license](https://github.com/lindell/JsBarcode/blob/master/MIT-LICENSE.txt). This means you can modify and use it however you want, even for comercial use. But please give this the Github repo a :star: and write a small comment of how you are using JsBarcode in the [gitter chat](https://gitter.im/lindell/JsBarcode). - - - -[1]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/JsBarcode.all.min.js "jsdelivr all barcodes" -[2]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.code128.min.js "jsdelivr code128" -[3]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.code39.min.js "jsdelivr code39" -[4]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.ean-upc.min.js "jsdelivr ean/upc" -[5]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.itf.min.js "jsdelivr itf" -[6]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.msi.min.js "jsdelivr msi" -[7]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.pharmacode.min.js "jsdelivr pharmacode" -[8]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.codabar.min.js "jsdelivr codabar" diff --git a/node_modules/jsbarcode/automation/barcode-building.json b/node_modules/jsbarcode/automation/barcode-building.json deleted file mode 100644 index 917c295..0000000 --- a/node_modules/jsbarcode/automation/barcode-building.json +++ /dev/null @@ -1,37 +0,0 @@ -[ - { - "name": "code39", - "names": "CODE39", - "barcodeFile": "./CODE39" - }, - { - "name": "code128", - "names": ["CODE128, CODE128A, CODE128B, CODE128C"], - "barcodeFile": "./CODE128" - }, - { - "name": "ean-upc", - "names": "EAN13, EAN8, EAN5, EAN2, UPC", - "barcodeFile": "./EAN_UPC" - }, - { - "name": "itf", - "names": "ITF, ITF14", - "barcodeFile": "./ITF" - }, - { - "name": "msi", - "names": "MSI, MSI10, MSI11, MSI1010, MSI1110", - "barcodeFile": "./MSI" - }, - { - "name": "pharmacode", - "names": "pharmacode", - "barcodeFile": "./pharmacode" - }, - { - "name": "codabar", - "names": "codabar", - "barcodeFile": "./codabar" - } -] diff --git a/node_modules/jsbarcode/automation/building.js b/node_modules/jsbarcode/automation/building.js deleted file mode 100644 index 24454c7..0000000 --- a/node_modules/jsbarcode/automation/building.js +++ /dev/null @@ -1,132 +0,0 @@ -var gulp = require('gulp'); -var header = require('gulp-header'); -var clean = require('gulp-clean'); -var gulpWebpack = require('webpack-stream'); -var webpack = require('webpack'); -var babel = require("gulp-babel"); -var runSequence = require('gulp4-run-sequence'); -var fs = require('fs'); - -var settings = require('./settings.json'); -var shared = require('./shared.js'); - -gulp.task("clean", gulp.series(function () { - return gulp.src(["bin/", "dist/"], { read: false }) - .pipe(clean()); -})); - - -gulp.task("babel", gulp.series(function () { - return babelFunc(); -})); - - -function babelFunc() { - return gulp.src("src/**/*") - .pipe(babel({ - presets: ['es2015', 'stage-3'] - })) - .pipe(gulp.dest("bin/")); -} - - -gulp.task("webpack", gulp.series(["babel"], function () { - return webpackFunc(); -})); - - -function webpackFunc() { - return gulp.src('bin/JsBarcode.js') - .pipe(gulpWebpack( - { - mode: "none", - output: { - filename: 'JsBarcode.all.js' - } - } - , webpack)) - .pipe(gulp.dest("dist/")); -} - - -gulp.task("webpack-min", gulp.series(["babel"], function () { - return webpackMin('all'); -})); - - -function webpackMin(name, dest) { - dest = dest || './'; - return gulp.src('bin/JsBarcode.js') - .pipe(gulpWebpack( - { - mode: "production", - output: { - filename: shared.minifiedFilename(name) - }, - } - , webpack)) - .pipe(header(settings.banner, require(settings.baseDir + 'package.json'))) - .pipe(gulp.dest("dist/" + dest)); -} - - -gulp.task("webpack-all", gulp.series(function (cb) { - var barcodes = require('./barcode-building.json'); - - // Move the real barcodes/index.js out of the way while compiling the individual barcodes - fs.renameSync("src/barcodes/index.js", "src/barcodes/index.tmp.js"); - - // Take a barcode from the barcodes array, call the functions to compile that - // format and have a callback when it has finished. - function loopBarcode(i) { - if (i < barcodes.length) { - createBarcodeInclude(barcodes[i], function () { - loopBarcode(i + 1); - }); - } - else { - fs.renameSync("src/barcodes/index.tmp.js", "src/barcodes/index.js"); - cb(); // Done - } - } - - loopBarcode(0); -})); - - -// Takes information about a barcode formatSize -// Modifies the barcodes/index.js file to only import the specified format -// and then does a recompilation and minifies everything with webpack -function createBarcodeInclude(barcode, callback) { - var toFile = ""; - toFile += "import {" + barcode.names + "} from '" + barcode.barcodeFile + "'"; - toFile += "\n"; - toFile += "export default {" + barcode.names + "}"; - - // Write a new barcodes/index file that only includes the specified barcode - fs.writeFile("src/barcodes/index.js", toFile, function () { - // Remove the compiled barcodes/index file (if it exist) - if (fs.existsSync("bin/barcodes/index.js")) { - fs.unlinkSync("bin/barcodes/index.js"); - } - // Re-compile with babel and webpack everything - babelFunc().on('end', function () { - webpackMin(barcode.name, 'barcodes/').on('end', callback); - }); - }); -} - - -gulp.task('compress', gulp.series(function (cb) { - runSequence( - "clean", - "webpack-all", - "webpack", - "webpack-min", - cb - ); -})); - -gulp.task('compile', gulp.series(['babel'])); - -gulp.task('compile-web', gulp.series(['webpack'])); diff --git a/node_modules/jsbarcode/automation/linting.js b/node_modules/jsbarcode/automation/linting.js deleted file mode 100644 index ef034f9..0000000 --- a/node_modules/jsbarcode/automation/linting.js +++ /dev/null @@ -1,9 +0,0 @@ -var gulp = require('gulp'); -var eslint = require('gulp-eslint'); - -gulp.task("lint", function () { - return gulp.src(['src/**/*.js']) - .pipe(eslint()) - .pipe(eslint.format()) - .pipe(eslint.failAfterError()); -}); diff --git a/node_modules/jsbarcode/automation/misc.js b/node_modules/jsbarcode/automation/misc.js deleted file mode 100644 index de94583..0000000 --- a/node_modules/jsbarcode/automation/misc.js +++ /dev/null @@ -1,30 +0,0 @@ -/*eslint no-console: 0 */ - -var gulp = require('gulp'); -var request = require('request'); -var fs = require('fs'); - -gulp.task('jsdelivr', function(callback){ - console.log("Making request..."); - request({ - url: "https://api.jsdelivr.com/v1/jsdelivr/libraries?name=jsbarcode", - json: true - }, function (error, response, body) { - if (!error && response.statusCode === 200) { - var readme = fs.readFileSync('README.md', "utf-8"); - var version = body[0].lastversion; - - readme = readme.replace(/https:\/\/cdn\.jsdelivr\.net\/jsbarcode\/[0-9]+\.[0-9]+\.[0-9]+\//g, - "https://cdn.jsdelivr.net/jsbarcode/" + version + "/"); - - fs.writeFileSync('README.md', readme, 'utf8'); - - console.log("New version: " + version); - callback(); - } - else{ - console.error("Failed to make jsdelivr api request"); - callback(); - } - }); -}); diff --git a/node_modules/jsbarcode/automation/releasing.js b/node_modules/jsbarcode/automation/releasing.js deleted file mode 100644 index 227e156..0000000 --- a/node_modules/jsbarcode/automation/releasing.js +++ /dev/null @@ -1,163 +0,0 @@ -/*eslint -no-console: 0 -*/ - -var gulp = require('gulp'); -var bump = require('gulp-bump'); -var git = require('gulp-git'); -var publishRelease = require('publish-release'); -var gzipSize = require('gzip-size'); -var runSequence = require('gulp4-run-sequence'); -var fs = require('fs'); - -var settings = require('./settings.json'); -var shared = require('./shared.js'); - - -gulp.task('git-release', gulp.series(['compress'], function (cb) { - var pkg = require(settings.baseDir + 'package.json'); - var v = 'v' + pkg.version; - var message = ':package: Release ' + v; - - updateReadmeFileSizes(); - - gulp.src(['./package.json', './bower.json', './README.md', './bin/', './dist']) - .pipe(git.add({ args: '--all --force' })) - .pipe(git.commit(message)); - - git.push('origin', 'master', function () { - git.tag(v, message, function () { - git.push('origin', 'master', { args: '--tags' }, cb); - }); - }); -})); - - -// Bump (increase) the version number -gulp.task('bump-patch', function () { - return gulp.src(['./package.json', './bower.json']) - .pipe(bump({ type: 'patch' })) - .pipe(gulp.dest('./')); -}); - - -gulp.task('bump-minor', function () { - return gulp.src(['./package.json', './bower.json']) - .pipe(bump({ type: 'minor' })) - .pipe(gulp.dest('./')); -}); - - -gulp.task('bump-major', function () { - return gulp.src(['./package.json', './bower.json']) - .pipe(bump({ type: 'major' })) - .pipe(gulp.dest('./')); -}); - - -gulp.task('npm', function (done) { - require('child_process').spawn('npm', ['publish'], { stdio: 'inherit' }) - .on('close', done); -}); - - -gulp.task('github-release', function (done) { - var pkg = require(settings.baseDir + './package.json'); - var v = 'v' + pkg.version; - var name = "JsBarcode " + v; - - publishRelease({ - token: process.env.GITHUB_TOKEN, - owner: "lindell", - repo: "JsBarcode", - tag: v, - name: name, - assets: [__dirname + "/" + settings.baseDir + "/dist/JsBarcode.all.min.js", __dirname + "/" + settings.baseDir + "/dist/JsBarcode.all.js"] - }, done); -}); - - - -gulp.task('release', gulp.series(function (callback) { - runSequence( - 'git-release', - 'github-release', - 'npm', - callback - ); -})); - - -gulp.task('patch', function () { - runSequence( - 'bump-patch', - 'release', - releaseDone - ); -}); - - -gulp.task('minor', function () { - runSequence( - 'bump-minor', - 'release', - releaseDone - ); -}); - - -gulp.task('major', function () { - runSequence( - 'bump-major', - 'release', - releaseDone - ); -}); - -function releaseDone(error) { - if (error) { - console.log(error.message); - } - else { - console.log('Successful!'); - } -} - - -function updateReadmeFileSizes() { - var files = require('./barcode-building.json'); - var readme = fs.readFileSync('README.md', "utf-8"); - - // Update .all files - var allData = fs.readFileSync('dist/JsBarcode.all.min.js'); - var allFilesize = gzipSize.sync(allData); - - var allRegexp = new RegExp('\\|[^\\|]*\\|([ \\t\\*]*\\[JsBarcode\\.all\\.min\\.js\\])'); - readme = readme.replace(allRegexp, "| *" + formatSize(allFilesize) + "* |$1"); - - // Update all barcodes files - for (var i in files) { - var filename = shared.minifiedFilename(files[i].name); - - var fileData = fs.readFileSync('dist/barcodes/' + filename); - var fileFilesize = gzipSize.sync(fileData); - - var fileRegexp = new RegExp('\\|[^\\|]*\\|([ \\t]*\\[' + RegExp.escape(filename) + '\\])'); - - readme = readme.replace(fileRegexp, "| " + formatSize(fileFilesize) + " |$1"); - } - - fs.writeFileSync('README.md', readme, 'utf8'); -} - - -// Util functions -RegExp.escape = function (s) { - return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); -}; - -function formatSize(bytes) { - var kilobytes = Math.round(bytes / 1024 * 10) / 10; - - return kilobytes + " kB"; -} diff --git a/node_modules/jsbarcode/automation/settings.json b/node_modules/jsbarcode/automation/settings.json deleted file mode 100644 index ab5b9b3..0000000 --- a/node_modules/jsbarcode/automation/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "baseDir": "../", - "distDir": "./dist/", - "binDir": "./bin/", - "banner": "/*! JsBarcode v<%= version %> | (c) <%= author %> | <%= license %> license */\n" -} diff --git a/node_modules/jsbarcode/automation/shared.js b/node_modules/jsbarcode/automation/shared.js deleted file mode 100644 index 0ecfa93..0000000 --- a/node_modules/jsbarcode/automation/shared.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = {}; - -module.exports.minifiedFilename = function(name){ - return "JsBarcode." + name + ".min.js"; -}; diff --git a/node_modules/jsbarcode/bin/JsBarcode.js b/node_modules/jsbarcode/bin/JsBarcode.js deleted file mode 100755 index 1dad255..0000000 --- a/node_modules/jsbarcode/bin/JsBarcode.js +++ /dev/null @@ -1,252 +0,0 @@ -'use strict'; - -var _barcodes = require('./barcodes/'); - -var _barcodes2 = _interopRequireDefault(_barcodes); - -var _merge = require('./help/merge.js'); - -var _merge2 = _interopRequireDefault(_merge); - -var _linearizeEncodings = require('./help/linearizeEncodings.js'); - -var _linearizeEncodings2 = _interopRequireDefault(_linearizeEncodings); - -var _fixOptions = require('./help/fixOptions.js'); - -var _fixOptions2 = _interopRequireDefault(_fixOptions); - -var _getRenderProperties = require('./help/getRenderProperties.js'); - -var _getRenderProperties2 = _interopRequireDefault(_getRenderProperties); - -var _optionsFromStrings = require('./help/optionsFromStrings.js'); - -var _optionsFromStrings2 = _interopRequireDefault(_optionsFromStrings); - -var _ErrorHandler = require('./exceptions/ErrorHandler.js'); - -var _ErrorHandler2 = _interopRequireDefault(_ErrorHandler); - -var _exceptions = require('./exceptions/exceptions.js'); - -var _defaults = require('./options/defaults.js'); - -var _defaults2 = _interopRequireDefault(_defaults); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// The protype of the object returned from the JsBarcode() call - - -// Help functions -var API = function API() {}; - -// The first call of the library API -// Will return an object with all barcodes calls and the data that is used -// by the renderers - - -// Default values - - -// Exceptions -// Import all the barcodes -var JsBarcode = function JsBarcode(element, text, options) { - var api = new API(); - - if (typeof element === "undefined") { - throw Error("No element to render on was provided."); - } - - // Variables that will be pased through the API calls - api._renderProperties = (0, _getRenderProperties2.default)(element); - api._encodings = []; - api._options = _defaults2.default; - api._errorHandler = new _ErrorHandler2.default(api); - - // If text is set, use the simple syntax (render the barcode directly) - if (typeof text !== "undefined") { - options = options || {}; - - if (!options.format) { - options.format = autoSelectBarcode(); - } - - api.options(options)[options.format](text, options).render(); - } - - return api; -}; - -// To make tests work TODO: remove -JsBarcode.getModule = function (name) { - return _barcodes2.default[name]; -}; - -// Register all barcodes -for (var name in _barcodes2.default) { - if (_barcodes2.default.hasOwnProperty(name)) { - // Security check if the propery is a prototype property - registerBarcode(_barcodes2.default, name); - } -} -function registerBarcode(barcodes, name) { - API.prototype[name] = API.prototype[name.toUpperCase()] = API.prototype[name.toLowerCase()] = function (text, options) { - var api = this; - return api._errorHandler.wrapBarcodeCall(function () { - // Ensure text is options.text - options.text = typeof options.text === 'undefined' ? undefined : '' + options.text; - - var newOptions = (0, _merge2.default)(api._options, options); - newOptions = (0, _optionsFromStrings2.default)(newOptions); - var Encoder = barcodes[name]; - var encoded = encode(text, Encoder, newOptions); - api._encodings.push(encoded); - - return api; - }); - }; -} - -// encode() handles the Encoder call and builds the binary string to be rendered -function encode(text, Encoder, options) { - // Ensure that text is a string - text = "" + text; - - var encoder = new Encoder(text, options); - - // If the input is not valid for the encoder, throw error. - // If the valid callback option is set, call it instead of throwing error - if (!encoder.valid()) { - throw new _exceptions.InvalidInputException(encoder.constructor.name, text); - } - - // Make a request for the binary data (and other infromation) that should be rendered - var encoded = encoder.encode(); - - // Encodings can be nestled like [[1-1, 1-2], 2, [3-1, 3-2] - // Convert to [1-1, 1-2, 2, 3-1, 3-2] - encoded = (0, _linearizeEncodings2.default)(encoded); - - // Merge - for (var i = 0; i < encoded.length; i++) { - encoded[i].options = (0, _merge2.default)(options, encoded[i].options); - } - - return encoded; -} - -function autoSelectBarcode() { - // If CODE128 exists. Use it - if (_barcodes2.default["CODE128"]) { - return "CODE128"; - } - - // Else, take the first (probably only) barcode - return Object.keys(_barcodes2.default)[0]; -} - -// Sets global encoder options -// Added to the api by the JsBarcode function -API.prototype.options = function (options) { - this._options = (0, _merge2.default)(this._options, options); - return this; -}; - -// Will create a blank space (usually in between barcodes) -API.prototype.blank = function (size) { - var zeroes = new Array(size + 1).join("0"); - this._encodings.push({ data: zeroes }); - return this; -}; - -// Initialize JsBarcode on all HTML elements defined. -API.prototype.init = function () { - // Should do nothing if no elements where found - if (!this._renderProperties) { - return; - } - - // Make sure renderProperies is an array - if (!Array.isArray(this._renderProperties)) { - this._renderProperties = [this._renderProperties]; - } - - var renderProperty; - for (var i in this._renderProperties) { - renderProperty = this._renderProperties[i]; - var options = (0, _merge2.default)(this._options, renderProperty.options); - - if (options.format == "auto") { - options.format = autoSelectBarcode(); - } - - this._errorHandler.wrapBarcodeCall(function () { - var text = options.value; - var Encoder = _barcodes2.default[options.format.toUpperCase()]; - var encoded = encode(text, Encoder, options); - - render(renderProperty, encoded, options); - }); - } -}; - -// The render API call. Calls the real render function. -API.prototype.render = function () { - if (!this._renderProperties) { - throw new _exceptions.NoElementException(); - } - - if (Array.isArray(this._renderProperties)) { - for (var i = 0; i < this._renderProperties.length; i++) { - render(this._renderProperties[i], this._encodings, this._options); - } - } else { - render(this._renderProperties, this._encodings, this._options); - } - - return this; -}; - -API.prototype._defaults = _defaults2.default; - -// Prepares the encodings and calls the renderer -function render(renderProperties, encodings, options) { - encodings = (0, _linearizeEncodings2.default)(encodings); - - for (var i = 0; i < encodings.length; i++) { - encodings[i].options = (0, _merge2.default)(options, encodings[i].options); - (0, _fixOptions2.default)(encodings[i].options); - } - - (0, _fixOptions2.default)(options); - - var Renderer = renderProperties.renderer; - var renderer = new Renderer(renderProperties.element, encodings, options); - renderer.render(); - - if (renderProperties.afterRender) { - renderProperties.afterRender(); - } -} - -// Export to browser -if (typeof window !== "undefined") { - window.JsBarcode = JsBarcode; -} - -// Export to jQuery -/*global jQuery */ -if (typeof jQuery !== 'undefined') { - jQuery.fn.JsBarcode = function (content, options) { - var elementArray = []; - jQuery(this).each(function () { - elementArray.push(this); - }); - return JsBarcode(elementArray, content, options); - }; -} - -// Export to commonJS -module.exports = JsBarcode; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/Barcode.js b/node_modules/jsbarcode/bin/barcodes/Barcode.js deleted file mode 100644 index 7138786..0000000 --- a/node_modules/jsbarcode/bin/barcodes/Barcode.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var Barcode = function Barcode(data, options) { - _classCallCheck(this, Barcode); - - this.data = data; - this.text = options.text || data; - this.options = options; -}; - -exports.default = Barcode; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128.js b/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128.js deleted file mode 100644 index 2d47112..0000000 --- a/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128.js +++ /dev/null @@ -1,167 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Barcode2 = require('../Barcode.js'); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -var _constants = require('./constants'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -// This is the master class, -// it does require the start code to be included in the string -var CODE128 = function (_Barcode) { - _inherits(CODE128, _Barcode); - - function CODE128(data, options) { - _classCallCheck(this, CODE128); - - // Get array of ascii codes from data - var _this = _possibleConstructorReturn(this, (CODE128.__proto__ || Object.getPrototypeOf(CODE128)).call(this, data.substring(1), options)); - - _this.bytes = data.split('').map(function (char) { - return char.charCodeAt(0); - }); - return _this; - } - - _createClass(CODE128, [{ - key: 'valid', - value: function valid() { - // ASCII value ranges 0-127, 200-211 - return (/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data) - ); - } - - // The public encoding function - - }, { - key: 'encode', - value: function encode() { - var bytes = this.bytes; - // Remove the start code from the bytes and set its index - var startIndex = bytes.shift() - 105; - // Get start set by index - var startSet = _constants.SET_BY_CODE[startIndex]; - - if (startSet === undefined) { - throw new RangeError('The encoding does not start with a start character.'); - } - - if (this.shouldEncodeAsEan128() === true) { - bytes.unshift(_constants.FNC1); - } - - // Start encode with the right type - var encodingResult = CODE128.next(bytes, 1, startSet); - - return { - text: this.text === this.data ? this.text.replace(/[^\x20-\x7E]/g, '') : this.text, - data: - // Add the start bits - CODE128.getBar(startIndex) + - // Add the encoded bits - encodingResult.result + - // Add the checksum - CODE128.getBar((encodingResult.checksum + startIndex) % _constants.MODULO) + - // Add the end bits - CODE128.getBar(_constants.STOP) - }; - } - - // GS1-128/EAN-128 - - }, { - key: 'shouldEncodeAsEan128', - value: function shouldEncodeAsEan128() { - var isEAN128 = this.options.ean128 || false; - if (typeof isEAN128 === 'string') { - isEAN128 = isEAN128.toLowerCase() === 'true'; - } - return isEAN128; - } - - // Get a bar symbol by index - - }], [{ - key: 'getBar', - value: function getBar(index) { - return _constants.BARS[index] ? _constants.BARS[index].toString() : ''; - } - - // Correct an index by a set and shift it from the bytes array - - }, { - key: 'correctIndex', - value: function correctIndex(bytes, set) { - if (set === _constants.SET_A) { - var charCode = bytes.shift(); - return charCode < 32 ? charCode + 64 : charCode - 32; - } else if (set === _constants.SET_B) { - return bytes.shift() - 32; - } else { - return (bytes.shift() - 48) * 10 + bytes.shift() - 48; - } - } - }, { - key: 'next', - value: function next(bytes, pos, set) { - if (!bytes.length) { - return { result: '', checksum: 0 }; - } - - var nextCode = void 0, - index = void 0; - - // Special characters - if (bytes[0] >= 200) { - index = bytes.shift() - 105; - var nextSet = _constants.SWAP[index]; - - // Swap to other set - if (nextSet !== undefined) { - nextCode = CODE128.next(bytes, pos + 1, nextSet); - } - // Continue on current set but encode a special character - else { - // Shift - if ((set === _constants.SET_A || set === _constants.SET_B) && index === _constants.SHIFT) { - // Convert the next character so that is encoded correctly - bytes[0] = set === _constants.SET_A ? bytes[0] > 95 ? bytes[0] - 96 : bytes[0] : bytes[0] < 32 ? bytes[0] + 96 : bytes[0]; - } - nextCode = CODE128.next(bytes, pos + 1, set); - } - } - // Continue encoding - else { - index = CODE128.correctIndex(bytes, set); - nextCode = CODE128.next(bytes, pos + 1, set); - } - - // Get the correct binary encoding and calculate the weight - var enc = CODE128.getBar(index); - var weight = index * pos; - - return { - result: enc + nextCode.result, - checksum: weight + nextCode.checksum - }; - } - }]); - - return CODE128; -}(_Barcode3.default); - -exports.default = CODE128; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128A.js b/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128A.js deleted file mode 100644 index 28d9f11..0000000 --- a/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128A.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _CODE2 = require('./CODE128.js'); - -var _CODE3 = _interopRequireDefault(_CODE2); - -var _constants = require('./constants'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var CODE128A = function (_CODE) { - _inherits(CODE128A, _CODE); - - function CODE128A(string, options) { - _classCallCheck(this, CODE128A); - - return _possibleConstructorReturn(this, (CODE128A.__proto__ || Object.getPrototypeOf(CODE128A)).call(this, _constants.A_START_CHAR + string, options)); - } - - _createClass(CODE128A, [{ - key: 'valid', - value: function valid() { - return new RegExp('^' + _constants.A_CHARS + '+$').test(this.data); - } - }]); - - return CODE128A; -}(_CODE3.default); - -exports.default = CODE128A; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128B.js b/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128B.js deleted file mode 100644 index 746c93b..0000000 --- a/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128B.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _CODE2 = require('./CODE128.js'); - -var _CODE3 = _interopRequireDefault(_CODE2); - -var _constants = require('./constants'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var CODE128B = function (_CODE) { - _inherits(CODE128B, _CODE); - - function CODE128B(string, options) { - _classCallCheck(this, CODE128B); - - return _possibleConstructorReturn(this, (CODE128B.__proto__ || Object.getPrototypeOf(CODE128B)).call(this, _constants.B_START_CHAR + string, options)); - } - - _createClass(CODE128B, [{ - key: 'valid', - value: function valid() { - return new RegExp('^' + _constants.B_CHARS + '+$').test(this.data); - } - }]); - - return CODE128B; -}(_CODE3.default); - -exports.default = CODE128B; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128C.js b/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128C.js deleted file mode 100644 index b83ab9f..0000000 --- a/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128C.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _CODE2 = require('./CODE128.js'); - -var _CODE3 = _interopRequireDefault(_CODE2); - -var _constants = require('./constants'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var CODE128C = function (_CODE) { - _inherits(CODE128C, _CODE); - - function CODE128C(string, options) { - _classCallCheck(this, CODE128C); - - return _possibleConstructorReturn(this, (CODE128C.__proto__ || Object.getPrototypeOf(CODE128C)).call(this, _constants.C_START_CHAR + string, options)); - } - - _createClass(CODE128C, [{ - key: 'valid', - value: function valid() { - return new RegExp('^' + _constants.C_CHARS + '+$').test(this.data); - } - }]); - - return CODE128C; -}(_CODE3.default); - -exports.default = CODE128C; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128_AUTO.js b/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128_AUTO.js deleted file mode 100644 index add94f4..0000000 --- a/node_modules/jsbarcode/bin/barcodes/CODE128/CODE128_AUTO.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _CODE2 = require('./CODE128'); - -var _CODE3 = _interopRequireDefault(_CODE2); - -var _auto = require('./auto'); - -var _auto2 = _interopRequireDefault(_auto); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var CODE128AUTO = function (_CODE) { - _inherits(CODE128AUTO, _CODE); - - function CODE128AUTO(data, options) { - _classCallCheck(this, CODE128AUTO); - - // ASCII value ranges 0-127, 200-211 - if (/^[\x00-\x7F\xC8-\xD3]+$/.test(data)) { - var _this = _possibleConstructorReturn(this, (CODE128AUTO.__proto__ || Object.getPrototypeOf(CODE128AUTO)).call(this, (0, _auto2.default)(data), options)); - } else { - var _this = _possibleConstructorReturn(this, (CODE128AUTO.__proto__ || Object.getPrototypeOf(CODE128AUTO)).call(this, data, options)); - } - return _possibleConstructorReturn(_this); - } - - return CODE128AUTO; -}(_CODE3.default); - -exports.default = CODE128AUTO; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/CODE128/auto.js b/node_modules/jsbarcode/bin/barcodes/CODE128/auto.js deleted file mode 100644 index ed1d6ff..0000000 --- a/node_modules/jsbarcode/bin/barcodes/CODE128/auto.js +++ /dev/null @@ -1,73 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _constants = require('./constants'); - -// Match Set functions -var matchSetALength = function matchSetALength(string) { - return string.match(new RegExp('^' + _constants.A_CHARS + '*'))[0].length; -}; -var matchSetBLength = function matchSetBLength(string) { - return string.match(new RegExp('^' + _constants.B_CHARS + '*'))[0].length; -}; -var matchSetC = function matchSetC(string) { - return string.match(new RegExp('^' + _constants.C_CHARS + '*'))[0]; -}; - -// CODE128A or CODE128B -function autoSelectFromAB(string, isA) { - var ranges = isA ? _constants.A_CHARS : _constants.B_CHARS; - var untilC = string.match(new RegExp('^(' + ranges + '+?)(([0-9]{2}){2,})([^0-9]|$)')); - - if (untilC) { - return untilC[1] + String.fromCharCode(204) + autoSelectFromC(string.substring(untilC[1].length)); - } - - var chars = string.match(new RegExp('^' + ranges + '+'))[0]; - - if (chars.length === string.length) { - return string; - } - - return chars + String.fromCharCode(isA ? 205 : 206) + autoSelectFromAB(string.substring(chars.length), !isA); -} - -// CODE128C -function autoSelectFromC(string) { - var cMatch = matchSetC(string); - var length = cMatch.length; - - if (length === string.length) { - return string; - } - - string = string.substring(length); - - // Select A/B depending on the longest match - var isA = matchSetALength(string) >= matchSetBLength(string); - return cMatch + String.fromCharCode(isA ? 206 : 205) + autoSelectFromAB(string, isA); -} - -// Detect Code Set (A, B or C) and format the string - -exports.default = function (string) { - var newString = void 0; - var cLength = matchSetC(string).length; - - // Select 128C if the string start with enough digits - if (cLength >= 2) { - newString = _constants.C_START_CHAR + autoSelectFromC(string); - } else { - // Select A/B depending on the longest match - var isA = matchSetALength(string) > matchSetBLength(string); - newString = (isA ? _constants.A_START_CHAR : _constants.B_START_CHAR) + autoSelectFromAB(string, isA); - } - - return newString.replace(/[\xCD\xCE]([^])[\xCD\xCE]/, // Any sequence between 205 and 206 characters - function (match, char) { - return String.fromCharCode(203) + char; - }); -}; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/CODE128/constants.js b/node_modules/jsbarcode/bin/barcodes/CODE128/constants.js deleted file mode 100644 index b992c0e..0000000 --- a/node_modules/jsbarcode/bin/barcodes/CODE128/constants.js +++ /dev/null @@ -1,54 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _SET_BY_CODE; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -// constants for internal usage -var SET_A = exports.SET_A = 0; -var SET_B = exports.SET_B = 1; -var SET_C = exports.SET_C = 2; - -// Special characters -var SHIFT = exports.SHIFT = 98; -var START_A = exports.START_A = 103; -var START_B = exports.START_B = 104; -var START_C = exports.START_C = 105; -var MODULO = exports.MODULO = 103; -var STOP = exports.STOP = 106; -var FNC1 = exports.FNC1 = 207; - -// Get set by start code -var SET_BY_CODE = exports.SET_BY_CODE = (_SET_BY_CODE = {}, _defineProperty(_SET_BY_CODE, START_A, SET_A), _defineProperty(_SET_BY_CODE, START_B, SET_B), _defineProperty(_SET_BY_CODE, START_C, SET_C), _SET_BY_CODE); - -// Get next set by code -var SWAP = exports.SWAP = { - 101: SET_A, - 100: SET_B, - 99: SET_C -}; - -var A_START_CHAR = exports.A_START_CHAR = String.fromCharCode(208); // START_A + 105 -var B_START_CHAR = exports.B_START_CHAR = String.fromCharCode(209); // START_B + 105 -var C_START_CHAR = exports.C_START_CHAR = String.fromCharCode(210); // START_C + 105 - -// 128A (Code Set A) -// ASCII characters 00 to 95 (0–9, A–Z and control codes), special characters, and FNC 1–4 -var A_CHARS = exports.A_CHARS = "[\x00-\x5F\xC8-\xCF]"; - -// 128B (Code Set B) -// ASCII characters 32 to 127 (0–9, A–Z, a–z), special characters, and FNC 1–4 -var B_CHARS = exports.B_CHARS = "[\x20-\x7F\xC8-\xCF]"; - -// 128C (Code Set C) -// 00–99 (encodes two digits with a single code point) and FNC1 -var C_CHARS = exports.C_CHARS = "(\xCF*[0-9]{2}\xCF*)"; - -// CODE128 includes 107 symbols: -// 103 data symbols, 3 start symbols (A, B and C), and 1 stop symbol (the last one) -// Each symbol consist of three black bars (1) and three white spaces (0). -var BARS = exports.BARS = [11011001100, 11001101100, 11001100110, 10010011000, 10010001100, 10001001100, 10011001000, 10011000100, 10001100100, 11001001000, 11001000100, 11000100100, 10110011100, 10011011100, 10011001110, 10111001100, 10011101100, 10011100110, 11001110010, 11001011100, 11001001110, 11011100100, 11001110100, 11101101110, 11101001100, 11100101100, 11100100110, 11101100100, 11100110100, 11100110010, 11011011000, 11011000110, 11000110110, 10100011000, 10001011000, 10001000110, 10110001000, 10001101000, 10001100010, 11010001000, 11000101000, 11000100010, 10110111000, 10110001110, 10001101110, 10111011000, 10111000110, 10001110110, 11101110110, 11010001110, 11000101110, 11011101000, 11011100010, 11011101110, 11101011000, 11101000110, 11100010110, 11101101000, 11101100010, 11100011010, 11101111010, 11001000010, 11110001010, 10100110000, 10100001100, 10010110000, 10010000110, 10000101100, 10000100110, 10110010000, 10110000100, 10011010000, 10011000010, 10000110100, 10000110010, 11000010010, 11001010000, 11110111010, 11000010100, 10001111010, 10100111100, 10010111100, 10010011110, 10111100100, 10011110100, 10011110010, 11110100100, 11110010100, 11110010010, 11011011110, 11011110110, 11110110110, 10101111000, 10100011110, 10001011110, 10111101000, 10111100010, 11110101000, 11110100010, 10111011110, 10111101110, 11101011110, 11110101110, 11010000100, 11010010000, 11010011100, 1100011101011]; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/CODE128/index.js b/node_modules/jsbarcode/bin/barcodes/CODE128/index.js deleted file mode 100644 index 4364222..0000000 --- a/node_modules/jsbarcode/bin/barcodes/CODE128/index.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.CODE128C = exports.CODE128B = exports.CODE128A = exports.CODE128 = undefined; - -var _CODE128_AUTO = require('./CODE128_AUTO.js'); - -var _CODE128_AUTO2 = _interopRequireDefault(_CODE128_AUTO); - -var _CODE128A = require('./CODE128A.js'); - -var _CODE128A2 = _interopRequireDefault(_CODE128A); - -var _CODE128B = require('./CODE128B.js'); - -var _CODE128B2 = _interopRequireDefault(_CODE128B); - -var _CODE128C = require('./CODE128C.js'); - -var _CODE128C2 = _interopRequireDefault(_CODE128C); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.CODE128 = _CODE128_AUTO2.default; -exports.CODE128A = _CODE128A2.default; -exports.CODE128B = _CODE128B2.default; -exports.CODE128C = _CODE128C2.default; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/CODE39/index.js b/node_modules/jsbarcode/bin/barcodes/CODE39/index.js deleted file mode 100644 index fe331fd..0000000 --- a/node_modules/jsbarcode/bin/barcodes/CODE39/index.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.CODE39 = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Barcode2 = require("../Barcode.js"); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: -// https://en.wikipedia.org/wiki/Code_39#Encoding - -var CODE39 = function (_Barcode) { - _inherits(CODE39, _Barcode); - - function CODE39(data, options) { - _classCallCheck(this, CODE39); - - data = data.toUpperCase(); - - // Calculate mod43 checksum if enabled - if (options.mod43) { - data += getCharacter(mod43checksum(data)); - } - - return _possibleConstructorReturn(this, (CODE39.__proto__ || Object.getPrototypeOf(CODE39)).call(this, data, options)); - } - - _createClass(CODE39, [{ - key: "encode", - value: function encode() { - // First character is always a * - var result = getEncoding("*"); - - // Take every character and add the binary representation to the result - for (var i = 0; i < this.data.length; i++) { - result += getEncoding(this.data[i]) + "0"; - } - - // Last character is always a * - result += getEncoding("*"); - - return { - data: result, - text: this.text - }; - } - }, { - key: "valid", - value: function valid() { - return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/) !== -1; - } - }]); - - return CODE39; -}(_Barcode3.default); - -// All characters. The position in the array is the (checksum) value - - -var characters = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "-", ".", " ", "$", "/", "+", "%", "*"]; - -// The decimal representation of the characters, is converted to the -// corresponding binary with the getEncoding function -var encodings = [20957, 29783, 23639, 30485, 20951, 29813, 23669, 20855, 29789, 23645, 29975, 23831, 30533, 22295, 30149, 24005, 21623, 29981, 23837, 22301, 30023, 23879, 30545, 22343, 30161, 24017, 21959, 30065, 23921, 22385, 29015, 18263, 29141, 17879, 29045, 18293, 17783, 29021, 18269, 17477, 17489, 17681, 20753, 35770]; - -// Get the binary representation of a character by converting the encodings -// from decimal to binary -function getEncoding(character) { - return getBinary(characterValue(character)); -} - -function getBinary(characterValue) { - return encodings[characterValue].toString(2); -} - -function getCharacter(characterValue) { - return characters[characterValue]; -} - -function characterValue(character) { - return characters.indexOf(character); -} - -function mod43checksum(data) { - var checksum = 0; - for (var i = 0; i < data.length; i++) { - checksum += characterValue(data[i]); - } - - checksum = checksum % 43; - return checksum; -} - -exports.CODE39 = CODE39; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN.js b/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN.js deleted file mode 100644 index 62d3ae3..0000000 --- a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN.js +++ /dev/null @@ -1,92 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _constants = require('./constants'); - -var _encoder = require('./encoder'); - -var _encoder2 = _interopRequireDefault(_encoder); - -var _Barcode2 = require('../Barcode'); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -// Base class for EAN8 & EAN13 -var EAN = function (_Barcode) { - _inherits(EAN, _Barcode); - - function EAN(data, options) { - _classCallCheck(this, EAN); - - // Make sure the font is not bigger than the space between the guard bars - var _this = _possibleConstructorReturn(this, (EAN.__proto__ || Object.getPrototypeOf(EAN)).call(this, data, options)); - - _this.fontSize = !options.flat && options.fontSize > options.width * 10 ? options.width * 10 : options.fontSize; - - // Make the guard bars go down half the way of the text - _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin; - return _this; - } - - _createClass(EAN, [{ - key: 'encode', - value: function encode() { - return this.options.flat ? this.encodeFlat() : this.encodeGuarded(); - } - }, { - key: 'leftText', - value: function leftText(from, to) { - return this.text.substr(from, to); - } - }, { - key: 'leftEncode', - value: function leftEncode(data, structure) { - return (0, _encoder2.default)(data, structure); - } - }, { - key: 'rightText', - value: function rightText(from, to) { - return this.text.substr(from, to); - } - }, { - key: 'rightEncode', - value: function rightEncode(data, structure) { - return (0, _encoder2.default)(data, structure); - } - }, { - key: 'encodeGuarded', - value: function encodeGuarded() { - var textOptions = { fontSize: this.fontSize }; - var guardOptions = { height: this.guardHeight }; - - return [{ data: _constants.SIDE_BIN, options: guardOptions }, { data: this.leftEncode(), text: this.leftText(), options: textOptions }, { data: _constants.MIDDLE_BIN, options: guardOptions }, { data: this.rightEncode(), text: this.rightText(), options: textOptions }, { data: _constants.SIDE_BIN, options: guardOptions }]; - } - }, { - key: 'encodeFlat', - value: function encodeFlat() { - var data = [_constants.SIDE_BIN, this.leftEncode(), _constants.MIDDLE_BIN, this.rightEncode(), _constants.SIDE_BIN]; - - return { - data: data.join(''), - text: this.text - }; - } - }]); - - return EAN; -}(_Barcode3.default); - -exports.default = EAN; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN13.js b/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN13.js deleted file mode 100644 index c73e3fb..0000000 --- a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN13.js +++ /dev/null @@ -1,119 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -var _constants = require('./constants'); - -var _EAN2 = require('./EAN'); - -var _EAN3 = _interopRequireDefault(_EAN2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: -// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Binary_encoding_of_data_digits_into_EAN-13_barcode - -// Calculate the checksum digit -// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit -var checksum = function checksum(number) { - var res = number.substr(0, 12).split('').map(function (n) { - return +n; - }).reduce(function (sum, a, idx) { - return idx % 2 ? sum + a * 3 : sum + a; - }, 0); - - return (10 - res % 10) % 10; -}; - -var EAN13 = function (_EAN) { - _inherits(EAN13, _EAN); - - function EAN13(data, options) { - _classCallCheck(this, EAN13); - - // Add checksum if it does not exist - if (data.search(/^[0-9]{12}$/) !== -1) { - data += checksum(data); - } - - // Adds a last character to the end of the barcode - var _this = _possibleConstructorReturn(this, (EAN13.__proto__ || Object.getPrototypeOf(EAN13)).call(this, data, options)); - - _this.lastChar = options.lastChar; - return _this; - } - - _createClass(EAN13, [{ - key: 'valid', - value: function valid() { - return this.data.search(/^[0-9]{13}$/) !== -1 && +this.data[12] === checksum(this.data); - } - }, { - key: 'leftText', - value: function leftText() { - return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'leftText', this).call(this, 1, 6); - } - }, { - key: 'leftEncode', - value: function leftEncode() { - var data = this.data.substr(1, 6); - var structure = _constants.EAN13_STRUCTURE[this.data[0]]; - return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'leftEncode', this).call(this, data, structure); - } - }, { - key: 'rightText', - value: function rightText() { - return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'rightText', this).call(this, 7, 6); - } - }, { - key: 'rightEncode', - value: function rightEncode() { - var data = this.data.substr(7, 6); - return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'rightEncode', this).call(this, data, 'RRRRRR'); - } - - // The "standard" way of printing EAN13 barcodes with guard bars - - }, { - key: 'encodeGuarded', - value: function encodeGuarded() { - var data = _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'encodeGuarded', this).call(this); - - // Extend data with left digit & last character - if (this.options.displayValue) { - data.unshift({ - data: '000000000000', - text: this.text.substr(0, 1), - options: { textAlign: 'left', fontSize: this.fontSize } - }); - - if (this.options.lastChar) { - data.push({ - data: '00' - }); - data.push({ - data: '00000', - text: this.options.lastChar, - options: { fontSize: this.fontSize } - }); - } - } - - return data; - } - }]); - - return EAN13; -}(_EAN3.default); - -exports.default = EAN13; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN2.js b/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN2.js deleted file mode 100644 index 46b3d6f..0000000 --- a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN2.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _constants = require('./constants'); - -var _encoder = require('./encoder'); - -var _encoder2 = _interopRequireDefault(_encoder); - -var _Barcode2 = require('../Barcode'); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: -// https://en.wikipedia.org/wiki/EAN_2#Encoding - -var EAN2 = function (_Barcode) { - _inherits(EAN2, _Barcode); - - function EAN2(data, options) { - _classCallCheck(this, EAN2); - - return _possibleConstructorReturn(this, (EAN2.__proto__ || Object.getPrototypeOf(EAN2)).call(this, data, options)); - } - - _createClass(EAN2, [{ - key: 'valid', - value: function valid() { - return this.data.search(/^[0-9]{2}$/) !== -1; - } - }, { - key: 'encode', - value: function encode() { - // Choose the structure based on the number mod 4 - var structure = _constants.EAN2_STRUCTURE[parseInt(this.data) % 4]; - return { - // Start bits + Encode the two digits with 01 in between - data: '1011' + (0, _encoder2.default)(this.data, structure, '01'), - text: this.text - }; - } - }]); - - return EAN2; -}(_Barcode3.default); - -exports.default = EAN2; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN5.js b/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN5.js deleted file mode 100644 index d1807c3..0000000 --- a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN5.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _constants = require('./constants'); - -var _encoder = require('./encoder'); - -var _encoder2 = _interopRequireDefault(_encoder); - -var _Barcode2 = require('../Barcode'); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: -// https://en.wikipedia.org/wiki/EAN_5#Encoding - -var checksum = function checksum(data) { - var result = data.split('').map(function (n) { - return +n; - }).reduce(function (sum, a, idx) { - return idx % 2 ? sum + a * 9 : sum + a * 3; - }, 0); - return result % 10; -}; - -var EAN5 = function (_Barcode) { - _inherits(EAN5, _Barcode); - - function EAN5(data, options) { - _classCallCheck(this, EAN5); - - return _possibleConstructorReturn(this, (EAN5.__proto__ || Object.getPrototypeOf(EAN5)).call(this, data, options)); - } - - _createClass(EAN5, [{ - key: 'valid', - value: function valid() { - return this.data.search(/^[0-9]{5}$/) !== -1; - } - }, { - key: 'encode', - value: function encode() { - var structure = _constants.EAN5_STRUCTURE[checksum(this.data)]; - return { - data: '1011' + (0, _encoder2.default)(this.data, structure, '01'), - text: this.text - }; - } - }]); - - return EAN5; -}(_Barcode3.default); - -exports.default = EAN5; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN8.js b/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN8.js deleted file mode 100644 index 8c6d638..0000000 --- a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/EAN8.js +++ /dev/null @@ -1,81 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -var _EAN2 = require('./EAN'); - -var _EAN3 = _interopRequireDefault(_EAN2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: -// http://www.barcodeisland.com/ean8.phtml - -// Calculate the checksum digit -var checksum = function checksum(number) { - var res = number.substr(0, 7).split('').map(function (n) { - return +n; - }).reduce(function (sum, a, idx) { - return idx % 2 ? sum + a : sum + a * 3; - }, 0); - - return (10 - res % 10) % 10; -}; - -var EAN8 = function (_EAN) { - _inherits(EAN8, _EAN); - - function EAN8(data, options) { - _classCallCheck(this, EAN8); - - // Add checksum if it does not exist - if (data.search(/^[0-9]{7}$/) !== -1) { - data += checksum(data); - } - - return _possibleConstructorReturn(this, (EAN8.__proto__ || Object.getPrototypeOf(EAN8)).call(this, data, options)); - } - - _createClass(EAN8, [{ - key: 'valid', - value: function valid() { - return this.data.search(/^[0-9]{8}$/) !== -1 && +this.data[7] === checksum(this.data); - } - }, { - key: 'leftText', - value: function leftText() { - return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'leftText', this).call(this, 0, 4); - } - }, { - key: 'leftEncode', - value: function leftEncode() { - var data = this.data.substr(0, 4); - return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'leftEncode', this).call(this, data, 'LLLL'); - } - }, { - key: 'rightText', - value: function rightText() { - return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'rightText', this).call(this, 4, 4); - } - }, { - key: 'rightEncode', - value: function rightEncode() { - var data = this.data.substr(4, 4); - return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'rightEncode', this).call(this, data, 'RRRR'); - } - }]); - - return EAN8; -}(_EAN3.default); - -exports.default = EAN8; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/UPC.js b/node_modules/jsbarcode/bin/barcodes/EAN_UPC/UPC.js deleted file mode 100644 index f811101..0000000 --- a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/UPC.js +++ /dev/null @@ -1,165 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -exports.checksum = checksum; - -var _encoder = require("./encoder"); - -var _encoder2 = _interopRequireDefault(_encoder); - -var _Barcode2 = require("../Barcode.js"); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: -// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding - -var UPC = function (_Barcode) { - _inherits(UPC, _Barcode); - - function UPC(data, options) { - _classCallCheck(this, UPC); - - // Add checksum if it does not exist - if (data.search(/^[0-9]{11}$/) !== -1) { - data += checksum(data); - } - - var _this = _possibleConstructorReturn(this, (UPC.__proto__ || Object.getPrototypeOf(UPC)).call(this, data, options)); - - _this.displayValue = options.displayValue; - - // Make sure the font is not bigger than the space between the guard bars - if (options.fontSize > options.width * 10) { - _this.fontSize = options.width * 10; - } else { - _this.fontSize = options.fontSize; - } - - // Make the guard bars go down half the way of the text - _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin; - return _this; - } - - _createClass(UPC, [{ - key: "valid", - value: function valid() { - return this.data.search(/^[0-9]{12}$/) !== -1 && this.data[11] == checksum(this.data); - } - }, { - key: "encode", - value: function encode() { - if (this.options.flat) { - return this.flatEncoding(); - } else { - return this.guardedEncoding(); - } - } - }, { - key: "flatEncoding", - value: function flatEncoding() { - var result = ""; - - result += "101"; - result += (0, _encoder2.default)(this.data.substr(0, 6), "LLLLLL"); - result += "01010"; - result += (0, _encoder2.default)(this.data.substr(6, 6), "RRRRRR"); - result += "101"; - - return { - data: result, - text: this.text - }; - } - }, { - key: "guardedEncoding", - value: function guardedEncoding() { - var result = []; - - // Add the first digit - if (this.displayValue) { - result.push({ - data: "00000000", - text: this.text.substr(0, 1), - options: { textAlign: "left", fontSize: this.fontSize } - }); - } - - // Add the guard bars - result.push({ - data: "101" + (0, _encoder2.default)(this.data[0], "L"), - options: { height: this.guardHeight } - }); - - // Add the left side - result.push({ - data: (0, _encoder2.default)(this.data.substr(1, 5), "LLLLL"), - text: this.text.substr(1, 5), - options: { fontSize: this.fontSize } - }); - - // Add the middle bits - result.push({ - data: "01010", - options: { height: this.guardHeight } - }); - - // Add the right side - result.push({ - data: (0, _encoder2.default)(this.data.substr(6, 5), "RRRRR"), - text: this.text.substr(6, 5), - options: { fontSize: this.fontSize } - }); - - // Add the end bits - result.push({ - data: (0, _encoder2.default)(this.data[11], "R") + "101", - options: { height: this.guardHeight } - }); - - // Add the last digit - if (this.displayValue) { - result.push({ - data: "00000000", - text: this.text.substr(11, 1), - options: { textAlign: "right", fontSize: this.fontSize } - }); - } - - return result; - } - }]); - - return UPC; -}(_Barcode3.default); - -// Calulate the checksum digit -// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit - - -function checksum(number) { - var result = 0; - - var i; - for (i = 1; i < 11; i += 2) { - result += parseInt(number[i]); - } - for (i = 0; i < 11; i += 2) { - result += parseInt(number[i]) * 3; - } - - return (10 - result % 10) % 10; -} - -exports.default = UPC; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/UPCE.js b/node_modules/jsbarcode/bin/barcodes/EAN_UPC/UPCE.js deleted file mode 100644 index 2281492..0000000 --- a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/UPCE.js +++ /dev/null @@ -1,185 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _encoder = require('./encoder'); - -var _encoder2 = _interopRequireDefault(_encoder); - -var _Barcode2 = require('../Barcode.js'); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -var _UPC = require('./UPC.js'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: -// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding -// -// UPC-E documentation: -// https://en.wikipedia.org/wiki/Universal_Product_Code#UPC-E - -var EXPANSIONS = ["XX00000XXX", "XX10000XXX", "XX20000XXX", "XXX00000XX", "XXXX00000X", "XXXXX00005", "XXXXX00006", "XXXXX00007", "XXXXX00008", "XXXXX00009"]; - -var PARITIES = [["EEEOOO", "OOOEEE"], ["EEOEOO", "OOEOEE"], ["EEOOEO", "OOEEOE"], ["EEOOOE", "OOEEEO"], ["EOEEOO", "OEOOEE"], ["EOOEEO", "OEEOOE"], ["EOOOEE", "OEEEOO"], ["EOEOEO", "OEOEOE"], ["EOEOOE", "OEOEEO"], ["EOOEOE", "OEEOEO"]]; - -var UPCE = function (_Barcode) { - _inherits(UPCE, _Barcode); - - function UPCE(data, options) { - _classCallCheck(this, UPCE); - - var _this = _possibleConstructorReturn(this, (UPCE.__proto__ || Object.getPrototypeOf(UPCE)).call(this, data, options)); - // Code may be 6 or 8 digits; - // A 7 digit code is ambiguous as to whether the extra digit - // is a UPC-A check or number system digit. - - - _this.isValid = false; - if (data.search(/^[0-9]{6}$/) !== -1) { - _this.middleDigits = data; - _this.upcA = expandToUPCA(data, "0"); - _this.text = options.text || '' + _this.upcA[0] + data + _this.upcA[_this.upcA.length - 1]; - _this.isValid = true; - } else if (data.search(/^[01][0-9]{7}$/) !== -1) { - _this.middleDigits = data.substring(1, data.length - 1); - _this.upcA = expandToUPCA(_this.middleDigits, data[0]); - - if (_this.upcA[_this.upcA.length - 1] === data[data.length - 1]) { - _this.isValid = true; - } else { - // checksum mismatch - return _possibleConstructorReturn(_this); - } - } else { - return _possibleConstructorReturn(_this); - } - - _this.displayValue = options.displayValue; - - // Make sure the font is not bigger than the space between the guard bars - if (options.fontSize > options.width * 10) { - _this.fontSize = options.width * 10; - } else { - _this.fontSize = options.fontSize; - } - - // Make the guard bars go down half the way of the text - _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin; - return _this; - } - - _createClass(UPCE, [{ - key: 'valid', - value: function valid() { - return this.isValid; - } - }, { - key: 'encode', - value: function encode() { - if (this.options.flat) { - return this.flatEncoding(); - } else { - return this.guardedEncoding(); - } - } - }, { - key: 'flatEncoding', - value: function flatEncoding() { - var result = ""; - - result += "101"; - result += this.encodeMiddleDigits(); - result += "010101"; - - return { - data: result, - text: this.text - }; - } - }, { - key: 'guardedEncoding', - value: function guardedEncoding() { - var result = []; - - // Add the UPC-A number system digit beneath the quiet zone - if (this.displayValue) { - result.push({ - data: "00000000", - text: this.text[0], - options: { textAlign: "left", fontSize: this.fontSize } - }); - } - - // Add the guard bars - result.push({ - data: "101", - options: { height: this.guardHeight } - }); - - // Add the 6 UPC-E digits - result.push({ - data: this.encodeMiddleDigits(), - text: this.text.substring(1, 7), - options: { fontSize: this.fontSize } - }); - - // Add the end bits - result.push({ - data: "010101", - options: { height: this.guardHeight } - }); - - // Add the UPC-A check digit beneath the quiet zone - if (this.displayValue) { - result.push({ - data: "00000000", - text: this.text[7], - options: { textAlign: "right", fontSize: this.fontSize } - }); - } - - return result; - } - }, { - key: 'encodeMiddleDigits', - value: function encodeMiddleDigits() { - var numberSystem = this.upcA[0]; - var checkDigit = this.upcA[this.upcA.length - 1]; - var parity = PARITIES[parseInt(checkDigit)][parseInt(numberSystem)]; - return (0, _encoder2.default)(this.middleDigits, parity); - } - }]); - - return UPCE; -}(_Barcode3.default); - -function expandToUPCA(middleDigits, numberSystem) { - var lastUpcE = parseInt(middleDigits[middleDigits.length - 1]); - var expansion = EXPANSIONS[lastUpcE]; - - var result = ""; - var digitIndex = 0; - for (var i = 0; i < expansion.length; i++) { - var c = expansion[i]; - if (c === 'X') { - result += middleDigits[digitIndex++]; - } else { - result += c; - } - } - - result = '' + numberSystem + result; - return '' + result + (0, _UPC.checksum)(result); -} - -exports.default = UPCE; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/constants.js b/node_modules/jsbarcode/bin/barcodes/EAN_UPC/constants.js deleted file mode 100644 index b00aa62..0000000 --- a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/constants.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -// Standard start end and middle bits -var SIDE_BIN = exports.SIDE_BIN = '101'; -var MIDDLE_BIN = exports.MIDDLE_BIN = '01010'; - -var BINARIES = exports.BINARIES = { - 'L': [// The L (left) type of encoding - '0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011'], - 'G': [// The G type of encoding - '0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', '0010111'], - 'R': [// The R (right) type of encoding - '1110010', '1100110', '1101100', '1000010', '1011100', '1001110', '1010000', '1000100', '1001000', '1110100'], - 'O': [// The O (odd) encoding for UPC-E - '0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011'], - 'E': [// The E (even) encoding for UPC-E - '0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', '0010111'] -}; - -// Define the EAN-2 structure -var EAN2_STRUCTURE = exports.EAN2_STRUCTURE = ['LL', 'LG', 'GL', 'GG']; - -// Define the EAN-5 structure -var EAN5_STRUCTURE = exports.EAN5_STRUCTURE = ['GGLLL', 'GLGLL', 'GLLGL', 'GLLLG', 'LGGLL', 'LLGGL', 'LLLGG', 'LGLGL', 'LGLLG', 'LLGLG']; - -// Define the EAN-13 structure -var EAN13_STRUCTURE = exports.EAN13_STRUCTURE = ['LLLLLL', 'LLGLGG', 'LLGGLG', 'LLGGGL', 'LGLLGG', 'LGGLLG', 'LGGGLL', 'LGLGLG', 'LGLGGL', 'LGGLGL']; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/encoder.js b/node_modules/jsbarcode/bin/barcodes/EAN_UPC/encoder.js deleted file mode 100644 index 80d8932..0000000 --- a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/encoder.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _constants = require('./constants'); - -// Encode data string -var encode = function encode(data, structure, separator) { - var encoded = data.split('').map(function (val, idx) { - return _constants.BINARIES[structure[idx]]; - }).map(function (val, idx) { - return val ? val[data[idx]] : ''; - }); - - if (separator) { - var last = data.length - 1; - encoded = encoded.map(function (val, idx) { - return idx < last ? val + separator : val; - }); - } - - return encoded.join(''); -}; - -exports.default = encode; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/index.js b/node_modules/jsbarcode/bin/barcodes/EAN_UPC/index.js deleted file mode 100644 index ed0ae04..0000000 --- a/node_modules/jsbarcode/bin/barcodes/EAN_UPC/index.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UPCE = exports.UPC = exports.EAN2 = exports.EAN5 = exports.EAN8 = exports.EAN13 = undefined; - -var _EAN = require('./EAN13.js'); - -var _EAN2 = _interopRequireDefault(_EAN); - -var _EAN3 = require('./EAN8.js'); - -var _EAN4 = _interopRequireDefault(_EAN3); - -var _EAN5 = require('./EAN5.js'); - -var _EAN6 = _interopRequireDefault(_EAN5); - -var _EAN7 = require('./EAN2.js'); - -var _EAN8 = _interopRequireDefault(_EAN7); - -var _UPC = require('./UPC.js'); - -var _UPC2 = _interopRequireDefault(_UPC); - -var _UPCE = require('./UPCE.js'); - -var _UPCE2 = _interopRequireDefault(_UPCE); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.EAN13 = _EAN2.default; -exports.EAN8 = _EAN4.default; -exports.EAN5 = _EAN6.default; -exports.EAN2 = _EAN8.default; -exports.UPC = _UPC2.default; -exports.UPCE = _UPCE2.default; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/GenericBarcode/index.js b/node_modules/jsbarcode/bin/barcodes/GenericBarcode/index.js deleted file mode 100644 index 05c7e2d..0000000 --- a/node_modules/jsbarcode/bin/barcodes/GenericBarcode/index.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.GenericBarcode = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Barcode2 = require("../Barcode.js"); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var GenericBarcode = function (_Barcode) { - _inherits(GenericBarcode, _Barcode); - - function GenericBarcode(data, options) { - _classCallCheck(this, GenericBarcode); - - return _possibleConstructorReturn(this, (GenericBarcode.__proto__ || Object.getPrototypeOf(GenericBarcode)).call(this, data, options)); // Sets this.data and this.text - } - - // Return the corresponding binary numbers for the data provided - - - _createClass(GenericBarcode, [{ - key: "encode", - value: function encode() { - return { - data: "10101010101010101010101010101010101010101", - text: this.text - }; - } - - // Resturn true/false if the string provided is valid for this encoder - - }, { - key: "valid", - value: function valid() { - return true; - } - }]); - - return GenericBarcode; -}(_Barcode3.default); - -exports.GenericBarcode = GenericBarcode; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/ITF/ITF.js b/node_modules/jsbarcode/bin/barcodes/ITF/ITF.js deleted file mode 100644 index 10b6346..0000000 --- a/node_modules/jsbarcode/bin/barcodes/ITF/ITF.js +++ /dev/null @@ -1,69 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _constants = require('./constants'); - -var _Barcode2 = require('../Barcode'); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var ITF = function (_Barcode) { - _inherits(ITF, _Barcode); - - function ITF() { - _classCallCheck(this, ITF); - - return _possibleConstructorReturn(this, (ITF.__proto__ || Object.getPrototypeOf(ITF)).apply(this, arguments)); - } - - _createClass(ITF, [{ - key: 'valid', - value: function valid() { - return this.data.search(/^([0-9]{2})+$/) !== -1; - } - }, { - key: 'encode', - value: function encode() { - var _this2 = this; - - // Calculate all the digit pairs - var encoded = this.data.match(/.{2}/g).map(function (pair) { - return _this2.encodePair(pair); - }).join(''); - - return { - data: _constants.START_BIN + encoded + _constants.END_BIN, - text: this.text - }; - } - - // Calculate the data of a number pair - - }, { - key: 'encodePair', - value: function encodePair(pair) { - var second = _constants.BINARIES[pair[1]]; - - return _constants.BINARIES[pair[0]].split('').map(function (first, idx) { - return (first === '1' ? '111' : '1') + (second[idx] === '1' ? '000' : '0'); - }).join(''); - } - }]); - - return ITF; -}(_Barcode3.default); - -exports.default = ITF; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/ITF/ITF14.js b/node_modules/jsbarcode/bin/barcodes/ITF/ITF14.js deleted file mode 100644 index 75687df..0000000 --- a/node_modules/jsbarcode/bin/barcodes/ITF/ITF14.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _ITF2 = require('./ITF'); - -var _ITF3 = _interopRequireDefault(_ITF2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -// Calculate the checksum digit -var checksum = function checksum(data) { - var res = data.substr(0, 13).split('').map(function (num) { - return parseInt(num, 10); - }).reduce(function (sum, n, idx) { - return sum + n * (3 - idx % 2 * 2); - }, 0); - - return Math.ceil(res / 10) * 10 - res; -}; - -var ITF14 = function (_ITF) { - _inherits(ITF14, _ITF); - - function ITF14(data, options) { - _classCallCheck(this, ITF14); - - // Add checksum if it does not exist - if (data.search(/^[0-9]{13}$/) !== -1) { - data += checksum(data); - } - return _possibleConstructorReturn(this, (ITF14.__proto__ || Object.getPrototypeOf(ITF14)).call(this, data, options)); - } - - _createClass(ITF14, [{ - key: 'valid', - value: function valid() { - return this.data.search(/^[0-9]{14}$/) !== -1 && +this.data[13] === checksum(this.data); - } - }]); - - return ITF14; -}(_ITF3.default); - -exports.default = ITF14; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/ITF/constants.js b/node_modules/jsbarcode/bin/barcodes/ITF/constants.js deleted file mode 100644 index fede952..0000000 --- a/node_modules/jsbarcode/bin/barcodes/ITF/constants.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var START_BIN = exports.START_BIN = '1010'; -var END_BIN = exports.END_BIN = '11101'; - -var BINARIES = exports.BINARIES = ['00110', '10001', '01001', '11000', '00101', '10100', '01100', '00011', '10010', '01010']; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/ITF/index.js b/node_modules/jsbarcode/bin/barcodes/ITF/index.js deleted file mode 100644 index dd3945e..0000000 --- a/node_modules/jsbarcode/bin/barcodes/ITF/index.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ITF14 = exports.ITF = undefined; - -var _ITF = require('./ITF'); - -var _ITF2 = _interopRequireDefault(_ITF); - -var _ITF3 = require('./ITF14'); - -var _ITF4 = _interopRequireDefault(_ITF3); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.ITF = _ITF2.default; -exports.ITF14 = _ITF4.default; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/MSI/MSI.js b/node_modules/jsbarcode/bin/barcodes/MSI/MSI.js deleted file mode 100644 index d53f5e1..0000000 --- a/node_modules/jsbarcode/bin/barcodes/MSI/MSI.js +++ /dev/null @@ -1,74 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Barcode2 = require("../Barcode.js"); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation -// https://en.wikipedia.org/wiki/MSI_Barcode#Character_set_and_binary_lookup - -var MSI = function (_Barcode) { - _inherits(MSI, _Barcode); - - function MSI(data, options) { - _classCallCheck(this, MSI); - - return _possibleConstructorReturn(this, (MSI.__proto__ || Object.getPrototypeOf(MSI)).call(this, data, options)); - } - - _createClass(MSI, [{ - key: "encode", - value: function encode() { - // Start bits - var ret = "110"; - - for (var i = 0; i < this.data.length; i++) { - // Convert the character to binary (always 4 binary digits) - var digit = parseInt(this.data[i]); - var bin = digit.toString(2); - bin = addZeroes(bin, 4 - bin.length); - - // Add 100 for every zero and 110 for every 1 - for (var b = 0; b < bin.length; b++) { - ret += bin[b] == "0" ? "100" : "110"; - } - } - - // End bits - ret += "1001"; - - return { - data: ret, - text: this.text - }; - } - }, { - key: "valid", - value: function valid() { - return this.data.search(/^[0-9]+$/) !== -1; - } - }]); - - return MSI; -}(_Barcode3.default); - -function addZeroes(number, n) { - for (var i = 0; i < n; i++) { - number = "0" + number; - } - return number; -} - -exports.default = MSI; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/MSI/MSI10.js b/node_modules/jsbarcode/bin/barcodes/MSI/MSI10.js deleted file mode 100644 index fca0a5f..0000000 --- a/node_modules/jsbarcode/bin/barcodes/MSI/MSI10.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _MSI2 = require('./MSI.js'); - -var _MSI3 = _interopRequireDefault(_MSI2); - -var _checksums = require('./checksums.js'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var MSI10 = function (_MSI) { - _inherits(MSI10, _MSI); - - function MSI10(data, options) { - _classCallCheck(this, MSI10); - - return _possibleConstructorReturn(this, (MSI10.__proto__ || Object.getPrototypeOf(MSI10)).call(this, data + (0, _checksums.mod10)(data), options)); - } - - return MSI10; -}(_MSI3.default); - -exports.default = MSI10; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/MSI/MSI1010.js b/node_modules/jsbarcode/bin/barcodes/MSI/MSI1010.js deleted file mode 100644 index ea87f5b..0000000 --- a/node_modules/jsbarcode/bin/barcodes/MSI/MSI1010.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _MSI2 = require('./MSI.js'); - -var _MSI3 = _interopRequireDefault(_MSI2); - -var _checksums = require('./checksums.js'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var MSI1010 = function (_MSI) { - _inherits(MSI1010, _MSI); - - function MSI1010(data, options) { - _classCallCheck(this, MSI1010); - - data += (0, _checksums.mod10)(data); - data += (0, _checksums.mod10)(data); - return _possibleConstructorReturn(this, (MSI1010.__proto__ || Object.getPrototypeOf(MSI1010)).call(this, data, options)); - } - - return MSI1010; -}(_MSI3.default); - -exports.default = MSI1010; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/MSI/MSI11.js b/node_modules/jsbarcode/bin/barcodes/MSI/MSI11.js deleted file mode 100644 index 8b18dc7..0000000 --- a/node_modules/jsbarcode/bin/barcodes/MSI/MSI11.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _MSI2 = require('./MSI.js'); - -var _MSI3 = _interopRequireDefault(_MSI2); - -var _checksums = require('./checksums.js'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var MSI11 = function (_MSI) { - _inherits(MSI11, _MSI); - - function MSI11(data, options) { - _classCallCheck(this, MSI11); - - return _possibleConstructorReturn(this, (MSI11.__proto__ || Object.getPrototypeOf(MSI11)).call(this, data + (0, _checksums.mod11)(data), options)); - } - - return MSI11; -}(_MSI3.default); - -exports.default = MSI11; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/MSI/MSI1110.js b/node_modules/jsbarcode/bin/barcodes/MSI/MSI1110.js deleted file mode 100644 index d5f2ab3..0000000 --- a/node_modules/jsbarcode/bin/barcodes/MSI/MSI1110.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _MSI2 = require('./MSI.js'); - -var _MSI3 = _interopRequireDefault(_MSI2); - -var _checksums = require('./checksums.js'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var MSI1110 = function (_MSI) { - _inherits(MSI1110, _MSI); - - function MSI1110(data, options) { - _classCallCheck(this, MSI1110); - - data += (0, _checksums.mod11)(data); - data += (0, _checksums.mod10)(data); - return _possibleConstructorReturn(this, (MSI1110.__proto__ || Object.getPrototypeOf(MSI1110)).call(this, data, options)); - } - - return MSI1110; -}(_MSI3.default); - -exports.default = MSI1110; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/MSI/checksums.js b/node_modules/jsbarcode/bin/barcodes/MSI/checksums.js deleted file mode 100644 index 8314d6e..0000000 --- a/node_modules/jsbarcode/bin/barcodes/MSI/checksums.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.mod10 = mod10; -exports.mod11 = mod11; -function mod10(number) { - var sum = 0; - for (var i = 0; i < number.length; i++) { - var n = parseInt(number[i]); - if ((i + number.length) % 2 === 0) { - sum += n; - } else { - sum += n * 2 % 10 + Math.floor(n * 2 / 10); - } - } - return (10 - sum % 10) % 10; -} - -function mod11(number) { - var sum = 0; - var weights = [2, 3, 4, 5, 6, 7]; - for (var i = 0; i < number.length; i++) { - var n = parseInt(number[number.length - 1 - i]); - sum += weights[i % weights.length] * n; - } - return (11 - sum % 11) % 11; -} \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/MSI/index.js b/node_modules/jsbarcode/bin/barcodes/MSI/index.js deleted file mode 100644 index 8eb7e43..0000000 --- a/node_modules/jsbarcode/bin/barcodes/MSI/index.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.MSI1110 = exports.MSI1010 = exports.MSI11 = exports.MSI10 = exports.MSI = undefined; - -var _MSI = require('./MSI.js'); - -var _MSI2 = _interopRequireDefault(_MSI); - -var _MSI3 = require('./MSI10.js'); - -var _MSI4 = _interopRequireDefault(_MSI3); - -var _MSI5 = require('./MSI11.js'); - -var _MSI6 = _interopRequireDefault(_MSI5); - -var _MSI7 = require('./MSI1010.js'); - -var _MSI8 = _interopRequireDefault(_MSI7); - -var _MSI9 = require('./MSI1110.js'); - -var _MSI10 = _interopRequireDefault(_MSI9); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.MSI = _MSI2.default; -exports.MSI10 = _MSI4.default; -exports.MSI11 = _MSI6.default; -exports.MSI1010 = _MSI8.default; -exports.MSI1110 = _MSI10.default; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/codabar/index.js b/node_modules/jsbarcode/bin/barcodes/codabar/index.js deleted file mode 100644 index ca74bbe..0000000 --- a/node_modules/jsbarcode/bin/barcodes/codabar/index.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.codabar = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Barcode2 = require("../Barcode.js"); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding specification: -// http://www.barcodeisland.com/codabar.phtml - -var codabar = function (_Barcode) { - _inherits(codabar, _Barcode); - - function codabar(data, options) { - _classCallCheck(this, codabar); - - if (data.search(/^[0-9\-\$\:\.\+\/]+$/) === 0) { - data = "A" + data + "A"; - } - - var _this = _possibleConstructorReturn(this, (codabar.__proto__ || Object.getPrototypeOf(codabar)).call(this, data.toUpperCase(), options)); - - _this.text = _this.options.text || _this.text.replace(/[A-D]/g, ''); - return _this; - } - - _createClass(codabar, [{ - key: "valid", - value: function valid() { - return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) !== -1; - } - }, { - key: "encode", - value: function encode() { - var result = []; - var encodings = this.getEncodings(); - for (var i = 0; i < this.data.length; i++) { - result.push(encodings[this.data.charAt(i)]); - // for all characters except the last, append a narrow-space ("0") - if (i !== this.data.length - 1) { - result.push("0"); - } - } - return { - text: this.text, - data: result.join('') - }; - } - }, { - key: "getEncodings", - value: function getEncodings() { - return { - "0": "101010011", - "1": "101011001", - "2": "101001011", - "3": "110010101", - "4": "101101001", - "5": "110101001", - "6": "100101011", - "7": "100101101", - "8": "100110101", - "9": "110100101", - "-": "101001101", - "$": "101100101", - ":": "1101011011", - "/": "1101101011", - ".": "1101101101", - "+": "1011011011", - "A": "1011001001", - "B": "1001001011", - "C": "1010010011", - "D": "1010011001" - }; - } - }]); - - return codabar; -}(_Barcode3.default); - -exports.codabar = codabar; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/index.js b/node_modules/jsbarcode/bin/barcodes/index.js deleted file mode 100644 index 9874593..0000000 --- a/node_modules/jsbarcode/bin/barcodes/index.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _CODE = require('./CODE39/'); - -var _CODE2 = require('./CODE128/'); - -var _EAN_UPC = require('./EAN_UPC/'); - -var _ITF = require('./ITF/'); - -var _MSI = require('./MSI/'); - -var _pharmacode = require('./pharmacode/'); - -var _codabar = require('./codabar'); - -var _GenericBarcode = require('./GenericBarcode/'); - -exports.default = { - CODE39: _CODE.CODE39, - CODE128: _CODE2.CODE128, CODE128A: _CODE2.CODE128A, CODE128B: _CODE2.CODE128B, CODE128C: _CODE2.CODE128C, - EAN13: _EAN_UPC.EAN13, EAN8: _EAN_UPC.EAN8, EAN5: _EAN_UPC.EAN5, EAN2: _EAN_UPC.EAN2, UPC: _EAN_UPC.UPC, UPCE: _EAN_UPC.UPCE, - ITF14: _ITF.ITF14, - ITF: _ITF.ITF, - MSI: _MSI.MSI, MSI10: _MSI.MSI10, MSI11: _MSI.MSI11, MSI1010: _MSI.MSI1010, MSI1110: _MSI.MSI1110, - pharmacode: _pharmacode.pharmacode, - codabar: _codabar.codabar, - GenericBarcode: _GenericBarcode.GenericBarcode -}; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/index.tmp.js b/node_modules/jsbarcode/bin/barcodes/index.tmp.js deleted file mode 100644 index 9874593..0000000 --- a/node_modules/jsbarcode/bin/barcodes/index.tmp.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _CODE = require('./CODE39/'); - -var _CODE2 = require('./CODE128/'); - -var _EAN_UPC = require('./EAN_UPC/'); - -var _ITF = require('./ITF/'); - -var _MSI = require('./MSI/'); - -var _pharmacode = require('./pharmacode/'); - -var _codabar = require('./codabar'); - -var _GenericBarcode = require('./GenericBarcode/'); - -exports.default = { - CODE39: _CODE.CODE39, - CODE128: _CODE2.CODE128, CODE128A: _CODE2.CODE128A, CODE128B: _CODE2.CODE128B, CODE128C: _CODE2.CODE128C, - EAN13: _EAN_UPC.EAN13, EAN8: _EAN_UPC.EAN8, EAN5: _EAN_UPC.EAN5, EAN2: _EAN_UPC.EAN2, UPC: _EAN_UPC.UPC, UPCE: _EAN_UPC.UPCE, - ITF14: _ITF.ITF14, - ITF: _ITF.ITF, - MSI: _MSI.MSI, MSI10: _MSI.MSI10, MSI11: _MSI.MSI11, MSI1010: _MSI.MSI1010, MSI1110: _MSI.MSI1110, - pharmacode: _pharmacode.pharmacode, - codabar: _codabar.codabar, - GenericBarcode: _GenericBarcode.GenericBarcode -}; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/barcodes/pharmacode/index.js b/node_modules/jsbarcode/bin/barcodes/pharmacode/index.js deleted file mode 100644 index 243794a..0000000 --- a/node_modules/jsbarcode/bin/barcodes/pharmacode/index.js +++ /dev/null @@ -1,73 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.pharmacode = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Barcode2 = require("../Barcode.js"); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation -// http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf - -var pharmacode = function (_Barcode) { - _inherits(pharmacode, _Barcode); - - function pharmacode(data, options) { - _classCallCheck(this, pharmacode); - - var _this = _possibleConstructorReturn(this, (pharmacode.__proto__ || Object.getPrototypeOf(pharmacode)).call(this, data, options)); - - _this.number = parseInt(data, 10); - return _this; - } - - _createClass(pharmacode, [{ - key: "encode", - value: function encode() { - var z = this.number; - var result = ""; - - // http://i.imgur.com/RMm4UDJ.png - // (source: http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf, page: 34) - while (!isNaN(z) && z != 0) { - if (z % 2 === 0) { - // Even - result = "11100" + result; - z = (z - 2) / 2; - } else { - // Odd - result = "100" + result; - z = (z - 1) / 2; - } - } - - // Remove the two last zeroes - result = result.slice(0, -2); - - return { - data: result, - text: this.text - }; - } - }, { - key: "valid", - value: function valid() { - return this.number >= 3 && this.number <= 131070; - } - }]); - - return pharmacode; -}(_Barcode3.default); - -exports.pharmacode = pharmacode; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/exceptions/ErrorHandler.js b/node_modules/jsbarcode/bin/exceptions/ErrorHandler.js deleted file mode 100644 index 729ab28..0000000 --- a/node_modules/jsbarcode/bin/exceptions/ErrorHandler.js +++ /dev/null @@ -1,54 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -/*eslint no-console: 0 */ - -var ErrorHandler = function () { - function ErrorHandler(api) { - _classCallCheck(this, ErrorHandler); - - this.api = api; - } - - _createClass(ErrorHandler, [{ - key: "handleCatch", - value: function handleCatch(e) { - // If babel supported extending of Error in a correct way instanceof would be used here - if (e.name === "InvalidInputException") { - if (this.api._options.valid !== this.api._defaults.valid) { - this.api._options.valid(false); - } else { - throw e.message; - } - } else { - throw e; - } - - this.api.render = function () {}; - } - }, { - key: "wrapBarcodeCall", - value: function wrapBarcodeCall(func) { - try { - var result = func.apply(undefined, arguments); - this.api._options.valid(true); - return result; - } catch (e) { - this.handleCatch(e); - - return this.api; - } - } - }]); - - return ErrorHandler; -}(); - -exports.default = ErrorHandler; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/exceptions/exceptions.js b/node_modules/jsbarcode/bin/exceptions/exceptions.js deleted file mode 100644 index 9919c5a..0000000 --- a/node_modules/jsbarcode/bin/exceptions/exceptions.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var InvalidInputException = function (_Error) { - _inherits(InvalidInputException, _Error); - - function InvalidInputException(symbology, input) { - _classCallCheck(this, InvalidInputException); - - var _this = _possibleConstructorReturn(this, (InvalidInputException.__proto__ || Object.getPrototypeOf(InvalidInputException)).call(this)); - - _this.name = "InvalidInputException"; - - _this.symbology = symbology; - _this.input = input; - - _this.message = '"' + _this.input + '" is not a valid input for ' + _this.symbology; - return _this; - } - - return InvalidInputException; -}(Error); - -var InvalidElementException = function (_Error2) { - _inherits(InvalidElementException, _Error2); - - function InvalidElementException() { - _classCallCheck(this, InvalidElementException); - - var _this2 = _possibleConstructorReturn(this, (InvalidElementException.__proto__ || Object.getPrototypeOf(InvalidElementException)).call(this)); - - _this2.name = "InvalidElementException"; - _this2.message = "Not supported type to render on"; - return _this2; - } - - return InvalidElementException; -}(Error); - -var NoElementException = function (_Error3) { - _inherits(NoElementException, _Error3); - - function NoElementException() { - _classCallCheck(this, NoElementException); - - var _this3 = _possibleConstructorReturn(this, (NoElementException.__proto__ || Object.getPrototypeOf(NoElementException)).call(this)); - - _this3.name = "NoElementException"; - _this3.message = "No element to render on."; - return _this3; - } - - return NoElementException; -}(Error); - -exports.InvalidInputException = InvalidInputException; -exports.InvalidElementException = InvalidElementException; -exports.NoElementException = NoElementException; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/help/fixOptions.js b/node_modules/jsbarcode/bin/help/fixOptions.js deleted file mode 100644 index da65887..0000000 --- a/node_modules/jsbarcode/bin/help/fixOptions.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = fixOptions; - - -function fixOptions(options) { - // Fix the margins - options.marginTop = options.marginTop || options.margin; - options.marginBottom = options.marginBottom || options.margin; - options.marginRight = options.marginRight || options.margin; - options.marginLeft = options.marginLeft || options.margin; - - return options; -} \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/help/getOptionsFromElement.js b/node_modules/jsbarcode/bin/help/getOptionsFromElement.js deleted file mode 100644 index 2a6f5a1..0000000 --- a/node_modules/jsbarcode/bin/help/getOptionsFromElement.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _optionsFromStrings = require("./optionsFromStrings.js"); - -var _optionsFromStrings2 = _interopRequireDefault(_optionsFromStrings); - -var _defaults = require("../options/defaults.js"); - -var _defaults2 = _interopRequireDefault(_defaults); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function getOptionsFromElement(element) { - var options = {}; - for (var property in _defaults2.default) { - if (_defaults2.default.hasOwnProperty(property)) { - // jsbarcode-* - if (element.hasAttribute("jsbarcode-" + property.toLowerCase())) { - options[property] = element.getAttribute("jsbarcode-" + property.toLowerCase()); - } - - // data-* - if (element.hasAttribute("data-" + property.toLowerCase())) { - options[property] = element.getAttribute("data-" + property.toLowerCase()); - } - } - } - - options["value"] = element.getAttribute("jsbarcode-value") || element.getAttribute("data-value"); - - // Since all atributes are string they need to be converted to integers - options = (0, _optionsFromStrings2.default)(options); - - return options; -} - -exports.default = getOptionsFromElement; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/help/getRenderProperties.js b/node_modules/jsbarcode/bin/help/getRenderProperties.js deleted file mode 100644 index 3807d9e..0000000 --- a/node_modules/jsbarcode/bin/help/getRenderProperties.js +++ /dev/null @@ -1,108 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /* global HTMLImageElement */ -/* global HTMLCanvasElement */ -/* global SVGElement */ - -var _getOptionsFromElement = require("./getOptionsFromElement.js"); - -var _getOptionsFromElement2 = _interopRequireDefault(_getOptionsFromElement); - -var _renderers = require("../renderers"); - -var _renderers2 = _interopRequireDefault(_renderers); - -var _exceptions = require("../exceptions/exceptions.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// Takes an element and returns an object with information about how -// it should be rendered -// This could also return an array with these objects -// { -// element: The element that the renderer should draw on -// renderer: The name of the renderer -// afterRender (optional): If something has to done after the renderer -// completed, calls afterRender (function) -// options (optional): Options that can be defined in the element -// } - -function getRenderProperties(element) { - // If the element is a string, query select call again - if (typeof element === "string") { - return querySelectedRenderProperties(element); - } - // If element is array. Recursivly call with every object in the array - else if (Array.isArray(element)) { - var returnArray = []; - for (var i = 0; i < element.length; i++) { - returnArray.push(getRenderProperties(element[i])); - } - return returnArray; - } - // If element, render on canvas and set the uri as src - else if (typeof HTMLCanvasElement !== 'undefined' && element instanceof HTMLImageElement) { - return newCanvasRenderProperties(element); - } - // If SVG - else if (element && element.nodeName && element.nodeName.toLowerCase() === 'svg' || typeof SVGElement !== 'undefined' && element instanceof SVGElement) { - return { - element: element, - options: (0, _getOptionsFromElement2.default)(element), - renderer: _renderers2.default.SVGRenderer - }; - } - // If canvas (in browser) - else if (typeof HTMLCanvasElement !== 'undefined' && element instanceof HTMLCanvasElement) { - return { - element: element, - options: (0, _getOptionsFromElement2.default)(element), - renderer: _renderers2.default.CanvasRenderer - }; - } - // If canvas (in node) - else if (element && element.getContext) { - return { - element: element, - renderer: _renderers2.default.CanvasRenderer - }; - } else if (element && (typeof element === "undefined" ? "undefined" : _typeof(element)) === 'object' && !element.nodeName) { - return { - element: element, - renderer: _renderers2.default.ObjectRenderer - }; - } else { - throw new _exceptions.InvalidElementException(); - } -} - -function querySelectedRenderProperties(string) { - var selector = document.querySelectorAll(string); - if (selector.length === 0) { - return undefined; - } else { - var returnArray = []; - for (var i = 0; i < selector.length; i++) { - returnArray.push(getRenderProperties(selector[i])); - } - return returnArray; - } -} - -function newCanvasRenderProperties(imgElement) { - var canvas = document.createElement('canvas'); - return { - element: canvas, - options: (0, _getOptionsFromElement2.default)(imgElement), - renderer: _renderers2.default.CanvasRenderer, - afterRender: function afterRender() { - imgElement.setAttribute("src", canvas.toDataURL()); - } - }; -} - -exports.default = getRenderProperties; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/help/linearizeEncodings.js b/node_modules/jsbarcode/bin/help/linearizeEncodings.js deleted file mode 100644 index 8da0616..0000000 --- a/node_modules/jsbarcode/bin/help/linearizeEncodings.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = linearizeEncodings; - -// Encodings can be nestled like [[1-1, 1-2], 2, [3-1, 3-2] -// Convert to [1-1, 1-2, 2, 3-1, 3-2] - -function linearizeEncodings(encodings) { - var linearEncodings = []; - function nextLevel(encoded) { - if (Array.isArray(encoded)) { - for (var i = 0; i < encoded.length; i++) { - nextLevel(encoded[i]); - } - } else { - encoded.text = encoded.text || ""; - encoded.data = encoded.data || ""; - linearEncodings.push(encoded); - } - } - nextLevel(encodings); - - return linearEncodings; -} \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/help/merge.js b/node_modules/jsbarcode/bin/help/merge.js deleted file mode 100644 index f60623d..0000000 --- a/node_modules/jsbarcode/bin/help/merge.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -exports.default = function (old, replaceObj) { - return _extends({}, old, replaceObj); -}; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/help/optionsFromStrings.js b/node_modules/jsbarcode/bin/help/optionsFromStrings.js deleted file mode 100644 index bc18336..0000000 --- a/node_modules/jsbarcode/bin/help/optionsFromStrings.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = optionsFromStrings; - -// Convert string to integers/booleans where it should be - -function optionsFromStrings(options) { - var intOptions = ["width", "height", "textMargin", "fontSize", "margin", "marginTop", "marginBottom", "marginLeft", "marginRight"]; - - for (var intOption in intOptions) { - if (intOptions.hasOwnProperty(intOption)) { - intOption = intOptions[intOption]; - if (typeof options[intOption] === "string") { - options[intOption] = parseInt(options[intOption], 10); - } - } - } - - if (typeof options["displayValue"] === "string") { - options["displayValue"] = options["displayValue"] != "false"; - } - - return options; -} \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/options/defaults.js b/node_modules/jsbarcode/bin/options/defaults.js deleted file mode 100644 index f546b8a..0000000 --- a/node_modules/jsbarcode/bin/options/defaults.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var defaults = { - width: 2, - height: 100, - format: "auto", - displayValue: true, - fontOptions: "", - font: "monospace", - text: undefined, - textAlign: "center", - textPosition: "bottom", - textMargin: 2, - fontSize: 20, - background: "#ffffff", - lineColor: "#000000", - margin: 10, - marginTop: undefined, - marginBottom: undefined, - marginLeft: undefined, - marginRight: undefined, - valid: function valid() {} -}; - -exports.default = defaults; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/renderers/canvas.js b/node_modules/jsbarcode/bin/renderers/canvas.js deleted file mode 100644 index df9185f..0000000 --- a/node_modules/jsbarcode/bin/renderers/canvas.js +++ /dev/null @@ -1,158 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _merge = require("../help/merge.js"); - -var _merge2 = _interopRequireDefault(_merge); - -var _shared = require("./shared.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var CanvasRenderer = function () { - function CanvasRenderer(canvas, encodings, options) { - _classCallCheck(this, CanvasRenderer); - - this.canvas = canvas; - this.encodings = encodings; - this.options = options; - } - - _createClass(CanvasRenderer, [{ - key: "render", - value: function render() { - // Abort if the browser does not support HTML5 canvas - if (!this.canvas.getContext) { - throw new Error('The browser does not support canvas.'); - } - - this.prepareCanvas(); - for (var i = 0; i < this.encodings.length; i++) { - var encodingOptions = (0, _merge2.default)(this.options, this.encodings[i].options); - - this.drawCanvasBarcode(encodingOptions, this.encodings[i]); - this.drawCanvasText(encodingOptions, this.encodings[i]); - - this.moveCanvasDrawing(this.encodings[i]); - } - - this.restoreCanvas(); - } - }, { - key: "prepareCanvas", - value: function prepareCanvas() { - // Get the canvas context - var ctx = this.canvas.getContext("2d"); - - ctx.save(); - - (0, _shared.calculateEncodingAttributes)(this.encodings, this.options, ctx); - var totalWidth = (0, _shared.getTotalWidthOfEncodings)(this.encodings); - var maxHeight = (0, _shared.getMaximumHeightOfEncodings)(this.encodings); - - this.canvas.width = totalWidth + this.options.marginLeft + this.options.marginRight; - - this.canvas.height = maxHeight; - - // Paint the canvas - ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); - if (this.options.background) { - ctx.fillStyle = this.options.background; - ctx.fillRect(0, 0, this.canvas.width, this.canvas.height); - } - - ctx.translate(this.options.marginLeft, 0); - } - }, { - key: "drawCanvasBarcode", - value: function drawCanvasBarcode(options, encoding) { - // Get the canvas context - var ctx = this.canvas.getContext("2d"); - - var binary = encoding.data; - - // Creates the barcode out of the encoded binary - var yFrom; - if (options.textPosition == "top") { - yFrom = options.marginTop + options.fontSize + options.textMargin; - } else { - yFrom = options.marginTop; - } - - ctx.fillStyle = options.lineColor; - - for (var b = 0; b < binary.length; b++) { - var x = b * options.width + encoding.barcodePadding; - - if (binary[b] === "1") { - ctx.fillRect(x, yFrom, options.width, options.height); - } else if (binary[b]) { - ctx.fillRect(x, yFrom, options.width, options.height * binary[b]); - } - } - } - }, { - key: "drawCanvasText", - value: function drawCanvasText(options, encoding) { - // Get the canvas context - var ctx = this.canvas.getContext("2d"); - - var font = options.fontOptions + " " + options.fontSize + "px " + options.font; - - // Draw the text if displayValue is set - if (options.displayValue) { - var x, y; - - if (options.textPosition == "top") { - y = options.marginTop + options.fontSize - options.textMargin; - } else { - y = options.height + options.textMargin + options.marginTop + options.fontSize; - } - - ctx.font = font; - - // Draw the text in the correct X depending on the textAlign option - if (options.textAlign == "left" || encoding.barcodePadding > 0) { - x = 0; - ctx.textAlign = 'left'; - } else if (options.textAlign == "right") { - x = encoding.width - 1; - ctx.textAlign = 'right'; - } - // In all other cases, center the text - else { - x = encoding.width / 2; - ctx.textAlign = 'center'; - } - - ctx.fillText(encoding.text, x, y); - } - } - }, { - key: "moveCanvasDrawing", - value: function moveCanvasDrawing(encoding) { - var ctx = this.canvas.getContext("2d"); - - ctx.translate(encoding.width, 0); - } - }, { - key: "restoreCanvas", - value: function restoreCanvas() { - // Get the canvas context - var ctx = this.canvas.getContext("2d"); - - ctx.restore(); - } - }]); - - return CanvasRenderer; -}(); - -exports.default = CanvasRenderer; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/renderers/index.js b/node_modules/jsbarcode/bin/renderers/index.js deleted file mode 100644 index 7ad8fa6..0000000 --- a/node_modules/jsbarcode/bin/renderers/index.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _canvas = require('./canvas.js'); - -var _canvas2 = _interopRequireDefault(_canvas); - -var _svg = require('./svg.js'); - -var _svg2 = _interopRequireDefault(_svg); - -var _object = require('./object.js'); - -var _object2 = _interopRequireDefault(_object); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = { CanvasRenderer: _canvas2.default, SVGRenderer: _svg2.default, ObjectRenderer: _object2.default }; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/renderers/object.js b/node_modules/jsbarcode/bin/renderers/object.js deleted file mode 100644 index 605f751..0000000 --- a/node_modules/jsbarcode/bin/renderers/object.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var ObjectRenderer = function () { - function ObjectRenderer(object, encodings, options) { - _classCallCheck(this, ObjectRenderer); - - this.object = object; - this.encodings = encodings; - this.options = options; - } - - _createClass(ObjectRenderer, [{ - key: "render", - value: function render() { - this.object.encodings = this.encodings; - } - }]); - - return ObjectRenderer; -}(); - -exports.default = ObjectRenderer; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/renderers/shared.js b/node_modules/jsbarcode/bin/renderers/shared.js deleted file mode 100644 index 367f97d..0000000 --- a/node_modules/jsbarcode/bin/renderers/shared.js +++ /dev/null @@ -1,101 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getTotalWidthOfEncodings = exports.calculateEncodingAttributes = exports.getBarcodePadding = exports.getEncodingHeight = exports.getMaximumHeightOfEncodings = undefined; - -var _merge = require("../help/merge.js"); - -var _merge2 = _interopRequireDefault(_merge); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function getEncodingHeight(encoding, options) { - return options.height + (options.displayValue && encoding.text.length > 0 ? options.fontSize + options.textMargin : 0) + options.marginTop + options.marginBottom; -} - -function getBarcodePadding(textWidth, barcodeWidth, options) { - if (options.displayValue && barcodeWidth < textWidth) { - if (options.textAlign == "center") { - return Math.floor((textWidth - barcodeWidth) / 2); - } else if (options.textAlign == "left") { - return 0; - } else if (options.textAlign == "right") { - return Math.floor(textWidth - barcodeWidth); - } - } - return 0; -} - -function calculateEncodingAttributes(encodings, barcodeOptions, context) { - for (var i = 0; i < encodings.length; i++) { - var encoding = encodings[i]; - var options = (0, _merge2.default)(barcodeOptions, encoding.options); - - // Calculate the width of the encoding - var textWidth; - if (options.displayValue) { - textWidth = messureText(encoding.text, options, context); - } else { - textWidth = 0; - } - - var barcodeWidth = encoding.data.length * options.width; - encoding.width = Math.ceil(Math.max(textWidth, barcodeWidth)); - - encoding.height = getEncodingHeight(encoding, options); - - encoding.barcodePadding = getBarcodePadding(textWidth, barcodeWidth, options); - } -} - -function getTotalWidthOfEncodings(encodings) { - var totalWidth = 0; - for (var i = 0; i < encodings.length; i++) { - totalWidth += encodings[i].width; - } - return totalWidth; -} - -function getMaximumHeightOfEncodings(encodings) { - var maxHeight = 0; - for (var i = 0; i < encodings.length; i++) { - if (encodings[i].height > maxHeight) { - maxHeight = encodings[i].height; - } - } - return maxHeight; -} - -function messureText(string, options, context) { - var ctx; - - if (context) { - ctx = context; - } else if (typeof document !== "undefined") { - ctx = document.createElement("canvas").getContext("2d"); - } else { - // If the text cannot be messured we will return 0. - // This will make some barcode with big text render incorrectly - return 0; - } - ctx.font = options.fontOptions + " " + options.fontSize + "px " + options.font; - - // Calculate the width of the encoding - var measureTextResult = ctx.measureText(string); - if (!measureTextResult) { - // Some implementations don't implement measureText and return undefined. - // If the text cannot be measured we will return 0. - // This will make some barcode with big text render incorrectly - return 0; - } - var size = measureTextResult.width; - return size; -} - -exports.getMaximumHeightOfEncodings = getMaximumHeightOfEncodings; -exports.getEncodingHeight = getEncodingHeight; -exports.getBarcodePadding = getBarcodePadding; -exports.calculateEncodingAttributes = calculateEncodingAttributes; -exports.getTotalWidthOfEncodings = getTotalWidthOfEncodings; \ No newline at end of file diff --git a/node_modules/jsbarcode/bin/renderers/svg.js b/node_modules/jsbarcode/bin/renderers/svg.js deleted file mode 100644 index 2da731a..0000000 --- a/node_modules/jsbarcode/bin/renderers/svg.js +++ /dev/null @@ -1,189 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _merge = require("../help/merge.js"); - -var _merge2 = _interopRequireDefault(_merge); - -var _shared = require("./shared.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var svgns = "http://www.w3.org/2000/svg"; - -var SVGRenderer = function () { - function SVGRenderer(svg, encodings, options) { - _classCallCheck(this, SVGRenderer); - - this.svg = svg; - this.encodings = encodings; - this.options = options; - this.document = options.xmlDocument || document; - } - - _createClass(SVGRenderer, [{ - key: "render", - value: function render() { - var currentX = this.options.marginLeft; - - this.prepareSVG(); - for (var i = 0; i < this.encodings.length; i++) { - var encoding = this.encodings[i]; - var encodingOptions = (0, _merge2.default)(this.options, encoding.options); - - var group = this.createGroup(currentX, encodingOptions.marginTop, this.svg); - - this.setGroupOptions(group, encodingOptions); - - this.drawSvgBarcode(group, encodingOptions, encoding); - this.drawSVGText(group, encodingOptions, encoding); - - currentX += encoding.width; - } - } - }, { - key: "prepareSVG", - value: function prepareSVG() { - // Clear the SVG - while (this.svg.firstChild) { - this.svg.removeChild(this.svg.firstChild); - } - - (0, _shared.calculateEncodingAttributes)(this.encodings, this.options); - var totalWidth = (0, _shared.getTotalWidthOfEncodings)(this.encodings); - var maxHeight = (0, _shared.getMaximumHeightOfEncodings)(this.encodings); - - var width = totalWidth + this.options.marginLeft + this.options.marginRight; - this.setSvgAttributes(width, maxHeight); - - if (this.options.background) { - this.drawRect(0, 0, width, maxHeight, this.svg).setAttribute("style", "fill:" + this.options.background + ";"); - } - } - }, { - key: "drawSvgBarcode", - value: function drawSvgBarcode(parent, options, encoding) { - var binary = encoding.data; - - // Creates the barcode out of the encoded binary - var yFrom; - if (options.textPosition == "top") { - yFrom = options.fontSize + options.textMargin; - } else { - yFrom = 0; - } - - var barWidth = 0; - var x = 0; - for (var b = 0; b < binary.length; b++) { - x = b * options.width + encoding.barcodePadding; - - if (binary[b] === "1") { - barWidth++; - } else if (barWidth > 0) { - this.drawRect(x - options.width * barWidth, yFrom, options.width * barWidth, options.height, parent); - barWidth = 0; - } - } - - // Last draw is needed since the barcode ends with 1 - if (barWidth > 0) { - this.drawRect(x - options.width * (barWidth - 1), yFrom, options.width * barWidth, options.height, parent); - } - } - }, { - key: "drawSVGText", - value: function drawSVGText(parent, options, encoding) { - var textElem = this.document.createElementNS(svgns, 'text'); - - // Draw the text if displayValue is set - if (options.displayValue) { - var x, y; - - textElem.setAttribute("style", "font:" + options.fontOptions + " " + options.fontSize + "px " + options.font); - - if (options.textPosition == "top") { - y = options.fontSize - options.textMargin; - } else { - y = options.height + options.textMargin + options.fontSize; - } - - // Draw the text in the correct X depending on the textAlign option - if (options.textAlign == "left" || encoding.barcodePadding > 0) { - x = 0; - textElem.setAttribute("text-anchor", "start"); - } else if (options.textAlign == "right") { - x = encoding.width - 1; - textElem.setAttribute("text-anchor", "end"); - } - // In all other cases, center the text - else { - x = encoding.width / 2; - textElem.setAttribute("text-anchor", "middle"); - } - - textElem.setAttribute("x", x); - textElem.setAttribute("y", y); - - textElem.appendChild(this.document.createTextNode(encoding.text)); - - parent.appendChild(textElem); - } - } - }, { - key: "setSvgAttributes", - value: function setSvgAttributes(width, height) { - var svg = this.svg; - svg.setAttribute("width", width + "px"); - svg.setAttribute("height", height + "px"); - svg.setAttribute("x", "0px"); - svg.setAttribute("y", "0px"); - svg.setAttribute("viewBox", "0 0 " + width + " " + height); - - svg.setAttribute("xmlns", svgns); - svg.setAttribute("version", "1.1"); - - svg.setAttribute("style", "transform: translate(0,0)"); - } - }, { - key: "createGroup", - value: function createGroup(x, y, parent) { - var group = this.document.createElementNS(svgns, 'g'); - group.setAttribute("transform", "translate(" + x + ", " + y + ")"); - - parent.appendChild(group); - - return group; - } - }, { - key: "setGroupOptions", - value: function setGroupOptions(group, options) { - group.setAttribute("style", "fill:" + options.lineColor + ";"); - } - }, { - key: "drawRect", - value: function drawRect(x, y, width, height, parent) { - var rect = this.document.createElementNS(svgns, 'rect'); - - rect.setAttribute("x", x); - rect.setAttribute("y", y); - rect.setAttribute("width", width); - rect.setAttribute("height", height); - - parent.appendChild(rect); - - return rect; - } - }]); - - return SVGRenderer; -}(); - -exports.default = SVGRenderer; \ No newline at end of file diff --git a/node_modules/jsbarcode/bower.json b/node_modules/jsbarcode/bower.json deleted file mode 100644 index c14eda5..0000000 --- a/node_modules/jsbarcode/bower.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "JsBarcode", - "main": "dist/JsBarcode.all.min.js", - "version": "3.11.5", - "homepage": "https://github.com/lindell/JsBarcode", - "authors": [ - "Johan Lindell " - ], - "description": "JsBarcode is a simple way to create different types of 1d barcodes.", - "repository": { - "type": "git", - "url": "git://github.com/lindell/JsBarcode" - }, - "moduleType": [ - "globals" - ], - "keywords": [ - "barcode", - "canvas", - "code128", - "upc", - "ean", - "itf", - "msi", - "pharmacode" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ] -} diff --git a/node_modules/jsbarcode/dist/JsBarcode.all.js b/node_modules/jsbarcode/dist/JsBarcode.all.js deleted file mode 100644 index 759153b..0000000 --- a/node_modules/jsbarcode/dist/JsBarcode.all.js +++ /dev/null @@ -1,3670 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _barcodes = __webpack_require__(1); - -var _barcodes2 = _interopRequireDefault(_barcodes); - -var _merge = __webpack_require__(36); - -var _merge2 = _interopRequireDefault(_merge); - -var _linearizeEncodings = __webpack_require__(37); - -var _linearizeEncodings2 = _interopRequireDefault(_linearizeEncodings); - -var _fixOptions = __webpack_require__(38); - -var _fixOptions2 = _interopRequireDefault(_fixOptions); - -var _getRenderProperties = __webpack_require__(39); - -var _getRenderProperties2 = _interopRequireDefault(_getRenderProperties); - -var _optionsFromStrings = __webpack_require__(41); - -var _optionsFromStrings2 = _interopRequireDefault(_optionsFromStrings); - -var _ErrorHandler = __webpack_require__(49); - -var _ErrorHandler2 = _interopRequireDefault(_ErrorHandler); - -var _exceptions = __webpack_require__(48); - -var _defaults = __webpack_require__(42); - -var _defaults2 = _interopRequireDefault(_defaults); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// The protype of the object returned from the JsBarcode() call - - -// Help functions -var API = function API() {}; - -// The first call of the library API -// Will return an object with all barcodes calls and the data that is used -// by the renderers - - -// Default values - - -// Exceptions -// Import all the barcodes -var JsBarcode = function JsBarcode(element, text, options) { - var api = new API(); - - if (typeof element === "undefined") { - throw Error("No element to render on was provided."); - } - - // Variables that will be pased through the API calls - api._renderProperties = (0, _getRenderProperties2.default)(element); - api._encodings = []; - api._options = _defaults2.default; - api._errorHandler = new _ErrorHandler2.default(api); - - // If text is set, use the simple syntax (render the barcode directly) - if (typeof text !== "undefined") { - options = options || {}; - - if (!options.format) { - options.format = autoSelectBarcode(); - } - - api.options(options)[options.format](text, options).render(); - } - - return api; -}; - -// To make tests work TODO: remove -JsBarcode.getModule = function (name) { - return _barcodes2.default[name]; -}; - -// Register all barcodes -for (var name in _barcodes2.default) { - if (_barcodes2.default.hasOwnProperty(name)) { - // Security check if the propery is a prototype property - registerBarcode(_barcodes2.default, name); - } -} -function registerBarcode(barcodes, name) { - API.prototype[name] = API.prototype[name.toUpperCase()] = API.prototype[name.toLowerCase()] = function (text, options) { - var api = this; - return api._errorHandler.wrapBarcodeCall(function () { - // Ensure text is options.text - options.text = typeof options.text === 'undefined' ? undefined : '' + options.text; - - var newOptions = (0, _merge2.default)(api._options, options); - newOptions = (0, _optionsFromStrings2.default)(newOptions); - var Encoder = barcodes[name]; - var encoded = encode(text, Encoder, newOptions); - api._encodings.push(encoded); - - return api; - }); - }; -} - -// encode() handles the Encoder call and builds the binary string to be rendered -function encode(text, Encoder, options) { - // Ensure that text is a string - text = "" + text; - - var encoder = new Encoder(text, options); - - // If the input is not valid for the encoder, throw error. - // If the valid callback option is set, call it instead of throwing error - if (!encoder.valid()) { - throw new _exceptions.InvalidInputException(encoder.constructor.name, text); - } - - // Make a request for the binary data (and other infromation) that should be rendered - var encoded = encoder.encode(); - - // Encodings can be nestled like [[1-1, 1-2], 2, [3-1, 3-2] - // Convert to [1-1, 1-2, 2, 3-1, 3-2] - encoded = (0, _linearizeEncodings2.default)(encoded); - - // Merge - for (var i = 0; i < encoded.length; i++) { - encoded[i].options = (0, _merge2.default)(options, encoded[i].options); - } - - return encoded; -} - -function autoSelectBarcode() { - // If CODE128 exists. Use it - if (_barcodes2.default["CODE128"]) { - return "CODE128"; - } - - // Else, take the first (probably only) barcode - return Object.keys(_barcodes2.default)[0]; -} - -// Sets global encoder options -// Added to the api by the JsBarcode function -API.prototype.options = function (options) { - this._options = (0, _merge2.default)(this._options, options); - return this; -}; - -// Will create a blank space (usually in between barcodes) -API.prototype.blank = function (size) { - var zeroes = new Array(size + 1).join("0"); - this._encodings.push({ data: zeroes }); - return this; -}; - -// Initialize JsBarcode on all HTML elements defined. -API.prototype.init = function () { - // Should do nothing if no elements where found - if (!this._renderProperties) { - return; - } - - // Make sure renderProperies is an array - if (!Array.isArray(this._renderProperties)) { - this._renderProperties = [this._renderProperties]; - } - - var renderProperty; - for (var i in this._renderProperties) { - renderProperty = this._renderProperties[i]; - var options = (0, _merge2.default)(this._options, renderProperty.options); - - if (options.format == "auto") { - options.format = autoSelectBarcode(); - } - - this._errorHandler.wrapBarcodeCall(function () { - var text = options.value; - var Encoder = _barcodes2.default[options.format.toUpperCase()]; - var encoded = encode(text, Encoder, options); - - render(renderProperty, encoded, options); - }); - } -}; - -// The render API call. Calls the real render function. -API.prototype.render = function () { - if (!this._renderProperties) { - throw new _exceptions.NoElementException(); - } - - if (Array.isArray(this._renderProperties)) { - for (var i = 0; i < this._renderProperties.length; i++) { - render(this._renderProperties[i], this._encodings, this._options); - } - } else { - render(this._renderProperties, this._encodings, this._options); - } - - return this; -}; - -API.prototype._defaults = _defaults2.default; - -// Prepares the encodings and calls the renderer -function render(renderProperties, encodings, options) { - encodings = (0, _linearizeEncodings2.default)(encodings); - - for (var i = 0; i < encodings.length; i++) { - encodings[i].options = (0, _merge2.default)(options, encodings[i].options); - (0, _fixOptions2.default)(encodings[i].options); - } - - (0, _fixOptions2.default)(options); - - var Renderer = renderProperties.renderer; - var renderer = new Renderer(renderProperties.element, encodings, options); - renderer.render(); - - if (renderProperties.afterRender) { - renderProperties.afterRender(); - } -} - -// Export to browser -if (typeof window !== "undefined") { - window.JsBarcode = JsBarcode; -} - -// Export to jQuery -/*global jQuery */ -if (typeof jQuery !== 'undefined') { - jQuery.fn.JsBarcode = function (content, options) { - var elementArray = []; - jQuery(this).each(function () { - elementArray.push(this); - }); - return JsBarcode(elementArray, content, options); - }; -} - -// Export to commonJS -module.exports = JsBarcode; - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _CODE = __webpack_require__(2); - -var _CODE2 = __webpack_require__(4); - -var _EAN_UPC = __webpack_require__(12); - -var _ITF = __webpack_require__(22); - -var _MSI = __webpack_require__(26); - -var _pharmacode = __webpack_require__(33); - -var _codabar = __webpack_require__(34); - -var _GenericBarcode = __webpack_require__(35); - -exports.default = { - CODE39: _CODE.CODE39, - CODE128: _CODE2.CODE128, CODE128A: _CODE2.CODE128A, CODE128B: _CODE2.CODE128B, CODE128C: _CODE2.CODE128C, - EAN13: _EAN_UPC.EAN13, EAN8: _EAN_UPC.EAN8, EAN5: _EAN_UPC.EAN5, EAN2: _EAN_UPC.EAN2, UPC: _EAN_UPC.UPC, UPCE: _EAN_UPC.UPCE, - ITF14: _ITF.ITF14, - ITF: _ITF.ITF, - MSI: _MSI.MSI, MSI10: _MSI.MSI10, MSI11: _MSI.MSI11, MSI1010: _MSI.MSI1010, MSI1110: _MSI.MSI1110, - pharmacode: _pharmacode.pharmacode, - codabar: _codabar.codabar, - GenericBarcode: _GenericBarcode.GenericBarcode -}; - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.CODE39 = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Barcode2 = __webpack_require__(3); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: -// https://en.wikipedia.org/wiki/Code_39#Encoding - -var CODE39 = function (_Barcode) { - _inherits(CODE39, _Barcode); - - function CODE39(data, options) { - _classCallCheck(this, CODE39); - - data = data.toUpperCase(); - - // Calculate mod43 checksum if enabled - if (options.mod43) { - data += getCharacter(mod43checksum(data)); - } - - return _possibleConstructorReturn(this, (CODE39.__proto__ || Object.getPrototypeOf(CODE39)).call(this, data, options)); - } - - _createClass(CODE39, [{ - key: "encode", - value: function encode() { - // First character is always a * - var result = getEncoding("*"); - - // Take every character and add the binary representation to the result - for (var i = 0; i < this.data.length; i++) { - result += getEncoding(this.data[i]) + "0"; - } - - // Last character is always a * - result += getEncoding("*"); - - return { - data: result, - text: this.text - }; - } - }, { - key: "valid", - value: function valid() { - return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/) !== -1; - } - }]); - - return CODE39; -}(_Barcode3.default); - -// All characters. The position in the array is the (checksum) value - - -var characters = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "-", ".", " ", "$", "/", "+", "%", "*"]; - -// The decimal representation of the characters, is converted to the -// corresponding binary with the getEncoding function -var encodings = [20957, 29783, 23639, 30485, 20951, 29813, 23669, 20855, 29789, 23645, 29975, 23831, 30533, 22295, 30149, 24005, 21623, 29981, 23837, 22301, 30023, 23879, 30545, 22343, 30161, 24017, 21959, 30065, 23921, 22385, 29015, 18263, 29141, 17879, 29045, 18293, 17783, 29021, 18269, 17477, 17489, 17681, 20753, 35770]; - -// Get the binary representation of a character by converting the encodings -// from decimal to binary -function getEncoding(character) { - return getBinary(characterValue(character)); -} - -function getBinary(characterValue) { - return encodings[characterValue].toString(2); -} - -function getCharacter(characterValue) { - return characters[characterValue]; -} - -function characterValue(character) { - return characters.indexOf(character); -} - -function mod43checksum(data) { - var checksum = 0; - for (var i = 0; i < data.length; i++) { - checksum += characterValue(data[i]); - } - - checksum = checksum % 43; - return checksum; -} - -exports.CODE39 = CODE39; - -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var Barcode = function Barcode(data, options) { - _classCallCheck(this, Barcode); - - this.data = data; - this.text = options.text || data; - this.options = options; -}; - -exports.default = Barcode; - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.CODE128C = exports.CODE128B = exports.CODE128A = exports.CODE128 = undefined; - -var _CODE128_AUTO = __webpack_require__(5); - -var _CODE128_AUTO2 = _interopRequireDefault(_CODE128_AUTO); - -var _CODE128A = __webpack_require__(9); - -var _CODE128A2 = _interopRequireDefault(_CODE128A); - -var _CODE128B = __webpack_require__(10); - -var _CODE128B2 = _interopRequireDefault(_CODE128B); - -var _CODE128C = __webpack_require__(11); - -var _CODE128C2 = _interopRequireDefault(_CODE128C); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.CODE128 = _CODE128_AUTO2.default; -exports.CODE128A = _CODE128A2.default; -exports.CODE128B = _CODE128B2.default; -exports.CODE128C = _CODE128C2.default; - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _CODE2 = __webpack_require__(6); - -var _CODE3 = _interopRequireDefault(_CODE2); - -var _auto = __webpack_require__(8); - -var _auto2 = _interopRequireDefault(_auto); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var CODE128AUTO = function (_CODE) { - _inherits(CODE128AUTO, _CODE); - - function CODE128AUTO(data, options) { - _classCallCheck(this, CODE128AUTO); - - // ASCII value ranges 0-127, 200-211 - if (/^[\x00-\x7F\xC8-\xD3]+$/.test(data)) { - var _this = _possibleConstructorReturn(this, (CODE128AUTO.__proto__ || Object.getPrototypeOf(CODE128AUTO)).call(this, (0, _auto2.default)(data), options)); - } else { - var _this = _possibleConstructorReturn(this, (CODE128AUTO.__proto__ || Object.getPrototypeOf(CODE128AUTO)).call(this, data, options)); - } - return _possibleConstructorReturn(_this); - } - - return CODE128AUTO; -}(_CODE3.default); - -exports.default = CODE128AUTO; - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Barcode2 = __webpack_require__(3); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -var _constants = __webpack_require__(7); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -// This is the master class, -// it does require the start code to be included in the string -var CODE128 = function (_Barcode) { - _inherits(CODE128, _Barcode); - - function CODE128(data, options) { - _classCallCheck(this, CODE128); - - // Get array of ascii codes from data - var _this = _possibleConstructorReturn(this, (CODE128.__proto__ || Object.getPrototypeOf(CODE128)).call(this, data.substring(1), options)); - - _this.bytes = data.split('').map(function (char) { - return char.charCodeAt(0); - }); - return _this; - } - - _createClass(CODE128, [{ - key: 'valid', - value: function valid() { - // ASCII value ranges 0-127, 200-211 - return (/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data) - ); - } - - // The public encoding function - - }, { - key: 'encode', - value: function encode() { - var bytes = this.bytes; - // Remove the start code from the bytes and set its index - var startIndex = bytes.shift() - 105; - // Get start set by index - var startSet = _constants.SET_BY_CODE[startIndex]; - - if (startSet === undefined) { - throw new RangeError('The encoding does not start with a start character.'); - } - - if (this.shouldEncodeAsEan128() === true) { - bytes.unshift(_constants.FNC1); - } - - // Start encode with the right type - var encodingResult = CODE128.next(bytes, 1, startSet); - - return { - text: this.text === this.data ? this.text.replace(/[^\x20-\x7E]/g, '') : this.text, - data: - // Add the start bits - CODE128.getBar(startIndex) + - // Add the encoded bits - encodingResult.result + - // Add the checksum - CODE128.getBar((encodingResult.checksum + startIndex) % _constants.MODULO) + - // Add the end bits - CODE128.getBar(_constants.STOP) - }; - } - - // GS1-128/EAN-128 - - }, { - key: 'shouldEncodeAsEan128', - value: function shouldEncodeAsEan128() { - var isEAN128 = this.options.ean128 || false; - if (typeof isEAN128 === 'string') { - isEAN128 = isEAN128.toLowerCase() === 'true'; - } - return isEAN128; - } - - // Get a bar symbol by index - - }], [{ - key: 'getBar', - value: function getBar(index) { - return _constants.BARS[index] ? _constants.BARS[index].toString() : ''; - } - - // Correct an index by a set and shift it from the bytes array - - }, { - key: 'correctIndex', - value: function correctIndex(bytes, set) { - if (set === _constants.SET_A) { - var charCode = bytes.shift(); - return charCode < 32 ? charCode + 64 : charCode - 32; - } else if (set === _constants.SET_B) { - return bytes.shift() - 32; - } else { - return (bytes.shift() - 48) * 10 + bytes.shift() - 48; - } - } - }, { - key: 'next', - value: function next(bytes, pos, set) { - if (!bytes.length) { - return { result: '', checksum: 0 }; - } - - var nextCode = void 0, - index = void 0; - - // Special characters - if (bytes[0] >= 200) { - index = bytes.shift() - 105; - var nextSet = _constants.SWAP[index]; - - // Swap to other set - if (nextSet !== undefined) { - nextCode = CODE128.next(bytes, pos + 1, nextSet); - } - // Continue on current set but encode a special character - else { - // Shift - if ((set === _constants.SET_A || set === _constants.SET_B) && index === _constants.SHIFT) { - // Convert the next character so that is encoded correctly - bytes[0] = set === _constants.SET_A ? bytes[0] > 95 ? bytes[0] - 96 : bytes[0] : bytes[0] < 32 ? bytes[0] + 96 : bytes[0]; - } - nextCode = CODE128.next(bytes, pos + 1, set); - } - } - // Continue encoding - else { - index = CODE128.correctIndex(bytes, set); - nextCode = CODE128.next(bytes, pos + 1, set); - } - - // Get the correct binary encoding and calculate the weight - var enc = CODE128.getBar(index); - var weight = index * pos; - - return { - result: enc + nextCode.result, - checksum: weight + nextCode.checksum - }; - } - }]); - - return CODE128; -}(_Barcode3.default); - -exports.default = CODE128; - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _SET_BY_CODE; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -// constants for internal usage -var SET_A = exports.SET_A = 0; -var SET_B = exports.SET_B = 1; -var SET_C = exports.SET_C = 2; - -// Special characters -var SHIFT = exports.SHIFT = 98; -var START_A = exports.START_A = 103; -var START_B = exports.START_B = 104; -var START_C = exports.START_C = 105; -var MODULO = exports.MODULO = 103; -var STOP = exports.STOP = 106; -var FNC1 = exports.FNC1 = 207; - -// Get set by start code -var SET_BY_CODE = exports.SET_BY_CODE = (_SET_BY_CODE = {}, _defineProperty(_SET_BY_CODE, START_A, SET_A), _defineProperty(_SET_BY_CODE, START_B, SET_B), _defineProperty(_SET_BY_CODE, START_C, SET_C), _SET_BY_CODE); - -// Get next set by code -var SWAP = exports.SWAP = { - 101: SET_A, - 100: SET_B, - 99: SET_C -}; - -var A_START_CHAR = exports.A_START_CHAR = String.fromCharCode(208); // START_A + 105 -var B_START_CHAR = exports.B_START_CHAR = String.fromCharCode(209); // START_B + 105 -var C_START_CHAR = exports.C_START_CHAR = String.fromCharCode(210); // START_C + 105 - -// 128A (Code Set A) -// ASCII characters 00 to 95 (0–9, A–Z and control codes), special characters, and FNC 1–4 -var A_CHARS = exports.A_CHARS = "[\x00-\x5F\xC8-\xCF]"; - -// 128B (Code Set B) -// ASCII characters 32 to 127 (0–9, A–Z, a–z), special characters, and FNC 1–4 -var B_CHARS = exports.B_CHARS = "[\x20-\x7F\xC8-\xCF]"; - -// 128C (Code Set C) -// 00–99 (encodes two digits with a single code point) and FNC1 -var C_CHARS = exports.C_CHARS = "(\xCF*[0-9]{2}\xCF*)"; - -// CODE128 includes 107 symbols: -// 103 data symbols, 3 start symbols (A, B and C), and 1 stop symbol (the last one) -// Each symbol consist of three black bars (1) and three white spaces (0). -var BARS = exports.BARS = [11011001100, 11001101100, 11001100110, 10010011000, 10010001100, 10001001100, 10011001000, 10011000100, 10001100100, 11001001000, 11001000100, 11000100100, 10110011100, 10011011100, 10011001110, 10111001100, 10011101100, 10011100110, 11001110010, 11001011100, 11001001110, 11011100100, 11001110100, 11101101110, 11101001100, 11100101100, 11100100110, 11101100100, 11100110100, 11100110010, 11011011000, 11011000110, 11000110110, 10100011000, 10001011000, 10001000110, 10110001000, 10001101000, 10001100010, 11010001000, 11000101000, 11000100010, 10110111000, 10110001110, 10001101110, 10111011000, 10111000110, 10001110110, 11101110110, 11010001110, 11000101110, 11011101000, 11011100010, 11011101110, 11101011000, 11101000110, 11100010110, 11101101000, 11101100010, 11100011010, 11101111010, 11001000010, 11110001010, 10100110000, 10100001100, 10010110000, 10010000110, 10000101100, 10000100110, 10110010000, 10110000100, 10011010000, 10011000010, 10000110100, 10000110010, 11000010010, 11001010000, 11110111010, 11000010100, 10001111010, 10100111100, 10010111100, 10010011110, 10111100100, 10011110100, 10011110010, 11110100100, 11110010100, 11110010010, 11011011110, 11011110110, 11110110110, 10101111000, 10100011110, 10001011110, 10111101000, 10111100010, 11110101000, 11110100010, 10111011110, 10111101110, 11101011110, 11110101110, 11010000100, 11010010000, 11010011100, 1100011101011]; - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _constants = __webpack_require__(7); - -// Match Set functions -var matchSetALength = function matchSetALength(string) { - return string.match(new RegExp('^' + _constants.A_CHARS + '*'))[0].length; -}; -var matchSetBLength = function matchSetBLength(string) { - return string.match(new RegExp('^' + _constants.B_CHARS + '*'))[0].length; -}; -var matchSetC = function matchSetC(string) { - return string.match(new RegExp('^' + _constants.C_CHARS + '*'))[0]; -}; - -// CODE128A or CODE128B -function autoSelectFromAB(string, isA) { - var ranges = isA ? _constants.A_CHARS : _constants.B_CHARS; - var untilC = string.match(new RegExp('^(' + ranges + '+?)(([0-9]{2}){2,})([^0-9]|$)')); - - if (untilC) { - return untilC[1] + String.fromCharCode(204) + autoSelectFromC(string.substring(untilC[1].length)); - } - - var chars = string.match(new RegExp('^' + ranges + '+'))[0]; - - if (chars.length === string.length) { - return string; - } - - return chars + String.fromCharCode(isA ? 205 : 206) + autoSelectFromAB(string.substring(chars.length), !isA); -} - -// CODE128C -function autoSelectFromC(string) { - var cMatch = matchSetC(string); - var length = cMatch.length; - - if (length === string.length) { - return string; - } - - string = string.substring(length); - - // Select A/B depending on the longest match - var isA = matchSetALength(string) >= matchSetBLength(string); - return cMatch + String.fromCharCode(isA ? 206 : 205) + autoSelectFromAB(string, isA); -} - -// Detect Code Set (A, B or C) and format the string - -exports.default = function (string) { - var newString = void 0; - var cLength = matchSetC(string).length; - - // Select 128C if the string start with enough digits - if (cLength >= 2) { - newString = _constants.C_START_CHAR + autoSelectFromC(string); - } else { - // Select A/B depending on the longest match - var isA = matchSetALength(string) > matchSetBLength(string); - newString = (isA ? _constants.A_START_CHAR : _constants.B_START_CHAR) + autoSelectFromAB(string, isA); - } - - return newString.replace(/[\xCD\xCE]([^])[\xCD\xCE]/, // Any sequence between 205 and 206 characters - function (match, char) { - return String.fromCharCode(203) + char; - }); -}; - -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _CODE2 = __webpack_require__(6); - -var _CODE3 = _interopRequireDefault(_CODE2); - -var _constants = __webpack_require__(7); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var CODE128A = function (_CODE) { - _inherits(CODE128A, _CODE); - - function CODE128A(string, options) { - _classCallCheck(this, CODE128A); - - return _possibleConstructorReturn(this, (CODE128A.__proto__ || Object.getPrototypeOf(CODE128A)).call(this, _constants.A_START_CHAR + string, options)); - } - - _createClass(CODE128A, [{ - key: 'valid', - value: function valid() { - return new RegExp('^' + _constants.A_CHARS + '+$').test(this.data); - } - }]); - - return CODE128A; -}(_CODE3.default); - -exports.default = CODE128A; - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _CODE2 = __webpack_require__(6); - -var _CODE3 = _interopRequireDefault(_CODE2); - -var _constants = __webpack_require__(7); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var CODE128B = function (_CODE) { - _inherits(CODE128B, _CODE); - - function CODE128B(string, options) { - _classCallCheck(this, CODE128B); - - return _possibleConstructorReturn(this, (CODE128B.__proto__ || Object.getPrototypeOf(CODE128B)).call(this, _constants.B_START_CHAR + string, options)); - } - - _createClass(CODE128B, [{ - key: 'valid', - value: function valid() { - return new RegExp('^' + _constants.B_CHARS + '+$').test(this.data); - } - }]); - - return CODE128B; -}(_CODE3.default); - -exports.default = CODE128B; - -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _CODE2 = __webpack_require__(6); - -var _CODE3 = _interopRequireDefault(_CODE2); - -var _constants = __webpack_require__(7); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var CODE128C = function (_CODE) { - _inherits(CODE128C, _CODE); - - function CODE128C(string, options) { - _classCallCheck(this, CODE128C); - - return _possibleConstructorReturn(this, (CODE128C.__proto__ || Object.getPrototypeOf(CODE128C)).call(this, _constants.C_START_CHAR + string, options)); - } - - _createClass(CODE128C, [{ - key: 'valid', - value: function valid() { - return new RegExp('^' + _constants.C_CHARS + '+$').test(this.data); - } - }]); - - return CODE128C; -}(_CODE3.default); - -exports.default = CODE128C; - -/***/ }), -/* 12 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UPCE = exports.UPC = exports.EAN2 = exports.EAN5 = exports.EAN8 = exports.EAN13 = undefined; - -var _EAN = __webpack_require__(13); - -var _EAN2 = _interopRequireDefault(_EAN); - -var _EAN3 = __webpack_require__(17); - -var _EAN4 = _interopRequireDefault(_EAN3); - -var _EAN5 = __webpack_require__(18); - -var _EAN6 = _interopRequireDefault(_EAN5); - -var _EAN7 = __webpack_require__(19); - -var _EAN8 = _interopRequireDefault(_EAN7); - -var _UPC = __webpack_require__(20); - -var _UPC2 = _interopRequireDefault(_UPC); - -var _UPCE = __webpack_require__(21); - -var _UPCE2 = _interopRequireDefault(_UPCE); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.EAN13 = _EAN2.default; -exports.EAN8 = _EAN4.default; -exports.EAN5 = _EAN6.default; -exports.EAN2 = _EAN8.default; -exports.UPC = _UPC2.default; -exports.UPCE = _UPCE2.default; - -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -var _constants = __webpack_require__(14); - -var _EAN2 = __webpack_require__(15); - -var _EAN3 = _interopRequireDefault(_EAN2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: -// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Binary_encoding_of_data_digits_into_EAN-13_barcode - -// Calculate the checksum digit -// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit -var checksum = function checksum(number) { - var res = number.substr(0, 12).split('').map(function (n) { - return +n; - }).reduce(function (sum, a, idx) { - return idx % 2 ? sum + a * 3 : sum + a; - }, 0); - - return (10 - res % 10) % 10; -}; - -var EAN13 = function (_EAN) { - _inherits(EAN13, _EAN); - - function EAN13(data, options) { - _classCallCheck(this, EAN13); - - // Add checksum if it does not exist - if (data.search(/^[0-9]{12}$/) !== -1) { - data += checksum(data); - } - - // Adds a last character to the end of the barcode - var _this = _possibleConstructorReturn(this, (EAN13.__proto__ || Object.getPrototypeOf(EAN13)).call(this, data, options)); - - _this.lastChar = options.lastChar; - return _this; - } - - _createClass(EAN13, [{ - key: 'valid', - value: function valid() { - return this.data.search(/^[0-9]{13}$/) !== -1 && +this.data[12] === checksum(this.data); - } - }, { - key: 'leftText', - value: function leftText() { - return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'leftText', this).call(this, 1, 6); - } - }, { - key: 'leftEncode', - value: function leftEncode() { - var data = this.data.substr(1, 6); - var structure = _constants.EAN13_STRUCTURE[this.data[0]]; - return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'leftEncode', this).call(this, data, structure); - } - }, { - key: 'rightText', - value: function rightText() { - return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'rightText', this).call(this, 7, 6); - } - }, { - key: 'rightEncode', - value: function rightEncode() { - var data = this.data.substr(7, 6); - return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'rightEncode', this).call(this, data, 'RRRRRR'); - } - - // The "standard" way of printing EAN13 barcodes with guard bars - - }, { - key: 'encodeGuarded', - value: function encodeGuarded() { - var data = _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'encodeGuarded', this).call(this); - - // Extend data with left digit & last character - if (this.options.displayValue) { - data.unshift({ - data: '000000000000', - text: this.text.substr(0, 1), - options: { textAlign: 'left', fontSize: this.fontSize } - }); - - if (this.options.lastChar) { - data.push({ - data: '00' - }); - data.push({ - data: '00000', - text: this.options.lastChar, - options: { fontSize: this.fontSize } - }); - } - } - - return data; - } - }]); - - return EAN13; -}(_EAN3.default); - -exports.default = EAN13; - -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -// Standard start end and middle bits -var SIDE_BIN = exports.SIDE_BIN = '101'; -var MIDDLE_BIN = exports.MIDDLE_BIN = '01010'; - -var BINARIES = exports.BINARIES = { - 'L': [// The L (left) type of encoding - '0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011'], - 'G': [// The G type of encoding - '0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', '0010111'], - 'R': [// The R (right) type of encoding - '1110010', '1100110', '1101100', '1000010', '1011100', '1001110', '1010000', '1000100', '1001000', '1110100'], - 'O': [// The O (odd) encoding for UPC-E - '0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011'], - 'E': [// The E (even) encoding for UPC-E - '0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', '0010111'] -}; - -// Define the EAN-2 structure -var EAN2_STRUCTURE = exports.EAN2_STRUCTURE = ['LL', 'LG', 'GL', 'GG']; - -// Define the EAN-5 structure -var EAN5_STRUCTURE = exports.EAN5_STRUCTURE = ['GGLLL', 'GLGLL', 'GLLGL', 'GLLLG', 'LGGLL', 'LLGGL', 'LLLGG', 'LGLGL', 'LGLLG', 'LLGLG']; - -// Define the EAN-13 structure -var EAN13_STRUCTURE = exports.EAN13_STRUCTURE = ['LLLLLL', 'LLGLGG', 'LLGGLG', 'LLGGGL', 'LGLLGG', 'LGGLLG', 'LGGGLL', 'LGLGLG', 'LGLGGL', 'LGGLGL']; - -/***/ }), -/* 15 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _constants = __webpack_require__(14); - -var _encoder = __webpack_require__(16); - -var _encoder2 = _interopRequireDefault(_encoder); - -var _Barcode2 = __webpack_require__(3); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -// Base class for EAN8 & EAN13 -var EAN = function (_Barcode) { - _inherits(EAN, _Barcode); - - function EAN(data, options) { - _classCallCheck(this, EAN); - - // Make sure the font is not bigger than the space between the guard bars - var _this = _possibleConstructorReturn(this, (EAN.__proto__ || Object.getPrototypeOf(EAN)).call(this, data, options)); - - _this.fontSize = !options.flat && options.fontSize > options.width * 10 ? options.width * 10 : options.fontSize; - - // Make the guard bars go down half the way of the text - _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin; - return _this; - } - - _createClass(EAN, [{ - key: 'encode', - value: function encode() { - return this.options.flat ? this.encodeFlat() : this.encodeGuarded(); - } - }, { - key: 'leftText', - value: function leftText(from, to) { - return this.text.substr(from, to); - } - }, { - key: 'leftEncode', - value: function leftEncode(data, structure) { - return (0, _encoder2.default)(data, structure); - } - }, { - key: 'rightText', - value: function rightText(from, to) { - return this.text.substr(from, to); - } - }, { - key: 'rightEncode', - value: function rightEncode(data, structure) { - return (0, _encoder2.default)(data, structure); - } - }, { - key: 'encodeGuarded', - value: function encodeGuarded() { - var textOptions = { fontSize: this.fontSize }; - var guardOptions = { height: this.guardHeight }; - - return [{ data: _constants.SIDE_BIN, options: guardOptions }, { data: this.leftEncode(), text: this.leftText(), options: textOptions }, { data: _constants.MIDDLE_BIN, options: guardOptions }, { data: this.rightEncode(), text: this.rightText(), options: textOptions }, { data: _constants.SIDE_BIN, options: guardOptions }]; - } - }, { - key: 'encodeFlat', - value: function encodeFlat() { - var data = [_constants.SIDE_BIN, this.leftEncode(), _constants.MIDDLE_BIN, this.rightEncode(), _constants.SIDE_BIN]; - - return { - data: data.join(''), - text: this.text - }; - } - }]); - - return EAN; -}(_Barcode3.default); - -exports.default = EAN; - -/***/ }), -/* 16 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _constants = __webpack_require__(14); - -// Encode data string -var encode = function encode(data, structure, separator) { - var encoded = data.split('').map(function (val, idx) { - return _constants.BINARIES[structure[idx]]; - }).map(function (val, idx) { - return val ? val[data[idx]] : ''; - }); - - if (separator) { - var last = data.length - 1; - encoded = encoded.map(function (val, idx) { - return idx < last ? val + separator : val; - }); - } - - return encoded.join(''); -}; - -exports.default = encode; - -/***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -var _EAN2 = __webpack_require__(15); - -var _EAN3 = _interopRequireDefault(_EAN2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: -// http://www.barcodeisland.com/ean8.phtml - -// Calculate the checksum digit -var checksum = function checksum(number) { - var res = number.substr(0, 7).split('').map(function (n) { - return +n; - }).reduce(function (sum, a, idx) { - return idx % 2 ? sum + a : sum + a * 3; - }, 0); - - return (10 - res % 10) % 10; -}; - -var EAN8 = function (_EAN) { - _inherits(EAN8, _EAN); - - function EAN8(data, options) { - _classCallCheck(this, EAN8); - - // Add checksum if it does not exist - if (data.search(/^[0-9]{7}$/) !== -1) { - data += checksum(data); - } - - return _possibleConstructorReturn(this, (EAN8.__proto__ || Object.getPrototypeOf(EAN8)).call(this, data, options)); - } - - _createClass(EAN8, [{ - key: 'valid', - value: function valid() { - return this.data.search(/^[0-9]{8}$/) !== -1 && +this.data[7] === checksum(this.data); - } - }, { - key: 'leftText', - value: function leftText() { - return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'leftText', this).call(this, 0, 4); - } - }, { - key: 'leftEncode', - value: function leftEncode() { - var data = this.data.substr(0, 4); - return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'leftEncode', this).call(this, data, 'LLLL'); - } - }, { - key: 'rightText', - value: function rightText() { - return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'rightText', this).call(this, 4, 4); - } - }, { - key: 'rightEncode', - value: function rightEncode() { - var data = this.data.substr(4, 4); - return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'rightEncode', this).call(this, data, 'RRRR'); - } - }]); - - return EAN8; -}(_EAN3.default); - -exports.default = EAN8; - -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _constants = __webpack_require__(14); - -var _encoder = __webpack_require__(16); - -var _encoder2 = _interopRequireDefault(_encoder); - -var _Barcode2 = __webpack_require__(3); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: -// https://en.wikipedia.org/wiki/EAN_5#Encoding - -var checksum = function checksum(data) { - var result = data.split('').map(function (n) { - return +n; - }).reduce(function (sum, a, idx) { - return idx % 2 ? sum + a * 9 : sum + a * 3; - }, 0); - return result % 10; -}; - -var EAN5 = function (_Barcode) { - _inherits(EAN5, _Barcode); - - function EAN5(data, options) { - _classCallCheck(this, EAN5); - - return _possibleConstructorReturn(this, (EAN5.__proto__ || Object.getPrototypeOf(EAN5)).call(this, data, options)); - } - - _createClass(EAN5, [{ - key: 'valid', - value: function valid() { - return this.data.search(/^[0-9]{5}$/) !== -1; - } - }, { - key: 'encode', - value: function encode() { - var structure = _constants.EAN5_STRUCTURE[checksum(this.data)]; - return { - data: '1011' + (0, _encoder2.default)(this.data, structure, '01'), - text: this.text - }; - } - }]); - - return EAN5; -}(_Barcode3.default); - -exports.default = EAN5; - -/***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _constants = __webpack_require__(14); - -var _encoder = __webpack_require__(16); - -var _encoder2 = _interopRequireDefault(_encoder); - -var _Barcode2 = __webpack_require__(3); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: -// https://en.wikipedia.org/wiki/EAN_2#Encoding - -var EAN2 = function (_Barcode) { - _inherits(EAN2, _Barcode); - - function EAN2(data, options) { - _classCallCheck(this, EAN2); - - return _possibleConstructorReturn(this, (EAN2.__proto__ || Object.getPrototypeOf(EAN2)).call(this, data, options)); - } - - _createClass(EAN2, [{ - key: 'valid', - value: function valid() { - return this.data.search(/^[0-9]{2}$/) !== -1; - } - }, { - key: 'encode', - value: function encode() { - // Choose the structure based on the number mod 4 - var structure = _constants.EAN2_STRUCTURE[parseInt(this.data) % 4]; - return { - // Start bits + Encode the two digits with 01 in between - data: '1011' + (0, _encoder2.default)(this.data, structure, '01'), - text: this.text - }; - } - }]); - - return EAN2; -}(_Barcode3.default); - -exports.default = EAN2; - -/***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -exports.checksum = checksum; - -var _encoder = __webpack_require__(16); - -var _encoder2 = _interopRequireDefault(_encoder); - -var _Barcode2 = __webpack_require__(3); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: -// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding - -var UPC = function (_Barcode) { - _inherits(UPC, _Barcode); - - function UPC(data, options) { - _classCallCheck(this, UPC); - - // Add checksum if it does not exist - if (data.search(/^[0-9]{11}$/) !== -1) { - data += checksum(data); - } - - var _this = _possibleConstructorReturn(this, (UPC.__proto__ || Object.getPrototypeOf(UPC)).call(this, data, options)); - - _this.displayValue = options.displayValue; - - // Make sure the font is not bigger than the space between the guard bars - if (options.fontSize > options.width * 10) { - _this.fontSize = options.width * 10; - } else { - _this.fontSize = options.fontSize; - } - - // Make the guard bars go down half the way of the text - _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin; - return _this; - } - - _createClass(UPC, [{ - key: "valid", - value: function valid() { - return this.data.search(/^[0-9]{12}$/) !== -1 && this.data[11] == checksum(this.data); - } - }, { - key: "encode", - value: function encode() { - if (this.options.flat) { - return this.flatEncoding(); - } else { - return this.guardedEncoding(); - } - } - }, { - key: "flatEncoding", - value: function flatEncoding() { - var result = ""; - - result += "101"; - result += (0, _encoder2.default)(this.data.substr(0, 6), "LLLLLL"); - result += "01010"; - result += (0, _encoder2.default)(this.data.substr(6, 6), "RRRRRR"); - result += "101"; - - return { - data: result, - text: this.text - }; - } - }, { - key: "guardedEncoding", - value: function guardedEncoding() { - var result = []; - - // Add the first digit - if (this.displayValue) { - result.push({ - data: "00000000", - text: this.text.substr(0, 1), - options: { textAlign: "left", fontSize: this.fontSize } - }); - } - - // Add the guard bars - result.push({ - data: "101" + (0, _encoder2.default)(this.data[0], "L"), - options: { height: this.guardHeight } - }); - - // Add the left side - result.push({ - data: (0, _encoder2.default)(this.data.substr(1, 5), "LLLLL"), - text: this.text.substr(1, 5), - options: { fontSize: this.fontSize } - }); - - // Add the middle bits - result.push({ - data: "01010", - options: { height: this.guardHeight } - }); - - // Add the right side - result.push({ - data: (0, _encoder2.default)(this.data.substr(6, 5), "RRRRR"), - text: this.text.substr(6, 5), - options: { fontSize: this.fontSize } - }); - - // Add the end bits - result.push({ - data: (0, _encoder2.default)(this.data[11], "R") + "101", - options: { height: this.guardHeight } - }); - - // Add the last digit - if (this.displayValue) { - result.push({ - data: "00000000", - text: this.text.substr(11, 1), - options: { textAlign: "right", fontSize: this.fontSize } - }); - } - - return result; - } - }]); - - return UPC; -}(_Barcode3.default); - -// Calulate the checksum digit -// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit - - -function checksum(number) { - var result = 0; - - var i; - for (i = 1; i < 11; i += 2) { - result += parseInt(number[i]); - } - for (i = 0; i < 11; i += 2) { - result += parseInt(number[i]) * 3; - } - - return (10 - result % 10) % 10; -} - -exports.default = UPC; - -/***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _encoder = __webpack_require__(16); - -var _encoder2 = _interopRequireDefault(_encoder); - -var _Barcode2 = __webpack_require__(3); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -var _UPC = __webpack_require__(20); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: -// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding -// -// UPC-E documentation: -// https://en.wikipedia.org/wiki/Universal_Product_Code#UPC-E - -var EXPANSIONS = ["XX00000XXX", "XX10000XXX", "XX20000XXX", "XXX00000XX", "XXXX00000X", "XXXXX00005", "XXXXX00006", "XXXXX00007", "XXXXX00008", "XXXXX00009"]; - -var PARITIES = [["EEEOOO", "OOOEEE"], ["EEOEOO", "OOEOEE"], ["EEOOEO", "OOEEOE"], ["EEOOOE", "OOEEEO"], ["EOEEOO", "OEOOEE"], ["EOOEEO", "OEEOOE"], ["EOOOEE", "OEEEOO"], ["EOEOEO", "OEOEOE"], ["EOEOOE", "OEOEEO"], ["EOOEOE", "OEEOEO"]]; - -var UPCE = function (_Barcode) { - _inherits(UPCE, _Barcode); - - function UPCE(data, options) { - _classCallCheck(this, UPCE); - - var _this = _possibleConstructorReturn(this, (UPCE.__proto__ || Object.getPrototypeOf(UPCE)).call(this, data, options)); - // Code may be 6 or 8 digits; - // A 7 digit code is ambiguous as to whether the extra digit - // is a UPC-A check or number system digit. - - - _this.isValid = false; - if (data.search(/^[0-9]{6}$/) !== -1) { - _this.middleDigits = data; - _this.upcA = expandToUPCA(data, "0"); - _this.text = options.text || '' + _this.upcA[0] + data + _this.upcA[_this.upcA.length - 1]; - _this.isValid = true; - } else if (data.search(/^[01][0-9]{7}$/) !== -1) { - _this.middleDigits = data.substring(1, data.length - 1); - _this.upcA = expandToUPCA(_this.middleDigits, data[0]); - - if (_this.upcA[_this.upcA.length - 1] === data[data.length - 1]) { - _this.isValid = true; - } else { - // checksum mismatch - return _possibleConstructorReturn(_this); - } - } else { - return _possibleConstructorReturn(_this); - } - - _this.displayValue = options.displayValue; - - // Make sure the font is not bigger than the space between the guard bars - if (options.fontSize > options.width * 10) { - _this.fontSize = options.width * 10; - } else { - _this.fontSize = options.fontSize; - } - - // Make the guard bars go down half the way of the text - _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin; - return _this; - } - - _createClass(UPCE, [{ - key: 'valid', - value: function valid() { - return this.isValid; - } - }, { - key: 'encode', - value: function encode() { - if (this.options.flat) { - return this.flatEncoding(); - } else { - return this.guardedEncoding(); - } - } - }, { - key: 'flatEncoding', - value: function flatEncoding() { - var result = ""; - - result += "101"; - result += this.encodeMiddleDigits(); - result += "010101"; - - return { - data: result, - text: this.text - }; - } - }, { - key: 'guardedEncoding', - value: function guardedEncoding() { - var result = []; - - // Add the UPC-A number system digit beneath the quiet zone - if (this.displayValue) { - result.push({ - data: "00000000", - text: this.text[0], - options: { textAlign: "left", fontSize: this.fontSize } - }); - } - - // Add the guard bars - result.push({ - data: "101", - options: { height: this.guardHeight } - }); - - // Add the 6 UPC-E digits - result.push({ - data: this.encodeMiddleDigits(), - text: this.text.substring(1, 7), - options: { fontSize: this.fontSize } - }); - - // Add the end bits - result.push({ - data: "010101", - options: { height: this.guardHeight } - }); - - // Add the UPC-A check digit beneath the quiet zone - if (this.displayValue) { - result.push({ - data: "00000000", - text: this.text[7], - options: { textAlign: "right", fontSize: this.fontSize } - }); - } - - return result; - } - }, { - key: 'encodeMiddleDigits', - value: function encodeMiddleDigits() { - var numberSystem = this.upcA[0]; - var checkDigit = this.upcA[this.upcA.length - 1]; - var parity = PARITIES[parseInt(checkDigit)][parseInt(numberSystem)]; - return (0, _encoder2.default)(this.middleDigits, parity); - } - }]); - - return UPCE; -}(_Barcode3.default); - -function expandToUPCA(middleDigits, numberSystem) { - var lastUpcE = parseInt(middleDigits[middleDigits.length - 1]); - var expansion = EXPANSIONS[lastUpcE]; - - var result = ""; - var digitIndex = 0; - for (var i = 0; i < expansion.length; i++) { - var c = expansion[i]; - if (c === 'X') { - result += middleDigits[digitIndex++]; - } else { - result += c; - } - } - - result = '' + numberSystem + result; - return '' + result + (0, _UPC.checksum)(result); -} - -exports.default = UPCE; - -/***/ }), -/* 22 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ITF14 = exports.ITF = undefined; - -var _ITF = __webpack_require__(23); - -var _ITF2 = _interopRequireDefault(_ITF); - -var _ITF3 = __webpack_require__(25); - -var _ITF4 = _interopRequireDefault(_ITF3); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.ITF = _ITF2.default; -exports.ITF14 = _ITF4.default; - -/***/ }), -/* 23 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _constants = __webpack_require__(24); - -var _Barcode2 = __webpack_require__(3); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var ITF = function (_Barcode) { - _inherits(ITF, _Barcode); - - function ITF() { - _classCallCheck(this, ITF); - - return _possibleConstructorReturn(this, (ITF.__proto__ || Object.getPrototypeOf(ITF)).apply(this, arguments)); - } - - _createClass(ITF, [{ - key: 'valid', - value: function valid() { - return this.data.search(/^([0-9]{2})+$/) !== -1; - } - }, { - key: 'encode', - value: function encode() { - var _this2 = this; - - // Calculate all the digit pairs - var encoded = this.data.match(/.{2}/g).map(function (pair) { - return _this2.encodePair(pair); - }).join(''); - - return { - data: _constants.START_BIN + encoded + _constants.END_BIN, - text: this.text - }; - } - - // Calculate the data of a number pair - - }, { - key: 'encodePair', - value: function encodePair(pair) { - var second = _constants.BINARIES[pair[1]]; - - return _constants.BINARIES[pair[0]].split('').map(function (first, idx) { - return (first === '1' ? '111' : '1') + (second[idx] === '1' ? '000' : '0'); - }).join(''); - } - }]); - - return ITF; -}(_Barcode3.default); - -exports.default = ITF; - -/***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var START_BIN = exports.START_BIN = '1010'; -var END_BIN = exports.END_BIN = '11101'; - -var BINARIES = exports.BINARIES = ['00110', '10001', '01001', '11000', '00101', '10100', '01100', '00011', '10010', '01010']; - -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _ITF2 = __webpack_require__(23); - -var _ITF3 = _interopRequireDefault(_ITF2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -// Calculate the checksum digit -var checksum = function checksum(data) { - var res = data.substr(0, 13).split('').map(function (num) { - return parseInt(num, 10); - }).reduce(function (sum, n, idx) { - return sum + n * (3 - idx % 2 * 2); - }, 0); - - return Math.ceil(res / 10) * 10 - res; -}; - -var ITF14 = function (_ITF) { - _inherits(ITF14, _ITF); - - function ITF14(data, options) { - _classCallCheck(this, ITF14); - - // Add checksum if it does not exist - if (data.search(/^[0-9]{13}$/) !== -1) { - data += checksum(data); - } - return _possibleConstructorReturn(this, (ITF14.__proto__ || Object.getPrototypeOf(ITF14)).call(this, data, options)); - } - - _createClass(ITF14, [{ - key: 'valid', - value: function valid() { - return this.data.search(/^[0-9]{14}$/) !== -1 && +this.data[13] === checksum(this.data); - } - }]); - - return ITF14; -}(_ITF3.default); - -exports.default = ITF14; - -/***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.MSI1110 = exports.MSI1010 = exports.MSI11 = exports.MSI10 = exports.MSI = undefined; - -var _MSI = __webpack_require__(27); - -var _MSI2 = _interopRequireDefault(_MSI); - -var _MSI3 = __webpack_require__(28); - -var _MSI4 = _interopRequireDefault(_MSI3); - -var _MSI5 = __webpack_require__(30); - -var _MSI6 = _interopRequireDefault(_MSI5); - -var _MSI7 = __webpack_require__(31); - -var _MSI8 = _interopRequireDefault(_MSI7); - -var _MSI9 = __webpack_require__(32); - -var _MSI10 = _interopRequireDefault(_MSI9); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.MSI = _MSI2.default; -exports.MSI10 = _MSI4.default; -exports.MSI11 = _MSI6.default; -exports.MSI1010 = _MSI8.default; -exports.MSI1110 = _MSI10.default; - -/***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Barcode2 = __webpack_require__(3); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation -// https://en.wikipedia.org/wiki/MSI_Barcode#Character_set_and_binary_lookup - -var MSI = function (_Barcode) { - _inherits(MSI, _Barcode); - - function MSI(data, options) { - _classCallCheck(this, MSI); - - return _possibleConstructorReturn(this, (MSI.__proto__ || Object.getPrototypeOf(MSI)).call(this, data, options)); - } - - _createClass(MSI, [{ - key: "encode", - value: function encode() { - // Start bits - var ret = "110"; - - for (var i = 0; i < this.data.length; i++) { - // Convert the character to binary (always 4 binary digits) - var digit = parseInt(this.data[i]); - var bin = digit.toString(2); - bin = addZeroes(bin, 4 - bin.length); - - // Add 100 for every zero and 110 for every 1 - for (var b = 0; b < bin.length; b++) { - ret += bin[b] == "0" ? "100" : "110"; - } - } - - // End bits - ret += "1001"; - - return { - data: ret, - text: this.text - }; - } - }, { - key: "valid", - value: function valid() { - return this.data.search(/^[0-9]+$/) !== -1; - } - }]); - - return MSI; -}(_Barcode3.default); - -function addZeroes(number, n) { - for (var i = 0; i < n; i++) { - number = "0" + number; - } - return number; -} - -exports.default = MSI; - -/***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _MSI2 = __webpack_require__(27); - -var _MSI3 = _interopRequireDefault(_MSI2); - -var _checksums = __webpack_require__(29); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var MSI10 = function (_MSI) { - _inherits(MSI10, _MSI); - - function MSI10(data, options) { - _classCallCheck(this, MSI10); - - return _possibleConstructorReturn(this, (MSI10.__proto__ || Object.getPrototypeOf(MSI10)).call(this, data + (0, _checksums.mod10)(data), options)); - } - - return MSI10; -}(_MSI3.default); - -exports.default = MSI10; - -/***/ }), -/* 29 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.mod10 = mod10; -exports.mod11 = mod11; -function mod10(number) { - var sum = 0; - for (var i = 0; i < number.length; i++) { - var n = parseInt(number[i]); - if ((i + number.length) % 2 === 0) { - sum += n; - } else { - sum += n * 2 % 10 + Math.floor(n * 2 / 10); - } - } - return (10 - sum % 10) % 10; -} - -function mod11(number) { - var sum = 0; - var weights = [2, 3, 4, 5, 6, 7]; - for (var i = 0; i < number.length; i++) { - var n = parseInt(number[number.length - 1 - i]); - sum += weights[i % weights.length] * n; - } - return (11 - sum % 11) % 11; -} - -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _MSI2 = __webpack_require__(27); - -var _MSI3 = _interopRequireDefault(_MSI2); - -var _checksums = __webpack_require__(29); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var MSI11 = function (_MSI) { - _inherits(MSI11, _MSI); - - function MSI11(data, options) { - _classCallCheck(this, MSI11); - - return _possibleConstructorReturn(this, (MSI11.__proto__ || Object.getPrototypeOf(MSI11)).call(this, data + (0, _checksums.mod11)(data), options)); - } - - return MSI11; -}(_MSI3.default); - -exports.default = MSI11; - -/***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _MSI2 = __webpack_require__(27); - -var _MSI3 = _interopRequireDefault(_MSI2); - -var _checksums = __webpack_require__(29); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var MSI1010 = function (_MSI) { - _inherits(MSI1010, _MSI); - - function MSI1010(data, options) { - _classCallCheck(this, MSI1010); - - data += (0, _checksums.mod10)(data); - data += (0, _checksums.mod10)(data); - return _possibleConstructorReturn(this, (MSI1010.__proto__ || Object.getPrototypeOf(MSI1010)).call(this, data, options)); - } - - return MSI1010; -}(_MSI3.default); - -exports.default = MSI1010; - -/***/ }), -/* 32 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _MSI2 = __webpack_require__(27); - -var _MSI3 = _interopRequireDefault(_MSI2); - -var _checksums = __webpack_require__(29); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var MSI1110 = function (_MSI) { - _inherits(MSI1110, _MSI); - - function MSI1110(data, options) { - _classCallCheck(this, MSI1110); - - data += (0, _checksums.mod11)(data); - data += (0, _checksums.mod10)(data); - return _possibleConstructorReturn(this, (MSI1110.__proto__ || Object.getPrototypeOf(MSI1110)).call(this, data, options)); - } - - return MSI1110; -}(_MSI3.default); - -exports.default = MSI1110; - -/***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.pharmacode = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Barcode2 = __webpack_require__(3); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation -// http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf - -var pharmacode = function (_Barcode) { - _inherits(pharmacode, _Barcode); - - function pharmacode(data, options) { - _classCallCheck(this, pharmacode); - - var _this = _possibleConstructorReturn(this, (pharmacode.__proto__ || Object.getPrototypeOf(pharmacode)).call(this, data, options)); - - _this.number = parseInt(data, 10); - return _this; - } - - _createClass(pharmacode, [{ - key: "encode", - value: function encode() { - var z = this.number; - var result = ""; - - // http://i.imgur.com/RMm4UDJ.png - // (source: http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf, page: 34) - while (!isNaN(z) && z != 0) { - if (z % 2 === 0) { - // Even - result = "11100" + result; - z = (z - 2) / 2; - } else { - // Odd - result = "100" + result; - z = (z - 1) / 2; - } - } - - // Remove the two last zeroes - result = result.slice(0, -2); - - return { - data: result, - text: this.text - }; - } - }, { - key: "valid", - value: function valid() { - return this.number >= 3 && this.number <= 131070; - } - }]); - - return pharmacode; -}(_Barcode3.default); - -exports.pharmacode = pharmacode; - -/***/ }), -/* 34 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.codabar = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Barcode2 = __webpack_require__(3); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding specification: -// http://www.barcodeisland.com/codabar.phtml - -var codabar = function (_Barcode) { - _inherits(codabar, _Barcode); - - function codabar(data, options) { - _classCallCheck(this, codabar); - - if (data.search(/^[0-9\-\$\:\.\+\/]+$/) === 0) { - data = "A" + data + "A"; - } - - var _this = _possibleConstructorReturn(this, (codabar.__proto__ || Object.getPrototypeOf(codabar)).call(this, data.toUpperCase(), options)); - - _this.text = _this.options.text || _this.text.replace(/[A-D]/g, ''); - return _this; - } - - _createClass(codabar, [{ - key: "valid", - value: function valid() { - return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) !== -1; - } - }, { - key: "encode", - value: function encode() { - var result = []; - var encodings = this.getEncodings(); - for (var i = 0; i < this.data.length; i++) { - result.push(encodings[this.data.charAt(i)]); - // for all characters except the last, append a narrow-space ("0") - if (i !== this.data.length - 1) { - result.push("0"); - } - } - return { - text: this.text, - data: result.join('') - }; - } - }, { - key: "getEncodings", - value: function getEncodings() { - return { - "0": "101010011", - "1": "101011001", - "2": "101001011", - "3": "110010101", - "4": "101101001", - "5": "110101001", - "6": "100101011", - "7": "100101101", - "8": "100110101", - "9": "110100101", - "-": "101001101", - "$": "101100101", - ":": "1101011011", - "/": "1101101011", - ".": "1101101101", - "+": "1011011011", - "A": "1011001001", - "B": "1001001011", - "C": "1010010011", - "D": "1010011001" - }; - } - }]); - - return codabar; -}(_Barcode3.default); - -exports.codabar = codabar; - -/***/ }), -/* 35 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.GenericBarcode = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Barcode2 = __webpack_require__(3); - -var _Barcode3 = _interopRequireDefault(_Barcode2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var GenericBarcode = function (_Barcode) { - _inherits(GenericBarcode, _Barcode); - - function GenericBarcode(data, options) { - _classCallCheck(this, GenericBarcode); - - return _possibleConstructorReturn(this, (GenericBarcode.__proto__ || Object.getPrototypeOf(GenericBarcode)).call(this, data, options)); // Sets this.data and this.text - } - - // Return the corresponding binary numbers for the data provided - - - _createClass(GenericBarcode, [{ - key: "encode", - value: function encode() { - return { - data: "10101010101010101010101010101010101010101", - text: this.text - }; - } - - // Resturn true/false if the string provided is valid for this encoder - - }, { - key: "valid", - value: function valid() { - return true; - } - }]); - - return GenericBarcode; -}(_Barcode3.default); - -exports.GenericBarcode = GenericBarcode; - -/***/ }), -/* 36 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -exports.default = function (old, replaceObj) { - return _extends({}, old, replaceObj); -}; - -/***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = linearizeEncodings; - -// Encodings can be nestled like [[1-1, 1-2], 2, [3-1, 3-2] -// Convert to [1-1, 1-2, 2, 3-1, 3-2] - -function linearizeEncodings(encodings) { - var linearEncodings = []; - function nextLevel(encoded) { - if (Array.isArray(encoded)) { - for (var i = 0; i < encoded.length; i++) { - nextLevel(encoded[i]); - } - } else { - encoded.text = encoded.text || ""; - encoded.data = encoded.data || ""; - linearEncodings.push(encoded); - } - } - nextLevel(encodings); - - return linearEncodings; -} - -/***/ }), -/* 38 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = fixOptions; - - -function fixOptions(options) { - // Fix the margins - options.marginTop = options.marginTop || options.margin; - options.marginBottom = options.marginBottom || options.margin; - options.marginRight = options.marginRight || options.margin; - options.marginLeft = options.marginLeft || options.margin; - - return options; -} - -/***/ }), -/* 39 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /* global HTMLImageElement */ -/* global HTMLCanvasElement */ -/* global SVGElement */ - -var _getOptionsFromElement = __webpack_require__(40); - -var _getOptionsFromElement2 = _interopRequireDefault(_getOptionsFromElement); - -var _renderers = __webpack_require__(43); - -var _renderers2 = _interopRequireDefault(_renderers); - -var _exceptions = __webpack_require__(48); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// Takes an element and returns an object with information about how -// it should be rendered -// This could also return an array with these objects -// { -// element: The element that the renderer should draw on -// renderer: The name of the renderer -// afterRender (optional): If something has to done after the renderer -// completed, calls afterRender (function) -// options (optional): Options that can be defined in the element -// } - -function getRenderProperties(element) { - // If the element is a string, query select call again - if (typeof element === "string") { - return querySelectedRenderProperties(element); - } - // If element is array. Recursivly call with every object in the array - else if (Array.isArray(element)) { - var returnArray = []; - for (var i = 0; i < element.length; i++) { - returnArray.push(getRenderProperties(element[i])); - } - return returnArray; - } - // If element, render on canvas and set the uri as src - else if (typeof HTMLCanvasElement !== 'undefined' && element instanceof HTMLImageElement) { - return newCanvasRenderProperties(element); - } - // If SVG - else if (element && element.nodeName && element.nodeName.toLowerCase() === 'svg' || typeof SVGElement !== 'undefined' && element instanceof SVGElement) { - return { - element: element, - options: (0, _getOptionsFromElement2.default)(element), - renderer: _renderers2.default.SVGRenderer - }; - } - // If canvas (in browser) - else if (typeof HTMLCanvasElement !== 'undefined' && element instanceof HTMLCanvasElement) { - return { - element: element, - options: (0, _getOptionsFromElement2.default)(element), - renderer: _renderers2.default.CanvasRenderer - }; - } - // If canvas (in node) - else if (element && element.getContext) { - return { - element: element, - renderer: _renderers2.default.CanvasRenderer - }; - } else if (element && (typeof element === "undefined" ? "undefined" : _typeof(element)) === 'object' && !element.nodeName) { - return { - element: element, - renderer: _renderers2.default.ObjectRenderer - }; - } else { - throw new _exceptions.InvalidElementException(); - } -} - -function querySelectedRenderProperties(string) { - var selector = document.querySelectorAll(string); - if (selector.length === 0) { - return undefined; - } else { - var returnArray = []; - for (var i = 0; i < selector.length; i++) { - returnArray.push(getRenderProperties(selector[i])); - } - return returnArray; - } -} - -function newCanvasRenderProperties(imgElement) { - var canvas = document.createElement('canvas'); - return { - element: canvas, - options: (0, _getOptionsFromElement2.default)(imgElement), - renderer: _renderers2.default.CanvasRenderer, - afterRender: function afterRender() { - imgElement.setAttribute("src", canvas.toDataURL()); - } - }; -} - -exports.default = getRenderProperties; - -/***/ }), -/* 40 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _optionsFromStrings = __webpack_require__(41); - -var _optionsFromStrings2 = _interopRequireDefault(_optionsFromStrings); - -var _defaults = __webpack_require__(42); - -var _defaults2 = _interopRequireDefault(_defaults); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function getOptionsFromElement(element) { - var options = {}; - for (var property in _defaults2.default) { - if (_defaults2.default.hasOwnProperty(property)) { - // jsbarcode-* - if (element.hasAttribute("jsbarcode-" + property.toLowerCase())) { - options[property] = element.getAttribute("jsbarcode-" + property.toLowerCase()); - } - - // data-* - if (element.hasAttribute("data-" + property.toLowerCase())) { - options[property] = element.getAttribute("data-" + property.toLowerCase()); - } - } - } - - options["value"] = element.getAttribute("jsbarcode-value") || element.getAttribute("data-value"); - - // Since all atributes are string they need to be converted to integers - options = (0, _optionsFromStrings2.default)(options); - - return options; -} - -exports.default = getOptionsFromElement; - -/***/ }), -/* 41 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = optionsFromStrings; - -// Convert string to integers/booleans where it should be - -function optionsFromStrings(options) { - var intOptions = ["width", "height", "textMargin", "fontSize", "margin", "marginTop", "marginBottom", "marginLeft", "marginRight"]; - - for (var intOption in intOptions) { - if (intOptions.hasOwnProperty(intOption)) { - intOption = intOptions[intOption]; - if (typeof options[intOption] === "string") { - options[intOption] = parseInt(options[intOption], 10); - } - } - } - - if (typeof options["displayValue"] === "string") { - options["displayValue"] = options["displayValue"] != "false"; - } - - return options; -} - -/***/ }), -/* 42 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var defaults = { - width: 2, - height: 100, - format: "auto", - displayValue: true, - fontOptions: "", - font: "monospace", - text: undefined, - textAlign: "center", - textPosition: "bottom", - textMargin: 2, - fontSize: 20, - background: "#ffffff", - lineColor: "#000000", - margin: 10, - marginTop: undefined, - marginBottom: undefined, - marginLeft: undefined, - marginRight: undefined, - valid: function valid() {} -}; - -exports.default = defaults; - -/***/ }), -/* 43 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _canvas = __webpack_require__(44); - -var _canvas2 = _interopRequireDefault(_canvas); - -var _svg = __webpack_require__(46); - -var _svg2 = _interopRequireDefault(_svg); - -var _object = __webpack_require__(47); - -var _object2 = _interopRequireDefault(_object); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = { CanvasRenderer: _canvas2.default, SVGRenderer: _svg2.default, ObjectRenderer: _object2.default }; - -/***/ }), -/* 44 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _merge = __webpack_require__(36); - -var _merge2 = _interopRequireDefault(_merge); - -var _shared = __webpack_require__(45); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var CanvasRenderer = function () { - function CanvasRenderer(canvas, encodings, options) { - _classCallCheck(this, CanvasRenderer); - - this.canvas = canvas; - this.encodings = encodings; - this.options = options; - } - - _createClass(CanvasRenderer, [{ - key: "render", - value: function render() { - // Abort if the browser does not support HTML5 canvas - if (!this.canvas.getContext) { - throw new Error('The browser does not support canvas.'); - } - - this.prepareCanvas(); - for (var i = 0; i < this.encodings.length; i++) { - var encodingOptions = (0, _merge2.default)(this.options, this.encodings[i].options); - - this.drawCanvasBarcode(encodingOptions, this.encodings[i]); - this.drawCanvasText(encodingOptions, this.encodings[i]); - - this.moveCanvasDrawing(this.encodings[i]); - } - - this.restoreCanvas(); - } - }, { - key: "prepareCanvas", - value: function prepareCanvas() { - // Get the canvas context - var ctx = this.canvas.getContext("2d"); - - ctx.save(); - - (0, _shared.calculateEncodingAttributes)(this.encodings, this.options, ctx); - var totalWidth = (0, _shared.getTotalWidthOfEncodings)(this.encodings); - var maxHeight = (0, _shared.getMaximumHeightOfEncodings)(this.encodings); - - this.canvas.width = totalWidth + this.options.marginLeft + this.options.marginRight; - - this.canvas.height = maxHeight; - - // Paint the canvas - ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); - if (this.options.background) { - ctx.fillStyle = this.options.background; - ctx.fillRect(0, 0, this.canvas.width, this.canvas.height); - } - - ctx.translate(this.options.marginLeft, 0); - } - }, { - key: "drawCanvasBarcode", - value: function drawCanvasBarcode(options, encoding) { - // Get the canvas context - var ctx = this.canvas.getContext("2d"); - - var binary = encoding.data; - - // Creates the barcode out of the encoded binary - var yFrom; - if (options.textPosition == "top") { - yFrom = options.marginTop + options.fontSize + options.textMargin; - } else { - yFrom = options.marginTop; - } - - ctx.fillStyle = options.lineColor; - - for (var b = 0; b < binary.length; b++) { - var x = b * options.width + encoding.barcodePadding; - - if (binary[b] === "1") { - ctx.fillRect(x, yFrom, options.width, options.height); - } else if (binary[b]) { - ctx.fillRect(x, yFrom, options.width, options.height * binary[b]); - } - } - } - }, { - key: "drawCanvasText", - value: function drawCanvasText(options, encoding) { - // Get the canvas context - var ctx = this.canvas.getContext("2d"); - - var font = options.fontOptions + " " + options.fontSize + "px " + options.font; - - // Draw the text if displayValue is set - if (options.displayValue) { - var x, y; - - if (options.textPosition == "top") { - y = options.marginTop + options.fontSize - options.textMargin; - } else { - y = options.height + options.textMargin + options.marginTop + options.fontSize; - } - - ctx.font = font; - - // Draw the text in the correct X depending on the textAlign option - if (options.textAlign == "left" || encoding.barcodePadding > 0) { - x = 0; - ctx.textAlign = 'left'; - } else if (options.textAlign == "right") { - x = encoding.width - 1; - ctx.textAlign = 'right'; - } - // In all other cases, center the text - else { - x = encoding.width / 2; - ctx.textAlign = 'center'; - } - - ctx.fillText(encoding.text, x, y); - } - } - }, { - key: "moveCanvasDrawing", - value: function moveCanvasDrawing(encoding) { - var ctx = this.canvas.getContext("2d"); - - ctx.translate(encoding.width, 0); - } - }, { - key: "restoreCanvas", - value: function restoreCanvas() { - // Get the canvas context - var ctx = this.canvas.getContext("2d"); - - ctx.restore(); - } - }]); - - return CanvasRenderer; -}(); - -exports.default = CanvasRenderer; - -/***/ }), -/* 45 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getTotalWidthOfEncodings = exports.calculateEncodingAttributes = exports.getBarcodePadding = exports.getEncodingHeight = exports.getMaximumHeightOfEncodings = undefined; - -var _merge = __webpack_require__(36); - -var _merge2 = _interopRequireDefault(_merge); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function getEncodingHeight(encoding, options) { - return options.height + (options.displayValue && encoding.text.length > 0 ? options.fontSize + options.textMargin : 0) + options.marginTop + options.marginBottom; -} - -function getBarcodePadding(textWidth, barcodeWidth, options) { - if (options.displayValue && barcodeWidth < textWidth) { - if (options.textAlign == "center") { - return Math.floor((textWidth - barcodeWidth) / 2); - } else if (options.textAlign == "left") { - return 0; - } else if (options.textAlign == "right") { - return Math.floor(textWidth - barcodeWidth); - } - } - return 0; -} - -function calculateEncodingAttributes(encodings, barcodeOptions, context) { - for (var i = 0; i < encodings.length; i++) { - var encoding = encodings[i]; - var options = (0, _merge2.default)(barcodeOptions, encoding.options); - - // Calculate the width of the encoding - var textWidth; - if (options.displayValue) { - textWidth = messureText(encoding.text, options, context); - } else { - textWidth = 0; - } - - var barcodeWidth = encoding.data.length * options.width; - encoding.width = Math.ceil(Math.max(textWidth, barcodeWidth)); - - encoding.height = getEncodingHeight(encoding, options); - - encoding.barcodePadding = getBarcodePadding(textWidth, barcodeWidth, options); - } -} - -function getTotalWidthOfEncodings(encodings) { - var totalWidth = 0; - for (var i = 0; i < encodings.length; i++) { - totalWidth += encodings[i].width; - } - return totalWidth; -} - -function getMaximumHeightOfEncodings(encodings) { - var maxHeight = 0; - for (var i = 0; i < encodings.length; i++) { - if (encodings[i].height > maxHeight) { - maxHeight = encodings[i].height; - } - } - return maxHeight; -} - -function messureText(string, options, context) { - var ctx; - - if (context) { - ctx = context; - } else if (typeof document !== "undefined") { - ctx = document.createElement("canvas").getContext("2d"); - } else { - // If the text cannot be messured we will return 0. - // This will make some barcode with big text render incorrectly - return 0; - } - ctx.font = options.fontOptions + " " + options.fontSize + "px " + options.font; - - // Calculate the width of the encoding - var measureTextResult = ctx.measureText(string); - if (!measureTextResult) { - // Some implementations don't implement measureText and return undefined. - // If the text cannot be measured we will return 0. - // This will make some barcode with big text render incorrectly - return 0; - } - var size = measureTextResult.width; - return size; -} - -exports.getMaximumHeightOfEncodings = getMaximumHeightOfEncodings; -exports.getEncodingHeight = getEncodingHeight; -exports.getBarcodePadding = getBarcodePadding; -exports.calculateEncodingAttributes = calculateEncodingAttributes; -exports.getTotalWidthOfEncodings = getTotalWidthOfEncodings; - -/***/ }), -/* 46 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _merge = __webpack_require__(36); - -var _merge2 = _interopRequireDefault(_merge); - -var _shared = __webpack_require__(45); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var svgns = "http://www.w3.org/2000/svg"; - -var SVGRenderer = function () { - function SVGRenderer(svg, encodings, options) { - _classCallCheck(this, SVGRenderer); - - this.svg = svg; - this.encodings = encodings; - this.options = options; - this.document = options.xmlDocument || document; - } - - _createClass(SVGRenderer, [{ - key: "render", - value: function render() { - var currentX = this.options.marginLeft; - - this.prepareSVG(); - for (var i = 0; i < this.encodings.length; i++) { - var encoding = this.encodings[i]; - var encodingOptions = (0, _merge2.default)(this.options, encoding.options); - - var group = this.createGroup(currentX, encodingOptions.marginTop, this.svg); - - this.setGroupOptions(group, encodingOptions); - - this.drawSvgBarcode(group, encodingOptions, encoding); - this.drawSVGText(group, encodingOptions, encoding); - - currentX += encoding.width; - } - } - }, { - key: "prepareSVG", - value: function prepareSVG() { - // Clear the SVG - while (this.svg.firstChild) { - this.svg.removeChild(this.svg.firstChild); - } - - (0, _shared.calculateEncodingAttributes)(this.encodings, this.options); - var totalWidth = (0, _shared.getTotalWidthOfEncodings)(this.encodings); - var maxHeight = (0, _shared.getMaximumHeightOfEncodings)(this.encodings); - - var width = totalWidth + this.options.marginLeft + this.options.marginRight; - this.setSvgAttributes(width, maxHeight); - - if (this.options.background) { - this.drawRect(0, 0, width, maxHeight, this.svg).setAttribute("style", "fill:" + this.options.background + ";"); - } - } - }, { - key: "drawSvgBarcode", - value: function drawSvgBarcode(parent, options, encoding) { - var binary = encoding.data; - - // Creates the barcode out of the encoded binary - var yFrom; - if (options.textPosition == "top") { - yFrom = options.fontSize + options.textMargin; - } else { - yFrom = 0; - } - - var barWidth = 0; - var x = 0; - for (var b = 0; b < binary.length; b++) { - x = b * options.width + encoding.barcodePadding; - - if (binary[b] === "1") { - barWidth++; - } else if (barWidth > 0) { - this.drawRect(x - options.width * barWidth, yFrom, options.width * barWidth, options.height, parent); - barWidth = 0; - } - } - - // Last draw is needed since the barcode ends with 1 - if (barWidth > 0) { - this.drawRect(x - options.width * (barWidth - 1), yFrom, options.width * barWidth, options.height, parent); - } - } - }, { - key: "drawSVGText", - value: function drawSVGText(parent, options, encoding) { - var textElem = this.document.createElementNS(svgns, 'text'); - - // Draw the text if displayValue is set - if (options.displayValue) { - var x, y; - - textElem.setAttribute("style", "font:" + options.fontOptions + " " + options.fontSize + "px " + options.font); - - if (options.textPosition == "top") { - y = options.fontSize - options.textMargin; - } else { - y = options.height + options.textMargin + options.fontSize; - } - - // Draw the text in the correct X depending on the textAlign option - if (options.textAlign == "left" || encoding.barcodePadding > 0) { - x = 0; - textElem.setAttribute("text-anchor", "start"); - } else if (options.textAlign == "right") { - x = encoding.width - 1; - textElem.setAttribute("text-anchor", "end"); - } - // In all other cases, center the text - else { - x = encoding.width / 2; - textElem.setAttribute("text-anchor", "middle"); - } - - textElem.setAttribute("x", x); - textElem.setAttribute("y", y); - - textElem.appendChild(this.document.createTextNode(encoding.text)); - - parent.appendChild(textElem); - } - } - }, { - key: "setSvgAttributes", - value: function setSvgAttributes(width, height) { - var svg = this.svg; - svg.setAttribute("width", width + "px"); - svg.setAttribute("height", height + "px"); - svg.setAttribute("x", "0px"); - svg.setAttribute("y", "0px"); - svg.setAttribute("viewBox", "0 0 " + width + " " + height); - - svg.setAttribute("xmlns", svgns); - svg.setAttribute("version", "1.1"); - - svg.setAttribute("style", "transform: translate(0,0)"); - } - }, { - key: "createGroup", - value: function createGroup(x, y, parent) { - var group = this.document.createElementNS(svgns, 'g'); - group.setAttribute("transform", "translate(" + x + ", " + y + ")"); - - parent.appendChild(group); - - return group; - } - }, { - key: "setGroupOptions", - value: function setGroupOptions(group, options) { - group.setAttribute("style", "fill:" + options.lineColor + ";"); - } - }, { - key: "drawRect", - value: function drawRect(x, y, width, height, parent) { - var rect = this.document.createElementNS(svgns, 'rect'); - - rect.setAttribute("x", x); - rect.setAttribute("y", y); - rect.setAttribute("width", width); - rect.setAttribute("height", height); - - parent.appendChild(rect); - - return rect; - } - }]); - - return SVGRenderer; -}(); - -exports.default = SVGRenderer; - -/***/ }), -/* 47 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var ObjectRenderer = function () { - function ObjectRenderer(object, encodings, options) { - _classCallCheck(this, ObjectRenderer); - - this.object = object; - this.encodings = encodings; - this.options = options; - } - - _createClass(ObjectRenderer, [{ - key: "render", - value: function render() { - this.object.encodings = this.encodings; - } - }]); - - return ObjectRenderer; -}(); - -exports.default = ObjectRenderer; - -/***/ }), -/* 48 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var InvalidInputException = function (_Error) { - _inherits(InvalidInputException, _Error); - - function InvalidInputException(symbology, input) { - _classCallCheck(this, InvalidInputException); - - var _this = _possibleConstructorReturn(this, (InvalidInputException.__proto__ || Object.getPrototypeOf(InvalidInputException)).call(this)); - - _this.name = "InvalidInputException"; - - _this.symbology = symbology; - _this.input = input; - - _this.message = '"' + _this.input + '" is not a valid input for ' + _this.symbology; - return _this; - } - - return InvalidInputException; -}(Error); - -var InvalidElementException = function (_Error2) { - _inherits(InvalidElementException, _Error2); - - function InvalidElementException() { - _classCallCheck(this, InvalidElementException); - - var _this2 = _possibleConstructorReturn(this, (InvalidElementException.__proto__ || Object.getPrototypeOf(InvalidElementException)).call(this)); - - _this2.name = "InvalidElementException"; - _this2.message = "Not supported type to render on"; - return _this2; - } - - return InvalidElementException; -}(Error); - -var NoElementException = function (_Error3) { - _inherits(NoElementException, _Error3); - - function NoElementException() { - _classCallCheck(this, NoElementException); - - var _this3 = _possibleConstructorReturn(this, (NoElementException.__proto__ || Object.getPrototypeOf(NoElementException)).call(this)); - - _this3.name = "NoElementException"; - _this3.message = "No element to render on."; - return _this3; - } - - return NoElementException; -}(Error); - -exports.InvalidInputException = InvalidInputException; -exports.InvalidElementException = InvalidElementException; -exports.NoElementException = NoElementException; - -/***/ }), -/* 49 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -/*eslint no-console: 0 */ - -var ErrorHandler = function () { - function ErrorHandler(api) { - _classCallCheck(this, ErrorHandler); - - this.api = api; - } - - _createClass(ErrorHandler, [{ - key: "handleCatch", - value: function handleCatch(e) { - // If babel supported extending of Error in a correct way instanceof would be used here - if (e.name === "InvalidInputException") { - if (this.api._options.valid !== this.api._defaults.valid) { - this.api._options.valid(false); - } else { - throw e.message; - } - } else { - throw e; - } - - this.api.render = function () {}; - } - }, { - key: "wrapBarcodeCall", - value: function wrapBarcodeCall(func) { - try { - var result = func.apply(undefined, arguments); - this.api._options.valid(true); - return result; - } catch (e) { - this.handleCatch(e); - - return this.api; - } - } - }]); - - return ErrorHandler; -}(); - -exports.default = ErrorHandler; - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/node_modules/jsbarcode/dist/JsBarcode.all.min.js b/node_modules/jsbarcode/dist/JsBarcode.all.min.js deleted file mode 100644 index c584536..0000000 --- a/node_modules/jsbarcode/dist/JsBarcode.all.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! JsBarcode v3.11.5 | (c) Johan Lindell | MIT license */ -!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=15)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.data=e,this.text=n.text||e,this.options=n}},function(t,e,n){"use strict";var r;function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperty(e,"__esModule",{value:!0});var i=e.SET_A=0,a=e.SET_B=1,u=e.SET_C=2,f=(e.SHIFT=98,e.START_A=103),c=e.START_B=104,s=e.START_C=105;e.MODULO=103,e.STOP=106,e.FNC1=207,e.SET_BY_CODE=(o(r={},f,i),o(r,c,a),o(r,s,u),r),e.SWAP={101:i,100:a,99:u},e.A_START_CHAR=String.fromCharCode(208),e.B_START_CHAR=String.fromCharCode(209),e.C_START_CHAR=String.fromCharCode(210),e.A_CHARS="[\0-_È-Ï]",e.B_CHARS="[ -È-Ï]",e.C_CHARS="(Ï*[0-9]{2}Ï*)",e.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.SIDE_BIN="101",e.MIDDLE_BIN="01010",e.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},e.EAN2_STRUCTURE=["LL","LG","GL","GG"],e.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],e.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2);e.default=function(t,e,n){var o=t.split("").map((function(t,n){return r.BINARIES[e[n]]})).map((function(e,n){return e?e[t[n]]:""}));if(n){var i=t.length-1;o=o.map((function(t,e){return e=200){i=t.shift()-105;var a=u.SWAP[i];void 0!==a?o=e.next(t,n+1,a):(r!==u.SET_A&&r!==u.SET_B||i!==u.SHIFT||(t[0]=r===u.SET_A?t[0]>95?t[0]-96:t[0]:t[0]<32?t[0]+96:t[0]),o=e.next(t,n+1,r))}else i=e.correctIndex(t,r),o=e.next(t,n+1,r);var f=i*n;return{result:e.getBar(i)+o.result,checksum:f+o.checksum}}}]),e}(a.default);e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.mod10=function(t){for(var e=0,n=0;n10*n.width?10*n.width:n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),r(e,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(t,e){return this.text.substr(t,e)}},{key:"leftEncode",value:function(t,e){return(0,i.default)(t,e)}},{key:"rightText",value:function(t,e){return this.text.substr(t,e)}},{key:"rightEncode",value:function(t,e){return(0,i.default)(t,e)}},{key:"encodeGuarded",value:function(){var t={fontSize:this.fontSize},e={height:this.guardHeight};return[{data:o.SIDE_BIN,options:e},{data:this.leftEncode(),text:this.leftText(),options:t},{data:o.MIDDLE_BIN,options:e},{data:this.rightEncode(),text:this.rightText(),options:t},{data:o.SIDE_BIN,options:e}]}},{key:"encodeFlat",value:function(){return{data:[o.SIDE_BIN,this.leftEncode(),o.MIDDLE_BIN,this.rightEncode(),o.SIDE_BIN].join(""),text:this.text}}}]),e}(a(n(0)).default);e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n10*n.width?r.fontSize=10*n.width:r.fontSize=n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),r(e,[{key:"valid",value:function(){return-1!==this.data.search(/^[0-9]{12}$/)&&this.data[11]==u(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var t="";return t+="101",t+=(0,o.default)(this.data.substr(0,6),"LLLLLL"),t+="01010",t+=(0,o.default)(this.data.substr(6,6),"RRRRRR"),{data:t+="101",text:this.text}}},{key:"guardedEncoding",value:function(){var t=[];return this.displayValue&&t.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),t.push({data:"101"+(0,o.default)(this.data[0],"L"),options:{height:this.guardHeight}}),t.push({data:(0,o.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),t.push({data:"01010",options:{height:this.guardHeight}}),t.push({data:(0,o.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),t.push({data:(0,o.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&t.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),t}}]),e}(i(n(0)).default);function u(t){var e,n=0;for(e=1;e<11;e+=2)n+=parseInt(t[e]);for(e=0;e<11;e+=2)n+=3*parseInt(t[e]);return(10-n%10)%10}e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function u(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e},e.getEncodingHeight=a,e.getBarcodePadding=u,e.calculateEncodingAttributes=function(t,e,n){for(var r=0;r=i(t);return e+String.fromCharCode(r?206:205)+u(t,r)}e.default=function(t){var e=void 0;if(a(t).length>=2)e=r.C_START_CHAR+f(t);else{var n=o(t)>i(t);e=(n?r.A_START_CHAR:r.B_START_CHAR)+u(t,n)}return e.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,(function(t,e){return String.fromCharCode(203)+e}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n10*n.width?r.fontSize=10*n.width:r.fontSize=n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),r(e,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var t="";return t+="101",t+=this.encodeMiddleDigits(),{data:t+="010101",text:this.text}}},{key:"guardedEncoding",value:function(){var t=[];return this.displayValue&&t.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),t.push({data:"101",options:{height:this.guardHeight}}),t.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),t.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&t.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),t}},{key:"encodeMiddleDigits",value:function(){var t=this.upcA[0],e=this.upcA[this.upcA.length-1],n=s[parseInt(e)][parseInt(t)];return(0,o.default)(this.middleDigits,n)}}]),e}(i.default);function p(t,e){for(var n=parseInt(t[t.length-1]),r=c[n],o="",i=0,u=0;u=3&&this.number<=131070}}]),e}(((r=i)&&r.__esModule?r:{default:r}).default);e.pharmacode=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.codabar=void 0;var r,o=function(){function t(t,e){for(var n=0;n0?(n=0,o.textAlign="left"):"right"==t.textAlign?(n=e.width-1,o.textAlign="right"):(n=e.width/2,o.textAlign="center"),o.fillText(e.text,n,r))}},{key:"moveCanvasDrawing",value:function(t){this.canvas.getContext("2d").translate(t.width,0)}},{key:"restoreCanvas",value:function(){this.canvas.getContext("2d").restore()}}]),t}();e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n0&&(this.drawRect(a-e.width*i,r,e.width*i,e.height,t),i=0);i>0&&this.drawRect(a-e.width*(i-1),r,e.width*i,e.height,t)}},{key:"drawSVGText",value:function(t,e,n){var r,o,i=this.document.createElementNS(f,"text");e.displayValue&&(i.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(r=0,i.setAttribute("text-anchor","start")):"right"==e.textAlign?(r=n.width-1,i.setAttribute("text-anchor","end")):(r=n.width/2,i.setAttribute("text-anchor","middle")),i.setAttribute("x",r),i.setAttribute("y",o),i.appendChild(this.document.createTextNode(n.text)),t.appendChild(i))}},{key:"setSvgAttributes",value:function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",f),n.setAttribute("version","1.1"),n.setAttribute("style","transform: translate(0,0)")}},{key:"createGroup",value:function(t,e,n){var r=this.document.createElementNS(f,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}},{key:"setGroupOptions",value:function(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}},{key:"drawRect",value:function(t,e,n,r,o){var i=this.document.createElementNS(f,"rect");return i.setAttribute("x",t),i.setAttribute("y",e),i.setAttribute("width",n),i.setAttribute("height",r),o.appendChild(i),i}}]),t}();e.default=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function s(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e},e.getEncodingHeight=a,e.getBarcodePadding=s,e.calculateEncodingAttributes=function(t,e,n){for(var r=0;r0?(n=0,i.textAlign="left"):"right"==t.textAlign?(n=e.width-1,i.textAlign="right"):(n=e.width/2,i.textAlign="center"),i.fillText(e.text,n,r))}},{key:"moveCanvasDrawing",value:function(t){this.canvas.getContext("2d").translate(t.width,0)}},{key:"restoreCanvas",value:function(){this.canvas.getContext("2d").restore()}}]),t}();e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=function(){function t(t,e){for(var n=0;n0&&(this.drawRect(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&this.drawRect(a-e.width*(o-1),r,e.width*o,e.height,t)}},{key:"drawSVGText",value:function(t,e,n){var r,i,o=this.document.createElementNS(u,"text");e.displayValue&&(o.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),i="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(r=0,o.setAttribute("text-anchor","start")):"right"==e.textAlign?(r=n.width-1,o.setAttribute("text-anchor","end")):(r=n.width/2,o.setAttribute("text-anchor","middle")),o.setAttribute("x",r),o.setAttribute("y",i),o.appendChild(this.document.createTextNode(n.text)),t.appendChild(o))}},{key:"setSvgAttributes",value:function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",u),n.setAttribute("version","1.1"),n.setAttribute("style","transform: translate(0,0)")}},{key:"createGroup",value:function(t,e,n){var r=this.document.createElementNS(u,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}},{key:"setGroupOptions",value:function(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}},{key:"drawRect",value:function(t,e,n,r,i){var o=this.document.createElementNS(u,"rect");return o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o),o}}]),t}();e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n=200){i=t.shift()-105;var a=u.SWAP[i];void 0!==a?o=e.next(t,n+1,a):(r!==u.SET_A&&r!==u.SET_B||i!==u.SHIFT||(t[0]=r===u.SET_A?t[0]>95?t[0]-96:t[0]:t[0]<32?t[0]+96:t[0]),o=e.next(t,n+1,r))}else i=e.correctIndex(t,r),o=e.next(t,n+1,r);var s=i*n;return{result:e.getBar(i)+o.result,checksum:s+o.checksum}}}]),e}(a.default);e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(t){for(var e=1;e0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function u(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e},e.getEncodingHeight=a,e.getBarcodePadding=u,e.calculateEncodingAttributes=function(t,e,n){for(var r=0;r=i(t);return e+String.fromCharCode(r?206:205)+u(t,r)}e.default=function(t){var e=void 0;if(a(t).length>=2)e=r.C_START_CHAR+s(t);else{var n=o(t)>i(t);e=(n?r.A_START_CHAR:r.B_START_CHAR)+u(t,n)}return e.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,(function(t,e){return String.fromCharCode(203)+e}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n0?(n=0,o.textAlign="left"):"right"==t.textAlign?(n=e.width-1,o.textAlign="right"):(n=e.width/2,o.textAlign="center"),o.fillText(e.text,n,r))}},{key:"moveCanvasDrawing",value:function(t){this.canvas.getContext("2d").translate(t.width,0)}},{key:"restoreCanvas",value:function(){this.canvas.getContext("2d").restore()}}]),t}();e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n0&&(this.drawRect(a-e.width*i,r,e.width*i,e.height,t),i=0);i>0&&this.drawRect(a-e.width*(i-1),r,e.width*i,e.height,t)}},{key:"drawSVGText",value:function(t,e,n){var r,o,i=this.document.createElementNS(s,"text");e.displayValue&&(i.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(r=0,i.setAttribute("text-anchor","start")):"right"==e.textAlign?(r=n.width-1,i.setAttribute("text-anchor","end")):(r=n.width/2,i.setAttribute("text-anchor","middle")),i.setAttribute("x",r),i.setAttribute("y",o),i.appendChild(this.document.createTextNode(n.text)),t.appendChild(i))}},{key:"setSvgAttributes",value:function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",s),n.setAttribute("version","1.1"),n.setAttribute("style","transform: translate(0,0)")}},{key:"createGroup",value:function(t,e,n){var r=this.document.createElementNS(s,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}},{key:"setGroupOptions",value:function(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}},{key:"drawRect",value:function(t,e,n,r,o){var i=this.document.createElementNS(s,"rect");return i.setAttribute("x",t),i.setAttribute("y",e),i.setAttribute("width",n),i.setAttribute("height",r),o.appendChild(i),i}}]),t}();e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function u(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e},e.getEncodingHeight=a,e.getBarcodePadding=u,e.calculateEncodingAttributes=function(t,e,n){for(var r=0;r0?(n=0,i.textAlign="left"):"right"==t.textAlign?(n=e.width-1,i.textAlign="right"):(n=e.width/2,i.textAlign="center"),i.fillText(e.text,n,r))}},{key:"moveCanvasDrawing",value:function(t){this.canvas.getContext("2d").translate(t.width,0)}},{key:"restoreCanvas",value:function(){this.canvas.getContext("2d").restore()}}]),t}();e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=function(){function t(t,e){for(var n=0;n0&&(this.drawRect(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&this.drawRect(a-e.width*(o-1),r,e.width*o,e.height,t)}},{key:"drawSVGText",value:function(t,e,n){var r,i,o=this.document.createElementNS(s,"text");e.displayValue&&(o.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),i="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(r=0,o.setAttribute("text-anchor","start")):"right"==e.textAlign?(r=n.width-1,o.setAttribute("text-anchor","end")):(r=n.width/2,o.setAttribute("text-anchor","middle")),o.setAttribute("x",r),o.setAttribute("y",i),o.appendChild(this.document.createTextNode(n.text)),t.appendChild(o))}},{key:"setSvgAttributes",value:function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",s),n.setAttribute("version","1.1"),n.setAttribute("style","transform: translate(0,0)")}},{key:"createGroup",value:function(t,e,n){var r=this.document.createElementNS(s,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}},{key:"setGroupOptions",value:function(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}},{key:"drawRect",value:function(t,e,n,r,i){var o=this.document.createElementNS(s,"rect");return o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o),o}}]),t}();e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n10*n.width?10*n.width:n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),r(e,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(t,e){return this.text.substr(t,e)}},{key:"leftEncode",value:function(t,e){return(0,i.default)(t,e)}},{key:"rightText",value:function(t,e){return this.text.substr(t,e)}},{key:"rightEncode",value:function(t,e){return(0,i.default)(t,e)}},{key:"encodeGuarded",value:function(){var t={fontSize:this.fontSize},e={height:this.guardHeight};return[{data:o.SIDE_BIN,options:e},{data:this.leftEncode(),text:this.leftText(),options:t},{data:o.MIDDLE_BIN,options:e},{data:this.rightEncode(),text:this.rightText(),options:t},{data:o.SIDE_BIN,options:e}]}},{key:"encodeFlat",value:function(){return{data:[o.SIDE_BIN,this.leftEncode(),o.MIDDLE_BIN,this.rightEncode(),o.SIDE_BIN].join(""),text:this.text}}}]),e}(a(n(2)).default);e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n10*n.width?r.fontSize=10*n.width:r.fontSize=n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),r(e,[{key:"valid",value:function(){return-1!==this.data.search(/^[0-9]{12}$/)&&this.data[11]==u(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var t="";return t+="101",t+=(0,o.default)(this.data.substr(0,6),"LLLLLL"),t+="01010",t+=(0,o.default)(this.data.substr(6,6),"RRRRRR"),{data:t+="101",text:this.text}}},{key:"guardedEncoding",value:function(){var t=[];return this.displayValue&&t.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),t.push({data:"101"+(0,o.default)(this.data[0],"L"),options:{height:this.guardHeight}}),t.push({data:(0,o.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),t.push({data:"01010",options:{height:this.guardHeight}}),t.push({data:(0,o.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),t.push({data:(0,o.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&t.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),t}}]),e}(i(n(2)).default);function u(t){var e,n=0;for(e=1;e<11;e+=2)n+=parseInt(t[e]);for(e=0;e<11;e+=2)n+=3*parseInt(t[e]);return(10-n%10)%10}e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var n in e)e.hasOwnProperty(n)&&(n=e[n],"string"==typeof t[n]&&(t[n]=parseInt(t[n],10)));"string"==typeof t.displayValue&&(t.displayValue="false"!=t.displayValue);return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var r,o=n(3),i=(r=o)&&r.__esModule?r:{default:r};function a(t,e){return e.height+(e.displayValue&&t.text.length>0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function u(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e},e.getEncodingHeight=a,e.getBarcodePadding=u,e.calculateEncodingAttributes=function(t,e,n){for(var r=0;r10*n.width?r.fontSize=10*n.width:r.fontSize=n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),r(e,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var t="";return t+="101",t+=this.encodeMiddleDigits(),{data:t+="010101",text:this.text}}},{key:"guardedEncoding",value:function(){var t=[];return this.displayValue&&t.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),t.push({data:"101",options:{height:this.guardHeight}}),t.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),t.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&t.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),t}},{key:"encodeMiddleDigits",value:function(){var t=this.upcA[0],e=this.upcA[this.upcA.length-1],n=l[parseInt(e)][parseInt(t)];return(0,o.default)(this.middleDigits,n)}}]),e}(i.default);function d(t,e){for(var n=parseInt(t[t.length-1]),r=f[n],o="",i=0,u=0;u0?(n=0,o.textAlign="left"):"right"==t.textAlign?(n=e.width-1,o.textAlign="right"):(n=e.width/2,o.textAlign="center"),o.fillText(e.text,n,r))}},{key:"moveCanvasDrawing",value:function(t){this.canvas.getContext("2d").translate(t.width,0)}},{key:"restoreCanvas",value:function(){this.canvas.getContext("2d").restore()}}]),t}();e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n0&&(this.drawRect(a-e.width*i,r,e.width*i,e.height,t),i=0);i>0&&this.drawRect(a-e.width*(i-1),r,e.width*i,e.height,t)}},{key:"drawSVGText",value:function(t,e,n){var r,o,i=this.document.createElementNS(s,"text");e.displayValue&&(i.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(r=0,i.setAttribute("text-anchor","start")):"right"==e.textAlign?(r=n.width-1,i.setAttribute("text-anchor","end")):(r=n.width/2,i.setAttribute("text-anchor","middle")),i.setAttribute("x",r),i.setAttribute("y",o),i.appendChild(this.document.createTextNode(n.text)),t.appendChild(i))}},{key:"setSvgAttributes",value:function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",s),n.setAttribute("version","1.1"),n.setAttribute("style","transform: translate(0,0)")}},{key:"createGroup",value:function(t,e,n){var r=this.document.createElementNS(s,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}},{key:"setGroupOptions",value:function(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}},{key:"drawRect",value:function(t,e,n,r,o){var i=this.document.createElementNS(s,"rect");return i.setAttribute("x",t),i.setAttribute("y",e),i.setAttribute("width",n),i.setAttribute("height",r),o.appendChild(i),i}}]),t}();e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function u(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e},e.getEncodingHeight=a,e.getBarcodePadding=u,e.calculateEncodingAttributes=function(t,e,n){for(var r=0;r0?(n=0,i.textAlign="left"):"right"==t.textAlign?(n=e.width-1,i.textAlign="right"):(n=e.width/2,i.textAlign="center"),i.fillText(e.text,n,r))}},{key:"moveCanvasDrawing",value:function(t){this.canvas.getContext("2d").translate(t.width,0)}},{key:"restoreCanvas",value:function(){this.canvas.getContext("2d").restore()}}]),t}();e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=function(){function t(t,e){for(var n=0;n0&&(this.drawRect(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&this.drawRect(a-e.width*(o-1),r,e.width*o,e.height,t)}},{key:"drawSVGText",value:function(t,e,n){var r,i,o=this.document.createElementNS(s,"text");e.displayValue&&(o.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),i="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(r=0,o.setAttribute("text-anchor","start")):"right"==e.textAlign?(r=n.width-1,o.setAttribute("text-anchor","end")):(r=n.width/2,o.setAttribute("text-anchor","middle")),o.setAttribute("x",r),o.setAttribute("y",i),o.appendChild(this.document.createTextNode(n.text)),t.appendChild(o))}},{key:"setSvgAttributes",value:function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",s),n.setAttribute("version","1.1"),n.setAttribute("style","transform: translate(0,0)")}},{key:"createGroup",value:function(t,e,n){var r=this.document.createElementNS(s,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}},{key:"setGroupOptions",value:function(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}},{key:"drawRect",value:function(t,e,n,r,i){var o=this.document.createElementNS(s,"rect");return o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o),o}}]),t}();e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function u(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e},e.getEncodingHeight=a,e.getBarcodePadding=u,e.calculateEncodingAttributes=function(t,e,n){for(var r=0;r0?(n=0,o.textAlign="left"):"right"==t.textAlign?(n=e.width-1,o.textAlign="right"):(n=e.width/2,o.textAlign="center"),o.fillText(e.text,n,r))}},{key:"moveCanvasDrawing",value:function(t){this.canvas.getContext("2d").translate(t.width,0)}},{key:"restoreCanvas",value:function(){this.canvas.getContext("2d").restore()}}]),t}();e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n0&&(this.drawRect(a-e.width*i,r,e.width*i,e.height,t),i=0);i>0&&this.drawRect(a-e.width*(i-1),r,e.width*i,e.height,t)}},{key:"drawSVGText",value:function(t,e,n){var r,o,i=this.document.createElementNS(s,"text");e.displayValue&&(i.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(r=0,i.setAttribute("text-anchor","start")):"right"==e.textAlign?(r=n.width-1,i.setAttribute("text-anchor","end")):(r=n.width/2,i.setAttribute("text-anchor","middle")),i.setAttribute("x",r),i.setAttribute("y",o),i.appendChild(this.document.createTextNode(n.text)),t.appendChild(i))}},{key:"setSvgAttributes",value:function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",s),n.setAttribute("version","1.1"),n.setAttribute("style","transform: translate(0,0)")}},{key:"createGroup",value:function(t,e,n){var r=this.document.createElementNS(s,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}},{key:"setGroupOptions",value:function(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}},{key:"drawRect",value:function(t,e,n,r,o){var i=this.document.createElementNS(s,"rect");return i.setAttribute("x",t),i.setAttribute("y",e),i.setAttribute("width",n),i.setAttribute("height",r),o.appendChild(i),i}}]),t}();e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function u(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e},e.getEncodingHeight=a,e.getBarcodePadding=u,e.calculateEncodingAttributes=function(t,e,n){for(var r=0;r=3&&this.number<=131070}}]),e}(((r=o)&&r.__esModule?r:{default:r}).default);e.pharmacode=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.data=e,this.text=n.text||e,this.options=n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=[];return function t(n){if(Array.isArray(n))for(var r=0;r0?(n=0,i.textAlign="left"):"right"==t.textAlign?(n=e.width-1,i.textAlign="right"):(n=e.width/2,i.textAlign="center"),i.fillText(e.text,n,r))}},{key:"moveCanvasDrawing",value:function(t){this.canvas.getContext("2d").translate(t.width,0)}},{key:"restoreCanvas",value:function(){this.canvas.getContext("2d").restore()}}]),t}();e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=function(){function t(t,e){for(var n=0;n0&&(this.drawRect(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&this.drawRect(a-e.width*(o-1),r,e.width*o,e.height,t)}},{key:"drawSVGText",value:function(t,e,n){var r,i,o=this.document.createElementNS(s,"text");e.displayValue&&(o.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),i="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(r=0,o.setAttribute("text-anchor","start")):"right"==e.textAlign?(r=n.width-1,o.setAttribute("text-anchor","end")):(r=n.width/2,o.setAttribute("text-anchor","middle")),o.setAttribute("x",r),o.setAttribute("y",i),o.appendChild(this.document.createTextNode(n.text)),t.appendChild(o))}},{key:"setSvgAttributes",value:function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",s),n.setAttribute("version","1.1"),n.setAttribute("style","transform: translate(0,0)")}},{key:"createGroup",value:function(t,e,n){var r=this.document.createElementNS(s,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}},{key:"setGroupOptions",value:function(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}},{key:"drawRect",value:function(t,e,n,r,i){var o=this.document.createElementNS(s,"rect");return o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o),o}}]),t}();e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n - - - - - - - - -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- - diff --git a/node_modules/jsbarcode/example/toBase64.html b/node_modules/jsbarcode/example/toBase64.html deleted file mode 100644 index 8bd2583..0000000 --- a/node_modules/jsbarcode/example/toBase64.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - Click Here - - - diff --git a/node_modules/jsbarcode/gulpfile.js b/node_modules/jsbarcode/gulpfile.js deleted file mode 100644 index 4d7cc64..0000000 --- a/node_modules/jsbarcode/gulpfile.js +++ /dev/null @@ -1,19 +0,0 @@ -/*eslint -no-console: 0 -*/ - -var gulp = require('gulp'); - -require('./automation/building.js'); -require('./automation/linting.js'); -require('./automation/releasing.js'); -require('./automation/misc.js'); - - -gulp.task('watch', gulp.series(['compile'], function () { - gulp.watch("src/**/*", ['compile']); -})); - -gulp.task('watch-web', gulp.series(['webpack'], function () { - gulp.watch("src/**/*", ['webpack']); -})); diff --git a/node_modules/jsbarcode/jsbarcode.d.ts b/node_modules/jsbarcode/jsbarcode.d.ts deleted file mode 100644 index 01003c8..0000000 --- a/node_modules/jsbarcode/jsbarcode.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -declare namespace JsBarcode { - interface BaseOptions { - width?: number; - height?: number; - format?: string; - displayValue?: boolean; - fontOptions?: string; - font?: string; - text?: string; - textAlign?: string; - textPosition?: string; - textMargin?: number; - fontSize?: number; - background?: string; - lineColor?: string; - margin?: number; - marginTop?: number; - marginBottom?: number; - marginLeft?: number; - marginRight?: number; - valid?: (valid: boolean) => void; - } - - interface NodeOptions extends BaseOptions { - xmlDocument?: XMLDocument; - } - - interface Code128Options extends BaseOptions { - ean128?: boolean; - } - - interface Ean8Options extends BaseOptions { - flat?: boolean; - } - - interface Ean13Options extends BaseOptions { - flat?: boolean; - lastChar?: string; - } - - type Options = BaseOptions | Code128Options | Ean13Options | NodeOptions; - - interface api { - options(options: Options): api; - blank(size: number): api; - init(options?: Options): void; - render(): void; - CODE39(value: string, options?: BaseOptions): api; - CODE128(value: string, options?: Code128Options): api; - CODE128A(value: string, options?: Code128Options): api; - CODE128B(value: string, options?: Code128Options): api; - CODE128C(value: string, options?: Code128Options): api; - EAN13(value: string, options?: Ean13Options): api; - EAN8(value: string, options?: Ean8Options): api; - EAN5(value: string, options?: BaseOptions): api; - EAN2(value: string, options?: BaseOptions): api; - UPC(value: string, options?: BaseOptions): api; - ITF14(value: string, options?: BaseOptions): api; - ITF(value: string, options?: BaseOptions): api; - MSI(value: string, options?: BaseOptions): api; - MSI10(value: string, options?: BaseOptions): api; - MSI11(value: string, options?: BaseOptions): api; - MSI1010(value: string, options?: BaseOptions): api; - MSI1110(value: string, options?: BaseOptions): api; - pharmacode(value: string, options?: BaseOptions): api; - codabar(value: string, options?: BaseOptions): api; - } -} - -declare function JsBarcode(element: any): JsBarcode.api; -declare function JsBarcode(element: any, data: string, options?: JsBarcode.Options): void; - -export = JsBarcode; -export as namespace JsBarcode; diff --git a/node_modules/jsbarcode/package.json b/node_modules/jsbarcode/package.json deleted file mode 100644 index b136d02..0000000 --- a/node_modules/jsbarcode/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "name": "jsbarcode", - "version": "3.11.5", - "description": "JsBarcode is a customizable barcode generator with support for multiple barcode formats.", - "main": "./bin/JsBarcode.js", - "directories": { - "example": "example", - "test": "test", - "lib": "src", - "bin": "bin" - }, - "scripts": { - "test": "gulp babel && node_modules/mocha/bin/mocha test/node/ -R spec", - "coveralls": "NODE_ENV=test YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha test/node/ --require blanket --reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js", - "coverage": "./node_modules/.bin/mocha test/node/ -r blanket -R html-cov > test/coverage.html", - "build": "gulp compile" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/lindell/JsBarcode.git" - }, - "keywords": [ - "barcode", - "canvas", - "code128", - "upc", - "ean", - "itf", - "msi", - "pharmacode" - ], - "author": "Johan Lindell", - "license": "MIT", - "bugs": { - "url": "https://github.com/lindell/JsBarcode/issues" - }, - "homepage": "https://github.com/lindell/JsBarcode#readme", - "devDependencies": { - "babel-cli": "^6.24.1", - "babel-core": "^6.24.1", - "babel-loader": "^7.0.0", - "babel-preset-es2015": "^6.24.1", - "babel-preset-stage-3": "6.24.1", - "blanket": "^1.2.3", - "canvas": "^2.6.1", - "coveralls": "^3.1.0", - "gulp": "^4.0.2", - "gulp-babel": "^6.1.2", - "gulp-bump": "^3.2.0", - "gulp-clean": "^0.4.0", - "gulp-concat": "^2.6.1", - "gulp-eslint": "^6.0.0", - "gulp-git": "^2.10.1", - "gulp-header": "^2.0.9", - "gulp-rename": "^2.0.0", - "gulp-uglify": "^3.0.2", - "gulp4-run-sequence": "^1.0.0", - "gzip-size": "^5.1.1", - "mocha": "^8.1.1", - "mocha-lcov-reporter": "^1.3.0", - "publish-release": "^1.6.1", - "request": "^2.88.2", - "webpack": "^4.44.1", - "webpack-stream": "^5.2.1", - "xmldom": "^0.1.31" - }, - "typings": "./jsbarcode.d.ts", - "config": { - "blanket": { - "pattern": [ - "JsBarcode.js", - "barcodes" - ], - "data-cover-never": [ - "GenericBarcode", - "node_modules" - ] - } - } -} diff --git a/node_modules/jsbarcode/src/JsBarcode.js b/node_modules/jsbarcode/src/JsBarcode.js deleted file mode 100644 index 177d9dd..0000000 --- a/node_modules/jsbarcode/src/JsBarcode.js +++ /dev/null @@ -1,225 +0,0 @@ -// Import all the barcodes -import barcodes from './barcodes/'; - -// Help functions -import merge from './help/merge.js'; -import linearizeEncodings from './help/linearizeEncodings.js'; -import fixOptions from './help/fixOptions.js'; -import getRenderProperties from './help/getRenderProperties.js'; -import optionsFromStrings from './help/optionsFromStrings.js'; - -// Exceptions -import ErrorHandler from './exceptions/ErrorHandler.js'; -import {InvalidInputException, NoElementException} from './exceptions/exceptions.js'; - -// Default values -import defaults from './options/defaults.js'; - -// The protype of the object returned from the JsBarcode() call -let API = function(){}; - -// The first call of the library API -// Will return an object with all barcodes calls and the data that is used -// by the renderers -let JsBarcode = function(element, text, options){ - var api = new API(); - - if(typeof element === "undefined"){ - throw Error("No element to render on was provided."); - } - - // Variables that will be pased through the API calls - api._renderProperties = getRenderProperties(element); - api._encodings = []; - api._options = defaults; - api._errorHandler = new ErrorHandler(api); - - // If text is set, use the simple syntax (render the barcode directly) - if(typeof text !== "undefined"){ - options = options || {}; - - if(!options.format){ - options.format = autoSelectBarcode(); - } - - api.options(options)[options.format](text, options).render(); - } - - return api; -}; - -// To make tests work TODO: remove -JsBarcode.getModule = function(name){ - return barcodes[name]; -}; - -// Register all barcodes -for(var name in barcodes){ - if(barcodes.hasOwnProperty(name)){ // Security check if the propery is a prototype property - registerBarcode(barcodes, name); - } -} -function registerBarcode(barcodes, name){ - API.prototype[name] = - API.prototype[name.toUpperCase()] = - API.prototype[name.toLowerCase()] = - function(text, options){ - var api = this; - return api._errorHandler.wrapBarcodeCall(function(){ - // Ensure text is options.text - options.text = typeof options.text === 'undefined' ? undefined : '' + options.text; - - var newOptions = merge(api._options, options); - newOptions = optionsFromStrings(newOptions); - var Encoder = barcodes[name]; - var encoded = encode(text, Encoder, newOptions); - api._encodings.push(encoded); - - return api; - }); - }; -} - -// encode() handles the Encoder call and builds the binary string to be rendered -function encode(text, Encoder, options){ - // Ensure that text is a string - text = "" + text; - - var encoder = new Encoder(text, options); - - // If the input is not valid for the encoder, throw error. - // If the valid callback option is set, call it instead of throwing error - if(!encoder.valid()){ - throw new InvalidInputException(encoder.constructor.name, text); - } - - // Make a request for the binary data (and other infromation) that should be rendered - var encoded = encoder.encode(); - - // Encodings can be nestled like [[1-1, 1-2], 2, [3-1, 3-2] - // Convert to [1-1, 1-2, 2, 3-1, 3-2] - encoded = linearizeEncodings(encoded); - - // Merge - for(let i = 0; i < encoded.length; i++){ - encoded[i].options = merge(options, encoded[i].options); - } - - return encoded; -} - -function autoSelectBarcode(){ - // If CODE128 exists. Use it - if(barcodes["CODE128"]){ - return "CODE128"; - } - - // Else, take the first (probably only) barcode - return Object.keys(barcodes)[0]; -} - -// Sets global encoder options -// Added to the api by the JsBarcode function -API.prototype.options = function(options){ - this._options = merge(this._options, options); - return this; -}; - -// Will create a blank space (usually in between barcodes) -API.prototype.blank = function(size){ - const zeroes = new Array(size + 1).join("0"); - this._encodings.push({data: zeroes}); - return this; -}; - -// Initialize JsBarcode on all HTML elements defined. -API.prototype.init = function(){ - // Should do nothing if no elements where found - if(!this._renderProperties){ - return; - } - - // Make sure renderProperies is an array - if(!Array.isArray(this._renderProperties)){ - this._renderProperties = [this._renderProperties]; - } - - var renderProperty; - for(let i in this._renderProperties){ - renderProperty = this._renderProperties[i]; - var options = merge(this._options, renderProperty.options); - - if(options.format == "auto"){ - options.format = autoSelectBarcode(); - } - - this._errorHandler.wrapBarcodeCall(function(){ - var text = options.value; - var Encoder = barcodes[options.format.toUpperCase()]; - var encoded = encode(text, Encoder, options); - - render(renderProperty, encoded, options); - }); - } -}; - - -// The render API call. Calls the real render function. -API.prototype.render = function(){ - if(!this._renderProperties){ - throw new NoElementException(); - } - - if(Array.isArray(this._renderProperties)){ - for(var i = 0; i < this._renderProperties.length; i++){ - render(this._renderProperties[i], this._encodings, this._options); - } - } - else{ - render(this._renderProperties, this._encodings, this._options); - } - - return this; -}; - -API.prototype._defaults = defaults; - -// Prepares the encodings and calls the renderer -function render(renderProperties, encodings, options){ - encodings = linearizeEncodings(encodings); - - for(let i = 0; i < encodings.length; i++){ - encodings[i].options = merge(options, encodings[i].options); - fixOptions(encodings[i].options); - } - - fixOptions(options); - - var Renderer = renderProperties.renderer; - var renderer = new Renderer(renderProperties.element, encodings, options); - renderer.render(); - - if(renderProperties.afterRender){ - renderProperties.afterRender(); - } -} - -// Export to browser -if(typeof window !== "undefined"){ - window.JsBarcode = JsBarcode; -} - -// Export to jQuery -/*global jQuery */ -if (typeof jQuery !== 'undefined') { - jQuery.fn.JsBarcode = function(content, options){ - var elementArray = []; - jQuery(this).each(function() { - elementArray.push(this); - }); - return JsBarcode(elementArray, content, options); - }; -} - -// Export to commonJS -module.exports = JsBarcode; diff --git a/node_modules/jsbarcode/src/barcodes/Barcode.js b/node_modules/jsbarcode/src/barcodes/Barcode.js deleted file mode 100644 index 89a55e0..0000000 --- a/node_modules/jsbarcode/src/barcodes/Barcode.js +++ /dev/null @@ -1,9 +0,0 @@ -class Barcode{ - constructor(data, options){ - this.data = data; - this.text = options.text || data; - this.options = options; - } -} - -export default Barcode; diff --git a/node_modules/jsbarcode/src/barcodes/CODE128/CODE128.js b/node_modules/jsbarcode/src/barcodes/CODE128/CODE128.js deleted file mode 100644 index dfd929b..0000000 --- a/node_modules/jsbarcode/src/barcodes/CODE128/CODE128.js +++ /dev/null @@ -1,127 +0,0 @@ -import Barcode from "../Barcode.js"; -import { SHIFT, SET_A, SET_B, MODULO, STOP, FNC1, SET_BY_CODE, SWAP, BARS } from './constants'; - -// This is the master class, -// it does require the start code to be included in the string -class CODE128 extends Barcode { - constructor(data, options) { - super(data.substring(1), options); - - // Get array of ascii codes from data - this.bytes = data.split('') - .map(char => char.charCodeAt(0)); - } - - valid() { - // ASCII value ranges 0-127, 200-211 - return /^[\x00-\x7F\xC8-\xD3]+$/.test(this.data); - } - - // The public encoding function - encode() { - const bytes = this.bytes; - // Remove the start code from the bytes and set its index - const startIndex = bytes.shift() - 105; - // Get start set by index - const startSet = SET_BY_CODE[startIndex]; - - if (startSet === undefined) { - throw new RangeError('The encoding does not start with a start character.'); - } - - if (this.shouldEncodeAsEan128() === true) { - bytes.unshift(FNC1); - } - - // Start encode with the right type - const encodingResult = CODE128.next(bytes, 1, startSet); - - return { - text: - this.text === this.data - ? this.text.replace(/[^\x20-\x7E]/g, '') - : this.text, - data: - // Add the start bits - CODE128.getBar(startIndex) + - // Add the encoded bits - encodingResult.result + - // Add the checksum - CODE128.getBar((encodingResult.checksum + startIndex) % MODULO) + - // Add the end bits - CODE128.getBar(STOP) - }; - } - - // GS1-128/EAN-128 - shouldEncodeAsEan128() { - let isEAN128 = this.options.ean128 || false; - if (typeof isEAN128 === 'string') { - isEAN128 = isEAN128.toLowerCase() === 'true'; - } - return isEAN128; - } - - // Get a bar symbol by index - static getBar(index) { - return BARS[index] ? BARS[index].toString() : ''; - } - - // Correct an index by a set and shift it from the bytes array - static correctIndex(bytes, set) { - if (set === SET_A) { - const charCode = bytes.shift(); - return charCode < 32 ? charCode + 64 : charCode - 32; - } else if (set === SET_B) { - return bytes.shift() - 32; - } else { - return (bytes.shift() - 48) * 10 + bytes.shift() - 48; - } - } - - static next(bytes, pos, set) { - if (!bytes.length) { - return { result: '', checksum: 0 }; - } - - let nextCode, index; - - // Special characters - if (bytes[0] >= 200){ - index = bytes.shift() - 105; - const nextSet = SWAP[index]; - - // Swap to other set - if (nextSet !== undefined) { - nextCode = CODE128.next(bytes, pos + 1, nextSet); - } - // Continue on current set but encode a special character - else { - // Shift - if ((set === SET_A || set === SET_B) && index === SHIFT) { - // Convert the next character so that is encoded correctly - bytes[0] = (set === SET_A) - ? bytes[0] > 95 ? bytes[0] - 96 : bytes[0] - : bytes[0] < 32 ? bytes[0] + 96 : bytes[0]; - } - nextCode = CODE128.next(bytes, pos + 1, set); - } - } - // Continue encoding - else { - index = CODE128.correctIndex(bytes, set); - nextCode = CODE128.next(bytes, pos + 1, set); - } - - // Get the correct binary encoding and calculate the weight - const enc = CODE128.getBar(index); - const weight = index * pos; - - return { - result: enc + nextCode.result, - checksum: weight + nextCode.checksum - }; - } -} - -export default CODE128; diff --git a/node_modules/jsbarcode/src/barcodes/CODE128/CODE128A.js b/node_modules/jsbarcode/src/barcodes/CODE128/CODE128A.js deleted file mode 100644 index c8e9af5..0000000 --- a/node_modules/jsbarcode/src/barcodes/CODE128/CODE128A.js +++ /dev/null @@ -1,14 +0,0 @@ -import CODE128 from './CODE128.js'; -import { A_START_CHAR, A_CHARS } from './constants'; - -class CODE128A extends CODE128 { - constructor(string, options) { - super(A_START_CHAR + string, options); - } - - valid() { - return (new RegExp(`^${A_CHARS}+$`)).test(this.data); - } -} - -export default CODE128A; diff --git a/node_modules/jsbarcode/src/barcodes/CODE128/CODE128B.js b/node_modules/jsbarcode/src/barcodes/CODE128/CODE128B.js deleted file mode 100644 index 0056315..0000000 --- a/node_modules/jsbarcode/src/barcodes/CODE128/CODE128B.js +++ /dev/null @@ -1,14 +0,0 @@ -import CODE128 from './CODE128.js'; -import { B_START_CHAR, B_CHARS } from './constants'; - -class CODE128B extends CODE128 { - constructor(string, options) { - super(B_START_CHAR + string, options); - } - - valid() { - return (new RegExp(`^${B_CHARS}+$`)).test(this.data); - } -} - -export default CODE128B; diff --git a/node_modules/jsbarcode/src/barcodes/CODE128/CODE128C.js b/node_modules/jsbarcode/src/barcodes/CODE128/CODE128C.js deleted file mode 100644 index db33269..0000000 --- a/node_modules/jsbarcode/src/barcodes/CODE128/CODE128C.js +++ /dev/null @@ -1,14 +0,0 @@ -import CODE128 from './CODE128.js'; -import { C_START_CHAR, C_CHARS } from './constants'; - -class CODE128C extends CODE128 { - constructor(string, options) { - super(C_START_CHAR + string, options); - } - - valid() { - return (new RegExp(`^${C_CHARS}+$`)).test(this.data); - } -} - -export default CODE128C; diff --git a/node_modules/jsbarcode/src/barcodes/CODE128/CODE128_AUTO.js b/node_modules/jsbarcode/src/barcodes/CODE128/CODE128_AUTO.js deleted file mode 100644 index 6b00643..0000000 --- a/node_modules/jsbarcode/src/barcodes/CODE128/CODE128_AUTO.js +++ /dev/null @@ -1,15 +0,0 @@ -import CODE128 from './CODE128'; -import autoSelectModes from './auto'; - -class CODE128AUTO extends CODE128{ - constructor(data, options){ - // ASCII value ranges 0-127, 200-211 - if (/^[\x00-\x7F\xC8-\xD3]+$/.test(data)) { - super(autoSelectModes(data), options); - } else{ - super(data, options); - } - } -} - -export default CODE128AUTO; diff --git a/node_modules/jsbarcode/src/barcodes/CODE128/auto.js b/node_modules/jsbarcode/src/barcodes/CODE128/auto.js deleted file mode 100644 index 5a88938..0000000 --- a/node_modules/jsbarcode/src/barcodes/CODE128/auto.js +++ /dev/null @@ -1,68 +0,0 @@ -import { A_START_CHAR, B_START_CHAR, C_START_CHAR, A_CHARS, B_CHARS, C_CHARS } from './constants'; - -// Match Set functions -const matchSetALength = (string) => string.match(new RegExp(`^${A_CHARS}*`))[0].length; -const matchSetBLength = (string) => string.match(new RegExp(`^${B_CHARS}*`))[0].length; -const matchSetC = (string) => string.match(new RegExp(`^${C_CHARS}*`))[0]; - -// CODE128A or CODE128B -function autoSelectFromAB(string, isA){ - const ranges = isA ? A_CHARS : B_CHARS; - const untilC = string.match(new RegExp(`^(${ranges}+?)(([0-9]{2}){2,})([^0-9]|$)`)); - - if (untilC) { - return ( - untilC[1] + - String.fromCharCode(204) + - autoSelectFromC(string.substring(untilC[1].length)) - ); - } - - const chars = string.match(new RegExp(`^${ranges}+`))[0]; - - if (chars.length === string.length) { - return string; - } - - return ( - chars + - String.fromCharCode(isA ? 205 : 206) + - autoSelectFromAB(string.substring(chars.length), !isA) - ); -} - -// CODE128C -function autoSelectFromC(string) { - const cMatch = matchSetC(string); - const length = cMatch.length; - - if (length === string.length) { - return string; - } - - string = string.substring(length); - - // Select A/B depending on the longest match - const isA = matchSetALength(string) >= matchSetBLength(string); - return cMatch + String.fromCharCode(isA ? 206 : 205) + autoSelectFromAB(string, isA); -} - -// Detect Code Set (A, B or C) and format the string -export default (string) => { - let newString; - const cLength = matchSetC(string).length; - - // Select 128C if the string start with enough digits - if (cLength >= 2) { - newString = C_START_CHAR + autoSelectFromC(string); - } else { - // Select A/B depending on the longest match - const isA = matchSetALength(string) > matchSetBLength(string); - newString = (isA ? A_START_CHAR : B_START_CHAR) + autoSelectFromAB(string, isA); - } - - return newString.replace( - /[\xCD\xCE]([^])[\xCD\xCE]/, // Any sequence between 205 and 206 characters - (match, char) => String.fromCharCode(203) + char - ); -}; diff --git a/node_modules/jsbarcode/src/barcodes/CODE128/constants.js b/node_modules/jsbarcode/src/barcodes/CODE128/constants.js deleted file mode 100644 index 10846ca..0000000 --- a/node_modules/jsbarcode/src/barcodes/CODE128/constants.js +++ /dev/null @@ -1,71 +0,0 @@ -// constants for internal usage -export const SET_A = 0; -export const SET_B = 1; -export const SET_C = 2; - -// Special characters -export const SHIFT = 98; -export const START_A = 103; -export const START_B = 104; -export const START_C = 105; -export const MODULO = 103; -export const STOP = 106; -export const FNC1 = 207; - -// Get set by start code -export const SET_BY_CODE = { - [START_A]: SET_A, - [START_B]: SET_B, - [START_C]: SET_C, -}; - -// Get next set by code -export const SWAP = { - 101: SET_A, - 100: SET_B, - 99: SET_C, -}; - -export const A_START_CHAR = String.fromCharCode(208); // START_A + 105 -export const B_START_CHAR = String.fromCharCode(209); // START_B + 105 -export const C_START_CHAR = String.fromCharCode(210); // START_C + 105 - -// 128A (Code Set A) -// ASCII characters 00 to 95 (0–9, A–Z and control codes), special characters, and FNC 1–4 -export const A_CHARS = "[\x00-\x5F\xC8-\xCF]"; - -// 128B (Code Set B) -// ASCII characters 32 to 127 (0–9, A–Z, a–z), special characters, and FNC 1–4 -export const B_CHARS = "[\x20-\x7F\xC8-\xCF]"; - -// 128C (Code Set C) -// 00–99 (encodes two digits with a single code point) and FNC1 -export const C_CHARS = "(\xCF*[0-9]{2}\xCF*)"; - -// CODE128 includes 107 symbols: -// 103 data symbols, 3 start symbols (A, B and C), and 1 stop symbol (the last one) -// Each symbol consist of three black bars (1) and three white spaces (0). -export const BARS = [ - 11011001100, 11001101100, 11001100110, 10010011000, 10010001100, - 10001001100, 10011001000, 10011000100, 10001100100, 11001001000, - 11001000100, 11000100100, 10110011100, 10011011100, 10011001110, - 10111001100, 10011101100, 10011100110, 11001110010, 11001011100, - 11001001110, 11011100100, 11001110100, 11101101110, 11101001100, - 11100101100, 11100100110, 11101100100, 11100110100, 11100110010, - 11011011000, 11011000110, 11000110110, 10100011000, 10001011000, - 10001000110, 10110001000, 10001101000, 10001100010, 11010001000, - 11000101000, 11000100010, 10110111000, 10110001110, 10001101110, - 10111011000, 10111000110, 10001110110, 11101110110, 11010001110, - 11000101110, 11011101000, 11011100010, 11011101110, 11101011000, - 11101000110, 11100010110, 11101101000, 11101100010, 11100011010, - 11101111010, 11001000010, 11110001010, 10100110000, 10100001100, - 10010110000, 10010000110, 10000101100, 10000100110, 10110010000, - 10110000100, 10011010000, 10011000010, 10000110100, 10000110010, - 11000010010, 11001010000, 11110111010, 11000010100, 10001111010, - 10100111100, 10010111100, 10010011110, 10111100100, 10011110100, - 10011110010, 11110100100, 11110010100, 11110010010, 11011011110, - 11011110110, 11110110110, 10101111000, 10100011110, 10001011110, - 10111101000, 10111100010, 11110101000, 11110100010, 10111011110, - 10111101110, 11101011110, 11110101110, 11010000100, 11010010000, - 11010011100, 1100011101011 -]; diff --git a/node_modules/jsbarcode/src/barcodes/CODE128/index.js b/node_modules/jsbarcode/src/barcodes/CODE128/index.js deleted file mode 100644 index e45411d..0000000 --- a/node_modules/jsbarcode/src/barcodes/CODE128/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import CODE128 from './CODE128_AUTO.js'; -import CODE128A from './CODE128A.js'; -import CODE128B from './CODE128B.js'; -import CODE128C from './CODE128C.js'; - -export {CODE128, CODE128A, CODE128B, CODE128C}; diff --git a/node_modules/jsbarcode/src/barcodes/CODE39/index.js b/node_modules/jsbarcode/src/barcodes/CODE39/index.js deleted file mode 100644 index e793a6a..0000000 --- a/node_modules/jsbarcode/src/barcodes/CODE39/index.js +++ /dev/null @@ -1,105 +0,0 @@ -// Encoding documentation: -// https://en.wikipedia.org/wiki/Code_39#Encoding - -import Barcode from "../Barcode.js"; - -class CODE39 extends Barcode { - constructor(data, options){ - data = data.toUpperCase(); - - // Calculate mod43 checksum if enabled - if(options.mod43){ - data += getCharacter(mod43checksum(data)); - } - - super(data, options); - } - - encode(){ - // First character is always a * - var result = getEncoding("*"); - - // Take every character and add the binary representation to the result - for(let i = 0; i < this.data.length; i++){ - result += getEncoding(this.data[i]) + "0"; - } - - // Last character is always a * - result += getEncoding("*"); - - return { - data: result, - text: this.text - }; - } - - valid(){ - return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/) !== -1; - } -} - - - - - - -// All characters. The position in the array is the (checksum) value -var characters = [ - "0", "1", "2", "3", - "4", "5", "6", "7", - "8", "9", "A", "B", - "C", "D", "E", "F", - "G", "H", "I", "J", - "K", "L", "M", "N", - "O", "P", "Q", "R", - "S", "T", "U", "V", - "W", "X", "Y", "Z", - "-", ".", " ", "$", - "/", "+", "%", "*" -]; - -// The decimal representation of the characters, is converted to the -// corresponding binary with the getEncoding function -var encodings = [ - 20957, 29783, 23639, 30485, - 20951, 29813, 23669, 20855, - 29789, 23645, 29975, 23831, - 30533, 22295, 30149, 24005, - 21623, 29981, 23837, 22301, - 30023, 23879, 30545, 22343, - 30161, 24017, 21959, 30065, - 23921, 22385, 29015, 18263, - 29141, 17879, 29045, 18293, - 17783, 29021, 18269, 17477, - 17489, 17681, 20753, 35770 -]; - -// Get the binary representation of a character by converting the encodings -// from decimal to binary -function getEncoding(character){ - return getBinary(characterValue(character)); -} - -function getBinary(characterValue){ - return encodings[characterValue].toString(2); -} - -function getCharacter(characterValue){ - return characters[characterValue]; -} - -function characterValue(character){ - return characters.indexOf(character); -} - -function mod43checksum(data){ - var checksum = 0; - for(let i = 0; i < data.length; i++){ - checksum += characterValue(data[i]); - } - - checksum = checksum % 43; - return checksum; -} - -export {CODE39}; diff --git a/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN.js b/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN.js deleted file mode 100644 index b6260cf..0000000 --- a/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN.js +++ /dev/null @@ -1,72 +0,0 @@ -import { SIDE_BIN, MIDDLE_BIN } from './constants'; -import encode from './encoder'; -import Barcode from '../Barcode'; - -// Base class for EAN8 & EAN13 -class EAN extends Barcode { - - constructor(data, options) { - super(data, options); - - // Make sure the font is not bigger than the space between the guard bars - this.fontSize = !options.flat && options.fontSize > options.width * 10 - ? options.width * 10 - : options.fontSize; - - // Make the guard bars go down half the way of the text - this.guardHeight = options.height + this.fontSize / 2 + options.textMargin; - } - - encode() { - return this.options.flat - ? this.encodeFlat() - : this.encodeGuarded(); - } - - leftText(from, to) { - return this.text.substr(from, to); - } - - leftEncode(data, structure) { - return encode(data, structure); - } - - rightText(from, to) { - return this.text.substr(from, to); - } - - rightEncode(data, structure) { - return encode(data, structure); - } - - encodeGuarded() { - const textOptions = { fontSize: this.fontSize }; - const guardOptions = { height: this.guardHeight }; - - return [ - { data: SIDE_BIN, options: guardOptions }, - { data: this.leftEncode(), text: this.leftText(), options: textOptions }, - { data: MIDDLE_BIN, options: guardOptions }, - { data: this.rightEncode(), text: this.rightText(), options: textOptions }, - { data: SIDE_BIN, options: guardOptions }, - ]; - } - - encodeFlat() { - const data = [ - SIDE_BIN, - this.leftEncode(), - MIDDLE_BIN, - this.rightEncode(), - SIDE_BIN - ]; - - return { - data: data.join(''), - text: this.text - }; - } - -} - -export default EAN; diff --git a/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN13.js b/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN13.js deleted file mode 100644 index dc82dd9..0000000 --- a/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN13.js +++ /dev/null @@ -1,90 +0,0 @@ -// Encoding documentation: -// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Binary_encoding_of_data_digits_into_EAN-13_barcode - -import { EAN13_STRUCTURE } from './constants'; -import EAN from './EAN'; - -// Calculate the checksum digit -// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit -const checksum = (number) => { - const res = number - .substr(0, 12) - .split('') - .map((n) => +n) - .reduce((sum, a, idx) => ( - idx % 2 ? sum + a * 3 : sum + a - ), 0); - - return (10 - (res % 10)) % 10; -}; - -class EAN13 extends EAN { - - constructor(data, options) { - // Add checksum if it does not exist - if (data.search(/^[0-9]{12}$/) !== -1) { - data += checksum(data); - } - - super(data, options); - - // Adds a last character to the end of the barcode - this.lastChar = options.lastChar; - } - - valid() { - return ( - this.data.search(/^[0-9]{13}$/) !== -1 && - +this.data[12] === checksum(this.data) - ); - } - - leftText() { - return super.leftText(1, 6); - } - - leftEncode() { - const data = this.data.substr(1, 6); - const structure = EAN13_STRUCTURE[this.data[0]]; - return super.leftEncode(data, structure); - } - - rightText() { - return super.rightText(7, 6); - } - - rightEncode() { - const data = this.data.substr(7, 6); - return super.rightEncode(data, 'RRRRRR'); - } - - // The "standard" way of printing EAN13 barcodes with guard bars - encodeGuarded() { - const data = super.encodeGuarded(); - - // Extend data with left digit & last character - if (this.options.displayValue) { - data.unshift({ - data: '000000000000', - text: this.text.substr(0, 1), - options: { textAlign: 'left', fontSize: this.fontSize } - }); - - if (this.options.lastChar) { - data.push({ - data: '00' - }); - data.push({ - data: '00000', - text: this.options.lastChar, - options: { fontSize: this.fontSize } - }); - } - } - - return data; - } - -} - -export default EAN13; diff --git a/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN2.js b/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN2.js deleted file mode 100644 index 672ee8e..0000000 --- a/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN2.js +++ /dev/null @@ -1,30 +0,0 @@ -// Encoding documentation: -// https://en.wikipedia.org/wiki/EAN_2#Encoding - -import { EAN2_STRUCTURE } from './constants'; -import encode from './encoder'; -import Barcode from '../Barcode'; - -class EAN2 extends Barcode { - - constructor(data, options) { - super(data, options); - } - - valid() { - return this.data.search(/^[0-9]{2}$/) !== -1; - } - - encode(){ - // Choose the structure based on the number mod 4 - const structure = EAN2_STRUCTURE[parseInt(this.data) % 4]; - return { - // Start bits + Encode the two digits with 01 in between - data: '1011' + encode(this.data, structure, '01'), - text: this.text - }; - } - -} - -export default EAN2; diff --git a/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN5.js b/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN5.js deleted file mode 100644 index 79b89e5..0000000 --- a/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN5.js +++ /dev/null @@ -1,40 +0,0 @@ -// Encoding documentation: -// https://en.wikipedia.org/wiki/EAN_5#Encoding - -import { EAN5_STRUCTURE } from './constants'; -import encode from './encoder'; -import Barcode from '../Barcode'; - -const checksum = (data) => { - const result = data - .split('') - .map(n => +n) - .reduce((sum, a, idx) => { - return idx % 2 - ? sum + a * 9 - : sum + a * 3; - }, 0); - return result % 10; -}; - -class EAN5 extends Barcode { - - constructor(data, options) { - super(data, options); - } - - valid() { - return this.data.search(/^[0-9]{5}$/) !== -1; - } - - encode() { - const structure = EAN5_STRUCTURE[checksum(this.data)]; - return { - data: '1011' + encode(this.data, structure, '01'), - text: this.text - }; - } - -} - -export default EAN5; diff --git a/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN8.js b/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN8.js deleted file mode 100644 index adf608c..0000000 --- a/node_modules/jsbarcode/src/barcodes/EAN_UPC/EAN8.js +++ /dev/null @@ -1,57 +0,0 @@ -// Encoding documentation: -// http://www.barcodeisland.com/ean8.phtml - -import EAN from './EAN'; - -// Calculate the checksum digit -const checksum = (number) => { - const res = number - .substr(0, 7) - .split('') - .map((n) => +n) - .reduce((sum, a, idx) => ( - idx % 2 ? sum + a : sum + a * 3 - ), 0); - - return (10 - (res % 10)) % 10; -}; - -class EAN8 extends EAN { - - constructor(data, options) { - // Add checksum if it does not exist - if (data.search(/^[0-9]{7}$/) !== -1) { - data += checksum(data); - } - - super(data, options); - } - - valid() { - return ( - this.data.search(/^[0-9]{8}$/) !== -1 && - +this.data[7] === checksum(this.data) - ); - } - - leftText() { - return super.leftText(0, 4); - } - - leftEncode() { - const data = this.data.substr(0, 4); - return super.leftEncode(data, 'LLLL'); - } - - rightText() { - return super.rightText(4, 4); - } - - rightEncode() { - const data = this.data.substr(4, 4); - return super.rightEncode(data, 'RRRR'); - } - -} - -export default EAN8; diff --git a/node_modules/jsbarcode/src/barcodes/EAN_UPC/UPC.js b/node_modules/jsbarcode/src/barcodes/EAN_UPC/UPC.js deleted file mode 100644 index 8e36bcb..0000000 --- a/node_modules/jsbarcode/src/barcodes/EAN_UPC/UPC.js +++ /dev/null @@ -1,132 +0,0 @@ -// Encoding documentation: -// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding - -import encode from './encoder'; -import Barcode from "../Barcode.js"; - -class UPC extends Barcode{ - constructor(data, options){ - // Add checksum if it does not exist - if(data.search(/^[0-9]{11}$/) !== -1){ - data += checksum(data); - } - - super(data, options); - - this.displayValue = options.displayValue; - - // Make sure the font is not bigger than the space between the guard bars - if(options.fontSize > options.width * 10){ - this.fontSize = options.width * 10; - } - else{ - this.fontSize = options.fontSize; - } - - // Make the guard bars go down half the way of the text - this.guardHeight = options.height + this.fontSize / 2 + options.textMargin; - } - - valid(){ - return this.data.search(/^[0-9]{12}$/) !== -1 && - this.data[11] == checksum(this.data); - } - - encode(){ - if(this.options.flat){ - return this.flatEncoding(); - } - else{ - return this.guardedEncoding(); - } - } - - flatEncoding(){ - var result = ""; - - result += "101"; - result += encode(this.data.substr(0, 6), "LLLLLL"); - result += "01010"; - result += encode(this.data.substr(6, 6), "RRRRRR"); - result += "101"; - - return { - data: result, - text: this.text - }; - } - - guardedEncoding(){ - var result = []; - - // Add the first digit - if(this.displayValue){ - result.push({ - data: "00000000", - text: this.text.substr(0, 1), - options: {textAlign: "left", fontSize: this.fontSize} - }); - } - - // Add the guard bars - result.push({ - data: "101" + encode(this.data[0], "L"), - options: {height: this.guardHeight} - }); - - // Add the left side - result.push({ - data: encode(this.data.substr(1, 5), "LLLLL"), - text: this.text.substr(1, 5), - options: {fontSize: this.fontSize} - }); - - // Add the middle bits - result.push({ - data: "01010", - options: {height: this.guardHeight} - }); - - // Add the right side - result.push({ - data: encode(this.data.substr(6, 5), "RRRRR"), - text: this.text.substr(6, 5), - options: {fontSize: this.fontSize} - }); - - // Add the end bits - result.push({ - data: encode(this.data[11], "R") + "101", - options: {height: this.guardHeight} - }); - - // Add the last digit - if(this.displayValue){ - result.push({ - data: "00000000", - text: this.text.substr(11, 1), - options: {textAlign: "right", fontSize: this.fontSize} - }); - } - - return result; - } -} - -// Calulate the checksum digit -// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit -export function checksum(number){ - var result = 0; - - var i; - for(i = 1; i < 11; i += 2){ - result += parseInt(number[i]); - } - for(i = 0; i < 11; i += 2){ - result += parseInt(number[i]) * 3; - } - - return (10 - (result % 10)) % 10; -} - -export default UPC; diff --git a/node_modules/jsbarcode/src/barcodes/EAN_UPC/UPCE.js b/node_modules/jsbarcode/src/barcodes/EAN_UPC/UPCE.js deleted file mode 100644 index 3b9b360..0000000 --- a/node_modules/jsbarcode/src/barcodes/EAN_UPC/UPCE.js +++ /dev/null @@ -1,177 +0,0 @@ -// Encoding documentation: -// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding -// -// UPC-E documentation: -// https://en.wikipedia.org/wiki/Universal_Product_Code#UPC-E - -import encode from './encoder'; -import Barcode from "../Barcode.js"; -import { checksum } from './UPC.js'; - -const EXPANSIONS = [ - "XX00000XXX", - "XX10000XXX", - "XX20000XXX", - "XXX00000XX", - "XXXX00000X", - "XXXXX00005", - "XXXXX00006", - "XXXXX00007", - "XXXXX00008", - "XXXXX00009" -]; - -const PARITIES = [ - ["EEEOOO", "OOOEEE"], - ["EEOEOO", "OOEOEE"], - ["EEOOEO", "OOEEOE"], - ["EEOOOE", "OOEEEO"], - ["EOEEOO", "OEOOEE"], - ["EOOEEO", "OEEOOE"], - ["EOOOEE", "OEEEOO"], - ["EOEOEO", "OEOEOE"], - ["EOEOOE", "OEOEEO"], - ["EOOEOE", "OEEOEO"] -]; - -class UPCE extends Barcode{ - constructor(data, options){ - // Code may be 6 or 8 digits; - // A 7 digit code is ambiguous as to whether the extra digit - // is a UPC-A check or number system digit. - super(data, options); - this.isValid = false; - if(data.search(/^[0-9]{6}$/) !== -1){ - this.middleDigits = data; - this.upcA = expandToUPCA(data, "0"); - this.text = options.text || - `${this.upcA[0]}${data}${this.upcA[this.upcA.length - 1]}`; - this.isValid = true; - } - else if(data.search(/^[01][0-9]{7}$/) !== -1){ - this.middleDigits = data.substring(1, data.length - 1); - this.upcA = expandToUPCA(this.middleDigits, data[0]); - - if(this.upcA[this.upcA.length - 1] === data[data.length - 1]){ - this.isValid = true; - } - else{ - // checksum mismatch - return; - } - } - else{ - return; - } - - this.displayValue = options.displayValue; - - // Make sure the font is not bigger than the space between the guard bars - if(options.fontSize > options.width * 10){ - this.fontSize = options.width * 10; - } - else{ - this.fontSize = options.fontSize; - } - - // Make the guard bars go down half the way of the text - this.guardHeight = options.height + this.fontSize / 2 + options.textMargin; - } - - valid(){ - return this.isValid; - } - - encode(){ - if(this.options.flat){ - return this.flatEncoding(); - } - else{ - return this.guardedEncoding(); - } - } - - flatEncoding(){ - var result = ""; - - result += "101"; - result += this.encodeMiddleDigits(); - result += "010101"; - - return { - data: result, - text: this.text - }; - } - - guardedEncoding(){ - var result = []; - - // Add the UPC-A number system digit beneath the quiet zone - if(this.displayValue){ - result.push({ - data: "00000000", - text: this.text[0], - options: {textAlign: "left", fontSize: this.fontSize} - }); - } - - // Add the guard bars - result.push({ - data: "101", - options: {height: this.guardHeight} - }); - - // Add the 6 UPC-E digits - result.push({ - data: this.encodeMiddleDigits(), - text: this.text.substring(1, 7), - options: {fontSize: this.fontSize} - }); - - // Add the end bits - result.push({ - data: "010101", - options: {height: this.guardHeight} - }); - - // Add the UPC-A check digit beneath the quiet zone - if(this.displayValue){ - result.push({ - data: "00000000", - text: this.text[7], - options: {textAlign: "right", fontSize: this.fontSize} - }); - } - - return result; - } - - encodeMiddleDigits() { - const numberSystem = this.upcA[0]; - const checkDigit = this.upcA[this.upcA.length - 1]; - const parity = PARITIES[parseInt(checkDigit)][parseInt(numberSystem)]; - return encode(this.middleDigits, parity); - } -} - -function expandToUPCA(middleDigits, numberSystem) { - const lastUpcE = parseInt(middleDigits[middleDigits.length - 1]); - const expansion = EXPANSIONS[lastUpcE]; - - let result = ""; - let digitIndex = 0; - for(let i = 0; i < expansion.length; i++) { - let c = expansion[i]; - if (c === 'X') { - result += middleDigits[digitIndex++]; - } else { - result += c; - } - } - - result = `${numberSystem}${result}`; - return `${result}${checksum(result)}`; -} - -export default UPCE; diff --git a/node_modules/jsbarcode/src/barcodes/EAN_UPC/constants.js b/node_modules/jsbarcode/src/barcodes/EAN_UPC/constants.js deleted file mode 100644 index abbe38f..0000000 --- a/node_modules/jsbarcode/src/barcodes/EAN_UPC/constants.js +++ /dev/null @@ -1,41 +0,0 @@ -// Standard start end and middle bits -export const SIDE_BIN = '101'; -export const MIDDLE_BIN = '01010'; - -export const BINARIES = { - 'L': [ // The L (left) type of encoding - '0001101', '0011001', '0010011', '0111101', '0100011', - '0110001', '0101111', '0111011', '0110111', '0001011' - ], - 'G': [ // The G type of encoding - '0100111', '0110011', '0011011', '0100001', '0011101', - '0111001', '0000101', '0010001', '0001001', '0010111' - ], - 'R': [ // The R (right) type of encoding - '1110010', '1100110', '1101100', '1000010', '1011100', - '1001110', '1010000', '1000100', '1001000', '1110100' - ], - 'O': [ // The O (odd) encoding for UPC-E - '0001101', '0011001', '0010011', '0111101', '0100011', - '0110001', '0101111', '0111011', '0110111', '0001011' - ], - 'E': [ // The E (even) encoding for UPC-E - '0100111', '0110011', '0011011', '0100001', '0011101', - '0111001', '0000101', '0010001', '0001001', '0010111' - ] -}; - -// Define the EAN-2 structure -export const EAN2_STRUCTURE = ['LL', 'LG', 'GL', 'GG']; - -// Define the EAN-5 structure -export const EAN5_STRUCTURE = [ - 'GGLLL', 'GLGLL', 'GLLGL', 'GLLLG', 'LGGLL', - 'LLGGL', 'LLLGG', 'LGLGL', 'LGLLG', 'LLGLG' -]; - -// Define the EAN-13 structure -export const EAN13_STRUCTURE = [ - 'LLLLLL', 'LLGLGG', 'LLGGLG', 'LLGGGL', 'LGLLGG', - 'LGGLLG', 'LGGGLL', 'LGLGLG', 'LGLGGL', 'LGGLGL' -]; diff --git a/node_modules/jsbarcode/src/barcodes/EAN_UPC/encoder.js b/node_modules/jsbarcode/src/barcodes/EAN_UPC/encoder.js deleted file mode 100644 index e66a312..0000000 --- a/node_modules/jsbarcode/src/barcodes/EAN_UPC/encoder.js +++ /dev/null @@ -1,20 +0,0 @@ -import { BINARIES } from './constants'; - -// Encode data string -const encode = (data, structure, separator) => { - let encoded = data - .split('') - .map((val, idx) => BINARIES[structure[idx]]) - .map((val, idx) => val ? val[data[idx]] : ''); - - if (separator) { - const last = data.length - 1; - encoded = encoded.map((val, idx) => ( - idx < last ? val + separator : val - )); - } - - return encoded.join(''); -}; - -export default encode; diff --git a/node_modules/jsbarcode/src/barcodes/EAN_UPC/index.js b/node_modules/jsbarcode/src/barcodes/EAN_UPC/index.js deleted file mode 100644 index 34cad19..0000000 --- a/node_modules/jsbarcode/src/barcodes/EAN_UPC/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import EAN13 from './EAN13.js'; -import EAN8 from './EAN8.js'; -import EAN5 from './EAN5.js'; -import EAN2 from './EAN2.js'; -import UPC from './UPC.js'; -import UPCE from './UPCE.js'; - -export {EAN13, EAN8, EAN5, EAN2, UPC, UPCE}; diff --git a/node_modules/jsbarcode/src/barcodes/GenericBarcode/index.js b/node_modules/jsbarcode/src/barcodes/GenericBarcode/index.js deleted file mode 100644 index c9c1f0e..0000000 --- a/node_modules/jsbarcode/src/barcodes/GenericBarcode/index.js +++ /dev/null @@ -1,22 +0,0 @@ -import Barcode from "../Barcode.js"; - -class GenericBarcode extends Barcode{ - constructor(data, options){ - super(data, options); // Sets this.data and this.text - } - - // Return the corresponding binary numbers for the data provided - encode(){ - return { - data: "10101010101010101010101010101010101010101", - text: this.text - }; - } - - // Resturn true/false if the string provided is valid for this encoder - valid(){ - return true; - } -} - -export {GenericBarcode}; diff --git a/node_modules/jsbarcode/src/barcodes/ITF/ITF.js b/node_modules/jsbarcode/src/barcodes/ITF/ITF.js deleted file mode 100644 index 14a7cae..0000000 --- a/node_modules/jsbarcode/src/barcodes/ITF/ITF.js +++ /dev/null @@ -1,37 +0,0 @@ -import { START_BIN, END_BIN, BINARIES } from './constants'; -import Barcode from '../Barcode'; - -class ITF extends Barcode { - - valid() { - return this.data.search(/^([0-9]{2})+$/) !== -1; - } - - encode() { - // Calculate all the digit pairs - const encoded = this.data - .match(/.{2}/g) - .map(pair => this.encodePair(pair)) - .join(''); - - return { - data: START_BIN + encoded + END_BIN, - text: this.text - }; - } - - // Calculate the data of a number pair - encodePair(pair) { - const second = BINARIES[pair[1]]; - - return BINARIES[pair[0]] - .split('') - .map((first, idx) => ( - (first === '1' ? '111' : '1') + - (second[idx] === '1' ? '000' : '0') - )) - .join(''); - } -} - -export default ITF; diff --git a/node_modules/jsbarcode/src/barcodes/ITF/ITF14.js b/node_modules/jsbarcode/src/barcodes/ITF/ITF14.js deleted file mode 100644 index 3ff25ff..0000000 --- a/node_modules/jsbarcode/src/barcodes/ITF/ITF14.js +++ /dev/null @@ -1,33 +0,0 @@ -import ITF from './ITF'; - -// Calculate the checksum digit -const checksum = (data) => { - const res = data - .substr(0, 13) - .split('') - .map(num => parseInt(num, 10)) - .reduce((sum, n, idx) => sum + (n * (3 - (idx % 2) * 2)), 0); - - return Math.ceil(res / 10) * 10 - res; -}; - -class ITF14 extends ITF { - - constructor(data, options) { - // Add checksum if it does not exist - if (data.search(/^[0-9]{13}$/) !== -1) { - data += checksum(data); - } - super(data, options); - } - - valid() { - return ( - this.data.search(/^[0-9]{14}$/) !== -1 && - +this.data[13] === checksum(this.data) - ); - } - -} - -export default ITF14; diff --git a/node_modules/jsbarcode/src/barcodes/ITF/constants.js b/node_modules/jsbarcode/src/barcodes/ITF/constants.js deleted file mode 100644 index 2a941b0..0000000 --- a/node_modules/jsbarcode/src/barcodes/ITF/constants.js +++ /dev/null @@ -1,7 +0,0 @@ -export const START_BIN = '1010'; -export const END_BIN = '11101'; - -export const BINARIES = [ - '00110', '10001', '01001', '11000', '00101', - '10100', '01100', '00011', '10010', '01010', -]; diff --git a/node_modules/jsbarcode/src/barcodes/ITF/index.js b/node_modules/jsbarcode/src/barcodes/ITF/index.js deleted file mode 100644 index c832dc2..0000000 --- a/node_modules/jsbarcode/src/barcodes/ITF/index.js +++ /dev/null @@ -1,4 +0,0 @@ -import ITF from './ITF'; -import ITF14 from './ITF14'; - -export { ITF, ITF14 }; diff --git a/node_modules/jsbarcode/src/barcodes/MSI/MSI.js b/node_modules/jsbarcode/src/barcodes/MSI/MSI.js deleted file mode 100644 index ba16909..0000000 --- a/node_modules/jsbarcode/src/barcodes/MSI/MSI.js +++ /dev/null @@ -1,48 +0,0 @@ -// Encoding documentation -// https://en.wikipedia.org/wiki/MSI_Barcode#Character_set_and_binary_lookup - -import Barcode from "../Barcode.js"; - -class MSI extends Barcode{ - constructor(data, options){ - super(data, options); - } - - encode(){ - // Start bits - var ret = "110"; - - for(var i = 0; i < this.data.length; i++){ - // Convert the character to binary (always 4 binary digits) - var digit = parseInt(this.data[i]); - var bin = digit.toString(2); - bin = addZeroes(bin, 4 - bin.length); - - // Add 100 for every zero and 110 for every 1 - for(var b = 0; b < bin.length; b++){ - ret += bin[b] == "0" ? "100" : "110"; - } - } - - // End bits - ret += "1001"; - - return { - data: ret, - text: this.text - }; - } - - valid(){ - return this.data.search(/^[0-9]+$/) !== -1; - } -} - -function addZeroes(number, n){ - for(var i = 0; i < n; i++){ - number = "0" + number; - } - return number; -} - -export default MSI; diff --git a/node_modules/jsbarcode/src/barcodes/MSI/MSI10.js b/node_modules/jsbarcode/src/barcodes/MSI/MSI10.js deleted file mode 100644 index a89bae8..0000000 --- a/node_modules/jsbarcode/src/barcodes/MSI/MSI10.js +++ /dev/null @@ -1,10 +0,0 @@ -import MSI from './MSI.js'; -import {mod10} from './checksums.js'; - -class MSI10 extends MSI{ - constructor(data, options){ - super(data + mod10(data), options); - } -} - -export default MSI10; diff --git a/node_modules/jsbarcode/src/barcodes/MSI/MSI1010.js b/node_modules/jsbarcode/src/barcodes/MSI/MSI1010.js deleted file mode 100644 index 0337ec3..0000000 --- a/node_modules/jsbarcode/src/barcodes/MSI/MSI1010.js +++ /dev/null @@ -1,12 +0,0 @@ -import MSI from './MSI.js'; -import {mod10} from './checksums.js'; - -class MSI1010 extends MSI{ - constructor(data, options){ - data += mod10(data); - data += mod10(data); - super(data, options); - } -} - -export default MSI1010; diff --git a/node_modules/jsbarcode/src/barcodes/MSI/MSI11.js b/node_modules/jsbarcode/src/barcodes/MSI/MSI11.js deleted file mode 100644 index 9038061..0000000 --- a/node_modules/jsbarcode/src/barcodes/MSI/MSI11.js +++ /dev/null @@ -1,10 +0,0 @@ -import MSI from './MSI.js'; -import {mod11} from './checksums.js'; - -class MSI11 extends MSI{ - constructor(data, options){ - super(data + mod11(data), options); - } -} - -export default MSI11; diff --git a/node_modules/jsbarcode/src/barcodes/MSI/MSI1110.js b/node_modules/jsbarcode/src/barcodes/MSI/MSI1110.js deleted file mode 100644 index 6dac155..0000000 --- a/node_modules/jsbarcode/src/barcodes/MSI/MSI1110.js +++ /dev/null @@ -1,12 +0,0 @@ -import MSI from './MSI.js'; -import {mod10, mod11} from './checksums.js'; - -class MSI1110 extends MSI{ - constructor(data, options){ - data += mod11(data); - data += mod10(data); - super(data, options); - } -} - -export default MSI1110; diff --git a/node_modules/jsbarcode/src/barcodes/MSI/checksums.js b/node_modules/jsbarcode/src/barcodes/MSI/checksums.js deleted file mode 100644 index 8a02721..0000000 --- a/node_modules/jsbarcode/src/barcodes/MSI/checksums.js +++ /dev/null @@ -1,23 +0,0 @@ -export function mod10(number){ - var sum = 0; - for(var i = 0; i < number.length; i++){ - var n = parseInt(number[i]); - if((i + number.length) % 2 === 0){ - sum += n; - } - else{ - sum += (n * 2) % 10 + Math.floor((n * 2) / 10); - } - } - return (10 - (sum % 10)) % 10; -} - -export function mod11(number){ - var sum = 0; - var weights = [2, 3, 4, 5, 6, 7]; - for(var i = 0; i < number.length; i++){ - var n = parseInt(number[number.length - 1 - i]); - sum += weights[i % weights.length] * n; - } - return (11 - (sum % 11)) % 11; -} diff --git a/node_modules/jsbarcode/src/barcodes/MSI/index.js b/node_modules/jsbarcode/src/barcodes/MSI/index.js deleted file mode 100644 index 2c20baf..0000000 --- a/node_modules/jsbarcode/src/barcodes/MSI/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import MSI from './MSI.js'; -import MSI10 from './MSI10.js'; -import MSI11 from './MSI11.js'; -import MSI1010 from './MSI1010.js'; -import MSI1110 from './MSI1110.js'; - -export {MSI, MSI10, MSI11, MSI1010, MSI1110}; diff --git a/node_modules/jsbarcode/src/barcodes/codabar/index.js b/node_modules/jsbarcode/src/barcodes/codabar/index.js deleted file mode 100644 index ee2f803..0000000 --- a/node_modules/jsbarcode/src/barcodes/codabar/index.js +++ /dev/null @@ -1,63 +0,0 @@ -// Encoding specification: -// http://www.barcodeisland.com/codabar.phtml - -import Barcode from "../Barcode.js"; - -class codabar extends Barcode{ - constructor(data, options){ - if (data.search(/^[0-9\-\$\:\.\+\/]+$/) === 0) { - data = "A" + data + "A"; - } - - super(data.toUpperCase(), options); - - this.text = this.options.text || this.text.replace(/[A-D]/g, ''); - } - - valid(){ - return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) !== -1; - } - - encode(){ - var result = []; - var encodings = this.getEncodings(); - for(var i = 0; i < this.data.length; i++){ - result.push(encodings[this.data.charAt(i)]); - // for all characters except the last, append a narrow-space ("0") - if (i !== this.data.length - 1) { - result.push("0"); - } - } - return { - text: this.text, - data: result.join('') - }; - } - - getEncodings(){ - return { - "0": "101010011", - "1": "101011001", - "2": "101001011", - "3": "110010101", - "4": "101101001", - "5": "110101001", - "6": "100101011", - "7": "100101101", - "8": "100110101", - "9": "110100101", - "-": "101001101", - "$": "101100101", - ":": "1101011011", - "/": "1101101011", - ".": "1101101101", - "+": "1011011011", - "A": "1011001001", - "B": "1001001011", - "C": "1010010011", - "D": "1010011001" - }; - } -} - -export {codabar}; diff --git a/node_modules/jsbarcode/src/barcodes/index.js b/node_modules/jsbarcode/src/barcodes/index.js deleted file mode 100644 index 36e9875..0000000 --- a/node_modules/jsbarcode/src/barcodes/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import {CODE39} from './CODE39/'; -import {CODE128, CODE128A, CODE128B, CODE128C} from './CODE128/'; -import {EAN13, EAN8, EAN5, EAN2, UPC, UPCE} from './EAN_UPC/'; -import {ITF, ITF14} from './ITF/'; -import {MSI, MSI10, MSI11, MSI1010, MSI1110} from './MSI/'; -import {pharmacode} from './pharmacode/'; -import {codabar} from './codabar'; -import {GenericBarcode} from './GenericBarcode/'; - -export default { - CODE39, - CODE128, CODE128A, CODE128B, CODE128C, - EAN13, EAN8, EAN5, EAN2, UPC, UPCE, - ITF14, - ITF, - MSI, MSI10, MSI11, MSI1010, MSI1110, - pharmacode, - codabar, - GenericBarcode -}; diff --git a/node_modules/jsbarcode/src/barcodes/pharmacode/index.js b/node_modules/jsbarcode/src/barcodes/pharmacode/index.js deleted file mode 100644 index 2cde723..0000000 --- a/node_modules/jsbarcode/src/barcodes/pharmacode/index.js +++ /dev/null @@ -1,43 +0,0 @@ -// Encoding documentation -// http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf - -import Barcode from "../Barcode.js"; - -class pharmacode extends Barcode{ - constructor(data, options){ - super(data, options); - this.number = parseInt(data, 10); - } - - encode(){ - var z = this.number; - var result = ""; - - // http://i.imgur.com/RMm4UDJ.png - // (source: http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf, page: 34) - while(!isNaN(z) && z != 0){ - if(z % 2 === 0){ // Even - result = "11100" + result; - z = (z - 2) / 2; - } - else{ // Odd - result = "100" + result; - z = (z - 1) / 2; - } - } - - // Remove the two last zeroes - result = result.slice(0, -2); - - return { - data: result, - text: this.text - }; - } - - valid(){ - return this.number >= 3 && this.number <= 131070; - } -} - -export {pharmacode}; diff --git a/node_modules/jsbarcode/src/exceptions/ErrorHandler.js b/node_modules/jsbarcode/src/exceptions/ErrorHandler.js deleted file mode 100644 index 1a684fa..0000000 --- a/node_modules/jsbarcode/src/exceptions/ErrorHandler.js +++ /dev/null @@ -1,39 +0,0 @@ -/*eslint no-console: 0 */ - -class ErrorHandler{ - constructor(api){ - this.api = api; - } - - handleCatch(e){ - // If babel supported extending of Error in a correct way instanceof would be used here - if(e.name === "InvalidInputException"){ - if(this.api._options.valid !== this.api._defaults.valid){ - this.api._options.valid(false); - } - else{ - throw e.message; - } - } - else{ - throw e; - } - - this.api.render = function(){}; - } - - wrapBarcodeCall(func){ - try{ - var result = func(...arguments); - this.api._options.valid(true); - return result; - } - catch(e){ - this.handleCatch(e); - - return this.api; - } - } -} - -export default ErrorHandler; diff --git a/node_modules/jsbarcode/src/exceptions/exceptions.js b/node_modules/jsbarcode/src/exceptions/exceptions.js deleted file mode 100644 index 4835435..0000000 --- a/node_modules/jsbarcode/src/exceptions/exceptions.js +++ /dev/null @@ -1,29 +0,0 @@ -class InvalidInputException extends Error{ - constructor(symbology, input) { - super(); - this.name = "InvalidInputException"; - - this.symbology = symbology; - this.input = input; - - this.message = '"' + this.input + '" is not a valid input for ' + this.symbology; - } -} - -class InvalidElementException extends Error{ - constructor() { - super(); - this.name = "InvalidElementException"; - this.message = "Not supported type to render on"; - } -} - -class NoElementException extends Error{ - constructor() { - super(); - this.name = "NoElementException"; - this.message = "No element to render on."; - } -} - -export {InvalidInputException, InvalidElementException, NoElementException}; diff --git a/node_modules/jsbarcode/src/help/fixOptions.js b/node_modules/jsbarcode/src/help/fixOptions.js deleted file mode 100644 index 0e1c082..0000000 --- a/node_modules/jsbarcode/src/help/fixOptions.js +++ /dev/null @@ -1,11 +0,0 @@ -export default fixOptions; - -function fixOptions(options){ - // Fix the margins - options.marginTop = options.marginTop || options.margin; - options.marginBottom = options.marginBottom || options.margin; - options.marginRight = options.marginRight || options.margin; - options.marginLeft = options.marginLeft || options.margin; - - return options; -} diff --git a/node_modules/jsbarcode/src/help/getOptionsFromElement.js b/node_modules/jsbarcode/src/help/getOptionsFromElement.js deleted file mode 100644 index f24e187..0000000 --- a/node_modules/jsbarcode/src/help/getOptionsFromElement.js +++ /dev/null @@ -1,28 +0,0 @@ -import optionsFromStrings from "./optionsFromStrings.js"; -import defaults from "../options/defaults.js"; - -function getOptionsFromElement(element){ - var options = {}; - for(var property in defaults){ - if(defaults.hasOwnProperty(property)){ - // jsbarcode-* - if(element.hasAttribute("jsbarcode-" + property.toLowerCase())){ - options[property] = element.getAttribute("jsbarcode-" + property.toLowerCase()); - } - - // data-* - if(element.hasAttribute("data-" + property.toLowerCase())){ - options[property] = element.getAttribute("data-" + property.toLowerCase()); - } - } - } - - options["value"] = element.getAttribute("jsbarcode-value") || element.getAttribute("data-value"); - -// Since all atributes are string they need to be converted to integers - options = optionsFromStrings(options); - - return options; -} - -export default getOptionsFromElement; diff --git a/node_modules/jsbarcode/src/help/getRenderProperties.js b/node_modules/jsbarcode/src/help/getRenderProperties.js deleted file mode 100644 index 58e2a62..0000000 --- a/node_modules/jsbarcode/src/help/getRenderProperties.js +++ /dev/null @@ -1,102 +0,0 @@ -/* global HTMLImageElement */ -/* global HTMLCanvasElement */ -/* global SVGElement */ - -import getOptionsFromElement from "./getOptionsFromElement.js"; -import renderers from "../renderers"; - -import {InvalidElementException} from "../exceptions/exceptions.js"; - -// Takes an element and returns an object with information about how -// it should be rendered -// This could also return an array with these objects -// { -// element: The element that the renderer should draw on -// renderer: The name of the renderer -// afterRender (optional): If something has to done after the renderer -// completed, calls afterRender (function) -// options (optional): Options that can be defined in the element -// } - -function getRenderProperties(element){ - // If the element is a string, query select call again - if(typeof element === "string"){ - return querySelectedRenderProperties(element); - } - // If element is array. Recursivly call with every object in the array - else if(Array.isArray(element)){ - var returnArray = []; - for(let i = 0; i < element.length; i++){ - returnArray.push(getRenderProperties(element[i])); - } - return returnArray; - } - // If element, render on canvas and set the uri as src - else if(typeof HTMLCanvasElement !== 'undefined' && element instanceof HTMLImageElement){ - return newCanvasRenderProperties(element); - } - // If SVG - else if( - (element && element.nodeName && element.nodeName.toLowerCase() === 'svg') || - (typeof SVGElement !== 'undefined' && element instanceof SVGElement) - ){ - return { - element: element, - options: getOptionsFromElement(element), - renderer: renderers.SVGRenderer - }; - } - // If canvas (in browser) - else if(typeof HTMLCanvasElement !== 'undefined' && element instanceof HTMLCanvasElement){ - return { - element: element, - options: getOptionsFromElement(element), - renderer: renderers.CanvasRenderer - }; - } - // If canvas (in node) - else if(element && element.getContext){ - return { - element: element, - renderer: renderers.CanvasRenderer - }; - } - else if(element && typeof element === 'object' && !element.nodeName) { - return { - element: element, - renderer: renderers.ObjectRenderer - }; - } - else{ - throw new InvalidElementException(); - } -} - -function querySelectedRenderProperties(string){ - var selector = document.querySelectorAll(string); - if(selector.length === 0){ - return undefined; - } - else{ - let returnArray = []; - for(let i = 0; i < selector.length; i++){ - returnArray.push(getRenderProperties(selector[i])); - } - return returnArray; - } -} - - -function newCanvasRenderProperties(imgElement){ - var canvas = document.createElement('canvas'); - return { - element: canvas, - options: getOptionsFromElement(imgElement), - renderer: renderers.CanvasRenderer, - afterRender: function(){ - imgElement.setAttribute("src", canvas.toDataURL()); - } - }; -} - -export default getRenderProperties; diff --git a/node_modules/jsbarcode/src/help/linearizeEncodings.js b/node_modules/jsbarcode/src/help/linearizeEncodings.js deleted file mode 100644 index eb13a66..0000000 --- a/node_modules/jsbarcode/src/help/linearizeEncodings.js +++ /dev/null @@ -1,22 +0,0 @@ -export default linearizeEncodings; - -// Encodings can be nestled like [[1-1, 1-2], 2, [3-1, 3-2] -// Convert to [1-1, 1-2, 2, 3-1, 3-2] -function linearizeEncodings(encodings){ - var linearEncodings = []; - function nextLevel(encoded){ - if(Array.isArray(encoded)){ - for(let i = 0; i < encoded.length; i++){ - nextLevel(encoded[i]); - } - } - else{ - encoded.text = encoded.text || ""; - encoded.data = encoded.data || ""; - linearEncodings.push(encoded); - } - } - nextLevel(encodings); - - return linearEncodings; -} diff --git a/node_modules/jsbarcode/src/help/merge.js b/node_modules/jsbarcode/src/help/merge.js deleted file mode 100644 index 88eb19c..0000000 --- a/node_modules/jsbarcode/src/help/merge.js +++ /dev/null @@ -1 +0,0 @@ -export default (old, replaceObj) => ({ ...old, ...replaceObj }); diff --git a/node_modules/jsbarcode/src/help/optionsFromStrings.js b/node_modules/jsbarcode/src/help/optionsFromStrings.js deleted file mode 100644 index a9adfda..0000000 --- a/node_modules/jsbarcode/src/help/optionsFromStrings.js +++ /dev/null @@ -1,31 +0,0 @@ -export default optionsFromStrings; - -// Convert string to integers/booleans where it should be -function optionsFromStrings(options){ - var intOptions = [ - "width", - "height", - "textMargin", - "fontSize", - "margin", - "marginTop", - "marginBottom", - "marginLeft", - "marginRight" - ]; - - for(var intOption in intOptions){ - if(intOptions.hasOwnProperty(intOption)){ - intOption = intOptions[intOption]; - if(typeof options[intOption] === "string"){ - options[intOption] = parseInt(options[intOption], 10); - } - } - } - - if(typeof options["displayValue"] === "string"){ - options["displayValue"] = (options["displayValue"] != "false"); - } - - return options; -} diff --git a/node_modules/jsbarcode/src/options/defaults.js b/node_modules/jsbarcode/src/options/defaults.js deleted file mode 100644 index f2362ff..0000000 --- a/node_modules/jsbarcode/src/options/defaults.js +++ /dev/null @@ -1,23 +0,0 @@ -var defaults = { - width: 2, - height: 100, - format: "auto", - displayValue: true, - fontOptions: "", - font: "monospace", - text: undefined, - textAlign: "center", - textPosition: "bottom", - textMargin: 2, - fontSize: 20, - background: "#ffffff", - lineColor: "#000000", - margin: 10, - marginTop: undefined, - marginBottom: undefined, - marginLeft: undefined, - marginRight: undefined, - valid: function(){} -}; - -export default defaults; diff --git a/node_modules/jsbarcode/src/renderers/canvas.js b/node_modules/jsbarcode/src/renderers/canvas.js deleted file mode 100644 index bba16d4..0000000 --- a/node_modules/jsbarcode/src/renderers/canvas.js +++ /dev/null @@ -1,137 +0,0 @@ -import merge from "../help/merge.js"; -import {calculateEncodingAttributes, getTotalWidthOfEncodings, getMaximumHeightOfEncodings} from "./shared.js"; - -class CanvasRenderer{ - constructor(canvas, encodings, options){ - this.canvas = canvas; - this.encodings = encodings; - this.options = options; - } - - render(){ - // Abort if the browser does not support HTML5 canvas - if (!this.canvas.getContext) { - throw new Error('The browser does not support canvas.'); - } - - this.prepareCanvas(); - for(let i = 0; i < this.encodings.length; i++){ - var encodingOptions = merge(this.options, this.encodings[i].options); - - this.drawCanvasBarcode(encodingOptions, this.encodings[i]); - this.drawCanvasText(encodingOptions, this.encodings[i]); - - this.moveCanvasDrawing(this.encodings[i]); - } - - this.restoreCanvas(); - } - - prepareCanvas(){ - // Get the canvas context - var ctx = this.canvas.getContext("2d"); - - ctx.save(); - - calculateEncodingAttributes(this.encodings, this.options, ctx); - var totalWidth = getTotalWidthOfEncodings(this.encodings); - var maxHeight = getMaximumHeightOfEncodings(this.encodings); - - this.canvas.width = totalWidth + this.options.marginLeft + this.options.marginRight; - - this.canvas.height = maxHeight; - - // Paint the canvas - ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); - if(this.options.background){ - ctx.fillStyle = this.options.background; - ctx.fillRect(0, 0, this.canvas.width, this.canvas.height); - } - - ctx.translate(this.options.marginLeft, 0); - } - - drawCanvasBarcode(options, encoding){ - // Get the canvas context - var ctx = this.canvas.getContext("2d"); - - var binary = encoding.data; - - // Creates the barcode out of the encoded binary - var yFrom; - if(options.textPosition == "top"){ - yFrom = options.marginTop + options.fontSize + options.textMargin; - } - else{ - yFrom = options.marginTop; - } - - ctx.fillStyle = options.lineColor; - - for(var b = 0; b < binary.length; b++){ - var x = b * options.width + encoding.barcodePadding; - - if(binary[b] === "1"){ - ctx.fillRect(x, yFrom, options.width, options.height); - } - else if(binary[b]){ - ctx.fillRect(x, yFrom, options.width, options.height * binary[b]); - } - } - } - - drawCanvasText(options, encoding){ - // Get the canvas context - var ctx = this.canvas.getContext("2d"); - - var font = options.fontOptions + " " + options.fontSize + "px " + options.font; - - // Draw the text if displayValue is set - if(options.displayValue){ - var x, y; - - if(options.textPosition == "top"){ - y = options.marginTop + options.fontSize - options.textMargin; - } - else{ - y = options.height + options.textMargin + options.marginTop + options.fontSize; - } - - ctx.font = font; - - // Draw the text in the correct X depending on the textAlign option - if(options.textAlign == "left" || encoding.barcodePadding > 0){ - x = 0; - ctx.textAlign = 'left'; - } - else if(options.textAlign == "right"){ - x = encoding.width - 1; - ctx.textAlign = 'right'; - } - // In all other cases, center the text - else{ - x = encoding.width / 2; - ctx.textAlign = 'center'; - } - - ctx.fillText(encoding.text, x, y); - } - } - - - - moveCanvasDrawing(encoding){ - var ctx = this.canvas.getContext("2d"); - - ctx.translate(encoding.width, 0); - } - - restoreCanvas(){ - // Get the canvas context - var ctx = this.canvas.getContext("2d"); - - ctx.restore(); - } -} - -export default CanvasRenderer; diff --git a/node_modules/jsbarcode/src/renderers/index.js b/node_modules/jsbarcode/src/renderers/index.js deleted file mode 100644 index 3797e01..0000000 --- a/node_modules/jsbarcode/src/renderers/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import CanvasRenderer from './canvas.js'; -import SVGRenderer from './svg.js'; -import ObjectRenderer from './object.js'; - -export default {CanvasRenderer, SVGRenderer, ObjectRenderer}; diff --git a/node_modules/jsbarcode/src/renderers/object.js b/node_modules/jsbarcode/src/renderers/object.js deleted file mode 100644 index fd0b7ca..0000000 --- a/node_modules/jsbarcode/src/renderers/object.js +++ /dev/null @@ -1,14 +0,0 @@ -class ObjectRenderer { - constructor(object, encodings, options) { - this.object = object; - this.encodings = encodings; - this.options = options; - } - - render() { - this.object.encodings = this.encodings; - } -} - - -export default ObjectRenderer; diff --git a/node_modules/jsbarcode/src/renderers/shared.js b/node_modules/jsbarcode/src/renderers/shared.js deleted file mode 100644 index 243126e..0000000 --- a/node_modules/jsbarcode/src/renderers/shared.js +++ /dev/null @@ -1,94 +0,0 @@ -import merge from "../help/merge.js"; - -function getEncodingHeight(encoding, options){ - return options.height + - ((options.displayValue && encoding.text.length > 0) ? options.fontSize + options.textMargin : 0) + - options.marginTop + - options.marginBottom; -} - -function getBarcodePadding(textWidth, barcodeWidth, options){ - if(options.displayValue && barcodeWidth < textWidth){ - if(options.textAlign == "center"){ - return Math.floor((textWidth - barcodeWidth) / 2); - } - else if(options.textAlign == "left"){ - return 0; - } - else if(options.textAlign == "right"){ - return Math.floor(textWidth - barcodeWidth); - } - } - return 0; -} - -function calculateEncodingAttributes(encodings, barcodeOptions, context){ - for(let i = 0; i < encodings.length; i++){ - var encoding = encodings[i]; - var options = merge(barcodeOptions, encoding.options); - - // Calculate the width of the encoding - var textWidth; - if(options.displayValue){ - textWidth = messureText(encoding.text, options, context); - } - else{ - textWidth = 0; - } - - var barcodeWidth = encoding.data.length * options.width; - encoding.width = Math.ceil(Math.max(textWidth, barcodeWidth)); - - encoding.height = getEncodingHeight(encoding, options); - - encoding.barcodePadding = getBarcodePadding(textWidth, barcodeWidth, options); - } -} - -function getTotalWidthOfEncodings(encodings){ - var totalWidth = 0; - for(let i = 0; i < encodings.length; i++){ - totalWidth += encodings[i].width; - } - return totalWidth; -} - -function getMaximumHeightOfEncodings(encodings){ - var maxHeight = 0; - for(let i = 0; i < encodings.length; i++){ - if(encodings[i].height > maxHeight){ - maxHeight = encodings[i].height; - } - } - return maxHeight; -} - -function messureText(string, options, context){ - var ctx; - - if(context){ - ctx = context; - } - else if(typeof document !== "undefined"){ - ctx = document.createElement("canvas").getContext("2d"); - } - else{ - // If the text cannot be messured we will return 0. - // This will make some barcode with big text render incorrectly - return 0; - } - ctx.font = options.fontOptions + " " + options.fontSize + "px " + options.font; - - // Calculate the width of the encoding - var measureTextResult = ctx.measureText(string); - if (!measureTextResult) { - // Some implementations don't implement measureText and return undefined. - // If the text cannot be measured we will return 0. - // This will make some barcode with big text render incorrectly - return 0; - } - var size = measureTextResult.width; - return size; -} - -export {getMaximumHeightOfEncodings, getEncodingHeight, getBarcodePadding, calculateEncodingAttributes, getTotalWidthOfEncodings}; diff --git a/node_modules/jsbarcode/src/renderers/svg.js b/node_modules/jsbarcode/src/renderers/svg.js deleted file mode 100644 index 33d3b0b..0000000 --- a/node_modules/jsbarcode/src/renderers/svg.js +++ /dev/null @@ -1,171 +0,0 @@ -import merge from "../help/merge.js"; -import {calculateEncodingAttributes, getTotalWidthOfEncodings, getMaximumHeightOfEncodings} from "./shared.js"; - -var svgns = "http://www.w3.org/2000/svg"; - -class SVGRenderer{ - constructor(svg, encodings, options){ - this.svg = svg; - this.encodings = encodings; - this.options = options; - this.document = options.xmlDocument || document; - } - - render(){ - var currentX = this.options.marginLeft; - - this.prepareSVG(); - for(let i = 0; i < this.encodings.length; i++){ - var encoding = this.encodings[i]; - var encodingOptions = merge(this.options, encoding.options); - - var group = this.createGroup(currentX, encodingOptions.marginTop, this.svg); - - this.setGroupOptions(group, encodingOptions); - - this.drawSvgBarcode(group, encodingOptions, encoding); - this.drawSVGText(group, encodingOptions, encoding); - - currentX += encoding.width; - } - } - - prepareSVG(){ - // Clear the SVG - while (this.svg.firstChild) { - this.svg.removeChild(this.svg.firstChild); - } - - calculateEncodingAttributes(this.encodings, this.options); - var totalWidth = getTotalWidthOfEncodings(this.encodings); - var maxHeight = getMaximumHeightOfEncodings(this.encodings); - - var width = totalWidth + this.options.marginLeft + this.options.marginRight; - this.setSvgAttributes(width, maxHeight); - - if(this.options.background){ - this.drawRect(0, 0, width, maxHeight, this.svg).setAttribute( - "style", "fill:" + this.options.background + ";" - ); - } - } - - drawSvgBarcode(parent, options, encoding){ - var binary = encoding.data; - - // Creates the barcode out of the encoded binary - var yFrom; - if(options.textPosition == "top"){ - yFrom = options.fontSize + options.textMargin; - } - else{ - yFrom = 0; - } - - var barWidth = 0; - var x = 0; - for(var b = 0; b < binary.length; b++){ - x = b * options.width + encoding.barcodePadding; - - if(binary[b] === "1"){ - barWidth++; - } - else if(barWidth > 0){ - this.drawRect(x - options.width * barWidth, yFrom, options.width * barWidth, options.height, parent); - barWidth = 0; - } - } - - // Last draw is needed since the barcode ends with 1 - if(barWidth > 0){ - this.drawRect(x - options.width * (barWidth - 1), yFrom, options.width * barWidth, options.height, parent); - } - } - - drawSVGText(parent, options, encoding){ - var textElem = this.document.createElementNS(svgns, 'text'); - - // Draw the text if displayValue is set - if(options.displayValue){ - var x, y; - - textElem.setAttribute("style", - "font:" + options.fontOptions + " " + options.fontSize + "px " + options.font - ); - - if(options.textPosition == "top"){ - y = options.fontSize - options.textMargin; - } - else{ - y = options.height + options.textMargin + options.fontSize; - } - - // Draw the text in the correct X depending on the textAlign option - if(options.textAlign == "left" || encoding.barcodePadding > 0){ - x = 0; - textElem.setAttribute("text-anchor", "start"); - } - else if(options.textAlign == "right"){ - x = encoding.width - 1; - textElem.setAttribute("text-anchor", "end"); - } - // In all other cases, center the text - else{ - x = encoding.width / 2; - textElem.setAttribute("text-anchor", "middle"); - } - - textElem.setAttribute("x", x); - textElem.setAttribute("y", y); - - textElem.appendChild(this.document.createTextNode(encoding.text)); - - parent.appendChild(textElem); - } - } - - - setSvgAttributes(width, height){ - var svg = this.svg; - svg.setAttribute("width", width + "px"); - svg.setAttribute("height", height + "px"); - svg.setAttribute("x", "0px"); - svg.setAttribute("y", "0px"); - svg.setAttribute("viewBox", "0 0 " + width + " " + height); - - svg.setAttribute("xmlns", svgns); - svg.setAttribute("version", "1.1"); - - svg.setAttribute("style", "transform: translate(0,0)"); - } - - createGroup(x, y, parent){ - var group = this.document.createElementNS(svgns, 'g'); - group.setAttribute("transform", "translate(" + x + ", " + y + ")"); - - parent.appendChild(group); - - return group; - } - - setGroupOptions(group, options){ - group.setAttribute("style", - "fill:" + options.lineColor + ";" - ); - } - - drawRect(x, y, width, height, parent){ - var rect = this.document.createElementNS(svgns, 'rect'); - - rect.setAttribute("x", x); - rect.setAttribute("y", y); - rect.setAttribute("width", width); - rect.setAttribute("height", height); - - parent.appendChild(rect); - - return rect; - } -} - -export default SVGRenderer; diff --git a/node_modules/jsbarcode/test/browser/canvasTest.html b/node_modules/jsbarcode/test/browser/canvasTest.html deleted file mode 100644 index e15f407..0000000 --- a/node_modules/jsbarcode/test/browser/canvasTest.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Test minified version - - - - - - - - - - - diff --git a/node_modules/jsbarcode/test/browser/canvasTest.js b/node_modules/jsbarcode/test/browser/canvasTest.js deleted file mode 100644 index e702654..0000000 --- a/node_modules/jsbarcode/test/browser/canvasTest.js +++ /dev/null @@ -1,30 +0,0 @@ -var parent; -function doTests(p){ - parent = p; - createTests(newTest); -} - -function newTest(text, options){ - var testbox = document.createElement("div"); - testbox.className = "testbox"; - - var format = (typeof options !== "undefined" && options.format) || "auto"; - - testbox.innerHTML = '\ - Format: ' + format + '
\ - Input: ' + text + '
\ -
\ - '; - - try{ - JsBarcode(testbox.querySelector('.barcode'), text, options); - } - catch(e){ - testbox.className = "errorbox"; - testbox.onclick = function(){ - throw e; - } - } - - parent.appendChild(testbox); -} diff --git a/node_modules/jsbarcode/test/browser/help/jquery-2.2.3.js b/node_modules/jsbarcode/test/browser/help/jquery-2.2.3.js deleted file mode 100644 index 3854747..0000000 --- a/node_modules/jsbarcode/test/browser/help/jquery-2.2.3.js +++ /dev/null @@ -1,9842 +0,0 @@ -/*! - * jQuery JavaScript Library v2.2.3 - * http://jquery.com/ - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2016-04-05T19:26Z - */ - -(function( global, factory ) { - - if ( typeof module === "object" && typeof module.exports === "object" ) { - // For CommonJS and CommonJS-like environments where a proper `window` - // is present, execute the factory and get jQuery. - // For environments that do not have a `window` with a `document` - // (such as Node.js), expose a factory as module.exports. - // This accentuates the need for the creation of a real `window`. - // e.g. var jQuery = require("jquery")(window); - // See ticket #14549 for more info. - module.exports = global.document ? - factory( global, true ) : - function( w ) { - if ( !w.document ) { - throw new Error( "jQuery requires a window with a document" ); - } - return factory( w ); - }; - } else { - factory( global ); - } - -// Pass this if window is not defined yet -}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { - -// Support: Firefox 18+ -// Can't be in strict mode, several libs including ASP.NET trace -// the stack via arguments.caller.callee and Firefox dies if -// you try to trace through "use strict" call chains. (#13335) -//"use strict"; -var arr = []; - -var document = window.document; - -var slice = arr.slice; - -var concat = arr.concat; - -var push = arr.push; - -var indexOf = arr.indexOf; - -var class2type = {}; - -var toString = class2type.toString; - -var hasOwn = class2type.hasOwnProperty; - -var support = {}; - - - -var - version = "2.2.3", - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - - // The jQuery object is actually just the init constructor 'enhanced' - // Need init if jQuery is called (just allow error to be thrown if not included) - return new jQuery.fn.init( selector, context ); - }, - - // Support: Android<4.1 - // Make sure we trim BOM and NBSP - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }; - -jQuery.fn = jQuery.prototype = { - - // The current version of jQuery being used - jquery: version, - - constructor: jQuery, - - // Start with an empty selector - selector: "", - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num != null ? - - // Return just the one element from the set - ( num < 0 ? this[ num + this.length ] : this[ num ] ) : - - // Return all the elements in a clean array - slice.call( this ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - ret.context = this.context; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - each: function( callback ) { - return jQuery.each( this, callback ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map( this, function( elem, i ) { - return callback.call( elem, i, elem ); - } ) ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); - }, - - end: function() { - return this.prevObject || this.constructor(); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: arr.sort, - splice: arr.splice -}; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[ 0 ] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - - // Skip the boolean and the target - target = arguments[ i ] || {}; - i++; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { - target = {}; - } - - // Extend jQuery itself if only one argument is passed - if ( i === length ) { - target = this; - i--; - } - - for ( ; i < length; i++ ) { - - // Only deal with non-null/undefined values - if ( ( options = arguments[ i ] ) != null ) { - - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject( copy ) || - ( copyIsArray = jQuery.isArray( copy ) ) ) ) { - - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray( src ) ? src : []; - - } else { - clone = src && jQuery.isPlainObject( src ) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend( { - - // Unique for each copy of jQuery on the page - expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - - // Assume jQuery is ready without the ready module - isReady: true, - - error: function( msg ) { - throw new Error( msg ); - }, - - noop: function() {}, - - isFunction: function( obj ) { - return jQuery.type( obj ) === "function"; - }, - - isArray: Array.isArray, - - isWindow: function( obj ) { - return obj != null && obj === obj.window; - }, - - isNumeric: function( obj ) { - - // parseFloat NaNs numeric-cast false positives (null|true|false|"") - // ...but misinterprets leading-number strings, particularly hex literals ("0x...") - // subtraction forces infinities to NaN - // adding 1 corrects loss of precision from parseFloat (#15100) - var realStringObj = obj && obj.toString(); - return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0; - }, - - isPlainObject: function( obj ) { - var key; - - // Not plain objects: - // - Any object or value whose internal [[Class]] property is not "[object Object]" - // - DOM nodes - // - window - if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call( obj, "constructor" ) && - !hasOwn.call( obj.constructor.prototype || {}, "isPrototypeOf" ) ) { - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - type: function( obj ) { - if ( obj == null ) { - return obj + ""; - } - - // Support: Android<4.0, iOS<6 (functionish RegExp) - return typeof obj === "object" || typeof obj === "function" ? - class2type[ toString.call( obj ) ] || "object" : - typeof obj; - }, - - // Evaluates a script in a global context - globalEval: function( code ) { - var script, - indirect = eval; - - code = jQuery.trim( code ); - - if ( code ) { - - // If the code includes a valid, prologue position - // strict mode pragma, execute code by injecting a - // script tag into the document. - if ( code.indexOf( "use strict" ) === 1 ) { - script = document.createElement( "script" ); - script.text = code; - document.head.appendChild( script ).parentNode.removeChild( script ); - } else { - - // Otherwise, avoid the DOM node creation, insertion - // and removal by using an indirect global eval - - indirect( code ); - } - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Support: IE9-11+ - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - each: function( obj, callback ) { - var length, i = 0; - - if ( isArrayLike( obj ) ) { - length = obj.length; - for ( ; i < length; i++ ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } else { - for ( i in obj ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } - - return obj; - }, - - // Support: Android<4.1 - trim: function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArrayLike( Object( arr ) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - return arr == null ? -1 : indexOf.call( arr, elem, i ); - }, - - merge: function( first, second ) { - var len = +second.length, - j = 0, - i = first.length; - - for ( ; j < len; j++ ) { - first[ i++ ] = second[ j ]; - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, invert ) { - var callbackInverse, - matches = [], - i = 0, - length = elems.length, - callbackExpect = !invert; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - callbackInverse = !callback( elems[ i ], i ); - if ( callbackInverse !== callbackExpect ) { - matches.push( elems[ i ] ); - } - } - - return matches; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var length, value, - i = 0, - ret = []; - - // Go through the array, translating each of the items to their new values - if ( isArrayLike( elems ) ) { - length = elems.length; - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - } - - // Flatten any nested arrays - return concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var tmp, args, proxy; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - now: Date.now, - - // jQuery.support is not used in Core but other projects attach their - // properties to it so it needs to exist. - support: support -} ); - -// JSHint would error on this code due to the Symbol not being defined in ES5. -// Defining this global in .jshintrc would create a danger of using the global -// unguarded in another place, it seems safer to just disable JSHint for these -// three lines. -/* jshint ignore: start */ -if ( typeof Symbol === "function" ) { - jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; -} -/* jshint ignore: end */ - -// Populate the class2type map -jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), -function( i, name ) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -} ); - -function isArrayLike( obj ) { - - // Support: iOS 8.2 (not reproducible in simulator) - // `in` check used to prevent JIT error (gh-2145) - // hasOwn isn't used here due to false negatives - // regarding Nodelist length in IE - var length = !!obj && "length" in obj && obj.length, - type = jQuery.type( obj ); - - if ( type === "function" || jQuery.isWindow( obj ) ) { - return false; - } - - return type === "array" || length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj; -} -var Sizzle = -/*! - * Sizzle CSS Selector Engine v2.2.1 - * http://sizzlejs.com/ - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2015-10-17 - */ -(function( window ) { - -var i, - support, - Expr, - getText, - isXML, - tokenize, - compile, - select, - outermostContext, - sortInput, - hasDuplicate, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + 1 * new Date(), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - } - return 0; - }, - - // General-purpose constants - MAX_NEGATIVE = 1 << 31, - - // Instance methods - hasOwn = ({}).hasOwnProperty, - arr = [], - pop = arr.pop, - push_native = arr.push, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf as it's faster than native - // http://jsperf.com/thor-indexof-vs-for/5 - indexOf = function( list, elem ) { - var i = 0, - len = list.length; - for ( ; i < len; i++ ) { - if ( list[i] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - - // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", - - // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + - // Operator (capture 2) - "*([*^$|!~]?=)" + whitespace + - // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" - "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + - "*\\]", - - pseudos = ":(" + identifier + ")(?:\\((" + - // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: - // 1. quoted (capture 3; capture 4 or capture 5) - "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + - // 2. simple (capture 6) - "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + - // 3. anything else (capture 2) - ".*" + - ")\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rwhitespace = new RegExp( whitespace + "+", "g" ), - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + identifier + ")" ), - "CLASS": new RegExp( "^\\.(" + identifier + ")" ), - "TAG": new RegExp( "^(" + identifier + "|[*])" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rsibling = /[+~]/, - rescape = /'|\\/g, - - // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), - funescape = function( _, escaped, escapedWhitespace ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - // Support: Firefox<24 - // Workaround erroneous numeric interpretation of +"0x" - return high !== high || escapedWhitespace ? - escaped : - high < 0 ? - // BMP codepoint - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }, - - // Used for iframes - // See setDocument() - // Removing the function wrapper causes a "Permission Denied" - // error in IE - unloadHandler = function() { - setDocument(); - }; - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - (arr = slice.call( preferredDoc.childNodes )), - preferredDoc.childNodes - ); - // Support: Android<4.0 - // Detect silently failing push.apply - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - push_native.apply( target, slice.call(els) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - // Can't trust NodeList.length - while ( (target[j++] = els[i++]) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var m, i, elem, nid, nidselect, match, groups, newSelector, - newContext = context && context.ownerDocument, - - // nodeType defaults to 9, since context defaults to document - nodeType = context ? context.nodeType : 9; - - results = results || []; - - // Return early from calls with invalid selector or context - if ( typeof selector !== "string" || !selector || - nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { - - return results; - } - - // Try to shortcut find operations (as opposed to filters) in HTML documents - if ( !seed ) { - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - context = context || document; - - if ( documentIsHTML ) { - - // If the selector is sufficiently simple, try using a "get*By*" DOM method - // (excepting DocumentFragment context, where the methods don't exist) - if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { - - // ID selector - if ( (m = match[1]) ) { - - // Document context - if ( nodeType === 9 ) { - if ( (elem = context.getElementById( m )) ) { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - - // Element context - } else { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( newContext && (elem = newContext.getElementById( m )) && - contains( context, elem ) && - elem.id === m ) { - - results.push( elem ); - return results; - } - } - - // Type selector - } else if ( match[2] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Class selector - } else if ( (m = match[3]) && support.getElementsByClassName && - context.getElementsByClassName ) { - - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // Take advantage of querySelectorAll - if ( support.qsa && - !compilerCache[ selector + " " ] && - (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - - if ( nodeType !== 1 ) { - newContext = context; - newSelector = selector; - - // qSA looks outside Element context, which is not what we want - // Thanks to Andrew Dupont for this workaround technique - // Support: IE <=8 - // Exclude object elements - } else if ( context.nodeName.toLowerCase() !== "object" ) { - - // Capture the context ID, setting it first if necessary - if ( (nid = context.getAttribute( "id" )) ) { - nid = nid.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", (nid = expando) ); - } - - // Prefix every selector in the list - groups = tokenize( selector ); - i = groups.length; - nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']"; - while ( i-- ) { - groups[i] = nidselect + " " + toSelector( groups[i] ); - } - newSelector = groups.join( "," ); - - // Expand context for sibling selectors - newContext = rsibling.test( selector ) && testContext( context.parentNode ) || - context; - } - - if ( newSelector ) { - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch ( qsaError ) { - } finally { - if ( nid === expando ) { - context.removeAttribute( "id" ); - } - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {function(string, object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key + " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key + " " ] = value); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created div and expects a boolean result - */ -function assert( fn ) { - var div = document.createElement("div"); - - try { - return !!fn( div ); - } catch (e) { - return false; - } finally { - // Remove from its parent by default - if ( div.parentNode ) { - div.parentNode.removeChild( div ); - } - // release memory in IE - div = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split("|"), - i = arr.length; - - while ( i-- ) { - Expr.attrHandle[ arr[i] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - ( ~b.sourceIndex || MAX_NEGATIVE ) - - ( ~a.sourceIndex || MAX_NEGATIVE ); - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Checks a node for validity as a Sizzle context - * @param {Element|Object=} context - * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value - */ -function testContext( context ) { - return context && typeof context.getElementsByTagName !== "undefined" && context; -} - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Detects XML nodes - * @param {Element|Object} elem An element or a document - * @returns {Boolean} True iff elem is a non-HTML XML node - */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, parent, - doc = node ? node.ownerDocument || node : preferredDoc; - - // Return early if doc is invalid or already selected - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Update global variables - document = doc; - docElem = document.documentElement; - documentIsHTML = !isXML( document ); - - // Support: IE 9-11, Edge - // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) - if ( (parent = document.defaultView) && parent.top !== parent ) { - // Support: IE 11 - if ( parent.addEventListener ) { - parent.addEventListener( "unload", unloadHandler, false ); - - // Support: IE 9 - 10 only - } else if ( parent.attachEvent ) { - parent.attachEvent( "onunload", unloadHandler ); - } - } - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties - // (excepting IE8 booleans) - support.attributes = assert(function( div ) { - div.className = "i"; - return !div.getAttribute("className"); - }); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert(function( div ) { - div.appendChild( document.createComment("") ); - return !div.getElementsByTagName("*").length; - }); - - // Support: IE<9 - support.getElementsByClassName = rnative.test( document.getElementsByClassName ); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert(function( div ) { - docElem.appendChild( div ).id = expando; - return !document.getElementsByName || !document.getElementsByName( expando ).length; - }); - - // ID find and filter - if ( support.getById ) { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var m = context.getElementById( id ); - return m ? [ m ] : []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - } else { - // Support: IE6/7 - // getElementById is not reliable as a find shortcut - delete Expr.find["ID"]; - - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== "undefined" && - elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - } - - // Tag - Expr.find["TAG"] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( tag ); - - // DocumentFragment nodes don't have gEBTN - } else if ( support.qsa ) { - return context.querySelectorAll( tag ); - } - } : - - function( tag, context ) { - var elem, - tmp = [], - i = 0, - // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See http://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - docElem.appendChild( div ).innerHTML = "" + - ""; - - // Support: IE8, Opera 11-12.16 - // Nothing should be selected when empty strings follow ^= or $= or *= - // The test attribute must be unknown in Opera but "safe" for WinRT - // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( div.querySelectorAll("[msallowcapture^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ - if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { - rbuggyQSA.push("~="); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - - // Support: Safari 8+, iOS 8+ - // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibing-combinator selector` fails - if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { - rbuggyQSA.push(".#.+[+~]"); - } - }); - - assert(function( div ) { - // Support: Windows 8 Native Apps - // The type and name attributes are restricted during .innerHTML assignment - var input = document.createElement("input"); - input.setAttribute( "type", "hidden" ); - div.appendChild( input ).setAttribute( "name", "D" ); - - // Support: IE8 - // Enforce case-sensitivity of name attribute - if ( div.querySelectorAll("[name=d]").length ) { - rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - div.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || - docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( div, "div" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( div, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); - - /* Contains - ---------------------------------------------------------------------- */ - hasCompare = rnative.test( docElem.compareDocumentPosition ); - - // Element contains another - // Purposefully self-exclusive - // As in, an element does not contain itself - contains = hasCompare || rnative.test( docElem.contains ) ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = hasCompare ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - // Sort on method existence if only one input has compareDocumentPosition - var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; - if ( compare ) { - return compare; - } - - // Calculate position if both inputs belong to the same document - compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? - a.compareDocumentPosition( b ) : - - // Otherwise we know they are disconnected - 1; - - // Disconnected nodes - if ( compare & 1 || - (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { - - // Choose the first element that is related to our preferred document - if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { - return -1; - } - if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } : - function( a, b ) { - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Parentless nodes are either documents or disconnected - if ( !aup || !bup ) { - return a === document ? -1 : - b === document ? 1 : - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - return document; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - if ( support.matchesSelector && documentIsHTML && - !compilerCache[ expr + " " ] && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch (e) {} - } - - return Sizzle( expr, document, null, [ elem ] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val !== undefined ? - val : - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - (val = elem.getAttributeNode(name)) && val.specified ? - val.value : - null; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( (elem = results[i++]) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - // Clear input after sorting to release objects - // See https://github.com/jquery/sizzle/pull/225 - sortInput = null; - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - while ( (node = elem[i++]) ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (jQuery #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[6] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[3] ) { - match[2] = match[4] || match[5] || ""; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { return true; } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, uniqueCache, outerCache, node, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType, - diff = false; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) { - - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - - // Seek `elem` from a previously-cached index - - // ...in a gzip-friendly way - node = parent; - outerCache = node[ expando ] || (node[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - (outerCache[ node.uniqueID ] = {}); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex && cache[ 2 ]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - (diff = nodeIndex = 0) || start.pop()) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - } else { - // Use previously-cached element index if available - if ( useCache ) { - // ...in a gzip-friendly way - node = elem; - outerCache = node[ expando ] || (node[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - (outerCache[ node.uniqueID ] = {}); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex; - } - - // xml :nth-child(...) - // or :nth-last-child(...) or :nth(-last)?-of-type(...) - if ( diff === false ) { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) && - ++diff ) { - - // Cache the index of each encountered element - if ( useCache ) { - outerCache = node[ expando ] || (node[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - (outerCache[ node.uniqueID ] = {}); - - uniqueCache[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - // Don't keep the element (issue #299) - input[0] = null; - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - text = text.replace( runescape, funescape ); - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifier - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), - // but not by others (comment: 8; processing instruction: 7; etc.) - // nodeType < 6 works because attributes (2) do not appear as children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeType < 6 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - - // Support: IE<8 - // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -tokenize = Sizzle.tokenize = function( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( (tokens = []) ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push({ - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - }); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push({ - value: matched, - type: type, - matches: match - }); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -}; - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && dir === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var oldCache, uniqueCache, outerCache, - newCache = [ dirruns, doneName ]; - - // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); - - if ( (oldCache = uniqueCache[ dir ]) && - oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { - - // Assign to newCache so results back-propagate to previous elements - return (newCache[ 2 ] = oldCache[ 2 ]); - } else { - // Reuse newcache so results back-propagate to previous elements - uniqueCache[ dir ] = newCache; - - // A match means we're done; a fail means we have to keep checking - if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { - return true; - } - } - } - } - } - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - // Avoid hanging onto element (issue #299) - checkContext = null; - return ret; - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, outermost ) { - var elem, j, matcher, - matchedCount = 0, - i = "0", - unmatched = seed && [], - setMatched = [], - contextBackup = outermostContext, - // We must always have either seed elements or outermost context - elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), - len = elems.length; - - if ( outermost ) { - outermostContext = context === document || context || outermost; - } - - // Add elements passing elementMatchers directly to results - // Support: IE<9, Safari - // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id - for ( ; i !== len && (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - if ( !context && elem.ownerDocument !== document ) { - setDocument( elem ); - xml = !documentIsHTML; - } - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context || document, xml) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // `i` is now the count of elements visited above, and adding it to `matchedCount` - // makes the latter nonnegative. - matchedCount += i; - - // Apply set filters to unmatched elements - // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` - // equals `i`), unless we didn't visit _any_ elements in the above loop because we have - // no element matchers and no seed. - // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that - // case, which will result in a "00" `matchedCount` that differs from `i` but is also - // numerically zero. - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !match ) { - match = tokenize( selector ); - } - i = match.length; - while ( i-- ) { - cached = matcherFromTokens( match[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - - // Save selector and tokenization - cached.selector = selector; - } - return cached; -}; - -/** - * A low-level selection function that works with Sizzle's compiled - * selector functions - * @param {String|Function} selector A selector or a pre-compiled - * selector function built with Sizzle.compile - * @param {Element} context - * @param {Array} [results] - * @param {Array} [seed] A set of elements to match against - */ -select = Sizzle.select = function( selector, context, results, seed ) { - var i, tokens, token, type, find, - compiled = typeof selector === "function" && selector, - match = !seed && tokenize( (selector = compiled.selector || selector) ); - - results = results || []; - - // Try to minimize operations if there is only one selector in the list and no seed - // (the latter of which guarantees us context) - if ( match.length === 1 ) { - - // Reduce context if the leading compound selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - support.getById && context.nodeType === 9 && documentIsHTML && - Expr.relative[ tokens[1].type ] ) { - - context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; - if ( !context ) { - return results; - - // Precompiled matchers will still verify ancestry, so step up a level - } else if ( compiled ) { - context = context.parentNode; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - - // Compile and execute a filtering function if one is not provided - // Provide `match` to avoid retokenization if we modified the selector above - ( compiled || compile( selector, match ) )( - seed, - context, - !documentIsHTML, - results, - !context || rsibling.test( selector ) && testContext( context.parentNode ) || context - ); - return results; -}; - -// One-time assignments - -// Sort stability -support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; - -// Support: Chrome 14-35+ -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = !!hasDuplicate; - -// Initialize against the default document -setDocument(); - -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert(function( div1 ) { - // Should return 1, but returns 4 (following) - return div1.compareDocumentPosition( document.createElement("div") ) & 1; -}); - -// Support: IE<8 -// Prevent attribute/property "interpolation" -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert(function( div ) { - div.innerHTML = ""; - return div.firstChild.getAttribute("href") === "#" ; -}) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - }); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert(function( div ) { - div.innerHTML = ""; - div.firstChild.setAttribute( "value", "" ); - return div.firstChild.getAttribute( "value" ) === ""; -}) ) { - addHandle( "value", function( elem, name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - }); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert(function( div ) { - return div.getAttribute("disabled") == null; -}) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return elem[ name ] === true ? name.toLowerCase() : - (val = elem.getAttributeNode( name )) && val.specified ? - val.value : - null; - } - }); -} - -return Sizzle; - -})( window ); - - - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[ ":" ] = jQuery.expr.pseudos; -jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - - -var dir = function( elem, dir, until ) { - var matched = [], - truncate = until !== undefined; - - while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { - if ( elem.nodeType === 1 ) { - if ( truncate && jQuery( elem ).is( until ) ) { - break; - } - matched.push( elem ); - } - } - return matched; -}; - - -var siblings = function( n, elem ) { - var matched = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - matched.push( n ); - } - } - - return matched; -}; - - -var rneedsContext = jQuery.expr.match.needsContext; - -var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ ); - - - -var risSimple = /^.[^:#\[\.,]*$/; - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - /* jshint -W018 */ - return !!qualifier.call( elem, i, elem ) !== not; - } ); - - } - - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - } ); - - } - - if ( typeof qualifier === "string" ) { - if ( risSimple.test( qualifier ) ) { - return jQuery.filter( qualifier, elements, not ); - } - - qualifier = jQuery.filter( qualifier, elements ); - } - - return jQuery.grep( elements, function( elem ) { - return ( indexOf.call( qualifier, elem ) > -1 ) !== not; - } ); -} - -jQuery.filter = function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 && elem.nodeType === 1 ? - jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : - jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - } ) ); -}; - -jQuery.fn.extend( { - find: function( selector ) { - var i, - len = this.length, - ret = [], - self = this; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter( function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - } ) ); - } - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - // Needed because $( selector, context ) becomes $( context ).find( selector ) - ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); - ret.selector = this.selector ? this.selector + " " + selector : selector; - return ret; - }, - filter: function( selector ) { - return this.pushStack( winnow( this, selector || [], false ) ); - }, - not: function( selector ) { - return this.pushStack( winnow( this, selector || [], true ) ); - }, - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - } -} ); - - -// Initialize a jQuery object - - -// A central reference to the root jQuery(document) -var rootjQuery, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, - - init = jQuery.fn.init = function( selector, context, root ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Method init() accepts an alternate rootjQuery - // so migrate can support jQuery.sub (gh-2101) - root = root || rootjQuery; - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector[ 0 ] === "<" && - selector[ selector.length - 1 ] === ">" && - selector.length >= 3 ) { - - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && ( match[ 1 ] || !context ) ) { - - // HANDLE: $(html) -> $(array) - if ( match[ 1 ] ) { - context = context instanceof jQuery ? context[ 0 ] : context; - - // Option to run scripts is true for back-compat - // Intentionally let the error be thrown if parseHTML is not present - jQuery.merge( this, jQuery.parseHTML( - match[ 1 ], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - - // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[ 2 ] ); - - // Support: Blackberry 4.6 - // gEBID returns nodes no longer in the document (#6963) - if ( elem && elem.parentNode ) { - - // Inject the element directly into the jQuery object - this.length = 1; - this[ 0 ] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || root ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this.context = this[ 0 ] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return root.ready !== undefined ? - root.ready( selector ) : - - // Execute immediately if ready is not present - selector( jQuery ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }; - -// Give the init function the jQuery prototype for later instantiation -init.prototype = jQuery.fn; - -// Initialize central reference -rootjQuery = jQuery( document ); - - -var rparentsprev = /^(?:parents|prev(?:Until|All))/, - - // Methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend( { - has: function( target ) { - var targets = jQuery( target, this ), - l = targets.length; - - return this.filter( function() { - var i = 0; - for ( ; i < l; i++ ) { - if ( jQuery.contains( this, targets[ i ] ) ) { - return true; - } - } - } ); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - matched = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( ; i < l; i++ ) { - for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { - - // Always skip document fragments - if ( cur.nodeType < 11 && ( pos ? - pos.index( cur ) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector( cur, selectors ) ) ) { - - matched.push( cur ); - break; - } - } - } - - return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); - }, - - // Determine the position of an element within the set - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; - } - - // Index in selector - if ( typeof elem === "string" ) { - return indexOf.call( jQuery( elem ), this[ 0 ] ); - } - - // Locate the position of the desired element - return indexOf.call( this, - - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[ 0 ] : elem - ); - }, - - add: function( selector, context ) { - return this.pushStack( - jQuery.uniqueSort( - jQuery.merge( this.get(), jQuery( selector, context ) ) - ) - ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - } -} ); - -function sibling( cur, dir ) { - while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} - return cur; -} - -jQuery.each( { - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return siblings( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return siblings( elem.firstChild ); - }, - contents: function( elem ) { - return elem.contentDocument || jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var matched = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - matched = jQuery.filter( selector, matched ); - } - - if ( this.length > 1 ) { - - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - jQuery.uniqueSort( matched ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - matched.reverse(); - } - } - - return this.pushStack( matched ); - }; -} ); -var rnotwhite = ( /\S+/g ); - - - -// Convert String-formatted options into Object-formatted ones -function createOptions( options ) { - var object = {}; - jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { - object[ flag ] = true; - } ); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - createOptions( options ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - - // Last fire value for non-forgettable lists - memory, - - // Flag to know if list was already fired - fired, - - // Flag to prevent firing - locked, - - // Actual callback list - list = [], - - // Queue of execution data for repeatable lists - queue = [], - - // Index of currently firing callback (modified by add/remove as needed) - firingIndex = -1, - - // Fire callbacks - fire = function() { - - // Enforce single-firing - locked = options.once; - - // Execute callbacks for all pending executions, - // respecting firingIndex overrides and runtime changes - fired = firing = true; - for ( ; queue.length; firingIndex = -1 ) { - memory = queue.shift(); - while ( ++firingIndex < list.length ) { - - // Run callback and check for early termination - if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && - options.stopOnFalse ) { - - // Jump to end and forget the data so .add doesn't re-fire - firingIndex = list.length; - memory = false; - } - } - } - - // Forget the data if we're done with it - if ( !options.memory ) { - memory = false; - } - - firing = false; - - // Clean up if we're done firing for good - if ( locked ) { - - // Keep an empty list if we have data for future add calls - if ( memory ) { - list = []; - - // Otherwise, this object is spent - } else { - list = ""; - } - } - }, - - // Actual Callbacks object - self = { - - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - - // If we have memory from a past run, we should fire after adding - if ( memory && !firing ) { - firingIndex = list.length - 1; - queue.push( memory ); - } - - ( function add( args ) { - jQuery.each( args, function( _, arg ) { - if ( jQuery.isFunction( arg ) ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { - - // Inspect recursively - add( arg ); - } - } ); - } )( arguments ); - - if ( memory && !firing ) { - fire(); - } - } - return this; - }, - - // Remove a callback from the list - remove: function() { - jQuery.each( arguments, function( _, arg ) { - var index; - while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - - // Handle firing indexes - if ( index <= firingIndex ) { - firingIndex--; - } - } - } ); - return this; - }, - - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? - jQuery.inArray( fn, list ) > -1 : - list.length > 0; - }, - - // Remove all callbacks from the list - empty: function() { - if ( list ) { - list = []; - } - return this; - }, - - // Disable .fire and .add - // Abort any current/pending executions - // Clear all callbacks and values - disable: function() { - locked = queue = []; - list = memory = ""; - return this; - }, - disabled: function() { - return !list; - }, - - // Disable .fire - // Also disable .add unless we have memory (since it would have no effect) - // Abort any pending executions - lock: function() { - locked = queue = []; - if ( !memory ) { - list = memory = ""; - } - return this; - }, - locked: function() { - return !!locked; - }, - - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( !locked ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - queue.push( args ); - if ( !firing ) { - fire(); - } - } - return this; - }, - - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - -jQuery.extend( { - - Deferred: function( func ) { - var tuples = [ - - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ], - [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ], - [ "notify", "progress", jQuery.Callbacks( "memory" ) ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - then: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - return jQuery.Deferred( function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; - - // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[ 1 ] ]( function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .progress( newDefer.notify ) - .done( newDefer.resolve ) - .fail( newDefer.reject ); - } else { - newDefer[ tuple[ 0 ] + "With" ]( - this === promise ? newDefer.promise() : this, - fn ? [ returned ] : arguments - ); - } - } ); - } ); - fns = null; - } ).promise(); - }, - - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Keep pipe for back-compat - promise.pipe = promise.then; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 3 ]; - - // promise[ done | fail | progress ] = list.add - promise[ tuple[ 1 ] ] = list.add; - - // Handle state - if ( stateString ) { - list.add( function() { - - // state = [ resolved | rejected ] - state = stateString; - - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); - } - - // deferred[ resolve | reject | notify ] - deferred[ tuple[ 0 ] ] = function() { - deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments ); - return this; - }; - deferred[ tuple[ 0 ] + "With" ] = list.fireWith; - } ); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, - resolveValues = slice.call( arguments ), - length = resolveValues.length, - - // the count of uncompleted subordinates - remaining = length !== 1 || - ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - - // the master Deferred. - // If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { - return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; - if ( values === progressValues ) { - deferred.notifyWith( contexts, values ); - } else if ( !( --remaining ) ) { - deferred.resolveWith( contexts, values ); - } - }; - }, - - progressValues, progressContexts, resolveContexts; - - // Add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .progress( updateFunc( i, progressContexts, progressValues ) ) - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ); - } else { - --remaining; - } - } - } - - // If we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); - } - - return deferred.promise(); - } -} ); - - -// The deferred used on DOM ready -var readyList; - -jQuery.fn.ready = function( fn ) { - - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; -}; - -jQuery.extend( { - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.triggerHandler ) { - jQuery( document ).triggerHandler( "ready" ); - jQuery( document ).off( "ready" ); - } - } -} ); - -/** - * The ready event handler and self cleanup method - */ -function completed() { - document.removeEventListener( "DOMContentLoaded", completed ); - window.removeEventListener( "load", completed ); - jQuery.ready(); -} - -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called - // after the browser event has already occurred. - // Support: IE9-10 only - // Older IE sometimes signals "interactive" too soon - if ( document.readyState === "complete" || - ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { - - // Handle it asynchronously to allow scripts the opportunity to delay ready - window.setTimeout( jQuery.ready ); - - } else { - - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed ); - } - } - return readyList.promise( obj ); -}; - -// Kick off the DOM ready check even if the user does not -jQuery.ready.promise(); - - - - -// Multifunctional method to get and set values of a collection -// The value/s can optionally be executed if it's a function -var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - len = elems.length, - bulk = key == null; - - // Sets many values - if ( jQuery.type( key ) === "object" ) { - chainable = true; - for ( i in key ) { - access( elems, fn, i, key[ i ], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !jQuery.isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < len; i++ ) { - fn( - elems[ i ], key, raw ? - value : - value.call( elems[ i ], i, fn( elems[ i ], key ) ) - ); - } - } - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - len ? fn( elems[ 0 ], key ) : emptyGet; -}; -var acceptData = function( owner ) { - - // Accepts only: - // - Node - // - Node.ELEMENT_NODE - // - Node.DOCUMENT_NODE - // - Object - // - Any - /* jshint -W018 */ - return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); -}; - - - - -function Data() { - this.expando = jQuery.expando + Data.uid++; -} - -Data.uid = 1; - -Data.prototype = { - - register: function( owner, initial ) { - var value = initial || {}; - - // If it is a node unlikely to be stringify-ed or looped over - // use plain assignment - if ( owner.nodeType ) { - owner[ this.expando ] = value; - - // Otherwise secure it in a non-enumerable, non-writable property - // configurability must be true to allow the property to be - // deleted with the delete operator - } else { - Object.defineProperty( owner, this.expando, { - value: value, - writable: true, - configurable: true - } ); - } - return owner[ this.expando ]; - }, - cache: function( owner ) { - - // We can accept data for non-element nodes in modern browsers, - // but we should not, see #8335. - // Always return an empty object. - if ( !acceptData( owner ) ) { - return {}; - } - - // Check if the owner object already has a cache - var value = owner[ this.expando ]; - - // If not, create one - if ( !value ) { - value = {}; - - // We can accept data for non-element nodes in modern browsers, - // but we should not, see #8335. - // Always return an empty object. - if ( acceptData( owner ) ) { - - // If it is a node unlikely to be stringify-ed or looped over - // use plain assignment - if ( owner.nodeType ) { - owner[ this.expando ] = value; - - // Otherwise secure it in a non-enumerable property - // configurable must be true to allow the property to be - // deleted when data is removed - } else { - Object.defineProperty( owner, this.expando, { - value: value, - configurable: true - } ); - } - } - } - - return value; - }, - set: function( owner, data, value ) { - var prop, - cache = this.cache( owner ); - - // Handle: [ owner, key, value ] args - if ( typeof data === "string" ) { - cache[ data ] = value; - - // Handle: [ owner, { properties } ] args - } else { - - // Copy the properties one-by-one to the cache object - for ( prop in data ) { - cache[ prop ] = data[ prop ]; - } - } - return cache; - }, - get: function( owner, key ) { - return key === undefined ? - this.cache( owner ) : - owner[ this.expando ] && owner[ this.expando ][ key ]; - }, - access: function( owner, key, value ) { - var stored; - - // In cases where either: - // - // 1. No key was specified - // 2. A string key was specified, but no value provided - // - // Take the "read" path and allow the get method to determine - // which value to return, respectively either: - // - // 1. The entire cache object - // 2. The data stored at the key - // - if ( key === undefined || - ( ( key && typeof key === "string" ) && value === undefined ) ) { - - stored = this.get( owner, key ); - - return stored !== undefined ? - stored : this.get( owner, jQuery.camelCase( key ) ); - } - - // When the key is not a string, or both a key and value - // are specified, set or extend (existing objects) with either: - // - // 1. An object of properties - // 2. A key and value - // - this.set( owner, key, value ); - - // Since the "set" path can have two possible entry points - // return the expected data based on which path was taken[*] - return value !== undefined ? value : key; - }, - remove: function( owner, key ) { - var i, name, camel, - cache = owner[ this.expando ]; - - if ( cache === undefined ) { - return; - } - - if ( key === undefined ) { - this.register( owner ); - - } else { - - // Support array or space separated string of keys - if ( jQuery.isArray( key ) ) { - - // If "name" is an array of keys... - // When data is initially created, via ("key", "val") signature, - // keys will be converted to camelCase. - // Since there is no way to tell _how_ a key was added, remove - // both plain key and camelCase key. #12786 - // This will only penalize the array argument path. - name = key.concat( key.map( jQuery.camelCase ) ); - } else { - camel = jQuery.camelCase( key ); - - // Try the string as a key before any manipulation - if ( key in cache ) { - name = [ key, camel ]; - } else { - - // If a key with the spaces exists, use it. - // Otherwise, create an array by matching non-whitespace - name = camel; - name = name in cache ? - [ name ] : ( name.match( rnotwhite ) || [] ); - } - } - - i = name.length; - - while ( i-- ) { - delete cache[ name[ i ] ]; - } - } - - // Remove the expando if there's no more data - if ( key === undefined || jQuery.isEmptyObject( cache ) ) { - - // Support: Chrome <= 35-45+ - // Webkit & Blink performance suffers when deleting properties - // from DOM nodes, so set to undefined instead - // https://code.google.com/p/chromium/issues/detail?id=378607 - if ( owner.nodeType ) { - owner[ this.expando ] = undefined; - } else { - delete owner[ this.expando ]; - } - } - }, - hasData: function( owner ) { - var cache = owner[ this.expando ]; - return cache !== undefined && !jQuery.isEmptyObject( cache ); - } -}; -var dataPriv = new Data(); - -var dataUser = new Data(); - - - -// Implementation Summary -// -// 1. Enforce API surface and semantic compatibility with 1.9.x branch -// 2. Improve the module's maintainability by reducing the storage -// paths to a single mechanism. -// 3. Use the same single mechanism to support "private" and "user" data. -// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) -// 5. Avoid exposing implementation details on user objects (eg. expando properties) -// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 - -var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, - rmultiDash = /[A-Z]/g; - -function dataAttr( elem, key, data ) { - var name; - - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch ( e ) {} - - // Make sure we set the data so it isn't changed later - dataUser.set( elem, key, data ); - } else { - data = undefined; - } - } - return data; -} - -jQuery.extend( { - hasData: function( elem ) { - return dataUser.hasData( elem ) || dataPriv.hasData( elem ); - }, - - data: function( elem, name, data ) { - return dataUser.access( elem, name, data ); - }, - - removeData: function( elem, name ) { - dataUser.remove( elem, name ); - }, - - // TODO: Now that all calls to _data and _removeData have been replaced - // with direct calls to dataPriv methods, these can be deprecated. - _data: function( elem, name, data ) { - return dataPriv.access( elem, name, data ); - }, - - _removeData: function( elem, name ) { - dataPriv.remove( elem, name ); - } -} ); - -jQuery.fn.extend( { - data: function( key, value ) { - var i, name, data, - elem = this[ 0 ], - attrs = elem && elem.attributes; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = dataUser.get( elem ); - - if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { - i = attrs.length; - while ( i-- ) { - - // Support: IE11+ - // The attrs elements can be null (#14894) - if ( attrs[ i ] ) { - name = attrs[ i ].name; - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.slice( 5 ) ); - dataAttr( elem, name, data[ name ] ); - } - } - } - dataPriv.set( elem, "hasDataAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each( function() { - dataUser.set( this, key ); - } ); - } - - return access( this, function( value ) { - var data, camelKey; - - // The calling jQuery object (element matches) is not empty - // (and therefore has an element appears at this[ 0 ]) and the - // `value` parameter was not undefined. An empty jQuery object - // will result in `undefined` for elem = this[ 0 ] which will - // throw an exception if an attempt to read a data cache is made. - if ( elem && value === undefined ) { - - // Attempt to get data from the cache - // with the key as-is - data = dataUser.get( elem, key ) || - - // Try to find dashed key if it exists (gh-2779) - // This is for 2.2.x only - dataUser.get( elem, key.replace( rmultiDash, "-$&" ).toLowerCase() ); - - if ( data !== undefined ) { - return data; - } - - camelKey = jQuery.camelCase( key ); - - // Attempt to get data from the cache - // with the key camelized - data = dataUser.get( elem, camelKey ); - if ( data !== undefined ) { - return data; - } - - // Attempt to "discover" the data in - // HTML5 custom data-* attrs - data = dataAttr( elem, camelKey, undefined ); - if ( data !== undefined ) { - return data; - } - - // We tried really hard, but the data doesn't exist. - return; - } - - // Set the data... - camelKey = jQuery.camelCase( key ); - this.each( function() { - - // First, attempt to store a copy or reference of any - // data that might've been store with a camelCased key. - var data = dataUser.get( this, camelKey ); - - // For HTML5 data-* attribute interop, we have to - // store property names with dashes in a camelCase form. - // This might not apply to all properties...* - dataUser.set( this, camelKey, value ); - - // *... In the case of properties that might _actually_ - // have dashes, we need to also store a copy of that - // unchanged property. - if ( key.indexOf( "-" ) > -1 && data !== undefined ) { - dataUser.set( this, key, value ); - } - } ); - }, null, value, arguments.length > 1, null, true ); - }, - - removeData: function( key ) { - return this.each( function() { - dataUser.remove( this, key ); - } ); - } -} ); - - -jQuery.extend( { - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = dataPriv.get( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || jQuery.isArray( data ) ) { - queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // Clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // Not public - generate a queueHooks object, or return the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { - empty: jQuery.Callbacks( "once memory" ).add( function() { - dataPriv.remove( elem, [ type + "queue", key ] ); - } ) - } ); - } -} ); - -jQuery.fn.extend( { - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[ 0 ], type ); - } - - return data === undefined ? - this : - this.each( function() { - var queue = jQuery.queue( this, type, data ); - - // Ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - } ); - }, - dequeue: function( type ) { - return this.each( function() { - jQuery.dequeue( this, type ); - } ); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while ( i-- ) { - tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -} ); -var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; - -var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); - - -var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; - -var isHidden = function( elem, el ) { - - // isHidden might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || - !jQuery.contains( elem.ownerDocument, elem ); - }; - - - -function adjustCSS( elem, prop, valueParts, tween ) { - var adjusted, - scale = 1, - maxIterations = 20, - currentValue = tween ? - function() { return tween.cur(); } : - function() { return jQuery.css( elem, prop, "" ); }, - initial = currentValue(), - unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), - - // Starting value computation is required for potential unit mismatches - initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && - rcssNum.exec( jQuery.css( elem, prop ) ); - - if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { - - // Trust units reported by jQuery.css - unit = unit || initialInUnit[ 3 ]; - - // Make sure we update the tween properties later on - valueParts = valueParts || []; - - // Iteratively approximate from a nonzero starting point - initialInUnit = +initial || 1; - - do { - - // If previous iteration zeroed out, double until we get *something*. - // Use string for doubling so we don't accidentally see scale as unchanged below - scale = scale || ".5"; - - // Adjust and apply - initialInUnit = initialInUnit / scale; - jQuery.style( elem, prop, initialInUnit + unit ); - - // Update scale, tolerating zero or NaN from tween.cur() - // Break the loop if scale is unchanged or perfect, or if we've just had enough. - } while ( - scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations - ); - } - - if ( valueParts ) { - initialInUnit = +initialInUnit || +initial || 0; - - // Apply relative offset (+=/-=) if specified - adjusted = valueParts[ 1 ] ? - initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : - +valueParts[ 2 ]; - if ( tween ) { - tween.unit = unit; - tween.start = initialInUnit; - tween.end = adjusted; - } - } - return adjusted; -} -var rcheckableType = ( /^(?:checkbox|radio)$/i ); - -var rtagName = ( /<([\w:-]+)/ ); - -var rscriptType = ( /^$|\/(?:java|ecma)script/i ); - - - -// We have to close these tags to support XHTML (#13200) -var wrapMap = { - - // Support: IE9 - option: [ 1, "" ], - - // XHTML parsers do not magically insert elements in the - // same way that tag soup parsers do. So we cannot shorten - // this by omitting or other required elements. - thead: [ 1, "", "
" ], - col: [ 2, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - _default: [ 0, "", "" ] -}; - -// Support: IE9 -wrapMap.optgroup = wrapMap.option; - -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - - -function getAll( context, tag ) { - - // Support: IE9-11+ - // Use typeof to avoid zero-argument method invocation on host objects (#15151) - var ret = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( tag || "*" ) : - typeof context.querySelectorAll !== "undefined" ? - context.querySelectorAll( tag || "*" ) : - []; - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], ret ) : - ret; -} - - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - dataPriv.set( - elems[ i ], - "globalEval", - !refElements || dataPriv.get( refElements[ i ], "globalEval" ) - ); - } -} - - -var rhtml = /<|&#?\w+;/; - -function buildFragment( elems, context, scripts, selection, ignored ) { - var elem, tmp, tag, wrap, contains, j, - fragment = context.createDocumentFragment(), - nodes = [], - i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { - - // Support: Android<4.1, PhantomJS<2 - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; - - // Descend through wrappers to the right content - j = wrap[ 0 ]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Support: Android<4.1, PhantomJS<2 - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, tmp.childNodes ); - - // Remember the top-level container - tmp = fragment.firstChild; - - // Ensure the created nodes are orphaned (#12392) - tmp.textContent = ""; - } - } - } - - // Remove wrapper from fragment - fragment.textContent = ""; - - i = 0; - while ( ( elem = nodes[ i++ ] ) ) { - - // Skip elements already in the context collection (trac-4087) - if ( selection && jQuery.inArray( elem, selection ) > -1 ) { - if ( ignored ) { - ignored.push( elem ); - } - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( fragment.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( ( elem = tmp[ j++ ] ) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - return fragment; -} - - -( function() { - var fragment = document.createDocumentFragment(), - div = fragment.appendChild( document.createElement( "div" ) ), - input = document.createElement( "input" ); - - // Support: Android 4.0-4.3, Safari<=5.1 - // Check state lost if the name is set (#11217) - // Support: Windows Web Apps (WWA) - // `name` and `type` must use .setAttribute for WWA (#14901) - input.setAttribute( "type", "radio" ); - input.setAttribute( "checked", "checked" ); - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - - // Support: Safari<=5.1, Android<4.2 - // Older WebKit doesn't clone checked state correctly in fragments - support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE<=11+ - // Make sure textarea (and checkbox) defaultValue is properly cloned - div.innerHTML = ""; - support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; -} )(); - - -var - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -// Support: IE9 -// See #13393 for more info -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -function on( elem, types, selector, data, fn, one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - on( elem, type, selector, data, types[ type ], one ); - } - return elem; - } - - if ( data == null && fn == null ) { - - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return elem; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return elem.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - } ); -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - - var handleObjIn, eventHandle, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.get( elem ); - - // Don't attach events to noData or text/comment nodes (but allow plain objects) - if ( !elemData ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !( events = elemData.events ) ) { - events = elemData.events = {}; - } - if ( !( eventHandle = elemData.handle ) ) { - eventHandle = elemData.handle = function( e ) { - - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? - jQuery.event.dispatch.apply( elem, arguments ) : undefined; - }; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( rnotwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend( { - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join( "." ) - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !( handlers = events[ type ] ) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener if the special events handler returns false - if ( !special.setup || - special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var j, origCount, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); - - if ( !elemData || !( events = elemData.events ) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnotwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[ 2 ] && - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || - selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || - special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove data and the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - dataPriv.remove( elem, "handle events" ); - } - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event ); - - var i, j, ret, matched, handleObj, - handlerQueue = [], - args = slice.call( arguments ), - handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[ 0 ] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( ( handleObj = matched.handlers[ j++ ] ) && - !event.isImmediatePropagationStopped() ) { - - // Triggered event must either 1) have no namespace, or 2) have namespace(s) - // a subset or equal to those in the bound event (both can have no namespace). - if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || - handleObj.handler ).apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( ( event.result = ret ) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var i, matches, sel, handleObj, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Support (at least): Chrome, IE9 - // Find delegate handlers - // Black-hole SVG instance trees (#13180) - // - // Support: Firefox<=42+ - // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343) - if ( delegateCount && cur.nodeType && - ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { - - for ( ; cur !== this; cur = cur.parentNode || this ) { - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) { - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matches[ sel ] === undefined ) { - matches[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) > -1 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matches[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push( { elem: cur, handlers: matches } ); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( delegateCount < handlers.length ) { - handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } ); - } - - return handlerQueue; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " + - "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split( " " ), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: ( "button buttons clientX clientY offsetX offsetY pageX pageY " + - "screenX screenY toElement" ).split( " " ), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + - ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + - ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, copy, - type = event.type, - originalEvent = event, - fixHook = this.fixHooks[ type ]; - - if ( !fixHook ) { - this.fixHooks[ type ] = fixHook = - rmouseEvent.test( type ) ? this.mouseHooks : - rkeyEvent.test( type ) ? this.keyHooks : - {}; - } - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = new jQuery.Event( originalEvent ); - - i = copy.length; - while ( i-- ) { - prop = copy[ i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Support: Cordova 2.5 (WebKit) (#13255) - // All events should have a target; Cordova deviceready doesn't - if ( !event.target ) { - event.target = document; - } - - // Support: Safari 6.0+, Chrome<28 - // Target should not be a text node (#504, #13143) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - load: { - - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - focus: { - - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== safeActiveElement() && this.focus ) { - this.focus(); - return false; - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === safeActiveElement() && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - click: { - - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { - this.click(); - return false; - } - }, - - // For cross-browser consistency, don't fire native .click() on links - _default: function( event ) { - return jQuery.nodeName( event.target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Support: Firefox 20+ - // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined && event.originalEvent ) { - event.originalEvent.returnValue = event.result; - } - } - } - } -}; - -jQuery.removeEvent = function( elem, type, handle ) { - - // This "if" is needed for plain objects - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle ); - } -}; - -jQuery.Event = function( src, props ) { - - // Allow instantiation without the 'new' keyword - if ( !( this instanceof jQuery.Event ) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = src.defaultPrevented || - src.defaultPrevented === undefined && - - // Support: Android<4.0 - src.returnValue === false ? - returnTrue : - returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - constructor: jQuery.Event, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - - if ( e ) { - e.preventDefault(); - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - - if ( e ) { - e.stopPropagation(); - } - }, - stopImmediatePropagation: function() { - var e = this.originalEvent; - - this.isImmediatePropagationStopped = returnTrue; - - if ( e ) { - e.stopImmediatePropagation(); - } - - this.stopPropagation(); - } -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -// so that event delegation works in jQuery. -// Do the same for pointerenter/pointerleave and pointerover/pointerout -// -// Support: Safari 7 only -// Safari sends mouseenter too often; see: -// https://code.google.com/p/chromium/issues/detail?id=470258 -// for the description of the bug (it existed in older Chrome versions as well). -jQuery.each( { - mouseenter: "mouseover", - mouseleave: "mouseout", - pointerenter: "pointerover", - pointerleave: "pointerout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mouseenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -} ); - -jQuery.fn.extend( { - on: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn ); - }, - one: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? - handleObj.origType + "." + handleObj.namespace : - handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each( function() { - jQuery.event.remove( this, types, fn, selector ); - } ); - } -} ); - - -var - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, - - // Support: IE 10-11, Edge 10240+ - // In IE/Edge using regex groups here causes severe slowdowns. - // See https://connect.microsoft.com/IE/feedback/details/1736512/ - rnoInnerhtml = /\s*$/g; - -// Manipulating tables requires a tbody -function manipulationTarget( elem, content ) { - return jQuery.nodeName( elem, "table" ) && - jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? - - elem.getElementsByTagName( "tbody" )[ 0 ] || - elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) : - elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - - if ( match ) { - elem.type = match[ 1 ]; - } else { - elem.removeAttribute( "type" ); - } - - return elem; -} - -function cloneCopyEvent( src, dest ) { - var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; - - if ( dest.nodeType !== 1 ) { - return; - } - - // 1. Copy private data: events, handlers, etc. - if ( dataPriv.hasData( src ) ) { - pdataOld = dataPriv.access( src ); - pdataCur = dataPriv.set( dest, pdataOld ); - events = pdataOld.events; - - if ( events ) { - delete pdataCur.handle; - pdataCur.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - } - - // 2. Copy user data - if ( dataUser.hasData( src ) ) { - udataOld = dataUser.access( src ); - udataCur = jQuery.extend( {}, udataOld ); - - dataUser.set( dest, udataCur ); - } -} - -// Fix IE bugs, see support tests -function fixInput( src, dest ) { - var nodeName = dest.nodeName.toLowerCase(); - - // Fails to persist the checked state of a cloned checkbox or radio button. - if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - dest.checked = src.checked; - - // Fails to return the selected option to the default selected state when cloning options - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -function domManip( collection, args, callback, ignored ) { - - // Flatten any nested arrays - args = concat.apply( [], args ); - - var fragment, first, scripts, hasScripts, node, doc, - i = 0, - l = collection.length, - iNoClone = l - 1, - value = args[ 0 ], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || - ( l > 1 && typeof value === "string" && - !support.checkClone && rchecked.test( value ) ) ) { - return collection.each( function( index ) { - var self = collection.eq( index ); - if ( isFunction ) { - args[ 0 ] = value.call( this, index, self.html() ); - } - domManip( self, args, callback, ignored ); - } ); - } - - if ( l ) { - fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - // Require either new content or an interest in ignored elements to invoke the callback - if ( first || ignored ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item - // instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - - // Support: Android<4.1, PhantomJS<2 - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( collection[ i ], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !dataPriv.access( node, "globalEval" ) && - jQuery.contains( doc, node ) ) { - - if ( node.src ) { - - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl ) { - jQuery._evalUrl( node.src ); - } - } else { - jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); - } - } - } - } - } - } - - return collection; -} - -function remove( elem, selector, keepData ) { - var node, - nodes = selector ? jQuery.filter( selector, elem ) : elem, - i = 0; - - for ( ; ( node = nodes[ i ] ) != null; i++ ) { - if ( !keepData && node.nodeType === 1 ) { - jQuery.cleanData( getAll( node ) ); - } - - if ( node.parentNode ) { - if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { - setGlobalEval( getAll( node, "script" ) ); - } - node.parentNode.removeChild( node ); - } - } - - return elem; -} - -jQuery.extend( { - htmlPrefilter: function( html ) { - return html.replace( rxhtmlTag, "<$1>" ); - }, - - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var i, l, srcElements, destElements, - clone = elem.cloneNode( true ), - inPage = jQuery.contains( elem.ownerDocument, elem ); - - // Fix IE cloning issues - if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && - !jQuery.isXMLDoc( elem ) ) { - - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - fixInput( srcElements[ i ], destElements[ i ] ); - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - cloneCopyEvent( srcElements[ i ], destElements[ i ] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - // Return the cloned set - return clone; - }, - - cleanData: function( elems ) { - var data, elem, type, - special = jQuery.event.special, - i = 0; - - for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { - if ( acceptData( elem ) ) { - if ( ( data = elem[ dataPriv.expando ] ) ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Support: Chrome <= 35-45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataPriv.expando ] = undefined; - } - if ( elem[ dataUser.expando ] ) { - - // Support: Chrome <= 35-45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataUser.expando ] = undefined; - } - } - } - } -} ); - -jQuery.fn.extend( { - - // Keep domManip exposed until 3.0 (gh-2225) - domManip: domManip, - - detach: function( selector ) { - return remove( this, selector, true ); - }, - - remove: function( selector ) { - return remove( this, selector ); - }, - - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().each( function() { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.textContent = value; - } - } ); - }, null, value, arguments.length ); - }, - - append: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - } ); - }, - - prepend: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - } ); - }, - - before: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - } ); - }, - - after: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - } ); - }, - - empty: function() { - var elem, - i = 0; - - for ( ; ( elem = this[ i ] ) != null; i++ ) { - if ( elem.nodeType === 1 ) { - - // Prevent memory leaks - jQuery.cleanData( getAll( elem, false ) ); - - // Remove any remaining nodes - elem.textContent = ""; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - } ); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined && elem.nodeType === 1 ) { - return elem.innerHTML; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { - - value = jQuery.htmlPrefilter( value ); - - try { - for ( ; i < l; i++ ) { - elem = this[ i ] || {}; - - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch ( e ) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var ignored = []; - - // Make the changes, replacing each non-ignored context element with the new content - return domManip( this, arguments, function( elem ) { - var parent = this.parentNode; - - if ( jQuery.inArray( this, ignored ) < 0 ) { - jQuery.cleanData( getAll( this ) ); - if ( parent ) { - parent.replaceChild( elem, this ); - } - } - - // Force callback invocation - }, ignored ); - } -} ); - -jQuery.each( { - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1, - i = 0; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone( true ); - jQuery( insert[ i ] )[ original ]( elems ); - - // Support: QtWebKit - // .get() because push.apply(_, arraylike) throws - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -} ); - - -var iframe, - elemdisplay = { - - // Support: Firefox - // We have to pre-define these values for FF (#10227) - HTML: "block", - BODY: "block" - }; - -/** - * Retrieve the actual display of a element - * @param {String} name nodeName of the element - * @param {Object} doc Document object - */ - -// Called only from within defaultDisplay -function actualDisplay( name, doc ) { - var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), - - display = jQuery.css( elem[ 0 ], "display" ); - - // We don't have any data stored on the element, - // so use "detach" method as fast way to get rid of the element - elem.detach(); - - return display; -} - -/** - * Try to determine the default display value of an element - * @param {String} nodeName - */ -function defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - - // Use the already-created iframe if possible - iframe = ( iframe || jQuery( "