You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

8 lines
29 KiB

var le=Object.defineProperty;var fe=(o,i,r)=>i in o?le(o,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[i]=r;var H=(o,i,r)=>fe(o,typeof i!="symbol"?i+"":i,r);import{B as de,V as he,f as ge,E as me,e as It,G as we,C as Ce,_ as pe,g as ye,h as Bt,j as St,i as Ae,w as Ee,l as Te,x as Nt}from"./index-BLqts8WY.js";import{s as Ie,g as Rt,y as Pt,z as Be,A as Se}from"./index-MyY_xqVN.js";import"./index-CsfPLOYu.js";var k={},$,_t;function Ne(){return _t||(_t=1,$=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),$}var Y={},V={},bt;function q(){if(bt)return V;bt=1;let o;const i=[0,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];return V.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17},V.getSymbolTotalCodewords=function(e){return i[e]},V.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e},V.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');o=e},V.isKanjiModeEnabled=function(){return typeof o<"u"},V.toSJIS=function(e){return o(e)},V}var Q={},Mt;function yt(){return Mt||(Mt=1,function(o){o.L={bit:1},o.M={bit:0},o.Q={bit:3},o.H={bit:2};function i(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return o.L;case"m":case"medium":return o.M;case"q":case"quartile":return o.Q;case"h":case"high":return o.H;default:throw new Error("Unknown EC Level: "+r)}}o.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4},o.from=function(e,t){if(o.isValid(e))return e;try{return i(e)}catch{return t}}}(Q)),Q}var Z,vt;function Re(){if(vt)return Z;vt=1;function o(){this.buffer=[],this.length=0}return o.prototype={get:function(i){const r=Math.floor(i/8);return(this.buffer[r]>>>7-i%8&1)===1},put:function(i,r){for(let e=0;e<r;e++)this.putBit((i>>>r-e-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(i){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),i&&(this.buffer[r]|=128>>>this.length%8),this.length++}},Z=o,Z}var X,Lt;function Pe(){if(Lt)return X;Lt=1;function o(i){if(!i||i<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=i,this.data=new Uint8Array(i*i),this.reservedBit=new Uint8Array(i*i)}return o.prototype.set=function(i,r,e,t){const n=i*this.size+r;this.data[n]=e,t&&(this.reservedBit[n]=!0)},o.prototype.get=function(i,r){return this.data[i*this.size+r]},o.prototype.xor=function(i,r,e){this.data[i*this.size+r]^=e},o.prototype.isReserved=function(i,r){return this.reservedBit[i*this.size+r]},X=o,X}var tt={},Dt;function _e(){return Dt||(Dt=1,function(o){const i=q().getSymbolSize;o.getRowColCoords=function(e){if(e===1)return[];const t=Math.floor(e/7)+2,n=i(e),a=n===145?26:Math.ceil((n-13)/(2*t-2))*2,u=[n-7];for(let s=1;s<t-1;s++)u[s]=u[s-1]-a;return u.push(6),u.reverse()},o.getPositions=function(e){const t=[],n=o.getRowColCoords(e),a=n.length;for(let u=0;u<a;u++)for(let s=0;s<a;s++)u===0&&s===0||u===0&&s===a-1||u===a-1&&s===0||t.push([n[u],n[s]]);return t}}(tt)),tt}var et={},Ht;function be(){if(Ht)return et;Ht=1;const o=q().getSymbolSize,i=7;return et.getPositions=function(e){const t=o(e);return[[0,0],[t-i,0],[0,t-i]]},et}var nt={},Vt;function Me(){return Vt||(Vt=1,function(o){o.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const i={N1:3,N2:3,N3:40,N4:10};o.isValid=function(t){return t!=null&&t!==""&&!isNaN(t)&&t>=0&&t<=7},o.from=function(t){return o.isValid(t)?parseInt(t,10):void 0},o.getPenaltyN1=function(t){const n=t.size;let a=0,u=0,s=0,c=null,f=null;for(let I=0;I<n;I++){u=s=0,c=f=null;for(let g=0;g<n;g++){let l=t.get(I,g);l===c?u++:(u>=5&&(a+=i.N1+(u-5)),c=l,u=1),l=t.get(g,I),l===f?s++:(s>=5&&(a+=i.N1+(s-5)),f=l,s=1)}u>=5&&(a+=i.N1+(u-5)),s>=5&&(a+=i.N1+(s-5))}return a},o.getPenaltyN2=function(t){const n=t.size;let a=0;for(let u=0;u<n-1;u++)for(let s=0;s<n-1;s++){const c=t.get(u,s)+t.get(u,s+1)+t.get(u+1,s)+t.get(u+1,s+1);(c===4||c===0)&&a++}return a*i.N2},o.getPenaltyN3=function(t){const n=t.size;let a=0,u=0,s=0;for(let c=0;c<n;c++){u=s=0;for(let f=0;f<n;f++)u=u<<1&2047|t.get(c,f),f>=10&&(u===1488||u===93)&&a++,s=s<<1&2047|t.get(f,c),f>=10&&(s===1488||s===93)&&a++}return a*i.N3},o.getPenaltyN4=function(t){let n=0;const a=t.data.length;for(let s=0;s<a;s++)n+=t.data[s];return Math.abs(Math.ceil(n*100/a/5)-10)*i.N4};function r(e,t,n){switch(e){case o.Patterns.PATTERN000:return(t+n)%2===0;case o.Patterns.PATTERN001:return t%2===0;case o.Patterns.PATTERN010:return n%3===0;case o.Patterns.PATTERN011:return(t+n)%3===0;case o.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2===0;case o.Patterns.PATTERN101:return t*n%2+t*n%3===0;case o.Patterns.PATTERN110:return(t*n%2+t*n%3)%2===0;case o.Patterns.PATTERN111:return(t*n%3+(t+n)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}}o.applyMask=function(t,n){const a=n.size;for(let u=0;u<a;u++)for(let s=0;s<a;s++)n.isReserved(s,u)||n.xor(s,u,r(t,s,u))},o.getBestMask=function(t,n){const a=Object.keys(o.Patterns).length;let u=0,s=1/0;for(let c=0;c<a;c++){n(c),o.applyMask(c,t);const f=o.getPenaltyN1(t)+o.getPenaltyN2(t)+o.getPenaltyN3(t)+o.getPenaltyN4(t);o.applyMask(c,t),f<s&&(s=f,u=c)}return u}}(nt)),nt}var x={},qt;function re(){if(qt)return x;qt=1;const o=yt(),i=[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],r=[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];return x.getBlocksCount=function(t,n){switch(n){case o.L:return i[(t-1)*4+0];case o.M:return i[(t-1)*4+1];case o.Q:return i[(t-1)*4+2];case o.H:return i[(t-1)*4+3];default:return}},x.getTotalCodewordsCount=function(t,n){switch(n){case o.L:return r[(t-1)*4+0];case o.M:return r[(t-1)*4+1];case o.Q:return r[(t-1)*4+2];case o.H:return r[(t-1)*4+3];default:return}},x}var rt={},G={},Ut;function ve(){if(Ut)return G;Ut=1;const o=new Uint8Array(512),i=new Uint8Array(256);return function(){let e=1;for(let t=0;t<255;t++)o[t]=e,i[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)o[t]=o[t-255]}(),G.log=function(e){if(e<1)throw new Error("log("+e+")");return i[e]},G.exp=function(e){return o[e]},G.mul=function(e,t){return e===0||t===0?0:o[i[e]+i[t]]},G}var Ft;function Le(){return Ft||(Ft=1,function(o){const i=ve();o.mul=function(e,t){const n=new Uint8Array(e.length+t.length-1);for(let a=0;a<e.length;a++)for(let u=0;u<t.length;u++)n[a+u]^=i.mul(e[a],t[u]);return n},o.mod=function(e,t){let n=new Uint8Array(e);for(;n.length-t.length>=0;){const a=n[0];for(let s=0;s<t.length;s++)n[s]^=i.mul(t[s],a);let u=0;for(;u<n.length&&n[u]===0;)u++;n=n.slice(u)}return n},o.generateECPolynomial=function(e){let t=new Uint8Array([1]);for(let n=0;n<e;n++)t=o.mul(t,new Uint8Array([1,i.exp(n)]));return t}}(rt)),rt}var it,kt;function De(){if(kt)return it;kt=1;const o=Le();function i(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}return i.prototype.initialize=function(e){this.degree=e,this.genPoly=o.generateECPolynomial(this.degree)},i.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=o.mod(t,this.genPoly),a=this.degree-n.length;if(a>0){const u=new Uint8Array(this.degree);return u.set(n,a),u}return n},it=i,it}var ot={},st={},at={},zt;function ie(){return zt||(zt=1,at.isValid=function(i){return!isNaN(i)&&i>=1&&i<=40}),at}var M={},Gt;function oe(){if(Gt)return M;Gt=1;const o="[0-9]+",i="[A-Z $%*+\\-./:]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const e="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+`)(?:.|[\r
]))+`;M.KANJI=new RegExp(r,"g"),M.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),M.BYTE=new RegExp(e,"g"),M.NUMERIC=new RegExp(o,"g"),M.ALPHANUMERIC=new RegExp(i,"g");const t=new RegExp("^"+r+"$"),n=new RegExp("^"+o+"$"),a=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return M.testKanji=function(s){return t.test(s)},M.testNumeric=function(s){return n.test(s)},M.testAlphanumeric=function(s){return a.test(s)},M}var jt;function U(){return jt||(jt=1,function(o){const i=ie(),r=oe();o.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},o.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},o.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},o.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},o.MIXED={bit:-1},o.getCharCountIndicator=function(n,a){if(!n.ccBits)throw new Error("Invalid mode: "+n);if(!i.isValid(a))throw new Error("Invalid version: "+a);return a>=1&&a<10?n.ccBits[0]:a<27?n.ccBits[1]:n.ccBits[2]},o.getBestModeForData=function(n){return r.testNumeric(n)?o.NUMERIC:r.testAlphanumeric(n)?o.ALPHANUMERIC:r.testKanji(n)?o.KANJI:o.BYTE},o.toString=function(n){if(n&&n.id)return n.id;throw new Error("Invalid mode")},o.isValid=function(n){return n&&n.bit&&n.ccBits};function e(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return o.NUMERIC;case"alphanumeric":return o.ALPHANUMERIC;case"kanji":return o.KANJI;case"byte":return o.BYTE;default:throw new Error("Unknown mode: "+t)}}o.from=function(n,a){if(o.isValid(n))return n;try{return e(n)}catch{return a}}}(st)),st}var xt;function He(){return xt||(xt=1,function(o){const i=q(),r=re(),e=yt(),t=U(),n=ie(),a=7973,u=i.getBCHDigit(a);function s(g,l,N){for(let R=1;R<=40;R++)if(l<=o.getCapacity(R,N,g))return R}function c(g,l){return t.getCharCountIndicator(g,l)+4}function f(g,l){let N=0;return g.forEach(function(R){const _=c(R.mode,l);N+=_+R.getBitsLength()}),N}function I(g,l){for(let N=1;N<=40;N++)if(f(g,N)<=o.getCapacity(N,l,t.MIXED))return N}o.from=function(l,N){return n.isValid(l)?parseInt(l,10):N},o.getCapacity=function(l,N,R){if(!n.isValid(l))throw new Error("Invalid QR Code version");typeof R>"u"&&(R=t.BYTE);const _=i.getSymbolTotalCodewords(l),d=r.getTotalCodewordsCount(l,N),S=(_-d)*8;if(R===t.MIXED)return S;const A=S-c(R,l);switch(R){case t.NUMERIC:return Math.floor(A/10*3);case t.ALPHANUMERIC:return Math.floor(A/11*2);case t.KANJI:return Math.floor(A/13);case t.BYTE:default:return Math.floor(A/8)}},o.getBestVersionForData=function(l,N){let R;const _=e.from(N,e.M);if(Array.isArray(l)){if(l.length>1)return I(l,_);if(l.length===0)return 1;R=l[0]}else R=l;return s(R.mode,R.getLength(),_)},o.getEncodedBits=function(l){if(!n.isValid(l)||l<7)throw new Error("Invalid QR Code version");let N=l<<12;for(;i.getBCHDigit(N)-u>=0;)N^=a<<i.getBCHDigit(N)-u;return l<<12|N}}(ot)),ot}var ut={},Kt;function Ve(){if(Kt)return ut;Kt=1;const o=q(),i=1335,r=21522,e=o.getBCHDigit(i);return ut.getEncodedBits=function(n,a){const u=n.bit<<3|a;let s=u<<10;for(;o.getBCHDigit(s)-e>=0;)s^=i<<o.getBCHDigit(s)-e;return(u<<10|s)^r},ut}var ct={},lt,Ot;function qe(){if(Ot)return lt;Ot=1;const o=U();function i(r){this.mode=o.NUMERIC,this.data=r.toString()}return i.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t,n,a;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),a=parseInt(n,10),e.put(a,10);const u=this.data.length-t;u>0&&(n=this.data.substr(t),a=parseInt(n,10),e.put(a,u*3+1))},lt=i,lt}var ft,Jt;function Ue(){if(Jt)return ft;Jt=1;const o=U(),i=["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 r(e){this.mode=o.ALPHANUMERIC,this.data=e}return r.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(t){let n;for(n=0;n+2<=this.data.length;n+=2){let a=i.indexOf(this.data[n])*45;a+=i.indexOf(this.data[n+1]),t.put(a,11)}this.data.length%2&&t.put(i.indexOf(this.data[n]),6)},ft=r,ft}var dt,Wt;function Fe(){if(Wt)return dt;Wt=1;const o=U();function i(r){this.mode=o.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}return i.getBitsLength=function(e){return e*8},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(r){for(let e=0,t=this.data.length;e<t;e++)r.put(this.data[e],8)},dt=i,dt}var ht,$t;function ke(){if($t)return ht;$t=1;const o=U(),i=q();function r(e){this.mode=o.KANJI,this.data=e}return r.getBitsLength=function(t){return t*13},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=i.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},ht=r,ht}var gt={exports:{}},Yt;function ze(){return Yt||(Yt=1,function(o){var i={single_source_shortest_paths:function(r,e,t){var n={},a={};a[e]=0;var u=i.PriorityQueue.make();u.push(e,0);for(var s,c,f,I,g,l,N,R,_;!u.empty();){s=u.pop(),c=s.value,I=s.cost,g=r[c]||{};for(f in g)g.hasOwnProperty(f)&&(l=g[f],N=I+l,R=a[f],_=typeof a[f]>"u",(_||R>N)&&(a[f]=N,u.push(f,N),n[f]=c))}if(typeof t<"u"&&typeof a[t]>"u"){var d=["Could not find a path from ",e," to ",t,"."].join("");throw new Error(d)}return n},extract_shortest_path_from_predecessor_list:function(r,e){for(var t=[],n=e;n;)t.push(n),r[n],n=r[n];return t.reverse(),t},find_path:function(r,e,t){var n=i.single_source_shortest_paths(r,e,t);return i.extract_shortest_path_from_predecessor_list(n,t)},PriorityQueue:{make:function(r){var e=i.PriorityQueue,t={},n;r=r||{};for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t.queue=[],t.sorter=r.sorter||e.default_sorter,t},default_sorter:function(r,e){return r.cost-e.cost},push:function(r,e){var t={value:r,cost:e};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};o.exports=i}(gt)),gt.exports}var Qt;function Ge(){return Qt||(Qt=1,function(o){const i=U(),r=qe(),e=Ue(),t=Fe(),n=ke(),a=oe(),u=q(),s=ze();function c(d){return unescape(encodeURIComponent(d)).length}function f(d,S,A){const w=[];let b;for(;(b=d.exec(A))!==null;)w.push({data:b[0],index:b.index,mode:S,length:b[0].length});return w}function I(d){const S=f(a.NUMERIC,i.NUMERIC,d),A=f(a.ALPHANUMERIC,i.ALPHANUMERIC,d);let w,b;return u.isKanjiModeEnabled()?(w=f(a.BYTE,i.BYTE,d),b=f(a.KANJI,i.KANJI,d)):(w=f(a.BYTE_KANJI,i.BYTE,d),b=[]),S.concat(A,w,b).sort(function(E,y){return E.index-y.index}).map(function(E){return{data:E.data,mode:E.mode,length:E.length}})}function g(d,S){switch(S){case i.NUMERIC:return r.getBitsLength(d);case i.ALPHANUMERIC:return e.getBitsLength(d);case i.KANJI:return n.getBitsLength(d);case i.BYTE:return t.getBitsLength(d)}}function l(d){return d.reduce(function(S,A){const w=S.length-1>=0?S[S.length-1]:null;return w&&w.mode===A.mode?(S[S.length-1].data+=A.data,S):(S.push(A),S)},[])}function N(d){const S=[];for(let A=0;A<d.length;A++){const w=d[A];switch(w.mode){case i.NUMERIC:S.push([w,{data:w.data,mode:i.ALPHANUMERIC,length:w.length},{data:w.data,mode:i.BYTE,length:w.length}]);break;case i.ALPHANUMERIC:S.push([w,{data:w.data,mode:i.BYTE,length:w.length}]);break;case i.KANJI:S.push([w,{data:w.data,mode:i.BYTE,length:c(w.data)}]);break;case i.BYTE:S.push([{data:w.data,mode:i.BYTE,length:c(w.data)}])}}return S}function R(d,S){const A={},w={start:{}};let b=["start"];for(let m=0;m<d.length;m++){const E=d[m],y=[];for(let h=0;h<E.length;h++){const B=E[h],C=""+m+h;y.push(C),A[C]={node:B,lastCount:0},w[C]={};for(let T=0;T<b.length;T++){const p=b[T];A[p]&&A[p].node.mode===B.mode?(w[p][C]=g(A[p].lastCount+B.length,B.mode)-g(A[p].lastCount,B.mode),A[p].lastCount+=B.length):(A[p]&&(A[p].lastCount=B.length),w[p][C]=g(B.length,B.mode)+4+i.getCharCountIndicator(B.mode,S))}}b=y}for(let m=0;m<b.length;m++)w[b[m]].end=0;return{map:w,table:A}}function _(d,S){let A;const w=i.getBestModeForData(d);if(A=i.from(S,w),A!==i.BYTE&&A.bit<w.bit)throw new Error('"'+d+'" cannot be encoded with mode '+i.toString(A)+`.
Suggested mode is: `+i.toString(w));switch(A===i.KANJI&&!u.isKanjiModeEnabled()&&(A=i.BYTE),A){case i.NUMERIC:return new r(d);case i.ALPHANUMERIC:return new e(d);case i.KANJI:return new n(d);case i.BYTE:return new t(d)}}o.fromArray=function(S){return S.reduce(function(A,w){return typeof w=="string"?A.push(_(w,null)):w.data&&A.push(_(w.data,w.mode)),A},[])},o.fromString=function(S,A){const w=I(S,u.isKanjiModeEnabled()),b=N(w),m=R(b,A),E=s.find_path(m.map,"start","end"),y=[];for(let h=1;h<E.length-1;h++)y.push(m.table[E[h]].node);return o.fromArray(l(y))},o.rawSplit=function(S){return o.fromArray(I(S,u.isKanjiModeEnabled()))}}(ct)),ct}var Zt;function je(){if(Zt)return Y;Zt=1;const o=q(),i=yt(),r=Re(),e=Pe(),t=_e(),n=be(),a=Me(),u=re(),s=De(),c=He(),f=Ve(),I=U(),g=Ge();function l(m,E){const y=m.size,h=n.getPositions(E);for(let B=0;B<h.length;B++){const C=h[B][0],T=h[B][1];for(let p=-1;p<=7;p++)if(!(C+p<=-1||y<=C+p))for(let P=-1;P<=7;P++)T+P<=-1||y<=T+P||(p>=0&&p<=6&&(P===0||P===6)||P>=0&&P<=6&&(p===0||p===6)||p>=2&&p<=4&&P>=2&&P<=4?m.set(C+p,T+P,!0,!0):m.set(C+p,T+P,!1,!0))}}function N(m){const E=m.size;for(let y=8;y<E-8;y++){const h=y%2===0;m.set(y,6,h,!0),m.set(6,y,h,!0)}}function R(m,E){const y=t.getPositions(E);for(let h=0;h<y.length;h++){const B=y[h][0],C=y[h][1];for(let T=-2;T<=2;T++)for(let p=-2;p<=2;p++)T===-2||T===2||p===-2||p===2||T===0&&p===0?m.set(B+T,C+p,!0,!0):m.set(B+T,C+p,!1,!0)}}function _(m,E){const y=m.size,h=c.getEncodedBits(E);let B,C,T;for(let p=0;p<18;p++)B=Math.floor(p/3),C=p%3+y-8-3,T=(h>>p&1)===1,m.set(B,C,T,!0),m.set(C,B,T,!0)}function d(m,E,y){const h=m.size,B=f.getEncodedBits(E,y);let C,T;for(C=0;C<15;C++)T=(B>>C&1)===1,C<6?m.set(C,8,T,!0):C<8?m.set(C+1,8,T,!0):m.set(h-15+C,8,T,!0),C<8?m.set(8,h-C-1,T,!0):C<9?m.set(8,15-C-1+1,T,!0):m.set(8,15-C-1,T,!0);m.set(h-8,8,1,!0)}function S(m,E){const y=m.size;let h=-1,B=y-1,C=7,T=0;for(let p=y-1;p>0;p-=2)for(p===6&&p--;;){for(let P=0;P<2;P++)if(!m.isReserved(B,p-P)){let D=!1;T<E.length&&(D=(E[T]>>>C&1)===1),m.set(B,p-P,D),C--,C===-1&&(T++,C=7)}if(B+=h,B<0||y<=B){B-=h,h=-h;break}}}function A(m,E,y){const h=new r;y.forEach(function(P){h.put(P.mode.bit,4),h.put(P.getLength(),I.getCharCountIndicator(P.mode,m)),P.write(h)});const B=o.getSymbolTotalCodewords(m),C=u.getTotalCodewordsCount(m,E),T=(B-C)*8;for(h.getLengthInBits()+4<=T&&h.put(0,4);h.getLengthInBits()%8!==0;)h.putBit(0);const p=(T-h.getLengthInBits())/8;for(let P=0;P<p;P++)h.put(P%2?17:236,8);return w(h,m,E)}function w(m,E,y){const h=o.getSymbolTotalCodewords(E),B=u.getTotalCodewordsCount(E,y),C=h-B,T=u.getBlocksCount(E,y),p=h%T,P=T-p,D=Math.floor(h/T),z=Math.floor(C/T),ae=z+1,At=D-z,ue=new s(At);let K=0;const j=new Array(T),Et=new Array(T);let O=0;const ce=new Uint8Array(m.buffer);for(let F=0;F<T;F++){const W=F<P?z:ae;j[F]=ce.slice(K,K+W),Et[F]=ue.encode(j[F]),K+=W,O=Math.max(O,W)}const J=new Uint8Array(h);let Tt=0,v,L;for(v=0;v<O;v++)for(L=0;L<T;L++)v<j[L].length&&(J[Tt++]=j[L][v]);for(v=0;v<At;v++)for(L=0;L<T;L++)J[Tt++]=Et[L][v];return J}function b(m,E,y,h){let B;if(Array.isArray(m))B=g.fromArray(m);else if(typeof m=="string"){let D=E;if(!D){const z=g.rawSplit(m);D=c.getBestVersionForData(z,y)}B=g.fromString(m,D||40)}else throw new Error("Invalid data");const C=c.getBestVersionForData(B,y);if(!C)throw new Error("The amount of data is too big to be stored in a QR Code");if(!E)E=C;else if(E<C)throw new Error(`
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: `+C+`.
`);const T=A(E,y,B),p=o.getSymbolSize(E),P=new e(p);return l(P,E),N(P),R(P,E),d(P,y,0),E>=7&&_(P,E),S(P,T),isNaN(h)&&(h=a.getBestMask(P,d.bind(null,P,y))),a.applyMask(h,P),d(P,y,h),{modules:P,version:E,errorCorrectionLevel:y,maskPattern:h,segments:B}}return Y.create=function(E,y){if(typeof E>"u"||E==="")throw new Error("No input text");let h=i.M,B,C;return typeof y<"u"&&(h=i.from(y.errorCorrectionLevel,i.M),B=c.from(y.version),C=a.from(y.maskPattern),y.toSJISFunc&&o.setToSJISFunction(y.toSJISFunc)),b(E,B,h,C)},Y}var mt={},wt={},Xt;function se(){return Xt||(Xt=1,function(o){function i(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let e=r.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+r);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");const t=parseInt(e.join(""),16);return{r:t>>24&255,g:t>>16&255,b:t>>8&255,a:t&255,hex:"#"+e.slice(0,6).join("")}}o.getOptions=function(e){e||(e={}),e.color||(e.color={});const t=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,a=e.scale||4;return{width:n,scale:n?4:a,margin:t,color:{dark:i(e.color.dark||"#000000ff"),light:i(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},o.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},o.getImageWidth=function(e,t){const n=o.getScale(e,t);return Math.floor((e+t.margin*2)*n)},o.qrToImageData=function(e,t,n){const a=t.modules.size,u=t.modules.data,s=o.getScale(a,n),c=Math.floor((a+n.margin*2)*s),f=n.margin*s,I=[n.color.light,n.color.dark];for(let g=0;g<c;g++)for(let l=0;l<c;l++){let N=(g*c+l)*4,R=n.color.light;if(g>=f&&l>=f&&g<c-f&&l<c-f){const _=Math.floor((g-f)/s),d=Math.floor((l-f)/s);R=I[u[_*a+d]?1:0]}e[N++]=R.r,e[N++]=R.g,e[N++]=R.b,e[N]=R.a}}}(wt)),wt}var te;function xe(){return te||(te=1,function(o){const i=se();function r(t,n,a){t.clearRect(0,0,n.width,n.height),n.style||(n.style={}),n.height=a,n.width=a,n.style.height=a+"px",n.style.width=a+"px"}function e(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}o.render=function(n,a,u){let s=u,c=a;typeof s>"u"&&(!a||!a.getContext)&&(s=a,a=void 0),a||(c=e()),s=i.getOptions(s);const f=i.getImageWidth(n.modules.size,s),I=c.getContext("2d"),g=I.createImageData(f,f);return i.qrToImageData(g.data,n,s),r(I,c,f),I.putImageData(g,0,0),c},o.renderToDataURL=function(n,a,u){let s=u;typeof s>"u"&&(!a||!a.getContext)&&(s=a,a=void 0),s||(s={});const c=o.render(n,a,s),f=s.type||"image/png",I=s.rendererOpts||{};return c.toDataURL(f,I.quality)}}(mt)),mt}var Ct={},ee;function Ke(){if(ee)return Ct;ee=1;const o=se();function i(t,n){const a=t.a/255,u=n+'="'+t.hex+'"';return a<1?u+" "+n+'-opacity="'+a.toFixed(2).slice(1)+'"':u}function r(t,n,a){let u=t+n;return typeof a<"u"&&(u+=" "+a),u}function e(t,n,a){let u="",s=0,c=!1,f=0;for(let I=0;I<t.length;I++){const g=Math.floor(I%n),l=Math.floor(I/n);!g&&!c&&(c=!0),t[I]?(f++,I>0&&g>0&&t[I-1]||(u+=c?r("M",g+a,.5+l+a):r("m",s,0),s=0,c=!1),g+1<n&&t[I+1]||(u+=r("h",f),f=0)):s++}return u}return Ct.render=function(n,a,u){const s=o.getOptions(a),c=n.modules.size,f=n.modules.data,I=c+s.margin*2,g=s.color.light.a?"<path "+i(s.color.light,"fill")+' d="M0 0h'+I+"v"+I+'H0z"/>':"",l="<path "+i(s.color.dark,"stroke")+' d="'+e(f,c,s.margin)+'"/>',N='viewBox="0 0 '+I+" "+I+'"',_='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+N+' shape-rendering="crispEdges">'+g+l+`</svg>
`;return typeof u=="function"&&u(null,_),_},Ct}var ne;function Oe(){if(ne)return k;ne=1;const o=Ne(),i=je(),r=xe(),e=Ke();function t(n,a,u,s,c){const f=[].slice.call(arguments,1),I=f.length,g=typeof f[I-1]=="function";if(!g&&!o())throw new Error("Callback required as last argument");if(g){if(I<2)throw new Error("Too few arguments provided");I===2?(c=u,u=a,a=s=void 0):I===3&&(a.getContext&&typeof c>"u"?(c=s,s=void 0):(c=s,s=u,u=a,a=void 0))}else{if(I<1)throw new Error("Too few arguments provided");return I===1?(u=a,a=s=void 0):I===2&&!a.getContext&&(s=u,u=a,a=void 0),new Promise(function(l,N){try{const R=i.create(u,s);l(n(R,a,s))}catch(R){N(R)}})}try{const l=i.create(u,s);c(null,n(l,a,s))}catch(l){c(l)}}return k.create=i.create,k.toCanvas=t.bind(null,r.render),k.toDataURL=t.bind(null,r.renderToDataURL),k.toString=t.bind(null,function(n,a,u){return e.render(n,u)}),k}var Je=Oe();const We=de(Je);var $e=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Qe=(o,i,r,e)=>{for(var t=e>1?void 0:e?Ye(i,r):i,n=o.length-1,a;n>=0;n--)(a=o[n])&&(t=(e?a(i,r,t):a(t))||t);return e&&t&&$e(i,r,t),t};let pt=class extends he{constructor(){super(...arguments);H(this,"$notify");H(this,"activeDid","");H(this,"allMyDids",[]);H(this,"apiServer","");H(this,"claimId","");H(this,"claimData",null);H(this,"serverUtil",Ie)}async created(){const r=await ge();this.activeDid=r.activeDid||"",this.apiServer=r.apiServer||"";const e=window.location.pathname.substring(12);this.claimId=e,await this.fetchClaim()}async fetchClaim(){try{const r=await Rt(this.activeDid),e=await this.axios.get(`${this.apiServer}/api/claim/${this.claimId}`,{headers:r});if(e.status===200){this.claimData=await e.data;const t=[this.claimId],n=await Rt(this.activeDid),a=await this.axios.post(`${this.apiServer}/api/v2/report/confirmers/?claimEntryIds=${this.claimId}`,{claimEntryIds:t},{headers:n});let u=[];a.status===200&&(u=await a.data.data),await me(),this.claimData&&this.drawCanvas(this.claimData,u)}else throw new Error(`Error fetching claim: ${e.statusText}`)}catch(r){console.error("Failed to load claim:",r),this.$notify({group:"alert",type:"danger",title:"Error",text:"There was a problem loading the claim."})}}async drawCanvas(r,e){await It.open();const t=await It.contacts.toArray(),n=this.$refs.claimCanvas;if(n){n.width=1100,n.height=850;const s=n.getContext("2d");if(s){const c=new Image;c.src="/img/background/cert-frame-2.jpg",c.onload=async()=>{var N,R,_;s.drawImage(c,0,0,1100,850),s.fillStyle="black",s.font="bold 20px Arial";const f=r.claimType==="GiveAction"?"Gift":r.claimType==="PlanAction"?"Project":this.serverUtil.capitalizeAndInsertSpacesBeforeCaps(r.claimType||""),I=s.measureText(f).width;if(s.fillText(f,(1100-I)/2,850*.33),r.claimType==="GiveAction"&&r.claim.agent){const d="Thanks To ";s.font="14px Arial";const S=s.measureText(d).width;s.fillText(d,(1100-S)/2,850*.37);const A=r.claim.agent.identifier||r.claim.agent,w=Pt(A,t);s.font="bold 20px Arial";const b=s.measureText(w).width;s.fillText(w,(1100-b)/2,850*.41)}const g=r.claim.name||r.claim.description;if(g){const d=g.length>50?g.substring(0,75)+"...":g;s.font="14px Arial";const S=s.measureText(d).width;s.fillText(d,(1100-S)/2,850*.495)}if((N=r.claim.object)!=null&&N.amountOfThisGood&&((R=r.claim.object)!=null&&R.unitCode)){const d=r.claim.object.amountOfThisGood,S=r.claim.object.unitCode,A=Se(S,d),w=s.measureText(A).width,b=g?850*.525:850*.495;s.font="14px Arial",s.fillText(A,(1100-w)/2,b)}if(console.log("claimData.issuer",r.issuer),r.issuer==null||Be(r.issuer)||r.issuer!==((_=r.claim.agent)==null?void 0:_.identifier)){s.font="14px Arial";let d=Pt(r.issuer,t);d.length>30&&(d=d.substring(0,30)+"...");const S="Issued by "+d;s.fillText(S,1100*.3,850*.6)}if(e.length>0){const d="Confirmed by "+e.length+(e.length===1?" person":" people");s.font="14px Arial",s.fillText(d,1100*.3,850*.63)}s.font="14px Arial",s.fillText(this.claimId,1100*.3,850*.7),s.fillText("via EndorserSearch.com",1100*.3,850*.73);const l=document.createElement("canvas");await We.toCanvas(l,we+"/claim/"+this.claimId,{width:150,color:{light:"#0000"}}),s.drawImage(l,1100*.6,850*.55)}}}}};pt=Qe([Ce],pt);const Ze={id:"Content"},Xe={class:"flex items-center justify-center h-screen"},tn={key:0},en={class:"w-full block mx-auto",ref:"claimCanvas"};function nn(o,i,r,e,t,n){const a=ye("router-link");return Nt(),Bt("section",Ze,[St("div",Xe,[o.claimData?(Nt(),Bt("div",tn,[Ae(a,{to:"/claim/"+this.claimId},{default:Ee(()=>[St("canvas",en,null,512)]),_:1},8,["to"])])):Te("",!0)])])}const cn=pe(pt,[["render",nn]]);export{cn as default};