mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-03-28 08:10:44 +00:00
2 lines
24 KiB
JavaScript
2 lines
24 KiB
JavaScript
System.register(["./src-legacy-BZrNK1xm.js","./use-app-legacy-BeVA4PKu.js"],function(t,e){var n,r,o,i,a,s,u,c,l,f,h,d,g,p,m,w,E,y,v,C,A,B,I,M,T,N,P,b,R,L,x,U,S,k,D,F,z,H,_,J,K,Y;return{setters:[function(t){n=t.C,r=t.D,o=t.G,i=t.N,a=t.dt,s=t.k,u=t.lt,c=t.n,l=t.z},function(t){f=t.r,h=t.t}],execute:function(){d=u((t,e)=>{e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}}),g=u(t=>{var e,n=[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];t.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},t.getSymbolTotalCodewords=function(t){return n[t]},t.getBCHDigit=function(t){let e=0;for(;0!==t;)e++,t>>>=1;return e},t.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');e=t},t.isKanjiModeEnabled=function(){return void 0!==e},t.toSJIS=function(t){return e(t)}}),p=u(t=>{t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(r){return n}}}),m=u((t,e)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(t){const e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(let n=0;n<e;n++)this.putBit(1==(t>>>e-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},e.exports=n}),w=u((t,e)=>{function n(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}n.prototype.set=function(t,e,n,r){const o=t*this.size+e;this.data[o]=n,r&&(this.reservedBit[o]=!0)},n.prototype.get=function(t,e){return this.data[t*this.size+e]},n.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n},n.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]},e.exports=n}),E=u(t=>{var e=g().getSymbolSize;t.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,r=e(t),o=145===r?26:2*Math.ceil((r-13)/(2*n-2)),i=[r-7];for(let e=1;e<n-1;e++)i[e]=i[e-1]-o;return i.push(6),i.reverse()},t.getPositions=function(e){const n=[],r=t.getRowColCoords(e),o=r.length;for(let t=0;t<o;t++)for(let e=0;e<o;e++)0===t&&0===e||0===t&&e===o-1||t===o-1&&0===e||n.push([r[t],r[e]]);return n}}),y=u(t=>{var e=g().getSymbolSize;t.getPositions=function(t){const n=e(t);return[[0,0],[n-7,0],[0,n-7]]}}),v=u(t=>{t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var e=3,n=3,r=40,o=10;function i(e,n,r){switch(e){case t.Patterns.PATTERN000:return(n+r)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return r%3==0;case t.Patterns.PATTERN011:return(n+r)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case t.Patterns.PATTERN101:return n*r%2+n*r%3==0;case t.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case t.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(t){const n=t.size;let r=0,o=0,i=0,a=null,s=null;for(let u=0;u<n;u++){o=i=0,a=s=null;for(let c=0;c<n;c++){let n=t.get(u,c);n===a?o++:(o>=5&&(r+=e+(o-5)),a=n,o=1),n=t.get(c,u),n===s?i++:(i>=5&&(r+=e+(i-5)),s=n,i=1)}o>=5&&(r+=e+(o-5)),i>=5&&(r+=e+(i-5))}return r},t.getPenaltyN2=function(t){const e=t.size;let r=0;for(let n=0;n<e-1;n++)for(let o=0;o<e-1;o++){const e=t.get(n,o)+t.get(n,o+1)+t.get(n+1,o)+t.get(n+1,o+1);4!==e&&0!==e||r++}return r*n},t.getPenaltyN3=function(t){const e=t.size;let n=0,o=0,i=0;for(let r=0;r<e;r++){o=i=0;for(let a=0;a<e;a++)o=o<<1&2047|t.get(r,a),a>=10&&(1488===o||93===o)&&n++,i=i<<1&2047|t.get(a,r),a>=10&&(1488===i||93===i)&&n++}return n*r},t.getPenaltyN4=function(t){let e=0;const n=t.data.length;for(let r=0;r<n;r++)e+=t.data[r];return Math.abs(Math.ceil(100*e/n/5)-10)*o},t.applyMask=function(t,e){const n=e.size;for(let r=0;r<n;r++)for(let o=0;o<n;o++)e.isReserved(o,r)||e.xor(o,r,i(t,o,r))},t.getBestMask=function(e,n){const r=Object.keys(t.Patterns).length;let o=0,i=1/0;for(let a=0;a<r;a++){n(a),t.applyMask(a,e);const r=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(a,e),r<i&&(i=r,o=a)}return o}}),C=u(t=>{var e=p(),n=[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];t.getBlocksCount=function(t,r){switch(r){case e.L:return n[4*(t-1)+0];case e.M:return n[4*(t-1)+1];case e.Q:return n[4*(t-1)+2];case e.H:return n[4*(t-1)+3];default:return}},t.getTotalCodewordsCount=function(t,n){switch(n){case e.L:return r[4*(t-1)+0];case e.M:return r[4*(t-1)+1];case e.Q:return r[4*(t-1)+2];case e.H:return r[4*(t-1)+3];default:return}}}),A=u(t=>{var e=new Uint8Array(512),n=new Uint8Array(256);!function(){let t=1;for(let r=0;r<255;r++)e[r]=t,n[t]=r,t<<=1,256&t&&(t^=285);for(let n=255;n<512;n++)e[n]=e[n-255]}(),t.log=function(t){if(t<1)throw new Error("log("+t+")");return n[t]},t.exp=function(t){return e[t]},t.mul=function(t,r){return 0===t||0===r?0:e[n[t]+n[r]]}}),B=u(t=>{var e=A();t.mul=function(t,n){const r=new Uint8Array(t.length+n.length-1);for(let o=0;o<t.length;o++)for(let i=0;i<n.length;i++)r[o+i]^=e.mul(t[o],n[i]);return r},t.mod=function(t,n){let r=new Uint8Array(t);for(;r.length-n.length>=0;){const t=r[0];for(let i=0;i<n.length;i++)r[i]^=e.mul(n[i],t);let o=0;for(;o<r.length&&0===r[o];)o++;r=r.slice(o)}return r},t.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let o=0;o<n;o++)r=t.mul(r,new Uint8Array([1,e.exp(o)]));return r}}),I=u((t,e)=>{var n=B();function r(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(t){this.degree=t,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(t.length+this.degree);e.set(t);const r=n.mod(e,this.genPoly),o=this.degree-r.length;if(o>0){const t=new Uint8Array(this.degree);return t.set(r,o),t}return r},e.exports=r}),M=u(t=>{t.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}}),T=u(t=>{var e="[0-9]+",n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",r="(?:(?![A-Z0-9 $%*+\\-./:]|"+(n=n.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";t.KANJI=new RegExp(n,"g"),t.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=new RegExp(r,"g"),t.NUMERIC=new RegExp(e,"g"),t.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");var o=new RegExp("^"+n+"$"),i=new RegExp("^"+e+"$"),a=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(t){return o.test(t)},t.testNumeric=function(t){return i.test(t)},t.testAlphanumeric=function(t){return a.test(t)}}),N=u(t=>{var e=M(),n=T();t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(t,n){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!e.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?t.ccBits[0]:n<27?t.ccBits[1]:t.ccBits[2]},t.getBestModeForData=function(e){return n.testNumeric(e)?t.NUMERIC:n.testAlphanumeric(e)?t.ALPHANUMERIC:n.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},t.isValid=function(t){return t&&t.bit&&t.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(r){return n}}}),P=u(t=>{var e=g(),n=C(),r=p(),o=N(),i=M(),a=e.getBCHDigit(7973);function s(t,e){return o.getCharCountIndicator(t,e)+4}function u(t,e){let n=0;return t.forEach(function(t){const r=s(t.mode,e);n+=r+t.getBitsLength()}),n}t.from=function(t,e){return i.isValid(t)?parseInt(t,10):e},t.getCapacity=function(t,r,a){if(!i.isValid(t))throw new Error("Invalid QR Code version");void 0===a&&(a=o.BYTE);const u=8*(e.getSymbolTotalCodewords(t)-n.getTotalCodewordsCount(t,r));if(a===o.MIXED)return u;const c=u-s(a,t);switch(a){case o.NUMERIC:return Math.floor(c/10*3);case o.ALPHANUMERIC:return Math.floor(c/11*2);case o.KANJI:return Math.floor(c/13);case o.BYTE:default:return Math.floor(c/8)}},t.getBestVersionForData=function(e,n){let i;const a=r.from(n,r.M);if(Array.isArray(e)){if(e.length>1)return function(e,n){for(let r=1;r<=40;r++)if(u(e,r)<=t.getCapacity(r,n,o.MIXED))return r}(e,a);if(0===e.length)return 1;i=e[0]}else i=e;return function(e,n,r){for(let o=1;o<=40;o++)if(n<=t.getCapacity(o,r,e))return o}(i.mode,i.getLength(),a)},t.getEncodedBits=function(t){if(!i.isValid(t)||t<7)throw new Error("Invalid QR Code version");let n=t<<12;for(;e.getBCHDigit(n)-a>=0;)n^=7973<<e.getBCHDigit(n)-a;return t<<12|n}}),b=u(t=>{var e=g(),n=e.getBCHDigit(1335);t.getEncodedBits=function(t,r){const o=t.bit<<3|r;let i=o<<10;for(;e.getBCHDigit(i)-n>=0;)i^=1335<<e.getBCHDigit(i)-n;return 21522^(o<<10|i)}}),R=u((t,e)=>{var n=N();function r(t){this.mode=n.NUMERIC,this.data=t.toString()}r.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(t){let e,n,r;for(e=0;e+3<=this.data.length;e+=3)n=this.data.substr(e,3),r=parseInt(n,10),t.put(r,10);const o=this.data.length-e;o>0&&(n=this.data.substr(e),r=parseInt(n,10),t.put(r,3*o+1))},e.exports=r}),L=u((t,e)=>{var n=N(),r=["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 o(t){this.mode=n.ALPHANUMERIC,this.data=t}o.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let n=45*r.indexOf(this.data[e]);n+=r.indexOf(this.data[e+1]),t.put(n,11)}this.data.length%2&&t.put(r.indexOf(this.data[e]),6)},e.exports=o}),x=u((t,e)=>{var n=N();function r(t){this.mode=n.BYTE,this.data="string"==typeof t?(new TextEncoder).encode(t):new Uint8Array(t)}r.getBitsLength=function(t){return 8*t},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data[e],8)},e.exports=r}),U=u((t,e)=>{var n=N(),r=g();function o(t){this.mode=n.KANJI,this.data=t}o.getBitsLength=function(t){return 13*t},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let n=r.toSJIS(this.data[e]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),t.put(n,13)}},e.exports=o}),S=u((t,e)=>{var n={single_source_shortest_paths:function(t,e,r){var o={},i={};i[e]=0;var a,s,u,c,l,f,h,d=n.PriorityQueue.make();for(d.push(e,0);!d.empty();)for(u in s=(a=d.pop()).value,c=a.cost,l=t[s]||{})l.hasOwnProperty(u)&&(f=c+l[u],h=i[u],(void 0===i[u]||h>f)&&(i[u]=f,d.push(u,f),o[u]=s));if(void 0!==r&&void 0===i[r]){var g=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(g)}return o},extract_shortest_path_from_predecessor_list:function(t,e){for(var n=[],r=e;r;)n.push(r),t[r],r=t[r];return n.reverse(),n},find_path:function(t,e,r){var o=n.single_source_shortest_paths(t,e,r);return n.extract_shortest_path_from_predecessor_list(o,r)},PriorityQueue:{make:function(t){var e,r=n.PriorityQueue,o={};for(e in t=t||{},r)r.hasOwnProperty(e)&&(o[e]=r[e]);return o.queue=[],o.sorter=t.sorter||r.default_sorter,o},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==e&&(e.exports=n)}),k=u(t=>{var e=N(),n=R(),r=L(),o=x(),i=U(),a=T(),s=g(),u=S();function c(t){return unescape(encodeURIComponent(t)).length}function l(t,e,n){const r=[];let o;for(;null!==(o=t.exec(n));)r.push({data:o[0],index:o.index,mode:e,length:o[0].length});return r}function f(t){const n=l(a.NUMERIC,e.NUMERIC,t),r=l(a.ALPHANUMERIC,e.ALPHANUMERIC,t);let o,i;return s.isKanjiModeEnabled()?(o=l(a.BYTE,e.BYTE,t),i=l(a.KANJI,e.KANJI,t)):(o=l(a.BYTE_KANJI,e.BYTE,t),i=[]),n.concat(r,o,i).sort(function(t,e){return t.index-e.index}).map(function(t){return{data:t.data,mode:t.mode,length:t.length}})}function h(t,a){switch(a){case e.NUMERIC:return n.getBitsLength(t);case e.ALPHANUMERIC:return r.getBitsLength(t);case e.KANJI:return i.getBitsLength(t);case e.BYTE:return o.getBitsLength(t)}}function d(t,a){let u;const c=e.getBestModeForData(t);if(u=e.from(a,c),u!==e.BYTE&&u.bit<c.bit)throw new Error('"'+t+'" cannot be encoded with mode '+e.toString(u)+".\n Suggested mode is: "+e.toString(c));switch(u!==e.KANJI||s.isKanjiModeEnabled()||(u=e.BYTE),u){case e.NUMERIC:return new n(t);case e.ALPHANUMERIC:return new r(t);case e.KANJI:return new i(t);case e.BYTE:return new o(t)}}t.fromArray=function(t){return t.reduce(function(t,e){return"string"==typeof e?t.push(d(e,null)):e.data&&t.push(d(e.data,e.mode)),t},[])},t.fromString=function(n,r){const o=function(t,n){const r={},o={start:{}};let i=["start"];for(let a=0;a<t.length;a++){const s=t[a],u=[];for(let t=0;t<s.length;t++){const c=s[t],l=""+a+t;u.push(l),r[l]={node:c,lastCount:0},o[l]={};for(let t=0;t<i.length;t++){const a=i[t];r[a]&&r[a].node.mode===c.mode?(o[a][l]=h(r[a].lastCount+c.length,c.mode)-h(r[a].lastCount,c.mode),r[a].lastCount+=c.length):(r[a]&&(r[a].lastCount=c.length),o[a][l]=h(c.length,c.mode)+4+e.getCharCountIndicator(c.mode,n))}}i=u}for(let e=0;e<i.length;e++)o[i[e]].end=0;return{map:o,table:r}}(function(t){const n=[];for(let r=0;r<t.length;r++){const o=t[r];switch(o.mode){case e.NUMERIC:n.push([o,{data:o.data,mode:e.ALPHANUMERIC,length:o.length},{data:o.data,mode:e.BYTE,length:o.length}]);break;case e.ALPHANUMERIC:n.push([o,{data:o.data,mode:e.BYTE,length:o.length}]);break;case e.KANJI:n.push([o,{data:o.data,mode:e.BYTE,length:c(o.data)}]);break;case e.BYTE:n.push([{data:o.data,mode:e.BYTE,length:c(o.data)}])}}return n}(f(n,s.isKanjiModeEnabled())),r),i=u.find_path(o.map,"start","end"),a=[];for(let t=1;t<i.length-1;t++)a.push(o.table[i[t]].node);return t.fromArray(a.reduce(function(t,e){const n=t.length-1>=0?t[t.length-1]:null;return n&&n.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)},[]))},t.rawSplit=function(e){return t.fromArray(f(e,s.isKanjiModeEnabled()))}}),D=u(t=>{var e=g(),n=p(),r=m(),o=w(),i=E(),a=y(),s=v(),u=C(),c=I(),l=P(),f=b(),h=N(),d=k();function A(t,e,n){const r=t.size,o=f.getEncodedBits(e,n);let i,a;for(i=0;i<15;i++)a=1==(o>>i&1),i<6?t.set(i,8,a,!0):i<8?t.set(i+1,8,a,!0):t.set(r-15+i,8,a,!0),i<8?t.set(8,r-i-1,a,!0):i<9?t.set(8,15-i-1+1,a,!0):t.set(8,15-i-1,a,!0);t.set(r-8,8,1,!0)}function B(t,n,o){const i=new r;o.forEach(function(e){i.put(e.mode.bit,4),i.put(e.getLength(),h.getCharCountIndicator(e.mode,t)),e.write(i)});const a=8*(e.getSymbolTotalCodewords(t)-u.getTotalCodewordsCount(t,n));for(i.getLengthInBits()+4<=a&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const s=(a-i.getLengthInBits())/8;for(let e=0;e<s;e++)i.put(e%2?17:236,8);return function(t,n,r){const o=e.getSymbolTotalCodewords(n),i=o-u.getTotalCodewordsCount(n,r),a=u.getBlocksCount(n,r),s=a-o%a,l=Math.floor(o/a),f=Math.floor(i/a),h=f+1,d=l-f,g=new c(d);let p=0;const m=new Array(a),w=new Array(a);let E=0;const y=new Uint8Array(t.buffer);for(let e=0;e<a;e++){const t=e<s?f:h;m[e]=y.slice(p,p+t),w[e]=g.encode(m[e]),p+=t,E=Math.max(E,t)}const v=new Uint8Array(o);let C,A,B=0;for(C=0;C<E;C++)for(A=0;A<a;A++)C<m[A].length&&(v[B++]=m[A][C]);for(C=0;C<d;C++)for(A=0;A<a;A++)v[B++]=w[A][C];return v}(i,t,n)}function M(t,n,r,u){let c;if(Array.isArray(t))c=d.fromArray(t);else{if("string"!=typeof t)throw new Error("Invalid data");{let e=n;if(!e){const n=d.rawSplit(t);e=l.getBestVersionForData(n,r)}c=d.fromString(t,e||40)}}const f=l.getBestVersionForData(c,r);if(!f)throw new Error("The amount of data is too big to be stored in a QR Code");if(n){if(n<f)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+f+".\n")}else n=f;const h=B(n,r,c),g=new o(e.getSymbolSize(n));return function(t,e){const n=t.size,r=a.getPositions(e);for(let o=0;o<r.length;o++){const e=r[o][0],i=r[o][1];for(let r=-1;r<=7;r++)if(!(e+r<=-1||n<=e+r))for(let o=-1;o<=7;o++)i+o<=-1||n<=i+o||(r>=0&&r<=6&&(0===o||6===o)||o>=0&&o<=6&&(0===r||6===r)||r>=2&&r<=4&&o>=2&&o<=4?t.set(e+r,i+o,!0,!0):t.set(e+r,i+o,!1,!0))}}(g,n),function(t){const e=t.size;for(let n=8;n<e-8;n++){const e=n%2==0;t.set(n,6,e,!0),t.set(6,n,e,!0)}}(g),function(t,e){const n=i.getPositions(e);for(let r=0;r<n.length;r++){const e=n[r][0],o=n[r][1];for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)-2===n||2===n||-2===r||2===r||0===n&&0===r?t.set(e+n,o+r,!0,!0):t.set(e+n,o+r,!1,!0)}}(g,n),A(g,r,0),n>=7&&function(t,e){const n=t.size,r=l.getEncodedBits(e);let o,i,a;for(let s=0;s<18;s++)o=Math.floor(s/3),i=s%3+n-8-3,a=1==(r>>s&1),t.set(o,i,a,!0),t.set(i,o,a,!0)}(g,n),function(t,e){const n=t.size;let r=-1,o=n-1,i=7,a=0;for(let s=n-1;s>0;s-=2)for(6===s&&s--;;){for(let n=0;n<2;n++)if(!t.isReserved(o,s-n)){let r=!1;a<e.length&&(r=1==(e[a]>>>i&1)),t.set(o,s-n,r),i--,-1===i&&(a++,i=7)}if(o+=r,o<0||n<=o){o-=r,r=-r;break}}}(g,h),isNaN(u)&&(u=s.getBestMask(g,A.bind(null,g,r))),s.applyMask(u,g),A(g,r,u),{modules:g,version:n,errorCorrectionLevel:r,maskPattern:u,segments:c}}t.create=function(t,r){if(void 0===t||""===t)throw new Error("No input text");let o,i,a=n.M;return void 0!==r&&(a=n.from(r.errorCorrectionLevel,n.M),o=l.from(r.version),i=s.from(r.maskPattern),r.toSJISFunc&&e.setToSJISFunction(r.toSJISFunc)),M(t,o,a,i)}}),F=u(t=>{function e(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||5===e.length||e.length>8)throw new Error("Invalid hex color: "+t);3!==e.length&&4!==e.length||(e=Array.prototype.concat.apply([],e.map(function(t){return[t,t]}))),6===e.length&&e.push("F","F");const n=parseInt(e.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+e.slice(0,6).join("")}}t.getOptions=function(t){t||(t={}),t.color||(t.color={});const n=void 0===t.margin||null===t.margin||t.margin<0?4:t.margin,r=t.width&&t.width>=21?t.width:void 0,o=t.scale||4;return{width:r,scale:r?4:o,margin:n,color:{dark:e(t.color.dark||"#000000ff"),light:e(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},t.getScale=function(t,e){return e.width&&e.width>=t+2*e.margin?e.width/(t+2*e.margin):e.scale},t.getImageWidth=function(e,n){const r=t.getScale(e,n);return Math.floor((e+2*n.margin)*r)},t.qrToImageData=function(e,n,r){const o=n.modules.size,i=n.modules.data,a=t.getScale(o,r),s=Math.floor((o+2*r.margin)*a),u=r.margin*a,c=[r.color.light,r.color.dark];for(let t=0;t<s;t++)for(let n=0;n<s;n++){let l=4*(t*s+n),f=r.color.light;t>=u&&n>=u&&t<s-u&&n<s-u&&(f=c[i[Math.floor((t-u)/a)*o+Math.floor((n-u)/a)]?1:0]),e[l++]=f.r,e[l++]=f.g,e[l++]=f.b,e[l]=f.a}}}),z=u(t=>{var e=F();t.render=function(t,n,r){let o=r,i=n;void 0!==o||n&&n.getContext||(o=n,n=void 0),n||(i=function(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}()),o=e.getOptions(o);const a=e.getImageWidth(t.modules.size,o),s=i.getContext("2d"),u=s.createImageData(a,a);return e.qrToImageData(u.data,t,o),function(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+"px",e.style.width=n+"px"}(s,i,a),s.putImageData(u,0,0),i},t.renderToDataURL=function(e,n,r){let o=r;void 0!==o||n&&n.getContext||(o=n,n=void 0),o||(o={});const i=t.render(e,n,o),a=o.type||"image/png",s=o.rendererOpts||{};return i.toDataURL(a,s.quality)}}),H=u(t=>{var e=F();function n(t,e){const n=t.a/255,r=e+'="'+t.hex+'"';return n<1?r+" "+e+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function r(t,e,n){let r=t+e;return void 0!==n&&(r+=" "+n),r}t.render=function(t,o,i){const a=e.getOptions(o),s=t.modules.size,u=t.modules.data,c=s+2*a.margin,l=a.color.light.a?"<path "+n(a.color.light,"fill")+' d="M0 0h'+c+"v"+c+'H0z"/>':"",f="<path "+n(a.color.dark,"stroke")+' d="'+function(t,e,n){let o="",i=0,a=!1,s=0;for(let u=0;u<t.length;u++){const c=Math.floor(u%e),l=Math.floor(u/e);c||a||(a=!0),t[u]?(s++,u>0&&c>0&&t[u-1]||(o+=a?r("M",c+n,.5+l+n):r("m",i,0),i=0,a=!1),c+1<e&&t[u+1]||(o+=r("h",s),s=0)):i++}return o}(u,s,a.margin)+'"/>',h='viewBox="0 0 '+c+" "+c+'"',d='<svg xmlns="http://www.w3.org/2000/svg" '+(a.width?'width="'+a.width+'" height="'+a.width+'" ':"")+h+' shape-rendering="crispEdges">'+l+f+"</svg>\n";return"function"==typeof i&&i(null,d),d}}),_=u(t=>{var e=d(),n=D(),r=z(),o=H();function i(t,r,o,i,a){const s=[].slice.call(arguments,1),u=s.length,c="function"==typeof s[u-1];if(!c&&!e())throw new Error("Callback required as last argument");if(!c){if(u<1)throw new Error("Too few arguments provided");return 1===u?(o=r,r=i=void 0):2!==u||r.getContext||(i=o,o=r,r=void 0),new Promise(function(e,a){try{e(t(n.create(o,i),r,i))}catch(s){a(s)}})}if(u<2)throw new Error("Too few arguments provided");2===u?(a=o,o=r,r=i=void 0):3===u&&(r.getContext&&void 0===a?(a=i,i=void 0):(a=i,i=o,o=r,r=void 0));try{const e=n.create(o,i);a(null,t(e,r,i))}catch(l){a(l)}}t.create=n.create,t.toCanvas=i.bind(null,r.render),t.toDataURL=i.bind(null,r.renderToDataURL),t.toString=i.bind(null,function(t,e,n){return o.render(t,n)})}),J=a(_(),1),K=["src"],Y=r({name:"tmagic-qrcode",__name:"index",props:{config:{},iteratorIndex:{},iteratorContainerId:{},containerIndex:{},pageFragmentContainerId:{},model:{},disabled:{type:Boolean}},setup(t){const e=t,r=o();l(()=>e.config.url,(t="")=>{J.toDataURL(t,(t,e)=>{t&&console.error(t),r.value=e})},{immediate:!0});const a=s("app"),u=f(e);h(u);const d=()=>{a&&u&&a.emit(`${c}click`,u)};return(t,e)=>(i(),n("img",{src:r.value,onClick:d},null,8,K))}}),t("default",Y)}}});
|
|
//# sourceMappingURL=src-legacy-CSMzvOPU.js.map
|