@valentynb/gs1-parser 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +226 -247
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +76 -23
- package/dist/index.d.ts +76 -23
- package/dist/index.js +1 -1
- package/package.json +51 -42
- package/typedoc.json +10 -0
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var r=(_,S)=>l(_,"name",{value:S,configurable:!0});var p=(_,S)=>{for(var E in S)l(_,E,{get:S[E],enumerable:!0})},b=(_,S,E,I)=>{if(S&&typeof S=="object"||typeof S=="function")for(let T of w(S))!B.call(_,T)&&T!==E&&l(_,T,{get:()=>S[T],enumerable:!(I=W(S,T))||I.enumerable});return _};var Q=_=>b(l({},"__esModule",{value:!0}),_);var y={};p(y,{GS1Parser:()=>h});module.exports=Q(y);var g={ai00:"sscc",ai01:"gtin",ai02:"content",ai10:"batch",ai11:"prodDate",ai12:"dueDate",ai13:"packDate",ai15:"bestBefore",ai16:"sellBy",ai17:"expDate",ai20:"variant",ai21:"serial",ai22:"hibcc",ai235:"tpx",ai240:"additionalProductID",ai241:"customerPartNumber",ai242:"madeToOrder",ai243:"packaging",ai250:"secondarySerialNumber",ai251:"refSource",ai253:"gdti",ai254:"glnExtension",ai255:"gcn",ai30:"variableCount",ai310:"netWeightKg0",ai3100:"netWeightKg0",ai3101:"netWeightKg1",ai3102:"netWeightKg2",ai3103:"netWeightKg3",ai3104:"netWeightKg4",ai3105:"netWeightKg5",ai3110:"lengthMeters0",ai3111:"lengthMeters1",ai3112:"lengthMeters2",ai3113:"lengthMeters3",ai3114:"lengthMeters4",ai3115:"lengthMeters5",ai3120:"widthMeters0",ai3121:"widthMeters1",ai3122:"widthMeters2",ai3123:"widthMeters3",ai3124:"widthMeters4",ai3125:"widthMeters5",ai3130:"heightMeters0",ai3131:"heightMeters1",ai3132:"heightMeters2",ai3133:"heightMeters3",ai3134:"heightMeters4",ai3135:"heightMeters5",ai3140:"areaSquareMeters0",ai3141:"areaSquareMeters1",ai3142:"areaSquareMeters2",ai3143:"areaSquareMeters3",ai3144:"areaSquareMeters4",ai3145:"areaSquareMeters5",ai3150:"netVolumeLiters0",ai3151:"netVolumeLiters1",ai3152:"netVolumeLiters2",ai3153:"netVolumeLiters3",ai3154:"netVolumeLiters4",ai3155:"netVolumeLiters5",ai3160:"netVolumeCubicMeters0",ai3161:"netVolumeCubicMeters1",ai3162:"netVolumeCubicMeters2",ai3163:"netVolumeCubicMeters3",ai3164:"netVolumeCubicMeters4",ai3165:"netVolumeCubicMeters5",ai3200:"netWeightLb0",ai3201:"netWeightLb1",ai3202:"netWeightLb2",ai3203:"netWeightLb3",ai3204:"netWeightLb4",ai3205:"netWeightLb5",ai3210:"lengthInches0",ai3211:"lengthInches1",ai3212:"lengthInches2",ai3213:"lengthInches3",ai3214:"lengthInches4",ai3215:"lengthInches5",ai3220:"lengthFeet0",ai3221:"lengthFeet1",ai3222:"lengthFeet2",ai3223:"lengthFeet3",ai3224:"lengthFeet4",ai3225:"lengthFeet5",ai3230:"lengthYards0",ai3231:"lengthYards1",ai3232:"lengthYards2",ai3233:"lengthYards3",ai3234:"lengthYards4",ai3235:"lengthYards5",ai3240:"widthInches0",ai3241:"widthInches1",ai3242:"widthInches2",ai3243:"widthInches3",ai3244:"widthInches4",ai3245:"widthInches5",ai3250:"widthFeet0",ai3251:"widthFeet1",ai3252:"widthFeet2",ai3253:"widthFeet3",ai3254:"widthFeet4",ai3255:"widthFeet5",ai3260:"widthYards0",ai3261:"widthYards1",ai3262:"widthYards2",ai3263:"widthYards3",ai3264:"widthYards4",ai3265:"widthYards5",ai3270:"heightInches0",ai3271:"heightInches1",ai3272:"heightInches2",ai3273:"heightInches3",ai3274:"heightInches4",ai3275:"heightInches5",ai3280:"heightFeet0",ai3281:"heightFeet1",ai3282:"heightFeet2",ai3283:"heightFeet3",ai3284:"heightFeet4",ai3285:"heightFeet5",ai3290:"heightYards0",ai3291:"heightYards1",ai3292:"heightYards2",ai3293:"heightYards3",ai3294:"heightYards4",ai3295:"heightYards5",ai3300:"grossWeightKg0",ai3301:"grossWeightKg1",ai3302:"grossWeightKg2",ai3303:"grossWeightKg3",ai3304:"grossWeightKg4",ai3305:"grossWeightKg5",ai3310:"lengthMetersLog0",ai3311:"lengthMetersLog1",ai3312:"lengthMetersLog2",ai3313:"lengthMetersLog3",ai3314:"lengthMetersLog4",ai3315:"lengthMetersLog5",ai3320:"widthMetersLog0",ai3321:"widthMetersLog1",ai3322:"widthMetersLog2",ai3323:"widthMetersLog3",ai3324:"widthMetersLog4",ai3325:"widthMetersLog5",ai3330:"heightMetersLog0",ai3331:"heightMetersLog1",ai3332:"heightMetersLog2",ai3333:"heightMetersLog3",ai3334:"heightMetersLog4",ai3335:"heightMetersLog5",ai3340:"areaSquareInches0",ai3341:"areaSquareInches1",ai3342:"areaSquareInches2",ai3343:"areaSquareInches3",ai3344:"areaSquareInches4",ai3345:"areaSquareInches5",ai3350:"areaSquareFeet0",ai3351:"areaSquareFeet1",ai3352:"areaSquareFeet2",ai3353:"areaSquareFeet3",ai3354:"areaSquareFeet4",ai3355:"areaSquareFeet5",ai3360:"areaSquareYards0",ai3361:"areaSquareYards1",ai3362:"areaSquareYards2",ai3363:"areaSquareYards3",ai3364:"areaSquareYards4",ai3365:"areaSquareYards5",ai3370:"areaSquareMetersLog0",ai3371:"areaSquareMetersLog1",ai3372:"areaSquareMetersLog2",ai3373:"areaSquareMetersLog3",ai3374:"areaSquareMetersLog4",ai3375:"areaSquareMetersLog5",ai3400:"netWeightOunces0",ai3401:"netWeightOunces1",ai3402:"netWeightOunces2",ai3403:"netWeightOunces3",ai3404:"netWeightOunces4",ai3405:"netWeightOunces5",ai3410:"netVolumeQuarts0",ai3411:"netVolumeQuarts1",ai3412:"netVolumeQuarts2",ai3413:"netVolumeQuarts3",ai3414:"netVolumeQuarts4",ai3415:"netVolumeQuarts5",ai3420:"netVolumeGallons0",ai3421:"netVolumeGallons1",ai3422:"netVolumeGallons2",ai3423:"netVolumeGallons3",ai3424:"netVolumeGallons4",ai3425:"netVolumeGallons5",ai3430:"volumeCubicInches0",ai3431:"volumeCubicInches1",ai3432:"volumeCubicInches2",ai3433:"volumeCubicInches3",ai3434:"volumeCubicInches4",ai3435:"volumeCubicInches5",ai3440:"volumeCubicFeet0",ai3441:"volumeCubicFeet1",ai3442:"volumeCubicFeet2",ai3443:"volumeCubicFeet3",ai3444:"volumeCubicFeet4",ai3445:"volumeCubicFeet5",ai3450:"volumeCubicYards0",ai3451:"volumeCubicYards1",ai3452:"volumeCubicYards2",ai3453:"volumeCubicYards3",ai3454:"volumeCubicYards4",ai3455:"volumeCubicYards5",ai3460:"volumeCubicMetersLog0",ai3461:"volumeCubicMetersLog1",ai3462:"volumeCubicMetersLog2",ai3463:"volumeCubicMetersLog3",ai3464:"volumeCubicMetersLog4",ai3465:"volumeCubicMetersLog5",ai3500:"grossWeightLb0",ai3501:"grossWeightLb1",ai3502:"grossWeightLb2",ai3503:"grossWeightLb3",ai3504:"grossWeightLb4",ai3505:"grossWeightLb5",ai3510:"lengthInchesLog0",ai3511:"lengthInchesLog1",ai3512:"lengthInchesLog2",ai3513:"lengthInchesLog3",ai3514:"lengthInchesLog4",ai3515:"lengthInchesLog5",ai3520:"lengthFeetLog0",ai3521:"lengthFeetLog1",ai3522:"lengthFeetLog2",ai3523:"lengthFeetLog3",ai3524:"lengthFeetLog4",ai3525:"lengthFeetLog5",ai3530:"lengthYardsLog0",ai3531:"lengthYardsLog1",ai3532:"lengthYardsLog2",ai3533:"lengthYardsLog3",ai3534:"lengthYardsLog4",ai3535:"lengthYardsLog5",ai3540:"widthInchesLog0",ai3541:"widthInchesLog1",ai3542:"widthInchesLog2",ai3543:"widthInchesLog3",ai3544:"widthInchesLog4",ai3545:"widthInchesLog5",ai3550:"widthFeetLog0",ai3551:"widthFeetLog1",ai3552:"widthFeetLog2",ai3553:"widthFeetLog3",ai3554:"widthFeetLog4",ai3555:"widthFeetLog5",ai3560:"widthYardsLog0",ai3561:"widthYardsLog1",ai3562:"widthYardsLog2",ai3563:"widthYardsLog3",ai3564:"widthYardsLog4",ai3565:"widthYardsLog5",ai3570:"heightInchesLog0",ai3571:"heightInchesLog1",ai3572:"heightInchesLog2",ai3573:"heightInchesLog3",ai3574:"heightInchesLog4",ai3575:"heightInchesLog5",ai3580:"heightFeetLog0",ai3581:"heightFeetLog1",ai3582:"heightFeetLog2",ai3583:"heightFeetLog3",ai3584:"heightFeetLog4",ai3585:"heightFeetLog5",ai3590:"heightYardsLog0",ai3591:"heightYardsLog1",ai3592:"heightYardsLog2",ai3593:"heightYardsLog3",ai3594:"heightYardsLog4",ai3595:"heightYardsLog5",ai3600:"grossWeightOunces0",ai3601:"grossWeightOunces1",ai3602:"grossWeightOunces2",ai3603:"grossWeightOunces3",ai3604:"grossWeightOunces4",ai3605:"grossWeightOunces5",ai3610:"netVolumeFluidOunces0",ai3611:"netVolumeFluidOunces1",ai3612:"netVolumeFluidOunces2",ai3613:"netVolumeFluidOunces3",ai3614:"netVolumeFluidOunces4",ai3615:"netVolumeFluidOunces5",ai3620:"grossVolumeQuarts0",ai3621:"grossVolumeQuarts1",ai3622:"grossVolumeQuarts2",ai3623:"grossVolumeQuarts3",ai3624:"grossVolumeQuarts4",ai3625:"grossVolumeQuarts5",ai3630:"grossVolumeGallons0",ai3631:"grossVolumeGallons1",ai3632:"grossVolumeGallons2",ai3633:"grossVolumeGallons3",ai3634:"grossVolumeGallons4",ai3635:"grossVolumeGallons5",ai3640:"volumeCubicInchesLog0",ai3641:"volumeCubicInchesLog1",ai3642:"volumeCubicInchesLog2",ai3643:"volumeCubicInchesLog3",ai3644:"volumeCubicInchesLog4",ai3645:"volumeCubicInchesLog5",ai3650:"volumeCubicFeetLog0",ai3651:"volumeCubicFeetLog1",ai3652:"volumeCubicFeetLog2",ai3653:"volumeCubicFeetLog3",ai3654:"volumeCubicFeetLog4",ai3655:"volumeCubicFeetLog5",ai3660:"volumeCubicYardsLog0",ai3661:"volumeCubicYardsLog1",ai3662:"volumeCubicYardsLog2",ai3663:"volumeCubicYardsLog3",ai3664:"volumeCubicYardsLog4",ai3665:"volumeCubicYardsLog5",ai37:"count",ai3900:"amountPayable0",ai3901:"amountPayable1",ai3902:"amountPayable2",ai3903:"amountPayable3",ai3904:"amountPayable4",ai3905:"amountPayable5",ai3910:"amountPayableISO0",ai3911:"amountPayableISO1",ai3912:"amountPayableISO2",ai3913:"amountPayableISO3",ai3914:"amountPayableISO4",ai3915:"amountPayableISO5",ai3920:"price0",ai3921:"price1",ai3922:"price2",ai3923:"price3",ai3930:"priceISO0",ai3931:"priceISO1",ai3932:"priceISO2",ai3933:"priceISO3",ai3940:"percentDiscount0",ai3941:"percentDiscount1",ai3942:"percentDiscount2",ai3943:"percentDiscount3",ai3950:"pricePerUnitMeasure0",ai3951:"pricePerUnitMeasure1",ai3952:"pricePerUnitMeasure2",ai3953:"pricePerUnitMeasure3",ai3954:"pricePerUnitMeasure4",ai3955:"pricePerUnitMeasure5",ai400:"orderNumber",ai401:"ginc",ai402:"gsin",ai403:"route",ai410:"shipTo",ai411:"billTo",ai412:"purchaseFrom",ai413:"shipFor",ai414:"locNo",ai415:"payTo",ai416:"prodServLoc",ai417:"party",ai420:"shipToPost",ai421:"shipToPostISO",ai422:"origin",ai423:"countryInitialProcess",ai424:"countryProcess",ai425:"countryDisassembly",ai426:"countryFullProcess",ai427:"originSubdivision",ai7001:"nsn",ai7002:"meatCut",ai7003:"expirationDateTime",ai7004:"activePotency",ai7005:"catchArea",ai7006:"firstFreezeDate",ai7007:"harvestDate",ai7008:"aquaticSpecies",ai7009:"fishingGearType",ai7010:"prodMethod",ai7020:"refurbLot",ai7021:"funcStat",ai7022:"revStat",ai7023:"giaiAssembly",ai7030:"processor",ai7031:"processor2",ai7032:"processor3",ai7033:"processor4",ai7034:"processor5",ai7035:"processor6",ai7036:"processor7",ai7037:"processor8",ai7038:"processor9",ai7039:"processor10",ai7040:"uicExt",ai8001:"rollProducts",ai8002:"cmtNo",ai8003:"grai",ai8004:"giai",ai8005:"pricePerUnit",ai8006:"itip",ai8007:"iban",ai8008:"prodTime",ai8009:"opticalSensor",ai8010:"cpid",ai8011:"cpidSerial",ai8012:"version",ai8013:"gmn",ai8017:"gsrnProvider",ai8018:"gsrnRecipient",ai8019:"srin",ai8020:"refNo",ai8026:"itipContent",ai8030:"coupon",ai8110:"couponExtended",ai8111:"couponExtended2",ai8112:"couponExtended3",ai8200:"productURL",ai90:"internal1",ai91:"internal2",ai92:"internal3",ai93:"internal4",ai94:"internal5",ai95:"internal6",ai96:"internal7",ai97:"internal8",ai98:"internal9",ai99:"internal10"};var M=String.fromCodePoint(29),o=/^\d+$/;var A=class extends Error{static{r(this,"InternalError")}constructor(S,E){super(S),this.name="InternalError",this.code=S,this.ex=E}ex;code},O=class extends Error{static{r(this,"InvalidAiError")}constructor(S,E){let I;S?I=`Invalid AI identifier "${E}" after "${S}"`:I=`Invalid first AI identifier "${E}"`,super(I),this.name="InvalidAiError"}},G=class extends Error{static{r(this,"BarcodeError")}constructor(S,E,I){super(I),this.name="BarcodeError",this.num=S,this.code=E,this.des=I}num;code;des},H=class{static{r(this,"ParsedElementClass")}ai;dataTitle;data;dataString;unit;constructor(S,E,I){switch(this.ai=S,this.dataTitle=E,this.unit="",this.dataString="",I){case"S":this.data="";break;case"N":this.data=0;break;case"D":this.data=new Date,this.data.setHours(0,0,0,0);break;default:this.data="";break}}},C=class{constructor(S,E,I={}){this.codeName=S;this.denormalized=E;this.data=I}static{r(this,"DecodeResult")}};function m(_,S){let E=_,I=E.slice(0,1);for(;I===S;)E=E.slice(1),I=E.slice(0,1);return E}r(m,"cleanCodestring");function F(_,S,E){if(S<0||S>11)return!1;let I=S;E===0&&I++;let T=new Date(_,I,E);return T.getFullYear()===_&&T.getMonth()===S&&(T.getDate()===E||E===0)}r(F,"checkValidDate");function D(_,S){let E=_.length-S,I=_.slice(0,E)+"."+_.slice(E);try{return Number.parseFloat(I)}catch(T){throw new A("36",T)}}r(D,"parseFloatingPoint");function u(_,S,E){let I=new H(_,S,"D"),T=_.length,a=E.slice(T,T+6),e=0,L=0,R=0;try{e=Number.parseInt(a.slice(0,2),10)}catch(N){throw new A("33",N)}try{L=Number.parseInt(a.slice(2,4),10)-1}catch(N){throw new A("34",N)}try{R=Number.parseInt(a.slice(4,6),10)}catch(N){throw new A("35",N)}if(e>50?e=e+1900:e=e+2e3,!F(e,L,R))throw new G(7,"36",`Invalid date "${a}" for AI "${_}".`);return R===0&&L++,I.data.setFullYear(e,L,R),I.dataString=a,{element:I,codestring:E.slice(T+6,E.length)}}r(u,"parseDate");function s(_,S,E,I,T=!1){let a=new H(_,S,"S"),e=_.length,L=I.slice(e,E+e);if(L.length<E)throw new G(9,"37",`Data length ${L.length} is less than expected length ${E} for AI "${_}".`);if(T&&!o.test(L))throw new G(11,"39",`Numeric data expected for AI "${_}", but got "${L}".`);a.data=L,a.dataString=L;let R=I.slice(E+e,I.length);return{element:a,codestring:R}}r(s,"parseFixedLength");function t(_,S,E,I,T,a=!1){let e=new H(_,S,"S"),L=_.length,R=E.indexOf(I),N="";if(R===-1?T&&T>0?(e.data=E.slice(L,T+L),N=E.replace(_+e.data,"")):e.data=E.slice(L,E.length):(e.data=E.slice(L,R),N=E.slice(R+1,E.length)),e.data==="")throw new G(10,"38",`Variable length data for AI "${_}" is empty.`);if(a&&!o.test(e.data))throw new G(11,"39",`Numeric data expected for AI "${_}", but got "${e.data}".`);return e.dataString=e.data,{element:e,codestring:N}}r(t,"parseVariableLength");function c(_,S,E,I,T,a){let e=new H(_+S,E,"N"),L=_.length+1,R=T.indexOf(a),N=Number.parseInt(S,10),n="",U="";return R===-1?n=T.slice(L,T.length):(n=T.slice(L,R),U=T.slice(R+1,T.length)),e.data=D(n,N),e.dataString=n,e.unit=I,{element:e,codestring:U}}r(c,"parseVariableLengthMeasure");function i(_,S,E,I,T){let a=new H(_+S,E,"N"),e=_.length+1,L=Number.parseInt(S,10),R=T.slice(e,e+6);a.data=D(R,L),a.dataString=R,a.unit=I;let N=T.slice(e+6,T.length);return{element:a,codestring:N}}r(i,"parseFixedLengthMeasure");function P(_,S,E,I,T){let a=new H(_+S,E,"N"),e=_.length+1,L=I.indexOf(T),R=Number.parseInt(S,10),N="",n="",U="";return L===-1?N=I.slice(e,I.length):(N=I.slice(e,L),U=I.slice(L+1,I.length)),n=N.slice(3,N.length),a.data=D(n,R),a.dataString=n,a.unit=N.slice(0,3),{element:a,codestring:U}}r(P,"parseVariableLengthWithISONumbers");function V(_,S,E,I){let T=new H(_,S,"S"),a=_.length,e=E.indexOf(I),L="",R="";return e===-1?L=E.slice(a,E.length):(L=E.slice(a,e),R=E.slice(e+1,E.length)),T.data=L.slice(3,L.length),T.unit=L.slice(0,3),T.dataString=L,{element:T,codestring:R}}r(V,"parseVariableLengthWithISOChars");function f(_,S,E){E||(E=M);let I=_.slice(0,1),T=_.slice(1,2),a="",e="";switch(I){case"0":switch(T){case"0":return s("00","SSCC",18,_,!0);case"1":return s("01","GTIN",14,_,!0);case"2":return s("02","CONTENT",14,_);case"3":return s("03","MTO GTIN",14,_);default:throw new O("0",T)}case"1":switch(T){case"0":return t("10","BATCH/LOT",_,E,S??20);case"1":return u("11","PROD DATE",_);case"2":return u("12","DUE DATE",_);case"3":return u("13","PACK DATE",_);case"5":return u("15","BEST BEFORE or BEST BY",_);case"6":return u("16","SELL BY",_);case"7":return u("17","USE BY OR EXPIRY",_);default:throw new O("1",T)}case"2":switch(T){case"0":return s("20","VARIANT",2,_);case"1":return t("21","SERIAL",_,E,S??20);case"2":return t("22","CPV",_,E,20);case"3":switch(a=_.slice(2,3),a){case"5":return t("235","TPX",_,E,28);default:throw new O("23",a)}case"4":switch(a=_.slice(2,3),a){case"0":return t("240","ADDITIONAL ID",_,E,30);case"1":return t("241","CUST. PART NO.",_,E,30);case"2":return t("242","MTO VARIANT",_,E,6);case"3":return t("243","PCN",_,E,20);default:throw new O("24",a)}case"5":switch(a=_.slice(2,3),a){case"0":return t("250","SECONDARY SERIAL",_,E,30);case"1":return t("251","REF. TO SOURCE",_,E,30);case"3":return t("253","GDTI",_,E,42);case"4":return t("254","GLN EXTENSION COMPONENT",_,E,20);case"5":return t("255","GCN",_,E,37);default:throw new O("25",a)}default:throw new O("2",T)}case"3":switch(T){case"0":return t("30","VAR. COUNT",_,E,8);case"1":switch(a=_.slice(2,3),e=_.slice(3,4),a){case"0":return i("310",e,"NET WEIGHT (kg)","KGM",_);case"1":return i("311",e,"LENGTH (m)","MTR",_);case"2":return i("312",e,"WIDTH (m)","MTR",_);case"3":return i("313",e,"HEIGHT (m)","MTR",_);case"4":return i("314",e,"AREA (m2)","MTK",_);case"5":return i("315",e,"NET VOLUME (l)","LTR",_);case"6":return i("316",e,"NET VOLUME (m3)","MTQ",_);default:throw new O("31",a)}case"2":switch(a=_.slice(2,3),e=_.slice(3,4),a){case"0":return i("320",e,"NET WEIGHT (lb)","LBR",_);case"1":return i("321",e,"LENGTH (i)","INH",_);case"2":return i("322",e,"LENGTH (f)","FOT",_);case"3":return i("323",e,"LENGTH (y)","YRD",_);case"4":return i("324",e,"WIDTH (i)","INH",_);case"5":return i("325",e,"WIDTH (f)","FOT",_);case"6":return i("326",e,"WIDTH (y)","YRD",_);case"7":return i("327",e,"HEIGHT (i)","INH",_);case"8":return i("328",e,"HEIGHT (f)","FOT",_);case"9":return i("329",e,"HEIGHT (y)","YRD",_);default:throw new O("32",a)}case"3":switch(a=_.slice(2,3),e=_.slice(3,4),a){case"0":return i("330",e,"GROSS WEIGHT (kg)","KGM",_);case"1":return i("331",e,"LENGTH (m), log","MTR",_);case"2":return i("332",e,"WIDTH (m), log","MTR",_);case"3":return i("333",e,"HEIGHT (m), log","MTR",_);case"4":return i("334",e,"AREA (m2), log","MTK",_);case"5":return i("335",e,"VOLUME (l), log","LTR",_);case"6":return i("336",e,"VOLUME (m3), log","MTQ",_);case"7":return i("337",e,"KG PER m\xB2","28",_);default:throw new O("33",a)}case"4":switch(a=_.slice(2,3),e=_.slice(3,4),a){case"0":return i("340",e,"GROSS WEIGHT (lb)","LBR",_);case"1":return i("341",e,"LENGTH (i), log","INH",_);case"2":return i("342",e,"LENGTH (f), log","FOT",_);case"3":return i("343",e,"LENGTH (y), log","YRD",_);case"4":return i("344",e,"WIDTH (i), log","INH",_);case"5":return i("345",e,"WIDTH (f), log","FOT",_);case"6":return i("346",e,"WIDTH (y), log","YRD",_);case"7":return i("347",e,"HEIGHT (i), log","INH",_);case"8":return i("348",e,"HEIGHT (f), log","FOT",_);case"9":return i("349",e,"HEIGHT (y), log","YRD",_);default:throw new O("33",a)}case"5":switch(a=_.slice(2,3),e=_.slice(3,4),a){case"0":return i("350",e,"AREA (i2)","INK",_);case"1":return i("351",e,"AREA (f2)","FTK",_);case"2":return i("352",e,"AREA (y2)","YDK",_);case"3":return i("353",e,"AREA (i2), log","INK",_);case"4":return i("354",e,"AREA (f2), log","FTK",_);case"5":return i("355",e,"AREA (y2), log","YDK",_);case"6":return i("356",e,"NET WEIGHT (t)","APZ",_);case"7":return i("357",e,"NET VOLUME (oz)","ONZ",_);default:throw new O("35",a)}case"6":switch(a=_.slice(2,3),e=_.slice(3,4),a){case"0":return i("360",e,"NET VOLUME (q)","QT",_);case"1":return i("361",e,"NET VOLUME (g)","GLL",_);case"2":return i("362",e,"VOLUME (q), log","QT",_);case"3":return i("363",e,"VOLUME (g), log","GLL",_);case"4":return i("364",e,"VOLUME (i3)","INQ",_);case"5":return i("365",e,"VOLUME (f3)","FTQ",_);case"6":return i("366",e,"VOLUME (y3)","YDQ",_);case"7":return i("367",e,"VOLUME (i3), log","INQ",_);case"8":return i("368",e,"VOLUME (f3), log","FTQ",_);case"9":return i("369",e,"VOLUME (y3), log","YDQ",_);default:throw new O("36",a)}case"7":return t("37","COUNT",_,E,8);case"9":switch(a=_.slice(2,3),e=_.slice(3,4),a){case"0":return c("390",e,"AMOUNT","",_,E);case"1":return P("391",e,"AMOUNT",_,E);case"2":return c("392",e,"PRICE","",_,E);case"3":return P("393",e,"PRICE",_,E);default:throw new O("39",a)}default:throw new O("3",T)}case"4":switch(T){case"0":switch(a=_.slice(2,3),a){case"0":return t("400","ORDER NUMBER",_,E,30);case"1":return t("401","GINC",_,E);case"2":return t("402","GSIN",_,E,17);case"3":return t("403","ROUTE",_,E,30);default:throw new O("40",a)}case"1":switch(a=_.slice(2,3),a){case"0":return s("410","SHIP TO LOC",13,_);case"1":return s("411","BILL TO",13,_);case"2":return s("412","PURCHASE FROM",13,_);case"3":return s("413","SHIP FOR LOC",13,_);case"4":return s("414","LOC NO",13,_);case"5":return s("415","PAY TO",13,_);case"6":return s("416","PROD/SERV LOC",13,_);case"7":return s("417","PARTY",13,_);default:throw new O("41",a)}case"2":switch(a=_.slice(2,3),a){case"0":return t("420","SHIP TO POST",_,E,20);case"1":return V("421","SHIP TO POST",_,E);case"2":return s("422","ORIGIN",3,_);case"3":return t("423","COUNTRY - INITIAL PROCESS.",_,E,15);case"4":return s("424","COUNTRY - PROCESS.",3,_);case"5":return s("425","COUNTRY - DISASSEMBLY",3,_);case"6":return s("426","COUNTRY - FULL PROCESS",3,_);case"7":return t("427","ORIGIN SUBDIVISION",_,E,3);default:throw new O("42",a)}default:throw new O("4",T)}case"7":switch(T){case"0":switch(a=_.slice(2,3),e=_.slice(3,4),a){case"0":switch(e){case"1":return t("7001","NSN",_,E,13);case"2":return t("7002","MEAT CUT",_,E);case"3":return t("7003","EXPIRY TIME",_,E,10);case"4":return t("7004","ACTIVE POTENCY",_,E,6);default:throw new O("70",a)}case"3":return V("703"+e,"PROCESSOR # "+e,_,E);default:throw new O("70",a)}case"1":switch(a=_.slice(2,3),a){case"0":return t("710","NHRN PZN",_,E);case"1":return t("711","NHRN CIP",_,E);case"2":return t("712","NHRN CN",_,E);case"3":return t("713","NHRN DRN",_,E);default:throw new O("71",a)}default:throw new O("7",T)}case"8":switch(T){case"0":switch(a=_.slice(2,3),e=_.slice(3,4),a){case"0":switch(e){case"1":return t("8001","DIMENSIONS",_,E,14);case"2":return t("8002","CMT No",_,E);case"3":return t("8003","GRAI",_,E);case"4":return t("8004","GIAI",_,E);case"5":return t("8005","PRICE PER UNIT",_,E,6);case"6":return t("8006","GCTIN",_,E,18);case"7":return t("8007","IBAN",_,E);case"8":return t("8008","PROD TIME",_,E,12);default:throw new O("800",e)}case"1":switch(e){case"0":return t("8010","CPID",_,E);case"1":return t("8011","CPID SERIAL",_,E);case"7":return t("8017","GSRN - PROVIDER",_,E,18);case"8":return t("8018","GSRN - RECIPIENT",_,E,18,!0);case"9":return t("8019","SRIN",_,E,void 0,!0);default:throw new O("801",e)}case"2":switch(e){case"0":return t("8020","REF No",_,E);default:throw new O("802",e)}default:throw new O("80",a)}case"1":switch(a=_.slice(2,3),e=_.slice(3,4),a){case"0":switch(e){case"0":return t("8100","-",_,E,6);case"1":return t("8101","-",_,E,10);case"2":return t("8102","-",_,E,2);default:throw new O("810",e)}case"1":switch(e){case"0":return t("8110","-",_,E);default:throw new O("811",e)}default:throw new O("81",a)}case"2":switch(a=_.slice(2,3),a){case"0":return t("8200","PRODUCT URL",_,E);default:throw new O("82",a)}default:throw new O("8",T)}case"9":switch(T){case"0":return t("90","INTERNAL",_,E);case"1":return t("91","INTERNAL",_,E);case"2":return t("92","INTERNAL",_,E);case"3":return t("93","INTERNAL",_,E);case"4":return t("94","INTERNAL",_,E);case"5":return t("95","INTERNAL",_,E);case"6":return t("96","INTERNAL",_,E);case"7":return t("97","INTERNAL",_,E);case"8":return t("98","INTERNAL",_,E);case"9":return t("99","INTERNAL",_,E);default:throw new O("9",T)}default:throw new O("",I)}}r(f,"identifyAI");function Y(_,S,E){if(!_||typeof _!="string")throw new G(2,"31","The barcode is empty or not a string.");let I=_.length,T={codeName:"",denormalized:"",parsedCodeItems:[]},a="",e=_.slice(0,3),L;switch(e){case"]C1":T.codeName="GS1-128",a=_.slice(3,I);break;case"]e0":T.codeName="GS1 DataBar",a=_.slice(3,I);break;case"]e1":case"]e2":T.codeName="GS1 Composite",a=_.slice(3,I);break;case"]d2":T.codeName="GS1 DataMatrix",a=_.slice(3,I);break;case"]Q3":T.codeName="GS1 QR Code",a=_.slice(3,I);break;default:T.codeName="",a=_;break}for(T.parsedCodeItems=[];a.length>0;)try{L=f(a,E),a=m(L.codestring,S),T.parsedCodeItems.push(L.element),T.denormalized+="("+L.element.ai+")"+L.element.dataString}catch(R){if(R instanceof A)v(R);else throw R}return T}r(Y,"parseBarcode");function v(_){switch(_.code){case"32":throw new G(6,32,"Invalid normal AI.");case"33":throw new G(7,33,"L'anno nella data non \xE8 valido.");case"34":throw new G(7,34,"Il mese nella data non \xE8 valido.");case"36":throw new G(8,36,"Numeri non validi");default:throw _}}r(v,"handleInternalError");var h=class{static{r(this,"GS1Parser")}fncChar;lotLen;constructor(S){this.fncChar=S?.fncChar||M,this.lotLen=S?.lotMaxLength}decode(S){let E=S.replaceAll("(",this.fncChar).replaceAll(")","");E.startsWith(this.fncChar)&&(E=E.slice(1));let I=Y(E,this.fncChar,this.lotLen),T={};for(let a of I.parsedCodeItems){let e=g["ai"+a.ai];e&&(T[e]=a)}return new C(I.codeName,I.denormalized,T)}};0&&(module.exports={GS1Parser});
|
|
1
|
+
"use strict";var D=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var N=(E,I)=>D(E,"name",{value:I,configurable:!0});var d=(E,I)=>{for(var e in I)D(E,e,{get:I[e],enumerable:!0})},Q=(E,I,e,i)=>{if(I&&typeof I=="object"||typeof I=="function")for(let S of p(I))!b.call(E,S)&&S!==e&&D(E,S,{get:()=>I[S],enumerable:!(i=B(I,S))||i.enumerable});return E};var f=E=>Q(D({},"__esModule",{value:!0}),E);var K={};d(K,{DecodeResult:()=>l,GS1Field:()=>c,GS1Parser:()=>o});module.exports=f(K);var c=(_=>(_.SSCC="sscc",_.GTIN="gtin",_.CONTENT="content",_.BATCH="batch",_.PROD_DATE="prodDate",_.DUE_DATE="dueDate",_.PACK_DATE="packDate",_.BEST_BEFORE="bestBefore",_.SELL_BY="sellBy",_.EXP_DATE="expDate",_.VARIANT="variant",_.SERIAL="serial",_.HIBCC="hibcc",_.TPX="tpx",_.ADDITIONAL_PRODUCT_ID="additionalProductID",_.CUSTOMER_PART_NUMBER="customerPartNumber",_.MADE_TO_ORDER="madeToOrder",_.PACKAGING="packaging",_.SECONDARY_SERIAL_NUMBER="secondarySerialNumber",_.REF_SOURCE="refSource",_.GDTI="gdti",_.GLN_EXTENSION="glnExtension",_.GCN="gcn",_.VARIABLE_COUNT="variableCount",_.NET_WEIGHT_KG_0="netWeightKg0",_.NET_WEIGHT_KG_1="netWeightKg1",_.NET_WEIGHT_KG_2="netWeightKg2",_.NET_WEIGHT_KG_3="netWeightKg3",_.NET_WEIGHT_KG_4="netWeightKg4",_.NET_WEIGHT_KG_5="netWeightKg5",_.LENGTH_METERS_0="lengthMeters0",_.LENGTH_METERS_1="lengthMeters1",_.LENGTH_METERS_2="lengthMeters2",_.LENGTH_METERS_3="lengthMeters3",_.LENGTH_METERS_4="lengthMeters4",_.LENGTH_METERS_5="lengthMeters5",_.WIDTH_METERS_0="widthMeters0",_.WIDTH_METERS_1="widthMeters1",_.WIDTH_METERS_2="widthMeters2",_.WIDTH_METERS_3="widthMeters3",_.WIDTH_METERS_4="widthMeters4",_.WIDTH_METERS_5="widthMeters5",_.HEIGHT_METERS_0="heightMeters0",_.HEIGHT_METERS_1="heightMeters1",_.HEIGHT_METERS_2="heightMeters2",_.HEIGHT_METERS_3="heightMeters3",_.HEIGHT_METERS_4="heightMeters4",_.HEIGHT_METERS_5="heightMeters5",_.AREA_SQUARE_METERS_0="areaSquareMeters0",_.AREA_SQUARE_METERS_1="areaSquareMeters1",_.AREA_SQUARE_METERS_2="areaSquareMeters2",_.AREA_SQUARE_METERS_3="areaSquareMeters3",_.AREA_SQUARE_METERS_4="areaSquareMeters4",_.AREA_SQUARE_METERS_5="areaSquareMeters5",_.NET_VOLUME_LITERS_0="netVolumeLiters0",_.NET_VOLUME_LITERS_1="netVolumeLiters1",_.NET_VOLUME_LITERS_2="netVolumeLiters2",_.NET_VOLUME_LITERS_3="netVolumeLiters3",_.NET_VOLUME_LITERS_4="netVolumeLiters4",_.NET_VOLUME_LITERS_5="netVolumeLiters5",_.NET_VOLUME_CUBIC_METERS_0="netVolumeCubicMeters0",_.NET_VOLUME_CUBIC_METERS_1="netVolumeCubicMeters1",_.NET_VOLUME_CUBIC_METERS_2="netVolumeCubicMeters2",_.NET_VOLUME_CUBIC_METERS_3="netVolumeCubicMeters3",_.NET_VOLUME_CUBIC_METERS_4="netVolumeCubicMeters4",_.NET_VOLUME_CUBIC_METERS_5="netVolumeCubicMeters5",_.NET_WEIGHT_LB_0="netWeightLb0",_.NET_WEIGHT_LB_1="netWeightLb1",_.NET_WEIGHT_LB_2="netWeightLb2",_.NET_WEIGHT_LB_3="netWeightLb3",_.NET_WEIGHT_LB_4="netWeightLb4",_.NET_WEIGHT_LB_5="netWeightLb5",_.LENGTH_INCHES_0="lengthInches0",_.LENGTH_INCHES_1="lengthInches1",_.LENGTH_INCHES_2="lengthInches2",_.LENGTH_INCHES_3="lengthInches3",_.LENGTH_INCHES_4="lengthInches4",_.LENGTH_INCHES_5="lengthInches5",_.LENGTH_FEET_0="lengthFeet0",_.LENGTH_FEET_1="lengthFeet1",_.LENGTH_FEET_2="lengthFeet2",_.LENGTH_FEET_3="lengthFeet3",_.LENGTH_FEET_4="lengthFeet4",_.LENGTH_FEET_5="lengthFeet5",_.LENGTH_YARDS_0="lengthYards0",_.LENGTH_YARDS_1="lengthYards1",_.LENGTH_YARDS_2="lengthYards2",_.LENGTH_YARDS_3="lengthYards3",_.LENGTH_YARDS_4="lengthYards4",_.LENGTH_YARDS_5="lengthYards5",_.WIDTH_INCHES_0="widthInches0",_.WIDTH_INCHES_1="widthInches1",_.WIDTH_INCHES_2="widthInches2",_.WIDTH_INCHES_3="widthInches3",_.WIDTH_INCHES_4="widthInches4",_.WIDTH_INCHES_5="widthInches5",_.WIDTH_FEET_0="widthFeet0",_.WIDTH_FEET_1="widthFeet1",_.WIDTH_FEET_2="widthFeet2",_.WIDTH_FEET_3="widthFeet3",_.WIDTH_FEET_4="widthFeet4",_.WIDTH_FEET_5="widthFeet5",_.WIDTH_YARDS_0="widthYards0",_.WIDTH_YARDS_1="widthYards1",_.WIDTH_YARDS_2="widthYards2",_.WIDTH_YARDS_3="widthYards3",_.WIDTH_YARDS_4="widthYards4",_.WIDTH_YARDS_5="widthYards5",_.HEIGHT_INCHES_0="heightInches0",_.HEIGHT_INCHES_1="heightInches1",_.HEIGHT_INCHES_2="heightInches2",_.HEIGHT_INCHES_3="heightInches3",_.HEIGHT_INCHES_4="heightInches4",_.HEIGHT_INCHES_5="heightInches5",_.HEIGHT_FEET_0="heightFeet0",_.HEIGHT_FEET_1="heightFeet1",_.HEIGHT_FEET_2="heightFeet2",_.HEIGHT_FEET_3="heightFeet3",_.HEIGHT_FEET_4="heightFeet4",_.HEIGHT_FEET_5="heightFeet5",_.HEIGHT_YARDS_0="heightYards0",_.HEIGHT_YARDS_1="heightYards1",_.HEIGHT_YARDS_2="heightYards2",_.HEIGHT_YARDS_3="heightYards3",_.HEIGHT_YARDS_4="heightYards4",_.HEIGHT_YARDS_5="heightYards5",_.GROSS_WEIGHT_KG_0="grossWeightKg0",_.GROSS_WEIGHT_KG_1="grossWeightKg1",_.GROSS_WEIGHT_KG_2="grossWeightKg2",_.GROSS_WEIGHT_KG_3="grossWeightKg3",_.GROSS_WEIGHT_KG_4="grossWeightKg4",_.GROSS_WEIGHT_KG_5="grossWeightKg5",_.LENGTH_METERS_LOG_0="lengthMetersLog0",_.LENGTH_METERS_LOG_1="lengthMetersLog1",_.LENGTH_METERS_LOG_2="lengthMetersLog2",_.LENGTH_METERS_LOG_3="lengthMetersLog3",_.LENGTH_METERS_LOG_4="lengthMetersLog4",_.LENGTH_METERS_LOG_5="lengthMetersLog5",_.WIDTH_METERS_LOG_0="widthMetersLog0",_.WIDTH_METERS_LOG_1="widthMetersLog1",_.WIDTH_METERS_LOG_2="widthMetersLog2",_.WIDTH_METERS_LOG_3="widthMetersLog3",_.WIDTH_METERS_LOG_4="widthMetersLog4",_.WIDTH_METERS_LOG_5="widthMetersLog5",_.HEIGHT_METERS_LOG_0="heightMetersLog0",_.HEIGHT_METERS_LOG_1="heightMetersLog1",_.HEIGHT_METERS_LOG_2="heightMetersLog2",_.HEIGHT_METERS_LOG_3="heightMetersLog3",_.HEIGHT_METERS_LOG_4="heightMetersLog4",_.HEIGHT_METERS_LOG_5="heightMetersLog5",_.AREA_SQUARE_INCHES_0="areaSquareInches0",_.AREA_SQUARE_INCHES_1="areaSquareInches1",_.AREA_SQUARE_INCHES_2="areaSquareInches2",_.AREA_SQUARE_INCHES_3="areaSquareInches3",_.AREA_SQUARE_INCHES_4="areaSquareInches4",_.AREA_SQUARE_INCHES_5="areaSquareInches5",_.AREA_SQUARE_FEET_0="areaSquareFeet0",_.AREA_SQUARE_FEET_1="areaSquareFeet1",_.AREA_SQUARE_FEET_2="areaSquareFeet2",_.AREA_SQUARE_FEET_3="areaSquareFeet3",_.AREA_SQUARE_FEET_4="areaSquareFeet4",_.AREA_SQUARE_FEET_5="areaSquareFeet5",_.AREA_SQUARE_YARDS_0="areaSquareYards0",_.AREA_SQUARE_YARDS_1="areaSquareYards1",_.AREA_SQUARE_YARDS_2="areaSquareYards2",_.AREA_SQUARE_YARDS_3="areaSquareYards3",_.AREA_SQUARE_YARDS_4="areaSquareYards4",_.AREA_SQUARE_YARDS_5="areaSquareYards5",_.AREA_SQUARE_METERS_LOG_0="areaSquareMetersLog0",_.AREA_SQUARE_METERS_LOG_1="areaSquareMetersLog1",_.AREA_SQUARE_METERS_LOG_2="areaSquareMetersLog2",_.AREA_SQUARE_METERS_LOG_3="areaSquareMetersLog3",_.AREA_SQUARE_METERS_LOG_4="areaSquareMetersLog4",_.AREA_SQUARE_METERS_LOG_5="areaSquareMetersLog5",_.NET_WEIGHT_OUNCES_0="netWeightOunces0",_.NET_WEIGHT_OUNCES_1="netWeightOunces1",_.NET_WEIGHT_OUNCES_2="netWeightOunces2",_.NET_WEIGHT_OUNCES_3="netWeightOunces3",_.NET_WEIGHT_OUNCES_4="netWeightOunces4",_.NET_WEIGHT_OUNCES_5="netWeightOunces5",_.NET_VOLUME_QUARTS_0="netVolumeQuarts0",_.NET_VOLUME_QUARTS_1="netVolumeQuarts1",_.NET_VOLUME_QUARTS_2="netVolumeQuarts2",_.NET_VOLUME_QUARTS_3="netVolumeQuarts3",_.NET_VOLUME_QUARTS_4="netVolumeQuarts4",_.NET_VOLUME_QUARTS_5="netVolumeQuarts5",_.NET_VOLUME_GALLONS_0="netVolumeGallons0",_.NET_VOLUME_GALLONS_1="netVolumeGallons1",_.NET_VOLUME_GALLONS_2="netVolumeGallons2",_.NET_VOLUME_GALLONS_3="netVolumeGallons3",_.NET_VOLUME_GALLONS_4="netVolumeGallons4",_.NET_VOLUME_GALLONS_5="netVolumeGallons5",_.VOLUME_CUBIC_INCHES_0="volumeCubicInches0",_.VOLUME_CUBIC_INCHES_1="volumeCubicInches1",_.VOLUME_CUBIC_INCHES_2="volumeCubicInches2",_.VOLUME_CUBIC_INCHES_3="volumeCubicInches3",_.VOLUME_CUBIC_INCHES_4="volumeCubicInches4",_.VOLUME_CUBIC_INCHES_5="volumeCubicInches5",_.VOLUME_CUBIC_FEET_0="volumeCubicFeet0",_.VOLUME_CUBIC_FEET_1="volumeCubicFeet1",_.VOLUME_CUBIC_FEET_2="volumeCubicFeet2",_.VOLUME_CUBIC_FEET_3="volumeCubicFeet3",_.VOLUME_CUBIC_FEET_4="volumeCubicFeet4",_.VOLUME_CUBIC_FEET_5="volumeCubicFeet5",_.VOLUME_CUBIC_YARDS_0="volumeCubicYards0",_.VOLUME_CUBIC_YARDS_1="volumeCubicYards1",_.VOLUME_CUBIC_YARDS_2="volumeCubicYards2",_.VOLUME_CUBIC_YARDS_3="volumeCubicYards3",_.VOLUME_CUBIC_YARDS_4="volumeCubicYards4",_.VOLUME_CUBIC_YARDS_5="volumeCubicYards5",_.VOLUME_CUBIC_METERS_LOG_0="volumeCubicMetersLog0",_.VOLUME_CUBIC_METERS_LOG_1="volumeCubicMetersLog1",_.VOLUME_CUBIC_METERS_LOG_2="volumeCubicMetersLog2",_.VOLUME_CUBIC_METERS_LOG_3="volumeCubicMetersLog3",_.VOLUME_CUBIC_METERS_LOG_4="volumeCubicMetersLog4",_.VOLUME_CUBIC_METERS_LOG_5="volumeCubicMetersLog5",_.GROSS_WEIGHT_LB_0="grossWeightLb0",_.GROSS_WEIGHT_LB_1="grossWeightLb1",_.GROSS_WEIGHT_LB_2="grossWeightLb2",_.GROSS_WEIGHT_LB_3="grossWeightLb3",_.GROSS_WEIGHT_LB_4="grossWeightLb4",_.GROSS_WEIGHT_LB_5="grossWeightLb5",_.LENGTH_INCHES_LOG_0="lengthInchesLog0",_.LENGTH_INCHES_LOG_1="lengthInchesLog1",_.LENGTH_INCHES_LOG_2="lengthInchesLog2",_.LENGTH_INCHES_LOG_3="lengthInchesLog3",_.LENGTH_INCHES_LOG_4="lengthInchesLog4",_.LENGTH_INCHES_LOG_5="lengthInchesLog5",_.LENGTH_FEET_LOG_0="lengthFeetLog0",_.LENGTH_FEET_LOG_1="lengthFeetLog1",_.LENGTH_FEET_LOG_2="lengthFeetLog2",_.LENGTH_FEET_LOG_3="lengthFeetLog3",_.LENGTH_FEET_LOG_4="lengthFeetLog4",_.LENGTH_FEET_LOG_5="lengthFeetLog5",_.LENGTH_YARDS_LOG_0="lengthYardsLog0",_.LENGTH_YARDS_LOG_1="lengthYardsLog1",_.LENGTH_YARDS_LOG_2="lengthYardsLog2",_.LENGTH_YARDS_LOG_3="lengthYardsLog3",_.LENGTH_YARDS_LOG_4="lengthYardsLog4",_.LENGTH_YARDS_LOG_5="lengthYardsLog5",_.WIDTH_INCHES_LOG_0="widthInchesLog0",_.WIDTH_INCHES_LOG_1="widthInchesLog1",_.WIDTH_INCHES_LOG_2="widthInchesLog2",_.WIDTH_INCHES_LOG_3="widthInchesLog3",_.WIDTH_INCHES_LOG_4="widthInchesLog4",_.WIDTH_INCHES_LOG_5="widthInchesLog5",_.WIDTH_FEET_LOG_0="widthFeetLog0",_.WIDTH_FEET_LOG_1="widthFeetLog1",_.WIDTH_FEET_LOG_2="widthFeetLog2",_.WIDTH_FEET_LOG_3="widthFeetLog3",_.WIDTH_FEET_LOG_4="widthFeetLog4",_.WIDTH_FEET_LOG_5="widthFeetLog5",_.WIDTH_YARDS_LOG_0="widthYardsLog0",_.WIDTH_YARDS_LOG_1="widthYardsLog1",_.WIDTH_YARDS_LOG_2="widthYardsLog2",_.WIDTH_YARDS_LOG_3="widthYardsLog3",_.WIDTH_YARDS_LOG_4="widthYardsLog4",_.WIDTH_YARDS_LOG_5="widthYardsLog5",_.HEIGHT_INCHES_LOG_0="heightInchesLog0",_.HEIGHT_INCHES_LOG_1="heightInchesLog1",_.HEIGHT_INCHES_LOG_2="heightInchesLog2",_.HEIGHT_INCHES_LOG_3="heightInchesLog3",_.HEIGHT_INCHES_LOG_4="heightInchesLog4",_.HEIGHT_INCHES_LOG_5="heightInchesLog5",_.HEIGHT_FEET_LOG_0="heightFeetLog0",_.HEIGHT_FEET_LOG_1="heightFeetLog1",_.HEIGHT_FEET_LOG_2="heightFeetLog2",_.HEIGHT_FEET_LOG_3="heightFeetLog3",_.HEIGHT_FEET_LOG_4="heightFeetLog4",_.HEIGHT_FEET_LOG_5="heightFeetLog5",_.HEIGHT_YARDS_LOG_0="heightYardsLog0",_.HEIGHT_YARDS_LOG_1="heightYardsLog1",_.HEIGHT_YARDS_LOG_2="heightYardsLog2",_.HEIGHT_YARDS_LOG_3="heightYardsLog3",_.HEIGHT_YARDS_LOG_4="heightYardsLog4",_.HEIGHT_YARDS_LOG_5="heightYardsLog5",_.GROSS_WEIGHT_OUNCES_0="grossWeightOunces0",_.GROSS_WEIGHT_OUNCES_1="grossWeightOunces1",_.GROSS_WEIGHT_OUNCES_2="grossWeightOunces2",_.GROSS_WEIGHT_OUNCES_3="grossWeightOunces3",_.GROSS_WEIGHT_OUNCES_4="grossWeightOunces4",_.GROSS_WEIGHT_OUNCES_5="grossWeightOunces5",_.NET_VOLUME_FLUID_OUNCES_0="netVolumeFluidOunces0",_.NET_VOLUME_FLUID_OUNCES_1="netVolumeFluidOunces1",_.NET_VOLUME_FLUID_OUNCES_2="netVolumeFluidOunces2",_.NET_VOLUME_FLUID_OUNCES_3="netVolumeFluidOunces3",_.NET_VOLUME_FLUID_OUNCES_4="netVolumeFluidOunces4",_.NET_VOLUME_FLUID_OUNCES_5="netVolumeFluidOunces5",_.GROSS_VOLUME_QUARTS_0="grossVolumeQuarts0",_.GROSS_VOLUME_QUARTS_1="grossVolumeQuarts1",_.GROSS_VOLUME_QUARTS_2="grossVolumeQuarts2",_.GROSS_VOLUME_QUARTS_3="grossVolumeQuarts3",_.GROSS_VOLUME_QUARTS_4="grossVolumeQuarts4",_.GROSS_VOLUME_QUARTS_5="grossVolumeQuarts5",_.GROSS_VOLUME_GALLONS_0="grossVolumeGallons0",_.GROSS_VOLUME_GALLONS_1="grossVolumeGallons1",_.GROSS_VOLUME_GALLONS_2="grossVolumeGallons2",_.GROSS_VOLUME_GALLONS_3="grossVolumeGallons3",_.GROSS_VOLUME_GALLONS_4="grossVolumeGallons4",_.GROSS_VOLUME_GALLONS_5="grossVolumeGallons5",_.VOLUME_CUBIC_INCHES_LOG_0="volumeCubicInchesLog0",_.VOLUME_CUBIC_INCHES_LOG_1="volumeCubicInchesLog1",_.VOLUME_CUBIC_INCHES_LOG_2="volumeCubicInchesLog2",_.VOLUME_CUBIC_INCHES_LOG_3="volumeCubicInchesLog3",_.VOLUME_CUBIC_INCHES_LOG_4="volumeCubicInchesLog4",_.VOLUME_CUBIC_INCHES_LOG_5="volumeCubicInchesLog5",_.VOLUME_CUBIC_FEET_LOG_0="volumeCubicFeetLog0",_.VOLUME_CUBIC_FEET_LOG_1="volumeCubicFeetLog1",_.VOLUME_CUBIC_FEET_LOG_2="volumeCubicFeetLog2",_.VOLUME_CUBIC_FEET_LOG_3="volumeCubicFeetLog3",_.VOLUME_CUBIC_FEET_LOG_4="volumeCubicFeetLog4",_.VOLUME_CUBIC_FEET_LOG_5="volumeCubicFeetLog5",_.VOLUME_CUBIC_YARDS_LOG_0="volumeCubicYardsLog0",_.VOLUME_CUBIC_YARDS_LOG_1="volumeCubicYardsLog1",_.VOLUME_CUBIC_YARDS_LOG_2="volumeCubicYardsLog2",_.VOLUME_CUBIC_YARDS_LOG_3="volumeCubicYardsLog3",_.VOLUME_CUBIC_YARDS_LOG_4="volumeCubicYardsLog4",_.VOLUME_CUBIC_YARDS_LOG_5="volumeCubicYardsLog5",_.COUNT="count",_.AMOUNT_PAYABLE_0="amountPayable0",_.AMOUNT_PAYABLE_1="amountPayable1",_.AMOUNT_PAYABLE_2="amountPayable2",_.AMOUNT_PAYABLE_3="amountPayable3",_.AMOUNT_PAYABLE_4="amountPayable4",_.AMOUNT_PAYABLE_5="amountPayable5",_.AMOUNT_PAYABLE_ISO_0="amountPayableISO0",_.AMOUNT_PAYABLE_ISO_1="amountPayableISO1",_.AMOUNT_PAYABLE_ISO_2="amountPayableISO2",_.AMOUNT_PAYABLE_ISO_3="amountPayableISO3",_.AMOUNT_PAYABLE_ISO_4="amountPayableISO4",_.AMOUNT_PAYABLE_ISO_5="amountPayableISO5",_.PRICE_0="price0",_.PRICE_1="price1",_.PRICE_2="price2",_.PRICE_3="price3",_.PRICE_ISO_0="priceISO0",_.PRICE_ISO_1="priceISO1",_.PRICE_ISO_2="priceISO2",_.PRICE_ISO_3="priceISO3",_.PERCENT_DISCOUNT_0="percentDiscount0",_.PERCENT_DISCOUNT_1="percentDiscount1",_.PERCENT_DISCOUNT_2="percentDiscount2",_.PERCENT_DISCOUNT_3="percentDiscount3",_.PRICE_PER_UNIT_MEASURE_0="pricePerUnitMeasure0",_.PRICE_PER_UNIT_MEASURE_1="pricePerUnitMeasure1",_.PRICE_PER_UNIT_MEASURE_2="pricePerUnitMeasure2",_.PRICE_PER_UNIT_MEASURE_3="pricePerUnitMeasure3",_.PRICE_PER_UNIT_MEASURE_4="pricePerUnitMeasure4",_.PRICE_PER_UNIT_MEASURE_5="pricePerUnitMeasure5",_.ORDER_NUMBER="orderNumber",_.GINC="ginc",_.GSIN="gsin",_.ROUTE="route",_.SHIP_TO="shipTo",_.BILL_TO="billTo",_.PURCHASE_FROM="purchaseFrom",_.SHIP_FOR="shipFor",_.LOC_NO="locNo",_.PAY_TO="payTo",_.PROD_SERV_LOC="prodServLoc",_.PARTY="party",_.SHIP_TO_POST="shipToPost",_.SHIP_TO_POST_ISO="shipToPostISO",_.ORIGIN="origin",_.COUNTRY_INITIAL_PROCESS="countryInitialProcess",_.COUNTRY_PROCESS="countryProcess",_.COUNTRY_DISASSEMBLY="countryDisassembly",_.COUNTRY_FULL_PROCESS="countryFullProcess",_.ORIGIN_SUBDIVISION="originSubdivision",_.NSN="nsn",_.MEAT_CUT="meatCut",_.EXPIRATION_DATE_TIME="expirationDateTime",_.ACTIVE_POTENCY="activePotency",_.CATCH_AREA="catchArea",_.FIRST_FREEZE_DATE="firstFreezeDate",_.HARVEST_DATE="harvestDate",_.AQUATIC_SPECIES="aquaticSpecies",_.FISHING_GEAR_TYPE="fishingGearType",_.PROD_METHOD="prodMethod",_.REFURB_LOT="refurbLot",_.FUNC_STAT="funcStat",_.REV_STAT="revStat",_.GIAI_ASSEMBLY="giaiAssembly",_.PROCESSOR="processor",_.PROCESSOR_2="processor2",_.PROCESSOR_3="processor3",_.PROCESSOR_4="processor4",_.PROCESSOR_5="processor5",_.PROCESSOR_6="processor6",_.PROCESSOR_7="processor7",_.PROCESSOR_8="processor8",_.PROCESSOR_9="processor9",_.PROCESSOR_10="processor10",_.UIC_EXT="uicExt",_.UFRGT_UNIT_TYPE="ufrgtUnitType",_.NHRN_PZN="nhrnPzn",_.NHRN_CIP="nhrnCip",_.NHRN_CN="nhrnCn",_.NHRN_DRN="nhrnDrn",_.NHRN_AIM="nhrnAim",_.NHRN_DNC="nhrnDnc",_.NHRN_AIC="nhrnAic",_.ROLL_PRODUCTS="rollProducts",_.CMT_NO="cmtNo",_.GRAI="grai",_.GIAI="giai",_.PRICE_PER_UNIT="pricePerUnit",_.ITIP="itip",_.IBAN="iban",_.PROD_TIME="prodTime",_.OPTICAL_SENSOR="opticalSensor",_.CPID="cpid",_.CPID_SERIAL="cpidSerial",_.VERSION="version",_.GMN="gmn",_.GSRN_PROVIDER="gsrnProvider",_.GSRN_RECIPIENT="gsrnRecipient",_.SRIN="srin",_.REF_NO="refNo",_.ITIP_CONTENT="itipContent",_.DIG_SIG="digSig",_.COUPON="coupon",_.POINTS="points",_.COUPON_EXTENDED="couponExtended",_.PRODUCT_URL="productURL",_.INTERNAL_1="internal1",_.INTERNAL_2="internal2",_.INTERNAL_3="internal3",_.INTERNAL_4="internal4",_.INTERNAL_5="internal5",_.INTERNAL_6="internal6",_.INTERNAL_7="internal7",_.INTERNAL_8="internal8",_.INTERNAL_9="internal9",_.INTERNAL_10="internal10",_))(c||{}),F={ai00:"sscc",ai01:"gtin",ai02:"content",ai10:"batch",ai11:"prodDate",ai12:"dueDate",ai13:"packDate",ai15:"bestBefore",ai16:"sellBy",ai17:"expDate",ai20:"variant",ai21:"serial",ai22:"hibcc",ai235:"tpx",ai240:"additionalProductID",ai241:"customerPartNumber",ai242:"madeToOrder",ai243:"packaging",ai250:"secondarySerialNumber",ai251:"refSource",ai253:"gdti",ai254:"glnExtension",ai255:"gcn",ai30:"variableCount",ai310:"netWeightKg0",ai3100:"netWeightKg0",ai3101:"netWeightKg1",ai3102:"netWeightKg2",ai3103:"netWeightKg3",ai3104:"netWeightKg4",ai3105:"netWeightKg5",ai3110:"lengthMeters0",ai3111:"lengthMeters1",ai3112:"lengthMeters2",ai3113:"lengthMeters3",ai3114:"lengthMeters4",ai3115:"lengthMeters5",ai3120:"widthMeters0",ai3121:"widthMeters1",ai3122:"widthMeters2",ai3123:"widthMeters3",ai3124:"widthMeters4",ai3125:"widthMeters5",ai3130:"heightMeters0",ai3131:"heightMeters1",ai3132:"heightMeters2",ai3133:"heightMeters3",ai3134:"heightMeters4",ai3135:"heightMeters5",ai3140:"areaSquareMeters0",ai3141:"areaSquareMeters1",ai3142:"areaSquareMeters2",ai3143:"areaSquareMeters3",ai3144:"areaSquareMeters4",ai3145:"areaSquareMeters5",ai3150:"netVolumeLiters0",ai3151:"netVolumeLiters1",ai3152:"netVolumeLiters2",ai3153:"netVolumeLiters3",ai3154:"netVolumeLiters4",ai3155:"netVolumeLiters5",ai3160:"netVolumeCubicMeters0",ai3161:"netVolumeCubicMeters1",ai3162:"netVolumeCubicMeters2",ai3163:"netVolumeCubicMeters3",ai3164:"netVolumeCubicMeters4",ai3165:"netVolumeCubicMeters5",ai3200:"netWeightLb0",ai3201:"netWeightLb1",ai3202:"netWeightLb2",ai3203:"netWeightLb3",ai3204:"netWeightLb4",ai3205:"netWeightLb5",ai3210:"lengthInches0",ai3211:"lengthInches1",ai3212:"lengthInches2",ai3213:"lengthInches3",ai3214:"lengthInches4",ai3215:"lengthInches5",ai3220:"lengthFeet0",ai3221:"lengthFeet1",ai3222:"lengthFeet2",ai3223:"lengthFeet3",ai3224:"lengthFeet4",ai3225:"lengthFeet5",ai3230:"lengthYards0",ai3231:"lengthYards1",ai3232:"lengthYards2",ai3233:"lengthYards3",ai3234:"lengthYards4",ai3235:"lengthYards5",ai3240:"widthInches0",ai3241:"widthInches1",ai3242:"widthInches2",ai3243:"widthInches3",ai3244:"widthInches4",ai3245:"widthInches5",ai3250:"widthFeet0",ai3251:"widthFeet1",ai3252:"widthFeet2",ai3253:"widthFeet3",ai3254:"widthFeet4",ai3255:"widthFeet5",ai3260:"widthYards0",ai3261:"widthYards1",ai3262:"widthYards2",ai3263:"widthYards3",ai3264:"widthYards4",ai3265:"widthYards5",ai3270:"heightInches0",ai3271:"heightInches1",ai3272:"heightInches2",ai3273:"heightInches3",ai3274:"heightInches4",ai3275:"heightInches5",ai3280:"heightFeet0",ai3281:"heightFeet1",ai3282:"heightFeet2",ai3283:"heightFeet3",ai3284:"heightFeet4",ai3285:"heightFeet5",ai3290:"heightYards0",ai3291:"heightYards1",ai3292:"heightYards2",ai3293:"heightYards3",ai3294:"heightYards4",ai3295:"heightYards5",ai3300:"grossWeightKg0",ai3301:"grossWeightKg1",ai3302:"grossWeightKg2",ai3303:"grossWeightKg3",ai3304:"grossWeightKg4",ai3305:"grossWeightKg5",ai3310:"lengthMetersLog0",ai3311:"lengthMetersLog1",ai3312:"lengthMetersLog2",ai3313:"lengthMetersLog3",ai3314:"lengthMetersLog4",ai3315:"lengthMetersLog5",ai3320:"widthMetersLog0",ai3321:"widthMetersLog1",ai3322:"widthMetersLog2",ai3323:"widthMetersLog3",ai3324:"widthMetersLog4",ai3325:"widthMetersLog5",ai3330:"heightMetersLog0",ai3331:"heightMetersLog1",ai3332:"heightMetersLog2",ai3333:"heightMetersLog3",ai3334:"heightMetersLog4",ai3335:"heightMetersLog5",ai3340:"areaSquareInches0",ai3341:"areaSquareInches1",ai3342:"areaSquareInches2",ai3343:"areaSquareInches3",ai3344:"areaSquareInches4",ai3345:"areaSquareInches5",ai3350:"areaSquareFeet0",ai3351:"areaSquareFeet1",ai3352:"areaSquareFeet2",ai3353:"areaSquareFeet3",ai3354:"areaSquareFeet4",ai3355:"areaSquareFeet5",ai3360:"areaSquareYards0",ai3361:"areaSquareYards1",ai3362:"areaSquareYards2",ai3363:"areaSquareYards3",ai3364:"areaSquareYards4",ai3365:"areaSquareYards5",ai3370:"areaSquareMetersLog0",ai3371:"areaSquareMetersLog1",ai3372:"areaSquareMetersLog2",ai3373:"areaSquareMetersLog3",ai3374:"areaSquareMetersLog4",ai3375:"areaSquareMetersLog5",ai3400:"netWeightOunces0",ai3401:"netWeightOunces1",ai3402:"netWeightOunces2",ai3403:"netWeightOunces3",ai3404:"netWeightOunces4",ai3405:"netWeightOunces5",ai3410:"netVolumeQuarts0",ai3411:"netVolumeQuarts1",ai3412:"netVolumeQuarts2",ai3413:"netVolumeQuarts3",ai3414:"netVolumeQuarts4",ai3415:"netVolumeQuarts5",ai3420:"netVolumeGallons0",ai3421:"netVolumeGallons1",ai3422:"netVolumeGallons2",ai3423:"netVolumeGallons3",ai3424:"netVolumeGallons4",ai3425:"netVolumeGallons5",ai3430:"volumeCubicInches0",ai3431:"volumeCubicInches1",ai3432:"volumeCubicInches2",ai3433:"volumeCubicInches3",ai3434:"volumeCubicInches4",ai3435:"volumeCubicInches5",ai3440:"volumeCubicFeet0",ai3441:"volumeCubicFeet1",ai3442:"volumeCubicFeet2",ai3443:"volumeCubicFeet3",ai3444:"volumeCubicFeet4",ai3445:"volumeCubicFeet5",ai3450:"volumeCubicYards0",ai3451:"volumeCubicYards1",ai3452:"volumeCubicYards2",ai3453:"volumeCubicYards3",ai3454:"volumeCubicYards4",ai3455:"volumeCubicYards5",ai3460:"volumeCubicMetersLog0",ai3461:"volumeCubicMetersLog1",ai3462:"volumeCubicMetersLog2",ai3463:"volumeCubicMetersLog3",ai3464:"volumeCubicMetersLog4",ai3465:"volumeCubicMetersLog5",ai3500:"grossWeightLb0",ai3501:"grossWeightLb1",ai3502:"grossWeightLb2",ai3503:"grossWeightLb3",ai3504:"grossWeightLb4",ai3505:"grossWeightLb5",ai3510:"lengthInchesLog0",ai3511:"lengthInchesLog1",ai3512:"lengthInchesLog2",ai3513:"lengthInchesLog3",ai3514:"lengthInchesLog4",ai3515:"lengthInchesLog5",ai3520:"lengthFeetLog0",ai3521:"lengthFeetLog1",ai3522:"lengthFeetLog2",ai3523:"lengthFeetLog3",ai3524:"lengthFeetLog4",ai3525:"lengthFeetLog5",ai3530:"lengthYardsLog0",ai3531:"lengthYardsLog1",ai3532:"lengthYardsLog2",ai3533:"lengthYardsLog3",ai3534:"lengthYardsLog4",ai3535:"lengthYardsLog5",ai3540:"widthInchesLog0",ai3541:"widthInchesLog1",ai3542:"widthInchesLog2",ai3543:"widthInchesLog3",ai3544:"widthInchesLog4",ai3545:"widthInchesLog5",ai3550:"widthFeetLog0",ai3551:"widthFeetLog1",ai3552:"widthFeetLog2",ai3553:"widthFeetLog3",ai3554:"widthFeetLog4",ai3555:"widthFeetLog5",ai3560:"widthYardsLog0",ai3561:"widthYardsLog1",ai3562:"widthYardsLog2",ai3563:"widthYardsLog3",ai3564:"widthYardsLog4",ai3565:"widthYardsLog5",ai3570:"heightInchesLog0",ai3571:"heightInchesLog1",ai3572:"heightInchesLog2",ai3573:"heightInchesLog3",ai3574:"heightInchesLog4",ai3575:"heightInchesLog5",ai3580:"heightFeetLog0",ai3581:"heightFeetLog1",ai3582:"heightFeetLog2",ai3583:"heightFeetLog3",ai3584:"heightFeetLog4",ai3585:"heightFeetLog5",ai3590:"heightYardsLog0",ai3591:"heightYardsLog1",ai3592:"heightYardsLog2",ai3593:"heightYardsLog3",ai3594:"heightYardsLog4",ai3595:"heightYardsLog5",ai3600:"grossWeightOunces0",ai3601:"grossWeightOunces1",ai3602:"grossWeightOunces2",ai3603:"grossWeightOunces3",ai3604:"grossWeightOunces4",ai3605:"grossWeightOunces5",ai3610:"netVolumeFluidOunces0",ai3611:"netVolumeFluidOunces1",ai3612:"netVolumeFluidOunces2",ai3613:"netVolumeFluidOunces3",ai3614:"netVolumeFluidOunces4",ai3615:"netVolumeFluidOunces5",ai3620:"grossVolumeQuarts0",ai3621:"grossVolumeQuarts1",ai3622:"grossVolumeQuarts2",ai3623:"grossVolumeQuarts3",ai3624:"grossVolumeQuarts4",ai3625:"grossVolumeQuarts5",ai3630:"grossVolumeGallons0",ai3631:"grossVolumeGallons1",ai3632:"grossVolumeGallons2",ai3633:"grossVolumeGallons3",ai3634:"grossVolumeGallons4",ai3635:"grossVolumeGallons5",ai3640:"volumeCubicInchesLog0",ai3641:"volumeCubicInchesLog1",ai3642:"volumeCubicInchesLog2",ai3643:"volumeCubicInchesLog3",ai3644:"volumeCubicInchesLog4",ai3645:"volumeCubicInchesLog5",ai3650:"volumeCubicFeetLog0",ai3651:"volumeCubicFeetLog1",ai3652:"volumeCubicFeetLog2",ai3653:"volumeCubicFeetLog3",ai3654:"volumeCubicFeetLog4",ai3655:"volumeCubicFeetLog5",ai3660:"volumeCubicYardsLog0",ai3661:"volumeCubicYardsLog1",ai3662:"volumeCubicYardsLog2",ai3663:"volumeCubicYardsLog3",ai3664:"volumeCubicYardsLog4",ai3665:"volumeCubicYardsLog5",ai37:"count",ai3900:"amountPayable0",ai3901:"amountPayable1",ai3902:"amountPayable2",ai3903:"amountPayable3",ai3904:"amountPayable4",ai3905:"amountPayable5",ai3910:"amountPayableISO0",ai3911:"amountPayableISO1",ai3912:"amountPayableISO2",ai3913:"amountPayableISO3",ai3914:"amountPayableISO4",ai3915:"amountPayableISO5",ai3920:"price0",ai3921:"price1",ai3922:"price2",ai3923:"price3",ai3930:"priceISO0",ai3931:"priceISO1",ai3932:"priceISO2",ai3933:"priceISO3",ai3940:"percentDiscount0",ai3941:"percentDiscount1",ai3942:"percentDiscount2",ai3943:"percentDiscount3",ai3950:"pricePerUnitMeasure0",ai3951:"pricePerUnitMeasure1",ai3952:"pricePerUnitMeasure2",ai3953:"pricePerUnitMeasure3",ai3954:"pricePerUnitMeasure4",ai3955:"pricePerUnitMeasure5",ai400:"orderNumber",ai401:"ginc",ai402:"gsin",ai403:"route",ai410:"shipTo",ai411:"billTo",ai412:"purchaseFrom",ai413:"shipFor",ai414:"locNo",ai415:"payTo",ai416:"prodServLoc",ai417:"party",ai420:"shipToPost",ai421:"shipToPostISO",ai422:"origin",ai423:"countryInitialProcess",ai424:"countryProcess",ai425:"countryDisassembly",ai426:"countryFullProcess",ai427:"originSubdivision",ai7001:"nsn",ai7002:"meatCut",ai7003:"expirationDateTime",ai7004:"activePotency",ai7005:"catchArea",ai7006:"firstFreezeDate",ai7007:"harvestDate",ai7008:"aquaticSpecies",ai7009:"fishingGearType",ai7010:"prodMethod",ai7020:"refurbLot",ai7021:"funcStat",ai7022:"revStat",ai7023:"giaiAssembly",ai7030:"processor",ai7031:"processor2",ai7032:"processor3",ai7033:"processor4",ai7034:"processor5",ai7035:"processor6",ai7036:"processor7",ai7037:"processor8",ai7038:"processor9",ai7039:"processor10",ai7040:"uicExt",ai7041:"ufrgtUnitType",ai710:"nhrnPzn",ai711:"nhrnCip",ai712:"nhrnCn",ai713:"nhrnDrn",ai714:"nhrnAim",ai715:"nhrnDnc",ai716:"nhrnAic",ai8001:"rollProducts",ai8002:"cmtNo",ai8003:"grai",ai8004:"giai",ai8005:"pricePerUnit",ai8006:"itip",ai8007:"iban",ai8008:"prodTime",ai8009:"opticalSensor",ai8010:"cpid",ai8011:"cpidSerial",ai8012:"version",ai8013:"gmn",ai8017:"gsrnProvider",ai8018:"gsrnRecipient",ai8019:"srin",ai8020:"refNo",ai8026:"itipContent",ai8030:"digSig",ai8110:"coupon",ai8111:"points",ai8112:"couponExtended",ai8200:"productURL",ai90:"internal1",ai91:"internal2",ai92:"internal3",ai93:"internal4",ai94:"internal5",ai95:"internal6",ai96:"internal7",ai97:"internal8",ai98:"internal9",ai99:"internal10"};var h=String.fromCodePoint(29),M=/^\d+$/;var n=class extends Error{static{N(this,"InternalError")}constructor(I,e){super(I),this.name="InternalError",this.code=I,this.ex=e}ex;code},L=class extends Error{static{N(this,"InvalidAiError")}constructor(I,e){let i;I?i=`Invalid AI identifier "${e}" after "${I}"`:i=`Invalid first AI identifier "${e}"`,super(i),this.name="InvalidAiError"}},H=class extends Error{static{N(this,"BarcodeError")}constructor(I,e,i){super(i),this.name="BarcodeError",this.num=I,this.code=e,this.des=i}num;code;des},A=class{static{N(this,"ParsedElementClass")}ai;dataTitle;data;dataString;unit;type="";constructor(I,e,i){switch(this.ai=I,this.dataTitle=e,this.unit="",this.dataString="",i){case"string":this.data="",this.type="string";break;case"number":this.data=0,this.type="number";break;case"date":this.data=new Date,this.data.setHours(0,0,0,0),this.type="date";break;default:this.data="";break}}},l=class{constructor(I,e,i={}){this.codeName=I;this.denormalized=e;this.data=i}static{N(this,"DecodeResult")}};function Y(E,I){let e=E,i=e.slice(0,1);for(;i===I;)e=e.slice(1),i=e.slice(0,1);return e}N(Y,"cleanCodestring");function W(E,I,e){if(I<0||I>11)return!1;let i=I;e===0&&i++;let S=new Date(E,i,e);return S.getFullYear()===E&&S.getMonth()===I&&(S.getDate()===e||e===0)}N(W,"checkValidDate");function P(E,I){let e=E.length-I,i=E.slice(0,e)+"."+E.slice(e);try{return Number.parseFloat(i)}catch(S){throw new n("36",S)}}N(P,"parseFloatingPoint");function U(E,I,e){let i=new A(E,I,"date"),S=E.length,T=e.slice(S,S+6),a=0,O=0,r=0;try{a=Number.parseInt(T.slice(0,2),10)}catch(s){throw new n("33",s)}try{O=Number.parseInt(T.slice(2,4),10)-1}catch(s){throw new n("34",s)}try{r=Number.parseInt(T.slice(4,6),10)}catch(s){throw new n("35",s)}if(a>50?a=a+1900:a=a+2e3,!W(a,O,r))throw new H(7,"36",`Invalid date "${T}" for AI "${E}".`);return r===0&&O++,i.data.setFullYear(a,O,r),i.dataString=T,{element:i,codestring:e.slice(S+6,e.length)}}N(U,"parseDate");function G(E,I,e,i,S=!1){let T=new A(E,I,"string"),a=E.length,O=i.slice(a,e+a);if(O.length<e)throw new H(9,"37",`Data length ${O.length} is less than expected length ${e} for AI "${E}".`);if(S&&!M.test(O))throw new H(11,"39",`Numeric data expected for AI "${E}", but got "${O}".`);T.data=O,T.dataString=O;let r=i.slice(e+a,i.length);return{element:T,codestring:r}}N(G,"parseFixedLength");function t(E,I,e,i,S,T=!1){let a=new A(E,I,"string"),O=E.length,r=e.indexOf(i),s="";if(r===-1?S&&S>0?(a.data=e.slice(O,S+O),s=e.replace(E+a.data,"")):a.data=e.slice(O,e.length):(a.data=e.slice(O,r),s=e.slice(r+1,e.length)),a.data==="")throw new H(10,"38",`Variable length data for AI "${E}" is empty.`);if(T&&!M.test(a.data))throw new H(11,"39",`Numeric data expected for AI "${E}", but got "${a.data}".`);return a.dataString=a.data,{element:a,codestring:s}}N(t,"parseVariableLength");function V(E,I,e,i,S,T){let a=new A(E+I,e,"number"),O=E.length+1,r=S.indexOf(T),s=Number.parseInt(I,10),u="",C="";return r===-1?u=S.slice(O,S.length):(u=S.slice(O,r),C=S.slice(r+1,S.length)),a.data=P(u,s),a.dataString=u,a.unit=i,{element:a,codestring:C}}N(V,"parseVariableLengthMeasure");function R(E,I,e,i,S){let T=new A(E+I,e,"number"),a=E.length+1;if(!M.test(I))throw new L(E,I);let O=Number.parseInt(I,10),r=S.slice(a,a+6);if(!M.test(r))throw new H(11,"39",`Numeric data expected for AI "${E+I}", but got "${r}".`);T.data=P(r,O),T.dataString=r,T.unit=i;let s=S.slice(a+6,S.length);return{element:T,codestring:s}}N(R,"parseFixedLengthMeasure");function m(E,I,e,i,S){let T=new A(E+I,e,"number"),a=E.length+1,O=i.indexOf(S),r=Number.parseInt(I,10),s="",u="",C="";return O===-1?s=i.slice(a,i.length):(s=i.slice(a,O),C=i.slice(O+1,i.length)),u=s.slice(3,s.length),T.data=P(u,r),T.dataString=u,T.unit=s.slice(0,3),{element:T,codestring:C}}N(m,"parseVariableLengthWithISONumbers");function g(E,I,e,i){let S=new A(E,I,"string"),T=E.length,a=e.indexOf(i),O="",r="";return a===-1?O=e.slice(T,e.length):(O=e.slice(T,a),r=e.slice(a+1,e.length)),S.data=O.slice(3,O.length),S.unit=O.slice(0,3),S.dataString=O,{element:S,codestring:r}}N(g,"parseVariableLengthWithISOChars");function v(E,I,e){e||(e=h);let i=E.slice(0,1),S=E.slice(1,2),T="",a="";switch(i){case"0":switch(S){case"0":return G("00","SSCC",18,E,!0);case"1":return G("01","GTIN",14,E,!0);case"2":return G("02","CONTENT",14,E);case"3":return G("03","MTO GTIN",14,E);default:throw new L("0",S)}case"1":switch(S){case"0":return t("10","BATCH/LOT",E,e,I??20);case"1":return U("11","PROD DATE",E);case"2":return U("12","DUE DATE",E);case"3":return U("13","PACK DATE",E);case"5":return U("15","BEST BEFORE or BEST BY",E);case"6":return U("16","SELL BY",E);case"7":return U("17","USE BY OR EXPIRY",E);default:throw new L("1",S)}case"2":switch(S){case"0":return G("20","VARIANT",2,E);case"1":return t("21","SERIAL",E,e,I??20);case"2":return t("22","CPV",E,e,20);case"3":switch(T=E.slice(2,3),T){case"5":return t("235","TPX",E,e,28);default:throw new L("23",T)}case"4":switch(T=E.slice(2,3),T){case"0":return t("240","ADDITIONAL ID",E,e,30);case"1":return t("241","CUST. PART NO.",E,e,30);case"2":return t("242","MTO VARIANT",E,e,6,!0);case"3":return t("243","PCN",E,e,20);default:throw new L("24",T)}case"5":switch(T=E.slice(2,3),T){case"0":return t("250","SECONDARY SERIAL",E,e,30);case"1":return t("251","REF. TO SOURCE",E,e,30);case"3":return t("253","GDTI",E,e,42);case"4":return t("254","GLN EXTENSION COMPONENT",E,e,20);case"5":return t("255","GCN",E,e,25,!0);default:throw new L("25",T)}default:throw new L("2",S)}case"3":switch(S){case"0":return t("30","VAR. COUNT",E,e,8,!0);case"1":switch(T=E.slice(2,3),a=E.slice(3,4),T){case"0":return R("310",a,"NET WEIGHT (kg)","KGM",E);case"1":return R("311",a,"LENGTH (m)","MTR",E);case"2":return R("312",a,"WIDTH (m)","MTR",E);case"3":return R("313",a,"HEIGHT (m)","MTR",E);case"4":return R("314",a,"AREA (m2)","MTK",E);case"5":return R("315",a,"NET VOLUME (l)","LTR",E);case"6":return R("316",a,"NET VOLUME (m3)","MTQ",E);default:throw new L("31",T)}case"2":switch(T=E.slice(2,3),a=E.slice(3,4),T){case"0":return R("320",a,"NET WEIGHT (lb)","LBR",E);case"1":return R("321",a,"LENGTH (i)","INH",E);case"2":return R("322",a,"LENGTH (f)","FOT",E);case"3":return R("323",a,"LENGTH (y)","YRD",E);case"4":return R("324",a,"WIDTH (i)","INH",E);case"5":return R("325",a,"WIDTH (f)","FOT",E);case"6":return R("326",a,"WIDTH (y)","YRD",E);case"7":return R("327",a,"HEIGHT (i)","INH",E);case"8":return R("328",a,"HEIGHT (f)","FOT",E);case"9":return R("329",a,"HEIGHT (y)","YRD",E);default:throw new L("32",T)}case"3":switch(T=E.slice(2,3),a=E.slice(3,4),T){case"0":return R("330",a,"GROSS WEIGHT (kg)","KGM",E);case"1":return R("331",a,"LENGTH (m), log","MTR",E);case"2":return R("332",a,"WIDTH (m), log","MTR",E);case"3":return R("333",a,"HEIGHT (m), log","MTR",E);case"4":return R("334",a,"AREA (m2), log","MTK",E);case"5":return R("335",a,"VOLUME (l), log","LTR",E);case"6":return R("336",a,"VOLUME (m3), log","MTQ",E);case"7":return R("337",a,"KG PER m\xB2","28",E);default:throw new L("33",T)}case"4":switch(T=E.slice(2,3),a=E.slice(3,4),T){case"0":return R("340",a,"GROSS WEIGHT (lb)","LBR",E);case"1":return R("341",a,"LENGTH (i), log","INH",E);case"2":return R("342",a,"LENGTH (f), log","FOT",E);case"3":return R("343",a,"LENGTH (y), log","YRD",E);case"4":return R("344",a,"WIDTH (i), log","INH",E);case"5":return R("345",a,"WIDTH (f), log","FOT",E);case"6":return R("346",a,"WIDTH (y), log","YRD",E);case"7":return R("347",a,"HEIGHT (i), log","INH",E);case"8":return R("348",a,"HEIGHT (f), log","FOT",E);case"9":return R("349",a,"HEIGHT (y), log","YRD",E);default:throw new L("33",T)}case"5":switch(T=E.slice(2,3),a=E.slice(3,4),T){case"0":return R("350",a,"AREA (i2)","INK",E);case"1":return R("351",a,"AREA (f2)","FTK",E);case"2":return R("352",a,"AREA (y2)","YDK",E);case"3":return R("353",a,"AREA (i2), log","INK",E);case"4":return R("354",a,"AREA (f2), log","FTK",E);case"5":return R("355",a,"AREA (y2), log","YDK",E);case"6":return R("356",a,"NET WEIGHT (t)","APZ",E);case"7":return R("357",a,"NET VOLUME (oz)","ONZ",E);default:throw new L("35",T)}case"6":switch(T=E.slice(2,3),a=E.slice(3,4),T){case"0":return R("360",a,"NET VOLUME (q)","QT",E);case"1":return R("361",a,"NET VOLUME (g)","GLL",E);case"2":return R("362",a,"VOLUME (q), log","QT",E);case"3":return R("363",a,"VOLUME (g), log","GLL",E);case"4":return R("364",a,"VOLUME (i3)","INQ",E);case"5":return R("365",a,"VOLUME (f3)","FTQ",E);case"6":return R("366",a,"VOLUME (y3)","YDQ",E);case"7":return R("367",a,"VOLUME (i3), log","INQ",E);case"8":return R("368",a,"VOLUME (f3), log","FTQ",E);case"9":return R("369",a,"VOLUME (y3), log","YDQ",E);default:throw new L("36",T)}case"7":return t("37","COUNT",E,e,8);case"9":switch(T=E.slice(2,3),a=E.slice(3,4),T){case"0":return V("390",a,"AMOUNT","",E,e);case"1":return m("391",a,"AMOUNT",E,e);case"2":return V("392",a,"PRICE","",E,e);case"3":return m("393",a,"PRICE",E,e);default:throw new L("39",T)}default:throw new L("3",S)}case"4":switch(S){case"0":switch(T=E.slice(2,3),T){case"0":return t("400","ORDER NUMBER",E,e,30);case"1":return t("401","GINC",E,e);case"2":return t("402","GSIN",E,e,17,!0);case"3":return t("403","ROUTE",E,e,30);default:throw new L("40",T)}case"1":switch(T=E.slice(2,3),T){case"0":return G("410","SHIP TO LOC",13,E,!0);case"1":return G("411","BILL TO",13,E,!0);case"2":return G("412","PURCHASE FROM",13,E,!0);case"3":return G("413","SHIP FOR LOC",13,E,!0);case"4":return G("414","LOC NO",13,E,!0);case"5":return G("415","PAY TO",13,E,!0);case"6":return G("416","PROD/SERV LOC",13,E,!0);case"7":return G("417","PARTY",13,E,!0);default:throw new L("41",T)}case"2":switch(T=E.slice(2,3),T){case"0":return t("420","SHIP TO POST",E,e,20);case"1":return g("421","SHIP TO POST",E,e);case"2":return G("422","ORIGIN",3,E,!0);case"3":return t("423","COUNTRY - INITIAL PROCESS.",E,e,15);case"4":return G("424","COUNTRY - PROCESS.",3,E,!0);case"5":return G("425","COUNTRY - DISASSEMBLY",3,E,!0);case"6":return G("426","COUNTRY - FULL PROCESS",3,E,!0);case"7":return t("427","ORIGIN SUBDIVISION",E,e,3);default:throw new L("42",T)}default:throw new L("4",S)}case"7":switch(S){case"0":switch(T=E.slice(2,3),a=E.slice(3,4),T){case"0":switch(a){case"1":return t("7001","NSN",E,e,13,!0);case"2":return t("7002","MEAT CUT",E,e);case"3":return t("7003","EXPIRY TIME",E,e,10,!0);case"4":return t("7004","ACTIVE POTENCY",E,e,4,!0);case"5":return t("7005","CATCH AREA",E,e,12);case"6":return U("7006","FIRST FREEZE DATE",E);case"7":return t("7007","HARVEST DATE",E,e,12,!0);case"8":return t("7008","AQUATIC SPECIES",E,e,3);case"9":return t("7009","FISHING GEAR TYPE",E,e,10);default:throw new L("700",a)}case"1":switch(a){case"0":return t("7010","PROD METHOD",E,e,2);case"1":return t("7011","TEST BY DATE",E,e,10,!0);default:throw new L("701",a)}case"2":switch(a){case"0":return t("7020","REFURB LOT",E,e,20);case"1":return t("7021","FUNC STAT",E,e,20);case"2":return t("7022","REV STAT",E,e,20);case"3":return t("7023","GIAI - ASSEMBLY",E,e,30);default:throw new L("702",a)}case"3":return g("703"+a,"PROCESSOR # "+a,E,e);default:throw new L("70",T)}case"1":switch(T=E.slice(2,3),T){case"0":return t("710","NHRN PZN",E,e);case"1":return t("711","NHRN CIP",E,e);case"2":return t("712","NHRN CN",E,e);case"3":return t("713","NHRN DRN",E,e);case"4":return t("714","NHRN AIM",E,e);case"5":return t("715","NHRN NDC",E,e);case"6":return t("716","NHRN AIC",E,e);default:throw new L("71",T)}default:throw new L("7",S)}case"8":switch(S){case"0":switch(T=E.slice(2,3),a=E.slice(3,4),T){case"0":switch(a){case"1":return t("8001","DIMENSIONS",E,e,14);case"2":return t("8002","CMT No",E,e);case"3":return t("8003","GRAI",E,e);case"4":return t("8004","GIAI",E,e);case"5":return t("8005","PRICE PER UNIT",E,e,6);case"6":return t("8006","GCTIN",E,e,18);case"7":return t("8007","IBAN",E,e);case"8":return t("8008","PROD TIME",E,e,12);default:throw new L("800",a)}case"1":switch(a){case"0":return t("8010","CPID",E,e);case"1":return t("8011","CPID SERIAL",E,e);case"7":return t("8017","GSRN - PROVIDER",E,e,18);case"8":return t("8018","GSRN - RECIPIENT",E,e,18,!0);case"9":return t("8019","SRIN",E,e,void 0,!0);default:throw new L("801",a)}case"2":switch(a){case"0":return t("8020","REF No",E,e);case"6":return t("8026","ITIP CONTENT",E,e,18,!0);default:throw new L("802",a)}case"3":switch(a){case"0":return t("8030","DIGSIG",E,e);default:throw new L("803",a)}default:throw new L("80",T)}case"1":switch(T=E.slice(2,3),a=E.slice(3,4),T){case"1":switch(a){case"0":return t("8110","-",E,e);case"1":return t("8111","POINTS",E,e,4,!0);case"2":return t("8112","-",E,e);default:throw new L("811",a)}default:throw new L("81",T)}case"2":switch(T=E.slice(2,3),T){case"0":return t("8200","PRODUCT URL",E,e);default:throw new L("82",T)}default:throw new L("8",S)}case"9":switch(S){case"0":return t("90","INTERNAL",E,e,30);case"1":return t("91","INTERNAL",E,e);case"2":return t("92","INTERNAL",E,e);case"3":return t("93","INTERNAL",E,e);case"4":return t("94","INTERNAL",E,e);case"5":return t("95","INTERNAL",E,e);case"6":return t("96","INTERNAL",E,e);case"7":return t("97","INTERNAL",E,e);case"8":return t("98","INTERNAL",E,e);case"9":return t("99","INTERNAL",E,e);default:throw new L("9",S)}default:throw new L("",i)}}N(v,"identifyAI");function w(E,I,e){if(!E||typeof E!="string")throw new H(2,"31","The barcode is empty or not a string.");let i=E.length,S={codeName:"",denormalized:"",parsedCodeItems:[]},T="",a=E.slice(0,3),O;switch(a){case"]C1":S.codeName="GS1-128",T=E.slice(3,i);break;case"]e0":S.codeName="GS1 DataBar",T=E.slice(3,i);break;case"]e1":case"]e2":S.codeName="GS1 Composite",T=E.slice(3,i);break;case"]d2":S.codeName="GS1 DataMatrix",T=E.slice(3,i);break;case"]Q3":S.codeName="GS1 QR Code",T=E.slice(3,i);break;default:S.codeName="",T=E;break}for(S.parsedCodeItems=[];T.length>0;)try{O=v(T,e),T=Y(O.codestring,I),S.parsedCodeItems.push(O.element),S.denormalized+="("+O.element.ai+")"+O.element.dataString}catch(r){if(r instanceof n)x(r);else throw r}return S}N(w,"parseBarcode");function x(E){switch(E.code){case"32":throw new H(6,32,"Invalid normal AI.");case"33":throw new H(7,33,"The year of the date is not valid.");case"34":throw new H(7,34,"The month of the date is not valid.");case"36":throw new H(8,36,"Invalid numbers");default:throw E}}N(x,"handleInternalError");var o=class{static{N(this,"GS1Parser")}fncChar;lotLen;constructor(I){this.fncChar=I?.fncChar||h,this.lotLen=I?.lotMaxLength}decode(I){let e=I.replaceAll("(",this.fncChar).replaceAll(")","");e.startsWith(this.fncChar)&&(e=e.slice(1));let i=w(e,this.fncChar,this.lotLen),S={};for(let T of i.parsedCodeItems){let a=F["ai"+T.ai];a&&(S[a]=T)}return new l(i.codeName,i.denormalized,S)}};0&&(module.exports={DecodeResult,GS1Field,GS1Parser});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
type GS1DecodedData = string | number | Date;
|
|
2
|
-
interface ParsedElement {
|
|
3
|
-
ai: string;
|
|
4
|
-
dataTitle: string;
|
|
5
|
-
data: GS1DecodedData;
|
|
6
|
-
dataString: string;
|
|
7
|
-
unit: string;
|
|
8
|
-
}
|
|
9
|
-
interface ParserOptions {
|
|
10
|
-
fncChar?: string;
|
|
11
|
-
lotMaxLength?: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
1
|
declare enum GS1Field {
|
|
15
2
|
SSCC = "sscc",
|
|
16
3
|
GTIN = "gtin",
|
|
@@ -406,6 +393,14 @@ declare enum GS1Field {
|
|
|
406
393
|
PROCESSOR_9 = "processor9",
|
|
407
394
|
PROCESSOR_10 = "processor10",
|
|
408
395
|
UIC_EXT = "uicExt",
|
|
396
|
+
UFRGT_UNIT_TYPE = "ufrgtUnitType",
|
|
397
|
+
NHRN_PZN = "nhrnPzn",
|
|
398
|
+
NHRN_CIP = "nhrnCip",
|
|
399
|
+
NHRN_CN = "nhrnCn",
|
|
400
|
+
NHRN_DRN = "nhrnDrn",
|
|
401
|
+
NHRN_AIM = "nhrnAim",
|
|
402
|
+
NHRN_DNC = "nhrnDnc",
|
|
403
|
+
NHRN_AIC = "nhrnAic",
|
|
409
404
|
ROLL_PRODUCTS = "rollProducts",
|
|
410
405
|
CMT_NO = "cmtNo",
|
|
411
406
|
GRAI = "grai",
|
|
@@ -424,10 +419,10 @@ declare enum GS1Field {
|
|
|
424
419
|
SRIN = "srin",
|
|
425
420
|
REF_NO = "refNo",
|
|
426
421
|
ITIP_CONTENT = "itipContent",
|
|
422
|
+
DIG_SIG = "digSig",
|
|
427
423
|
COUPON = "coupon",
|
|
424
|
+
POINTS = "points",
|
|
428
425
|
COUPON_EXTENDED = "couponExtended",
|
|
429
|
-
COUPON_EXTENDED_2 = "couponExtended2",
|
|
430
|
-
COUPON_EXTENDED_3 = "couponExtended3",
|
|
431
426
|
PRODUCT_URL = "productURL",
|
|
432
427
|
INTERNAL_1 = "internal1",
|
|
433
428
|
INTERNAL_2 = "internal2",
|
|
@@ -441,24 +436,82 @@ declare enum GS1Field {
|
|
|
441
436
|
INTERNAL_10 = "internal10"
|
|
442
437
|
}
|
|
443
438
|
|
|
439
|
+
declare enum ElementType {
|
|
440
|
+
S = "string",
|
|
441
|
+
N = "number",
|
|
442
|
+
D = "date",
|
|
443
|
+
UNDEFINED = ""
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* The result returned by {@link GS1Parser#decode}
|
|
447
|
+
*/
|
|
444
448
|
declare class DecodeResult {
|
|
449
|
+
/**
|
|
450
|
+
* A barcode type identifier (a simple string denoting the type of barcode)
|
|
451
|
+
*/
|
|
445
452
|
codeName: string;
|
|
453
|
+
/**
|
|
454
|
+
* Human readable full barcode, with parentheses surrounding AIs
|
|
455
|
+
*/
|
|
446
456
|
denormalized: string;
|
|
447
|
-
|
|
448
|
-
|
|
457
|
+
/**
|
|
458
|
+
* The actual parsed data, presented in a dictionary
|
|
459
|
+
*/
|
|
460
|
+
data: Partial<Record<GS1Field, ParsedElement<GS1DecodedData>>>;
|
|
461
|
+
constructor(
|
|
462
|
+
/**
|
|
463
|
+
* A barcode type identifier (a simple string denoting the type of barcode)
|
|
464
|
+
*/
|
|
465
|
+
codeName: string,
|
|
466
|
+
/**
|
|
467
|
+
* Human readable full barcode, with parentheses surrounding AIs
|
|
468
|
+
*/
|
|
469
|
+
denormalized: string,
|
|
470
|
+
/**
|
|
471
|
+
* The actual parsed data, presented in a dictionary
|
|
472
|
+
*/
|
|
473
|
+
data?: Partial<Record<GS1Field, ParsedElement<GS1DecodedData>>>);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
type GS1DecodedData = string | number | Date;
|
|
477
|
+
interface ParsedElement<T> {
|
|
478
|
+
ai: string;
|
|
479
|
+
dataTitle: string;
|
|
480
|
+
data: T;
|
|
481
|
+
dataString: string;
|
|
482
|
+
unit: string;
|
|
483
|
+
type: ElementType;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Options that tweak the parser's behavior
|
|
487
|
+
*/
|
|
488
|
+
interface ParserOptions {
|
|
489
|
+
/**
|
|
490
|
+
* The FNC1 character, a non-printable special character that delimits fields of variable length.
|
|
491
|
+
* If not specified, the GS char (\x1D) is used
|
|
492
|
+
*/
|
|
493
|
+
fncChar?: string;
|
|
494
|
+
/**
|
|
495
|
+
* The lot (or batch) field is usually delimited by a FNC1 char, but you can limit its size to a specific length.
|
|
496
|
+
* If not specified, no limit is applied, except the one in the GS1 specs
|
|
497
|
+
*/
|
|
498
|
+
lotMaxLength?: number;
|
|
449
499
|
}
|
|
450
500
|
|
|
451
501
|
declare class GS1Parser {
|
|
452
|
-
fncChar: string;
|
|
453
|
-
lotLen?: number;
|
|
502
|
+
protected fncChar: string;
|
|
503
|
+
protected lotLen?: number;
|
|
454
504
|
/**
|
|
455
505
|
* Builds a GS1 barcode parser
|
|
456
|
-
* @param options
|
|
457
|
-
* @param options.fncChar The function character used as a separator in variable length fields. Default is ASCII 29 (Group Separator).
|
|
458
|
-
* @param options.lotMaxLength The maximum length for lot/batch numbers. If not provided, no maximum length is enforced.
|
|
506
|
+
* @param options Barcode parser options
|
|
459
507
|
*/
|
|
460
508
|
constructor(options?: ParserOptions);
|
|
509
|
+
/**
|
|
510
|
+
* Performs the actual parsing
|
|
511
|
+
* @param barcode The barcode to be parsed
|
|
512
|
+
* @returns Parsed data
|
|
513
|
+
*/
|
|
461
514
|
decode(barcode: string): DecodeResult;
|
|
462
515
|
}
|
|
463
516
|
|
|
464
|
-
export { GS1Parser };
|
|
517
|
+
export { DecodeResult, type GS1DecodedData, GS1Field, GS1Parser, type ParsedElement, type ParserOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
type GS1DecodedData = string | number | Date;
|
|
2
|
-
interface ParsedElement {
|
|
3
|
-
ai: string;
|
|
4
|
-
dataTitle: string;
|
|
5
|
-
data: GS1DecodedData;
|
|
6
|
-
dataString: string;
|
|
7
|
-
unit: string;
|
|
8
|
-
}
|
|
9
|
-
interface ParserOptions {
|
|
10
|
-
fncChar?: string;
|
|
11
|
-
lotMaxLength?: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
1
|
declare enum GS1Field {
|
|
15
2
|
SSCC = "sscc",
|
|
16
3
|
GTIN = "gtin",
|
|
@@ -406,6 +393,14 @@ declare enum GS1Field {
|
|
|
406
393
|
PROCESSOR_9 = "processor9",
|
|
407
394
|
PROCESSOR_10 = "processor10",
|
|
408
395
|
UIC_EXT = "uicExt",
|
|
396
|
+
UFRGT_UNIT_TYPE = "ufrgtUnitType",
|
|
397
|
+
NHRN_PZN = "nhrnPzn",
|
|
398
|
+
NHRN_CIP = "nhrnCip",
|
|
399
|
+
NHRN_CN = "nhrnCn",
|
|
400
|
+
NHRN_DRN = "nhrnDrn",
|
|
401
|
+
NHRN_AIM = "nhrnAim",
|
|
402
|
+
NHRN_DNC = "nhrnDnc",
|
|
403
|
+
NHRN_AIC = "nhrnAic",
|
|
409
404
|
ROLL_PRODUCTS = "rollProducts",
|
|
410
405
|
CMT_NO = "cmtNo",
|
|
411
406
|
GRAI = "grai",
|
|
@@ -424,10 +419,10 @@ declare enum GS1Field {
|
|
|
424
419
|
SRIN = "srin",
|
|
425
420
|
REF_NO = "refNo",
|
|
426
421
|
ITIP_CONTENT = "itipContent",
|
|
422
|
+
DIG_SIG = "digSig",
|
|
427
423
|
COUPON = "coupon",
|
|
424
|
+
POINTS = "points",
|
|
428
425
|
COUPON_EXTENDED = "couponExtended",
|
|
429
|
-
COUPON_EXTENDED_2 = "couponExtended2",
|
|
430
|
-
COUPON_EXTENDED_3 = "couponExtended3",
|
|
431
426
|
PRODUCT_URL = "productURL",
|
|
432
427
|
INTERNAL_1 = "internal1",
|
|
433
428
|
INTERNAL_2 = "internal2",
|
|
@@ -441,24 +436,82 @@ declare enum GS1Field {
|
|
|
441
436
|
INTERNAL_10 = "internal10"
|
|
442
437
|
}
|
|
443
438
|
|
|
439
|
+
declare enum ElementType {
|
|
440
|
+
S = "string",
|
|
441
|
+
N = "number",
|
|
442
|
+
D = "date",
|
|
443
|
+
UNDEFINED = ""
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* The result returned by {@link GS1Parser#decode}
|
|
447
|
+
*/
|
|
444
448
|
declare class DecodeResult {
|
|
449
|
+
/**
|
|
450
|
+
* A barcode type identifier (a simple string denoting the type of barcode)
|
|
451
|
+
*/
|
|
445
452
|
codeName: string;
|
|
453
|
+
/**
|
|
454
|
+
* Human readable full barcode, with parentheses surrounding AIs
|
|
455
|
+
*/
|
|
446
456
|
denormalized: string;
|
|
447
|
-
|
|
448
|
-
|
|
457
|
+
/**
|
|
458
|
+
* The actual parsed data, presented in a dictionary
|
|
459
|
+
*/
|
|
460
|
+
data: Partial<Record<GS1Field, ParsedElement<GS1DecodedData>>>;
|
|
461
|
+
constructor(
|
|
462
|
+
/**
|
|
463
|
+
* A barcode type identifier (a simple string denoting the type of barcode)
|
|
464
|
+
*/
|
|
465
|
+
codeName: string,
|
|
466
|
+
/**
|
|
467
|
+
* Human readable full barcode, with parentheses surrounding AIs
|
|
468
|
+
*/
|
|
469
|
+
denormalized: string,
|
|
470
|
+
/**
|
|
471
|
+
* The actual parsed data, presented in a dictionary
|
|
472
|
+
*/
|
|
473
|
+
data?: Partial<Record<GS1Field, ParsedElement<GS1DecodedData>>>);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
type GS1DecodedData = string | number | Date;
|
|
477
|
+
interface ParsedElement<T> {
|
|
478
|
+
ai: string;
|
|
479
|
+
dataTitle: string;
|
|
480
|
+
data: T;
|
|
481
|
+
dataString: string;
|
|
482
|
+
unit: string;
|
|
483
|
+
type: ElementType;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Options that tweak the parser's behavior
|
|
487
|
+
*/
|
|
488
|
+
interface ParserOptions {
|
|
489
|
+
/**
|
|
490
|
+
* The FNC1 character, a non-printable special character that delimits fields of variable length.
|
|
491
|
+
* If not specified, the GS char (\x1D) is used
|
|
492
|
+
*/
|
|
493
|
+
fncChar?: string;
|
|
494
|
+
/**
|
|
495
|
+
* The lot (or batch) field is usually delimited by a FNC1 char, but you can limit its size to a specific length.
|
|
496
|
+
* If not specified, no limit is applied, except the one in the GS1 specs
|
|
497
|
+
*/
|
|
498
|
+
lotMaxLength?: number;
|
|
449
499
|
}
|
|
450
500
|
|
|
451
501
|
declare class GS1Parser {
|
|
452
|
-
fncChar: string;
|
|
453
|
-
lotLen?: number;
|
|
502
|
+
protected fncChar: string;
|
|
503
|
+
protected lotLen?: number;
|
|
454
504
|
/**
|
|
455
505
|
* Builds a GS1 barcode parser
|
|
456
|
-
* @param options
|
|
457
|
-
* @param options.fncChar The function character used as a separator in variable length fields. Default is ASCII 29 (Group Separator).
|
|
458
|
-
* @param options.lotMaxLength The maximum length for lot/batch numbers. If not provided, no maximum length is enforced.
|
|
506
|
+
* @param options Barcode parser options
|
|
459
507
|
*/
|
|
460
508
|
constructor(options?: ParserOptions);
|
|
509
|
+
/**
|
|
510
|
+
* Performs the actual parsing
|
|
511
|
+
* @param barcode The barcode to be parsed
|
|
512
|
+
* @returns Parsed data
|
|
513
|
+
*/
|
|
461
514
|
decode(barcode: string): DecodeResult;
|
|
462
515
|
}
|
|
463
516
|
|
|
464
|
-
export { GS1Parser };
|
|
517
|
+
export { DecodeResult, type GS1DecodedData, GS1Field, GS1Parser, type ParsedElement, type ParserOptions };
|