56 lines
708 KiB
JavaScript
56 lines
708 KiB
JavaScript
|
var UDOC={};UDOC.G={concat:function(e,r){for(var s=0;s<r.cmds.length;s++)e.cmds.push(r.cmds[s]);for(var s=0;s<r.crds.length;s++)e.crds.push(r.crds[s])},getBB:function(e){for(var r=1e99,s=1e99,o=-r,a=-s,u=0;u<e.length;u+=2){var l=e[u],v=e[u+1];l<r&&(r=l),l>o&&(o=l),v<s&&(s=v),v>a&&(a=v)}return[r,s,o,a]},rectToPath:function(e){return{cmds:["M","L","L","L","Z"],crds:[e[0],e[1],e[2],e[1],e[2],e[3],e[0],e[3]]}},insideBox:function(e,r){return r[0]<=e[0]&&r[1]<=e[1]&&e[2]<=r[2]&&e[3]<=r[3]},isBox:function(e,r){var s=function(y,w){for(var M=0;M<8;M+=2){for(var T=!0,B=0;B<8;B++)if(Math.abs(w[B]-y[B+M&7])>=2){T=!1;break}if(T)return!0}return!1};if(e.cmds.length>10)return!1;var o=e.cmds.join(""),a=e.crds,u=!1;if(o=="MLLLZ"&&a.length==8||o=="MLLLLZ"&&a.length==10){if(a.length==10&&(a=a.slice(0,8)),r==null){r=[a[0],a[1],a[0],a[1]];for(var l=0;l<a.length;l+=2){var v=a[l],p=a[l+1];v<r[0]&&(r[0]=v),p<r[1]&&(r[1]=p),r[2]<v&&(r[2]=v),r[3]<p&&(r[3]=p)}}var c=r[0],_=r[1],f=r[2],g=r[3];u||(u=s(a,[c,_,f,_,f,g,c,g])),u||(u=s(a,[c,g,f,g,f,_,c,_]))}return u},boxArea:function(e){var r=e[2]-e[0],s=e[3]-e[1];return r*s},newPath:function(e){e.pth={cmds:[],crds:[]}},moveTo:function(e,r,s){var o=UDOC.M.multPoint(e.ctm,[r,s]),a=e.pth,u=a.cmds.length;u!=0&&a.cmds[u-1]=="M"&&(a.cmds.pop(),a.crds.pop(),a.crds.pop()),e.pth.cmds.push("M"),e.pth.crds.push(o[0],o[1]),e.cpos=o},lineTo:function(e,r,s){var o=UDOC.M.multPoint(e.ctm,[r,s]);e.cpos[0]==o[0]&&e.cpos[1]==o[1]||(e.pth.cmds.push("L"),e.pth.crds.push(o[0],o[1]),e.cpos=o)},curveTo:function(e,r,s,o,a,u,l){var v;e.pth.cmds.length==0&&UDOC.G.moveTo(e,0,0),v=UDOC.M.multPoint(e.ctm,[r,s]),r=v[0],s=v[1],v=UDOC.M.multPoint(e.ctm,[o,a]),o=v[0],a=v[1],v=UDOC.M.multPoint(e.ctm,[u,l]),u=v[0],l=v[1],e.cpos=v,e.pth.cmds.push("C"),e.pth.crds.push(r,s,o,a,u,l)},closePath:function(e){e.pth.cmds.push("Z")},arc:function(e,r,s,o,a,u,l){if(l)for(;u>a;)u-=2*Math.PI;else for(;u<a;)u+=2*Math.PI;for(var v=(u-a)/4,p=Math.cos(v/2),c=-Math.sin(v/2),_=(4-p)/3,f=c==0?c:(1-p)*(3-p)/(3*c),g=_,y=-f,w=p,M=-c,T=[p,c],B=[_,f],H=[g,y],J=[w,M],Q={cmds:[e.pth.cmds.length==0?"M":"L"],crds:[p,c]},q=[1,0,0,1,0,0],O=0;O<4;O++)B=UDOC.M.multPoint(q,B),H=UDOC.M.multPoint(q,H),J=UDOC.M.multPoint(q,J),Q.crds.push(B[0],B[1],H[0],H[1],J[0],J[1]),Q.cmds.push("C"),O==0&&UDOC.M.rotate(q,-v);var K=[o,0,0,o,r,s];UDOC.M.rotate(q,-a+v/2),UDOC.M.concat(q,K),UDOC.M.multArray(q,Q.crds),UDOC.M.multArray(e.ctm,Q.crds),UDOC.G.concat(e.pth,Q);var s=Q.crds.pop();r=Q.crds.pop(),e.cpos=[r,s]},drawRect:function(e,r,s,o,a){UDOC.G.moveTo(e,r,s),UDOC.G.lineTo(e,r+o,s),UDOC.G.lineTo(e,r+o,s+a),UDOC.G.lineTo(e,r,s+a),UDOC.G.closePath(e)},toPoly:function(e){if(e.cmds[0]!="M"||e.cmds[e.cmds.length-1]!="Z")return null;for(var r=1;r<e.cmds.length-1;r++)if(e.cmds[r]!="L")return null;var s=[],o=e.crds.length;e.crds[0]==e.crds[o-2]&&e.crds[1]==e.crds[o-1]&&(o-=2);for(var r=0;r<o;r+=2)s.push([e.crds[r],e.crds[r+1]]);return UDOC.G.polyArea(e.crds)<0&&s.reverse(),s},fromPoly:function(e){for(var r={cmds:[],crds:[]},s=0;s<e.length;s++)r.crds.push(e[s][0],e[s][1]),r.cmds.push(s==0?"M":"L");return r.cmds.push("Z"),r},polyArea:function(e){if(e.length<6)return 0;for(var r=e.length-2,s=(e[0]-e[r])*(e[r+1]+e[1]),o=0;o<r;o+=2)s+=(e[o+2]-e[o])*(e[o+1]+e[o+3]);return-s*.5},polyClip:function(e,r){var s,o,a,u,l=function(_){return(o[0]-s[0])*(_[1]-s[1])>(o[1]-s[1])*(_[0]-s[0])},v=function(){var _=[s[0]-o[0],s[1]-o[1]],f=[a[0]-u[0],a[1]-u[1]],g=s[0]*o[1]-s[1]*o[0],y=a[0]*u[1]-a[1]*u[0],w=1/(_[0]*f[1]-_[1]*f[0]);return[(g*f[0]-y*_[0])*w,(g*f[1]-y*_[1])*w]},p=e;s=r[r.length-1];for(j in r){var o=r[j],c=p;p=[],a=c[c.length-1];for(i in c){var u=c[i];l(u)?(l(a)||p.push(v()),p.push(u)):l(a)&&p.push(v()),a=u}s=o}return p}},UDOC.M={getScale:function(e){return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))},translate:function(e,r,s){UDOC.M.concat(e,[1,0,0,1,r,s])},rotate:function(e,r){UDOC.M.concat(e,[Math.cos(r),-Math.sin(r),Math.sin(r),Math.cos(r),0,0])},scale:function(e,r,s){UDOC.M.concat(e,[r,0,0,s,0,0])},concat:function(e,r){var s=e[0],o=e[1],a=e[2],u=e[3],l=e[4],v=e[5];e[0]=s*r[0]+o*r[2],e[1]=s*r[1]+o*r[3],e[2
|
||
|
`,"\r"," ","\b","\f","\\","(",")"," ","/"],a=0;a<e.length;a++){var u=e[a],l=String.fromCharCode(u);if(l=="\\"){var v=String.fromCharCode(e[a+1]);if(a++,v=="\r"||v==`
|
||
|
`)continue;var p=s.indexOf(v);if(p!=-1)r.push(o[p].charCodeAt(0));else{var c=v+String.fromCharCode(e[a+1])+String.fromCharCode(e[a+2]);a+=2,r.push(parseInt(c,8))}}else r.push(u)}return r},FromPS.makeString=function(e){for(var r=["n","r","t","b","f","\\","(",")"],s=[`
|
||
|
`,"\r"," ","\b","\f","\\","(",")"],o=[],a=0;a<e.length;a++){var u=e[a],l=s.indexOf(String.fromCharCode(u));l==-1?o.push(u):o.push(92,r[l].charCodeAt(0))}return o},FromPS.readHex=function(e,r,s){for(var o=0,a=-1,u=e.off;o!=r;){var l=e.buff[u];u++;var v=0;if(47<l&&l<58)v=l-48;else if(96<l&&l<103)v=10+l-97;else if(64<l&&l<71)v=10+l-65;else{if(l==62)break;if(FromPS.isWhite(l))continue;throw"e"}a==-1?a=v:(s[o]=a<<4|v,a=-1,o++)}e.off=u},FromPS.getShadingFill=function(e,r){var s=e["/ShadingType"],o=e["/ColorSpace"],a=e["/Extend"],u=e["/Coords"]?e["/Coords"].slice(0):null;a==null&&(a=[!1,!1]);var l="";if(s==2)l="lin";else if(s==3)l="rad";else{console.log("Unknown shading type",s);return}var v=e["/Function"],p;if(v instanceof Array){for(var c=v.length,_,f=0;f<c;f++){var g=FromPS.getGrad(v[f],"/DeviceGray");if(f==0)_=g;else for(var y=_.length,w=0;w<y;w++)_[w][1][f]=g[w][1][0]}if(o=="/DeviceCMYK")for(var f=0;f<_.length;f++)_[f][1]=UDOC.C.cmykToRgb(_[f][1]);p=_}else p=FromPS.getGrad(v,o);if(l=="rad"&&u[2]>u[5]){u=u.slice(3).concat(u.slice(0,3)),a.reverse(),p.reverse();for(var f=0;f<p.length;f++)p[f][0]=1-p[f][0]}if(!a[0]&&l!="rad"){var M=p[0];M[0]+=.002,p.unshift([.001,M[1].slice(),0])}if(!a[1]){var M=p[p.length-1];M[0]-=.002,p.push([0,999,M[1].slice(),0])}var T={typ:l,mat:r,grad:p,crds:u};return T},FromPS.getGrad=function(e,r){var s=FromPS._normColor,o=e["/Functions"],a=e["/FunctionType"],u=e["/Bounds"],l=e["/Encode"],v;if(a==0){v=[],n=Math.min(4,e["/Size"][0]);for(var p=0;p<=n;p++)v.push([p/n,s(e,[p/n],r)])}else if(a==2)v=[[0,s(e,[0],r)],[1,s(e,[1],r)]];else if(a==3){var c=0;v=[],(u.length==0||u[0]>0)&&v.push([0,s(o[0],[c],r)]);for(var p=0;p<u.length;p++)v.push([u[p],s(o[p],[1-c],r)]);(u.length==0||u[u.length-1]<1)&&v.push([1,s(o[o.length-1],[1-c],r)])}else if(a==4){v=[];for(var p=0;p<5;p++)v.push([p/5,s(e,[p/5],r)])}return v},FromPS._normColor=function(e,r,s){var o="/DeviceCMYK",a="/DeviceRGB",u,l=FromPS.Func(e,r);if(s[3]&&s[3]["/Length"])if(l=FromPS.Func(s[3],l),s[2]==o||l.length==4)u=o;else if(s[2]==a)u=a;else if(s[2]&&s[2][1]&&s[2][1]["/Alternate"]&&s[2][1]["/Alternate"][0]=="/Lab")u="/Lab";else throw console.log(l,s),"unknown color profile";else if(s[0]=="/ICCBased"&&s[1]){var v=s[1]["/N"];if(v==4)u=o;else if(v==3)u=a;else throw v}else s[0]=="/Separation"?(l=FromPS._readSeparation(s,l[0]),u=a):s.length==1?u=s[0]:s[2]==o?u=o:u=s;if(u==a)l=l;else if(u==o)l=UDOC.C.cmykToRgb(l);else if(u=="/DeviceGray")l=[l[0],l[0],l[0]];else if(u=="/Lab")l=UDOC.C.labToRgb(l);else throw"Unknown color space "+u;return l},FromPS._readSeparation=function(e,r){var s=FromPS.Func(e[3],[r]),o;return e&&e[2]=="/DeviceCMYK"?o=UDOC.C.cmykToRgb(s):e&&e[2]=="/DeviceGray"?o=[s[0],s[0],s[0]]:o=UDOC.C.labToRgb(s),o},FromPS.Func=function(e,r){for(var s=FromPS.intp,o=e["/Domain"],a=e["/Range"],u=e["/FunctionType"],l=[],v=0;v<r.length;v++)r[v]=Math.max(o[2*v],Math.min(o[2*v+1],r[v]));if(u==0){var p=e["/Encode"],c=e["/Size"],_=e["/Decode"],f=a.length/2;p==null&&(p=[0,c[0]-1]),_==null&&(_=a);for(var v=0;v<r.length;v++){var g=s(r[v],o[2*v],o[2*v+1],p[2*v],p[2*v+1]);r[v]=Math.max(0,Math.min(c[v]-1,g))}for(var y=e["/DataSource"],w=0;w<f;w++){var M=Math.round(r[0]),T;y?T=y.charCodeAt(f*M+w):T=FromPS.GS(e)[f*M+w],T=s(T,0,255,_[2*w],_[2*w+1]),l.push(T)}}else if(u==2)for(var B=e["/C0"],H=e["/C1"],J=e["/N"],M=r[0],v=0;v<B.length;v++)l[v]=B[v]+Math.pow(M,J)*(H[v]-B[v]);else if(u==4){var Q=FromPS._getEnv([0,0,0,0]);Q.pgOpen=!0;var q=[],O=[],y=FromPS._getDictStack([],{}),K=[];K.push({typ:"file",val:{buff:FromPS.GS(e),off:0}});for(var pe=!0;pe;)pe=FromPS.step(O,y,K,q,Q,{},FromPS.operator);var R=O.pop();R.off=0,K.push(R);for(var v=0;v<r.length;v++)O.push({typ:"real",val:r[v]});for(pe=!0;pe;)pe=FromPS.step(O,y,K,q,Q,{},FromPS.operator);for(var v=0;v<O.length;v++)l.push(O[v].val)}if(a)for(var v=0;v<l.length;v++)l[v]=Math.max(a[2*v],Math.min(a[2*v+1],l[v]));return l},FromPS.intp=function(e,r,s,o,a){return o+(e-r)*(a-o)/(s-r)},FromPS.GS=function(e){if(e.stream==null){var r=e.buff;delete e.buff;var s=e["/Filter"],o=e["/DecodeParms"];if(s!=null){for(var a=typeof s=="string"?[s]:s,u=!
|
||
|
`)},ToPDF.prototype.Fill=function(e,r){e.ca!=0&&(this.setGState(e,!0),this._cont+=` f
|
||
|
`)},ToPDF._flt=function(e){return""+parseFloat(e.toFixed(2))},ToPDF._fltc=function(e){return""+parseFloat(e.toFixed(3))},ToPDF._scale=function(e){return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))},ToPDF._mat=function(e){var r=e.map(ToPDF._flt).join(" ");return r=="1 0 0 1 0 0"?"":r+" cm "},ToPDF._eq=function(e,r){if(e.length!=r.length)return!1;for(var s=0;s<e.length;s++)if(e[s]!=r[s])return!1;return!0},ToPDF._format=function(e){for(var r=[[255,216,255],[0,0,0,12,106,80,32,32],[0,0,0,0,48,0,1,0]],s=["/DCTDecode","/JPXDecode","/JBIG2Decode"],o=0;o<r.length;o++){for(var a=r[o],u=!0,l=0;l<a.length;l++)u=u&&e[l]==a[l];if(u)return s[o]}},ToPDF.prototype.setGState=function(e,r){var s=this._gst,o={};for(var a in e)o[a]=typeof e[a]=="string"?e[a]:JSON.stringify(e[a]);for(var u=ToPDF._scale(e.ctm),l=e.dash.slice(0),v=0;v<l.length;v++)l[v]=ToPDF._flt(l[v]*u);var p=this._cont;if(s.lcap!=o.lcap&&(p+=e.lcap+" J "),s.ljoin!=o.ljoin&&(p+=e.ljoin+" j "),s.lwidth!=o.lwidth&&(p+=ToPDF._flt(e.lwidth*u)+" w "),s.mlimit!=o.mlimit&&(p+=ToPDF._flt(e.mlimit)+" M "),(s.dash!=o.dash||s.doff!=o.doff)&&(p+="["+l.join(" ")+"] "+e.doff+" d "),s.COLR!=o.COLR&&(p+=e.COLR.map(ToPDF._fltc).join(" ")+" RG "),s.colr!=o.colr)if(e.colr.length!=null)p+=e.colr.map(ToPDF._fltc).join(" ")+` rg
|
||
|
`;else{var c=this._res["/Pattern"],_=e.colr,f="/P"+(ToPDF.maxI(c)+1),g={"/ShadingType":_.typ=="lin"?2:3,"/ColorSpace":"/DeviceRGB","/Extend":[!0,!0],"/Function":ToPDF._makeGrad(_.grad),"/Coords":_.crds};c[f]={"/Type":"/Pattern","/PatternType":2,"/Matrix":_.mat,"/Shading":g},p+="/Pattern cs "+f+" scn "}var y=this._res["/ExtGState"];if(s.bmode!=o.bmode){var w=o.bmode;y[w]==null&&(y[w]={"/Type":"/ExtGState","/BM":e.bmode}),p+=w+" gs "}if(s.CA!=o.CA){var w="/Alpha"+Math.round(255*o.CA);y[w]==null&&(y[w]={"/Type":"/ExtGState","/CA":e.CA}),p+=w+" gs "}if(s.ca!=o.ca){var w="/alpha"+Math.round(255*o.ca);y[w]==null&&(y[w]={"/Type":"/ExtGState","/ca":e.ca}),p+=w+" gs "}r&&(p+=ToPDF.drawPath(e.pth)),this._cont=p,this._gst=o},ToPDF.drawPath=function(e){for(var r=0,s="",o=ToPDF._flt,a=0;a<e.cmds.length;a++){var u=e.cmds[a];if(u=="M"){for(var l=0;l<2;l++)s+=o(e.crds[r++])+" ";s+="m "}else if(u=="L"){for(var l=0;l<2;l++)s+=o(e.crds[r++])+" ";s+="l "}else if(u=="C"){for(var l=0;l<6;l++)s+=o(e.crds[r++])+" ";s+="c "}else if(u=="Z")s+="h ";else throw u}return s},ToPDF._makeGrad=function(e){var r=[],s=[],o=[0,1],a=ToPDF._stopFun;if(e.length==2)return a(e[0][1],e[1][1]);s.push(a(e[0][1],e[1][1]));for(var u=1;u<e.length-1;u++)r.push(e[u][0]),s.push(a(e[u][1],e[u+1][1])),o.push(0,1);return{"/FunctionType":3,"/Encode":o,"/Domain":[0,1],"/Bounds":r,"/Functions":s}},ToPDF._stopFun=function(e,r){return{"/FunctionType":2,"/C0":e,"/C1":r,"/Domain":[0,1],"/N":1}},ToPDF.prototype.PutText=function(e,r,s,o){this.setGState(e,!1);var a=this.addFont(e.font.Tf,o);this._cont+="q ",this._cont+=ToPDF._mat(e.ctm),this._cont+=ToPDF._mat(e.font.Tm),this._cont+="BT "+a+" "+ToPDF._flt(e.font.Tfs)+" Tf 0 0 Td (";var u=[];if(o==null)for(var l=[128,8364,130,8218,131,402,132,8222,133,8230,134,8224,135,8225,136,710,137,8240,138,352,139,8249,140,338,142,381,145,8216,146,8217,147,8220,148,8221,149,8226,150,8211,151,8212,152,732,153,8482,154,353,155,8250,156,339,158,382,159,376],v=0;v<r.length;v++){var p=r.charCodeAt(v);if(p>255){var c=l.indexOf(p);u.push(c==-1?32:l[c-1])}else u.push(p)}else for(var v=0;v<r.length;v++){var p=r.charCodeAt(v);u.push(p&255)}u=FromPS.makeString(u);for(var v=0;v<u.length;v++)this._cont+=String.fromCharCode(u[v]);this._cont+=") Tj ET ",this._cont+=` Q
|
||
|
`},ToPDF.prototype.PutImage=function(e,r,s,o,a){if(r.length==s*o*4&&a==null){for(var u=s*o,l=new Uint8Array(u),v=255,p=0;p<u;p++)l[p]=r[(p<<2)+3],v&=r[(p<<2)+3];v!=255&&(a=l)}var c=this.addImage(r,s,o,a);this.setGState(e,!1),this._cont+="q "+ToPDF._mat(e.ctm),this._cont+=c+` Do Q
|
||
|
`},ToPDF.prototype.ShowPage=function(){ToPDF.addPage(this._xr,this._cont,this._bnds),this._cont="",this._gst=ToPDF.defState()},ToPDF.prototype.Print=function(e){},ToPDF.prototype.Done=function(){var e=this._res;for(var r in e)Object.keys(e[r])==0&&delete e[r];this.buffer=ToPDF.xrToPDF(this._xr)},ToPDF.prototype.addImage=function(e,r,s,o){var a;if(o){var u=o;if(o.length==r*s*4){u=new Uint8Array(r*s);for(var l=0;l<u.length;l++)u[l]=o[(l<<2)+1]}a=this.addImage(u,r,s,null)}var v=ToPDF._format(e),p=e;if(e.length==r*s*4){p=new Uint8Array(r*s*3);for(var l=0;l<e.length;l+=4){var c=3*(l>>2);p[c]=e[l+0],p[c+1]=e[l+1],p[c+2]=e[l+2]}}var _=this._res["/XObject"];for(var f in _)if(ToPDF._eq(this._xr[_[f].ind].stream,p))return f;var f="/I"+(ToPDF.maxI(_)+1);_[f]={typ:"ref",ind:this._xr.length};var g={"/Type":"/XObject","/Subtype":"/Image","/BitsPerComponent":8,"/ColorSpace":e.length==r*s||v=="/DCTDecode"&&ToPDF.jpgProp(e)&&ToPDF.jpgProp(e).comps==1?"/DeviceGray":"/DeviceRGB","/Height":s,"/Width":r,stream:p};return v!=null&&(g["/Filter"]=ToPDF._format(e)),o&&(g["/SMask"]={typ:"ref",ind:this._xr.length-1},delete _[a]),this._xr.push(g),f},ToPDF.jpgProp=function(e){for(var r=0;r<e.length;){for(;e[r]==255;)r++;var s=e[r];if(r++,s!=216){if(s==217)break;if(!(208<=s&&s<=215)&&s!=1){var o=(e[r]<<8|e[r+1])-2;if(r+=2,s==192)return{bpp:e[r],w:e[r+1]<<8|e[r+2],h:e[r+3]<<8|e[r+4],comps:e[r+5]};r+=o}}}},ToPDF.readUshort=function(e,r){return e[r]<<8|e[r+1]},ToPDF.maxI=function(e){var r;for(var s in e)r=s;return r==null?0:parseInt(r.slice(2))},ToPDF._basicFont=function(e){var r=e.toLowerCase(),s=["Helvetica","Helvetica-Bold","Helvetica-Oblique","Helvetica-BoldOblique","Times-Roman","Times-Bold","Times-Italic","Times-BoldItalic"],o=0;r.indexOf("sans")!=-1?o=0:r.indexOf("serif")!=-1&&(o=4);var a=r.indexOf("bold")!=-1,u=r.indexOf("italic")!=-1||r.indexOf("oblique")!=-1||r.endsWith("-it");return a&&u?o+=3:u?o+=2:a&&(o+=1),s[o]},ToPDF.prototype.addFont=function(e,r){e=ToPDF._basicFont(e),e="/"+e;var s=this._res["/Font"];for(var o in s)if(s[o]["/BaseFont"]==e)return o;var o="/F"+(ToPDF.maxI(s)+1),a={"/Type":"/Font","/Subtype":"/Type1","/BaseFont":e,"/Encoding":"/WinAnsiEncoding"};if(r!=null){for(var u="/CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def /CMapName /Adobe-Identity-UCS def /CMapType 2 def 1 begincodespacerange <0000> <FFFF> endcodespacerange 1 beginbfchar <0001> <200B> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end",l=new Uint8Array(u.length),v=0;v<u.length;v++)l[v]=u.charCodeAt(v);a["/Subtype"]="/TrueType",delete a["/Encoding"],a["/FirstChar"]=0,a["/Widths"]=[];for(var v=0;v<256;v++)a["/Widths"].push(500);a["/LastChar"]=a["/Widths"].length-1,a["/FontDescriptor"]={"/Ascent":905,"/CapHeight":1010,"/Descent":211,"/Flags":4,"/FontBBox":[-627,-376,2e3,1011],"/FontName":e,"/ItalicAngle":0,"/StemV":80,"/Type":"/FontDescriptor","/FontFile2":{stream:new Uint8Array(r)}}}return s[o]=a,o},ToPDF.addPage=function(e,r,s){var o=e.length;e[2]["/Kids"].push({typ:"ref",ind:o}),e[2]["/Count"]++,e.push({"/Type":"/Page","/Parent":{typ:"ref",ind:2},"/Resources":{typ:"ref",ind:3},"/MediaBox":s,"/Contents":{typ:"ref",ind:o+1}}),e.push({stream:r})},ToPDF.xrToPDF=function(e){var r={file:new ToPDF.MFile,off:0},s=ToPDF.write,o=[];s(r,`%PDF-1.1
|
||
|
`);for(var a=1;a<e.length;a++)o.push(r.off),s(r,a+` 0 obj
|
||
|
`),ToPDF.writeDict(r,e[a],0),s(r,`
|
||
|
endobj
|
||
|
`);var u=r.off;s(r,`xref
|
||
|
`),s(r,"0 "+e.length+`
|
||
|
`),s(r,`0000000000 65535 f
|
||
|
`);for(var a=0;a<o.length;a++){for(var l=o[a]+"";l.length<10;)l="0"+l;s(r,l+` 00000 n
|
||
|
`)}return s(r,`trailer
|
||
|
`),ToPDF.writeDict(r,{"/Root":{typ:"ref",ind:1},"/Size":e.length},0),s(r,`
|
||
|
startxref
|
||
|
`+u+`
|
||
|
%%EOF
|
||
|
`),r.file.data.buffer.slice(0,r.off)},ToPDF.write=function(e,r){e.file.req(e.off,r.length);for(var s=0;s<r.length;s++)e.file.data[e.off+s]=r.charCodeAt(s);e.off+=r.length},ToPDF._tab=" ",ToPDF.spc=function(e){for(var r="",s=0;s<e;s++)r+=ToPDF._tab;return r},ToPDF.writeValue=function(e,r,s){var o=ToPDF.write;if(typeof r=="string")o(e,r);else if(typeof r=="number")o(e,""+r);else if(typeof r=="boolean")o(e,""+r);else if(r.typ!=null)o(e,r.ind+" 0 R");else if(r instanceof Array)ToPDF.writeArray(e,r,s+1);else if(r instanceof Object)ToPDF.writeDict(e,r,s+1);else throw console.log(r),"e"},ToPDF.writeDict=function(e,r,s){var o=ToPDF.write,a=ToPDF.spc,u=r.stream;if(u){if(typeof u=="string"){for(var l=new Uint8Array(u.length),v=0;v<u.length;v++)l[v]=u.charCodeAt(v);u=l}r["/Filter"]==null&&(r["/Filter"]="/FlateDecode",u=pako.deflate(u))}o(e,`<<
|
||
|
`);for(var p in r)p.charAt(0)=="/"&&(o(e,a(s+1)+p+" "),ToPDF.writeValue(e,r[p],s),o(e,`
|
||
|
`));if(u&&o(e,a(s+1)+"/Length "+u.length+`
|
||
|
`),o(e,a(s)+">>"),u){o(e,a(s)+`
|
||
|
stream
|
||
|
`),e.file.req(e.off,u.length);for(var v=0;v<u.length;v++)e.file.data[e.off+v]=u[v];e.off+=u.length,o(e,a(s)+`
|
||
|
endstream`)}},ToPDF.writeArray=function(e,r,s){var o=ToPDF.write;o(e,"[ ");for(var a=0;a<r.length;a++)ToPDF.writeValue(e,r[a],s+1),a!=r.length-1&&o(e," ");o(e," ]")},ToPDF.MFile=function(){this.size=16,this.data=new Uint8Array(16)},ToPDF.MFile.prototype.req=function(e,r){if(!(e+r<=this.size)){for(var s=this.size;e+r>this.size;)this.size*=2;for(var o=new Uint8Array(this.size),a=0;a<s;a++)o[a]=this.data[a];this.data=o}};function ToEMF(){this._file={file:new ToEMF.MFile,off:0},this._lstw=0,this._curx=0,this._curh=0,this._recs=0,this._lenp=0,this._objs={},this._tabl=1,this._stkf=0,this._tclr=0,this._curt={p:-1,b:-1,t:-1},this._inited=!1}ToEMF.prototype.StartPage=function(e,r,s,o){this._check();var a=this._file,u=ToEMF.B.writeUint,l=ToEMF.B.writeInt;this._curh=Math.max(this._curh,o*10),this._inited?(this._curx+=this._lstw,ToEMF._writeHeadBox(a,[0,0,this._curx+s,Math.round(this._curh/10)])):(this._inited=!0,this._addRec("HEADER",88),ToEMF._writeHeadBox(a,[e,r,s,o]),a.off+=32,ToEMF.B.writeASCII(a.file,a.off," EMF"),a.off+=4,u(a.file,a.off,65536),a.off+=4,this._lenp=a.off,a.off+=4+4+4,a.off+=4+4+4,l(a.file,a.off,1440),a.off+=4,l(a.file,a.off,900),a.off+=4,l(a.file,a.off,508),a.off+=4,l(a.file,a.off,318),a.off+=4,this._trsf([.1,0,0,.1,0,0]),this._addRec("SETBKMODE",12),u(a.file,a.off,1),a.off+=4,this._addRec("SETTEXTALIGN",12),u(a.file,a.off,24),a.off+=4),this._lstw=s},ToEMF.prototype.Stroke=function(e){this._draw(e,1)},ToEMF.prototype.Fill=function(e,r){this._draw(e,2)},ToEMF.prototype.PutImage=function(e,r,s,o,a){var u=r.length;(u&3)!=0&&(u+=4-(u&3));var l=[1,0,0,-1,0,1];UDOC.M.concat(l,e.ctm),UDOC.M.scale(l,10,10),UDOC.M.scale(l,1,-1),UDOC.M.translate(l,this._curx,this._curh),this._trsf(l);var v=this._file,p=ToEMF.B.writeUint,c=ToEMF.B.writeInt,_=ToEMF.B.writeUshort,f=8+16+14*4;if(this._addRec("STRETCHDIBITS",f+40+u),v.off+=16,c(v.file,v.off,Math.round(0)),v.off+=4,c(v.file,v.off,Math.round(0)),v.off+=4,v.off+=8,c(v.file,v.off,s),v.off+=4,c(v.file,v.off,o),v.off+=4,p(v.file,v.off,f),v.off+=4,p(v.file,v.off,40),v.off+=4,p(v.file,v.off,f+40),v.off+=4,p(v.file,v.off,r.length),v.off+=4,v.off+=4,p(v.file,v.off,13369376),v.off+=4,c(v.file,v.off,Math.round(1)),v.off+=4,c(v.file,v.off,Math.round(1)),v.off+=4,c(v.file,v.off,40),v.off+=4,c(v.file,v.off,s),v.off+=4,c(v.file,v.off,o),v.off+=4,_(v.file,v.off,1),v.off+=2,_(v.file,v.off,32),v.off+=2,c(v.file,v.off,0),v.off+=4,c(v.file,v.off,r.length),v.off+=4,c(v.file,v.off,3800),v.off+=4,c(v.file,v.off,3800),v.off+=4,v.off+=8,v.file.req(v.off,r.length),r.length==s*o*4)for(var g=0;g<o;g++)for(var y=0;y<s;y++){var w=g*s+y<<2,M=v.off+((o-1-g)*s+y<<2);v.file.data[M]=r[w+2],v.file.data[M+1]=r[w+1],v.file.data[M+2]=r[w],v.file.data[M+3]=r[w+3]}else for(var T=0;T<r.length;T++)v.file.data[v.off+T]=r[T];v.off+=u,UDOC.M.invert(l),this._trsf(l)},ToEMF.prototype.PutText=function(e,r,s){var o=r.length;(o&1)==1&&o++,this._check();var a=this._file,u=ToEMF.B.writeUint,l=ToEMF.B.writeInt,v=ToEMF.B.writeUshort,p=ToEMF.B.writeFloat,c=ToEMF._color(e.colr);c!=this._tclr&&(this._addRec("SETTEXTCOLOR",12),u(a.file,a.off,c),a.off+=4,this._tclr=c),this._setTool("f",[e.font.Tf,Math.round(e.font.Tfs*10)]);var _=10*(e.ctm[4]+this._curx),f=this._curh-10*e.ctm[5],g=Math.abs(e.ctm[1])>.05,y;g&&(y=e.ctm.slice(0),y[1]*=-1,y[2]*=-1,y[4]=_,y[5]=f,_=f=0,this._trsf(y));var w=8+16+12+4*6+16;this._addRec("EXTTEXTOUTW",w+o*2),a.off+=16,u(a.file,a.off,2),a.off+=4,p(a.file,a.off,31.25),a.off+=4,p(a.file,a.off,31.25),a.off+=4,l(a.file,a.off,Math.round(_)),a.off+=4,l(a.file,a.off,Math.round(f)),a.off+=4,u(a.file,a.off,r.length),a.off+=4,u(a.file,a.off,w),a.off+=4,u(a.file,a.off,0),a.off+=4,a.off+=16,u(a.file,a.off,0),a.off+=4;for(var M=0;M<r.length;M++)v(a.file,a.off+M*2,r.charCodeAt(M));a.off+=2*o,g&&(UDOC.M.invert(y),this._trsf(y))},ToEMF.prototype.ShowPage=function(){this._check()},ToEMF.prototype.Done=function(){this._check();var e=this._file,r=ToEMF.B.writeUint;this._addRec("EOF",20),r(e.file,e.off,0),e.off+=4,r(e.file,e.off,16),e.off+=4,r(e.file,e.off,20),e.off+=4,r(e.file,this._lenp,e.off),r(e.file,this._lenp+4,this._recs),r(
|
||
|
* @license
|
||
|
* Copyright 2015 Mozilla Foundation
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/var PDFJS;(function(e){"use strict";var r=function(){function M(T){this.message="JPEG error: "+T}return M.prototype=new Error,M.prototype.name="JpegError",M.constructor=M,M}(),s=function(){var M=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),T=4017,B=799,H=3406,J=2276,Q=1567,q=3784,O=5793,K=2896;function pe({decodeTransform:$=null,colorTransform:ee=-1}={}){this._decodeTransform=$,this._colorTransform=ee}function R($,ee){for(var ne=0,_e=[],ae,Me,Ne=16;Ne>0&&!$[Ne-1];)Ne--;_e.push({children:[],index:0});var Ae=_e[0],Fe;for(ae=0;ae<Ne;ae++){for(Me=0;Me<$[ae];Me++){for(Ae=_e.pop(),Ae.children[Ae.index]=ee[ne];Ae.index>0;)Ae=_e.pop();for(Ae.index++,_e.push(Ae);_e.length<=ae;)_e.push(Fe={children:[],index:0}),Ae.children[Ae.index]=Fe.children,Ae=Fe;ne++}ae+1<Ne&&(_e.push(Fe={children:[],index:0}),Ae.children[Ae.index]=Fe.children,Ae=Fe)}return _e[0].children}function Te($,ee,ne){return 64*(($.blocksPerLine+1)*ee+ne)}function re($,ee,ne,_e,ae,Me,Ne,Ae,Fe,De=!1){var ze=ne.mcusPerLine,ye=ne.progressive;const he=ee;let ke=0,le=0;function Ce(){if(le>0)return le--,ke>>le&1;if(ke=$[ee++],ke===255){var A=$[ee++];if(A){if(A===220&&De){ee+=2;const N=p($,ee);if(ee+=2,N>0&&N!==ne.scanLines)throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data",N)}else if(A===217){if(De){const N=h*8;if(N>0&&N<ne.scanLines/10)throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, possibly caused by incorrect `scanLines` parameter",N)}throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data")}throw new r(`unexpected marker ${(ke<<8|A).toString(16)}`)}}return le=7,ke>>>7}function Be(A){for(var N=A;;){switch(N=N[Ce()],typeof N){case"number":return N;case"object":continue}throw new r("invalid huffman sequence")}}function we(A){for(var N=0;A>0;)N=N<<1|Ce(),A--;return N}function xe(A){if(A===1)return Ce()===1?1:-1;var N=we(A);return N>=1<<A-1?N:N+(-1<<A)+1}function Ie(A,N){var I=Be(A.huffmanTableDC),te=I===0?0:xe(I);A.blockData[N]=A.pred+=te;for(var fe=1;fe<64;){var S=Be(A.huffmanTableAC),de=S&15,se=S>>4;if(de===0){if(se<15)break;fe+=16;continue}fe+=se;var ie=M[fe];A.blockData[N+ie]=xe(de),fe++}}function Re(A,N){var I=Be(A.huffmanTableDC),te=I===0?0:xe(I)<<Fe;A.blockData[N]=A.pred+=te}function Le(A,N){A.blockData[N]|=Ce()<<Fe}var Oe=0;function Ve(A,N){if(Oe>0){Oe--;return}for(var I=Me,te=Ne;I<=te;){var fe=Be(A.huffmanTableAC),S=fe&15,de=fe>>4;if(S===0){if(de<15){Oe=we(de)+(1<<de)-1;break}I+=16;continue}I+=de;var se=M[I];A.blockData[N+se]=xe(S)*(1<<Fe),I++}}var Xe=0,We;function t(A,N){for(var I=Me,te=Ne,fe=0,S,de;I<=te;){const se=N+M[I],ie=A.blockData[se]<0?-1:1;switch(Xe){case 0:if(de=Be(A.huffmanTableAC),S=de&15,fe=de>>4,S===0)fe<15?(Oe=we(fe)+(1<<fe),Xe=4):(fe=16,Xe=1);else{if(S!==1)throw new r("invalid ACn encoding");We=xe(S),Xe=fe?2:3}continue;case 1:case 2:A.blockData[se]?A.blockData[se]+=ie*(Ce()<<Fe):(fe--,fe===0&&(Xe=Xe===2?3:0));break;case 3:A.blockData[se]?A.blockData[se]+=ie*(Ce()<<Fe):(A.blockData[se]=We<<Fe,Xe=0);break;case 4:A.blockData[se]&&(A.blockData[se]+=ie*(Ce()<<Fe));break}I++}Xe===4&&(Oe--,Oe===0&&(Xe=0))}let h=0;function d(A,N,I,te,fe){var S=I/ze|0,de=I%ze;h=S*A.v+te;var se=de*A.h+fe;const ie=Te(A,h,se);N(A,ie)}function x(A,N,I){h=I/A.blocksPerLine|0;var te=I%A.blocksPerLine;const fe=Te(A,h,te);N(A,fe)}var E=_e.length,C,b,U,D,k,Z;ye?Me===0?Z=Ae===0?Re:Le:Z=Ae===0?Ve:t:Z=Ie;var Y=0,W,F;E===1?F=_e[0].blocksPerLine*_e[0].blocksPerColumn:F=ze*ne.mcusPerColumn;for(var z,G;Y<=F;){var X=ae?Math.min(F-Y,ae):F;if(X>0){for(b=0;b<E;b++)_e[b].pred=0;if(Oe=0,E===1)for(C=_e[0],k=0;k<X;k++)x(C,Z,Y),Y++;else for(k=0;k<X;k++){for(b=0;b<E;b++)for(C=_e[b],z=C.h,G=C.v,U=0;U<G;U++)for(D=0;D<z;D++)d(C,Z,Y,U,D);Y++}}if(le=0,W=ue($,ee),!W)break;if(W.invalid){const A=X>0?"unexpected":"excessive";g(`decodeScan - ${A} MCU data, current marker is: ${W.invalid}`),ee=W.offset}if(W.marker>=65488&&W.marker<=65495)ee+=2;else break}return ee-he}function oe($
|
||
|
`),cooked:this.value},this.next(),u.tail=this.type===o.types.backQuote,this.finishNode(u,"TemplateElement")},e.parseTemplate=function(){var u=this.startNode();this.next(),u.expressions=[];var l=this.parseTemplateElement();for(u.quasis=[l];!l.tail;)this.expect(o.types.dollarBraceL),u.expressions.push(this.parseExpression()),this.expect(o.types.braceR),u.quasis.push(l=this.parseTemplateElement());return this.next(),this.finishNode(u,"TemplateLiteral")},e.parseObj=function(u,l){var v=this.startNode(),p=!0,c={};for(v.properties=[],this.next();!this.eat(o.types.braceR);){if(p)p=!1;else if(this.expect(o.types.comma),this.afterTrailingComma(o.types.braceR))break;var _=this.startNode(),f=void 0,g=void 0,y=void 0;6<=this.options.ecmaVersion&&(_.method=!1,_.shorthand=!1,(u||l)&&(g=this.start,y=this.startLoc),u||(f=this.eat(o.types.star))),this.parsePropertyName(_),this.parsePropertyValue(_,u,f,g,y,l),this.checkPropClash(_,c),v.properties.push(this.finishNode(_,"Property"))}return this.finishNode(v,u?"ObjectPattern":"ObjectExpression")},e.parsePropertyValue=function(u,l,v,p,c,_){this.eat(o.types.colon)?(u.value=l?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,_),u.kind="init"):6<=this.options.ecmaVersion&&this.type===o.types.parenL?(l&&this.unexpected(),u.kind="init",u.method=!0,u.value=this.parseMethod(v)):5<=this.options.ecmaVersion&&!u.computed&&u.key.type==="Identifier"&&(u.key.name==="get"||u.key.name==="set")&&this.type!=o.types.comma&&this.type!=o.types.braceR?((v||l)&&this.unexpected(),u.kind=u.key.name,this.parsePropertyName(u),u.value=this.parseMethod(!1),u.value.params.length!==(u.kind==="get"?0:1)&&(l=u.value.start,u.kind==="get"?this.raiseRecoverable(l,"getter should have no params"):this.raiseRecoverable(l,"setter should have exactly one param")),u.kind==="set"&&u.value.params[0].type==="RestElement"&&this.raiseRecoverable(u.value.params[0].start,"Setter cannot use rest params")):6<=this.options.ecmaVersion&&!u.computed&&u.key.type==="Identifier"?(u.kind="init",l?((this.keywords.test(u.key.name)||(this.strict?this.reservedWordsStrictBind:this.reservedWords).test(u.key.name)||this.inGenerator&&u.key.name=="yield")&&this.raiseRecoverable(u.key.start,"Binding "+u.key.name),u.value=this.parseMaybeDefault(p,c,u.key)):this.type===o.types.eq&&_?(_.shorthandAssign||(_.shorthandAssign=this.start),u.value=this.parseMaybeDefault(p,c,u.key)):u.value=u.key,u.shorthand=!0):this.unexpected()},e.parsePropertyName=function(u){if(6<=this.options.ecmaVersion){if(this.eat(o.types.bracketL))return u.computed=!0,u.key=this.parseMaybeAssign(),this.expect(o.types.bracketR),u.key;u.computed=!1}return u.key=this.type===o.types.num||this.type===o.types.string?this.parseExprAtom():this.parseIdent(!0)},e.initFunction=function(u){u.id=null,6<=this.options.ecmaVersion&&(u.generator=!1,u.expression=!1)},e.parseMethod=function(u){var l=this.startNode(),v=this.inGenerator;return this.inGenerator=u,this.initFunction(l),this.expect(o.types.parenL),l.params=this.parseBindingList(o.types.parenR,!1,!1),6<=this.options.ecmaVersion&&(l.generator=u),this.parseFunctionBody(l,!1),this.inGenerator=v,this.finishNode(l,"FunctionExpression")},e.parseArrowExpression=function(u,l){var v=this.inGenerator;return this.inGenerator=!1,this.initFunction(u),u.params=this.toAssignableList(l,!0),this.parseFunctionBody(u,!0),this.inGenerator=v,this.finishNode(u,"ArrowFunctionExpression")},e.parseFunctionBody=function(u,l){var v=l&&this.type!==o.types.braceL;if(v)u.body=this.parseMaybeAssign(),u.expression=!0;else{var p=this.inFunction,c=this.labels;this.inFunction=!0,this.labels=[],u.body=this.parseBlock(!0),u.expression=!1,this.inFunction=p,this.labels=c}this.strict||!v&&u.body.body.length&&this.isUseStrict(u.body.body[0])?(v=this.strict,this.strict=!0,u.id&&this.checkLVal(u.id,!0),this.checkParams(u),this.strict=v):l&&this.checkParams(u)},e.checkParams=function(u){for(var l={},v=0;v<u.params.length;v++)this.checkLVal(u.params[v],!0,l)},e.parseExprList=function(u,l,v,p){for(var c=[],_=!0;!this.eat(u);){if(_)_=!1;else if(this.expect(o.types.comma),l
|
||
|
`,g)),this.curLine=this.input.slice(0,this.lineStart).split(l.lineBreak).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=u.types.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.strict=this.inModule=_.sourceType==="module",this.potentialArrowAt=-1,this.inFunction=this.inGenerator=!1,this.labels=[],this.pos===0&&_.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2)}return c.prototype.isKeyword=function(_){return this.keywords.test(_)},c.prototype.isReservedWord=function(_){return this.reservedWords.test(_)},c.prototype.extend=function(_,f){this[_]=f(this[_])},c.prototype.loadPlugins=function(_){for(var f in _){var g=p[f];if(!g)throw Error("Plugin '"+f+"' not found");g(this,_[f])}},c.prototype.parse=function(){var _=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(_)},c}(),s.Parser=e},{"./identifier":2,"./options":8,"./tokentype":14,"./whitespace":16}],11:[function(e,r,s){var o=e("./tokentype");r=e("./state");var a=e("./whitespace"),u=e("./identifier");e=r.Parser.prototype,e.parseTopLevel=function(c){var _=!0;for(c.body||(c.body=[]);this.type!==o.types.eof;){var f=this.parseStatement(!0,!0);c.body.push(f),_&&(this.isUseStrict(f)&&this.setStrict(!0),_=!1)}return this.next(),6<=this.options.ecmaVersion&&(c.sourceType=this.options.sourceType),this.finishNode(c,"Program")};var l={kind:"loop"},v={kind:"switch"};e.isLet=function(){if(this.type!==o.types.name||6>this.options.ecmaVersion||this.value!="let")return!1;a.skipWhiteSpace.lastIndex=this.pos;var c=a.skipWhiteSpace.exec(this.input),c=this.pos+c[0].length,_=this.input.charCodeAt(c);if(_===91||_==123)return!0;if(u.isIdentifierStart(_,!0)){for(_=c+1;u.isIdentifierChar(this.input.charCodeAt(_,!0));++_);if(c=this.input.slice(c,_),!this.isKeyword(c))return!0}return!1},e.parseStatement=function(c,_){var f=this.type,g=this.startNode(),y=void 0;switch(this.isLet()&&(f=o.types._var,y="let"),f){case o.types._break:case o.types._continue:return this.parseBreakContinueStatement(g,f.keyword);case o.types._debugger:return this.parseDebuggerStatement(g);case o.types._do:return this.parseDoStatement(g);case o.types._for:return this.parseForStatement(g);case o.types._function:return!c&&6<=this.options.ecmaVersion&&this.unexpected(),this.parseFunctionStatement(g);case o.types._class:return c||this.unexpected(),this.parseClass(g,!0);case o.types._if:return this.parseIfStatement(g);case o.types._return:return this.parseReturnStatement(g);case o.types._switch:return this.parseSwitchStatement(g);case o.types._throw:return this.parseThrowStatement(g);case o.types._try:return this.parseTryStatement(g);case o.types._const:case o.types._var:return y=y||this.value,c||y=="var"||this.unexpected(),this.parseVarStatement(g,y);case o.types._while:return this.parseWhileStatement(g);case o.types._with:return this.parseWithStatement(g);case o.types.braceL:return this.parseBlock();case o.types.semi:return this.parseEmptyStatement(g);case o.types._export:case o.types._import:return this.options.allowImportExportEverywhere||(_||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),f===o.types._import?this.parseImport(g):this.parseExport(g);default:var y=this.value,w=this.parseExpression();return f===o.types.name&&w.type==="Identifier"&&this.eat(o.types.colon)?this.parseLabeledStatement(g,y,w):this.parseExpressionStatement(g,w)}},e.parseBreakContinueStatement=function(c,_){var f=_=="break";this.next(),this.eat(o.types.semi)||this.insertSemicolon()?c.label=null:this.type!==o.types.name?this.unexpected():(c.label=this.parseIdent(),this.semicolon());for(var g=0;g<this.labels.length;++g){var y=this.labels[g];if((c.label==null||y.name===c.label.name)&&(y.kind!=null&&(f||y.kind==="loop")||c.label&&f))break}return g===this.labels.length&&
|
||
|
`,this.lineStart-2)+1,--this.curLine;this.nextToken()}},e.curContext=function(){return this.context[this.context.length-1]},e.nextToken=function(){var g=this.curContext();if(g&&g.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(l.types.eof);if(g.override)return g.override(this);this.readToken(this.fullCharCodeAtPos())},e.readToken=function(g){return u.isIdentifierStart(g,6<=this.options.ecmaVersion)||g===92?this.readWord():this.getTokenFromCode(g)},e.fullCharCodeAtPos=function(){var g=this.input.charCodeAt(this.pos);if(55295>=g||57344<=g)return g;var y=this.input.charCodeAt(this.pos+1);return(g<<10)+y-56613888},e.skipBlockComment=function(){var g=this.options.onComment&&this.curPosition(),y=this.pos,w=this.input.indexOf("*/",this.pos+=2);if(w===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=w+2,this.options.locations){p.lineBreakG.lastIndex=y;for(var M=void 0;(M=p.lineBreakG.exec(this.input))&&M.index<this.pos;)++this.curLine,this.lineStart=M.index+M[0].length}this.options.onComment&&this.options.onComment(!0,this.input.slice(y+2,w),y,this.pos,g,this.curPosition())},e.skipLineComment=function(g){for(var y=this.pos,w=this.options.onComment&&this.curPosition(),M=this.input.charCodeAt(this.pos+=g);this.pos<this.input.length&&M!==10&&M!==13&&M!==8232&&M!==8233;)++this.pos,M=this.input.charCodeAt(this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(y+g,this.pos),y,this.pos,w,this.curPosition())},e.skipSpace=function(){e:for(;this.pos<this.input.length;){var g=this.input.charCodeAt(this.pos);switch(g){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(8<g&&14>g||5760<=g&&p.nonASCIIwhitespace.test(String.fromCharCode(g)))++this.pos;else break e}}},e.finishToken=function(g,y){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var w=this.type;this.type=g,this.value=y,this.updateContext(w)},e.readToken_dot=function(){var g=this.input.charCodeAt(this.pos+1);if(48<=g&&57>=g)return this.readNumber(!0);var y=this.input.charCodeAt(this.pos+2);return 6<=this.options.ecmaVersion&&g===46&&y===46?(this.pos+=3,this.finishToken(l.types.ellipsis)):(++this.pos,this.finishToken(l.types.dot))},e.readToken_slash=function(){var g=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):g===61?this.finishOp(l.types.assign,2):this.finishOp(l.types.slash,1)},e.readToken_mult_modulo_exp=function(g){var y=this.input.charCodeAt(this.pos+1),w=1;return g=g===42?l.types.star:l.types.modulo,7<=this.options.ecmaVersion&&y===42&&(++w,g=l.types.starstar,y=this.input.charCodeAt(this.pos+2)),y===61?this.finishOp(l.types.assign,w+1):this.finishOp(g,w)},e.readToken_pipe_amp=function(g){var y=this.input.charCodeAt(this.pos+1);return y===g?this.finishOp(g===124?l.types.logicalOR:l.types.logicalAND,2):y===61?this.finishOp(l.types.assign,2):this.finishOp(g===124?l.types.bitwiseOR:l.types.bitwiseAND,1)},e.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(l.types.assign,2):this.finishOp(l.types.bitwiseXOR,1)},e.readToken_plus_min=function(g){var y=this.input.charCodeAt(this.pos+1);return y===g?y==45&&this.input.charCodeAt(this.pos+2)==62&&p.lineBreak.test(this.input.slice(this.lastTokEnd,this.pos))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(l.types.incDec,2):y===61?this.finishOp(l.types.assign,2):this.finishOp(l.types.plusMin,1)},e.readToken_lt_gt=function(g){var y=this.input.charCodeAt(this.pos+1),w=1;return y===g?(w=g===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+w)===61?this.finishOp(l.types.assign,w+1):this.finishOp(l.types.bitShift,w)):y==33&&g==60&&this.in
|
||
|
`;break;default:g+=String.fromCharCode(w)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),y=this.pos}else++this.pos}},e.readEscapedChar=function(g){var y=this.input.charCodeAt(++this.pos);switch(++this.pos,y){case 110:return`
|
||
|
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return a(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";default:if(48<=y&&55>=y){var y=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],w=parseInt(y,8);return 255<w&&(y=y.slice(0,-1),w=parseInt(y,8)),y!=="0"&&(this.strict||g)&&this.raise(this.pos-2,"Octal literal in strict mode"),this.pos+=y.length-1,String.fromCharCode(w)}return String.fromCharCode(y)}},e.readHexChar=function(g){var y=this.pos;return g=this.readInt(16,g),g===null&&this.raise(y,"Bad character escape sequence"),g},e.readWord1=function(){this.containsEsc=!1;for(var g="",y=!0,w=this.pos,M=6<=this.options.ecmaVersion;this.pos<this.input.length;){var T=this.fullCharCodeAtPos();if(u.isIdentifierChar(T,M))this.pos+=65535>=T?1:2;else if(T===92)this.containsEsc=!0,g+=this.input.slice(w,this.pos),w=this.pos,this.input.charCodeAt(++this.pos)!=117&&this.raise(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos,T=this.readCodePoint(),(y?u.isIdentifierStart:u.isIdentifierChar)(T,M)||this.raise(w,"Invalid Unicode escape"),g+=a(T),w=this.pos;else break;y=!1}return g+this.input.slice(w,this.pos)},e.readWord=function(){var g=this.readWord1(),y=l.types.name;return(6<=this.options.ecmaVersion||!this.containsEsc)&&this.keywords.test(g)&&(y=l.keywords[g]),this.finishToken(y,g)}},{"./identifier":2,"./locutil":5,"./state":10,"./tokentype":14,"./whitespace":16}],14:[function(e,r,s){function o(p,c){return new u(p,{beforeExpr:!0,binop:c})}function a(p){var c=1>=arguments.length||arguments[1]===void 0?{}:arguments[1];c.keyword=p,v[p]=l["_"+p]=new u(p,c)}s.__esModule=!0;var u=function p(c){var _=1>=arguments.length||arguments[1]===void 0?{}:arguments[1];if(!(this instanceof p))throw new TypeError("Cannot call a class as a function");this.label=c,this.keyword=_.keyword,this.beforeExpr=!!_.beforeExpr,this.startsExpr=!!_.startsExpr,this.isLoop=!!_.isLoop,this.isAssign=!!_.isAssign,this.prefix=!!_.prefix,this.postfix=!!_.postfix,this.binop=_.binop||null,this.updateContext=null};s.TokenType=u,e={beforeExpr:!0},r={startsExpr:!0};var l={num:new u("num",r),regexp:new u("regexp",r),string:new u("string",r),name:new u("name",r),eof:new u("eof"),bracketL:new u("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new u("]"),braceL:new u("{",{beforeExpr:!0,startsExpr:!0}),braceR:new u("}"),parenL:new u("(",{beforeExpr:!0,startsExpr:!0}),parenR:new u(")"),comma:new u(",",e),semi:new u(";",e),colon:new u(":",e),dot:new u("."),question:new u("?",e),arrow:new u("=>",e),template:new u("template"),ellipsis:new u("...",e),backQuote:new u("`",r),dollarBraceL:new u("${",{beforeExpr:!0,startsExpr:!0}),eq:new u("=",{beforeExpr:!0,isAssign:!0}),assign:new u("_=",{beforeExpr:!0,isAssign:!0}),incDec:new u("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new u("prefix",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:o("||",1),logicalAND:o("&&",2),bitwiseOR:o("|",3),bitwiseXOR:o("^",4),bitwiseAND:o("&",5),equality:o("==/!=",6),relational:o("</>",7),bitShift:o("<</>>",8),plusMin:new u("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:o("%",10),star:o("*",10),slash:o("/",10),starstar:new u("**",{beforeExpr:!0})};s.types=l;var v={};s.keywords=v,a("break"),a("case",e),a("catch"),a("continue"),a("debugger"),a("default",e),a("do",{isLoop:!0,beforeExpr:!0}),a("else",e),a("finally"),a("for",{isLoop:!0}),a("function",r),a("if"),a("return",e),a("switch"),a("throw",e),a("try"),a("var"),a("const"),a("while",{isLoop:!0}),a("with"),a("new",{beforeExpr:!0,startsExpr:!0}),a("this",r),a("super",r),a("class"),a("extends",e),a("export"),a("import"),a("null",r),a("true",r),a("false",r),a("in",{beforeExpr:!0,binop:7}),a("instanceof",{beforeExpr:!0,binop:7}),a("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),a("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),a("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},{}],15:[function(e,r
|
||
|
* [js-sha1]{@link https://github.com/emn178/js-sha1}
|
||
|
*
|
||
|
* @version 0.6.0
|
||
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||
|
* @copyright Chen, Yi-Cyuan 2014-2017
|
||
|
* @license MIT
|
||
|
*/(function(){"use strict";function t(e){e?(f[0]=f[16]=f[1]=f[2]=f[3]=f[4]=f[5]=f[6]=f[7]=f[8]=f[9]=f[10]=f[11]=f[12]=f[13]=f[14]=f[15]=0,this.blocks=f):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}var h=typeof window=="object"?window:{},s=!h.JS_SHA1_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s&&(h=global);var i=!h.JS_SHA1_NO_COMMON_JS&&typeof module=="object"&&module.exports,e=typeof define=="function"&&define.amd,r="0123456789abcdef".split(""),o=[-2147483648,8388608,32768,128],n=[24,16,8,0],a=["hex","array","digest","arrayBuffer"],f=[],u=function(e){return function(r){return new t(!0).update(r)[e]()}},c=function(){var e=u("hex");s&&(e=p(e)),e.create=function(){return new t},e.update=function(o){return e.create().update(o)};for(var r=0;r<a.length;++r){var s=a[r];e[s]=u(s)}return e},p=function(t){var h=eval("require('crypto')"),s=eval("require('buffer').Buffer"),i=function(e){if(typeof e=="string")return h.createHash("sha1").update(e,"utf8").digest("hex");if(e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(e.length===void 0)return t(e);return h.createHash("sha1").update(new s(e)).digest("hex")};return i};t.prototype.update=function(e){if(!this.finalized){var r=typeof e!="string";r&&e.constructor===h.ArrayBuffer&&(e=new Uint8Array(e));for(var s,o,a=0,u=e.length||0,l=this.blocks;a<u;){if(this.hashed&&(this.hashed=!1,l[0]=this.block,l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0),r)for(o=this.start;a<u&&o<64;++a)l[o>>2]|=e[a]<<n[3&o++];else for(o=this.start;a<u&&o<64;++a)(s=e.charCodeAt(a))<128?l[o>>2]|=s<<n[3&o++]:s<2048?(l[o>>2]|=(192|s>>6)<<n[3&o++],l[o>>2]|=(128|63&s)<<n[3&o++]):s<55296||s>=57344?(l[o>>2]|=(224|s>>12)<<n[3&o++],l[o>>2]|=(128|s>>6&63)<<n[3&o++],l[o>>2]|=(128|63&s)<<n[3&o++]):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++a)),l[o>>2]|=(240|s>>18)<<n[3&o++],l[o>>2]|=(128|s>>12&63)<<n[3&o++],l[o>>2]|=(128|s>>6&63)<<n[3&o++],l[o>>2]|=(128|63&s)<<n[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=l[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,r=this.lastByteIndex;e[16]=this.block,e[r>>2]|=o[3&r],this.block=e[16],r>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},t.prototype.hash=function(){var e,r,s=this.h0,o=this.h1,a=this.h2,u=this.h3,l=this.h4,v=this.blocks;for(e=16;e<80;++e)r=v[e-3]^v[e-8]^v[e-14]^v[e-16],v[e]=r<<1|r>>>31;for(e=0;e<20;e+=5)s=(r=(o=(r=(a=(r=(u=(r=(l=(r=s<<5|s>>>27)+(o&a|~o&u)+l+1518500249+v[e]<<0)<<5|l>>>27)+(s&(o=o<<30|o>>>2)|~s&a)+u+1518500249+v[e+1]<<0)<<5|u>>>27)+(l&(s=s<<30|s>>>2)|~l&o)+a+1518500249+v[e+2]<<0)<<5|a>>>27)+(u&(l=l<<30|l>>>2)|~u&s)+o+1518500249+v[e+3]<<0)<<5|o>>>27)+(a&(u=u<<30|u>>>2)|~a&l)+s+1518500249+v[e+4]<<0,a=a<<30|a>>>2;for(;e<40;e+=5)s=(r=(o=(r=(a=(r=(u=(r=(l=(r=s<<5|s>>>27)+(o^a^u)+l+1859775393+v[e]<<0)<<5|l>>>27)+(s^(o=o<<30|o>>>2)^a)+u+1859775393+v[e+1]<<0)<<5|u>>>27)+(l^(s=s<<30|s>>>2)^o)+a+1859775393+v[e+2]<<0)<<5|a>>>27)+(u^(l=l<<30|l>>>2)^s)+o+1859775393+v[e+3]<<0)<<5|o>>>27)+(a^(u=u<<30|u>>>2)^l)+s+1859775393+v[e+4]<<0,a=a<<30|a>>>2;for(;e<60;e+=5)s=(r=(o=(r=(a=(r=(u=(r=(l=(r=s<<5|s>>>27)+(o&a|o&u|a&u)+l-1894007588+v[e]<<0)<<5|l>>>27)+(s&(o=o<<30|o>>>2)|s&a|o&a)+u-1894007588+v[e+1]<<0)<<5|u>>>27)+(l&(s=s<<30|s>>>2)|l&o|s&o)+a-1894007588+v[e+2]<<0)<<5|a>>>27)+(u&(l=l<<30|l>>>2)|u&s|l&s)+o-1894007588+v[e+3]<<0)<<5|o>>>27)+(a&(u=u<<30|u>>>2)|a&l|u&l)+s-1894007588+v[e+4]<<0,a=a<<30|a>>>2;for(;e<80;e+=5)s=(r=(o=(r=(a=(r=(u=(r=(l=(r=s<<5|s>>>27)+(o^a^u)+l-899497514+v[e]<<0)<<5|l>>>27)+(s^(o=o<<30|o>>>2)^a)+u-
|