Which barcode types belong to which group (retail product, tickets and passes, parcels, cases and pallets, GS1, postal, ID and documents) and how to enable a whole group in ZipZapKit.
ZipZapKit hasn’t been released yet. The API names on this page are provisional and may change.
Most people know what they’re scanning, products, shipping labels, IDs, but not which barcode types those use. Groups let you say the first and get the second: enable a group, and a field reads every barcode type in it.Groups work like tags, not folders. A barcode type can carry any number of them, or none, and a group isn’t simply a subset of a bigger one. Each group is defined by what you’re scanning, not by what the barcode looks like.This page lists what’s in each group. Whether a particular reader can read each type is a separate question, answered on each barcode type’s page.
How groups work
Groups overlap. A barcode type can be in several groups. GS1-128 is in Parcels, Cases and pallets, and GS1.
Some memberships depend on the content. A QR code is a retail product barcode only when it carries a GTIN, and a PDF417 is an ID barcode only when it carries a driver’s license. A field set to that group reads the barcodes that match and ignores the rest.
Some barcode types aren’t in any group. Code 39, Codabar and other general-purpose barcodes are used for too many things to tell what’s on them. Enable them on their own.
Enabling two groups gives you both. The field reads any barcode type in either group.
Narrower is better. Every extra barcode type a field accepts makes camera scanning a little slower and wrong reads a little more likely. Pick the narrowest group that covers what you scan.
See Barcode types for combining groups and choosing individual types.
The groups
Retail product
For the barcode on the thing a shopper hands you: every barcode that identifies a product by its GTIN.QR Code and Data Matrix are in this group only when they carry a GTIN, because products are starting to use them at checkout. See Sunrise 2027. Any other QR code, such as a link on a poster, isn’t a product barcode, and a field set to this group ignores it.GS1 Composite is in this group when its linear part carries a GTIN, as it always does on a UPC, EAN or DataBar. A composite built on GS1-128 may carry a pallet’s SSCC instead.
How ZipZapKit tells whether a 2D barcode carries a GTIN
A QR Code or Data Matrix counts as a product barcode in two cases:
It contains
How ZipZapKit recognizes it
A GS1 Digital Link: a web address with /01/ followed by a GTIN
From the content: the address is in Digital Link form and the GTIN’s check digit is valid. Works the same with every reader.
GS1 data, as in GS1 DataMatrix or GS1 QR Code
When the scan source reports the barcode’s symbology identifier (]d2 or ]Q3), which marks GS1 data, ZipZapKit uses it. The camera doesn’t report it, so ZipZapKit infers it from the content: the data must parse as GS1 data starting with a GTIN whose check digit is valid.
The camera’s inference is rarely wrong, because ordinary text almost never parses as GS1 data with a valid check digit.
Tickets and passes
For event tickets, boarding passes, transit tickets and passes in Apple Wallet, on a phone screen or printed.These are the four barcode types Apple Wallet passes can use, plus Data Matrix, which airlines can use on mobile boarding passes. If you issue the tickets yourself, enable only the barcode type you print: a narrower field scans faster.
Parcels
For the shipping label on a parcel: the carrier’s tracking number and the sorting barcodes beside it.Most carriers put the tracking number in a Code 128 or GS1-128 barcode. MaxiCode and PDF417 carry sorting and address data alongside it. Code 128 is used for many things besides parcels, so check that a scan is a tracking number. See Validation.
Cases and pallets
For receiving goods: the GS1 labels on cases, cartons and pallets, rather than on the products inside.A case carries its own GTIN in an ITF-14 barcode. A pallet label carries an SSCC, the pallet’s serial number, in GS1-128, often with batch numbers and dates. See the GS1 AI table.
GS1
For barcodes that can carry GS1 data beyond a product number: Application Identifiers such as batch numbers and expiry dates, or a GS1 Digital Link. Use it with ZipZapKit’s GS1 parsing. See GS1 Application Identifiers.QR Code and Data Matrix are in this group only when they carry GS1 data or a Digital Link, recognized the same way as for Retail product.
Postal
The barcodes postal services print on mail for sorting and tracking.
ID and documents
Barcodes and printed text on identity documents: the PDF417 barcode on North American driver’s licenses, and the MRZ on passports and ID cards. The MRZ is printed text, not a barcode, and needs a reader with text recognition.PDF417 is in this group only when it carries AAMVA data, the format of North American driver’s licenses and ID cards. That data always starts with a fixed header, so every reader recognizes it from the content. A PDF417 on a boarding pass or parcel label isn’t an ID, and a field set to this group ignores it.
Every barcode type and its groups
The table is split by shape. A barcode type that isn’t in any group can still be enabled on its own.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Sparklane Docs","description":"Developer documentation for ZipZapKit, the Swift SDK for scanning barcodes in your iOS app, plus a reference to every barcode type, GS1 data and check digits, and tools to decode, check and generate barcodes.","colors":{"primary":"#111214","light":"#D4FF3F","dark":"#111214"},"logo":{"light":"https://mintcdn.com/sparklane/eA0rJR6iNtLhoJwT/logo/lockup-sparklane.svg?fit=max\u0026auto=format\u0026n=eA0rJR6iNtLhoJwT\u0026q=85\u0026s=63b59b7296b0d24b4196a133ac89b8f7","dark":"https://mintcdn.com/sparklane/eA0rJR6iNtLhoJwT/logo/lockup-sparklane-dark.svg?fit=max\u0026auto=format\u0026n=eA0rJR6iNtLhoJwT\u0026q=85\u0026s=2bef0f92c77026381ca468ea149b2772","href":"https://www.sparklane.com"},"favicon":"https://mintcdn.com/sparklane/eA0rJR6iNtLhoJwT/favicon.svg?fit=max\u0026auto=format\u0026n=eA0rJR6iNtLhoJwT\u0026q=85\u0026s=f64a1c06ac831ebe08606c30a820e1a6","background":{"color":{"light":"#FAFAFA","dark":"#0E0F11"}},"navbar":{"links":[{"href":"https://www.sparklane.com/support","label":"Support"}],"primary":{"type":"button","label":"Get started","href":"/sdk/getting-started"}},"footer":{"links":[{"header":"Company","items":[{"label":"About","href":"https://www.sparklane.com/about"},{"label":"Privacy","href":"https://www.sparklane.com/privacy"},{"label":"Legal","href":"https://www.sparklane.com/legal"}]}]},"fonts":{"family":"Geist"},"styling":{"codeblocks":"dark","latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"sparklane","hasAudioNarration":false,"actualSubdomain":"sparklane","customDomains":["docs.sparklane.com"],"gitSource":{"type":"github","owner":"sparklane-inc","repo":"sparklane-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":"","_id":"6b1102489ffae5051c41e584"},"feedback":{"thumbs":true,"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"},"WEB_MCP":{"status":"DISABLED"},"NARRATION":{"status":"DISABLED"}},"buildId":"6ac46c4478efa927eac3ad34","clientVersion":"0.0.4428","searchFilterCounts":[{"language":"default","tag":"Barcode reference","count":47},{"language":"default","tag":"SDK","count":17},{"language":"default","tag":"Logistics and industrial","count":12},{"language":"default","tag":"Postal","count":10},{"language":"default","tag":"2D","count":9},{"language":"default","tag":"Retail (GTIN)","count":8},{"language":"default","tag":"Reference","count":7},{"language":"default","tag":"API reference","count":5},{"language":"default","tag":"Tools","count":4},{"language":"default","tag":"Modifiers","count":3}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"auth-vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":true},"customCss":[{"filePath":"style.css","content":"/* cyrillic-ext */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTN1OVgaY.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTPlOVgaY.woff2) format('woff2');\n unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* greek */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOVOVgaY.woff2) format('woff2');\n unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;\n}\n/* vietnamese */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNVOVgaY.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNFOVgaY.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOlOV.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n:root{--sl-line: #E4E6EA;--sl-ink-muted: #6B6F76;--sl-surface: #F2F3F5}.dark{--sl-line: #1E2023;--sl-ink-muted: #9A9EA6;--sl-surface: #17181B}code,pre,kbd,samp{font-family:\"JetBrains Mono\", ui-monospace, SFMono-Regular, Menlo, monospace}h1,h2,h3{font-weight:700;letter-spacing:-0.03em;text-wrap:pretty}h1{letter-spacing:-0.04em}[data-table-wrapper] [data-component-part=\"scroll-area-viewport\"]{--table-cover: rgb(var(--background-light));--table-cover-clear: rgb(var(--background-light) / 0);--table-shadow: rgb(0 0 0 / 0.28);background:linear-gradient(to right, var(--table-cover) 30%, var(--table-cover-clear)) left center / 40px 100% no-repeat local,\n linear-gradient(to left, var(--table-cover) 30%, var(--table-cover-clear)) right center / 40px 100% no-repeat local,\n radial-gradient(farthest-side at 0 50%, var(--table-shadow), transparent) left center / 20px 100% no-repeat scroll,\n radial-gradient(farthest-side at 100% 50%, var(--table-shadow), transparent) right center / 20px 100% no-repeat scroll}.dark [data-table-wrapper] [data-component-part=\"scroll-area-viewport\"]{--table-cover: rgb(var(--background-dark));--table-cover-clear: rgb(var(--background-dark) / 0);--table-shadow: rgb(255 255 255 / 0.22)}@media (max-width: 640px){[data-table-wrapper] table td,[data-table-wrapper] table th{min-width:0}}.barcode-tool table{border-collapse:collapse;margin:12px 0;font-size:14px}.barcode-tool th,.barcode-tool td{padding:6px 16px 6px 0;text-align:left;vertical-align:top}.barcode-tool th:last-child,.barcode-tool td:last-child{padding-right:0}.barcode-tool tr+tr>*,.barcode-tool tbody tr:first-child>*{border-top:1px solid rgb(128 128 128 / 0.25)}.barcode-tool .viewer-close{background:rgb(255 255 255 / 0.72);color:#111214}.dark .barcode-tool .viewer-close{background:rgb(14 15 17 / 0.62);color:#fff}"}]}
{"page":{"pagePath":"reference/barcode-groups","slug":"/reference/barcode-groups","pageMetadata":{"title":"Barcode groups","description":"Which barcode types belong to which group (retail product, tickets and passes, parcels, cases and pallets, GS1, postal, ID and documents) and how to enable a whole group in ZipZapKit.","sidebarTitle":"Barcode groups","href":"/reference/barcode-groups"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Which barcode types belong to which group (retail product, tickets and passes, parcels, cases and pallets, GS1, postal, ID and documents) and how to enable a whole group in ZipZapKit.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];const Barcode=({view,...props})=>{const _components={a:`a`,..._provideComponents()};const BARCODE_GROUPS=[{key:`retail`,name:`Retail product`,anchor:`retail-product`},{key:`tickets`,name:`Tickets and passes`,anchor:`tickets-and-passes`},{key:`parcels`,name:`Parcels`,anchor:`parcels`},{key:`pallets`,name:`Cases and pallets`,anchor:`cases-and-pallets`},{key:`gs1`,name:`GS1`,anchor:`gs1`},{key:`postal`,name:`Postal`,anchor:`postal`},{key:`id`,name:`ID and documents`,anchor:`id-and-documents`}];const BARCODE_TYPES=[{slug:`upc-a`,name:`UPC-A`,dimension:`1D`,data:`Digits 0–9`,length:`12 digits`,check:{label:`GS1 mod-10`,method:`gs1-mod10`},groups:[`retail`],standard:`ISO/IEC 15420:2025, GS1 General Specifications`,status:`active`,example:`061414100007`,verified:true},{slug:`upc-e`,name:`UPC-E`,dimension:`1D`,data:`Digits 0–9`,length:`8 digits (expands to 12)`,check:{label:`GS1 mod-10, on the expanded UPC-A`,method:`upc-e`},groups:[`retail`],standard:`ISO/IEC 15420:2025, GS1 General Specifications`,status:`active`,example:`01234565`,verified:true},{slug:`ean-13`,name:`EAN-13`,dimension:`1D`,data:`Digits 0–9`,length:`13 digits`,check:{label:`GS1 mod-10`,method:`gs1-mod10`},groups:[`retail`],standard:`ISO/IEC 15420:2025, GS1 General Specifications`,status:`active`,example:`9521234567899`,verified:true},{slug:`ean-8`,name:`EAN-8`,dimension:`1D`,data:`Digits 0–9`,length:`8 digits`,check:{label:`GS1 mod-10`,method:`gs1-mod10`},groups:[`retail`],standard:`ISO/IEC 15420:2025, GS1 General Specifications`,status:`active`,example:`95212340`,verified:true},{slug:`isbn`,name:`ISBN`,dimension:`1D`,data:`Digits 0–9`,length:`13 digits, starting 978 or 979`,check:{label:`GS1 mod-10 (ISBN-10: mod-11)`,method:`gs1-mod10`},groups:[`retail`],standard:`ISO 2108, encoded as EAN-13`,status:`active`,example:`9780306406157`,verified:true},{slug:`issn`,name:`ISSN`,dimension:`1D`,data:`Digits 0–9`,length:`13 digits, starting 977, often with a 2-digit add-on`,check:{label:`GS1 mod-10 (the ISSN itself: mod-11)`,method:`gs1-mod10`},groups:[`retail`],standard:`ISO 3297, encoded as EAN-13`,status:`active`,example:`9771234567003`,verified:true},{slug:`gs1-databar`,name:`GS1 DataBar`,dimension:`1D`,data:`A GTIN; Expanded adds GS1 data such as weight and expiry`,length:`14 digits; Expanded up to 74 digits or 41 letters`,check:{label:`Built-in check, plus the GTIN check digit`,method:null},groups:[`retail`,`gs1`],standard:`ISO/IEC 24724`,status:`active`,example:null,verified:false},{slug:`gs1-composite`,name:`GS1 Composite`,dimension:`1D with a 2D component`,data:`GS1 Application Identifier element strings`,length:`Up to 56, 338 or 2,361 digits in the 2D part`,check:{label:`Each component has its own`,method:null},groups:[`retail`,`gs1`],groupWhen:{retail:`with a GTIN`},standard:`ISO/IEC 24723`,status:`active`,example:null,verified:false},{slug:`itf-14`,name:`ITF-14`,dimension:`1D`,data:`Digits 0–9`,length:`14 digits`,check:{label:`GS1 mod-10`,method:`gs1-mod10`},groups:[`pallets`],standard:`ISO/IEC 16390, GS1 General Specifications`,status:`active`,example:`19521234567896`,verified:true},{slug:`code-128`,name:`Code 128`,dimension:`1D`,data:`All 128 ASCII characters`,length:`Variable`,check:{label:`Mod-103 check character`,method:null},groups:[`tickets`,`parcels`],standard:`ISO/IEC 15417`,status:`active`,example:null,verified:true},{slug:`gs1-128`,name:`GS1-128`,dimension:`1D`,data:`GS1 Application Identifier element strings`,length:`Up to 48 characters`,check:{label:`Mod-103 check character, plus mod-10 inside GTINs and SSCCs`,method:null},groups:[`parcels`,`pallets`,`gs1`],standard:`ISO/IEC 15417, GS1 General Specifications`,status:`active`,example:null,verified:true},{slug:`code-39`,name:`Code 39`,dimension:`1D`,data:`A–Z, 0–9 and - . space $ / + %`,length:`Variable`,check:{label:`Optional mod-43`,method:null},groups:[],standard:`ISO/IEC 16388`,status:`active`,example:null,verified:true},{slug:`interleaved-2-of-5`,name:`Interleaved 2 of 5`,dimension:`1D`,data:`Digits 0–9`,length:`Even number of digits`,check:{label:`Optional`,method:null},groups:[],standard:`ISO/IEC 16390`,status:`active`,example:null,verified:true},{slug:`code-93`,name:`Code 93`,dimension:`1D`,data:`A–Z, 0–9 and - . space $ / + %, plus shift pairs for the rest of ASCII`,length:`Variable`,check:{label:`Two check characters (C and K)`,method:null},groups:[],standard:null,status:`active`,example:null,verified:false},{slug:`codabar`,name:`Codabar`,dimension:`1D`,data:`Digits 0–9 and - $ : / . +`,length:`Variable`,check:{label:`None required`,method:null},groups:[],standard:null,status:`active`,example:null,verified:false},{slug:`code-11`,name:`Code 11`,dimension:`1D`,data:`Digits 0–9 and -`,length:`Variable`,check:{label:`One or two check characters`,method:null},groups:[],standard:null,status:`active`,example:null,verified:false},{slug:`msi-plessey`,name:`MSI Plessey`,dimension:`1D`,data:`Digits 0–9`,length:`Variable`,check:{label:`Mod-10 or mod-11, sometimes two`,method:null},groups:[],standard:null,status:`active`,example:null,verified:false},{slug:`industrial-2-of-5`,name:`Industrial 2 of 5`,dimension:`1D`,data:`Digits 0–9`,length:`Variable`,check:{label:`None required`,method:null},groups:[],standard:null,status:`active`,example:null,verified:false},{slug:`matrix-2-of-5`,name:`Matrix 2 of 5`,dimension:`1D`,data:`Digits 0–9`,length:`Variable`,check:{label:`None required`,method:null},groups:[],standard:null,status:`active`,example:null,verified:false},{slug:`qr-code`,name:`QR Code`,dimension:`2D`,data:`Any text or binary`,length:`Up to 7,089 digits or 2,953 bytes`,check:{label:`Reed–Solomon, levels L, M, Q and H`,method:null},groups:[`retail`,`tickets`,`gs1`],groupWhen:{retail:`with a GTIN`,gs1:`with GS1 data or a Digital Link`},standard:`ISO/IEC 18004`,status:`active`,example:null,verified:false},{slug:`datamatrix`,name:`Data Matrix`,dimension:`2D`,data:`Any text or binary`,length:`Up to 3,116 digits or 1,556 bytes`,check:{label:`Reed–Solomon, fixed by size`,method:null},groups:[`retail`,`tickets`,`gs1`],groupWhen:{retail:`with a GTIN`,gs1:`with GS1 data or a Digital Link`},standard:`ISO/IEC 16022`,status:`active`,example:null,verified:false},{slug:`pdf417`,name:`PDF417`,dimension:`2D (stacked)`,data:`Any text or binary`,length:`Up to about 2,710 digits or 1,108 bytes`,check:{label:`Reed–Solomon, levels 0 to 8`,method:null},groups:[`tickets`,`parcels`,`id`],groupWhen:{id:`with AAMVA data`},standard:`ISO/IEC 15438`,status:`active`,example:null,verified:false},{slug:`aztec`,name:`Aztec`,dimension:`2D`,data:`Any text or binary`,length:`Up to 3,832 digits or 1,914 bytes`,check:{label:`Reed–Solomon, 5% to 95%`,method:null},groups:[`tickets`],standard:`ISO/IEC 24778`,status:`active`,example:null,verified:false},{slug:`micro-qr`,name:`Micro QR Code`,dimension:`2D`,data:`Any text or binary`,length:`Up to 35 digits or 15 bytes`,check:{label:`Reed–Solomon, levels L, M and Q`,method:null},groups:[],standard:`ISO/IEC 18004`,status:`active`,example:null,verified:false},{slug:`micro-pdf417`,name:`MicroPDF417`,dimension:`2D (stacked)`,data:`Any text or binary`,length:null,check:{label:`Reed–Solomon, fixed by size`,method:null},groups:[],standard:`ISO/IEC 24728`,status:`active`,example:null,verified:false},{slug:`maxicode`,name:`MaxiCode`,dimension:`2D`,data:`Any text; structured carrier messages`,length:`About 93 characters, in a fixed 1-inch square`,check:{label:`Reed–Solomon, set by the mode`,method:null},groups:[`parcels`],standard:`ISO/IEC 16023`,status:`active`,example:null,verified:false},{slug:`han-xin`,name:`Han Xin`,dimension:`2D`,data:`Any text or binary, including Chinese characters`,length:`23×23 to 189×189 modules`,check:{label:`Reed–Solomon, four levels`,method:null},groups:[],standard:`ISO/IEC 20830`,status:`active`,example:null,verified:false},{slug:`grid-matrix`,name:`Grid Matrix`,dimension:`2D`,data:`Any text or binary, including Chinese characters`,length:`18×18 to 162×162 modules`,check:{label:`Five levels, 10% to 50%`,method:null},groups:[],standard:`AIMD014`,status:`active`,example:null,verified:false},{slug:`usps-intelligent-mail`,name:`USPS Intelligent Mail`,dimension:`4-state`,data:`Digits 0–9`,length:`A 20-digit tracking code and a routing code of 0, 5, 9 or 11 digits`,check:{label:`Built into the encoding`,method:null},groups:[`postal`],standard:`USPS-B-3200`,status:`active`,example:null,verified:false},{slug:`postnet`,name:`POSTNET`,dimension:`2-state (bar height)`,data:`Digits 0–9`,length:`5, 9 or 11 digits, plus a correction digit (32, 52 or 62 bars)`,check:{label:`Mod-10 correction digit`,method:null},groups:[`postal`],standard:`USPS Domestic Mail Manual (archived)`,status:`retired`,example:null,verified:false},{slug:`planet`,name:`PLANET`,dimension:`2-state (bar height)`,data:`Digits 0–9`,length:`12 or 14 digits, including a check digit`,check:{label:`Check digit`,method:null},groups:[`postal`],standard:`USPS Domestic Mail Manual (archived)`,status:`retired`,example:null,verified:false},{slug:`royal-mail-4-state`,name:`Royal Mail 4-State (RM4SCC)`,dimension:`4-state`,data:`A–Z, 0–9`,length:`A postcode and delivery point suffix`,check:{label:`Checksum character`,method:null},groups:[`postal`],standard:`Royal Mail`,status:`active`,example:null,verified:false},{slug:`mailmark`,name:`Royal Mail Mailmark`,dimension:`4-state and 2D`,data:`Uppercase letters, digits and space`,length:`22 or 26 characters (4-state); 51, 70 or 90 (2D)`,check:{label:`At least 25% error correction`,method:null},groups:[`postal`],standard:`Royal Mail Mailmark barcode definition`,status:`active`,example:null,verified:false},{slug:`australia-post`,name:`Australia Post 4-State`,dimension:`4-state`,data:`A delivery point identifier, plus optional customer information`,length:`37, 52 or 67 bars`,check:{label:`Reed–Solomon`,method:null},groups:[`postal`],standard:`Australia Post Customer Barcoding Technical Specifications`,status:`active`,example:null,verified:false},{slug:`japan-post`,name:`Japan Post`,dimension:`4-state`,data:`Digits, hyphens and letters`,length:`A 7-digit postal code and a 13-character address number`,check:{label:`Mod-19 check digit`,method:null},groups:[`postal`],standard:`Japan Post`,status:`active`,example:null,verified:false},{slug:`kix`,name:`KIX`,dimension:`4-state`,data:`A–Z, 0–9`,length:`A postcode, house number and optional addition`,check:{label:`None`,method:null},groups:[`postal`],standard:`PostNL`,status:`active`,example:null,verified:false},{slug:`korea-post`,name:`Korea Post`,dimension:`1D (bar position)`,data:`Digits 0–9`,length:`6 digits plus a check digit`,check:{label:`Modified mod-10 check digit`,method:null},groups:[`postal`],standard:null,status:`active`,example:null,verified:false},{slug:`china-post-2-of-5`,name:`China Post 2 of 5`,dimension:`1D`,data:`Digits 0–9`,length:null,check:null,groups:[`postal`],standard:null,status:`active`,example:null,verified:false},{slug:`mrz`,name:`MRZ (machine-readable zone)`,path:`/reference/documents/mrz`,dimension:`Printed text (OCR-B)`,data:`A–Z, 0–9 and \u003c`,length:`2 or 3 lines of 30, 36 or 44 characters`,check:{label:`Mod-10 with weights 7, 3, 1 on each field`,method:`mrz-td3`},groups:[`id`],standard:`ICAO Doc 9303`,status:`active`,example:`L898902C36UTO7408122F1204159ZE184226B\u003c\u003c\u003c\u003c\u003c10`,verified:false}];const READERS=[{key:`camera`,name:`Camera`,detail:null,reads:[`upc-a`,`upc-e`,`ean-13`,`ean-8`,`isbn`,`issn`,`gs1-databar`,`itf-14`,`interleaved-2-of-5`,`code-128`,`code-39`,`code-93`,`codabar`,`msi-plessey`,`qr-code`,`micro-qr`,`datamatrix`,`pdf417`,`micro-pdf417`,`aztec`,`mailmark`],unknown:[`gs1-128`,`mrz`],notes:{\"upc-a\":`as EAN-13 with a leading 0`,isbn:`as EAN-13`,issn:`as EAN-13, without add-ons`,mailmark:`the 2D form only, as Data Matrix`}},{key:`series-5`,name:`5 series`,detail:`barcodes`,reads:[],unknown:[`upc-a`,`upc-e`,`ean-13`,`ean-8`,`isbn`,`issn`,`gs1-databar`,`gs1-composite`,`itf-14`,`interleaved-2-of-5`,`code-128`,`gs1-128`,`code-39`,`code-93`,`codabar`,`code-11`,`msi-plessey`,`industrial-2-of-5`,`matrix-2-of-5`,`qr-code`,`micro-qr`,`datamatrix`,`pdf417`,`micro-pdf417`,`aztec`,`maxicode`,`han-xin`,`grid-matrix`,`usps-intelligent-mail`,`postnet`,`planet`,`royal-mail-4-state`,`mailmark`,`australia-post`,`japan-post`,`kix`,`korea-post`,`china-post-2-of-5`],notes:{}},{key:`series-7`,name:`7 series`,detail:`barcodes + printed text`,reads:[`upc-a`,`upc-e`,`ean-13`,`ean-8`,`isbn`,`issn`,`gs1-databar`,`gs1-composite`,`itf-14`,`interleaved-2-of-5`,`code-128`,`gs1-128`,`code-39`,`code-93`,`codabar`,`code-11`,`msi-plessey`,`industrial-2-of-5`,`matrix-2-of-5`,`qr-code`,`micro-qr`,`datamatrix`,`pdf417`,`micro-pdf417`,`aztec`,`maxicode`,`han-xin`,`grid-matrix`,`usps-intelligent-mail`,`postnet`,`planet`,`royal-mail-4-state`,`mailmark`,`australia-post`,`japan-post`,`kix`,`korea-post`,`china-post-2-of-5`,`mrz`],unknown:[],notes:{}}];const SHOW_HARDWARE=false;const SHOWN_READERS=SHOW_HARDWARE?READERS:READERS.filter(r=>r.key===`camera`);const findType=slug=>BARCODE_TYPES.find(t=>t.slug===slug);const findGroup=key=>BARCODE_GROUPS.find(g=>g.key===key);const href=t=>t.path||`/reference/barcode-types/${t.slug}`;const readerName=r=>r.detail?`${r.name} (${r.detail})`:r.name;const support=(r,slug)=>{if(r.reads.includes(slug))return{text:`Yes`,note:r.notes[slug]};if(r.unknown.includes(slug))return{text:`TBC`};return{text:`No`}};const SupportCell=({r,slug})=>{const{text,note}=support(r,slug);return _jsxs(`td`,{style:text===`TBC`?muted:undefined,children:[text,note\u0026\u0026_jsxs(`span`,{style:muted,children:[`, `,note]})]})};const muted={opacity:.6};const nums={fontVariantNumeric:`tabular-nums`};const Facts=({type})=>{const t=findType(type);if(!t)return null;const groups=!t.groups.length?_jsx(`span`,{style:muted,children:`None. Enable it on its own.`}):t.groups.map((key,i)=>{const g=findGroup(key);return _jsxs(`span`,{children:[i>0\u0026\u0026`, `,_jsx(_components.a,{href:`/reference/barcode-groups#${g.anchor}`,children:g.name}),t.groupWhen\u0026\u0026t.groupWhen[key]\u0026\u0026` (${t.groupWhen[key]})`]},key)});const rows=[[`Kind`,t.dimension],[`Encodes`,t.data],[`Length`,t.length],[`Check`,t.check\u0026\u0026t.check.label],[`Groups`,groups],[`Standard`,t.standard],[`Status`,t.status===`retired`?`Retired`:`In use`]];return _jsxs(`table`,{children:[_jsxs(`caption`,{className:`mint-sr-only`,children:[t.name,` at a glance`]}),_jsx(`tbody`,{children:rows.map(([label,value])=>_jsxs(`tr`,{children:[_jsx(`th`,{scope:`row`,className:`mint-font-medium`,children:label}),_jsx(`td`,{children:value==null?_jsx(`span`,{style:muted,children:`TBC`}):value})]},label))})]})};const SupportMatrix=({type,types})=>{if(type){const t=findType(type);if(!t)return null;return _jsxs(`table`,{children:[_jsx(`thead`,{children:_jsxs(`tr`,{children:[_jsx(`th`,{scope:`col`,children:`Reader`}),_jsxs(`th`,{scope:`col`,children:[`Reads `,t.name]})]})}),_jsx(`tbody`,{children:SHOWN_READERS.map(r=>_jsxs(`tr`,{children:[_jsx(`th`,{scope:`row`,className:`mint-font-medium`,children:readerName(r)}),_jsx(SupportCell,{r,slug:t.slug})]},r.key))})]})}const rows=types?types.split(`,`).map(x=>findType(x.trim())).filter(Boolean):BARCODE_TYPES;return _jsx(`div`,{className:`mint-overflow-x-auto`,children:_jsxs(`table`,{children:[_jsx(`thead`,{children:_jsxs(`tr`,{children:[_jsx(`th`,{scope:`col`,children:`Barcode type`}),SHOWN_READERS.map(r=>_jsx(`th`,{scope:`col`,children:readerName(r)},r.key))]})}),_jsx(`tbody`,{children:rows.map(t=>_jsxs(`tr`,{children:[_jsx(`th`,{scope:`row`,className:`mint-font-medium`,children:_jsx(_components.a,{href:href(t),children:t.name})}),SHOWN_READERS.map(r=>_jsx(SupportCell,{r,slug:t.slug},r.key))]},t.slug))})]})})};const SHAPES=[{name:`1D`,test:d=>d.startsWith(`1D`)},{name:`2D`,test:d=>d.startsWith(`2D`)},{name:`Bars of different heights`,test:d=>/state/.test(d)},{name:`Printed text`,test:d=>d.startsWith(`Printed text`)}];const shapeOf=t=>SHAPES.find(s=>s.test(t.dimension||``))||SHAPES[0];const GroupMatrix=()=>_jsx(`div`,{className:`mint-overflow-x-auto`,children:_jsxs(`table`,{children:[_jsx(`thead`,{children:_jsxs(`tr`,{children:[_jsx(`th`,{scope:`col`,children:`Barcode type`}),BARCODE_GROUPS.map(g=>_jsx(`th`,{scope:`col`,children:_jsx(_components.a,{href:`#${g.anchor}`,children:g.name})},g.key))]})}),SHAPES.map(shape=>_jsxs(`tbody`,{children:[_jsx(`tr`,{children:_jsx(`th`,{scope:`rowgroup`,colSpan:BARCODE_GROUPS.length+1,style:{fontWeight:600,paddingTop:`1.25em`},children:shape.name})}),BARCODE_TYPES.filter(t=>shapeOf(t)===shape).map(t=>_jsxs(`tr`,{children:[_jsx(`th`,{scope:`row`,className:`mint-font-medium`,children:_jsx(_components.a,{href:href(t),children:t.name})}),!t.groups.length\u0026\u0026_jsx(`td`,{colSpan:BARCODE_GROUPS.length,className:`mint-text-sm`,style:muted,children:`Not in any group`}),!!t.groups.length\u0026\u0026BARCODE_GROUPS.map(g=>_jsx(`td`,{className:`mint-text-center`,children:t.groups.includes(g.key)?_jsxs(_Fragment,{children:[_jsx(`span`,{\"aria-hidden\":`true`,children:`✓`}),_jsx(`span`,{className:`mint-sr-only`,children:`Yes`}),t.groupWhen\u0026\u0026t.groupWhen[g.key]\u0026\u0026_jsxs(`span`,{className:`mint-text-sm`,style:muted,children:[` `,t.groupWhen[g.key]]})]}):_jsx(`span`,{className:`mint-sr-only`,children:`No`})},g.key))]},t.slug))]},shape.name))]})});const CheckDigitSteps=({value})=>{const digits=String(value).split(``).map(Number);const data=digits.slice(0,-1);const given=digits[digits.length-1];const weights=data.map((_,i)=>(data.length-i)%2===1?3:1);const products=data.map((d,i)=>d*weights[i]);const sum=products.reduce((a,b)=>a+b,0);const next=Math.ceil(sum/10)*10;const check=next-sum;const row=(label,cells,strong)=>_jsxs(`tr`,{children:[_jsx(`th`,{scope:`row`,className:`mint-font-medium mint-whitespace-nowrap`,children:label}),cells.map((c,i)=>_jsx(`td`,{className:strong?`mint-text-center mint-font-semibold`:`mint-text-center`,style:nums,children:c},i))]});return _jsxs(`div`,{children:[_jsx(`div`,{className:`mint-overflow-x-auto`,children:_jsxs(`table`,{children:[_jsxs(`caption`,{className:`mint-sr-only`,children:[`Check digit calculation for `,value]}),_jsxs(`tbody`,{children:[row(`Digit`,data),row(`× Weight`,weights),row(`= Product`,products,true)]})]})}),_jsxs(`p`,{children:[`Sum of products: `,_jsx(`strong`,{style:nums,children:sum}),`. Round up to the next multiple of 10: `,_jsx(`strong`,{style:nums,children:next}),`. Check digit:`,` `,_jsxs(`span`,{style:nums,children:[next,` − `,sum,` = `]}),_jsx(`strong`,{style:nums,children:check}),check===given?`, which matches the last digit of ${value}.`:`, but ${value} ends in ${given}: this number is not valid.`]})]})};const EAN_L=[`0001101`,`0011001`,`0010011`,`0111101`,`0100011`,`0110001`,`0101111`,`0111011`,`0110111`,`0001011`];const EAN_R=EAN_L.map(p=>p.replace(/./g,c=>c===`0`?`1`:`0`));const EAN_G=EAN_R.map(p=>p.split(``).reverse().join(``));const EAN_PARITY=[`LLLLLL`,`LLGLGG`,`LLGGLG`,`LLGGGL`,`LGLLGG`,`LGGLLG`,`LGGGLL`,`LGLGLG`,`LGLGGL`,`LGGLGL`];const leftChar=k=>3+7*k+3.5;const rightChar=(k,halfWidth)=>3+halfWidth+5+7*k+3.5;const ANATOMY={\"ean-13\":{length:13,quiet:[11,7],encode:d=>{const parity=EAN_PARITY[d[0]];const left=d.slice(1,7).map((n,i)=>(parity[i]===`L`?EAN_L:EAN_G)[n]).join(``);const right=d.slice(7).map(n=>EAN_R[n]).join(``);return`101`+left+`01010`+right+`101`},hri:i=>i===0?-6:i\u003c=6?leftChar(i-1):rightChar(i-7,42),number:[[0,3,`GS1 prefix`,`Which national GS1 office issued the company prefix. Not the country the product was made in.`],[3,12,`Company prefix and item reference`,`The brand owner’s GS1 company prefix followed by its number for this item. Where one ends and the other begins depends on the prefix length, which you can’t tell from the digits alone.`],[12,13,`Check digit`,`Calculated from the other 12 digits with GS1 mod-10.`]],leftNote:`Six digits, each seven modules wide. Each digit is drawn in one of two patterns, and the combination of patterns encodes the first digit, which has no bars of its own.`},\"upc-a\":{length:12,quiet:[9,9],encode:d=>`101`+d.slice(0,6).map(n=>EAN_L[n]).join(``)+`01010`+d.slice(6).map(n=>EAN_R[n]).join(``)+`101`,hri:i=>i===0?-5:i\u003c=5?leftChar(i):i\u003c=10?rightChar(i-6,42):95+5,extended:[[3,10],[85,92]],number:[[0,11,`Company prefix and item reference`,`The brand owner’s GS1 company prefix followed by its number for this item.`],[11,12,`Check digit`,`Calculated from the other 11 digits with GS1 mod-10.`]],leftNote:`Six digits, each seven modules wide.`},\"ean-8\":{length:8,quiet:[7,7],encode:d=>`101`+d.slice(0,4).map(n=>EAN_L[n]).join(``)+`01010`+d.slice(4).map(n=>EAN_R[n]).join(``)+`101`,hri:i=>i\u003c=3?leftChar(i):rightChar(i-4,28),number:[[0,3,`GS1-8 prefix`,`Which national GS1 office issued the number.`],[3,7,`Item reference`,`Assigned by that GS1 office for this item.`],[7,8,`Check digit`,`Calculated from the other 7 digits with GS1 mod-10.`]],leftNote:`Four digits, each seven modules wide.`},\"upc-e\":{length:8,quiet:[9,7],encode:d=>{const forZero=[`GGGLLL`,`GGLGLL`,`GGLLGL`,`GGLLLG`,`GLGGLL`,`GLLGGL`,`GLLLGG`,`GLGLGL`,`GLGLLG`,`GLLGLG`][d[7]];const parity=d[0]===0?forZero:forZero.replace(/./g,c=>c===`G`?`L`:`G`);return`101`+d.slice(1,7).map((n,i)=>(parity[i]===`L`?EAN_L:EAN_G)[n]).join(``)+`010101`},hri:i=>i===0?-5:i\u003c=6?leftChar(i-1):51+4,guards:()=>[[0,3],[45,51]],structure:()=>[[`Start guard`,0,3,`Three modules (bar, space, bar) that tell the scanner where the symbol starts and how wide one module is.`],[`Six digits`,3,45,`Each digit is seven modules wide and drawn in one of two patterns. The combination of patterns encodes the number system and the check digit, which have no bars of their own.`],[`End guard`,45,51,`Six modules that mark the end of the symbol.`]],number:[[0,1,`Number system`,`Always 0 or 1.`],[1,7,`Zero-suppressed digits`,`The company prefix and item reference with their zeros removed. The last of the six says where the zeros go back.`],[7,8,`Check digit`,`The check digit of the full 12-digit UPC-A.`]]}};ANATOMY.isbn={...ANATOMY[`ean-13`],number:[[0,3,`Prefix`,`978 or 979, which mark the number as a book.`],[3,12,`Registration group, registrant and publication`,`The language area or country, the publisher, and the edition. Each part varies in length, which is what the hyphens in a printed ISBN show.`],[12,13,`Check digit`,`Calculated from the other 12 digits with GS1 mod-10.`]]};ANATOMY.issn={...ANATOMY[`ean-13`],number:[[0,3,`Prefix`,`977, which marks the number as a serial publication.`],[3,10,`ISSN`,`The first seven digits of the ISSN. Its own check digit is left out.`],[10,12,`Variant`,`Usually 00. Publishers change it for a special issue or a price change.`],[12,13,`Check digit`,`Calculated from the other 12 digits with GS1 mod-10.`]]};const Anatomy=({type,value,plain})=>{const spec=ANATOMY[type];const digits=String(value).split(``).map(Number);if(!spec||digits.length!==spec.length||digits.some(isNaN)){return _jsxs(`p`,{style:muted,children:[`Can’t draw `,type,` for “`,value,`”.`]})}const modules=spec.encode(digits);const n=modules.length;const half=(n-11)/2;const guards=spec.guards?spec.guards():[[0,3],[3+half,8+half],[n-3,n]];const tall=[...guards,...spec.extended||[]];const isTall=m=>tall.some(([a,b])=>m>=a\u0026\u0026m\u003cb);const M=4;const[qL,qR]=spec.quiet;const x=m=>(qL+m)*M;const width=(qL+n+qR)*M;const labelTop=plain?0:30,barTop=labelTop+6,barH=70,guardH=76,hriY=barTop+guardH+4,labelBottom=hriY+6;const bottomBracket=labelBottom+8,height=plain?labelBottom:bottomBracket+22;const bars=[];for(let m=0;m\u003cn;m++){if(modules[m]!==`1`)continue;let end=m;while(modules[end+1]===`1`)end++;bars.push(_jsx(`rect`,{x:x(m),y:barTop,width:(end-m+1)*M,height:isTall(m)?guardH:barH},m));m=end}const structure=spec.structure?spec.structure():[[`Start guard`,0,3,`Three modules (bar, space, bar) that tell the scanner where the symbol starts and how wide one module is.`],[`Left half`,3,3+half,spec.leftNote],[`Center guard`,3+half,8+half,`Five modules that separate the two halves. Scanners decode each half on its own, then join them.`],[`Right half`,8+half,n-3,`The remaining digits, each seven modules wide, always drawn from the same set of patterns.`],[`End guard`,n-3,n,`Three modules that mark the end of the symbol.`]];const numberSegs=spec.number.map(([a,b,name,meaning])=>[name,spec.hri(a)-3.5,spec.hri(b-1)+3.5,meaning]);const legend=[...structure,...numberSegs];const bracket=(key,x1,x2,y,up)=>{const t=up?y-4:y+4;return _jsx(`path`,{d:`M${x1+1} ${t} V${y} H${x2-1} V${t}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`},key)};const marker=(key,label,cx,y)=>_jsx(`text`,{x:cx,y,textAnchor:`middle`,fontSize:`10`,fontWeight:`600`,fill:`currentColor`,children:label},key);const label=_jsxs(_Fragment,{children:[_jsx(`rect`,{x:`0`,y:labelTop,width,height:labelBottom-labelTop,fill:`#ffffff`,rx:plain?0:4}),_jsxs(`g`,{fill:`#111214`,children:[bars,digits.map((d,i)=>_jsx(`text`,{x:x(spec.hri(i)),y:hriY,textAnchor:`middle`,fontSize:`13`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,children:d},i))]})]});if(plain){return _jsx(`figure`,{className:`not-prose mint-my-6`,children:_jsx(`svg`,{viewBox:`0 0 ${width} ${height}`,role:`img`,\"aria-label\":`${type.toUpperCase()} barcode for ${value}`,style:{width:`100%`,maxWidth:360,height:`auto`},children:label})})}return _jsxs(`figure`,{className:`not-prose mint-my-6`,children:[_jsxs(`svg`,{viewBox:`0 0 ${width} ${height}`,role:`img`,\"aria-labelledby\":`anatomy-${type}-title`,style:{width:`100%`,height:`auto`},children:[_jsx(`title`,{id:`anatomy-${type}-title`,children:`Annotated ${type.toUpperCase()} barcode for ${value}`}),structure.map(([,a,b],i)=>_jsxs(`g`,{children:[bracket(`sb${i}`,x(a),x(b),22,false),marker(`sm${i}`,i+1,(x(a)+x(b))/2,16)]},`s${i}`)),label,numberSegs.map(([,a,b],i)=>_jsxs(`g`,{children:[bracket(`nb${i}`,x(a),x(b),bottomBracket,true),marker(`nm${i}`,structure.length+i+1,(x(a)+x(b))/2,bottomBracket+14)]},`n${i}`))]}),_jsx(`figcaption`,{className:`mint-mt-4`,children:_jsx(`ol`,{className:`mint-list-decimal mint-pl-5 mint-text-sm`,children:legend.map(([name,,,meaning])=>_jsxs(`li`,{children:[_jsxs(`strong`,{children:[name,`.`]}),` `,meaning]},name))})})]})};const C128=[[2,1,2,2,2,2],[2,2,2,1,2,2],[2,2,2,2,2,1],[1,2,1,2,2,3],[1,2,1,3,2,2],[1,3,1,2,2,2],[1,2,2,2,1,3],[1,2,2,3,1,2],[1,3,2,2,1,2],[2,2,1,2,1,3],[2,2,1,3,1,2],[2,3,1,2,1,2],[1,1,2,2,3,2],[1,2,2,1,3,2],[1,2,2,2,3,1],[1,1,3,2,2,2],[1,2,3,1,2,2],[1,2,3,2,2,1],[2,2,3,2,1,1],[2,2,1,1,3,2],[2,2,1,2,3,1],[2,1,3,2,1,2],[2,2,3,1,1,2],[3,1,2,1,3,1],[3,1,1,2,2,2],[3,2,1,1,2,2],[3,2,1,2,2,1],[3,1,2,2,1,2],[3,2,2,1,1,2],[3,2,2,2,1,1],[2,1,2,1,2,3],[2,1,2,3,2,1],[2,3,2,1,2,1],[1,1,1,3,2,3],[1,3,1,1,2,3],[1,3,1,3,2,1],[1,1,2,3,1,3],[1,3,2,1,1,3],[1,3,2,3,1,1],[2,1,1,3,1,3],[2,3,1,1,1,3],[2,3,1,3,1,1],[1,1,2,1,3,3],[1,1,2,3,3,1],[1,3,2,1,3,1],[1,1,3,1,2,3],[1,1,3,3,2,1],[1,3,3,1,2,1],[3,1,3,1,2,1],[2,1,1,3,3,1],[2,3,1,1,3,1],[2,1,3,1,1,3],[2,1,3,3,1,1],[2,1,3,1,3,1],[3,1,1,1,2,3],[3,1,1,3,2,1],[3,3,1,1,2,1],[3,1,2,1,1,3],[3,1,2,3,1,1],[3,3,2,1,1,1],[3,1,4,1,1,1],[2,2,1,4,1,1],[4,3,1,1,1,1],[1,1,1,2,2,4],[1,1,1,4,2,2],[1,2,1,1,2,4],[1,2,1,4,2,1],[1,4,1,1,2,2],[1,4,1,2,2,1],[1,1,2,2,1,4],[1,1,2,4,1,2],[1,2,2,1,1,4],[1,2,2,4,1,1],[1,4,2,1,1,2],[1,4,2,2,1,1],[2,4,1,2,1,1],[2,2,1,1,1,4],[4,1,3,1,1,1],[2,4,1,1,1,2],[1,3,4,1,1,1],[1,1,1,2,4,2],[1,2,1,1,4,2],[1,2,1,2,4,1],[1,1,4,2,1,2],[1,2,4,1,1,2],[1,2,4,2,1,1],[4,1,1,2,1,2],[4,2,1,1,1,2],[4,2,1,2,1,1],[2,1,2,1,4,1],[2,1,4,1,2,1],[4,1,2,1,2,1],[1,1,1,1,4,3],[1,1,1,3,4,1],[1,3,1,1,4,1],[1,1,4,1,1,3],[1,1,4,3,1,1],[4,1,1,1,1,3],[4,1,1,3,1,1],[1,1,3,1,4,1],[1,1,4,1,3,1],[3,1,1,1,4,1],[4,1,1,1,3,1],[2,1,1,4,1,2],[2,1,1,2,1,4],[2,1,1,2,3,2],[2,3,3,1,1,1,2]];const C39_CHARS=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%`;const C39=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42];const C39_STAR=148;const I25=[`NNWWN`,`WNNNW`,`NWNNW`,`WWNNN`,`NNWNW`,`WNWNN`,`NWWNN`,`NNNWW`,`WNNWN`,`NWNWN`];const C93=[276,328,324,322,296,292,290,336,274,266,424,420,418,404,402,394,360,356,354,308,282,344,332,326,300,278,436,434,428,422,406,410,364,358,310,314,302,468,466,458,366,374,430,294,474,470,306,350];const code93=text=>{const values=[...text].map(c=>C39_CHARS.indexOf(c));const weighted=(vs,max)=>vs.reduceRight((acc,v,i)=>acc+v*((vs.length-1-i)%max+1),0)%47;const c=weighted(values,20);const k=weighted([...values,c],15);const modules=[47,...values,c,k,47].map(v=>C93[v].toString(2).padStart(9,`0`)).join(``)+`1`;const widths=[];for(let i=0;i\u003cmodules.length;){let j=i;while(modules[j]===modules[i])j++;widths.push(j-i);i=j}const n=values.length;const name=v=>C39_CHARS[v]||`value ${v}`;return{widths,hri:text,segments:[[`Start character`,0,9,`Marks the start. Scanners don’t send it.`],[`Data`,9,9*(n+1),`Each character is 9 modules: three bars and three spaces, each 1 to 4 modules wide.`],[`Check character C`,9*(n+1),9*(n+2),`Mod-47 over the data, with weights 1 to 20. Here, ${name(c)}.`],[`Check character K`,9*(n+2),9*(n+3),`Mod-47 over the data and C, with weights 1 to 15. Here, ${name(k)}.`],[`Stop`,9*(n+3),9*(n+4)+1,`The stop character, then a single-module bar that ends the symbol.`]]}};const code39=text=>{const chars=[...text];const check=C39_CHARS[chars.reduce((sum,c)=>sum+C39_CHARS.indexOf(c),0)%43];const element=bits=>Array.from({length:9},(_,i)=>bits>>8-i\u00261?3:1);const parts=[C39_STAR,...chars.map(c=>C39[C39_CHARS.indexOf(c)]),C39[C39_CHARS.indexOf(check)],C39_STAR];const widths=[];parts.forEach((bits,i)=>{widths.push(...element(bits));if(i\u003cparts.length-1)widths.push(1)});const char=16;const n=parts.length;return{widths,hri:text+check,segments:[[`Start character`,0,15,`An asterisk. It marks the start, and scanners don’t send it.`],[`Data`,char,char*(n-2)-1,`Each character is nine elements, five bars and four spaces, three of them wide. A narrow gap separates characters.`],[`Check character`,char*(n-2),char*(n-1)-1,`Optional. The mod-43 check for this data is ${check}.`],[`Stop character`,char*(n-1),char*n-1,`Another asterisk, which marks the end.`]]}};const code128Values=(text,gs1)=>{const digitsAt=i=>{let n=0;while(/\\d/.test(text[i+n]||``))n++;return n};let set=digitsAt(0)>=4?`C`:`B`;const values=[set===`C`?105:104];if(gs1)values.push(102);for(let i=0;i\u003ctext.length;){if(text[i]===`\u001d`){values.push(102);i+=1;continue}if(set===`C`){if(digitsAt(i)>=2){values.push(Number(text.slice(i,i+2)));i+=2}else{values.push(100);set=`B`}}else if(digitsAt(i)>=4\u0026\u0026digitsAt(i)%2===0){values.push(99);set=`C`}else{values.push(text.charCodeAt(i)-32);i+=1}}return values};const code128=(text,gs1)=>{const data=gs1?gs1Text(text):text;const values=code128Values(data,gs1);const check=values.reduce((sum,v,i)=>sum+v*(i||1),0)%103;const widths=[...values,check,106].flatMap(v=>C128[v]);const head=gs1?22:11;const end=values.length*11;const startSet=values[0]===105?`C`:`B`;const startNote=startSet===`C`?`The first characters are digits, packed two to a character.`:`The first characters are text. The start code also counts toward the check.`;return{widths,hri:text,segments:[[`Start code ${startSet}`,0,11,startNote],...gs1?[[`FNC1`,11,22,`A special character that marks the barcode as GS1-128. Scanners don’t send it as data.`]]:[],[`Data`,head,end,gs1?`Each character is 11 modules: three bars and three spaces. Digits are packed two to a character in code set C, then a switch to code set B handles the letters.`:`Each character is 11 modules: three bars and three spaces, each 1 to 4 modules wide.`],[`Check character`,end,end+11,`Mod-103 check, value ${check}. Scanners verify it, then drop it.`],[`Stop`,end+11,end+24,`Thirteen modules, ending in a final bar.`]]}};const itf=(digits,wide=2.5)=>{const widths=[1,1,1,1];for(let i=0;i\u003cdigits.length;i+=2){const bars=I25[digits[i]],spaces=I25[digits[i+1]];for(let k=0;k\u003c5;k++)widths.push(bars[k]===`W`?wide:1,spaces[k]===`W`?wide:1)}widths.push(wide,1,1);const pair=2*(3+2*wide);const end=4+pair*(digits.length/2);return{widths,hri:digits,segments:[[`Start`,0,4,`Four narrow elements: bar, space, bar, space.`],[`Digit pairs`,4,end,`Each pair of digits shares five bars and five spaces. The first digit sets which bars are wide, the second which spaces are wide.`],[`Stop`,end,end+wide+2,`A wide bar, a narrow space and a narrow bar.`]]}};const GS1_AI_NAMES={\"00\":[`SSCC`,`The serial shipping container code: an 18-digit number for one pallet or parcel.`],\"01\":[`GTIN`,`The product’s 14-digit GTIN.`],10:[`Batch or lot`,`Up to 20 characters. Variable length, so it comes last or is followed by a separator.`],11:[`Production date`,`YYMMDD.`],15:[`Best before date`,`YYMMDD.`],17:[`Expiry date`,`YYMMDD.`],21:[`Serial number`,`Up to 20 characters.`],37:[`Count`,`How many trade items the unit contains.`]};const LINEAR={\"code-39\":{quiet:10,encode:v=>code39(v)},\"code-93\":{quiet:10,encode:v=>code93(v)},\"code-128\":{quiet:10,encode:v=>code128(v,false)},\"gs1-128\":{quiet:10,encode:v=>code128(v,true),numbers:hri=>[...hri.matchAll(/\\((\\d{2,4})\\)[^(]*/g)].map(m=>{const[name,meaning]=GS1_AI_NAMES[m[1]]||[`AI ${m[1]}`,``];return[m.index,m.index+m[0].length,`(${m[1]}) ${name}`,meaning]})},\"interleaved-2-of-5\":{quiet:10,encode:v=>itf(v)},\"itf-14\":{quiet:10,bearer:true,encode:v=>itf(v),numbers:()=>[[0,1,`Indicator digit`,`The packaging level. 1 to 8 mean a case or other grouping of the same item.`],[1,13,`Item number`,`Often the first 12 digits of the item’s own GTIN-13, but not always.`],[13,14,`Check digit`,`GS1 mod-10, calculated over all 14 digits.`]]}};const Linear=({type,value,plain})=>{const spec=LINEAR[type];if(!spec||!value)return _jsxs(`p`,{style:muted,children:[`Can’t draw `,type,` for “`,value,`”.`]});const{widths,hri,segments}=spec.encode(String(value));const numbers=spec.numbers?spec.numbers(hri):[];const total=widths.reduce((a,b)=>a+b,0);const q=spec.quiet;const M=Math.max(2,Math.min(4,520/(total+2*q)));const x=m=>(q+m)*M;const width=(total+2*q)*M;const bearer=spec.bearer?6:0;const labelTop=plain?0:30,barTop=labelTop+6+bearer,barH=70;const hriY=barTop+barH+bearer+16,labelBottom=hriY+6;const bottomBracket=labelBottom+8,height=plain?labelBottom:bottomBracket+22;const slot=total/hri.length;const charX=i=>x((i+.5)*slot);const bars=[];let pos=0;widths.forEach((w,i)=>{if(i%2===0)bars.push(_jsx(`rect`,{x:x(pos),y:barTop,width:w*M,height:barH},i));pos+=w});const label=_jsxs(_Fragment,{children:[_jsx(`rect`,{x:`0`,y:labelTop,width,height:labelBottom-labelTop,fill:`#ffffff`,rx:plain?0:4}),_jsxs(`g`,{fill:`#111214`,children:[spec.bearer\u0026\u0026_jsx(`rect`,{x:x(-q/2),y:barTop-bearer,width:(total+q)*M,height:bearer-1}),spec.bearer\u0026\u0026_jsx(`rect`,{x:x(-q/2),y:barTop+barH+1,width:(total+q)*M,height:bearer-1}),bars,[...hri].map((c,i)=>_jsx(`text`,{x:charX(i),y:hriY,textAnchor:`middle`,fontSize:`12`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,children:c},i))]})]});const name=(findType(type)||{name:type}).name;if(plain){return _jsx(`figure`,{className:`not-prose mint-my-6`,children:_jsx(`svg`,{viewBox:`0 0 ${width} ${height}`,role:`img`,\"aria-label\":`${name} barcode for ${hri}`,style:{width:`100%`,maxWidth:480,height:`auto`},children:label})})}const bracket=(key,x1,x2,y,up)=>{const t=up?y-4:y+4;return _jsx(`path`,{d:`M${x1+1} ${t} V${y} H${x2-1} V${t}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`},key)};const marker=(key,n,cx,y)=>_jsx(`text`,{x:cx,y,textAnchor:`middle`,fontSize:`10`,fontWeight:`600`,fill:`currentColor`,children:n},key);const numberSegs=numbers.map(([a,b,title,meaning])=>[title,charX(a)-slot*M/2,charX(b-1)+slot*M/2,meaning]);return _jsxs(`figure`,{className:`not-prose mint-my-6`,children:[_jsxs(`svg`,{viewBox:`0 0 ${width} ${height}`,role:`img`,\"aria-labelledby\":`anatomy-${type}-title`,style:{width:`100%`,height:`auto`},children:[_jsx(`title`,{id:`anatomy-${type}-title`,children:`Annotated ${name} barcode for ${hri}`}),segments.map(([,a,b],i)=>_jsxs(`g`,{children:[bracket(`sb${i}`,x(a),x(b),22,false),marker(`sm${i}`,i+1,(x(a)+x(b))/2,16)]},`s${i}`)),label,numberSegs.map(([,a,b],i)=>_jsxs(`g`,{children:[bracket(`nb${i}`,a,b,bottomBracket,true),marker(`nm${i}`,segments.length+i+1,(a+b)/2,bottomBracket+14)]},`n${i}`))]}),_jsx(`figcaption`,{className:`mint-mt-4`,children:_jsx(`ol`,{className:`mint-list-decimal mint-pl-5 mint-text-sm`,children:[...segments,...numberSegs].map(([title,,,meaning])=>_jsxs(`li`,{children:[_jsxs(`strong`,{children:[title,`.`]}),` `,meaning]},title))})})]})};const gf=poly=>{const exp=new Array(512),log=new Array(256);let x=1;for(let i=0;i\u003c255;i++){exp[i]=x;log[x]=i;x\u003c\u003c=1;if(x\u0026256)x^=poly}for(let i=255;i\u003c512;i++)exp[i]=exp[i-255];const mul=(a,b)=>a\u0026\u0026b?exp[log[a]+log[b]]:0;const generator=(n,first)=>{let g=[1];for(let i=0;i\u003cn;i++){const next=new Array(g.length+1).fill(0);g.forEach((c,j)=>{next[j]^=c;next[j+1]^=mul(c,exp[first+i])});g=next}return g.slice(1)};const remainder=(data,n,first)=>{const g=generator(n,first);const rem=new Array(n).fill(0);for(const d of data){const factor=d^rem.shift();rem.push(0);g.forEach((c,j)=>{rem[j]^=mul(c,factor)})}return rem};return{remainder}};const QR_EC_PER_BLOCK={L:[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],M:[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],Q:[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],H:[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]};const QR_BLOCKS={L:[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],M:[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],Q:[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],H:[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]};const QR_FORMAT_EC={L:1,M:0,Q:3,H:2};const qrRawModules=v=>{let r=(16*v+128)*v+64;if(v>=2){const n=Math.floor(v/7)+2;r-=(25*n-10)*n-55;if(v>=7)r-=36}return r};const qrDataCodewords=(v,ec)=>Math.floor(qrRawModules(v)/8)-QR_EC_PER_BLOCK[ec][v]*QR_BLOCKS[ec][v];const qrAlignment=v=>{if(v===1)return[];const n=Math.floor(v/7)+2,size=v*4+17;const step=v===32?26:Math.ceil((v*4+4)/(n*2-2))*2;const out=[6];for(let pos=size-7;out.length\u003cn;pos-=step)out.splice(1,0,pos);return out};const qrMask=[(x,y)=>(x+y)%2===0,(x,y)=>y%2===0,x=>x%3===0,(x,y)=>(x+y)%3===0,(x,y)=>(Math.floor(x/3)+Math.floor(y/2))%2===0,(x,y)=>x*y%2+x*y%3===0,(x,y)=>(x*y%2+x*y%3)%2===0,(x,y)=>((x+y)%2+x*y%3)%2===0];const qrPenalty=m=>{const n=m.length;let p=0;const lines=[];for(let i=0;i\u003cn;i++){lines.push(m[i]);lines.push(m.map(row=>row[i]))}for(const line of lines){for(let i=0;i\u003cn;){let j=i;while(j\u003cn\u0026\u0026line[j]===line[i])j++;if(j-i>=5)p+=3+(j-i-5);i=j}const s=line.map(b=>b?1:0).join(``);for(const pat of[`10111010000`,`00001011101`])for(let i=s.indexOf(pat);i!==-1;i=s.indexOf(pat,i+1))p+=40}for(let y=0;y\u003cn-1;y++)for(let x=0;x\u003cn-1;x++){const c=m[y][x];if(c===m[y][x+1]\u0026\u0026c===m[y+1][x]\u0026\u0026c===m[y+1][x+1])p+=3}const dark=m.flat().filter(Boolean).length;p+=Math.floor(Math.abs(dark*20-n*n*10)/(n*n))*10;return p};const encodeQR=(text,ec=`M`)=>{const bytes=[...new TextEncoder().encode(text)];let v=1;const bitsNeeded=ver=>4+(ver\u003c10?8:16)+bytes.length*8;while(v\u003c=40\u0026\u0026bitsNeeded(v)>qrDataCodewords(v,ec)*8)v++;if(v>40)throw new Error(`Too much data for a QR Code`);const capacity=qrDataCodewords(v,ec);const bits=[];const put=(val,len)=>{for(let i=len-1;i>=0;i--)bits.push(val>>i\u00261)};put(4,4);put(bytes.length,v\u003c10?8:16);bytes.forEach(b=>put(b,8));put(0,Math.min(4,capacity*8-bits.length));while(bits.length%8)bits.push(0);const data=[];for(let i=0;i\u003cbits.length;i+=8)data.push(parseInt(bits.slice(i,i+8).join(``),2));for(let pad=236;data.length\u003ccapacity;pad^=236^17)data.push(pad);const rs=gf(285);const numBlocks=QR_BLOCKS[ec][v],ecLen=QR_EC_PER_BLOCK[ec][v];const raw=Math.floor(qrRawModules(v)/8);const shortBlocks=numBlocks-raw%numBlocks,shortLen=Math.floor(raw/numBlocks);const blocks=[];for(let i=0,k=0;i\u003cnumBlocks;i++){const len=shortLen-ecLen+(i\u003cshortBlocks?0:1);const d=data.slice(k,k+len);k+=len;blocks.push({d,e:rs.remainder(d,ecLen,0)})}const codewords=[];for(let i=0;i\u003c=shortLen-ecLen;i++)blocks.forEach(b=>{if(i\u003cb.d.length)codewords.push(b.d[i])});for(let i=0;i\u003cecLen;i++)blocks.forEach(b=>codewords.push(b.e[i]));const size=v*4+17;const m=Array.from({length:size},()=>new Array(size).fill(false));const role=Array.from({length:size},()=>new Array(size).fill(null));const set=(x,y,dark,r)=>{m[y][x]=dark;role[y][x]=r};for(let i=0;i\u003csize;i++){set(6,i,i%2===0,`timing`);set(i,6,i%2===0,`timing`)}for(const[cx,cy]of[[3,3],[size-4,3],[3,size-4]]){for(let dy=-4;dy\u003c=4;dy++)for(let dx=-4;dx\u003c=4;dx++){const x=cx+dx,y=cy+dy;if(x\u003c0||y\u003c0||x>=size||y>=size)continue;const d=Math.max(Math.abs(dx),Math.abs(dy));set(x,y,d!==2\u0026\u0026d!==4,d===4?`separator`:`finder`)}}const align=qrAlignment(v);align.forEach((ax,i)=>align.forEach((ay,j)=>{if(i===0\u0026\u0026j===0||i===0\u0026\u0026j===align.length-1||i===align.length-1\u0026\u0026j===0)return;for(let dy=-2;dy\u003c=2;dy++)for(let dx=-2;dx\u003c=2;dx++)set(ax+dx,ay+dy,Math.max(Math.abs(dx),Math.abs(dy))!==1,`alignment`)}));const formatCells=[];for(let i=0;i\u003c9;i++){if(i!==6){formatCells.push([8,i],[i,8])}}for(let i=0;i\u003c8;i++)formatCells.push([size-1-i,8],[8,size-1-i]);formatCells.forEach(([x,y])=>set(x,y,false,`format`));set(8,size-8,true,`format`);if(v>=7){let rem=v;for(let i=0;i\u003c12;i++)rem=rem\u003c\u003c1^(rem>>11)*7973;const vb=v\u003c\u003c12|rem;for(let i=0;i\u003c18;i++){const bit=(vb>>i\u00261)===1,a=size-11+i%3,b=Math.floor(i/3);set(a,b,bit,`version`);set(b,a,bit,`version`)}}let i=0;for(let right=size-1;right>=1;right-=2){if(right===6)right=5;for(let vert=0;vert\u003csize;vert++)for(let j=0;j\u003c2;j++){const x=right-j,upward=(right+1\u00262)===0,y=upward?size-1-vert:vert;if(role[y][x])continue;role[y][x]=i\u003ccodewords.length*8?`data`:`remainder`;m[y][x]=i\u003ccodewords.length*8?(codewords[i>>3]>>7-(i\u00267)\u00261)===1:false;i++}}const formatBits=mask=>{const d=QR_FORMAT_EC[ec]\u003c\u003c3|mask;let rem=d;for(let k=0;k\u003c10;k++)rem=rem\u003c\u003c1^(rem>>9)*1335;return(d\u003c\u003c10|rem)^21522};const apply=mask=>{const out=m.map((row,y)=>row.map((dark,x)=>(role[y][x]===`data`||role[y][x]===`remainder`)\u0026\u0026qrMask[mask](x,y)?!dark:dark));const fb=formatBits(mask),bit=k=>(fb>>k\u00261)===1;for(let k=0;k\u003c=5;k++)out[k][8]=bit(k);out[7][8]=bit(6);out[8][8]=bit(7);out[8][7]=bit(8);for(let k=9;k\u003c15;k++)out[8][14-k]=bit(k);for(let k=0;k\u003c8;k++)out[8][size-1-k]=bit(k);for(let k=8;k\u003c15;k++)out[size-15+k][8]=bit(k);out[size-8][8]=true;return out};let best=null;for(let mask=0;mask\u003c8;mask++){const candidate=apply(mask),p=qrPenalty(candidate);if(!best||p\u003cbest.p)best={p,mask,grid:candidate}}return{grid:best.grid,role,size,version:v,ec,mask:best.mask,quiet:4,dataCodewords:capacity,ecCodewords:ecLen*numBlocks}};const DM_SIZES=[[10,8,3,5],[12,10,5,7],[14,12,8,10],[16,14,12,12],[18,16,18,14],[20,18,22,18],[22,20,30,20],[24,22,36,24],[26,24,44,28],[32,14,62,36],[36,16,86,42],[40,18,114,48],[44,20,144,56],[48,22,174,68]];const dmPlacement=(nrow,ncol)=>{const a=new Array(nrow*ncol).fill(0);const module=(row,col,chr,bit)=>{if(row\u003c0){row+=nrow;col+=4-(nrow+4)%8}if(col\u003c0){col+=ncol;row+=4-(ncol+4)%8}a[row*ncol+col]=10*chr+bit};const utah=(row,col,chr)=>{module(row-2,col-2,chr,1);module(row-2,col-1,chr,2);module(row-1,col-2,chr,3);module(row-1,col-1,chr,4);module(row-1,col,chr,5);module(row,col-2,chr,6);module(row,col-1,chr,7);module(row,col,chr,8)};const corner=(chr,cells)=>cells.forEach(([r,c],k)=>module(r,c,chr,k+1));let chr=1,row=4,col=0;do{if(row===nrow\u0026\u0026col===0)corner(chr++,[[nrow-1,0],[nrow-1,1],[nrow-1,2],[0,ncol-2],[0,ncol-1],[1,ncol-1],[2,ncol-1],[3,ncol-1]]);if(row===nrow-2\u0026\u0026col===0\u0026\u0026ncol%4)corner(chr++,[[nrow-3,0],[nrow-2,0],[nrow-1,0],[0,ncol-4],[0,ncol-3],[0,ncol-2],[0,ncol-1],[1,ncol-1]]);if(row===nrow-2\u0026\u0026col===0\u0026\u0026ncol%8===4)corner(chr++,[[nrow-3,0],[nrow-2,0],[nrow-1,0],[0,ncol-2],[0,ncol-1],[1,ncol-1],[2,ncol-1],[3,ncol-1]]);if(row===nrow+4\u0026\u0026col===2\u0026\u0026!(ncol%8))corner(chr++,[[nrow-1,0],[nrow-1,ncol-1],[0,ncol-3],[0,ncol-2],[0,ncol-1],[1,ncol-3],[1,ncol-2],[1,ncol-1]]);do{if(row\u003cnrow\u0026\u0026col>=0\u0026\u0026!a[row*ncol+col])utah(row,col,chr++);row-=2;col+=2}while(row>=0\u0026\u0026col\u003cncol);row+=1;col+=3;do{if(row>=0\u0026\u0026col\u003cncol\u0026\u0026!a[row*ncol+col])utah(row,col,chr++);row+=2;col-=2}while(row\u003cnrow\u0026\u0026col>=0);row+=3;col+=1}while(row\u003cnrow||col\u003cncol);if(!a[nrow*ncol-1]){a[nrow*ncol-1]=1;a[nrow*ncol-ncol-2]=1}return a};const encodeDataMatrix=(text,gs1=false)=>{const cw=gs1?[232]:[];for(let i=0;i\u003ctext.length;){const c=text.charCodeAt(i);if(/\\d\\d/.test(text.slice(i,i+2))){cw.push(130+Number(text.slice(i,i+2)));i+=2}else if(c===29\u0026\u0026gs1){cw.push(232);i+=1}else if(c\u003c128){cw.push(c+1);i+=1}else{cw.push(235,c-128+1);i+=1}}const spec=DM_SIZES.find(([,,d])=>d>=cw.length);if(!spec)throw new Error(`Too much data for this Data Matrix encoder`);const[size,region,dataLen,ecLen]=spec;const data=[...cw];if(data.length\u003cdataLen)data.push(129);while(data.length\u003cdataLen){let pad=129+149*(data.length+1)%253+1;if(pad>254)pad-=254;data.push(pad)}const codewords=[...data,...gf(301).remainder(data,ecLen,1)];const per=size/(region+2);const n=region*per;const place=dmPlacement(n,n);const grid=Array.from({length:size},()=>new Array(size).fill(false));const role=Array.from({length:size},()=>new Array(size).fill(null));for(let by=0;by\u003cper;by++)for(let bx=0;bx\u003cper;bx++){const y0=by*(region+2),x0=bx*(region+2);for(let k=0;k\u003cregion+2;k++){grid[y0+region+1][x0+k]=true;role[y0+region+1][x0+k]=`finder`;grid[y0+k][x0]=true;role[y0+k][x0]=`finder`}for(let k=0;k\u003cregion+2;k++){if(!role[y0][x0+k]){grid[y0][x0+k]=k%2===0;role[y0][x0+k]=`timing`}if(!role[y0+k][x0+region+1]){grid[y0+k][x0+region+1]=k%2===1;role[y0+k][x0+region+1]=`timing`}}}for(let r=0;r\u003cn;r++)for(let c=0;c\u003cn;c++){const y=Math.floor(r/region)*(region+2)+1+r%region;const x=Math.floor(c/region)*(region+2)+1+c%region;const v=place[r*n+c];const chr=Math.floor(v/10),bit=v%10;grid[y][x]=v===1?true:chr>0?(codewords[chr-1]>>8-bit\u00261)===1:false;role[y][x]=chr>dataLen?`ec`:`data`}return{grid,role,size,quiet:1,dataCodewords:dataLen,ecCodewords:ecLen,used:cw.length}};const GS1_FIXED=/^(0[0-3]|1[1-35-7]|20|3[1-6]\\d\\d|41[0-7])$/;const gs1Text=hri=>{const fields=[...hri.matchAll(/\\((\\d{2,4})\\)([^(]*)/g)];return fields.map(([,ai,v],i)=>ai+v+(i\u003cfields.length-1\u0026\u0026!GS1_FIXED.test(ai)?`\u001d`:``)).join(``)};const MATRIX_ROLES={\"qr-code\":[[`finder`,`rgba(37, 99, 235, 0.45)`,`Finder patterns`,`Three squares that let a scanner find the symbol and work out its size and angle, from any direction.`],[`separator`,null,null,null],[`timing`,`rgba(234, 88, 12, 0.55)`,`Timing patterns`,`Alternating dark and light modules between the finder patterns, which set the module grid.`],[`alignment`,`rgba(147, 51, 234, 0.5)`,`Alignment patterns`,`Smaller squares that help correct for a curved or skewed surface. Larger versions have more of them.`],[`format`,`rgba(22, 163, 74, 0.55)`,`Format information`,`The error correction level and the mask, stored twice so one copy can be damaged.`],[`version`,`rgba(219, 39, 119, 0.5)`,`Version information`,`The symbol’s size, stored twice. Only versions 7 and up have it.`],[`data`,null,`Data and error correction`,`Everything unshaded. Codewords run in two-module columns, zigzagging up and down from the bottom right.`]],datamatrix:[[`finder`,`rgba(37, 99, 235, 0.45)`,`Finder pattern`,`A solid L along the left and bottom edges, which shows a scanner where the symbol is and which way up it is.`],[`timing`,`rgba(234, 88, 12, 0.55)`,`Clock track`,`Alternating modules along the top and right edges, which set the module grid. Larger sizes repeat both inside the symbol.`],[`data`,null,`Data`,`Unshaded. The encoded data, eight modules to a codeword.`],[`ec`,`rgba(22, 163, 74, 0.4)`,`Error correction`,`Reed–Solomon codewords that let a scanner rebuild damaged data.`]]};const Matrix2D=({type,value,ec,plain,damage})=>{const sym=type===`qr-code`?encodeQR(String(value),ec||`M`):encodeDataMatrix(gs1Text(String(value))||String(value),String(value).startsWith(`(`));const{grid,role,size}=sym;const quiet=Math.max(sym.quiet,2);const M=8,full=(size+2*quiet)*M,at=i=>(i+quiet)*M;const roles=MATRIX_ROLES[type];const cells=[];grid.forEach((row,y)=>row.forEach((dark,x)=>{if(dark)cells.push(_jsx(`rect`,{x:at(x),y:at(y),width:M,height:M},`${x}-${y}`))}));const h={light:.16,heavy:.3,severe:.36}[damage]||.16,w=.5;const scratch=damage?_jsx(`g`,{fill:`#ffffff`,children:_jsx(`rect`,{x:at(size*.38),y:at(size*.5),width:size*w*M,height:size*h*M,transform:`rotate(-12 ${at(size*.67)} ${at(size*.58)})`})}):null;const overlays=[];if(!plain\u0026\u0026!damage){roles.forEach(([r,color])=>{if(!color)return;grid.forEach((row,y)=>row.forEach((_,x)=>{if(role[y][x]===r)overlays.push(_jsx(`rect`,{x:at(x),y:at(y),width:M,height:M,fill:color},`${r}-${x}-${y}`))}))})}const legend=roles.filter(([,,title])=>title);const name=(findType(type)||{name:type}).name;const label=`${name} for ${String(value)}`;const svg=_jsxs(`svg`,{viewBox:`0 0 ${full} ${full}`,role:`img`,\"aria-label\":damage?`${label}, scratched, with error correction level ${ec}`:label,style:{width:`100%`,maxWidth:plain||damage?240:360,height:`auto`},children:[_jsx(`rect`,{x:`0`,y:`0`,width:full,height:full,fill:`#ffffff`,rx:plain?0:6}),_jsx(`g`,{fill:`#111214`,children:cells}),_jsx(`g`,{\"data-overlay\":``,children:overlays}),scratch]});if(plain||damage)return _jsx(`figure`,{className:`not-prose mint-my-6`,children:svg});return _jsxs(`figure`,{className:`not-prose mint-my-6`,children:[svg,_jsxs(`figcaption`,{className:`mint-mt-4`,children:[_jsx(`ul`,{className:`mint-pl-0 mint-text-sm`,style:{listStyle:`none`},children:legend.map(([r,color,title,meaning])=>_jsxs(`li`,{style:{marginBottom:6},children:[_jsx(`span`,{\"aria-hidden\":`true`,style:{display:`inline-block`,width:12,height:12,marginRight:8,verticalAlign:`middle`,background:color||`#ffffff`,border:`1px solid currentColor`,opacity:color?1:.5}}),_jsxs(`strong`,{children:[title,`.`]}),` `,meaning]},r))}),_jsx(`p`,{className:`mint-text-sm`,style:muted,children:type===`qr-code`?`Version ${sym.version} (${size}×${size} modules), error correction level ${sym.ec}, mask ${sym.mask}: ${sym.dataCodewords} data codewords and ${sym.ecCodewords} error correction codewords.`:`${size}×${size} modules: ${sym.dataCodewords} data codewords and ${sym.ecCodewords} error correction codewords.`})]})]})};const Damage=({type=`qr-code`,value,levels=`L,H`,severity=`light`})=>_jsx(`div`,{className:`not-prose`,style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(110px, 1fr))`,gap:12},children:levels.split(`,`).map(ec=>{const{size}=encodeQR(String(value),ec.trim());return _jsxs(`div`,{children:[Matrix2D({type,value,ec:ec.trim(),damage:severity}),_jsxs(`p`,{className:`mint-text-sm`,style:{textAlign:`center`,marginTop:-12},children:[`Level `,ec.trim(),` · `,size,`×`,size]})]},ec)})});const BarStates=({kind=`four-state`,labels})=>{const names=labels?labels.split(`,`).map(l=>l.trim()):kind===`height`?[`Tall`,`Short`]:[`Full`,`Ascender`,`Descender`,`Tracker`];const shapes=kind===`height`?[[0,40],[24,16]]:[[0,40],[0,26],[14,26],[14,12]];const gap=92,width=names.length*gap;return _jsx(`figure`,{className:`not-prose mint-my-6`,children:_jsxs(`svg`,{viewBox:`0 0 ${width} 78`,role:`img`,\"aria-label\":`Bar shapes: ${names.join(`, `)}`,style:{width:`100%`,maxWidth:width*1.4,height:`auto`},children:[kind!==`height`\u0026\u0026_jsx(`rect`,{x:`0`,y:`14`,width,height:`12`,fill:`currentColor`,opacity:`0.08`}),shapes.map(([top,h],i)=>_jsxs(`g`,{children:[_jsx(`rect`,{x:i*gap+gap/2-5,y:top,width:`10`,height:h,fill:`currentColor`}),_jsx(`text`,{x:i*gap+gap/2,y:`72`,textAnchor:`middle`,fontSize:`12`,fill:`currentColor`,children:names[i]})]},i))]})})};const GroupMembers=({group})=>{const members=BARCODE_TYPES.filter(t=>t.groups.includes(group));if(!members.length)return _jsxs(`p`,{style:muted,children:[`No barcode types in “`,group,`”.`]});return _jsx(`ul`,{children:members.map(t=>_jsxs(`li`,{children:[_jsx(_components.a,{href:href(t),children:t.name}),t.groupWhen\u0026\u0026t.groupWhen[group]\u0026\u0026`, ${t.groupWhen[group]}`]},t.slug))})};const VIEWS={facts:Facts,support:SupportMatrix,groups:GroupMatrix,\"check-digit\":CheckDigitSteps,anatomy:p=>MATRIX_ROLES[p.type]?Matrix2D(p):LINEAR[p.type]?Linear(p):Anatomy(p),symbol:p=>MATRIX_ROLES[p.type]?Matrix2D({...p,plain:true}):LINEAR[p.type]?Linear({...p,plain:true}):Anatomy({...p,plain:true}),damage:Damage,\"bar-states\":BarStates,group:GroupMembers};const render=VIEWS[view];return render?render(props):_jsxs(`p`,{style:muted,children:[`Unknown barcode view “`,view,`”.`]})};function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning,_MdxComponentBoundary}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);if(!_MdxComponentBoundary)_missingMdxReference(`_MdxComponentBoundary`,true);return _jsxs(_Fragment,{children:[_jsx(Warning,{children:`ZipZapKit hasn’t been released yet. The API names on this page are provisional and may change.`}),`\n`,_jsx(_components.p,{children:`Most people know what they’re scanning, products, shipping labels, IDs, but not which barcode types those use. Groups let you say the first and get the second: enable a group, and a field reads every barcode type in it.`}),`\n`,_jsx(_components.p,{children:`Groups work like tags, not folders. A barcode type can carry any number of them, or none, and a group isn’t simply a subset of a bigger one. Each group is defined by what you’re scanning, not by what the barcode looks like.`}),`\n`,_jsx(_components.p,{children:`This page lists what’s in each group. Whether a particular reader can read each type is a separate question, answered on each barcode type’s page.`}),`\n`,_jsx(Heading,{level:`2`,id:`how-groups-work`,children:`How groups work`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Groups overlap.`}),` A barcode type can be in several groups. GS1-128 is in Parcels, Cases and pallets, and GS1.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Some memberships depend on the content.`}),` A QR code is a retail product barcode only when it carries a GTIN, and a PDF417 is an ID barcode only when it carries a driver’s license. A field set to that group reads the barcodes that match and ignores the rest.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Some barcode types aren’t in any group.`}),` Code 39, Codabar and other general-purpose barcodes are used for too many things to tell what’s on them. Enable them on their own.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Enabling two groups gives you both.`}),` The field reads any barcode type in either group.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Narrower is better.`}),` Every extra barcode type a field accepts makes camera scanning a little slower and wrong reads a little more likely. Pick the narrowest group that covers what you scan.`]}),`\n`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`swift`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`swift`,children:_jsxs(_components.code,{language:`swift`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`ScanField`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"Product barcode\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`text`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: $gtin)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`barcodeTypes`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`(.`}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`retailProduct`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/sdk/modifiers/barcode-types`,children:`Barcode types`}),` for combining groups and choosing individual types.`]}),`\n`,_jsx(Heading,{level:`2`,id:`the-groups`,children:`The groups`}),`\n`,_jsx(Heading,{level:`3`,id:`retail-product`,children:`Retail product`}),`\n`,_jsx(_components.p,{children:`For the barcode on the thing a shopper hands you: every barcode that identifies a product by its GTIN.`}),`\n`,_jsx(_MdxComponentBoundary,{name:`Barcode`,children:_jsx(Barcode,{view:`group`,group:`retail`})}),`\n`,_jsxs(_components.p,{children:[`QR Code and Data Matrix are in this group only when they carry a GTIN, because products are starting to use them at checkout. See `,_jsx(_components.a,{href:`/reference/sunrise-2027`,children:`Sunrise 2027`}),`. Any other QR code, such as a link on a poster, isn’t a product barcode, and a field set to this group ignores it.`]}),`\n`,_jsx(_components.p,{children:`GS1 Composite is in this group when its linear part carries a GTIN, as it always does on a UPC, EAN or DataBar. A composite built on GS1-128 may carry a pallet’s SSCC instead.`}),`\n`,_jsx(Heading,{level:`4`,id:`how-zipzapkit-tells-whether-a-2d-barcode-carries-a-gtin`,children:`How ZipZapKit tells whether a 2D barcode carries a GTIN`}),`\n`,_jsx(_components.p,{children:`A QR Code or Data Matrix counts as a product barcode in two cases:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`It contains`}),_jsx(_components.th,{children:`How ZipZapKit recognizes it`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`A GS1 Digital Link: a web address with `,_jsx(_components.code,{children:`/01/`}),` followed by a GTIN`]}),_jsx(_components.td,{children:`From the content: the address is in Digital Link form and the GTIN’s check digit is valid. Works the same with every reader.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`GS1 data, as in GS1 DataMatrix or GS1 QR Code`}),_jsxs(_components.td,{children:[`When the scan source reports the barcode’s symbology identifier (`,_jsx(_components.code,{children:`]d2`}),` or `,_jsx(_components.code,{children:`]Q3`}),`), which marks GS1 data, ZipZapKit uses it. The camera doesn’t report it, so ZipZapKit infers it from the content: the data must parse as GS1 data starting with a GTIN whose check digit is valid.`]})]})]})]}),`\n`,_jsx(_components.p,{children:`The camera’s inference is rarely wrong, because ordinary text almost never parses as GS1 data with a valid check digit.`}),`\n`,_jsx(Heading,{level:`3`,id:`tickets-and-passes`,children:`Tickets and passes`}),`\n`,_jsx(_components.p,{children:`For event tickets, boarding passes, transit tickets and passes in Apple Wallet, on a phone screen or printed.`}),`\n`,_jsx(_MdxComponentBoundary,{name:`Barcode`,children:_jsx(Barcode,{view:`group`,group:`tickets`})}),`\n`,_jsx(_components.p,{children:`These are the four barcode types Apple Wallet passes can use, plus Data Matrix, which airlines can use on mobile boarding passes. If you issue the tickets yourself, enable only the barcode type you print: a narrower field scans faster.`}),`\n`,_jsx(Heading,{level:`3`,id:`parcels`,children:`Parcels`}),`\n`,_jsx(_components.p,{children:`For the shipping label on a parcel: the carrier’s tracking number and the sorting barcodes beside it.`}),`\n`,_jsx(_MdxComponentBoundary,{name:`Barcode`,children:_jsx(Barcode,{view:`group`,group:`parcels`})}),`\n`,_jsxs(_components.p,{children:[`Most carriers put the tracking number in a Code 128 or GS1-128 barcode. MaxiCode and PDF417 carry sorting and address data alongside it. Code 128 is used for many things besides parcels, so check that a scan is a tracking number. See `,_jsx(_components.a,{href:`/sdk/modifiers/validation`,children:`Validation`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`cases-and-pallets`,children:`Cases and pallets`}),`\n`,_jsx(_components.p,{children:`For receiving goods: the GS1 labels on cases, cartons and pallets, rather than on the products inside.`}),`\n`,_jsx(_MdxComponentBoundary,{name:`Barcode`,children:_jsx(Barcode,{view:`group`,group:`pallets`})}),`\n`,_jsxs(_components.p,{children:[`A case carries its own GTIN in an ITF-14 barcode. A pallet label carries an SSCC, the pallet’s serial number, in GS1-128, often with batch numbers and dates. See the `,_jsx(_components.a,{href:`/reference/gs1-application-identifiers`,children:`GS1 AI table`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`gs1`,children:`GS1`}),`\n`,_jsxs(_components.p,{children:[`For barcodes that can carry GS1 data beyond a product number: Application Identifiers such as batch numbers and expiry dates, or a GS1 Digital Link. Use it with ZipZapKit’s GS1 parsing. See `,_jsx(_components.a,{href:`/sdk/gs1/application-identifiers`,children:`GS1 Application Identifiers`}),`.`]}),`\n`,_jsx(_MdxComponentBoundary,{name:`Barcode`,children:_jsx(Barcode,{view:`group`,group:`gs1`})}),`\n`,_jsxs(_components.p,{children:[`QR Code and Data Matrix are in this group only when they carry GS1 data or a Digital Link, recognized the same way as for `,_jsx(_components.a,{href:`#how-zipzapkit-tells-whether-a-2d-barcode-carries-a-gtin`,children:`Retail product`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`postal`,children:`Postal`}),`\n`,_jsx(_components.p,{children:`The barcodes postal services print on mail for sorting and tracking.`}),`\n`,_jsx(_MdxComponentBoundary,{name:`Barcode`,children:_jsx(Barcode,{view:`group`,group:`postal`})}),`\n`,_jsx(Heading,{level:`3`,id:`id-and-documents`,children:`ID and documents`}),`\n`,_jsx(_components.p,{children:`Barcodes and printed text on identity documents: the PDF417 barcode on North American driver’s licenses, and the MRZ on passports and ID cards. The MRZ is printed text, not a barcode, and needs a reader with text recognition.`}),`\n`,_jsx(_MdxComponentBoundary,{name:`Barcode`,children:_jsx(Barcode,{view:`group`,group:`id`})}),`\n`,_jsx(_components.p,{children:`PDF417 is in this group only when it carries AAMVA data, the format of North American driver’s licenses and ID cards. That data always starts with a fixed header, so every reader recognizes it from the content. A PDF417 on a boarding pass or parcel label isn’t an ID, and a field set to this group ignores it.`}),`\n`,_jsx(Heading,{level:`2`,id:`every-barcode-type-and-its-groups`,children:`Every barcode type and its groups`}),`\n`,_jsx(_components.p,{children:`The table is split by shape. A barcode type that isn’t in any group can still be enabled on its own.`}),`\n`,_jsx(_MdxComponentBoundary,{name:`Barcode`,children:_jsx(Barcode,{view:`groups`})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{Barcode,default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":"dark","config":{},"pageMetadata":{"title":"Barcode groups","description":"Which barcode types belong to which group (retail product, tickets and passes, parcels, cases and pallets, GS1, postal, ID and documents) and how to enable a whole group in ZipZapKit.","sidebarTitle":"Barcode groups","href":"/reference/barcode-groups"}}},"mdxSourceWithNoJs":null,"noJsSplices":[[143,52771,")=>null;function _cr"]]},"mdxExtracts":{"tableOfContents":[{"title":"How groups work","slug":"how-groups-work","depth":2,"children":[]},{"title":"The groups","slug":"the-groups","depth":2,"children":[{"title":"Retail product","slug":"retail-product","depth":3,"children":[]},{"title":"How ZipZapKit tells whether a 2D barcode carries a GTIN","slug":"how-zipzapkit-tells-whether-a-2d-barcode-carries-a-gtin","depth":4,"children":[]},{"title":"Tickets and passes","slug":"tickets-and-passes","depth":3,"children":[]},{"title":"Parcels","slug":"parcels","depth":3,"children":[]},{"title":"Cases and pallets","slug":"cases-and-pallets","depth":3,"children":[]},{"title":"GS1","slug":"gs1","depth":3,"children":[]},{"title":"Postal","slug":"postal","depth":3,"children":[]},{"title":"ID and documents","slug":"id-and-documents","depth":3,"children":[]}]},{"title":"Every barcode type and its groups","slug":"every-barcode-type-and-its-groups","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"dynamicCss":".mint-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0\n}\n.mint-my-6 {\n margin-top: 1.5rem;\n margin-bottom: 1.5rem\n}\n.mint-mt-4 {\n margin-top: 1rem\n}\n.mint-list-decimal {\n list-style-type: decimal\n}\n.mint-overflow-x-auto {\n overflow-x: auto\n}\n.mint-whitespace-nowrap {\n white-space: nowrap\n}\n.mint-pl-0 {\n padding-left: 0px\n}\n.mint-pl-5 {\n padding-left: 1.25rem\n}\n.mint-text-center {\n text-align: center\n}\n.mint-text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem\n}\n.mint-font-medium {\n font-weight: 500\n}\n.mint-font-semibold {\n font-weight: 600\n}","subdomain":"sparklane","siteName":"Sparklane Docs","title":"Barcode groups - Sparklane Docs","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-06T03:35:14.560Z","originalFileLocation":"reference/barcode-groups.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Which barcode types belong to which group (retail product, tickets and passes, parcels, cases and pallets, GS1, postal, ID and documents) and how to enable a whole group in ZipZapKit.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Sparklane Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/sparklane/Qyp4_kXo-HltD2Eb/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/sparklane/Qyp4_kXo-HltD2Eb/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/sparklane/Qyp4_kXo-HltD2Eb/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/sparklane/Qyp4_kXo-HltD2Eb/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/sparklane/Qyp4_kXo-HltD2Eb/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/sparklane/Qyp4_kXo-HltD2Eb/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/sparklane/Qyp4_kXo-HltD2Eb/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/sparklane/Qyp4_kXo-HltD2Eb/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/sparklane/Qyp4_kXo-HltD2Eb/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Barcode groups - Sparklane Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Which barcode types belong to which group (retail product, tickets and passes, parcels, cases and pallets, GS1, postal, ID and documents) and how to enable a whole group in ZipZapKit.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Sparklane Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.sparklane.com/reference/barcode-groups\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://sparklane.mintlify.site/_mintlify/api/og/v2?division=Reference\u0026amp;title=Barcode+groups\u0026amp;description=Which+barcode+types+belong+to+which+group+%28retail+product%2C+tickets+and+passes%2C+parcels%2C+cases+and+pallets%2C+GS1%2C+postal%2C+ID+and+documents%29+and+how+to+enable+a+wh\u0026amp;theme=f4dacdeea88096d3fd6c053b\u0026amp;signature=c44b1a2f28c9066ed5974a18bf357fb982e2324bb0fcfb4b7e1ca3dc45d07c40\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Barcode groups - Sparklane Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Which barcode types belong to which group (retail product, tickets and passes, parcels, cases and pallets, GS1, postal, ID and documents) and how to enable a whole group in ZipZapKit.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://sparklane.mintlify.site/_mintlify/api/og/v2?division=Reference\u0026amp;title=Barcode+groups\u0026amp;description=Which+barcode+types+belong+to+which+group+%28retail+product%2C+tickets+and+passes%2C+parcels%2C+cases+and+pallets%2C+GS1%2C+postal%2C+ID+and+documents%29+and+how+to+enable+a+wh\u0026amp;theme=f4dacdeea88096d3fd6c053b\u0026amp;signature=c44b1a2f28c9066ed5974a18bf357fb982e2324bb0fcfb4b7e1ca3dc45d07c40\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/sparklane/Qyp4_kXo-HltD2Eb/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Sparklane Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#111214\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.sparklane.com/reference/barcode-groups\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/reference/barcode-groups.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.sparklane.com/#organization\",\"name\":\"Sparklane Docs\",\"url\":\"https://docs.sparklane.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/sparklane/eA0rJR6iNtLhoJwT/logo/lockup-sparklane.svg?fit=max\u0026auto=format\u0026n=eA0rJR6iNtLhoJwT\u0026q=85\u0026s=63b59b7296b0d24b4196a133ac89b8f7\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.sparklane.com#website\",\"name\":\"Sparklane Docs\",\"url\":\"https://docs.sparklane.com\",\"publisher\":{\"@id\":\"https://docs.sparklane.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.sparklane.com/reference/barcode-groups#webpage\",\"url\":\"https://docs.sparklane.com/reference/barcode-groups\",\"name\":\"Barcode groups\",\"description\":\"Which barcode types belong to which group (retail product, tickets and passes, parcels, cases and pallets, GS1, postal, ID and documents) and how to enable a whole group in ZipZapKit.\",\"dateModified\":\"2026-10-06T03:35:14.560Z\",\"isPartOf\":{\"@id\":\"https://docs.sparklane.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.sparklane.com/reference/barcode-groups#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.sparklane.com/reference/barcode-groups#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Reference\",\"item\":\"https://docs.sparklane.com/reference/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Barcode groups\",\"item\":\"https://docs.sparklane.com/reference/barcode-groups\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.sparklane.com/reference/barcode-groups#article\",\"headline\":\"Barcode groups\",\"name\":\"Barcode groups\",\"description\":\"Which barcode types belong to which group (retail product, tickets and passes, parcels, cases and pallets, GS1, postal, ID and documents) and how to enable a whole group in ZipZapKit.\",\"url\":\"https://docs.sparklane.com/reference/barcode-groups\",\"mainEntityOfPage\":{\"@id\":\"https://docs.sparklane.com/reference/barcode-groups#webpage\"},\"dateModified\":\"2026-10-06T03:35:14.560Z\",\"publisher\":{\"@id\":\"https://docs.sparklane.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.sparklane.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Sparklane Docs\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Sparklane Docs\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/reference/barcode-groups.md","siteName":"Sparklane Docs","nav":{"global":null,"tabs":[{"tab":"SDK","pages":[{"title":"SDK","href":""}]},{"tab":"Tools","pages":[{"title":"Tools","href":"/tools/barcode-anatomy"}]},{"tab":"Barcode reference","groups":[{"group":"Reference","pages":[{"title":"Barcode reference","description":"How the barcodes you'll scan are built: every barcode type ZipZapKit knows, plus guides to check digits, error correction, GS1 data and more.","icon":"book","sidebarTitle":"Overview","href":"/reference/overview"},{"title":"Barcode groups","sidebarTitle":"Barcode groups","href":"/reference/barcode-groups"},{"title":"Why doesn't my scan match the number printed under the barcode?","description":"Leading zeros, check digits, add-ons and scanner prefixes: why scanned data differs from the digits printed under a barcode, and how to fix it.","sidebarTitle":"Scan vs printed number","href":"/reference/scan-vs-printed-number"},{"title":"GS1 Application Identifiers","sidebarTitle":"GS1 AI table","href":"/reference/gs1-application-identifiers"},{"title":"Check digits","href":"/reference/check-digits"},{"title":"How much error correction should I use?","sidebarTitle":"Error correction","href":"/reference/error-correction"},{"title":"Sunrise 2027","href":"/reference/sunrise-2027"}]},{"group":"Retail (GTIN)","pages":[{"title":"UPC-A","href":"/reference/barcode-types/upc-a"},{"title":"UPC-E","href":"/reference/barcode-types/upc-e"},{"title":"EAN-13","href":"/reference/barcode-types/ean-13"},{"title":"EAN-8","href":"/reference/barcode-types/ean-8"},{"title":"ISBN","href":"/reference/barcode-types/isbn"},{"title":"ISSN","href":"/reference/barcode-types/issn"},{"title":"GS1 DataBar","href":"/reference/barcode-types/gs1-databar"},{"title":"GS1 Composite","href":"/reference/barcode-types/gs1-composite"}]},{"group":"Logistics and industrial","pages":[{"title":"ITF-14","href":"/reference/barcode-types/itf-14"},{"title":"2 of 5 barcodes","sidebarTitle":"2 of 5 family","href":"/reference/2-of-5-barcodes"},{"title":"Interleaved 2 of 5","href":"/reference/barcode-types/interleaved-2-of-5"},{"title":"Code 128","href":"/reference/barcode-types/code-128"},{"title":"GS1-128","href":"/reference/barcode-types/gs1-128"},{"title":"Code 39","href":"/reference/barcode-types/code-39"},{"title":"Code 93","href":"/reference/barcode-types/code-93"},{"title":"Codabar","href":"/reference/barcode-types/codabar"},{"title":"Code 11","href":"/reference/barcode-types/code-11"},{"title":"MSI Plessey","href":"/reference/barcode-types/msi-plessey"},{"title":"Industrial 2 of 5","href":"/reference/barcode-types/industrial-2-of-5"},{"title":"Matrix 2 of 5","href":"/reference/barcode-types/matrix-2-of-5"}]},{"group":"2D","pages":[{"title":"QR Code","href":"/reference/barcode-types/qr-code"},{"title":"Micro QR Code","href":"/reference/barcode-types/micro-qr"},{"title":"Data Matrix","href":"/reference/barcode-types/datamatrix"},{"title":"PDF417","href":"/reference/barcode-types/pdf417"},{"title":"MicroPDF417","href":"/reference/barcode-types/micro-pdf417"},{"title":"Aztec","href":"/reference/barcode-types/aztec"},{"title":"MaxiCode","href":"/reference/barcode-types/maxicode"},{"title":"Han Xin","href":"/reference/barcode-types/han-xin"},{"title":"Grid Matrix","href":"/reference/barcode-types/grid-matrix"}]},{"group":"Postal","pages":[{"title":"USPS Intelligent Mail","href":"/reference/barcode-types/usps-intelligent-mail"},{"title":"POSTNET","href":"/reference/barcode-types/postnet"},{"title":"PLANET","href":"/reference/barcode-types/planet"},{"title":"Royal Mail 4-State (RM4SCC)","sidebarTitle":"Royal Mail 4-State","href":"/reference/barcode-types/royal-mail-4-state"},{"title":"Royal Mail Mailmark","href":"/reference/barcode-types/mailmark"},{"title":"Australia Post 4-State","href":"/reference/barcode-types/australia-post"},{"title":"Japan Post","href":"/reference/barcode-types/japan-post"},{"title":"KIX","href":"/reference/barcode-types/kix"},{"title":"Korea Post","href":"/reference/barcode-types/korea-post"},{"title":"China Post 2 of 5","href":"/reference/barcode-types/china-post-2-of-5"}]},{"group":"Documents","pages":[{"title":"MRZ (machine-readable zone)","sidebarTitle":"MRZ","href":"/reference/documents/mrz"}]}]}]},"basePath":"","title":"Barcode groups - Sparklane Docs","deploymentId":"dpl_4dgnk6TA5fUgboKHTvWWyeqm3idh","buildId":"dpl_4dgnk6TA5fUgboKHTvWWyeqm3idh","dynamics":[],"chunks":[]}