var Nt=Object.defineProperty,Ct=Object.defineProperties;var Gt=Object.getOwnPropertyDescriptors;var Ve=Object.getOwnPropertySymbols;var Ft=Object.prototype.hasOwnProperty,Ht=Object.prototype.propertyIsEnumerable;var qe=(t,e,r)=>e in t?Nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Je=(t,e)=>{for(var r in e||(e={}))Ft.call(e,r)&&qe(t,r,e[r]);if(Ve)for(var r of Ve(e))Ht.call(e,r)&&qe(t,r,e[r]);return t},We=(t,e)=>Ct(t,Gt(e));import{W as Xt,d as dt,a as zt,m as Ut,b as Vt,X as qt,f as de,Z as Jt,k as Qe,i as b,w as m,e as X,g as Wt,h as z,F as Qt,l as Yt,u as Zt}from"./index-CV7M57fm.js";var se={},W={},l={};Object.defineProperty(l,"__esModule",{value:!0});function Kt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var en=function t(e,r){Kt(this,t),this.data=e,this.text=r.text||e,this.options=r};l.default=en;Object.defineProperty(W,"__esModule",{value:!0});W.CODE39=void 0;var tn=function(){function t(e,r){for(var n=0;n=200){u=n.shift()-105;var d=h.SWAP[u];d!==void 0?o=e.next(n,a+1,d):((i===h.SET_A||i===h.SET_B)&&u===h.SHIFT&&(n[0]=i===h.SET_A?n[0]>95?n[0]-96:n[0]:n[0]<32?n[0]+96:n[0]),o=e.next(n,a+1,i))}else u=e.correctIndex(n,i),o=e.next(n,a+1,i);var g=e.getBar(u),Lt=u*a;return{result:g+o.result,checksum:Lt+o.checksum}}}]),e}(On.default);M.default=$n;var pe={};Object.defineProperty(pe,"__esModule",{value:!0});var O=f,pt=function(e){return e.match(new RegExp("^"+O.A_CHARS+"*"))[0].length},gt=function(e){return e.match(new RegExp("^"+O.B_CHARS+"*"))[0].length},Ot=function(e){return e.match(new RegExp("^"+O.C_CHARS+"*"))[0]};function ge(t,e){var r=e?O.A_CHARS:O.B_CHARS,n=t.match(new RegExp("^("+r+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(n)return n[1]+"Ì"+Et(t.substring(n[1].length));var a=t.match(new RegExp("^"+r+"+"))[0];return a.length===t.length?t:a+String.fromCharCode(e?205:206)+ge(t.substring(a.length),!e)}function Et(t){var e=Ot(t),r=e.length;if(r===t.length)return t;t=t.substring(r);var n=pt(t)>=gt(t);return e+String.fromCharCode(n?206:205)+ge(t,n)}pe.default=function(t){var e=void 0,r=Ot(t).length;if(r>=2)e=O.C_START_CHAR+Et(t);else{var n=pt(t)>gt(t);e=(n?O.A_START_CHAR:O.B_START_CHAR)+ge(t,n)}return e.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(a,i){return"Ë"+i})};Object.defineProperty(ye,"__esModule",{value:!0});var xn=M,Sn=bt(xn),Rn=pe,An=bt(Rn);function bt(t){return t&&t.__esModule?t:{default:t}}function Pn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ue(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:t}function Tn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var Mn=function(t){Tn(e,t);function e(r,n){if(Pn(this,e),/^[\x00-\x7F\xC8-\xD3]+$/.test(r))var a=ue(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,(0,An.default)(r),n));else var a=ue(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,r,n));return ue(a)}return e}(Sn.default);ye.default=Mn;var Oe={};Object.defineProperty(Oe,"__esModule",{value:!0});var kn=function(){function t(e,r){for(var n=0;nn.width*10?n.width*10:n.fontSize,a.guardHeight=n.height+a.fontSize/2+n.textMargin,a}return hr(e,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(n,a){return this.text.substr(n,a)}},{key:"leftEncode",value:function(n,a){return(0,et.default)(n,a)}},{key:"rightText",value:function(n,a){return this.text.substr(n,a)}},{key:"rightEncode",value:function(n,a){return(0,et.default)(n,a)}},{key:"encodeGuarded",value:function(){var n={fontSize:this.fontSize},a={height:this.guardHeight};return[{data:R.SIDE_BIN,options:a},{data:this.leftEncode(),text:this.leftText(),options:n},{data:R.MIDDLE_BIN,options:a},{data:this.rightEncode(),text:this.rightText(),options:n},{data:R.SIDE_BIN,options:a}]}},{key:"encodeFlat",value:function(){var n=[R.SIDE_BIN,this.leftEncode(),R.MIDDLE_BIN,this.rightEncode(),R.SIDE_BIN];return{data:n.join(""),text:this.text}}}]),e}(sr.default);Y.default=Or;Object.defineProperty(me,"__esModule",{value:!0});var Er=function(){function t(e,r){for(var n=0;nn.width*10?a.fontSize=n.width*10:a.fontSize=n.fontSize,a.guardHeight=n.height+a.fontSize/2+n.textMargin,a}return aa(e,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==he(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var n="";return n+="101",n+=(0,A.default)(this.data.substr(0,6),"LLLLLL"),n+="01010",n+=(0,A.default)(this.data.substr(6,6),"RRRRRR"),n+="101",{data:n,text:this.text}}},{key:"guardedEncoding",value:function(){var n=[];return this.displayValue&&n.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),n.push({data:"101"+(0,A.default)(this.data[0],"L"),options:{height:this.guardHeight}}),n.push({data:(0,A.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),n.push({data:"01010",options:{height:this.guardHeight}}),n.push({data:(0,A.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),n.push({data:(0,A.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&n.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),n}}]),e}(ua.default);function he(t){var e=0,r;for(r=1;r<11;r+=2)e+=parseInt(t[r]);for(r=0;r<11;r+=2)e+=parseInt(t[r])*3;return(10-e%10)%10}C.default=da;var Se={};Object.defineProperty(Se,"__esModule",{value:!0});var ha=function(){function t(e,r){for(var n=0;nn.width*10?a.fontSize=n.width*10:a.fontSize=n.fontSize,a.guardHeight=n.height+a.fontSize/2+n.textMargin,a}return ha(e,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var n="";return n+="101",n+=this.encodeMiddleDigits(),n+="010101",{data:n,text:this.text}}},{key:"guardedEncoding",value:function(){var n=[];return this.displayValue&&n.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),n.push({data:"101",options:{height:this.guardHeight}}),n.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),n.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&n.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),n}},{key:"encodeMiddleDigits",value:function(){var n=this.upcA[0],a=this.upcA[this.upcA.length-1],i=ba[parseInt(a)][parseInt(n)];return(0,va.default)(this.middleDigits,i)}}]),e}(ya.default);function rt(t,e){for(var r=parseInt(t[t.length-1]),n=Ea[r],a="",i=0,o=0;o=3&&this.number<=131070}}]),e}(eo.default);K.pharmacode=io;var ee={};Object.defineProperty(ee,"__esModule",{value:!0});ee.codabar=void 0;var oo=function(){function t(e,r){for(var n=0;n0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function Tt(t,e,r){if(r.displayValue&&ee&&(e=t[r].height);return e}function Ho(t,e,r){var n;if(r)n=r;else if(typeof document!="undefined")n=document.createElement("canvas").getContext("2d");else return 0;n.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var a=n.measureText(t);if(!a)return 0;var i=a.width;return i}_.getMaximumHeightOfEncodings=Fo;_.getEncodingHeight=Pt;_.getBarcodePadding=Tt;_.calculateEncodingAttributes=Co;_.getTotalWidthOfEncodings=Go;Object.defineProperty(Le,"__esModule",{value:!0});var Xo=function(){function t(e,r){for(var n=0;n0?(o=0,a.textAlign="left"):r.textAlign=="right"?(o=n.width-1,a.textAlign="right"):(o=n.width/2,a.textAlign="center"),a.fillText(n.text,o,u)}}},{key:"moveCanvasDrawing",value:function(r){var n=this.canvas.getContext("2d");n.translate(r.width,0)}},{key:"restoreCanvas",value:function(){var r=this.canvas.getContext("2d");r.restore()}}]),t}();Le.default=Jo;var Ne={};Object.defineProperty(Ne,"__esModule",{value:!0});var Wo=function(){function t(e,r){for(var n=0;n0&&(this.drawRect(d-n.width*u,o,n.width*u,n.height,r),u=0);u>0&&this.drawRect(d-n.width*(u-1),o,n.width*u,n.height,r)}},{key:"drawSVGText",value:function(r,n,a){var i=this.document.createElementNS(J,"text");if(n.displayValue){var o,u;i.setAttribute("style","font:"+n.fontOptions+" "+n.fontSize+"px "+n.font),n.textPosition=="top"?u=n.fontSize-n.textMargin:u=n.height+n.textMargin+n.fontSize,n.textAlign=="left"||a.barcodePadding>0?(o=0,i.setAttribute("text-anchor","start")):n.textAlign=="right"?(o=a.width-1,i.setAttribute("text-anchor","end")):(o=a.width/2,i.setAttribute("text-anchor","middle")),i.setAttribute("x",o),i.setAttribute("y",u),i.appendChild(this.document.createTextNode(a.text)),r.appendChild(i)}}},{key:"setSvgAttributes",value:function(r,n){var a=this.svg;a.setAttribute("width",r+"px"),a.setAttribute("height",n+"px"),a.setAttribute("x","0px"),a.setAttribute("y","0px"),a.setAttribute("viewBox","0 0 "+r+" "+n),a.setAttribute("xmlns",J),a.setAttribute("version","1.1"),a.setAttribute("style","transform: translate(0,0)")}},{key:"createGroup",value:function(r,n,a){var i=this.document.createElementNS(J,"g");return i.setAttribute("transform","translate("+r+", "+n+")"),a.appendChild(i),i}},{key:"setGroupOptions",value:function(r,n){r.setAttribute("style","fill:"+n.lineColor+";")}},{key:"drawRect",value:function(r,n,a,i,o){var u=this.document.createElementNS(J,"rect");return u.setAttribute("x",r),u.setAttribute("y",n),u.setAttribute("width",a),u.setAttribute("height",i),o.appendChild(u),u}}]),t}();Ne.default=eu;var Ce={};Object.defineProperty(Ce,"__esModule",{value:!0});var tu=function(){function t(e,r){for(var n=0;n{const n=We(Je({},e.options),{format:e.type});Bu(r.value,e.text,n)}),(n,a)=>(de(),Vt(qt(t.tag),{ref_key:"wrapEl",ref:r},null,512))}}),Lu=Jt(ju),Nu={class:"font-medium"},Fu=dt({name:"BarCode",__name:"barcode",setup(t){const e=[{text:"CODE128",type:"CODE128",options:{}},{text:"CODE39",type:"CODE39",options:{lineColor:"#990000"}},{text:"123456",type:"pharmacode",options:{background:"#eee",width:5}}];return(r,n)=>{const a=X("el-link"),i=X("el-card"),o=X("el-col"),u=X("el-row");return de(),Qe("div",null,[b(i,{shadow:"never"},{header:m(()=>[Wt("div",Nu,[z(" 条形码(基于 "),b(a,{href:"https://lindell.me/JsBarcode/",target:"_blank",style:{margin:"0 5px 4px 0","font-size":"16px"}},{default:m(()=>[z(" JsBarcode ")]),_:1}),z(" 生成) ")]),b(a,{class:"mt-2",href:"https://github.com/pure-admin/vue-pure-admin/blob/main/src/views/able/barcode.vue",target:"_blank"},{default:m(()=>[z(" 代码位置 src/views/able/barcode.vue ")]),_:1})]),default:m(()=>[b(u,{gutter:12},{default:m(()=>[(de(),Qe(Qt,null,Yt(e,(d,g)=>b(o,{key:g,xs:24,sm:24,md:12,lg:8,xl:8},{default:m(()=>[b(i,{shadow:"hover",class:"flex justify-center"},{default:m(()=>[b(Zt(Lu),{text:d.text,type:d.type,options:d.options},null,8,["text","type","options"])]),_:2},1024)]),_:2},1024)),64))]),_:1})]),_:1})])}}});export{Fu as default};