gerber-to-svg
Advanced tools
Comparing version 0.2.4 to 0.2.5
/* copyright 2014 by mike cousins; shared under the terms of the MIT license. Source code available at github.com/mcous/gerber-to-svg */ | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.gerberToSvg=t()}}(function(){return function t(e,r,i){function o(s,h){if(!r[s]){if(!e[s]){var l="function"==typeof require&&require;if(!h&&l)return l(s,!0);if(n)return n(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var u=r[s]={exports:{}};e[s][0].call(u.exports,function(t){var r=e[s][1][t];return o(r?r:t)},u,u.exports,t,e,r,i)}return r[s].exports}for(var n="function"==typeof require&&require,s=0;s<i.length;s++)o(i[s]);return o}({1:[function(t,e){(function(r){var i,o,n,s;n=t("./obj-to-xml"),o=t("./plotter"),s=t("./svg-coord").factor,i={drill:!1,pretty:!1,object:!1,warnArr:null},e.exports=function(e,h){var l,a,u,c,f,p,d,x,b,m,g,w,y,v,M;null==h&&(h={}),x={};for(p in i)g=i[p],x[p]=g;for(p in h)g=h[p],x[p]=g;if("object"==typeof e){if(null!=e.svg)return n(e,{pretty:x.pretty});throw new Error("non SVG object cannot be converted to an SVG string")}x.drill?(a=t("./drill-reader"),l=t("./drill-parser")):(a=t("./gerber-reader"),l=t("./gerber-parser")),b=new o(e,a,l),d=null,m=null,Array.isArray(x.warnArr)&&(m="undefined"!=typeof window&&null!==window?window:r,null==m.console&&(m.console={}),d=m.console.warn,m.console.warn=function(t){return x.warnArr.push(t.toString())});try{v=b.plot()}catch(k){throw c=k,new Error("Error at line "+b.reader.line+" - "+c.message)}finally{null!=d&&null!=m&&(m.console.warn=d)}b.bbox.xMin>=b.bbox.xMax?(b.bbox.xMin=0,b.bbox.xMax=0,w=0):w=b.bbox.xMax-b.bbox.xMin,b.bbox.yMin>=b.bbox.yMax?(b.bbox.yMin=0,b.bbox.yMax=0,f=0):f=b.bbox.yMax-b.bbox.yMin,y={svg:{xmlns:"http://www.w3.org/2000/svg",version:"1.1","xmlns:xlink":"http://www.w3.org/1999/xlink",width:""+w/s+b.units,height:""+f/s+b.units,viewBox:[b.bbox.xMin,b.bbox.yMin,w,f],_:[]}},M=b.attr;for(u in M)g=M[u],y.svg[u]=g;return b.defs.length&&y.svg._.push({defs:{_:b.defs}}),b.group.g._.length&&y.svg._.push(b.group),x.object?y:n(y,{pretty:x.pretty})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./drill-parser":3,"./drill-reader":4,"./gerber-parser":5,"./gerber-reader":6,"./obj-to-xml":9,"./plotter":11,"./svg-coord":13}],2:[function(t,e){var r;r=t("./svg-coord").get,e.exports=function(t,e){var i,o,n,s,h,l,a,u,c,f,p,d;if(null==t)return{};if(null==e.zero||null==e.places)throw new Error("format undefined");o={},n={},o.x=null!=(h=t.match(/X[+-]?[\d\.]+/))&&null!=(l=h[0])?l.slice(1):void 0,o.y=null!=(a=t.match(/Y[+-]?[\d\.]+/))&&null!=(u=a[0])?u.slice(1):void 0,o.i=null!=(c=t.match(/I[+-]?[\d\.]+/))&&null!=(f=c[0])?f.slice(1):void 0,o.j=null!=(p=t.match(/J[+-]?[\d\.]+/))&&null!=(d=p[0])?d.slice(1):void 0;for(i in o)s=o[i],null!=s&&(n[i]=r(s,e));return n}},{"./svg-coord":13}],3:[function(t,e){var r,i,o,n,s,h,l,a,u,c;u=t("./coord-parser"),a=t("./svg-coord").get,o={"FMAT,1":"M70","FMAT,2":"M72"},s="M71",r="G90",n="G91",c=/[XY]{1,2}/,l="L",h=[2,4],i=function(){function t(){this.format={zero:null,places:null},this.fmat="FMAT,2"}return t.prototype.parseCommand=function(t){var e,i,f,p,d,x,b,m;if(i={},";"===t[0])return i;if("FMAT,1"===t)this.fmat=t;else if("M30"===t||"M00"===t)i.set={done:!0};else if(t===o[this.fmat]||t.match(/INCH/))this.format.places=[2,4],i.set={units:"in"};else if(t===s||t.match(/METRIC/))this.format.places=[3,3],i.set={units:"mm"};else if(t===r)i.set={notation:"abs"};else if(t===n)i.set={notation:"inc"};else if(e=null!=(x=t.match(/T\d+/))?x[0]:void 0){for(;"0"===e[1];)e=e[0]+e.slice(2);(f=null!=(b=t.match(/C[\d\.]+(?=.*$)/))?b[0]:void 0)?(f=f.slice(1),i.tool={},i.tool[e]={dia:a(f,{places:this.format.places})}):i.set={currentTool:e}}if(t.match(/TZ/)?this.format.zero="L":t.match(/LZ/)&&(this.format.zero="T"),t.match(c)){i.op={"do":"flash"},null==this.format.zero&&(this.format.zero=l),null==this.format.places&&(this.format.places=h),m=u(t,this.format);for(p in m)d=m[p],i.op[p]=d}return i},t}(),e.exports=i},{"./coord-parser":2,"./svg-coord":13}],4:[function(t,e){var r;r=function(){function t(t){this.line=0,this.blocks=t.split(/\r?\n/)}return t.prototype.nextBlock=function(){return this.line<this.blocks.length?this.blocks[++this.line-1]:!1},t}(),e.exports=r},{}],5:[function(t,e){var r,i,o,n;o=t("./coord-parser"),i=t("./svg-coord").get,n=/([XYIJ][+-]?\d+){1,4}/g,r=function(){function t(){this.format={zero:null,places:null}}return t.prototype.parseFormat=function(t,e){var r,i,o;if(o="L"===t[2]||"T"===t[2]?t[2]:null,r="A"===t[3]||"I"===t[3]?t[3]:null,"X"===t[4]&&"Y"===t[7]&&t.slice(5,7)===t.slice(8,10)&&t[5]<8&&t[6]<8&&(i=[+t[5],+t[6]]),null==i||null==r||null==o)throw new Error("invalid format specification");return this.format.zero=o,this.format.places=i,null==e.set&&(e.set={}),e.set.notation=r},t.prototype.parseToolDef=function(t,e){var r,o,n,s,h,l,a;for(null==e.tool&&(e.tool={}),r=null!=(l=t.match(/^ADD\d{2,}/))?l[0].slice(2):void 0,a=t.slice(2+r.length).split(","),h=a[0],s=a[1],s=null!=s?s.split("X"):void 0;"0"===r[1];)r=r[0]+r.slice(2);switch(h){case"C":if(s.length>2?o={width:i(s[1],{places:this.format.places}),height:i(s[2],{places:this.format.places})}:s.length>1&&(o={dia:i(s[1],{places:this.format.places})}),e.tool[r]={dia:i(s[0],{places:this.format.places})},null!=o)return e.tool[r].hole=o;break;case"R":case"O":if(s.length>3?o={width:i(s[2],{places:this.format.places}),height:i(s[3],{places:this.format.places})}:s.length>2&&(o={dia:i(s[2],{places:this.format.places})}),e.tool[r]={width:i(s[0],{places:this.format.places}),height:i(s[1],{places:this.format.places})},"O"===h&&(e.tool[r].obround=!0),null!=o)return e.tool[r].hole=o;break;case"P":if(s.length>4?o={width:i(s[3],{places:this.format.places}),height:i(s[4],{places:this.format.places})}:s.length>3&&(o={dia:i(s[3],{places:this.format.places})}),e.tool[r]={dia:i(s[0],{places:this.format.places}),verticies:+s[1]},s.length>2&&(e.tool[r].degrees=+s[2]),null!=o)return e.tool[r].hole=o;break;default:return s=function(){var t,e,r,i;for(r=null!=s?s:[],i=[],t=0,e=r.length;e>t;t++)n=r[t],i.push(+n);return i}(),e.tool[r]={macro:h,mods:s}}},t.prototype.parseCommand=function(t){var e,r,s,h,l,a,u,c,f,p,d,x,b,m,g,w,y,v,M,k,E,q,R,T,B,D,_;if(null==t&&(t={}),r={},p=t.param)for(w=0,y=p.length;y>w;w++)switch(f=p[w],s=f.slice(0,2)){case"FS":this.parseFormat(f,r);break;case"MO":if(x=f.slice(2,4),null==r.set&&(r.set={}),"IN"===x)r.set.units="in";else{if("MM"!==x)throw new Error(""+f+" is an invalid units setting");r.set.units="mm"}break;case"AD":this.parseToolDef(f,r);break;case"AM":return{macro:p};case"LP":if(null==r["new"]&&(r["new"]={}),("D"===f[2]||"C"===f[2])&&(r["new"].layer=f[2]),null==r["new"].layer)throw new Error("invalid level polarity");break;case"SR":if(null==r["new"]&&(r["new"]={}),m=null!=(v=null!=(M=f.match(/X[+-]?[\d\.]+/))?M[0].slice(1):void 0)?v:1,g=null!=(k=null!=(E=f.match(/Y[+-]?[\d\.]+/))?E[0].slice(1):void 0)?k:1,l=null!=(q=f.match(/I[+-]?[\d\.]+/))?q[0].slice(1):void 0,a=null!=(R=f.match(/J[+-]?[\d\.]+/))?R[0].slice(1):void 0,1>m||1>g||m>1&&null==l||0>l||g>1&&null==a||0>a)throw new Error("invalid step repeat");r["new"].sr={x:+m,y:+g},null!=l&&(r["new"].sr.i=i(l,{places:this.format.places})),null!=a&&(r["new"].sr.j=i(a,{places:this.format.places}))}else if(t=t.block){if("M02"===t)return{set:{done:!0}};if("G"===t[0])switch(s=null!=(T=t.slice(1).match(/^\d{1,2}/))?T[0]:void 0){case"4":case"04":return{};case"1":case"01":case"2":case"02":case"3":case"03":s=s[s.length-1],u="1"===s?"i":"2"===s?"cw":"ccw",r.set={mode:u};break;case"36":case"37":r.set={region:"36"===s};break;case"70":case"71":r.set={backupUnits:"70"===s?"in":"mm"};break;case"74":case"75":r.set={quad:"74"===s?"s":"m"}}if(h=o(null!=(B=t.match(n))?B[0]:void 0,this.format),c=(null!=(D=t.match(/D0?[123]$/))?D[0]:void 0)||Object.keys(h).length){null!=c&&(c=c[c.length-1]),c=function(){switch(c){case"1":return"int";case"2":return"move";case"3":return"flash";default:return"last"}}(),r.op={"do":c};for(e in h)b=h[e],r.op[e]=b}else(d=null!=(_=t.match(/D\d+$/))?_[0]:void 0)&&(r.set={currentTool:d})}return r},t}(),e.exports=r},{"./coord-parser":2,"./svg-coord":13}],6:[function(t,e){var r;r=function(){function t(t){this.gerberFile=t,this.line=0,this.charIndex=0,this.end=this.gerberFile.length}return t.prototype.nextBlock=function(){var t,e,r;if(this.index>=this.end)return!1;for(e="",r=!1,0===this.line&&this.line++;!(this.charIndex>=this.end);)if(t=this.gerberFile[this.charIndex++],"%"===t){if(r)return{param:r};r=[]}else if("*"===t){if(!r)return{block:e};r.push(e),e=""}else"\n"===t?this.line++:t>=" "&&"~">=t&&(e+=t);return!1},t.prototype.getLine=function(){return this.line},t}(),e.exports=r},{}],7:[function(t,e){var r,i,o,n,s,h;i=/[\+\-\/xX\(\)]/,r=/[\$\d\.]+/,o=new RegExp("("+i.source+")|("+r.source+")","g"),h=function(t){var e;return e=t.match(o)},n=function(t){return r.test(t)},s=function(t){var e,r,i,o,s,l,a;return a=h(t),r=0,l=function(){return a[r]},e=function(t){return t===l()?r++:void 0},s=function(){var t,r;if(r=l(),e(r),n(r))t={type:"n",val:r};else{if("("!==r)throw new Error(""+r+" is unexpected in an arithmetic string");if(t=i(),")"!==l())throw new Error("expected ')'");e(")")}return t},o=function(){var t,r,i;for(t=s(),i=l();"x"===i||"/"===i||"X"===i;)e(i),"X"===i&&(i="x"),r=s(),t={type:i,left:t,right:r},i=l();return t},(i=function(){var t,r,i;for(t=o(),i=l();"+"===i||"-"===i;)e(i),r=o(),t={type:i,left:t,right:r},i=l();return t})()},e.exports={tokenize:h,isNumber:n,parse:s}},{}],8:[function(t,e){var r,i,o,n,s;n=t("./pad-shapes"),i=t("./macro-calc"),s=t("./unique-id"),o=t("./svg-coord").get,r=function(){function t(t,e){this.modifiers={},this.name=t[0].slice(2),this.blocks=t.slice(1),this.shapes=[],this.masks=[],this.lastExposure=null,this.bbox=[null,null,null,null],this.format={places:e}}return t.prototype.run=function(t,e){var r,i,o,n,h,l,a,u,c,f,p,d,x,b,m,g,w,y,v;for(null==e&&(e=[]),this.lastExposure=null,this.shapes=[],this.masks=[],this.bbox=[null,null,null,null],this.modifiers={},o=c=0,x=e.length;x>c;o=++c)n=e[o],this.modifiers["$"+(o+1)]=n;for(w=this.blocks,f=0,b=w.length;b>f;f++)r=w[f],this.runBlock(r);for(l="tool-"+t+"-pad-"+s(),h=[],y=this.masks,p=0,m=y.length;m>p;p++)n=y[p],h.push(n);if(this.shapes.length>1){for(i={id:l,_:[]},v=this.shapes,d=0,g=v.length;g>d;d++)a=v[d],i._.push(a);h=[{g:i}]}else 1===this.shapes.length&&(u=Object.keys(this.shapes[0])[0],this.shapes[0][u].id=l,h.push(this.shapes[0]));return{pad:h,padId:l,bbox:this.bbox,trace:!1}},t.prototype.runBlock=function(t){var e,r,i,o,n,s,h,l;switch(t[0]){case"$":return o=null!=(l=t.match(/^\$\d+(?=\=)/))?l[0]:void 0,n=t.slice(1+o.length),this.modifiers[o]=this.getNumber(n);case"1":case"2":case"20":case"21":case"22":case"4":case"5":case"6":case"7":for(r=t.split(","),i=s=0,h=r.length;h>s;i=++s)e=r[i],r[i]=this.getNumber(e);return this.primitive(r);default:if("0"!==t[0])throw new Error("'"+t+"' unrecognized tool macro block")}},t.prototype.primitive=function(t){var e,r,i,h,l,a,u,c,f,p,d,x,b,m,g,w,y,v,M,k,E,q,R,T,B,D,_,A,L;switch(l=!1,f=!1,d=null,t[0]){case 1:d=n.circle({dia:o(t[2],this.format),cx:o(t[3],this.format),cy:o(t[4],this.format)}),0===t[1]?l=!0:this.addBbox(d.bbox);break;case 2:case 20:d=n.vector({width:o(t[2],this.format),x1:o(t[3],this.format),y1:o(t[4],this.format),x2:o(t[5],this.format),y2:o(t[6],this.format)}),t[7]&&(d.shape.line.transform="rotate("+t[7]+")"),0===t[1]?l=!0:this.addBbox(d.bbox,t[7]);break;case 21:d=n.rect({cx:o(t[4],this.format),cy:o(t[5],this.format),width:o(t[2],this.format),height:o(t[3],this.format)}),t[6]&&(d.shape.rect.transform="rotate("+t[6]+")"),0===t[1]?l=!0:this.addBbox(d.bbox,t[6]);break;case 22:d=n.lowerLeftRect({x:o(t[4],this.format),y:o(t[5],this.format),width:o(t[2],this.format),height:o(t[3],this.format)}),t[6]&&(d.shape.rect.transform="rotate("+t[6]+")"),0===t[1]?l=!0:this.addBbox(d.bbox,t[6]);break;case 4:for(u=[],r=x=3,R=3+2*t[2];R>=x;r=x+=2)u.push([o(t[r],this.format),o(t[r+1],this.format)]);d=n.outline({points:u}),(c=t[t.length-1])&&(d.shape.polygon.transform="rotate("+c+")"),0===t[1]?l=!0:this.addBbox(d.bbox,t[t.length-1]);break;case 5:if(0!==t[6]&&(0!==t[3]||0!==t[4]))throw new RangeError("polygon center must be 0,0 if rotated in macro");d=n.polygon({cx:o(t[3],this.format),cy:o(t[4],this.format),dia:o(t[5],this.format),verticies:t[2],degrees:t[6]}),0===t[1]?l=!0:this.addBbox(d.bbox);break;case 6:if(0!==t[9]&&(0!==t[1]||0!==t[2]))throw new RangeError("moiré center must be 0,0 if rotated in macro");if(d=n.moire({cx:o(t[1],this.format),cy:o(t[2],this.format),outerDia:o(t[3],this.format),ringThx:o(t[4],this.format),ringGap:o(t[5],this.format),maxRings:t[6],crossThx:o(t[7],this.format),crossLength:o(t[8],this.format)}),t[9])for(T=d.shape,b=0,w=T.length;w>b;b++)p=T[b],null!=p.line&&(p.line.transform="rotate("+t[9]+")");this.addBbox(d.bbox,t[9]);break;case 7:if(0!==t[9]&&(0!==t[1]||0!==t[2]))throw new RangeError("thermal center must be 0,0 if rotated in macro");if(d=n.thermal({cx:o(t[1],this.format),cy:o(t[2],this.format),outerDia:o(t[3],this.format),innerDia:o(t[4],this.format),gap:o(t[5],this.format)}),t[6])for(B=d.shape,m=0,y=B.length;y>m;m++)if(p=B[m],null!=p.mask)for(D=p.mask._,g=0,v=D.length;v>g;g++)h=D[g],null!=h.rect&&(h.rect.transform="rotate("+t[6]+")");this.addBbox(d.bbox,t[6]);break;default:throw new Error(""+t[0]+" is not a valid primitive code")}if(l){for(i in d.shape)d.shape[i].fill="#000";if(0!==this.lastExposure){if(this.lastExposure=0,a="macro-"+this.name+"-mask-"+s(),h={mask:{id:a}},h.mask._=[{rect:{x:this.bbox[0],y:this.bbox[1],width:this.bbox[2]-this.bbox[0],height:this.bbox[3]-this.bbox[1],fill:"#fff"}}],1===this.shapes.length)for(i in this.shapes[0])this.shapes[0][i].mask="url(#"+a+")";else if(this.shapes.length>1){for(e={mask:"url(#"+a+")",_:[]},_=this.shapes,E=0,M=_.length;M>E;E++)p=_[E],e._.push(p);this.shapes=[{g:e}]}this.masks.push(h)}return this.masks[this.masks.length-1].mask._.push(d.shape)}if(this.lastExposure=1,Array.isArray(d.shape)){for(A=d.shape,L=[],q=0,k=A.length;k>q;q++)p=A[q],L.push(null!=p.mask?this.masks.push(p):this.shapes.push(p));return L}return this.shapes.push(d.shape)},t.prototype.addBbox=function(t,e){var r,i,o,n,s,h,l,a,u;if(null==e&&(e=0),e){for(s=Math.sin(e*Math.PI/180),i=Math.cos(e*Math.PI/180),Math.abs(s)<1e-9&&(s=0),Math.abs(i)<1e-9&&(i=0),n=[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]]],a=0,u=n.length;u>a;a++)o=n[a],h=o[0]*i-o[1]*s,l=o[0]*s+o[1]*i,(null===this.bbox[0]||h<this.bbox[0])&&(this.bbox[0]=h),(null===this.bbox[1]||l<this.bbox[1])&&(this.bbox[1]=l),(null===this.bbox[2]||h>this.bbox[2])&&(this.bbox[2]=h),(null===this.bbox[3]||l>this.bbox[3])&&(this.bbox[3]=l);return this.bbox=function(){var t,e,i,o;for(i=this.bbox,o=[],t=0,e=i.length;e>t;t++)r=i[t],o.push(r===-0?0:r);return o}.call(this)}return(null===this.bbox[0]||t[0]<this.bbox[0])&&(this.bbox[0]=t[0]),(null===this.bbox[1]||t[1]<this.bbox[1])&&(this.bbox[1]=t[1]),(null===this.bbox[2]||t[2]>this.bbox[2])&&(this.bbox[2]=t[2]),null===this.bbox[3]||t[3]>this.bbox[3]?this.bbox[3]=t[3]:void 0},t.prototype.getNumber=function(t){return t.match(/^[+-]?[\d.]+$/)?Number(t):t.match(/^\$\d+$/)?Number(this.modifiers[t]):this.evaluate(i.parse(t))},t.prototype.evaluate=function(t){switch(t.type){case"n":return this.getNumber(t.val);case"+":return this.evaluate(t.left)+this.evaluate(t.right);case"-":return this.evaluate(t.left)-this.evaluate(t.right);case"x":return this.evaluate(t.left)*this.evaluate(t.right);case"/":return this.evaluate(t.left)/this.evaluate(t.right)}},t}(),e.exports=r},{"./macro-calc":7,"./pad-shapes":10,"./svg-coord":13,"./unique-id":14}],9:[function(t,e){var r,i,o,n;n=function(t,e){var r;if(r="",0===e)return"";for(;e>1;)1&e&&(r+=t),e>>=1,t+=t;return r+t},r="_",i=" ",o=function(t,e){var s,h,l,a,u,c,f,p,d,x,b,m,g,w,y,v,M,k,E;if(null==e&&(e={}),x=e.pretty,c=null!=(M=e.indent)?M:0,h=null!=(k=e.maxDec)?k:!1,l=function(t){return"number"==typeof t?Number(t.toFixed(h)):t},p=x?"\n":"",b=p?"string"==typeof x?x:i:"",b=n(b,c),w="","function"==typeof t&&(t=t()),Array.isArray(t))for(u=y=0,v=t.length;v>y;u=++y)d=t[u],w+=(0!==u?p:"")+o(d,e);else if("object"==typeof t){if(s=!1,a=Object.keys(t)[0],null!=a){w=""+b+"<"+a,"function"==typeof t[a]&&(t[a]=t[a]()),E=t[a];for(f in E)g=E[f],"function"==typeof g&&(g=g()),f===r?s=g:(Array.isArray(g)&&(h&&(g=function(){var t,e,r;for(r=[],t=0,e=g.length;e>t;t++)m=g[t],r.push(l(m));return r}()),g=g.join(" ")),h&&(g=l(g)),w+=" "+f+'="'+g+'"');s&&(w+=">"+p+o(s,{pretty:x,indent:c+1})),w+=null!=t[a]._?""+p+b+"</"+a+">":"/>"}}else w+=""+t+" ";return w},e.exports=o},{}],10:[function(t,e){var r,i,o,n,s,h,l,a,u;a=t("./unique-id"),r=function(t){var e;if(null==t.dia)throw new Error("circle function requires diameter");if(null==t.cx)throw new Error("circle function requires x center");if(null==t.cy)throw new Error("circle function requires y center");return e=t.dia/2,{shape:{circle:{cx:t.cx,cy:t.cy,r:e}},bbox:[t.cx-e,t.cy-e,t.cx+e,t.cy+e]}},h=function(t){var e,r,i,o;if(null==t.width)throw new Error("rectangle requires width");if(null==t.height)throw new Error("rectangle requires height");if(null==t.cx)throw new Error("rectangle function requires x center");if(null==t.cy)throw new Error("rectangle function requires y center");return i=t.cx-t.width/2,o=t.cy-t.height/2,r={shape:{rect:{x:i,y:o,width:t.width,height:t.height}},bbox:[i,o,i+t.width,o+t.height]},t.obround&&(e=.5*Math.min(t.width,t.height),r.shape.rect.rx=e,r.shape.rect.ry=e),r},s=function(t){var e,r,i,o,n,s,h,l,a,u,c,f,p,d,x,b;if(null==t.dia)throw new Error("polygon requires diameter");if(null==t.verticies)throw new Error("polygon requires verticies");if(null==t.cx)throw new Error("polygon function requires x center");if(null==t.cy)throw new Error("polygon function requires y center");for(s=null!=t.degrees?t.degrees*Math.PI/180:0,h=2*Math.PI/t.verticies,i=t.dia/2,r="",c=null,d=null,u=null,p=null,e=x=0,b=t.verticies;b>=0?b>x:x>b;e=b>=0?++x:--x)l=s+e*h,o=i*Math.cos(l),n=i*Math.sin(l),Math.abs(o)<1e-9&&(o=0),Math.abs(n)<1e-9&&(n=0),a=t.cx+o,f=t.cy+n,(c>a||null===c)&&(c=a),(a>u||null===u)&&(u=a),(d>f||null===d)&&(d=f),(f>p||null===p)&&(p=f),r+=" "+a+","+f;return{shape:{polygon:{points:r.slice(1)}},bbox:[c,d,u,p]}},u=function(t){var e,r,i;if(null==t.x1)throw new Error("vector function requires start x");if(null==t.y1)throw new Error("vector function requires start y");if(null==t.x2)throw new Error("vector function requires end x");if(null==t.y2)throw new Error("vector function requires end y");if(null==t.width)throw new Error("vector function requires width");return e=Math.abs(Math.atan((t.y2-t.y1)/(t.x2-t.x1))),r=t.width/2*Math.sin(e),i=t.width/2*Math.cos(e),1e-7>r&&(r=0),1e-7>i&&(i=0),{shape:{line:{x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,"stroke-width":t.width,"stroke-linecap":"butt"}},bbox:[Math.min(t.x1,t.x2)-r,Math.min(t.y1,t.y2)-i,Math.max(t.x1,t.x2)+r,Math.max(t.y1,t.y2)+i]}},i=function(t){if(null==t.width)throw new Error("lower left rect requires width");if(null==t.height)throw new Error("lower left rect requires height");if(null==t.x)throw new Error("lower left rectangle requires x");if(null==t.y)throw new Error("lower left rectangle requires y");return{shape:{rect:{x:t.x,y:t.y,width:t.width,height:t.height}},bbox:[t.x,t.y,t.x+t.width,t.y+t.height]}},n=function(t){var e,r,i,o,n,s,h,l,a,u,c,f,p;if(!(Array.isArray(t.points)&&t.points.length>1))throw new Error("outline function requires points array");for(s=null,u=null,n=null,a=null,r="",p=t.points,c=0,f=p.length;f>c;c++){if(e=p[c],!Array.isArray(e)||2!==e.length)throw new Error("outline function requires points array");i=e[0],h=e[1],(s>i||null===s)&&(s=i),(i>n||null===n)&&(n=i),(u>h||null===u)&&(u=h),(h>a||null===a)&&(a=h),r+=" "+i+","+h}if(o=t.points[t.points.length-1][0],l=t.points[t.points.length-1][1],o!==t.points[0][0]||l!==t.points[0][1])throw new RangeError("last point must match first point of outline");return{shape:{polygon:{points:r.slice(1)}},bbox:[s,u,n,a]}},o=function(t){var e,r,i;if(null==t.cx)throw new Error("moiré requires x center");if(null==t.cy)throw new Error("moiré requires y center");if(null==t.outerDia)throw new Error("moiré requires outer diameter");if(null==t.ringThx)throw new Error("moiré requires ring thickness");if(null==t.ringGap)throw new Error("moiré requires ring gap");if(null==t.maxRings)throw new Error("moiré requires max rings");if(null==t.crossLength)throw new Error("moiré requires crosshair length");if(null==t.crossThx)throw new Error("moiré requires crosshair thickness");for(i=[{line:{x1:t.cx-t.crossLength/2,y1:0,x2:t.cx+t.crossLength/2,y2:0,"stroke-width":t.crossThx,"stroke-linecap":"butt"}},{line:{x1:0,y1:t.cy-t.crossLength/2,x2:0,y2:t.cy+t.crossLength/2,"stroke-width":t.crossThx,"stroke-linecap":"butt"}}],e=(t.outerDia-t.ringThx)/2,r=0;e>=t.ringThx&&r<t.maxRings;)i.push({circle:{cx:t.cx,cy:t.cy,r:e,fill:"none","stroke-width":t.ringThx}}),r++,e-=t.ringThx+t.ringGap;return e+=.5*t.ringThx,e>0&&r<t.maxRings&&i.push({circle:{cx:t.cx,cy:t.cy,r:e}}),{shape:i,bbox:[Math.min(t.cx-t.crossLength/2,t.cx-t.outerDia/2),Math.min(t.cy-t.crossLength/2,t.cy-t.outerDia/2),Math.max(t.cx+t.crossLength/2,t.cx+t.outerDia/2),Math.max(t.cy+t.crossLength/2,t.cy+t.outerDia/2)]}},l=function(t){var e,r,i,o,n,s,h,l,u;if(null==t.cx)throw new Error("thermal requires x center");if(null==t.cy)throw new Error("thermal requires y center");if(null==t.outerDia)throw new Error("thermal requires outer diameter");if(null==t.innerDia)throw new Error("thermal requires inner diameter");if(null==t.gap)throw new Error("thermal requires gap");return r="thermal-mask-"+a(),n=(t.outerDia-t.innerDia)/2,i=t.outerDia/2,o=i-n/2,h=t.cx-i,s=t.cx+i,u=t.cy-i,l=t.cy+i,e=t.gap/2,{shape:[{mask:{id:r,_:[{circle:{cx:t.cx,cy:t.cy,r:i,"stroke-width":0,fill:"#fff"}},{rect:{x:h,y:-e,width:t.outerDia,height:t.gap,"stroke-width":0,fill:"#000"}},{rect:{x:-e,y:u,width:t.gap,height:t.outerDia,"stroke-width":0,fill:"#000"}}]}},{circle:{cx:t.cx,cy:t.cy,r:o,fill:"none","stroke-width":n,mask:"url(#"+r+")"}}],bbox:[h,u,s,l]}},e.exports={circle:r,rect:h,polygon:s,vector:u,lowerLeftRect:i,outline:n,moire:o,thermal:l}},{"./unique-id":14}],11:[function(t,e){var r,i,o,n,s,h,l,a,u;u=t("./unique-id"),o=t("./macro-tool"),a=t("./standard-tool"),l=t("./svg-coord").factor,i=Math.PI/2,s=3*i,h=2*Math.PI,r="in",n=function(){function t(t,e,r){null==t&&(t=""),null!=e&&(this.reader=new e(t)),null!=r&&(this.parser=new r),this.macros={},this.tools={},this.currentTool="",this.defs=[],this.group={g:{_:[]}},this.polarity="D",this.current=[],this.stepRepeat={x:1,y:1,i:0,j:0},this.srOverClear=!1,this.srOverCurrent=[],this.units=null,this.mode=null,this.quad=null,this.lastOp=null,this.region=!1,this.done=!1,this.pos={x:0,y:0},this.path=[],this.attr={"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":0,stroke:"#000"},this.bbox={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},this.layerBbox={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0}}return t.prototype.addTool=function(t,e){var r,i;if(null!=this.tools[t])throw new Error("cannot reassign tool "+t);return i=null!=e.macro?this.macros[e.macro].run(t,e.mods):a(t,e),this.tools[t]={trace:i.trace,pad:function(){var t,e,o,n;for(o=i.pad,n=[],t=0,e=o.length;e>t;t++)r=o[t],n.push(r);return n}(),flash:function(t,e){return{use:{x:t,y:e,"xlink:href":"#"+i.padId}}},bbox:function(t,e){return null==t&&(t=0),null==e&&(e=0),{xMin:t+i.bbox[0],yMin:e+i.bbox[1],xMax:t+i.bbox[2],yMax:e+i.bbox[3]}}},this.changeTool(t)},t.prototype.changeTool=function(t){var e;if(this.finishPath(),this.region)throw new Error("cannot change tool when in region mode");if(null!=this.tools[t])return this.currentTool=t;if(!(null!=(e=this.parser)?e.fmat:void 0))throw new Error("tool "+t+" is not defined")},t.prototype.command=function(t){var e,r,i,n,s,h,l,a;if(null!=t.macro)return r=new o(t.macro,this.parser.format.places),void(this.macros[r.name]=r);h=t.set;for(n in h){if(s=h[n],"units"===n&&null!=this.units&&null==(null!=(l=this.parser)?l.fmat:void 0))throw new Error("cannot redefine units");if("notation"===n&&null!=this.notation)throw new Error("cannot redefine notation");"region"===n&&this.finishPath(),"currentTool"===n?this.changeTool(s):this[n]=s}if(null!=t.tool){a=t.tool;for(e in a)i=a[e],this.addTool(e,i)}if(null!=t.op&&this.operate(t.op),null!=t["new"]){if(this.finishLayer(),null!=t["new"].layer)return this.polarity=t["new"].layer;if(null!=t["new"].sr)return this.finishSR(),this.stepRepeat=t["new"].sr}},t.prototype.plot=function(){for(var t,e;!this.done;){if(t=this.reader.nextBlock(),t===!1)throw new Error(null==(null!=(e=this.parser)?e.fmat:void 0)?"end of file encountered before required M02 command":"end of drill file encountered before M00/M30 command");this.command(this.parser.parseCommand(t))}return this.finish()},t.prototype.finish=function(){return this.finishPath(),this.finishLayer(),this.finishSR(),this.group.g.fill="currentColor",this.group.g.stroke="currentColor",this.group.g.transform="translate(0,"+(this.bbox.yMin+this.bbox.yMax)+") scale(1,-1)"},t.prototype.finishSR=function(){var t,e,r,i,o,n,s,h,l,a,c,f,p,d,x,b;if(this.srOverClear&&this.srOverCurrent){for(r="gerber-sr-mask_"+u(),e={mask:{color:"#000",id:r,_:[]}},e.mask._.push({rect:{fill:"#fff",x:this.bbox.xMin,y:this.bbox.yMin,width:this.bbox.xMax-this.bbox.xMin,height:this.bbox.yMax-this.bbox.yMin}}),o=s=0,c=this.stepRepeat.x*this.stepRepeat.i,f=this.stepRepeat.i;f>0?c>s:s>c;o=s+=f)for(n=h=0,p=this.stepRepeat.y*this.stepRepeat.j,d=this.stepRepeat.j;d>0?p>h:h>p;n=h+=d)for(x=this.srOverCurrent,l=0,a=x.length;a>l;l++)t=x[l],i={use:{}},0!==o&&(i.use.x=o),0!==n&&(i.use.y=n),i.use["xlink:href"]="#"+(null!=(b=t.C)?b:t.D),null!=t.D&&(i.use.fill="#fff"),e.mask._.push(i);return this.srOverClear=!1,this.srOverCurrent=[],this.defs.push(e),this.group.g.mask="url(#"+r+")"}},t.prototype.finishLayer=function(){var t,e,r,i,o,n,s,h,l,a,c,f,p,d,x,b;if(this.finishPath(),this.current.length){if(this.stepRepeat.x>1||this.stepRepeat.y>1){for(o="gerber-sr_"+u(),this.current=[{g:{id:o,_:this.current}}],(this.srOverClear||this.stepRepeat.i<this.layerBbox.xMax-this.layerBbox.xMin||this.stepRepeat.j<this.layerBbox.yMax-this.layerBbox.yMin)&&(i={},i[this.polarity]=o,this.srOverCurrent.push(i),"C"===this.polarity&&(this.srOverClear=!0,this.defs.push(this.current[0]))),h=a=0,d=this.stepRepeat.x;d>=0?d>a:a>d;h=d>=0?++a:--a)for(l=c=0,x=this.stepRepeat.y;x>=0?x>c:c>x;l=x>=0?++c:--c)(0!==h||0!==l)&&(n={use:{"xlink:href":"#"+o}},0!==h&&(n.use.x=h*this.stepRepeat.i),0!==l&&(n.use.y=l*this.stepRepeat.j),this.current.push(n));this.layerBbox.xMax+=(this.stepRepeat.x-1)*this.stepRepeat.i,this.layerBbox.yMax+=(this.stepRepeat.y-1)*this.stepRepeat.j}if(this.addBbox(this.layerBbox,this.bbox),this.layerBbox={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},"D"===this.polarity)if(null!=this.group.g.mask&&this.current.unshift(this.group),null==this.group.g.mask&&this.group.g._.length)for(b=this.current,f=0,p=b.length;p>f;f++)t=b[f],this.group.g._.push(t);else this.group={g:{_:this.current}};else"C"!==this.polarity||this.srOverClear||(r="gerber-mask_"+u(),s=this.bbox.xMax-this.bbox.xMin,e=this.bbox.yMax-this.bbox.yMin,this.current.unshift({rect:{x:this.bbox.xMin,y:this.bbox.yMin,width:s,height:e,fill:"#fff"}}),this.defs.push({mask:{id:r,color:"#000",_:this.current}}),this.group.g.mask="url(#"+r+")");return this.current=[]}},t.prototype.finishPath=function(){var t,e,r,i;if(this.path.length){if(e={path:{}},this.region)this.path.push("Z");else{i=this.tools[this.currentTool].trace;for(t in i)r=i[t],e.path[t]=r}return e.path.d=this.path,this.current.push(e),this.path=[]}},t.prototype.operate=function(t){var e,i,o,n,s,h,l,a,u,c,f,p,d,x,b;if("last"===t["do"]?t["do"]=this.lastOp:this.lastOp=t["do"],s=this.pos.x,h=this.pos.y,"I"===this.notation?(this.pos.x+=null!=(c=t.x)?c:0,this.pos.y+=null!=(f=t.y)?f:0):(this.pos.x=null!=(p=t.x)?p:this.pos.x,this.pos.y=null!=(d=t.y)?d:this.pos.y),i=this.pos.x,o=this.pos.y,l=this.tools[this.currentTool],null==this.units&&(this.units=null!=this.backupUnits?this.backupUnits:r),null==this.notation){if(null==(null!=(x=this.parser)?x.fmat:void 0))throw new Error("format has not been set");this.notation="A"}if("move"===t["do"]&&this.path.length)return this.path.push("M",i,o);if("flash"===t["do"]){if(this.finishPath(),this.region)throw new Error("cannot flash while in region mode");if(l.pad){for(b=l.pad,a=0,u=b.length;u>a;a++)n=b[a],this.defs.push(n);l.pad=!1}return this.current.push(l.flash(i,o)),this.addBbox(l.bbox(i,o),this.layerBbox)}if("int"===t["do"]){if(!this.region&&!l.trace)throw new Error(""+this.currentTool+" is not a strokable tool");return 0===this.path.length&&(this.path.push("M",s,h),e=this.region?{xMin:s,yMin:h,xMax:s,yMax:h}:l.bbox(s,h),this.addBbox(e,this.layerBbox)),null==this.mode&&(this.mode="i"),"i"===this.mode?this.drawLine(s,h,i,o):(null==t.i&&(t.i=0),null==t.j&&(t.j=0),this.drawArc(s,h,i,o,t.i,t.j))}},t.prototype.drawLine=function(t,e,r,o){var n,s,h,l,a,u,c,f,p,d,x,b,m;return b=this.tools[this.currentTool],n=this.region?{xMin:r,yMin:o,xMax:r,yMax:o}:b.bbox(r,o),this.addBbox(n,this.layerBbox),this.region||b.trace["stroke-width"]>=0?this.path.push("L",r,o):(c=b.pad[0].rect.width/2,u=b.pad[0].rect.height/2,f=t-c,p=t+c,d=e-u,x=e+u,s=r-c,h=r+c,l=o-u,a=o+u,m=Math.atan2(o-e,r-t),m>=0&&i>m?this.path.push("M",f,d,p,d,h,l,h,a,s,a,f,x,"Z"):m>=i&&m<Math.PI?this.path.push("M",f,d,p,d,p,x,h,a,s,a,s,l,"Z"):-Math.PI<=m&&-i>m?this.path.push("M",p,d,p,x,f,x,s,a,s,l,h,l,"Z"):m>=-i&&0>m?this.path.push("M",f,d,s,l,h,l,h,a,p,x,f,x,"Z"):void 0)},t.prototype.drawArc=function(t,e,r,o,n,a){var u,c,f,p,d,x,b,m,g,w,y,v,M,k,E,q,R,T,B,D,_,A,L,C,I,j,O,P,z,N;if(u=1.5*l*Math.pow(10,-(null!=(P=null!=(z=this.parser)?z.format.places[1]:void 0)?P:7)),w=this.tools[this.currentTool],!this.region&&!w.trace["stroke-width"])throw Error("cannot stroke an arc with non-circular tool "+this.currentTool);if(null==this.quad)throw new Error("arc quadrant mode has not been set");for(b=Math.sqrt(Math.pow(n,2)+Math.pow(a,2)),g="cw"===this.mode?0:1,x=0,k=[],f=[[t+n,e+a]],"s"===this.quad&&f.push([t-n,e-a],[t-n,e+a],[t+n,e-a]),C=0,j=f.length;j>C;C++)c=f[C],d=Math.sqrt(Math.pow(c[0]-r,2)+Math.pow(c[1]-o,2)),Math.abs(b-d)<u&&k.push({x:c[0],y:c[1]});for(v=0,M=0,p=null,I=0,O=k.length;O>I&&(c=k[I],v=Math.atan2(o-c.y,r-c.x),0>v&&(v+=h),M=Math.atan2(e-c.y,t-c.x),0>M&&(M+=h),"cw"===this.mode&&v>M?M+=h:"ccw"===this.mode&&M>v&&(v+=h),y=Math.abs(v-M),"s"===this.quad&&i>=y?p=c:"m"===this.quad&&(y>=Math.PI&&(x=1),p={x:c.x,y:c.y}),null==p);I++);return null!=p?(m=this.region?0:w.bbox().xMax,"cw"===this.mode&&(N=[M,v],v=N[0],M=N[1]),T=M>0?h:0,A=i+(M>i?h:0),R=Math.PI+(M>Math.PI?h:0),_=s+(M>s?h:0),q=R>=M&&v>=R?p.x-b-m:Math.min(t,r)-m,E=T>=M&&v>=T?p.x+b+m:Math.max(t,r)+m,D=_>=M&&v>=_?p.y-b-m:Math.min(e,o)-m,B=A>=M&&v>=A?p.y+b+m:Math.max(e,o)+m,L=Math.abs(t-r)<u&&Math.abs(e-o)<u,"m"===this.quad&&L&&(this.path.push("A",b,b,0,0,g,r+2*n,o+2*a),q=p.x-b-m,D=p.y-b-m,E=p.x+b+m,B=p.y+b+m),this.path.push("A",b,b,0,x,g,r,o),"s"===this.quad&&L&&this.path.push("Z"),this.addBbox({xMin:q,yMin:D,xMax:E,yMax:B},this.layerBbox)):void 0},t.prototype.addBbox=function(t,e){return t.xMin<e.xMin&&(e.xMin=t.xMin),t.yMin<e.yMin&&(e.yMin=t.yMin),t.xMax>e.xMax&&(e.xMax=t.xMax),t.yMax>e.yMax?e.yMax=t.yMax:void 0},t}(),e.exports=n},{"./macro-tool":8,"./standard-tool":12,"./svg-coord":13,"./unique-id":14}],12:[function(t,e){var r,i,o;o=t("./unique-id"),r=t("./pad-shapes"),i=function(t,e){var i,n,s,h,l,a,u;if(a={pad:[],trace:!1},e.cx=0,e.cy=0,n="tool-"+t+"-pad-"+o(),u="",null!=e.dia&&null==e.verticies){if(null!=e.obround||null!=e.width||null!=e.height||null!=e.degrees)throw new Error("incompatible parameters for tool "+t);if(e.dia<0)throw new RangeError(""+t+" circle diameter out of range ("+e.dia+"<0)");u="circle",null==e.hole&&(a.trace={"stroke-width":e.dia,fill:"none"})}else if(null!=e.width&&null!=e.height){if(null!=e.dia||null!=e.verticies||null!=e.degrees)throw new Error("incompatible parameters for tool "+t); | ||
if(e.width<=0)throw new RangeError(""+t+" rect width out of range ("+e.width+"<=0)");if(e.height<=0)throw new RangeError(""+t+" rect height out of range ("+e.height+"<=0)");u="rect",null!=e.hole||e.obround||(a.trace={})}else{if(null==e.dia||null==e.verticies)throw new Error("unidentified standard tool shape");if(null!=e.obround||null!=e.width||null!=e.height)throw new Error("incompatible parameters for tool "+t);if(e.verticies<3||e.verticies>12)throw new RangeError(""+t+" polygon points out of range ("+e.verticies+"<3 or >12)]");u="polygon"}if(l=r[u](e),null!=e.hole){if(i=null,null!=e.hole.dia&&null==e.hole.width&&null==e.hole.height){if(!(e.hole.dia>=0))throw new RangeError(""+t+" hole diameter out of range ("+e.hole.dia+"<0)");i=r.circle({cx:e.cx,cy:e.cy,dia:e.hole.dia}),i=i.shape,i.circle.fill="#000"}else{if(null==e.hole.width||null==e.hole.height)throw new Error(""+t+" has invalid hole parameters");if(!(e.hole.width>=0))throw new RangeError(""+t+" hole width out of range ("+e.hole.width+"<0)");if(!(e.hole.height>=0))throw new RangeError(""+t+" hole height out of range");i=r.rect({cx:e.cx,cy:e.cy,width:e.hole.width,height:e.hole.height}),i=i.shape,i.rect.fill="#000"}h=n+"-mask",s={mask:{id:n+"-mask",_:[{rect:{x:l.bbox[0],y:l.bbox[1],width:l.bbox[2]-l.bbox[0],height:l.bbox[3]-l.bbox[1],fill:"#fff"}},i]}},l.shape[u].mask="url(#"+h+")",a.pad.push(s)}return n&&(l.shape[u].id=n),a.pad.push(l.shape),a.bbox=l.bbox,a.padId=n,a},e.exports=i},{"./pad-shapes":10,"./unique-id":14}],13:[function(t,e){var r,i,o,n=[].indexOf||function(t){for(var e=0,r=this.length;r>e;e++)if(e in this&&this[e]===t)return e;return-1};i=1e3,r=3,o=function(t,e){var i,o,s,h,l,a,u,c,f,p,d,x,b;if(t=""+t,o="",i="",l="+",("-"===t[0]||"+"===t[0])&&(l=t[0],t=t.slice(1)),n.call(t,".")>=0||null==e.zero){if(a=t.split("."),a.length>2)return 0/0;d=[a[0],a[1]],o=d[0],i=d[1],null==i&&(i=""),null==o&&(o="")}else{if("number"!=typeof(null!=e&&null!=(x=e.places)?x[0]:void 0)&&"number"!=typeof(null!=e&&null!=(b=e.places)?b[1]:void 0))return 0/0;if("T"===e.zero){for(h=u=0,f=t.length;f>u;h=++u)s=t[h],h<e.places[0]?o+=s:i+=s;for(;o.length<e.places[0];)o+="0"}else if("L"===e.zero){for(h=c=0,p=t.length;p>c;h=++c)s=t[h],t.length-h<=e.places[1]?i+=s:o+=s;for(;i.length<e.places[1];)i="0"+i}}for(;i.length<r;)i+="0";return o+=i.slice(0,r),i=i.length>r?"."+i.slice(r):"",Number(l+o+i)},e.exports={get:o,factor:i}},{}],14:[function(t,e){var r,i;i=1e3,r=function(){return i++},e.exports=r},{}]},{},[1])(1)}); | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.gerberToSvg=t()}}(function(){return function t(e,r,i){function o(s,h){if(!r[s]){if(!e[s]){var l="function"==typeof require&&require;if(!h&&l)return l(s,!0);if(n)return n(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var u=r[s]={exports:{}};e[s][0].call(u.exports,function(t){var r=e[s][1][t];return o(r?r:t)},u,u.exports,t,e,r,i)}return r[s].exports}for(var n="function"==typeof require&&require,s=0;s<i.length;s++)o(i[s]);return o}({1:[function(t,e){(function(r){var i,o,n,s;n=t("./obj-to-xml"),o=t("./plotter"),s=t("./svg-coord").factor,i={drill:!1,pretty:!1,object:!1,warnArr:null},e.exports=function(e,h){var l,a,u,c,f,p,d,x,b,m,g,w,y,v,M;null==h&&(h={}),x={};for(p in i)g=i[p],x[p]=g;for(p in h)g=h[p],x[p]=g;if("object"==typeof e){if(null!=e.svg)return n(e,{pretty:x.pretty});throw new Error("non SVG object cannot be converted to an SVG string")}x.drill?(a=t("./drill-reader"),l=t("./drill-parser")):(a=t("./gerber-reader"),l=t("./gerber-parser")),b=new o(e,a,l),d=null,m=null,Array.isArray(x.warnArr)&&(m="undefined"!=typeof window&&null!==window?window:r,null==m.console&&(m.console={}),d=m.console.warn,m.console.warn=function(t){return x.warnArr.push(t.toString())});try{v=b.plot()}catch(k){throw c=k,new Error("Error at line "+b.reader.line+" - "+c.message)}finally{null!=d&&null!=m&&(m.console.warn=d)}b.bbox.xMin>=b.bbox.xMax?(b.bbox.xMin=0,b.bbox.xMax=0,w=0):w=b.bbox.xMax-b.bbox.xMin,b.bbox.yMin>=b.bbox.yMax?(b.bbox.yMin=0,b.bbox.yMax=0,f=0):f=b.bbox.yMax-b.bbox.yMin,y={svg:{xmlns:"http://www.w3.org/2000/svg",version:"1.1","xmlns:xlink":"http://www.w3.org/1999/xlink",width:""+w/s+b.units,height:""+f/s+b.units,viewBox:[b.bbox.xMin,b.bbox.yMin,w,f],_:[]}},M=b.attr;for(u in M)g=M[u],y.svg[u]=g;return b.defs.length&&y.svg._.push({defs:{_:b.defs}}),b.group.g._.length&&y.svg._.push(b.group),x.object?y:n(y,{pretty:x.pretty})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./drill-parser":3,"./drill-reader":4,"./gerber-parser":5,"./gerber-reader":6,"./obj-to-xml":9,"./plotter":11,"./svg-coord":13}],2:[function(t,e){var r;r=t("./svg-coord").get,e.exports=function(t,e){var i,o,n,s,h,l,a,u,c,f,p,d;if(null==t)return{};if(null==e.zero||null==e.places)throw new Error("format undefined");o={},n={},o.x=null!=(h=t.match(/X[+-]?[\d\.]+/))&&null!=(l=h[0])?l.slice(1):void 0,o.y=null!=(a=t.match(/Y[+-]?[\d\.]+/))&&null!=(u=a[0])?u.slice(1):void 0,o.i=null!=(c=t.match(/I[+-]?[\d\.]+/))&&null!=(f=c[0])?f.slice(1):void 0,o.j=null!=(p=t.match(/J[+-]?[\d\.]+/))&&null!=(d=p[0])?d.slice(1):void 0;for(i in o)s=o[i],null!=s&&(n[i]=r(s,e));return n}},{"./svg-coord":13}],3:[function(t,e){var r,i,o,n,s,h,l,a,u,c;u=t("./coord-parser"),a=t("./svg-coord").get,o={"FMAT,1":"M70","FMAT,2":"M72"},s="M71",r="G90",n="G91",c=/[XY]{1,2}/,l="L",h=[2,4],i=function(){function t(){this.format={zero:null,places:null},this.fmat="FMAT,2"}return t.prototype.parseCommand=function(t){var e,i,f,p,d,x,b,m;if(i={},";"===t[0])return i;if("FMAT,1"===t)this.fmat=t;else if("M30"===t||"M00"===t)i.set={done:!0};else if(t===o[this.fmat]||t.match(/INCH/))this.format.places=[2,4],i.set={units:"in"};else if(t===s||t.match(/METRIC/))this.format.places=[3,3],i.set={units:"mm"};else if(t===r)i.set={notation:"abs"};else if(t===n)i.set={notation:"inc"};else if(e=null!=(x=t.match(/T\d+/))?x[0]:void 0){for(;"0"===e[1];)e=e[0]+e.slice(2);(f=null!=(b=t.match(/C[\d\.]+(?=.*$)/))?b[0]:void 0)?(f=f.slice(1),i.tool={},i.tool[e]={dia:a(f,{places:this.format.places})}):i.set={currentTool:e}}if(t.match(/TZ/)?this.format.zero="L":t.match(/LZ/)&&(this.format.zero="T"),t.match(c)){i.op={"do":"flash"},null==this.format.zero&&(this.format.zero=l),null==this.format.places&&(this.format.places=h),m=u(t,this.format);for(p in m)d=m[p],i.op[p]=d}return i},t}(),e.exports=i},{"./coord-parser":2,"./svg-coord":13}],4:[function(t,e){var r;r=function(){function t(t){this.line=0,this.blocks=t.split(/\r?\n/)}return t.prototype.nextBlock=function(){return this.line<this.blocks.length?this.blocks[++this.line-1]:!1},t}(),e.exports=r},{}],5:[function(t,e){var r,i,o,n;o=t("./coord-parser"),i=t("./svg-coord").get,n=/([XYIJ][+-]?\d+){1,4}/g,r=function(){function t(){this.format={zero:null,places:null}}return t.prototype.parseFormat=function(t,e){var r,i,o;if(o="L"===t[2]||"T"===t[2]?t[2]:null,r="A"===t[3]||"I"===t[3]?t[3]:null,"X"===t[4]&&"Y"===t[7]&&t.slice(5,7)===t.slice(8,10)&&t[5]<8&&t[6]<8&&(i=[+t[5],+t[6]]),null==i||null==r||null==o)throw new Error("invalid format specification");return this.format.zero=o,this.format.places=i,null==e.set&&(e.set={}),e.set.notation=r},t.prototype.parseToolDef=function(t,e){var r,o,n,s,h,l,a;for(null==e.tool&&(e.tool={}),r=null!=(l=t.match(/^ADD\d{2,}/))?l[0].slice(2):void 0,a=t.slice(2+r.length).split(","),h=a[0],s=a[1],s=null!=s?s.split("X"):void 0;"0"===r[1];)r=r[0]+r.slice(2);switch(h){case"C":if(s.length>2?o={width:i(s[1],{places:this.format.places}),height:i(s[2],{places:this.format.places})}:s.length>1&&(o={dia:i(s[1],{places:this.format.places})}),e.tool[r]={dia:i(s[0],{places:this.format.places})},null!=o)return e.tool[r].hole=o;break;case"R":case"O":if(s.length>3?o={width:i(s[2],{places:this.format.places}),height:i(s[3],{places:this.format.places})}:s.length>2&&(o={dia:i(s[2],{places:this.format.places})}),e.tool[r]={width:i(s[0],{places:this.format.places}),height:i(s[1],{places:this.format.places})},"O"===h&&(e.tool[r].obround=!0),null!=o)return e.tool[r].hole=o;break;case"P":if(s.length>4?o={width:i(s[3],{places:this.format.places}),height:i(s[4],{places:this.format.places})}:s.length>3&&(o={dia:i(s[3],{places:this.format.places})}),e.tool[r]={dia:i(s[0],{places:this.format.places}),verticies:+s[1]},s.length>2&&(e.tool[r].degrees=+s[2]),null!=o)return e.tool[r].hole=o;break;default:return s=function(){var t,e,r,i;for(r=null!=s?s:[],i=[],t=0,e=r.length;e>t;t++)n=r[t],i.push(+n);return i}(),e.tool[r]={macro:h,mods:s}}},t.prototype.parseCommand=function(t){var e,r,s,h,l,a,u,c,f,p,d,x,b,m,g,w,y,v,M,k,E,q,R,T,B,D,_;if(null==t&&(t={}),r={},p=t.param)for(w=0,y=p.length;y>w;w++)switch(f=p[w],s=f.slice(0,2)){case"FS":this.parseFormat(f,r);break;case"MO":if(x=f.slice(2,4),null==r.set&&(r.set={}),"IN"===x)r.set.units="in";else{if("MM"!==x)throw new Error(""+f+" is an invalid units setting");r.set.units="mm"}break;case"AD":this.parseToolDef(f,r);break;case"AM":return{macro:p};case"LP":if(null==r["new"]&&(r["new"]={}),("D"===f[2]||"C"===f[2])&&(r["new"].layer=f[2]),null==r["new"].layer)throw new Error("invalid level polarity");break;case"SR":if(null==r["new"]&&(r["new"]={}),m=null!=(v=null!=(M=f.match(/X[+-]?[\d\.]+/))?M[0].slice(1):void 0)?v:1,g=null!=(k=null!=(E=f.match(/Y[+-]?[\d\.]+/))?E[0].slice(1):void 0)?k:1,l=null!=(q=f.match(/I[+-]?[\d\.]+/))?q[0].slice(1):void 0,a=null!=(R=f.match(/J[+-]?[\d\.]+/))?R[0].slice(1):void 0,1>m||1>g||m>1&&null==l||0>l||g>1&&null==a||0>a)throw new Error("invalid step repeat");r["new"].sr={x:+m,y:+g},null!=l&&(r["new"].sr.i=i(l,{places:this.format.places})),null!=a&&(r["new"].sr.j=i(a,{places:this.format.places}))}else if(t=t.block){if("M02"===t)return{set:{done:!0}};if("G"===t[0])switch(s=null!=(T=t.slice(1).match(/^\d{1,2}/))?T[0]:void 0){case"4":case"04":return{};case"1":case"01":case"2":case"02":case"3":case"03":s=s[s.length-1],u="1"===s?"i":"2"===s?"cw":"ccw",r.set={mode:u};break;case"36":case"37":r.set={region:"36"===s};break;case"70":case"71":r.set={backupUnits:"70"===s?"in":"mm"};break;case"74":case"75":r.set={quad:"74"===s?"s":"m"}}if(h=o(null!=(B=t.match(n))?B[0]:void 0,this.format),c=(null!=(D=t.match(/D0?[123]$/))?D[0]:void 0)||Object.keys(h).length){null!=c&&(c=c[c.length-1]),c=function(){switch(c){case"1":return"int";case"2":return"move";case"3":return"flash";default:return"last"}}(),r.op={"do":c};for(e in h)b=h[e],r.op[e]=b}else(d=null!=(_=t.match(/D\d+$/))?_[0]:void 0)&&(r.set={currentTool:d})}return r},t}(),e.exports=r},{"./coord-parser":2,"./svg-coord":13}],6:[function(t,e){var r;r=function(){function t(t){this.gerberFile=t,this.line=0,this.charIndex=0,this.end=this.gerberFile.length}return t.prototype.nextBlock=function(){var t,e,r;if(this.index>=this.end)return!1;for(e="",r=!1,0===this.line&&this.line++;!(this.charIndex>=this.end);)if(t=this.gerberFile[this.charIndex++],"%"===t){if(r)return{param:r};r=[]}else if("*"===t){if(!r)return{block:e};r.push(e),e=""}else"\n"===t?this.line++:t>=" "&&"~">=t&&(e+=t);return!1},t.prototype.getLine=function(){return this.line},t}(),e.exports=r},{}],7:[function(t,e){var r,i,o,n,s,h;i=/[\+\-\/xX\(\)]/,r=/[\$\d\.]+/,o=new RegExp("("+i.source+")|("+r.source+")","g"),h=function(t){var e;return e=t.match(o)},n=function(t){return r.test(t)},s=function(t){var e,r,i,o,s,l,a;return a=h(t),r=0,l=function(){return a[r]},e=function(t){return t===l()?r++:void 0},s=function(){var t,r;if(r=l(),e(r),n(r))t={type:"n",val:r};else{if("("!==r)throw new Error(""+r+" is unexpected in an arithmetic string");if(t=i(),")"!==l())throw new Error("expected ')'");e(")")}return t},o=function(){var t,r,i;for(t=s(),i=l();"x"===i||"/"===i||"X"===i;)e(i),"X"===i&&(i="x"),r=s(),t={type:i,left:t,right:r},i=l();return t},(i=function(){var t,r,i;for(t=o(),i=l();"+"===i||"-"===i;)e(i),r=o(),t={type:i,left:t,right:r},i=l();return t})()},e.exports={tokenize:h,isNumber:n,parse:s}},{}],8:[function(t,e){var r,i,o,n,s;n=t("./pad-shapes"),i=t("./macro-calc"),s=t("./unique-id"),o=t("./svg-coord").get,r=function(){function t(t,e){this.modifiers={},this.name=t[0].slice(2),this.blocks=t.slice(1),this.shapes=[],this.masks=[],this.lastExposure=null,this.bbox=[null,null,null,null],this.format={places:e}}return t.prototype.run=function(t,e){var r,i,o,n,h,l,a,u,c,f,p,d,x,b,m,g,w,y,v;for(null==e&&(e=[]),this.lastExposure=null,this.shapes=[],this.masks=[],this.bbox=[null,null,null,null],this.modifiers={},o=c=0,x=e.length;x>c;o=++c)n=e[o],this.modifiers["$"+(o+1)]=n;for(w=this.blocks,f=0,b=w.length;b>f;f++)r=w[f],this.runBlock(r);for(l="tool-"+t+"-pad-"+s(),h=[],y=this.masks,p=0,m=y.length;m>p;p++)n=y[p],h.push(n);if(this.shapes.length>1){for(i={id:l,_:[]},v=this.shapes,d=0,g=v.length;g>d;d++)a=v[d],i._.push(a);h=[{g:i}]}else 1===this.shapes.length&&(u=Object.keys(this.shapes[0])[0],this.shapes[0][u].id=l,h.push(this.shapes[0]));return{pad:h,padId:l,bbox:this.bbox,trace:!1}},t.prototype.runBlock=function(t){var e,r,i,o,n,s,h,l;switch(t[0]){case"$":return o=null!=(l=t.match(/^\$\d+(?=\=)/))?l[0]:void 0,n=t.slice(1+o.length),this.modifiers[o]=this.getNumber(n);case"1":case"2":case"20":case"21":case"22":case"4":case"5":case"6":case"7":for(r=t.split(","),i=s=0,h=r.length;h>s;i=++s)e=r[i],r[i]=this.getNumber(e);return this.primitive(r);default:if("0"!==t[0])throw new Error("'"+t+"' unrecognized tool macro block")}},t.prototype.primitive=function(t){var e,r,i,h,l,a,u,c,f,p,d,x,b,m,g,w,y,v,M,k,E,q,R,T,B,D,_,A,L;switch(l=!1,f=!1,d=null,t[0]){case 1:d=n.circle({dia:o(t[2],this.format),cx:o(t[3],this.format),cy:o(t[4],this.format)}),0===t[1]?l=!0:this.addBbox(d.bbox);break;case 2:case 20:d=n.vector({width:o(t[2],this.format),x1:o(t[3],this.format),y1:o(t[4],this.format),x2:o(t[5],this.format),y2:o(t[6],this.format)}),t[7]&&(d.shape.line.transform="rotate("+t[7]+")"),0===t[1]?l=!0:this.addBbox(d.bbox,t[7]);break;case 21:d=n.rect({cx:o(t[4],this.format),cy:o(t[5],this.format),width:o(t[2],this.format),height:o(t[3],this.format)}),t[6]&&(d.shape.rect.transform="rotate("+t[6]+")"),0===t[1]?l=!0:this.addBbox(d.bbox,t[6]);break;case 22:d=n.lowerLeftRect({x:o(t[4],this.format),y:o(t[5],this.format),width:o(t[2],this.format),height:o(t[3],this.format)}),t[6]&&(d.shape.rect.transform="rotate("+t[6]+")"),0===t[1]?l=!0:this.addBbox(d.bbox,t[6]);break;case 4:for(u=[],r=x=3,R=3+2*t[2];R>=x;r=x+=2)u.push([o(t[r],this.format),o(t[r+1],this.format)]);d=n.outline({points:u}),(c=t[t.length-1])&&(d.shape.polygon.transform="rotate("+c+")"),0===t[1]?l=!0:this.addBbox(d.bbox,t[t.length-1]);break;case 5:if(0!==t[6]&&(0!==t[3]||0!==t[4]))throw new RangeError("polygon center must be 0,0 if rotated in macro");d=n.polygon({cx:o(t[3],this.format),cy:o(t[4],this.format),dia:o(t[5],this.format),verticies:t[2],degrees:t[6]}),0===t[1]?l=!0:this.addBbox(d.bbox);break;case 6:if(0!==t[9]&&(0!==t[1]||0!==t[2]))throw new RangeError("moiré center must be 0,0 if rotated in macro");if(d=n.moire({cx:o(t[1],this.format),cy:o(t[2],this.format),outerDia:o(t[3],this.format),ringThx:o(t[4],this.format),ringGap:o(t[5],this.format),maxRings:t[6],crossThx:o(t[7],this.format),crossLength:o(t[8],this.format)}),t[9])for(T=d.shape,b=0,w=T.length;w>b;b++)p=T[b],null!=p.line&&(p.line.transform="rotate("+t[9]+")");this.addBbox(d.bbox,t[9]);break;case 7:if(0!==t[9]&&(0!==t[1]||0!==t[2]))throw new RangeError("thermal center must be 0,0 if rotated in macro");if(d=n.thermal({cx:o(t[1],this.format),cy:o(t[2],this.format),outerDia:o(t[3],this.format),innerDia:o(t[4],this.format),gap:o(t[5],this.format)}),t[6])for(B=d.shape,m=0,y=B.length;y>m;m++)if(p=B[m],null!=p.mask)for(D=p.mask._,g=0,v=D.length;v>g;g++)h=D[g],null!=h.rect&&(h.rect.transform="rotate("+t[6]+")");this.addBbox(d.bbox,t[6]);break;default:throw new Error(""+t[0]+" is not a valid primitive code")}if(l){for(i in d.shape)d.shape[i].fill="#000";if(0!==this.lastExposure){if(this.lastExposure=0,a="macro-"+this.name+"-mask-"+s(),h={mask:{id:a}},h.mask._=[{rect:{x:this.bbox[0],y:this.bbox[1],width:this.bbox[2]-this.bbox[0],height:this.bbox[3]-this.bbox[1],fill:"#fff"}}],1===this.shapes.length)for(i in this.shapes[0])this.shapes[0][i].mask="url(#"+a+")";else if(this.shapes.length>1){for(e={mask:"url(#"+a+")",_:[]},_=this.shapes,E=0,M=_.length;M>E;E++)p=_[E],e._.push(p);this.shapes=[{g:e}]}this.masks.push(h)}return this.masks[this.masks.length-1].mask._.push(d.shape)}if(this.lastExposure=1,Array.isArray(d.shape)){for(A=d.shape,L=[],q=0,k=A.length;k>q;q++)p=A[q],L.push(null!=p.mask?this.masks.push(p):this.shapes.push(p));return L}return this.shapes.push(d.shape)},t.prototype.addBbox=function(t,e){var r,i,o,n,s,h,l,a,u;if(null==e&&(e=0),e){for(s=Math.sin(e*Math.PI/180),i=Math.cos(e*Math.PI/180),Math.abs(s)<1e-9&&(s=0),Math.abs(i)<1e-9&&(i=0),n=[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]]],a=0,u=n.length;u>a;a++)o=n[a],h=o[0]*i-o[1]*s,l=o[0]*s+o[1]*i,(null===this.bbox[0]||h<this.bbox[0])&&(this.bbox[0]=h),(null===this.bbox[1]||l<this.bbox[1])&&(this.bbox[1]=l),(null===this.bbox[2]||h>this.bbox[2])&&(this.bbox[2]=h),(null===this.bbox[3]||l>this.bbox[3])&&(this.bbox[3]=l);return this.bbox=function(){var t,e,i,o;for(i=this.bbox,o=[],t=0,e=i.length;e>t;t++)r=i[t],o.push(r===-0?0:r);return o}.call(this)}return(null===this.bbox[0]||t[0]<this.bbox[0])&&(this.bbox[0]=t[0]),(null===this.bbox[1]||t[1]<this.bbox[1])&&(this.bbox[1]=t[1]),(null===this.bbox[2]||t[2]>this.bbox[2])&&(this.bbox[2]=t[2]),null===this.bbox[3]||t[3]>this.bbox[3]?this.bbox[3]=t[3]:void 0},t.prototype.getNumber=function(t){return t.match(/^[+-]?[\d.]+$/)?Number(t):t.match(/^\$\d+$/)?Number(this.modifiers[t]):this.evaluate(i.parse(t))},t.prototype.evaluate=function(t){switch(t.type){case"n":return this.getNumber(t.val);case"+":return this.evaluate(t.left)+this.evaluate(t.right);case"-":return this.evaluate(t.left)-this.evaluate(t.right);case"x":return this.evaluate(t.left)*this.evaluate(t.right);case"/":return this.evaluate(t.left)/this.evaluate(t.right)}},t}(),e.exports=r},{"./macro-calc":7,"./pad-shapes":10,"./svg-coord":13,"./unique-id":14}],9:[function(t,e){var r,i,o,n;n=function(t,e){var r;if(r="",0===e)return"";for(;e>1;)1&e&&(r+=t),e>>=1,t+=t;return r+t},r="_",i=" ",o=function(t,e){var s,h,l,a,u,c,f,p,d,x,b,m,g,w,y,v,M,k,E;if(null==e&&(e={}),x=e.pretty,c=null!=(M=e.indent)?M:0,h=null!=(k=e.maxDec)?k:!1,l=function(t){return"number"==typeof t?Number(t.toFixed(h)):t},p=x?"\n":"",b=p?"string"==typeof x?x:i:"",b=n(b,c),w="","function"==typeof t&&(t=t()),Array.isArray(t))for(u=y=0,v=t.length;v>y;u=++y)d=t[u],w+=(0!==u?p:"")+o(d,e);else if("object"==typeof t){if(s=!1,a=Object.keys(t)[0],null!=a){w=""+b+"<"+a,"function"==typeof t[a]&&(t[a]=t[a]()),E=t[a];for(f in E)g=E[f],"function"==typeof g&&(g=g()),f===r?s=g:(Array.isArray(g)&&(h&&(g=function(){var t,e,r;for(r=[],t=0,e=g.length;e>t;t++)m=g[t],r.push(l(m));return r}()),g=g.join(" ")),h&&(g=l(g)),w+=" "+f+'="'+g+'"');s&&(w+=">"+p+o(s,{pretty:x,indent:c+1})),w+=null!=t[a]._?""+p+b+"</"+a+">":"/>"}}else w+=""+t+" ";return w},e.exports=o},{}],10:[function(t,e){var r,i,o,n,s,h,l,a,u;a=t("./unique-id"),r=function(t){var e;if(null==t.dia)throw new Error("circle function requires diameter");if(null==t.cx)throw new Error("circle function requires x center");if(null==t.cy)throw new Error("circle function requires y center");return e=t.dia/2,{shape:{circle:{cx:t.cx,cy:t.cy,r:e}},bbox:[t.cx-e,t.cy-e,t.cx+e,t.cy+e]}},h=function(t){var e,r,i,o;if(null==t.width)throw new Error("rectangle requires width");if(null==t.height)throw new Error("rectangle requires height");if(null==t.cx)throw new Error("rectangle function requires x center");if(null==t.cy)throw new Error("rectangle function requires y center");return i=t.cx-t.width/2,o=t.cy-t.height/2,r={shape:{rect:{x:i,y:o,width:t.width,height:t.height}},bbox:[i,o,i+t.width,o+t.height]},t.obround&&(e=.5*Math.min(t.width,t.height),r.shape.rect.rx=e,r.shape.rect.ry=e),r},s=function(t){var e,r,i,o,n,s,h,l,a,u,c,f,p,d,x,b;if(null==t.dia)throw new Error("polygon requires diameter");if(null==t.verticies)throw new Error("polygon requires verticies");if(null==t.cx)throw new Error("polygon function requires x center");if(null==t.cy)throw new Error("polygon function requires y center");for(s=null!=t.degrees?t.degrees*Math.PI/180:0,h=2*Math.PI/t.verticies,i=t.dia/2,r="",c=null,d=null,u=null,p=null,e=x=0,b=t.verticies;b>=0?b>x:x>b;e=b>=0?++x:--x)l=s+e*h,o=i*Math.cos(l),n=i*Math.sin(l),Math.abs(o)<1e-9&&(o=0),Math.abs(n)<1e-9&&(n=0),a=t.cx+o,f=t.cy+n,(c>a||null===c)&&(c=a),(a>u||null===u)&&(u=a),(d>f||null===d)&&(d=f),(f>p||null===p)&&(p=f),r+=" "+a+","+f;return{shape:{polygon:{points:r.slice(1)}},bbox:[c,d,u,p]}},u=function(t){var e,r,i;if(null==t.x1)throw new Error("vector function requires start x");if(null==t.y1)throw new Error("vector function requires start y");if(null==t.x2)throw new Error("vector function requires end x");if(null==t.y2)throw new Error("vector function requires end y");if(null==t.width)throw new Error("vector function requires width");return e=Math.abs(Math.atan((t.y2-t.y1)/(t.x2-t.x1))),r=t.width/2*Math.sin(e),i=t.width/2*Math.cos(e),1e-7>r&&(r=0),1e-7>i&&(i=0),{shape:{line:{x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,"stroke-width":t.width,"stroke-linecap":"butt"}},bbox:[Math.min(t.x1,t.x2)-r,Math.min(t.y1,t.y2)-i,Math.max(t.x1,t.x2)+r,Math.max(t.y1,t.y2)+i]}},i=function(t){if(null==t.width)throw new Error("lower left rect requires width");if(null==t.height)throw new Error("lower left rect requires height");if(null==t.x)throw new Error("lower left rectangle requires x");if(null==t.y)throw new Error("lower left rectangle requires y");return{shape:{rect:{x:t.x,y:t.y,width:t.width,height:t.height}},bbox:[t.x,t.y,t.x+t.width,t.y+t.height]}},n=function(t){var e,r,i,o,n,s,h,l,a,u,c,f,p;if(!(Array.isArray(t.points)&&t.points.length>1))throw new Error("outline function requires points array");for(s=null,u=null,n=null,a=null,r="",p=t.points,c=0,f=p.length;f>c;c++){if(e=p[c],!Array.isArray(e)||2!==e.length)throw new Error("outline function requires points array");i=e[0],h=e[1],(s>i||null===s)&&(s=i),(i>n||null===n)&&(n=i),(u>h||null===u)&&(u=h),(h>a||null===a)&&(a=h),r+=" "+i+","+h}if(o=t.points[t.points.length-1][0],l=t.points[t.points.length-1][1],o!==t.points[0][0]||l!==t.points[0][1])throw new RangeError("last point must match first point of outline");return{shape:{polygon:{points:r.slice(1)}},bbox:[s,u,n,a]}},o=function(t){var e,r,i;if(null==t.cx)throw new Error("moiré requires x center");if(null==t.cy)throw new Error("moiré requires y center");if(null==t.outerDia)throw new Error("moiré requires outer diameter");if(null==t.ringThx)throw new Error("moiré requires ring thickness");if(null==t.ringGap)throw new Error("moiré requires ring gap");if(null==t.maxRings)throw new Error("moiré requires max rings");if(null==t.crossLength)throw new Error("moiré requires crosshair length");if(null==t.crossThx)throw new Error("moiré requires crosshair thickness");for(i=[{line:{x1:t.cx-t.crossLength/2,y1:0,x2:t.cx+t.crossLength/2,y2:0,"stroke-width":t.crossThx,"stroke-linecap":"butt"}},{line:{x1:0,y1:t.cy-t.crossLength/2,x2:0,y2:t.cy+t.crossLength/2,"stroke-width":t.crossThx,"stroke-linecap":"butt"}}],e=(t.outerDia-t.ringThx)/2,r=0;e>=t.ringThx&&r<t.maxRings;)i.push({circle:{cx:t.cx,cy:t.cy,r:e,fill:"none","stroke-width":t.ringThx}}),r++,e-=t.ringThx+t.ringGap;return e+=.5*t.ringThx,e>0&&r<t.maxRings&&i.push({circle:{cx:t.cx,cy:t.cy,r:e}}),{shape:i,bbox:[Math.min(t.cx-t.crossLength/2,t.cx-t.outerDia/2),Math.min(t.cy-t.crossLength/2,t.cy-t.outerDia/2),Math.max(t.cx+t.crossLength/2,t.cx+t.outerDia/2),Math.max(t.cy+t.crossLength/2,t.cy+t.outerDia/2)]}},l=function(t){var e,r,i,o,n,s,h,l,u;if(null==t.cx)throw new Error("thermal requires x center");if(null==t.cy)throw new Error("thermal requires y center");if(null==t.outerDia)throw new Error("thermal requires outer diameter");if(null==t.innerDia)throw new Error("thermal requires inner diameter");if(null==t.gap)throw new Error("thermal requires gap");return r="thermal-mask-"+a(),n=(t.outerDia-t.innerDia)/2,i=t.outerDia/2,o=i-n/2,h=t.cx-i,s=t.cx+i,u=t.cy-i,l=t.cy+i,e=t.gap/2,{shape:[{mask:{id:r,_:[{circle:{cx:t.cx,cy:t.cy,r:i,fill:"#fff"}},{rect:{x:h,y:-e,width:t.outerDia,height:t.gap,fill:"#000"}},{rect:{x:-e,y:u,width:t.gap,height:t.outerDia,fill:"#000"}}]}},{circle:{cx:t.cx,cy:t.cy,r:o,fill:"none","stroke-width":n,mask:"url(#"+r+")"}}],bbox:[h,u,s,l]}},e.exports={circle:r,rect:h,polygon:s,vector:u,lowerLeftRect:i,outline:n,moire:o,thermal:l}},{"./unique-id":14}],11:[function(t,e){var r,i,o,n,s,h,l,a,u;u=t("./unique-id"),o=t("./macro-tool"),a=t("./standard-tool"),l=t("./svg-coord").factor,i=Math.PI/2,s=3*i,h=2*Math.PI,r="in",n=function(){function t(t,e,r){null==t&&(t=""),null!=e&&(this.reader=new e(t)),null!=r&&(this.parser=new r),this.macros={},this.tools={},this.currentTool="",this.defs=[],this.group={g:{_:[]}},this.polarity="D",this.current=[],this.stepRepeat={x:1,y:1,i:0,j:0},this.srOverClear=!1,this.srOverCurrent=[],this.units=null,this.mode=null,this.quad=null,this.lastOp=null,this.region=!1,this.done=!1,this.pos={x:0,y:0},this.path=[],this.attr={"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":0,stroke:"#000"},this.bbox={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},this.layerBbox={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0}}return t.prototype.addTool=function(t,e){var r,i;if(null!=this.tools[t])throw new Error("cannot reassign tool "+t);return i=null!=e.macro?this.macros[e.macro].run(t,e.mods):a(t,e),this.tools[t]={trace:i.trace,pad:function(){var t,e,o,n;for(o=i.pad,n=[],t=0,e=o.length;e>t;t++)r=o[t],n.push(r);return n}(),flash:function(t,e){return{use:{x:t,y:e,"xlink:href":"#"+i.padId}}},bbox:function(t,e){return null==t&&(t=0),null==e&&(e=0),{xMin:t+i.bbox[0],yMin:e+i.bbox[1],xMax:t+i.bbox[2],yMax:e+i.bbox[3]}}},this.changeTool(t)},t.prototype.changeTool=function(t){var e;if(this.finishPath(),this.region)throw new Error("cannot change tool when in region mode");if(null!=this.tools[t])return this.currentTool=t;if(!(null!=(e=this.parser)?e.fmat:void 0))throw new Error("tool "+t+" is not defined")},t.prototype.command=function(t){var e,r,i,n,s,h,l,a;if(null!=t.macro)return r=new o(t.macro,this.parser.format.places),void(this.macros[r.name]=r);h=t.set;for(n in h){if(s=h[n],"units"===n&&null!=this.units&&null==(null!=(l=this.parser)?l.fmat:void 0))throw new Error("cannot redefine units");if("notation"===n&&null!=this.notation)throw new Error("cannot redefine notation");"region"===n&&this.finishPath(),"currentTool"===n?this.changeTool(s):this[n]=s}if(null!=t.tool){a=t.tool;for(e in a)i=a[e],this.addTool(e,i)}if(null!=t.op&&this.operate(t.op),null!=t["new"]){if(this.finishLayer(),null!=t["new"].layer)return this.polarity=t["new"].layer;if(null!=t["new"].sr)return this.finishSR(),this.stepRepeat=t["new"].sr}},t.prototype.plot=function(){for(var t,e;!this.done;){if(t=this.reader.nextBlock(),t===!1)throw new Error(null==(null!=(e=this.parser)?e.fmat:void 0)?"end of file encountered before required M02 command":"end of drill file encountered before M00/M30 command");this.command(this.parser.parseCommand(t))}return this.finish()},t.prototype.finish=function(){return this.finishPath(),this.finishLayer(),this.finishSR(),this.group.g.fill="currentColor",this.group.g.stroke="currentColor",this.group.g.transform="translate(0,"+(this.bbox.yMin+this.bbox.yMax)+") scale(1,-1)"},t.prototype.finishSR=function(){var t,e,r,i,o,n,s,h,l,a,c,f,p,d,x,b;if(this.srOverClear&&this.srOverCurrent){for(r="gerber-sr-mask_"+u(),e={mask:{color:"#000",id:r,_:[]}},e.mask._.push({rect:{fill:"#fff",x:this.bbox.xMin,y:this.bbox.yMin,width:this.bbox.xMax-this.bbox.xMin,height:this.bbox.yMax-this.bbox.yMin}}),o=s=0,c=this.stepRepeat.x*this.stepRepeat.i,f=this.stepRepeat.i;f>0?c>s:s>c;o=s+=f)for(n=h=0,p=this.stepRepeat.y*this.stepRepeat.j,d=this.stepRepeat.j;d>0?p>h:h>p;n=h+=d)for(x=this.srOverCurrent,l=0,a=x.length;a>l;l++)t=x[l],i={use:{}},0!==o&&(i.use.x=o),0!==n&&(i.use.y=n),i.use["xlink:href"]="#"+(null!=(b=t.C)?b:t.D),null!=t.D&&(i.use.fill="#fff"),e.mask._.push(i);return this.srOverClear=!1,this.srOverCurrent=[],this.defs.push(e),this.group.g.mask="url(#"+r+")"}},t.prototype.finishLayer=function(){var t,e,r,i,o,n,s,h,l,a,c,f,p,d,x,b;if(this.finishPath(),this.current.length){if(this.stepRepeat.x>1||this.stepRepeat.y>1){for(o="gerber-sr_"+u(),this.current=[{g:{id:o,_:this.current}}],(this.srOverClear||this.stepRepeat.i<this.layerBbox.xMax-this.layerBbox.xMin||this.stepRepeat.j<this.layerBbox.yMax-this.layerBbox.yMin)&&(i={},i[this.polarity]=o,this.srOverCurrent.push(i),"C"===this.polarity&&(this.srOverClear=!0,this.defs.push(this.current[0]))),h=a=0,d=this.stepRepeat.x;d>=0?d>a:a>d;h=d>=0?++a:--a)for(l=c=0,x=this.stepRepeat.y;x>=0?x>c:c>x;l=x>=0?++c:--c)(0!==h||0!==l)&&(n={use:{"xlink:href":"#"+o}},0!==h&&(n.use.x=h*this.stepRepeat.i),0!==l&&(n.use.y=l*this.stepRepeat.j),this.current.push(n));this.layerBbox.xMax+=(this.stepRepeat.x-1)*this.stepRepeat.i,this.layerBbox.yMax+=(this.stepRepeat.y-1)*this.stepRepeat.j}if(this.addBbox(this.layerBbox,this.bbox),this.layerBbox={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},"D"===this.polarity)if(null!=this.group.g.mask&&this.current.unshift(this.group),null==this.group.g.mask&&this.group.g._.length)for(b=this.current,f=0,p=b.length;p>f;f++)t=b[f],this.group.g._.push(t);else this.group={g:{_:this.current}};else"C"!==this.polarity||this.srOverClear||(r="gerber-mask_"+u(),s=this.bbox.xMax-this.bbox.xMin,e=this.bbox.yMax-this.bbox.yMin,this.current.unshift({rect:{x:this.bbox.xMin,y:this.bbox.yMin,width:s,height:e,fill:"#fff"}}),this.defs.push({mask:{id:r,color:"#000",_:this.current}}),this.group.g.mask="url(#"+r+")");return this.current=[]}},t.prototype.finishPath=function(){var t,e,r,i;if(this.path.length){if(e={path:{}},this.region)this.path.push("Z");else{i=this.tools[this.currentTool].trace;for(t in i)r=i[t],e.path[t]=r}return e.path.d=this.path,this.current.push(e),this.path=[]}},t.prototype.operate=function(t){var e,i,o,n,s,h,l,a,u,c,f,p,d,x,b;if("last"===t["do"]?t["do"]=this.lastOp:this.lastOp=t["do"],s=this.pos.x,h=this.pos.y,"I"===this.notation?(this.pos.x+=null!=(c=t.x)?c:0,this.pos.y+=null!=(f=t.y)?f:0):(this.pos.x=null!=(p=t.x)?p:this.pos.x,this.pos.y=null!=(d=t.y)?d:this.pos.y),i=this.pos.x,o=this.pos.y,l=this.tools[this.currentTool],null==this.units&&(this.units=null!=this.backupUnits?this.backupUnits:r),null==this.notation){if(null==(null!=(x=this.parser)?x.fmat:void 0))throw new Error("format has not been set");this.notation="A"}if("move"===t["do"]&&this.path.length)return this.path.push("M",i,o);if("flash"===t["do"]){if(this.finishPath(),this.region)throw new Error("cannot flash while in region mode");if(l.pad){for(b=l.pad,a=0,u=b.length;u>a;a++)n=b[a],this.defs.push(n);l.pad=!1}return this.current.push(l.flash(i,o)),this.addBbox(l.bbox(i,o),this.layerBbox)}if("int"===t["do"]){if(!this.region&&!l.trace)throw new Error(""+this.currentTool+" is not a strokable tool");return 0===this.path.length&&(this.path.push("M",s,h),e=this.region?{xMin:s,yMin:h,xMax:s,yMax:h}:l.bbox(s,h),this.addBbox(e,this.layerBbox)),null==this.mode&&(this.mode="i"),"i"===this.mode?this.drawLine(s,h,i,o):(null==t.i&&(t.i=0),null==t.j&&(t.j=0),this.drawArc(s,h,i,o,t.i,t.j))}},t.prototype.drawLine=function(t,e,r,o){var n,s,h,l,a,u,c,f,p,d,x,b,m;return b=this.tools[this.currentTool],n=this.region?{xMin:r,yMin:o,xMax:r,yMax:o}:b.bbox(r,o),this.addBbox(n,this.layerBbox),this.region||b.trace["stroke-width"]>=0?this.path.push("L",r,o):(c=b.pad[0].rect.width/2,u=b.pad[0].rect.height/2,f=t-c,p=t+c,d=e-u,x=e+u,s=r-c,h=r+c,l=o-u,a=o+u,m=Math.atan2(o-e,r-t),m>=0&&i>m?this.path.push("M",f,d,p,d,h,l,h,a,s,a,f,x,"Z"):m>=i&&m<Math.PI?this.path.push("M",f,d,p,d,p,x,h,a,s,a,s,l,"Z"):-Math.PI<=m&&-i>m?this.path.push("M",p,d,p,x,f,x,s,a,s,l,h,l,"Z"):m>=-i&&0>m?this.path.push("M",f,d,s,l,h,l,h,a,p,x,f,x,"Z"):void 0)},t.prototype.drawArc=function(t,e,r,o,n,a){var u,c,f,p,d,x,b,m,g,w,y,v,M,k,E,q,R,T,B,D,_,A,L,C,I,j,O,P,z,N;if(u=1.5*l*Math.pow(10,-(null!=(P=null!=(z=this.parser)?z.format.places[1]:void 0)?P:7)),w=this.tools[this.currentTool],!this.region&&!w.trace["stroke-width"])throw Error("cannot stroke an arc with non-circular tool "+this.currentTool);if(null==this.quad)throw new Error("arc quadrant mode has not been set");for(b=Math.sqrt(Math.pow(n,2)+Math.pow(a,2)),g="cw"===this.mode?0:1,x=0,k=[],f=[[t+n,e+a]],"s"===this.quad&&f.push([t-n,e-a],[t-n,e+a],[t+n,e-a]),C=0,j=f.length;j>C;C++)c=f[C],d=Math.sqrt(Math.pow(c[0]-r,2)+Math.pow(c[1]-o,2)),Math.abs(b-d)<u&&k.push({x:c[0],y:c[1]});for(v=0,M=0,p=null,I=0,O=k.length;O>I&&(c=k[I],v=Math.atan2(o-c.y,r-c.x),0>v&&(v+=h),M=Math.atan2(e-c.y,t-c.x),0>M&&(M+=h),"cw"===this.mode&&v>M?M+=h:"ccw"===this.mode&&M>v&&(v+=h),y=Math.abs(v-M),"s"===this.quad&&i>=y?p=c:"m"===this.quad&&(y>=Math.PI&&(x=1),p={x:c.x,y:c.y}),null==p);I++);return null!=p?(m=this.region?0:w.bbox().xMax,"cw"===this.mode&&(N=[M,v],v=N[0],M=N[1]),T=M>0?h:0,A=i+(M>i?h:0),R=Math.PI+(M>Math.PI?h:0),_=s+(M>s?h:0),q=R>=M&&v>=R?p.x-b-m:Math.min(t,r)-m,E=T>=M&&v>=T?p.x+b+m:Math.max(t,r)+m,D=_>=M&&v>=_?p.y-b-m:Math.min(e,o)-m,B=A>=M&&v>=A?p.y+b+m:Math.max(e,o)+m,L=Math.abs(t-r)<u&&Math.abs(e-o)<u,"m"===this.quad&&L&&(this.path.push("A",b,b,0,0,g,r+2*n,o+2*a),q=p.x-b-m,D=p.y-b-m,E=p.x+b+m,B=p.y+b+m),this.path.push("A",b,b,0,x,g,r,o),"s"===this.quad&&L&&this.path.push("Z"),this.addBbox({xMin:q,yMin:D,xMax:E,yMax:B},this.layerBbox)):void 0},t.prototype.addBbox=function(t,e){return t.xMin<e.xMin&&(e.xMin=t.xMin),t.yMin<e.yMin&&(e.yMin=t.yMin),t.xMax>e.xMax&&(e.xMax=t.xMax),t.yMax>e.yMax?e.yMax=t.yMax:void 0},t}(),e.exports=n},{"./macro-tool":8,"./standard-tool":12,"./svg-coord":13,"./unique-id":14}],12:[function(t,e){var r,i,o;o=t("./unique-id"),r=t("./pad-shapes"),i=function(t,e){var i,n,s,h,l,a,u;if(a={pad:[],trace:!1},e.cx=0,e.cy=0,n="tool-"+t+"-pad-"+o(),u="",null!=e.dia&&null==e.verticies){if(null!=e.obround||null!=e.width||null!=e.height||null!=e.degrees)throw new Error("incompatible parameters for tool "+t);if(e.dia<0)throw new RangeError(""+t+" circle diameter out of range ("+e.dia+"<0)");u="circle",null==e.hole&&(a.trace={"stroke-width":e.dia,fill:"none"})}else if(null!=e.width&&null!=e.height){if(null!=e.dia||null!=e.verticies||null!=e.degrees)throw new Error("incompatible parameters for tool "+t);if(e.width<=0)throw new RangeError(""+t+" rect width out of range ("+e.width+"<=0)"); | ||
if(e.height<=0)throw new RangeError(""+t+" rect height out of range ("+e.height+"<=0)");u="rect",null!=e.hole||e.obround||(a.trace={})}else{if(null==e.dia||null==e.verticies)throw new Error("unidentified standard tool shape");if(null!=e.obround||null!=e.width||null!=e.height)throw new Error("incompatible parameters for tool "+t);if(e.verticies<3||e.verticies>12)throw new RangeError(""+t+" polygon points out of range ("+e.verticies+"<3 or >12)]");u="polygon"}if(l=r[u](e),null!=e.hole){if(i=null,null!=e.hole.dia&&null==e.hole.width&&null==e.hole.height){if(!(e.hole.dia>=0))throw new RangeError(""+t+" hole diameter out of range ("+e.hole.dia+"<0)");i=r.circle({cx:e.cx,cy:e.cy,dia:e.hole.dia}),i=i.shape,i.circle.fill="#000"}else{if(null==e.hole.width||null==e.hole.height)throw new Error(""+t+" has invalid hole parameters");if(!(e.hole.width>=0))throw new RangeError(""+t+" hole width out of range ("+e.hole.width+"<0)");if(!(e.hole.height>=0))throw new RangeError(""+t+" hole height out of range");i=r.rect({cx:e.cx,cy:e.cy,width:e.hole.width,height:e.hole.height}),i=i.shape,i.rect.fill="#000"}h=n+"-mask",s={mask:{id:n+"-mask",_:[{rect:{x:l.bbox[0],y:l.bbox[1],width:l.bbox[2]-l.bbox[0],height:l.bbox[3]-l.bbox[1],fill:"#fff"}},i]}},l.shape[u].mask="url(#"+h+")",a.pad.push(s)}return n&&(l.shape[u].id=n),a.pad.push(l.shape),a.bbox=l.bbox,a.padId=n,a},e.exports=i},{"./pad-shapes":10,"./unique-id":14}],13:[function(t,e){var r,i,o,n=[].indexOf||function(t){for(var e=0,r=this.length;r>e;e++)if(e in this&&this[e]===t)return e;return-1};i=1e3,r=3,o=function(t,e){var i,o,s,h,l,a,u,c,f,p,d,x,b;if(t=""+t,o="",i="",l="+",("-"===t[0]||"+"===t[0])&&(l=t[0],t=t.slice(1)),n.call(t,".")>=0||null==e.zero){if(a=t.split("."),a.length>2)return 0/0;d=[a[0],a[1]],o=d[0],i=d[1],null==i&&(i=""),null==o&&(o="")}else{if("number"!=typeof(null!=e&&null!=(x=e.places)?x[0]:void 0)&&"number"!=typeof(null!=e&&null!=(b=e.places)?b[1]:void 0))return 0/0;if("T"===e.zero){for(h=u=0,f=t.length;f>u;h=++u)s=t[h],h<e.places[0]?o+=s:i+=s;for(;o.length<e.places[0];)o+="0"}else if("L"===e.zero){for(h=c=0,p=t.length;p>c;h=++c)s=t[h],t.length-h<=e.places[1]?i+=s:o+=s;for(;i.length<e.places[1];)i="0"+i}}for(;i.length<r;)i+="0";return o+=i.slice(0,r),i=i.length>r?"."+i.slice(r):"",Number(l+o+i)},e.exports={get:o,factor:i}},{}],14:[function(t,e){var r,i;i=1e3,r=function(){return i++},e.exports=r},{}]},{},[1])(1)}); |
{ | ||
"name": "gerber-to-svg", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Gerber and NC drill file to SVG converter", | ||
@@ -10,5 +10,3 @@ "main": "lib/gerber-to-svg.js", | ||
"scripts": { | ||
"prepublish": "gulp", | ||
"test": "gulp test", | ||
"test:travis": "gulp coverage" | ||
"test": "gulp test" | ||
}, | ||
@@ -34,21 +32,21 @@ "repository": { | ||
"devDependencies": { | ||
"browserify": "^5.9.1", | ||
"coffee-coverage": "^0.4.2", | ||
"brfs": "^1.2.0", | ||
"browserify": "^8.0.1", | ||
"chai": "^1.10.0", | ||
"coffee-script": "^1.7.1", | ||
"coffeeify": "^0.7.0", | ||
"coffeeify": "^1.0.0", | ||
"glob": "^4.3.2", | ||
"gulp": "^3.8.5", | ||
"gulp-coffee": "^2.0.1", | ||
"gulp-coveralls": "^0.1.2", | ||
"gulp-mocha": "^0.4.1", | ||
"gulp-coffee-istanbul": "^0.6.0", | ||
"gulp-coveralls": "^0.1.2", | ||
"gulp-mocha": "^2.0.0", | ||
"gulp-rename": "^1.2.0", | ||
"gulp-run": "^1.6.3", | ||
"gulp-streamify": "0.0.5", | ||
"gulp-uglify": "^1.0.1", | ||
"gulp-util": "^2.2.19", | ||
"gulp-util": "^3.0.1", | ||
"jquery": "^2.1.1", | ||
"mocha": "^1.20.1", | ||
"mocha-lcov-reporter": "0.0.1", | ||
"node-static": "^0.7.4", | ||
"should": "^4.0.4", | ||
"vinyl-source-stream": "^0.1.1" | ||
"vinyl-source-stream": "^1.0.0", | ||
"zuul": "git://github.com/mcous/zuul.git#e21cf63" | ||
}, | ||
@@ -55,0 +53,0 @@ "dependencies": { |
@@ -1,3 +0,5 @@ | ||
# gerber-to-svg [![Build Status](http://img.shields.io/travis/mcous/gerber-to-svg.svg?style=flat)](https://travis-ci.org/mcous/gerber-to-svg) [![Coverage](http://img.shields.io/coveralls/mcous/gerber-to-svg.svg?style=flat)](https://coveralls.io/r/mcous/gerber-to-svg) [![Version](http://img.shields.io/npm/v/gerber-to-svg.svg?style=flat)](https://www.npmjs.org/package/gerber-to-svg) | ||
# gerber-to-svg [![Build Status](http://img.shields.io/travis/mcous/gerber-to-svg.svg?style=flat-square)](https://travis-ci.org/mcous/gerber-to-svg) [![Coverage](http://img.shields.io/coveralls/mcous/gerber-to-svg.svg?style=flat-square)](https://coveralls.io/r/mcous/gerber-to-svg) [![Version](http://img.shields.io/npm/v/gerber-to-svg.svg?style=flat-square)](https://www.npmjs.org/package/gerber-to-svg) [![Dependencies](http://img.shields.io/david/mcous/gerber-to-svg.svg?style=flat-square)](https://david-dm.org/mcous/gerber-to-svg) | ||
[![Sauce Test Status](https://saucelabs.com/browser-matrix/gerber-to-svg.svg)](https://saucelabs.com/u/gerber-to-svg) | ||
Gerber and NC drill file to SVG converter for Node and the browser. | ||
@@ -4,0 +6,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
549481
30
179
4
2583