summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--192x192.pngbin0 -> 941 bytes
-rw-r--r--512x512.pngbin0 -> 2009 bytes
-rw-r--r--courbd.ttfbin0 -> 710192 bytes
-rw-r--r--favicon.icobin0 -> 99940 bytes
-rw-r--r--favicon.pngbin0 -> 208 bytes
-rw-r--r--index - Copy.html241
-rw-r--r--index.html241
-rw-r--r--iso-8859-2.js154
-rw-r--r--manifest.json27
-rw-r--r--myriadpro-semibold.otfbin0 -> 95616 bytes
-rw-r--r--myriadpro.otfbin0 -> 94360 bytes
-rw-r--r--qr.html121
-rw-r--r--qrcode.js5414
-rw-r--r--qrcode.tosjis.js106
-rw-r--r--sw - Copy.js46
-rw-r--r--sw.js46
-rw-r--r--upn.html36
-rw-r--r--upn.svg225
18 files changed, 6657 insertions, 0 deletions
diff --git a/192x192.png b/192x192.png
new file mode 100644
index 0000000..9118db4
--- /dev/null
+++ b/192x192.png
Binary files differ
diff --git a/512x512.png b/512x512.png
new file mode 100644
index 0000000..1e409c6
--- /dev/null
+++ b/512x512.png
Binary files differ
diff --git a/courbd.ttf b/courbd.ttf
new file mode 100644
index 0000000..a4f26b4
--- /dev/null
+++ b/courbd.ttf
Binary files differ
diff --git a/favicon.ico b/favicon.ico
new file mode 100644
index 0000000..64017a2
--- /dev/null
+++ b/favicon.ico
Binary files differ
diff --git a/favicon.png b/favicon.png
new file mode 100644
index 0000000..6160396
--- /dev/null
+++ b/favicon.png
Binary files differ
diff --git a/index - Copy.html b/index - Copy.html
new file mode 100644
index 0000000..bfa9441
--- /dev/null
+++ b/index - Copy.html
@@ -0,0 +1,241 @@
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <link rel="manifest" href="./manifest.json">
+ <title>
+ Orodje za izdelavo UPN nalogov, (C) Anton Luka Šijanec 2020
+ </title>
+ <style>
+ @font-face {
+ font-family: myriadpro;
+ src: url(myriadpro.otf);
+ }
+ @font-face {
+ font-family: courbd;
+ src: url(courbd.ttf);
+ }
+ body {
+ font-family: myriadpro;
+ background: black;
+ color: white;
+ }
+ input {
+ font-family: courbd;
+ border: 0;
+ width: 100%;
+ background: transparent;
+ position: fixed;
+ color: black;
+ }
+ #div {
+ background-color: white;
+ display: inline-block;
+ }
+ canvas {
+ background: white;
+ color: black;
+ position: fixed;
+ width: 0;
+ heigth: 0;
+ }
+ </style>
+ <script src="qrcode.js"></script>
+ <script src="qrcode.tosjis.js"></script>
+ <script src="iso-8859-2.js"></script>
+ <script src="sw.js"></script>
+ <script>
+ if ("serviceWorker" in navigator) {
+ navigator.serviceWorker.register("./sw.js")
+ .then(() => { })
+ .catch((err) => console.log("Service worker registration failed", err));
+ }
+ // Listen to messages from service workers.}
+ if(navigator.serviceWorker) {
+ navigator.serviceWorker.addEventListener('message', (event) => {
+ if (event.data.msg === "install") {
+ window.location.replace("./index.html");
+ }
+ });
+ }
+ if (location.protocol != 'https:') {
+ location.href = 'https:' + window.location.href.substring(window.location.protocol.length);
+ }
+ var canvasEl, errorEl, qrtext;
+ function httpGet(theUrl) {
+ var xmlHttp = new XMLHttpRequest();
+ xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
+ xmlHttp.send( null );
+ return xmlHttp.responseText;
+ }
+ var unikatnapolja = ["KodaNamena", "ImePlacnika", "UlicaPlacnika", "KrajPlacnika", "NamenPlacila", "RokPlacila", "Znesek", "IbanPrejemnika", "ImePrejemnika", "UlicaPrejemnika", "KrajPrejemnika", "IbanPlacnika", "ReferencaPlacnika1", "ReferencaPlacnika2", "ReferencaPrejemnika1", "ReferencaPrejemnika2", "PodpisPlacnikaNeobveznoZig1", "PodpisPlacnikaNeobveznoZig2", "DatumPlacila", "Dvig", "Polog", "Nujno"];
+ document.addEventListener("DOMContentLoaded", function() {
+ document.getElementById("div").insertAdjacentHTML( 'afterbegin', httpGet("upn.svg"));
+ var element = "ImePlacnika";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "UlicaPlacnika";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "KrajPlacnika";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "NamenPlacila";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "RokPlacila";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "Znesek";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "IbanPrejemnika";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "ReferencaPrejemnika1";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "ReferencaPrejemnika2";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "ImePrejemnika";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "UlicaPrejemnika";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "KrajPrejemnika";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "QRKoda";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<canvas id=polje"+element+"Rdece style='top:"+document.getElementById("rdecaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("rdecaVnos"+element).getBoundingClientRect().left+"' >");
+ for (const element of unikatnapolja) {
+ if(document.getElementById("rdecaVnos"+element) != null) var ccc = "rdeca"; else
+ if(document.getElementById("rumenaVnos"+element) != null) var ccc = "rumena"; else
+ if(document.getElementById("belaVnos"+element) != null) var ccc = "bela";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+" style='top:"+document.getElementById(ccc+"Vnos"+element).getBoundingClientRect().top+";left:"+document.getElementById(ccc+"Vnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById(ccc+"Vnos"+element).childNodes[0].nodeValue="";
+ }
+ var unikatnekljukice;
+ addeventlisteners();
+ canvasEl = document.getElementById('poljeQRKodaRdece');
+ errorEl = document.getElementById('error');
+ });
+ function addeventlisteners() {
+ var belapolja = ["ImePlacnika", "UlicaPlacnika", "KrajPlacnika", "NamenPlacila", "RokPlacila", "Znesek", "IbanPrejemnika", "ImePrejemnika", "UlicaPrejemnika", "KrajPrejemnika", "ReferencaPrejemnika1", "ReferencaPrejemnika2"];
+ for (const element of belapolja) {
+ document.getElementById("polje"+element).addEventListener("keyup", function() {
+ document.getElementById("polje"+element+"Belo").value = document.getElementById("polje"+element).value;
+ });
+ document.getElementById("polje"+element+"Belo").addEventListener("keyup", function() {
+ document.getElementById("polje"+element).value = document.getElementById("polje"+element+"Belo").value;
+ });
+ }
+ document.addEventListener("keyup", function() {
+ updateQR();
+ });
+ }
+ function debounce (func, wait, immediate) {
+ var timeout
+ return function () {
+ var context = this
+ var args = arguments
+ var later = function () {
+ timeout = null
+ if (!immediate) func.apply(context, args)
+ }
+
+ var callNow = immediate && !timeout
+ clearTimeout(timeout)
+ timeout = setTimeout(later, wait)
+ if (callNow) func.apply(context, args)
+ }
+ }
+
+ function drawQR (text) {
+ errorEl.style.display = 'none'
+ canvasEl.style.display = 'block'
+
+ QRCode.toCanvas(canvasEl, text, {
+ version: 15,
+ errorCorrectionLevel: "M",
+ margin: 0,
+ width: 123.199029921,
+ color: {
+ light: "#ffffff",
+ dark: "#000000"
+ },
+ toSJISFunc: QRCode.toSJIS
+ }, function (error, canvas) {
+ if (error) {
+ canvasEl.style.display = 'none'
+ errorEl.style.display = 'inline'
+ errorEl.textContent = error
+ }
+ })
+ }
+
+ var updateQR = debounce(function () {
+ dpi = window.devicePixelRatio;
+ ctx = canvasEl.getContext('2d');
+ var telo = "UPNQR\n"
+ +document.getElementById("poljeIbanPlacnika").value.replace(/\s/g, '').substring(0, 19)+"\n"
+ +document.getElementById("poljePolog").value.replace(/\s/g, '').substring(0, 1)+"\n"
+ +document.getElementById("poljeDvig").value.replace(/\s/g, '').substring(0, 1)+"\n"
+ +document.getElementById("poljeReferencaPlacnika1").value.replace(/\s/g, '').substring(0, 4)+document.getElementById("poljeReferencaPlacnika2").value.replace(/\s/g, '').substring(0, 22)+"\n"
+ +document.getElementById("poljeImePlacnika").value.substring(0, 33)+"\n"
+ +document.getElementById("poljeUlicaPlacnika").value.substring(0, 33)+"\n"
+ +document.getElementById("poljeKrajPlacnika").value.substring(0, 33)+"\n"
+ +(Number(document.getElementById("poljeZnesek").value.replace(/\s/g, '').substring(3).replace(/\./g, '').replace(',', '.'))*100).toString().padStart(11, "0")+"\n"
+ +document.getElementById("poljeDatumPlacila").value.replace(/\s/g, '').substring(0, 10)+"\n"
+ +document.getElementById("poljeNujno").value.replace(/\s/g, '').substring(0, 1)+"\n"
+ +document.getElementById("poljeKodaNamena").value.replace(/\s/g, '').toUpperCase().substring(0, 4)+"\n"
+ +document.getElementById("poljeNamenPlacila").value.replace(/\s/g, '').substring(0, 42)+"\n"
+ +document.getElementById("poljeRokPlacila").value.replace(/\s/g, '').substring(0, 10)+"\n"
+ +document.getElementById("poljeIbanPrejemnika").value.replace(/\s/g, '').substring(0, 34)+"\n"
+ +document.getElementById("poljeReferencaPrejemnika1").value.replace(/\s/g, '').substring(0, 4)+document.getElementById("poljeReferencaPrejemnika2").value.replace(/\s/g, '').substring(0, 22)+"\n"
+ +document.getElementById("poljeImePrejemnika").value.substring(0, 33)+"\n"
+ +document.getElementById("poljeUlicaPrejemnika").value.substring(0, 33)+"\n"
+ +document.getElementById("poljeKrajPrejemnika").value.substring(0, 33)+"\n";
+ var podpis = "upn.sijanec.eu - Anton Luka Šijanec je spisal programsko opremo, ki je generirala ta UPN. (C) 2020";
+ var qrtext = telo+telo.length.toString().padStart(3, "0")+"\n"+podpis.substring(0, 411-(telo.length+4));
+ console.log(qrtext);
+ var mode = "Byte";
+ if (mode !== 'Auto') {
+ // drawQR([{ data: iso88592.encode(qrtext.replace(/[\t\r]/g,)), mode: mode }])
+ drawQR([{ data: qrtext.replace(/[\t\r]/g,), mode: mode }])
+ } else {
+ // drawQR(iso88592.encode(qrtext.replace(/[\t\r]/g,)))
+ drawQR(qrtext.replace(/[\t\r]/g,))
+ }
+ }, 250)
+ var pxTomm = function(px){
+ return Math.floor(px/($('#my_mm').height()/100)); //JQuery returns sizes in PX
+ };
+ </script>
+ </head>
+ <body>
+ <h1 align="center">
+ Orodje za izdelavo položnic, (C) Anton Luka Šijanec 2020
+ </h1>
+ <div id="div">
+ </div>
+ <hr>
+ <ul>
+ <b>Navodila in opombe za vpisovanje:</b>
+ <li>Številke IBAN morajo biti ločene s presledki na vsake štiri znake.</li>
+ <li>Ko strojno vpisujemo podatke, le-ti ne smejo biti vpisani znak-po-znak med vodila, ki so namenjena zgolj ročnemu vnosu.</li>
+ <li>Kljukice na poljih Polog, Dvig in Nujno označimo z vpisom velike tiskane črke X.</li>
+ <li>Pri poljih Ime, ulica in kraj ne pišemo vejic.</li>
+ <li>Znesek začnemo z tremi zvezdicami (***) in vanj vnesemo tudi cente, ločene z decimalno vejico. Največji znesek je 999.999.999,99 evrov (ena milijarda minus en cent). Celoštevilski del ločimo na segmente po tri mesta s piko. Primer zneska (en milijon dvanajst tisoč petsto triindvajset evrov in triinpetdeset centov): ***1.012.523,53.</li>
+ <li>Datume pišemo v slovenskem formatu brez presledkov (primer: 31.12.1999).</li>
+ <li>Reference pišemo v formatu <i>SI00 225268-32526-222</i>, vendar sem opazil, da delujejo tudi brez pomišljajev.</li>
+ <li>Kode namena najdete na <a href="https://www.nlb.si/sepa-koda-namena-prebivalstvo" target="_blank">spletni strani NLB [odpre v novem zavihku]</a>.</li>
+ <li>Program ne preverja vnosa!</li>
+ </ul>
+ <div id="error">
+ </div>
+ <hr>
+ <i>šijanec/upn, različica 0.0.7</i>
+ </body>
+</html> \ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..bfa9441
--- /dev/null
+++ b/index.html
@@ -0,0 +1,241 @@
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <link rel="manifest" href="./manifest.json">
+ <title>
+ Orodje za izdelavo UPN nalogov, (C) Anton Luka Šijanec 2020
+ </title>
+ <style>
+ @font-face {
+ font-family: myriadpro;
+ src: url(myriadpro.otf);
+ }
+ @font-face {
+ font-family: courbd;
+ src: url(courbd.ttf);
+ }
+ body {
+ font-family: myriadpro;
+ background: black;
+ color: white;
+ }
+ input {
+ font-family: courbd;
+ border: 0;
+ width: 100%;
+ background: transparent;
+ position: fixed;
+ color: black;
+ }
+ #div {
+ background-color: white;
+ display: inline-block;
+ }
+ canvas {
+ background: white;
+ color: black;
+ position: fixed;
+ width: 0;
+ heigth: 0;
+ }
+ </style>
+ <script src="qrcode.js"></script>
+ <script src="qrcode.tosjis.js"></script>
+ <script src="iso-8859-2.js"></script>
+ <script src="sw.js"></script>
+ <script>
+ if ("serviceWorker" in navigator) {
+ navigator.serviceWorker.register("./sw.js")
+ .then(() => { })
+ .catch((err) => console.log("Service worker registration failed", err));
+ }
+ // Listen to messages from service workers.}
+ if(navigator.serviceWorker) {
+ navigator.serviceWorker.addEventListener('message', (event) => {
+ if (event.data.msg === "install") {
+ window.location.replace("./index.html");
+ }
+ });
+ }
+ if (location.protocol != 'https:') {
+ location.href = 'https:' + window.location.href.substring(window.location.protocol.length);
+ }
+ var canvasEl, errorEl, qrtext;
+ function httpGet(theUrl) {
+ var xmlHttp = new XMLHttpRequest();
+ xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
+ xmlHttp.send( null );
+ return xmlHttp.responseText;
+ }
+ var unikatnapolja = ["KodaNamena", "ImePlacnika", "UlicaPlacnika", "KrajPlacnika", "NamenPlacila", "RokPlacila", "Znesek", "IbanPrejemnika", "ImePrejemnika", "UlicaPrejemnika", "KrajPrejemnika", "IbanPlacnika", "ReferencaPlacnika1", "ReferencaPlacnika2", "ReferencaPrejemnika1", "ReferencaPrejemnika2", "PodpisPlacnikaNeobveznoZig1", "PodpisPlacnikaNeobveznoZig2", "DatumPlacila", "Dvig", "Polog", "Nujno"];
+ document.addEventListener("DOMContentLoaded", function() {
+ document.getElementById("div").insertAdjacentHTML( 'afterbegin', httpGet("upn.svg"));
+ var element = "ImePlacnika";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "UlicaPlacnika";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "KrajPlacnika";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "NamenPlacila";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "RokPlacila";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "Znesek";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "IbanPrejemnika";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "ReferencaPrejemnika1";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "ReferencaPrejemnika2";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "ImePrejemnika";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "UlicaPrejemnika";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "KrajPrejemnika";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+"Belo style='top:"+document.getElementById("belaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("belaVnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById("belaVnos"+element).childNodes[0].nodeValue="";
+ var element = "QRKoda";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<canvas id=polje"+element+"Rdece style='top:"+document.getElementById("rdecaVnos"+element).getBoundingClientRect().top+";left:"+document.getElementById("rdecaVnos"+element).getBoundingClientRect().left+"' >");
+ for (const element of unikatnapolja) {
+ if(document.getElementById("rdecaVnos"+element) != null) var ccc = "rdeca"; else
+ if(document.getElementById("rumenaVnos"+element) != null) var ccc = "rumena"; else
+ if(document.getElementById("belaVnos"+element) != null) var ccc = "bela";
+ document.getElementById("div").insertAdjacentHTML( 'beforeend', "<input id=polje"+element+" style='top:"+document.getElementById(ccc+"Vnos"+element).getBoundingClientRect().top+";left:"+document.getElementById(ccc+"Vnos"+element).getBoundingClientRect().left+"' >");
+ document.getElementById(ccc+"Vnos"+element).childNodes[0].nodeValue="";
+ }
+ var unikatnekljukice;
+ addeventlisteners();
+ canvasEl = document.getElementById('poljeQRKodaRdece');
+ errorEl = document.getElementById('error');
+ });
+ function addeventlisteners() {
+ var belapolja = ["ImePlacnika", "UlicaPlacnika", "KrajPlacnika", "NamenPlacila", "RokPlacila", "Znesek", "IbanPrejemnika", "ImePrejemnika", "UlicaPrejemnika", "KrajPrejemnika", "ReferencaPrejemnika1", "ReferencaPrejemnika2"];
+ for (const element of belapolja) {
+ document.getElementById("polje"+element).addEventListener("keyup", function() {
+ document.getElementById("polje"+element+"Belo").value = document.getElementById("polje"+element).value;
+ });
+ document.getElementById("polje"+element+"Belo").addEventListener("keyup", function() {
+ document.getElementById("polje"+element).value = document.getElementById("polje"+element+"Belo").value;
+ });
+ }
+ document.addEventListener("keyup", function() {
+ updateQR();
+ });
+ }
+ function debounce (func, wait, immediate) {
+ var timeout
+ return function () {
+ var context = this
+ var args = arguments
+ var later = function () {
+ timeout = null
+ if (!immediate) func.apply(context, args)
+ }
+
+ var callNow = immediate && !timeout
+ clearTimeout(timeout)
+ timeout = setTimeout(later, wait)
+ if (callNow) func.apply(context, args)
+ }
+ }
+
+ function drawQR (text) {
+ errorEl.style.display = 'none'
+ canvasEl.style.display = 'block'
+
+ QRCode.toCanvas(canvasEl, text, {
+ version: 15,
+ errorCorrectionLevel: "M",
+ margin: 0,
+ width: 123.199029921,
+ color: {
+ light: "#ffffff",
+ dark: "#000000"
+ },
+ toSJISFunc: QRCode.toSJIS
+ }, function (error, canvas) {
+ if (error) {
+ canvasEl.style.display = 'none'
+ errorEl.style.display = 'inline'
+ errorEl.textContent = error
+ }
+ })
+ }
+
+ var updateQR = debounce(function () {
+ dpi = window.devicePixelRatio;
+ ctx = canvasEl.getContext('2d');
+ var telo = "UPNQR\n"
+ +document.getElementById("poljeIbanPlacnika").value.replace(/\s/g, '').substring(0, 19)+"\n"
+ +document.getElementById("poljePolog").value.replace(/\s/g, '').substring(0, 1)+"\n"
+ +document.getElementById("poljeDvig").value.replace(/\s/g, '').substring(0, 1)+"\n"
+ +document.getElementById("poljeReferencaPlacnika1").value.replace(/\s/g, '').substring(0, 4)+document.getElementById("poljeReferencaPlacnika2").value.replace(/\s/g, '').substring(0, 22)+"\n"
+ +document.getElementById("poljeImePlacnika").value.substring(0, 33)+"\n"
+ +document.getElementById("poljeUlicaPlacnika").value.substring(0, 33)+"\n"
+ +document.getElementById("poljeKrajPlacnika").value.substring(0, 33)+"\n"
+ +(Number(document.getElementById("poljeZnesek").value.replace(/\s/g, '').substring(3).replace(/\./g, '').replace(',', '.'))*100).toString().padStart(11, "0")+"\n"
+ +document.getElementById("poljeDatumPlacila").value.replace(/\s/g, '').substring(0, 10)+"\n"
+ +document.getElementById("poljeNujno").value.replace(/\s/g, '').substring(0, 1)+"\n"
+ +document.getElementById("poljeKodaNamena").value.replace(/\s/g, '').toUpperCase().substring(0, 4)+"\n"
+ +document.getElementById("poljeNamenPlacila").value.replace(/\s/g, '').substring(0, 42)+"\n"
+ +document.getElementById("poljeRokPlacila").value.replace(/\s/g, '').substring(0, 10)+"\n"
+ +document.getElementById("poljeIbanPrejemnika").value.replace(/\s/g, '').substring(0, 34)+"\n"
+ +document.getElementById("poljeReferencaPrejemnika1").value.replace(/\s/g, '').substring(0, 4)+document.getElementById("poljeReferencaPrejemnika2").value.replace(/\s/g, '').substring(0, 22)+"\n"
+ +document.getElementById("poljeImePrejemnika").value.substring(0, 33)+"\n"
+ +document.getElementById("poljeUlicaPrejemnika").value.substring(0, 33)+"\n"
+ +document.getElementById("poljeKrajPrejemnika").value.substring(0, 33)+"\n";
+ var podpis = "upn.sijanec.eu - Anton Luka Šijanec je spisal programsko opremo, ki je generirala ta UPN. (C) 2020";
+ var qrtext = telo+telo.length.toString().padStart(3, "0")+"\n"+podpis.substring(0, 411-(telo.length+4));
+ console.log(qrtext);
+ var mode = "Byte";
+ if (mode !== 'Auto') {
+ // drawQR([{ data: iso88592.encode(qrtext.replace(/[\t\r]/g,)), mode: mode }])
+ drawQR([{ data: qrtext.replace(/[\t\r]/g,), mode: mode }])
+ } else {
+ // drawQR(iso88592.encode(qrtext.replace(/[\t\r]/g,)))
+ drawQR(qrtext.replace(/[\t\r]/g,))
+ }
+ }, 250)
+ var pxTomm = function(px){
+ return Math.floor(px/($('#my_mm').height()/100)); //JQuery returns sizes in PX
+ };
+ </script>
+ </head>
+ <body>
+ <h1 align="center">
+ Orodje za izdelavo položnic, (C) Anton Luka Šijanec 2020
+ </h1>
+ <div id="div">
+ </div>
+ <hr>
+ <ul>
+ <b>Navodila in opombe za vpisovanje:</b>
+ <li>Številke IBAN morajo biti ločene s presledki na vsake štiri znake.</li>
+ <li>Ko strojno vpisujemo podatke, le-ti ne smejo biti vpisani znak-po-znak med vodila, ki so namenjena zgolj ročnemu vnosu.</li>
+ <li>Kljukice na poljih Polog, Dvig in Nujno označimo z vpisom velike tiskane črke X.</li>
+ <li>Pri poljih Ime, ulica in kraj ne pišemo vejic.</li>
+ <li>Znesek začnemo z tremi zvezdicami (***) in vanj vnesemo tudi cente, ločene z decimalno vejico. Največji znesek je 999.999.999,99 evrov (ena milijarda minus en cent). Celoštevilski del ločimo na segmente po tri mesta s piko. Primer zneska (en milijon dvanajst tisoč petsto triindvajset evrov in triinpetdeset centov): ***1.012.523,53.</li>
+ <li>Datume pišemo v slovenskem formatu brez presledkov (primer: 31.12.1999).</li>
+ <li>Reference pišemo v formatu <i>SI00 225268-32526-222</i>, vendar sem opazil, da delujejo tudi brez pomišljajev.</li>
+ <li>Kode namena najdete na <a href="https://www.nlb.si/sepa-koda-namena-prebivalstvo" target="_blank">spletni strani NLB [odpre v novem zavihku]</a>.</li>
+ <li>Program ne preverja vnosa!</li>
+ </ul>
+ <div id="error">
+ </div>
+ <hr>
+ <i>šijanec/upn, različica 0.0.7</i>
+ </body>
+</html> \ No newline at end of file
diff --git a/iso-8859-2.js b/iso-8859-2.js
new file mode 100644
index 0000000..ac332dd
--- /dev/null
+++ b/iso-8859-2.js
@@ -0,0 +1,154 @@
+/*! https://mths.be/iso-8859-2 v1.0.0 by @mathias | MIT license */
+;(function(root) {
+
+ // Detect free variables `exports`.
+ var freeExports = typeof exports == 'object' && exports;
+
+ // Detect free variable `module`.
+ var freeModule = typeof module == 'object' && module &&
+ module.exports == freeExports && module;
+
+ // Detect free variable `global`, from Node.js/io.js or Browserified code,
+ // and use it as `root`.
+ var freeGlobal = typeof global == 'object' && global;
+ if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
+ root = freeGlobal;
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ var object = {};
+ var hasOwnProperty = object.hasOwnProperty;
+ var stringFromCharCode = String.fromCharCode;
+
+ var INDEX_BY_CODE_POINT = {'128':0,'129':1,'130':2,'131':3,'132':4,'133':5,'134':6,'135':7,'136':8,'137':9,'138':10,'139':11,'140':12,'141':13,'142':14,'143':15,'144':16,'145':17,'146':18,'147':19,'148':20,'149':21,'150':22,'151':23,'152':24,'153':25,'154':26,'155':27,'156':28,'157':29,'158':30,'159':31,'160':32,'164':36,'167':39,'168':40,'173':45,'176':48,'180':52,'184':56,'193':65,'194':66,'196':68,'199':71,'201':73,'203':75,'205':77,'206':78,'211':83,'212':84,'214':86,'215':87,'218':90,'220':92,'221':93,'223':95,'225':97,'226':98,'228':100,'231':103,'233':105,'235':107,'237':109,'238':110,'243':115,'244':116,'246':118,'247':119,'250':122,'252':124,'253':125,'258':67,'259':99,'260':33,'261':49,'262':70,'263':102,'268':72,'269':104,'270':79,'271':111,'272':80,'273':112,'280':74,'281':106,'282':76,'283':108,'313':69,'314':101,'317':37,'318':53,'321':35,'322':51,'323':81,'324':113,'327':82,'328':114,'336':85,'337':117,'340':64,'341':96,'344':88,'345':120,'346':38,'347':54,'350':42,'351':58,'352':41,'353':57,'354':94,'355':126,'356':43,'357':59,'366':89,'367':121,'368':91,'369':123,'377':44,'378':60,'379':47,'380':63,'381':46,'382':62,'711':55,'728':34,'729':127,'731':50,'733':61};
+ var INDEX_BY_POINTER = {'0':'\x80','1':'\x81','2':'\x82','3':'\x83','4':'\x84','5':'\x85','6':'\x86','7':'\x87','8':'\x88','9':'\x89','10':'\x8A','11':'\x8B','12':'\x8C','13':'\x8D','14':'\x8E','15':'\x8F','16':'\x90','17':'\x91','18':'\x92','19':'\x93','20':'\x94','21':'\x95','22':'\x96','23':'\x97','24':'\x98','25':'\x99','26':'\x9A','27':'\x9B','28':'\x9C','29':'\x9D','30':'\x9E','31':'\x9F','32':'\xA0','33':'\u0104','34':'\u02D8','35':'\u0141','36':'\xA4','37':'\u013D','38':'\u015A','39':'\xA7','40':'\xA8','41':'\u0160','42':'\u015E','43':'\u0164','44':'\u0179','45':'\xAD','46':'\u017D','47':'\u017B','48':'\xB0','49':'\u0105','50':'\u02DB','51':'\u0142','52':'\xB4','53':'\u013E','54':'\u015B','55':'\u02C7','56':'\xB8','57':'\u0161','58':'\u015F','59':'\u0165','60':'\u017A','61':'\u02DD','62':'\u017E','63':'\u017C','64':'\u0154','65':'\xC1','66':'\xC2','67':'\u0102','68':'\xC4','69':'\u0139','70':'\u0106','71':'\xC7','72':'\u010C','73':'\xC9','74':'\u0118','75':'\xCB','76':'\u011A','77':'\xCD','78':'\xCE','79':'\u010E','80':'\u0110','81':'\u0143','82':'\u0147','83':'\xD3','84':'\xD4','85':'\u0150','86':'\xD6','87':'\xD7','88':'\u0158','89':'\u016E','90':'\xDA','91':'\u0170','92':'\xDC','93':'\xDD','94':'\u0162','95':'\xDF','96':'\u0155','97':'\xE1','98':'\xE2','99':'\u0103','100':'\xE4','101':'\u013A','102':'\u0107','103':'\xE7','104':'\u010D','105':'\xE9','106':'\u0119','107':'\xEB','108':'\u011B','109':'\xED','110':'\xEE','111':'\u010F','112':'\u0111','113':'\u0144','114':'\u0148','115':'\xF3','116':'\xF4','117':'\u0151','118':'\xF6','119':'\xF7','120':'\u0159','121':'\u016F','122':'\xFA','123':'\u0171','124':'\xFC','125':'\xFD','126':'\u0163','127':'\u02D9'};
+
+ // https://encoding.spec.whatwg.org/#error-mode
+ var error = function(codePoint, mode) {
+ if (mode == 'replacement') {
+ return '\uFFFD';
+ }
+ if (codePoint != null && mode == 'html') {
+ return '&#' + codePoint + ';';
+ }
+ // Else, `mode == 'fatal'`.
+ throw Error();
+ };
+
+ // https://encoding.spec.whatwg.org/#single-byte-decoder
+ var decode = function(input, options) {
+ var mode;
+ if (options && options.mode) {
+ mode = options.mode.toLowerCase();
+ }
+ // “An error mode […] is either `replacement` (default) or `fatal` for a
+ // decoder.”
+ if (mode != 'replacement' && mode != 'fatal') {
+ mode = 'replacement';
+ }
+ var length = input.length;
+ var index = -1;
+ var byteValue;
+ var pointer;
+ var result = '';
+ while (++index < length) {
+ byteValue = input.charCodeAt(index);
+ // “If `byte` is in the range `0x00` to `0x7F`, return a code point whose
+ // value is `byte`.”
+ if (byteValue >= 0x00 && byteValue <= 0x7F) {
+ result += stringFromCharCode(byteValue);
+ continue;
+ }
+ // “Let `code point` be the index code point for `byte − 0x80` in index
+ // `single-byte`.”
+ pointer = byteValue - 0x80;
+ if (hasOwnProperty.call(INDEX_BY_POINTER, pointer)) {
+ // “Return a code point whose value is `code point`.”
+ result += INDEX_BY_POINTER[pointer];
+ } else {
+ // “If `code point` is `null`, return `error`.”
+ result += error(null, mode);
+ }
+ }
+ return result;
+ };
+
+ // https://encoding.spec.whatwg.org/#single-byte-encoder
+ var encode = function(input, options) {
+ var mode;
+ if (options && options.mode) {
+ mode = options.mode.toLowerCase();
+ }
+ // “An error mode […] is either `fatal` (default) or `HTML` for an
+ // encoder.”
+ if (mode != 'fatal' && mode != 'html') {
+ mode = 'fatal';
+ }
+ var length = input.length;
+ var index = -1;
+ var codePoint;
+ var pointer;
+ var result = '';
+ while (++index < length) {
+ codePoint = input.charCodeAt(index);
+ // “If `code point` is in the range U+0000 to U+007F, return a byte whose
+ // value is `code point`.”
+ if (codePoint >= 0x00 && codePoint <= 0x7F) {
+ result += stringFromCharCode(codePoint);
+ continue;
+ }
+ // “Let `pointer` be the index pointer for `code point` in index
+ // `single-byte`.”
+ if (hasOwnProperty.call(INDEX_BY_CODE_POINT, codePoint)) {
+ pointer = INDEX_BY_CODE_POINT[codePoint];
+ // “Return a byte whose value is `pointer + 0x80`.”
+ result += stringFromCharCode(pointer + 0x80);
+ } else {
+ // “If `pointer` is `null`, return `error` with `code point`.”
+ result += error(codePoint, mode);
+ }
+ }
+ return result;
+ };
+
+ var iso88592 = {
+ 'encode': encode,
+ 'decode': decode,
+ 'labels': [
+ 'csisolatin2',
+ 'iso-8859-2',
+ 'iso-ir-101',
+ 'iso8859-2',
+ 'iso88592',
+ 'iso_8859-2',
+ 'iso_8859-2:1987',
+ 'l2',
+ 'latin2'
+ ],
+ 'version': '1.0.0'
+ };
+
+ // Some AMD build optimizers, like r.js, check for specific condition patterns
+ // like the following:
+ if (
+ typeof define == 'function' &&
+ typeof define.amd == 'object' &&
+ define.amd
+ ) {
+ define(function() {
+ return iso88592;
+ });
+ } else if (freeExports && !freeExports.nodeType) {
+ if (freeModule) { // in Node.js, io.js or RingoJS v0.8.0+
+ freeModule.exports = iso88592;
+ } else { // in Narwhal or RingoJS v0.7.0-
+ for (var key in iso88592) {
+ iso88592.hasOwnProperty(key) && (freeExports[key] = iso88592[key]);
+ }
+ }
+ } else { // in Rhino or a web browser
+ root.iso88592 = iso88592;
+ }
+
+}(this));
diff --git a/manifest.json b/manifest.json
new file mode 100644
index 0000000..bc8dc57
--- /dev/null
+++ b/manifest.json
@@ -0,0 +1,27 @@
+{
+ "short_name": "Orodje za UPN",
+ "name": "Orodje za UPN - A. Šijanec ...",
+ "description": "Orodje za generiranje UPNQR položnic",
+ "lang": "sl-SI",
+ "categories": [
+ "productivity",
+ "utilities"
+ ],
+ "icons": [
+ {
+ "src": "./192x192.png",
+ "type": "image/png",
+ "sizes": "192x192"
+ },
+ {
+ "src": "./512x512.png",
+ "type": "image/png",
+ "sizes": "512x512"
+ }
+ ],
+ "start_url": "./index.html",
+ "background_color": "#000000",
+ "display": "standalone",
+ "scope": "./",
+ "theme_color": "#000000"
+}
diff --git a/myriadpro-semibold.otf b/myriadpro-semibold.otf
new file mode 100644
index 0000000..1178f24
--- /dev/null
+++ b/myriadpro-semibold.otf
Binary files differ
diff --git a/myriadpro.otf b/myriadpro.otf
new file mode 100644
index 0000000..e7b7f26
--- /dev/null
+++ b/myriadpro.otf
Binary files differ
diff --git a/qr.html b/qr.html
new file mode 100644
index 0000000..bcb7b9f
--- /dev/null
+++ b/qr.html
@@ -0,0 +1,121 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>upn softver</title>
+ <!--[if ie]><script type="text/javascript" src="vendors/excanvas/excanvas.js"></script><![endif]-->
+ <script src="qrcode.js"></script>
+ <script src="qrcode.tosjis.js"></script>
+ <script src="iso-8859-2.js"></script>
+ <style>
+ .container { display: flex; }
+ .controls {
+ display: flex; flex-direction: column;
+ width: 100%;
+ padding: 0 5px 0 5px;
+ background-color: ghostwhite;
+ }
+ .controls > label { margin-bottom: 5px; margin-top: 10px; }
+ .controls > textarea { flex: 1; margin-bottom: 10px; }
+ .controls > input { width: 100%; margin: 0; padding: 0; flex: 1; }
+ .qrcode-container {
+ display: flex; align-items: center; justify-content: center;
+ min-height: 300px; min-width: 300px; padding: 10px;
+ background-color: ghostwhite;
+ }
+ .qrcode-image { box-shadow: 2px 2px 12px lightgray; }
+ .error { color: red; max-width: 280px; }
+ </style>
+ </head>
+ <body>
+ <div class="container">
+ <div class="controls" style="max-width: 320px;">
+ <div class="container">
+
+ <div class="controls" style="flex: 1;">
+ <textarea rows=19 id="input-text">UPNQR
+X
+
+SI56051008010486080
+Novo podjetje d.o.o.
+Lepa cesta 15
+3698 Loški Potok
+00000013167
+11.07.2016
+X
+SUSB
+Letna naročnina na ZZYS
+11.11.2020
+DE12500105170648489890
+RF45SBO2010
+Gesselshaft GmbH
+Rosenthal 15
+DE-86807 Buchloe
+222
+</textarea>
+ </div>
+
+ </div>
+ <div class="qrcode-container">
+ <p id="error" class="error"></p>
+ <canvas id="canvas" class="qrcode-image"></canvas>
+ </div>
+ </div>
+
+ <script>
+ var canvasEl = document.getElementById('canvas')
+ var textEl = document.getElementById('input-text')
+ var errorEl = document.getElementById('error')
+ function debounce (func, wait, immediate) {
+ var timeout
+ return function () {
+ var context = this
+ var args = arguments
+ var later = function () {
+ timeout = null
+ if (!immediate) func.apply(context, args)
+ }
+
+ var callNow = immediate && !timeout
+ clearTimeout(timeout)
+ timeout = setTimeout(later, wait)
+ if (callNow) func.apply(context, args)
+ }
+ }
+
+ function drawQR (text) {
+ errorEl.style.display = 'none'
+ canvasEl.style.display = 'block'
+
+ QRCode.toCanvas(canvasEl, text, {
+ version: 15,
+ errorCorrectionLevel: "M",
+ margin: 0,
+ color: {
+ light: "#ffffff",
+ dark: "#000000"
+ },
+ toSJISFunc: QRCode.toSJIS
+ }, function (error, canvas) {
+ if (error) {
+ canvasEl.style.display = 'none'
+ errorEl.style.display = 'inline'
+ errorEl.textContent = error
+ }
+ })
+ }
+
+ var updateQR = debounce(function () {
+ var mode = "Byte";
+ if (mode !== 'Auto') {
+ drawQR([{ data: iso88592.encode(textEl.value.replace(/[\t\n]/g,)), mode: mode }])
+ } else {
+ drawQR(iso88592.encode(textEl.value.replace(/[\t\n]/g,)))
+ }
+ }, 250)
+ textEl.addEventListener('keyup', updateQR, false);
+ updateQR();
+ </script>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/qrcode.js b/qrcode.js
new file mode 100644
index 0000000..fc9aa33
--- /dev/null
+++ b/qrcode.js
@@ -0,0 +1,5414 @@
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.QRCode = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
+// can-promise has a crash in some versions of react native that dont have
+// standard global objects
+// https://github.com/soldair/node-qrcode/issues/157
+
+module.exports = function () {
+ return typeof Promise === 'function' && Promise.prototype && Promise.prototype.then
+}
+
+},{}],2:[function(require,module,exports){
+/**
+ * Alignment pattern are fixed reference pattern in defined positions
+ * in a matrix symbology, which enables the decode software to re-synchronise
+ * the coordinate mapping of the image modules in the event of moderate amounts
+ * of distortion of the image.
+ *
+ * Alignment patterns are present only in QR Code symbols of version 2 or larger
+ * and their number depends on the symbol version.
+ */
+
+var getSymbolSize = require('./utils').getSymbolSize
+
+/**
+ * Calculate the row/column coordinates of the center module of each alignment pattern
+ * for the specified QR Code version.
+ *
+ * The alignment patterns are positioned symmetrically on either side of the diagonal
+ * running from the top left corner of the symbol to the bottom right corner.
+ *
+ * Since positions are simmetrical only half of the coordinates are returned.
+ * Each item of the array will represent in turn the x and y coordinate.
+ * @see {@link getPositions}
+ *
+ * @param {Number} version QR Code version
+ * @return {Array} Array of coordinate
+ */
+exports.getRowColCoords = function getRowColCoords (version) {
+ if (version === 1) return []
+
+ var posCount = Math.floor(version / 7) + 2
+ var size = getSymbolSize(version)
+ var intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2
+ var positions = [size - 7] // Last coord is always (size - 7)
+
+ for (var i = 1; i < posCount - 1; i++) {
+ positions[i] = positions[i - 1] - intervals
+ }
+
+ positions.push(6) // First coord is always 6
+
+ return positions.reverse()
+}
+
+/**
+ * Returns an array containing the positions of each alignment pattern.
+ * Each array's element represent the center point of the pattern as (x, y) coordinates
+ *
+ * Coordinates are calculated expanding the row/column coordinates returned by {@link getRowColCoords}
+ * and filtering out the items that overlaps with finder pattern
+ *
+ * @example
+ * For a Version 7 symbol {@link getRowColCoords} returns values 6, 22 and 38.
+ * The alignment patterns, therefore, are to be centered on (row, column)
+ * positions (6,22), (22,6), (22,22), (22,38), (38,22), (38,38).
+ * Note that the coordinates (6,6), (6,38), (38,6) are occupied by finder patterns
+ * and are not therefore used for alignment patterns.
+ *
+ * var pos = getPositions(7)
+ * // [[6,22], [22,6], [22,22], [22,38], [38,22], [38,38]]
+ *
+ * @param {Number} version QR Code version
+ * @return {Array} Array of coordinates
+ */
+exports.getPositions = function getPositions (version) {
+ var coords = []
+ var pos = exports.getRowColCoords(version)
+ var posLength = pos.length
+
+ for (var i = 0; i < posLength; i++) {
+ for (var j = 0; j < posLength; j++) {
+ // Skip if position is occupied by finder patterns
+ if ((i === 0 && j === 0) || // top-left
+ (i === 0 && j === posLength - 1) || // bottom-left
+ (i === posLength - 1 && j === 0)) { // top-right
+ continue
+ }
+
+ coords.push([pos[i], pos[j]])
+ }
+ }
+
+ return coords
+}
+
+},{"./utils":21}],3:[function(require,module,exports){
+var Mode = require('./mode')
+
+/**
+ * Array of characters available in alphanumeric mode
+ *
+ * As per QR Code specification, to each character
+ * is assigned a value from 0 to 44 which in this case coincides
+ * with the array index
+ *
+ * @type {Array}
+ */
+var ALPHA_NUM_CHARS = [
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+ ' ', '$', '%', '*', '+', '-', '.', '/', ':'
+]
+
+function AlphanumericData (data) {
+ this.mode = Mode.ALPHANUMERIC
+ this.data = data
+}
+
+AlphanumericData.getBitsLength = function getBitsLength (length) {
+ return 11 * Math.floor(length / 2) + 6 * (length % 2)
+}
+
+AlphanumericData.prototype.getLength = function getLength () {
+ return this.data.length
+}
+
+AlphanumericData.prototype.getBitsLength = function getBitsLength () {
+ return AlphanumericData.getBitsLength(this.data.length)
+}
+
+AlphanumericData.prototype.write = function write (bitBuffer) {
+ var i
+
+ // Input data characters are divided into groups of two characters
+ // and encoded as 11-bit binary codes.
+ for (i = 0; i + 2 <= this.data.length; i += 2) {
+ // The character value of the first character is multiplied by 45
+ var value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45
+
+ // The character value of the second digit is added to the product
+ value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1])
+
+ // The sum is then stored as 11-bit binary number
+ bitBuffer.put(value, 11)
+ }
+
+ // If the number of input data characters is not a multiple of two,
+ // the character value of the final character is encoded as a 6-bit binary number.
+ if (this.data.length % 2) {
+ bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6)
+ }
+}
+
+module.exports = AlphanumericData
+
+},{"./mode":14}],4:[function(require,module,exports){
+function BitBuffer () {
+ this.buffer = []
+ this.length = 0
+}
+
+BitBuffer.prototype = {
+
+ get: function (index) {
+ var bufIndex = Math.floor(index / 8)
+ return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) === 1
+ },
+
+ put: function (num, length) {
+ for (var i = 0; i < length; i++) {
+ this.putBit(((num >>> (length - i - 1)) & 1) === 1)
+ }
+ },
+
+ getLengthInBits: function () {
+ return this.length
+ },
+
+ putBit: function (bit) {
+ var bufIndex = Math.floor(this.length / 8)
+ if (this.buffer.length <= bufIndex) {
+ this.buffer.push(0)
+ }
+
+ if (bit) {
+ this.buffer[bufIndex] |= (0x80 >>> (this.length % 8))
+ }
+
+ this.length++
+ }
+}
+
+module.exports = BitBuffer
+
+},{}],5:[function(require,module,exports){
+var BufferUtil = require('../utils/buffer')
+
+/**
+ * Helper class to handle QR Code symbol modules
+ *
+ * @param {Number} size Symbol size
+ */
+function BitMatrix (size) {
+ if (!size || size < 1) {
+ throw new Error('BitMatrix size must be defined and greater than 0')
+ }
+
+ this.size = size
+ this.data = BufferUtil.alloc(size * size)
+ this.reservedBit = BufferUtil.alloc(size * size)
+}
+
+/**
+ * Set bit value at specified location
+ * If reserved flag is set, this bit will be ignored during masking process
+ *
+ * @param {Number} row
+ * @param {Number} col
+ * @param {Boolean} value
+ * @param {Boolean} reserved
+ */
+BitMatrix.prototype.set = function (row, col, value, reserved) {
+ var index = row * this.size + col
+ this.data[index] = value
+ if (reserved) this.reservedBit[index] = true
+}
+
+/**
+ * Returns bit value at specified location
+ *
+ * @param {Number} row
+ * @param {Number} col
+ * @return {Boolean}
+ */
+BitMatrix.prototype.get = function (row, col) {
+ return this.data[row * this.size + col]
+}
+
+/**
+ * Applies xor operator at specified location
+ * (used during masking process)
+ *
+ * @param {Number} row
+ * @param {Number} col
+ * @param {Boolean} value
+ */
+BitMatrix.prototype.xor = function (row, col, value) {
+ this.data[row * this.size + col] ^= value
+}
+
+/**
+ * Check if bit at specified location is reserved
+ *
+ * @param {Number} row
+ * @param {Number} col
+ * @return {Boolean}
+ */
+BitMatrix.prototype.isReserved = function (row, col) {
+ return this.reservedBit[row * this.size + col]
+}
+
+module.exports = BitMatrix
+
+},{"../utils/buffer":28}],6:[function(require,module,exports){
+var BufferUtil = require('../utils/buffer')
+var Mode = require('./mode')
+
+function ByteData (data) {
+ this.mode = Mode.BYTE
+ this.data = BufferUtil.from(data)
+}
+
+ByteData.getBitsLength = function getBitsLength (length) {
+ return length * 8
+}
+
+ByteData.prototype.getLength = function getLength () {
+ return this.data.length
+}
+
+ByteData.prototype.getBitsLength = function getBitsLength () {
+ return ByteData.getBitsLength(this.data.length)
+}
+
+ByteData.prototype.write = function (bitBuffer) {
+ for (var i = 0, l = this.data.length; i < l; i++) {
+ bitBuffer.put(this.data[i], 8)
+ }
+}
+
+module.exports = ByteData
+
+},{"../utils/buffer":28,"./mode":14}],7:[function(require,module,exports){
+var ECLevel = require('./error-correction-level')
+
+var EC_BLOCKS_TABLE = [
+// L M Q H
+ 1, 1, 1, 1,
+ 1, 1, 1, 1,
+ 1, 1, 2, 2,
+ 1, 2, 2, 4,
+ 1, 2, 4, 4,
+ 2, 4, 4, 4,
+ 2, 4, 6, 5,
+ 2, 4, 6, 6,
+ 2, 5, 8, 8,
+ 4, 5, 8, 8,
+ 4, 5, 8, 11,
+ 4, 8, 10, 11,
+ 4, 9, 12, 16,
+ 4, 9, 16, 16,
+ 6, 10, 12, 18,
+ 6, 10, 17, 16,
+ 6, 11, 16, 19,
+ 6, 13, 18, 21,
+ 7, 14, 21, 25,
+ 8, 16, 20, 25,
+ 8, 17, 23, 25,
+ 9, 17, 23, 34,
+ 9, 18, 25, 30,
+ 10, 20, 27, 32,
+ 12, 21, 29, 35,
+ 12, 23, 34, 37,
+ 12, 25, 34, 40,
+ 13, 26, 35, 42,
+ 14, 28, 38, 45,
+ 15, 29, 40, 48,
+ 16, 31, 43, 51,
+ 17, 33, 45, 54,
+ 18, 35, 48, 57,
+ 19, 37, 51, 60,
+ 19, 38, 53, 63,
+ 20, 40, 56, 66,
+ 21, 43, 59, 70,
+ 22, 45, 62, 74,
+ 24, 47, 65, 77,
+ 25, 49, 68, 81
+]
+
+var EC_CODEWORDS_TABLE = [
+// L M Q H
+ 7, 10, 13, 17,
+ 10, 16, 22, 28,
+ 15, 26, 36, 44,
+ 20, 36, 52, 64,
+ 26, 48, 72, 88,
+ 36, 64, 96, 112,
+ 40, 72, 108, 130,
+ 48, 88, 132, 156,
+ 60, 110, 160, 192,
+ 72, 130, 192, 224,
+ 80, 150, 224, 264,
+ 96, 176, 260, 308,
+ 104, 198, 288, 352,
+ 120, 216, 320, 384,
+ 132, 240, 360, 432,
+ 144, 280, 408, 480,
+ 168, 308, 448, 532,
+ 180, 338, 504, 588,
+ 196, 364, 546, 650,
+ 224, 416, 600, 700,
+ 224, 442, 644, 750,
+ 252, 476, 690, 816,
+ 270, 504, 750, 900,
+ 300, 560, 810, 960,
+ 312, 588, 870, 1050,
+ 336, 644, 952, 1110,
+ 360, 700, 1020, 1200,
+ 390, 728, 1050, 1260,
+ 420, 784, 1140, 1350,
+ 450, 812, 1200, 1440,
+ 480, 868, 1290, 1530,
+ 510, 924, 1350, 1620,
+ 540, 980, 1440, 1710,
+ 570, 1036, 1530, 1800,
+ 570, 1064, 1590, 1890,
+ 600, 1120, 1680, 1980,
+ 630, 1204, 1770, 2100,
+ 660, 1260, 1860, 2220,
+ 720, 1316, 1950, 2310,
+ 750, 1372, 2040, 2430
+]
+
+/**
+ * Returns the number of error correction block that the QR Code should contain
+ * for the specified version and error correction level.
+ *
+ * @param {Number} version QR Code version
+ * @param {Number} errorCorrectionLevel Error correction level
+ * @return {Number} Number of error correction blocks
+ */
+exports.getBlocksCount = function getBlocksCount (version, errorCorrectionLevel) {
+ switch (errorCorrectionLevel) {
+ case ECLevel.L:
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 0]
+ case ECLevel.M:
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 1]
+ case ECLevel.Q:
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 2]
+ case ECLevel.H:
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 3]
+ default:
+ return undefined
+ }
+}
+
+/**
+ * Returns the number of error correction codewords to use for the specified
+ * version and error correction level.
+ *
+ * @param {Number} version QR Code version
+ * @param {Number} errorCorrectionLevel Error correction level
+ * @return {Number} Number of error correction codewords
+ */
+exports.getTotalCodewordsCount = function getTotalCodewordsCount (version, errorCorrectionLevel) {
+ switch (errorCorrectionLevel) {
+ case ECLevel.L:
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0]
+ case ECLevel.M:
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1]
+ case ECLevel.Q:
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2]
+ case ECLevel.H:
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3]
+ default:
+ return undefined
+ }
+}
+
+},{"./error-correction-level":8}],8:[function(require,module,exports){
+exports.L = { bit: 1 }
+exports.M = { bit: 0 }
+exports.Q = { bit: 3 }
+exports.H = { bit: 2 }
+
+function fromString (string) {
+ if (typeof string !== 'string') {
+ throw new Error('Param is not a string')
+ }
+
+ var lcStr = string.toLowerCase()
+
+ switch (lcStr) {
+ case 'l':
+ case 'low':
+ return exports.L
+
+ case 'm':
+ case 'medium':
+ return exports.M
+
+ case 'q':
+ case 'quartile':
+ return exports.Q
+
+ case 'h':
+ case 'high':
+ return exports.H
+
+ default:
+ throw new Error('Unknown EC Level: ' + string)
+ }
+}
+
+exports.isValid = function isValid (level) {
+ return level && typeof level.bit !== 'undefined' &&
+ level.bit >= 0 && level.bit < 4
+}
+
+exports.from = function from (value, defaultValue) {
+ if (exports.isValid(value)) {
+ return value
+ }
+
+ try {
+ return fromString(value)
+ } catch (e) {
+ return defaultValue
+ }
+}
+
+},{}],9:[function(require,module,exports){
+var getSymbolSize = require('./utils').getSymbolSize
+var FINDER_PATTERN_SIZE = 7
+
+/**
+ * Returns an array containing the positions of each finder pattern.
+ * Each array's element represent the top-left point of the pattern as (x, y) coordinates
+ *
+ * @param {Number} version QR Code version
+ * @return {Array} Array of coordinates
+ */
+exports.getPositions = function getPositions (version) {
+ var size = getSymbolSize(version)
+
+ return [
+ // top-left
+ [0, 0],
+ // top-right
+ [size - FINDER_PATTERN_SIZE, 0],
+ // bottom-left
+ [0, size - FINDER_PATTERN_SIZE]
+ ]
+}
+
+},{"./utils":21}],10:[function(require,module,exports){
+var Utils = require('./utils')
+
+var G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0)
+var G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1)
+var G15_BCH = Utils.getBCHDigit(G15)
+
+/**
+ * Returns format information with relative error correction bits
+ *
+ * The format information is a 15-bit sequence containing 5 data bits,
+ * with 10 error correction bits calculated using the (15, 5) BCH code.
+ *
+ * @param {Number} errorCorrectionLevel Error correction level
+ * @param {Number} mask Mask pattern
+ * @return {Number} Encoded format information bits
+ */
+exports.getEncodedBits = function getEncodedBits (errorCorrectionLevel, mask) {
+ var data = ((errorCorrectionLevel.bit << 3) | mask)
+ var d = data << 10
+
+ while (Utils.getBCHDigit(d) - G15_BCH >= 0) {
+ d ^= (G15 << (Utils.getBCHDigit(d) - G15_BCH))
+ }
+
+ // xor final data with mask pattern in order to ensure that
+ // no combination of Error Correction Level and data mask pattern
+ // will result in an all-zero data string
+ return ((data << 10) | d) ^ G15_MASK
+}
+
+},{"./utils":21}],11:[function(require,module,exports){
+var BufferUtil = require('../utils/buffer')
+
+var EXP_TABLE = BufferUtil.alloc(512)
+var LOG_TABLE = BufferUtil.alloc(256)
+/**
+ * Precompute the log and anti-log tables for faster computation later
+ *
+ * For each possible value in the galois field 2^8, we will pre-compute
+ * the logarithm and anti-logarithm (exponential) of this value
+ *
+ * ref {@link https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Introduction_to_mathematical_fields}
+ */
+;(function initTables () {
+ var x = 1
+ for (var i = 0; i < 255; i++) {
+ EXP_TABLE[i] = x
+ LOG_TABLE[x] = i
+
+ x <<= 1 // multiply by 2
+
+ // The QR code specification says to use byte-wise modulo 100011101 arithmetic.
+ // This means that when a number is 256 or larger, it should be XORed with 0x11D.
+ if (x & 0x100) { // similar to x >= 256, but a lot faster (because 0x100 == 256)
+ x ^= 0x11D
+ }
+ }
+
+ // Optimization: double the size of the anti-log table so that we don't need to mod 255 to
+ // stay inside the bounds (because we will mainly use this table for the multiplication of
+ // two GF numbers, no more).
+ // @see {@link mul}
+ for (i = 255; i < 512; i++) {
+ EXP_TABLE[i] = EXP_TABLE[i - 255]
+ }
+}())
+
+/**
+ * Returns log value of n inside Galois Field
+ *
+ * @param {Number} n
+ * @return {Number}
+ */
+exports.log = function log (n) {
+ if (n < 1) throw new Error('log(' + n + ')')
+ return LOG_TABLE[n]
+}
+
+/**
+ * Returns anti-log value of n inside Galois Field
+ *
+ * @param {Number} n
+ * @return {Number}
+ */
+exports.exp = function exp (n) {
+ return EXP_TABLE[n]
+}
+
+/**
+ * Multiplies two number inside Galois Field
+ *
+ * @param {Number} x
+ * @param {Number} y
+ * @return {Number}
+ */
+exports.mul = function mul (x, y) {
+ if (x === 0 || y === 0) return 0
+
+ // should be EXP_TABLE[(LOG_TABLE[x] + LOG_TABLE[y]) % 255] if EXP_TABLE wasn't oversized
+ // @see {@link initTables}
+ return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]]
+}
+
+},{"../utils/buffer":28}],12:[function(require,module,exports){
+var Mode = require('./mode')
+var Utils = require('./utils')
+
+function KanjiData (data) {
+ this.mode = Mode.KANJI
+ this.data = data
+}
+
+KanjiData.getBitsLength = function getBitsLength (length) {
+ return length * 13
+}
+
+KanjiData.prototype.getLength = function getLength () {
+ return this.data.length
+}
+
+KanjiData.prototype.getBitsLength = function getBitsLength () {
+ return KanjiData.getBitsLength(this.data.length)
+}
+
+KanjiData.prototype.write = function (bitBuffer) {
+ var i
+
+ // In the Shift JIS system, Kanji characters are represented by a two byte combination.
+ // These byte values are shifted from the JIS X 0208 values.
+ // JIS X 0208 gives details of the shift coded representation.
+ for (i = 0; i < this.data.length; i++) {
+ var value = Utils.toSJIS(this.data[i])
+
+ // For characters with Shift JIS values from 0x8140 to 0x9FFC:
+ if (value >= 0x8140 && value <= 0x9FFC) {
+ // Subtract 0x8140 from Shift JIS value
+ value -= 0x8140
+
+ // For characters with Shift JIS values from 0xE040 to 0xEBBF
+ } else if (value >= 0xE040 && value <= 0xEBBF) {
+ // Subtract 0xC140 from Shift JIS value
+ value -= 0xC140
+ } else {
+ throw new Error(
+ 'Invalid SJIS character: ' + this.data[i] + '\n' +
+ 'Make sure your charset is UTF-8')
+ }
+
+ // Multiply most significant byte of result by 0xC0
+ // and add least significant byte to product
+ value = (((value >>> 8) & 0xff) * 0xC0) + (value & 0xff)
+
+ // Convert result to a 13-bit binary string
+ bitBuffer.put(value, 13)
+ }
+}
+
+module.exports = KanjiData
+
+},{"./mode":14,"./utils":21}],13:[function(require,module,exports){
+/**
+ * Data mask pattern reference
+ * @type {Object}
+ */
+exports.Patterns = {
+ PATTERN000: 0,
+ PATTERN001: 1,
+ PATTERN010: 2,
+ PATTERN011: 3,
+ PATTERN100: 4,
+ PATTERN101: 5,
+ PATTERN110: 6,
+ PATTERN111: 7
+}
+
+/**
+ * Weighted penalty scores for the undesirable features
+ * @type {Object}
+ */
+var PenaltyScores = {
+ N1: 3,
+ N2: 3,
+ N3: 40,
+ N4: 10
+}
+
+/**
+ * Check if mask pattern value is valid
+ *
+ * @param {Number} mask Mask pattern
+ * @return {Boolean} true if valid, false otherwise
+ */
+exports.isValid = function isValid (mask) {
+ return mask != null && mask !== '' && !isNaN(mask) && mask >= 0 && mask <= 7
+}
+
+/**
+ * Returns mask pattern from a value.
+ * If value is not valid, returns undefined
+ *
+ * @param {Number|String} value Mask pattern value
+ * @return {Number} Valid mask pattern or undefined
+ */
+exports.from = function from (value) {
+ return exports.isValid(value) ? parseInt(value, 10) : undefined
+}
+
+/**
+* Find adjacent modules in row/column with the same color
+* and assign a penalty value.
+*
+* Points: N1 + i
+* i is the amount by which the number of adjacent modules of the same color exceeds 5
+*/
+exports.getPenaltyN1 = function getPenaltyN1 (data) {
+ var size = data.size
+ var points = 0
+ var sameCountCol = 0
+ var sameCountRow = 0
+ var lastCol = null
+ var lastRow = null
+
+ for (var row = 0; row < size; row++) {
+ sameCountCol = sameCountRow = 0
+ lastCol = lastRow = null
+
+ for (var col = 0; col < size; col++) {
+ var module = data.get(row, col)
+ if (module === lastCol) {
+ sameCountCol++
+ } else {
+ if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5)
+ lastCol = module
+ sameCountCol = 1
+ }
+
+ module = data.get(col, row)
+ if (module === lastRow) {
+ sameCountRow++
+ } else {
+ if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5)
+ lastRow = module
+ sameCountRow = 1
+ }
+ }
+
+ if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5)
+ if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5)
+ }
+
+ return points
+}
+
+/**
+ * Find 2x2 blocks with the same color and assign a penalty value
+ *
+ * Points: N2 * (m - 1) * (n - 1)
+ */
+exports.getPenaltyN2 = function getPenaltyN2 (data) {
+ var size = data.size
+ var points = 0
+
+ for (var row = 0; row < size - 1; row++) {
+ for (var col = 0; col < size - 1; col++) {
+ var last = data.get(row, col) +
+ data.get(row, col + 1) +
+ data.get(row + 1, col) +
+ data.get(row + 1, col + 1)
+
+ if (last === 4 || last === 0) points++
+ }
+ }
+
+ return points * PenaltyScores.N2
+}
+
+/**
+ * Find 1:1:3:1:1 ratio (dark:light:dark:light:dark) pattern in row/column,
+ * preceded or followed by light area 4 modules wide
+ *
+ * Points: N3 * number of pattern found
+ */
+exports.getPenaltyN3 = function getPenaltyN3 (data) {
+ var size = data.size
+ var points = 0
+ var bitsCol = 0
+ var bitsRow = 0
+
+ for (var row = 0; row < size; row++) {
+ bitsCol = bitsRow = 0
+ for (var col = 0; col < size; col++) {
+ bitsCol = ((bitsCol << 1) & 0x7FF) | data.get(row, col)
+ if (col >= 10 && (bitsCol === 0x5D0 || bitsCol === 0x05D)) points++
+
+ bitsRow = ((bitsRow << 1) & 0x7FF) | data.get(col, row)
+ if (col >= 10 && (bitsRow === 0x5D0 || bitsRow === 0x05D)) points++
+ }
+ }
+
+ return points * PenaltyScores.N3
+}
+
+/**
+ * Calculate proportion of dark modules in entire symbol
+ *
+ * Points: N4 * k
+ *
+ * k is the rating of the deviation of the proportion of dark modules
+ * in the symbol from 50% in steps of 5%
+ */
+exports.getPenaltyN4 = function getPenaltyN4 (data) {
+ var darkCount = 0
+ var modulesCount = data.data.length
+
+ for (var i = 0; i < modulesCount; i++) darkCount += data.data[i]
+
+ var k = Math.abs(Math.ceil((darkCount * 100 / modulesCount) / 5) - 10)
+
+ return k * PenaltyScores.N4
+}
+
+/**
+ * Return mask value at given position
+ *
+ * @param {Number} maskPattern Pattern reference value
+ * @param {Number} i Row
+ * @param {Number} j Column
+ * @return {Boolean} Mask value
+ */
+function getMaskAt (maskPattern, i, j) {
+ switch (maskPattern) {
+ case exports.Patterns.PATTERN000: return (i + j) % 2 === 0
+ case exports.Patterns.PATTERN001: return i % 2 === 0
+ case exports.Patterns.PATTERN010: return j % 3 === 0
+ case exports.Patterns.PATTERN011: return (i + j) % 3 === 0
+ case exports.Patterns.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0
+ case exports.Patterns.PATTERN101: return (i * j) % 2 + (i * j) % 3 === 0
+ case exports.Patterns.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 === 0
+ case exports.Patterns.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 === 0
+
+ default: throw new Error('bad maskPattern:' + maskPattern)
+ }
+}
+
+/**
+ * Apply a mask pattern to a BitMatrix
+ *
+ * @param {Number} pattern Pattern reference number
+ * @param {BitMatrix} data BitMatrix data
+ */
+exports.applyMask = function applyMask (pattern, data) {
+ var size = data.size
+
+ for (var col = 0; col < size; col++) {
+ for (var row = 0; row < size; row++) {
+ if (data.isReserved(row, col)) continue
+ data.xor(row, col, getMaskAt(pattern, row, col))
+ }
+ }
+}
+
+/**
+ * Returns the best mask pattern for data
+ *
+ * @param {BitMatrix} data
+ * @return {Number} Mask pattern reference number
+ */
+exports.getBestMask = function getBestMask (data, setupFormatFunc) {
+ var numPatterns = Object.keys(exports.Patterns).length
+ var bestPattern = 0
+ var lowerPenalty = Infinity
+
+ for (var p = 0; p < numPatterns; p++) {
+ setupFormatFunc(p)
+ exports.applyMask(p, data)
+
+ // Calculate penalty
+ var penalty =
+ exports.getPenaltyN1(data) +
+ exports.getPenaltyN2(data) +
+ exports.getPenaltyN3(data) +
+ exports.getPenaltyN4(data)
+
+ // Undo previously applied mask
+ exports.applyMask(p, data)
+
+ if (penalty < lowerPenalty) {
+ lowerPenalty = penalty
+ bestPattern = p
+ }
+ }
+
+ return bestPattern
+}
+
+},{}],14:[function(require,module,exports){
+var VersionCheck = require('./version-check')
+var Regex = require('./regex')
+
+/**
+ * Numeric mode encodes data from the decimal digit set (0 - 9)
+ * (byte values 30HEX to 39HEX).
+ * Normally, 3 data characters are represented by 10 bits.
+ *
+ * @type {Object}
+ */
+exports.NUMERIC = {
+ id: 'Numeric',
+ bit: 1 << 0,
+ ccBits: [10, 12, 14]
+}
+
+/**
+ * Alphanumeric mode encodes data from a set of 45 characters,
+ * i.e. 10 numeric digits (0 - 9),
+ * 26 alphabetic characters (A - Z),
+ * and 9 symbols (SP, $, %, *, +, -, ., /, :).
+ * Normally, two input characters are represented by 11 bits.
+ *
+ * @type {Object}
+ */
+exports.ALPHANUMERIC = {
+ id: 'Alphanumeric',
+ bit: 1 << 1,
+ ccBits: [9, 11, 13]
+}
+
+/**
+ * In byte mode, data is encoded at 8 bits per character.
+ *
+ * @type {Object}
+ */
+exports.BYTE = {
+ id: 'Byte',
+ bit: 1 << 2,
+ ccBits: [8, 16, 16]
+}
+
+/**
+ * The Kanji mode efficiently encodes Kanji characters in accordance with
+ * the Shift JIS system based on JIS X 0208.
+ * The Shift JIS values are shifted from the JIS X 0208 values.
+ * JIS X 0208 gives details of the shift coded representation.
+ * Each two-byte character value is compacted to a 13-bit binary codeword.
+ *
+ * @type {Object}
+ */
+exports.KANJI = {
+ id: 'Kanji',
+ bit: 1 << 3,
+ ccBits: [8, 10, 12]
+}
+
+/**
+ * Mixed mode will contain a sequences of data in a combination of any of
+ * the modes described above
+ *
+ * @type {Object}
+ */
+exports.MIXED = {
+ bit: -1
+}
+
+/**
+ * Returns the number of bits needed to store the data length
+ * according to QR Code specifications.
+ *
+ * @param {Mode} mode Data mode
+ * @param {Number} version QR Code version
+ * @return {Number} Number of bits
+ */
+exports.getCharCountIndicator = function getCharCountIndicator (mode, version) {
+ if (!mode.ccBits) throw new Error('Invalid mode: ' + mode)
+
+ if (!VersionCheck.isValid(version)) {
+ throw new Error('Invalid version: ' + version)
+ }
+
+ if (version >= 1 && version < 10) return mode.ccBits[0]
+ else if (version < 27) return mode.ccBits[1]
+ return mode.ccBits[2]
+}
+
+/**
+ * Returns the most efficient mode to store the specified data
+ *
+ * @param {String} dataStr Input data string
+ * @return {Mode} Best mode
+ */
+exports.getBestModeForData = function getBestModeForData (dataStr) {
+ if (Regex.testNumeric(dataStr)) return exports.NUMERIC
+ else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC
+ else if (Regex.testKanji(dataStr)) return exports.KANJI
+ else return exports.BYTE
+}
+
+/**
+ * Return mode name as string
+ *
+ * @param {Mode} mode Mode object
+ * @returns {String} Mode name
+ */
+exports.toString = function toString (mode) {
+ if (mode && mode.id) return mode.id
+ throw new Error('Invalid mode')
+}
+
+/**
+ * Check if input param is a valid mode object
+ *
+ * @param {Mode} mode Mode object
+ * @returns {Boolean} True if valid mode, false otherwise
+ */
+exports.isValid = function isValid (mode) {
+ return mode && mode.bit && mode.ccBits
+}
+
+/**
+ * Get mode object from its name
+ *
+ * @param {String} string Mode name
+ * @returns {Mode} Mode object
+ */
+function fromString (string) {
+ if (typeof string !== 'string') {
+ throw new Error('Param is not a string')
+ }
+
+ var lcStr = string.toLowerCase()
+
+ switch (lcStr) {
+ case 'numeric':
+ return exports.NUMERIC
+ case 'alphanumeric':
+ return exports.ALPHANUMERIC
+ case 'kanji':
+ return exports.KANJI
+ case 'byte':
+ return exports.BYTE
+ default:
+ throw new Error('Unknown mode: ' + string)
+ }
+}
+
+/**
+ * Returns mode from a value.
+ * If value is not a valid mode, returns defaultValue
+ *
+ * @param {Mode|String} value Encoding mode
+ * @param {Mode} defaultValue Fallback value
+ * @return {Mode} Encoding mode
+ */
+exports.from = function from (value, defaultValue) {
+ if (exports.isValid(value)) {
+ return value
+ }
+
+ try {
+ return fromString(value)
+ } catch (e) {
+ return defaultValue
+ }
+}
+
+},{"./regex":19,"./version-check":22}],15:[function(require,module,exports){
+var Mode = require('./mode')
+
+function NumericData (data) {
+ this.mode = Mode.NUMERIC
+ this.data = data.toString()
+}
+
+NumericData.getBitsLength = function getBitsLength (length) {
+ return 10 * Math.floor(length / 3) + ((length % 3) ? ((length % 3) * 3 + 1) : 0)
+}
+
+NumericData.prototype.getLength = function getLength () {
+ return this.data.length
+}
+
+NumericData.prototype.getBitsLength = function getBitsLength () {
+ return NumericData.getBitsLength(this.data.length)
+}
+
+NumericData.prototype.write = function write (bitBuffer) {
+ var i, group, value
+
+ // The input data string is divided into groups of three digits,
+ // and each group is converted to its 10-bit binary equivalent.
+ for (i = 0; i + 3 <= this.data.length; i += 3) {
+ group = this.data.substr(i, 3)
+ value = parseInt(group, 10)
+
+ bitBuffer.put(value, 10)
+ }
+
+ // If the number of input digits is not an exact multiple of three,
+ // the final one or two digits are converted to 4 or 7 bits respectively.
+ var remainingNum = this.data.length - i
+ if (remainingNum > 0) {
+ group = this.data.substr(i)
+ value = parseInt(group, 10)
+
+ bitBuffer.put(value, remainingNum * 3 + 1)
+ }
+}
+
+module.exports = NumericData
+
+},{"./mode":14}],16:[function(require,module,exports){
+var BufferUtil = require('../utils/buffer')
+var GF = require('./galois-field')
+
+/**
+ * Multiplies two polynomials inside Galois Field
+ *
+ * @param {Buffer} p1 Polynomial
+ * @param {Buffer} p2 Polynomial
+ * @return {Buffer} Product of p1 and p2
+ */
+exports.mul = function mul (p1, p2) {
+ var coeff = BufferUtil.alloc(p1.length + p2.length - 1)
+
+ for (var i = 0; i < p1.length; i++) {
+ for (var j = 0; j < p2.length; j++) {
+ coeff[i + j] ^= GF.mul(p1[i], p2[j])
+ }
+ }
+
+ return coeff
+}
+
+/**
+ * Calculate the remainder of polynomials division
+ *
+ * @param {Buffer} divident Polynomial
+ * @param {Buffer} divisor Polynomial
+ * @return {Buffer} Remainder
+ */
+exports.mod = function mod (divident, divisor) {
+ var result = BufferUtil.from(divident)
+
+ while ((result.length - divisor.length) >= 0) {
+ var coeff = result[0]
+
+ for (var i = 0; i < divisor.length; i++) {
+ result[i] ^= GF.mul(divisor[i], coeff)
+ }
+
+ // remove all zeros from buffer head
+ var offset = 0
+ while (offset < result.length && result[offset] === 0) offset++
+ result = result.slice(offset)
+ }
+
+ return result
+}
+
+/**
+ * Generate an irreducible generator polynomial of specified degree
+ * (used by Reed-Solomon encoder)
+ *
+ * @param {Number} degree Degree of the generator polynomial
+ * @return {Buffer} Buffer containing polynomial coefficients
+ */
+exports.generateECPolynomial = function generateECPolynomial (degree) {
+ var poly = BufferUtil.from([1])
+ for (var i = 0; i < degree; i++) {
+ poly = exports.mul(poly, [1, GF.exp(i)])
+ }
+
+ return poly
+}
+
+},{"../utils/buffer":28,"./galois-field":11}],17:[function(require,module,exports){
+var BufferUtil = require('../utils/buffer')
+var Utils = require('./utils')
+var ECLevel = require('./error-correction-level')
+var BitBuffer = require('./bit-buffer')
+var BitMatrix = require('./bit-matrix')
+var AlignmentPattern = require('./alignment-pattern')
+var FinderPattern = require('./finder-pattern')
+var MaskPattern = require('./mask-pattern')
+var ECCode = require('./error-correction-code')
+var ReedSolomonEncoder = require('./reed-solomon-encoder')
+var Version = require('./version')
+var FormatInfo = require('./format-info')
+var Mode = require('./mode')
+var Segments = require('./segments')
+var isArray = require('isarray')
+
+/**
+ * QRCode for JavaScript
+ *
+ * modified by Ryan Day for nodejs support
+ * Copyright (c) 2011 Ryan Day
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+//---------------------------------------------------------------------
+// QRCode for JavaScript
+//
+// Copyright (c) 2009 Kazuhiko Arase
+//
+// URL: http://www.d-project.com/
+//
+// Licensed under the MIT license:
+// http://www.opensource.org/licenses/mit-license.php
+//
+// The word "QR Code" is registered trademark of
+// DENSO WAVE INCORPORATED
+// http://www.denso-wave.com/qrcode/faqpatent-e.html
+//
+//---------------------------------------------------------------------
+*/
+
+/**
+ * Add finder patterns bits to matrix
+ *
+ * @param {BitMatrix} matrix Modules matrix
+ * @param {Number} version QR Code version
+ */
+function setupFinderPattern (matrix, version) {
+ var size = matrix.size
+ var pos = FinderPattern.getPositions(version)
+
+ for (var i = 0; i < pos.length; i++) {
+ var row = pos[i][0]
+ var col = pos[i][1]
+
+ for (var r = -1; r <= 7; r++) {
+ if (row + r <= -1 || size <= row + r) continue
+
+ for (var c = -1; c <= 7; c++) {
+ if (col + c <= -1 || size <= col + c) continue
+
+ if ((r >= 0 && r <= 6 && (c === 0 || c === 6)) ||
+ (c >= 0 && c <= 6 && (r === 0 || r === 6)) ||
+ (r >= 2 && r <= 4 && c >= 2 && c <= 4)) {
+ matrix.set(row + r, col + c, true, true)
+ } else {
+ matrix.set(row + r, col + c, false, true)
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Add timing pattern bits to matrix
+ *
+ * Note: this function must be called before {@link setupAlignmentPattern}
+ *
+ * @param {BitMatrix} matrix Modules matrix
+ */
+function setupTimingPattern (matrix) {
+ var size = matrix.size
+
+ for (var r = 8; r < size - 8; r++) {
+ var value = r % 2 === 0
+ matrix.set(r, 6, value, true)
+ matrix.set(6, r, value, true)
+ }
+}
+
+/**
+ * Add alignment patterns bits to matrix
+ *
+ * Note: this function must be called after {@link setupTimingPattern}
+ *
+ * @param {BitMatrix} matrix Modules matrix
+ * @param {Number} version QR Code version
+ */
+function setupAlignmentPattern (matrix, version) {
+ var pos = AlignmentPattern.getPositions(version)
+
+ for (var i = 0; i < pos.length; i++) {
+ var row = pos[i][0]
+ var col = pos[i][1]
+
+ for (var r = -2; r <= 2; r++) {
+ for (var c = -2; c <= 2; c++) {
+ if (r === -2 || r === 2 || c === -2 || c === 2 ||
+ (r === 0 && c === 0)) {
+ matrix.set(row + r, col + c, true, true)
+ } else {
+ matrix.set(row + r, col + c, false, true)
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Add version info bits to matrix
+ *
+ * @param {BitMatrix} matrix Modules matrix
+ * @param {Number} version QR Code version
+ */
+function setupVersionInfo (matrix, version) {
+ var size = matrix.size
+ var bits = Version.getEncodedBits(version)
+ var row, col, mod
+
+ for (var i = 0; i < 18; i++) {
+ row = Math.floor(i / 3)
+ col = i % 3 + size - 8 - 3
+ mod = ((bits >> i) & 1) === 1
+
+ matrix.set(row, col, mod, true)
+ matrix.set(col, row, mod, true)
+ }
+}
+
+/**
+ * Add format info bits to matrix
+ *
+ * @param {BitMatrix} matrix Modules matrix
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
+ * @param {Number} maskPattern Mask pattern reference value
+ */
+function setupFormatInfo (matrix, errorCorrectionLevel, maskPattern) {
+ var size = matrix.size
+ var bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern)
+ var i, mod
+
+ for (i = 0; i < 15; i++) {
+ mod = ((bits >> i) & 1) === 1
+
+ // vertical
+ if (i < 6) {
+ matrix.set(i, 8, mod, true)
+ } else if (i < 8) {
+ matrix.set(i + 1, 8, mod, true)
+ } else {
+ matrix.set(size - 15 + i, 8, mod, true)
+ }
+
+ // horizontal
+ if (i < 8) {
+ matrix.set(8, size - i - 1, mod, true)
+ } else if (i < 9) {
+ matrix.set(8, 15 - i - 1 + 1, mod, true)
+ } else {
+ matrix.set(8, 15 - i - 1, mod, true)
+ }
+ }
+
+ // fixed module
+ matrix.set(size - 8, 8, 1, true)
+}
+
+/**
+ * Add encoded data bits to matrix
+ *
+ * @param {BitMatrix} matrix Modules matrix
+ * @param {Buffer} data Data codewords
+ */
+function setupData (matrix, data) {
+ var size = matrix.size
+ var inc = -1
+ var row = size - 1
+ var bitIndex = 7
+ var byteIndex = 0
+
+ for (var col = size - 1; col > 0; col -= 2) {
+ if (col === 6) col--
+
+ while (true) {
+ for (var c = 0; c < 2; c++) {
+ if (!matrix.isReserved(row, col - c)) {
+ var dark = false
+
+ if (byteIndex < data.length) {
+ dark = (((data[byteIndex] >>> bitIndex) & 1) === 1)
+ }
+
+ matrix.set(row, col - c, dark)
+ bitIndex--
+
+ if (bitIndex === -1) {
+ byteIndex++
+ bitIndex = 7
+ }
+ }
+ }
+
+ row += inc
+
+ if (row < 0 || size <= row) {
+ row -= inc
+ inc = -inc
+ break
+ }
+ }
+ }
+}
+
+/**
+ * Create encoded codewords from data input
+ *
+ * @param {Number} version QR Code version
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
+ * @param {ByteData} data Data input
+ * @return {Buffer} Buffer containing encoded codewords
+ */
+function createData (version, errorCorrectionLevel, segments) {
+ // Prepare data buffer
+ var buffer = new BitBuffer()
+
+ segments.forEach(function (data) {
+ // prefix data with mode indicator (4 bits)
+ buffer.put(data.mode.bit, 4)
+
+ // Prefix data with character count indicator.
+ // The character count indicator is a string of bits that represents the
+ // number of characters that are being encoded.
+ // The character count indicator must be placed after the mode indicator
+ // and must be a certain number of bits long, depending on the QR version
+ // and data mode
+ // @see {@link Mode.getCharCountIndicator}.
+ buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version))
+
+ // add binary data sequence to buffer
+ data.write(buffer)
+ })
+
+ // Calculate required number of bits
+ var totalCodewords = Utils.getSymbolTotalCodewords(version)
+ var ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)
+ var dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8
+
+ // Add a terminator.
+ // If the bit string is shorter than the total number of required bits,
+ // a terminator of up to four 0s must be added to the right side of the string.
+ // If the bit string is more than four bits shorter than the required number of bits,
+ // add four 0s to the end.
+ if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {
+ buffer.put(0, 4)
+ }
+
+ // If the bit string is fewer than four bits shorter, add only the number of 0s that
+ // are needed to reach the required number of bits.
+
+ // After adding the terminator, if the number of bits in the string is not a multiple of 8,
+ // pad the string on the right with 0s to make the string's length a multiple of 8.
+ while (buffer.getLengthInBits() % 8 !== 0) {
+ buffer.putBit(0)
+ }
+
+ // Add pad bytes if the string is still shorter than the total number of required bits.
+ // Extend the buffer to fill the data capacity of the symbol corresponding to
+ // the Version and Error Correction Level by adding the Pad Codewords 11101100 (0xEC)
+ // and 00010001 (0x11) alternately.
+ var remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8
+ for (var i = 0; i < remainingByte; i++) {
+ buffer.put(i % 2 ? 0x11 : 0xEC, 8)
+ }
+
+ return createCodewords(buffer, version, errorCorrectionLevel)
+}
+
+/**
+ * Encode input data with Reed-Solomon and return codewords with
+ * relative error correction bits
+ *
+ * @param {BitBuffer} bitBuffer Data to encode
+ * @param {Number} version QR Code version
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
+ * @return {Buffer} Buffer containing encoded codewords
+ */
+function createCodewords (bitBuffer, version, errorCorrectionLevel) {
+ // Total codewords for this QR code version (Data + Error correction)
+ var totalCodewords = Utils.getSymbolTotalCodewords(version)
+
+ // Total number of error correction codewords
+ var ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)
+
+ // Total number of data codewords
+ var dataTotalCodewords = totalCodewords - ecTotalCodewords
+
+ // Total number of blocks
+ var ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel)
+
+ // Calculate how many blocks each group should contain
+ var blocksInGroup2 = totalCodewords % ecTotalBlocks
+ var blocksInGroup1 = ecTotalBlocks - blocksInGroup2
+
+ var totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks)
+
+ var dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks)
+ var dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1
+
+ // Number of EC codewords is the same for both groups
+ var ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1
+
+ // Initialize a Reed-Solomon encoder with a generator polynomial of degree ecCount
+ var rs = new ReedSolomonEncoder(ecCount)
+
+ var offset = 0
+ var dcData = new Array(ecTotalBlocks)
+ var ecData = new Array(ecTotalBlocks)
+ var maxDataSize = 0
+ var buffer = BufferUtil.from(bitBuffer.buffer)
+
+ // Divide the buffer into the required number of blocks
+ for (var b = 0; b < ecTotalBlocks; b++) {
+ var dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2
+
+ // extract a block of data from buffer
+ dcData[b] = buffer.slice(offset, offset + dataSize)
+
+ // Calculate EC codewords for this data block
+ ecData[b] = rs.encode(dcData[b])
+
+ offset += dataSize
+ maxDataSize = Math.max(maxDataSize, dataSize)
+ }
+
+ // Create final data
+ // Interleave the data and error correction codewords from each block
+ var data = BufferUtil.alloc(totalCodewords)
+ var index = 0
+ var i, r
+
+ // Add data codewords
+ for (i = 0; i < maxDataSize; i++) {
+ for (r = 0; r < ecTotalBlocks; r++) {
+ if (i < dcData[r].length) {
+ data[index++] = dcData[r][i]
+ }
+ }
+ }
+
+ // Apped EC codewords
+ for (i = 0; i < ecCount; i++) {
+ for (r = 0; r < ecTotalBlocks; r++) {
+ data[index++] = ecData[r][i]
+ }
+ }
+
+ return data
+}
+
+/**
+ * Build QR Code symbol
+ *
+ * @param {String} data Input string
+ * @param {Number} version QR Code version
+ * @param {ErrorCorretionLevel} errorCorrectionLevel Error level
+ * @param {MaskPattern} maskPattern Mask pattern
+ * @return {Object} Object containing symbol data
+ */
+function createSymbol (data, version, errorCorrectionLevel, maskPattern) {
+ var segments
+
+ if (isArray(data)) {
+ segments = Segments.fromArray(data)
+ } else if (typeof data === 'string') {
+ var estimatedVersion = version
+
+ if (!estimatedVersion) {
+ var rawSegments = Segments.rawSplit(data)
+
+ // Estimate best version that can contain raw splitted segments
+ estimatedVersion = Version.getBestVersionForData(rawSegments,
+ errorCorrectionLevel)
+ }
+
+ // Build optimized segments
+ // If estimated version is undefined, try with the highest version
+ segments = Segments.fromString(data, estimatedVersion || 40)
+ } else {
+ throw new Error('Invalid data')
+ }
+
+ // Get the min version that can contain data
+ var bestVersion = Version.getBestVersionForData(segments,
+ errorCorrectionLevel)
+
+ // If no version is found, data cannot be stored
+ if (!bestVersion) {
+ throw new Error('The amount of data is too big to be stored in a QR Code')
+ }
+
+ // If not specified, use min version as default
+ if (!version) {
+ version = bestVersion
+
+ // Check if the specified version can contain the data
+ } else if (version < bestVersion) {
+ throw new Error('\n' +
+ 'The chosen QR Code version cannot contain this amount of data.\n' +
+ 'Minimum version required to store current data is: ' + bestVersion + '.\n'
+ )
+ }
+
+ var dataBits = createData(version, errorCorrectionLevel, segments)
+
+ // Allocate matrix buffer
+ var moduleCount = Utils.getSymbolSize(version)
+ var modules = new BitMatrix(moduleCount)
+
+ // Add function modules
+ setupFinderPattern(modules, version)
+ setupTimingPattern(modules)
+ setupAlignmentPattern(modules, version)
+
+ // Add temporary dummy bits for format info just to set them as reserved.
+ // This is needed to prevent these bits from being masked by {@link MaskPattern.applyMask}
+ // since the masking operation must be performed only on the encoding region.
+ // These blocks will be replaced with correct values later in code.
+ setupFormatInfo(modules, errorCorrectionLevel, 0)
+
+ if (version >= 7) {
+ setupVersionInfo(modules, version)
+ }
+
+ // Add data codewords
+ setupData(modules, dataBits)
+
+ if (isNaN(maskPattern)) {
+ // Find best mask pattern
+ maskPattern = MaskPattern.getBestMask(modules,
+ setupFormatInfo.bind(null, modules, errorCorrectionLevel))
+ }
+
+ // Apply mask pattern
+ MaskPattern.applyMask(maskPattern, modules)
+
+ // Replace format info bits with correct values
+ setupFormatInfo(modules, errorCorrectionLevel, maskPattern)
+
+ return {
+ modules: modules,
+ version: version,
+ errorCorrectionLevel: errorCorrectionLevel,
+ maskPattern: maskPattern,
+ segments: segments
+ }
+}
+
+/**
+ * QR Code
+ *
+ * @param {String | Array} data Input data
+ * @param {Object} options Optional configurations
+ * @param {Number} options.version QR Code version
+ * @param {String} options.errorCorrectionLevel Error correction level
+ * @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis
+ */
+exports.create = function create (data, options) {
+ if (typeof data === 'undefined' || data === '') {
+ throw new Error('No input text')
+ }
+
+ var errorCorrectionLevel = ECLevel.M
+ var version
+ var mask
+
+ if (typeof options !== 'undefined') {
+ // Use higher error correction level as default
+ errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M)
+ version = Version.from(options.version)
+ mask = MaskPattern.from(options.maskPattern)
+
+ if (options.toSJISFunc) {
+ Utils.setToSJISFunction(options.toSJISFunc)
+ }
+ }
+
+ return createSymbol(data, version, errorCorrectionLevel, mask)
+}
+
+},{"../utils/buffer":28,"./alignment-pattern":2,"./bit-buffer":4,"./bit-matrix":5,"./error-correction-code":7,"./error-correction-level":8,"./finder-pattern":9,"./format-info":10,"./mask-pattern":13,"./mode":14,"./reed-solomon-encoder":18,"./segments":20,"./utils":21,"./version":23,"isarray":33}],18:[function(require,module,exports){
+var BufferUtil = require('../utils/buffer')
+var Polynomial = require('./polynomial')
+var Buffer = require('buffer').Buffer
+
+function ReedSolomonEncoder (degree) {
+ this.genPoly = undefined
+ this.degree = degree
+
+ if (this.degree) this.initialize(this.degree)
+}
+
+/**
+ * Initialize the encoder.
+ * The input param should correspond to the number of error correction codewords.
+ *
+ * @param {Number} degree
+ */
+ReedSolomonEncoder.prototype.initialize = function initialize (degree) {
+ // create an irreducible generator polynomial
+ this.degree = degree
+ this.genPoly = Polynomial.generateECPolynomial(this.degree)
+}
+
+/**
+ * Encodes a chunk of data
+ *
+ * @param {Buffer} data Buffer containing input data
+ * @return {Buffer} Buffer containing encoded data
+ */
+ReedSolomonEncoder.prototype.encode = function encode (data) {
+ if (!this.genPoly) {
+ throw new Error('Encoder not initialized')
+ }
+
+ // Calculate EC for this data block
+ // extends data size to data+genPoly size
+ var pad = BufferUtil.alloc(this.degree)
+ var paddedData = Buffer.concat([data, pad], data.length + this.degree)
+
+ // The error correction codewords are the remainder after dividing the data codewords
+ // by a generator polynomial
+ var remainder = Polynomial.mod(paddedData, this.genPoly)
+
+ // return EC data blocks (last n byte, where n is the degree of genPoly)
+ // If coefficients number in remainder are less than genPoly degree,
+ // pad with 0s to the left to reach the needed number of coefficients
+ var start = this.degree - remainder.length
+ if (start > 0) {
+ var buff = BufferUtil.alloc(this.degree)
+ remainder.copy(buff, start)
+
+ return buff
+ }
+
+ return remainder
+}
+
+module.exports = ReedSolomonEncoder
+
+},{"../utils/buffer":28,"./polynomial":16,"buffer":30}],19:[function(require,module,exports){
+var numeric = '[0-9]+'
+var alphanumeric = '[A-Z $%*+\\-./:]+'
+var kanji = '(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|' +
+ '[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|' +
+ '[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|' +
+ '[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+'
+kanji = kanji.replace(/u/g, '\\u')
+
+var byte = '(?:(?![A-Z0-9 $%*+\\-./:]|' + kanji + ')(?:.|[\r\n]))+'
+
+exports.KANJI = new RegExp(kanji, 'g')
+exports.BYTE_KANJI = new RegExp('[^A-Z0-9 $%*+\\-./:]+', 'g')
+exports.BYTE = new RegExp(byte, 'g')
+exports.NUMERIC = new RegExp(numeric, 'g')
+exports.ALPHANUMERIC = new RegExp(alphanumeric, 'g')
+
+var TEST_KANJI = new RegExp('^' + kanji + '$')
+var TEST_NUMERIC = new RegExp('^' + numeric + '$')
+var TEST_ALPHANUMERIC = new RegExp('^[A-Z0-9 $%*+\\-./:]+$')
+
+exports.testKanji = function testKanji (str) {
+ return TEST_KANJI.test(str)
+}
+
+exports.testNumeric = function testNumeric (str) {
+ return TEST_NUMERIC.test(str)
+}
+
+exports.testAlphanumeric = function testAlphanumeric (str) {
+ return TEST_ALPHANUMERIC.test(str)
+}
+
+},{}],20:[function(require,module,exports){
+var Mode = require('./mode')
+var NumericData = require('./numeric-data')
+var AlphanumericData = require('./alphanumeric-data')
+var ByteData = require('./byte-data')
+var KanjiData = require('./kanji-data')
+var Regex = require('./regex')
+var Utils = require('./utils')
+var dijkstra = require('dijkstrajs')
+
+/**
+ * Returns UTF8 byte length
+ *
+ * @param {String} str Input string
+ * @return {Number} Number of byte
+ */
+function getStringByteLength (str) {
+ return unescape(encodeURIComponent(str)).length
+}
+
+/**
+ * Get a list of segments of the specified mode
+ * from a string
+ *
+ * @param {Mode} mode Segment mode
+ * @param {String} str String to process
+ * @return {Array} Array of object with segments data
+ */
+function getSegments (regex, mode, str) {
+ var segments = []
+ var result
+
+ while ((result = regex.exec(str)) !== null) {
+ segments.push({
+ data: result[0],
+ index: result.index,
+ mode: mode,
+ length: result[0].length
+ })
+ }
+
+ return segments
+}
+
+/**
+ * Extracts a series of segments with the appropriate
+ * modes from a string
+ *
+ * @param {String} dataStr Input string
+ * @return {Array} Array of object with segments data
+ */
+function getSegmentsFromString (dataStr) {
+ var numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr)
+ var alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr)
+ var byteSegs
+ var kanjiSegs
+
+ if (Utils.isKanjiModeEnabled()) {
+ byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr)
+ kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr)
+ } else {
+ byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr)
+ kanjiSegs = []
+ }
+
+ var segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs)
+
+ return segs
+ .sort(function (s1, s2) {
+ return s1.index - s2.index
+ })
+ .map(function (obj) {
+ return {
+ data: obj.data,
+ mode: obj.mode,
+ length: obj.length
+ }
+ })
+}
+
+/**
+ * Returns how many bits are needed to encode a string of
+ * specified length with the specified mode
+ *
+ * @param {Number} length String length
+ * @param {Mode} mode Segment mode
+ * @return {Number} Bit length
+ */
+function getSegmentBitsLength (length, mode) {
+ switch (mode) {
+ case Mode.NUMERIC:
+ return NumericData.getBitsLength(length)
+ case Mode.ALPHANUMERIC:
+ return AlphanumericData.getBitsLength(length)
+ case Mode.KANJI:
+ return KanjiData.getBitsLength(length)
+ case Mode.BYTE:
+ return ByteData.getBitsLength(length)
+ }
+}
+
+/**
+ * Merges adjacent segments which have the same mode
+ *
+ * @param {Array} segs Array of object with segments data
+ * @return {Array} Array of object with segments data
+ */
+function mergeSegments (segs) {
+ return segs.reduce(function (acc, curr) {
+ var prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null
+ if (prevSeg && prevSeg.mode === curr.mode) {
+ acc[acc.length - 1].data += curr.data
+ return acc
+ }
+
+ acc.push(curr)
+ return acc
+ }, [])
+}
+
+/**
+ * Generates a list of all possible nodes combination which
+ * will be used to build a segments graph.
+ *
+ * Nodes are divided by groups. Each group will contain a list of all the modes
+ * in which is possible to encode the given text.
+ *
+ * For example the text '12345' can be encoded as Numeric, Alphanumeric or Byte.
+ * The group for '12345' will contain then 3 objects, one for each
+ * possible encoding mode.
+ *
+ * Each node represents a possible segment.
+ *
+ * @param {Array} segs Array of object with segments data
+ * @return {Array} Array of object with segments data
+ */
+function buildNodes (segs) {
+ var nodes = []
+ for (var i = 0; i < segs.length; i++) {
+ var seg = segs[i]
+
+ switch (seg.mode) {
+ case Mode.NUMERIC:
+ nodes.push([seg,
+ { data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },
+ { data: seg.data, mode: Mode.BYTE, length: seg.length }
+ ])
+ break
+ case Mode.ALPHANUMERIC:
+ nodes.push([seg,
+ { data: seg.data, mode: Mode.BYTE, length: seg.length }
+ ])
+ break
+ case Mode.KANJI:
+ nodes.push([seg,
+ { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
+ ])
+ break
+ case Mode.BYTE:
+ nodes.push([
+ { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
+ ])
+ }
+ }
+
+ return nodes
+}
+
+/**
+ * Builds a graph from a list of nodes.
+ * All segments in each node group will be connected with all the segments of
+ * the next group and so on.
+ *
+ * At each connection will be assigned a weight depending on the
+ * segment's byte length.
+ *
+ * @param {Array} nodes Array of object with segments data
+ * @param {Number} version QR Code version
+ * @return {Object} Graph of all possible segments
+ */
+function buildGraph (nodes, version) {
+ var table = {}
+ var graph = {'start': {}}
+ var prevNodeIds = ['start']
+
+ for (var i = 0; i < nodes.length; i++) {
+ var nodeGroup = nodes[i]
+ var currentNodeIds = []
+
+ for (var j = 0; j < nodeGroup.length; j++) {
+ var node = nodeGroup[j]
+ var key = '' + i + j
+
+ currentNodeIds.push(key)
+ table[key] = { node: node, lastCount: 0 }
+ graph[key] = {}
+
+ for (var n = 0; n < prevNodeIds.length; n++) {
+ var prevNodeId = prevNodeIds[n]
+
+ if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
+ graph[prevNodeId][key] =
+ getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) -
+ getSegmentBitsLength(table[prevNodeId].lastCount, node.mode)
+
+ table[prevNodeId].lastCount += node.length
+ } else {
+ if (table[prevNodeId]) table[prevNodeId].lastCount = node.length
+
+ graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) +
+ 4 + Mode.getCharCountIndicator(node.mode, version) // switch cost
+ }
+ }
+ }
+
+ prevNodeIds = currentNodeIds
+ }
+
+ for (n = 0; n < prevNodeIds.length; n++) {
+ graph[prevNodeIds[n]]['end'] = 0
+ }
+
+ return { map: graph, table: table }
+}
+
+/**
+ * Builds a segment from a specified data and mode.
+ * If a mode is not specified, the more suitable will be used.
+ *
+ * @param {String} data Input data
+ * @param {Mode | String} modesHint Data mode
+ * @return {Segment} Segment
+ */
+function buildSingleSegment (data, modesHint) {
+ var mode
+ var bestMode = Mode.getBestModeForData(data)
+
+ mode = Mode.from(modesHint, bestMode)
+
+ // Make sure data can be encoded
+ if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {
+ throw new Error('"' + data + '"' +
+ ' cannot be encoded with mode ' + Mode.toString(mode) +
+ '.\n Suggested mode is: ' + Mode.toString(bestMode))
+ }
+
+ // Use Mode.BYTE if Kanji support is disabled
+ if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {
+ mode = Mode.BYTE
+ }
+
+ switch (mode) {
+ case Mode.NUMERIC:
+ return new NumericData(data)
+
+ case Mode.ALPHANUMERIC:
+ return new AlphanumericData(data)
+
+ case Mode.KANJI:
+ return new KanjiData(data)
+
+ case Mode.BYTE:
+ return new ByteData(data)
+ }
+}
+
+/**
+ * Builds a list of segments from an array.
+ * Array can contain Strings or Objects with segment's info.
+ *
+ * For each item which is a string, will be generated a segment with the given
+ * string and the more appropriate encoding mode.
+ *
+ * For each item which is an object, will be generated a segment with the given
+ * data and mode.
+ * Objects must contain at least the property "data".
+ * If property "mode" is not present, the more suitable mode will be used.
+ *
+ * @param {Array} array Array of objects with segments data
+ * @return {Array} Array of Segments
+ */
+exports.fromArray = function fromArray (array) {
+ return array.reduce(function (acc, seg) {
+ if (typeof seg === 'string') {
+ acc.push(buildSingleSegment(seg, null))
+ } else if (seg.data) {
+ acc.push(buildSingleSegment(seg.data, seg.mode))
+ }
+
+ return acc
+ }, [])
+}
+
+/**
+ * Builds an optimized sequence of segments from a string,
+ * which will produce the shortest possible bitstream.
+ *
+ * @param {String} data Input string
+ * @param {Number} version QR Code version
+ * @return {Array} Array of segments
+ */
+exports.fromString = function fromString (data, version) {
+ var segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled())
+
+ var nodes = buildNodes(segs)
+ var graph = buildGraph(nodes, version)
+ var path = dijkstra.find_path(graph.map, 'start', 'end')
+
+ var optimizedSegs = []
+ for (var i = 1; i < path.length - 1; i++) {
+ optimizedSegs.push(graph.table[path[i]].node)
+ }
+
+ return exports.fromArray(mergeSegments(optimizedSegs))
+}
+
+/**
+ * Splits a string in various segments with the modes which
+ * best represent their content.
+ * The produced segments are far from being optimized.
+ * The output of this function is only used to estimate a QR Code version
+ * which may contain the data.
+ *
+ * @param {string} data Input string
+ * @return {Array} Array of segments
+ */
+exports.rawSplit = function rawSplit (data) {
+ return exports.fromArray(
+ getSegmentsFromString(data, Utils.isKanjiModeEnabled())
+ )
+}
+
+},{"./alphanumeric-data":3,"./byte-data":6,"./kanji-data":12,"./mode":14,"./numeric-data":15,"./regex":19,"./utils":21,"dijkstrajs":31}],21:[function(require,module,exports){
+var toSJISFunction
+var CODEWORDS_COUNT = [
+ 0, // Not used
+ 26, 44, 70, 100, 134, 172, 196, 242, 292, 346,
+ 404, 466, 532, 581, 655, 733, 815, 901, 991, 1085,
+ 1156, 1258, 1364, 1474, 1588, 1706, 1828, 1921, 2051, 2185,
+ 2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532, 3706
+]
+
+/**
+ * Returns the QR Code size for the specified version
+ *
+ * @param {Number} version QR Code version
+ * @return {Number} size of QR code
+ */
+exports.getSymbolSize = function getSymbolSize (version) {
+ if (!version) throw new Error('"version" cannot be null or undefined')
+ if (version < 1 || version > 40) throw new Error('"version" should be in range from 1 to 40')
+ return version * 4 + 17
+}
+
+/**
+ * Returns the total number of codewords used to store data and EC information.
+ *
+ * @param {Number} version QR Code version
+ * @return {Number} Data length in bits
+ */
+exports.getSymbolTotalCodewords = function getSymbolTotalCodewords (version) {
+ return CODEWORDS_COUNT[version]
+}
+
+/**
+ * Encode data with Bose-Chaudhuri-Hocquenghem
+ *
+ * @param {Number} data Value to encode
+ * @return {Number} Encoded value
+ */
+exports.getBCHDigit = function (data) {
+ var digit = 0
+
+ while (data !== 0) {
+ digit++
+ data >>>= 1
+ }
+
+ return digit
+}
+
+exports.setToSJISFunction = function setToSJISFunction (f) {
+ if (typeof f !== 'function') {
+ throw new Error('"toSJISFunc" is not a valid function.')
+ }
+
+ toSJISFunction = f
+}
+
+exports.isKanjiModeEnabled = function () {
+ return typeof toSJISFunction !== 'undefined'
+}
+
+exports.toSJIS = function toSJIS (kanji) {
+ return toSJISFunction(kanji)
+}
+
+},{}],22:[function(require,module,exports){
+/**
+ * Check if QR Code version is valid
+ *
+ * @param {Number} version QR Code version
+ * @return {Boolean} true if valid version, false otherwise
+ */
+exports.isValid = function isValid (version) {
+ return !isNaN(version) && version >= 1 && version <= 40
+}
+
+},{}],23:[function(require,module,exports){
+var Utils = require('./utils')
+var ECCode = require('./error-correction-code')
+var ECLevel = require('./error-correction-level')
+var Mode = require('./mode')
+var VersionCheck = require('./version-check')
+var isArray = require('isarray')
+
+// Generator polynomial used to encode version information
+var G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0)
+var G18_BCH = Utils.getBCHDigit(G18)
+
+function getBestVersionForDataLength (mode, length, errorCorrectionLevel) {
+ for (var currentVersion = 1; currentVersion <= 40; currentVersion++) {
+ if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {
+ return currentVersion
+ }
+ }
+
+ return undefined
+}
+
+function getReservedBitsCount (mode, version) {
+ // Character count indicator + mode indicator bits
+ return Mode.getCharCountIndicator(mode, version) + 4
+}
+
+function getTotalBitsFromDataArray (segments, version) {
+ var totalBits = 0
+
+ segments.forEach(function (data) {
+ var reservedBits = getReservedBitsCount(data.mode, version)
+ totalBits += reservedBits + data.getBitsLength()
+ })
+
+ return totalBits
+}
+
+function getBestVersionForMixedData (segments, errorCorrectionLevel) {
+ for (var currentVersion = 1; currentVersion <= 40; currentVersion++) {
+ var length = getTotalBitsFromDataArray(segments, currentVersion)
+ if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {
+ return currentVersion
+ }
+ }
+
+ return undefined
+}
+
+/**
+ * Returns version number from a value.
+ * If value is not a valid version, returns defaultValue
+ *
+ * @param {Number|String} value QR Code version
+ * @param {Number} defaultValue Fallback value
+ * @return {Number} QR Code version number
+ */
+exports.from = function from (value, defaultValue) {
+ if (VersionCheck.isValid(value)) {
+ return parseInt(value, 10)
+ }
+
+ return defaultValue
+}
+
+/**
+ * Returns how much data can be stored with the specified QR code version
+ * and error correction level
+ *
+ * @param {Number} version QR Code version (1-40)
+ * @param {Number} errorCorrectionLevel Error correction level
+ * @param {Mode} mode Data mode
+ * @return {Number} Quantity of storable data
+ */
+exports.getCapacity = function getCapacity (version, errorCorrectionLevel, mode) {
+ if (!VersionCheck.isValid(version)) {
+ throw new Error('Invalid QR Code version')
+ }
+
+ // Use Byte mode as default
+ if (typeof mode === 'undefined') mode = Mode.BYTE
+
+ // Total codewords for this QR code version (Data + Error correction)
+ var totalCodewords = Utils.getSymbolTotalCodewords(version)
+
+ // Total number of error correction codewords
+ var ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)
+
+ // Total number of data codewords
+ var dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8
+
+ if (mode === Mode.MIXED) return dataTotalCodewordsBits
+
+ var usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version)
+
+ // Return max number of storable codewords
+ switch (mode) {
+ case Mode.NUMERIC:
+ return Math.floor((usableBits / 10) * 3)
+
+ case Mode.ALPHANUMERIC:
+ return Math.floor((usableBits / 11) * 2)
+
+ case Mode.KANJI:
+ return Math.floor(usableBits / 13)
+
+ case Mode.BYTE:
+ default:
+ return Math.floor(usableBits / 8)
+ }
+}
+
+/**
+ * Returns the minimum version needed to contain the amount of data
+ *
+ * @param {Segment} data Segment of data
+ * @param {Number} [errorCorrectionLevel=H] Error correction level
+ * @param {Mode} mode Data mode
+ * @return {Number} QR Code version
+ */
+exports.getBestVersionForData = function getBestVersionForData (data, errorCorrectionLevel) {
+ var seg
+
+ var ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M)
+
+ if (isArray(data)) {
+ if (data.length > 1) {
+ return getBestVersionForMixedData(data, ecl)
+ }
+
+ if (data.length === 0) {
+ return 1
+ }
+
+ seg = data[0]
+ } else {
+ seg = data
+ }
+
+ return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl)
+}
+
+/**
+ * Returns version information with relative error correction bits
+ *
+ * The version information is included in QR Code symbols of version 7 or larger.
+ * It consists of an 18-bit sequence containing 6 data bits,
+ * with 12 error correction bits calculated using the (18, 6) Golay code.
+ *
+ * @param {Number} version QR Code version
+ * @return {Number} Encoded version info bits
+ */
+exports.getEncodedBits = function getEncodedBits (version) {
+ if (!VersionCheck.isValid(version) || version < 7) {
+ throw new Error('Invalid QR Code version')
+ }
+
+ var d = version << 12
+
+ while (Utils.getBCHDigit(d) - G18_BCH >= 0) {
+ d ^= (G18 << (Utils.getBCHDigit(d) - G18_BCH))
+ }
+
+ return (version << 12) | d
+}
+
+},{"./error-correction-code":7,"./error-correction-level":8,"./mode":14,"./utils":21,"./version-check":22,"isarray":33}],24:[function(require,module,exports){
+
+var canPromise = require('./can-promise')
+
+var QRCode = require('./core/qrcode')
+var CanvasRenderer = require('./renderer/canvas')
+var SvgRenderer = require('./renderer/svg-tag.js')
+
+function renderCanvas (renderFunc, canvas, text, opts, cb) {
+ var args = [].slice.call(arguments, 1)
+ var argsNum = args.length
+ var isLastArgCb = typeof args[argsNum - 1] === 'function'
+
+ if (!isLastArgCb && !canPromise()) {
+ throw new Error('Callback required as last argument')
+ }
+
+ if (isLastArgCb) {
+ if (argsNum < 2) {
+ throw new Error('Too few arguments provided')
+ }
+
+ if (argsNum === 2) {
+ cb = text
+ text = canvas
+ canvas = opts = undefined
+ } else if (argsNum === 3) {
+ if (canvas.getContext && typeof cb === 'undefined') {
+ cb = opts
+ opts = undefined
+ } else {
+ cb = opts
+ opts = text
+ text = canvas
+ canvas = undefined
+ }
+ }
+ } else {
+ if (argsNum < 1) {
+ throw new Error('Too few arguments provided')
+ }
+
+ if (argsNum === 1) {
+ text = canvas
+ canvas = opts = undefined
+ } else if (argsNum === 2 && !canvas.getContext) {
+ opts = text
+ text = canvas
+ canvas = undefined
+ }
+
+ return new Promise(function (resolve, reject) {
+ try {
+ var data = QRCode.create(text, opts)
+ resolve(renderFunc(data, canvas, opts))
+ } catch (e) {
+ reject(e)
+ }
+ })
+ }
+
+ try {
+ var data = QRCode.create(text, opts)
+ cb(null, renderFunc(data, canvas, opts))
+ } catch (e) {
+ cb(e)
+ }
+}
+
+exports.create = QRCode.create
+exports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render)
+exports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL)
+
+// only svg for now.
+exports.toString = renderCanvas.bind(null, function (data, _, opts) {
+ return SvgRenderer.render(data, opts)
+})
+
+},{"./can-promise":1,"./core/qrcode":17,"./renderer/canvas":25,"./renderer/svg-tag.js":26}],25:[function(require,module,exports){
+var Utils = require('./utils')
+
+function clearCanvas (ctx, canvas, size) {
+ ctx.clearRect(0, 0, canvas.width, canvas.height)
+
+ if (!canvas.style) canvas.style = {}
+ canvas.height = size
+ canvas.width = size
+ canvas.style.height = size + 'px'
+ canvas.style.width = size + 'px'
+}
+
+function getCanvasElement () {
+ try {
+ return document.createElement('canvas')
+ } catch (e) {
+ throw new Error('You need to specify a canvas element')
+ }
+}
+
+exports.render = function render (qrData, canvas, options) {
+ var opts = options
+ var canvasEl = canvas
+
+ if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {
+ opts = canvas
+ canvas = undefined
+ }
+
+ if (!canvas) {
+ canvasEl = getCanvasElement()
+ }
+
+ opts = Utils.getOptions(opts)
+ var size = Utils.getImageWidth(qrData.modules.size, opts)
+
+ var ctx = canvasEl.getContext('2d')
+ var image = ctx.createImageData(size, size)
+ Utils.qrToImageData(image.data, qrData, opts)
+
+ clearCanvas(ctx, canvasEl, size)
+ ctx.putImageData(image, 0, 0)
+
+ return canvasEl
+}
+
+exports.renderToDataURL = function renderToDataURL (qrData, canvas, options) {
+ var opts = options
+
+ if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {
+ opts = canvas
+ canvas = undefined
+ }
+
+ if (!opts) opts = {}
+
+ var canvasEl = exports.render(qrData, canvas, opts)
+
+ var type = opts.type || 'image/png'
+ var rendererOpts = opts.rendererOpts || {}
+
+ return canvasEl.toDataURL(type, rendererOpts.quality)
+}
+
+},{"./utils":27}],26:[function(require,module,exports){
+var Utils = require('./utils')
+
+function getColorAttrib (color, attrib) {
+ var alpha = color.a / 255
+ var str = attrib + '="' + color.hex + '"'
+
+ return alpha < 1
+ ? str + ' ' + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"'
+ : str
+}
+
+function svgCmd (cmd, x, y) {
+ var str = cmd + x
+ if (typeof y !== 'undefined') str += ' ' + y
+
+ return str
+}
+
+function qrToPath (data, size, margin) {
+ var path = ''
+ var moveBy = 0
+ var newRow = false
+ var lineLength = 0
+
+ for (var i = 0; i < data.length; i++) {
+ var col = Math.floor(i % size)
+ var row = Math.floor(i / size)
+
+ if (!col && !newRow) newRow = true
+
+ if (data[i]) {
+ lineLength++
+
+ if (!(i > 0 && col > 0 && data[i - 1])) {
+ path += newRow
+ ? svgCmd('M', col + margin, 0.5 + row + margin)
+ : svgCmd('m', moveBy, 0)
+
+ moveBy = 0
+ newRow = false
+ }
+
+ if (!(col + 1 < size && data[i + 1])) {
+ path += svgCmd('h', lineLength)
+ lineLength = 0
+ }
+ } else {
+ moveBy++
+ }
+ }
+
+ return path
+}
+
+exports.render = function render (qrData, options, cb) {
+ var opts = Utils.getOptions(options)
+ var size = qrData.modules.size
+ var data = qrData.modules.data
+ var qrcodesize = size + opts.margin * 2
+
+ var bg = !opts.color.light.a
+ ? ''
+ : '<path ' + getColorAttrib(opts.color.light, 'fill') +
+ ' d="M0 0h' + qrcodesize + 'v' + qrcodesize + 'H0z"/>'
+
+ var path =
+ '<path ' + getColorAttrib(opts.color.dark, 'stroke') +
+ ' d="' + qrToPath(data, size, opts.margin) + '"/>'
+
+ var viewBox = 'viewBox="' + '0 0 ' + qrcodesize + ' ' + qrcodesize + '"'
+
+ var width = !opts.width ? '' : 'width="' + opts.width + '" height="' + opts.width + '" '
+
+ var svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path + '</svg>\n'
+
+ if (typeof cb === 'function') {
+ cb(null, svgTag)
+ }
+
+ return svgTag
+}
+
+},{"./utils":27}],27:[function(require,module,exports){
+function hex2rgba (hex) {
+ if (typeof hex === 'number') {
+ hex = hex.toString()
+ }
+
+ if (typeof hex !== 'string') {
+ throw new Error('Color should be defined as hex string')
+ }
+
+ var hexCode = hex.slice().replace('#', '').split('')
+ if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {
+ throw new Error('Invalid hex color: ' + hex)
+ }
+
+ // Convert from short to long form (fff -> ffffff)
+ if (hexCode.length === 3 || hexCode.length === 4) {
+ hexCode = Array.prototype.concat.apply([], hexCode.map(function (c) {
+ return [c, c]
+ }))
+ }
+
+ // Add default alpha value
+ if (hexCode.length === 6) hexCode.push('F', 'F')
+
+ var hexValue = parseInt(hexCode.join(''), 16)
+
+ return {
+ r: (hexValue >> 24) & 255,
+ g: (hexValue >> 16) & 255,
+ b: (hexValue >> 8) & 255,
+ a: hexValue & 255,
+ hex: '#' + hexCode.slice(0, 6).join('')
+ }
+}
+
+exports.getOptions = function getOptions (options) {
+ if (!options) options = {}
+ if (!options.color) options.color = {}
+
+ var margin = typeof options.margin === 'undefined' ||
+ options.margin === null ||
+ options.margin < 0 ? 4 : options.margin
+
+ var width = options.width && options.width >= 21 ? options.width : undefined
+ var scale = options.scale || 4
+
+ return {
+ width: width,
+ scale: width ? 4 : scale,
+ margin: margin,
+ color: {
+ dark: hex2rgba(options.color.dark || '#000000ff'),
+ light: hex2rgba(options.color.light || '#ffffffff')
+ },
+ type: options.type,
+ rendererOpts: options.rendererOpts || {}
+ }
+}
+
+exports.getScale = function getScale (qrSize, opts) {
+ return opts.width && opts.width >= qrSize + opts.margin * 2
+ ? opts.width / (qrSize + opts.margin * 2)
+ : opts.scale
+}
+
+exports.getImageWidth = function getImageWidth (qrSize, opts) {
+ var scale = exports.getScale(qrSize, opts)
+ return Math.floor((qrSize + opts.margin * 2) * scale)
+}
+
+exports.qrToImageData = function qrToImageData (imgData, qr, opts) {
+ var size = qr.modules.size
+ var data = qr.modules.data
+ var scale = exports.getScale(size, opts)
+ var symbolSize = Math.floor((size + opts.margin * 2) * scale)
+ var scaledMargin = opts.margin * scale
+ var palette = [opts.color.light, opts.color.dark]
+
+ for (var i = 0; i < symbolSize; i++) {
+ for (var j = 0; j < symbolSize; j++) {
+ var posDst = (i * symbolSize + j) * 4
+ var pxColor = opts.color.light
+
+ if (i >= scaledMargin && j >= scaledMargin &&
+ i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {
+ var iSrc = Math.floor((i - scaledMargin) / scale)
+ var jSrc = Math.floor((j - scaledMargin) / scale)
+ pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0]
+ }
+
+ imgData[posDst++] = pxColor.r
+ imgData[posDst++] = pxColor.g
+ imgData[posDst++] = pxColor.b
+ imgData[posDst] = pxColor.a
+ }
+ }
+}
+
+},{}],28:[function(require,module,exports){
+/**
+ * Implementation of a subset of node.js Buffer methods for the browser.
+ * Based on https://github.com/feross/buffer
+ */
+
+/* eslint-disable no-proto */
+
+'use strict'
+
+var isArray = require('isarray')
+
+function typedArraySupport () {
+ // Can typed array instances be augmented?
+ try {
+ var arr = new Uint8Array(1)
+ arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
+ return arr.foo() === 42
+ } catch (e) {
+ return false
+ }
+}
+
+Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
+
+var K_MAX_LENGTH = Buffer.TYPED_ARRAY_SUPPORT
+ ? 0x7fffffff
+ : 0x3fffffff
+
+function Buffer (arg, offset, length) {
+ if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
+ return new Buffer(arg, offset, length)
+ }
+
+ if (typeof arg === 'number') {
+ return allocUnsafe(this, arg)
+ }
+
+ return from(this, arg, offset, length)
+}
+
+if (Buffer.TYPED_ARRAY_SUPPORT) {
+ Buffer.prototype.__proto__ = Uint8Array.prototype
+ Buffer.__proto__ = Uint8Array
+
+ // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
+ if (typeof Symbol !== 'undefined' && Symbol.species &&
+ Buffer[Symbol.species] === Buffer) {
+ Object.defineProperty(Buffer, Symbol.species, {
+ value: null,
+ configurable: true,
+ enumerable: false,
+ writable: false
+ })
+ }
+}
+
+function checked (length) {
+ // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
+ // length is NaN (which is otherwise coerced to zero.)
+ if (length >= K_MAX_LENGTH) {
+ throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
+ 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
+ }
+ return length | 0
+}
+
+function isnan (val) {
+ return val !== val // eslint-disable-line no-self-compare
+}
+
+function createBuffer (that, length) {
+ var buf
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
+ buf = new Uint8Array(length)
+ buf.__proto__ = Buffer.prototype
+ } else {
+ // Fallback: Return an object instance of the Buffer class
+ buf = that
+ if (buf === null) {
+ buf = new Buffer(length)
+ }
+ buf.length = length
+ }
+
+ return buf
+}
+
+function allocUnsafe (that, size) {
+ var buf = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
+
+ if (!Buffer.TYPED_ARRAY_SUPPORT) {
+ for (var i = 0; i < size; ++i) {
+ buf[i] = 0
+ }
+ }
+
+ return buf
+}
+
+function fromString (that, string) {
+ var length = byteLength(string) | 0
+ var buf = createBuffer(that, length)
+
+ var actual = buf.write(string)
+
+ if (actual !== length) {
+ // Writing a hex string, for example, that contains invalid characters will
+ // cause everything after the first invalid character to be ignored. (e.g.
+ // 'abxxcd' will be treated as 'ab')
+ buf = buf.slice(0, actual)
+ }
+
+ return buf
+}
+
+function fromArrayLike (that, array) {
+ var length = array.length < 0 ? 0 : checked(array.length) | 0
+ var buf = createBuffer(that, length)
+ for (var i = 0; i < length; i += 1) {
+ buf[i] = array[i] & 255
+ }
+ return buf
+}
+
+function fromArrayBuffer (that, array, byteOffset, length) {
+ if (byteOffset < 0 || array.byteLength < byteOffset) {
+ throw new RangeError('\'offset\' is out of bounds')
+ }
+
+ if (array.byteLength < byteOffset + (length || 0)) {
+ throw new RangeError('\'length\' is out of bounds')
+ }
+
+ var buf
+ if (byteOffset === undefined && length === undefined) {
+ buf = new Uint8Array(array)
+ } else if (length === undefined) {
+ buf = new Uint8Array(array, byteOffset)
+ } else {
+ buf = new Uint8Array(array, byteOffset, length)
+ }
+
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
+ // Return an augmented `Uint8Array` instance, for best performance
+ buf.__proto__ = Buffer.prototype
+ } else {
+ // Fallback: Return an object instance of the Buffer class
+ buf = fromArrayLike(that, buf)
+ }
+
+ return buf
+}
+
+function fromObject (that, obj) {
+ if (Buffer.isBuffer(obj)) {
+ var len = checked(obj.length) | 0
+ var buf = createBuffer(that, len)
+
+ if (buf.length === 0) {
+ return buf
+ }
+
+ obj.copy(buf, 0, 0, len)
+ return buf
+ }
+
+ if (obj) {
+ if ((typeof ArrayBuffer !== 'undefined' &&
+ obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
+ if (typeof obj.length !== 'number' || isnan(obj.length)) {
+ return createBuffer(that, 0)
+ }
+ return fromArrayLike(that, obj)
+ }
+
+ if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
+ return fromArrayLike(that, obj.data)
+ }
+ }
+
+ throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
+}
+
+function utf8ToBytes (string, units) {
+ units = units || Infinity
+ var codePoint
+ var length = string.length
+ var leadSurrogate = null
+ var bytes = []
+
+ for (var i = 0; i < length; ++i) {
+ codePoint = string.charCodeAt(i)
+
+ // is surrogate component
+ if (codePoint > 0xD7FF && codePoint < 0xE000) {
+ // last char was a lead
+ if (!leadSurrogate) {
+ // no lead yet
+ if (codePoint > 0xDBFF) {
+ // unexpected trail
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ continue
+ } else if (i + 1 === length) {
+ // unpaired lead
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ continue
+ }
+
+ // valid lead
+ leadSurrogate = codePoint
+
+ continue
+ }
+
+ // 2 leads in a row
+ if (codePoint < 0xDC00) {
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ leadSurrogate = codePoint
+ continue
+ }
+
+ // valid surrogate pair
+ codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
+ } else if (leadSurrogate) {
+ // valid bmp char, but last char was a lead
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ }
+
+ leadSurrogate = null
+
+ // encode utf8
+ if (codePoint < 0x80) {
+ if ((units -= 1) < 0) break
+ bytes.push(codePoint)
+ } else if (codePoint < 0x800) {
+ if ((units -= 2) < 0) break
+ bytes.push(
+ codePoint >> 0x6 | 0xC0,
+ codePoint & 0x3F | 0x80
+ )
+ } else if (codePoint < 0x10000) {
+ if ((units -= 3) < 0) break
+ bytes.push(
+ codePoint >> 0xC | 0xE0,
+ codePoint >> 0x6 & 0x3F | 0x80,
+ codePoint & 0x3F | 0x80
+ )
+ } else if (codePoint < 0x110000) {
+ if ((units -= 4) < 0) break
+ bytes.push(
+ codePoint >> 0x12 | 0xF0,
+ codePoint >> 0xC & 0x3F | 0x80,
+ codePoint >> 0x6 & 0x3F | 0x80,
+ codePoint & 0x3F | 0x80
+ )
+ } else {
+ throw new Error('Invalid code point')
+ }
+ }
+
+ return bytes
+}
+
+function byteLength (string) {
+ if (Buffer.isBuffer(string)) {
+ return string.length
+ }
+ if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
+ (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
+ return string.byteLength
+ }
+ if (typeof string !== 'string') {
+ string = '' + string
+ }
+
+ var len = string.length
+ if (len === 0) return 0
+
+ return utf8ToBytes(string).length
+}
+
+function blitBuffer (src, dst, offset, length) {
+ for (var i = 0; i < length; ++i) {
+ if ((i + offset >= dst.length) || (i >= src.length)) break
+ dst[i + offset] = src[i]
+ }
+ return i
+}
+
+function utf8Write (buf, string, offset, length) {
+ return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
+}
+
+function from (that, value, offset, length) {
+ if (typeof value === 'number') {
+ throw new TypeError('"value" argument must not be a number')
+ }
+
+ if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
+ return fromArrayBuffer(that, value, offset, length)
+ }
+
+ if (typeof value === 'string') {
+ return fromString(that, value, offset)
+ }
+
+ return fromObject(that, value)
+}
+
+Buffer.prototype.write = function write (string, offset, length) {
+ // Buffer#write(string)
+ if (offset === undefined) {
+ length = this.length
+ offset = 0
+ // Buffer#write(string, encoding)
+ } else if (length === undefined && typeof offset === 'string') {
+ length = this.length
+ offset = 0
+ // Buffer#write(string, offset[, length])
+ } else if (isFinite(offset)) {
+ offset = offset | 0
+ if (isFinite(length)) {
+ length = length | 0
+ } else {
+ length = undefined
+ }
+ }
+
+ var remaining = this.length - offset
+ if (length === undefined || length > remaining) length = remaining
+
+ if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
+ throw new RangeError('Attempt to write outside buffer bounds')
+ }
+
+ return utf8Write(this, string, offset, length)
+}
+
+Buffer.prototype.slice = function slice (start, end) {
+ var len = this.length
+ start = ~~start
+ end = end === undefined ? len : ~~end
+
+ if (start < 0) {
+ start += len
+ if (start < 0) start = 0
+ } else if (start > len) {
+ start = len
+ }
+
+ if (end < 0) {
+ end += len
+ if (end < 0) end = 0
+ } else if (end > len) {
+ end = len
+ }
+
+ if (end < start) end = start
+
+ var newBuf
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
+ newBuf = this.subarray(start, end)
+ // Return an augmented `Uint8Array` instance
+ newBuf.__proto__ = Buffer.prototype
+ } else {
+ var sliceLen = end - start
+ newBuf = new Buffer(sliceLen, undefined)
+ for (var i = 0; i < sliceLen; ++i) {
+ newBuf[i] = this[i + start]
+ }
+ }
+
+ return newBuf
+}
+
+Buffer.prototype.copy = function copy (target, targetStart, start, end) {
+ if (!start) start = 0
+ if (!end && end !== 0) end = this.length
+ if (targetStart >= target.length) targetStart = target.length
+ if (!targetStart) targetStart = 0
+ if (end > 0 && end < start) end = start
+
+ // Copy 0 bytes; we're done
+ if (end === start) return 0
+ if (target.length === 0 || this.length === 0) return 0
+
+ // Fatal error conditions
+ if (targetStart < 0) {
+ throw new RangeError('targetStart out of bounds')
+ }
+ if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
+ if (end < 0) throw new RangeError('sourceEnd out of bounds')
+
+ // Are we oob?
+ if (end > this.length) end = this.length
+ if (target.length - targetStart < end - start) {
+ end = target.length - targetStart + start
+ }
+
+ var len = end - start
+ var i
+
+ if (this === target && start < targetStart && targetStart < end) {
+ // descending copy from end
+ for (i = len - 1; i >= 0; --i) {
+ target[i + targetStart] = this[i + start]
+ }
+ } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
+ // ascending copy from start
+ for (i = 0; i < len; ++i) {
+ target[i + targetStart] = this[i + start]
+ }
+ } else {
+ Uint8Array.prototype.set.call(
+ target,
+ this.subarray(start, start + len),
+ targetStart
+ )
+ }
+
+ return len
+}
+
+Buffer.prototype.fill = function fill (val, start, end) {
+ // Handle string cases:
+ if (typeof val === 'string') {
+ if (typeof start === 'string') {
+ start = 0
+ end = this.length
+ } else if (typeof end === 'string') {
+ end = this.length
+ }
+ if (val.length === 1) {
+ var code = val.charCodeAt(0)
+ if (code < 256) {
+ val = code
+ }
+ }
+ } else if (typeof val === 'number') {
+ val = val & 255
+ }
+
+ // Invalid ranges are not set to a default, so can range check early.
+ if (start < 0 || this.length < start || this.length < end) {
+ throw new RangeError('Out of range index')
+ }
+
+ if (end <= start) {
+ return this
+ }
+
+ start = start >>> 0
+ end = end === undefined ? this.length : end >>> 0
+
+ if (!val) val = 0
+
+ var i
+ if (typeof val === 'number') {
+ for (i = start; i < end; ++i) {
+ this[i] = val
+ }
+ } else {
+ var bytes = Buffer.isBuffer(val)
+ ? val
+ : new Buffer(val)
+ var len = bytes.length
+ for (i = 0; i < end - start; ++i) {
+ this[i + start] = bytes[i % len]
+ }
+ }
+
+ return this
+}
+
+Buffer.concat = function concat (list, length) {
+ if (!isArray(list)) {
+ throw new TypeError('"list" argument must be an Array of Buffers')
+ }
+
+ if (list.length === 0) {
+ return createBuffer(null, 0)
+ }
+
+ var i
+ if (length === undefined) {
+ length = 0
+ for (i = 0; i < list.length; ++i) {
+ length += list[i].length
+ }
+ }
+
+ var buffer = allocUnsafe(null, length)
+ var pos = 0
+ for (i = 0; i < list.length; ++i) {
+ var buf = list[i]
+ if (!Buffer.isBuffer(buf)) {
+ throw new TypeError('"list" argument must be an Array of Buffers')
+ }
+ buf.copy(buffer, pos)
+ pos += buf.length
+ }
+ return buffer
+}
+
+Buffer.byteLength = byteLength
+
+Buffer.prototype._isBuffer = true
+Buffer.isBuffer = function isBuffer (b) {
+ return !!(b != null && b._isBuffer)
+}
+
+module.exports.alloc = function (size) {
+ var buffer = new Buffer(size)
+ buffer.fill(0)
+ return buffer
+}
+
+module.exports.from = function (data) {
+ return new Buffer(data)
+}
+
+},{"isarray":33}],29:[function(require,module,exports){
+'use strict'
+
+exports.byteLength = byteLength
+exports.toByteArray = toByteArray
+exports.fromByteArray = fromByteArray
+
+var lookup = []
+var revLookup = []
+var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
+
+var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
+for (var i = 0, len = code.length; i < len; ++i) {
+ lookup[i] = code[i]
+ revLookup[code.charCodeAt(i)] = i
+}
+
+// Support decoding URL-safe base64 strings, as Node.js does.
+// See: https://en.wikipedia.org/wiki/Base64#URL_applications
+revLookup['-'.charCodeAt(0)] = 62
+revLookup['_'.charCodeAt(0)] = 63
+
+function getLens (b64) {
+ var len = b64.length
+
+ if (len % 4 > 0) {
+ throw new Error('Invalid string. Length must be a multiple of 4')
+ }
+
+ // Trim off extra bytes after placeholder bytes are found
+ // See: https://github.com/beatgammit/base64-js/issues/42
+ var validLen = b64.indexOf('=')
+ if (validLen === -1) validLen = len
+
+ var placeHoldersLen = validLen === len
+ ? 0
+ : 4 - (validLen % 4)
+
+ return [validLen, placeHoldersLen]
+}
+
+// base64 is 4/3 + up to two characters of the original data
+function byteLength (b64) {
+ var lens = getLens(b64)
+ var validLen = lens[0]
+ var placeHoldersLen = lens[1]
+ return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
+}
+
+function _byteLength (b64, validLen, placeHoldersLen) {
+ return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
+}
+
+function toByteArray (b64) {
+ var tmp
+ var lens = getLens(b64)
+ var validLen = lens[0]
+ var placeHoldersLen = lens[1]
+
+ var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
+
+ var curByte = 0
+
+ // if there are placeholders, only get up to the last complete 4 chars
+ var len = placeHoldersLen > 0
+ ? validLen - 4
+ : validLen
+
+ var i
+ for (i = 0; i < len; i += 4) {
+ tmp =
+ (revLookup[b64.charCodeAt(i)] << 18) |
+ (revLookup[b64.charCodeAt(i + 1)] << 12) |
+ (revLookup[b64.charCodeAt(i + 2)] << 6) |
+ revLookup[b64.charCodeAt(i + 3)]
+ arr[curByte++] = (tmp >> 16) & 0xFF
+ arr[curByte++] = (tmp >> 8) & 0xFF
+ arr[curByte++] = tmp & 0xFF
+ }
+
+ if (placeHoldersLen === 2) {
+ tmp =
+ (revLookup[b64.charCodeAt(i)] << 2) |
+ (revLookup[b64.charCodeAt(i + 1)] >> 4)
+ arr[curByte++] = tmp & 0xFF
+ }
+
+ if (placeHoldersLen === 1) {
+ tmp =
+ (revLookup[b64.charCodeAt(i)] << 10) |
+ (revLookup[b64.charCodeAt(i + 1)] << 4) |
+ (revLookup[b64.charCodeAt(i + 2)] >> 2)
+ arr[curByte++] = (tmp >> 8) & 0xFF
+ arr[curByte++] = tmp & 0xFF
+ }
+
+ return arr
+}
+
+function tripletToBase64 (num) {
+ return lookup[num >> 18 & 0x3F] +
+ lookup[num >> 12 & 0x3F] +
+ lookup[num >> 6 & 0x3F] +
+ lookup[num & 0x3F]
+}
+
+function encodeChunk (uint8, start, end) {
+ var tmp
+ var output = []
+ for (var i = start; i < end; i += 3) {
+ tmp =
+ ((uint8[i] << 16) & 0xFF0000) +
+ ((uint8[i + 1] << 8) & 0xFF00) +
+ (uint8[i + 2] & 0xFF)
+ output.push(tripletToBase64(tmp))
+ }
+ return output.join('')
+}
+
+function fromByteArray (uint8) {
+ var tmp
+ var len = uint8.length
+ var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
+ var parts = []
+ var maxChunkLength = 16383 // must be multiple of 3
+
+ // go through the array every three bytes, we'll deal with trailing stuff later
+ for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
+ parts.push(encodeChunk(
+ uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
+ ))
+ }
+
+ // pad the end with zeros, but make sure to not forget the extra bytes
+ if (extraBytes === 1) {
+ tmp = uint8[len - 1]
+ parts.push(
+ lookup[tmp >> 2] +
+ lookup[(tmp << 4) & 0x3F] +
+ '=='
+ )
+ } else if (extraBytes === 2) {
+ tmp = (uint8[len - 2] << 8) + uint8[len - 1]
+ parts.push(
+ lookup[tmp >> 10] +
+ lookup[(tmp >> 4) & 0x3F] +
+ lookup[(tmp << 2) & 0x3F] +
+ '='
+ )
+ }
+
+ return parts.join('')
+}
+
+},{}],30:[function(require,module,exports){
+/*!
+ * The buffer module from node.js, for the browser.
+ *
+ * @author Feross Aboukhadijeh <https://feross.org>
+ * @license MIT
+ */
+/* eslint-disable no-proto */
+
+'use strict'
+
+var base64 = require('base64-js')
+var ieee754 = require('ieee754')
+var customInspectSymbol =
+ (typeof Symbol === 'function' && typeof Symbol.for === 'function')
+ ? Symbol.for('nodejs.util.inspect.custom')
+ : null
+
+exports.Buffer = Buffer
+exports.SlowBuffer = SlowBuffer
+exports.INSPECT_MAX_BYTES = 50
+
+var K_MAX_LENGTH = 0x7fffffff
+exports.kMaxLength = K_MAX_LENGTH
+
+/**
+ * If `Buffer.TYPED_ARRAY_SUPPORT`:
+ * === true Use Uint8Array implementation (fastest)
+ * === false Print warning and recommend using `buffer` v4.x which has an Object
+ * implementation (most compatible, even IE6)
+ *
+ * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
+ * Opera 11.6+, iOS 4.2+.
+ *
+ * We report that the browser does not support typed arrays if the are not subclassable
+ * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
+ * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
+ * for __proto__ and has a buggy typed array implementation.
+ */
+Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
+
+if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
+ typeof console.error === 'function') {
+ console.error(
+ 'This browser lacks typed array (Uint8Array) support which is required by ' +
+ '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
+ )
+}
+
+function typedArraySupport () {
+ // Can typed array instances can be augmented?
+ try {
+ var arr = new Uint8Array(1)
+ var proto = { foo: function () { return 42 } }
+ Object.setPrototypeOf(proto, Uint8Array.prototype)
+ Object.setPrototypeOf(arr, proto)
+ return arr.foo() === 42
+ } catch (e) {
+ return false
+ }
+}
+
+Object.defineProperty(Buffer.prototype, 'parent', {
+ enumerable: true,
+ get: function () {
+ if (!Buffer.isBuffer(this)) return undefined
+ return this.buffer
+ }
+})
+
+Object.defineProperty(Buffer.prototype, 'offset', {
+ enumerable: true,
+ get: function () {
+ if (!Buffer.isBuffer(this)) return undefined
+ return this.byteOffset
+ }
+})
+
+function createBuffer (length) {
+ if (length > K_MAX_LENGTH) {
+ throw new RangeError('The value "' + length + '" is invalid for option "size"')
+ }
+ // Return an augmented `Uint8Array` instance
+ var buf = new Uint8Array(length)
+ Object.setPrototypeOf(buf, Buffer.prototype)
+ return buf
+}
+
+/**
+ * The Buffer constructor returns instances of `Uint8Array` that have their
+ * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
+ * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
+ * and the `Uint8Array` methods. Square bracket notation works as expected -- it
+ * returns a single octet.
+ *
+ * The `Uint8Array` prototype remains unmodified.
+ */
+
+function Buffer (arg, encodingOrOffset, length) {
+ // Common case.
+ if (typeof arg === 'number') {
+ if (typeof encodingOrOffset === 'string') {
+ throw new TypeError(
+ 'The "string" argument must be of type string. Received type number'
+ )
+ }
+ return allocUnsafe(arg)
+ }
+ return from(arg, encodingOrOffset, length)
+}
+
+// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
+if (typeof Symbol !== 'undefined' && Symbol.species != null &&
+ Buffer[Symbol.species] === Buffer) {
+ Object.defineProperty(Buffer, Symbol.species, {
+ value: null,
+ configurable: true,
+ enumerable: false,
+ writable: false
+ })
+}
+
+Buffer.poolSize = 8192 // not used by this implementation
+
+function from (value, encodingOrOffset, length) {
+ if (typeof value === 'string') {
+ return fromString(value, encodingOrOffset)
+ }
+
+ if (ArrayBuffer.isView(value)) {
+ return fromArrayLike(value)
+ }
+
+ if (value == null) {
+ throw new TypeError(
+ 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
+ 'or Array-like Object. Received type ' + (typeof value)
+ )
+ }
+
+ if (isInstance(value, ArrayBuffer) ||
+ (value && isInstance(value.buffer, ArrayBuffer))) {
+ return fromArrayBuffer(value, encodingOrOffset, length)
+ }
+
+ if (typeof value === 'number') {
+ throw new TypeError(
+ 'The "value" argument must not be of type number. Received type number'
+ )
+ }
+
+ var valueOf = value.valueOf && value.valueOf()
+ if (valueOf != null && valueOf !== value) {
+ return Buffer.from(valueOf, encodingOrOffset, length)
+ }
+
+ var b = fromObject(value)
+ if (b) return b
+
+ if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
+ typeof value[Symbol.toPrimitive] === 'function') {
+ return Buffer.from(
+ value[Symbol.toPrimitive]('string'), encodingOrOffset, length
+ )
+ }
+
+ throw new TypeError(
+ 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
+ 'or Array-like Object. Received type ' + (typeof value)
+ )
+}
+
+/**
+ * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
+ * if value is a number.
+ * Buffer.from(str[, encoding])
+ * Buffer.from(array)
+ * Buffer.from(buffer)
+ * Buffer.from(arrayBuffer[, byteOffset[, length]])
+ **/
+Buffer.from = function (value, encodingOrOffset, length) {
+ return from(value, encodingOrOffset, length)
+}
+
+// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
+// https://github.com/feross/buffer/pull/148
+Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)
+Object.setPrototypeOf(Buffer, Uint8Array)
+
+function assertSize (size) {
+ if (typeof size !== 'number') {
+ throw new TypeError('"size" argument must be of type number')
+ } else if (size < 0) {
+ throw new RangeError('The value "' + size + '" is invalid for option "size"')
+ }
+}
+
+function alloc (size, fill, encoding) {
+ assertSize(size)
+ if (size <= 0) {
+ return createBuffer(size)
+ }
+ if (fill !== undefined) {
+ // Only pay attention to encoding if it's a string. This
+ // prevents accidentally sending in a number that would
+ // be interpretted as a start offset.
+ return typeof encoding === 'string'
+ ? createBuffer(size).fill(fill, encoding)
+ : createBuffer(size).fill(fill)
+ }
+ return createBuffer(size)
+}
+
+/**
+ * Creates a new filled Buffer instance.
+ * alloc(size[, fill[, encoding]])
+ **/
+Buffer.alloc = function (size, fill, encoding) {
+ return alloc(size, fill, encoding)
+}
+
+function allocUnsafe (size) {
+ assertSize(size)
+ return createBuffer(size < 0 ? 0 : checked(size) | 0)
+}
+
+/**
+ * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
+ * */
+Buffer.allocUnsafe = function (size) {
+ return allocUnsafe(size)
+}
+/**
+ * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
+ */
+Buffer.allocUnsafeSlow = function (size) {
+ return allocUnsafe(size)
+}
+
+function fromString (string, encoding) {
+ if (typeof encoding !== 'string' || encoding === '') {
+ encoding = 'utf8'
+ }
+
+ if (!Buffer.isEncoding(encoding)) {
+ throw new TypeError('Unknown encoding: ' + encoding)
+ }
+
+ var length = byteLength(string, encoding) | 0
+ var buf = createBuffer(length)
+
+ var actual = buf.write(string, encoding)
+
+ if (actual !== length) {
+ // Writing a hex string, for example, that contains invalid characters will
+ // cause everything after the first invalid character to be ignored. (e.g.
+ // 'abxxcd' will be treated as 'ab')
+ buf = buf.slice(0, actual)
+ }
+
+ return buf
+}
+
+function fromArrayLike (array) {
+ var length = array.length < 0 ? 0 : checked(array.length) | 0
+ var buf = createBuffer(length)
+ for (var i = 0; i < length; i += 1) {
+ buf[i] = array[i] & 255
+ }
+ return buf
+}
+
+function fromArrayBuffer (array, byteOffset, length) {
+ if (byteOffset < 0 || array.byteLength < byteOffset) {
+ throw new RangeError('"offset" is outside of buffer bounds')
+ }
+
+ if (array.byteLength < byteOffset + (length || 0)) {
+ throw new RangeError('"length" is outside of buffer bounds')
+ }
+
+ var buf
+ if (byteOffset === undefined && length === undefined) {
+ buf = new Uint8Array(array)
+ } else if (length === undefined) {
+ buf = new Uint8Array(array, byteOffset)
+ } else {
+ buf = new Uint8Array(array, byteOffset, length)
+ }
+
+ // Return an augmented `Uint8Array` instance
+ Object.setPrototypeOf(buf, Buffer.prototype)
+
+ return buf
+}
+
+function fromObject (obj) {
+ if (Buffer.isBuffer(obj)) {
+ var len = checked(obj.length) | 0
+ var buf = createBuffer(len)
+
+ if (buf.length === 0) {
+ return buf
+ }
+
+ obj.copy(buf, 0, 0, len)
+ return buf
+ }
+
+ if (obj.length !== undefined) {
+ if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
+ return createBuffer(0)
+ }
+ return fromArrayLike(obj)
+ }
+
+ if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
+ return fromArrayLike(obj.data)
+ }
+}
+
+function checked (length) {
+ // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
+ // length is NaN (which is otherwise coerced to zero.)
+ if (length >= K_MAX_LENGTH) {
+ throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
+ 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
+ }
+ return length | 0
+}
+
+function SlowBuffer (length) {
+ if (+length != length) { // eslint-disable-line eqeqeq
+ length = 0
+ }
+ return Buffer.alloc(+length)
+}
+
+Buffer.isBuffer = function isBuffer (b) {
+ return b != null && b._isBuffer === true &&
+ b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
+}
+
+Buffer.compare = function compare (a, b) {
+ if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
+ if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
+ if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
+ throw new TypeError(
+ 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
+ )
+ }
+
+ if (a === b) return 0
+
+ var x = a.length
+ var y = b.length
+
+ for (var i = 0, len = Math.min(x, y); i < len; ++i) {
+ if (a[i] !== b[i]) {
+ x = a[i]
+ y = b[i]
+ break
+ }
+ }
+
+ if (x < y) return -1
+ if (y < x) return 1
+ return 0
+}
+
+Buffer.isEncoding = function isEncoding (encoding) {
+ switch (String(encoding).toLowerCase()) {
+ case 'hex':
+ case 'utf8':
+ case 'utf-8':
+ case 'ascii':
+ case 'latin1':
+ case 'binary':
+ case 'base64':
+ case 'ucs2':
+ case 'ucs-2':
+ case 'utf16le':
+ case 'utf-16le':
+ return true
+ default:
+ return false
+ }
+}
+
+Buffer.concat = function concat (list, length) {
+ if (!Array.isArray(list)) {
+ throw new TypeError('"list" argument must be an Array of Buffers')
+ }
+
+ if (list.length === 0) {
+ return Buffer.alloc(0)
+ }
+
+ var i
+ if (length === undefined) {
+ length = 0
+ for (i = 0; i < list.length; ++i) {
+ length += list[i].length
+ }
+ }
+
+ var buffer = Buffer.allocUnsafe(length)
+ var pos = 0
+ for (i = 0; i < list.length; ++i) {
+ var buf = list[i]
+ if (isInstance(buf, Uint8Array)) {
+ buf = Buffer.from(buf)
+ }
+ if (!Buffer.isBuffer(buf)) {
+ throw new TypeError('"list" argument must be an Array of Buffers')
+ }
+ buf.copy(buffer, pos)
+ pos += buf.length
+ }
+ return buffer
+}
+
+function byteLength (string, encoding) {
+ if (Buffer.isBuffer(string)) {
+ return string.length
+ }
+ if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
+ return string.byteLength
+ }
+ if (typeof string !== 'string') {
+ throw new TypeError(
+ 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
+ 'Received type ' + typeof string
+ )
+ }
+
+ var len = string.length
+ var mustMatch = (arguments.length > 2 && arguments[2] === true)
+ if (!mustMatch && len === 0) return 0
+
+ // Use a for loop to avoid recursion
+ var loweredCase = false
+ for (;;) {
+ switch (encoding) {
+ case 'ascii':
+ case 'latin1':
+ case 'binary':
+ return len
+ case 'utf8':
+ case 'utf-8':
+ return utf8ToBytes(string).length
+ case 'ucs2':
+ case 'ucs-2':
+ case 'utf16le':
+ case 'utf-16le':
+ return len * 2
+ case 'hex':
+ return len >>> 1
+ case 'base64':
+ return base64ToBytes(string).length
+ default:
+ if (loweredCase) {
+ return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
+ }
+ encoding = ('' + encoding).toLowerCase()
+ loweredCase = true
+ }
+ }
+}
+Buffer.byteLength = byteLength
+
+function slowToString (encoding, start, end) {
+ var loweredCase = false
+
+ // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
+ // property of a typed array.
+
+ // This behaves neither like String nor Uint8Array in that we set start/end
+ // to their upper/lower bounds if the value passed is out of range.
+ // undefined is handled specially as per ECMA-262 6th Edition,
+ // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
+ if (start === undefined || start < 0) {
+ start = 0
+ }
+ // Return early if start > this.length. Done here to prevent potential uint32
+ // coercion fail below.
+ if (start > this.length) {
+ return ''
+ }
+
+ if (end === undefined || end > this.length) {
+ end = this.length
+ }
+
+ if (end <= 0) {
+ return ''
+ }
+
+ // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
+ end >>>= 0
+ start >>>= 0
+
+ if (end <= start) {
+ return ''
+ }
+
+ if (!encoding) encoding = 'utf8'
+
+ while (true) {
+ switch (encoding) {
+ case 'hex':
+ return hexSlice(this, start, end)
+
+ case 'utf8':
+ case 'utf-8':
+ return utf8Slice(this, start, end)
+
+ case 'ascii':
+ return asciiSlice(this, start, end)
+
+ case 'latin1':
+ case 'binary':
+ return latin1Slice(this, start, end)
+
+ case 'base64':
+ return base64Slice(this, start, end)
+
+ case 'ucs2':
+ case 'ucs-2':
+ case 'utf16le':
+ case 'utf-16le':
+ return utf16leSlice(this, start, end)
+
+ default:
+ if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
+ encoding = (encoding + '').toLowerCase()
+ loweredCase = true
+ }
+ }
+}
+
+// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
+// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
+// reliably in a browserify context because there could be multiple different
+// copies of the 'buffer' package in use. This method works even for Buffer
+// instances that were created from another copy of the `buffer` package.
+// See: https://github.com/feross/buffer/issues/154
+Buffer.prototype._isBuffer = true
+
+function swap (b, n, m) {
+ var i = b[n]
+ b[n] = b[m]
+ b[m] = i
+}
+
+Buffer.prototype.swap16 = function swap16 () {
+ var len = this.length
+ if (len % 2 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 16-bits')
+ }
+ for (var i = 0; i < len; i += 2) {
+ swap(this, i, i + 1)
+ }
+ return this
+}
+
+Buffer.prototype.swap32 = function swap32 () {
+ var len = this.length
+ if (len % 4 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 32-bits')
+ }
+ for (var i = 0; i < len; i += 4) {
+ swap(this, i, i + 3)
+ swap(this, i + 1, i + 2)
+ }
+ return this
+}
+
+Buffer.prototype.swap64 = function swap64 () {
+ var len = this.length
+ if (len % 8 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 64-bits')
+ }
+ for (var i = 0; i < len; i += 8) {
+ swap(this, i, i + 7)
+ swap(this, i + 1, i + 6)
+ swap(this, i + 2, i + 5)
+ swap(this, i + 3, i + 4)
+ }
+ return this
+}
+
+Buffer.prototype.toString = function toString () {
+ var length = this.length
+ if (length === 0) return ''
+ if (arguments.length === 0) return utf8Slice(this, 0, length)
+ return slowToString.apply(this, arguments)
+}
+
+Buffer.prototype.toLocaleString = Buffer.prototype.toString
+
+Buffer.prototype.equals = function equals (b) {
+ if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
+ if (this === b) return true
+ return Buffer.compare(this, b) === 0
+}
+
+Buffer.prototype.inspect = function inspect () {
+ var str = ''
+ var max = exports.INSPECT_MAX_BYTES
+ str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
+ if (this.length > max) str += ' ... '
+ return '<Buffer ' + str + '>'
+}
+if (customInspectSymbol) {
+ Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect
+}
+
+Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
+ if (isInstance(target, Uint8Array)) {
+ target = Buffer.from(target, target.offset, target.byteLength)
+ }
+ if (!Buffer.isBuffer(target)) {
+ throw new TypeError(
+ 'The "target" argument must be one of type Buffer or Uint8Array. ' +
+ 'Received type ' + (typeof target)
+ )
+ }
+
+ if (start === undefined) {
+ start = 0
+ }
+ if (end === undefined) {
+ end = target ? target.length : 0
+ }
+ if (thisStart === undefined) {
+ thisStart = 0
+ }
+ if (thisEnd === undefined) {
+ thisEnd = this.length
+ }
+
+ if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
+ throw new RangeError('out of range index')
+ }
+
+ if (thisStart >= thisEnd && start >= end) {
+ return 0
+ }
+ if (thisStart >= thisEnd) {
+ return -1
+ }
+ if (start >= end) {
+ return 1
+ }
+
+ start >>>= 0
+ end >>>= 0
+ thisStart >>>= 0
+ thisEnd >>>= 0
+
+ if (this === target) return 0
+
+ var x = thisEnd - thisStart
+ var y = end - start
+ var len = Math.min(x, y)
+
+ var thisCopy = this.slice(thisStart, thisEnd)
+ var targetCopy = target.slice(start, end)
+
+ for (var i = 0; i < len; ++i) {
+ if (thisCopy[i] !== targetCopy[i]) {
+ x = thisCopy[i]
+ y = targetCopy[i]
+ break
+ }
+ }
+
+ if (x < y) return -1
+ if (y < x) return 1
+ return 0
+}
+
+// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
+// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
+//
+// Arguments:
+// - buffer - a Buffer to search
+// - val - a string, Buffer, or number
+// - byteOffset - an index into `buffer`; will be clamped to an int32
+// - encoding - an optional encoding, relevant is val is a string
+// - dir - true for indexOf, false for lastIndexOf
+function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
+ // Empty buffer means no match
+ if (buffer.length === 0) return -1
+
+ // Normalize byteOffset
+ if (typeof byteOffset === 'string') {
+ encoding = byteOffset
+ byteOffset = 0
+ } else if (byteOffset > 0x7fffffff) {
+ byteOffset = 0x7fffffff
+ } else if (byteOffset < -0x80000000) {
+ byteOffset = -0x80000000
+ }
+ byteOffset = +byteOffset // Coerce to Number.
+ if (numberIsNaN(byteOffset)) {
+ // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
+ byteOffset = dir ? 0 : (buffer.length - 1)
+ }
+
+ // Normalize byteOffset: negative offsets start from the end of the buffer
+ if (byteOffset < 0) byteOffset = buffer.length + byteOffset
+ if (byteOffset >= buffer.length) {
+ if (dir) return -1
+ else byteOffset = buffer.length - 1
+ } else if (byteOffset < 0) {
+ if (dir) byteOffset = 0
+ else return -1
+ }
+
+ // Normalize val
+ if (typeof val === 'string') {
+ val = Buffer.from(val, encoding)
+ }
+
+ // Finally, search either indexOf (if dir is true) or lastIndexOf
+ if (Buffer.isBuffer(val)) {
+ // Special case: looking for empty string/buffer always fails
+ if (val.length === 0) {
+ return -1
+ }
+ return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
+ } else if (typeof val === 'number') {
+ val = val & 0xFF // Search for a byte value [0-255]
+ if (typeof Uint8Array.prototype.indexOf === 'function') {
+ if (dir) {
+ return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
+ } else {
+ return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
+ }
+ }
+ return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
+ }
+
+ throw new TypeError('val must be string, number or Buffer')
+}
+
+function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
+ var indexSize = 1
+ var arrLength = arr.length
+ var valLength = val.length
+
+ if (encoding !== undefined) {
+ encoding = String(encoding).toLowerCase()
+ if (encoding === 'ucs2' || encoding === 'ucs-2' ||
+ encoding === 'utf16le' || encoding === 'utf-16le') {
+ if (arr.length < 2 || val.length < 2) {
+ return -1
+ }
+ indexSize = 2
+ arrLength /= 2
+ valLength /= 2
+ byteOffset /= 2
+ }
+ }
+
+ function read (buf, i) {
+ if (indexSize === 1) {
+ return buf[i]
+ } else {
+ return buf.readUInt16BE(i * indexSize)
+ }
+ }
+
+ var i
+ if (dir) {
+ var foundIndex = -1
+ for (i = byteOffset; i < arrLength; i++) {
+ if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
+ if (foundIndex === -1) foundIndex = i
+ if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
+ } else {
+ if (foundIndex !== -1) i -= i - foundIndex
+ foundIndex = -1
+ }
+ }
+ } else {
+ if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
+ for (i = byteOffset; i >= 0; i--) {
+ var found = true
+ for (var j = 0; j < valLength; j++) {
+ if (read(arr, i + j) !== read(val, j)) {
+ found = false
+ break
+ }
+ }
+ if (found) return i
+ }
+ }
+
+ return -1
+}
+
+Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
+ return this.indexOf(val, byteOffset, encoding) !== -1
+}
+
+Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
+}
+
+Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
+}
+
+function hexWrite (buf, string, offset, length) {
+ offset = Number(offset) || 0
+ var remaining = buf.length - offset
+ if (!length) {
+ length = remaining
+ } else {
+ length = Number(length)
+ if (length > remaining) {
+ length = remaining
+ }
+ }
+
+ var strLen = string.length
+
+ if (length > strLen / 2) {
+ length = strLen / 2
+ }
+ for (var i = 0; i < length; ++i) {
+ var parsed = parseInt(string.substr(i * 2, 2), 16)
+ if (numberIsNaN(parsed)) return i
+ buf[offset + i] = parsed
+ }
+ return i
+}
+
+function utf8Write (buf, string, offset, length) {
+ return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
+}
+
+function asciiWrite (buf, string, offset, length) {
+ return blitBuffer(asciiToBytes(string), buf, offset, length)
+}
+
+function latin1Write (buf, string, offset, length) {
+ return asciiWrite(buf, string, offset, length)
+}
+
+function base64Write (buf, string, offset, length) {
+ return blitBuffer(base64ToBytes(string), buf, offset, length)
+}
+
+function ucs2Write (buf, string, offset, length) {
+ return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
+}
+
+Buffer.prototype.write = function write (string, offset, length, encoding) {
+ // Buffer#write(string)
+ if (offset === undefined) {
+ encoding = 'utf8'
+ length = this.length
+ offset = 0
+ // Buffer#write(string, encoding)
+ } else if (length === undefined && typeof offset === 'string') {
+ encoding = offset
+ length = this.length
+ offset = 0
+ // Buffer#write(string, offset[, length][, encoding])
+ } else if (isFinite(offset)) {
+ offset = offset >>> 0
+ if (isFinite(length)) {
+ length = length >>> 0
+ if (encoding === undefined) encoding = 'utf8'
+ } else {
+ encoding = length
+ length = undefined
+ }
+ } else {
+ throw new Error(
+ 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
+ )
+ }
+
+ var remaining = this.length - offset
+ if (length === undefined || length > remaining) length = remaining
+
+ if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
+ throw new RangeError('Attempt to write outside buffer bounds')
+ }
+
+ if (!encoding) encoding = 'utf8'
+
+ var loweredCase = false
+ for (;;) {
+ switch (encoding) {
+ case 'hex':
+ return hexWrite(this, string, offset, length)
+
+ case 'utf8':
+ case 'utf-8':
+ return utf8Write(this, string, offset, length)
+
+ case 'ascii':
+ return asciiWrite(this, string, offset, length)
+
+ case 'latin1':
+ case 'binary':
+ return latin1Write(this, string, offset, length)
+
+ case 'base64':
+ // Warning: maxLength not taken into account in base64Write
+ return base64Write(this, string, offset, length)
+
+ case 'ucs2':
+ case 'ucs-2':
+ case 'utf16le':
+ case 'utf-16le':
+ return ucs2Write(this, string, offset, length)
+
+ default:
+ if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
+ encoding = ('' + encoding).toLowerCase()
+ loweredCase = true
+ }
+ }
+}
+
+Buffer.prototype.toJSON = function toJSON () {
+ return {
+ type: 'Buffer',
+ data: Array.prototype.slice.call(this._arr || this, 0)
+ }
+}
+
+function base64Slice (buf, start, end) {
+ if (start === 0 && end === buf.length) {
+ return base64.fromByteArray(buf)
+ } else {
+ return base64.fromByteArray(buf.slice(start, end))
+ }
+}
+
+function utf8Slice (buf, start, end) {
+ end = Math.min(buf.length, end)
+ var res = []
+
+ var i = start
+ while (i < end) {
+ var firstByte = buf[i]
+ var codePoint = null
+ var bytesPerSequence = (firstByte > 0xEF) ? 4
+ : (firstByte > 0xDF) ? 3
+ : (firstByte > 0xBF) ? 2
+ : 1
+
+ if (i + bytesPerSequence <= end) {
+ var secondByte, thirdByte, fourthByte, tempCodePoint
+
+ switch (bytesPerSequence) {
+ case 1:
+ if (firstByte < 0x80) {
+ codePoint = firstByte
+ }
+ break
+ case 2:
+ secondByte = buf[i + 1]
+ if ((secondByte & 0xC0) === 0x80) {
+ tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
+ if (tempCodePoint > 0x7F) {
+ codePoint = tempCodePoint
+ }
+ }
+ break
+ case 3:
+ secondByte = buf[i + 1]
+ thirdByte = buf[i + 2]
+ if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
+ tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
+ if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
+ codePoint = tempCodePoint
+ }
+ }
+ break
+ case 4:
+ secondByte = buf[i + 1]
+ thirdByte = buf[i + 2]
+ fourthByte = buf[i + 3]
+ if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
+ tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
+ if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
+ codePoint = tempCodePoint
+ }
+ }
+ }
+ }
+
+ if (codePoint === null) {
+ // we did not generate a valid codePoint so insert a
+ // replacement char (U+FFFD) and advance only 1 byte
+ codePoint = 0xFFFD
+ bytesPerSequence = 1
+ } else if (codePoint > 0xFFFF) {
+ // encode to utf16 (surrogate pair dance)
+ codePoint -= 0x10000
+ res.push(codePoint >>> 10 & 0x3FF | 0xD800)
+ codePoint = 0xDC00 | codePoint & 0x3FF
+ }
+
+ res.push(codePoint)
+ i += bytesPerSequence
+ }
+
+ return decodeCodePointsArray(res)
+}
+
+// Based on http://stackoverflow.com/a/22747272/680742, the browser with
+// the lowest limit is Chrome, with 0x10000 args.
+// We go 1 magnitude less, for safety
+var MAX_ARGUMENTS_LENGTH = 0x1000
+
+function decodeCodePointsArray (codePoints) {
+ var len = codePoints.length
+ if (len <= MAX_ARGUMENTS_LENGTH) {
+ return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
+ }
+
+ // Decode in chunks to avoid "call stack size exceeded".
+ var res = ''
+ var i = 0
+ while (i < len) {
+ res += String.fromCharCode.apply(
+ String,
+ codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
+ )
+ }
+ return res
+}
+
+function asciiSlice (buf, start, end) {
+ var ret = ''
+ end = Math.min(buf.length, end)
+
+ for (var i = start; i < end; ++i) {
+ ret += String.fromCharCode(buf[i] & 0x7F)
+ }
+ return ret
+}
+
+function latin1Slice (buf, start, end) {
+ var ret = ''
+ end = Math.min(buf.length, end)
+
+ for (var i = start; i < end; ++i) {
+ ret += String.fromCharCode(buf[i])
+ }
+ return ret
+}
+
+function hexSlice (buf, start, end) {
+ var len = buf.length
+
+ if (!start || start < 0) start = 0
+ if (!end || end < 0 || end > len) end = len
+
+ var out = ''
+ for (var i = start; i < end; ++i) {
+ out += hexSliceLookupTable[buf[i]]
+ }
+ return out
+}
+
+function utf16leSlice (buf, start, end) {
+ var bytes = buf.slice(start, end)
+ var res = ''
+ for (var i = 0; i < bytes.length; i += 2) {
+ res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
+ }
+ return res
+}
+
+Buffer.prototype.slice = function slice (start, end) {
+ var len = this.length
+ start = ~~start
+ end = end === undefined ? len : ~~end
+
+ if (start < 0) {
+ start += len
+ if (start < 0) start = 0
+ } else if (start > len) {
+ start = len
+ }
+
+ if (end < 0) {
+ end += len
+ if (end < 0) end = 0
+ } else if (end > len) {
+ end = len
+ }
+
+ if (end < start) end = start
+
+ var newBuf = this.subarray(start, end)
+ // Return an augmented `Uint8Array` instance
+ Object.setPrototypeOf(newBuf, Buffer.prototype)
+
+ return newBuf
+}
+
+/*
+ * Need to make sure that buffer isn't trying to write out of bounds.
+ */
+function checkOffset (offset, ext, length) {
+ if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
+ if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
+}
+
+Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
+ offset = offset >>> 0
+ byteLength = byteLength >>> 0
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
+
+ var val = this[offset]
+ var mul = 1
+ var i = 0
+ while (++i < byteLength && (mul *= 0x100)) {
+ val += this[offset + i] * mul
+ }
+
+ return val
+}
+
+Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
+ offset = offset >>> 0
+ byteLength = byteLength >>> 0
+ if (!noAssert) {
+ checkOffset(offset, byteLength, this.length)
+ }
+
+ var val = this[offset + --byteLength]
+ var mul = 1
+ while (byteLength > 0 && (mul *= 0x100)) {
+ val += this[offset + --byteLength] * mul
+ }
+
+ return val
+}
+
+Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 1, this.length)
+ return this[offset]
+}
+
+Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 2, this.length)
+ return this[offset] | (this[offset + 1] << 8)
+}
+
+Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 2, this.length)
+ return (this[offset] << 8) | this[offset + 1]
+}
+
+Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 4, this.length)
+
+ return ((this[offset]) |
+ (this[offset + 1] << 8) |
+ (this[offset + 2] << 16)) +
+ (this[offset + 3] * 0x1000000)
+}
+
+Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 4, this.length)
+
+ return (this[offset] * 0x1000000) +
+ ((this[offset + 1] << 16) |
+ (this[offset + 2] << 8) |
+ this[offset + 3])
+}
+
+Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
+ offset = offset >>> 0
+ byteLength = byteLength >>> 0
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
+
+ var val = this[offset]
+ var mul = 1
+ var i = 0
+ while (++i < byteLength && (mul *= 0x100)) {
+ val += this[offset + i] * mul
+ }
+ mul *= 0x80
+
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength)
+
+ return val
+}
+
+Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
+ offset = offset >>> 0
+ byteLength = byteLength >>> 0
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
+
+ var i = byteLength
+ var mul = 1
+ var val = this[offset + --i]
+ while (i > 0 && (mul *= 0x100)) {
+ val += this[offset + --i] * mul
+ }
+ mul *= 0x80
+
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength)
+
+ return val
+}
+
+Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 1, this.length)
+ if (!(this[offset] & 0x80)) return (this[offset])
+ return ((0xff - this[offset] + 1) * -1)
+}
+
+Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 2, this.length)
+ var val = this[offset] | (this[offset + 1] << 8)
+ return (val & 0x8000) ? val | 0xFFFF0000 : val
+}
+
+Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 2, this.length)
+ var val = this[offset + 1] | (this[offset] << 8)
+ return (val & 0x8000) ? val | 0xFFFF0000 : val
+}
+
+Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 4, this.length)
+
+ return (this[offset]) |
+ (this[offset + 1] << 8) |
+ (this[offset + 2] << 16) |
+ (this[offset + 3] << 24)
+}
+
+Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 4, this.length)
+
+ return (this[offset] << 24) |
+ (this[offset + 1] << 16) |
+ (this[offset + 2] << 8) |
+ (this[offset + 3])
+}
+
+Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 4, this.length)
+ return ieee754.read(this, offset, true, 23, 4)
+}
+
+Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 4, this.length)
+ return ieee754.read(this, offset, false, 23, 4)
+}
+
+Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 8, this.length)
+ return ieee754.read(this, offset, true, 52, 8)
+}
+
+Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 8, this.length)
+ return ieee754.read(this, offset, false, 52, 8)
+}
+
+function checkInt (buf, value, offset, ext, max, min) {
+ if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
+ if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
+ if (offset + ext > buf.length) throw new RangeError('Index out of range')
+}
+
+Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ byteLength = byteLength >>> 0
+ if (!noAssert) {
+ var maxBytes = Math.pow(2, 8 * byteLength) - 1
+ checkInt(this, value, offset, byteLength, maxBytes, 0)
+ }
+
+ var mul = 1
+ var i = 0
+ this[offset] = value & 0xFF
+ while (++i < byteLength && (mul *= 0x100)) {
+ this[offset + i] = (value / mul) & 0xFF
+ }
+
+ return offset + byteLength
+}
+
+Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ byteLength = byteLength >>> 0
+ if (!noAssert) {
+ var maxBytes = Math.pow(2, 8 * byteLength) - 1
+ checkInt(this, value, offset, byteLength, maxBytes, 0)
+ }
+
+ var i = byteLength - 1
+ var mul = 1
+ this[offset + i] = value & 0xFF
+ while (--i >= 0 && (mul *= 0x100)) {
+ this[offset + i] = (value / mul) & 0xFF
+ }
+
+ return offset + byteLength
+}
+
+Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
+ this[offset] = (value & 0xff)
+ return offset + 1
+}
+
+Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
+ this[offset] = (value & 0xff)
+ this[offset + 1] = (value >>> 8)
+ return offset + 2
+}
+
+Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
+ this[offset] = (value >>> 8)
+ this[offset + 1] = (value & 0xff)
+ return offset + 2
+}
+
+Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
+ this[offset + 3] = (value >>> 24)
+ this[offset + 2] = (value >>> 16)
+ this[offset + 1] = (value >>> 8)
+ this[offset] = (value & 0xff)
+ return offset + 4
+}
+
+Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
+ this[offset] = (value >>> 24)
+ this[offset + 1] = (value >>> 16)
+ this[offset + 2] = (value >>> 8)
+ this[offset + 3] = (value & 0xff)
+ return offset + 4
+}
+
+Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) {
+ var limit = Math.pow(2, (8 * byteLength) - 1)
+
+ checkInt(this, value, offset, byteLength, limit - 1, -limit)
+ }
+
+ var i = 0
+ var mul = 1
+ var sub = 0
+ this[offset] = value & 0xFF
+ while (++i < byteLength && (mul *= 0x100)) {
+ if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
+ sub = 1
+ }
+ this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
+ }
+
+ return offset + byteLength
+}
+
+Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) {
+ var limit = Math.pow(2, (8 * byteLength) - 1)
+
+ checkInt(this, value, offset, byteLength, limit - 1, -limit)
+ }
+
+ var i = byteLength - 1
+ var mul = 1
+ var sub = 0
+ this[offset + i] = value & 0xFF
+ while (--i >= 0 && (mul *= 0x100)) {
+ if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
+ sub = 1
+ }
+ this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
+ }
+
+ return offset + byteLength
+}
+
+Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
+ if (value < 0) value = 0xff + value + 1
+ this[offset] = (value & 0xff)
+ return offset + 1
+}
+
+Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
+ this[offset] = (value & 0xff)
+ this[offset + 1] = (value >>> 8)
+ return offset + 2
+}
+
+Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
+ this[offset] = (value >>> 8)
+ this[offset + 1] = (value & 0xff)
+ return offset + 2
+}
+
+Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
+ this[offset] = (value & 0xff)
+ this[offset + 1] = (value >>> 8)
+ this[offset + 2] = (value >>> 16)
+ this[offset + 3] = (value >>> 24)
+ return offset + 4
+}
+
+Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
+ if (value < 0) value = 0xffffffff + value + 1
+ this[offset] = (value >>> 24)
+ this[offset + 1] = (value >>> 16)
+ this[offset + 2] = (value >>> 8)
+ this[offset + 3] = (value & 0xff)
+ return offset + 4
+}
+
+function checkIEEE754 (buf, value, offset, ext, max, min) {
+ if (offset + ext > buf.length) throw new RangeError('Index out of range')
+ if (offset < 0) throw new RangeError('Index out of range')
+}
+
+function writeFloat (buf, value, offset, littleEndian, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) {
+ checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
+ }
+ ieee754.write(buf, value, offset, littleEndian, 23, 4)
+ return offset + 4
+}
+
+Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
+ return writeFloat(this, value, offset, true, noAssert)
+}
+
+Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
+ return writeFloat(this, value, offset, false, noAssert)
+}
+
+function writeDouble (buf, value, offset, littleEndian, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) {
+ checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
+ }
+ ieee754.write(buf, value, offset, littleEndian, 52, 8)
+ return offset + 8
+}
+
+Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
+ return writeDouble(this, value, offset, true, noAssert)
+}
+
+Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
+ return writeDouble(this, value, offset, false, noAssert)
+}
+
+// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
+Buffer.prototype.copy = function copy (target, targetStart, start, end) {
+ if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
+ if (!start) start = 0
+ if (!end && end !== 0) end = this.length
+ if (targetStart >= target.length) targetStart = target.length
+ if (!targetStart) targetStart = 0
+ if (end > 0 && end < start) end = start
+
+ // Copy 0 bytes; we're done
+ if (end === start) return 0
+ if (target.length === 0 || this.length === 0) return 0
+
+ // Fatal error conditions
+ if (targetStart < 0) {
+ throw new RangeError('targetStart out of bounds')
+ }
+ if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
+ if (end < 0) throw new RangeError('sourceEnd out of bounds')
+
+ // Are we oob?
+ if (end > this.length) end = this.length
+ if (target.length - targetStart < end - start) {
+ end = target.length - targetStart + start
+ }
+
+ var len = end - start
+
+ if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
+ // Use built-in when available, missing from IE11
+ this.copyWithin(targetStart, start, end)
+ } else if (this === target && start < targetStart && targetStart < end) {
+ // descending copy from end
+ for (var i = len - 1; i >= 0; --i) {
+ target[i + targetStart] = this[i + start]
+ }
+ } else {
+ Uint8Array.prototype.set.call(
+ target,
+ this.subarray(start, end),
+ targetStart
+ )
+ }
+
+ return len
+}
+
+// Usage:
+// buffer.fill(number[, offset[, end]])
+// buffer.fill(buffer[, offset[, end]])
+// buffer.fill(string[, offset[, end]][, encoding])
+Buffer.prototype.fill = function fill (val, start, end, encoding) {
+ // Handle string cases:
+ if (typeof val === 'string') {
+ if (typeof start === 'string') {
+ encoding = start
+ start = 0
+ end = this.length
+ } else if (typeof end === 'string') {
+ encoding = end
+ end = this.length
+ }
+ if (encoding !== undefined && typeof encoding !== 'string') {
+ throw new TypeError('encoding must be a string')
+ }
+ if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
+ throw new TypeError('Unknown encoding: ' + encoding)
+ }
+ if (val.length === 1) {
+ var code = val.charCodeAt(0)
+ if ((encoding === 'utf8' && code < 128) ||
+ encoding === 'latin1') {
+ // Fast path: If `val` fits into a single byte, use that numeric value.
+ val = code
+ }
+ }
+ } else if (typeof val === 'number') {
+ val = val & 255
+ } else if (typeof val === 'boolean') {
+ val = Number(val)
+ }
+
+ // Invalid ranges are not set to a default, so can range check early.
+ if (start < 0 || this.length < start || this.length < end) {
+ throw new RangeError('Out of range index')
+ }
+
+ if (end <= start) {
+ return this
+ }
+
+ start = start >>> 0
+ end = end === undefined ? this.length : end >>> 0
+
+ if (!val) val = 0
+
+ var i
+ if (typeof val === 'number') {
+ for (i = start; i < end; ++i) {
+ this[i] = val
+ }
+ } else {
+ var bytes = Buffer.isBuffer(val)
+ ? val
+ : Buffer.from(val, encoding)
+ var len = bytes.length
+ if (len === 0) {
+ throw new TypeError('The value "' + val +
+ '" is invalid for argument "value"')
+ }
+ for (i = 0; i < end - start; ++i) {
+ this[i + start] = bytes[i % len]
+ }
+ }
+
+ return this
+}
+
+// HELPER FUNCTIONS
+// ================
+
+var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
+
+function base64clean (str) {
+ // Node takes equal signs as end of the Base64 encoding
+ str = str.split('=')[0]
+ // Node strips out invalid characters like \n and \t from the string, base64-js does not
+ str = str.trim().replace(INVALID_BASE64_RE, '')
+ // Node converts strings with length < 2 to ''
+ if (str.length < 2) return ''
+ // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
+ while (str.length % 4 !== 0) {
+ str = str + '='
+ }
+ return str
+}
+
+function utf8ToBytes (string, units) {
+ units = units || Infinity
+ var codePoint
+ var length = string.length
+ var leadSurrogate = null
+ var bytes = []
+
+ for (var i = 0; i < length; ++i) {
+ codePoint = string.charCodeAt(i)
+
+ // is surrogate component
+ if (codePoint > 0xD7FF && codePoint < 0xE000) {
+ // last char was a lead
+ if (!leadSurrogate) {
+ // no lead yet
+ if (codePoint > 0xDBFF) {
+ // unexpected trail
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ continue
+ } else if (i + 1 === length) {
+ // unpaired lead
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ continue
+ }
+
+ // valid lead
+ leadSurrogate = codePoint
+
+ continue
+ }
+
+ // 2 leads in a row
+ if (codePoint < 0xDC00) {
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ leadSurrogate = codePoint
+ continue
+ }
+
+ // valid surrogate pair
+ codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
+ } else if (leadSurrogate) {
+ // valid bmp char, but last char was a lead
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ }
+
+ leadSurrogate = null
+
+ // encode utf8
+ if (codePoint < 0x80) {
+ if ((units -= 1) < 0) break
+ bytes.push(codePoint)
+ } else if (codePoint < 0x800) {
+ if ((units -= 2) < 0) break
+ bytes.push(
+ codePoint >> 0x6 | 0xC0,
+ codePoint & 0x3F | 0x80
+ )
+ } else if (codePoint < 0x10000) {
+ if ((units -= 3) < 0) break
+ bytes.push(
+ codePoint >> 0xC | 0xE0,
+ codePoint >> 0x6 & 0x3F | 0x80,
+ codePoint & 0x3F | 0x80
+ )
+ } else if (codePoint < 0x110000) {
+ if ((units -= 4) < 0) break
+ bytes.push(
+ codePoint >> 0x12 | 0xF0,
+ codePoint >> 0xC & 0x3F | 0x80,
+ codePoint >> 0x6 & 0x3F | 0x80,
+ codePoint & 0x3F | 0x80
+ )
+ } else {
+ throw new Error('Invalid code point')
+ }
+ }
+
+ return bytes
+}
+
+function asciiToBytes (str) {
+ var byteArray = []
+ for (var i = 0; i < str.length; ++i) {
+ // Node's code seems to be doing this and not & 0x7F..
+ byteArray.push(str.charCodeAt(i) & 0xFF)
+ }
+ return byteArray
+}
+
+function utf16leToBytes (str, units) {
+ var c, hi, lo
+ var byteArray = []
+ for (var i = 0; i < str.length; ++i) {
+ if ((units -= 2) < 0) break
+
+ c = str.charCodeAt(i)
+ hi = c >> 8
+ lo = c % 256
+ byteArray.push(lo)
+ byteArray.push(hi)
+ }
+
+ return byteArray
+}
+
+function base64ToBytes (str) {
+ return base64.toByteArray(base64clean(str))
+}
+
+function blitBuffer (src, dst, offset, length) {
+ for (var i = 0; i < length; ++i) {
+ if ((i + offset >= dst.length) || (i >= src.length)) break
+ dst[i + offset] = src[i]
+ }
+ return i
+}
+
+// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
+// the `instanceof` check but they should be treated as of that type.
+// See: https://github.com/feross/buffer/issues/166
+function isInstance (obj, type) {
+ return obj instanceof type ||
+ (obj != null && obj.constructor != null && obj.constructor.name != null &&
+ obj.constructor.name === type.name)
+}
+function numberIsNaN (obj) {
+ // For IE11 support
+ return obj !== obj // eslint-disable-line no-self-compare
+}
+
+// Create lookup table for `toString('hex')`
+// See: https://github.com/feross/buffer/issues/219
+var hexSliceLookupTable = (function () {
+ var alphabet = '0123456789abcdef'
+ var table = new Array(256)
+ for (var i = 0; i < 16; ++i) {
+ var i16 = i * 16
+ for (var j = 0; j < 16; ++j) {
+ table[i16 + j] = alphabet[i] + alphabet[j]
+ }
+ }
+ return table
+})()
+
+},{"base64-js":29,"ieee754":32}],31:[function(require,module,exports){
+'use strict';
+
+/******************************************************************************
+ * Created 2008-08-19.
+ *
+ * Dijkstra path-finding functions. Adapted from the Dijkstar Python project.
+ *
+ * Copyright (C) 2008
+ * Wyatt Baldwin <self@wyattbaldwin.com>
+ * All rights reserved
+ *
+ * Licensed under the MIT license.
+ *
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *****************************************************************************/
+var dijkstra = {
+ single_source_shortest_paths: function(graph, s, d) {
+ // Predecessor map for each node that has been encountered.
+ // node ID => predecessor node ID
+ var predecessors = {};
+
+ // Costs of shortest paths from s to all nodes encountered.
+ // node ID => cost
+ var costs = {};
+ costs[s] = 0;
+
+ // Costs of shortest paths from s to all nodes encountered; differs from
+ // `costs` in that it provides easy access to the node that currently has
+ // the known shortest path from s.
+ // XXX: Do we actually need both `costs` and `open`?
+ var open = dijkstra.PriorityQueue.make();
+ open.push(s, 0);
+
+ var closest,
+ u, v,
+ cost_of_s_to_u,
+ adjacent_nodes,
+ cost_of_e,
+ cost_of_s_to_u_plus_cost_of_e,
+ cost_of_s_to_v,
+ first_visit;
+ while (!open.empty()) {
+ // In the nodes remaining in graph that have a known cost from s,
+ // find the node, u, that currently has the shortest path from s.
+ closest = open.pop();
+ u = closest.value;
+ cost_of_s_to_u = closest.cost;
+
+ // Get nodes adjacent to u...
+ adjacent_nodes = graph[u] || {};
+
+ // ...and explore the edges that connect u to those nodes, updating
+ // the cost of the shortest paths to any or all of those nodes as
+ // necessary. v is the node across the current edge from u.
+ for (v in adjacent_nodes) {
+ if (adjacent_nodes.hasOwnProperty(v)) {
+ // Get the cost of the edge running from u to v.
+ cost_of_e = adjacent_nodes[v];
+
+ // Cost of s to u plus the cost of u to v across e--this is *a*
+ // cost from s to v that may or may not be less than the current
+ // known cost to v.
+ cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
+
+ // If we haven't visited v yet OR if the current known cost from s to
+ // v is greater than the new cost we just found (cost of s to u plus
+ // cost of u to v across e), update v's cost in the cost list and
+ // update v's predecessor in the predecessor list (it's now u).
+ cost_of_s_to_v = costs[v];
+ first_visit = (typeof costs[v] === 'undefined');
+ if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
+ costs[v] = cost_of_s_to_u_plus_cost_of_e;
+ open.push(v, cost_of_s_to_u_plus_cost_of_e);
+ predecessors[v] = u;
+ }
+ }
+ }
+ }
+
+ if (typeof d !== 'undefined' && typeof costs[d] === 'undefined') {
+ var msg = ['Could not find a path from ', s, ' to ', d, '.'].join('');
+ throw new Error(msg);
+ }
+
+ return predecessors;
+ },
+
+ extract_shortest_path_from_predecessor_list: function(predecessors, d) {
+ var nodes = [];
+ var u = d;
+ var predecessor;
+ while (u) {
+ nodes.push(u);
+ predecessor = predecessors[u];
+ u = predecessors[u];
+ }
+ nodes.reverse();
+ return nodes;
+ },
+
+ find_path: function(graph, s, d) {
+ var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
+ return dijkstra.extract_shortest_path_from_predecessor_list(
+ predecessors, d);
+ },
+
+ /**
+ * A very naive priority queue implementation.
+ */
+ PriorityQueue: {
+ make: function (opts) {
+ var T = dijkstra.PriorityQueue,
+ t = {},
+ key;
+ opts = opts || {};
+ for (key in T) {
+ if (T.hasOwnProperty(key)) {
+ t[key] = T[key];
+ }
+ }
+ t.queue = [];
+ t.sorter = opts.sorter || T.default_sorter;
+ return t;
+ },
+
+ default_sorter: function (a, b) {
+ return a.cost - b.cost;
+ },
+
+ /**
+ * Add a new item to the queue and ensure the highest priority element
+ * is at the front of the queue.
+ */
+ push: function (value, cost) {
+ var item = {value: value, cost: cost};
+ this.queue.push(item);
+ this.queue.sort(this.sorter);
+ },
+
+ /**
+ * Return the highest priority element in the queue.
+ */
+ pop: function () {
+ return this.queue.shift();
+ },
+
+ empty: function () {
+ return this.queue.length === 0;
+ }
+ }
+};
+
+
+// node.js module exports
+if (typeof module !== 'undefined') {
+ module.exports = dijkstra;
+}
+
+},{}],32:[function(require,module,exports){
+exports.read = function (buffer, offset, isLE, mLen, nBytes) {
+ var e, m
+ var eLen = (nBytes * 8) - mLen - 1
+ var eMax = (1 << eLen) - 1
+ var eBias = eMax >> 1
+ var nBits = -7
+ var i = isLE ? (nBytes - 1) : 0
+ var d = isLE ? -1 : 1
+ var s = buffer[offset + i]
+
+ i += d
+
+ e = s & ((1 << (-nBits)) - 1)
+ s >>= (-nBits)
+ nBits += eLen
+ for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
+
+ m = e & ((1 << (-nBits)) - 1)
+ e >>= (-nBits)
+ nBits += mLen
+ for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
+
+ if (e === 0) {
+ e = 1 - eBias
+ } else if (e === eMax) {
+ return m ? NaN : ((s ? -1 : 1) * Infinity)
+ } else {
+ m = m + Math.pow(2, mLen)
+ e = e - eBias
+ }
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
+}
+
+exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
+ var e, m, c
+ var eLen = (nBytes * 8) - mLen - 1
+ var eMax = (1 << eLen) - 1
+ var eBias = eMax >> 1
+ var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
+ var i = isLE ? 0 : (nBytes - 1)
+ var d = isLE ? 1 : -1
+ var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
+
+ value = Math.abs(value)
+
+ if (isNaN(value) || value === Infinity) {
+ m = isNaN(value) ? 1 : 0
+ e = eMax
+ } else {
+ e = Math.floor(Math.log(value) / Math.LN2)
+ if (value * (c = Math.pow(2, -e)) < 1) {
+ e--
+ c *= 2
+ }
+ if (e + eBias >= 1) {
+ value += rt / c
+ } else {
+ value += rt * Math.pow(2, 1 - eBias)
+ }
+ if (value * c >= 2) {
+ e++
+ c /= 2
+ }
+
+ if (e + eBias >= eMax) {
+ m = 0
+ e = eMax
+ } else if (e + eBias >= 1) {
+ m = ((value * c) - 1) * Math.pow(2, mLen)
+ e = e + eBias
+ } else {
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
+ e = 0
+ }
+ }
+
+ for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
+
+ e = (e << mLen) | m
+ eLen += mLen
+ for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
+
+ buffer[offset + i - d] |= s * 128
+}
+
+},{}],33:[function(require,module,exports){
+var toString = {}.toString;
+
+module.exports = Array.isArray || function (arr) {
+ return toString.call(arr) == '[object Array]';
+};
+
+},{}]},{},[24])(24)
+});
+
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJsaWIvY2FuLXByb21pc2UuanMiLCJsaWIvY29yZS9hbGlnbm1lbnQtcGF0dGVybi5qcyIsImxpYi9jb3JlL2FscGhhbnVtZXJpYy1kYXRhLmpzIiwibGliL2NvcmUvYml0LWJ1ZmZlci5qcyIsImxpYi9jb3JlL2JpdC1tYXRyaXguanMiLCJsaWIvY29yZS9ieXRlLWRhdGEuanMiLCJs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c2lvblxuICovXG5mdW5jdGlvbiBzZXR1cEFsaWdubWVudFBhdHRlcm4gKG1hdHJpeCwgdmVyc2lvbikge1xuICB2YXIgcG9zID0gQWxpZ25tZW50UGF0dGVybi5nZXRQb3NpdGlvbnModmVyc2lvbilcblxuICBmb3IgKHZhciBpID0gMDsgaSA8IHBvcy5sZW5ndGg7IGkrKykge1xuICAgIHZhciByb3cgPSBwb3NbaV1bMF1cbiAgICB2YXIgY29sID0gcG9zW2ldWzFdXG5cbiAgICBmb3IgKHZhciByID0gLTI7IHIgPD0gMjsgcisrKSB7XG4gICAgICBmb3IgKHZhciBjID0gLTI7IGMgPD0gMjsgYysrKSB7XG4gICAgICAgIGlmIChyID09PSAtMiB8fCByID09PSAyIHx8IGMgPT09IC0yIHx8IGMgPT09IDIgfHxcbiAgICAgICAgICAociA9PT0gMCAmJiBjID09PSAwKSkge1xuICAgICAgICAgIG1hdHJpeC5zZXQocm93ICsgciwgY29sICsgYywgdHJ1ZSwgdHJ1ZSlcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBtYXRyaXguc2V0KHJvdyArIHIsIGNvbCArIGMsIGZhbHNlLCB0cnVlKVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuICB9XG59XG5cbi8qKlxuICogQWRkIHZlcnNpb24gaW5mbyBiaXRzIHRvIG1hdHJpeFxuICpcbiAqIEBwYXJhbSAge0JpdE1hdHJpeH0gbWF0cml4ICBNb2R1bGVzIG1hdHJpeFxuICogQHBhcmFtICB7TnVtYmVyfSAgICB2ZXJzaW9uIFFSIENvZGUgdmVyc2lvblxuICovXG5mdW5jdGlvbiBzZXR1cFZlcnNpb25JbmZvIChtYXRyaXgsIHZlcnNpb24pIHtcbiAgdmFyIHNpemUgPSBtYXRyaXguc2l6ZVxuICB2YXIgYml0cyA9IFZlcnNpb24uZ2V0RW5jb2RlZEJpdHModmVyc2lvbilcbiAgdmFyIHJvdywgY29sLCBtb2RcblxuICBmb3IgKHZhciBpID0gMDs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jsgYysrKSB7XG4gICAgICAgIGlmICghbWF0cml4LmlzUmVzZXJ2ZWQocm93LCBjb2wgLSBjKSkge1xuICAgICAgICAgIHZhciBkYXJrID0gZmFsc2VcblxuICAgICAgICAgIGlmIChieXRlSW5kZXggPCBkYXRhLmxlbmd0aCkge1xuICAgICAgICAgICAgZGFyayA9ICgoKGRhdGFbYnl0ZUluZGV4XSA+Pj4gYml0SW5kZXgpICYgMSkgPT09IDEpXG4gICAgICAgICAgfVxuXG4gICAgICAgICAgbWF0cml4LnNldChyb3csIGNvbCAtIGMsIGRhcmspXG4gICAgICAgICAgYml0SW5kZXgtLVxuXG4gICAgICAgICAgaWYgKGJpdEluZGV4ID09PSAtMSkge1xuICAgICAgICAgICAgYnl0ZUluZGV4KytcbiAgICAgICAgICAgIGJpdEluZGV4ID0gN1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICByb3cgKz0gaW5jXG5cbiAgICAgIGlmIChyb3cgPCAwIHx8IHNpemUgPD0gcm93KSB7XG4gICAgICAgIHJvdyAtPSBpbmNcbiAgICAgICAgaW5jID0gLWluY1xuICAgICAgICBicmVha1xuICAgICAgfVxuICAgIH1cbiAgfVxufVxuXG4vKipcbiAqIENyZWF0ZSBlbmNvZGVkIGNvZGV3b3JkcyBmcm9tIGRhdGEgaW5wdXRcbiAqXG4gKiBAcGFyYW0gIHtOdW1iZXJ9ICAgdmVyc2lvbiAgICAgICAgICAgICAgUVIgQ29kZSB2ZXJzaW9uXG4gKiBAcGFyYW0gIHtFcnJvckNvcnJlY3Rpb25MZXZlbH0gICBlcnJvckNvcnJlY3Rpb25MZXZlbCBFcnJvciBjb3JyZWN0aW9uIGxldmVsXG4gKiBAcGFyYW0gIHtCeXRlRGF0YX0gZGF0YSAgICAgICAgICAgICAgICAgRGF0YSBpbnB1dFxuICogQHJldHVybiB7QnVmZmVyfSAgICAgICAgICAgICAgICAgICAgICAgIEJ1ZmZlciBjb250YWluaW5nIGVuY29kZW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mFsdWUgKiBNYXRoLnBvdygyLCBlQmlhcyAtIDEpICogTWF0aC5wb3coMiwgbUxlbilcbiAgICAgIGUgPSAwXG4gICAgfVxuICB9XG5cbiAgZm9yICg7IG1MZW4gPj0gODsgYnVmZmVyW29mZnNldCArIGldID0gbSAmIDB4ZmYsIGkgKz0gZCwgbSAvPSAyNTYsIG1MZW4gLT0gOCkge31cblxuICBlID0gKGUgPDwgbUxlbikgfCBtXG4gIGVMZW4gKz0gbUxlblxuICBmb3IgKDsgZUxlbiA+IDA7IGJ1ZmZlcltvZmZzZXQgKyBpXSA9IGUgJiAweGZmLCBpICs9IGQsIGUgLz0gMjU2LCBlTGVuIC09IDgpIHt9XG5cbiAgYnVmZmVyW29mZnNldCArIGkgLSBkXSB8PSBzICogMTI4XG59XG4iLCJ2YXIgdG9TdHJpbmcgPSB7fS50b1N0cmluZztcblxubW9kdWxlLmV4cG9ydHMgPSBBcnJheS5pc0FycmF5IHx8IGZ1bmN0aW9uIChhcnIpIHtcbiAgcmV0dXJuIHRvU3RyaW5nLmNhbGwoYXJyKSA9PSAnW29iamVjdCBBcnJheV0nO1xufTtcbiJdfQ==
diff --git a/qrcode.tosjis.js b/qrcode.tosjis.js
new file mode 100644
index 0000000..a6c3390
--- /dev/null
+++ b/qrcode.tosjis.js
@@ -0,0 +1,106 @@
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.QRCode || (g.QRCode = {})).toSJIS = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
+var SJIS_UTF8 = [
+ [0x8140, ' 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈〉《》「」『』【】+-±×'],
+ [0x8180, '÷=≠<>'],
+ [0x818f, '¥$¢£%#&*@§☆★'],
+ [0x81a6, '※〒→←↑↓〓'],
+ [0x81ca, '¬'],
+ [0x824f, '0123456789'],
+ [0x8260, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'],
+ [0x8281, 'abcdefghijklmnopqrstuvwxyz'],
+ [0x829f, 'ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをん'],
+ [0x8340, 'ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミ'],
+ [0x8380, 'ムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶ'],
+ [0x839f, 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ'],
+ [0x83bf, 'αβγδεζηθικλμνξοπρστυφχψω'],
+ [0x8440, 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ'],
+ [0x8470, 'абвгдеёжзийклмн'],
+ [0x8480, 'опрстуфхцчшщъыьэюя'],
+ [0x8780, '〝〟'],
+ [0x8940, '院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円'],
+ [0x8980, '園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改'],
+ [0x8a40, '魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫'],
+ [0x8a80, '橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄'],
+ [0x8b40, '機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救'],
+ [0x8b80, '朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈'],
+ [0x8c40, '掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨'],
+ [0x8c80, '劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向'],
+ [0x8d40, '后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降'],
+ [0x8d80, '項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷'],
+ [0x8e40, '察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止'],
+ [0x8e80, '死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周'],
+ [0x8f40, '宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳'],
+ [0x8f80, '準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾'],
+ [0x9040, '拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨'],
+ [0x9080, '逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線'],
+ [0x9140, '繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻'],
+ [0x9180, '操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只'],
+ [0x9240, '叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄'],
+ [0x9280, '逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓'],
+ [0x9340, '邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬'],
+ [0x9380, '凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入'],
+ [0x9440, '如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅'],
+ [0x9480, '楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美'],
+ [0x9540, '鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷'],
+ [0x9580, '斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋'],
+ [0x9640, '法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆'],
+ [0x9680, '摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒'],
+ [0x9740, '諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲'],
+ [0x9780, '沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯'],
+ [0x9840, '蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕'],
+ [0x989f, '弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲'],
+ [0x9940, '僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭'],
+ [0x9980, '凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨'],
+ [0x9a40, '咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸'],
+ [0x9a80, '噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩'],
+ [0x9b40, '奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀'],
+ [0x9b80, '它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏'],
+ [0x9c40, '廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠'],
+ [0x9c80, '怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛'],
+ [0x9d40, '戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫'],
+ [0x9d80, '捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼'],
+ [0x9e40, '曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎'],
+ [0x9e80, '梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣'],
+ [0x9f40, '檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯'],
+ [0x9f80, '麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌'],
+ [0xe040, '漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝'],
+ [0xe080, '烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱'],
+ [0xe140, '瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿'],
+ [0xe180, '痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬'],
+ [0xe240, '磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰'],
+ [0xe280, '窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆'],
+ [0xe340, '紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷'],
+ [0xe380, '縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋'],
+ [0xe440, '隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤'],
+ [0xe480, '艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈'],
+ [0xe540, '蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬'],
+ [0xe580, '蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞'],
+ [0xe640, '襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧'],
+ [0xe680, '諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊'],
+ [0xe740, '蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜'],
+ [0xe780, '轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮'],
+ [0xe840, '錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙'],
+ [0xe880, '閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰'],
+ [0xe940, '顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃'],
+ [0xe980, '騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈'],
+ [0xea40, '鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯'],
+ [0xea80, '黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠堯槇遙瑤凜熙']
+]
+
+module.exports = function toSJIS (utf8Char) {
+ if (!utf8Char || utf8Char === '') return
+
+ for (var i = 0; i < SJIS_UTF8.length; i++) {
+ var kanji = SJIS_UTF8[i][1]
+
+ var posIndex = kanji.indexOf(utf8Char)
+ if (posIndex >= 0) {
+ return SJIS_UTF8[i][0] + posIndex
+ }
+ }
+}
+
+},{}]},{},[1])(1)
+});
+
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX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IGMoaSwhMCk7aWYodSlyZXR1cm4gdShpLCEwKTt2YXIgYT1uZXcgRXJyb3IoXCJDYW5ub3QgZmluZCBtb2R1bGUgJ1wiK2krXCInXCIpO3Rocm93IGEuY29kZT1cIk1PRFVMRV9OT1RfRk9VTkRcIixhfXZhciBwPW5baV09e2V4cG9ydHM6e319O2VbaV1bMF0uY2FsbChwLmV4cG9ydHMsZnVuY3Rpb24ocil7dmFyIG49ZVtpXVsxXVtyXTtyZXR1cm4gbyhufHxyKX0scCxwLmV4cG9ydHMscixlLG4sdCl9cmV0dXJuIG5baV0uZXhwb3J0c31mb3IodmFyIHU9XCJmdW5jdGlvblwiPT10eXBlb2YgcmVxdWlyZSYmcmVxdWlyZSxpPTA7aTx0Lmxlbmd0aDtpKyspbyh0W2ldKTtyZXR1cm4gb31yZXR1cm4gcn0pKCkiLCJ2YXIgU0pJU19VVEY4ID0gW1xuICBbMHg4MTQwLCAn44CA44CB44CC77yM77yO44O777ya77yb77yf77yB44Kb44KcwrTvvYDCqO+8vu+/o++8v+ODveODvuOCneOCnuOAg+S7neOAheOAhuOAh+ODvOKAleKAkO+8j++8vO+9nuKIpe+9nOKApuKApeKAmOKAmeKAnOKAne+8iO+8ieOAlOOAle+8u++8ve+9m++9neOAiOOAieOAiuOAi+OAjOOAjeOAjuOAj+OAkOOAke+8i++8jcKxw5cnXSxcbiAgWzB4ODE4MCwgJ8O377yd4omg77yc77yeJ10sXG4gIFsweDgxOGYsICfvv6XvvITvv6Dvv6HvvIXvvIPvvIbvvIrvvKDCp+KYhuKYhSddLFxuICBbMHg4MWE2LCAn4oC744CS4oaS4oaQ4oaR4oaT44CTJ10sXG4gIFsweDgxY2EsICfvv6InXSxcbiAgWzB4ODI0ZiwgJ++8kO+8ke+8ku+8k++8lO+8le+8lu+8l++8mO+8mSddLFxuICBbMHg4MjYwLCAn77yh77yi77yj77yk77yl77ym77yn77yo77yp77yq77yr77ys77yt77yu77yv77yw77yx77yy77yz77y077y177y277y377y477y577y6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rrPltJbmhajmpoLmtq/noo3ok4vooZfoqbLpjqfpqrjmtazppqjom5nlnqPmn7/om47piI7lioPlmoflkITlu5Pmi6HmkrnmoLzmoLjmrrvnjbLnorrnqavopprop5LotavovIPpg63plqPpmpTpnanlrablsrPmpb3poY3poY7mjpvnrKDmqKsnXSxcbiAgWzB4OGE4MCwgJ+apv+aitumwjea9n+WJsuWWneaBsOaLrOa0u+a4h+a7keiRm+ikkOi9hOS4lOmwueWPtuakm+aouumehOagquWFnOerg+iSsumHnOmOjOWZm+m0qOagouiMheiQseeypeWIiOiLheeTpuS5vuS+g+WGoOWvkuWIiuWLmOWLp+W3u+WWmuWgquWnpuWujOWumOWvm+W5suW5ueaCo+aEn+aFo+aGvuaPm+aVouafkeahk+ajuuasvuatk+axl+a8oua+l+a9heeSsOeUmOebo+eci+erv+euoeewoee3qee8tue/sOiCneiJpuiOnuims+irjOiyq+mChOmRkemWk+mWkemWoumZpemfk+mkqOiImOS4uOWQq+WyuOW3jOeOqeeZjOecvOWyqee/q+i0i+mbgemgkemhlOmhmOS8geS8juWNseWWnOWZqOWfuuWlh+WsieWvhOWykOW4jOW5vuW/jOaPruacuuaXl+aXouacn+aji+ajhCddLFxuICBbMHg4YjQwLCAn5qmf5biw5q+F5rCX5rG955W/56WI5a2j56iA57SA5b696KaP6KiY6LK06LW36LuM6Lyd6aOi6aiO6ay85LqA5YG95YSA5aaT5a6c5oiv5oqA5pOs5qy654qg55aR56WH576p6J+76Kq86K2w5o6s6I+K6Z6g5ZCJ5ZCD5Zar5qGU5qmY6Kmw56Cn5p216buN5Y205a6i6ISa6JmQ6YCG5LiY5LmF5LuH5LyR5Y+K5ZC45a6u5byT5oCl5pWRJ10sXG4gIFsweDhiODAsICfmnL3msYLmsbLms6PngbjnkIPnqbbnqq7nrIjntJrns77ntabml6fniZvljrvlsYXlt6jmi5Lmi6DmjJnmuKDomZroqLHot53pi7jmvIHnpqbprZrkuqjkuqvkuqzkvpvkvqDlg5HlhYfnq7blhbH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5L285L6v5YCZ5YCW5YWJ5YWs5Yqf5Yq55Yu+5Y6a5Y+j5ZCRJ10sXG4gIFsweDhkNDAsICflkI7llonlnZHlnqLlpb3lrZTlrZ3lro/lt6Xlt6flt7flubjluoPluprlurflvJjmgZLmhYzmipfmi5jmjqfmlLvmmILmmYPmm7Tmna3moKHmopfmp4vmsZ/mtKrmtanmuK/mup3nlLLnmofnoaznqL/ns6DntIXntJjntZ7ntrHogJXogIPogq/ogrHohZToho/oiKrojZLooYzooaHorJvosqLos7zpg4rphbXpibHnoL/pi7zplqTpmY0nXSxcbiAgWzB4OGQ4MCwgJ+mghemmmemrmOm0u+WJm+WKq+WPt+WQiOWjleaLt+a/oOixqui9n+m6ueWFi+WIu+WRiuWbveepgOmFt+m1oOm7kueNhOa8ieiFsOeUkeW/veaDmumqqOeLm+i+vOatpOmgg+S7iuWbsOWdpOWivuWpmuaBqOaHh+aYj+aYhuagueaisea3t+eXlee0uuiJrumtguS6m+S9kOWPieWUhuW1r+W3puW3ruafu+aymeeRs+egguipkOmOluijn+WdkOW6p+aMq+WCteWCrOWGjeacgOWTieWhnuWmu+WusOW9qeaJjeaOoeagveats+a4iOeBvemHh+eKgOegleegpuelreaWjue0sOiPnOijgei8iemam+WJpOWcqOadkOe9quiyoeWGtOWdgumYquWguuamiuiCtOWSsuW0juWfvOeilem3uuS9nOWJiuWSi+aQvuaYqOaclOafteeqhOetlue0oumMr+ahnOmureesueWMmeWGiuWItyddLFxuICBbMHg4ZTQwLCAn5a+f5ou25pKu5pOm5pyt5q666Jap6ZuR55qQ6a+W5o2M6YyG6a6r55q/5pmS5LiJ5YKY5Y+C5bGx5oOo5pKS5pWj5qGf54em54+K55Sj566X57qC6JqV6K6D6LOb6YW46aSQ5pas5pqr5q6L5LuV5LuU5Ly65L2/5Yi65Y+45Y+y5Zej5Zub5aOr5aeL5aeJ5ae/5a2Q5bGN5biC5bir5b+X5oCd5oyH5pSv5a2c5pav5pa95peo5p6d5q2iJ10sXG4gIFsweDhlODAsICfmrbvmsI/njYXnpYnnp4Hns7jntJnntKvogqLohILoh7PoppboqZ7oqanoqaboqozoq67os4fos5zpm4zpo7zmra/kuovkvLzkvo3lhZDlrZflr7rmhYjmjIHmmYLmrKHmu4vmsrvniL7nkr3nl5Tno4HnpLrogIzogLPoh6rokpTovp7msZDpub/lvI/orZjptKvnq7rou7jlro3pm6vkuIPlj7Hln7flpLHlq4nlrqTmgonmub/mvIbnlr7os6rlrp/olIDnr6DlgbLmn7Toip3lsaHolYrnuJ7oiI7lhpnlsITmjajotabmlpznha7npL7ntJfogIXorJ3ou4rpga7om4fpgqrlgJ/li7rlsLrmnZPngbzniLXphYzph4jpjKvoi6Xlr4LlvLHmg7nkuLvlj5blrojmiYvmnLHmrorni6nnj6DnqK7ohavotqPphZLpppblhJLlj5flkarlr7/mjojmqLnntqzpnIDlm5rlj47lkagnXSxcbiAgWzB4OGY0MCwgJ+Wul+WwseW3nuS/ruaEgeaLvua0suengOeni+e1gue5jee/kuiHreiIn+iSkOihhuilsuiukOi5tOi8r+mAsemFi+mFrOmbhumGnOS7gOS9j+WFheWNgeW+k+aIjuaflOaxgea4i+eNo+e4pumHjemKg+WPlOWkmeWuv+a3keelnee4rueym+WhvueGn+WHuuihk+i/sOS/iuWzu+aYpeeerOero+iInOmnv+WHhuW+quaXrOalr+auiea3syddLFxuICBbMHg4ZjgwLCAn5rqW5r2k55u+57SU5beh6YG16YaH6aCG5Yem5Yid5omA5pqR5puZ5ria5bq257eS572y5pu46Jav6Je36Ku45Yqp5Y+Z5aWz5bqP5b6Q5oGV6Yuk6Zmk5YK35YSf5Yud5Yyg5Y2H5Y+s5ZOo5ZWG5ZSx5ZiX5aWo5aa+5ai85a615bCG5bCP5bCR5bCa5bqE5bqK5bug5b2w5om/5oqE5oub5o6M5o235piH5piM5pit5pm25p2+5qKi5qif5qi15rK85raI5riJ5rmY54S854Sm54Wn55eH55yB56Gd56SB56Wl56ew56ug56yR57Kn57S56IKW6I+W6JKL6JWJ6KGd6KOz6Kif6Ki86KmU6Kmz6LGh6LOe6Yak6Ymm6Y2+6ZCY6Zqc6Z6Y5LiK5LiI5Lie5LmX5YaX5Ymw5Z+O5aC05aOM5ayi5bi45oOF5pO+5p2h5p2W5rWE54q255Wz56mj6JK46K2y6Ya46Yyg5Zix5Z+06aO+J10sXG4gIFsweDkwNDAsICfmi63mpI3mrpbnh63nuZTogbfoibLop6bpo5/onZXovrHlsLvkvLjkv6HkvrXllIflqKDlr53lr6nlv4PmhY7mjK/mlrDmmYvmo67mppvmtbjmt7HnlLPnlrnnnJ/npZ7np6bntLPoh6Poiq/olqropqroqLrouqvovpvpgLLph53pnIfkurrku4HliIPlobXlo6zlsIvnlJrlsL3ohY7oqIrov4XpmaPpna3nrKXoq4/poIjphaLlm7PljqgnXSxcbiAgWzB4OTA4MCwgJ+mAl+WQueWeguW4peaOqOawtOeCiuedoeeyi+e/oOihsOmBgumFlOmMkOmMmOmaj+eRnumrhOW0h+W1qeaVsOaeoui2qOmbm+aNruadieakmeiPhemgl+mbgOijvua+hOaRuuWvuOS4lueArOeVneaYr+WHhOWItuWLouWnk+W+geaAp+aIkOaUv+aVtOaYn+aZtOajsuagluato+a4heeJsueUn+ebm+eyvuiBluWjsOijveilv+iqoOiqk+iri+mAnemGkumdkumdmeaWieeojuiEhumau+W4reaDnOaImuaWpeaYlOaekOefs+epjeexjee4vuiEiuiyrOi1pOi3oei5n+eiqeWIh+aLmeaOpeaRguaKmOioreeqg+evgOiqrOmbque1tuiIjOidieS7meWFiOWNg+WNoOWuo+WwguWwluW3neaIpuaJh+aSsOagk+agtOaziea1hea0l+afk+a9nOeFjueFveaXi+epv+euree3middLFxuICBbMHg5MTQwLCAn57mK576o6IW66Iib6Ii56Jam6Kmu6LOO6Le16YG46YG36Yqt6YqR6ZaD6a6u5YmN5ZaE5ry454S25YWo56aF57mV6Iaz57OO5ZmM5aGR5bKo5o6q5pu+5pu95qWa54uZ55aP55aO56SO56WW56ef57KX57Sg57WE6JiH6Ki06Zi76YGh6byg5YOn5Ym15Y+M5Y+i5YCJ5Zaq5aOu5aWP54i95a6L5bGk5Yyd5oOj5oOz5o2c5o6D5oy/5o67J10sXG4gIFsweDkxODAsICfmk43ml6nmm7nlt6Pmp43mp73mvJXnh6Xkuonnl6nnm7jnqpPns5/nt4/ntpzogaHojYnojZjokazokrzol7voo4XotbDpgIHpga3pjpfpnJzpqJLlg4/lopfmho7oh5PolLXotIjpgKDkv4PlgbTliYfljbPmga/mjYnmnZ/muKzotrPpgJ/kv5flsZ7os4rml4/ntprljZLoopblhbbmj4PlrZjlravlsIrmkI3mnZHpgZzku5blpJrlpKrmsbDoqZHllL7loJXlpqXmg7DmiZPmn4HoiLXmpZXpmYDpp4TpqKjkvZPloIblr77ogJDlsrHluK/lvoXmgKDmhYvmiLTmm7/ms7Dmu57og47ohb/oi5TooovosrjpgIDpgK7pmorpu5vpr5vku6Plj7DlpKfnrKzpho3poYzpt7nmu53ngKfljZPllYTlroXmiZjmip7mi5PmsqLmv6/nkKLoqJfpkLjmv4Hoq77ojLjlh6fom7jlj6onXSxcbiAgWzB4OTI0MCwgJ+WPqeS9humBlOi+sOWlquiEseW3veerqui+v+ajmuiwt+eLuOmxiOaoveiqsOS4ueWNmOWYhuWdpuaLheaOouaXpuatjua3oea5m+eCreefreerr+euque2u+iAveiDhuibi+iqlemNm+Wbo+Wjh+W8vuaWreaaluaqgOauteeUt+irh+WApOefpeWcsOW8m+aBpeaZuuaxoOeXtOeomue9ruiHtOicmOmBhemms+evieeVnOerueetkeiThCddLFxuICBbMHg5MjgwLCAn6YCQ56ep56qS6Iy25auh552A5Lit5Luy5a6Z5b+g5oq95pi85p+x5rOo6Jmr6KG36Ki76YWO6Yuz6aeQ5qiX54Cm54yq6Iun6JGX6LKv5LiB5YWG5YeL5ZaL5a+15biW5biz5bqB5byU5by15b2r5b605oey5oyR5pqi5pyd5r2u54mS55S655y66IG06IS56IW46J226Kq/6Kuc6LaF6Lez6Yqa6ZW36aCC6bOl5YuF5o2X55u05pyV5rKI54+N6LOD6Y6u6Zmz5rSl5aKc5qSO5qeM6L+96Y6a55eb6YCa5aGa5qCC5o605qe75L2D5rys5p+Y6L676JSm57a06Y2U5qS/5r2w5Z2q5aO35ays57Ss54iq5ZCK6Yej6ba05Lqt5L2O5YGc5YG15YmD6LKe5ZGI5aCk5a6a5bid5bqV5bqt5bu35byf5oKM5oq15oy65o+Q5qKv5rGA56KH56aO56iL57eg6ImH6KiC6Kum6LmE6YCTJ10sXG4gIFsweDkzNDAsICfpgrjphK3ph5jpvI7ms6XmkZjmk6LmlbXmu7TnmoTnrJvpganpj5Hmurrlk7LlvrnmkqTovY3ov63piYTlhbjloavlpKnlsZXlupfmt7vnuo/nlJzosrzou6LpoZvngrnkvJ3mrr/mvrHnlLDpm7vlhY7lkJDloLXloZflpqzlsaDlvpLmlpfmnZzmuKHnmbvoj5/os63pgJTpg73pjY3noKXnoLrliqrluqblnJ/lpbTmgJLlgJLlhZrlhqwnXSxcbiAgWzB4OTM4MCwgJ+WHjeWIgOWUkOWhlOWhmOWll+WuleWztuW2i+aCvOaKleaQreadseahg+aivOajn+ebl+a3mOa5r+a2m+eBr+eHiOW9k+eXmOelt+etieetlOetkuezlue1seWIsOiRo+iVqeiXpOiojuishOixhui4j+mAg+mAj+mQmemZtumgremosOmXmOWDjeWLleWQjOWgguWwjuaGp+aSnua0nuees+erpeiDtOiQhOmBk+mKheWzoOm0h+WMv+W+l+W+s+a2nOeJueedo+emv+evpOavkueLrOiqreagg+apoeWHuOeqgeaktOWxiumztuiLq+WvhemFieeAnuWZuOWxr+aDh+aVpuayjOixmumBgemgk+WRkeabh+mIjeWliOmCo+WGheS5jeWHquiWmeisjueBmOaNuumNi+aloummtOe4hOeVt+WNl+aloOi7n+mbo+axneS6jOWwvOW8kOi/qeWMguizkeiCieiZueW7v+aXpeS5s+WFpSddLFxuICBbMHg5NDQwLCAn5aaC5bC/6Z+u5Lu75aaK5b+N6KqN5r+h56aw56Wi5a+n6JGx54yr54ax5bm05b+15o275pKa54eD57KY5LmD5bu85LmL5Z+c5Zqi5oKp5r+D57SN6IO96ISz6Ia/6L6y6KaX6Jqk5be05oqK5pKt6KaH5p235rOi5rS+55C256C05amG57216Iqt6aas5L+z5buD5oud5o6S5pWX5p2v55uD54mM6IOM6IK66Lyp6YWN5YCN5Z+55aqS5qKFJ10sXG4gIFsweDk0ODAsICfmpbPnhaTni73osrflo7Los6DpmarpgJnonb/np6Tnn6fokKnkvK/liaXljZrmi43mn4/ms4rnmb3nrpTnspXoiLboloTov6vmm53mvKDniIbnuJvojqvpp4Hpuqblh73nrrHnobLnrrjogofnrYjmq6jluaHogoznlZHnlaDlhavpiaLmuoznmbrphpfpq6rkvJDnvbDmipznrY/plqXps6nlmbrloZnom6TpmrzkvLTliKTljYrlj43lj5vluIbmkKzmlpHmnb/msL7msY7niYjniq/nj63nlZTnuYHoiKzol6nosqnnr4Tph4bnhanpoJLpo6/mjL3mmannlarnm6Tno5DolYPom67ljKrljZHlkKblpoPluoflvbzmgrLmiYnmibnmiqvmlpDmr5Tms4znlrLnmq7nopHnp5jnt4vnvbfogqXooqvoqrnosrvpgb/pnZ7po5vmqIvnsLjlgpnlsL7lvq7mnofmr5jnkLXnnInnvo4nXSxcbiAgWzB4OTU0MCwgJ+m8u+afiueol+WMueeWi+mrreW9puiGneiPseiCmOW8vOW/heeVouethumAvOahp+Wnq+Wqm+e0kOeZvuisrOS/teW9quaomeawt+a8gueTouelqOihqOipleixueW7n+aPj+eXheenkuiLl+mMqOmLsuiSnOibremwreWTgeW9rOaWjOa1nOeAleiyp+izk+mgu+aVj+eTtuS4jeS7mOWfoOWkq+WppuWvjOWGqOW4g+W6nOaAluaJtuaVtyddLFxuICBbMHg5NTgwLCAn5pan5pmu5rWu54i256ym6IWQ6Iaa6IqZ6K2c6LKg6LOm6LW06Zic6ZmE5L6u5pKr5q2m6Iie6JGh6JWq6YOo5bCB5qWT6aKo6JG66JWX5LyP5Ymv5b6p5bmF5pyN56aP6IW56KSH6KaG5re15byX5omV5rK45LuP54mp6a6S5YiG5ZC75Zm05aKz5oak5omu54Sa5aWu57KJ57Oe57Sb6Zuw5paH6IGe5LiZ5L215YW15aGA5bmj5bmz5byK5p+E5Lim6JS96ZaJ6Zmb57Gz6aCB5YO75aOB55mW56Kn5Yil556l6JSR566G5YGP5aSJ54mH56+H57eo6L666L+U6YGN5L6/5YuJ5aip5byB6Z6t5L+d6IiX6Yuq5ZyD5o2V5q2p55Sr6KOc6LyU56mC5Yuf5aKT5oWV5oiK5pqu5q+N57C/6I+p5YCj5L+45YyF5ZGG5aCx5aWJ5a6d5bOw5bOv5bSp5bqW5oqx5o2n5pS+5pa55pyLJ10sXG4gIFsweDk2NDAsICfms5Xms6Hng7nnoLLnuKvog57oirPokIzok6zonILopJLoqKrosYrpgqbpi5Lpo73ps7PptazkuY/kuqHlgo3liZblnYrlpqjluL3lv5jlv5nmiL/mmrTmnJvmn5Dmo5LlhpLntKHogqrohqjorIDosozosr/pib7pmLLlkKDpoKzljJflg5XljZzloqjmkrLmnLTniafnnabnqYbph6bli4PmsqHmrobloIDluYzlpZTmnKznv7vlh6Hnm4YnXSxcbiAgWzB4OTY4MCwgJ+aRqeejqOmtlOm6u+Wfi+WmueaYp+aemuavjuWTqeanmeW5leiGnOaelemuquafvumxkuahneS6puS/o+WPiOaKueacq+ayq+i/hOS+ree5rem6v+S4h+aFoua6gOa8q+iUk+WRs+acqumtheW3s+euleWyrOWvhuicnOa5iuiTkeeolOiEiOWmmeeyjeawkeecoOWLmeWkoueEoeeJn+efm+mcp+m1oeaki+Wpv+WomOWGpeWQjeWRveaYjuebn+i/t+mKmOmztOWnqueJnea7heWFjeajiee2v+e3rOmdoum6uuaRuOaooeiMguWmhOWtn+avm+eMm+ebsue2suiAl+iSmeWEsuacqOm7meebruadouWLv+mkheWwpOaIu+exvuiysOWVj+aCtue0i+mWgOWMgeS5n+WGtuWknOeIuuiAtumHjuW8peefouWOhOW9uee0hOiWrOios+i6jemdluafs+iWrumRk+aEieaEiOayueeZkiddLFxuICBbMHg5NzQwLCAn6Kut6Ly45ZSv5L2R5YSq5YuH5Y+L5a6l5bm95oKg5oaC5o+W5pyJ5p+a5rmn5raM54y254y355Sx56WQ6KOV6KqY6YGK6YKR6YO16ZuE6J6N5aSV5LqI5L2Z5LiO6KqJ6Ly/6aCQ5YKt5bm85aaW5a655bq45o+a5o+65pOB5puc5qWK5qeY5rSL5rq254aU55So56qv576K6ICA6JGJ6JOJ6KaB6Kyh6LiK6YGl6Zm96aSK5oW+5oqR5qyyJ10sXG4gIFsweDk3ODAsICfmsoPmtbTnv4znv7zmt4DnvoXonrroo7jmnaXojrHpoLzpm7fmtJvntaHokL3pharkubHljbXltZDmrITmv6vol43omK3opqfliKnlkI/lsaXmnY7moqjnkIbnkoPnl6Loo4/oo6Hph4zpm6Lpmbjlvovnjofnq4vokY7mjqDnlaXlionmtYHmupznkInnlZnnoavnspLpmobnq5zpvo3kvrbmha7ml4XomZzkuobkuq7lg5rkuKHlh4zlr67mlpnmooHmtrznjJ/nmYLnnq3nqJzns6foia/oq5Lpgbzph4/pmbXpoJjlipvnt5HlgKvljpjmnpfmt4vnh5DnkLPoh6jovKrpmqPpsZfpup/nkaDloYHmtpnntK/poZ7ku6TkvLbkvovlhrflirHltrrmgJznjrLnpLzoi5PpiLTpmrfpm7bpnIrpupfpvaLmmqbmrbTliJfliqPng4joo4Llu4nmgYvmhpDmvKPnhYnnsL7nt7Toga8nXSxcbiAgWzB4OTg0MCwgJ+iTrumAo+mMrOWRgumtr+ark+eCieizgui3r+mcsuWKtOWpgeW7iuW8hOacl+alvOamlOa1qua8j+eJoueLvOevreiAgeiBvuidi+mDjuWFrem6k+emhOiCi+mMsuirluWAreWSjOipseatquizhOiEh+aDkeaeoOm3suS6meS6mOmwkOipq+iXgeiVqOakgOa5vueil+iFlSddLFxuICBbMHg5ODlmLCAn5byM5LiQ5LiV5Liq5Lix5Li25Li85Li/5LmC5LmW5LmY5LqC5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pjmmp3mm4Hmmrnmm4nmmr7mmrwnXSxcbiAgWzB4OWU0MCwgJ+abhOaauOabluabmuaboOaYv+abpuabqeabsOabteabt+acj+acluacnuacpuacp+mcuOacruacv+actuadgeacuOact+adhuadnuadoOadmeado+adpOaeieadsOaeqeadvOadquaejOaei+aepuaeoeaeheaet+afr+aetOafrOaes+afqeaeuOafpOafnuafneafouafruaeueafjuafhuafp+aqnOagnuahhuagqeahgOahjeagsuahjiddLFxuICBbMHg5ZTgwLCAn5qKz5qCr5qGZ5qGj5qG35qG/5qKf5qKP5qKt5qKU5qKd5qKb5qKD5qqu5qK55qG05qK15qKg5qK65qSP5qKN5qG+5qSB5qOK5qSI5qOY5qSi5qSm5qOh5qSM5qON5qOU5qOn5qOV5qS25qSS5qSE5qOX5qOj5qSl5qO55qOg5qOv5qSo5qSq5qSa5qSj5qSh5qOG5qW55qW35qWc5qW45qWr5qWU5qW+5qWu5qS55qW05qS95qWZ5qSw5qWh5qWe5qWd5qaB5qWq5qay5qau5qeQ5qa/5qeB5qeT5qa+5qeO5a+o5qeK5qed5qa75qeD5qan5qiu5qaR5qag5qac5qaV5qa05qee5qeo5qiC5qib5qe/5qyK5qe55qey5qen5qiF5qax5qie5qet5qiU5qer5qiK5qiS5quB5qij5qiT5qmE5qiM5qmy5qi25qm45qmH5qmi5qmZ5qmm5qmI5qi45qii5qqQ5qqN5qqg5qqE5qqi5qqjJ10sXG4gIFsweDlmNDAsICfmqpfomJfmqrvmq4Pmq4LmqrjmqrPmqqzmq57mq5Hmq5/mqqrmq5rmq6rmq7vmrIXomJbmq7rmrJLmrJbprLHmrJ/mrLjmrLfnm5zmrLnpo67mrYfmrYPmrYnmrZDmrZnmrZTmrZvmrZ/mraHmrbjmrbnmrb/mroDmroTmroPmro3mrpjmrpXmrp7mrqTmrqrmrqvmrq/mrrLmrrHmrrPmrrfmrrzmr4bmr4vmr5Pmr5/mr6zmr6vmr7Pmr68nXSxcbiAgWzB4OWY4MCwgJ+m6vuawiOawk+awlOawm+awpOawo+axnuaxleaxouaxquayguayjeaymuaygeaym+axvuaxqOaxs+aykuaykOazhOazseazk+ayveazl+azheazneayruayseayvuayuuazm+azr+azmeazqua0n+ihjea0tua0q+a0vea0uOa0mea0tea0s+a0kua0jOa1o+a2k+a1pOa1mua1uea1mea2jua2lea/pOa2hea3uea4lea4iua2tea3h+a3pua2uOa3hua3rOa3nua3jOa3qOa3kua3hea3uua3mea3pOa3lea3qua3rua4rea5rua4rua4mea5sua5n+a4vua4o+a5q+a4q+a5tua5jea4n+a5g+a4uua5jua4pOa7v+a4nea4uOa6gua6qua6mOa7iea6t+a7k+a6vea6r+a7hOa6sua7lOa7lea6j+a6pea7gua6n+a9gea8keeBjOa7rOa7uOa7vua8v+a7sua8sea7r+a8sua7jCddLFxuICBbMHhlMDQwLCAn5ry+5ryT5ru35r6G5r265r245r6B5r6A5r2v5r2b5r+z5r2t5r6C5r285r2Y5r6O5r6R5r+C5r2m5r6z5r6j5r6h5r6k5r655r+G5r6q5r+f5r+V5r+s5r+U5r+Y5r+x5r+u5r+b54CJ54CL5r+654CR54CB54CP5r++54Cb54Ca5r2054Cd54CY54Cf54Cw54C+54Cy54GR54Gj54KZ54KS54Kv54Ox54Ks54K454Kz54Ku54Of54OL54OdJ10sXG4gIFsweGUwODAsICfng5nnhInng73nhJznhJnnhaXnhZXnhojnhabnhaLnhYznhZbnhaznho/nh7vnhoTnhpXnhqjnhqznh5fnhrnnhr7nh5Lnh4nnh5Tnh47nh6Dnh6znh6fnh7Xnh7znh7nnh7/niI3niJDniJvniKjniK3niKzniLDniLLniLvniLzniL/niYDniYbniYvniZjnibTnib7nioLnioHniofnipLnipbniqLniqfnirnnirLni4Pni4bni4Tni47ni5Lni6Lni6Dni6Hni7nni7flgI/njJfnjIrnjJznjJbnjJ3njLTnjK/njKnnjKXnjL7njY7njY/pu5jnjZfnjarnjajnjbDnjbjnjbXnjbvnjbrnj4jnjrPnj47njrvnj4Dnj6Xnj67nj57nkqLnkIXnka/nkKXnj7jnkLLnkLrnkZXnkL/nkZ/nkZnnkYHnkZznkannkbDnkaPnkarnkbbnkb7nkovnkp7nkqfnk4rnk4/nk5Tnj7EnXSxcbiAgWzB4ZTE0MCwgJ+eToOeTo+eTp+eTqeeTrueTsueTsOeTseeTuOeTt+eUhOeUg+eUheeUjOeUjueUjeeUleeUk+eUnueUpueUrOeUvOeVhOeVjeeViueVieeVm+eVhueVmueVqeeVpOeVp+eVq+eVreeVuOeVtueWhueWh+eVtOeWiueWieeWgueWlOeWmueWneeWpeeWo+eXgueWs+eXg+eWteeWveeWuOeWvOeWseeXjeeXiueXkueXmeeXo+eXnueXvueXvyddLFxuICBbMHhlMTgwLCAn55e855iB55ew55e655ey55ez55iL55iN55iJ55if55in55ig55ih55ii55ik55i055iw55i755mH55mI55mG55mc55mY55mh55mi55mo55mp55mq55mn55ms55mw55my55m255m455m855qA55qD55qI55qL55qO55qW55qT55qZ55qa55qw55q055q455q555q655uC55uN55uW55uS55ue55uh55ul55un55uq6Jiv55u755yI55yH55yE55yp55yk55ye55yl55ym55yb55y355y4552H552a552o552r552b552l552/552+5525556O556L556R556g556e556w55625565556/55685569556755+H55+N55+X55+a55+c55+j55+u55+856CM56CS56Sm56Cg56Sq56GF56KO56G056KG56G856Ka56KM56Kj56K156Kq56Kv56OR56OG56OL56OU56K+56K856OF56OK56OsJ10sXG4gIFsweGUyNDAsICfno6fno5rno73no7TnpIfnpJLnpJHnpJnnpKznpKvnpYDnpaDnpZfnpZ/npZrnpZXnpZPnpbrnpb/npornpp3npqfpvYvnpqrnpq7nprPnprnnprrnp4nnp5Xnp6fnp6znp6Hnp6PnqIjnqI3nqJjnqJnnqKDnqJ/npoDnqLHnqLvnqL7nqLfnqYPnqZfnqYnnqaHnqaLnqanpvp3nqbDnqbnnqb3nqojnqpfnqpXnqpjnqpbnqqnnq4jnqrAnXSxcbiAgWzB4ZTI4MCwgJ+eqtuerheerhOeqv+mCg+erh+eriuerjeerj+erleerk+ermeermuerneeroeerouerpuerreersOesguesj+esiueshuess+esmOesmeesnuesteesqOestuetkOetuueshOetjeesi+etjOetheetteetpeettOetp+etsOetseetrOetrueuneeumOeun+eujeeunOeumueui+eukueuj+etneeumeevi+evgeevjOevj+eutOevhuevneevqeewkeewlOevpuevpeexoOewgOewh+ewk+evs+evt+ewl+ewjeevtuewo+ewp+ewquewn+ewt+ewq+ewveexjOexg+exlOexj+exgOexkOexmOexn+expOexluexpeexrOexteeyg+eykOeypOeyreeyoueyq+eyoeeyqOeys+eysueyseeyrueyueeyveezgOezheezguezmOezkueznOezoumsu+ezr+ezsueztOeztuezuue0hiddLFxuICBbMHhlMzQwLCAn57SC57Sc57SV57SK57WF57WL57Su57Sy57S/57S157WG57Wz57WW57WO57Wy57Wo57Wu57WP57Wj57aT57aJ57Wb57aP57W957ab57a657au57aj57a157eH57a957ar57i957ai57av57ec57a457af57aw57eY57ed57ek57ee57e757ey57eh57iF57iK57ij57ih57iS57ix57if57iJ57iL57ii57mG57mm57i757i157i557mD57i3J10sXG4gIFsweGUzODAsICfnuLLnuLrnuafnuZ3nuZbnuZ7nuZnnuZrnubnnuarnuannubznubvnuoPnt5Xnub3ovq7nub/nuojnuonnuoznupLnupDnupPnupTnupbnuo7nupvnupznvLjnvLrnvYXnvYznvY3nvY7nvZDnvZHnvZXnvZTnvZjnvZ/nvaDnvajnvannvafnvbjnvoLnvobnvoPnvojnvofnvoznvpTnvp7nvp3nvprnvqPnvq/nvrLnvrnnvq7nvrbnvrjorbHnv4Xnv4bnv4rnv5Xnv5Tnv6Hnv6bnv6nnv7Pnv7npo5zogIbogITogIvogJLogJjogJnogJzogKHogKjogL/ogLvogYrogYbogZLogZjogZrogZ/ogaLogajogbPogbLogbDogbbogbnogb3ogb/ogoTogobogoXogpvogpPogprogq3lhpDogqzog5vog6Xog5nog53og4Tog5rog5bohInog6/og7HohJvohKnohKPohK/ohYsnXSxcbiAgWzB4ZTQ0MCwgJ+mai+iFhuiEvuiFk+iFkeiDvOiFseiFruiFpeiFpuiFtOiGg+iGiOiGiuiGgOiGguiGoOiGleiGpOiGo+iFn+iGk+iGqeiGsOiGteiGvuiGuOiGveiHgOiHguiGuuiHieiHjeiHkeiHmeiHmOiHiOiHmuiHn+iHoOiHp+iHuuiHu+iHvuiIgeiIguiIheiIh+iIiuiIjeiIkOiIluiIqeiIq+iIuOiIs+iJgOiJmeiJmOiJneiJmuiJn+iJpCddLFxuICBbMHhlNDgwLCAn6Imi6Imo6Imq6Imr6Iiu6Imx6Im36Im46Im+6IqN6IqS6Iqr6Iqf6Iq76Iqs6Iuh6Iuj6Iuf6IuS6Iu06Iuz6Iu66I6T6IyD6Iu76Iu56Iue6IyG6Iuc6IyJ6IuZ6Iy16Iy06IyW6Iyy6Iyx6I2A6Iy56I2Q6I2F6Iyv6Iyr6IyX6IyY6I6F6I6a6I6q6I6f6I6i6I6W6Iyj6I6O6I6H6I6K6I286I616I2z6I216I6g6I6J6I6o6I+06JCT6I+r6I+O6I+96JCD6I+Y6JCL6I+B6I+36JCH6I+g6I+y6JCN6JCi6JCg6I696JC46JSG6I+76JGt6JCq6JC86JWa6JKE6JG36JGr6JKt6JGu6JKC6JGp6JGG6JCs6JGv6JG56JC16JOK6JGi6JK56JK/6JKf6JOZ6JON6JK76JOa6JOQ6JOB6JOG6JOW6JKh6JSh6JO/6JO06JSX6JSY6JSs6JSf6JSV6JSU6JO86JWA6JWj6JWY6JWIJ10sXG4gIFsweGU1NDAsICfolYHomILolYvolZXoloDolqTolojolpHolorolqjola3olpTolpvol6rolofolpzolbfolb7olpDol4nolrrol4/olrnol5Dol5Xol53ol6Xol5zol7nomIromJPomIvol77ol7romIbomKLomJromLDomL/omY3kuZXomZTomZ/omafombHompPomqPomqnomqromovomozomrbomq/om4Tom4bomrDom4nooKPomqvom5Tom57om6nom6wnXSxcbiAgWzB4ZTU4MCwgJ+ibn+ibm+ibr+ickuichuiciOicgOicg+ibu+ickeicieicjeibueiciuictOicv+ict+icu+icpeicqeicmuidoOidn+iduOidjOidjuidtOidl+idqOidruidmeidk+ido+idquigheieouien+ieguier+ifi+ieveifgOifkOmbluieq+ifhOies+ifh+ifhuieu+ifr+ifsuifoOigj+igjeifvuiftuift+igjuifkuigkeigluigleigouigoeigseigtuigueigp+igu+ihhOihguihkuihmeihnuihouihq+iigeihvuiinuihteihveiiteihsuiiguiil+iikuiiruiimeiiouiijeiipOiisOiiv+iiseijg+ijhOijlOijmOijmeijneijueikguijvOijtOijqOijsuikhOikjOikiuikk+ilg+iknuikpeikquikq+ilgeilhOiku+iktuikuOiljOikneiloOilniddLFxuICBbMHhlNjQwLCAn6KWm6KWk6KWt6KWq6KWv6KW06KW36KW+6KaD6KaI6KaK6KaT6KaY6Kah6Kap6Kam6Kas6Kav6Kay6Ka66Ka96Ka/6KeA6Kea6Kec6Ked6Ken6Ke06Ke46KiD6KiW6KiQ6KiM6Kib6Kid6Kil6Ki26KmB6Kmb6KmS6KmG6KmI6Km86Kmt6Kms6Kmi6KqF6KqC6KqE6Kqo6Kqh6KqR6Kql6Kqm6Kqa6Kqj6KuE6KuN6KuC6Kua6Kur6Kuz6KunJ10sXG4gIFsweGU2ODAsICfoq6Toq7HorJToq6Doq6Loq7foq57oq5vorIzorIforJroq6HorJborJDorJforKDorLPpnqvorKborKvorL7orKjorYHorYzorY/orY7orYnorZborZvorZroravorZ/orazora/orbTorb3oroDorozoro7orpLorpPorpborpnorprosLrosYHosL/osYjosYzosY7osZDosZXosaLosazosbjosbrosoLosonosoXosoroso3oso7ospTosbzospjmiJ3osq3osqrosr3osrLosrPosq7osrbos4jos4Hos6Tos6Pos5ros73os7ros7votITotIXotIrotIfotI/otI3otJDpvY7otJPos43otJTotJbotafota3otbHotbPotoHotpnot4Lotr7otrrot4/ot5rot5bot4zot5vot4vot6rot6vot5/ot6Pot7zouIjouInot7/ouJ3ouJ7ouJDouJ/ouYLouLXouLDouLTouYonXSxcbiAgWzB4ZTc0MCwgJ+i5h+i5iei5jOi5kOi5iOi5mei5pOi5oOi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Wu+mWuemWvumXiua/tumXg+mXjemXjOmXlemXlOmXlumXnOmXoemXpemXoumYoemYqOmYrumYr+mZgumZjOmZj+mZi+mZt+mZnOmZnumZnemZn+mZpumZsumZrOmajemamOmalemal+maqumap+masemasumasOmatOmatumauOmauembjumbi+mbiembjeiljembnOmcjemblembuemchOmchumciOmck+mcjumckemcj+mclumcmemcpOmcqumcsOmcuemcvemcvumdhOmdhumdiOmdgumdiemdnOmdoOmdpOmdpumdqOWLkumdq+mdsemduemehemdvOmegemduumehumei+mej+mekOmenOmeqOmepumeo+mes+metOmfg+mfhumfiOmfi+mfnOmfrem9j+mfsuern+mftumftemgj+mgjOmguOmgpOmgoemgt+mgvemhhumhj+mhi+mhq+mhr+mhsCddLFxuICBbMHhlOTQwLCAn6aGx6aG06aGz6aKq6aKv6aKx6aK26aOE6aOD6aOG6aOp6aOr6aSD6aSJ6aSS6aSU6aSY6aSh6aSd6aSe6aSk6aSg6aSs6aSu6aS96aS+6aWC6aWJ6aWF6aWQ6aWL6aWR6aWS6aWM6aWV6aaX6aaY6aal6aat6aau6aa86aef6aeb6aed6aeY6aeR6aet6aeu6aex6aey6ae76ae46aiB6aiP6aiF6aei6aiZ6air6ai36amF6amC6amA6amDJ10sXG4gIFsweGU5ODAsICfpqL7pqZXpqY3pqZvpqZfpqZ/pqaLpqaXpqaTpqanpqavpqarpqq3pqrDpqrzpq4Dpq4/pq5Hpq5Ppq5Tpq57pq5/pq6Lpq6Ppq6bpq6/pq6vpq67pq7Tpq7Hpq7fpq7vprIbprJjprJrprJ/prKLprKPprKXprKfprKjprKnprKrprK7prK/prLLprYTprYPprY/prY3prY7prZHprZjprbTprpPproPprpHprpbprpfprp/prqDprqjprrTpr4Dpr4rprrnpr4bpr4/pr5Hpr5Lpr6Ppr6Lpr6Tpr5Tpr6HpsLrpr7Lpr7Hpr7DpsJXpsJTpsInpsJPpsIzpsIbpsIjpsJLpsIrpsITpsK7psJvpsKXpsKTpsKHpsLDpsYfpsLLpsYbpsL7psZrpsaDpsafpsbbpsbjps6fps6zps7DptInptIjps6vptIPptIbptKrptKbptq/ptKPptJ/ptYTptJXptJLptYHptL/ptL7ptYbptYgnXSxcbiAgWzB4ZWE0MCwgJ+m1nem1num1pOm1kem1kOm1mem1sum2iem2h+m2q+m1r+m1uum2mum2pOm2qem2sum3hOm3gem2u+m2uOm2uum3hum3j+m3gum3mem3k+m3uOm3pum3rem3r+m3vem4mum4m+m4num5tem5uem5vem6gem6iOm6i+m6jOm6kum6lem6kem6nem6pem6qem6uOm6qum6remdoem7jOm7jum7j+m7kOm7lOm7nOm7num7nem7oOm7pem7qOm7ryddLFxuICBbMHhlYTgwLCAn6bu06bu26bu36bu56bu76bu86bu96byH6byI55q36byV6byh6bys6by+6b2K6b2S6b2U6b2j6b2f6b2g6b2h6b2m6b2n6b2s6b2q6b236b2y6b226b6V6b6c6b6g5aCv5qeH6YGZ55Gk5Yec54aZJ11cbl1cblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiB0b1NKSVMgKHV0ZjhDaGFyKSB7XG4gIGlmICghdXRmOENoYXIgfHwgdXRmOENoYXIgPT09ICcnKSByZXR1cm5cblxuICBmb3IgKHZhciBpID0gMDsgaSA8IFNKSVNfVVRGOC5sZW5ndGg7IGkrKykge1xuICAgIHZhciBrYW5qaSA9IFNKSVNfVVRGOFtpXVsxXVxuXG4gICAgdmFyIHBvc0luZGV4ID0ga2FuamkuaW5kZXhPZih1dGY4Q2hhcilcbiAgICBpZiAocG9zSW5kZXggPj0gMCkge1xuICAgICAgcmV0dXJuIFNKSVNfVVRGOFtpXVswXSArIHBvc0luZGV4XG4gICAgfVxuICB9XG59XG4iXX0=
diff --git a/sw - Copy.js b/sw - Copy.js
new file mode 100644
index 0000000..c1f9f91
--- /dev/null
+++ b/sw - Copy.js
@@ -0,0 +1,46 @@
+// Change version to cause cache refresh, sw.js SE NE SME CACHAT aka ne ga dat v assets!
+const static_cache_name = "site-static-v0.0.7";
+const assets = [
+ "./",
+ "./courbd.ttf",
+ "./favicon.ico",
+ "./favicon.png",
+ "./iso-8859-2.js",
+ "./myriadpro.otf",
+ "./myriadpro-semibold.otf",
+ "./qr.html",
+ "./qrcode.js",
+ "./qrcode.tosjis.js",
+ "./upn.html",
+ "./upn.svg",
+ "./index.html",
+ "./512x512.png",
+ "./192x192.png",
+ "./manifest.json"
+];
+
+self.addEventListener("install", (evt) => {
+ evt.waitUntil(
+ caches.open(static_cache_name).then((cache) => {
+ cache.addAll(assets);
+ })
+ );
+});
+
+// Delete old caches
+self.addEventListener("activate", evt => {
+ evt.waitUntil(
+ caches.keys().then((keys) => {
+ return Promise.all(keys
+ .filter(key => key !== static_cache_name)
+ .map(key => caches.delete(key))
+ );
+ })
+ );
+});
+
+self.addEventListener("fetch", (evt) => {
+ evt.respondWith(caches.match(evt.request).then((cache_res) => {
+ return cache_res || fetch(evt.request);
+ }))
+});
diff --git a/sw.js b/sw.js
new file mode 100644
index 0000000..c1f9f91
--- /dev/null
+++ b/sw.js
@@ -0,0 +1,46 @@
+// Change version to cause cache refresh, sw.js SE NE SME CACHAT aka ne ga dat v assets!
+const static_cache_name = "site-static-v0.0.7";
+const assets = [
+ "./",
+ "./courbd.ttf",
+ "./favicon.ico",
+ "./favicon.png",
+ "./iso-8859-2.js",
+ "./myriadpro.otf",
+ "./myriadpro-semibold.otf",
+ "./qr.html",
+ "./qrcode.js",
+ "./qrcode.tosjis.js",
+ "./upn.html",
+ "./upn.svg",
+ "./index.html",
+ "./512x512.png",
+ "./192x192.png",
+ "./manifest.json"
+];
+
+self.addEventListener("install", (evt) => {
+ evt.waitUntil(
+ caches.open(static_cache_name).then((cache) => {
+ cache.addAll(assets);
+ })
+ );
+});
+
+// Delete old caches
+self.addEventListener("activate", evt => {
+ evt.waitUntil(
+ caches.keys().then((keys) => {
+ return Promise.all(keys
+ .filter(key => key !== static_cache_name)
+ .map(key => caches.delete(key))
+ );
+ })
+ );
+});
+
+self.addEventListener("fetch", (evt) => {
+ evt.respondWith(caches.match(evt.request).then((cache_res) => {
+ return cache_res || fetch(evt.request);
+ }))
+});
diff --git a/upn.html b/upn.html
new file mode 100644
index 0000000..8d0aab3
--- /dev/null
+++ b/upn.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title></title>
+</head>
+<body>
+<div id="svg-container">
+<object type="image/svg+xml" data="upn.svg"></object>
+</div>
+
+<canvas id="canvas" width="210mm" height="99mm"></canvas>
+<div id="png-container"></div>
+
+
+<script>
+var svgString = new XMLSerializer().serializeToString(document.querySelector('svg'));
+
+var canvas = document.getElementById("canvas");
+var ctx = canvas.getContext("2d");
+var DOMURL = self.URL || self.webkitURL || self;
+var img = new Image();
+var svg = new Blob([svgString], {type: "image/svg+xml;charset=utf-8"});
+var url = DOMURL.createObjectURL(svg);
+img.onload = function() {
+ ctx.drawImage(img, 0, 0);
+ var png = canvas.toDataURL("image/png");
+ document.querySelector('#png-container').innerHTML = '<img src="'+png+'"/>';
+ DOMURL.revokeObjectURL(png);
+};
+img.src = url;
+
+</script>
+
+</body>
+</html> \ No newline at end of file
diff --git a/upn.svg b/upn.svg
new file mode 100644
index 0000000..738b65e
--- /dev/null
+++ b/upn.svg
@@ -0,0 +1,225 @@
+<svg version="1.1"
+ baseProfile="full"
+ width="210mm" height="99mm"
+ xmlns="http://www.w3.org/2000/svg">
+
+<defs>
+ <style type="text/css">
+ @font-face {
+ font-family: myriadpro-semibold;
+ src: url(myriadpro-semibold.otf);
+ }
+ @font-face {
+ font-family: myriadpro;
+ src: url(myriadpro.otf);
+ }
+ @font-face {
+ font-family: courbd;
+ src: url(courbd.ttf);
+ }
+ svg {
+ dominant-baseline: hanging;
+ }
+ </style>
+</defs>
+ <rect x="0mm" y="0mm" width="60mm" height="100%" style="fill:rgb(255,255,255);stroke-width:0;stroke:rgb(0,0,0)" />
+ <text style="font-family: myriadpro-semibold" x="32.6mm" y="2.0mm" font-size="10pt" text-anchor="start" fill="rgb(45, 41, 38)">UPN QR - potrdilo</text>
+ <text style="font-family: myriadpro-semibold" x="4.0mm" y="3.5mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Ime plačnika</text>
+ <rect x="4.0mm" y="6.0mm" width="52.5mm" height="13.5mm" style="fill:rgba(0,0,0,0);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <text id="belaVnosImePlacnika" style="font-family: courbd" x="4.0mm" y="6.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">Anton Luka Šijanec</text>
+ <text id="belaVnosUlicaPlacnika" style="font-family: courbd" x="4.0mm" y="10.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">Ulica dvajsetega aprila 69</text>
+ <text id="belaVnosKrajPlacnika" style="font-family: courbd" x="4.0mm" y="13.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">1337 Elita</text>
+ <text style="font-family: myriadpro-semibold" x="4.0mm" y="20mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Namen in rok plačila</text>
+ <rect x="4.0mm" y="22.5mm" width="52.5mm" height="9mm" style="fill:rgba(0,0,0,0);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <text id="belaVnosNamenPlacila" style="font-family: courbd" x="4.0mm" y="22.5mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">to pa to placilo</text>
+ <text id="belaVnosRokPlacila" style="font-family: courbd" x="4.0mm" y="28mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">22.02.2022</text>
+ <text style="font-family: myriadpro-semibold" x="16.5mm" y="32mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Znesek</text>
+ <text style="font-family: myriadpro-semibold" x="7.8mm" y="35.6mm" font-size="11pt" text-anchor="start" fill="rgb(45, 41, 38)">EUR</text>
+ <rect x="16.5mm" y="34.5mm" width="40mm" height="5mm" style="fill:rgba(0,0,0,0);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <text id="belaVnosZnesek" style="font-family: courbd" x="16.5mm" y="34.5mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">***14.71</text>
+ <text style="font-family: myriadpro-semibold" x="4.0mm" y="40.0mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">IBAN in referenca prejemnika</text>
+ <rect x="4.0mm" y="42.5mm" width="52.5mm" height="13.5mm" style="fill:rgba(0,0,0,0);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <text id="belaVnosIbanPrejemnika" style="font-family: courbd" x="4.0mm" y="42.5mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">SI56 7890 1234 5678 910</text>
+ <text id="belaVnosReferencaPrejemnika1" style="font-family: courbd" x="4.0mm" y="50mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">SI56</text>
+ <text id="belaVnosReferencaPrejemnika2" style="font-family: courbd" x="16.0mm" y="50mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">7891011121314</text>
+ <text style="font-family: myriadpro-semibold" x="4.0mm" y="56.5mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Ime prejemnika</text>
+ <rect x="4.0mm" y="59mm" width="52.5mm" height="13.5mm" style="fill:rgba(0,0,0,0);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <text id="belaVnosImePrejemnika" style="font-family: courbd" x="4.0mm" y="59mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">Anton Luka Šijanec</text>
+ <text id="belaVnosUlicaPrejemnika" style="font-family: courbd" x="4.0mm" y="63mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">Ulica dvajsetega aprila 69</text>
+ <text id="belaVnosKrajPrejemnika" style="font-family: courbd" x="4.0mm" y="66mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">1337 Elita</text>
+ <rect x="0mm" y="72.5mm" width="60mm" height="26.5mm" style="fill:rgba(0,0,0,0);" />
+ <text style="font-family: myriadpro" x="13.8mm" y="97mm" font-size="6pt" text-anchor="start" fill="rgb(255,103,77)">Prostor za vpise ponudnika plačilnih storitev</text>
+ <rect x="60mm" y="0mm" width="150mm" height="55mm" style="fill:rgba(255,255,255,1);stroke-width:0;stroke:rgb(0,0,0)" />
+ <rect x="60mm" y="0mm" width="150mm" height="55mm" style="fill:rgba(255,103,77,0.2);stroke-width:0;stroke:rgb(0,0,0)" />
+ <rect x="61.0mm" y="1.0mm" width="1.5mm" height="1.5mm" style="fill:rgba(0,0,0,1);" />
+ <rect x="207.5mm" y="1.0mm" width="1.5mm" height="1.5mm" style="fill:rgba(0,0,0,1);" />
+ <text style="font-family: myriadpro-semibold" x="63.5mm" y="3.5mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Koda QR</text>
+ <text style="font-family: myriadpro-semibold" x="106.5mm" y="3.5mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">IBAN plačnika</text>
+ <text style="font-family: myriadpro-semibold" x="184.3mm" y="3.5mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Polog</text>
+ <text style="font-family: myriadpro-semibold" x="196.1mm" y="3.5mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Dvig</text>
+ <rect x="63.5mm" y="6.0mm" width="40mm" height="39.5mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" /> <!-- qr polje -->
+ <line x1="63.5mm" y1="7.8mm" x2="64.1mm" y2="7.8mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <line x1="63.5mm" y1="43.7mm" x2="64.1mm" y2="43.7mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <line x1="102.8mm" y1="7.8mm" x2="103.4mm" y2="7.8mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" /> <!-- nenatančno -->
+ <line x1="102.8mm" y1="43.7mm" x2="103.4mm" y2="43.7mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" /> <!-- nenatančno -->
+ <line x1="65.3mm" y1="6.0mm" x2="65.3mm" y2="6.6mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <line x1="101.7mm" y1="6.0mm" x2="101.7mm" y2="6.6mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <line x1="65.3mm" y1="44.9mm" x2="65.3mm" y2="45.5mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <line x1="101.7mm" y1="44.9mm" x2="101.7mm" y2="45.5mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <rect id="rdecaVnosQRKoda" x="65.3mm" y="7.8mm" width="32.59641mm" height="32.59641mm" style="fill:rgba(255,255,255,0);stroke-width:0pt;stroke:rgb(255,103,77)" />
+ <rect x="106.5mm" y="6.0mm" width="71.25mm" height="5mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <svg x="106.5mm" y="6.0mm" width="71.25mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="106.5mm" y="6.0mm" width="71.25mm" height="5mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="20mm" stroke-dasharray="0.25mm,14.75mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="106.5mm" y="9.3mm" width="71.25mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <text id="rdecaVnosIbanPlacnika" style="font-family: courbd" x="106.5mm" y="6.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">SI56 7890 1234 5678 910</text>
+ <rect x="185.2mm" y="6.5mm" width="4mm" height="4mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <rect x="196.5mm" y="6.5mm" width="4mm" height="4mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <line x1="185.2mm" y1="6.5mm" x2="189.2mm" y2="10.5mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <line x1="185.2mm" y1="10.5mm" x2="189.2mm" y2="6.5mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <line x1="196.5mm" y1="6.5mm" x2="200.5mm" y2="10.5mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <line x1="196.5mm" y1="10.5mm" x2="200.5mm" y2="6.5mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <text id="rdecaVnosPolog" style="font-family: courbd" x="196.5mm" y="6.5mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">X</text>
+ <text id="rdecaVnosDvig" style="font-family: courbd" x="185.2mm" y="6.5mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">X</text>
+ <text style="font-family: myriadpro-semibold" x="106.5mm" y="11.5mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Referenca plačnika</text>
+ <rect x="106.5mm" y="14.0mm" width="15mm" height="5mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <svg x="106.5mm" y="14.0mm" width="15mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="106.5mm" y="17.3mm" width="71.25mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <text id="rdecaVnosReferencaPlacnika1" style="font-family: courbd" x="106.5mm" y="14.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">SI56</text>
+ <rect x="123.5mm" y="14.0mm" width="82.5mm" height="5mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <svg x="123.5mm" y="14.0mm" width="82.5mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="123.5mm" y="17.3mm" width="82.5mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <text id="rdecaVnosReferencaPlacnika2" style="font-family: courbd" x="123.5mm" y="14.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">7891011121314</text>
+ <text style="font-family: myriadpro-semibold" x="106.5mm" y="19.5mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Ime, ulica in kraj plačnika</text>
+ <rect x="106.5mm" y="22.0mm" width="99.5mm" height="15mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <text id="rdecaVnosImePlacnika" style="font-family: courbd" x="106.5mm" y="22.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">Anton Luka Šijanec</text>
+ <text id="rdecaVnosUlicaPlacnika" style="font-family: courbd" x="106.5mm" y="27.5mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">Ulica dvajsetega aprila 69</text>
+ <text id="rdecaVnosKrajPlacnika" style="font-family: courbd" x="106.5mm" y="32.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">1337 Elita</text>
+ <line x1="106.5mm" y1="27.5mm" x2="206.0mm" y2="27.0mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <line x1="106.5mm" y1="32.0mm" x2="206.0mm" y2="32.0mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <text style="font-family: myriadpro-semibold" x="106.5mm" y="41.6mm" font-size="11pt" text-anchor="start" fill="rgb(45, 41, 38)">EUR</text>
+ <text style="font-family: myriadpro-semibold" x="114.2mm" y="38.0mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Znesek</text>
+ <text style="font-family: myriadpro-semibold" x="161.2mm" y="38.0mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Datum plačila</text>
+ <text style="font-family: myriadpro-semibold" x="195.3mm" y="38.0mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Nujno</text>
+ <rect x="114.2mm" y="40.5mm" width="41.25mm" height="5mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <svg x="114.2mm" y="40.5mm" width="41.25mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="114.2mm" y="40.5mm" width="41.25mm" height="5mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="20mm" stroke-dasharray="0.25mm,11mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="114.2mm" y="43.8mm" width="41.25mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <text id="rdecaVnosZnesek" style="font-family: courbd" x="114.2mm" y="40.5mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">***14.71</text>
+ <rect x="161.2mm" y="40.5mm" width="30.0mm" height="5mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <svg x="161.2mm" y="40.5mm" width="30.0mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="161.2mm" y="40.5mm" width="20.0mm" height="5mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="20mm" stroke-dasharray="0.25mm,7.25mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="161.2mm" y="43.8mm" width="30.0mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <text id="rdecaVnosDatumPlacila" style="font-family: courbd" x="161.2mm" y="40.5mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">22. 02. 2020</text>
+ <rect x="196.5mm" y="41.0mm" width="4mm" height="4mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <text id="rdecaVnosNujno" style="font-family: courbd" x="196.5mm" y="41.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">X</text>
+ <line x1="196.5mm" y1="41.0mm" x2="200.5mm" y2="45.0mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <line x1="196.5mm" y1="45.0mm" x2="200.5mm" y2="41.0mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <text style="font-family: myriadpro-semibold" x="63.5mm" y="46.5mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Koda namena</text>
+ <text style="font-family: myriadpro-semibold" x="80.5mm" y="46.5mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Namen plačila</text>
+ <text style="font-family: myriadpro-semibold" x="176.2mm" y="46.5mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Rok plačila</text>
+ <rect x="63.5mm" y="49.0mm" width="15mm" height="5mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <svg x="63.5mm" y="49.0mm" width="15mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="63.5mm" y="49.0mm" width="15mm" height="5mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="20mm" stroke-dasharray="0.25mm,14.75mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="63.5mm" y="52.3mm" width="15mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <text id="rdecaVnosKodaNamena" style="font-family: courbd" x="63.5mm" y="49.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">XMPL</text>
+ <rect x="80.5mm" y="49.0mm" width="93.75mm" height="5mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <svg x="80.5mm" y="49.0mm" width="93.75mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="80.5mm" y="52.3mm" width="93.75mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <text id="rdecaVnosNamenPlacila" style="font-family: courbd" x="80.5mm" y="49.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">krneki</text>
+ <rect x="176.2mm" y="49.0mm" width="29.75mm" height="5mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <svg x="176.2mm" y="49.0mm" width="29.75mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="176.2mm" y="49.0mm" width="20.0mm" height="5mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="20mm" stroke-dasharray="0.25mm,7.25mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="176.2mm" y="52.3mm" width="29.75mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <text id="rdecaVnosRokPlacila" style="font-family: courbd" x="176.2mm" y="49.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">23. 02. 2020</text>
+ <rect x="60mm" y="55mm" width="150mm" height="100%" style="fill:rgba(255,255,255,1);stroke-width:0;stroke:rgb(0,0,0)" /> <!-- 100% višina, itak se ne vidi overflowa -->
+ <rect x="60mm" y="55mm" width="150mm" height="100%" style="fill:rgba(255,181,17,0.2);stroke-width:0;stroke:rgb(0,0,0)" /> <!-- 100% višina, itak se ne vidi overflowa -->
+ <text style="font-family: myriadpro-semibold" x="63.5mm" y="55.5mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">IBAN prejemnika</text>
+ <rect x="63.5mm" y="58.0mm" width="127.5mm" height="5mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <svg x="63.5mm" y="58.0mm" width="127.5mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="63.5mm" y="58.0mm" width="127.5mm" height="5mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="20mm" stroke-dasharray="0.25mm,14.75mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="63.5mm" y="61.3mm" width="127.5mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <text id="rumenaVnosIbanPrejemnika" style="font-family: courbd" x="63.5mm" y="58.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">SI56 7890 1234 5678 910</text>
+ <text style="font-family: myriadpro-semibold" x="194.3mm" y="59.1mm" font-size="11pt" text-anchor="start" fill="rgb(45, 41, 38)">UPN QR</text>
+ <text style="font-family: myriadpro-semibold" x="63.5mm" y="63.5mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Referenca prejemnika</text>
+ <rect x="63.5mm" y="66.0mm" width="15mm" height="5mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <svg x="63.5mm" y="66.0mm" width="15mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="63.5mm" y="69.3mm" width="15mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <text id="rumenaVnosReferencaPrejemnika1" style="font-family: courbd" x="63.5mm" y="66.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">SI56</text>
+ <rect x="80.5mm" y="66.0mm" width="82.5mm" height="5mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <svg x="80.5mm" y="66.0mm" width="82.5mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <svg x="80.5mm" y="69.3mm" width="82.5mm" height="1.7mm" >
+ <path stroke="rgb(255,103,77)" stroke-width="4mm" stroke-dasharray="0.25mm,3.50mm" d="M0 0 l1969 0" /> <!-- nenatančno -->
+ </svg>
+ <text id="rumenaVnosReferencaPrejemnika2" style="font-family: courbd" x="80.5mm" y="66.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">7891011121314</text>
+ <rect x="166.0mm" y="66.0mm" width="40mm" height="23mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <text id="rumenaVnosPodpisPlacnikaNeobveznoZig1" style="font-family: courbd" x="166.0mm" y="66.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">/-\ |\| T () |\|</text>
+ <text id="rumenaVnosPodpisPlacnikaNeobveznoZig2" style="font-family: courbd" x="166.0mm" y="70.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">Š | _| /-\ |\| € (</text>
+ <text style="font-family: myriadpro-semibold" x="63.5mm" y="71.5mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Ime, ulica in kraj prejemnika</text>
+ <rect x="63.5mm" y="74.0mm" width="99.5mm" height="15mm" style="fill:rgba(255,255,255,1);stroke-width:0.5pt;stroke:rgb(255,103,77)" />
+ <line x1="63.5mm" y1="79.0mm" x2="163.0mm" y2="79.0mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <line x1="63.5mm" y1="84.0mm" x2="163.0mm" y2="84.0mm" style="stroke:rgb(255,0,0);stroke-width:0.25pt" />
+ <text id="rumenaVnosImePrejemnika" style="font-family: courbd" x="63.5mm" y="74.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">Anton Luka Šijanec</text>
+ <text id="rumenaVnosUlicaPrejemnika" style="font-family: courbd" x="63.5mm" y="79.5mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">Ulica dvajsetega aprila 69</text>
+ <text id="rumenaVnosKrajPrejemnika" style="font-family: courbd" x="63.5mm" y="84.0mm" font-size="9pt" text-anchor="start" fill="rgb(0,0,0)">1337 Elita</text>
+ <line x1="168.6mm" y1="85.3mm" x2="203.3mm" y2="85.3mm" style="stroke:rgb(255,0,0);stroke-width:0.5pt" />
+ <text style="font-family: myriadpro" x="172.0mm" y="86.0mm" font-size="6pt" text-anchor="start" fill="rgb(255,103,77)">Podpis plačnika (neobvezno žig)</text>
+ <rect x="60.0mm" y="89.0mm" width="150mm" height="10mm" style="fill:rgba(0,0,0,0);" />
+ <text style="font-family: myriadpro" x="118.0mm" y="97.0mm" font-size="6pt" text-anchor="start" fill="rgb(255,103,77)">Prostor za vpise ponudnika plačilnih storitev</text>
+ <rect x="191.0mm" y="96.0mm" width="15mm" height="3mm" style="fill:rgba(0,0,0,0);stroke-width:0.25pt;stroke:rgb(255,103,77)" />
+ <text style="font-family: myriadpro-semibold" x="191mm" y="96.0mm" font-size="7pt" text-anchor="start" fill="rgb(255,103,77)">Anton Šijanec</text>
+ <rect x="207.5mm" y="96.5mm" width="1.5mm" height="1.5mm" style="fill:rgba(0,0,0,1);" />
+</svg>