/*! Build based on gin-vue-admin Time : 1757946830000 */ !function(){function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function e(e){for(var r=1;r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function s(r,n,o,a){var s=n&&n.prototype instanceof u?n:u,c=Object.create(s.prototype);return i(c,"_invoke",function(r,n,o){var i,a,s,u=0,c=o||[],f=!1,h={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return i=e,a=0,s=t,h.n=r,l}};function d(r,n){for(a=r,s=n,e=0;!f&&u&&!o&&e3?(o=g===n)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=r<2&&dn||n>g)&&(i[4]=r,i[5]=n,h.n=g,a=0))}if(o||r>1)return l;throw f=!0,n}return function(o,c,g){if(u>1)throw TypeError("Generator is already running");for(f&&1===c&&d(c,g),a=c,s=g;(e=a<2?t:s)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,s)):h.n=s:h.v=s);try{if(u=2,i){if(a||(o="next"),e=i[o]){if(!(e=e.call(i,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,a<2&&(a=0)}else 1===a&&(e=i.return)&&e.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((e=(f=h.n<0)?s:r.call(n,h))!==l)break}catch(e){i=t,a=1,s=e}finally{u=1}}return{value:e,done:f}}}(r,o,a),!0),c}var l={};function u(){}function c(){}function f(){}e=Object.getPrototypeOf;var h=[][n]?e(e([][n]())):(i(e={},n,function(){return this}),e),d=f.prototype=u.prototype=Object.create(h);function g(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,i(t,a,"GeneratorFunction")),t.prototype=Object.create(d),t}return c.prototype=f,i(d,"constructor",f),i(f,"constructor",c),c.displayName="GeneratorFunction",i(f,a,"GeneratorFunction"),i(d),i(d,a,"Generator"),i(d,n,function(){return this}),i(d,"toString",function(){return"[object Generator]"}),(o=function(){return{w:s,m:g}})()}function i(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}i=function(t,e,r,n){function a(e,r){i(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},i(t,e,r,n)}function a(t,e,r,n,o,i,a){try{var s=t[i](a),l=s.value}catch(t){return void r(t)}s.done?e(l):Promise.resolve(l).then(n,o)}function s(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function s(t){a(i,n,o,s,l,"next",t)}function l(t){a(i,n,o,s,l,"throw",t)}s(void 0)})}}function l(t,e,r){return(e=h(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=Array(e);r8)return A.error("文件大小不能超过8MB!"),!1;var e=new FileReader;e.onload=function(t){a.value=t.target.result,i.value=!0},e.readAsDataURL(t.raw)}else A.error("请选择图片文件")},J=function(t){-90===t?l.$refs.cropperRef.rotateLeft():l.$refs.cropperRef.rotateRight()},Z=function(t){u.value=t},tt=function(){c.value=!0,l.$refs.cropperRef.getCropBlob(function(t){try{var e=new File([t],"".concat(Date.now(),".jpg"),{type:"image/jpeg"});o.value.clearFiles(),o.value.handleStart(e),o.value.submit()}catch(r){c.value=!1,A.error("上传失败: "+r.message)}})},et=function(t){var e=t.data;e&&setTimeout(function(){c.value=!1,i.value=!1,u.value={},A.success("上传成功"),r("on-success",e.url)},1e3)};return function(t,e){var r=p("el-button"),l=p("el-upload"),A=p("el-tooltip"),P=p("el-button-group"),B=p("el-option"),rt=p("el-select"),nt=p("el-dialog");return m(),v(R,null,[y(l,{ref_key:"uploadRef",ref:o,action:"".concat(w(x)(),"/fileUploadAndDownload/upload"),accept:"image/*","show-file-list":!1,"auto-upload":!1,data:{classId:n.classId},"on-success":et,"on-change":Y,headers:{"x-token":t.token}},{default:b(function(){return[y(r,{type:"primary",icon:"crop"},{default:b(function(){return g(e[8]||(e[8]=[C(" 裁剪上传",-1)]))}),_:1})]}),_:1},8,["action","data","headers"]),y(nt,{modelValue:i.value,"onUpdate:modelValue":e[6]||(e[6]=function(t){return i.value=t}),title:"图片裁剪",width:"1200px","append-to-body":"",onClose:e[7]||(e[7]=function(t){return i.value=!1}),"close-on-click-modal":!1,draggable:""},{footer:b(function(){return[S("div",W,[y(r,{onClick:e[5]||(e[5]=function(t){return i.value=!1})},{default:b(function(){return g(e[10]||(e[10]=[C("取 消",-1)]))}),_:1}),y(r,{type:"primary",onClick:tt,loading:c.value},{default:b(function(){return[C(M(c.value?"上传中...":"上 传"),1)]}),_:1},8,["loading"])])]}),default:b(function(){return[S("div",G,[S("div",H,[S("div",q,[y(w(F),{ref_key:"cropperRef",ref:s,img:a.value,outputType:"jpeg",autoCrop:!0,autoCropWidth:k.value,autoCropHeight:j.value,fixedBox:!1,fixed:N.value,fixedNumber:d.value,centerBox:!0,canMoveBox:!0,full:!1,maxImgSize:1200,original:!0,onRealTime:Z},null,8,["img","autoCropWidth","autoCropHeight","fixed","fixedNumber"])]),S("div",Q,[y(P,null,{default:b(function(){return[y(A,{content:"向左旋转"},{default:b(function(){return[y(r,{onClick:e[0]||(e[0]=function(t){return J(-90)}),icon:w(D)},null,8,["icon"])]}),_:1}),y(A,{content:"向右旋转"},{default:b(function(){return[y(r,{onClick:e[1]||(e[1]=function(t){return J(90)}),icon:w(T)},null,8,["icon"])]}),_:1}),y(r,{icon:w(E),onClick:e[2]||(e[2]=function(t){return f(1)})},null,8,["icon"]),y(r,{icon:w(_),onClick:e[3]||(e[3]=function(t){return f(-1)})},null,8,["icon"])]}),_:1}),y(rt,{modelValue:U.value,"onUpdate:modelValue":e[4]||(e[4]=function(t){return U.value=t}),placeholder:"选择比例",class:"w-32 ml-4",onChange:z},{default:b(function(){return[(m(!0),v(R,null,I(h.value,function(t,e){return m(),L(B,{key:e,label:t.label,value:e},null,8,["label","value"])}),128))]}),_:1},8,["modelValue"])])]),S("div",K,[S("div",V,[e[9]||(e[9]=S("div",{class:"mb-[15px] text-gray-600"},"裁剪预览",-1)),S("div",{class:"bg-white p-5 rounded-lg shadow-[0_2px_12px_rgba(0,0,0,0.1)]",style:O({width:u.value.w+"px",height:u.value.h+"px"})},[S("div",X,[S("img",{src:u.value.url,style:O(u.value.img),alt:"",class:"max-w-none absolute transition-all duration-300 ease-in-out image-render-pixelated origin-[0_0]"},null,12,$)])],4)])])])]}),_:1},8,["modelValue"])],64)}}}),[["__scopeId","data-v-5a05348c"]]));function Y(t){return""===t?t:"true"===t||"1"==t}function J(t,e){return new Promise(function(e,r){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var t=new FileReader;t.onloadend=function(){e(t.result)},t.readAsArrayBuffer(n.response)},n.open("GET",t),n.send()})}function Z(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function tt(t,e){for(var r,n="",o=0,i=-1,a=0,s=0;s<=t.length;++s){if(s2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",o=0):o=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),i=s,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=s,a=0;continue}e&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+t.slice(i+1,s):n=t.slice(i+1,s),o=s-i-1;i=s,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var et={resolve:function(){for(var t,e="",r=!1,n=arguments.length-1;n>=-1&&!r;n--){var o;n>=0?o=arguments[n]:(void 0===t&&(t=process.cwd()),o=t),Z(o),0!==o.length&&(e=o+"/"+e,r=47===o.charCodeAt(0))}return e=tt(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(t){if(Z(t),0===t.length)return".";var e=47===t.charCodeAt(0),r=47===t.charCodeAt(t.length-1);return 0!==(t=tt(t,!e)).length||e||(t="."),t.length>0&&r&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return Z(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e0&&(void 0===t?t=r:t+="/"+r)}return void 0===t?".":et.normalize(t)},relative:function(t,e){if(Z(t),Z(e),t===e)return"";if((t=et.resolve(t))===(e=et.resolve(e)))return"";for(var r=1;rs){if(47===e.charCodeAt(i+u))return e.slice(i+u+1);if(0===u)return e.slice(i+u)}else o>s&&(47===t.charCodeAt(r+u)?l=u:0===u&&(l=0));break}var c=t.charCodeAt(r+u);if(c!==e.charCodeAt(i+u))break;47===c&&(l=u)}var f="";for(u=r+l+1;u<=n;++u)u!==n&&47!==t.charCodeAt(u)||(0===f.length?f+="..":f+="/..");return f.length>0?f+e.slice(i+l):(i+=l,47===e.charCodeAt(i)&&++i,e.slice(i))},_makeLong:function(t){return t},dirname:function(t){if(Z(t),0===t.length)return".";for(var e=t.charCodeAt(0),r=47===e,n=-1,o=!0,i=t.length-1;i>=1;--i)if(47===(e=t.charCodeAt(i))){if(!o){n=i;break}}else o=!1;return-1===n?r?"/":".":r&&1===n?"//":t.slice(0,n)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');Z(t);var r,n=0,o=-1,i=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var a=e.length-1,s=-1;for(r=t.length-1;r>=0;--r){var l=t.charCodeAt(r);if(47===l){if(!i){n=r+1;break}}else-1===s&&(i=!1,s=r+1),a>=0&&(l===e.charCodeAt(a)?-1===--a&&(o=r):(a=-1,o=s))}return n===o?o=s:-1===o&&(o=t.length),t.slice(n,o)}for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!i){n=r+1;break}}else-1===o&&(i=!1,o=r+1);return-1===o?"":t.slice(n,o)},extname:function(t){Z(t);for(var e=-1,r=0,n=-1,o=!0,i=0,a=t.length-1;a>=0;--a){var s=t.charCodeAt(a);if(47!==s)-1===n&&(o=!1,n=a+1),46===s?-1===e?e=a:1!==i&&(i=1):-1!==e&&(i=-1);else if(!o){r=a+1;break}}return-1===e||-1===n||0===i||1===i&&e===n-1&&e===r+1?"":t.slice(e,n)},format:function(t){if(null===t||"object"!==d(t))throw new TypeError('The "pathObject" argument must be of type Object. Received type '+d(t));return function(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+t+n:n}("/",t)},parse:function(t){Z(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var r,n=t.charCodeAt(0),o=47===n;o?(e.root="/",r=1):r=0;for(var i=-1,a=0,s=-1,l=!0,u=t.length-1,c=0;u>=r;--u)if(47!==(n=t.charCodeAt(u)))-1===s&&(l=!1,s=u+1),46===n?-1===i?i=u:1!==c&&(c=1):-1!==i&&(c=-1);else if(!l){a=u+1;break}return-1===i||-1===s||0===c||1===c&&i===s-1&&i===a+1?-1!==s&&(e.base=e.name=0===a&&o?t.slice(1,s):t.slice(a,s)):(0===a&&o?(e.name=t.slice(1,i),e.base=t.slice(1,s)):(e.name=t.slice(a,i),e.base=t.slice(a,s)),e.ext=t.slice(i,s)),a>0?e.dir=t.slice(0,a-1):o&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};et.posix=et;var rt=et.extname,nt=et.basename,ot=function(){return f(function t(){u(this,t);var e="undefined"==typeof global,r="image/png",n="image/jpeg",o="image/jpeg",i="image/webp",a="application/pdf",s="image/svg+xml";Object.assign(this,{toMime:this.toMime.bind(this),fromMime:this.fromMime.bind(this),expected:e?'"png", "jpg", or "webp"':'"png", "jpg", "pdf", or "svg"',formats:e?{png:r,jpg:n,jpeg:o,webp:i}:{png:r,jpg:n,jpeg:o,pdf:a,svg:s},mimes:e?l(l(l({},r,"png"),n,"jpg"),i,"webp"):l(l(l(l({},r,"png"),n,"jpg"),a,"pdf"),s,"svg")})},[{key:"toMime",value:function(t){return this.formats[(t||"").replace(/^\./,"").toLowerCase()]}},{key:"fromMime",value:function(t){return this.mimes[t]}}])}();var it=function(){function t(){u(this,t),this.crc=-1}return f(t,[{key:"get",value:function(){return~this.crc}},{key:"append",value:function(t){for(var e=0|this.crc,r=this.table,n=0,o=0|t.length;n>>8^r[255&(e^t[n])];return this.crc=e,this}}],[{key:"for",value:function(e){return(new t).append(e).get()}}])}();function at(t){var e=new Uint8Array(t),r=new DataView(e.buffer),n={array:e,view:r,size:t,set8:function(t,e){return r.setUint8(t,e),n},set16:function(t,e){return r.setUint16(t,e,!0),n},set32:function(t,e){return r.setUint32(t,e,!0),n},bytes:function(t,r){return e.set(r,t),n}};return n}it.prototype.table=function(){var t,e,r,n=[];for(t=0;t<256;t++){for(r=t,e=0;e<8;e++)r=1&r?r>>>1^3988292384:r>>>1;n[t]=r}return n}();var st=function(){function t(e){u(this,t);var r=new Date;Object.assign(this,{directory:e,offset:0,files:[],time:(r.getHours()<<6|r.getMinutes())<<5|r.getSeconds()/2,date:(r.getFullYear()-1980<<4|r.getMonth()+1)<<5|r.getDate()}),this.add(e)}return f(t,[{key:"add",value:(e=s(o().m(function e(r,n){var i,a,s,l,u,c,f,h,d,g;return o().w(function(e){for(;;)switch(e.n){case 0:if(i=!n,a=t.encoder.encode("".concat(this.directory,"/").concat(i?"":r)),d=Uint8Array,!i){e.n=1;break}g=0,e.n=3;break;case 1:return e.n=2,n.arrayBuffer();case 2:g=e.v;case 3:s=new d(g),l=30+a.length,u=l+s.length,c=this.offset,f=at(26).set32(0,134742036).set16(6,this.time).set16(8,this.date).set32(10,it.for(s)).set32(14,s.length).set32(18,s.length).set16(22,a.length),c+=l,h=at(l+s.length+16).set32(0,67324752).bytes(4,f.array).bytes(30,a).bytes(l,s),c+=s.length,h.set32(u,134695760).bytes(u+4,f.array.slice(10,22)),c+=16,this.files.push({offset:c,folder:i,name:a,header:f,payload:h}),this.offset=c;case 4:return e.a(2)}},e,this)})),function(t,r){return e.apply(this,arguments)})},{key:"toBuffer",value:function(){var t,e=this.files.reduce(function(t,e){return 46+e.name.length+t},0),r=at(e+22),o=0,i=n(this.files);try{for(i.s();!(t=i.n()).done;){var a=t.value,s=a.offset,l=a.name,u=a.header,c=a.folder;r.set32(o,33639248).set16(o+4,20).bytes(o+6,u.array).set8(o+38,c?16:0).set32(o+42,s).bytes(o+46,l),o+=46+l.length}}catch(v){i.e(v)}finally{i.f()}r.set32(o,101010256).set16(o+8,this.files.length).set16(o+10,this.files.length).set32(o+12,e).set32(o+16,this.offset);var f,h=new Uint8Array(this.offset+r.size),d=0,g=n(this.files);try{for(g.s();!(f=g.n()).done;){var p=f.value.payload;h.set(p.array,d),d+=p.size}}catch(v){g.e(v)}finally{g.f()}return h.set(r.array,d),h}},{key:"blob",get:function(){return new Blob([this.toBuffer()],{type:"application/zip"})}}]);var e}();st.encoder=new TextEncoder;var lt=function(t,e,r,n){if(n){var o=t,i=o.width,a=o.height,s=Object.assign(document.createElement("canvas"),{width:i,height:a}),l=s.getContext("2d");l.fillStyle=n,l.fillRect(0,0,i,a),l.drawImage(t,0,0),t=s}return new Promise(function(n,o){return t.toBlob(n,e,r)})},ut=function(){var t=s(o().m(function t(e,r,n,i,a){var s,l;return o().w(function(t){for(;;)switch(t.n){case 0:return s=ft,l=a,t.n=1,lt(e,r,n,i);case 1:s(l,t.v);case 2:return t.a(2)}},t)}));return function(e,r,n,o,i){return t.apply(this,arguments)}}(),ct=function(){var t=s(o().m(function t(e,r,n,i,a,l,u){var c,f,h;return o().w(function(t){for(;;)switch(t.n){case 0:return c=function(t){return l.replace("{}",String(t+1).padStart(u,"0"))},f=nt(a,".zip")||"archive",h=new st(f),t.n=1,Promise.all(e.map(function(){var t=s(o().m(function t(e,a){var s,l,u;return o().w(function(t){for(;;)switch(t.n){case 0:return s=c(a),l=h,u=s,t.n=1,lt(e,r,n,i);case 1:return t.n=2,l.add.call(l,u,t.v);case 2:return t.a(2)}},t)}));return function(e,r){return t.apply(this,arguments)}}()));case 1:ft("".concat(f,".zip"),h.blob);case 2:return t.a(2)}},t)}));return function(e,r,n,o,i,a,s){return t.apply(this,arguments)}}(),ft=function(t,e){var r=window.URL.createObjectURL(e),n=document.createElement("a");n.style.display="none",n.href=r,n.setAttribute("download",t),void 0===n.download&&n.setAttribute("target","_blank"),document.body.appendChild(n),n.click(),document.body.removeChild(n),setTimeout(function(){return window.URL.revokeObjectURL(r)},100)},ht={asBuffer:function(){return lt.apply(void 0,arguments).then(function(t){return t.arrayBuffer()})},asDownload:ut,asZipDownload:ct,atScale:function(t,e,r){return t.map(function(t){if(1==e&&!r)return t.canvas;var n=document.createElement("canvas"),o=n.getContext("2d"),i=t.canvas?t.canvas:t;return n.width=i.width*e,n.height=i.height*e,r&&(o.fillStyle=r,o.fillRect(0,0,n.width,n.height)),o.scale(e,e),o.drawImage(i,0,0),n})},options:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.filename,n=void 0===r?"":r,o=e.extension,i=void 0===o?"":o,a=e.format,s=e.page,l=e.quality,u=e.matte,c=e.density,f=e.outline;return function(e,r){var o=new ot,a=o.fromMime,h=o.toMime,d=o.expected,g=(r=r||"canvas",e||i.replace(/@\d+x$/i,"")||rt(n)),p=(e=a(h(g)||g),h(e)),v=t.length;if(!g)throw new Error("Cannot determine image format (use a filename extension or 'format' argument)");if(!e)throw new Error('Unsupported file format "'.concat(g,'" (expected ').concat(d,")"));if(!v)throw new RangeError("Canvas has no associated contexts (try calling getContext or newPage first)");var m,y,b=n.replace(/{(\d*)}/g,function(t,e){return y=!0,e=parseInt(e,10),m=isFinite(e)?e:isFinite(m)?m:-1,"{}"}),w=s>0?s-1:s<0?v+s:void 0;if(isFinite(w)&&w<0||w>=v)throw new RangeError(1==v?"Canvas only has a ‘page 1’ (".concat(w," is out of bounds)"):"Canvas has pages 1–".concat(v," (").concat(w," is out of bounds)"));if(t=isFinite(w)?[t[w]]:y||"pdf"==e?t:t.slice(-1),void 0===l)l=.92;else if("number"!=typeof l||!isFinite(l)||l<0||l>1)throw new TypeError("The quality option must be an number in the 0.0–1.0 range");if(void 0===c){var k=(i||nt(n,g)).match(/@(\d+)x$/i);c=k?parseInt(k[1],10):1}else if("number"!=typeof c||!Number.isInteger(c)||c<1)throw new TypeError("The density option must be a non-negative integer");return void 0===f?f=!0:"svg"==e&&(f=!!f),{filename:n,pattern:b,format:e,mime:p,pages:t,padding:m,quality:l,matte:u,density:c,outline:f,archive:r}}(a,e.archive)}},dt=ht.asBuffer,gt=ht.asDownload,pt=ht.asZipDownload,vt=ht.atScale,mt=ht.options,yt=Symbol.for("toDataURL"),bt=f(function t(n,o){u(this,t);var i=document.createElement("canvas"),a=[];Object.defineProperty(i,"async",{value:!0,writable:!1,enumerable:!0});for(var s=0,c=Object.entries({png:function(){return dt(i,"image/png")},jpg:function(){return dt(i,"image/jpeg")},pages:function(){return a.concat(i).map(function(t){return t.getContext("2d")})}});s0&&void 0!==arguments[0]?arguments[0]:"png",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r="number"==typeof r?{quality:r}:r;var n=mt(this.pages,e({extension:t},r)),o=n.mime,i=n.quality,a=n.matte,s=n.pages,l=n.density,u=vt(s,l,a)[0];return dt(u,o,i,a)}},yt,i.toDataURL.bind(i)),"toDataURL",function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"png",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r="number"==typeof r?{quality:r}:r;var n=mt(this.pages,e({extension:t},r)),o=n.mime,a=n.quality,s=n.matte,l=n.pages,u=n.density,c=vt(l,u,s)[0],f=c[c===i?yt:"toDataURL"](o,a);return Promise.resolve(f)}))}),wt={Canvas:bt},kt=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r;if(Array.isArray(e))e.forEach(function(e){return kt(t,e,r,n)});else if("function"==typeof e)e(t,r,n,kt);else{var o=Object.keys(e)[0];Array.isArray(e[o])?(n[o]={},kt(t,e[o],r,n[o])):n[o]=e[o](t,r,n,kt)}return r},Ct=function(t,e){return function(r,n,o,i){e(r,n,o)&&i(r,t,n,o)}},xt=function(){return function(t){return t.data[t.pos++]}},At=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}},Pt=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}},Bt=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}},St=function(t){return function(e){return Array.from(Pt(t)(e)).map(function(t){return String.fromCharCode(t)}).join("")}},Dt=function(t){return function(e){var r=Pt(2)(e);return t?(r[1]<<8)+r[0]:(r[0]<<8)+r[1]}},Tt=function(t,e){return function(r,n,o){for(var i="function"==typeof e?e(r,n,o):e,a=Pt(t),s=new Array(i),l=0;l=r){var i=r-t.pos;e.push(Pt(i)(t)),n+=i;break}e.push(Pt(o)(t)),n+=o}for(var a=new Uint8Array(n),s=0,l=0;l>=a,g-=a,c>n||c==s)break;if(c==o){i=(1<<(a=h+1))-1,n=o+2,u=-1;continue}if(-1==u){A[v++]=x[c],u=c,p=c;continue}for(l=c,c==n&&(A[v++]=p,c=u);c>o;)A[v++]=x[c],c=C[c];p=255&x[c],A[v++]=p,n65536?(i[0]=240|(1835008&a)>>>18,i[1]=128|(258048&a)>>>12,i[2]=128|(4032&a)>>>6,i[3]=128|63&a):a>2048?(i[0]=224|(61440&a)>>>12,i[1]=128|(4032&a)>>>6,i[2]=128|63&a):a>128?(i[0]=192|(1984&a)>>>6,i[1]=128|63&a):i[0]=a,r.push(i)}this.parsedData=Array.prototype.concat.apply([],r),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))},[{key:"getLength",value:function(){return this.parsedData.length}},{key:"write",value:function(t){for(var e=0,r=this.parsedData.length;e0&&void 0!==arguments[0]?arguments[0]:-1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qt.L;u(this,t),this.moduleCount=0,this.dataList=[],this.typeNumber=e,this.errorCorrectLevel=r,this.moduleCount=0,this.dataList=[]}return f(t,[{key:"addData",value:function(t){if(this.typeNumber<=0)this.typeNumber=function(t,e){for(var r=1,n=Ft(t),o=0,i=Jt.length;oJt.length)throw new Error("Too long data");return r}(t,this.errorCorrectLevel);else{if(this.typeNumber>40)throw new Error("Invalid QR version: ".concat(this.typeNumber));if(!function(t,e,r){var n=Ft(e),o=t-1,i=0;switch(r){case qt.L:i=Jt[o][0];break;case qt.M:i=Jt[o][1];break;case qt.Q:i=Jt[o][2];break;case qt.H:i=Jt[o][3]}return n<=i}(this.typeNumber,t,this.errorCorrectLevel))throw new Error("Data is too long for QR version: ".concat(this.typeNumber))}var e=new Gt(t);this.dataList.push(e),this.dataCache=void 0}},{key:"isDark",value:function(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error("".concat(t,",").concat(e));return this.modules[t][e]}},{key:"getModuleCount",value:function(){return this.moduleCount}},{key:"make",value:function(){this.makeImpl(!1,this.getBestMaskPattern())}},{key:"makeImpl",value:function(e,r){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var n=0;n=7&&this.setupTypeNumber(e),null==this.dataCache&&(this.dataCache=t.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,r)}},{key:"setupPositionProbePattern",value:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(this.modules[t+r][e+n]=0<=r&&r<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=n&&n<=4)}},{key:"getBestMaskPattern",value:function(){if(Number.isInteger(this.maskPattern)&&Object.values(Kt).includes(this.maskPattern))return this.maskPattern;for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=Vt.getLostPoint(this);(0==r||t>n)&&(t=n,e=r)}return e}},{key:"setupTimingPattern",value:function(){for(var t=8;t>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(r=0;r<18;r++){n=!t&&1==(e>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}}},{key:"setupTypeInfo",value:function(t,e){for(var r=this.errorCorrectLevel<<3|e,n=Vt.getBCHTypeInfo(r),o=0;o<15;o++){var i=!t&&1==(n>>o&1);o<6?this.modules[o][8]=i:o<8?this.modules[o+1][8]=i:this.modules[this.moduleCount-15+o][8]=i}for(o=0;o<15;o++){i=!t&&1==(n>>o&1);o<8?this.modules[8][this.moduleCount-o-1]=i:o<9?this.modules[8][15-o-1+1]=i:this.modules[8][15-o-1]=i}this.modules[this.moduleCount-8][8]=!t}},{key:"mapData",value:function(t,e){for(var r=-1,n=this.moduleCount-1,o=7,i=0,a=this.moduleCount-1;a>0;a-=2)for(6==a&&a--;;){for(var s=0;s<2;s++)if(null==this.modules[n][a-s]){var l=!1;i>>o&1)),Vt.getMask(e,n,a-s)&&(l=!l),this.modules[n][a-s]=l,-1==--o&&(i++,o=7)}if((n+=r)<0||this.moduleCount<=n){n-=r,r=-r;break}}}}],[{key:"createData",value:function(e,r,n){for(var o=Wt.getRSBlocks(e,r),i=new Yt,a=0;a8*l)throw new Error("code length overflow. (".concat(i.getLengthInBits(),">").concat(8*l,")"));for(i.getLengthInBits()+4<=8*l&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=8*l||(i.put(t.PAD0,8),i.getLengthInBits()>=8*l));)i.put(t.PAD1,8);return t.createBytes(i,o)}},{key:"createBytes",value:function(t,e){for(var r=0,n=0,o=0,i=new Array(e.length),a=new Array(e.length),s=0;s=0?h.get(d):0}}var g=0;for(c=0;c=0;)r^=t.G15<=0;)r^=t.G18<>>=1;return e}},{key:"getPatternPosition",value:function(e){return t.PATTERN_POSITION_TABLE[e-1]}},{key:"getMask",value:function(t,e,r){switch(t){case Kt.PATTERN000:return(e+r)%2==0;case Kt.PATTERN001:return e%2==0;case Kt.PATTERN010:return r%3==0;case Kt.PATTERN011:return(e+r)%3==0;case Kt.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case Kt.PATTERN101:return e*r%2+e*r%3==0;case Kt.PATTERN110:return(e*r%2+e*r%3)%2==0;case Kt.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:".concat(t))}}},{key:"getErrorCorrectPolynomial",value:function(t){for(var e=new $t([1],0),r=0;r5&&(r+=3+i-5)}for(n=0;n=256;)e-=255;return t.EXP_TABLE[e]}}])}();Xt.EXP_TABLE=new Array(256),Xt.LOG_TABLE=new Array(256),Xt._constructor=function(){for(var t=0;t<8;t++)Xt.EXP_TABLE[t]=1<>>7-t%8&1)}},{key:"put",value:function(t,e){for(var r=0;r>>e-r-1&1))}},{key:"getLengthInBits",value:function(){return this.length}},{key:"putBit",value:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}}])}(),Jt=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],Zt=256,te=1024,ee=1<<18;function re(t,e){var r,n,o,i,a;function s(t,e,n,o,i){r[e][0]-=t*(r[e][0]-n)/te,r[e][1]-=t*(r[e][1]-o)/te,r[e][2]-=t*(r[e][2]-i)/te}function l(t,e,n,o,i){for(var s,l,u=Math.abs(e-t),c=Math.min(e+t,Zt),f=e+1,h=e-1,d=1;fu;)l=a[d++],fu&&((s=r[h--])[0]-=l*(s[0]-n)/ee,s[1]-=l*(s[1]-o)/ee,s[2]-=l*(s[2]-i)/ee)}function u(t,e,n){var a,s,l,u,c,f=2147483647,h=f,d=-1,g=d;for(a=0;a>12))>10,i[a]-=c,o[a]+=c<<10;return i[d]+=64,o[d]-=65536,g}this.buildColormap=function(){!function(){var t,e;for(r=[],n=new Int32Array(256),o=new Int32Array(Zt),i=new Int32Array(Zt),a=new Int32Array(32),t=0;t>6;for(y<=1&&(y=0),r=0;r=h&&(b-=h),0===p&&(p=1),++r%p===0)for(v-=v/d,(y=(m-=m/30)>>6)<=1&&(y=0),f=0;f>=4,r[t][1]>>=4,r[t][2]>>=4,r[t][3]=t}(),function(){var t,e,o,i,a,s,l=0,u=0;for(t=0;t>1,e=l+1;e>1,e=l+1;e<256;e++)n[e]=255}()},this.getColormap=function(){for(var t=[],e=[],n=0;n=0;)c=l?c=Zt:(c++,s<0&&(s=-s),(i=a[0]-t)<0&&(i=-i),(s+=i)=0&&((s=e-(a=r[f])[1])>=l?f=-1:(f--,s<0&&(s=-s),(i=a[0]-t)<0&&(i=-i),(s+=i)=254&&x(e)}function k(t){C(ne),y=l+2,b=!0,B(l,t)}function C(t){for(var e=0;e0&&(t.writeByte(i),t.writeBytes(g,0,i),i=0)}function A(t){return(1<0?o|=t<=8;)w(255&o,e),o>>=8,m-=8;if((y>a||b)&&(b?(a=A(h=s),b=!1):(++h,a=12==h?4096:A(h))),t==u){for(;m>0;)w(255&o,e),o>>=8,m-=8;x(e)}}this.encode=function(r){r.writeByte(d),c=t*e,f=0,function(t,e){var r,n,o,c,f,d,g;for(b=!1,a=A(h=s=t),u=1+(l=1<=0){f=d-o,0===o&&(f=1);do{if((o-=f)<0&&(o+=d),p[o]===r){c=v[o];continue t}}while(p[o]>=0)}B(c,e),c=n,y<4096?(v[o]=y++,p[o]=r):k(e)}else c=v[o];B(c,e),B(u,e)}(d+1,r),r.writeByte(0)}}function ae(){this.page=-1,this.pages=[],this.newPage()}ae.pageSize=4096,ae.charMap={};for(var se=0;se<256;se++)ae.charMap[se]=String.fromCharCode(se);function le(t,e){this.width=~~t,this.height=~~e,this.transparent=null,this.transIndex=0,this.repeat=-1,this.delay=0,this.image=null,this.pixels=null,this.indexedPixels=null,this.colorDepth=null,this.colorTab=null,this.neuQuant=null,this.usedEntry=new Array,this.palSize=7,this.dispose=-1,this.firstFrame=!0,this.sample=10,this.dither=!1,this.globalPalette=!1,this.out=new ae}ae.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(ae.pageSize),this.cursor=0},ae.prototype.getData=function(){for(var t="",e=0;e=ae.pageSize&&this.newPage(),this.pages[this.page][this.cursor++]=t},ae.prototype.writeUTFBytes=function(t){for(var e=t.length,r=0;r=0&&(this.dispose=t)},le.prototype.setRepeat=function(t){this.repeat=t},le.prototype.setTransparent=function(t){this.transparent=t},le.prototype.addFrame=function(t){this.image=t,this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null,this.getImagePixels(),this.analyzePixels(),!0===this.globalPalette&&(this.globalPalette=this.colorTab),this.firstFrame&&(this.writeHeader(),this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.globalPalette||this.writePalette(),this.writePixels(),this.firstFrame=!1},le.prototype.finish=function(){this.out.writeByte(59)},le.prototype.setQuality=function(t){t<1&&(t=1),this.sample=t},le.prototype.setDither=function(t){!0===t&&(t="FloydSteinberg"),this.dither=t},le.prototype.setGlobalPalette=function(t){this.globalPalette=t},le.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette},le.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")},le.prototype.analyzePixels=function(){this.colorTab||(this.neuQuant=new re(this.pixels,this.sample),this.neuQuant.buildColormap(),this.colorTab=this.neuQuant.getColormap()),this.dither?this.ditherPixels(this.dither.replace("-serpentine",""),null!==this.dither.match(/-serpentine/)):this.indexPixels(),this.pixels=null,this.colorDepth=8,this.palSize=7,null!==this.transparent&&(this.transIndex=this.findClosest(this.transparent,!0))},le.prototype.indexPixels=function(t){var e=this.pixels.length/3;this.indexedPixels=new Uint8Array(e);for(var r=0,n=0;n=0&&k+c=0&&C+u>16,(65280&t)>>8,255&t,e)},le.prototype.findClosestRGB=function(t,e,r,n){if(null===this.colorTab)return-1;if(this.neuQuant&&!n)return this.neuQuant.lookupRGB(t,e,r);for(var o=0,i=16777216,a=this.colorTab.length,s=0,l=0;s=0&&(e=7&this.dispose),e<<=2,this.out.writeByte(0|e|t),this.writeShort(this.delay),this.out.writeByte(this.transIndex),this.out.writeByte(0)},le.prototype.writeImageDesc=function(){this.out.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame||this.globalPalette?this.out.writeByte(0):this.out.writeByte(128|this.palSize)},le.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.out.writeByte(240|this.palSize),this.out.writeByte(0),this.out.writeByte(0)},le.prototype.writeNetscapeExt=function(){this.out.writeByte(33),this.out.writeByte(255),this.out.writeByte(11),this.out.writeUTFBytes("NETSCAPE2.0"),this.out.writeByte(3),this.out.writeByte(1),this.writeShort(this.repeat),this.out.writeByte(0)},le.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);for(var t=768-this.colorTab.length,e=0;e>8&255)},le.prototype.writePixels=function(){new ie(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this.out)},le.prototype.stream=function(){return this.out};var ue=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function a(t){try{l(n.next(t))}catch(e){i(e)}}function s(t){try{l(n.throw(t))}catch(e){i(e)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(a,s)}l((n=n.apply(t,e||[])).next())})},ce=wt.Canvas,fe=.4;function he(t){if(t)return new Promise(function(r,n){if("data"==t.slice(0,4)){var o=new Image;return o.onload=function(){r(o),e(o)},o.onerror=function(){n("Image load error"),e(o)},void(o.src=t)}var i=new Image;i.setAttribute("crossOrigin","Anonymous"),i.onload=function(){r(i)},i.onerror=function(){n("Image load error")},i.src=t});function e(t){t.onload=null,t.onerror=null}}var de=function(){function t(e){u(this,t);var r=Object.assign({},e);if(Object.keys(t.defaultOptions).forEach(function(e){e in r||Object.defineProperty(r,e,{value:t.defaultOptions[e],enumerable:!0,writable:!0})}),r.components?"object"===d(r.components)&&Object.keys(t.defaultComponentOptions).forEach(function(e){e in r.components?Object.defineProperty(r.components,e,{value:Object.assign(Object.assign({},t.defaultComponentOptions[e]),r.components[e]),enumerable:!0,writable:!0}):Object.defineProperty(r.components,e,{value:t.defaultComponentOptions[e],enumerable:!0,writable:!0})}):r.components=t.defaultComponentOptions,null!==r.dotScale&&void 0!==r.dotScale){if(r.dotScale<=0||r.dotScale>1)throw new Error("dotScale should be in range (0, 1].");r.components.data.scale=r.dotScale,r.components.timing.scale=r.dotScale,r.components.alignment.scale=r.dotScale}this.options=r,this.canvas=new ce(e.size,e.size),this.canvasContext=this.canvas.getContext("2d"),this.qrCode=new Ht(-1,this.options.correctLevel),Number.isInteger(this.options.maskPattern)&&(this.qrCode.maskPattern=this.options.maskPattern),Number.isInteger(this.options.version)&&(this.qrCode.typeNumber=this.options.version),this.qrCode.addData(this.options.text),this.qrCode.make()}return f(t,[{key:"draw",value:function(){var t=this;return new Promise(function(e){return t._draw().then(e)})}},{key:"_clear",value:function(){this.canvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}},{key:"_draw",value:function(){var e,r,n,i,a,s,l,u,c,f,h,d,g,p,v,m,y,b,w;return ue(this,void 0,void 0,o().m(function k(){var C,x,A,P,B,S,D,T,E,_,R,I,L,O,M,j,N,U,z,F,G,H,q,Q,K,V,X,$,W,Y,J,Z,tt,et,rt,nt,ot,it,at,st,lt,ut,ct,ft,ht,dt,gt,pt,vt,mt,yt,bt,wt,kt,Ct,xt,At,Pt,Bt,St,Dt,Tt,Et,_t,Rt,It,Lt,Ot,Mt,jt,Ut,Ft;return o().w(function(o){for(;;)switch(o.n){case 0:if(C=null===(e=this.qrCode)||void 0===e?void 0:e.moduleCount,x=this.options.size,((A=this.options.margin)<0||2*A>=x)&&(A=0),P=Math.ceil(A),B=x-2*A,S=this.options.whiteMargin,D=this.options.backgroundDimming,T=Math.ceil(B/C),R=new ce(_=(E=T*C)+2*P,_),I=R.getContext("2d"),this._clear(),I.save(),I.translate(P,P),L=new ce(_,_),O=L.getContext("2d"),M=null,j=[],!this.options.gifBackground){o.n=7;break}if(N=Nt(this.options.gifBackground),M=N,j=zt(N),!this.options.autoColor){o.n=6;break}U=0,z=0,F=0,G=0,H=0;case 1:if(!(H200||q[1]>200||q[2]>200)){o.n=2;break}return o.a(3,4);case 2:if(0!==q[0]||0!==q[1]||0!==q[2]){o.n=3;break}return o.a(3,4);case 3:G++,U+=q[0],z+=q[1],F+=q[2];case 4:H++,o.n=1;break;case 5:U=~~(U/G),z=~~(z/G),F=~~(F/G),this.options.colorDark="rgb(".concat(U,",").concat(z,",").concat(F,")");case 6:o.n=10;break;case 7:if(!this.options.backgroundImage){o.n=9;break}return o.n=8,he(this.options.backgroundImage);case 8:Q=o.v,this.options.autoColor&&(K=t._getAverageRGB(Q),this.options.colorDark="rgb(".concat(K.r,",").concat(K.g,",").concat(K.b,")")),O.drawImage(Q,0,0,Q.width,Q.height,0,0,_,_),O.rect(0,0,_,_),O.fillStyle=D,O.fill(),o.n=10;break;case 9:O.rect(0,0,_,_),O.fillStyle=this.options.colorLight,O.fill();case 10:for(V=Vt.getPatternPosition(this.qrCode.typeNumber),X=(null===(n=null===(r=this.options.components)||void 0===r?void 0:r.data)||void 0===n?void 0:n.scale)||fe,$=.5*(1-X),W=0;W=8&&Y<=C-8||6==Y&&W>=8&&W<=C-8,tt=Y<8&&(W<8||W>=C-8)||Y>=C-8&&W<8||Z,et=1;et=V[et]-2&&W<=V[et]+2&&Y>=V[et]-2&&Y<=V[et]+2;rt=Y*T+(tt?0:$*T),nt=W*T+(tt?0:$*T),I.strokeStyle=J?this.options.colorDark:this.options.colorLight,I.lineWidth=.5,I.fillStyle=J?this.options.colorDark:this.options.colorLight,0===V.length?tt||I.fillRect(rt,nt,(tt?1:X)*T,(tt?1:X)*T):(ot=Y=C-4-5&&W=C-4-5,tt||ot||I.fillRect(rt,nt,(tt?1:X)*T,(tt?1:X)*T))}if(it=V[V.length-1],at=this.options.colorLight,I.fillStyle=at,I.fillRect(0,0,8*T,8*T),I.fillRect(0,(C-8)*T,8*T,8*T),I.fillRect((C-8)*T,0,8*T,8*T),(null===(a=null===(i=this.options.components)||void 0===i?void 0:i.timing)||void 0===a?void 0:a.protectors)&&(I.fillRect(8*T,6*T,(C-8-8)*T,T),I.fillRect(6*T,8*T,T,(C-8-8)*T)),(null===(l=null===(s=this.options.components)||void 0===s?void 0:s.cornerAlignment)||void 0===l?void 0:l.protectors)&&t._drawAlignProtector(I,it,it,T),!(null===(c=null===(u=this.options.components)||void 0===u?void 0:u.alignment)||void 0===c?void 0:c.protectors)){o.n=18;break}st=0;case 11:if(!(st=1)&&(xt=.2),At<0&&(At=0),Pt<0&&(Pt=0),Dt=St=.5*(_-(Bt=E*xt)),I.restore(),I.fillStyle=this.options.logoBackgroundColor,I.save(),t._prepareRoundedCornerClip(I,St-At,Dt-At,Bt+2*At,Bt+2*At,Pt+At),I.clip(),Tt=I.globalCompositeOperation,I.globalCompositeOperation="destination-out",I.fill(),I.globalCompositeOperation=Tt,I.restore(),I.save(),t._prepareRoundedCornerClip(I,St,Dt,Bt,Bt,Pt),I.clip(),I.drawImage(Ct,St,Dt,Bt,Bt),I.restore(),I.save(),I.translate(P,P);case 28:if(!M){o.n=31;break}if(j.forEach(function(t){Et||((Et=new le(x,x)).setDelay(t.delay),Et.setRepeat(0));var e=t.dims,r=e.width,n=e.height;_t||(_t=new ce(r,n),(Rt=_t.getContext("2d")).rect(0,0,_t.width,_t.height),Rt.fillStyle="#ffffff",Rt.fill()),It&&Ot&&r===It.width&&n===It.height||(It=new ce(r,n),Lt=It.getContext("2d"),Ot=Lt.createImageData(r,n)),Ot.data.set(t.patch),Lt.putImageData(Ot,0,0),Rt.drawImage(It.getContext("2d").canvas,t.dims.left,t.dims.top);var o=new ce(_,_),i=o.getContext("2d");i.drawImage(_t.getContext("2d").canvas,0,0,_,_),i.rect(0,0,_,_),i.fillStyle=D,i.fill(),i.drawImage(R.getContext("2d").canvas,0,0,_,_);var a=new ce(x,x),s=a.getContext("2d");s.drawImage(o.getContext("2d").canvas,0,0,x,x),Et.addFrame(s.getImageData(0,0,a.width,a.height).data)}),Et){o.n=29;break}throw new Error("No frames.");case 29:if(Et.finish(),!ge(this.canvas)){o.n=30;break}return Mt=Et.stream().toFlattenUint8Array(),jt=Mt.reduce(function(t,e){return t+String.fromCharCode(e)},""),o.a(2,Promise.resolve("data:image/gif;base64,".concat(window.btoa(jt))));case 30:return o.a(2,Promise.resolve(Buffer.from(Et.stream().toFlattenUint8Array())));case 31:if(O.drawImage(R.getContext("2d").canvas,0,0,_,_),I.drawImage(L.getContext("2d").canvas,-P,-P,_,_),Ut=new ce(x,x),Ut.getContext("2d").drawImage(R.getContext("2d").canvas,0,0,x,x),this.canvas=Ut,Ft=this.options.gifBackground?"gif":"png",!ge(this.canvas)){o.n=32;break}return o.a(2,Promise.resolve(this.canvas.toDataURL(Ft)));case 32:return o.a(2,Promise.resolve(this.canvas.toBuffer(Ft)));case 33:return o.a(2)}},k,this)}))}}],[{key:"_prepareRoundedCornerClip",value:function(t,e,r,n,o,i){t.beginPath(),t.moveTo(e,r),t.arcTo(e+n,r,e+n,r+o,i),t.arcTo(e+n,r+o,e,r+o,i),t.arcTo(e,r+o,e,r,i),t.arcTo(e,r,e+n,r,i),t.closePath()}},{key:"_getAverageRGB",value:function(t){var e,r,n={r:0,g:0,b:0},o=-4,i={r:0,g:0,b:0},a=0;r=t.naturalHeight||t.height,e=t.naturalWidth||t.width;var s,l=new ce(e,r).getContext("2d");if(!l)return n;l.drawImage(t,0,0);try{s=l.getImageData(0,0,e,r)}catch(u){return n}for(;(o+=20)200||s.data[o+1]>200||s.data[o+2]>200||(++a,i.r+=s.data[o],i.g+=s.data[o+1],i.b+=s.data[o+2]);return i.r=~~(i.r/a),i.g=~~(i.g/a),i.b=~~(i.b/a),i}},{key:"_drawDot",value:function(t,e,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;t.fillRect((e+o)*n,(r+o)*n,i*n,i*n)}},{key:"_drawAlignProtector",value:function(t,e,r,n){t.clearRect((e-2)*n,(r-2)*n,5*n,5*n),t.fillRect((e-2)*n,(r-2)*n,5*n,5*n)}},{key:"_drawAlign",value:function(e,r,n,o){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,s=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0,u=e.fillStyle;e.fillStyle=s,new Array(4).fill(0).map(function(s,l){t._drawDot(e,r-2+l,n-2,o,i,a),t._drawDot(e,r+2,n-2+l,o,i,a),t._drawDot(e,r+2-l,n+2,o,i,a),t._drawDot(e,r-2,n+2-l,o,i,a)}),t._drawDot(e,r,n,o,i,a),l||(e.fillStyle="rgba(255, 255, 255, 0.6)",new Array(2).fill(0).map(function(s,l){t._drawDot(e,r-1+l,n-1,o,i,a),t._drawDot(e,r+1,n-1+l,o,i,a),t._drawDot(e,r+1-l,n+1,o,i,a),t._drawDot(e,r-1,n+1-l,o,i,a)})),e.fillStyle=u}}])}();function ge(t){try{return t instanceof HTMLElement}catch(e){return"object"===d(t)&&1===t.nodeType&&"object"===d(t.style)&&"object"===d(t.ownerDocument)}}de.CorrectLevel=qt,de.defaultComponentOptions={data:{scale:.4},timing:{scale:.5,protectors:!1},alignment:{scale:.5,protectors:!1},cornerAlignment:{scale:.5,protectors:!0}},de.defaultOptions={text:"",size:400,margin:20,colorDark:"#000000",colorLight:"rgba(255, 255, 255, 0.6)",correctLevel:qt.M,backgroundImage:void 0,backgroundDimming:"rgba(0,0,0,0)",logoImage:void 0,logoScale:.2,logoMargin:4,logoCornerRadius:8,whiteMargin:!0,components:de.defaultComponentOptions,autoColor:!0,logoBackgroundColor:"#ffffff",backgroundColor:"#ffffff"};var pe={props:{text:{type:String,required:!0},qid:{type:String},correctLevel:{type:Number,default:1},size:{type:Number,default:200},margin:{type:Number,default:20},colorDark:{type:String,default:"#000000"},colorLight:{type:String,default:"#FFFFFF"},bgSrc:{type:String,default:void 0},background:{type:String,default:"rgba(0,0,0,0)"},backgroundDimming:{type:String,default:"rgba(0,0,0,0)"},logoSrc:{type:String,default:void 0},logoBackgroundColor:{type:String,default:"rgba(255,255,255,1)"},gifBgSrc:{type:String,default:void 0},logoScale:{type:Number,default:.2},logoMargin:{type:Number,default:0},logoCornerRadius:{type:Number,default:8},whiteMargin:{type:[Boolean,String],default:!0},dotScale:{type:Number,default:1},autoColor:{type:[Boolean,String],default:!0},binarize:{type:[Boolean,String],default:!1},binarizeThreshold:{type:Number,default:128},callback:{type:Function,default:function(){}},bindElement:{type:Boolean,default:!0},backgroundColor:{type:String,default:"#FFFFFF"},components:{default:function(){return{data:{scale:1},timing:{scale:1,protectors:!1},alignment:{scale:1,protectors:!1},cornerAlignment:{scale:1,protectors:!0}}}}},name:"vue-qr",data:function(){return{imgUrl:""}},watch:{$props:{deep:!0,handler:function(){this.main()}}},mounted:function(){this.main()},methods:{main:function(){var t=this;return s(o().m(function e(){var r,n,i,a;return o().w(function(e){for(;;)switch(e.n){case 0:if(!t.gifBgSrc){e.n=2;break}return e.n=1,J(t.gifBgSrc);case 1:return r=e.v,n=t.logoSrc,t.render(void 0,n,r),e.a(2);case 2:i=t.bgSrc,a=t.logoSrc,t.render(i,a);case 3:return e.a(2)}},e)}))()},render:function(t,e,r){var n=this;return s(o().m(function i(){var a;return o().w(function(o){for(;;)switch(o.n){case 0:new de({gifBackground:r,text:(a=n).text,size:a.size,margin:a.margin,colorDark:a.colorDark,colorLight:a.colorLight,backgroundColor:a.backgroundColor,backgroundImage:t,backgroundDimming:a.backgroundDimming,logoImage:e,logoScale:a.logoScale,logoBackgroundColor:a.logoBackgroundColor,correctLevel:a.correctLevel,logoMargin:a.logoMargin,logoCornerRadius:a.logoCornerRadius,whiteMargin:Y(a.whiteMargin),dotScale:a.dotScale,autoColor:Y(a.autoColor),binarize:Y(a.binarize),binarizeThreshold:a.binarizeThreshold,components:a.components}).draw().then(function(t){n.imgUrl=t,a.callback&&a.callback(t,a.qid)});case 1:return o.a(2)}},i)}))()}}},ve=["src"];var me=c(pe,[["render",function(t,e,r,n,o,i){return r.bindElement?(m(),v("img",{key:0,style:{display:"inline-block"},src:o.imgUrl},null,8,ve)):j("",!0)}]]),ye={class:"m-2"},be={class:"dialog-footer"};t("a",Object.assign({name:"QRCodeUpload"},{__name:"QR-code",props:{classId:{type:Number,default:0}},emits:["on-success"],setup:function(t,e){var r=e.emit,n=t,o=P(!1),i=h(),a=P(""),s=function(){var t=window.location;a.value=t.protocol+"//"+t.host+"/#/scanUpload?id="+n.classId+"&token="+i.token+"&t="+Date.now(),o.value=!0},l=function(){o.value=!1,a.value="",r("on-success","")};return function(t,e){var r=p("el-button"),n=p("el-dialog");return m(),v(R,null,[S("div",null,[y(r,{type:"primary",icon:"iphone",onClick:s},{default:b(function(){return g(e[2]||(e[2]=[C(" 扫码上传",-1)]))}),_:1})]),y(n,{modelValue:o.value,"onUpdate:modelValue":e[1]||(e[1]=function(t){return o.value=t}),title:"扫码上传",width:"320px","show-close":!1,"append-to-body":"","close-on-click-modal":!1,draggable:""},{footer:b(function(){return[S("div",be,[y(r,{onClick:e[0]||(e[0]=function(t){return o.value=!1})},{default:b(function(){return g(e[3]||(e[3]=[C("取 消",-1)]))}),_:1}),y(r,{type:"primary",onClick:l},{default:b(function(){return g(e[4]||(e[4]=[C("完成上传",-1)]))}),_:1})])]}),default:b(function(){return[S("div",ye,[y(me,{logoSrc:w("/assets/logo.DAivSsrL.png"),size:291,margin:0,autoColor:!0,dotScale:1,text:a.value,colorDark:"green",colorLight:"white",ref:"qrcode"},null,8,["logoSrc","text"])])]}),_:1},8,["modelValue"])],64)}}}))}}})}();