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mOlBwC,GAAe,UAASA,EAAN,QAEtBA,SAAgB3D,UAAO,SAAiC5yC,GAAK,OAAO,IAAKA,GAAKu2C,IAC9EA,EAAgBC,UAAqB3D,6BAAwB,CAAE/4C,KAAMy8C,IACrEA,EAAgBE,UAAqB5D,6BAAwB,IAJjC0D,GAAT","names":["s","r","HAS_TYPED_ARRAYS","Uint8Array","support","BASE64","keyStr","decode","str","input","replace","i","n","length","output","enc1","indexOf","charAt","enc2","enc3","enc4","chr2","chr3","push","encode","bytes","chr1","data","offset","ensure","len","tmp","Math","max","set","get","buffer","write","writeString","writeByte","b","readByte","w","readShort","writeShort","readLong","writeLong","times","charCodeAt","reader","ret","Array","stream","eof","readFixed","writeFixed","f","round","readShort_","writeShort_","readLong_","writeLong_","readFixed_","writeFixed_","read","readString","String","fromCharCode","apply","slice","start","x","pos","skip","nbytes","toString","Error","saveExcursion","writeBase64","base64","window","atob","array","map","value","join","obj","key","Object","prototype","hasOwnProperty","call","keys","sort","a","parseFloat","constructor","this","raw","scalerType","tableCount","searchRange","entrySelector","rangeShift","tables","entry","tag","checksum","readTable","name","Ctor","def","table","render","maxpow2","pow","floor","log","LN2","out","BinaryStream","directoryLength","headOffset","tableData","adjustment","sum","file","definition","rawData","parse","Table","version","revision","checkSumAdjustment","magicNumber","flags","unitsPerEm","created","modified","xMin","yMin","xMax","yMax","macStyle","lowestRecPPEM","fontDirectionHint","indexToLocFormat","glyphDataFormat","offsets","head","offsetOf","id","lengthOf","needsLongFormat","format","ascent","descent","lineGap","advanceWidthMax","minLeftSideBearing","minRightSideBearing","xMaxExtent","caretSlopeRise","caretSlopeRun","caretOffset","metricDataFormat","numOfLongHorMetrics","ids","numGlyphs","maxPoints","maxContours","maxComponentPoints","maxComponentContours","maxZones","maxTwilightPoints","maxStorage","maxFunctionDefs","maxInstructionDefs","maxStackElements","maxSizeOfInstructions","maxComponentElements","maxComponentDepth","glyphIds","dir","metrics","hhea","advance","lsb","leftSideBearings","maxp","forGlyph","m","GlyfTable","compound","idOffsets","d","old2new","cache","glyphFor","loca","numberOfContours","glyph","CompoundGlyph","SimpleGlyph","glyphs","oldIds","NameTable","text","platformID","platformSpecificID","languageID","nameID","count","stringOffset","nameRecords","strings","rec","NameEntry","postscriptEntry","postscriptName","psName","strCount","strTable","list","j","PostTable","POSTSCRIPT_GLYPHS","split","numberOfGlyphs","italicAngle","underlinePosition","underlineThickness","isFixedPitch","minMemType42","maxMemType42","minMemType1","maxMemType1","glyphNameIndex","names","limit","code","index","mapping","indexes","post","CmapTable","codeMap","self","language","segCount","endCode","startCode","idDelta","idRangeOffset","end","glyphId","ngroups","endCharCode","glyphCode","console","error","CmapEntry","ncid2ogid","ogid2ngid","codes","sortedKeys","startCodes","endCodes","last","diff","charcode","delta","new_gid","segCountX2","deltas","rangeOffsets","startGlyph","forEach","renderCharmap","averageCharWidth","weightClass","widthClass","type","ySubscriptXSize","ySubscriptYSize","ySubscriptXOffset","ySubscriptYOffset","ySuperscriptXSize","ySuperscriptYSize","ySuperscriptXOffset","ySuperscriptYOffset","yStrikeoutSize","yStrikeoutPosition","familyClass","panose","charRange","vendorID","selection","firstCharIndex","lastCharIndex","winAscent","winDescent","codePageRange","xHeight","capHeight","defaultChar","breakChar","maxContext","subsetTag","font","subset","unicodes","ngid2ogid","next","firstChar","nextGid","nextSubsetTag","use","ch","string","extra","counter","ucs2decode","reduce","old_gid","cmap","encodeText","glyphsFor","result","glyf","parseInt","old_gid_ids","lastChar","hmtx","os2","directory","cidToGidMap","cid","contents","numFonts","Directory","HeadTable","LocaTable","HheaTable","MaxpTable","HmtxTable","OS2Table","scale","widthOfGlyph","makeSubset","Subfont","buf","size","subarray","fnTyped","arraySet","dest","src","src_offs","dest_offs","flattenChunks","chunks","l","chunk","Buf8","Buf16","Uint16Array","Buf32","Int32Array","fnUntyped","concat","typedOK","supported","strApplyOK","strApplyUintOK","c","c2","m_pos","str_len","buf_len","t","shrinkBuf","_buf2binstring","adler","s1","s2","crcTable","k","makeTable","crc","msg","next_in","avail_in","total_in","next_out","avail_out","total_out","state","data_type","static_ltree","static_dtree","_dist_code","_length_code","base_length","base_dist","static_l_desc","static_d_desc","static_bl_desc","extra_lbits","extra_dbits","extra_blbits","bl_order","static_tree","extra_bits","extra_base","elems","max_length","has_stree","dyn_tree","stat_desc","max_code","dist","pending_buf","pending","bi_valid","bi_buf","put_short","tree","send_bits","res","bl_count","bits","next_code","MAX_BITS","bi_reverse","LITERALS","dyn_ltree","dyn_dtree","bl_tree","END_BLOCK","opt_len","static_len","last_lit","matches","depth","_n2","_m2","v","heap","heap_len","smaller","ltree","dtree","lc","lx","d_buf","l_buf","send_code","d_code","desc","node","stree","heap_max","pqdownheap","h","xbits","base","overflow","gen_bitlen","gen_codes","curlen","prevlen","nextlen","max_count","min_count","REP_3_6","REPZ_3_10","REPZ_11_138","o","static_init_done","stored_len","STORED_BLOCK","header","bi_windup","copy_block","lit_bufsize","MIN_LOOKAHEAD","MAX_MATCH$1","strm","errorCode","pending_out","opt_lenb","static_lenb","max_blindex","level","black_mask","detect_data_type","build_tree","l_desc","d_desc","scan_tree","bl_desc","BL_CODES","build_bl_tree","_tr_stored_block","e","strategy","STATIC_TREES","compress_block","DYN_TREES","lcodes","dcodes","blcodes","rank","send_tree","send_all_trees","init_block","_tr_flush_block","block_start","strstart","flush_pending","wrap","adler32","crc32","cur_match","match","chain_length","max_chain_length","scan","best_len","prev_length","nice_match","w_size","_win","wmask","w_mask","prev","strend","scan_end1","scan_end","good_match","lookahead","match_start","p","more","_w_size","window_size","hash_size","read_buf","insert","ins_h","hash_shift","hash_mask","flush","max_block_size","pending_buf_size","fill_window","max_start","flush_block_only","hash_head","bflush","match_length","longest_match","_tr_tally","max_lazy_match","MIN_MATCH$1","max_insert","prev_match","match_available","BS_NEED_MORE","good_length","max_lazy","nice_length","max_chain","func","configurationTable","Config","deflate_stored","deflate_fast","deflate_slow","status","gzhead","gzindex","method","last_flush","w_bits","hash_bits","HEAP_SIZE$1","zero$1","MAX_BITS$1","zero","L_CODES","D_CODES","MAX_MATCH","LENGTH_CODES","StaticTreeDesc","tr_static_init","TreeDesc","_tr_init","err","deflateResetKeep","lm_init","old_flush","beg","val","put_byte","hcrc","comment","time","os","putShortMSB","Z_OK","bstate","deflate_huff","deflate_rle","bi_flush","_tr_align","toString$1","options","sources","arguments","source","shift","TypeError","_has","assign","chunkSize","windowBits","memLevel","to","opt","gzip","ended","ZStream","DeflateState","deflateReset","deflateInit2","deflateSetHeader","dictionary","dict","string2buf","Rn","avail","tmpDict","dictLength","deflateSetDictionary","_dict_set","mode","_mode","deflate","onEnd","onData","buf2binstring","deflateEnd","deflator","Deflate","browser","NL","RESOURCE_COUNTER","PAPER_SIZE","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","a10","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","b10","c0","c1","c3","c4","c5","c6","c7","c8","c9","c10","executive","folio","legal","letter","tabloid","indentLevel","undefined","PDFValue","beforeRender","isArray","renderArray","isDate","renderDate","isNaN","num","toFixed","test","PDFDictionary","writeData","withIndent","indent","pad","getOption","paperSize","toLowerCase","unitsToPoints","min","margin","left","top","right","bottom","FONT_CACHE","Helvetica","Courier","Symbol","ZapfDingbats","IMAGE_CACHE","loadFonts","loadOne","urls","callback","manyLoader","url","cont","msie","exec","idx","atobUint8Array","createUint8Array","base64ToUint8Array","substr","req","XMLHttpRequest","open","responseType","onload","response","VBArray","responseBody","toArray","onerror","send","loadBinary","TTFFont","loadImages","images","jpegQuality","keepPNG","bloburl","blob","img","Image","crossOrigin","xhr","mozilla","FileReader","svg","doc","DOMParser","parseFromString","documentElement","getAttribute","_load","URL","createObjectURL","setAttribute","width","height","xml","XMLSerializer","serializeToString","encodeBase64","readAsText","_onerror","complete","_onload","canvas","document","createElement","imgdata","ctx","getContext","drawImage","getImageData","revokeObjectURL","hasAlpha","rgb","alpha","rawbytes","PDFRawImage","toDataURL","PDFJpegImage","substring","upscale","_trycanvas","readAsArrayBuffer","loadImage","makeOutput","objcount","objects","defval","attach","renderValue","renderFull","_offset","wrapObject","pages","FONTS","IMAGES","GRAD_COL_FUNCTIONS","GRAD_OPC_FUNCTIONS","GRAD_COL","GRAD_OPC","catalog","PDFCatalog","pageTree","PDFPageTree","nameTree","JavaScript","Names","PDFString","S","_","JS","props","setPages","info","Producer","Title","Author","Subject","Keywords","Creator","CreationDate","Date","addPage","paperOptions","getPaperOptions","contentWidth","contentHeight","content","PDFStream","Contents","Parent","MediaBox","page","PDFPage","_content","transform","translate","rect","clip","xrefOffset","zeropad","Size","Root","Info","getFont","PDFStandardFont","PDFFont","getImage","asStream","getOpacityGS","opacity","forStroke","_opacityGSCache","gs","Type","CA","ca","_resourceName","date","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","mm","cm","mm2pt","inch","cm2pt","in","in2pt","utf16be","super","Boolean","txt","BOM","encodeUTF16BE","static","escape","PDFName_cache","PDFName","empty","compress","Filter","unshift","Length","pagesObj","Pages","Kids","Count","pageObj","SOF_CODES","colorSpace","bitsPerComponent","marker","Subtype","Width","Height","BitsPerComponent","ColorSpace","Decode","pdf","mask","SMask","BaseFont","Encoding","_pdf","_font","_sub","bbox","stemV","isSerif","isScript","PDFHexString","getTextWidth","fontSize","sub","fontStream","Length1","descriptor","FontName","FontBBox","Flags","StemV","ItalicAngle","Ascent","Descent","CapHeight","XHeight","FontFile2","charWidths","gid","loop","descendant","CIDSystemInfo","Registry","Ordering","Supplement","FontDescriptor","FirstChar","LastChar","DW","W","CIDToGIDMap","_makeCidToGidMap","DescendantFonts","unimap","PDFToUnicodeCmap","unimapStream","ToUnicode","ucs2encode","makeHash","r1","g1","r2","g2","hash","FunctionType","Domain","Range","N","C0","C1","_rcount","_textMode","_fontResources","_gsResources","_xResources","_patResources","_shResources","_opacity","_matrix","_annotations","_fontSize","_contextStack","ProcSet","Resources","Font","ExtGState","XObject","Pattern","Shading","Annots","_out","isIdentityMatrix","d1","e1","f1","d2","mmul","dx","dy","sx","sy","rotate","angle","cos","sin","beginText","endText","_requireTextMode","_requireFont","setFont","setTextLeading","setTextRenderingMode","showText","requestedWidth","outputWidth","showTextNL","addLink","uri","box","ll","_toPage","y","ur","Rect","Border","A","URI","setStrokeColor","g","setOpacity","setFillOpacity","setStrokeOpacity","setFillColor","gradient","save","userSpace","oname","isRadial","funcs","stops","cur","prevColor","curColor","opacities","colors","cacheColorGradientFunction","color","cacheOpacityGradientFunction","pop","assemble","Functions","Bounds","Encode","makeGradientFunctions","coords","shading","ShadingType","Coords","Function","Extend","cacheColorGradient","AIS","G","FormType","BBox","Group","CS","I","s0","cacheOpacityGradient","cacheGradient","sname","restore","setDashPattern","dashArray","dashPhase","setLineWidth","setLineCap","lineCap","setLineJoin","lineJoin","setMitterLimit","mitterLimit","_context","moveTo","lineTo","bezier","x1","y1","x2","y2","x3","y3","bezier1","bezier2","close","ellipse","rx","ry","_X","_Y","circle","stroke","nop","clipStroke","closeStroke","fill","fillStroke","line","matrix","fontdef","fontFamily","italic","variant","bold","lineHeight","unquote","style","FONT_MAPPINGS","serif","monospace","zapfdingbats","alias","defineFont","fontAlias","thing","KENDO_PSEUDO_ELEMENT","nodeInfo","_root","microsoft","edge","Text","getOrigin","_pdfRect","rawBBox","el","styles","Element","selector","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","querySelectorAll","closest","nodeType","parentNode","cloneNodes","$","clone","cloneNode","$el","$clone","tagName","removeAttribute","checked","selected","firstChild","nextSibling","appendChild","_kendoExportVisual","dive","canvases","orig","kendo","jQuery","element","promise","createPromise","reject","getComputedStyle","PDF","styleSheets","doStylesheet","ss","rules","cssRules","styleSheet","family","splitProperty","getPropertyValue","findFonts","addRule","addRules","rule","getFontURL","cssText","href","getFontFaces","ownerDocument","getXY","group","getBoundingClientRect","setTransform","_clipbox","geo","_stackingContext","_avoidLinks","avoidLinks","cls","classList","add","className","addClass","renderElement","remove","word","removeClass","cacheImages","forceBreak","forcePageBreak","hasPaperSize","pageWidth","pageHeight","hasMargin","multiPage","_ignoreMargin","template","compileTemplate","div","innerHTML","firstElementChild","makeTemplate","copy","_destructive","container","adjust","splitElement","makePage","insertBefore","pageNum","totalPages","bind","keepTogether","offsetHeight","setCSS","tableLayout","bottomPadding","bottomBorder","saveAdjust","isFirst","breakAtElement","fall","fallsOnMargin","splitText","first","children","firstInParent","colgroup","thead","grid","gridHead","querySelector","repeatHeaders","range","createRange","setStartBefore","setEndBefore","extractContents","preventBulletOnListItem","display","boxSizing","padding","position","clear","pageClassName","available","selectNodeContents","nextnode","P","setEnd","findEOP","endOffset","li","tfoot","ol","paddingLeft","paddingRight","whenImagesAreActuallyLoaded","beforePageBreak","doPageBreak","handlePageBreaks","progress","canceled","doOne","append","cancel","removeChild","setTimeout","resolve","parseBackgroundImage","tok_linear_gradient","tok_percent","tok_length","tok_keyword","tok_angle","tok_whitespace","tok_popen","tok_pclose","tok_comma","tok_url","tok_content","cache1","cache2","tok","token","skip_ws","percent","utils_parseColor","toRGB","propName","to1","to2","reverse","PI","parseAngle","stop","read_stop","read_linear_gradient","read_url","separator","cacheKey","in_paren","in_string","looking_at","trim","create","getFontHeight","measureText","inc","getPrototypeOf","counterReset","doCounters","resetCounter","counterIncrement","incCounter","css","toCssRgba","elements","bg","path","pseudoElt","prop","defa","webkit","me","opera","important","setProperty","p1","p2","toUpperCase","side","parseColor","sanitizeRadius","innerBox","wt","wr","wb","wl","radians","shape","clipPath","points","curvePoints","curveTo","rTL","rTR","rBR","rBL","tl_x","tl_y","tr_x","tr_y","br_x","br_y","bl_x","bl_y","tl","tr","br","bl","getBorderRadius","bt","getBorder","bb","pt","pr","pb","pl","roundBox","rTL0","rTR0","rBR0","rBL0","adjustBorderRadiusForBox","Path","addArcToPath","startAngle","endAngle","radiusX","radiusY","arabicToRoman","alphaNumeral","_renderElement","fake","kind","place","updateCounters","psel","getCssText","textContent","values","getAllCounters","formatCounter","getCounter","displayCounter","evalPseudoElementContent","pseudo","saveClass","backgroundColor","textOverflow","saveTextOverflow","backgroundImage","backgroundRepeat","backgroundPosition","backgroundOrigin","backgroundSize","currentStyle","innerbox","setClipping","updateClipbox","boxes","cells","getClientRects","tableBorderLeft","tableBorderTop","tableBox","firstCellBox","rows","adjustBoxes","drawOneBox","_pdfLink","listStyleType","listStylePosition","_drawBullet","bullet","disc","square","elementIndex","saveStyle","C","textAlign","drawBullet","isFormField","elementRoundBox","clipit","visual","attr","widget","widgetInstance","exportDOMVisual","exportVisual","maybeRenderWidget","renderContents","Wtop","Wleft","Wright","rl","rr","drawRoundCorner","ri","radiansToDegrees","he","anticlockwise","background","drawBackgroundImage","atan2","pxlen","abs","scaledAngle","atan","tan","implicit","LinearGradient","gradientRenderer","img_width","img_height","renderBG","aspect_ratio","orgBox","M","Xe","origin","rewX","repeatX","rewY","isLast","drawOneBackground","drawBackground","shouldDrawLeft","shouldDrawRight","drawEdge","inv","getContentBox","image","sa","sb","za","zb","pa","renderImage","serializer","serializeSVG","Circle","renderCheckbox","option","whiteSpace","multiple","selectedOptions","selectedIndex","getSelectedOption","scrollLeft","scrollTop","renderFormField","floats","positioned","renderText","floating","mergeSort","zIndexSort","cb","emptyClipbox","search","isJustified","columnCount","textTransform","estimateLineLength","prevLineBottom","underline","lineThrough","overline","hasDecoration","doChunk","selectNode","ypos","chrome","safari","rectangles","Infinity","done","origStart","setStart","actuallyGetRangeBoundingRect","found","eol","findEOL","startOffset","cc","TextRect","drawText","visibility","getTransform","zIndex","main","_dom_zIndex","invert","transformCopy","groupInStackingContext","decoration","createsStackingContext","pushNodeInfo","pleaseSetPropertyValue","multiplyCopy","_renderWithPseudoElements","popNodeInfo","TEXT_RENDERING_MODE","DASH_PATTERNS","dash","dashDot","dot","longDash","longDashDot","longDashDotDot","solid","LINE_CAP","butt","LINE_JOIN","miter","bevel","fonts","imgDPI","producer","title","author","subject","keywords","creator","autoPrint","drawPage","root","changed","clipbox","currentBox","newShape","visible","shouldDraw","saveclipbox","savematrix","withClipping","MultiPath","inClipbox","change","dispatch","segments","paths","optArray","Arc","optimize","addMargin","getSize","drawElement","landscape","traverse","ceil","doIt","handlers","handler","_pdfDebug","dashType","setStrokeOptions","Gradient","setFillOptions","_drawPath","drawPath","drawMultiPath","drawCircle","drawArc","drawGroup","drawRect","RadialGradient","center","radius","topLeft","maybeGradient","gt","closed","controlIn","anchor","maybeDrawRect","seg","prevOut","controlOut","maybeFillStroke","geometry","_position","sz","cornerRadius","fileName","parts","contentType","Blob","navigator","msSaveBlob","dataURI","fileSaver","download","createEvent","initMouseEvent","dispatchEvent","proxyURL","form","proxyTarget","formData","proxyData","body","submit","_c0","packageMetadata","productName","productCodes","publishDate","licensingDocsUrl","PDFExportTemplateDirective","templateRef","ɵfac","ɵngcc0","ɵdir","selectors","__decorate","__param","Optional","__metadata","TemplateRef","FIELDS","PDFExportMarginComponent","field","ɵcmp","inputs","decls","vars","rf","encapsulation","Input","PDFExportComponent","validatePackage","drawMargin","marginComponent","saveAs","nativeElement","export","exportElement","then","exportGroup","pdfOptions","dataUri","saveDataUri","saveOptions","drawOptions","cleanup","pageTemplate","destroy","pageTemplateDirective","context","embeddedView","createEmbeddedView","detectChanges","templateWrap","rootNodes","rootNode","imageResolution","forceProxy","drawDOM","exportPDF","postToProxy","saveAsDataURI","saveAsBlob","contentQueries","dirIndex","_t","ngContentSelectors","Number","ContentChild","ElementRef","PDFExportModule","ɵmod","ɵinj"],"sourceRoot":"webpack:///","sources":["./node_modules/source-map-loader/dist/cjs.js","./node_modules/@progress/kendo-drawing/dist/es2015/pdf/utils.js","./node_modules/@progress/kendo-drawing/dist/es2015/pdf/ttf.js","./node_modules/@progress/pako-esm/dist/pako-esm2015.js","./node_modules/@progress/kendo-drawing/dist/es2015/pdf/deflate.js","./node_modules/@progress/kendo-drawing/dist/es2015/pdf/core.js","./node_modules/@progress/kendo-drawing/dist/es2015/html/core.js","./node_modules/@progress/kendo-drawing/dist/es2015/common/template.js","./node_modules/@progress/kendo-drawing/dist/es2015/pdf/drawing.js","./node_modules/@progress/kendo-file-saver/dist/es2015/save-as.js","./node_modules/@progress/kendo-angular-pdf-export/__ivy_ngcc__/dist/fesm2015/index.js"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { support } from '../common';\n\n/* eslint-disable no-multi-spaces, key-spacing, indent, camelcase, space-before-blocks, eqeqeq, brace-style */\n/* eslint-disable space-infix-ops, space-before-function-paren, array-bracket-spacing, object-curly-spacing */\n/* eslint-disable no-nested-ternary, max-params, default-case, no-else-return, no-empty */\n/* eslint-disable no-param-reassign, no-var, block-scoped-var */\n\n// XXX: remove this junk (assume `true`) when we no longer have to support IE < 10\n// IE 9 (at least compatibility) reports having Uint8Array but the request response does not contain ArrayBuffer which results in missing table head error\nconst HAS_TYPED_ARRAYS = typeof Uint8Array !== 'undefined' && support.browser && (!support.browser.msie || support.browser.version > 9);\n\nconst BASE64 = (function(){\n var keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n return {\n decode: function(str) {\n var input = str.replace(/[^A-Za-z0-9\\+\\/\\=]/g, \"\"), i = 0, n = input.length, output = [];\n\n while (i < n) {\n var enc1 = keyStr.indexOf(input.charAt(i++));\n var enc2 = keyStr.indexOf(input.charAt(i++));\n var enc3 = keyStr.indexOf(input.charAt(i++));\n var enc4 = keyStr.indexOf(input.charAt(i++));\n\n var chr1 = (enc1 << 2) | (enc2 >>> 4);\n var chr2 = ((enc2 & 15) << 4) | (enc3 >>> 2);\n var chr3 = ((enc3 & 3) << 6) | enc4;\n\n output.push(chr1);\n if (enc3 != 64) {\n output.push(chr2);\n }\n if (enc4 != 64) {\n output.push(chr3);\n }\n }\n\n return output;\n },\n encode: function(bytes) {\n var i = 0, n = bytes.length;\n var output = \"\";\n\n while (i < n) {\n var chr1 = bytes[i++];\n var chr2 = bytes[i++];\n var chr3 = bytes[i++];\n\n var enc1 = chr1 >>> 2;\n var enc2 = ((chr1 & 3) << 4) | (chr2 >>> 4);\n var enc3 = ((chr2 & 15) << 2) | (chr3 >>> 6);\n var enc4 = chr3 & 63;\n\n if (i - n == 2) {\n enc3 = enc4 = 64;\n } else if (i - n == 1) {\n enc4 = 64;\n }\n\n output += keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);\n }\n return output;\n }\n };\n}());\n\nfunction BinaryStream(data) {\n var offset = 0, length = 0;\n if (data == null) {\n data = HAS_TYPED_ARRAYS ? new Uint8Array(256) : [];\n } else {\n length = data.length;\n }\n\n var ensure = HAS_TYPED_ARRAYS ? function(len) {\n if (len >= data.length) {\n var tmp = new Uint8Array(Math.max(len + 256, data.length * 2));\n tmp.set(data, 0);\n data = tmp;\n }\n } : function() {};\n\n var get = HAS_TYPED_ARRAYS ? function() {\n return new Uint8Array(data.buffer, 0, length);\n } : function() {\n return data;\n };\n\n var write = HAS_TYPED_ARRAYS ? function(bytes) {\n if (typeof bytes == \"string\") {\n return writeString(bytes);\n }\n var len = bytes.length;\n ensure(offset + len);\n data.set(bytes, offset);\n offset += len;\n if (offset > length) {\n length = offset;\n }\n } : function(bytes) {\n if (typeof bytes == \"string\") {\n return writeString(bytes);\n }\n for (var i = 0; i < bytes.length; ++i) {\n writeByte(bytes[i]);\n }\n };\n\n var slice = HAS_TYPED_ARRAYS ? function(start, length) {\n if (data.buffer.slice) {\n return new Uint8Array(data.buffer.slice(start, start + length));\n } else {\n // IE10\n var x = new Uint8Array(length);\n x.set(new Uint8Array(data.buffer, start, length));\n return x;\n }\n } : function(start, length) {\n return data.slice(start, start + length);\n };\n\n function eof() {\n return offset >= length;\n }\n function readByte() {\n return offset < length ? data[offset++] : 0;\n }\n function writeByte(b) {\n ensure(offset);\n data[offset++] = b & 0xFF;\n if (offset > length) {\n length = offset;\n }\n }\n function readShort() {\n return (readByte() << 8) | readByte();\n }\n function writeShort(w) {\n writeByte(w >> 8);\n writeByte(w);\n }\n function readShort_() {\n var w = readShort();\n return w >= 0x8000 ? w - 0x10000 : w;\n }\n function writeShort_(w) {\n writeShort(w < 0 ? w + 0x10000 : w);\n }\n function readLong() {\n return (readShort() * 0x10000) + readShort();\n }\n function writeLong(w) {\n writeShort((w >>> 16) & 0xFFFF);\n writeShort(w & 0xFFFF);\n }\n function readLong_() {\n var w = readLong();\n return w >= 0x80000000 ? w - 0x100000000 : w;\n }\n function writeLong_(w) {\n writeLong(w < 0 ? w + 0x100000000 : w);\n }\n function readFixed() {\n return readLong() / 0x10000;\n }\n function writeFixed(f) {\n writeLong(Math.round(f * 0x10000));\n }\n function readFixed_() {\n return readLong_() / 0x10000;\n }\n function writeFixed_(f) {\n writeLong_(Math.round(f * 0x10000));\n }\n function read(len) {\n return times(len, readByte);\n }\n function readString(len) {\n return String.fromCharCode.apply(String, read(len));\n }\n function writeString(str) {\n for (var i = 0; i < str.length; ++i) {\n writeByte(str.charCodeAt(i));\n }\n }\n function times(n, reader) {\n for (var ret = new Array(n), i = 0; i < n; ++i) {\n ret[i] = reader();\n }\n return ret;\n }\n\n var stream = {\n eof : eof,\n readByte : readByte,\n writeByte : writeByte,\n readShort : readShort,\n writeShort : writeShort,\n readLong : readLong,\n writeLong : writeLong,\n readFixed : readFixed,\n writeFixed : writeFixed,\n\n // signed numbers.\n readShort_ : readShort_,\n writeShort_ : writeShort_,\n readLong_ : readLong_,\n writeLong_ : writeLong_,\n readFixed_ : readFixed_,\n writeFixed_ : writeFixed_,\n\n read : read,\n write : write,\n readString : readString,\n writeString : writeString,\n\n times : times,\n get : get,\n slice : slice,\n\n offset: function(pos) {\n if (pos != null) {\n offset = pos;\n return stream;\n }\n return offset;\n },\n\n skip: function(nbytes) {\n offset += nbytes;\n },\n\n toString: function() {\n throw new Error(\"FIX CALLER. BinaryStream is no longer convertible to string!\");\n },\n\n length: function() { return length; },\n\n saveExcursion: function(f) {\n var pos = offset;\n try {\n return f();\n } finally {\n offset = pos;\n }\n },\n\n writeBase64: function(base64) {\n if (window.atob) {\n writeString(window.atob(base64));\n } else {\n write(BASE64.decode(base64));\n }\n },\n base64: function() {\n return BASE64.encode(get());\n }\n };\n\n return stream;\n}\n\nfunction ucs2decode(string) {\n var output = [],\n counter = 0,\n length = string.length,\n value,\n extra;\n while (counter < length) {\n value = string.charCodeAt(counter++);\n if (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n // high surrogate, and there is a next character\n extra = string.charCodeAt(counter++);\n if ((extra & 0xFC00) == 0xDC00) { // low surrogate\n output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n } else {\n // unmatched surrogate; only append this code unit, in case the next\n // code unit is the high surrogate of a surrogate pair\n output.push(value);\n counter--;\n }\n } else {\n output.push(value);\n }\n }\n return output;\n}\n\nfunction ucs2encode(array) {\n return array.map(function(value){\n var output = \"\";\n if (value > 0xFFFF) {\n value -= 0x10000;\n output += String.fromCharCode(value >>> 10 & 0x3FF | 0xD800);\n value = 0xDC00 | value & 0x3FF;\n }\n output += String.fromCharCode(value);\n return output;\n }).join(\"\");\n}\n\nfunction atobUint8Array(base64) {\n const data = window.atob(base64);\n const result = new Uint8Array(data.length);\n\n for (let idx = 0; idx < data.length; idx++) {\n result[idx] = data.charCodeAt(idx);\n }\n\n return result;\n}\n\nfunction createUint8Array(data) {\n const result = new Uint8Array(data.length);\n\n for (let idx = 0; idx < data.length; idx++) {\n result[idx] = data[idx];\n }\n\n return result;\n}\n\nfunction base64ToUint8Array(base64) {\n if (window.atob) {\n return atobUint8Array(base64);\n }\n\n return createUint8Array(BASE64.decode(base64));\n}\n\nexport {\n HAS_TYPED_ARRAYS,\n BASE64,\n BinaryStream,\n ucs2decode,\n ucs2encode,\n base64ToUint8Array\n};\n","/* eslint-disable no-multi-spaces, key-spacing, indent, camelcase, space-before-blocks, eqeqeq, brace-style */\n/* eslint-disable space-infix-ops, space-before-function-paren, array-bracket-spacing, object-curly-spacing */\n/* eslint-disable no-nested-ternary, max-params, default-case, no-else-return, no-empty */\n/* eslint-disable no-param-reassign, no-var, block-scoped-var */\n\n/*****************************************************************************\\\n *\n * The code in this file, although written from scratch, is influenced by the\n * TrueType parser/encoder in PDFKit -- http://pdfkit.org/ (a CoffeeScript\n * library for producing PDF files).\n *\n * PDFKit is (c) Devon Govett 2014 and released under the MIT License.\n *\n\\*****************************************************************************/\n\nimport { BinaryStream, ucs2decode } from \"./utils\";\n\nfunction hasOwnProperty(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nfunction sortedKeys(obj) {\n return Object.keys(obj).sort(function(a, b){ return a - b; }).map(parseFloat);\n}\n\n///\nclass Directory {\n constructor(data) {\n this.raw = data;\n this.scalerType = data.readLong();\n this.tableCount = data.readShort();\n this.searchRange = data.readShort();\n this.entrySelector = data.readShort();\n this.rangeShift = data.readShort();\n\n var tables = this.tables = {};\n for (var i = 0; i < this.tableCount; ++i) {\n var entry = {\n tag : data.readString(4),\n checksum : data.readLong(),\n offset : data.readLong(),\n length : data.readLong()\n };\n tables[entry.tag] = entry;\n }\n }\n\n readTable(name, Ctor) {\n var def = this.tables[name];\n if (!def) {\n throw new Error(\"Table \" + name + \" not found in directory\");\n }\n return (this[name] = def.table = new Ctor(this, def));\n }\n\n render(tables) {\n var tableCount = Object.keys(tables).length;\n\n var maxpow2 = Math.pow(2, Math.floor(Math.log(tableCount) / Math.LN2));\n var searchRange = maxpow2 * 16;\n var entrySelector = Math.floor(Math.log(maxpow2) / Math.LN2);\n var rangeShift = tableCount * 16 - searchRange;\n\n var out = BinaryStream();\n out.writeLong(this.scalerType);\n out.writeShort(tableCount);\n out.writeShort(searchRange);\n out.writeShort(entrySelector);\n out.writeShort(rangeShift);\n\n var directoryLength = tableCount * 16;\n var offset = out.offset() + directoryLength;\n var headOffset = null;\n var tableData = BinaryStream();\n\n for (var tag in tables) {\n if (hasOwnProperty(tables, tag)) {\n var table = tables[tag];\n\n out.writeString(tag);\n out.writeLong(this.checksum(table));\n out.writeLong(offset);\n out.writeLong(table.length);\n\n tableData.write(table);\n if (tag == \"head\") {\n headOffset = offset;\n }\n offset += table.length;\n\n while (offset % 4) {\n tableData.writeByte(0);\n offset++;\n }\n }\n }\n\n out.write(tableData.get());\n var sum = this.checksum(out.get());\n var adjustment = 0xB1B0AFBA - sum;\n\n out.offset(headOffset + 8);\n out.writeLong(adjustment);\n return out.get();\n }\n\n checksum(data) {\n data = BinaryStream(data);\n var sum = 0;\n while (!data.eof()) {\n sum += data.readLong();\n }\n return sum & 0xFFFFFFFF;\n }\n}\n\nclass Table {\n constructor(file, def) {\n this.definition = def;\n this.length = def.length;\n this.offset = def.offset;\n this.file = file;\n this.rawData = file.raw;\n this.parse(file.raw);\n }\n\n raw() {\n return this.rawData.slice(this.offset, this.length);\n }\n\n parse() {} // abstract\n}\n\nclass HeadTable extends Table {\n parse(data) {\n data.offset(this.offset);\n this.version = data.readLong();\n this.revision = data.readLong();\n this.checkSumAdjustment = data.readLong();\n this.magicNumber = data.readLong();\n this.flags = data.readShort();\n this.unitsPerEm = data.readShort();\n this.created = data.read(8);\n this.modified = data.read(8);\n\n this.xMin = data.readShort_();\n this.yMin = data.readShort_();\n this.xMax = data.readShort_();\n this.yMax = data.readShort_();\n\n this.macStyle = data.readShort();\n this.lowestRecPPEM = data.readShort();\n this.fontDirectionHint = data.readShort_();\n this.indexToLocFormat = data.readShort_();\n this.glyphDataFormat = data.readShort_();\n }\n\n render(indexToLocFormat) {\n var out = BinaryStream();\n out.writeLong(this.version);\n out.writeLong(this.revision);\n out.writeLong(0); // checksum adjustment; shall be computed later\n out.writeLong(this.magicNumber);\n out.writeShort(this.flags);\n out.writeShort(this.unitsPerEm);\n out.write(this.created);\n out.write(this.modified);\n out.writeShort_(this.xMin);\n out.writeShort_(this.yMin);\n out.writeShort_(this.xMax);\n out.writeShort_(this.yMax);\n out.writeShort(this.macStyle);\n out.writeShort(this.lowestRecPPEM);\n out.writeShort_(this.fontDirectionHint);\n out.writeShort_(indexToLocFormat); // this will depend on the `loca` table\n out.writeShort_(this.glyphDataFormat);\n return out.get();\n }\n}\n\nclass LocaTable extends Table {\n parse(data) {\n data.offset(this.offset);\n var format = this.file.head.indexToLocFormat;\n if (format === 0) {\n this.offsets = data.times(this.length / 2, function(){\n return 2 * data.readShort();\n });\n } else {\n this.offsets = data.times(this.length / 4, data.readLong);\n }\n }\n\n offsetOf(id) {\n return this.offsets[id];\n }\n\n lengthOf(id) {\n return this.offsets[id + 1] - this.offsets[id];\n }\n\n render(offsets) {\n var out = BinaryStream();\n var needsLongFormat = offsets[offsets.length - 1] > 0xFFFF;\n for (var i = 0; i < offsets.length; ++i) {\n if (needsLongFormat) {\n out.writeLong(offsets[i]);\n } else {\n out.writeShort(offsets[i] / 2);\n }\n }\n return {\n format: needsLongFormat ? 1 : 0,\n table: out.get()\n };\n }\n}\n\nclass HheaTable extends Table {\n parse(data) {\n data.offset(this.offset);\n\n this.version = data.readLong();\n this.ascent = data.readShort_();\n this.descent = data.readShort_();\n this.lineGap = data.readShort_();\n this.advanceWidthMax = data.readShort();\n this.minLeftSideBearing = data.readShort_();\n this.minRightSideBearing = data.readShort_();\n this.xMaxExtent = data.readShort_();\n this.caretSlopeRise = data.readShort_();\n this.caretSlopeRun = data.readShort_();\n this.caretOffset = data.readShort_();\n\n data.skip(4 * 2); // reserved\n\n this.metricDataFormat = data.readShort_();\n this.numOfLongHorMetrics = data.readShort();\n }\n\n render(ids) {\n var out = BinaryStream();\n out.writeLong(this.version);\n out.writeShort_(this.ascent);\n out.writeShort_(this.descent);\n out.writeShort_(this.lineGap);\n out.writeShort(this.advanceWidthMax);\n out.writeShort_(this.minLeftSideBearing);\n out.writeShort_(this.minRightSideBearing);\n out.writeShort_(this.xMaxExtent);\n out.writeShort_(this.caretSlopeRise);\n out.writeShort_(this.caretSlopeRun);\n out.writeShort_(this.caretOffset);\n\n out.write([ 0, 0, 0, 0, 0, 0, 0, 0 ]); // reserved bytes\n\n out.writeShort_(this.metricDataFormat);\n out.writeShort(ids.length);\n return out.get();\n }\n}\n\nclass MaxpTable extends Table {\n parse(data) {\n data.offset(this.offset);\n this.version = data.readLong();\n this.numGlyphs = data.readShort();\n this.maxPoints = data.readShort();\n this.maxContours = data.readShort();\n this.maxComponentPoints = data.readShort();\n this.maxComponentContours = data.readShort();\n this.maxZones = data.readShort();\n this.maxTwilightPoints = data.readShort();\n this.maxStorage = data.readShort();\n this.maxFunctionDefs = data.readShort();\n this.maxInstructionDefs = data.readShort();\n this.maxStackElements = data.readShort();\n this.maxSizeOfInstructions = data.readShort();\n this.maxComponentElements = data.readShort();\n this.maxComponentDepth = data.readShort();\n }\n\n render(glyphIds) {\n var out = BinaryStream();\n out.writeLong(this.version);\n out.writeShort(glyphIds.length);\n out.writeShort(this.maxPoints);\n out.writeShort(this.maxContours);\n out.writeShort(this.maxComponentPoints);\n out.writeShort(this.maxComponentContours);\n out.writeShort(this.maxZones);\n out.writeShort(this.maxTwilightPoints);\n out.writeShort(this.maxStorage);\n out.writeShort(this.maxFunctionDefs);\n out.writeShort(this.maxInstructionDefs);\n out.writeShort(this.maxStackElements);\n out.writeShort(this.maxSizeOfInstructions);\n out.writeShort(this.maxComponentElements);\n out.writeShort(this.maxComponentDepth);\n return out.get();\n }\n}\n\nclass HmtxTable extends Table {\n parse(data) {\n data.offset(this.offset);\n var dir = this.file, hhea = dir.hhea;\n this.metrics = data.times(hhea.numOfLongHorMetrics, function(){\n return {\n advance: data.readShort(),\n lsb: data.readShort_()\n };\n });\n var lsbCount = dir.maxp.numGlyphs - dir.hhea.numOfLongHorMetrics;\n this.leftSideBearings = data.times(lsbCount, data.readShort_);\n }\n\n forGlyph(id) {\n var metrics = this.metrics;\n var n = metrics.length;\n if (id < n) {\n return metrics[id];\n }\n return {\n advance: metrics[n - 1].advance,\n lsb: this.leftSideBearings[id - n]\n };\n }\n\n render(glyphIds) {\n var out = BinaryStream();\n for (var i = 0; i < glyphIds.length; ++i) {\n var m = this.forGlyph(glyphIds[i]);\n out.writeShort(m.advance);\n out.writeShort_(m.lsb);\n }\n return out.get();\n }\n}\n\nvar GlyfTable = (function(){\n class SimpleGlyph {\n get compound() {\n return false;\n }\n\n constructor(raw) {\n this.raw = raw;\n }\n\n render() {\n return this.raw.get();\n }\n }\n\n var ARG_1_AND_2_ARE_WORDS = 0x0001;\n var WE_HAVE_A_SCALE = 0x0008;\n var MORE_COMPONENTS = 0x0020;\n var WE_HAVE_AN_X_AND_Y_SCALE = 0x0040;\n var WE_HAVE_A_TWO_BY_TWO = 0x0080;\n //var WE_HAVE_INSTRUCTIONS = 0x0100;\n\n class CompoundGlyph {\n get compound() {\n return true;\n }\n\n constructor(data) {\n this.raw = data;\n var ids = this.glyphIds = [];\n var offsets = this.idOffsets = [];\n while (true) { // eslint-disable-line no-constant-condition\n var flags = data.readShort();\n offsets.push(data.offset());\n ids.push(data.readShort());\n\n if (!(flags & MORE_COMPONENTS)) {\n break;\n }\n\n data.skip(flags & ARG_1_AND_2_ARE_WORDS ? 4 : 2);\n\n if (flags & WE_HAVE_A_TWO_BY_TWO) {\n data.skip(8);\n } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {\n data.skip(4);\n } else if (flags & WE_HAVE_A_SCALE) {\n data.skip(2);\n }\n }\n }\n\n render(old2new) {\n var out = BinaryStream(this.raw.get());\n for (var i = 0; i < this.glyphIds.length; ++i) {\n var id = this.glyphIds[i];\n out.offset(this.idOffsets[i]);\n out.writeShort(old2new[id]);\n }\n return out.get();\n }\n }\n\n return class extends Table {\n parse() {\n this.cache = {};\n }\n\n glyphFor(id) {\n var cache = this.cache;\n if (hasOwnProperty(cache, id)) {\n return cache[id];\n }\n\n var loca = this.file.loca;\n var length = loca.lengthOf(id);\n\n if (length === 0) {\n return (cache[id] = null);\n }\n\n var data = this.rawData;\n var offset = this.offset + loca.offsetOf(id);\n var raw = BinaryStream(data.slice(offset, length));\n\n var numberOfContours = raw.readShort_();\n var xMin = raw.readShort_();\n var yMin = raw.readShort_();\n var xMax = raw.readShort_();\n var yMax = raw.readShort_();\n\n var glyph = cache[id] = numberOfContours < 0 ? new CompoundGlyph(raw) : new SimpleGlyph(raw);\n\n glyph.numberOfContours = numberOfContours;\n glyph.xMin = xMin;\n glyph.yMin = yMin;\n glyph.xMax = xMax;\n glyph.yMax = yMax;\n\n return glyph;\n }\n\n render(glyphs, oldIds, old2new) {\n var out = BinaryStream(), offsets = [];\n for (var i = 0; i < oldIds.length; ++i) {\n var id = oldIds[i];\n var glyph = glyphs[id];\n if (out.offset() % 2) {\n out.writeByte(0);\n }\n offsets.push(out.offset());\n if (glyph) {\n out.write(glyph.render(old2new));\n }\n }\n if (out.offset() % 2) {\n out.writeByte(0);\n }\n offsets.push(out.offset());\n return {\n table: out.get(),\n offsets: offsets\n };\n }\n };\n}());\n\nvar NameTable = (function(){\n class NameEntry {\n constructor(text, entry) {\n this.text = text;\n this.length = text.length;\n this.platformID = entry.platformID;\n this.platformSpecificID = entry.platformSpecificID;\n this.languageID = entry.languageID;\n this.nameID = entry.nameID;\n }\n }\n\n return class extends Table {\n parse(data) {\n data.offset(this.offset);\n data.readShort(); // format\n var count = data.readShort();\n var stringOffset = this.offset + data.readShort();\n var nameRecords = data.times(count, function(){\n return {\n platformID : data.readShort(),\n platformSpecificID : data.readShort(),\n languageID : data.readShort(),\n nameID : data.readShort(),\n length : data.readShort(),\n offset : data.readShort() + stringOffset\n };\n });\n var strings = this.strings = {};\n for (var i = 0; i < nameRecords.length; ++i) {\n var rec = nameRecords[i];\n data.offset(rec.offset);\n var text = data.readString(rec.length);\n if (!strings[rec.nameID]) {\n strings[rec.nameID] = [];\n }\n strings[rec.nameID].push(new NameEntry(text, rec));\n }\n this.postscriptEntry = strings[6][0];\n this.postscriptName = this.postscriptEntry.text.replace(/[^\\x20-\\x7F]/g, \"\");\n }\n\n render(psName) {\n var strings = this.strings;\n var strCount = 0;\n for (var i in strings) {\n if (hasOwnProperty(strings, i)) {\n strCount += strings[i].length;\n }\n }\n var out = BinaryStream();\n var strTable = BinaryStream();\n\n out.writeShort(0); // format\n out.writeShort(strCount);\n out.writeShort(6 + 12 * strCount); // stringOffset\n\n for (i in strings) {\n if (hasOwnProperty(strings, i)) {\n var list = i == 6 ? [\n new NameEntry(psName, this.postscriptEntry)\n ] : strings[i];\n for (var j = 0; j < list.length; ++j) {\n var str = list[j];\n out.writeShort(str.platformID);\n out.writeShort(str.platformSpecificID);\n out.writeShort(str.languageID);\n out.writeShort(str.nameID);\n out.writeShort(str.length);\n out.writeShort(strTable.offset());\n\n strTable.writeString(str.text);\n }\n }\n }\n\n out.write(strTable.get());\n\n return out.get();\n }\n };\n})();\n\nvar PostTable = (function(){\n var POSTSCRIPT_GLYPHS = \".notdef .null nonmarkingreturn space exclam quotedbl numbersign dollar percent ampersand quotesingle parenleft parenright asterisk plus comma hyphen period slash zero one two three four five six seven eight nine colon semicolon less equal greater question at A B C D E F G H I J K L M N O P Q R S T U V W X Y Z bracketleft backslash bracketright asciicircum underscore grave a b c d e f g h i j k l m n o p q r s t u v w x y z braceleft bar braceright asciitilde Adieresis Aring Ccedilla Eacute Ntilde Odieresis Udieresis aacute agrave acircumflex adieresis atilde aring ccedilla eacute egrave ecircumflex edieresis iacute igrave icircumflex idieresis ntilde oacute ograve ocircumflex odieresis otilde uacute ugrave ucircumflex udieresis dagger degree cent sterling section bullet paragraph germandbls registered copyright trademark acute dieresis notequal AE Oslash infinity plusminus lessequal greaterequal yen mu partialdiff summation product pi integral ordfeminine ordmasculine Omega ae oslash questiondown exclamdown logicalnot radical florin approxequal Delta guillemotleft guillemotright ellipsis nonbreakingspace Agrave Atilde Otilde OE oe endash emdash quotedblleft quotedblright quoteleft quoteright divide lozenge ydieresis Ydieresis fraction currency guilsinglleft guilsinglright fi fl daggerdbl periodcentered quotesinglbase quotedblbase perthousand Acircumflex Ecircumflex Aacute Edieresis Egrave Iacute Icircumflex Idieresis Igrave Oacute Ocircumflex apple Ograve Uacute Ucircumflex Ugrave dotlessi circumflex tilde macron breve dotaccent ring cedilla hungarumlaut ogonek caron Lslash lslash Scaron scaron Zcaron zcaron brokenbar Eth eth Yacute yacute Thorn thorn minus multiply onesuperior twosuperior threesuperior onehalf onequarter threequarters franc Gbreve gbreve Idotaccent Scedilla scedilla Cacute cacute Ccaron ccaron dcroat\".split(/\\s+/g);\n\n return class extends Table {\n parse(data) {\n data.offset(this.offset);\n\n this.format = data.readLong();\n this.italicAngle = data.readFixed_();\n this.underlinePosition = data.readShort_();\n this.underlineThickness = data.readShort_();\n this.isFixedPitch = data.readLong();\n this.minMemType42 = data.readLong();\n this.maxMemType42 = data.readLong();\n this.minMemType1 = data.readLong();\n this.maxMemType1 = data.readLong();\n\n var numberOfGlyphs;\n\n switch (this.format) {\n case 0x00010000:\n case 0x00030000:\n break;\n\n case 0x00020000:\n numberOfGlyphs = data.readShort();\n this.glyphNameIndex = data.times(numberOfGlyphs, data.readShort);\n this.names = [];\n var limit = this.offset + this.length;\n while (data.offset() < limit) {\n this.names.push(data.readString(data.readByte()));\n }\n break;\n\n case 0x00025000:\n numberOfGlyphs = data.readShort();\n this.offsets = data.read(numberOfGlyphs);\n break;\n\n case 0x00040000:\n this.map = data.times(this.file.maxp.numGlyphs, data.readShort);\n break;\n }\n }\n\n glyphFor(code) {\n switch (this.format) {\n case 0x00010000:\n return POSTSCRIPT_GLYPHS[code] || \".notdef\";\n\n case 0x00020000:\n var index = this.glyphNameIndex[code];\n if (index < POSTSCRIPT_GLYPHS.length) {\n return POSTSCRIPT_GLYPHS[index];\n }\n return this.names[index - POSTSCRIPT_GLYPHS.length] || \".notdef\";\n\n case 0x00025000:\n\n case 0x00030000:\n return \".notdef\";\n\n case 0x00040000:\n return this.map[code] || 0xFFFF;\n }\n }\n\n render(mapping) {\n if (this.format == 0x00030000) {\n return this.raw();\n }\n\n // keep original header, but set format to 2.0\n var out = BinaryStream(this.rawData.slice(this.offset, 32));\n out.writeLong(0x00020000);\n out.offset(32);\n\n var indexes = [];\n var strings = [];\n\n for (var i = 0; i < mapping.length; ++i) {\n var id = mapping[i];\n var post = this.glyphFor(id);\n var index = POSTSCRIPT_GLYPHS.indexOf(post);\n if (index >= 0) {\n indexes.push(index);\n } else {\n indexes.push(POSTSCRIPT_GLYPHS.length + strings.length);\n strings.push(post);\n }\n }\n\n out.writeShort(mapping.length);\n\n for (i = 0; i < indexes.length; ++i) {\n out.writeShort(indexes[i]);\n }\n\n for (i = 0; i < strings.length; ++i) {\n out.writeByte(strings[i].length);\n out.writeString(strings[i]);\n }\n\n return out.get();\n }\n };\n})();\n\nvar CmapTable = (function(){\n class CmapEntry {\n constructor(data, offset, codeMap) {\n var self = this;\n self.platformID = data.readShort();\n self.platformSpecificID = data.readShort();\n self.offset = offset + data.readLong();\n\n data.saveExcursion(function(){\n var code;\n data.offset(self.offset);\n self.format = data.readShort();\n\n switch (self.format) {\n case 0:\n self.length = data.readShort();\n self.language = data.readShort();\n for (var i = 0; i < 256; ++i) {\n codeMap[i] = data.readByte();\n }\n break;\n\n case 4:\n self.length = data.readShort();\n self.language = data.readShort();\n var segCount = data.readShort() / 2;\n\n data.skip(6); // searchRange, entrySelector, rangeShift\n var endCode = data.times(segCount, data.readShort);\n data.skip(2); // reserved pad\n var startCode = data.times(segCount, data.readShort);\n var idDelta = data.times(segCount, data.readShort_);\n var idRangeOffset = data.times(segCount, data.readShort);\n\n var count = (self.length + self.offset - data.offset()) / 2;\n var glyphIds = data.times(count, data.readShort);\n\n for (i = 0; i < segCount; ++i) {\n var start = startCode[i], end = endCode[i];\n for (code = start; code <= end; ++code) {\n var glyphId;\n if (idRangeOffset[i] === 0) {\n glyphId = code + idDelta[i];\n } else {\n ///\n // When non-zero, idRangeOffset contains for each segment the byte offset of the Glyph ID\n // into the glyphIds table, from the *current* `i` cell of idRangeOffset. In other words,\n // this offset spans from the first into the second array. This works, because the arrays\n // are consecutive in the TTF file:\n //\n // [ ...idRangeOffset... ][ ...glyphIds... ]\n // ...... 48 ...... .... ID ....\n // ^----- 48 bytes -----^\n //\n // (but I can't stop wondering why is it not just a plain index, possibly incremented by 1\n // so that we can have that special `zero` value.)\n //\n // The elements of idRangeOffset are even numbers, because both arrays contain 16-bit words,\n // yet the offset is in bytes. That is why we divide it by 2. Then we subtract the\n // remaining segments (segCount-i), and add the code-start offset, to which we need to add\n // the corresponding delta to get the actual glyph ID.\n ///\n var index = idRangeOffset[i] / 2 - (segCount - i) + (code - start);\n glyphId = glyphIds[index] || 0;\n if (glyphId !== 0) {\n glyphId += idDelta[i];\n }\n }\n codeMap[code] = glyphId & 0xFFFF;\n }\n }\n break;\n\n case 6:\n self.length = data.readShort();\n self.language = data.readShort();\n code = data.readShort();\n var length = data.readShort();\n while (length-- > 0) {\n codeMap[code++] = data.readShort();\n }\n break;\n\n case 12:\n data.readShort(); // reserved\n self.length = data.readLong();\n self.language = data.readLong();\n var ngroups = data.readLong();\n while (ngroups-- > 0) {\n code = data.readLong();\n var endCharCode = data.readLong();\n var glyphCode = data.readLong();\n while (code <= endCharCode) {\n codeMap[code++] = glyphCode++;\n }\n }\n break;\n\n default:\n if (window.console) {\n window.console.error(\"Unhandled CMAP format: \" + self.format);\n }\n }\n });\n }\n }\n\n function renderCharmap(ncid2ogid, ogid2ngid) {\n var codes = sortedKeys(ncid2ogid);\n var startCodes = [];\n var endCodes = [];\n var last = null;\n var diff = null;\n\n function new_gid(charcode) {\n return ogid2ngid[ncid2ogid[charcode]];\n }\n\n for (var i = 0; i < codes.length; ++i) {\n var code = codes[i];\n var gid = new_gid(code);\n var delta = gid - code;\n if (last == null || delta !== diff) {\n if (last) {\n endCodes.push(last);\n }\n startCodes.push(code);\n diff = delta;\n }\n last = code;\n }\n\n if (last) {\n endCodes.push(last);\n }\n endCodes.push(0xFFFF);\n startCodes.push(0xFFFF);\n\n var segCount = startCodes.length;\n var segCountX2 = segCount * 2;\n var searchRange = 2 * Math.pow(2, Math.floor(Math.log(segCount) / Math.LN2));\n var entrySelector = Math.log(searchRange / 2) / Math.LN2;\n var rangeShift = segCountX2 - searchRange;\n\n var deltas = [];\n var rangeOffsets = [];\n var glyphIds = [];\n\n for (i = 0; i < segCount; ++i) {\n var startCode = startCodes[i];\n var endCode = endCodes[i];\n if (startCode == 0xFFFF) {\n deltas.push(0);\n rangeOffsets.push(0);\n break;\n }\n var startGlyph = new_gid(startCode);\n if (startCode - startGlyph >= 0x8000) {\n deltas.push(0);\n rangeOffsets.push(2 * (glyphIds.length + segCount - i));\n for (var j = startCode; j <= endCode; ++j) {\n glyphIds.push(new_gid(j));\n }\n } else {\n deltas.push(startGlyph - startCode);\n rangeOffsets.push(0);\n }\n }\n\n var out = BinaryStream();\n\n out.writeShort(3); // platformID\n out.writeShort(1); // platformSpecificID\n out.writeLong(12); // offset\n out.writeShort(4); // format\n out.writeShort(16 + segCount * 8 + glyphIds.length * 2); // length\n out.writeShort(0); // language\n out.writeShort(segCountX2);\n out.writeShort(searchRange);\n out.writeShort(entrySelector);\n out.writeShort(rangeShift);\n\n endCodes.forEach(out.writeShort);\n out.writeShort(0); // reserved pad\n startCodes.forEach(out.writeShort);\n deltas.forEach(out.writeShort_);\n rangeOffsets.forEach(out.writeShort);\n glyphIds.forEach(out.writeShort);\n\n return out.get();\n }\n\n return class extends Table {\n parse(data) {\n var self = this;\n var offset = self.offset;\n data.offset(offset);\n self.codeMap = {};\n self.version = data.readShort();\n var tableCount = data.readShort();\n self.tables = data.times(tableCount, function(){\n return new CmapEntry(data, offset, self.codeMap);\n });\n }\n\n static render(ncid2ogid, ogid2ngid) {\n var out = BinaryStream();\n out.writeShort(0); // version\n out.writeShort(1); // tableCount\n out.write(renderCharmap(ncid2ogid, ogid2ngid));\n return out.get();\n }\n };\n\n})();\n\nclass OS2Table extends Table {\n parse(data) {\n data.offset(this.offset);\n this.version = data.readShort();\n this.averageCharWidth = data.readShort_();\n this.weightClass = data.readShort();\n this.widthClass = data.readShort();\n this.type = data.readShort();\n this.ySubscriptXSize = data.readShort_();\n this.ySubscriptYSize = data.readShort_();\n this.ySubscriptXOffset = data.readShort_();\n this.ySubscriptYOffset = data.readShort_();\n this.ySuperscriptXSize = data.readShort_();\n this.ySuperscriptYSize = data.readShort_();\n this.ySuperscriptXOffset = data.readShort_();\n this.ySuperscriptYOffset = data.readShort_();\n this.yStrikeoutSize = data.readShort_();\n this.yStrikeoutPosition = data.readShort_();\n this.familyClass = data.readShort_();\n\n this.panose = data.times(10, data.readByte);\n this.charRange = data.times(4, data.readLong);\n\n this.vendorID = data.readString(4);\n this.selection = data.readShort();\n this.firstCharIndex = data.readShort();\n this.lastCharIndex = data.readShort();\n\n if (this.version > 0) {\n this.ascent = data.readShort_();\n this.descent = data.readShort_();\n this.lineGap = data.readShort_();\n this.winAscent = data.readShort();\n this.winDescent = data.readShort();\n this.codePageRange = data.times(2, data.readLong);\n\n if (this.version > 1) {\n this.xHeight = data.readShort();\n this.capHeight = data.readShort();\n this.defaultChar = data.readShort();\n this.breakChar = data.readShort();\n this.maxContext = data.readShort();\n }\n }\n }\n\n render() {\n return this.raw();\n }\n}\n\nvar subsetTag = 100000;\n\nfunction nextSubsetTag() {\n var ret = \"\", n = String(subsetTag);\n for (var i = 0; i < n.length; ++i) {\n ret += String.fromCharCode(n.charCodeAt(i) - 48 + 65);\n }\n ++subsetTag;\n return ret;\n}\n\nclass Subfont {\n constructor(font) {\n this.font = font;\n this.subset = {};\n this.unicodes = {};\n this.ogid2ngid = { 0: 0 };\n this.ngid2ogid = { 0: 0 };\n this.ncid2ogid = {};\n this.next = this.firstChar = 1;\n this.nextGid = 1;\n this.psName = nextSubsetTag() + \"+\" + this.font.psName;\n }\n\n use(ch) {\n var self = this;\n if (typeof ch == \"string\") {\n return ucs2decode(ch).reduce(function(ret, code){\n return ret + String.fromCharCode(self.use(code));\n }, \"\");\n }\n var code = self.unicodes[ch];\n if (!code) {\n code = self.next++;\n self.subset[code] = ch;\n self.unicodes[ch] = code;\n\n // generate new GID (glyph ID) and maintain newGID ->\n // oldGID and back mappings\n var old_gid = self.font.cmap.codeMap[ch];\n if (old_gid) {\n self.ncid2ogid[code] = old_gid;\n if (self.ogid2ngid[old_gid] == null) {\n var new_gid = self.nextGid++;\n self.ogid2ngid[old_gid] = new_gid;\n self.ngid2ogid[new_gid] = old_gid;\n }\n }\n }\n return code;\n }\n\n encodeText(text) {\n return this.use(text);\n }\n\n glyphIds() {\n return sortedKeys(this.ogid2ngid);\n }\n\n glyphsFor(glyphIds, result) {\n if (!result) {\n result = {};\n }\n for (var i = 0; i < glyphIds.length; ++i) {\n var id = glyphIds[i];\n if (!result[id]) {\n var glyph = result[id] = this.font.glyf.glyphFor(id);\n if (glyph && glyph.compound) {\n this.glyphsFor(glyph.glyphIds, result);\n }\n }\n }\n return result;\n }\n\n render() {\n var glyphs = this.glyphsFor(this.glyphIds());\n\n // add missing sub-glyphs\n for (var old_gid in glyphs) {\n if (hasOwnProperty(glyphs, old_gid)) {\n old_gid = parseInt(old_gid, 10);\n if (this.ogid2ngid[old_gid] == null) {\n var new_gid = this.nextGid++;\n this.ogid2ngid[old_gid] = new_gid;\n this.ngid2ogid[new_gid] = old_gid;\n }\n }\n }\n\n // must obtain old_gid_ids in an order matching sorted\n // new_gid_ids\n var new_gid_ids = sortedKeys(this.ngid2ogid);\n var old_gid_ids = new_gid_ids.map(function(id){\n return this.ngid2ogid[id];\n }, this);\n\n var font = this.font;\n var glyf = font.glyf.render(glyphs, old_gid_ids, this.ogid2ngid);\n var loca = font.loca.render(glyf.offsets);\n\n this.lastChar = this.next - 1;\n\n var tables = {\n \"cmap\" : CmapTable.render(this.ncid2ogid, this.ogid2ngid),\n \"glyf\" : glyf.table,\n \"loca\" : loca.table,\n \"hmtx\" : font.hmtx.render(old_gid_ids),\n \"hhea\" : font.hhea.render(old_gid_ids),\n \"maxp\" : font.maxp.render(old_gid_ids),\n \"post\" : font.post.render(old_gid_ids),\n \"name\" : font.name.render(this.psName),\n \"head\" : font.head.render(loca.format),\n \"OS/2\" : font.os2.render()\n };\n\n return this.font.directory.render(tables);\n }\n\n cidToGidMap() {\n var out = BinaryStream(), len = 0;\n for (var cid = this.firstChar; cid < this.next; ++cid) {\n while (len < cid) {\n out.writeShort(0);\n len++;\n }\n var old_gid = this.ncid2ogid[cid];\n if (old_gid) {\n var new_gid = this.ogid2ngid[old_gid];\n out.writeShort(new_gid);\n } else {\n out.writeShort(0);\n }\n len++;\n }\n return out.get();\n }\n}\n\nclass TTFFont {\n constructor(rawData, name) {\n var self = this;\n var data = self.contents = BinaryStream(rawData);\n if (data.readString(4) == \"ttcf\") {\n var offset;\n const parse = function() {\n data.offset(offset);\n self.parse();\n };\n if (!name) {\n throw new Error(\"Must specify a name for TTC files\");\n }\n data.readLong(); // version\n var numFonts = data.readLong();\n for (var i = 0; i < numFonts; ++i) {\n offset = data.readLong();\n data.saveExcursion(parse);\n if (self.psName == name) {\n return;\n }\n }\n throw new Error(\"Font \" + name + \" not found in collection\");\n } else {\n data.offset(0);\n self.parse();\n }\n }\n\n parse() {\n var dir = this.directory = new Directory(this.contents);\n\n this.head = dir.readTable(\"head\", HeadTable);\n this.loca = dir.readTable(\"loca\", LocaTable);\n this.hhea = dir.readTable(\"hhea\", HheaTable);\n this.maxp = dir.readTable(\"maxp\", MaxpTable);\n this.hmtx = dir.readTable(\"hmtx\", HmtxTable);\n this.glyf = dir.readTable(\"glyf\", GlyfTable);\n this.name = dir.readTable(\"name\", NameTable);\n this.post = dir.readTable(\"post\", PostTable);\n this.cmap = dir.readTable(\"cmap\", CmapTable);\n this.os2 = dir.readTable(\"OS/2\", OS2Table);\n\n this.psName = this.name.postscriptName;\n this.ascent = this.os2.ascent || this.hhea.ascent;\n this.descent = this.os2.descent || this.hhea.descent;\n this.lineGap = this.os2.lineGap || this.hhea.lineGap;\n this.scale = 1000 / this.head.unitsPerEm;\n }\n\n widthOfGlyph(glyph) {\n return this.hmtx.forGlyph(glyph).advance * this.scale;\n }\n\n makeSubset() {\n return new Subfont(this);\n }\n}\n\nexport { TTFFont };\n","/* eslint-disable */\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\nvar Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n/* Return codes for the compression/decompression functions. Negative values\n* are errors, positive values are used for special but normal events.\n*/\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\nvar Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//export var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//export var Z_VERSION_ERROR = -6;\n\n/* compression levels */\nvar Z_NO_COMPRESSION = 0;\nvar Z_BEST_SPEED = 1;\nvar Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//export var Z_ASCII = 1; // = Z_TEXT (deprecated)\nvar Z_UNKNOWN = 2;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n//export var Z_NULL = null // Use -1 or null inline; depending on var type\n\n/* eslint-disable */\n\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nfunction assign(obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n}\n\n\n// reduce buffer size, avoiding mem copy\nfunction shrinkBuf(buf, size) {\n if (buf.length === size) { return buf; }\n if (buf.subarray) { return buf.subarray(0, size); }\n buf.length = size;\n return buf;\n}\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n },\n Buf8: function(size) {\n return new Uint8Array(size);\n },\n Buf16: function(size) {\n return new Uint16Array(size);\n },\n Buf32: function(size) {\n return new Int32Array(size);\n }\n};\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n },\n Buf8: function(size) {\n return new Array(size);\n },\n Buf16: function(size) {\n return new Array(size);\n },\n Buf32: function(size) {\n return new Array(size);\n }\n};\n\nlet typedOK = () => {\n const supported =\n (typeof Uint8Array !== 'undefined') &&\n (typeof Uint16Array !== 'undefined') &&\n (typeof Int32Array !== 'undefined');\n\n typedOK = () => supported;\n return supported;\n};\n\nlet arraySet = (dest, src, src_offs, len, dest_offs) => {\n arraySet = typedOK() ?\n fnTyped.arraySet : fnUntyped.arraySet;\n\n return arraySet(dest, src, src_offs, len, dest_offs);\n};\n\nlet flattenChunks = (chunks) => {\n flattenChunks = typedOK() ?\n fnTyped.flattenChunks : fnUntyped.flattenChunks;\n\n return flattenChunks(chunks);\n};\n\nlet Buf8 = (size) => {\n Buf8 = typedOK() ? fnTyped.Buf8 : fnUntyped.Buf8;\n return Buf8(size);\n};\n\nlet Buf16 = (size) => {\n Buf16 = typedOK() ? fnTyped.Buf16 : fnUntyped.Buf16;\n return Buf16(size);\n};\n\nlet Buf32 = (size) => {\n Buf32 = typedOK() ? fnTyped.Buf32 : fnUntyped.Buf32;\n return Buf32(size);\n};\n\n/* eslint-disable */\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\nlet strApplyOK = function() {\n let result = true;\n try {\n String.fromCharCode.apply(null, [ 0 ]);\n } catch (_) {\n result = false;\n }\n\n strApplyOK = () => result;\n return result;\n};\n\nlet strApplyUintOK = function() {\n let result = true;\n try {\n String.fromCharCode.apply(null, new Uint8Array(1));\n } catch (_) {\n result = false;\n }\n\n strApplyUintOK = () => result;\n return result;\n};\n\nlet utf8len = function(c) {\n // Table with utf8 lengths (calculated by first byte of sequence)\n // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n // because max possible codepoint is 0x10ffff\n var table = Buf8(256);\n for (var q = 0; q < 256; q++) {\n table[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n }\n table[254] = table[254] = 1; // Invalid sequence start\n\n utf8len = arg => table[arg];\n return table[c];\n};\n\n// convert string to array (typed, when possible)\nfunction string2buf(str) {\n var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new Uint8Array(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n}\n\n// Helper (used in 2 places)\nfunction _buf2binstring(buf, len) {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if ((buf.subarray && strApplyUintOK()) || (!buf.subarray && strApplyOK())) {\n return String.fromCharCode.apply(null, shrinkBuf(buf, len));\n }\n }\n\n var result = '';\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n}\n\n\n// Convert byte array to binary string\nfunction buf2binstring(buf) {\n return _buf2binstring(buf, buf.length);\n}\n\n\n// Convert binary string (typed, when possible)\nfunction binstring2buf(str) {\n var buf = new Uint8Array(str.length);\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n}\n\n\n// convert array to string\nfunction buf2string(buf, max) {\n var i, out, c, c_len;\n var len = max || buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n c_len = utf8len(c);\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return _buf2binstring(utf16buf, out);\n}\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nfunction utf8border(buf, max) {\n var pos;\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + utf8len(buf[pos]) > max) ? pos : max;\n}\n\n/* eslint-disable */\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n}\n\n/* eslint-disable */\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\nlet crcTable = function() {\n const table = makeTable();\n crcTable = () => table;\n return table;\n};\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable(),\n end = pos + len;\n\n crc ^= -1;\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n/* eslint-disable */\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nfunction inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n//#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n\n\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n}\n\n/* eslint-disable */\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n];\n\nfunction inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) {\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0, max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n// var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n}\n\n/* eslint-disable */\n\nvar CODES$1 = 0;\nvar LENS$1 = 1;\nvar DISTS$1 = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH$1 = 4;\nvar Z_BLOCK$1 = 5;\nvar Z_TREES$1 = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK$1 = 0;\nvar Z_STREAM_END$1 = 1;\nvar Z_NEED_DICT$1 = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR$1 = -2;\nvar Z_DATA_ERROR$1 = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR$1 = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED$1 = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE$1 = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD$1 = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS$1 = 852;\nvar ENOUGH_DISTS$1 = 592;\n\n\nfunction zswap32(q) {\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = Buf16(320); /* temporary storage for code lengths */\n this.work = Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = Buf32(ENOUGH_LENS$1);\n state.distcode = state.distdyn = Buf32(ENOUGH_DISTS$1);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK$1;\n}\n\nfunction inflateReset(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR$1;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n\n if (!strm) { return Z_STREAM_ERROR$1; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK$1) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n\n lenfix = Buf32(512);\n distfix = Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS$1, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS$1, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n}\n\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR$1;\n }\n\n state = strm.state;\n if (state.mode === TYPE$1) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK$1;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD$1;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED$1) {\n strm.msg = 'unknown compression method';\n state.mode = BAD$1;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD$1;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE$1;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED$1) {\n strm.msg = 'unknown compression method';\n state.mode = BAD$1;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD$1;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD$1;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE$1;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT$1;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE$1;\n /* falls through */\n case TYPE$1:\n if (flush === Z_BLOCK$1 || flush === Z_TREES$1) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES$1) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD$1;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD$1;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES$1) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE$1;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD$1;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES$1, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD$1;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD$1;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD$1;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD$1) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD$1;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS$1, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD$1;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS$1, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD$1;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES$1) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE$1) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE$1;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD$1;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD$1;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD$1;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD$1;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END$1;\n break inf_leave;\n case BAD$1:\n ret = Z_DATA_ERROR$1;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR$1;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD$1 &&\n (state.mode < CHECK || flush !== Z_FINISH$1))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) ;\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE$1 ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH$1) && ret === Z_OK$1) {\n ret = Z_BUF_ERROR$1;\n }\n return ret;\n}\n\nfunction inflateEnd(strm) {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR$1;\n }\n\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK$1;\n}\n\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR$1; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK$1;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR$1; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR$1;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR$1;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK$1;\n}\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n\n/* eslint-disable */\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar msg = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n\n/* eslint-disable */\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\n/* eslint-disable */\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\n/* eslint-disable */\n\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nclass Inflate {\n constructor(options) {\n if (!(this instanceof Inflate)) return new Inflate(options);\n\n this.options = assign({\n chunkSize: 16384,\n windowBits: 0,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this.header = new GZheader();\n\n inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n }\n }\n }\n\n /**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\n push(data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var dictionary = this.options.dictionary;\n var status, _mode;\n var next_out_utf8, tail, utf8str;\n var dict;\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false;\n\n if (this.ended) { return false; }\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = binstring2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = inflate(strm, Z_NO_FLUSH); /* no bad return value */\n\n if (status === Z_NEED_DICT && dictionary) {\n // Convert data if needed\n if (typeof dictionary === 'string') {\n dict = string2buf(dictionary);\n } else if (toString.call(dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(dictionary);\n } else {\n dict = dictionary;\n }\n\n status = inflateSetDictionary(this.strm, dict);\n\n }\n\n if (status === Z_BUF_ERROR && allowBufError === true) {\n status = Z_OK;\n allowBufError = false;\n }\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === Z_STREAM_END || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n\n if (this.options.to === 'string') {\n\n next_out_utf8 = utf8border(strm.output, strm.next_out);\n\n tail = strm.next_out - next_out_utf8;\n utf8str = buf2string(strm.output, next_out_utf8);\n\n // move tail\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) { arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\n\n this.onData(utf8str);\n\n } else {\n this.onData(shrinkBuf(strm.output, strm.next_out));\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true;\n }\n\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n if (status === Z_STREAM_END) {\n _mode = Z_FINISH;\n }\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n }\n\n\n /**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\n onData(chunk) {\n this.chunks.push(chunk);\n }\n\n\n /**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\n onEnd(status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('');\n } else {\n this.result = flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n }\n}\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate$1(input, options) {\n var inflator = new Inflate(options);\n\n inflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) { throw inflator.msg || msg[inflator.err]; }\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate$1(input, options);\n}\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\nvar ungzip = inflate$1;\n\n/* eslint-disable */\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\n\nvar extra_dbits = /* extra bits for each distance code */\n [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\n\nvar extra_blbits = /* extra bits for each bit length code */\n [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree;\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree;\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code;\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code;\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length;\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist;\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}\n\n\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s) {\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last) {\n //DeflateState *s;\n //charf *buf; /* input block */\n //ulg stored_len; /* length of input block */\n //int last; /* one if this is the last block for a file */\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last) {\n //DeflateState *s;\n //charf *buf; /* input block, or NULL if too old */\n //ulg stored_len; /* length of input block */\n //int last; /* one if this is the last block for a file */\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc) {\n // deflate_state *s;\n // unsigned dist; /* distance of matched string */\n // unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\n\n/* eslint-disable */\n\nvar MAX_MEM_LEVEL = 9;\n\n\nvar LENGTH_CODES$1 = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS$1 = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES$1 = LITERALS$1 + 1 + LENGTH_CODES$1;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES$1 = 30;\n/* number of distance codes */\nvar BL_CODES$1 = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE$1 = 2 * L_CODES$1 + 1;\n/* maximum heap size */\nvar MAX_BITS$1 = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH$1 = 3;\nvar MAX_MATCH$1 = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH$1 + MIN_MATCH$1 + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\n\nfunction rank(f) {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero$1(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\n\n\nfunction flush_block_only(s, last) {\n _tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH$1;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH$1 - (strend - scan);\n scan = strend - MAX_MATCH$1;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH$1) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH$1 - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH$1) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// var curr = s.strstart + s.lookahead;\n// var init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH$1) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH$1 - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH$1) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = _tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH$1);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH$1) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH$1 - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH$1 - 1)) ? s.strstart : MIN_MATCH$1 - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH$1) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH$1 - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH$1 - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH$1 && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH$1 - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH$1 && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH$1;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = _tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH$1);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH$1 - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH$1 - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH$1 - 1 ? s.strstart : MIN_MATCH$1 - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH$1) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH$1 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH$1 && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH$1;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH$1 - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH$1) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = _tr_tally(s, 1, s.match_length - MIN_MATCH$1);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nlet configurationTable = function() {\n const table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n \n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n ];\n\n configurationTable = () => table;\n return table;\n};\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero$1(s.head); // Fill with NIL (= 0);\n\n const table = configurationTable();\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = table[s.level].max_lazy;\n s.good_match = table[s.level].good_length;\n s.nice_match = table[s.level].nice_length;\n s.max_chain_length = table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH$1 - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = Buf16(HEAP_SIZE$1 * 2);\n this.dyn_dtree = Buf16((2 * D_CODES$1 + 1) * 2);\n this.bl_tree = Buf16((2 * BL_CODES$1 + 1) * 2);\n zero$1(this.dyn_ltree);\n zero$1(this.dyn_dtree);\n zero$1(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = Buf16(MAX_BITS$1 + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = Buf16(2 * L_CODES$1 + 1); /* heap used to build the Huffman trees */\n zero$1(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = Buf16(2 * L_CODES$1 + 1); //uch depth[2*L_CODES+1];\n zero$1(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nfunction deflateResetKeep(strm) {\n var s;\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n _tr_init(s);\n return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH$1 - 1) / MIN_MATCH$1);\n\n s.window = Buf8(s.w_size * 2);\n s.head = Buf16(s.hash_size);\n s.prev = Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n}\n\n\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n var level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configurationTable()[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n _tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n _tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero$1(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n var status;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n s = strm.state;\n wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero$1(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = Buf8(s.w_size);\n arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH$1) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH$1 - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH$1 - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH$1 - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH$1 - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n\n/* eslint-disable */\n\nvar toString$1 = Object.prototype.toString;\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nclass Deflate {\n constructor(options) {\n this.options = assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n if (opt.header) {\n deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n var dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = string2buf(opt.dictionary);\n } else if (toString$1.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this._dict_set = true;\n }\n }\n\n /**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\n push(data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var status, _mode;\n\n if (this.ended) { return false; }\n\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = string2buf(data);\n } else if (toString$1.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = deflate(strm, _mode); /* no bad return value */\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n if (this.options.to === 'string') {\n this.onData(buf2binstring(shrinkBuf(strm.output, strm.next_out)));\n } else {\n this.onData(shrinkBuf(strm.output, strm.next_out));\n }\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n }\n\n\n /**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\n onData(chunk) {\n this.chunks.push(chunk);\n }\n\n\n /**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\n onEnd(status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n }\n}\n\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate$1(input, options) {\n var deflator = new Deflate(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || msg[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate$1(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate$1(input, options);\n}\n\nexport { Deflate, Inflate, Z_BEST_COMPRESSION, Z_BEST_SPEED, Z_BINARY, Z_BLOCK, Z_BUF_ERROR, Z_DATA_ERROR, Z_DEFAULT_COMPRESSION, Z_DEFAULT_STRATEGY, Z_DEFLATED, Z_ERRNO, Z_FILTERED, Z_FINISH, Z_FIXED, Z_FULL_FLUSH, Z_HUFFMAN_ONLY, Z_NEED_DICT, Z_NO_COMPRESSION, Z_NO_FLUSH, Z_OK, Z_PARTIAL_FLUSH, Z_RLE, Z_STREAM_END, Z_STREAM_ERROR, Z_SYNC_FLUSH, Z_TEXT, Z_TREES, Z_UNKNOWN, deflate$1 as deflate, deflateRaw, gzip, inflate$1 as inflate, inflateRaw, ungzip };\n","import { deflate as pakoDeflate } from '@progress/pako-esm';\n\nexport const deflate = pakoDeflate;\n\nexport function supportsDeflate() {\n return true;\n}\n\n","/* eslint-disable no-multi-spaces, key-spacing, indent, camelcase, space-before-blocks, eqeqeq, brace-style */\n/* eslint-disable space-infix-ops, space-before-function-paren, array-bracket-spacing, object-curly-spacing */\n/* eslint-disable no-nested-ternary, max-params, default-case, no-else-return, no-empty */\n/* eslint-disable no-param-reassign, no-var, block-scoped-var */\n\nimport { BinaryStream, ucs2encode, base64ToUint8Array, HAS_TYPED_ARRAYS } from \"./utils\";\nimport { support } from '../common';\nimport { TTFFont } from \"./ttf\";\nimport { deflate, supportsDeflate } from './deflate';\nimport { encodeUTF16BE, BOM } from \"../util/encode-utf\";\nimport { encodeBase64 } from \"../util\";\n\nconst browser = support.browser;\nconst NL = \"\\n\";\n\nvar RESOURCE_COUNTER = 0;\n\nconst PAPER_SIZE = {\n a0 : [ 2383.94 , 3370.39 ],\n a1 : [ 1683.78 , 2383.94 ],\n a2 : [ 1190.55 , 1683.78 ],\n a3 : [ 841.89 , 1190.55 ],\n a4 : [ 595.28 , 841.89 ],\n a5 : [ 419.53 , 595.28 ],\n a6 : [ 297.64 , 419.53 ],\n a7 : [ 209.76 , 297.64 ],\n a8 : [ 147.40 , 209.76 ],\n a9 : [ 104.88 , 147.40 ],\n a10 : [ 73.70 , 104.88 ],\n b0 : [ 2834.65 , 4008.19 ],\n b1 : [ 2004.09 , 2834.65 ],\n b2 : [ 1417.32 , 2004.09 ],\n b3 : [ 1000.63 , 1417.32 ],\n b4 : [ 708.66 , 1000.63 ],\n b5 : [ 498.90 , 708.66 ],\n b6 : [ 354.33 , 498.90 ],\n b7 : [ 249.45 , 354.33 ],\n b8 : [ 175.75 , 249.45 ],\n b9 : [ 124.72 , 175.75 ],\n b10 : [ 87.87 , 124.72 ],\n c0 : [ 2599.37 , 3676.54 ],\n c1 : [ 1836.85 , 2599.37 ],\n c2 : [ 1298.27 , 1836.85 ],\n c3 : [ 918.43 , 1298.27 ],\n c4 : [ 649.13 , 918.43 ],\n c5 : [ 459.21 , 649.13 ],\n c6 : [ 323.15 , 459.21 ],\n c7 : [ 229.61 , 323.15 ],\n c8 : [ 161.57 , 229.61 ],\n c9 : [ 113.39 , 161.57 ],\n c10 : [ 79.37 , 113.39 ],\n executive : [ 521.86 , 756.00 ],\n folio : [ 612.00 , 936.00 ],\n legal : [ 612.00 , 1008.00 ],\n letter : [ 612.00 , 792.00 ],\n tabloid : [ 792.00 , 1224.00 ]\n};\n\nfunction makeOutput() {\n var indentLevel = 0, output = BinaryStream();\n function out() {\n for (var i = 0; i < arguments.length; ++i) {\n var x = arguments[i];\n if (x === undefined) {\n throw new Error(\"Cannot output undefined to PDF\");\n }\n else if (x instanceof PDFValue) {\n x.beforeRender(out);\n x.render(out);\n }\n else if (isArray(x)) {\n renderArray(x, out);\n }\n else if (isDate(x)) {\n renderDate(x, out);\n }\n else if (typeof x == \"number\") {\n if (isNaN(x)) {\n throw new Error(\"Cannot output NaN to PDF\");\n }\n // make sure it doesn't end up in exponent notation\n var num = x.toFixed(7);\n if (num.indexOf(\".\") >= 0) {\n num = num.replace(/\\.?0+$/, \"\");\n }\n if (num == \"-0\") {\n num = \"0\";\n }\n output.writeString(num);\n }\n else if (/string|boolean/.test(typeof x)) {\n output.writeString(String(x));\n }\n else if (typeof x.get == \"function\") {\n output.write(x.get());\n }\n else if (typeof x == \"object\") {\n if (!x) {\n output.writeString(\"null\");\n } else {\n out(new PDFDictionary(x));\n }\n }\n }\n }\n out.writeData = function(data) {\n output.write(data);\n };\n out.withIndent = function(f) {\n ++indentLevel;\n f(out);\n --indentLevel;\n };\n out.indent = function() {\n out(NL, pad(\"\", indentLevel * 2, \" \"));\n out.apply(null, arguments);\n };\n out.offset = function() {\n return output.offset();\n };\n out.toString = function() {\n throw new Error(\"FIX CALLER\");\n };\n out.get = function() {\n return output.get();\n };\n out.stream = function() {\n return output;\n };\n return out;\n}\n\nfunction wrapObject(value, id) {\n var beforeRender = value.beforeRender;\n var renderValue = value.render;\n\n value.beforeRender = function(){};\n\n value.render = function(out) {\n out(id, \" 0 R\");\n };\n\n value.renderFull = function(out) {\n value._offset = out.offset();\n out(id, \" 0 obj \");\n beforeRender.call(value, out);\n renderValue.call(value, out);\n out(\" endobj\");\n };\n}\n\nfunction getPaperOptions(getOption) {\n if (typeof getOption != \"function\") {\n var options = getOption;\n getOption = function(key, def) {\n return key in options ? options[key] : def;\n };\n }\n var paperSize = getOption(\"paperSize\", PAPER_SIZE.a4);\n if (!paperSize) {\n return {};\n }\n if (typeof paperSize == \"string\") {\n paperSize = PAPER_SIZE[paperSize.toLowerCase()];\n if (paperSize == null) {\n throw new Error(\"Unknown paper size\");\n }\n }\n\n paperSize[0] = unitsToPoints(paperSize[0]);\n paperSize[1] = unitsToPoints(paperSize[1]);\n\n if (getOption(\"landscape\", false)) {\n paperSize = [\n Math.max(paperSize[0], paperSize[1]),\n Math.min(paperSize[0], paperSize[1])\n ];\n }\n\n var margin = getOption(\"margin\");\n if (margin) {\n if (typeof margin == \"string\" || typeof margin == \"number\") {\n margin = unitsToPoints(margin, 0);\n margin = { left: margin, top: margin, right: margin, bottom: margin };\n } else {\n margin = {\n left : unitsToPoints(margin.left, 0),\n top : unitsToPoints(margin.top, 0),\n right : unitsToPoints(margin.right, 0),\n bottom : unitsToPoints(margin.bottom, 0)\n };\n }\n if (getOption(\"addMargin\")) {\n paperSize[0] += margin.left + margin.right;\n paperSize[1] += margin.top + margin.bottom;\n }\n }\n return { paperSize: paperSize, margin: margin };\n}\n\nvar FONT_CACHE = {\n \"Times-Roman\" : true,\n \"Times-Bold\" : true,\n \"Times-Italic\" : true,\n \"Times-BoldItalic\" : true,\n \"Helvetica\" : true,\n \"Helvetica-Bold\" : true,\n \"Helvetica-Oblique\" : true,\n \"Helvetica-BoldOblique\" : true,\n \"Courier\" : true,\n \"Courier-Bold\" : true,\n \"Courier-Oblique\" : true,\n \"Courier-BoldOblique\" : true,\n \"Symbol\" : true,\n \"ZapfDingbats\" : true\n};\n\nfunction loadBinary(url, cont) {\n // IE throws Accesss denied error for Data URIs\n let m;\n if (browser.msie && (m = /^data:.*?;base64,/i.exec(url))) {\n cont(base64ToUint8Array(url.substr(m[0].length)));\n return;\n }\n\n function error() {\n if (window.console) {\n if (window.console.error) {\n window.console.error(\"Cannot load URL: %s\", url);\n } else {\n window.console.log(\"Cannot load URL: %s\", url);\n }\n }\n cont(null);\n }\n var req = new XMLHttpRequest();\n req.open('GET', url, true);\n if (HAS_TYPED_ARRAYS) {\n req.responseType = \"arraybuffer\";\n }\n req.onload = function() {\n if (req.status == 200 || req.status == 304) {\n if (HAS_TYPED_ARRAYS) {\n cont(new Uint8Array(req.response));\n } else {\n cont(new window.VBArray(req.responseBody).toArray()); // IE9 only\n }\n } else {\n error();\n }\n };\n req.onerror = error;\n req.send(null);\n}\n\nfunction loadFont(url, cont) {\n var font = FONT_CACHE[url];\n if (font) {\n cont(font);\n } else {\n loadBinary(url, function(data){\n if (data == null) {\n throw new Error(\"Cannot load font from \" + url);\n } else {\n var font = new TTFFont(data);\n FONT_CACHE[url] = font;\n cont(font);\n }\n });\n }\n}\n\nvar IMAGE_CACHE = {};\n\nfunction clearImageCache() {\n IMAGE_CACHE = {};\n}\n\nfunction loadImage(url, size, cont, options) {\n var img = IMAGE_CACHE[url], bloburl, blob;\n if (img) {\n cont(img);\n } else {\n img = new Image();\n if (!(/^data:/i.test(url))) {\n img.crossOrigin = \"Anonymous\";\n }\n if (HAS_TYPED_ARRAYS && !(/^data:/i.test(url))) {\n // IE10 fails to load images from another domain even when the server sends the\n // proper CORS headers. a XHR, however, will be able to load the data.\n // http://stackoverflow.com/a/19734516/154985\n //\n // On the other hand, it's worth doing it this way for all browsers which support\n // responseType = \"blob\" (HAS_TYPED_ARRAYS will be true), because we can inspect the\n // mime type and if it's a JPEG (very common case) we can save a lot of time in\n // _load below.\n var xhr = new XMLHttpRequest();\n xhr.onload = function() {\n blob = xhr.response;\n if (browser.mozilla && blob.type == \"image/svg+xml\") {\n // Firefox won't render SVGs that don't contain width and height attributes.\n let reader = new FileReader();\n reader.onload = function() {\n let doc = new window.DOMParser().parseFromString(this.result, \"image/svg+xml\");\n let svg = doc.documentElement;\n if (svg.getAttribute(\"width\") && svg.getAttribute(\"height\")) {\n // we're good, continue with the existing blob.\n bloburl = URL.createObjectURL(blob);\n _load(bloburl);\n } else {\n svg.setAttribute(\"width\", size.width);\n svg.setAttribute(\"height\", size.height);\n let xml = new window.XMLSerializer().serializeToString(svg);\n let dataURL = `data:image/svg+xml;base64,${encodeBase64(xml)}`;\n _load(dataURL);\n }\n };\n reader.readAsText(blob);\n } else {\n bloburl = URL.createObjectURL(blob);\n _load(bloburl);\n }\n };\n xhr.onerror = _onerror;\n xhr.open(\"GET\", url, true);\n xhr.responseType = \"blob\";\n xhr.send();\n } else {\n _load(url);\n }\n }\n\n function _load(url) {\n img.src = url;\n if (img.complete && !browser.msie) {\n // IE, bless its little heart, says img.complete == true even though the image is\n // not loaded (width=0), therefore we must go the onload route (ticket 929635).\n _onload.call(img);\n } else {\n img.onload = _onload;\n img.onerror = _onerror;\n }\n }\n\n function _trycanvas() {\n if (!size) {\n size = { width: img.width, height: img.height };\n }\n\n var canvas = document.createElement(\"canvas\");\n canvas.width = size.width;\n canvas.height = size.height;\n\n var ctx = canvas.getContext(\"2d\");\n ctx.drawImage(img, 0, 0, size.width, size.height);\n\n var imgdata;\n try {\n imgdata = ctx.getImageData(0, 0, size.width, size.height);\n } catch (ex) {\n // it tainted the canvas -- can't draw it.\n _onerror();\n return;\n } finally {\n if (bloburl) {\n URL.revokeObjectURL(bloburl);\n }\n }\n\n // in case it contains transparency, we must separate rgb data from the alpha\n // channel and create a PDFRawImage image with opacity. otherwise we can use a\n // PDFJpegImage.\n //\n // to do this in one step, we create the rgb and alpha streams anyway, even if\n // we might end up not using them if hasAlpha remains false.\n\n var hasAlpha = false, rgb = BinaryStream(), alpha = BinaryStream();\n var rawbytes = imgdata.data;\n var i = 0;\n while (i < rawbytes.length) {\n rgb.writeByte(rawbytes[i++]);\n rgb.writeByte(rawbytes[i++]);\n rgb.writeByte(rawbytes[i++]);\n var a = rawbytes[i++];\n if (a < 255) {\n hasAlpha = true;\n }\n alpha.writeByte(a);\n }\n\n if (hasAlpha || options.keepPNG) {\n img = new PDFRawImage(size.width, size.height, rgb, alpha);\n } else {\n // no transparency, encode as JPEG.\n var data = canvas.toDataURL(\"image/jpeg\", options.jpegQuality);\n data = data.substr(data.indexOf(\";base64,\") + 8);\n\n var stream = BinaryStream();\n stream.writeBase64(data);\n img = new PDFJpegImage(stream);\n }\n\n cont(IMAGE_CACHE[url] = img);\n }\n\n function _onerror() {\n cont(IMAGE_CACHE[url] = \"ERROR\");\n }\n\n function _onload() {\n if (size) {\n const svg = (blob && blob.type === 'image/svg+xml') || (\n /^data:image\\/svg\\+xml;/i.test(this.src.substring(0, 19))\n );\n\n const upscale = size.width >= img.width || size.height >= img.height;\n\n // Use the original image if requested size is bigger than the source,\n // unless it's an SVG that can be upscaled.\n if (!svg && upscale) {\n size = null;\n }\n }\n if (!size && blob && /^image\\/jpe?g$/i.test(blob.type)) {\n // If we know we got a JPEG, we can skip the process of rendering it to a\n // canvas, getting the pixel data, searching for transparency we know we won't\n // find, getting back a data URI and then decoding the BASE64 to finally get the\n // binary we already have. Also, we avoid downgrading the image quality, with\n // the possible drawback of making a bigger PDF; still, seems legit.\n //\n // Besides saving a lot of work, this also reuses the buffer memory\n // (BinaryStream does not create a copy), potentially saving some GC cycles.\n let reader = new FileReader();\n reader.onload = function() {\n try {\n let img = new PDFJpegImage(BinaryStream(new Uint8Array(this.result)));\n URL.revokeObjectURL(bloburl);\n cont(IMAGE_CACHE[url] = img);\n } catch (ex) {\n // if there's an error parsing the JPEG stream, it could be due to a\n // misconfigured server (improper content-type:\n // https://github.com/telerik/kendo-ui-core/issues/4184). If that's the case,\n // the canvas will still be able to draw it.\n _trycanvas();\n }\n };\n reader.readAsArrayBuffer(blob);\n } else {\n _trycanvas();\n }\n }\n}\n\nfunction manyLoader(loadOne) {\n return function(urls, callback) {\n var n = urls.length, i = n;\n if (n === 0) {\n return callback();\n }\n function next() {\n if (--n === 0) {\n callback();\n }\n }\n while (i-- > 0) {\n loadOne(urls[i], next);\n }\n };\n}\n\nvar loadFonts = manyLoader(loadFont);\nvar loadImages = function(images, callback, options) {\n options = Object.assign({\n jpegQuality : 0.92,\n keepPNG : false\n }, options);\n var urls = Object.keys(images), n = urls.length;\n if (n === 0) {\n return callback();\n }\n function next() {\n if (--n === 0) {\n callback();\n }\n }\n urls.forEach(function(url){\n loadImage(url, images[url], next, options);\n });\n};\n\nclass PDFDocument {\n constructor (options) {\n var self = this;\n var out = makeOutput();\n var objcount = 0;\n var objects = [];\n\n function getOption(name, defval) {\n return (options && options[name] != null) ? options[name] : defval;\n }\n\n self.getOption = getOption;\n\n self.attach = function(value) {\n if (objects.indexOf(value) < 0) {\n wrapObject(value, ++objcount);\n objects.push(value);\n }\n return value;\n };\n\n self.pages = [];\n\n self.FONTS = {};\n self.IMAGES = {};\n self.GRAD_COL_FUNCTIONS = {}; // cache for color gradient functions\n self.GRAD_OPC_FUNCTIONS = {}; // cache for opacity gradient functions\n self.GRAD_COL = {}; // cache for whole color gradient objects\n self.GRAD_OPC = {}; // cache for whole opacity gradient objects\n\n var catalog = self.attach(new PDFCatalog());\n var pageTree = self.attach(new PDFPageTree());\n\n if (getOption(\"autoPrint\")) {\n let nameTree = {};\n nameTree.JavaScript = new PDFDictionary({ Names: [\n new PDFString(\"JS\"), self.attach(new PDFDictionary({\n S: _(\"JavaScript\"),\n JS: new PDFString(\"print(true);\")\n }))\n ] });\n catalog.props.Names = new PDFDictionary(nameTree);\n }\n\n catalog.setPages(pageTree);\n\n var info = self.attach(new PDFDictionary({\n Producer : new PDFString(getOption(\"producer\", \"Kendo UI PDF Generator\"), true), // XXX: kendo.version?\n Title : new PDFString(getOption(\"title\", \"\"), true),\n Author : new PDFString(getOption(\"author\", \"\"), true),\n Subject : new PDFString(getOption(\"subject\", \"\"), true),\n Keywords : new PDFString(getOption(\"keywords\", \"\"), true),\n Creator : new PDFString(getOption(\"creator\", \"Kendo UI PDF Generator\"), true),\n CreationDate : getOption(\"date\", new Date())\n }));\n\n self.addPage = function(options) {\n var paperOptions = getPaperOptions(function(name, defval){\n return (options && options[name] != null) ? options[name] : defval;\n });\n var paperSize = paperOptions.paperSize;\n var margin = paperOptions.margin;\n var contentWidth = paperSize[0];\n var contentHeight = paperSize[1];\n if (margin) {\n contentWidth -= margin.left + margin.right;\n contentHeight -= margin.top + margin.bottom;\n }\n var content = new PDFStream(makeOutput(), null, true);\n var props = {\n Contents : self.attach(content),\n Parent : pageTree,\n MediaBox : [ 0, 0, paperSize[0], paperSize[1] ]\n };\n var page = new PDFPage(self, props);\n page._content = content;\n pageTree.addPage(self.attach(page));\n\n // canvas-like coord. system. (0,0) is upper-left.\n // text must be vertically mirorred before drawing.\n page.transform(1, 0, 0, -1, 0, paperSize[1]);\n\n if (margin) {\n page.translate(margin.left, margin.top);\n // XXX: clip to right/bottom margin. Make this optional?\n page.rect(0, 0, contentWidth, contentHeight);\n page.clip();\n }\n\n self.pages.push(page);\n return page;\n };\n\n self.render = function() {\n var i;\n /// file header\n out(\"%PDF-1.4\", NL, \"%\\xc2\\xc1\\xda\\xcf\\xce\", NL, NL);\n\n /// file body\n for (i = 0; i < objects.length; ++i) {\n objects[i].renderFull(out);\n out(NL, NL);\n }\n\n /// cross-reference table\n var xrefOffset = out.offset();\n out(\"xref\", NL, 0, \" \", objects.length + 1, NL);\n out(\"0000000000 65535 f \", NL);\n for (i = 0; i < objects.length; ++i) {\n out(zeropad(objects[i]._offset, 10), \" 00000 n \", NL);\n }\n out(NL);\n\n /// trailer\n out(\"trailer\", NL);\n out(new PDFDictionary({\n Size: objects.length + 1,\n Root: catalog,\n Info: info\n }), NL, NL);\n\n /// end\n out(\"startxref\", NL, xrefOffset, NL);\n out(\"%%EOF\", NL);\n\n return out.stream().offset(0);\n };\n\n self.loadFonts = loadFonts;\n self.loadImages = loadImages;\n }\n\n getFont(url) {\n var font = this.FONTS[url];\n if (!font) {\n font = FONT_CACHE[url];\n if (!font) {\n throw new Error(\"Font \" + url + \" has not been loaded\");\n }\n if (font === true) {\n font = this.attach(new PDFStandardFont(url));\n } else {\n font = this.attach(new PDFFont(this, font));\n }\n this.FONTS[url] = font;\n }\n return font;\n }\n\n getImage(url) {\n var img = this.IMAGES[url];\n if (!img) {\n img = IMAGE_CACHE[url];\n if (!img) {\n throw new Error(\"Image \" + url + \" has not been loaded\");\n }\n if (img === \"ERROR\") {\n return null;\n }\n img = this.IMAGES[url] = this.attach(img.asStream(this));\n }\n return img;\n }\n\n getOpacityGS(opacity, forStroke) {\n var id = parseFloat(opacity).toFixed(3);\n opacity = parseFloat(id);\n id += forStroke ? \"S\" : \"F\";\n var cache = this._opacityGSCache || (this._opacityGSCache = {});\n var gs = cache[id];\n if (!gs) {\n var props = {\n Type: _(\"ExtGState\")\n };\n if (forStroke) {\n props.CA = opacity;\n } else {\n props.ca = opacity;\n }\n gs = this.attach(new PDFDictionary(props));\n gs._resourceName = _(\"GS\" + (++RESOURCE_COUNTER));\n cache[id] = gs;\n }\n return gs;\n }\n\n dict(props) {\n return new PDFDictionary(props);\n }\n\n name(str) {\n return _(str);\n }\n\n stream(props, content) {\n return new PDFStream(content, props);\n }\n}\n\n/* -----[ utils ]----- */\n\nfunction pad(str, len, ch) {\n while (str.length < len) {\n str = ch + str;\n }\n return str;\n}\n\nfunction zeropad(n, len) {\n return pad(String(n), len, \"0\");\n}\n\nfunction hasOwnProperty(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nvar isArray = Array.isArray || function(obj) {\n return obj instanceof Array;\n};\n\nfunction isDate(obj) {\n return obj instanceof Date;\n}\n\nfunction renderArray(a, out) {\n out(\"[\");\n if (a.length > 0) {\n out.withIndent(function(){\n for (var i = 0; i < a.length; ++i) {\n if (i > 0 && i % 8 === 0) {\n out.indent(a[i]);\n } else {\n out(\" \", a[i]);\n }\n }\n });\n //out.indent();\n }\n out(\" ]\");\n}\n\nfunction renderDate(date, out) {\n out(\"(D:\",\n zeropad(date.getUTCFullYear(), 4),\n zeropad(date.getUTCMonth() + 1, 2),\n zeropad(date.getUTCDate(), 2),\n zeropad(date.getUTCHours(), 2),\n zeropad(date.getUTCMinutes(), 2),\n zeropad(date.getUTCSeconds(), 2),\n \"Z)\");\n}\n\nfunction mm2pt(mm) {\n return mm * (72/25.4);\n}\n\nfunction cm2pt(cm) {\n return mm2pt(cm * 10);\n}\n\nfunction in2pt(inch) {\n return inch * 72;\n}\n\n\nfunction unitsToPoints(x, def) {\n if (typeof x == \"number\") {\n return x;\n }\n if (typeof x == \"string\") {\n var m;\n m = /^\\s*([0-9.]+)\\s*(mm|cm|in|pt)\\s*$/.exec(x);\n if (m) {\n var num = parseFloat(m[1]);\n if (!isNaN(num)) {\n if (m[2] == \"pt\") {\n return num;\n }\n return {\n \"mm\": mm2pt,\n \"cm\": cm2pt,\n \"in\": in2pt\n }[m[2]](num);\n }\n }\n }\n if (def != null) {\n return def;\n }\n throw new Error(\"Can't parse unit: \" + x);\n}\n\n/* -----[ PDF basic objects ]----- */\n\nclass PDFValue {\n beforeRender() {}\n}\n\nclass PDFString extends PDFValue {\n constructor(value, utf16be) {\n super();\n this.value = value;\n this.utf16be = Boolean(utf16be);\n }\n\n render(out) {\n let txt = this.value;\n if (this.utf16be) {\n txt = BOM + encodeUTF16BE(txt);\n txt = txt.replace(/([\\(\\)\\\\])/g, \"\\\\$1\");\n out(\"(\", txt, \")\");\n } else {\n // out.writeString truncates charcodes to 8 bits and\n // 0x128 & 0xFF is 40, the code for open paren.\n // therefore we need to do the chopping here to make\n // sure we backslash all cases.\n let data = [ 40 ]; // open PDF string '('\n for (var i = 0; i < txt.length; ++i) {\n let code = txt.charCodeAt(i) & 0xFF;\n if (code == 40 || code == 41 || code == 92) {\n // backslash before (, ) and \\\n data.push(92);\n }\n data.push(code);\n }\n data.push(41); // ')' close PDF string\n out.writeData(data);\n }\n }\n\n toString() {\n return this.value;\n }\n}\n\nclass PDFHexString extends PDFString {\n constructor(value) {\n super(value);\n this.value = value;\n }\n\n render(out) {\n out(\"<\");\n for (var i = 0; i < this.value.length; ++i) {\n out(zeropad(this.value.charCodeAt(i).toString(16), 4));\n }\n out(\">\");\n }\n}\n\n/// names\nclass PDFName extends PDFValue {\n static get(name) {\n return _(name);\n }\n\n constructor(name) {\n super();\n this.name = name;\n }\n\n render(out) {\n out(\"/\" + this.escape());\n }\n\n escape() {\n return this.name.replace(/[^\\x21-\\x7E]/g, function(c){\n return \"#\" + zeropad(c.charCodeAt(0).toString(16), 2);\n });\n }\n\n toString() {\n return this.name;\n }\n}\n\nvar PDFName_cache = {};\n\nfunction _(name) {\n if (hasOwnProperty(PDFName_cache, name)) {\n return PDFName_cache[name];\n }\n return (PDFName_cache[name] = new PDFName(name));\n}\n\n/// dictionary\n\nclass PDFDictionary extends PDFValue {\n constructor(props) {\n super();\n this.props = props;\n }\n\n render(out) {\n var props = this.props, empty = true;\n out(\"<<\");\n out.withIndent(function(){\n for (var i in props) {\n if (hasOwnProperty(props, i) && !/^_/.test(i)) {\n empty = false;\n out.indent(_(i), \" \", props[i]);\n }\n }\n });\n if (!empty) {\n out.indent();\n }\n out(\">>\");\n }\n}\n\n/// streams\n\nclass PDFStream extends PDFValue {\n constructor(data, props, compress) {\n super();\n if (typeof data == \"string\") {\n var tmp = BinaryStream();\n tmp.write(data);\n data = tmp;\n }\n this.data = data;\n this.props = props || {};\n this.compress = compress;\n }\n\n render(out) {\n var data = this.data.get(), props = this.props;\n if (this.compress && supportsDeflate()) {\n if (!props.Filter) {\n props.Filter = [];\n } else if (!(props.Filter instanceof Array)) {\n props.Filter = [ props.Filter ];\n }\n props.Filter.unshift(_(\"FlateDecode\"));\n data = deflate(data);\n }\n props.Length = data.length;\n out(new PDFDictionary(props), \" stream\", NL);\n out.writeData(data);\n out(NL, \"endstream\");\n }\n}\n\n/// catalog\n\nclass PDFCatalog extends PDFDictionary {\n constructor() {\n super({\n Type: _(\"Catalog\")\n });\n }\n\n setPages(pagesObj) {\n this.props.Pages = pagesObj;\n }\n}\n\n/// page tree\n\nclass PDFPageTree extends PDFDictionary {\n constructor() {\n super({\n Type : _(\"Pages\"),\n Kids : [],\n Count : 0\n });\n }\n\n addPage(pageObj) {\n this.props.Kids.push(pageObj);\n this.props.Count++;\n }\n}\n\n/// images\n\n// JPEG\n\nvar SOF_CODES = [0xc0, 0xc1, 0xc2, 0xc3, 0xc5, 0xc6, 0xc7, 0xc9, 0xca, 0xcb, 0xcd, 0xce, 0xcf];\n\nclass PDFJpegImage {\n constructor(data) {\n // we must determine the correct color space. we'll parse a bit\n // of the JPEG stream for this, it's still better than going\n // through the canvas.\n // https://github.com/telerik/kendo-ui-core/issues/2845\n data.offset(0);\n var width, height, colorSpace, bitsPerComponent;\n var soi = data.readShort();\n if (soi != 0xFFD8) {\n // XXX: do we have some better options here?\n throw new Error(\"Invalid JPEG image\");\n }\n while (!data.eof()) {\n var ff = data.readByte();\n if (ff != 0xFF) {\n throw new Error(\"Invalid JPEG image\");\n }\n var marker = data.readByte();\n var length = data.readShort();\n if (SOF_CODES.indexOf(marker) >= 0) {\n // \"start of frame\" marker\n bitsPerComponent = data.readByte();\n height = data.readShort();\n width = data.readShort();\n colorSpace = data.readByte();\n break;\n }\n data.skip(length - 2);\n }\n\n if (colorSpace == null) {\n throw new Error(\"Invalid JPEG image\");\n }\n\n var props = {\n Type : _(\"XObject\"),\n Subtype : _(\"Image\"),\n Width : width,\n Height : height,\n BitsPerComponent : bitsPerComponent,\n Filter : _(\"DCTDecode\")\n };\n\n switch (colorSpace) {\n case 1:\n props.ColorSpace = _(\"DeviceGray\");\n break;\n case 3:\n props.ColorSpace = _(\"DeviceRGB\");\n break;\n case 4:\n props.ColorSpace = _(\"DeviceCMYK\");\n props.Decode = [ 1, 0, 1, 0, 1, 0, 1, 0 ]; // invert colors\n break;\n }\n\n this.asStream = function() {\n data.offset(0);\n var stream = new PDFStream(data, props);\n stream._resourceName = _(\"I\" + (++RESOURCE_COUNTER));\n return stream;\n };\n }\n}\n\n// PDFRawImage will be used for images with transparency (PNG)\n\nclass PDFRawImage {\n constructor(width, height, rgb, alpha) {\n this.asStream = function(pdf) {\n var mask = new PDFStream(alpha, {\n Type : _(\"XObject\"),\n Subtype : _(\"Image\"),\n Width : width,\n Height : height,\n BitsPerComponent : 8,\n ColorSpace : _(\"DeviceGray\")\n }, true);\n var stream = new PDFStream(rgb, {\n Type : _(\"XObject\"),\n Subtype : _(\"Image\"),\n Width : width,\n Height : height,\n BitsPerComponent : 8,\n ColorSpace : _(\"DeviceRGB\"),\n SMask : pdf.attach(mask)\n }, true);\n stream._resourceName = _(\"I\" + (++RESOURCE_COUNTER));\n return stream;\n };\n }\n}\n\n/// standard fonts\n\nclass PDFStandardFont extends PDFDictionary {\n constructor(name){\n super({\n Type : _(\"Font\"),\n Subtype : _(\"Type1\"),\n BaseFont : _(name)\n });\n\n this._resourceName = _(\"F\" + (++RESOURCE_COUNTER));\n }\n\n encodeText(str) {\n return new PDFString(String(str));\n }\n}\n\n/// TTF fonts\n\nclass PDFFont extends PDFDictionary {\n constructor(pdf, font, props){\n super({});\n\n props = this.props;\n props.Type = _(\"Font\");\n props.Subtype = _(\"Type0\");\n props.Encoding = _(\"Identity-H\");\n\n this._pdf = pdf;\n this._font = font;\n this._sub = font.makeSubset();\n this._resourceName = _(\"F\" + (++RESOURCE_COUNTER));\n\n var head = font.head;\n\n this.name = font.psName;\n var scale = this.scale = font.scale;\n this.bbox = [\n head.xMin * scale,\n head.yMin * scale,\n head.xMax * scale,\n head.yMax * scale\n ];\n\n this.italicAngle = font.post.italicAngle;\n this.ascent = font.ascent * scale;\n this.descent = font.descent * scale;\n this.lineGap = font.lineGap * scale;\n this.capHeight = font.os2.capHeight || this.ascent;\n this.xHeight = font.os2.xHeight || 0;\n this.stemV = 0;\n\n this.familyClass = (font.os2.familyClass || 0) >> 8;\n this.isSerif = this.familyClass >= 1 && this.familyClass <= 7;\n this.isScript = this.familyClass == 10;\n\n this.flags = ((font.post.isFixedPitch ? 1 : 0) |\n (this.isSerif ? 1 << 1 : 0) |\n (this.isScript ? 1 << 3 : 0) |\n (this.italicAngle !== 0 ? 1 << 6 : 0) |\n (1 << 5));\n }\n\n encodeText(text) {\n return new PDFHexString(this._sub.encodeText(String(text)));\n }\n\n getTextWidth(fontSize, text) {\n var width = 0, codeMap = this._font.cmap.codeMap;\n for (var i = 0; i < text.length; ++i) {\n var glyphId = codeMap[text.charCodeAt(i)];\n width += this._font.widthOfGlyph(glyphId || 0);\n }\n return width * fontSize / 1000;\n }\n\n beforeRender() {\n var self = this;\n var sub = self._sub;\n\n // write the TTF data\n var data = sub.render();\n var fontStream = new PDFStream(BinaryStream(data), {\n Length1: data.length\n }, true);\n\n var descriptor = self._pdf.attach(new PDFDictionary({\n Type : _(\"FontDescriptor\"),\n FontName : _(self._sub.psName),\n FontBBox : self.bbox,\n Flags : self.flags,\n StemV : self.stemV,\n ItalicAngle : self.italicAngle,\n Ascent : self.ascent,\n Descent : self.descent,\n CapHeight : self.capHeight,\n XHeight : self.xHeight,\n FontFile2 : self._pdf.attach(fontStream)\n }));\n\n var cmap = sub.ncid2ogid;\n var firstChar = sub.firstChar;\n var lastChar = sub.lastChar;\n var charWidths = [];\n (function loop(i, chunk){\n if (i <= lastChar) {\n var gid = cmap[i];\n if (gid == null) {\n loop(i + 1);\n } else {\n if (!chunk) {\n charWidths.push(i, chunk = []);\n }\n chunk.push(self._font.widthOfGlyph(gid));\n loop(i + 1, chunk);\n }\n }\n })(firstChar);\n\n // As if two dictionaries weren't enough, we need another\n // one, the \"descendant font\". Only that one can be of\n // Subtype CIDFontType2. PDF is the X11 of document\n // formats: portable but full of legacy that nobody cares\n // about anymore.\n\n var descendant = new PDFDictionary({\n Type: _(\"Font\"),\n Subtype: _(\"CIDFontType2\"),\n BaseFont: _(self._sub.psName),\n CIDSystemInfo: new PDFDictionary({\n Registry : new PDFString(\"Adobe\"),\n Ordering : new PDFString(\"Identity\"),\n Supplement : 0\n }),\n FontDescriptor: descriptor,\n FirstChar: firstChar,\n LastChar: lastChar,\n DW: Math.round(self._font.widthOfGlyph(0)),\n W: charWidths,\n CIDToGIDMap: self._pdf.attach(self._makeCidToGidMap())\n });\n\n var dict = self.props;\n dict.BaseFont = _(self._sub.psName);\n dict.DescendantFonts = [ self._pdf.attach(descendant) ];\n\n // Compute the ToUnicode map so that apps can extract\n // meaningful text from the PDF.\n var unimap = new PDFToUnicodeCmap(firstChar, lastChar, sub.subset);\n var unimapStream = new PDFStream(makeOutput(), null, true);\n unimapStream.data(unimap);\n dict.ToUnicode = self._pdf.attach(unimapStream);\n }\n\n _makeCidToGidMap() {\n return new PDFStream(BinaryStream(this._sub.cidToGidMap()), null, true);\n }\n}\n\nclass PDFToUnicodeCmap extends PDFValue {\n constructor(firstChar, lastChar, map){\n super();\n this.firstChar = firstChar;\n this.lastChar = lastChar;\n this.map = map;\n }\n\n render(out) {\n out.indent(\"/CIDInit /ProcSet findresource begin\");\n out.indent(\"12 dict begin\");\n out.indent(\"begincmap\");\n out.indent(\"/CIDSystemInfo <<\");\n out.indent(\" /Registry (Adobe)\");\n out.indent(\" /Ordering (UCS)\");\n out.indent(\" /Supplement 0\");\n out.indent(\">> def\");\n out.indent(\"/CMapName /Adobe-Identity-UCS def\");\n out.indent(\"/CMapType 2 def\");\n out.indent(\"1 begincodespacerange\");\n out.indent(\" <0000>\");\n out.indent(\"endcodespacerange\");\n\n var self = this;\n out.indent(self.lastChar - self.firstChar + 1, \" beginbfchar\");\n out.withIndent(function(){\n for (var code = self.firstChar; code <= self.lastChar; ++code) {\n var unicode = self.map[code];\n var str = ucs2encode([ unicode ]);\n out.indent(\"<\", zeropad(code.toString(16), 4), \">\", \"<\");\n for (var i = 0; i < str.length; ++i) {\n out(zeropad(str.charCodeAt(i).toString(16), 4));\n }\n out(\">\");\n }\n });\n out.indent(\"endbfchar\");\n\n out.indent(\"endcmap\");\n out.indent(\"CMapName currentdict /CMap defineresource pop\");\n out.indent(\"end\");\n out.indent(\"end\");\n }\n}\n\n/// gradients\n\nfunction makeHash(a) {\n return a.map(function(x){\n return isArray(x) ? makeHash(x)\n : typeof x == \"number\" ? (Math.round(x * 1000) / 1000).toFixed(3)\n : x;\n }).join(\" \");\n}\n\nfunction cacheColorGradientFunction(pdf, r1, g1, b1, r2, g2, b2) {\n var hash = makeHash([ r1, g1, b1, r2, g2, b2 ]);\n var func = pdf.GRAD_COL_FUNCTIONS[hash];\n if (!func) {\n func = pdf.GRAD_COL_FUNCTIONS[hash] = pdf.attach(new PDFDictionary({\n FunctionType: 2,\n Domain: [ 0, 1 ],\n Range: [ 0, 1, 0, 1, 0, 1 ],\n N: 1,\n C0: [ r1 , g1 , b1 ],\n C1: [ r2 , g2 , b2 ]\n }));\n }\n return func;\n}\n\nfunction cacheOpacityGradientFunction(pdf, a1, a2) {\n var hash = makeHash([ a1, a2 ]);\n var func = pdf.GRAD_OPC_FUNCTIONS[hash];\n if (!func) {\n func = pdf.GRAD_OPC_FUNCTIONS[hash] = pdf.attach(new PDFDictionary({\n FunctionType: 2,\n Domain: [ 0, 1 ],\n Range: [ 0, 1 ],\n N: 1,\n C0: [ a1 ],\n C1: [ a2 ]\n }));\n }\n return func;\n}\n\nfunction makeGradientFunctions(pdf, stops) {\n var hasAlpha = false;\n var opacities = [];\n var colors = [];\n var offsets = [];\n var encode = [];\n var i, prev, cur, prevColor, curColor;\n for (i = 1; i < stops.length; ++i) {\n prev = stops[i - 1];\n cur = stops[i];\n prevColor = prev.color;\n curColor = cur.color;\n colors.push(cacheColorGradientFunction(\n pdf,\n prevColor.r, prevColor.g, prevColor.b,\n curColor.r, curColor.g, curColor.b\n ));\n if (prevColor.a < 1 || curColor.a < 1) {\n hasAlpha = true;\n }\n offsets.push(cur.offset);\n encode.push(0, 1);\n }\n if (hasAlpha) {\n for (i = 1; i < stops.length; ++i) {\n prev = stops[i - 1];\n cur = stops[i];\n prevColor = prev.color;\n curColor = cur.color;\n opacities.push(cacheOpacityGradientFunction(\n pdf, prevColor.a, curColor.a\n ));\n }\n }\n offsets.pop();\n return {\n hasAlpha : hasAlpha,\n colors : assemble(colors),\n opacities : hasAlpha ? assemble(opacities) : null\n };\n function assemble(funcs) {\n if (funcs.length == 1) {\n return funcs[0];\n }\n return {\n FunctionType: 3,\n Functions: funcs,\n Domain: [ 0, 1 ],\n Bounds: offsets,\n Encode: encode\n };\n }\n}\n\nfunction cacheColorGradient(pdf, isRadial, stops, coords, funcs, box) {\n var shading, hash;\n // if box is given then we have user-space coordinates, which\n // means the gradient is designed for a certain position/size\n // on page. caching won't do any good.\n if (!box) {\n var a = [ isRadial ].concat(coords);\n stops.forEach(function(x){\n a.push(x.offset, x.color.r, x.color.g, x.color.b);\n });\n hash = makeHash(a);\n shading = pdf.GRAD_COL[hash];\n }\n if (!shading) {\n shading = new PDFDictionary({\n Type: _(\"Shading\"),\n ShadingType: isRadial ? 3 : 2,\n ColorSpace: _(\"DeviceRGB\"),\n Coords: coords,\n Domain: [ 0, 1 ],\n Function: funcs,\n Extend: [ true, true ]\n });\n pdf.attach(shading);\n shading._resourceName = \"S\" + (++RESOURCE_COUNTER);\n if (hash) {\n pdf.GRAD_COL[hash] = shading;\n }\n }\n return shading;\n}\n\nfunction cacheOpacityGradient(pdf, isRadial, stops, coords, funcs, box) {\n var opacity, hash;\n // if box is given then we have user-space coordinates, which\n // means the gradient is designed for a certain position/size\n // on page. caching won't do any good.\n if (!box) {\n var a = [ isRadial ].concat(coords);\n stops.forEach(function(x){\n a.push(x.offset, x.color.a);\n });\n hash = makeHash(a);\n opacity = pdf.GRAD_OPC[hash];\n }\n if (!opacity) {\n opacity = new PDFDictionary({\n Type: _(\"ExtGState\"),\n AIS: false,\n CA: 1,\n ca: 1,\n SMask: {\n Type: _(\"Mask\"),\n S: _(\"Luminosity\"),\n G: pdf.attach(new PDFStream(\"/a0 gs /s0 sh\", {\n Type: _(\"XObject\"),\n Subtype: _(\"Form\"),\n FormType: 1,\n BBox: (box ? [\n box.left, box.top + box.height, box.left + box.width, box.top\n ] : [ 0, 1, 1, 0 ]),\n Group: {\n Type: _(\"Group\"),\n S: _(\"Transparency\"),\n CS: _(\"DeviceGray\"),\n I: true\n },\n Resources: {\n ExtGState: {\n a0: { CA: 1, ca: 1 }\n },\n Shading: {\n s0: {\n ColorSpace: _(\"DeviceGray\"),\n Coords: coords,\n Domain: [ 0, 1 ],\n ShadingType: isRadial ? 3 : 2,\n Function: funcs,\n Extend: [ true, true ]\n }\n }\n }\n }))\n }\n });\n pdf.attach(opacity);\n opacity._resourceName = \"O\" + (++RESOURCE_COUNTER);\n if (hash) {\n pdf.GRAD_OPC[hash] = opacity;\n }\n }\n return opacity;\n}\n\nfunction cacheGradient(pdf, gradient, box) {\n var isRadial = gradient.type == \"radial\";\n var funcs = makeGradientFunctions(pdf, gradient.stops);\n var coords = isRadial ? [\n gradient.start.x , gradient.start.y , gradient.start.r,\n gradient.end.x , gradient.end.y , gradient.end.r\n ] : [\n gradient.start.x , gradient.start.y,\n gradient.end.x , gradient.end.y\n ];\n var shading = cacheColorGradient(\n pdf, isRadial, gradient.stops, coords, funcs.colors, gradient.userSpace && box\n );\n var opacity = funcs.hasAlpha ? cacheOpacityGradient(\n pdf, isRadial, gradient.stops, coords, funcs.opacities, gradient.userSpace && box\n ) : null;\n return {\n hasAlpha: funcs.hasAlpha,\n shading: shading,\n opacity: opacity\n };\n}\n\n/// page object\n\nclass PDFPage extends PDFDictionary {\n constructor(pdf, props){\n super(props);\n\n this._pdf = pdf;\n this._rcount = 0;\n this._textMode = false;\n this._fontResources = {};\n this._gsResources = {};\n this._xResources = {};\n this._patResources = {};\n this._shResources = {};\n this._opacity = 1;\n this._matrix = [ 1, 0, 0, 1, 0, 0 ];\n this._annotations = [];\n\n this._font = null;\n this._fontSize = null;\n\n this._contextStack = [];\n\n props = this.props;\n props.Type = _(\"Page\");\n props.ProcSet = [\n _(\"PDF\"),\n _(\"Text\"),\n _(\"ImageB\"),\n _(\"ImageC\"),\n _(\"ImageI\")\n ];\n props.Resources = new PDFDictionary({\n Font : new PDFDictionary(this._fontResources),\n ExtGState : new PDFDictionary(this._gsResources),\n XObject : new PDFDictionary(this._xResources),\n Pattern : new PDFDictionary(this._patResources),\n Shading : new PDFDictionary(this._shResources)\n });\n props.Annots = this._annotations;\n }\n\n _out() {\n this._content.data.apply(null, arguments);\n }\n\n transform(a, b, c, d, e, f) {\n if (!isIdentityMatrix(arguments)) {\n this._matrix = mmul(arguments, this._matrix);\n this._out(a, \" \", b, \" \", c, \" \", d, \" \", e, \" \", f, \" cm\");\n // XXX: debug\n // this._out(\" % current matrix: \", this._matrix);\n this._out(NL);\n }\n }\n\n translate(dx, dy) {\n this.transform(1, 0, 0, 1, dx, dy);\n }\n\n scale(sx, sy) {\n this.transform(sx, 0, 0, sy, 0, 0);\n }\n\n rotate(angle) {\n var cos = Math.cos(angle), sin = Math.sin(angle);\n this.transform(cos, sin, -sin, cos, 0, 0);\n }\n\n beginText() {\n this._textMode = true;\n this._out(\"BT\", NL);\n }\n\n endText() {\n this._textMode = false;\n this._out(\"ET\", NL);\n }\n\n _requireTextMode() {\n if (!this._textMode) {\n throw new Error(\"Text mode required; call page.beginText() first\");\n }\n }\n\n _requireFont() {\n if (!this._font) {\n throw new Error(\"No font selected; call page.setFont() first\");\n }\n }\n\n setFont(font, size) {\n this._requireTextMode();\n if (font == null) {\n font = this._font;\n } else if (!(font instanceof PDFFont)) {\n font = this._pdf.getFont(font);\n }\n if (size == null) {\n size = this._fontSize;\n }\n this._fontResources[font._resourceName] = font;\n this._font = font;\n this._fontSize = size;\n this._out(font._resourceName, \" \", size, \" Tf\", NL);\n }\n\n setTextLeading(size) {\n this._requireTextMode();\n this._out(size, \" TL\", NL);\n }\n\n setTextRenderingMode(mode) {\n this._requireTextMode();\n this._out(mode, \" Tr\", NL);\n }\n\n showText(text, requestedWidth) {\n this._requireFont();\n if (text.length > 1 && requestedWidth && this._font instanceof PDFFont) {\n var outputWidth = this._font.getTextWidth(this._fontSize, text);\n var scale = requestedWidth / outputWidth * 100;\n this._out(scale, \" Tz \");\n }\n this._out(this._font.encodeText(text), \" Tj\", NL);\n }\n\n showTextNL(text) {\n this._requireFont();\n this._out(this._font.encodeText(text), \" '\", NL);\n }\n\n addLink(uri, box) {\n var ll = this._toPage({ x: box.left, y: box.bottom });\n var ur = this._toPage({ x: box.right, y: box.top });\n this._annotations.push(new PDFDictionary({\n Type : _(\"Annot\"),\n Subtype : _(\"Link\"),\n Rect : [ ll.x, ll.y, ur.x, ur.y ],\n Border : [ 0, 0, 0 ],\n A : new PDFDictionary({\n Type : _(\"Action\"),\n S : _(\"URI\"),\n URI : new PDFString(uri)\n })\n }));\n }\n\n setStrokeColor(r, g, b) {\n this._out(r, \" \", g, \" \", b, \" RG\", NL);\n }\n\n setOpacity(opacity) {\n this.setFillOpacity(opacity);\n this.setStrokeOpacity(opacity);\n this._opacity *= opacity;\n }\n\n setStrokeOpacity(opacity) {\n if (opacity < 1) {\n var gs = this._pdf.getOpacityGS(this._opacity * opacity, true);\n this._gsResources[gs._resourceName] = gs;\n this._out(gs._resourceName, \" gs\", NL);\n }\n }\n\n setFillColor(r, g, b) {\n this._out(r, \" \", g, \" \", b, \" rg\", NL);\n }\n\n setFillOpacity(opacity) {\n if (opacity < 1) {\n var gs = this._pdf.getOpacityGS(this._opacity * opacity, false);\n this._gsResources[gs._resourceName] = gs;\n this._out(gs._resourceName, \" gs\", NL);\n }\n }\n\n gradient(gradient, box) {\n this.save();\n this.rect(box.left, box.top, box.width, box.height);\n this.clip();\n if (!gradient.userSpace) {\n this.transform(box.width, 0, 0, box.height, box.left, box.top);\n }\n var g = cacheGradient(this._pdf, gradient, box);\n var sname = g.shading._resourceName, oname;\n this._shResources[sname] = g.shading;\n if (g.hasAlpha) {\n oname = g.opacity._resourceName;\n this._gsResources[oname] = g.opacity;\n this._out(\"/\" + oname + \" gs \");\n }\n this._out(\"/\" + sname + \" sh\", NL);\n this.restore();\n }\n\n setDashPattern(dashArray, dashPhase) {\n this._out(dashArray, \" \", dashPhase, \" d\", NL);\n }\n\n setLineWidth(width) {\n this._out(width, \" w\", NL);\n }\n\n setLineCap(lineCap) {\n this._out(lineCap, \" J\", NL);\n }\n\n setLineJoin(lineJoin) {\n this._out(lineJoin, \" j\", NL);\n }\n\n setMitterLimit(mitterLimit) {\n this._out(mitterLimit, \" M\", NL);\n }\n\n save() {\n this._contextStack.push(this._context());\n this._out(\"q\", NL);\n }\n\n restore() {\n this._out(\"Q\", NL);\n this._context(this._contextStack.pop());\n }\n\n\n // paths\n moveTo(x, y) {\n this._out(x, \" \", y, \" m\", NL);\n }\n\n lineTo(x, y) {\n this._out(x, \" \", y, \" l\", NL);\n }\n\n bezier(x1, y1, x2, y2, x3, y3) {\n this._out(x1, \" \", y1, \" \", x2, \" \", y2, \" \", x3, \" \", y3, \" c\", NL);\n }\n\n bezier1(x1, y1, x3, y3) {\n this._out(x1, \" \", y1, \" \", x3, \" \", y3, \" y\", NL);\n }\n\n bezier2(x2, y2, x3, y3) {\n this._out(x2, \" \", y2, \" \", x3, \" \", y3, \" v\", NL);\n }\n\n close() {\n this._out(\"h\", NL);\n }\n\n rect(x, y, w, h) {\n this._out(x, \" \", y, \" \", w, \" \", h, \" re\", NL);\n }\n\n ellipse(x, y, rx, ry) {\n function _X(v) { return x + v; }\n function _Y(v) { return y + v; }\n\n // how to get to the \"magic number\" is explained here:\n // http://www.whizkidtech.redprince.net/bezier/circle/kappa/\n var k = 0.5522847498307936;\n\n this.moveTo(_X(0), _Y(ry));\n this.bezier(\n _X(rx * k) , _Y(ry),\n _X(rx) , _Y(ry * k),\n _X(rx) , _Y(0)\n );\n this.bezier(\n _X(rx) , _Y(-ry * k),\n _X(rx * k) , _Y(-ry),\n _X(0) , _Y(-ry)\n );\n this.bezier(\n _X(-rx * k) , _Y(-ry),\n _X(-rx) , _Y(-ry * k),\n _X(-rx) , _Y(0)\n );\n this.bezier(\n _X(-rx) , _Y(ry * k),\n _X(-rx * k) , _Y(ry),\n _X(0) , _Y(ry)\n );\n }\n\n circle(x, y, r) {\n this.ellipse(x, y, r, r);\n }\n\n stroke() {\n this._out(\"S\", NL);\n }\n\n nop() {\n this._out(\"n\", NL);\n }\n\n clip() {\n this._out(\"W n\", NL);\n }\n\n clipStroke() {\n this._out(\"W S\", NL);\n }\n\n closeStroke() {\n this._out(\"s\", NL);\n }\n\n fill() {\n this._out(\"f\", NL);\n }\n\n fillStroke() {\n this._out(\"B\", NL);\n }\n\n drawImage(url) {\n var img = this._pdf.getImage(url);\n if (img) { // the result can be null for a cross-domain image\n this._xResources[img._resourceName] = img;\n this._out(img._resourceName, \" Do\", NL);\n }\n }\n\n comment(txt) {\n var self = this;\n txt.split(/\\r?\\n/g).forEach(function(line){\n self._out(\"% \", line, NL);\n });\n }\n\n // internal\n _context(val) {\n if (val != null) {\n this._opacity = val.opacity;\n this._matrix = val.matrix;\n } else {\n return {\n opacity: this._opacity,\n matrix: this._matrix\n };\n }\n }\n\n _toPage(p) {\n var m = this._matrix;\n var a = m[0], b = m[1], c = m[2], d = m[3], e = m[4], f = m[5];\n return {\n x: a*p.x + c*p.y + e,\n y: b*p.x + d*p.y + f\n };\n }\n}\n\nfunction unquote(str) {\n return str.replace(/^\\s*(['\"])(.*)\\1\\s*$/, \"$2\");\n}\n\nfunction parseFontDef(fontdef) {\n // XXX: this is very crude for now and buggy. Proper parsing is quite involved.\n var rx = /^\\s*((normal|italic)\\s+)?((normal|small-caps)\\s+)?((normal|bold|\\d+)\\s+)?(([0-9.]+)(px|pt))(\\/(([0-9.]+)(px|pt)|normal))?\\s+(.*?)\\s*$/i;\n var m = rx.exec(fontdef);\n if (!m) {\n return { fontSize: 12, fontFamily: \"sans-serif\" };\n }\n var fontSize = m[8] ? parseInt(m[8], 10) : 12;\n return {\n italic : m[2] && m[2].toLowerCase() == \"italic\",\n variant : m[4],\n bold : m[6] && /bold|700/i.test(m[6]),\n fontSize : fontSize,\n lineHeight : m[12] ? m[12] == \"normal\" ? fontSize : parseInt(m[12], 10) : null,\n fontFamily : m[14].split(/\\s*,\\s*/g).map(unquote)\n };\n}\n\nfunction getFontURL(style) {\n function mkFamily(name) {\n if (style.bold) {\n name += \"|bold\";\n }\n if (style.italic) {\n name += \"|italic\";\n }\n return name.toLowerCase();\n }\n var fontFamily = style.fontFamily;\n var name, url;\n if (fontFamily instanceof Array) {\n for (var i = 0; i < fontFamily.length; ++i) {\n name = mkFamily(fontFamily[i]);\n url = FONT_MAPPINGS[name];\n if (url) {\n break;\n }\n }\n } else {\n url = FONT_MAPPINGS[fontFamily.toLowerCase()];\n }\n while (typeof url == \"function\") {\n url = url();\n }\n if (!url) {\n url = \"Times-Roman\";\n }\n return url;\n}\n\nvar FONT_MAPPINGS = {\n \"serif\" : \"Times-Roman\",\n \"serif|bold\" : \"Times-Bold\",\n \"serif|italic\" : \"Times-Italic\",\n \"serif|bold|italic\" : \"Times-BoldItalic\",\n \"sans-serif\" : \"Helvetica\",\n \"sans-serif|bold\" : \"Helvetica-Bold\",\n \"sans-serif|italic\" : \"Helvetica-Oblique\",\n \"sans-serif|bold|italic\" : \"Helvetica-BoldOblique\",\n \"monospace\" : \"Courier\",\n \"monospace|bold\" : \"Courier-Bold\",\n \"monospace|italic\" : \"Courier-Oblique\",\n \"monospace|bold|italic\" : \"Courier-BoldOblique\",\n \"zapfdingbats\" : \"ZapfDingbats\",\n \"zapfdingbats|bold\" : \"ZapfDingbats\",\n \"zapfdingbats|italic\" : \"ZapfDingbats\",\n \"zapfdingbats|bold|italic\" : \"ZapfDingbats\"\n};\n\nfunction fontAlias(alias, name) {\n alias = alias.toLowerCase();\n FONT_MAPPINGS[alias] = function() {\n return FONT_MAPPINGS[name];\n };\n FONT_MAPPINGS[alias + \"|bold\"] = function() {\n return FONT_MAPPINGS[name + \"|bold\"];\n };\n FONT_MAPPINGS[alias + \"|italic\"] = function() {\n return FONT_MAPPINGS[name + \"|italic\"];\n };\n FONT_MAPPINGS[alias + \"|bold|italic\"] = function() {\n return FONT_MAPPINGS[name + \"|bold|italic\"];\n };\n}\n\n// Let's define some common names to an appropriate replacement.\n// These are overridable via pdf.defineFont, should the user want to\n// include the proper versions.\n\nfontAlias(\"Times New Roman\" , \"serif\");\nfontAlias(\"Courier New\" , \"monospace\");\nfontAlias(\"Arial\" , \"sans-serif\");\nfontAlias(\"Helvetica\" , \"sans-serif\");\nfontAlias(\"Verdana\" , \"sans-serif\");\nfontAlias(\"Tahoma\" , \"sans-serif\");\nfontAlias(\"Georgia\" , \"sans-serif\");\nfontAlias(\"Monaco\" , \"monospace\");\nfontAlias(\"Andale Mono\" , \"monospace\");\n\nfunction defineFont(name, url) {\n if (arguments.length == 1) {\n for (var i in name) {\n if (hasOwnProperty(name, i)) {\n defineFont(i, name[i]);\n }\n }\n } else {\n name = name.toLowerCase();\n FONT_MAPPINGS[name] = url;\n\n // special handling for DejaVu fonts: if they get defined,\n // let them also replace the default families, for good\n // Unicode support out of the box.\n switch (name) {\n case \"dejavu sans\" : FONT_MAPPINGS[\"sans-serif\"] = url; break;\n case \"dejavu sans|bold\" : FONT_MAPPINGS[\"sans-serif|bold\"] = url; break;\n case \"dejavu sans|italic\" : FONT_MAPPINGS[\"sans-serif|italic\"] = url; break;\n case \"dejavu sans|bold|italic\" : FONT_MAPPINGS[\"sans-serif|bold|italic\"] = url; break;\n case \"dejavu serif\" : FONT_MAPPINGS[\"serif\"] = url; break;\n case \"dejavu serif|bold\" : FONT_MAPPINGS[\"serif|bold\"] = url; break;\n case \"dejavu serif|italic\" : FONT_MAPPINGS[\"serif|italic\"] = url; break;\n case \"dejavu serif|bold|italic\" : FONT_MAPPINGS[\"serif|bold|italic\"] = url; break;\n case \"dejavu mono\" : FONT_MAPPINGS[\"monospace\"] = url; break;\n case \"dejavu mono|bold\" : FONT_MAPPINGS[\"monospace|bold\"] = url; break;\n case \"dejavu mono|italic\" : FONT_MAPPINGS[\"monospace|italic\"] = url; break;\n case \"dejavu mono|bold|italic\" : FONT_MAPPINGS[\"monospace|bold|italic\"] = url; break;\n }\n }\n}\n\nfunction mmul(a, b) {\n var a1 = a[0], b1 = a[1], c1 = a[2], d1 = a[3], e1 = a[4], f1 = a[5];\n var a2 = b[0], b2 = b[1], c2 = b[2], d2 = b[3], e2 = b[4], f2 = b[5];\n return [\n a1*a2 + b1*c2, a1*b2 + b1*d2,\n c1*a2 + d1*c2, c1*b2 + d1*d2,\n e1*a2 + f1*c2 + e2, e1*b2 + f1*d2 + f2\n ];\n}\n\nfunction isIdentityMatrix(m) {\n return m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1 && m[4] === 0 && m[5] === 0;\n}\n\nconst TEXT_RENDERING_MODE = {\n fill : 0,\n stroke : 1,\n fillAndStroke : 2,\n invisible : 3,\n fillAndClip : 4,\n strokeAndClip : 5,\n fillStrokeClip : 6,\n clip : 7\n};\n\nexport {\n PDFDocument as Document,\n BinaryStream,\n defineFont,\n parseFontDef,\n getFontURL,\n loadFonts,\n loadImages,\n getPaperOptions,\n clearImageCache,\n TEXT_RENDERING_MODE\n};\n","/* eslint-disable no-multi-spaces, key-spacing, indent, camelcase, space-before-blocks, eqeqeq, brace-style */\n/* eslint-disable space-infix-ops, space-before-function-paren, array-bracket-spacing, object-curly-spacing */\n/* eslint-disable no-nested-ternary, max-params, default-case, no-else-return, no-empty, yoda */\n/* eslint-disable no-param-reassign, no-var, block-scoped-var */\n\nimport * as geo from \"../geometry\";\nimport * as PDF from \"../pdf\";\nimport { arabicToRoman, createPromise, measureText, mergeSort } from '../util';\nimport { parseColor as utils_parseColor, support, template as compileTemplate } from \"../common\";\nimport { Path, Text, Group, Image, Circle, LinearGradient } from \"../drawing\";\nimport { encodeBase64 } from \"../util\";\n\nconst browser = support.browser || {};\n/*\n\n XXX: to test:\n\n - cloneNodes function:\n - drawing document containing canvas with page breaking\n - drawing document with named radio -s (should not clear selection)\n - IE9/IE10 don't support el.dataset; do they copy user data?\n\n - repeating table headers/footers on page breaking\n\n - forceBreak, keepTogether\n\n - avoidLinks\n\n */\n\n/* -----[ local vars ]----- */\n\nfunction slice(thing) {\n return Array.prototype.slice.call(thing);\n}\n\nvar KENDO_PSEUDO_ELEMENT = \"KENDO-PSEUDO-ELEMENT\";\n\nvar IMAGE_CACHE = {};\n\nvar nodeInfo = {};\nnodeInfo._root = nodeInfo;\n\n/* -----[ Custom Text node to speed up rendering in PDF ]----- */\n\nconst inBrowser = typeof window !== 'undefined';\nconst microsoft = inBrowser ? browser.msie || browser.edge : false;\n\nclass TextRect extends Text {\n constructor(str, rect, options) {\n super(str, rect.getOrigin(), options);\n this._pdfRect = rect;\n }\n rect() {\n // this is the crux of it: we can avoid a call to\n // measure(), which is what the base class does, since we\n // already know the rect. measure() is s-l-o-w.\n return this._pdfRect;\n }\n rawBBox() {\n // also let's avoid creating a new rectangle.\n return this._pdfRect;\n }\n}\n\nfunction addClass(el, cls) {\n if (el.classList) {\n el.classList.add(cls);\n } else {\n el.className += \" \" + cls;\n }\n}\n\nfunction removeClass(el, cls) {\n if (el.classList) {\n el.classList.remove(cls);\n } else {\n el.className = el.className.split(/\\s+/).reduce(function(a, word){\n if (word != cls) {\n a.push(word);\n }\n return a;\n }, []).join(\" \");\n }\n}\n\nfunction setCSS(el, styles) {\n Object.keys(styles).forEach(function(key){\n el.style[key] = styles[key];\n });\n}\n\nvar matches = typeof Element !== \"undefined\" && Element.prototype && (function(p){\n if (p.matches) {\n return function(el, selector) { return el.matches(selector); };\n }\n if (p.webkitMatchesSelector) {\n return function(el, selector) { return el.webkitMatchesSelector(selector); };\n }\n if (p.mozMatchesSelector) {\n return function(el, selector) { return el.mozMatchesSelector(selector); };\n }\n if (p.msMatchesSelector) {\n return function(el, selector) { return el.msMatchesSelector(selector); };\n }\n return function(s) {\n\treturn [].indexOf.call(document.querySelectorAll(s), this) !== -1;\n };\n})(Element.prototype);\n\nfunction closest(el, selector) {\n if (el.closest) {\n return el.closest(selector);\n }\n // IE: stringifying rather than simply comparing with `document`,\n // which is not iframe-proof and fails in editor export —\n // https://github.com/telerik/kendo/issues/6721\n while (el && !/^\\[object (?:HTML)?Document\\]$/.test(String(el))) {\n if (el.nodeType == 1 /* Element */ && matches(el, selector)) {\n return el;\n }\n el = el.parentNode;\n }\n}\n\n// clone nodes ourselves, so that we redraw (DOM or\n// jQuery clone will not)\nvar cloneNodes = (function($){\n if ($) {\n // if we have Kendo and jQuery, use this version as it will\n // maintain proper links between cloned element and Kendo\n // widgets (i.e. it clones jQuery data(), which isn't the same\n // as element's data attributes).\n // https://github.com/telerik/kendo-ui-core/issues/2750\n return function cloneNodes(el) {\n var clone = el.cloneNode(false);\n if (el.nodeType == 1 /* Element */) {\n var $el = $(el), $clone = $(clone), i;\n var data = $el.data();\n for (i in data) {\n $clone.data(i, data[i]);\n }\n if (/^canvas$/i.test(el.tagName)) {\n clone.getContext(\"2d\").drawImage(el, 0, 0);\n } else if (/^(?:input|select|textarea|option)$/i.test(el.tagName)) {\n // drop the name attributes so that we don't affect the selection of the\n // original nodes (i.e. checked status of radio buttons) when we insert our copy\n // into the DOM. https://github.com/telerik/kendo/issues/5409\n clone.removeAttribute(\"id\");\n clone.removeAttribute(\"name\");\n if (!/^textarea$/i.test(el.tagName)) {\n clone.value = el.value;\n }\n clone.checked = el.checked;\n clone.selected = el.selected;\n }\n for (i = el.firstChild; i; i = i.nextSibling) {\n clone.appendChild(cloneNodes(i));\n }\n }\n return clone;\n };\n } else {\n // the no-jQuery version\n return function cloneNodes(el) {\n const clone = (function dive(node){\n const clone = node.cloneNode(false);\n if (node._kendoExportVisual) {\n clone._kendoExportVisual = node._kendoExportVisual;\n }\n for (let i = node.firstChild; i; i = i.nextSibling) {\n clone.appendChild(dive(i));\n }\n return clone;\n })(el);\n\n // re-draw canvases - https://github.com/telerik/kendo/issues/4872\n const canvases = el.querySelectorAll(\"canvas\");\n if (canvases.length) {\n slice(clone.querySelectorAll(\"canvas\")).forEach((canvas, i) => {\n canvas.getContext(\"2d\").drawImage(canvases[i], 0, 0);\n });\n }\n\n // remove \"name\" attributes from elements -\n // https://github.com/telerik/kendo/issues/5409\n const orig = el.querySelectorAll(\"input, select, textarea, option\");\n slice(clone.querySelectorAll(\"input, select, textarea, option\")).forEach((el, i) => {\n el.removeAttribute(\"id\");\n el.removeAttribute(\"name\");\n if (!/^textarea$/i.test(el.tagName)) {\n el.value = orig[i].value;\n }\n el.checked = orig[i].checked;\n el.selected = orig[i].selected;\n });\n\n return clone;\n };\n }\n})(typeof window !== \"undefined\" && window.kendo && window.kendo.jQuery);\n\nfunction getXY(thing) {\n if (typeof thing == \"number\") {\n return { x: thing, y: thing };\n }\n if (Array.isArray(thing)) {\n return { x: thing[0], y: thing[1] };\n }\n return { x: thing.x, y: thing.y };\n}\n\nfunction drawDOM(element, options) {\n if (!options) {\n options = {};\n }\n var promise = createPromise();\n\n if (!element) {\n return promise.reject(\"No element to export\");\n }\n\n if (typeof window.getComputedStyle != \"function\") {\n throw new Error(\"window.getComputedStyle is missing. You are using an unsupported browser, or running in IE8 compatibility mode. Drawing HTML is supported in Chrome, Firefox, Safari and IE9+.\");\n }\n\n PDF.defineFont(getFontFaces(element.ownerDocument));\n\n var scale = getXY(options.scale || 1);\n\n function doOne(element) {\n var group = new Group();\n\n // translate to start of page\n var pos = element.getBoundingClientRect();\n setTransform(group, [\n scale.x,\n 0,\n 0,\n scale.y,\n (-pos.left * scale.x),\n (-pos.top * scale.y)\n ]);\n\n nodeInfo._clipbox = false;\n nodeInfo._matrix = geo.Matrix.unit();\n nodeInfo._stackingContext = {\n element: element,\n group: group\n };\n\n if (options.avoidLinks === true) {\n nodeInfo._avoidLinks = \"a\";\n } else {\n nodeInfo._avoidLinks = options.avoidLinks;\n }\n\n addClass(element, \"k-pdf-export\");\n renderElement(element, group);\n removeClass(element, \"k-pdf-export\");\n\n return group;\n }\n\n cacheImages([ element ], function(){\n var forceBreak = options && options.forcePageBreak;\n var hasPaperSize = options && options.paperSize && options.paperSize != \"auto\";\n var paperOptions = PDF.getPaperOptions(function(key, def){\n if (key == \"paperSize\") {\n // PDF.getPaperOptions croaks on \"auto\", just pass dummy A4 as we might\n // still be interested in margins.\n return hasPaperSize ? options[key] : \"A4\";\n }\n return key in options ? options[key] : def;\n });\n var pageWidth = hasPaperSize && paperOptions.paperSize[0];\n var pageHeight = hasPaperSize && paperOptions.paperSize[1];\n var margin = options.margin && paperOptions.margin;\n var hasMargin = Boolean(margin);\n if (forceBreak || pageHeight) {\n if (!margin) {\n margin = { left: 0, top: 0, right: 0, bottom: 0 };\n }\n\n // we want paper size and margin to be unaffected by\n // scaling in the output, so we have to reverse-scale\n // before our calculations begin.\n if (pageWidth) { pageWidth /= scale.x; }\n if (pageHeight) { pageHeight /= scale.y; }\n margin.left /= scale.x;\n margin.right /= scale.x;\n margin.top /= scale.y;\n margin.bottom /= scale.y;\n\n var group = new Group({\n pdf: {\n multiPage : true,\n paperSize : hasPaperSize ? paperOptions.paperSize : \"auto\",\n _ignoreMargin : hasMargin // HACK! see exportPDF in pdf/drawing.js\n }\n });\n handlePageBreaks(\n function(x) {\n if (options.progress) {\n var canceled = false, pageNum = 0;\n (function next(){\n if (pageNum < x.pages.length) {\n var page = doOne(x.pages[pageNum]);\n group.append(page);\n options.progress({\n page: page,\n pageNum: ++pageNum,\n totalPages: x.pages.length,\n cancel: function() {\n canceled = true;\n }\n });\n if (!canceled) {\n setTimeout(next);\n } else {\n // XXX: should we also fail() the deferred object?\n x.container.parentNode.removeChild(x.container);\n }\n } else {\n x.container.parentNode.removeChild(x.container);\n promise.resolve(group);\n }\n })();\n } else {\n x.pages.forEach(function(page){\n group.append(doOne(page));\n });\n x.container.parentNode.removeChild(x.container);\n promise.resolve(group);\n }\n },\n element,\n forceBreak,\n pageWidth ? pageWidth - margin.left - margin.right : null,\n pageHeight ? pageHeight - margin.top - margin.bottom : null,\n margin,\n options\n );\n } else {\n promise.resolve(doOne(element));\n }\n });\n\n function makeTemplate(template) {\n if (template != null) {\n if (typeof template == \"string\") {\n template = compileTemplate(template.replace(/^\\s+|\\s+$/g, \"\"));\n }\n if (typeof template == \"function\") {\n return function(data) {\n var el = template(data);\n if (el && typeof el == \"string\") {\n var div = document.createElement(\"div\");\n div.innerHTML = el;\n el = div.firstElementChild;\n }\n return el;\n };\n }\n // assumed DOM element\n return function() {\n return template.cloneNode(true);\n };\n }\n }\n\n function handlePageBreaks(callback, element, forceBreak, pageWidth, pageHeight, margin, options) {\n var template = makeTemplate(options.template);\n var doc = element.ownerDocument;\n var pages = [];\n var copy = options._destructive ? element : cloneNodes(element);\n var container = doc.createElement(\"KENDO-PDF-DOCUMENT\");\n var adjust = 0;\n\n // make sure elements are at the end (Grid widget\n // places TFOOT before TBODY, tricking our algorithm to\n // insert a page break right after the header).\n // https://github.com/telerik/kendo/issues/4699\n slice(copy.querySelectorAll(\"tfoot\")).forEach(function(tfoot){\n tfoot.parentNode.appendChild(tfoot);\n });\n\n // remember the index of each LI from an ordered list.\n // we'll use it to reconstruct the proper numbering.\n slice(copy.querySelectorAll(\"ol\")).forEach(function(ol){\n slice(ol.children).forEach(function(li, index){\n li.setAttribute(\"kendo-split-index\", index);\n });\n });\n\n setCSS(container, {\n display : \"block\",\n position : \"absolute\",\n boxSizing : \"content-box\",\n left : \"-10000px\",\n top : \"-10000px\"\n });\n\n if (pageWidth) {\n // subtle: if we don't set the width *and* margins here, the layout in this\n // container will be different from the one in our final page elements, and we'll\n // split at the wrong places.\n setCSS(container, {\n width : pageWidth + \"px\",\n paddingLeft : margin.left + \"px\",\n paddingRight : margin.right + \"px\"\n });\n\n // when the first element has a margin-top (i.e. a

) the page will be\n // inadvertently enlarged by that number (the browser will report the container's\n // bounding box top to start at the element's top, rather than including its\n // margin). Adding overflow: hidden seems to fix it.\n //\n // to understand the difference, try the following snippets in your browser:\n //\n // 1.
\n //

Foo

\n //
\n //\n // 2.
\n //

Foo

\n //
\n //\n // this detail is not important when automatic page breaking is not requested, hence\n // doing it only if pageWidth is defined.\n setCSS(copy, { overflow: \"hidden\" });\n }\n\n element.parentNode.insertBefore(container, element);\n container.appendChild(copy);\n\n // With cache disabled, images will still have height zero until their `complete` attribute\n // is true. `whenImagesAreActuallyLoaded` will wait for it.\n if (options.beforePageBreak) {\n whenImagesAreActuallyLoaded([ container ], function() {\n options.beforePageBreak(container, doPageBreak);\n });\n } else {\n whenImagesAreActuallyLoaded([ container ], doPageBreak);\n }\n\n function doPageBreak() {\n if (forceBreak != \"-\" || pageHeight) {\n splitElement(copy);\n }\n\n {\n let page = makePage();\n copy.parentNode.insertBefore(page, copy);\n page.appendChild(copy);\n }\n\n if (template) {\n pages.forEach(function(page, i){\n const el = template({\n element : page,\n pageNum : i + 1,\n totalPages : pages.length\n });\n if (el) {\n page.appendChild(el);\n }\n });\n }\n\n cacheImages(pages, callback.bind(null, { pages: pages, container: container }));\n }\n\n function keepTogether(el) {\n if (options.keepTogether && matches(el, options.keepTogether) && el.offsetHeight <= pageHeight - adjust) {\n return true;\n }\n\n var tag = el.tagName;\n if (/^h[1-6]$/i.test(tag) && el.offsetHeight >= pageHeight - adjust) {\n return false;\n }\n\n return (el.getAttribute(\"data-kendo-chart\") ||\n /^(?:img|tr|thead|th|tfoot|iframe|svg|object|canvas|input|textarea|select|video|h[1-6])/i.test(el.tagName));\n }\n\n function splitElement(element) {\n if (element.tagName == \"TABLE\") {\n setCSS(element, { tableLayout: \"fixed\" });\n }\n if (keepTogether(element)) {\n return;\n }\n var style = getComputedStyle(element);\n var bottomPadding = parseFloat(getPropertyValue(style, \"padding-bottom\"));\n var bottomBorder = parseFloat(getPropertyValue(style, \"border-bottom-width\"));\n var saveAdjust = adjust;\n adjust += bottomPadding + bottomBorder;\n var isFirst = true;\n for (var el = element.firstChild; el; el = el.nextSibling) {\n if (el.nodeType == 1 /* Element */) {\n isFirst = false;\n if (matches(el, forceBreak)) {\n breakAtElement(el);\n continue;\n }\n if (!pageHeight) {\n // we're in \"manual breaks mode\"\n splitElement(el);\n continue;\n }\n if (!/^(?:static|relative)$/.test(getPropertyValue(getComputedStyle(el), \"position\"))) {\n continue;\n }\n var fall = fallsOnMargin(el);\n if (fall == 1) {\n // element starts on next page, break before anyway.\n breakAtElement(el);\n }\n else if (fall) {\n // elements ends up on next page, or possibly doesn't fit on a page at\n // all. break before it anyway if it's an or , otherwise\n // attempt to split.\n if (keepTogether(el)) {\n breakAtElement(el);\n } else {\n splitElement(el);\n }\n }\n else {\n splitElement(el);\n }\n }\n else if (el.nodeType == 3 /* Text */ && pageHeight) {\n splitText(el, isFirst);\n isFirst = false;\n }\n }\n adjust = saveAdjust;\n }\n\n function firstInParent(el) {\n var p = el.parentNode, first = p.firstChild;\n if (el === first) {\n return true;\n }\n if (el === p.children[0]) {\n if (first.nodeType == 7 /* comment */ ||\n first.nodeType == 8 /* processing instruction */) {\n return true;\n }\n if (first.nodeType == 3 /* text */) {\n // if whitespace only we can probably consider it's first\n return !/\\S/.test(first.data);\n }\n }\n return false;\n }\n\n function breakAtElement(el) {\n if (el.nodeType == 1 && el !== copy && firstInParent(el)) {\n return breakAtElement(el.parentNode);\n }\n var table, colgroup, thead, grid, gridHead;\n table = closest(el, \"table\");\n colgroup = table && table.querySelector(\"colgroup\");\n if (options.repeatHeaders) {\n thead = table && table.querySelector(\"thead\");\n\n // If we break page in a Kendo Grid, repeat its header. This ugly hack is\n // necessary because a scrollable grid will keep the header in a separate\n // element from its content.\n //\n // XXX: This is likely to break as soon as the widget HTML is modified.\n grid = closest(el, \".k-grid.k-widget\");\n if (grid && grid.querySelector(\".k-auto-scrollable\")) {\n gridHead = grid.querySelector(\".k-grid-header\");\n }\n }\n var page = makePage();\n var range = doc.createRange();\n range.setStartBefore(copy);\n range.setEndBefore(el);\n page.appendChild(range.extractContents());\n copy.parentNode.insertBefore(page, copy);\n preventBulletOnListItem(el.parentNode);\n if (table) {\n table = closest(el, \"table\"); // that's the
on next page!\n if (options.repeatHeaders && thead) {\n table.insertBefore(thead.cloneNode(true), table.firstChild);\n }\n if (colgroup) {\n table.insertBefore(colgroup.cloneNode(true), table.firstChild);\n }\n }\n if (options.repeatHeaders && gridHead) {\n grid = closest(el, \".k-grid.k-widget\");\n grid.insertBefore(gridHead.cloneNode(true), grid.firstChild);\n }\n }\n\n function makePage() {\n var page = doc.createElement(\"KENDO-PDF-PAGE\");\n setCSS(page, {\n display : \"block\",\n boxSizing: \"content-box\",\n width : pageWidth ? (pageWidth + \"px\") : \"auto\",\n padding : (margin.top + \"px \" +\n margin.right + \"px \" +\n margin.bottom + \"px \" +\n margin.left + \"px\"),\n\n // allow absolutely positioned elements to be relative to current page\n position : \"relative\",\n\n // without the following we might affect layout of subsequent pages\n height : pageHeight ? (pageHeight + \"px\") : \"auto\",\n overflow : pageHeight || pageWidth ? \"hidden\" : \"visible\",\n clear : \"both\"\n });\n\n // debug\n // $(\"
\").css({\n // position : \"absolute\",\n // left : margin.left,\n // top : margin.top,\n // width : pageWidth,\n // height : pageHeight,\n // boxSizing : \"border-box\",\n // background: \"rgba(255, 255, 0, 0.5)\"\n // //border : \"1px solid red\"\n // }).appendTo(page);\n\n if (options && options.pageClassName) {\n page.className = options.pageClassName;\n }\n pages.push(page);\n return page;\n }\n\n function fallsOnMargin(thing) {\n var box = thing.getBoundingClientRect();\n if (box.width === 0 || box.height === 0) {\n // I'd say an element with dimensions zero fits on current page.\n return 0;\n }\n var top = copy.getBoundingClientRect().top;\n var available = pageHeight - adjust;\n return (box.height > available) ? 3\n : (box.top - top > available) ? 1\n : (box.bottom - top > available) ? 2\n : 0;\n }\n\n function splitText(node, isFirst) {\n if (!/\\S/.test(node.data)) {\n return;\n }\n\n var len = node.data.length;\n var range = doc.createRange();\n range.selectNodeContents(node);\n var fall = fallsOnMargin(range);\n if (!fall) {\n return; // the whole text fits on current page\n }\n\n var nextnode = node;\n if (fall == 1) {\n // starts on next page, break before anyway.\n if (isFirst) {\n // avoid leaving an empty

,

  • , etc. on previous page.\n breakAtElement(node.parentNode);\n } else {\n breakAtElement(node);\n }\n }\n else {\n (function findEOP(min, pos, max) {\n range.setEnd(node, pos);\n if (min == pos || pos == max) {\n return pos;\n }\n if (fallsOnMargin(range)) {\n return findEOP(min, (min + pos) >> 1, pos);\n } else {\n return findEOP(pos, (pos + max) >> 1, max);\n }\n })(0, len >> 1, len);\n\n if (!/\\S/.test(range.toString()) && isFirst) {\n // avoid leaving an empty

    ,

  • , etc. on previous page.\n breakAtElement(node.parentNode);\n } else {\n // This is only needed for IE, but it feels cleaner to do it anyway. Without\n // it, IE will truncate a very long text (playground/pdf-long-text-2.html).\n nextnode = node.splitText(range.endOffset);\n\n var page = makePage();\n range.setStartBefore(copy);\n page.appendChild(range.extractContents());\n copy.parentNode.insertBefore(page, copy);\n preventBulletOnListItem(nextnode.parentNode);\n }\n }\n\n splitText(nextnode);\n }\n\n function preventBulletOnListItem(el) {\n // set a hint on continued LI elements, to tell the\n // renderer not to draw the bullet again.\n // https://github.com/telerik/kendo-ui-core/issues/2732\n var li = closest(el, \"li\");\n if (li) {\n li.setAttribute(\"kendo-no-bullet\", \"1\");\n preventBulletOnListItem(li.parentNode);\n }\n }\n }\n\n return promise;\n}\n\n// This is needed for the Spreadsheet print functionality. Since\n// there we only need to draw text, this cuts through the ceremony\n// of drawDOM/renderElement and renders the text node directly.\nfunction drawText(element) {\n var group = new Group();\n nodeInfo._clipbox = false;\n nodeInfo._matrix = geo.Matrix.unit();\n nodeInfo._stackingContext = {\n element: element,\n group: group\n };\n pushNodeInfo(element, getComputedStyle(element), group);\n if (element.firstChild.nodeType == 3 /* Text */) {\n // avoid the penalty of renderElement\n renderText(element, element.firstChild, group);\n } else {\n _renderElement(element, group);\n }\n popNodeInfo();\n return group;\n}\n\nvar parseBackgroundImage = (function(){\n var tok_linear_gradient = /^((-webkit-|-moz-|-o-|-ms-)?linear-gradient\\s*)\\(/;\n //var tok_radial_gradient = /^((-webkit-|-moz-|-o-|-ms-)?radial-gradient\\s*)\\(/;\n var tok_percent = /^([-0-9.]+%)/;\n var tok_length = /^([-0-9.]+px)/;\n var tok_keyword = /^(left|right|top|bottom|to|center)\\W/;\n var tok_angle = /^([-0-9.]+(deg|grad|rad|turn)|0)/;\n var tok_whitespace = /^(\\s+)/;\n var tok_popen = /^(\\()/;\n var tok_pclose = /^(\\))/;\n var tok_comma = /^(,)/;\n var tok_url = /^(url)\\(/;\n var tok_content = /^(.*?)\\)/;\n\n var cache1 = {}, cache2 = {};\n\n function parse(input) {\n var orig = input;\n if (hasOwnProperty(cache1, orig)) {\n return cache1[orig];\n }\n function skip_ws() {\n var m = tok_whitespace.exec(input);\n if (m) {\n input = input.substr(m[1].length);\n }\n }\n function read(token) {\n skip_ws();\n var m = token.exec(input);\n if (m) {\n input = input.substr(m[1].length);\n return m[1];\n }\n }\n\n function read_stop() {\n var color = utils_parseColor(input, true);\n var length, percent;\n if (color) {\n let match =\n /^#[0-9a-f]+/i.exec(input) ||\n /^rgba?\\(.*?\\)/i.exec(input) ||\n /^..*?\\b/.exec(input); // maybe named color\n input = input.substr(match[0].length);\n color = color.toRGB();\n if (!(length = read(tok_length))) {\n percent = read(tok_percent);\n }\n return { color: color, length: length, percent: percent };\n }\n }\n\n function read_linear_gradient(propName) {\n var angle;\n var to1, to2;\n var stops = [];\n var reverse = false;\n\n if (read(tok_popen)) {\n // 1. [ || to , ]?\n angle = read(tok_angle);\n if (angle == \"0\") {\n angle = \"0deg\"; // Edge\n }\n if (angle) {\n angle = parseAngle(angle);\n read(tok_comma);\n }\n else {\n to1 = read(tok_keyword);\n if (to1 == \"to\") {\n to1 = read(tok_keyword);\n } else if (to1 && /^-/.test(propName)) {\n reverse = true;\n }\n to2 = read(tok_keyword);\n read(tok_comma);\n }\n\n if (/-moz-/.test(propName) && angle == null && to1 == null) {\n var x = read(tok_percent), y = read(tok_percent);\n reverse = true;\n if (x == \"0%\") {\n to1 = \"left\";\n } else if (x == \"100%\") {\n to1 = \"right\";\n }\n if (y == \"0%\") {\n to2 = \"top\";\n } else if (y == \"100%\") {\n to2 = \"bottom\";\n }\n read(tok_comma);\n }\n\n // 2. color stops\n while (input && !read(tok_pclose)) {\n var stop = read_stop();\n if (!stop) {\n break;\n }\n stops.push(stop);\n read(tok_comma);\n }\n\n return {\n type : \"linear\",\n angle : angle,\n to : to1 && to2 ? to1 + \" \" + to2 : to1 ? to1 : to2 ? to2 : null,\n stops : stops,\n reverse : reverse\n };\n }\n }\n\n function read_url() {\n if (read(tok_popen)) {\n var url = read(tok_content);\n url = url.replace(/^['\"]+|[\"']+$/g, \"\");\n read(tok_pclose);\n return { type: \"url\", url: url };\n }\n }\n\n var tok;\n\n if ((tok = read(tok_linear_gradient))) {\n tok = read_linear_gradient(tok);\n }\n else if ((tok = read(tok_url))) {\n tok = read_url();\n }\n\n return (cache1[orig] = tok || { type: \"none\" });\n }\n\n return function(input) {\n if (hasOwnProperty(cache2, input)) {\n return cache2[input];\n }\n return (cache2[input] = splitProperty(input).map(parse));\n };\n})();\n\nvar splitProperty = (function(){\n var cache = {};\n return function(input, separator) {\n if (!separator) {\n separator = /^\\s*,\\s*/;\n }\n\n var cacheKey = input + separator;\n\n if (hasOwnProperty(cache, cacheKey)) {\n return cache[cacheKey];\n }\n\n var ret = [];\n var last = 0, pos = 0;\n var in_paren = 0;\n var in_string = false;\n var m;\n\n function looking_at(rx) {\n return (m = rx.exec(input.substr(pos)));\n }\n\n function trim(str) {\n return str.replace(/^\\s+|\\s+$/g, \"\");\n }\n\n while (pos < input.length) {\n if (!in_string && looking_at(/^[\\(\\[\\{]/)) {\n in_paren++;\n pos++;\n }\n else if (!in_string && looking_at(/^[\\)\\]\\}]/)) {\n in_paren--;\n pos++;\n }\n else if (!in_string && looking_at(/^[\\\"\\']/)) {\n in_string = m[0];\n pos++;\n }\n else if (in_string == \"'\" && looking_at(/^\\\\\\'/)) {\n pos += 2;\n }\n else if (in_string == '\"' && looking_at(/^\\\\\\\"/)) {\n pos += 2;\n }\n else if (in_string == \"'\" && looking_at(/^\\'/)) {\n in_string = false;\n pos++;\n }\n else if (in_string == '\"' && looking_at(/^\\\"/)) {\n in_string = false;\n pos++;\n }\n else if (looking_at(separator)) {\n if (!in_string && !in_paren && pos > last) {\n ret.push(trim(input.substring(last, pos)));\n last = pos + m[0].length;\n }\n pos += m[0].length;\n }\n else {\n pos++;\n }\n }\n if (last < pos) {\n ret.push(trim(input.substring(last, pos)));\n }\n return (cache[cacheKey] = ret);\n };\n})();\n\nvar getFontURL = (function(cache){\n return function(el){\n // XXX: for IE we get here the whole cssText of the rule,\n // because the computedStyle.src is empty. Next time we need\n // to fix these regexps we better write a CSS parser. :-\\\n var url = cache[el];\n if (!url) {\n var m;\n if ((m = /url\\((['\"]?)([^'\")]*?)\\1\\)\\s+format\\((['\"]?)truetype\\3\\)/.exec(el))) {\n url = cache[el] = m[2];\n } else if ((m = /url\\((['\"]?)([^'\")]*?\\.ttf)\\1\\)/.exec(el))) {\n url = cache[el] = m[2];\n }\n }\n return url;\n };\n})(Object.create(null));\n\nvar getFontHeight = (function(cache){\n return function(font) {\n var height = cache[font];\n if (height == null) {\n height = cache[font] = measureText(\"Mapq\", { font: font }).height;\n }\n return height;\n };\n})(Object.create(null));\n\nfunction getFontFaces(doc) {\n if (doc == null) {\n doc = document;\n }\n var result = {};\n for (var i = 0; i < doc.styleSheets.length; ++i) {\n doStylesheet(doc.styleSheets[i]);\n }\n return result;\n function doStylesheet(ss) {\n if (ss) {\n var rules = null;\n try {\n rules = ss.cssRules;\n } catch (ex) {}\n if (rules) {\n addRules(ss, rules);\n }\n }\n }\n function findFonts(rule) {\n var src = getPropertyValue(rule.style, \"src\");\n if (src) {\n return splitProperty(src).reduce(function(a, el){\n var font = getFontURL(el);\n if (font) {\n a.push(font);\n }\n return a;\n }, []);\n } else {\n // Internet Explorer\n // XXX: this is gross. should work though for valid CSS.\n var font = getFontURL(rule.cssText);\n return font ? [ font ] : [];\n }\n }\n function addRules(styleSheet, rules) {\n for (var i = 0; i < rules.length; ++i) {\n var r = rules[i];\n switch (r.type) {\n case 3: // CSSImportRule\n doStylesheet(r.styleSheet);\n break;\n case 5: // CSSFontFaceRule\n var style = r.style;\n var family = splitProperty(getPropertyValue(style, \"font-family\"));\n var bold = /^([56789]00|bold)$/i.test(getPropertyValue(style, \"font-weight\"));\n var italic = \"italic\" == getPropertyValue(style, \"font-style\");\n var src = findFonts(r);\n if (src.length > 0) {\n addRule(styleSheet, family, bold, italic, src[0]);\n }\n }\n }\n }\n function addRule(styleSheet, names, bold, italic, url) {\n // We get full resolved absolute URLs in Chrome, but sadly\n // not in Firefox.\n if (!(/^data:/i.test(url))) {\n if (!(/^[^\\/:]+:\\/\\//.test(url) || /^\\//.test(url))) {\n url = String(styleSheet.href).replace(/[^\\/]*$/, \"\") + url;\n }\n }\n names.forEach(function(name){\n name = name.replace(/^(['\"]?)(.*?)\\1$/, \"$2\"); // it's quoted\n if (bold) {\n name += \"|bold\";\n }\n if (italic) {\n name += \"|italic\";\n }\n result[name] = url;\n });\n }\n}\n\nfunction hasOwnProperty(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nfunction getCounter(name) {\n name = \"_counter_\" + name;\n return nodeInfo[name];\n}\n\nfunction getAllCounters(name) {\n var values = [], p = nodeInfo;\n name = \"_counter_\" + name;\n while (p) {\n if (hasOwnProperty(p, name)) {\n values.push(p[name]);\n }\n p = Object.getPrototypeOf(p);\n }\n return values.reverse();\n}\n\nfunction incCounter(name, inc) {\n var p = nodeInfo;\n name = \"_counter_\" + name;\n while (p && !hasOwnProperty(p, name)) {\n p = Object.getPrototypeOf(p);\n }\n if (!p) {\n p = nodeInfo._root;\n }\n p[name] = (p[name] || 0) + (inc == null ? 1 : inc);\n}\n\nfunction resetCounter(name, val) {\n name = \"_counter_\" + name;\n nodeInfo[name] = val == null ? 0 : val;\n}\n\nfunction doCounters(a, f, def) {\n for (var i = 0; i < a.length;) {\n var name = a[i++];\n var val = parseFloat(a[i]);\n if (isNaN(val)) {\n f(name, def);\n } else {\n f(name, val);\n ++i;\n }\n }\n}\n\nfunction updateCounters(style) {\n var counterReset = getPropertyValue(style, \"counter-reset\");\n if (counterReset) {\n doCounters(splitProperty(counterReset, /^\\s+/), resetCounter, 0);\n }\n var counterIncrement = getPropertyValue(style, \"counter-increment\");\n if (counterIncrement) {\n doCounters(splitProperty(counterIncrement, /^\\s+/), incCounter, 1);\n }\n}\n\nfunction parseColor(str, css) {\n var color = utils_parseColor(str, true);\n if (color) {\n color = color.toRGB();\n if (css) {\n color = color.toCssRgba();\n } else if (color.a === 0) {\n color = null;\n }\n }\n return color;\n}\n\nfunction whenImagesAreActuallyLoaded(elements, callback) {\n var pending = 0;\n elements.forEach(function(el){\n var images = el.querySelectorAll(\"img\");\n for (var i = 0; i < images.length; ++i) {\n var img = images[i];\n if (!img.complete) {\n pending++;\n img.onload = img.onerror = next;\n }\n }\n });\n if (!pending) {\n next();\n }\n function next() {\n if (--pending <= 0) {\n callback();\n }\n }\n}\n\nfunction cacheImages(elements, callback) {\n var urls = [];\n function add(url) {\n if (!IMAGE_CACHE[url]) {\n IMAGE_CACHE[url] = true;\n urls.push(url);\n }\n }\n\n elements.forEach(function dive(element){\n if (/^img$/i.test(element.tagName)) {\n add(element.src);\n }\n parseBackgroundImage(\n getPropertyValue(\n getComputedStyle(element), \"background-image\"\n )\n ).forEach(function(bg){\n if (bg.type == \"url\") {\n add(bg.url);\n }\n });\n\n if (element.children) {\n slice(element.children).forEach(dive);\n }\n });\n\n var count = urls.length;\n function next() {\n if (--count <= 0) {\n // Even though we cached them, they simply won't be available immediately in the newly\n // created DOM. Previously we'd allow a 10ms timeout, but that's arbitrary and clearly\n // not working in all cases (https://github.com/telerik/kendo/issues/5399), so this\n // function will wait for their .complete attribute.\n whenImagesAreActuallyLoaded(elements, callback);\n }\n }\n if (count === 0) {\n next();\n }\n urls.forEach(function(url){\n var img = IMAGE_CACHE[url] = new window.Image();\n if (!(/^data:/i.test(url))) {\n img.crossOrigin = \"Anonymous\";\n }\n img.src = url;\n if (img.complete) {\n next();\n } else {\n img.onload = next;\n img.onerror = function() {\n IMAGE_CACHE[url] = null;\n next();\n };\n }\n });\n}\n\nfunction alphaNumeral(n) {\n var result = \"\";\n do {\n var r = n % 26;\n result = String.fromCharCode(97 + r) + result;\n n = Math.floor(n / 26);\n } while (n > 0);\n return result;\n}\n\nfunction pushNodeInfo(element, style, group) {\n nodeInfo = Object.create(nodeInfo);\n nodeInfo[element.tagName.toLowerCase()] = {\n element: element,\n style: style\n };\n var decoration = getPropertyValue(style, \"text-decoration\");\n if (decoration && decoration != \"none\") {\n var color = getPropertyValue(style, \"color\");\n decoration.split(/\\s+/g).forEach(function(name){\n if (!nodeInfo[name]) {\n nodeInfo[name] = color;\n }\n });\n }\n\n if (createsStackingContext(style)) {\n nodeInfo._stackingContext = {\n element: element,\n group: group\n };\n }\n}\n\nfunction popNodeInfo() {\n nodeInfo = Object.getPrototypeOf(nodeInfo);\n}\n\nfunction updateClipbox(path) {\n if (nodeInfo._clipbox != null) {\n var box = path.bbox(nodeInfo._matrix);\n if (nodeInfo._clipbox) {\n nodeInfo._clipbox = geo.Rect.intersect(nodeInfo._clipbox, box);\n } else {\n nodeInfo._clipbox = box;\n }\n }\n}\n\nfunction emptyClipbox() {\n var cb = nodeInfo._clipbox;\n if (cb == null) {\n return true;\n }\n if (cb) {\n return cb.width() === 0 || cb.height() === 0;\n }\n}\n\nfunction createsStackingContext(style) {\n function prop(name) { return getPropertyValue(style, name); }\n if (prop(\"transform\") != \"none\" ||\n prop(\"position\") != \"static\" ||\n prop(\"z-index\") != \"auto\" ||\n prop(\"opacity\") < 1) {\n return true;\n }\n}\n\nfunction getComputedStyle(element, pseudoElt) {\n return window.getComputedStyle(element, pseudoElt || null);\n}\n\nfunction getPropertyValue(style, prop, defa) {\n var val = style.getPropertyValue(prop);\n if (val == null || val === \"\") {\n if (browser.webkit) {\n val = style.getPropertyValue(\"-webkit-\" + prop );\n } else if (browser.mozilla) {\n val = style.getPropertyValue(\"-moz-\" + prop );\n } else if (browser.opera) {\n val = style.getPropertyValue(\"-o-\" + prop);\n } else if (microsoft) {\n val = style.getPropertyValue(\"-ms-\" + prop);\n }\n }\n if (arguments.length > 2 && (val == null || val === \"\")) {\n return defa;\n } else {\n return val;\n }\n}\n\nfunction pleaseSetPropertyValue(style, prop, value, important) {\n style.setProperty(prop, value, important);\n if (browser.webkit) {\n style.setProperty(\"-webkit-\" + prop, value, important);\n } else if (browser.mozilla) {\n style.setProperty(\"-moz-\" + prop, value, important);\n } else if (browser.opera) {\n style.setProperty(\"-o-\" + prop, value, important);\n } else if (microsoft) {\n style.setProperty(\"-ms-\" + prop, value, important);\n prop = \"ms\" + prop.replace(/(^|-)([a-z])/g, function(s, p1, p2){\n return p1 + p2.toUpperCase();\n });\n style[prop] = value;\n }\n}\n\nfunction getBorder(style, side) {\n side = \"border-\" + side;\n return {\n width: parseFloat(getPropertyValue(style, side + \"-width\")),\n style: getPropertyValue(style, side + \"-style\"),\n color: parseColor(getPropertyValue(style, side + \"-color\"), true)\n };\n}\n\nfunction saveStyle(element, func) {\n var prev = element.style.cssText;\n var result = func();\n element.style.cssText = prev;\n return result;\n}\n\nfunction getBorderRadius(style, side) {\n var r = getPropertyValue(style, \"border-\" + side + \"-radius\").split(/\\s+/g).map(parseFloat);\n if (r.length == 1) {\n r.push(r[0]);\n }\n return sanitizeRadius({ x: r[0], y: r[1] });\n}\n\nfunction getContentBox(element) {\n var box = element.getBoundingClientRect();\n box = innerBox(box, \"border-*-width\", element);\n box = innerBox(box, \"padding-*\", element);\n return box;\n}\n\nfunction innerBox(box, prop, element) {\n var style, wt, wr, wb, wl;\n if (typeof prop == \"string\") {\n style = getComputedStyle(element);\n wt = parseFloat(getPropertyValue(style, prop.replace(\"*\", \"top\")));\n wr = parseFloat(getPropertyValue(style, prop.replace(\"*\", \"right\")));\n wb = parseFloat(getPropertyValue(style, prop.replace(\"*\", \"bottom\")));\n wl = parseFloat(getPropertyValue(style, prop.replace(\"*\", \"left\")));\n }\n else if (typeof prop == \"number\") {\n wt = wr = wb = wl = prop;\n }\n return {\n top : box.top + wt,\n right : box.right - wr,\n bottom : box.bottom - wb,\n left : box.left + wl,\n width : box.right - box.left - wr - wl,\n height : box.bottom - box.top - wb - wt\n };\n}\n\nfunction getTransform(style) {\n var transform = getPropertyValue(style, \"transform\");\n if (transform == \"none\") {\n return null;\n }\n var matrix = /^\\s*matrix\\(\\s*(.*?)\\s*\\)\\s*$/.exec(transform);\n if (matrix) {\n var origin = getPropertyValue(style, \"transform-origin\");\n matrix = matrix[1].split(/\\s*,\\s*/g).map(parseFloat);\n origin = origin.split(/\\s+/g).map(parseFloat);\n return {\n matrix: matrix,\n origin: origin\n };\n }\n}\n\nfunction radiansToDegrees(radians) {\n return ((180 * radians) / Math.PI) % 360;\n}\n\nfunction parseAngle(angle) {\n var num = parseFloat(angle);\n if (/grad$/.test(angle)) {\n return Math.PI * num / 200;\n }\n else if (/rad$/.test(angle)) {\n return num;\n }\n else if (/turn$/.test(angle)) {\n return Math.PI * num * 2;\n }\n else if (/deg$/.test(angle)) {\n return Math.PI * num / 180;\n }\n}\n\nfunction setTransform(shape, m) {\n m = new geo.Matrix(m[0], m[1], m[2], m[3], m[4], m[5]);\n shape.transform(m);\n return m;\n}\n\nfunction setClipping(shape, clipPath) {\n shape.clip(clipPath);\n}\n\nfunction addArcToPath(path, x, y, options) {\n var points = new geo.Arc([ x, y ], options).curvePoints(), i = 1;\n while (i < points.length) {\n path.curveTo(points[i++], points[i++], points[i++]);\n }\n}\n\nfunction sanitizeRadius(r) {\n if (r.x <= 0 || r.y <= 0) {\n r.x = r.y = 0;\n }\n return r;\n}\n\nfunction adjustBorderRadiusForBox(box, rTL, rTR, rBR, rBL) {\n // adjust border radiuses such that the sum of adjacent\n // radiuses is not bigger than the length of the side.\n // seems the correct algorithm is variant (3) from here:\n // http://www.w3.org/Style/CSS/Tracker/issues/29?changelog\n var tl_x = Math.max(0, rTL.x), tl_y = Math.max(0, rTL.y);\n var tr_x = Math.max(0, rTR.x), tr_y = Math.max(0, rTR.y);\n var br_x = Math.max(0, rBR.x), br_y = Math.max(0, rBR.y);\n var bl_x = Math.max(0, rBL.x), bl_y = Math.max(0, rBL.y);\n\n var f = Math.min(\n box.width / (tl_x + tr_x),\n box.height / (tr_y + br_y),\n box.width / (br_x + bl_x),\n box.height / (bl_y + tl_y)\n );\n\n if (f < 1) {\n tl_x *= f; tl_y *= f;\n tr_x *= f; tr_y *= f;\n br_x *= f; br_y *= f;\n bl_x *= f; bl_y *= f;\n }\n\n return {\n tl: { x: tl_x, y: tl_y },\n tr: { x: tr_x, y: tr_y },\n br: { x: br_x, y: br_y },\n bl: { x: bl_x, y: bl_y }\n };\n}\n\nfunction elementRoundBox(element, box, type) {\n var style = getComputedStyle(element);\n\n var rTL = getBorderRadius(style, \"top-left\");\n var rTR = getBorderRadius(style, \"top-right\");\n var rBL = getBorderRadius(style, \"bottom-left\");\n var rBR = getBorderRadius(style, \"bottom-right\");\n\n if (type == \"padding\" || type == \"content\") {\n var bt = getBorder(style, \"top\");\n var br = getBorder(style, \"right\");\n var bb = getBorder(style, \"bottom\");\n var bl = getBorder(style, \"left\");\n rTL.x -= bl.width; rTL.y -= bt.width;\n rTR.x -= br.width; rTR.y -= bt.width;\n rBR.x -= br.width; rBR.y -= bb.width;\n rBL.x -= bl.width; rBL.y -= bb.width;\n if (type == \"content\") {\n var pt = parseFloat(getPropertyValue(style, \"padding-top\"));\n var pr = parseFloat(getPropertyValue(style, \"padding-right\"));\n var pb = parseFloat(getPropertyValue(style, \"padding-bottom\"));\n var pl = parseFloat(getPropertyValue(style, \"padding-left\"));\n rTL.x -= pl; rTL.y -= pt;\n rTR.x -= pr; rTR.y -= pt;\n rBR.x -= pr; rBR.y -= pb;\n rBL.x -= pl; rBL.y -= pb;\n }\n }\n\n if (typeof type == \"number\") {\n rTL.x -= type; rTL.y -= type;\n rTR.x -= type; rTR.y -= type;\n rBR.x -= type; rBR.y -= type;\n rBL.x -= type; rBL.y -= type;\n }\n\n return roundBox(box, rTL, rTR, rBR, rBL);\n}\n\n// Create a drawing.Path for a rounded rectangle. Receives the\n// bounding box and the border-radiuses in CSS order (top-left,\n// top-right, bottom-right, bottom-left). The radiuses must be\n// objects containing x (horiz. radius) and y (vertical radius).\nfunction roundBox(box, rTL0, rTR0, rBR0, rBL0) {\n var tmp = adjustBorderRadiusForBox(box, rTL0, rTR0, rBR0, rBL0);\n var rTL = tmp.tl;\n var rTR = tmp.tr;\n var rBR = tmp.br;\n var rBL = tmp.bl;\n var path = new Path({ fill: null, stroke: null });\n path.moveTo(box.left, box.top + rTL.y);\n if (rTL.x) {\n addArcToPath(path, box.left + rTL.x, box.top + rTL.y, {\n startAngle: -180,\n endAngle: -90,\n radiusX: rTL.x,\n radiusY: rTL.y\n });\n }\n path.lineTo(box.right - rTR.x, box.top);\n if (rTR.x) {\n addArcToPath(path, box.right - rTR.x, box.top + rTR.y, {\n startAngle: -90,\n endAngle: 0,\n radiusX: rTR.x,\n radiusY: rTR.y\n });\n }\n path.lineTo(box.right, box.bottom - rBR.y);\n if (rBR.x) {\n addArcToPath(path, box.right - rBR.x, box.bottom - rBR.y, {\n startAngle: 0,\n endAngle: 90,\n radiusX: rBR.x,\n radiusY: rBR.y\n });\n }\n path.lineTo(box.left + rBL.x, box.bottom);\n if (rBL.x) {\n addArcToPath(path, box.left + rBL.x, box.bottom - rBL.y, {\n startAngle: 90,\n endAngle: 180,\n radiusX: rBL.x,\n radiusY: rBL.y\n });\n }\n return path.close();\n}\n\nfunction formatCounter(val, style) {\n var str = String(parseFloat(val));\n switch (style) {\n case \"decimal-leading-zero\":\n if (str.length < 2) {\n str = \"0\" + str;\n }\n return str;\n case \"lower-roman\":\n return arabicToRoman(val).toLowerCase();\n case \"upper-roman\":\n return arabicToRoman(val).toUpperCase();\n case \"lower-latin\":\n case \"lower-alpha\":\n return alphaNumeral(val - 1);\n case \"upper-latin\":\n case \"upper-alpha\":\n return alphaNumeral(val - 1).toUpperCase();\n default:\n return str;\n }\n}\n\nfunction evalPseudoElementContent(element, content) {\n function displayCounter(name, style, separator) {\n if (!separator) {\n return formatCounter(getCounter(name) || 0, style);\n }\n separator = separator.replace(/^\\s*([\"'])(.*)\\1\\s*$/, \"$2\");\n return getAllCounters(name).map(function(val){\n return formatCounter(val, style);\n }).join(separator);\n }\n var a = splitProperty(content, /^\\s+/);\n var result = [], m;\n a.forEach(function(el){\n var tmp;\n if ((m = /^\\s*([\"'])(.*)\\1\\s*$/.exec(el))) {\n result.push(m[2].replace(/\\\\([0-9a-f]{4})/gi, function(s, p){\n return String.fromCharCode(parseInt(p, 16));\n }));\n }\n else if ((m = /^\\s*counter\\((.*?)\\)\\s*$/.exec(el))) {\n tmp = splitProperty(m[1]);\n result.push(displayCounter(tmp[0], tmp[1]));\n }\n else if ((m = /^\\s*counters\\((.*?)\\)\\s*$/.exec(el))) {\n tmp = splitProperty(m[1]);\n result.push(displayCounter(tmp[0], tmp[2], tmp[1]));\n }\n else if ((m = /^\\s*attr\\((.*?)\\)\\s*$/.exec(el))) {\n result.push(element.getAttribute(m[1]) || \"\");\n }\n else {\n result.push(el);\n }\n });\n return result.join(\"\");\n}\n\nfunction getCssText(style) {\n if (style.cssText) {\n return style.cssText;\n }\n // Status: NEW. Report year: 2002. Current year: 2014.\n // Nice played, Mozillians.\n // https://bugzilla.mozilla.org/show_bug.cgi?id=137687\n var result = [];\n for (var i = 0; i < style.length; ++i) {\n result.push(style[i] + \": \" + getPropertyValue(style, style[i]));\n }\n return result.join(\";\\n\");\n}\n\nfunction _renderWithPseudoElements(element, group) {\n if (element.tagName == KENDO_PSEUDO_ELEMENT) {\n _renderElement(element, group);\n return;\n }\n let fake = [];\n function pseudo(kind, place) {\n let style = getComputedStyle(element, kind), content = style.content;\n updateCounters(style);\n if (content && content != \"normal\" && content != \"none\" && style.width != \"0px\") {\n let psel = element.ownerDocument.createElement(KENDO_PSEUDO_ELEMENT);\n psel.style.cssText = getCssText(style);\n psel.textContent = evalPseudoElementContent(element, content);\n element.insertBefore(psel, place);\n fake.push(psel);\n }\n }\n pseudo(\":before\", element.firstChild);\n pseudo(\":after\", null);\n if (fake.length > 0) {\n let saveClass = element.className;\n element.className += \" kendo-pdf-hide-pseudo-elements\";\n _renderElement(element, group);\n element.className = saveClass;\n fake.forEach(function(el){ element.removeChild(el); });\n } else {\n _renderElement(element, group);\n }\n}\n\nfunction _renderElement(element, group) {\n var style = getComputedStyle(element);\n\n var top = getBorder(style, \"top\");\n var right = getBorder(style, \"right\");\n var bottom = getBorder(style, \"bottom\");\n var left = getBorder(style, \"left\");\n\n var rTL0 = getBorderRadius(style, \"top-left\");\n var rTR0 = getBorderRadius(style, \"top-right\");\n var rBL0 = getBorderRadius(style, \"bottom-left\");\n var rBR0 = getBorderRadius(style, \"bottom-right\");\n\n var dir = getPropertyValue(style, \"direction\");\n\n var backgroundColor = getPropertyValue(style, \"background-color\");\n backgroundColor = parseColor(backgroundColor);\n\n var backgroundImage = parseBackgroundImage( getPropertyValue(style, \"background-image\") );\n var backgroundRepeat = splitProperty( getPropertyValue(style, \"background-repeat\") );\n var backgroundPosition = splitProperty( getPropertyValue(style, \"background-position\") );\n var backgroundOrigin = splitProperty( getPropertyValue(style, \"background-origin\") );\n var backgroundSize = splitProperty( getPropertyValue(style, \"background-size\") );\n\n // IE shrinks the text with text-overflow: ellipsis,\n // apparently because the returned bounding box for the range\n // is limited to the visible area minus space for the dots,\n // instead of being the full width of the text.\n //\n // https://github.com/telerik/kendo/issues/5232\n // https://github.com/telerik/kendo-ui-core/issues/1868\n //\n // We have to test it here rather than in renderText because\n // text-overflow: ellipsis could be set on a parent element (not\n // necessarily the one containing the text); in this case,\n // getComputedStyle(elementWithTheText) will return \"clip\", not\n // \"ellipsis\" (which is probably a bug, but oh well...)\n var textOverflow, saveTextOverflow;\n if (microsoft) {\n textOverflow = style.textOverflow; // computed style\n if (textOverflow == \"ellipsis\") {\n saveTextOverflow = element.style.textOverflow; // own style.\n element.style.textOverflow = \"clip\";\n }\n }\n\n if (browser.msie && browser.version < 10) {\n // IE9 hacks. getPropertyValue won't return the correct\n // value. Sucks that we have to do it here, I'd prefer to\n // move it in getPropertyValue, but we don't have the\n // element.\n backgroundPosition = splitProperty(element.currentStyle.backgroundPosition);\n }\n\n var innerbox = innerBox(element.getBoundingClientRect(), \"border-*-width\", element);\n\n // CSS \"clip\" property - if present, replace the group with a\n // new one which is clipped. This must happen before drawing\n // the borders and background.\n (function(){\n var clip = getPropertyValue(style, \"clip\");\n var m = /^\\s*rect\\((.*)\\)\\s*$/.exec(clip);\n if (m) {\n var a = m[1].split(/[ ,]+/g);\n var top = a[0] == \"auto\" ? innerbox.top : parseFloat(a[0]) + innerbox.top;\n var right = a[1] == \"auto\" ? innerbox.right : parseFloat(a[1]) + innerbox.left;\n var bottom = a[2] == \"auto\" ? innerbox.bottom : parseFloat(a[2]) + innerbox.top;\n var left = a[3] == \"auto\" ? innerbox.left : parseFloat(a[3]) + innerbox.left;\n var tmp = new Group();\n var clipPath = new Path()\n .moveTo(left, top)\n .lineTo(right, top)\n .lineTo(right, bottom)\n .lineTo(left, bottom)\n .close();\n setClipping(tmp, clipPath);\n group.append(tmp);\n group = tmp;\n updateClipbox(clipPath);\n }\n })();\n\n var boxes, i, cells;\n var display = getPropertyValue(style, \"display\");\n\n if (display == \"table-row\") {\n // because of rowspan/colspan, we shouldn't draw background of table row elements on the\n // box given by its getBoundingClientRect, because if we do we risk overwritting a\n // previously rendered cell. https://github.com/telerik/kendo/issues/4881\n boxes = [];\n for (i = 0, cells = element.children; i < cells.length; ++i) {\n boxes.push(cells[i].getBoundingClientRect());\n }\n } else {\n boxes = element.getClientRects();\n if (boxes.length == 1) {\n // Workaround the missing borders in Chrome! getClientRects() boxes contains values\n // rounded to integer. getBoundingClientRect() appears to work fine. We still need\n // getClientRects() to support cases where there are more boxes (continued inline\n // elements that might have border/background).\n boxes = [ element.getBoundingClientRect() ];\n }\n }\n\n // This function workarounds another Chrome bug, where boxes returned for a table with\n // border-collapse: collapse will overlap the table border. Our rendering is not perfect in\n // such case anyway, but with this is better than without it.\n boxes = adjustBoxes(boxes);\n\n for (i = 0; i < boxes.length; ++i) {\n drawOneBox(boxes[i], i === 0, i == boxes.length - 1);\n }\n\n // Render links as separate groups. We can't use boxes returned by element's getClientRects\n // because if display type is \"inline\" (default for ), boxes will not include the height of\n // images inside. https://github.com/telerik/kendo-ui-core/issues/3359\n if (element.tagName == \"A\" && element.href && !/^#?$/.test(element.getAttribute(\"href\"))) {\n if (!nodeInfo._avoidLinks || !matches(element, nodeInfo._avoidLinks)) {\n const r = document.createRange();\n r.selectNodeContents(element);\n slice(r.getClientRects()).forEach(function(box){\n const g = new Group();\n g._pdfLink = {\n url : element.href,\n top : box.top,\n right : box.right,\n bottom : box.bottom,\n left : box.left\n };\n group.append(g);\n });\n }\n }\n\n if (boxes.length > 0 && display == \"list-item\" && !element.getAttribute(\"kendo-no-bullet\")) {\n drawBullet(boxes[0]);\n }\n\n // overflow: hidden/auto - if present, replace the group with\n // a new one clipped by the inner box.\n (function(){\n function clipit() {\n var clipPath = elementRoundBox(element, innerbox, \"padding\");\n var tmp = new Group();\n setClipping(tmp, clipPath);\n group.append(tmp);\n group = tmp;\n updateClipbox(clipPath);\n }\n if (isFormField(element)) {\n clipit();\n } else if (/^(hidden|auto|scroll)/.test(getPropertyValue(style, \"overflow\"))) {\n clipit();\n } else if (/^(hidden|auto|scroll)/.test(getPropertyValue(style, \"overflow-x\"))) {\n clipit();\n } else if (/^(hidden|auto|scroll)/.test(getPropertyValue(style, \"overflow-y\"))) {\n clipit();\n }\n })();\n\n if (!maybeRenderWidget(element, group)) {\n renderContents(element, group);\n }\n\n if (microsoft && textOverflow == \"ellipsis\") {\n element.style.textOverflow = saveTextOverflow;\n }\n\n return group; // only utility functions after this line.\n\n function adjustBoxes(boxes) {\n if (/^td$/i.test(element.tagName)) {\n var table = nodeInfo.table;\n if (table && getPropertyValue(table.style, \"border-collapse\") == \"collapse\") {\n var tableBorderLeft = getBorder(table.style, \"left\").width;\n var tableBorderTop = getBorder(table.style, \"top\").width;\n // check if we need to adjust\n if (tableBorderLeft === 0 && tableBorderTop === 0) {\n return boxes; // nope\n }\n var tableBox = table.element.getBoundingClientRect();\n var firstCell = table.element.rows[0].cells[0];\n var firstCellBox = firstCell.getBoundingClientRect();\n if (firstCellBox.top == tableBox.top || firstCellBox.left == tableBox.left) {\n return slice(boxes).map(function(box){\n return {\n left : box.left + tableBorderLeft,\n top : box.top + tableBorderTop,\n right : box.right + tableBorderLeft,\n bottom : box.bottom + tableBorderTop,\n height : box.height,\n width : box.width\n };\n });\n }\n }\n }\n return boxes;\n }\n\n // this function will be called to draw each border. it\n // draws starting at origin and the resulted path must be\n // translated/rotated to be placed in the proper position.\n //\n // arguments are named as if it draws the top border:\n //\n // - `len` the length of the edge\n // - `Wtop` the width of the edge (i.e. border-top-width)\n // - `Wleft` the width of the left edge (border-left-width)\n // - `Wright` the width of the right edge\n // - `rl` and `rl` -- the border radius on the left and right\n // (objects containing x and y, for horiz/vertical radius)\n // - `transform` -- transformation to apply\n //\n function drawEdge(color, len, Wtop, Wleft, Wright, rl, rr, transform) {\n if (Wtop <= 0) {\n return;\n }\n\n var path, edge = new Group();\n setTransform(edge, transform);\n group.append(edge);\n\n sanitizeRadius(rl);\n sanitizeRadius(rr);\n\n // draw main border. this is the area without the rounded corners\n path = new Path({\n fill: { color: color },\n stroke: null\n });\n edge.append(path);\n path.moveTo(rl.x ? Math.max(rl.x, Wleft) : 0, 0)\n .lineTo(len - (rr.x ? Math.max(rr.x, Wright) : 0), 0)\n .lineTo(len - Math.max(rr.x, Wright), Wtop)\n .lineTo(Math.max(rl.x, Wleft), Wtop)\n .close();\n\n if (rl.x) {\n drawRoundCorner(Wleft, rl, [ -1, 0, 0, 1, rl.x, 0 ]);\n }\n\n if (rr.x) {\n drawRoundCorner(Wright, rr, [ 1, 0, 0, 1, len - rr.x, 0 ]);\n }\n\n // draws one round corner, starting at origin (needs to be\n // translated/rotated to be placed properly).\n function drawRoundCorner(Wright, r, transform) {\n var angle = Math.PI/2 * Wright / (Wright + Wtop);\n\n // not sanitizing this one, because negative values\n // are useful to fill the box correctly.\n var ri = {\n x: r.x - Wright,\n y: r.y - Wtop\n };\n\n var path = new Path({\n fill: { color: color },\n stroke: null\n }).moveTo(0, 0);\n\n setTransform(path, transform);\n\n addArcToPath(path, 0, r.y, {\n startAngle: -90,\n endAngle: -radiansToDegrees(angle),\n radiusX: r.x,\n radiusY: r.y\n });\n\n if (ri.x > 0 && ri.y > 0) {\n path.lineTo(ri.x * Math.cos(angle), r.y - ri.y * Math.sin(angle));\n addArcToPath(path, 0, r.y, {\n startAngle: -radiansToDegrees(angle),\n endAngle: -90,\n radiusX: ri.x,\n radiusY: ri.y,\n anticlockwise: true\n });\n }\n else if (ri.x > 0) {\n path.lineTo(ri.x, Wtop)\n .lineTo(0, Wtop);\n }\n else {\n path.lineTo(ri.x, Wtop)\n .lineTo(ri.x, 0);\n }\n\n edge.append(path.close());\n }\n }\n\n function drawBackground(box) {\n var background = new Group();\n setClipping(background, roundBox(box, rTL0, rTR0, rBR0, rBL0));\n group.append(background);\n\n if (backgroundColor) {\n var path = new Path({\n fill: { color: backgroundColor.toCssRgba() },\n stroke: null\n });\n path.moveTo(box.left, box.top)\n .lineTo(box.right, box.top)\n .lineTo(box.right, box.bottom)\n .lineTo(box.left, box.bottom)\n .close();\n background.append(path);\n }\n\n for (var i = backgroundImage.length; --i >= 0;) {\n drawOneBackground(\n background, box,\n backgroundImage[i],\n backgroundRepeat[i % backgroundRepeat.length],\n backgroundPosition[i % backgroundPosition.length],\n backgroundOrigin[i % backgroundOrigin.length],\n backgroundSize[i % backgroundSize.length]\n );\n }\n }\n\n function drawOneBackground(group, box, background, backgroundRepeat, backgroundPosition, backgroundOrigin, backgroundSize) {\n if (!background || (background == \"none\")) {\n return;\n }\n\n if (background.type == \"url\") {\n var img = IMAGE_CACHE[background.url];\n if (img && img.width > 0 && img.height > 0) {\n drawBackgroundImage(group, box, img.width, img.height, function(group, rect){\n group.append(new Image(background.url, rect));\n });\n }\n } else if (background.type == \"linear\") {\n drawBackgroundImage(group, box, box.width, box.height, gradientRenderer(background));\n } else {\n return;\n }\n\n function drawBackgroundImage(group, box, img_width, img_height, renderBG) {\n var aspect_ratio = img_width / img_height, f;\n\n // for background-origin: border-box the box is already appropriate\n var orgBox = box;\n if (backgroundOrigin == \"content-box\") {\n orgBox = innerBox(orgBox, \"border-*-width\", element);\n orgBox = innerBox(orgBox, \"padding-*\", element);\n } else if (backgroundOrigin == \"padding-box\") {\n orgBox = innerBox(orgBox, \"border-*-width\", element);\n }\n\n if (!/^\\s*auto(\\s+auto)?\\s*$/.test(backgroundSize)) {\n if (backgroundSize == \"contain\") {\n f = Math.min(orgBox.width / img_width,\n orgBox.height / img_height);\n img_width *= f;\n img_height *= f;\n }\n else if (backgroundSize == \"cover\") {\n f = Math.max(orgBox.width / img_width,\n orgBox.height / img_height);\n img_width *= f;\n img_height *= f;\n }\n else {\n var size = backgroundSize.split(/\\s+/g);\n // compute width\n if (/%$/.test(size[0])) {\n img_width = orgBox.width * parseFloat(size[0]) / 100;\n } else {\n img_width = parseFloat(size[0]);\n }\n // compute height\n if (size.length == 1 || size[1] == \"auto\") {\n img_height = img_width / aspect_ratio;\n } else if (/%$/.test(size[1])) {\n img_height = orgBox.height * parseFloat(size[1]) / 100;\n } else {\n img_height = parseFloat(size[1]);\n }\n }\n }\n\n var pos = String(backgroundPosition);\n\n // IE sometimes reports single-word positions\n // https://github.com/telerik/kendo-ui-core/issues/2786\n //\n // it seems to switch to percentages when the horizontal\n // position is not \"center\", therefore we don't handle\n // multi-word cases here. All other browsers return\n // percentages or pixels instead of keywords. At least\n // for now...\n switch (pos) {\n case \"bottom\" : pos = \"50% 100%\"; break;\n case \"top\" : pos = \"50% 0\"; break;\n case \"left\" : pos = \"0 50%\"; break;\n case \"right\" : pos = \"100% 50%\"; break;\n case \"center\" : pos = \"50% 50%\"; break;\n }\n\n pos = pos.split(/\\s+/);\n if (pos.length == 1) {\n pos[1] = \"50%\";\n }\n\n if (/%$/.test(pos[0])) {\n pos[0] = parseFloat(pos[0]) / 100 * (orgBox.width - img_width);\n } else {\n pos[0] = parseFloat(pos[0]);\n }\n if (/%$/.test(pos[1])) {\n pos[1] = parseFloat(pos[1]) / 100 * (orgBox.height - img_height);\n } else {\n pos[1] = parseFloat(pos[1]);\n }\n\n var rect = new geo.Rect([ orgBox.left + pos[0], orgBox.top + pos[1] ], [ img_width, img_height ]);\n\n // XXX: background-repeat could be implemented more\n // efficiently as a fill pattern (at least for PDF\n // output, probably SVG too).\n\n function rewX() {\n while (rect.origin.x > box.left) {\n rect.origin.x -= img_width;\n }\n }\n\n function rewY() {\n while (rect.origin.y > box.top) {\n rect.origin.y -= img_height;\n }\n }\n\n function repeatX() {\n while (rect.origin.x < box.right) {\n renderBG(group, rect.clone());\n rect.origin.x += img_width;\n }\n }\n\n if (backgroundRepeat == \"no-repeat\") {\n renderBG(group, rect);\n }\n else if (backgroundRepeat == \"repeat-x\") {\n rewX();\n repeatX();\n }\n else if (backgroundRepeat == \"repeat-y\") {\n rewY();\n while (rect.origin.y < box.bottom) {\n renderBG(group, rect.clone());\n rect.origin.y += img_height;\n }\n }\n else if (backgroundRepeat == \"repeat\") {\n rewX();\n rewY();\n var origin = rect.origin.clone();\n while (rect.origin.y < box.bottom) {\n rect.origin.x = origin.x;\n repeatX();\n rect.origin.y += img_height;\n }\n }\n }\n }\n\n function drawBullet() {\n var listStyleType = getPropertyValue(style, \"list-style-type\");\n if (listStyleType == \"none\") {\n return;\n }\n var listStylePosition = getPropertyValue(style, \"list-style-position\");\n\n function _drawBullet(f) {\n saveStyle(element, function(){\n element.style.position = \"relative\";\n var bullet = element.ownerDocument.createElement(KENDO_PSEUDO_ELEMENT);\n bullet.style.position = \"absolute\";\n bullet.style.boxSizing = \"border-box\";\n if (listStylePosition == \"outside\") {\n bullet.style.width = \"6em\";\n bullet.style.left = \"-6.8em\";\n bullet.style.textAlign = \"right\";\n } else {\n bullet.style.left = \"0px\";\n }\n f(bullet);\n element.insertBefore(bullet, element.firstChild);\n renderElement(bullet, group);\n element.removeChild(bullet);\n });\n }\n\n function elementIndex(f) {\n var a = element.parentNode.children;\n var k = element.getAttribute(\"kendo-split-index\");\n if (k != null) {\n return f(k|0, a.length);\n }\n for (var i = 0; i < a.length; ++i) {\n if (a[i] === element) {\n return f(i, a.length);\n }\n }\n }\n\n switch (listStyleType) {\n case \"circle\":\n case \"disc\":\n case \"square\":\n _drawBullet(function(bullet){\n // XXX: the science behind these values is called \"trial and error\".\n bullet.style.fontSize = \"60%\";\n bullet.style.lineHeight = \"200%\";\n bullet.style.paddingRight = \"0.5em\";\n bullet.style.fontFamily = \"DejaVu Serif\";\n bullet.innerHTML = {\n \"disc\" : \"\\u25cf\",\n \"circle\" : \"\\u25ef\",\n \"square\" : \"\\u25a0\"\n }[listStyleType];\n });\n break;\n\n case \"decimal\":\n case \"decimal-leading-zero\":\n _drawBullet(function(bullet){\n elementIndex(function(idx){\n ++idx;\n if (listStyleType == \"decimal-leading-zero\" && idx < 10) {\n idx = \"0\" + idx;\n }\n bullet.innerHTML = idx + \".\";\n });\n });\n break;\n\n case \"lower-roman\":\n case \"upper-roman\":\n _drawBullet(function(bullet){\n elementIndex(function(idx){\n idx = arabicToRoman(idx + 1);\n if (listStyleType == \"upper-roman\") {\n idx = idx.toUpperCase();\n }\n bullet.innerHTML = idx + \".\";\n });\n });\n break;\n\n case \"lower-latin\":\n case \"lower-alpha\":\n case \"upper-latin\":\n case \"upper-alpha\":\n _drawBullet(function(bullet){\n elementIndex(function(idx){\n idx = alphaNumeral(idx);\n if (/^upper/i.test(listStyleType)) {\n idx = idx.toUpperCase();\n }\n bullet.innerHTML = idx + \".\";\n });\n });\n break;\n }\n }\n\n // draws a single border box\n function drawOneBox(box, isFirst, isLast) {\n if (box.width === 0 || box.height === 0) {\n return;\n }\n\n drawBackground(box);\n\n var shouldDrawLeft = (left.width > 0 && ((isFirst && dir == \"ltr\") || (isLast && dir == \"rtl\")));\n var shouldDrawRight = (right.width > 0 && ((isLast && dir == \"ltr\") || (isFirst && dir == \"rtl\")));\n\n // The most general case is that the 4 borders have different widths and border\n // radiuses. The way that is handled is by drawing 3 Paths for each border: the\n // straight line, and two round corners which represent half of the entire rounded\n // corner. To simplify code those shapes are drawed at origin (by the drawEdge\n // function), then translated/rotated into the right position.\n //\n // However, this leads to poor results due to rounding in the simpler cases where\n // borders are straight lines. Therefore we handle a few such cases separately with\n // straight lines. C^wC^wC^w -- nope, scratch that. poor rendering was because of a bug\n // in Chrome (getClientRects() returns rounded integer values rather than exact floats.\n // web dev is still a ghetto.)\n\n // first, just in case there is no border...\n if (top.width === 0 && left.width === 0 && right.width === 0 && bottom.width === 0) {\n return;\n }\n\n // START paint borders\n // if all borders have equal colors...\n if (top.color == right.color && top.color == bottom.color && top.color == left.color) {\n\n // if same widths too, we can draw the whole border by stroking a single path.\n if (top.width == right.width && top.width == bottom.width && top.width == left.width)\n {\n if (shouldDrawLeft && shouldDrawRight) {\n // reduce box by half the border width, so we can draw it by stroking.\n box = innerBox(box, top.width/2);\n\n // adjust the border radiuses, again by top.width/2, and make the path element.\n var path = elementRoundBox(element, box, top.width/2);\n path.options.stroke = {\n color: top.color,\n width: top.width\n };\n group.append(path);\n return;\n }\n }\n }\n\n // if border radiuses are zero and widths are at most one pixel, we can again use simple\n // paths.\n if (rTL0.x === 0 && rTR0.x === 0 && rBR0.x === 0 && rBL0.x === 0) {\n // alright, 1.9px will do as well. the difference in color blending should not be\n // noticeable.\n if (top.width < 2 && left.width < 2 && right.width < 2 && bottom.width < 2) {\n // top border\n if (top.width > 0) {\n group.append(\n new Path({\n stroke: { width: top.width, color: top.color }\n })\n .moveTo(box.left, box.top + top.width/2)\n .lineTo(box.right, box.top + top.width/2)\n );\n }\n\n // bottom border\n if (bottom.width > 0) {\n group.append(\n new Path({\n stroke: { width: bottom.width, color: bottom.color }\n })\n .moveTo(box.left, box.bottom - bottom.width/2)\n .lineTo(box.right, box.bottom - bottom.width/2)\n );\n }\n\n // left border\n if (shouldDrawLeft) {\n group.append(\n new Path({\n stroke: { width: left.width, color: left.color }\n })\n .moveTo(box.left + left.width/2, box.top)\n .lineTo(box.left + left.width/2, box.bottom)\n );\n }\n\n // right border\n if (shouldDrawRight) {\n group.append(\n new Path({\n stroke: { width: right.width, color: right.color }\n })\n .moveTo(box.right - right.width/2, box.top)\n .lineTo(box.right - right.width/2, box.bottom)\n );\n }\n\n return;\n }\n }\n // END paint borders\n\n var tmp = adjustBorderRadiusForBox(box, rTL0, rTR0, rBR0, rBL0);\n var rTL = tmp.tl;\n var rTR = tmp.tr;\n var rBR = tmp.br;\n var rBL = tmp.bl;\n\n // top border\n drawEdge(top.color,\n box.width, top.width, left.width, right.width,\n rTL, rTR,\n [ 1, 0, 0, 1, box.left, box.top ]);\n\n // bottom border\n drawEdge(bottom.color,\n box.width, bottom.width, right.width, left.width,\n rBR, rBL,\n [ -1, 0, 0, -1, box.right, box.bottom ]);\n\n // for left/right borders we need to invert the border-radiuses\n function inv(p) {\n return { x: p.y, y: p.x };\n }\n\n // left border\n drawEdge(left.color,\n box.height, left.width, bottom.width, top.width,\n inv(rBL), inv(rTL),\n [ 0, -1, 1, 0, box.left, box.bottom ]);\n\n // right border\n drawEdge(right.color,\n box.height, right.width, top.width, bottom.width,\n inv(rTR), inv(rBR),\n [ 0, 1, -1, 0, box.right, box.top ]);\n }\n}\n\nfunction gradientRenderer(gradient) {\n return function(group, rect) {\n var width = rect.width(), height = rect.height();\n\n switch (gradient.type) {\n case \"linear\":\n\n // figure out the angle.\n var angle = gradient.angle != null ? gradient.angle : Math.PI;\n switch (gradient.to) {\n case \"top\":\n angle = 0;\n break;\n case \"left\":\n angle = -Math.PI / 2;\n break;\n case \"bottom\":\n angle = Math.PI;\n break;\n case \"right\":\n angle = Math.PI / 2;\n break;\n case \"top left\": case \"left top\":\n angle = -Math.atan2(height, width);\n break;\n case \"top right\": case \"right top\":\n angle = Math.atan2(height, width);\n break;\n case \"bottom left\": case \"left bottom\":\n angle = Math.PI + Math.atan2(height, width);\n break;\n case \"bottom right\": case \"right bottom\":\n angle = Math.PI - Math.atan2(height, width);\n break;\n }\n\n if (gradient.reverse) {\n angle -= Math.PI;\n }\n\n // limit the angle between 0..2PI\n angle %= 2 * Math.PI;\n if (angle < 0) {\n angle += 2 * Math.PI;\n }\n\n // compute gradient's start/end points. here len is the length of the gradient line\n // and x,y is the end point relative to the center of the rectangle in conventional\n // (math) axis direction.\n\n // this is the original (unscaled) length of the gradient line. needed to deal with\n // absolutely positioned color stops. formula from the CSS spec:\n // http://dev.w3.org/csswg/css-images-3/#linear-gradient-syntax\n var pxlen = Math.abs(width * Math.sin(angle)) + Math.abs(height * Math.cos(angle));\n\n // The math below is pretty simple, but it took a while to figure out. We compute x\n // and y, the *end* of the gradient line. However, we want to transform them into\n // element-based coordinates (SVG's gradientUnits=\"objectBoundingBox\"). That means,\n // x=0 is the left edge, x=1 is the right edge, y=0 is the top edge and y=1 is the\n // bottom edge.\n //\n // A naive approach would use the original angle for these calculations. Say we'd\n // like to draw a gradient angled at 45deg in a 100x400 box. When we use\n // objectBoundingBox, the renderer will draw it in a 1x1 *square* box, and then\n // scale that to the desired dimensions. The 45deg angle will look more like 70deg\n // after scaling. SVG (http://www.w3.org/TR/SVG/pservers.html#LinearGradients) says\n // the following:\n //\n // When gradientUnits=\"objectBoundingBox\" and 'gradientTransform' is the\n // identity matrix, the normal of the linear gradient is perpendicular to the\n // gradient vector in object bounding box space (i.e., the abstract coordinate\n // system where (0,0) is at the top/left of the object bounding box and (1,1) is\n // at the bottom/right of the object bounding box). When the object's bounding\n // box is not square, the gradient normal which is initially perpendicular to\n // the gradient vector within object bounding box space may render\n // non-perpendicular relative to the gradient vector in user space. If the\n // gradient vector is parallel to one of the axes of the bounding box, the\n // gradient normal will remain perpendicular. This transformation is due to\n // application of the non-uniform scaling transformation from bounding box space\n // to user space.\n //\n // which is an extremely long and confusing way to tell what I just said above.\n //\n // For this reason we need to apply the reverse scaling to the original angle, so\n // that when it'll finally be rendered it'll actually be at the desired slope. Now\n // I'll let you figure out the math yourself.\n\n var scaledAngle = Math.atan(width * Math.tan(angle) / height);\n var sin = Math.sin(scaledAngle), cos = Math.cos(scaledAngle);\n var len = Math.abs(sin) + Math.abs(cos);\n var x = len/2 * sin;\n var y = len/2 * cos;\n\n // Because of the arctangent, our scaledAngle ends up between -PI/2..PI/2, possibly\n // losing the intended direction of the gradient. The following fixes it.\n if (angle > Math.PI/2 && angle <= 3*Math.PI/2) {\n x = -x;\n y = -y;\n }\n\n // compute the color stops.\n var implicit = [], right = 0;\n var stops = gradient.stops.map(function(s, i){\n var offset = s.percent;\n if (offset) {\n offset = parseFloat(offset) / 100;\n } else if (s.length) {\n offset = parseFloat(s.length) / pxlen;\n } else if (i === 0) {\n offset = 0;\n } else if (i == gradient.stops.length - 1) {\n offset = 1;\n }\n var stop = {\n color: s.color.toCssRgba(),\n offset: offset\n };\n if (offset != null) {\n right = offset;\n // fix implicit offsets\n implicit.forEach(function(s, i){\n var stop = s.stop;\n stop.offset = s.left + (right - s.left) * (i + 1) / (implicit.length + 1);\n });\n implicit = [];\n } else {\n implicit.push({ left: right, stop: stop });\n }\n return stop;\n });\n\n var start = [ 0.5 - x, 0.5 + y ];\n var end = [ 0.5 + x, 0.5 - y ];\n\n // finally, draw it.\n group.append(\n Path.fromRect(rect)\n .stroke(null)\n .fill(new LinearGradient({\n start : start,\n end : end,\n stops : stops,\n userSpace : false\n }))\n );\n break;\n case \"radial\":\n // XXX:\n if (window.console && window.console.log) {\n window.console.log(\"Radial gradients are not yet supported in HTML renderer\");\n }\n break;\n }\n };\n}\n\nfunction maybeRenderWidget(element, group) {\n var visual;\n\n if (element._kendoExportVisual) {\n visual = element._kendoExportVisual();\n } else if (window.kendo && window.kendo.jQuery && element.getAttribute(window.kendo.attr(\"role\"))) {\n var widget = window.kendo.widgetInstance(window.kendo.jQuery(element));\n if (widget && (widget.exportDOMVisual || widget.exportVisual)) {\n if (widget.exportDOMVisual) {\n visual = widget.exportDOMVisual();\n } else {\n visual = widget.exportVisual();\n }\n }\n }\n\n if (!visual) {\n return false;\n }\n\n var wrap = new Group();\n wrap.children.push(visual);\n\n var bbox = element.getBoundingClientRect();\n wrap.transform(geo.transform().translate(bbox.left, bbox.top));\n\n group.append(wrap);\n\n return true;\n}\n\nfunction renderImage(element, url, group) {\n var box = getContentBox(element);\n var rect = new geo.Rect([ box.left, box.top ], [ box.width, box.height ]);\n var image = new Image(url, rect);\n setClipping(image, elementRoundBox(element, box, \"content\"));\n group.append(image);\n}\n\nfunction zIndexSort(a, b) {\n var sa = getComputedStyle(a);\n var sb = getComputedStyle(b);\n var za = parseFloat(getPropertyValue(sa, \"z-index\"));\n var zb = parseFloat(getPropertyValue(sb, \"z-index\"));\n var pa = getPropertyValue(sa, \"position\");\n var pb = getPropertyValue(sb, \"position\");\n if (isNaN(za) && isNaN(zb)) {\n if ((/static|absolute/.test(pa)) && (/static|absolute/.test(pb))) {\n return 0;\n }\n if (pa == \"static\") {\n return -1;\n }\n if (pb == \"static\") {\n return 1;\n }\n return 0;\n }\n if (isNaN(za)) {\n return zb === 0 ? 0 : zb > 0 ? -1 : 1;\n }\n if (isNaN(zb)) {\n return za === 0 ? 0 : za > 0 ? 1 : -1;\n }\n return parseFloat(za) - parseFloat(zb);\n}\n\nfunction isFormField(element) {\n return /^(?:textarea|select|input)$/i.test(element.tagName);\n}\n\nfunction getSelectedOption(element) {\n if (element.selectedOptions && element.selectedOptions.length > 0) {\n return element.selectedOptions[0];\n }\n return element.options[element.selectedIndex];\n}\n\nfunction renderCheckbox(element, group) {\n var style = getComputedStyle(element);\n var color = getPropertyValue(style, \"color\");\n var box = element.getBoundingClientRect();\n if (element.type == \"checkbox\") {\n group.append(\n Path.fromRect(\n new geo.Rect([ box.left+1, box.top+1 ],\n [ box.width-2, box.height-2 ])\n ).stroke(color, 1)\n );\n if (element.checked) {\n // fill a rectangle inside? looks kinda ugly.\n // group.append(\n // Path.fromRect(\n // new geo.Rect([ box.left+4, box.top+4 ],\n // [ box.width-8, box.height-8])\n // ).fill(color).stroke(null)\n // );\n\n // let's draw a checkmark instead. artistic, eh?\n group.append(\n new Path()\n .stroke(color, 1.2)\n .moveTo(box.left + 0.22 * box.width,\n box.top + 0.55 * box.height)\n .lineTo(box.left + 0.45 * box.width,\n box.top + 0.75 * box.height)\n .lineTo(box.left + 0.78 * box.width,\n box.top + 0.22 * box.width)\n );\n }\n } else {\n group.append(\n new Circle(\n new geo.Circle([\n (box.left + box.right) / 2,\n (box.top + box.bottom) / 2\n ], Math.min(box.width-2, box.height-2) / 2)\n ).stroke(color, 1)\n );\n if (element.checked) {\n group.append(\n new Circle(\n new geo.Circle([\n (box.left + box.right) / 2,\n (box.top + box.bottom) / 2\n ], Math.min(box.width-8, box.height-8) / 2)\n ).fill(color).stroke(null)\n );\n }\n }\n}\n\nfunction renderFormField(element, group) {\n var tag = element.tagName.toLowerCase();\n if (tag == \"input\" && (element.type == \"checkbox\" || element.type == \"radio\")) {\n return renderCheckbox(element, group);\n }\n var p = element.parentNode;\n var doc = element.ownerDocument;\n var el = doc.createElement(KENDO_PSEUDO_ELEMENT);\n var option;\n el.style.cssText = getCssText(getComputedStyle(element));\n if (tag == \"input\") {\n el.style.whiteSpace = \"pre\";\n }\n if (tag == \"select\" || tag == \"textarea\") {\n el.style.overflow = \"auto\";\n }\n if (tag == \"select\") {\n if (element.multiple) {\n for (var i = 0; i < element.options.length; ++i) {\n option = doc.createElement(KENDO_PSEUDO_ELEMENT);\n option.style.cssText = getCssText(getComputedStyle(element.options[i]));\n option.style.display = \"block\"; // IE9 messes up without this\n option.textContent = element.options[i].textContent;\n el.appendChild(option);\n }\n } else {\n option = getSelectedOption(element);\n if (option) {\n el.textContent = option.textContent;\n }\n }\n } else {\n el.textContent = element.value;\n }\n p.insertBefore(el, element);\n el.scrollLeft = element.scrollLeft;\n el.scrollTop = element.scrollTop;\n\n // must temporarily hide the original element, otherwise it\n // may affect layout of the fake element we want to render.\n element.style.display = \"none\";\n\n renderContents(el, group);\n element.style.display = \"\";\n p.removeChild(el);\n}\n\nfunction serializeSVG(element) {\n const serializer = new window.XMLSerializer();\n let xml = serializer.serializeToString(element);\n\n if (browser.mozilla && !(element.getAttribute(\"width\") && element.getAttribute(\"height\"))) {\n const doc = new window.DOMParser().parseFromString(xml, \"image/svg+xml\");\n const svg = doc.documentElement;\n const box = getContentBox(element);\n svg.setAttribute(\"width\", box.width);\n svg.setAttribute(\"height\", box.height);\n xml = serializer.serializeToString(svg);\n }\n\n return xml;\n}\n\nfunction renderContents(element, group) {\n if (nodeInfo._stackingContext.element === element) {\n // the group that was set in pushNodeInfo might have\n // changed due to clipping/transforms, update it here.\n nodeInfo._stackingContext.group = group;\n }\n switch (element.tagName.toLowerCase()) {\n case \"img\":\n renderImage(element, element.src, group);\n break;\n\n case \"svg\":\n let xml = serializeSVG(element);\n let dataURL = `data:image/svg+xml;base64,${encodeBase64(xml)}`;\n renderImage(element, dataURL, group);\n break;\n\n case \"canvas\":\n try {\n renderImage(element, element.toDataURL(\"image/png\"), group);\n } catch (ex) {\n // tainted; can't draw it, ignore.\n }\n break;\n\n case \"textarea\":\n case \"input\":\n case \"select\":\n renderFormField(element, group);\n break;\n\n default:\n var children = [], floats = [], positioned = [];\n for (var i = element.firstChild; i; i = i.nextSibling) {\n switch (i.nodeType) {\n case 3: // Text\n if (/\\S/.test(i.data)) {\n renderText(element, i, group);\n }\n break;\n case 1: // Element\n var style = getComputedStyle(i);\n var floating = getPropertyValue(style, \"float\");\n var position = getPropertyValue(style, \"position\");\n if (position != \"static\") {\n positioned.push(i);\n }\n else if (floating != \"none\") {\n floats.push(i);\n } else {\n children.push(i);\n }\n break;\n }\n }\n\n mergeSort(children, zIndexSort).forEach(function(el){ renderElement(el, group); });\n mergeSort(floats, zIndexSort).forEach(function(el){ renderElement(el, group); });\n mergeSort(positioned, zIndexSort).forEach(function(el){ renderElement(el, group); });\n }\n}\n\nfunction renderText(element, node, group) {\n if (emptyClipbox()) {\n return;\n }\n var style = getComputedStyle(element);\n\n if (parseFloat(getPropertyValue(style, \"text-indent\")) < -500) {\n // assume it should not be displayed. the slider's\n // draggable handle displays a Drag text for some reason,\n // having text-indent: -3333px.\n return;\n }\n\n var text = node.data;\n var start = 0;\n var end = text.search(/\\S\\s*$/) + 1;\n\n if (!end) {\n return; // whitespace-only node\n }\n\n var fontSize = getPropertyValue(style, \"font-size\");\n var lineHeight = getPropertyValue(style, \"line-height\");\n\n // simply getPropertyValue(\"font\") doesn't work in Firefox :-\\\n var font = [\n getPropertyValue(style, \"font-style\"),\n getPropertyValue(style, \"font-variant\"),\n getPropertyValue(style, \"font-weight\"),\n fontSize, // no need for line height here; it breaks layout in FF\n getPropertyValue(style, \"font-family\")\n ].join(\" \");\n\n fontSize = parseFloat(fontSize);\n lineHeight = parseFloat(lineHeight);\n\n if (fontSize === 0) {\n return;\n }\n\n var color = getPropertyValue(style, \"color\");\n var range = element.ownerDocument.createRange();\n var align = getPropertyValue(style, \"text-align\");\n var isJustified = align == \"justify\";\n var columnCount = getPropertyValue(style, \"column-count\", 1);\n var whiteSpace = getPropertyValue(style, \"white-space\");\n var textTransform = getPropertyValue(style, \"text-transform\");\n\n // A line of 500px, with a font of 12px, contains an average of 80 characters, but since we\n // err, we'd like to guess a bigger number rather than a smaller one. Multiplying by 5\n // seems to be a good option.\n var estimateLineLength = element.getBoundingClientRect().width / fontSize * 5;\n if (estimateLineLength === 0) {\n estimateLineLength = 500;\n }\n\n // we'll maintain this so we can workaround bugs in Chrome's Range.getClientRects\n // https://github.com/telerik/kendo/issues/5740\n var prevLineBottom = null;\n\n var underline = nodeInfo[\"underline\"];\n var lineThrough = nodeInfo[\"line-through\"];\n var overline = nodeInfo[\"overline\"];\n var hasDecoration = underline || lineThrough || overline;\n\n // doChunk returns true when all text has been rendered\n while (!doChunk()) {}\n\n if (hasDecoration) {\n range.selectNode(node);\n slice(range.getClientRects()).forEach(decorate);\n }\n\n return; // only function declarations after this line\n\n function actuallyGetRangeBoundingRect(range) {\n // XXX: to be revised when this Chrome bug is fixed:\n // https://bugs.chromium.org/p/chromium/issues/detail?id=612459\n if (microsoft || browser.chrome || browser.safari) {\n // Workaround browser bugs: IE and Chrome would sometimes\n // return 0 or 1-width rectangles before or after the main\n // one. https://github.com/telerik/kendo/issues/4674\n\n // Actually Chrome 50 got worse, since the rectangles can now have the width of a\n // full character, making it hard to tell whether it's a bogus rectangle or valid\n // selection location. The workaround is to ignore rectangles that fall on the\n // previous line. https://github.com/telerik/kendo/issues/5740\n var rectangles = range.getClientRects(), box = {\n top : Infinity,\n right : -Infinity,\n bottom : -Infinity,\n left : Infinity\n }, done = false;\n for (var i = 0; i < rectangles.length; ++i) {\n var b = rectangles[i];\n if (b.width <= 1 || b.bottom === prevLineBottom) {\n continue; // bogus rectangle\n }\n box.left = Math.min(b.left , box.left);\n box.top = Math.min(b.top , box.top);\n box.right = Math.max(b.right , box.right);\n box.bottom = Math.max(b.bottom , box.bottom);\n done = true;\n }\n if (!done) {\n return range.getBoundingClientRect();\n }\n box.width = box.right - box.left;\n box.height = box.bottom - box.top;\n return box;\n }\n return range.getBoundingClientRect();\n }\n\n // Render a chunk of text, typically one line (but for justified text we render each word as\n // a separate Text object, because spacing is variable). Returns true when it finished the\n // current node. After each chunk it updates `start` to just after the last rendered\n // character.\n function doChunk() {\n var origStart = start;\n var box, pos = text.substr(start).search(/\\S/);\n start += pos;\n if (pos < 0 || start >= end) {\n return true;\n }\n\n // Select a single character to determine the height of a line of text. The box.bottom\n // will be essential for us to figure out where the next line begins.\n range.setStart(node, start);\n range.setEnd(node, start + 1);\n box = actuallyGetRangeBoundingRect(range);\n\n // for justified text we must split at each space, because space has variable width.\n var found = false;\n if (isJustified || columnCount > 1) {\n pos = text.substr(start).search(/\\s/);\n if (pos >= 0) {\n // we can only split there if it's on the same line, otherwise we'll fall back\n // to the default mechanism (see findEOL below).\n range.setEnd(node, start + pos);\n var r = actuallyGetRangeBoundingRect(range);\n if (r.bottom == box.bottom) {\n box = r;\n found = true;\n start += pos;\n }\n }\n }\n\n if (!found) {\n // This code does three things: (1) it selects one line of text in `range`, (2) it\n // leaves the bounding rect of that line in `box` and (3) it returns the position\n // just after the EOL. We know where the line starts (`start`) but we don't know\n // where it ends. To figure this out, we select a piece of text and look at the\n // bottom of the bounding box. If it changes, we have more than one line selected\n // and should retry with a smaller selection.\n //\n // To speed things up, we first try to select all text in the node (`start` ->\n // `end`). If there's more than one line there, then select only half of it. And\n // so on. When we find a value for `end` that fits in one line, we try increasing\n // it (also in halves) until we get to the next line. The algorithm stops when the\n // right side of the bounding box does not change.\n //\n // One more thing to note is that everything happens in a single Text DOM node.\n // There's no other tags inside it, therefore the left/top coordinates of the\n // bounding box will not change.\n pos = (function findEOL(min, eol, max){\n range.setEnd(node, eol);\n var r = actuallyGetRangeBoundingRect(range);\n if (r.bottom != box.bottom && min < eol) {\n return findEOL(min, (min + eol) >> 1, eol);\n } else if (r.right != box.right) {\n box = r;\n if (eol < max) {\n return findEOL(eol, (eol + max) >> 1, max);\n } else {\n return eol;\n }\n } else {\n return eol;\n }\n })(start, Math.min(end, start + estimateLineLength), end);\n\n if (pos == start) {\n // if EOL is at the start, then no more text fits on this line. Skip the\n // remainder of this node entirely to avoid a stack overflow.\n return true;\n }\n start = pos;\n\n pos = range.toString().search(/\\s+$/);\n if (pos === 0) {\n return false; // whitespace only; we should not get here.\n }\n if (pos > 0) {\n // eliminate trailing whitespace\n range.setEnd(node, range.startOffset + pos);\n box = actuallyGetRangeBoundingRect(range);\n }\n }\n\n // another workaround for IE: if we rely on getBoundingClientRect() we'll overlap with the bullet for LI\n // elements. Calling getClientRects() and using the *first* rect appears to give us the correct location.\n // Note: not to be used in Chrome as it randomly returns a zero-width rectangle from the previous line.\n if (microsoft) {\n box = range.getClientRects()[0];\n }\n\n var str = range.toString();\n if (!/^(?:pre|pre-wrap)$/i.test(whiteSpace)) {\n // node with non-significant space -- collapse whitespace.\n str = str.replace(/\\s+/g, \" \");\n }\n else if (/\\t/.test(str)) {\n // with significant whitespace we need to do something about literal TAB characters.\n // There's no TAB glyph in a font so they would be rendered in PDF as an empty box,\n // and the whole text will stretch to fill the original width. The core PDF lib\n // does not have sufficient context to deal with it.\n\n // calculate the starting column here, since we initially discarded any whitespace.\n var cc = 0;\n for (pos = origStart; pos < range.startOffset; ++pos) {\n var code = text.charCodeAt(pos);\n if (code == 9) {\n // when we meet a TAB we must round up to the next tab stop.\n // in all browsers TABs seem to be 8 characters.\n cc += 8 - cc % 8;\n } else if (code == 10 || code == 13) {\n // just in case we meet a newline we must restart.\n cc = 0;\n } else {\n // ordinary character --> advance one column\n cc++;\n }\n }\n\n // based on starting column, replace any TAB characters in the string we actually\n // have to display with spaces so that they align to columns multiple of 8.\n while ((pos = str.search(\"\\t\")) >= 0) {\n var indent = \" \".substr(0, 8 - (cc + pos) % 8);\n str = str.substr(0, pos) + indent + str.substr(pos + 1);\n }\n }\n\n if (!found) {\n prevLineBottom = box.bottom;\n }\n drawText(str, box);\n }\n\n function drawText(str, box) {\n // In IE the box height will be approximately lineHeight, while in\n // other browsers it'll (correctly) be the height of the bounding\n // box for the current text/font. Which is to say, IE sucks again.\n // The only good solution I can think of is to measure the text\n // ourselves and center the bounding box.\n if (microsoft && !isNaN(lineHeight)) {\n var height = getFontHeight(font);\n var top = (box.top + box.bottom - height) / 2;\n box = {\n top : top,\n right : box.right,\n bottom : top + height,\n left : box.left,\n height : height,\n width : box.right - box.left\n };\n }\n\n // var path = new Path({ stroke: { color: \"red\" }});\n // path.moveTo(box.left, box.top)\n // .lineTo(box.right, box.top)\n // .lineTo(box.right, box.bottom)\n // .lineTo(box.left, box.bottom)\n // .close();\n // group.append(path);\n\n switch (textTransform) {\n case \"uppercase\":\n str = str.toUpperCase();\n break;\n case \"lowercase\":\n str = str.toLowerCase();\n break;\n case \"capitalize\":\n str = str.replace(/(?:^|\\s)\\S/g, l => l.toUpperCase());\n break;\n }\n\n var text = new TextRect(\n str, new geo.Rect([ box.left, box.top ],\n [ box.width, box.height ]),\n {\n font: font,\n fill: { color: color }\n }\n );\n group.append(text);\n }\n\n function decorate(box) {\n line(underline, box.bottom);\n line(lineThrough, box.bottom - box.height / 2.7);\n line(overline, box.top);\n function line(color, ypos) {\n if (color) {\n var width = fontSize / 12;\n var path = new Path({ stroke: {\n width: width,\n color: color\n }});\n\n ypos -= width;\n path.moveTo(box.left, ypos)\n .lineTo(box.right, ypos);\n group.append(path);\n }\n }\n }\n}\n\nfunction groupInStackingContext(element, group, zIndex) {\n var main;\n if (zIndex != \"auto\") {\n // use the current stacking context\n main = nodeInfo._stackingContext.group;\n zIndex = parseFloat(zIndex);\n } else {\n // normal flow — use given container. we still have to\n // figure out where should we insert this element with the\n // assumption that its z-index is zero, as the group might\n // already contain elements with higher z-index.\n main = group;\n zIndex = 0;\n }\n var a = main.children;\n for (var i = 0; i < a.length; ++i) {\n if (a[i]._dom_zIndex != null && a[i]._dom_zIndex > zIndex) {\n break;\n }\n }\n\n var tmp = new Group();\n main.insert(i, tmp);\n tmp._dom_zIndex = zIndex;\n\n if (main !== group) {\n // console.log(\"Placing\", element, \"in\", nodeInfo._stackingContext.element, \"at position\", i, \" / \", a.length);\n // console.log(a.slice(i+1));\n\n // if (nodeInfo._matrix) {\n // tmp.transform(nodeInfo._matrix);\n // }\n if (nodeInfo._clipbox) {\n var m = nodeInfo._matrix.invert();\n var r = nodeInfo._clipbox.transformCopy(m);\n setClipping(tmp, Path.fromRect(r));\n // console.log(r);\n // tmp.append(Path.fromRect(r));\n // tmp.append(new Text(element.className || element.id, r.topLeft()));\n }\n }\n\n return tmp;\n}\n\nfunction renderElement(element, container) {\n var style = getComputedStyle(element);\n\n updateCounters(style);\n\n if (/^(style|script|link|meta|iframe|col|colgroup)$/i.test(element.tagName)) {\n return;\n }\n\n if (nodeInfo._clipbox == null) {\n return;\n }\n\n var opacity = parseFloat(getPropertyValue(style, \"opacity\"));\n var visibility = getPropertyValue(style, \"visibility\");\n var display = getPropertyValue(style, \"display\");\n\n if (opacity === 0 || visibility == \"hidden\" || display == \"none\") {\n return;\n }\n\n var tr = getTransform(style);\n var group;\n\n var zIndex = getPropertyValue(style, \"z-index\");\n if ((tr || opacity < 1) && zIndex == \"auto\") {\n zIndex = 0;\n }\n group = groupInStackingContext(element, container, zIndex);\n\n // XXX: remove at some point\n // group._pdfElement = element;\n // group.options._pdfDebug = \"\";\n // if (element.id) {\n // group.options._pdfDebug = \"#\" + element.id;\n // }\n // if (element.className) {\n // group.options._pdfDebug += \".\" + element.className.split(\" \").join(\".\");\n // }\n\n if (opacity < 1) {\n group.opacity(opacity * group.opacity());\n }\n\n pushNodeInfo(element, style, group);\n\n if (!tr) {\n _renderWithPseudoElements(element, group);\n }\n else {\n saveStyle(element, function(){\n // must clear transform, so getBoundingClientRect returns correct values.\n pleaseSetPropertyValue(element.style, \"transform\", \"none\", \"important\");\n\n // must also clear transitions, so correct values are returned *immediately*\n pleaseSetPropertyValue(element.style, \"transition\", \"none\", \"important\");\n\n // the presence of any transform makes it behave like it had position: relative,\n // because why not.\n // http://meyerweb.com/eric/thoughts/2011/09/12/un-fixing-fixed-elements-with-css-transforms/\n if (getPropertyValue(style, \"position\") == \"static\") {\n // but only if it's not already positioned. :-/\n pleaseSetPropertyValue(element.style, \"position\", \"relative\", \"important\");\n }\n\n // must translate to origin before applying the CSS\n // transformation, then translate back.\n var bbox = element.getBoundingClientRect();\n var x = bbox.left + tr.origin[0];\n var y = bbox.top + tr.origin[1];\n var m = [ 1, 0, 0, 1, -x, -y ];\n m = mmul(m, tr.matrix);\n m = mmul(m, [ 1, 0, 0, 1, x, y ]);\n m = setTransform(group, m);\n\n nodeInfo._matrix = nodeInfo._matrix.multiplyCopy(m);\n\n _renderWithPseudoElements(element, group);\n });\n }\n\n popNodeInfo();\n\n //drawDebugBox(element.getBoundingClientRect(), container);\n}\n\n// function drawDebugBox(box, group, color) {\n// var path = Path.fromRect(new geo.Rect([ box.left, box.top ], [ box.width, box.height ]));\n// if (color) {\n// path.stroke(color);\n// }\n// group.append(path);\n// }\n\n// function dumpTextNode(node) {\n// var txt = node.data.replace(/^\\s+/, \"\");\n// if (txt.length < 100) {\n// console.log(node.data.length + \": |\" + txt);\n// } else {\n// console.log(node.data.length + \": |\" + txt.substr(0, 50) + \"|...|\" + txt.substr(-50));\n// }\n// }\n\nfunction mmul(a, b) {\n var a1 = a[0], b1 = a[1], c1 = a[2], d1 = a[3], e1 = a[4], f1 = a[5];\n var a2 = b[0], b2 = b[1], c2 = b[2], d2 = b[3], e2 = b[4], f2 = b[5];\n return [\n a1*a2 + b1*c2, a1*b2 + b1*d2,\n c1*a2 + d1*c2, c1*b2 + d1*d2,\n e1*a2 + f1*c2 + e2, e1*b2 + f1*d2 + f2\n ];\n}\n\nexport { drawDOM, drawText, getFontFaces };\n","export default function template() {\n throw new Error(\"Template implementation missing.\");\n}\n","/* eslint-disable no-multi-spaces, key-spacing, indent, camelcase, space-before-blocks, eqeqeq, brace-style */\n/* eslint-disable space-infix-ops, space-before-function-paren, array-bracket-spacing, object-curly-spacing */\n/* eslint-disable no-nested-ternary, max-params, default-case, no-else-return, no-empty */\n/* eslint-disable no-param-reassign, no-var, block-scoped-var */\n\nimport { createPromise } from \"../util\";\nimport { parseColor as utils_parseColor, saveAs as util_saveAs, support } from \"../common\";\nimport * as PDF from \"./core\";\nimport { Group, Path, MultiPath, Gradient, RadialGradient } from '../drawing';\nimport * as geo from \"../geometry\";\n\nconst DEFAULT_IMAGE_DPI = 300;\nconst TEXT_RENDERING_MODE = PDF.TEXT_RENDERING_MODE;\n\nconst DASH_PATTERNS = {\n dash : [ 4 ],\n dashDot : [ 4, 2, 1, 2 ],\n dot : [ 1, 2 ],\n longDash : [ 8, 2 ],\n longDashDot : [ 8, 2, 1, 2 ],\n longDashDotDot : [ 8, 2, 1, 2, 1, 2 ],\n solid : []\n};\n\nconst LINE_CAP = {\n butt : 0,\n round : 1,\n square : 2\n};\n\nconst LINE_JOIN = {\n miter : 0,\n round : 1,\n bevel : 2\n};\n\nfunction render(group, callback) {\n var fonts = [], images = {}, options = group.options;\n\n function getOption(name, defval, hash) {\n if (!hash) {\n hash = options;\n }\n if (hash.pdf && hash.pdf[name] != null) {\n return hash.pdf[name];\n }\n return defval;\n }\n\n var multiPage = getOption(\"multiPage\");\n var imgDPI = getOption(\"imgDPI\", DEFAULT_IMAGE_DPI);\n\n PDF.clearImageCache();\n\n group.traverse(function(element){\n dispatch({\n Image: function(element) {\n var url = element.src();\n var size = element.bbox().size;\n if (imgDPI) {\n var prev = images[url];\n size = {\n width: Math.ceil(size.width * imgDPI / 72),\n height: Math.ceil(size.height * imgDPI / 72)\n };\n\n if (prev) {\n size.width = Math.max(prev.width, size.width);\n size.height = Math.max(prev.height, size.height);\n }\n }\n\n images[url] = size;\n },\n Text: function(element) {\n var style = PDF.parseFontDef(element.options.font);\n var url = PDF.getFontURL(style);\n if (fonts.indexOf(url) < 0) {\n fonts.push(url);\n }\n }\n }, element);\n });\n\n function doIt() {\n if (--count > 0) {\n return;\n }\n\n var pdf = new (PDF.Document)({\n producer : getOption(\"producer\"),\n title : getOption(\"title\"),\n author : getOption(\"author\"),\n subject : getOption(\"subject\"),\n keywords : getOption(\"keywords\"),\n creator : getOption(\"creator\"),\n date : getOption(\"date\"),\n\n autoPrint : getOption(\"autoPrint\")\n });\n\n function drawPage(group) {\n var options = group.options;\n\n var tmp = optimize(group);\n var bbox = tmp.bbox;\n group = tmp.root;\n // var tmp, bbox;\n\n var paperSize = getOption(\"paperSize\", getOption(\"paperSize\", \"auto\"), options), addMargin = false;\n if (paperSize == \"auto\") {\n if (bbox) {\n var size = bbox.getSize();\n paperSize = [ size.width, size.height ];\n addMargin = true;\n var origin = bbox.getOrigin();\n tmp = new Group();\n tmp.transform(new geo.Matrix(1, 0, 0, 1, -origin.x, -origin.y));\n tmp.append(group);\n group = tmp;\n }\n else {\n paperSize = \"A4\";\n }\n }\n\n var page;\n page = pdf.addPage({\n paperSize : paperSize,\n margin : getOption(\"margin\", getOption(\"margin\"), options),\n addMargin : addMargin,\n landscape : getOption(\"landscape\", getOption(\"landscape\", false), options)\n });\n drawElement(group, page, pdf);\n }\n\n if (multiPage) {\n group.children.forEach(drawPage);\n } else {\n drawPage(group);\n }\n\n callback(pdf.render(), pdf);\n }\n\n var count = 2;\n PDF.loadFonts(fonts, doIt);\n PDF.loadImages(images, doIt, {\n jpegQuality : getOption(\"jpegQuality\", 0.92),\n keepPNG : getOption(\"keepPNG\", false)\n });\n}\n\nfunction toDataURL(group, callback) {\n render(group, function(data){\n callback(\"data:application/pdf;base64,\" + data.base64());\n });\n}\n\nfunction toBlob(group, callback) {\n render(group, function(data){\n callback(new window.Blob([ data.get() ], { type: \"application/pdf\" }));\n });\n}\n\nfunction saveAs(group, filename, proxy, callback) {\n // XXX: Safari has Blob, but does not support the download attribute\n // so we'd end up converting to dataURL and using the proxy anyway.\n if (window.Blob && !support.browser.safari) {\n toBlob(group, function(blob){\n util_saveAs({ dataURI: blob, fileName: filename });\n if (callback) {\n callback(blob);\n }\n });\n } else {\n toDataURL(group, function(dataURL){\n util_saveAs({ dataURI: dataURL, fileName: filename, proxyURL: proxy });\n if (callback) {\n callback(dataURL);\n }\n });\n }\n}\n\nfunction dispatch(handlers, element) {\n var handler = handlers[element.nodeType];\n if (handler) {\n return handler.call.apply(handler, arguments);\n }\n return element;\n}\n\nfunction drawElement(element, page, pdf) {\n if (element.options._pdfDebug) {\n page.comment(\"BEGIN: \" + element.options._pdfDebug);\n }\n\n var transform = element.transform();\n var opacity = element.opacity();\n\n page.save();\n\n if (opacity != null && opacity < 1) {\n page.setOpacity(opacity);\n }\n\n setStrokeOptions(element, page, pdf);\n setFillOptions(element, page, pdf);\n\n if (transform) {\n var m = transform.matrix();\n page.transform(m.a, m.b, m.c, m.d, m.e, m.f);\n }\n\n setClipping(element, page, pdf);\n\n dispatch({\n Path : drawPath,\n MultiPath : drawMultiPath,\n Circle : drawCircle,\n Arc : drawArc,\n Text : drawText,\n Image : drawImage,\n Group : drawGroup,\n Rect : drawRect\n }, element, page, pdf);\n\n page.restore();\n\n if (element.options._pdfDebug) {\n page.comment(\"END: \" + element.options._pdfDebug);\n }\n}\n\nfunction setStrokeOptions(element, page) {\n var stroke = element.stroke && element.stroke();\n if (!stroke) {\n return;\n }\n\n var color = stroke.color;\n if (color) {\n color = parseColor(color);\n if (color == null) {\n return; // no stroke\n }\n page.setStrokeColor(color.r, color.g, color.b);\n if (color.a != 1) {\n page.setStrokeOpacity(color.a);\n }\n }\n\n var width = stroke.width;\n if (width != null) {\n if (width === 0) {\n return; // no stroke\n }\n page.setLineWidth(width);\n }\n\n var dashType = stroke.dashType;\n if (dashType) {\n page.setDashPattern(DASH_PATTERNS[dashType], 0);\n }\n\n var lineCap = stroke.lineCap;\n if (lineCap) {\n page.setLineCap(LINE_CAP[lineCap]);\n }\n\n var lineJoin = stroke.lineJoin;\n if (lineJoin) {\n page.setLineJoin(LINE_JOIN[lineJoin]);\n }\n\n var opacity = stroke.opacity;\n if (opacity != null) {\n page.setStrokeOpacity(opacity);\n }\n}\n\nfunction setFillOptions(element, page) {\n var fill = element.fill && element.fill();\n if (!fill) {\n return;\n }\n\n if (fill instanceof Gradient) {\n return;\n }\n\n var color = fill.color;\n if (color) {\n color = parseColor(color);\n if (color == null) {\n return; // no fill\n }\n page.setFillColor(color.r, color.g, color.b);\n if (color.a != 1) {\n page.setFillOpacity(color.a);\n }\n }\n\n var opacity = fill.opacity;\n if (opacity != null) {\n page.setFillOpacity(opacity);\n }\n}\n\nfunction setClipping(element, page, pdf) {\n // XXX: only Path supported at the moment.\n var clip = element.clip();\n if (clip) {\n _drawPath(clip, page, pdf);\n page.clip();\n // page.setStrokeColor(Math.random(), Math.random(), Math.random());\n // page.setLineWidth(1);\n // page.stroke();\n }\n}\n\nfunction shouldDraw(thing) {\n return (thing &&\n (thing instanceof Gradient ||\n (thing.color && !/^(none|transparent)$/i.test(thing.color) &&\n (thing.width == null || thing.width > 0) &&\n (thing.opacity == null || thing.opacity > 0))));\n}\n\nfunction maybeGradient(element, page, pdf, stroke) {\n var fill = element.fill();\n if (fill instanceof Gradient) {\n if (stroke) {\n page.clipStroke();\n } else {\n page.clip();\n }\n var isRadial = fill instanceof RadialGradient;\n var start, end;\n if (isRadial) {\n start = { x: fill.center().x , y: fill.center().y , r: 0 };\n end = { x: fill.center().x , y: fill.center().y , r: fill.radius() };\n } else {\n start = { x: fill.start().x , y: fill.start().y };\n end = { x: fill.end().x , y: fill.end().y };\n }\n\n var stops = fill.stops.elements().map(function(stop){\n var offset = stop.offset();\n if (/%$/.test(offset)) {\n offset = parseFloat(offset) / 100;\n } else {\n offset = parseFloat(offset);\n }\n var color = parseColor(stop.color());\n color.a *= stop.opacity();\n return {\n offset: offset,\n color: color\n };\n });\n\n // Duplicats first and last stop to fix\n // https://github.com/telerik/kendo-ui-core/issues/1782\n stops.unshift(stops[0]);\n stops.push(stops[stops.length - 1]);\n\n var gradient = {\n userSpace : fill.userSpace(),\n type : isRadial ? \"radial\" : \"linear\",\n start : start,\n end : end,\n stops : stops\n };\n var box = element.rawBBox();\n var tl = box.topLeft(), size = box.getSize();\n box = {\n left : tl.x,\n top : tl.y,\n width : size.width,\n height : size.height\n };\n page.gradient(gradient, box);\n return true;\n }\n}\n\nfunction maybeFillStroke(element, page, pdf) {\n if (shouldDraw(element.fill()) && shouldDraw(element.stroke())) {\n if (!maybeGradient(element, page, pdf, true)) {\n page.fillStroke();\n }\n } else if (shouldDraw(element.fill())) {\n if (!maybeGradient(element, page, pdf, false)) {\n page.fill();\n }\n } else if (shouldDraw(element.stroke())) {\n page.stroke();\n } else {\n // we should not get here; the path should have been\n // optimized away. but let's be prepared.\n page.nop();\n }\n}\n\nfunction maybeDrawRect(path, page) {\n var segments = path.segments;\n if (segments.length == 4 && path.options.closed) {\n // detect if this path looks like a rectangle parallel to the axis\n var a = [];\n for (var i = 0; i < segments.length; ++i) {\n if (segments[i].controlIn()) { // has curve?\n return false;\n }\n a[i] = segments[i].anchor();\n }\n // it's a rectangle if the y/x/y/x or x/y/x/y coords of\n // consecutive points are the same.\n var isRect = (\n a[0].y == a[1].y && a[1].x == a[2].x && a[2].y == a[3].y && a[3].x == a[0].x\n ) || (\n a[0].x == a[1].x && a[1].y == a[2].y && a[2].x == a[3].x && a[3].y == a[0].y\n );\n if (isRect) {\n // this saves a bunch of instructions in PDF:\n // moveTo, lineTo, lineTo, lineTo, close -> rect.\n page.rect(a[0].x, a[0].y,\n a[2].x - a[0].x /*width*/,\n a[2].y - a[0].y /*height*/);\n return true;\n }\n }\n}\n\nfunction _drawPath(element, page, pdf) {\n var segments = element.segments;\n if (segments.length === 0) {\n return;\n }\n if (!maybeDrawRect(element, page, pdf)) {\n for (var prev, i = 0; i < segments.length; ++i) {\n var seg = segments[i];\n var anchor = seg.anchor();\n if (!prev) {\n page.moveTo(anchor.x, anchor.y);\n } else {\n var prevOut = prev.controlOut();\n var controlIn = seg.controlIn();\n if (prevOut && controlIn) {\n page.bezier(\n prevOut.x , prevOut.y,\n controlIn.x , controlIn.y,\n anchor.x , anchor.y\n );\n } else {\n page.lineTo(anchor.x, anchor.y);\n }\n }\n prev = seg;\n }\n if (element.options.closed) {\n page.close();\n }\n }\n}\n\nfunction drawPath(element, page, pdf) {\n _drawPath(element, page, pdf);\n maybeFillStroke(element, page, pdf);\n}\n\nfunction drawMultiPath(element, page, pdf) {\n var paths = element.paths;\n for (var i = 0; i < paths.length; ++i) {\n _drawPath(paths[i], page, pdf);\n }\n maybeFillStroke(element, page, pdf);\n}\n\nfunction drawCircle(element, page, pdf) {\n var g = element.geometry();\n page.circle(g.center.x, g.center.y, g.radius);\n maybeFillStroke(element, page, pdf);\n}\n\nfunction drawArc(element, page, pdf) {\n var points = element.geometry().curvePoints();\n page.moveTo(points[0].x, points[0].y);\n for (var i = 1; i < points.length;) {\n page.bezier(\n points[i].x, points[i++].y,\n points[i].x, points[i++].y,\n points[i].x, points[i++].y\n );\n }\n maybeFillStroke(element, page, pdf);\n}\n\nfunction drawText(element, page) {\n var style = PDF.parseFontDef(element.options.font);\n var pos = element._position;\n var mode;\n if (element.fill() && element.stroke()) {\n mode = TEXT_RENDERING_MODE.fillAndStroke;\n } else if (element.fill()) {\n mode = TEXT_RENDERING_MODE.fill;\n } else if (element.stroke()) {\n mode = TEXT_RENDERING_MODE.stroke;\n }\n\n page.transform(1, 0, 0, -1, pos.x, pos.y + style.fontSize);\n page.beginText();\n page.setFont(PDF.getFontURL(style), style.fontSize);\n page.setTextRenderingMode(mode);\n page.showText(element.content(), element._pdfRect ? element._pdfRect.width() : null);\n page.endText();\n}\n\nfunction drawGroup(element, page, pdf) {\n if (element._pdfLink) {\n page.addLink(element._pdfLink.url, element._pdfLink);\n }\n var children = element.children;\n for (var i = 0; i < children.length; ++i) {\n drawElement(children[i], page, pdf);\n }\n}\n\nfunction drawImage(element, page) {\n var url = element.src();\n if (!url) {\n return;\n }\n\n var rect = element.rect();\n var tl = rect.getOrigin();\n var sz = rect.getSize();\n page.transform(sz.width, 0, 0, -sz.height, tl.x, tl.y + sz.height);\n page.drawImage(url);\n}\n\nfunction drawRect(element, page, pdf) {\n var geometry = element.geometry();\n const [ rx, ry ] = geometry.cornerRadius;\n if (rx === 0 && ry === 0) {\n page.rect(geometry.origin.x, geometry.origin.y, geometry.size.width, geometry.size.height);\n maybeFillStroke(element, page, pdf);\n } else {\n drawPath(Path.fromRect(geometry, element.options), page, pdf);\n }\n}\n\nfunction parseColor(value) {\n var color = utils_parseColor(value, true);\n return color ? color.toRGB() : null;\n}\n\nfunction optimize(root) {\n var clipbox = false;\n var matrix = geo.Matrix.unit();\n var currentBox = null;\n var changed;\n do {\n changed = false;\n root = opt(root);\n } while (root && changed);\n return { root: root, bbox: currentBox };\n\n function change(newShape) {\n changed = true;\n return newShape;\n }\n\n function visible(shape) {\n return (shape.visible() && shape.opacity() > 0 &&\n ( shouldDraw(shape.fill()) ||\n shouldDraw(shape.stroke()) ));\n }\n\n function optArray(a) {\n var b = [];\n for (var i = 0; i < a.length; ++i) {\n var el = opt(a[i]);\n if (el != null) {\n b.push(el);\n }\n }\n return b;\n }\n\n function withClipping(shape, f) {\n var saveclipbox = clipbox;\n var savematrix = matrix;\n\n if (shape.transform()) {\n matrix = matrix.multiplyCopy(shape.transform().matrix());\n }\n\n var clip = shape.clip();\n if (clip) {\n clip = clip.bbox();\n if (clip) {\n clip = clip.bbox(matrix);\n clipbox = clipbox ? geo.Rect.intersect(clipbox, clip) : clip;\n }\n }\n\n try {\n return f();\n }\n finally {\n clipbox = saveclipbox;\n matrix = savematrix;\n }\n }\n\n function inClipbox(shape) {\n if (clipbox == null) {\n return false;\n }\n var box = shape.rawBBox().bbox(matrix);\n if (clipbox && box) {\n box = geo.Rect.intersect(box, clipbox);\n }\n return box;\n }\n\n function opt(shape) {\n return withClipping(shape, function(){\n if (!(shape instanceof Group || shape instanceof MultiPath)) {\n var box = inClipbox(shape);\n if (!box) {\n return change(null);\n }\n currentBox = currentBox ? geo.Rect.union(currentBox, box) : box;\n }\n return dispatch({\n Path: function(shape) {\n if (shape.segments.length === 0 || !visible(shape)) {\n return change(null);\n }\n return shape;\n },\n MultiPath: function(shape) {\n if (!visible(shape)) {\n return change(null);\n }\n var el = new MultiPath(shape.options);\n el.paths = optArray(shape.paths);\n if (el.paths.length === 0) {\n return change(null);\n }\n return el;\n },\n Circle: function(shape) {\n if (!visible(shape)) {\n return change(null);\n }\n return shape;\n },\n Arc: function(shape) {\n if (!visible(shape)) {\n return change(null);\n }\n return shape;\n },\n Text: function(shape) {\n if (!/\\S/.test(shape.content()) || !visible(shape)) {\n return change(null);\n }\n return shape;\n },\n Image: function(shape) {\n if (!(shape.visible() && shape.opacity() > 0)) {\n return change(null);\n }\n return shape;\n },\n Group: function(shape) {\n if (!(shape.visible() && shape.opacity() > 0)) {\n return change(null);\n }\n var el = new Group(shape.options);\n el.children = optArray(shape.children);\n el._pdfLink = shape._pdfLink;\n if (shape !== root && el.children.length === 0 && !shape._pdfLink) {\n return change(null);\n }\n return el;\n },\n Rect: function(shape) {\n if (!visible(shape)) {\n return change(null);\n }\n return shape;\n }\n }, shape);\n });\n }\n}\n\nfunction exportPDF(group, options) {\n var promise = createPromise();\n\n for (var i in options) {\n if (i == \"margin\" && group.options.pdf && group.options.pdf._ignoreMargin) {\n // This hackish option is set by the page breaking code in drawDOM. The idea is\n // that margin is already taken into account there (that's required to do proper\n // page breaking) and we don't want to set it again here, as it would double the\n // top-left margin, and truncate the content on bottom/right.\n continue;\n }\n group.options.set(\"pdf.\" + i, options[i]);\n }\n\n toDataURL(group, promise.resolve);\n\n return promise;\n}\n\n// XXX: the duplication is in order to keep exportPDF return a data\n// URI, which is what previous versions do. Currently only IE9 does\n// not support Blob, IMO we should switch to Blob by default\n// everywhere.\nfunction exportPDFToBlob(group, options) {\n var promise = createPromise();\n\n for (var i in options) {\n if (i == \"margin\" && group.options.pdf && group.options.pdf._ignoreMargin) {\n // This hackish option is set by the page breaking code in drawDOM. The idea is\n // that margin is already taken into account there (that's required to do proper\n // page breaking) and we don't want to set it again here, as it would double the\n // top-left margin, and truncate the content on bottom/right.\n continue;\n }\n group.options.set(\"pdf.\" + i, options[i]);\n }\n\n if (window.Blob && !support.browser.safari) {\n toBlob(group, promise.resolve);\n } else {\n toDataURL(group, promise.resolve);\n }\n\n return promise;\n}\n\n\nexport { exportPDF, exportPDFToBlob, saveAs, toDataURL, toBlob, render };\n","export function saveAs(data, fileName, options = {}) {\n let save = postToProxy;\n\n if (options.forceProxy && !options.proxyURL) {\n throw new Error('No proxyURL is set, but forceProxy is true');\n }\n\n if (!options.forceProxy) {\n if (canDownload()) {\n save = saveAsDataURI;\n }\n\n if (navigator.msSaveBlob) {\n save = saveAsBlob;\n }\n }\n\n save(data, fileName, options);\n}\n\nconst anchor = () => document.createElement('a');\nconst canDownload = () => 'download' in anchor();\n\nfunction saveAsBlob(data, fileName) {\n let blob = data; // could be a Blob object\n\n if (typeof data === 'string') {\n const parts = data.split(';base64,');\n const contentType = parts[0];\n const base64 = atob(parts[1]);\n const array = new Uint8Array(base64.length);\n\n for (let idx = 0; idx < base64.length; idx++) {\n array[idx] = base64.charCodeAt(idx);\n }\n\n blob = new Blob([ array.buffer ], { type: contentType });\n }\n\n navigator.msSaveBlob(blob, fileName);\n}\n\nfunction saveAsDataURI(data, fileName) {\n let dataURI = data;\n if (window.Blob && data instanceof Blob) {\n dataURI = URL.createObjectURL(data);\n }\n\n const fileSaver = anchor();\n fileSaver.download = fileName;\n fileSaver.href = dataURI;\n\n const e = document.createEvent('MouseEvents');\n e.initMouseEvent('click', true, false, window,\n 0, 0, 0, 0, 0, false, false, false, false, 0, null);\n\n fileSaver.dispatchEvent(e);\n setTimeout(() => URL.revokeObjectURL(dataURI));\n}\n\nfunction postToProxy(dataURI, fileName, options) {\n if (!options.proxyURL) {\n return;\n }\n\n const form = document.createElement('form');\n form.setAttribute('action', options.proxyURL);\n form.setAttribute('method', 'POST');\n form.setAttribute('target', options.proxyTarget || '_self');\n\n const formData = options.proxyData || {};\n formData.fileName = fileName;\n\n const parts = dataURI.split(\";base64,\");\n formData.contentType = parts[0].replace(\"data:\", \"\");\n formData.base64 = parts[1];\n\n for (let name in formData) {\n if (formData.hasOwnProperty(name)) {\n const input = document.createElement('input');\n input.setAttribute('type', 'hidden');\n input.setAttribute('name', name);\n input.setAttribute('value', formData[name]);\n\n form.appendChild(input);\n }\n }\n\n document.body.appendChild(form);\n form.submit();\n document.body.removeChild(form);\n}\n\n","/**-----------------------------------------------------------------------------------------\n* Copyright © 2021 Progress Software Corporation. All rights reserved.\n* Licensed under commercial license. See LICENSE.md in the project root for more information\n*-------------------------------------------------------------------------------------------*/\nimport { __decorate, __param, __metadata } from 'tslib';\nimport { Directive, Optional, TemplateRef, Input, Component, ContentChild, ElementRef, NgModule } from '@angular/core';\nimport { drawDOM, exportPDF } from '@progress/kendo-drawing';\nimport { saveAs } from '@progress/kendo-file-saver';\nimport { validatePackage } from '@progress/kendo-licensing';\n\n/**\n * @hidden\n */\nimport * as ɵngcc0 from '@angular/core';\n\nconst _c0 = [\"*\"];\nconst packageMetadata = {\n name: '@progress/kendo-angular-pdf-export',\n productName: 'Kendo UI for Angular',\n productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],\n publishDate: 1646219273,\n version: '',\n licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'\n};\n\nlet PDFExportTemplateDirective = class PDFExportTemplateDirective {\n constructor(templateRef) {\n this.templateRef = templateRef;\n }\n};\nPDFExportTemplateDirective.ɵfac = function PDFExportTemplateDirective_Factory(t) { return new (t || PDFExportTemplateDirective)(ɵngcc0.ɵɵdirectiveInject(ɵngcc0.TemplateRef, 8)); };\nPDFExportTemplateDirective.ɵdir = /*@__PURE__*/ ɵngcc0.ɵɵdefineDirective({ type: PDFExportTemplateDirective, selectors: [[\"\", \"kendoPDFTemplate\", \"\"]] });\nPDFExportTemplateDirective = __decorate([ __param(0, Optional()),\n __metadata(\"design:paramtypes\", [TemplateRef])\n], PDFExportTemplateDirective);\n\nconst FIELDS = ['bottom', 'left', 'right', 'top'];\n/**\n * Represents the Kendo UI PDFMargin component for Angular.\n */\nlet PDFExportMarginComponent = class PDFExportMarginComponent {\n /**\n * @hidden\n */\n get options() {\n const options = {};\n for (let idx = 0; idx < FIELDS.length; idx++) {\n const field = FIELDS[idx];\n const value = this[field];\n if (typeof value !== 'undefined') {\n options[field] = value;\n }\n }\n return options;\n }\n};\nPDFExportMarginComponent.ɵfac = function PDFExportMarginComponent_Factory(t) { return new (t || PDFExportMarginComponent)(); };\nPDFExportMarginComponent.ɵcmp = /*@__PURE__*/ ɵngcc0.ɵɵdefineComponent({ type: PDFExportMarginComponent, selectors: [[\"kendo-pdf-export-margin\"]], inputs: { left: \"left\", top: \"top\", right: \"right\", bottom: \"bottom\" }, decls: 0, vars: 0, template: function PDFExportMarginComponent_Template(rf, ctx) { }, encapsulation: 2 });\n__decorate([\n Input(),\n __metadata(\"design:type\", Object)\n], PDFExportMarginComponent.prototype, \"left\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", Object)\n], PDFExportMarginComponent.prototype, \"top\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", Object)\n], PDFExportMarginComponent.prototype, \"right\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", Object)\n], PDFExportMarginComponent.prototype, \"bottom\", void 0);\n\n/**\n * @hidden\n */\nconst compileTemplate = (templateRef) => {\n const context = {};\n let embeddedView = templateRef.createEmbeddedView(context);\n const result = (data) => {\n Object.assign(context, data);\n embeddedView.detectChanges();\n const templateWrap = document.createElement('span');\n embeddedView.rootNodes.forEach((rootNode) => {\n templateWrap.appendChild(rootNode.cloneNode(true));\n });\n return templateWrap;\n };\n result.destroy = () => {\n embeddedView.destroy();\n embeddedView = null;\n };\n return result;\n};\n\n/**\n * Represents the [Kendo UI PDF Export component for Angular]({% slug overview_pdfexport %}).\n *\n * @example\n * ```ts-preview\n * _@Component({\n * selector: 'my-app',\n * template: `\n *
    \n * \n *
    \n *\n * \n * Content goes here\n * \n * `\n * })\n * export class AppComponent {\n * }\n * ```\n */\nlet PDFExportComponent = class PDFExportComponent {\n constructor(element) {\n this.element = element;\n /**\n * The creator of the PDF document.\n * @default \"Kendo UI PDF Generator\"\n */\n this.creator = 'Kendo UI PDF Generator';\n /**\n * Specifies the name of the exported PDF file.\n * @default \"Export.pdf\"\n */\n this.fileName = 'export.pdf';\n validatePackage(packageMetadata);\n }\n get drawMargin() {\n const marginComponent = this.marginComponent;\n let margin = this.margin;\n if (marginComponent) {\n margin = Object.assign(margin || {}, marginComponent.options);\n }\n return margin;\n }\n /**\n * Saves the content as a PDF file with the specified name.\n * @param fileName - The name of the exported file.\n */\n saveAs(fileName = this.fileName) {\n this.save(this.element.nativeElement, fileName);\n }\n /**\n * Exports the content as a `Group` for further processing.\n *\n * @return - The root group of the exported scene.\n */\n export() {\n return this.exportElement(this.element.nativeElement);\n }\n save(element, fileName) {\n this.exportElement(element)\n .then(group => this.exportGroup(group, this.pdfOptions()))\n .then(dataUri => this.saveDataUri(dataUri, fileName, this.saveOptions()));\n }\n exportElement(element) {\n const promise = this.drawElement(element, this.drawOptions());\n const cleanup = this.cleanup.bind(this);\n promise.then(cleanup, cleanup);\n return promise;\n }\n cleanup() {\n if (this.pageTemplate) {\n this.pageTemplate.destroy();\n delete this.pageTemplate;\n }\n }\n drawOptions() {\n if (this.pageTemplateDirective) {\n this.pageTemplate = compileTemplate(this.pageTemplateDirective.templateRef);\n }\n return {\n avoidLinks: this.avoidLinks,\n forcePageBreak: this.forcePageBreak,\n keepTogether: this.keepTogether,\n margin: this.drawMargin,\n paperSize: this.paperSize,\n landscape: this.landscape,\n repeatHeaders: this.repeatHeaders,\n scale: this.scale,\n template: this.pageTemplate\n };\n }\n pdfOptions() {\n return {\n autoPrint: this.autoPrint,\n author: this.author,\n creator: this.creator,\n date: this.date,\n imgDPI: this.imageResolution,\n keywords: this.keywords,\n landscape: this.landscape,\n margin: this.drawMargin,\n multiPage: true,\n paperSize: this.paperSize,\n producer: this.producer,\n subject: this.subject,\n title: this.title\n };\n }\n saveOptions() {\n return {\n forceProxy: this.forceProxy,\n proxyData: this.proxyData,\n proxyTarget: this.proxyTarget,\n proxyURL: this.proxyURL\n };\n }\n drawElement(element, options) {\n return drawDOM(element, options);\n }\n exportGroup(group, options) {\n return exportPDF(group, options);\n }\n saveDataUri(dataUri, fileName, options) {\n saveAs(dataUri, fileName, options);\n }\n};\nPDFExportComponent.ɵfac = function PDFExportComponent_Factory(t) { return new (t || PDFExportComponent)(ɵngcc0.ɵɵdirectiveInject(ɵngcc0.ElementRef)); };\nPDFExportComponent.ɵcmp = /*@__PURE__*/ ɵngcc0.ɵɵdefineComponent({ type: PDFExportComponent, selectors: [[\"kendo-pdf-export\"]], contentQueries: function PDFExportComponent_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) {\n ɵngcc0.ɵɵcontentQuery(dirIndex, PDFExportTemplateDirective, 5);\n ɵngcc0.ɵɵcontentQuery(dirIndex, PDFExportMarginComponent, 5);\n } if (rf & 2) {\n let _t;\n ɵngcc0.ɵɵqueryRefresh(_t = ɵngcc0.ɵɵloadQuery()) && (ctx.pageTemplateDirective = _t.first);\n ɵngcc0.ɵɵqueryRefresh(_t = ɵngcc0.ɵɵloadQuery()) && (ctx.marginComponent = _t.first);\n } }, inputs: { creator: \"creator\", fileName: \"fileName\", autoPrint: \"autoPrint\", author: \"author\", avoidLinks: \"avoidLinks\", forcePageBreak: \"forcePageBreak\", keepTogether: \"keepTogether\", date: \"date\", imageResolution: \"imageResolution\", forceProxy: \"forceProxy\", keywords: \"keywords\", landscape: \"landscape\", margin: \"margin\", paperSize: \"paperSize\", repeatHeaders: \"repeatHeaders\", scale: \"scale\", proxyData: \"proxyData\", proxyURL: \"proxyURL\", proxyTarget: \"proxyTarget\", producer: \"producer\", subject: \"subject\", title: \"title\" }, ngContentSelectors: _c0, decls: 2, vars: 0, template: function PDFExportComponent_Template(rf, ctx) { if (rf & 1) {\n ɵngcc0.ɵɵprojectionDef();\n ɵngcc0.ɵɵelementStart(0, \"div\");\n ɵngcc0.ɵɵprojection(1);\n ɵngcc0.ɵɵelementEnd();\n } }, encapsulation: 2 });\n__decorate([\n Input(),\n __metadata(\"design:type\", Boolean)\n], PDFExportComponent.prototype, \"autoPrint\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", String)\n], PDFExportComponent.prototype, \"author\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", Object)\n], PDFExportComponent.prototype, \"avoidLinks\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", String)\n], PDFExportComponent.prototype, \"forcePageBreak\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", String)\n], PDFExportComponent.prototype, \"keepTogether\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", String)\n], PDFExportComponent.prototype, \"creator\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", Date)\n], PDFExportComponent.prototype, \"date\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", Number)\n], PDFExportComponent.prototype, \"imageResolution\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", String)\n], PDFExportComponent.prototype, \"fileName\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", Boolean)\n], PDFExportComponent.prototype, \"forceProxy\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", String)\n], PDFExportComponent.prototype, \"keywords\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", Boolean)\n], PDFExportComponent.prototype, \"landscape\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", Object)\n], PDFExportComponent.prototype, \"margin\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", Object)\n], PDFExportComponent.prototype, \"paperSize\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", Boolean)\n], PDFExportComponent.prototype, \"repeatHeaders\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", Number)\n], PDFExportComponent.prototype, \"scale\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", Object)\n], PDFExportComponent.prototype, \"proxyData\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", String)\n], PDFExportComponent.prototype, \"proxyURL\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", String)\n], PDFExportComponent.prototype, \"proxyTarget\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", String)\n], PDFExportComponent.prototype, \"producer\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", String)\n], PDFExportComponent.prototype, \"subject\", void 0);\n__decorate([\n Input(),\n __metadata(\"design:type\", String)\n], PDFExportComponent.prototype, \"title\", void 0);\n__decorate([\n ContentChild(PDFExportTemplateDirective, { static: false }),\n __metadata(\"design:type\", PDFExportTemplateDirective)\n], PDFExportComponent.prototype, \"pageTemplateDirective\", void 0);\n__decorate([\n ContentChild(PDFExportMarginComponent, { static: false }),\n __metadata(\"design:type\", PDFExportMarginComponent)\n], PDFExportComponent.prototype, \"marginComponent\", void 0);\nPDFExportComponent = __decorate([ __metadata(\"design:paramtypes\", [ElementRef])\n], PDFExportComponent);\n\nconst COMPONENT_DIRECTIVES = [\n PDFExportComponent,\n PDFExportMarginComponent,\n PDFExportTemplateDirective\n];\n/**\n * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }}) definition for the PDF Export directive.\n */\nlet PDFExportModule = class PDFExportModule {\n};\nPDFExportModule.ɵfac = function PDFExportModule_Factory(t) { return new (t || PDFExportModule)(); };\nPDFExportModule.ɵmod = /*@__PURE__*/ ɵngcc0.ɵɵdefineNgModule({ type: PDFExportModule });\nPDFExportModule.ɵinj = /*@__PURE__*/ ɵngcc0.ɵɵdefineInjector({});\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(PDFExportTemplateDirective, [{\n type: Directive,\n args: [{\n selector: '[kendoPDFTemplate]'\n }]\n }], function () { return [{ type: ɵngcc0.TemplateRef, decorators: [{\n type: Optional\n }] }]; }, null); })();\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(PDFExportMarginComponent, [{\n type: Component,\n args: [{\n selector: 'kendo-pdf-export-margin',\n template: ``\n }]\n }], null, { left: [{\n type: Input\n }], top: [{\n type: Input\n }], right: [{\n type: Input\n }], bottom: [{\n type: Input\n }] }); })();\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(PDFExportComponent, [{\n type: Component,\n args: [{\n selector: 'kendo-pdf-export',\n template: `
    `\n }]\n }], function () { return [{ type: ɵngcc0.ElementRef }]; }, { creator: [{\n type: Input\n }], fileName: [{\n type: Input\n }], autoPrint: [{\n type: Input\n }], author: [{\n type: Input\n }], avoidLinks: [{\n type: Input\n }], forcePageBreak: [{\n type: Input\n }], keepTogether: [{\n type: Input\n }], date: [{\n type: Input\n }], imageResolution: [{\n type: Input\n }], forceProxy: [{\n type: Input\n }], keywords: [{\n type: Input\n }], landscape: [{\n type: Input\n }], margin: [{\n type: Input\n }], paperSize: [{\n type: Input\n }], repeatHeaders: [{\n type: Input\n }], scale: [{\n type: Input\n }], proxyData: [{\n type: Input\n }], proxyURL: [{\n type: Input\n }], proxyTarget: [{\n type: Input\n }], producer: [{\n type: Input\n }], subject: [{\n type: Input\n }], title: [{\n type: Input\n }], pageTemplateDirective: [{\n type: ContentChild,\n args: [PDFExportTemplateDirective, { static: false }]\n }], marginComponent: [{\n type: ContentChild,\n args: [PDFExportMarginComponent, { static: false }]\n }] }); })();\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(PDFExportModule, [{\n type: NgModule,\n args: [{\n declarations: [COMPONENT_DIRECTIVES],\n exports: [COMPONENT_DIRECTIVES]\n }]\n }], null, null); })();\n(function () { (typeof ngJitMode === \"undefined\" || ngJitMode) && ɵngcc0.ɵɵsetNgModuleScope(PDFExportModule, { declarations: [PDFExportComponent, PDFExportMarginComponent, PDFExportTemplateDirective], exports: [PDFExportComponent, PDFExportMarginComponent, PDFExportTemplateDirective] }); })();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { PDFExportComponent, PDFExportModule, PDFExportMarginComponent, PDFExportTemplateDirective, compileTemplate };\n\n"]}