diff --git "a/Pages/streamlit_img_label/frontend/build/static/js/2.b19543fd.chunk.js" "b/Pages/streamlit_img_label/frontend/build/static/js/2.b19543fd.chunk.js" new file mode 100644--- /dev/null +++ "b/Pages/streamlit_img_label/frontend/build/static/js/2.b19543fd.chunk.js" @@ -0,0 +1,3 @@ +/*! For license information please see 2.b19543fd.chunk.js.LICENSE.txt */ +(this.webpackJsonpstreamlit_img_label=this.webpackJsonpstreamlit_img_label||[]).push([[2],[function(t,e,n){t.exports=n(21)},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(9);var i=n(7);function o(t){return function(t){if(Array.isArray(t))return Object(r.a)(t)}(t)||function(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||Object(i.a)(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(7);function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t)){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(u){i=!0,o=u}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}}(t,e)||Object(r.a)(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(5);function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e0,i.isLikelyNode="undefined"!==typeof t&&"undefined"===typeof window,i.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"],i.DPI=96,i.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",i.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,i.reNonWord=/[ \n\.,;!\?\-]/,i.fontPaths={},i.iMatrix=[1,0,0,1,0,0],i.svgNS="http://www.w3.org/2000/svg",i.perfLimitSizeTotal=2097152,i.maxCacheSideLimit=4096,i.minCacheSideLimit=256,i.charWidthsCache={},i.textureSize=2048,i.disableStyleCopyPaste=!1,i.enableGLFiltering=!0,i.devicePixelRatio=i.window.devicePixelRatio||i.window.webkitDevicePixelRatio||i.window.mozDevicePixelRatio||1,i.browserShadowBlurConstant=1,i.arcToSegmentsCache={},i.boundsOfCurveCache={},i.cachesBoundsOfCurve=!0,i.forceGLPutImageData=!1,i.initFilterBackend=function(){return i.enableGLFiltering&&i.isWebglSupported&&i.isWebglSupported(i.textureSize)?(console.log("max texture size: "+i.maxTextureSize),new i.WebglFilterBackend({tileSize:i.textureSize})):i.Canvas2dFilterBackend?new i.Canvas2dFilterBackend:void 0},"undefined"!==typeof document&&"undefined"!==typeof window&&(window.fabric=i),function(){function t(t,e){if(this.__eventListeners[t]){var n=this.__eventListeners[t];e?n[n.indexOf(e)]=!1:i.util.array.fill(n,!1)}}function e(t,e){if(this.__eventListeners||(this.__eventListeners={}),1===arguments.length)for(var n in t)this.on(n,t[n]);else this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e);return this}function n(e,n){if(!this.__eventListeners)return this;if(0===arguments.length)for(e in this.__eventListeners)t.call(this,e);else if(1===arguments.length&&"object"===typeof arguments[0])for(var r in e)t.call(this,r,e[r]);else t.call(this,e,n);return this}function r(t,e){if(!this.__eventListeners)return this;var n=this.__eventListeners[t];if(!n)return this;for(var r=0,i=n.length;r-1},complexity:function(){return this._objects.reduce((function(t,e){return t+=e.complexity?e.complexity():0}),0)}},i.CommonMethods={_setOptions:function(t){for(var e in t)this.set(e,t[e])},_initGradient:function(t,e){!t||!t.colorStops||t instanceof i.Gradient||this.set(e,new i.Gradient(t))},_initPattern:function(t,e,n){!t||!t.source||t instanceof i.Pattern?n&&n():this.set(e,new i.Pattern(t,n))},_initClipping:function(t){if(t.clipTo&&"string"===typeof t.clipTo){var e=i.util.getFunctionBody(t.clipTo);"undefined"!==typeof e&&(this.clipTo=new Function("ctx",e))}},_setObject:function(t){for(var e in t)this._set(e,t[e])},set:function(t,e){return"object"===typeof t?this._setObject(t):"function"===typeof e&&"clipTo"!==t?this._set(t,e(this.get(t))):this._set(t,e),this},_set:function(t,e){this[t]=e},toggle:function(t){var e=this.get(t);return"boolean"===typeof e&&this.set(t,!e),this},get:function(t){return this[t]}},function(t){var e=Math.sqrt,n=Math.atan2,r=Math.pow,o=Math.PI/180,a=Math.PI/2;i.util={cos:function(t){if(0===t)return 1;switch(t<0&&(t=-t),t/a){case 1:case 3:return 0;case 2:return-1}return Math.cos(t)},sin:function(t){if(0===t)return 0;var e=1;switch(t<0&&(e=-1),t/a){case 1:return e;case 2:return 0;case 3:return-e}return Math.sin(t)},removeFromArray:function(t,e){var n=t.indexOf(e);return-1!==n&&t.splice(n,1),t},getRandomInt:function(t,e){return Math.floor(Math.random()*(e-t+1))+t},degreesToRadians:function(t){return t*o},radiansToDegrees:function(t){return t/o},rotatePoint:function(t,e,n){t.subtractEquals(e);var r=i.util.rotateVector(t,n);return new i.Point(r.x,r.y).addEquals(e)},rotateVector:function(t,e){var n=i.util.sin(e),r=i.util.cos(e);return{x:t.x*r-t.y*n,y:t.x*n+t.y*r}},transformPoint:function(t,e,n){return n?new i.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new i.Point(e[0]*t.x+e[2]*t.y+e[4],e[1]*t.x+e[3]*t.y+e[5])},makeBoundingBoxFromPoints:function(t,e){if(e)for(var n=0;nr;)(r+=s[d++%f])>l&&(r=l),t[p?"lineTo":"moveTo"](r,0),p=!p;t.restore()},createCanvasElement:function(){return i.document.createElement("canvas")},copyCanvasElement:function(t){var e=i.util.createCanvasElement();return e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0),e},toDataURL:function(t,e,n){return t.toDataURL("image/"+e,n)},createImage:function(){return i.document.createElement("img")},clipContext:function(t,e){e.save(),e.beginPath(),t.clipTo(e),e.clip()},multiplyTransformMatrices:function(t,e,n){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],n?0:t[0]*e[4]+t[2]*e[5]+t[4],n?0:t[1]*e[4]+t[3]*e[5]+t[5]]},qrDecompose:function(t){var i=n(t[1],t[0]),a=r(t[0],2)+r(t[1],2),s=e(a),u=(t[0]*t[3]-t[2]*t[1])/s,c=n(t[0]*t[2]+t[1]*t[3],a);return{angle:i/o,scaleX:s,scaleY:u,skewX:c/o,skewY:0,translateX:t[4],translateY:t[5]}},calcRotateMatrix:function(t){if(!t.angle)return i.iMatrix.concat();var e=i.util.degreesToRadians(t.angle),n=i.util.cos(e),r=i.util.sin(e);return[n,r,-r,n,0,0]},calcDimensionsMatrix:function(t){var e="undefined"===typeof t.scaleX?1:t.scaleX,n="undefined"===typeof t.scaleY?1:t.scaleY,r=[t.flipX?-e:e,0,0,t.flipY?-n:n,0,0],o=i.util.multiplyTransformMatrices,a=i.util.degreesToRadians;return t.skewX&&(r=o(r,[1,0,Math.tan(a(t.skewX)),1],!0)),t.skewY&&(r=o(r,[1,Math.tan(a(t.skewY)),0,1],!0)),r},composeMatrix:function(t){var e=[1,0,0,1,t.translateX||0,t.translateY||0],n=i.util.multiplyTransformMatrices;return t.angle&&(e=n(e,i.util.calcRotateMatrix(t))),(t.scaleX||t.scaleY||t.skewX||t.skewY||t.flipX||t.flipY)&&(e=n(e,i.util.calcDimensionsMatrix(t))),e},customTransformMatrix:function(t,e,n){return i.util.composeMatrix({scaleX:t,scaleY:e,skewX:n})},resetObjectTransform:function(t){t.scaleX=1,t.scaleY=1,t.skewX=0,t.skewY=0,t.flipX=!1,t.flipY=!1,t.rotate(0)},saveObjectTransform:function(t){return{scaleX:t.scaleX,scaleY:t.scaleY,skewX:t.skewX,skewY:t.skewY,angle:t.angle,left:t.left,flipX:t.flipX,flipY:t.flipY,top:t.top}},getFunctionBody:function(t){return(String(t).match(/function[^{]*\{([\s\S]*)\}/)||{})[1]},isTransparent:function(t,e,n,r){r>0&&(e>r?e-=r:e=0,n>r?n-=r:n=0);var i,o=!0,a=t.getImageData(e,n,2*r||1,2*r||1),s=a.data.length;for(i=3;i0?P-=2*f:1===c&&P<0&&(P+=2*f);for(var M=Math.ceil(Math.abs(P/f*2)),B=[],F=P/M,L=8/3*Math.sin(F/4)*Math.sin(F/4)/Math.sin(F/2),j=D+F,R=0;R=i?o-i:2*Math.PI-(i-o)}function o(e,n,r,o,a,s,u,c){var l;if(i.cachesBoundsOfCurve&&(l=t.call(arguments),i.boundsOfCurveCache[l]))return i.boundsOfCurveCache[l];var h,f,d,p,v,y,g,m,b=Math.sqrt,_=Math.min,w=Math.max,k=Math.abs,x=[],S=[[],[]];f=6*e-12*r+6*a,h=-3*e+9*r-9*a+3*u,d=3*r-3*e;for(var T=0;T<2;++T)if(T>0&&(f=6*n-12*o+6*s,h=-3*n+9*o-9*s+3*c,d=3*o-3*n),k(h)<1e-12){if(k(f)<1e-12)continue;0<(p=-d/f)&&p<1&&x.push(p)}else(g=f*f-4*d*h)<0||(0<(v=(-f+(m=b(g)))/(2*h))&&v<1&&x.push(v),0<(y=(-f-m)/(2*h))&&y<1&&x.push(y));for(var C,O,E,I=x.length,A=I;I--;)C=(E=1-(p=x[I]))*E*E*e+3*E*E*p*r+3*E*p*p*a+p*p*p*u,S[0][I]=C,O=E*E*E*n+3*E*E*p*o+3*E*p*p*s+p*p*p*c,S[1][I]=O;S[0][A]=e,S[1][A]=n,S[0][A+1]=u,S[1][A+1]=c;var D=[{x:_.apply(null,S[0]),y:_.apply(null,S[1])},{x:w.apply(null,S[0]),y:w.apply(null,S[1])}];return i.cachesBoundsOfCurve&&(i.boundsOfCurveCache[l]=D),D}i.util.drawArc=function(t,n,r,i){for(var o=i[0],a=i[1],s=i[2],u=i[3],c=i[4],l=[[],[],[],[]],h=e(i[5]-n,i[6]-r,o,a,u,c,s),f=0,d=h.length;f=e}))}}}(),function(){function t(e,n,r){if(r)if(!i.isLikelyNode&&n instanceof Element)e=n;else if(n instanceof Array){e=[];for(var o=0,a=n.length;o57343)return t.charAt(e);if(55296<=n&&n<=56319){if(t.length<=e+1)throw"High surrogate without following low surrogate";var r=t.charCodeAt(e+1);if(56320>r||r>57343)throw"High surrogate without following low surrogate";return t.charAt(e)+t.charAt(e+1)}if(0===e)throw"Low surrogate without preceding high surrogate";var i=t.charCodeAt(e-1);if(55296>i||i>56319)throw"Low surrogate without preceding high surrogate";return!1}i.util.string={camelize:function(t){return t.replace(/-+(.)?/g,(function(t,e){return e?e.toUpperCase():""}))},capitalize:function(t,e){return t.charAt(0).toUpperCase()+(e?t.slice(1):t.slice(1).toLowerCase())},escapeXml:function(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")},graphemeSplit:function(e){var n,r=0,i=[];for(r=0;r-1?t.prototype[i]=function(t){return function(){var n=this.constructor.superclass;this.constructor.superclass=r;var i=e[t].apply(this,arguments);if(this.constructor.superclass=n,"initialize"!==t)return i}}(i):t.prototype[i]=e[i],n&&(e.toString!==Object.prototype.toString&&(t.prototype.toString=e.toString),e.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=e.valueOf))};function o(){}function a(e){for(var n=null,r=this;r.constructor.superclass;){var i=r.constructor.superclass.prototype[e];if(r[e]!==i){n=i;break}r=r.constructor.superclass.prototype}return n?arguments.length>1?n.apply(this,t.call(arguments,1)):n.call(this):console.log("tried to callSuper "+e+", method not found in prototype chain",this)}i.util.createClass=function(){var n=null,i=t.call(arguments,0);function s(){this.initialize.apply(this,arguments)}"function"===typeof i[0]&&(n=i.shift()),s.superclass=n,s.subclasses=[],n&&(o.prototype=n.prototype,s.prototype=new o,n.subclasses.push(s));for(var u=0,c=i.length;u=.9999?"":"alpha(opacity="+100*e+")",n.filter=n.filter.replace(r,e)):n.filter+=" alpha(opacity="+100*e+")",t}),i.util.setStyle=function(t,e){var n=t.style;if(!n)return t;if("string"===typeof e)return t.style.cssText+=";"+e,e.indexOf("opacity")>-1?o(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var r in e){if("opacity"===r)o(t,e[r]);else n["float"===r||"cssFloat"===r?"undefined"===typeof n.styleFloat?"cssFloat":"styleFloat":r]=e[r]}return t}}(),function(){var t=Array.prototype.slice;var e,n,r=function(e){return t.call(e,0)};try{e=r(i.document.childNodes)instanceof Array}catch(s){}function o(t,e){var n=i.document.createElement(t);for(var r in e)"class"===r?n.className=e[r]:"for"===r?n.htmlFor=e[r]:n.setAttribute(r,e[r]);return n}function a(t){for(var e=0,n=0,r=i.document.documentElement,o=i.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&((t=t.parentNode||t.host)===i.document?(e=o.scrollLeft||r.scrollLeft||0,n=o.scrollTop||r.scrollTop||0):(e+=t.scrollLeft||0,n+=t.scrollTop||0),1!==t.nodeType||"fixed"!==t.style.position););return{left:e,top:n}}e||(r=function(t){for(var e=new Array(t.length),n=t.length;n--;)e[n]=t[n];return e}),n=i.document.defaultView&&i.document.defaultView.getComputedStyle?function(t,e){var n=i.document.defaultView.getComputedStyle(t,null);return n?n[e]:void 0}:function(t,e){var n=t.style[e];return!n&&t.currentStyle&&(n=t.currentStyle[e]),n},function(){var t=i.document.documentElement.style,e="userSelect"in t?"userSelect":"MozUserSelect"in t?"MozUserSelect":"WebkitUserSelect"in t?"WebkitUserSelect":"KhtmlUserSelect"in t?"KhtmlUserSelect":"";i.util.makeElementUnselectable=function(t){return"undefined"!==typeof t.onselectstart&&(t.onselectstart=i.util.falseFunction),e?t.style[e]="none":"string"===typeof t.unselectable&&(t.unselectable="on"),t},i.util.makeElementSelectable=function(t){return"undefined"!==typeof t.onselectstart&&(t.onselectstart=null),e?t.style[e]="":"string"===typeof t.unselectable&&(t.unselectable=""),t}}(),i.util.getScript=function(t,e){var n=i.document.getElementsByTagName("head")[0],r=i.document.createElement("script"),o=!0;r.onload=r.onreadystatechange=function(t){if(o){if("string"===typeof this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)return;o=!1,e(t||i.window.event),r=r.onload=r.onreadystatechange=null}},r.src=t,n.appendChild(r)},i.util.getById=function(t){return"string"===typeof t?i.document.getElementById(t):t},i.util.toArray=r,i.util.makeElement=o,i.util.addClass=function(t,e){t&&-1===(" "+t.className+" ").indexOf(" "+e+" ")&&(t.className+=(t.className?" ":"")+e)},i.util.wrapElement=function(t,e,n){return"string"===typeof e&&(e=o(e,n)),t.parentNode&&t.parentNode.replaceChild(e,t),e.appendChild(t),e},i.util.getScrollLeftTop=a,i.util.getElementOffset=function(t){var e,r,i=t&&t.ownerDocument,o={left:0,top:0},s={left:0,top:0},u={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!i)return s;for(var c in u)s[u[c]]+=parseInt(n(t,c),10)||0;return e=i.documentElement,"undefined"!==typeof t.getBoundingClientRect&&(o=t.getBoundingClientRect()),r=a(t),{left:o.left+r.left-(e.clientLeft||0)+s.left,top:o.top+r.top-(e.clientTop||0)+s.top}},i.util.getElementStyle=n,i.util.getNodeCanvas=function(t){var e=i.jsdomImplForWrapper(t);return e._canvas||e._image},i.util.cleanUpJsdomNode=function(t){if(i.isLikelyNode){var e=i.jsdomImplForWrapper(t);e&&(e._image=null,e._canvas=null,e._currentSrc=null,e._attributes=null,e._classList=null)}}}(),function(){function t(){}i.util.request=function(e,n){n||(n={});var r=n.method?n.method.toUpperCase():"GET",o=n.onComplete||function(){},a=new i.window.XMLHttpRequest,s=n.body||n.parameters;return a.onreadystatechange=function(){4===a.readyState&&(o(a),a.onreadystatechange=t)},"GET"===r&&(s=null,"string"===typeof n.parameters&&(e=function(t,e){return t+(/\?/.test(t)?"&":"?")+e}(e,n.parameters))),a.open(r,e,!0),"POST"!==r&&"PUT"!==r||a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.send(s),a}}(),i.log=console.log,i.warn=console.warn,function(){function t(){return!1}function e(t,e,n,r){return-n*Math.cos(t/r*(Math.PI/2))+n+e}var n=i.window.requestAnimationFrame||i.window.webkitRequestAnimationFrame||i.window.mozRequestAnimationFrame||i.window.oRequestAnimationFrame||i.window.msRequestAnimationFrame||function(t){return i.window.setTimeout(t,1e3/60)},r=i.window.cancelAnimationFrame||i.window.clearTimeout;function o(){return n.apply(i.window,arguments)}i.util.animate=function(n){o((function(r){n||(n={});var i,a=r||+new Date,s=n.duration||500,u=a+s,c=n.onChange||t,l=n.abort||t,h=n.onComplete||t,f=n.easing||e,d="startValue"in n?n.startValue:0,p="endValue"in n?n.endValue:100,v=n.byValue||p-d;n.onStart&&n.onStart(),function t(e){var n=(i=e||+new Date)>u?s:i-a,r=n/s,y=f(n,d,v,s),g=Math.abs((y-d)/v);if(!l())return i>u?(c(p,1,1),void h(p,1,1)):(c(y,g,r),void o(t));h(p,1,1)}(a)}))},i.util.requestAnimFrame=o,i.util.cancelAnimFrame=function(){return r.apply(i.window,arguments)}}(),i.util.animateColor=function(t,e,n,r){var o=new i.Color(t).getSource(),a=new i.Color(e).getSource();r=r||{},i.util.animate(i.util.object.extend(r,{duration:n||500,startValue:o,endValue:a,byValue:a,easing:function(t,e,n,i){return function(t,e,n){var r="rgba("+parseInt(t[0]+n*(e[0]-t[0]),10)+","+parseInt(t[1]+n*(e[1]-t[1]),10)+","+parseInt(t[2]+n*(e[2]-t[2]),10);return r+=","+(t&&e?parseFloat(t[3]+n*(e[3]-t[3])):1),r+=")"}(e,n,r.colorEasing?r.colorEasing(t,i):1-Math.cos(t/i*(Math.PI/2)))}}))},function(){function t(t,e,n,r){return t-1&&l>-1&&l-1)&&(n="stroke")}else{if("href"===t||"xlink:href"===t)return n;s=u?n.map(o):o(n,i)}else n="";return!u&&isNaN(s)?n:s}function h(t){return new RegExp("^("+t.join("|")+")\\b","i")}function f(t,e){var n,r,i,o,a=[];for(i=0,o=e.length;i1;)u.shift(),c=e.util.multiplyTransformMatrices(c,u[0]);return c}}();var y=new RegExp("^\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*$");function g(t){var n,r,i,a,s,u,c=t.getAttribute("viewBox"),l=1,h=1,f=t.getAttribute("width"),d=t.getAttribute("height"),p=t.getAttribute("x")||0,v=t.getAttribute("y")||0,g=t.getAttribute("preserveAspectRatio")||"",m=!c||!e.svgViewBoxElementsRegEx.test(t.nodeName)||!(c=c.match(y)),b=!f||!d||"100%"===f||"100%"===d,_=m&&b,w={},k="",x=0,S=0;if(w.width=0,w.height=0,w.toBeParsed=_,_)return w;if(m)return w.width=o(f),w.height=o(d),w;if(n=-parseFloat(c[1]),r=-parseFloat(c[2]),i=parseFloat(c[3]),a=parseFloat(c[4]),w.minX=n,w.minY=r,w.viewBoxWidth=i,w.viewBoxHeight=a,b?(w.width=i,w.height=a):(w.width=o(f),w.height=o(d),l=w.width/i,h=w.height/a),"none"!==(g=e.util.parsePreserveAspectRatioAttribute(g)).alignX&&("meet"===g.meetOrSlice&&(h=l=l>h?h:l),"slice"===g.meetOrSlice&&(h=l=l>h?l:h),x=w.width-i*l,S=w.height-a*l,"Mid"===g.alignX&&(x/=2),"Mid"===g.alignY&&(S/=2),"Min"===g.alignX&&(x=0),"Min"===g.alignY&&(S=0)),1===l&&1===h&&0===n&&0===r&&0===p&&0===v)return w;if((p||v)&&(k=" translate("+o(p)+" "+o(v)+") "),s=k+" matrix("+l+" 0 0 "+h+" "+(n*l+x)+" "+(r*h+S)+") ",w.viewboxTransform=e.parseTransformAttribute(s),"svg"===t.nodeName){for(u=t.ownerDocument.createElementNS(e.svgNS,"g");t.firstChild;)u.appendChild(t.firstChild);t.appendChild(u)}else s=(u=t).getAttribute("transform")+s;return u.setAttribute("transform",s),w}function m(t,e){var n=v(t,e.getAttribute("xlink:href").substr(1));if(n&&n.getAttribute("xlink:href")&&m(t,n),["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"].forEach((function(t){n&&!e.hasAttribute(t)&&n.hasAttribute(t)&&e.setAttribute(t,n.getAttribute(t))})),!e.children.length)for(var r=n.cloneNode(!0);r.firstChild;)e.appendChild(r.firstChild);e.removeAttribute("xlink:href")}e.parseSVGDocument=function(t,n,i,o){if(t){!function(t){for(var n=f(t,["use","svg:use"]),r=0;n.length&&r/i,"")));if(!o||!o.documentElement)return n&&n(null),!1;e.parseSVGDocument(o.documentElement,(function(t,e,r,i){n&&n(t,e,r,i)}),r,i)}})},loadSVGFromString:function(t,n,r,i){var o;if(t=t.trim(),"undefined"!==typeof e.window.DOMParser){var a=new e.window.DOMParser;a&&a.parseFromString&&(o=a.parseFromString(t,"text/xml"))}else e.window.ActiveXObject&&((o=new ActiveXObject("Microsoft.XMLDOM")).async="false",o.loadXML(t.replace(//i,"")));e.parseSVGDocument(o.documentElement,(function(t,e,r,i){n(t,e,r,i)}),r,i)}})}(e),i.ElementsParser=function(t,e,n,r,i,o){this.elements=t,this.callback=e,this.options=n,this.reviver=r,this.svgUid=n&&n.svgUid||0,this.parsingOptions=i,this.regexUrl=/^url\(['"]?#([^'"]+)['"]?\)/g,this.doc=o},(r=i.ElementsParser.prototype).parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},r.createObjects=function(){var t=this;this.elements.forEach((function(e,n){e.setAttribute("svgUid",t.svgUid),t.createObject(e,n)}))},r.findTag=function(t){return i[i.util.string.capitalize(t.tagName.replace("svg:",""))]},r.createObject=function(t,e){var n=this.findTag(t);if(n&&n.fromElement)try{n.fromElement(t,this.createCallback(e,t),this.options)}catch(r){i.log(r)}else this.checkIfDone()},r.createCallback=function(t,e){var n=this;return function(r){var o;n.resolveGradient(r,e,"fill"),n.resolveGradient(r,e,"stroke"),r instanceof i.Image&&r._originalElement&&(o=r.parsePreserveAspectRatioAttribute(e)),r._removeTransformMatrix(o),n.resolveClipPath(r,e),n.reviver&&n.reviver(e,r),n.instances[t]=r,n.checkIfDone()}},r.extractPropertyDefinition=function(t,e,n){var r=t[e],o=this.regexUrl;if(o.test(r)){o.lastIndex=0;var a=o.exec(r)[1];return o.lastIndex=0,i[n][this.svgUid][a]}},r.resolveGradient=function(t,e,n){var r=this.extractPropertyDefinition(t,n,"gradientDefs");if(r){var o=e.getAttribute(n+"-opacity"),a=i.Gradient.fromElement(r,t,o,this.options);t.set(n,a)}},r.createClipPathCallback=function(t,e){return function(t){t._removeTransformMatrix(),t.fillRule=t.clipRule,e.push(t)}},r.resolveClipPath=function(t,e){var n,r,o,a,s=this.extractPropertyDefinition(t,"clipPath","clipPaths");if(s){o=[],r=i.util.invertTransform(t.calcTransformMatrix());for(var u=s[0].parentNode,c=e;c.parentNode&&c.getAttribute("clip-path")!==t.clipPath;)c=c.parentNode;c.parentNode.appendChild(u);for(var l=0;lt.x&&this.y>t.y},gte:function(t){return this.x>=t.x&&this.y>=t.y},lerp:function(t,e){return"undefined"===typeof e&&(e=.5),e=Math.max(Math.min(1,e),0),new n(this.x+(t.x-this.x)*e,this.y+(t.y-this.y)*e)},distanceFrom:function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},midPointFrom:function(t){return this.lerp(t)},min:function(t){return new n(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new n(Math.max(this.x,t.x),Math.max(this.y,t.y))},toString:function(){return this.x+","+this.y},setXY:function(t,e){return this.x=t,this.y=e,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setFromPoint:function(t){return this.x=t.x,this.y=t.y,this},swap:function(t){var e=this.x,n=this.y;this.x=t.x,this.y=t.y,t.x=e,t.y=n},clone:function(){return new n(this.x,this.y)}})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={});function n(t){this.status=t,this.points=[]}e.Intersection?e.warn("fabric.Intersection is already defined"):(e.Intersection=n,e.Intersection.prototype={constructor:n,appendPoint:function(t){return this.points.push(t),this},appendPoints:function(t){return this.points=this.points.concat(t),this}},e.Intersection.intersectLineLine=function(t,r,i,o){var a,s=(o.x-i.x)*(t.y-i.y)-(o.y-i.y)*(t.x-i.x),u=(r.x-t.x)*(t.y-i.y)-(r.y-t.y)*(t.x-i.x),c=(o.y-i.y)*(r.x-t.x)-(o.x-i.x)*(r.y-t.y);if(0!==c){var l=s/c,h=u/c;0<=l&&l<=1&&0<=h&&h<=1?(a=new n("Intersection")).appendPoint(new e.Point(t.x+l*(r.x-t.x),t.y+l*(r.y-t.y))):a=new n}else a=new n(0===s||0===u?"Coincident":"Parallel");return a},e.Intersection.intersectLinePolygon=function(t,e,r){var i,o,a,s,u=new n,c=r.length;for(s=0;s0&&(u.status="Intersection"),u},e.Intersection.intersectPolygonPolygon=function(t,e){var r,i=new n,o=t.length;for(r=0;r0&&(i.status="Intersection"),i},e.Intersection.intersectPolygonRectangle=function(t,r,i){var o=r.min(i),a=r.max(i),s=new e.Point(a.x,o.y),u=new e.Point(o.x,a.y),c=n.intersectLinePolygon(o,s,t),l=n.intersectLinePolygon(s,a,t),h=n.intersectLinePolygon(a,u,t),f=n.intersectLinePolygon(u,o,t),d=new n;return d.appendPoints(c.points),d.appendPoints(l.points),d.appendPoints(h.points),d.appendPoints(f.points),d.points.length>0&&(d.status="Intersection"),d})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={});function n(t){t?this._tryParsingColor(t):this.setSource([0,0,0,1])}function r(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}e.Color?e.warn("fabric.Color is already defined."):(e.Color=n,e.Color.prototype={_tryParsingColor:function(t){var e;t in n.colorNameMap&&(t=n.colorNameMap[t]),"transparent"===t&&(e=[255,255,255,0]),e||(e=n.sourceFromHex(t)),e||(e=n.sourceFromRgb(t)),e||(e=n.sourceFromHsl(t)),e||(e=[0,0,0,1]),e&&this.setSource(e)},_rgbToHsl:function(t,n,r){t/=255,n/=255,r/=255;var i,o,a,s=e.util.array.max([t,n,r]),u=e.util.array.min([t,n,r]);if(a=(s+u)/2,s===u)i=o=0;else{var c=s-u;switch(o=a>.5?c/(2-s-u):c/(s+u),s){case t:i=(n-r)/c+(n1?1:u,s){var c=s.split(/\s*;\s*/);for(""===c[c.length-1]&&c.pop(),a=c.length;a--;){var l=c[a].split(/\s*:\s*/),h=l[0].trim(),f=l[1].trim();"stop-color"===h?n=f:"stop-opacity"===h&&(o=f)}}return n||(n=t.getAttribute("stop-color")||"rgb(0,0,0)"),o||(o=t.getAttribute("stop-opacity")),r=(n=new i.Color(n)).getAlpha(),o=isNaN(parseFloat(o))?1:parseFloat(o),o*=r*e,{offset:u,color:n.toRgb(),opacity:o}}var e=i.util.object.clone;function n(t,e,n,r){var i,o;Object.keys(e).forEach((function(t){"Infinity"===(i=e[t])?o=1:"-Infinity"===i?o=0:(o=parseFloat(e[t],10),"string"===typeof i&&/^(\d+\.\d+)%|(\d+)%$/.test(i)&&(o*=.01,"pixels"===r&&("x1"!==t&&"x2"!==t&&"r2"!==t||(o*=n.viewBoxWidth||n.width),"y1"!==t&&"y2"!==t||(o*=n.viewBoxHeight||n.height)))),e[t]=o}))}i.Gradient=i.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:"pixels",type:"linear",initialize:function(t){t||(t={}),t.coords||(t.coords={});var e,n=this;Object.keys(t).forEach((function(e){n[e]=t[e]})),this.id?this.id+="_"+i.Object.__uid++:this.id=i.Object.__uid++,e={x1:t.coords.x1||0,y1:t.coords.y1||0,x2:t.coords.x2||0,y2:t.coords.y2||0},"radial"===this.type&&(e.r1=t.coords.r1||0,e.r2=t.coords.r2||0),this.coords=e,this.colorStops=t.colorStops.slice()},addColorStop:function(t){for(var e in t){var n=new i.Color(t[e]);this.colorStops.push({offset:parseFloat(e),color:n.toRgb(),opacity:n.getAlpha()})}return this},toObject:function(t){var e={type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform};return i.util.populateWithProperties(this,e,t),e},toSVG:function(t,n){var r,o,a,s,u=e(this.coords,!0),c=(n=n||{},e(this.colorStops,!0)),l=u.r1>u.r2,h=this.gradientTransform?this.gradientTransform.concat():i.iMatrix.concat(),f=-this.offsetX,d=-this.offsetY,p=!!n.additionalTransform,v="pixels"===this.gradientUnits?"userSpaceOnUse":"objectBoundingBox";if(c.sort((function(t,e){return t.offset-e.offset})),"objectBoundingBox"===v?(f/=t.width,d/=t.height):(f+=t.width/2,d+=t.height/2),"path"===t.type&&(f-=t.pathOffset.x,d-=t.pathOffset.y),h[4]-=f,h[5]-=d,s='id="SVGID_'+this.id+'" gradientUnits="'+v+'"',s+=' gradientTransform="'+(p?n.additionalTransform+" ":"")+i.util.matrixToSVG(h)+'" ',"linear"===this.type?a=["\n']:"radial"===this.type&&(a=["\n']),"radial"===this.type){if(l)for((c=c.concat()).reverse(),r=0,o=c.length;r0){var g=y/Math.max(u.r1,u.r2);for(r=0,o=c.length;r\n')}return a.push("linear"===this.type?"\n":"\n"),a.join("")},toLive:function(t,e){var n,r,o,a=i.util.object.clone(this.coords),s=a.x1,u=a.y1,c=a.x2,l=a.y2,h=this.colorStops;if(this.type){for(e instanceof i.Text&&"percentage"===this.gradientUnits&&(s*=e.width,u*=e.height,c*=e.width,l*=e.height),"linear"===this.type?n=t.createLinearGradient(s,u,c,l):"radial"===this.type&&(n=t.createRadialGradient(s,u,a.r1,c,l,a.r2)),r=0,o=h.length;r1?1:s,isNaN(s)&&(s=1);var u,c,l,h,f=e.getElementsByTagName("stop"),d="userSpaceOnUse"===e.getAttribute("gradientUnits")?"pixels":"percentage",p=e.getAttribute("gradientTransform")||"",v=[],y=0,g=0;for("linearGradient"===e.nodeName||"LINEARGRADIENT"===e.nodeName?(u="linear",c=function(t){return{x1:t.getAttribute("x1")||0,y1:t.getAttribute("y1")||0,x2:t.getAttribute("x2")||"100%",y2:t.getAttribute("y2")||0}}(e)):(u="radial",c=function(t){return{x1:t.getAttribute("fx")||t.getAttribute("cx")||"50%",y1:t.getAttribute("fy")||t.getAttribute("cy")||"50%",r1:0,x2:t.getAttribute("cx")||"50%",y2:t.getAttribute("cy")||"50%",r2:t.getAttribute("r")||"50%"}}(e)),l=f.length;l--;)v.push(t(f[l],s));return h=i.parseTransformAttribute(p),n(r,c,a,d),"pixels"===d&&(y=-r.left,g=-r.top),new i.Gradient({id:e.getAttribute("id"),type:u,coords:c,colorStops:v,gradientUnits:d,gradientTransform:h,offsetX:y,offsetY:g})},forObject:function(t,e){return e||(e={}),n(t,e.coords,e.gradientUnits,{viewBoxWidth:100,viewBoxHeight:100}),new i.Gradient(e)}})}(),function(){"use strict";var t=i.util.toFixed;i.Pattern=i.util.createClass({repeat:"repeat",offsetX:0,offsetY:0,crossOrigin:"",patternTransform:null,initialize:function(t,e){if(t||(t={}),this.id=i.Object.__uid++,this.setOptions(t),!t.source||t.source&&"string"!==typeof t.source)e&&e(this);else if("undefined"!==typeof i.util.getFunctionBody(t.source))this.source=new Function(i.util.getFunctionBody(t.source)),e&&e(this);else{var n=this;this.source=i.util.createImage(),i.util.loadImage(t.source,(function(t){n.source=t,e&&e(n)}),null,this.crossOrigin)}},toObject:function(e){var n,r,o=i.Object.NUM_FRACTION_DIGITS;return"function"===typeof this.source?n=String(this.source):"string"===typeof this.source.src?n=this.source.src:"object"===typeof this.source&&this.source.toDataURL&&(n=this.source.toDataURL()),r={type:"pattern",source:n,repeat:this.repeat,crossOrigin:this.crossOrigin,offsetX:t(this.offsetX,o),offsetY:t(this.offsetY,o),patternTransform:this.patternTransform?this.patternTransform.concat():null},i.util.populateWithProperties(this,r,e),r},toSVG:function(t){var e="function"===typeof this.source?this.source():this.source,n=e.width/t.width,r=e.height/t.height,i=this.offsetX/t.width,o=this.offsetY/t.height,a="";return"repeat-x"!==this.repeat&&"no-repeat"!==this.repeat||(r=1,o&&(r+=Math.abs(o))),"repeat-y"!==this.repeat&&"no-repeat"!==this.repeat||(n=1,i&&(n+=Math.abs(i))),e.src?a=e.src:e.toDataURL&&(a=e.toDataURL()),'\n\n\n'},setOptions:function(t){for(var e in t)this[e]=t[e]},toLive:function(t){var e="function"===typeof this.source?this.source():this.source;if(!e)return"";if("undefined"!==typeof e.src){if(!e.complete)return"";if(0===e.naturalWidth||0===e.naturalHeight)return""}return t.createPattern(e,this.repeat)}})}(),function(t){"use strict";var e=t.fabric||(t.fabric={}),n=e.util.toFixed;e.Shadow?e.warn("fabric.Shadow is already defined."):(e.Shadow=e.util.createClass({color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,nonScaling:!1,initialize:function(t){for(var n in"string"===typeof t&&(t=this._parseShadow(t)),t)this[n]=t[n];this.id=e.Object.__uid++},_parseShadow:function(t){var n=t.trim(),r=e.Shadow.reOffsetsAndBlur.exec(n)||[];return{color:(n.replace(e.Shadow.reOffsetsAndBlur,"")||"rgb(0,0,0)").trim(),offsetX:parseInt(r[1],10)||0,offsetY:parseInt(r[2],10)||0,blur:parseInt(r[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")},toSVG:function(t){var r=40,i=40,o=e.Object.NUM_FRACTION_DIGITS,a=e.util.rotateVector({x:this.offsetX,y:this.offsetY},e.util.degreesToRadians(-t.angle)),s=new e.Color(this.color);return t.width&&t.height&&(r=100*n((Math.abs(a.x)+this.blur)/t.width,o)+20,i=100*n((Math.abs(a.y)+this.blur)/t.height,o)+20),t.flipX&&(a.x*=-1),t.flipY&&(a.y*=-1),'\n\t\n\t\n\t\n\t\n\t\n\t\t\n\t\t\n\t\n\n'},toObject:function(){if(this.includeDefaultValues)return{color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY,affectStroke:this.affectStroke,nonScaling:this.nonScaling};var t={},n=e.Shadow.prototype;return["color","blur","offsetX","offsetY","affectStroke","nonScaling"].forEach((function(e){this[e]!==n[e]&&(t[e]=this[e])}),this),t}}),e.Shadow.reOffsetsAndBlur=/(?:\s|^)(-?\d+(?:px)?(?:\s?|$))?(-?\d+(?:px)?(?:\s?|$))?(\d+(?:px)?)?(?:\s?|$)(?:$|\s)/)}(e),function(){"use strict";if(i.StaticCanvas)i.warn("fabric.StaticCanvas is already defined.");else{var t=i.util.object.extend,e=i.util.getElementOffset,n=i.util.removeFromArray,r=i.util.toFixed,o=i.util.transformPoint,a=i.util.invertTransform,s=i.util.getNodeCanvas,u=i.util.createCanvasElement,c=new Error("Could not initialize `canvas` element");i.StaticCanvas=i.util.createClass(i.CommonMethods,{initialize:function(t,e){e||(e={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(t,e)},backgroundColor:"",backgroundImage:null,overlayColor:"",overlayImage:null,includeDefaultValues:!0,stateful:!1,renderOnAddRemove:!0,clipTo:null,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:i.iMatrix.concat(),backgroundVpt:!0,overlayVpt:!0,onBeforeScaleRotate:function(){},enableRetinaScaling:!0,vptCoords:{},skipOffscreen:!0,clipPath:void 0,_initStatic:function(t,e){var n=this.requestRenderAllBound;this._objects=[],this._createLowerCanvas(t),this._initOptions(e),this._setImageSmoothing(),this.interactive||this._initRetinaScaling(),e.overlayImage&&this.setOverlayImage(e.overlayImage,n),e.backgroundImage&&this.setBackgroundImage(e.backgroundImage,n),e.backgroundColor&&this.setBackgroundColor(e.backgroundColor,n),e.overlayColor&&this.setOverlayColor(e.overlayColor,n),this.calcOffset()},_isRetinaScaling:function(){return 1!==i.devicePixelRatio&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?i.devicePixelRatio:1},_initRetinaScaling:function(){if(this._isRetinaScaling()){var t=i.devicePixelRatio;this.__initRetinaScaling(t,this.lowerCanvasEl,this.contextContainer),this.upperCanvasEl&&this.__initRetinaScaling(t,this.upperCanvasEl,this.contextTop)}},__initRetinaScaling:function(t,e,n){e.setAttribute("width",this.width*t),e.setAttribute("height",this.height*t),n.scale(t,t)},calcOffset:function(){return this._offset=e(this.lowerCanvasEl),this},setOverlayImage:function(t,e,n){return this.__setBgOverlayImage("overlayImage",t,e,n)},setBackgroundImage:function(t,e,n){return this.__setBgOverlayImage("backgroundImage",t,e,n)},setOverlayColor:function(t,e){return this.__setBgOverlayColor("overlayColor",t,e)},setBackgroundColor:function(t,e){return this.__setBgOverlayColor("backgroundColor",t,e)},_setImageSmoothing:function(){var t=this.getContext();t.imageSmoothingEnabled=t.imageSmoothingEnabled||t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled||t.oImageSmoothingEnabled,t.imageSmoothingEnabled=this.imageSmoothingEnabled},__setBgOverlayImage:function(t,e,n,r){return"string"===typeof e?i.util.loadImage(e,(function(e){if(e){var o=new i.Image(e,r);this[t]=o,o.canvas=this}n&&n(e)}),this,r&&r.crossOrigin):(r&&e.setOptions(r),this[t]=e,e&&(e.canvas=this),n&&n(e)),this},__setBgOverlayColor:function(t,e,n){return this[t]=e,this._initGradient(e,t),this._initPattern(e,t,n),this},_createCanvasElement:function(){var t=u();if(!t)throw c;if(t.style||(t.style={}),"undefined"===typeof t.getContext)throw c;return t},_initOptions:function(t){var e=this.lowerCanvasEl;this._setOptions(t),this.width=this.width||parseInt(e.width,10)||0,this.height=this.height||parseInt(e.height,10)||0,this.lowerCanvasEl.style&&(e.width=this.width,e.height=this.height,e.style.width=this.width+"px",e.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(t){t&&t.getContext?this.lowerCanvasEl=t:this.lowerCanvasEl=i.util.getById(t)||this._createCanvasElement(),i.util.addClass(this.lowerCanvasEl,"lower-canvas"),this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl),this.contextContainer=this.lowerCanvasEl.getContext("2d")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(t,e){return this.setDimensions({width:t},e)},setHeight:function(t,e){return this.setDimensions({height:t},e)},setDimensions:function(t,e){var n;for(var r in e=e||{},t)n=t[r],e.cssOnly||(this._setBackstoreDimension(r,t[r]),n+="px",this.hasLostContext=!0),e.backstoreOnly||this._setCssDimension(r,n);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(),this._initRetinaScaling(),this._setImageSmoothing(),this.calcOffset(),e.cssOnly||this.requestRenderAll(),this},_setBackstoreDimension:function(t,e){return this.lowerCanvasEl[t]=e,this.upperCanvasEl&&(this.upperCanvasEl[t]=e),this.cacheCanvasEl&&(this.cacheCanvasEl[t]=e),this[t]=e,this},_setCssDimension:function(t,e){return this.lowerCanvasEl.style[t]=e,this.upperCanvasEl&&(this.upperCanvasEl.style[t]=e),this.wrapperEl&&(this.wrapperEl.style[t]=e),this},getZoom:function(){return this.viewportTransform[0]},setViewportTransform:function(t){var e,n,r,i=this._activeObject;for(this.viewportTransform=t,n=0,r=this._objects.length;n\n'),this._setSVGBgOverlayColor(n,"background"),this._setSVGBgOverlayImage(n,"backgroundImage",e),this._setSVGObjects(n,e),this.clipPath&&n.push("\n"),this._setSVGBgOverlayColor(n,"overlay"),this._setSVGBgOverlayImage(n,"overlayImage",e),n.push(""),n.join("")},_setSVGPreamble:function(t,e){e.suppressPreamble||t.push('\n','\n')},_setSVGHeader:function(t,e){var n,o=e.width||this.width,a=e.height||this.height,s='viewBox="0 0 '+this.width+" "+this.height+'" ',u=i.Object.NUM_FRACTION_DIGITS;e.viewBox?s='viewBox="'+e.viewBox.x+" "+e.viewBox.y+" "+e.viewBox.width+" "+e.viewBox.height+'" ':this.svgViewportTransformation&&(n=this.viewportTransform,s='viewBox="'+r(-n[4]/n[0],u)+" "+r(-n[5]/n[3],u)+" "+r(this.width/n[0],u)+" "+r(this.height/n[3],u)+'" '),t.push("\n',"Created with Fabric.js ",i.version,"\n","\n",this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),this.createSVGClipPathMarkup(e),"\n")},createSVGClipPathMarkup:function(t){var e=this.clipPath;return e?(e.clipPathId="CLIPPATH_"+i.Object.__uid++,'\n'+this.clipPath.toClipPathSVG(t.reviver)+"\n"):""},createSVGRefElementsMarkup:function(){var t=this;return["background","overlay"].map((function(e){var n=t[e+"Color"];if(n&&n.toLive){var r=t[e+"Vpt"],o=t.viewportTransform,a={width:t.width/(r?o[0]:1),height:t.height/(r?o[3]:1)};return n.toSVG(a,{additionalTransform:r?i.util.matrixToSVG(o):""})}})).join("")},createSVGFontFacesMarkup:function(){var t,e,n,r,o,a,s,u,c="",l={},h=i.fontPaths,f=[];for(this._objects.forEach((function t(e){f.push(e),e._objects&&e._objects.forEach(t)})),s=0,u=f.length;s',"\n",c,"","\n"].join("")),c},_setSVGObjects:function(t,e){var n,r,i,o=this._objects;for(r=0,i=o.length;r\n")}else t.push('\n")},sendToBack:function(t){if(!t)return this;var e,r,i,o=this._activeObject;if(t===o&&"activeSelection"===t.type)for(e=(i=o._objects).length;e--;)r=i[e],n(this._objects,r),this._objects.unshift(r);else n(this._objects,t),this._objects.unshift(t);return this.renderOnAddRemove&&this.requestRenderAll(),this},bringToFront:function(t){if(!t)return this;var e,r,i,o=this._activeObject;if(t===o&&"activeSelection"===t.type)for(i=o._objects,e=0;e0+c&&(a=o-1,n(this._objects,i),this._objects.splice(a,0,i)),c++;else 0!==(o=this._objects.indexOf(t))&&(a=this._findNewLowerIndex(t,o,e),n(this._objects,t),this._objects.splice(a,0,t));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewLowerIndex:function(t,e,n){var r,i;if(n)for(r=e,i=e-1;i>=0;--i){if(t.intersectsWithObject(this._objects[i])||t.isContainedWithinObject(this._objects[i])||this._objects[i].isContainedWithinObject(t)){r=i;break}}else r=e-1;return r},bringForward:function(t,e){if(!t)return this;var r,i,o,a,s,u=this._activeObject,c=0;if(t===u&&"activeSelection"===t.type)for(r=(s=u._objects).length;r--;)i=s[r],(o=this._objects.indexOf(i))"}}),t(i.StaticCanvas.prototype,i.Observable),t(i.StaticCanvas.prototype,i.Collection),t(i.StaticCanvas.prototype,i.DataURLExporter),t(i.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',supports:function(t){var e=u();if(!e||!e.getContext)return null;var n=e.getContext("2d");if(!n)return null;switch(t){case"setLineDash":return"undefined"!==typeof n.setLineDash;default:return null}}}),i.StaticCanvas.prototype.toJSON=i.StaticCanvas.prototype.toObject,i.isLikelyNode&&(i.StaticCanvas.prototype.createPNGStream=function(){var t=s(this.lowerCanvasEl);return t&&t.createPNGStream()},i.StaticCanvas.prototype.createJPEGStream=function(t){var e=s(this.lowerCanvasEl);return e&&e.createJPEGStream(t)})}}(),i.BaseBrush=i.util.createClass({color:"rgb(0, 0, 0)",width:1,shadow:null,strokeLineCap:"round",strokeLineJoin:"round",strokeMiterLimit:10,strokeDashArray:null,setShadow:function(t){return this.shadow=new i.Shadow(t),this},_setBrushStyles:function(){var t=this.canvas.contextTop;t.strokeStyle=this.color,t.lineWidth=this.width,t.lineCap=this.strokeLineCap,t.miterLimit=this.strokeMiterLimit,t.lineJoin=this.strokeLineJoin,i.StaticCanvas.supports("setLineDash")&&t.setLineDash(this.strokeDashArray||[])},_saveAndTransform:function(t){var e=this.canvas.viewportTransform;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5])},_setShadow:function(){if(this.shadow){var t=this.canvas,e=this.shadow,n=t.contextTop,r=t.getZoom();t&&t._isRetinaScaling()&&(r*=i.devicePixelRatio),n.shadowColor=e.color,n.shadowBlur=e.blur*r,n.shadowOffsetX=e.offsetX*r,n.shadowOffsetY=e.offsetY*r}},needsFullRender:function(){return new i.Color(this.color).getAlpha()<1||!!this.shadow},_resetShadow:function(){var t=this.canvas.contextTop;t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0}}),i.PencilBrush=i.util.createClass(i.BaseBrush,{decimate:.4,initialize:function(t){this.canvas=t,this._points=[]},_drawSegment:function(t,e,n){var r=e.midPointFrom(n);return t.quadraticCurveTo(e.x,e.y,r.x,r.y),r},onMouseDown:function(t,e){this.canvas._isMainEvent(e.e)&&(this._prepareForDrawing(t),this._captureDrawingPath(t),this._render())},onMouseMove:function(t,e){if(this.canvas._isMainEvent(e.e)&&this._captureDrawingPath(t)&&this._points.length>1)if(this.needsFullRender())this.canvas.clearContext(this.canvas.contextTop),this._render();else{var n=this._points,r=n.length,i=this.canvas.contextTop;this._saveAndTransform(i),this.oldEnd&&(i.beginPath(),i.moveTo(this.oldEnd.x,this.oldEnd.y)),this.oldEnd=this._drawSegment(i,n[r-2],n[r-1],!0),i.stroke(),i.restore()}},onMouseUp:function(t){return!this.canvas._isMainEvent(t.e)||(this.oldEnd=void 0,this._finalizeAndAddPath(),!1)},_prepareForDrawing:function(t){var e=new i.Point(t.x,t.y);this._reset(),this._addPoint(e),this.canvas.contextTop.moveTo(e.x,e.y)},_addPoint:function(t){return!(this._points.length>1&&t.eq(this._points[this._points.length-1]))&&(this._points.push(t),!0)},_reset:function(){this._points=[],this._setBrushStyles(),this._setShadow()},_captureDrawingPath:function(t){var e=new i.Point(t.x,t.y);return this._addPoint(e)},_render:function(){var t,e,n=this.canvas.contextTop,r=this._points[0],o=this._points[1];if(this._saveAndTransform(n),n.beginPath(),2===this._points.length&&r.x===o.x&&r.y===o.y){var a=this.width/1e3;r=new i.Point(r.x,r.y),o=new i.Point(o.x,o.y),r.x-=a,o.x+=a}for(n.moveTo(r.x,r.y),t=1,e=this._points.length;t2;for(l&&(u=t[2].xt[e-2].x?1:o.x===t[e-2].x?0:-1,c=o.y>t[e-2].y?1:o.y===t[e-2].y?0:-1),n.push("L ",o.x+u*r," ",o.y+c*r),n},createPath:function(t){var e=new i.Path(t,{fill:null,stroke:this.color,strokeWidth:this.width,strokeLineCap:this.strokeLineCap,strokeMiterLimit:this.strokeMiterLimit,strokeLineJoin:this.strokeLineJoin,strokeDashArray:this.strokeDashArray});return this.shadow&&(this.shadow.affectStroke=!0,e.setShadow(this.shadow)),e},decimatePoints:function(t,e){if(t.length<=2)return t;var n,r=this.canvas.getZoom(),o=Math.pow(e/r,2),a=t.length-1,s=t[0],u=[s];for(n=1;n=o&&(s=t[n],u.push(s));return 1===u.length&&u.push(new i.Point(u[0].x,u[0].y)),u},_finalizeAndAddPath:function(){this.canvas.contextTop.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate));var t=this.convertPointsToSVGPath(this._points).join("");if("M 0 0 Q 0 0 0 0 L 0 0"!==t){var e=this.createPath(t);this.canvas.clearContext(this.canvas.contextTop),this.canvas.add(e),this.canvas.requestRenderAll(),e.setCoords(),this._resetShadow(),this.canvas.fire("path:created",{path:e})}else this.canvas.requestRenderAll()}}),i.CircleBrush=i.util.createClass(i.BaseBrush,{width:10,initialize:function(t){this.canvas=t,this.points=[]},drawDot:function(t){var e=this.addPoint(t),n=this.canvas.contextTop;this._saveAndTransform(n),this.dot(n,e),n.restore()},dot:function(t,e){t.fillStyle=e.fill,t.beginPath(),t.arc(e.x,e.y,e.radius,0,2*Math.PI,!1),t.closePath(),t.fill()},onMouseDown:function(t){this.points.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.drawDot(t)},_render:function(){var t,e,n=this.canvas.contextTop,r=this.points;for(this._saveAndTransform(n),t=0,e=r.length;t0&&!this.preserveObjectStacking){e=[],n=[];for(var i=0,o=this._objects.length;i1&&(this._activeObject._objects=n),e.push.apply(e,n)}else e=this._objects;return e},renderAll:function(){!this.contextTopDirty||this._groupSelector||this.isDrawingMode||(this.clearContext(this.contextTop),this.contextTopDirty=!1),this.hasLostContext&&this.renderTopLayer(this.contextTop);var t=this.contextContainer;return this.renderCanvas(t,this._chooseObjectsToRender()),this},renderTopLayer:function(t){t.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(t),this.contextTopDirty=!0),t.restore()},renderTop:function(){var t=this.contextTop;return this.clearContext(t),this.renderTopLayer(t),this.fire("after:render"),this},_resetCurrentTransform:function(){var t=this._currentTransform;t.target.set({scaleX:t.original.scaleX,scaleY:t.original.scaleY,skewX:t.original.skewX,skewY:t.original.skewY,left:t.original.left,top:t.original.top}),this._shouldCenterTransform(t.target)?("center"!==t.originX&&("right"===t.originX?t.mouseXSign=-1:t.mouseXSign=1),"center"!==t.originY&&("bottom"===t.originY?t.mouseYSign=-1:t.mouseYSign=1),t.originX="center",t.originY="center"):(t.originX=t.original.originX,t.originY=t.original.originY)},containsPoint:function(t,e,n){var r,i=n||this.getPointer(t,!0);return r=e.group&&e.group===this._activeObject&&"activeSelection"===e.group.type?this._normalizePointer(e.group,i):{x:i.x,y:i.y},e.containsPoint(r)||e._findTargetCorner(i)},_normalizePointer:function(t,e){var n=t.calcTransformMatrix(),r=i.util.invertTransform(n),o=this.restorePointerVpt(e);return i.util.transformPoint(o,r)},isTargetTransparent:function(t,e,n){if(t.shouldCache()&&t._cacheCanvas&&t!==this._activeObject){var r=this._normalizePointer(t,{x:e,y:n}),o=Math.max(t.cacheTranslationX+r.x*t.zoomX,0),a=Math.max(t.cacheTranslationY+r.y*t.zoomY,0);return i.util.isTransparent(t._cacheContext,Math.round(o),Math.round(a),this.targetFindTolerance)}var s=this.contextCache,u=t.selectionBackgroundColor,c=this.viewportTransform;return t.selectionBackgroundColor="",this.clearContext(s),s.save(),s.transform(c[0],c[1],c[2],c[3],c[4],c[5]),t.render(s),s.restore(),t===this._activeObject&&t._renderControls(s,{hasBorders:!1,transparentCorners:!1},{hasBorders:!1}),t.selectionBackgroundColor=u,i.util.isTransparent(s,e,n,this.targetFindTolerance)},_isSelectionKeyPressed:function(t){return"[object Array]"===Object.prototype.toString.call(this.selectionKey)?!!this.selectionKey.find((function(e){return!0===t[e]})):t[this.selectionKey]},_shouldClearSelection:function(t,e){var n=this.getActiveObjects(),r=this._activeObject;return!e||e&&r&&n.length>1&&-1===n.indexOf(e)&&r!==e&&!this._isSelectionKeyPressed(t)||e&&!e.evented||e&&!e.selectable&&r&&r!==e},_shouldCenterTransform:function(t){if(t){var e,n=this._currentTransform;return"scale"===n.action||"scaleX"===n.action||"scaleY"===n.action?e=this.centeredScaling||t.centeredScaling:"rotate"===n.action&&(e=this.centeredRotation||t.centeredRotation),e?!n.altKey:n.altKey}},_getOriginFromCorner:function(t,e){var n={x:t.originX,y:t.originY};return"ml"===e||"tl"===e||"bl"===e?n.x="right":"mr"!==e&&"tr"!==e&&"br"!==e||(n.x="left"),"tl"===e||"mt"===e||"tr"===e?n.y="bottom":"bl"!==e&&"mb"!==e&&"br"!==e||(n.y="top"),n},_getActionFromCorner:function(t,e,n){if(!e||!t)return"drag";switch(e){case"mtr":return"rotate";case"ml":case"mr":return n[this.altActionKey]?"skewY":"scaleX";case"mt":case"mb":return n[this.altActionKey]?"skewX":"scaleY";default:return"scale"}},_setupCurrentTransform:function(t,n,r){if(n){var o=this.getPointer(t),a=n._findTargetCorner(this.getPointer(t,!0)),s=this._getActionFromCorner(r,a,t,n),u=this._getOriginFromCorner(n,a);this._currentTransform={target:n,action:s,corner:a,scaleX:n.scaleX,scaleY:n.scaleY,skewX:n.skewX,skewY:n.skewY,offsetX:o.x-n.left,offsetY:o.y-n.top,originX:u.x,originY:u.y,ex:o.x,ey:o.y,lastX:o.x,lastY:o.y,theta:e(n.angle),width:n.width*n.scaleX,mouseXSign:1,mouseYSign:1,shiftKey:t.shiftKey,altKey:t[this.centeredKey],original:i.util.saveObjectTransform(n)},this._currentTransform.original.originX=u.x,this._currentTransform.original.originY=u.y,this._resetCurrentTransform(),this._beforeTransform(t)}},_translateObject:function(t,e){var n=this._currentTransform,r=n.target,i=t-n.offsetX,o=e-n.offsetY,a=!r.get("lockMovementX")&&r.left!==i,s=!r.get("lockMovementY")&&r.top!==o;return a&&r.set("left",i),s&&r.set("top",o),a||s},_changeSkewTransformOrigin:function(t,e,n){var r="originX",i={0:"center"},o=e.target.skewX,a="left",s="right",u="mt"===e.corner||"ml"===e.corner?1:-1,c=1;t=t>0?1:-1,"y"===n&&(o=e.target.skewY,a="top",s="bottom",r="originY"),i[-1]=a,i[1]=s,e.target.flipX&&(c*=-1),e.target.flipY&&(c*=-1),0===o?(e.skewSign=-u*t*c,e[r]=i[-t]):(o=o>0?1:-1,e.skewSign=o,e[r]=i[o*u*c])},_skewObject:function(t,e,n){var r,o=this._currentTransform,a=o.target,s=a.get("lockSkewingX"),u=a.get("lockSkewingY");if(s&&"x"===n||u&&"y"===n)return!1;var c,l,h=a.getCenterPoint(),f=a.toLocalPoint(new i.Point(t,e),"center","center")[n],d=a.toLocalPoint(new i.Point(o.lastX,o.lastY),"center","center")[n],p=a._getTransformedDimensions();return this._changeSkewTransformOrigin(f-d,o,n),c=a.toLocalPoint(new i.Point(t,e),o.originX,o.originY)[n],l=a.translateToOriginPoint(h,o.originX,o.originY),r=this._setObjectSkew(c,o,n,p),o.lastX=t,o.lastY=e,a.setPositionByOrigin(l,o.originX,o.originY),r},_setObjectSkew:function(t,e,n,r){var o,a,s,u,c,l,h,f,d,p,v=e.target,y=e.skewSign;return"x"===n?(c="y",l="Y",h="X",d=0,p=v.skewY):(c="x",l="X",h="Y",d=v.skewX,p=0),u=v._getTransformedDimensions(d,p),(f=2*Math.abs(t)-u[n])<=2?o=0:(o=y*Math.atan(f/v["scale"+h]/(u[c]/v["scale"+l])),o=i.util.radiansToDegrees(o)),a=v["skew"+h]!==o,v.set("skew"+h,o),0!==v["skew"+l]&&(s=v._getTransformedDimensions(),o=r[c]/s[c]*v["scale"+l],v.set("scale"+l,o)),a},_scaleObject:function(t,e,n){var r=this._currentTransform,o=r.target,a=o.lockScalingX,s=o.lockScalingY,u=o.lockScalingFlip;if(a&&s)return!1;var c,l=o.translateToOriginPoint(o.getCenterPoint(),r.originX,r.originY),h=o.toLocalPoint(new i.Point(t,e),r.originX,r.originY),f=o._getTransformedDimensions();return this._setLocalMouse(h,r),c=this._setObjectScale(h,r,a,s,n,u,f),o.setPositionByOrigin(l,r.originX,r.originY),c},_setObjectScale:function(t,e,n,r,o,a,s){var u=e.target,c=!1,l=!1,h=!1,f=t.x*u.scaleX/s.x,d=t.y*u.scaleY/s.y,p=u.scaleX!==f,v=u.scaleY!==d;if(e.newScaleX=f,e.newScaleY=d,i.Textbox&&"x"===o&&u instanceof i.Textbox){var y=u.width*(t.x/s.x);return y>=u.getMinWidth()&&(h=y!==u.width,u.set("width",y),h)}return a&&f<=0&&fi?t.x<0?t.x+=i:t.x-=i:t.x=0,o(t.y)>i?t.y<0?t.y+=i:t.y-=i:t.y=0},_rotateObject:function(t,e){var i=this._currentTransform,o=i.target,a=o.translateToOriginPoint(o.getCenterPoint(),i.originX,i.originY);if(o.lockRotation)return!1;var s=r(i.ey-a.y,i.ex-a.x),u=r(e-a.y,t-a.x),c=n(u-s+i.theta),l=!0;if(o.snapAngle>0){var h=o.snapAngle,f=o.snapThreshold||h,d=Math.ceil(c/h)*h,p=Math.floor(c/h)*h;Math.abs(c-p)0?0:-n),e.ey-(r>0?0:-r),s,u)),this.selectionLineWidth&&this.selectionBorderColor)if(t.lineWidth=this.selectionLineWidth,t.strokeStyle=this.selectionBorderColor,this.selectionDashArray.length>1&&!a){var c=e.ex+.5-(n>0?0:s),l=e.ey+.5-(r>0?0:u);t.beginPath(),i.util.drawDashedLine(t,c,l,c+s,l,this.selectionDashArray),i.util.drawDashedLine(t,c,l+u-1,c+s,l+u-1,this.selectionDashArray),i.util.drawDashedLine(t,c,l,c,l+u,this.selectionDashArray),i.util.drawDashedLine(t,c+s-1,l,c+s-1,l+u,this.selectionDashArray),t.closePath(),t.stroke()}else i.Object.prototype._setLineDash.call(this,t,this.selectionDashArray),t.strokeRect(e.ex+.5-(n>0?0:s),e.ey+.5-(r>0?0:u),s,u)},findTarget:function(t,e){if(!this.skipTargetFind){var n,r,i=this.getPointer(t,!0),o=this._activeObject,a=this.getActiveObjects();if(this.targets=[],a.length>1&&!e&&o===this._searchPossibleTargets([o],i))return o;if(1===a.length&&o._findTargetCorner(i))return o;if(1===a.length&&o===this._searchPossibleTargets([o],i)){if(!this.preserveObjectStacking)return o;n=o,r=this.targets,this.targets=[]}var s=this._searchPossibleTargets(this._objects,i);return t[this.altSelectionKey]&&s&&n&&s!==n&&(s=n,this.targets=r),s}},_checkTarget:function(t,e,n){if(e&&e.visible&&e.evented&&this.containsPoint(null,e,t)){if(!this.perPixelTargetFind&&!e.perPixelTargetFind||e.isEditing)return!0;if(!this.isTargetTransparent(e,n.x,n.y))return!0}},_searchPossibleTargets:function(t,e){for(var n,r,o=t.length;o--;){var a=t[o],s=a.group&&"activeSelection"!==a.group.type?this._normalizePointer(a.group,e):e;if(this._checkTarget(s,a,e)){(n=t[o]).subTargetCheck&&n instanceof i.Group&&(r=this._searchPossibleTargets(n._objects,e))&&this.targets.push(r);break}}return n},restorePointerVpt:function(t){return i.util.transformPoint(t,i.util.invertTransform(this.viewportTransform))},getPointer:function(e,n){if(this._absolutePointer&&!n)return this._absolutePointer;if(this._pointer&&n)return this._pointer;var r,i=t(e),o=this.upperCanvasEl,a=o.getBoundingClientRect(),s=a.width||0,u=a.height||0;s&&u||("top"in a&&"bottom"in a&&(u=Math.abs(a.top-a.bottom)),"right"in a&&"left"in a&&(s=Math.abs(a.right-a.left))),this.calcOffset(),i.x=i.x-this._offset.left,i.y=i.y-this._offset.top,n||(i=this.restorePointerVpt(i));var c=this.getRetinaScaling();return 1!==c&&(i.x/=c,i.y/=c),r=0===s||0===u?{width:1,height:1}:{width:o.width/s,height:o.height/u},{x:i.x*r.width,y:i.y*r.height}},_createUpperCanvas:function(){var t=this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/,""),e=this.lowerCanvasEl,n=this.upperCanvasEl;n?n.className="":(n=this._createCanvasElement(),this.upperCanvasEl=n),i.util.addClass(n,"upper-canvas "+t),this.wrapperEl.appendChild(n),this._copyCanvasStyle(e,n),this._applyCanvasStyle(n),this.contextTop=n.getContext("2d")},_createCacheCanvas:function(){this.cacheCanvasEl=this._createCanvasElement(),this.cacheCanvasEl.setAttribute("width",this.width),this.cacheCanvasEl.setAttribute("height",this.height),this.contextCache=this.cacheCanvasEl.getContext("2d")},_initWrapperElement:function(){this.wrapperEl=i.util.wrapElement(this.lowerCanvasEl,"div",{class:this.containerClass}),i.util.setStyle(this.wrapperEl,{width:this.width+"px",height:this.height+"px",position:"relative"}),i.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(t){var e=this.width||t.width,n=this.height||t.height;i.util.setStyle(t,{position:"absolute",width:e+"px",height:n+"px",left:0,top:0,"touch-action":this.allowTouchScrolling?"manipulation":"none","-ms-touch-action":this.allowTouchScrolling?"manipulation":"none"}),t.width=e,t.height=n,i.util.makeElementUnselectable(t)},_copyCanvasStyle:function(t,e){e.style.cssText=t.style.cssText},getSelectionContext:function(){return this.contextTop},getSelectionElement:function(){return this.upperCanvasEl},getActiveObject:function(){return this._activeObject},getActiveObjects:function(){var t=this._activeObject;return t?"activeSelection"===t.type&&t._objects?t._objects.slice(0):[t]:[]},_onObjectRemoved:function(t){t===this._activeObject&&(this.fire("before:selection:cleared",{target:t}),this._discardActiveObject(),this.fire("selection:cleared",{target:t}),t.fire("deselected")),t===this._hoveredTarget&&(this._hoveredTarget=null,this._hoveredTargets=[]),this.callSuper("_onObjectRemoved",t)},_fireSelectionEvents:function(t,e){var n=!1,r=this.getActiveObjects(),i=[],o=[],a={e:e};t.forEach((function(t){-1===r.indexOf(t)&&(n=!0,t.fire("deselected",a),o.push(t))})),r.forEach((function(e){-1===t.indexOf(e)&&(n=!0,e.fire("selected",a),i.push(e))})),t.length>0&&r.length>0?(a.selected=i,a.deselected=o,a.updated=i[0]||o[0],a.target=this._activeObject,n&&this.fire("selection:updated",a)):r.length>0?(1===r.length&&(a.target=i[0],this.fire("object:selected",a)),a.selected=i,a.target=this._activeObject,this.fire("selection:created",a)):t.length>0&&(a.deselected=o,this.fire("selection:cleared",a))},setActiveObject:function(t,e){var n=this.getActiveObjects();return this._setActiveObject(t,e),this._fireSelectionEvents(n,e),this},_setActiveObject:function(t,e){return this._activeObject!==t&&(!!this._discardActiveObject(e,t)&&(!t.onSelect({e:e})&&(this._activeObject=t,!0)))},_discardActiveObject:function(t,e){var n=this._activeObject;if(n){if(n.onDeselect({e:t,object:e}))return!1;this._activeObject=null}return!0},discardActiveObject:function(t){var e=this.getActiveObjects(),n=this.getActiveObject();return e.length&&this.fire("before:selection:cleared",{target:n,e:t}),this._discardActiveObject(t),this._fireSelectionEvents(e,t),this},dispose:function(){var t=this.wrapperEl;return this.removeListeners(),t.removeChild(this.upperCanvasEl),t.removeChild(this.lowerCanvasEl),this.contextCache=null,this.contextTop=null,["upperCanvasEl","cacheCanvasEl"].forEach(function(t){i.util.cleanUpJsdomNode(this[t]),this[t]=void 0}.bind(this)),t.parentNode&&t.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,i.StaticCanvas.prototype.dispose.call(this),this},clear:function(){return this.discardActiveObject(),this.clearContext(this.contextTop),this.callSuper("clear")},drawControls:function(t){var e=this._activeObject;e&&e._renderControls(t)},_toObject:function(t,e,n){var r=this._realizeGroupTransformOnObject(t),i=this.callSuper("_toObject",t,e,n);return this._unwindGroupTransformOnObject(t,r),i},_realizeGroupTransformOnObject:function(t){if(t.group&&"activeSelection"===t.group.type&&this._activeObject===t.group){var e={};return["angle","flipX","flipY","left","scaleX","scaleY","skewX","skewY","top"].forEach((function(n){e[n]=t[n]})),this._activeObject.realizeTransform(t),e}return null},_unwindGroupTransformOnObject:function(t,e){e&&t.set(e)},_setSVGObject:function(t,e,n){var r=this._realizeGroupTransformOnObject(e);this.callSuper("_setSVGObject",t,e,n),this._unwindGroupTransformOnObject(e,r)},setViewportTransform:function(t){this.renderOnAddRemove&&this._activeObject&&this._activeObject.isEditing&&this._activeObject.clearContextTop(),i.StaticCanvas.prototype.setViewportTransform.call(this,t)}}),i.StaticCanvas)"prototype"!==s&&(i.Canvas[s]=i.StaticCanvas[s])}(),function(){var t={mt:0,tr:1,mr:2,br:3,mb:4,bl:5,ml:6,tl:7},e=i.util.addListener,n=i.util.removeListener,r={passive:!1};function o(t,e){return t.button&&t.button===e-1}i.util.object.extend(i.Canvas.prototype,{cursorMap:["n-resize","ne-resize","e-resize","se-resize","s-resize","sw-resize","w-resize","nw-resize"],mainTouchId:null,_initEventListeners:function(){this.removeListeners(),this._bindEvents(),this.addOrRemove(e,"add")},_getEventPrefix:function(){return this.enablePointerEvents?"pointer":"mouse"},addOrRemove:function(t,e){var n=this.upperCanvasEl,o=this._getEventPrefix();t(i.window,"resize",this._onResize),t(n,o+"down",this._onMouseDown),t(n,o+"move",this._onMouseMove,r),t(n,o+"out",this._onMouseOut),t(n,o+"enter",this._onMouseEnter),t(n,"wheel",this._onMouseWheel),t(n,"contextmenu",this._onContextMenu),t(n,"dblclick",this._onDoubleClick),t(n,"dragover",this._onDragOver),t(n,"dragenter",this._onDragEnter),t(n,"dragleave",this._onDragLeave),t(n,"drop",this._onDrop),this.enablePointerEvents||t(n,"touchstart",this._onTouchStart,r),"undefined"!==typeof eventjs&&e in eventjs&&(eventjs[e](n,"gesture",this._onGesture),eventjs[e](n,"drag",this._onDrag),eventjs[e](n,"orientation",this._onOrientationChange),eventjs[e](n,"shake",this._onShake),eventjs[e](n,"longpress",this._onLongPress))},removeListeners:function(){this.addOrRemove(n,"remove");var t=this._getEventPrefix();n(i.document,t+"up",this._onMouseUp),n(i.document,"touchend",this._onTouchEnd,r),n(i.document,t+"move",this._onMouseMove,r),n(i.document,"touchmove",this._onMouseMove,r)},_bindEvents:function(){this.eventsBound||(this._onMouseDown=this._onMouseDown.bind(this),this._onTouchStart=this._onTouchStart.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onResize=this._onResize.bind(this),this._onGesture=this._onGesture.bind(this),this._onDrag=this._onDrag.bind(this),this._onShake=this._onShake.bind(this),this._onLongPress=this._onLongPress.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onMouseWheel=this._onMouseWheel.bind(this),this._onMouseOut=this._onMouseOut.bind(this),this._onMouseEnter=this._onMouseEnter.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onDoubleClick=this._onDoubleClick.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDragEnter=this._simpleEventHandler.bind(this,"dragenter"),this._onDragLeave=this._simpleEventHandler.bind(this,"dragleave"),this._onDrop=this._simpleEventHandler.bind(this,"drop"),this.eventsBound=!0)},_onGesture:function(t,e){this.__onTransformGesture&&this.__onTransformGesture(t,e)},_onDrag:function(t,e){this.__onDrag&&this.__onDrag(t,e)},_onMouseWheel:function(t){this.__onMouseWheel(t)},_onMouseOut:function(t){var e=this._hoveredTarget;this.fire("mouse:out",{target:e,e:t}),this._hoveredTarget=null,e&&e.fire("mouseout",{e:t});var n=this;this._hoveredTargets.forEach((function(r){n.fire("mouse:out",{target:e,e:t}),r&&e.fire("mouseout",{e:t})})),this._hoveredTargets=[],this._iTextInstances&&this._iTextInstances.forEach((function(t){t.isEditing&&t.hiddenTextarea.focus()}))},_onMouseEnter:function(t){this.currentTransform||this.findTarget(t)||(this.fire("mouse:over",{target:null,e:t}),this._hoveredTarget=null,this._hoveredTargets=[])},_onOrientationChange:function(t,e){this.__onOrientationChange&&this.__onOrientationChange(t,e)},_onShake:function(t,e){this.__onShake&&this.__onShake(t,e)},_onLongPress:function(t,e){this.__onLongPress&&this.__onLongPress(t,e)},_onDragOver:function(t){t.preventDefault();var e=this._simpleEventHandler("dragover",t);this._fireEnterLeaveEvents(e,t)},_onContextMenu:function(t){return this.stopContextMenu&&(t.stopPropagation(),t.preventDefault()),!1},_onDoubleClick:function(t){this._cacheTransformEventData(t),this._handleEvent(t,"dblclick"),this._resetTransformEventData(t)},getPointerId:function(t){var e=t.changedTouches;return e?e[0]&&e[0].identifier:this.enablePointerEvents?t.pointerId:-1},_isMainEvent:function(t){return!0===t.isPrimary||!1!==t.isPrimary&&("touchend"===t.type&&0===t.touches.length||(!t.changedTouches||t.changedTouches[0].identifier===this.mainTouchId))},_onTouchStart:function(t){t.preventDefault(),null===this.mainTouchId&&(this.mainTouchId=this.getPointerId(t)),this.__onMouseDown(t),this._resetTransformEventData();var o=this.upperCanvasEl,a=this._getEventPrefix();e(i.document,"touchend",this._onTouchEnd,r),e(i.document,"touchmove",this._onMouseMove,r),n(o,a+"down",this._onMouseDown)},_onMouseDown:function(t){this.__onMouseDown(t),this._resetTransformEventData();var o=this.upperCanvasEl,a=this._getEventPrefix();n(o,a+"move",this._onMouseMove,r),e(i.document,a+"up",this._onMouseUp),e(i.document,a+"move",this._onMouseMove,r)},_onTouchEnd:function(t){if(!(t.touches.length>0)){this.__onMouseUp(t),this._resetTransformEventData(),this.mainTouchId=null;var o=this._getEventPrefix();n(i.document,"touchend",this._onTouchEnd,r),n(i.document,"touchmove",this._onMouseMove,r);var a=this;this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout((function(){e(a.upperCanvasEl,o+"down",a._onMouseDown),a._willAddMouseDown=0}),400)}},_onMouseUp:function(t){this.__onMouseUp(t),this._resetTransformEventData();var o=this.upperCanvasEl,a=this._getEventPrefix();this._isMainEvent(t)&&(n(i.document,a+"up",this._onMouseUp),n(i.document,a+"move",this._onMouseMove,r),e(o,a+"move",this._onMouseMove,r))},_onMouseMove:function(t){!this.allowTouchScrolling&&t.preventDefault&&t.preventDefault(),this.__onMouseMove(t)},_onResize:function(){this.calcOffset()},_shouldRender:function(t){var e=this._activeObject;return!!(!!e!==!!t||e&&t&&e!==t)||(e&&e.isEditing,!1)},__onMouseUp:function(t){var e,n=this._currentTransform,r=this._groupSelector,i=!1,a=!r||0===r.left&&0===r.top;if(this._cacheTransformEventData(t),e=this._target,this._handleEvent(t,"up:before"),!o(t,3))return o(t,2)?(this.fireMiddleClick&&this._handleEvent(t,"up",2,a),void this._resetTransformEventData()):void(this.isDrawingMode&&this._isCurrentlyDrawing?this._onMouseUpInDrawingMode(t):this._isMainEvent(t)&&(n&&(this._finalizeCurrentTransform(t),i=n.actionPerformed),a||(this._maybeGroupObjects(t),i||(i=this._shouldRender(e))),e&&(e.isMoving=!1),this._setCursorFromEvent(t,e),this._handleEvent(t,"up",1,a),this._groupSelector=null,this._currentTransform=null,e&&(e.__corner=0),i?this.requestRenderAll():a||this.renderTop()));this.fireRightClick&&this._handleEvent(t,"up",3,a)},_simpleEventHandler:function(t,e){var n=this.findTarget(e),r=this.targets,i={e:e,target:n,subTargets:r};if(this.fire(t,i),n&&n.fire(t,i),!r)return n;for(var o=0;o1&&(e=new i.ActiveSelection(n.reverse(),{canvas:this}),this.setActiveObject(e,t))},_collectObjects:function(n){for(var r,o=[],a=this._groupSelector.ex,s=this._groupSelector.ey,u=a+this._groupSelector.left,c=s+this._groupSelector.top,l=new i.Point(t(a,u),t(s,c)),h=new i.Point(e(a,u),e(s,c)),f=!this.selectionFullyContained,d=a===u&&s===c,p=this._objects.length;p--&&!((r=this._objects[p])&&r.selectable&&r.visible&&(f&&r.intersectsWithRect(l,h)||r.isContainedWithinRect(l,h)||f&&r.containsPoint(l)||f&&r.containsPoint(h))&&(o.push(r),d)););return o.length>1&&(o=o.filter((function(t){return!t.onSelect({e:n})}))),o},_maybeGroupObjects:function(t){this.selection&&this._groupSelector&&this._groupSelectedObjects(t),this.setCursor(this.defaultCursor),this._groupSelector=null}})}(),i.util.object.extend(i.StaticCanvas.prototype,{toDataURL:function(t){t||(t={});var e=t.format||"png",n=t.quality||1,r=(t.multiplier||1)*(t.enableRetinaScaling?this.getRetinaScaling():1),o=this.toCanvasElement(r,t);return i.util.toDataURL(o,e,n)},toCanvasElement:function(t,e){t=t||1;var n=((e=e||{}).width||this.width)*t,r=(e.height||this.height)*t,o=this.getZoom(),a=this.width,s=this.height,u=o*t,c=this.viewportTransform,l=(c[4]-(e.left||0))*t,h=(c[5]-(e.top||0))*t,f=this.interactive,d=[u,0,0,u,l,h],p=this.enableRetinaScaling,v=i.util.createCanvasElement(),y=this.contextTop;return v.width=n,v.height=r,this.contextTop=null,this.enableRetinaScaling=!1,this.interactive=!1,this.viewportTransform=d,this.width=n,this.height=r,this.calcViewportBoundaries(),this.renderCanvas(v.getContext("2d"),this._objects),this.viewportTransform=c,this.width=a,this.height=s,this.calcViewportBoundaries(),this.interactive=f,this.enableRetinaScaling=p,this.contextTop=y,v}}),i.util.object.extend(i.StaticCanvas.prototype,{loadFromDatalessJSON:function(t,e,n){return this.loadFromJSON(t,e,n)},loadFromJSON:function(t,e,n){if(t){var r="string"===typeof t?JSON.parse(t):i.util.object.clone(t),o=this,a=r.clipPath,s=this.renderOnAddRemove;return this.renderOnAddRemove=!1,delete r.clipPath,this._enlivenObjects(r.objects,(function(t){o.clear(),o._setBgOverlay(r,(function(){a?o._enlivenObjects([a],(function(n){o.clipPath=n[0],o.__setupCanvas.call(o,r,t,s,e)})):o.__setupCanvas.call(o,r,t,s,e)}))}),n),this}},__setupCanvas:function(t,e,n,r){var i=this;e.forEach((function(t,e){i.insertAt(t,e)})),this.renderOnAddRemove=n,delete t.objects,delete t.backgroundImage,delete t.overlayImage,delete t.background,delete t.overlay,this._setOptions(t),this.renderAll(),r&&r()},_setBgOverlay:function(t,e){var n={backgroundColor:!1,overlayColor:!1,backgroundImage:!1,overlayImage:!1};if(t.backgroundImage||t.overlayImage||t.background||t.overlay){var r=function(){n.backgroundImage&&n.overlayImage&&n.backgroundColor&&n.overlayColor&&e&&e()};this.__setBgOverlay("backgroundImage",t.backgroundImage,n,r),this.__setBgOverlay("overlayImage",t.overlayImage,n,r),this.__setBgOverlay("backgroundColor",t.background,n,r),this.__setBgOverlay("overlayColor",t.overlay,n,r)}else e&&e()},__setBgOverlay:function(t,e,n,r){var o=this;if(!e)return n[t]=!0,void(r&&r());"backgroundImage"===t||"overlayImage"===t?i.util.enlivenObjects([e],(function(e){o[t]=e[0],n[t]=!0,r&&r()})):this["set"+i.util.string.capitalize(t,!0)](e,(function(){n[t]=!0,r&&r()}))},_enlivenObjects:function(t,e,n){t&&0!==t.length?i.util.enlivenObjects(t,(function(t){e&&e(t)}),null,n):e&&e([])},_toDataURL:function(t,e){this.clone((function(n){e(n.toDataURL(t))}))},_toDataURLWithMultiplier:function(t,e,n){this.clone((function(r){n(r.toDataURLWithMultiplier(t,e))}))},clone:function(t,e){var n=JSON.stringify(this.toJSON(e));this.cloneWithoutData((function(e){e.loadFromJSON(n,(function(){t&&t(e)}))}))},cloneWithoutData:function(t){var e=i.util.createCanvasElement();e.width=this.width,e.height=this.height;var n=new i.Canvas(e);n.clipTo=this.clipTo,this.backgroundImage?(n.setBackgroundImage(this.backgroundImage.src,(function(){n.renderAll(),t&&t(n)})),n.backgroundImageOpacity=this.backgroundImageOpacity,n.backgroundImageStretch=this.backgroundImageStretch):t&&t(n)}}),function(t){"use strict";var e=t.fabric||(t.fabric={}),n=e.util.object.extend,r=e.util.object.clone,i=e.util.toFixed,o=e.util.string.capitalize,a=e.util.degreesToRadians,s=e.StaticCanvas.supports("setLineDash"),u=!e.isLikelyNode;e.Object||(e.Object=e.util.createClass(e.CommonMethods,{type:"object",originX:"left",originY:"top",top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,skewX:0,skewY:0,cornerSize:13,transparentCorners:!0,hoverCursor:null,moveCursor:null,padding:0,borderColor:"rgba(102,153,255,0.75)",borderDashArray:null,cornerColor:"rgba(102,153,255,0.5)",cornerStrokeColor:null,cornerStyle:"rect",cornerDashArray:null,centeredScaling:!1,centeredRotation:!0,fill:"rgb(0,0,0)",fillRule:"nonzero",globalCompositeOperation:"source-over",backgroundColor:"",selectionBackgroundColor:"",stroke:null,strokeWidth:1,strokeDashArray:null,strokeDashOffset:0,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:4,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,transformMatrix:null,minScaleLimit:0,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,hasRotatingPoint:!0,rotatingPointOffset:40,perPixelTargetFind:!1,includeDefaultValues:!0,clipTo:null,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockUniScaling:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,excludeFromExport:!1,objectCaching:u,statefullCache:!1,noScaleCache:!0,strokeUniform:!1,dirty:!0,__corner:0,paintFirst:"fill",stateProperties:"top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow clipTo visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform".split(" "),cacheProperties:"fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath".split(" "),clipPath:void 0,inverted:!1,absolutePositioned:!1,initialize:function(t){t&&this.setOptions(t)},_createCacheCanvas:function(){this._cacheProperties={},this._cacheCanvas=e.util.createCanvasElement(),this._cacheContext=this._cacheCanvas.getContext("2d"),this._updateCacheCanvas(),this.dirty=!0},_limitCacheSize:function(t){var n=e.perfLimitSizeTotal,r=t.width,i=t.height,o=e.maxCacheSideLimit,a=e.minCacheSideLimit;if(r<=o&&i<=o&&r*i<=n)return rl&&(t.zoomX/=r/l,t.width=l,t.capped=!0),i>h&&(t.zoomY/=i/h,t.height=h,t.capped=!0),t},_getCacheCanvasDimensions:function(){var t=this.getTotalObjectScaling(),e=this._getTransformedDimensions(0,0),n=e.x*t.scaleX/this.scaleX,r=e.y*t.scaleY/this.scaleY;return{width:n+2,height:r+2,zoomX:t.scaleX,zoomY:t.scaleY,x:n,y:r}},_updateCacheCanvas:function(){var t=this.canvas;if(this.noScaleCache&&t&&t._currentTransform){var n=t._currentTransform.target,r=t._currentTransform.action;if(this===n&&r.slice&&"scale"===r.slice(0,5))return!1}var i,o,a=this._cacheCanvas,s=this._limitCacheSize(this._getCacheCanvasDimensions()),u=e.minCacheSideLimit,c=s.width,l=s.height,h=s.zoomX,f=s.zoomY,d=c!==this.cacheWidth||l!==this.cacheHeight,p=this.zoomX!==h||this.zoomY!==f,v=d||p,y=0,g=0,m=!1;if(d){var b=this._cacheCanvas.width,_=this._cacheCanvas.height,w=c>b||l>_;m=w||(c<.9*b||l<.9*_)&&b>u&&_>u,w&&!s.capped&&(c>u||l>u)&&(y=.1*c,g=.1*l)}return!!v&&(m?(a.width=Math.ceil(c+y),a.height=Math.ceil(l+g)):(this._cacheContext.setTransform(1,0,0,1,0,0),this._cacheContext.clearRect(0,0,a.width,a.height)),i=s.x/2,o=s.y/2,this.cacheTranslationX=Math.round(a.width/2-i)+i,this.cacheTranslationY=Math.round(a.height/2-o)+o,this.cacheWidth=c,this.cacheHeight=l,this._cacheContext.translate(this.cacheTranslationX,this.cacheTranslationY),this._cacheContext.scale(h,f),this.zoomX=h,this.zoomY=f,!0)},setOptions:function(t){this._setOptions(t),this._initGradient(t.fill,"fill"),this._initGradient(t.stroke,"stroke"),this._initClipping(t),this._initPattern(t.fill,"fill"),this._initPattern(t.stroke,"stroke")},transform:function(t){var e;e=this.group&&!this.group._transformDone?this.calcTransformMatrix():this.calcOwnMatrix(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5])},toObject:function(t){var n=e.Object.NUM_FRACTION_DIGITS,r={type:this.type,version:e.version,originX:this.originX,originY:this.originY,left:i(this.left,n),top:i(this.top,n),width:i(this.width,n),height:i(this.height,n),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:i(this.strokeWidth,n),strokeDashArray:this.strokeDashArray?this.strokeDashArray.concat():this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeDashOffset:this.strokeDashOffset,strokeLineJoin:this.strokeLineJoin,strokeMiterLimit:i(this.strokeMiterLimit,n),scaleX:i(this.scaleX,n),scaleY:i(this.scaleY,n),angle:i(this.angle,n),flipX:this.flipX,flipY:this.flipY,opacity:i(this.opacity,n),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,clipTo:this.clipTo&&String(this.clipTo),backgroundColor:this.backgroundColor,fillRule:this.fillRule,paintFirst:this.paintFirst,globalCompositeOperation:this.globalCompositeOperation,transformMatrix:this.transformMatrix?this.transformMatrix.concat():null,skewX:i(this.skewX,n),skewY:i(this.skewY,n)};return this.clipPath&&(r.clipPath=this.clipPath.toObject(t),r.clipPath.inverted=this.clipPath.inverted,r.clipPath.absolutePositioned=this.clipPath.absolutePositioned),e.util.populateWithProperties(this,r,t),this.includeDefaultValues||(r=this._removeDefaultValues(r)),r},toDatalessObject:function(t){return this.toObject(t)},_removeDefaultValues:function(t){var n=e.util.getKlass(t.type).prototype;return n.stateProperties.forEach((function(e){"left"!==e&&"top"!==e&&(t[e]===n[e]&&delete t[e],"[object Array]"===Object.prototype.toString.call(t[e])&&"[object Array]"===Object.prototype.toString.call(n[e])&&0===t[e].length&&0===n[e].length&&delete t[e])})),t},toString:function(){return"#"},getObjectScaling:function(){var t=e.util.qrDecompose(this.calcTransformMatrix());return{scaleX:Math.abs(t.scaleX),scaleY:Math.abs(t.scaleY)}},getTotalObjectScaling:function(){var t=this.getObjectScaling(),e=t.scaleX,n=t.scaleY;if(this.canvas){var r=this.canvas.getZoom(),i=this.canvas.getRetinaScaling();e*=r*i,n*=r*i}return{scaleX:e,scaleY:n}},getObjectOpacity:function(){var t=this.opacity;return this.group&&(t*=this.group.getObjectOpacity()),t},_set:function(t,n){var r="scaleX"===t||"scaleY"===t,i=this[t]!==n,o=!1;return r&&(n=this._constrainScale(n)),"scaleX"===t&&n<0?(this.flipX=!this.flipX,n*=-1):"scaleY"===t&&n<0?(this.flipY=!this.flipY,n*=-1):"shadow"!==t||!n||n instanceof e.Shadow?"dirty"===t&&this.group&&this.group.set("dirty",n):n=new e.Shadow(n),this[t]=n,i&&(o=this.group&&this.group.isOnACache(),this.cacheProperties.indexOf(t)>-1?(this.dirty=!0,o&&this.group.set("dirty",!0)):o&&this.stateProperties.indexOf(t)>-1&&this.group.set("dirty",!0)),this},setOnGroup:function(){},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:e.iMatrix.concat()},isNotVisible:function(){return 0===this.opacity||0===this.width&&0===this.height&&0===this.strokeWidth||!this.visible},render:function(t){this.isNotVisible()||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(t.save(),this._setupCompositeOperation(t),this.drawSelectionBackground(t),this.transform(t),this._setOpacity(t),this._setShadow(t,this),this.transformMatrix&&t.transform.apply(t,this.transformMatrix),this.clipTo&&e.util.clipContext(this,t),this.shouldCache()?(this.renderCache(),this.drawCacheOnCanvas(t)):(this._removeCacheCanvas(),this.dirty=!1,this.drawObject(t),this.objectCaching&&this.statefullCache&&this.saveState({propertySet:"cacheProperties"})),this.clipTo&&t.restore(),t.restore())},renderCache:function(t){t=t||{},this._cacheCanvas||this._createCacheCanvas(),this.isCacheDirty()&&(this.statefullCache&&this.saveState({propertySet:"cacheProperties"}),this.drawObject(this._cacheContext,t.forClipping),this.dirty=!1)},_removeCacheCanvas:function(){this._cacheCanvas=null,this.cacheWidth=0,this.cacheHeight=0},hasStroke:function(){return this.stroke&&"transparent"!==this.stroke&&0!==this.strokeWidth},hasFill:function(){return this.fill&&"transparent"!==this.fill},needsItsOwnCache:function(){return!("stroke"!==this.paintFirst||!this.hasFill()||!this.hasStroke()||"object"!==typeof this.shadow)||!!this.clipPath},shouldCache:function(){return this.ownCaching=this.needsItsOwnCache()||this.objectCaching&&(!this.group||!this.group.isOnACache()),this.ownCaching},willDrawShadow:function(){return!!this.shadow&&(0!==this.shadow.offsetX||0!==this.shadow.offsetY)},drawClipPathOnCache:function(t){var n=this.clipPath;if(t.save(),n.inverted?t.globalCompositeOperation="destination-out":t.globalCompositeOperation="destination-in",n.absolutePositioned){var r=e.util.invertTransform(this.calcTransformMatrix());t.transform(r[0],r[1],r[2],r[3],r[4],r[5])}n.transform(t),t.scale(1/n.zoomX,1/n.zoomY),t.drawImage(n._cacheCanvas,-n.cacheTranslationX,-n.cacheTranslationY),t.restore()},drawObject:function(t,e){var n=this.fill,r=this.stroke;e?(this.fill="black",this.stroke="",this._setClippingProperties(t)):(this._renderBackground(t),this._setStrokeStyles(t,this),this._setFillStyles(t,this)),this._render(t),this._drawClipPath(t),this.fill=n,this.stroke=r},_drawClipPath:function(t){var e=this.clipPath;e&&(e.canvas=this.canvas,e.shouldCache(),e._transformDone=!0,e.renderCache({forClipping:!0}),this.drawClipPathOnCache(t))},drawCacheOnCanvas:function(t){t.scale(1/this.zoomX,1/this.zoomY),t.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)},isCacheDirty:function(t){if(this.isNotVisible())return!1;if(this._cacheCanvas&&!t&&this._updateCacheCanvas())return!0;if(this.dirty||this.clipPath&&this.clipPath.absolutePositioned||this.statefullCache&&this.hasStateChanged("cacheProperties")){if(this._cacheCanvas&&!t){var e=this.cacheWidth/this.zoomX,n=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-e/2,-n/2,e,n)}return!0}return!1},_renderBackground:function(t){if(this.backgroundColor){var e=this._getNonTransformedDimensions();t.fillStyle=this.backgroundColor,t.fillRect(-e.x/2,-e.y/2,e.x,e.y),this._removeShadow(t)}},_setOpacity:function(t){this.group&&!this.group._transformDone?t.globalAlpha=this.getObjectOpacity():t.globalAlpha*=this.opacity},_setStrokeStyles:function(t,e){e.stroke&&(t.lineWidth=e.strokeWidth,t.lineCap=e.strokeLineCap,t.lineDashOffset=e.strokeDashOffset,t.lineJoin=e.strokeLineJoin,t.miterLimit=e.strokeMiterLimit,t.strokeStyle=e.stroke.toLive?e.stroke.toLive(t,this):e.stroke)},_setFillStyles:function(t,e){e.fill&&(t.fillStyle=e.fill.toLive?e.fill.toLive(t,this):e.fill)},_setClippingProperties:function(t){t.globalAlpha=1,t.strokeStyle="transparent",t.fillStyle="#000000"},_setLineDash:function(t,e,n){e&&0!==e.length&&(1&e.length&&e.push.apply(e,e),s?t.setLineDash(e):n&&n(t))},_renderControls:function(t,n){var r,i,o,s=this.getViewportTransform(),u=this.calcTransformMatrix();i="undefined"!==typeof(n=n||{}).hasBorders?n.hasBorders:this.hasBorders,o="undefined"!==typeof n.hasControls?n.hasControls:this.hasControls,u=e.util.multiplyTransformMatrices(s,u),r=e.util.qrDecompose(u),t.save(),t.translate(r.translateX,r.translateY),t.lineWidth=1*this.borderScaleFactor,this.group||(t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),n.forActiveSelection?(t.rotate(a(r.angle)),i&&this.drawBordersInGroup(t,r,n)):(t.rotate(a(this.angle)),i&&this.drawBorders(t,n)),o&&this.drawControls(t,n),t.restore()},_setShadow:function(t){if(this.shadow){var n,r=this.shadow,i=this.canvas,o=i&&i.viewportTransform[0]||1,a=i&&i.viewportTransform[3]||1;n=r.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),i&&i._isRetinaScaling()&&(o*=e.devicePixelRatio,a*=e.devicePixelRatio),t.shadowColor=r.color,t.shadowBlur=r.blur*e.browserShadowBlurConstant*(o+a)*(n.scaleX+n.scaleY)/4,t.shadowOffsetX=r.offsetX*o*n.scaleX,t.shadowOffsetY=r.offsetY*a*n.scaleY}},_removeShadow:function(t){this.shadow&&(t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0)},_applyPatternGradientTransform:function(t,e){if(!e||!e.toLive)return{offsetX:0,offsetY:0};var n=e.gradientTransform||e.patternTransform,r=-this.width/2+e.offsetX||0,i=-this.height/2+e.offsetY||0;return"percentage"===e.gradientUnits?t.transform(this.width,0,0,this.height,r,i):t.transform(1,0,0,1,r,i),n&&t.transform(n[0],n[1],n[2],n[3],n[4],n[5]),{offsetX:r,offsetY:i}},_renderPaintInOrder:function(t){"stroke"===this.paintFirst?(this._renderStroke(t),this._renderFill(t)):(this._renderFill(t),this._renderStroke(t))},_render:function(){},_renderFill:function(t){this.fill&&(t.save(),this._applyPatternGradientTransform(t,this.fill),"evenodd"===this.fillRule?t.fill("evenodd"):t.fill(),t.restore())},_renderStroke:function(t){if(this.stroke&&0!==this.strokeWidth){if(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this.strokeUniform&&this.group){var e=this.getObjectScaling();t.scale(1/e.scaleX,1/e.scaleY)}else this.strokeUniform&&t.scale(1/this.scaleX,1/this.scaleY);this._setLineDash(t,this.strokeDashArray,this._renderDashedStroke),this.stroke.toLive&&"percentage"===this.stroke.gradientUnits?this._applyPatternForTransformedGradient(t,this.stroke):this._applyPatternGradientTransform(t,this.stroke),t.stroke(),t.restore()}},_applyPatternForTransformedGradient:function(t,n){var r,i=this._limitCacheSize(this._getCacheCanvasDimensions()),o=e.util.createCanvasElement(),a=this.canvas.getRetinaScaling(),s=i.x/this.scaleX/a,u=i.y/this.scaleY/a;o.width=s,o.height=u,(r=o.getContext("2d")).beginPath(),r.moveTo(0,0),r.lineTo(s,0),r.lineTo(s,u),r.lineTo(0,u),r.closePath(),r.translate(s/2,u/2),r.scale(i.zoomX/this.scaleX/a,i.zoomY/this.scaleY/a),this._applyPatternGradientTransform(r,n),r.fillStyle=n.toLive(t),r.fill(),t.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),t.scale(a*this.scaleX/i.zoomX,a*this.scaleY/i.zoomY),t.strokeStyle=r.createPattern(o,"no-repeat")},_findCenterFromElement:function(){return{x:this.left+this.width/2,y:this.top+this.height/2}},_assignTransformMatrixProps:function(){if(this.transformMatrix){var t=e.util.qrDecompose(this.transformMatrix);this.flipX=!1,this.flipY=!1,this.set("scaleX",t.scaleX),this.set("scaleY",t.scaleY),this.angle=t.angle,this.skewX=t.skewX,this.skewY=0}},_removeTransformMatrix:function(t){var n=this._findCenterFromElement();this.transformMatrix&&(this._assignTransformMatrixProps(),n=e.util.transformPoint(n,this.transformMatrix)),this.transformMatrix=null,t&&(this.scaleX*=t.scaleX,this.scaleY*=t.scaleY,this.cropX=t.cropX,this.cropY=t.cropY,n.x+=t.offsetLeft,n.y+=t.offsetTop,this.width=t.width,this.height=t.height),this.setPositionByOrigin(n,"center","center")},clone:function(t,n){var r=this.toObject(n);this.constructor.fromObject?this.constructor.fromObject(r,t):e.Object._fromObject("Object",r,t)},cloneAsImage:function(t,n){var r=this.toCanvasElement(n);return t&&t(new e.Image(r)),this},toCanvasElement:function(t){t||(t={});var n=e.util,r=n.saveObjectTransform(this),i=this.group,o=this.shadow,a=Math.abs,s=(t.multiplier||1)*(t.enableRetinaScaling?e.devicePixelRatio:1);delete this.group,t.withoutTransform&&n.resetObjectTransform(this),t.withoutShadow&&(this.shadow=null);var u,c,l,h,f=e.util.createCanvasElement(),d=this.getBoundingRect(!0,!0),p=this.shadow,v={x:0,y:0};p&&(c=p.blur,u=p.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),v.x=2*Math.round(a(p.offsetX)+c)*a(u.scaleX),v.y=2*Math.round(a(p.offsetY)+c)*a(u.scaleY)),l=d.width+v.x,h=d.height+v.y,f.width=Math.ceil(l),f.height=Math.ceil(h);var y=new e.StaticCanvas(f,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1});"jpeg"===t.format&&(y.backgroundColor="#fff"),this.setPositionByOrigin(new e.Point(y.width/2,y.height/2),"center","center");var g=this.canvas;y.add(this);var m=y.toCanvasElement(s||1,t);return this.shadow=o,this.set("canvas",g),i&&(this.group=i),this.set(r).setCoords(),y._objects=[],y.dispose(),y=null,m},toDataURL:function(t){return t||(t={}),e.util.toDataURL(this.toCanvasElement(t),t.format||"png",t.quality||1)},isType:function(t){return this.type===t},complexity:function(){return 1},toJSON:function(t){return this.toObject(t)},setGradient:function(t,n){n||(n={});var r={colorStops:[]};return r.type=n.type||(n.r1||n.r2?"radial":"linear"),r.coords={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2},r.gradientUnits=n.gradientUnits||"pixels",(n.r1||n.r2)&&(r.coords.r1=n.r1,r.coords.r2=n.r2),r.gradientTransform=n.gradientTransform,e.Gradient.prototype.addColorStop.call(r,n.colorStops),this.set(t,e.Gradient.forObject(this,r))},setPatternFill:function(t,n){return this.set("fill",new e.Pattern(t,n))},setShadow:function(t){return this.set("shadow",t?new e.Shadow(t):null)},setColor:function(t){return this.set("fill",t),this},rotate:function(t){var e=("center"!==this.originX||"center"!==this.originY)&&this.centeredRotation;return e&&this._setOriginToCenter(),this.set("angle",t),e&&this._resetOrigin(),this},centerH:function(){return this.canvas&&this.canvas.centerObjectH(this),this},viewportCenterH:function(){return this.canvas&&this.canvas.viewportCenterObjectH(this),this},centerV:function(){return this.canvas&&this.canvas.centerObjectV(this),this},viewportCenterV:function(){return this.canvas&&this.canvas.viewportCenterObjectV(this),this},center:function(){return this.canvas&&this.canvas.centerObject(this),this},viewportCenter:function(){return this.canvas&&this.canvas.viewportCenterObject(this),this},getLocalPointer:function(t,n){n=n||this.canvas.getPointer(t);var r=new e.Point(n.x,n.y),i=this._getLeftTopCoords();return this.angle&&(r=e.util.rotatePoint(r,i,a(-this.angle))),{x:r.x-i.x,y:r.y-i.y}},_setupCompositeOperation:function(t){this.globalCompositeOperation&&(t.globalCompositeOperation=this.globalCompositeOperation)}}),e.util.createAccessors&&e.util.createAccessors(e.Object),n(e.Object.prototype,e.Observable),e.Object.NUM_FRACTION_DIGITS=2,e.Object._fromObject=function(t,n,i,o){var a=e[t];n=r(n,!0),e.util.enlivenPatterns([n.fill,n.stroke],(function(t){"undefined"!==typeof t[0]&&(n.fill=t[0]),"undefined"!==typeof t[1]&&(n.stroke=t[1]),e.util.enlivenObjects([n.clipPath],(function(t){n.clipPath=t[0];var e=o?new a(n[o],n):new a(n);i&&i(e)}))}))},e.Object.__uid=0)}(e),function(){var t=i.util.degreesToRadians,e={left:-.5,center:0,right:.5},n={top:-.5,center:0,bottom:.5};i.util.object.extend(i.Object.prototype,{translateToGivenOrigin:function(t,r,o,a,s){var u,c,l,h=t.x,f=t.y;return"string"===typeof r?r=e[r]:r-=.5,"string"===typeof a?a=e[a]:a-=.5,"string"===typeof o?o=n[o]:o-=.5,"string"===typeof s?s=n[s]:s-=.5,c=s-o,((u=a-r)||c)&&(l=this._getTransformedDimensions(),h=t.x+u*l.x,f=t.y+c*l.y),new i.Point(h,f)},translateToCenterPoint:function(e,n,r){var o=this.translateToGivenOrigin(e,n,r,"center","center");return this.angle?i.util.rotatePoint(o,e,t(this.angle)):o},translateToOriginPoint:function(e,n,r){var o=this.translateToGivenOrigin(e,"center","center",n,r);return this.angle?i.util.rotatePoint(o,e,t(this.angle)):o},getCenterPoint:function(){var t=new i.Point(this.left,this.top);return this.translateToCenterPoint(t,this.originX,this.originY)},getPointByOrigin:function(t,e){var n=this.getCenterPoint();return this.translateToOriginPoint(n,t,e)},toLocalPoint:function(e,n,r){var o,a,s=this.getCenterPoint();return o="undefined"!==typeof n&&"undefined"!==typeof r?this.translateToGivenOrigin(s,"center","center",n,r):new i.Point(this.left,this.top),a=new i.Point(e.x,e.y),this.angle&&(a=i.util.rotatePoint(a,s,-t(this.angle))),a.subtractEquals(o)},setPositionByOrigin:function(t,e,n){var r=this.translateToCenterPoint(t,e,n),i=this.translateToOriginPoint(r,this.originX,this.originY);this.set("left",i.x),this.set("top",i.y)},adjustPosition:function(n){var r,o,a=t(this.angle),s=this.getScaledWidth(),u=i.util.cos(a)*s,c=i.util.sin(a)*s;r="string"===typeof this.originX?e[this.originX]:this.originX-.5,o="string"===typeof n?e[n]:n-.5,this.left+=u*(o-r),this.top+=c*(o-r),this.setCoords(),this.originX=n},_setOriginToCenter:function(){this._originalOriginX=this.originX,this._originalOriginY=this.originY;var t=this.getCenterPoint();this.originX="center",this.originY="center",this.left=t.x,this.top=t.y},_resetOrigin:function(){var t=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX,this.originY=this._originalOriginY,this.left=t.x,this.top=t.y,this._originalOriginX=null,this._originalOriginY=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),"left","top")}})}(),function(){var t=i.util.degreesToRadians,e=i.util.multiplyTransformMatrices,n=i.util.transformPoint;i.util.object.extend(i.Object.prototype,{oCoords:null,aCoords:null,ownMatrixCache:null,matrixCache:null,getCoords:function(t,e){this.oCoords||this.setCoords();var n=t?this.aCoords:this.oCoords;return function(t){return[new i.Point(t.tl.x,t.tl.y),new i.Point(t.tr.x,t.tr.y),new i.Point(t.br.x,t.br.y),new i.Point(t.bl.x,t.bl.y)]}(e?this.calcCoords(t):n)},intersectsWithRect:function(t,e,n,r){var o=this.getCoords(n,r);return"Intersection"===i.Intersection.intersectPolygonRectangle(o,t,e).status},intersectsWithObject:function(t,e,n){return"Intersection"===i.Intersection.intersectPolygonPolygon(this.getCoords(e,n),t.getCoords(e,n)).status||t.isContainedWithinObject(this,e,n)||this.isContainedWithinObject(t,e,n)},isContainedWithinObject:function(t,e,n){for(var r=this.getCoords(e,n),i=0,o=t._getImageLines(n?t.calcCoords(e):e?t.aCoords:t.oCoords);i<4;i++)if(!t.containsPoint(r[i],o))return!1;return!0},isContainedWithinRect:function(t,e,n,r){var i=this.getBoundingRect(n,r);return i.left>=t.x&&i.left+i.width<=e.x&&i.top>=t.y&&i.top+i.height<=e.y},containsPoint:function(t,e,n,r){e=e||this._getImageLines(r?this.calcCoords(n):n?this.aCoords:this.oCoords);var i=this._findCrossPoints(t,e);return 0!==i&&i%2===1},isOnScreen:function(t){if(!this.canvas)return!1;for(var e,n=this.canvas.vptCoords.tl,r=this.canvas.vptCoords.br,i=this.getCoords(!0,t),o=0;o<4;o++)if((e=i[o]).x<=r.x&&e.x>=n.x&&e.y<=r.y&&e.y>=n.y)return!0;return!!this.intersectsWithRect(n,r,!0,t)||this._containsCenterOfCanvas(n,r,t)},_containsCenterOfCanvas:function(t,e,n){var r={x:(t.x+e.x)/2,y:(t.y+e.y)/2};return!!this.containsPoint(r,null,!0,n)},isPartiallyOnScreen:function(t){if(!this.canvas)return!1;var e=this.canvas.vptCoords.tl,n=this.canvas.vptCoords.br;return!!this.intersectsWithRect(e,n,!0,t)||this._containsCenterOfCanvas(e,n,t)},_getImageLines:function(t){return{topline:{o:t.tl,d:t.tr},rightline:{o:t.tr,d:t.br},bottomline:{o:t.br,d:t.bl},leftline:{o:t.bl,d:t.tl}}},_findCrossPoints:function(t,e){var n,r,i,o=0;for(var a in e)if(!((i=e[a]).o.y=t.y&&i.d.y>=t.y)&&(i.o.x===i.d.x&&i.o.x>=t.x?r=i.o.x:(0,n=(i.d.y-i.o.y)/(i.d.x-i.o.x),r=-(t.y-0*t.x-(i.o.y-n*i.o.x))/(0-n)),r>=t.x&&(o+=1),2===o))break;return o},getBoundingRect:function(t,e){var n=this.getCoords(t,e);return i.util.makeBoundingBoxFromPoints(n)},getScaledWidth:function(){return this._getTransformedDimensions().x},getScaledHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(t){return Math.abs(t)\n')}},toSVG:function(t){return this._createBaseSVGMarkup(this._toSVG(t),{reviver:t})},toClipPathSVG:function(t){return"\t"+this._createBaseClipPathSVGMarkup(this._toSVG(t),{reviver:t})},_createBaseClipPathSVGMarkup:function(t,e){var n=(e=e||{}).reviver,r=e.additionalTransform||"",i=[this.getSvgTransform(!0,r),this.getSvgCommons()].join(""),o=t.indexOf("COMMON_PARTS");return t[o]=i,n?n(t.join("")):t.join("")},_createBaseSVGMarkup:function(t,e){var n,r,o=(e=e||{}).noStyle,a=e.reviver,s=o?"":'style="'+this.getSvgStyles()+'" ',u=e.withShadow?'style="'+this.getSvgFilter()+'" ':"",c=this.clipPath,l=this.strokeUniform?'vector-effect="non-scaling-stroke" ':"",h=c&&c.absolutePositioned,f=this.stroke,d=this.fill,p=this.shadow,v=[],y=t.indexOf("COMMON_PARTS"),g=e.additionalTransform;return c&&(c.clipPathId="CLIPPATH_"+i.Object.__uid++,r='\n'+c.toClipPathSVG(a)+"\n"),h&&v.push("\n"),v.push("\n"),n=[s,l,o?"":this.addPaintOrder()," ",g?'transform="'+g+'" ':""].join(""),t[y]=n,d&&d.toLive&&v.push(d.toSVG(this)),f&&f.toLive&&v.push(f.toSVG(this)),p&&v.push(p.toSVG(this)),c&&v.push(r),v.push(t.join("")),v.push("\n"),h&&v.push("\n"),a?a(v.join("")):v.join("")},addPaintOrder:function(){return"fill"!==this.paintFirst?' paint-order="'+this.paintFirst+'" ':""}})}(),function(){var t=i.util.object.extend;function e(e,n,r){var i={};r.forEach((function(t){i[t]=e[t]})),t(e[n],i,!0)}i.util.object.extend(i.Object.prototype,{hasStateChanged:function(t){var e="_"+(t=t||"stateProperties");return Object.keys(this[e]).length\n']}}),e.Line.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")),e.Line.fromElement=function(t,r,i){i=i||{};var o=e.parseAttributes(t,e.Line.ATTRIBUTE_NAMES),a=[o.x1||0,o.y1||0,o.x2||0,o.y2||0];r(new e.Line(a,n(o,i)))},e.Line.fromObject=function(t,n){var i=r(t,!0);i.points=[t.x1,t.y1,t.x2,t.y2],e.Object._fromObject("Line",i,(function(t){delete t.points,n&&n(t)}),"points")})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),n=Math.PI;e.Circle?e.warn("fabric.Circle is already defined."):(e.Circle=e.util.createClass(e.Object,{type:"circle",radius:0,startAngle:0,endAngle:2*n,cacheProperties:e.Object.prototype.cacheProperties.concat("radius","startAngle","endAngle"),_set:function(t,e){return this.callSuper("_set",t,e),"radius"===t&&this.setRadius(e),this},toObject:function(t){return this.callSuper("toObject",["radius","startAngle","endAngle"].concat(t))},_toSVG:function(){var t,r=(this.endAngle-this.startAngle)%(2*n);if(0===r)t=["\n'];else{var i=e.util.cos(this.startAngle)*this.radius,o=e.util.sin(this.startAngle)*this.radius,a=e.util.cos(this.endAngle)*this.radius,s=e.util.sin(this.endAngle)*this.radius,u=r>n?"1":"0";t=['\n"]}return t},_render:function(t){t.beginPath(),t.arc(0,0,this.radius,this.startAngle,this.endAngle,!1),this._renderPaintInOrder(t)},getRadiusX:function(){return this.get("radius")*this.get("scaleX")},getRadiusY:function(){return this.get("radius")*this.get("scaleY")},setRadius:function(t){return this.radius=t,this.set("width",2*t).set("height",2*t)}}),e.Circle.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")),e.Circle.fromElement=function(t,n){var r,i=e.parseAttributes(t,e.Circle.ATTRIBUTE_NAMES);if(!("radius"in(r=i)&&r.radius>=0))throw new Error("value of `r` attribute is required and can not be negative");i.left=(i.left||0)-i.radius,i.top=(i.top||0)-i.radius,n(new e.Circle(i))},e.Circle.fromObject=function(t,n){return e.Object._fromObject("Circle",t,n)})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={});e.Triangle?e.warn("fabric.Triangle is already defined"):(e.Triangle=e.util.createClass(e.Object,{type:"triangle",width:100,height:100,_render:function(t){var e=this.width/2,n=this.height/2;t.beginPath(),t.moveTo(-e,n),t.lineTo(0,-n),t.lineTo(e,n),t.closePath(),this._renderPaintInOrder(t)},_renderDashedStroke:function(t){var n=this.width/2,r=this.height/2;t.beginPath(),e.util.drawDashedLine(t,-n,r,0,-r,this.strokeDashArray),e.util.drawDashedLine(t,0,-r,n,r,this.strokeDashArray),e.util.drawDashedLine(t,n,r,-n,r,this.strokeDashArray),t.closePath()},_toSVG:function(){var t=this.width/2,e=this.height/2;return["']}}),e.Triangle.fromObject=function(t,n){return e.Object._fromObject("Triangle",t,n)})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),n=2*Math.PI;e.Ellipse?e.warn("fabric.Ellipse is already defined."):(e.Ellipse=e.util.createClass(e.Object,{type:"ellipse",rx:0,ry:0,cacheProperties:e.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(t){this.callSuper("initialize",t),this.set("rx",t&&t.rx||0),this.set("ry",t&&t.ry||0)},_set:function(t,e){switch(this.callSuper("_set",t,e),t){case"rx":this.rx=e,this.set("width",2*e);break;case"ry":this.ry=e,this.set("height",2*e)}return this},getRx:function(){return this.get("rx")*this.get("scaleX")},getRy:function(){return this.get("ry")*this.get("scaleY")},toObject:function(t){return this.callSuper("toObject",["rx","ry"].concat(t))},_toSVG:function(){return["\n']},_render:function(t){t.beginPath(),t.save(),t.transform(1,0,0,this.ry/this.rx,0,0),t.arc(0,0,this.rx,0,n,!1),t.restore(),this._renderPaintInOrder(t)}}),e.Ellipse.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")),e.Ellipse.fromElement=function(t,n){var r=e.parseAttributes(t,e.Ellipse.ATTRIBUTE_NAMES);r.left=(r.left||0)-r.rx,r.top=(r.top||0)-r.ry,n(new e.Ellipse(r))},e.Ellipse.fromObject=function(t,n){return e.Object._fromObject("Ellipse",t,n)})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),n=e.util.object.extend;e.Rect?e.warn("fabric.Rect is already defined"):(e.Rect=e.util.createClass(e.Object,{stateProperties:e.Object.prototype.stateProperties.concat("rx","ry"),type:"rect",rx:0,ry:0,cacheProperties:e.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(t){this.callSuper("initialize",t),this._initRxRy()},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(t){var e=this.rx?Math.min(this.rx,this.width/2):0,n=this.ry?Math.min(this.ry,this.height/2):0,r=this.width,i=this.height,o=-this.width/2,a=-this.height/2,s=0!==e||0!==n,u=.4477152502;t.beginPath(),t.moveTo(o+e,a),t.lineTo(o+r-e,a),s&&t.bezierCurveTo(o+r-u*e,a,o+r,a+u*n,o+r,a+n),t.lineTo(o+r,a+i-n),s&&t.bezierCurveTo(o+r,a+i-u*n,o+r-u*e,a+i,o+r-e,a+i),t.lineTo(o+e,a+i),s&&t.bezierCurveTo(o+u*e,a+i,o,a+i-u*n,o,a+i-n),t.lineTo(o,a+n),s&&t.bezierCurveTo(o,a+u*n,o+u*e,a,o+e,a),t.closePath(),this._renderPaintInOrder(t)},_renderDashedStroke:function(t){var n=-this.width/2,r=-this.height/2,i=this.width,o=this.height;t.beginPath(),e.util.drawDashedLine(t,n,r,n+i,r,this.strokeDashArray),e.util.drawDashedLine(t,n+i,r,n+i,r+o,this.strokeDashArray),e.util.drawDashedLine(t,n+i,r+o,n,r+o,this.strokeDashArray),e.util.drawDashedLine(t,n,r+o,n,r,this.strokeDashArray),t.closePath()},toObject:function(t){return this.callSuper("toObject",["rx","ry"].concat(t))},_toSVG:function(){return["\n']}}),e.Rect.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")),e.Rect.fromElement=function(t,r,i){if(!t)return r(null);i=i||{};var o=e.parseAttributes(t,e.Rect.ATTRIBUTE_NAMES);o.left=o.left||0,o.top=o.top||0,o.height=o.height||0,o.width=o.width||0;var a=new e.Rect(n(i?e.util.object.clone(i):{},o));a.visible=a.visible&&a.width>0&&a.height>0,r(a)},e.Rect.fromObject=function(t,n){return e.Object._fromObject("Rect",t,n)})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),n=e.util.object.extend,r=e.util.array.min,i=e.util.array.max,o=e.util.toFixed;e.Polyline?e.warn("fabric.Polyline is already defined"):(e.Polyline=e.util.createClass(e.Object,{type:"polyline",points:null,cacheProperties:e.Object.prototype.cacheProperties.concat("points"),initialize:function(t,e){e=e||{},this.points=t||[],this.callSuper("initialize",e),this._setPositionDimensions(e)},_setPositionDimensions:function(t){var e,n=this._calcDimensions(t);this.width=n.width,this.height=n.height,t.fromSVG||(e=this.translateToGivenOrigin({x:n.left-this.strokeWidth/2,y:n.top-this.strokeWidth/2},"left","top",this.originX,this.originY)),"undefined"===typeof t.left&&(this.left=t.fromSVG?n.left:e.x),"undefined"===typeof t.top&&(this.top=t.fromSVG?n.top:e.y),this.pathOffset={x:n.left+this.width/2,y:n.top+this.height/2}},_calcDimensions:function(){var t=this.points,e=r(t,"x")||0,n=r(t,"y")||0;return{left:e,top:n,width:(i(t,"x")||0)-e,height:(i(t,"y")||0)-n}},toObject:function(t){return n(this.callSuper("toObject",t),{points:this.points.concat()})},_toSVG:function(){for(var t=[],n=this.pathOffset.x,r=this.pathOffset.y,i=e.Object.NUM_FRACTION_DIGITS,a=0,s=this.points.length;a\n']},commonRender:function(t){var e,n=this.points.length,r=this.pathOffset.x,i=this.pathOffset.y;if(!n||isNaN(this.points[n-1].y))return!1;t.beginPath(),t.moveTo(this.points[0].x-r,this.points[0].y-i);for(var o=0;o"},toObject:function(t){return i(this.callSuper("toObject",t),{path:this.path.map((function(t){return t.slice()}))})},toDatalessObject:function(t){var e=this.toObject(["sourcePath"].concat(t));return e.sourcePath&&delete e.path,e},_toSVG:function(){return["\n"]},_getOffsetTransform:function(){var t=e.Object.NUM_FRACTION_DIGITS;return" translate("+s(-this.pathOffset.x,t)+", "+s(-this.pathOffset.y,t)+")"},toClipPathSVG:function(t){var e=this._getOffsetTransform();return"\t"+this._createBaseClipPathSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})},toSVG:function(t){var e=this._getOffsetTransform();return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})},complexity:function(){return this.path.length},_parsePath:function(){for(var t,n,r,i,o,a=[],s=[],l=e.rePathCommand,h=0,f=this.path.length;hy)for(var m=1,b=o.length;m"},addWithUpdate:function(t){return this._restoreObjectsState(),e.util.resetObjectTransform(this),t&&(this._objects.push(t),t.group=this,t._set("canvas",this.canvas)),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},removeWithUpdate:function(t){return this._restoreObjectsState(),e.util.resetObjectTransform(this),this.remove(t),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},_onObjectAdded:function(t){this.dirty=!0,t.group=this,t._set("canvas",this.canvas)},_onObjectRemoved:function(t){this.dirty=!0,delete t.group},_set:function(t,n){var r=this._objects.length;if(this.useSetOnGroup)for(;r--;)this._objects[r].setOnGroup(t,n);if("canvas"===t)for(;r--;)this._objects[r]._set(t,n);e.Object.prototype._set.call(this,t,n)},toObject:function(t){var n=this.includeDefaultValues,r=this._objects.map((function(e){var r=e.includeDefaultValues;e.includeDefaultValues=n;var i=e.toObject(t);return e.includeDefaultValues=r,i})),i=e.Object.prototype.toObject.call(this,t);return i.objects=r,i},toDatalessObject:function(t){var n,r=this.sourcePath;if(r)n=r;else{var i=this.includeDefaultValues;n=this._objects.map((function(e){var n=e.includeDefaultValues;e.includeDefaultValues=i;var r=e.toDatalessObject(t);return e.includeDefaultValues=n,r}))}var o=e.Object.prototype.toDatalessObject.call(this,t);return o.objects=n,o},render:function(t){this._transformDone=!0,this.callSuper("render",t),this._transformDone=!1},shouldCache:function(){var t=e.Object.prototype.shouldCache.call(this);if(t)for(var n=0,r=this._objects.length;n\n"],n=0,r=this._objects.length;n\n"),e},getSvgStyles:function(){var t="undefined"!==typeof this.opacity&&1!==this.opacity?"opacity: "+this.opacity+";":"",e=this.visible?"":" visibility: hidden;";return[t,this.getSvgFilter(),e].join("")},toClipPathSVG:function(t){for(var e=[],n=0,r=this._objects.length;n"},shouldCache:function(){return!1},isOnACache:function(){return!1},_renderControls:function(t,e,n){t.save(),t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,this.callSuper("_renderControls",t,e),"undefined"===typeof(n=n||{}).hasControls&&(n.hasControls=!1),"undefined"===typeof n.hasRotatingPoint&&(n.hasRotatingPoint=!1),n.forActiveSelection=!0;for(var r=0,i=this._objects.length;r\n','\t\n',"\n"),a=' clip-path="url(#imageCrop_'+s+')" '}if(n.push("\t\n"),this.stroke||this.strokeDashArray){var u=this.fill;this.fill=null,t=["\t\n'],this.fill=u}return e="fill"!==this.paintFirst?e.concat(t,n):e.concat(n,t)},getSrc:function(t){var e=t?this._element:this._originalElement;return e?e.toDataURL?e.toDataURL():this.srcFromAttribute?e.getAttribute("src"):e.src:this.src||""},setSrc:function(t,e,n){return i.util.loadImage(t,(function(t){this.setElement(t,n),this._setWidthHeight(),e&&e(this)}),this,n&&n.crossOrigin),this},toString:function(){return'#'},applyResizeFilters:function(){var t=this.resizeFilter,e=this.minimumScaleTrigger,n=this.getTotalObjectScaling(),r=n.scaleX,o=n.scaleY,a=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!t||r>e&&o>e)return this._element=a,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=r,void(this._lastScaleY=o);i.filterBackend||(i.filterBackend=i.initFilterBackend());var s=i.util.createCanvasElement(),u=this._filteredEl?this.cacheKey+"_filtered":this.cacheKey,c=a.width,l=a.height;s.width=c,s.height=l,this._element=s,this._lastScaleX=t.scaleX=r,this._lastScaleY=t.scaleY=o,i.filterBackend.applyFilters([t],a,c,l,this._element,u),this._filterScalingX=s.width/this._originalElement.width,this._filterScalingY=s.height/this._originalElement.height},applyFilters:function(t){if(t=(t=t||this.filters||[]).filter((function(t){return t&&!t.isNeutralState()})),this.set("dirty",!0),this.removeTexture(this.cacheKey+"_filtered"),0===t.length)return this._element=this._originalElement,this._filteredEl=null,this._filterScalingX=1,this._filterScalingY=1,this;var e=this._originalElement,n=e.naturalWidth||e.width,r=e.naturalHeight||e.height;if(this._element===this._originalElement){var o=i.util.createCanvasElement();o.width=n,o.height=r,this._element=o,this._filteredEl=o}else this._element=this._filteredEl,this._filteredEl.getContext("2d").clearRect(0,0,n,r),this._lastScaleX=1,this._lastScaleY=1;return i.filterBackend||(i.filterBackend=i.initFilterBackend()),i.filterBackend.applyFilters(t,this._originalElement,n,r,this._element,this.cacheKey),this._originalElement.width===this._element.width&&this._originalElement.height===this._element.height||(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height),this},_render:function(t){!0!==this.isMoving&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(t),this._renderPaintInOrder(t)},shouldCache:function(){return this.needsItsOwnCache()},_renderFill:function(t){var e=this._element;if(e){var n=this._filterScalingX,r=this._filterScalingY,i=this.width,o=this.height,a=Math.min,s=Math.max,u=s(this.cropX,0),c=s(this.cropY,0),l=e.naturalWidth||e.width,h=e.naturalHeight||e.height,f=u*n,d=c*r,p=a(i*n,l-f),v=a(o*r,h-d),y=-i/2,g=-o/2,m=a(i,l/n-u),b=a(o,h/n-c);e&&t.drawImage(e,f,d,p,v,y,g,m,b)}},_needsResize:function(){var t=this.getTotalObjectScaling();return t.scaleX!==this._lastScaleX||t.scaleY!==this._lastScaleY},_resetWidthHeight:function(){this.set(this.getOriginalSize())},_initElement:function(t,e){this.setElement(i.util.getById(t),e),i.util.addClass(this.getElement(),i.Image.CSS_CANVAS)},_initConfig:function(t){t||(t={}),this.setOptions(t),this._setWidthHeight(t),this._element&&this.crossOrigin&&(this._element.crossOrigin=this.crossOrigin)},_initFilters:function(t,e){t&&t.length?i.util.enlivenObjects(t,(function(t){e&&e(t)}),"fabric.Image.filters"):e&&e()},_setWidthHeight:function(t){t||(t={});var e=this.getElement();this.width=t.width||e.naturalWidth||e.width||0,this.height=t.height||e.naturalHeight||e.height||0},parsePreserveAspectRatioAttribute:function(){var t,e=i.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio||""),n=this._element.width,r=this._element.height,o=1,a=1,s=0,u=0,c=0,l=0,h=this.width,f=this.height,d={width:h,height:f};return!e||"none"===e.alignX&&"none"===e.alignY?(o=h/n,a=f/r):("meet"===e.meetOrSlice&&(t=(h-n*(o=a=i.util.findScaleToFit(this._element,d)))/2,"Min"===e.alignX&&(s=-t),"Max"===e.alignX&&(s=t),t=(f-r*a)/2,"Min"===e.alignY&&(u=-t),"Max"===e.alignY&&(u=t)),"slice"===e.meetOrSlice&&(t=n-h/(o=a=i.util.findScaleToCover(this._element,d)),"Mid"===e.alignX&&(c=t/2),"Max"===e.alignX&&(c=t),t=r-f/a,"Mid"===e.alignY&&(l=t/2),"Max"===e.alignY&&(l=t),n=h/o,r=f/a)),{width:n,height:r,scaleX:o,scaleY:a,offsetLeft:s,offsetTop:u,cropX:c,cropY:l}}}),i.Image.CSS_CANVAS="canvas-img",i.Image.prototype.getSvgSrc=i.Image.prototype.getSrc,i.Image.fromObject=function(t,e){var n=i.util.object.clone(t);i.util.loadImage(n.src,(function(t,r){r?e&&e(null,r):i.Image.prototype._initFilters.call(n,n.filters,(function(r){n.filters=r||[],i.Image.prototype._initFilters.call(n,[n.resizeFilter],(function(r){n.resizeFilter=r[0],i.util.enlivenObjects([n.clipPath],(function(r){n.clipPath=r[0];var o=new i.Image(t,n);e(o)}))}))}))}),null,n.crossOrigin)},i.Image.fromURL=function(t,e,n){i.util.loadImage(t,(function(t){e&&e(new i.Image(t,n))}),null,n&&n.crossOrigin)},i.Image.ATTRIBUTE_NAMES=i.SHARED_ATTRIBUTES.concat("x y width height preserveAspectRatio xlink:href crossOrigin".split(" ")),i.Image.fromElement=function(t,n,r){var o=i.parseAttributes(t,i.Image.ATTRIBUTE_NAMES);i.Image.fromURL(o["xlink:href"],n,e(r?i.util.object.clone(r):{},o))})}(e),i.util.object.extend(i.Object.prototype,{_getAngleValueForStraighten:function(){var t=this.angle%360;return t>0?90*Math.round((t-1)/90):90*Math.round(t/90)},straighten:function(){return this.rotate(this._getAngleValueForStraighten()),this},fxStraighten:function(t){var e=function(){},n=(t=t||{}).onComplete||e,r=t.onChange||e,o=this;return i.util.animate({startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(t){o.rotate(t),r()},onComplete:function(){o.setCoords(),n()}}),this}}),i.util.object.extend(i.StaticCanvas.prototype,{straightenObject:function(t){return t.straighten(),this.requestRenderAll(),this},fxStraightenObject:function(t){return t.fxStraighten({onChange:this.requestRenderAllBound}),this}}),function(){"use strict";function t(t,e){var n="precision "+e+" float;\nvoid main(){}",r=t.createShader(t.FRAGMENT_SHADER);return t.shaderSource(r,n),t.compileShader(r),!!t.getShaderParameter(r,t.COMPILE_STATUS)}function e(t){t&&t.tileSize&&(this.tileSize=t.tileSize),this.setupGLContext(this.tileSize,this.tileSize),this.captureGPUInfo()}i.isWebglSupported=function(e){if(i.isLikelyNode)return!1;e=e||i.WebglFilterBackend.prototype.tileSize;var n=document.createElement("canvas"),r=n.getContext("webgl")||n.getContext("experimental-webgl"),o=!1;if(r){i.maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE),o=i.maxTextureSize>=e;for(var a=["highp","mediump","lowp"],s=0;s<3;s++)if(t(r,a[s])){i.webGlPrecision=a[s];break}}return this.isSupported=o,o},i.WebglFilterBackend=e,e.prototype={tileSize:2048,resources:{},setupGLContext:function(t,e){this.dispose(),this.createWebGLCanvas(t,e),this.aPosition=new Float32Array([0,0,0,1,1,0,1,1]),this.chooseFastestCopyGLTo2DMethod(t,e)},chooseFastestCopyGLTo2DMethod:function(t,e){var n,r="undefined"!==typeof window.performance;try{new ImageData(1,1),n=!0}catch(p){n=!1}var o="undefined"!==typeof ArrayBuffer,u="undefined"!==typeof Uint8ClampedArray;if(r&&n&&o&&u){var c=i.util.createCanvasElement(),l=new ArrayBuffer(t*e*4);if(i.forceGLPutImageData)return this.imageBuffer=l,void(this.copyGLTo2D=s);var h,f,d={imageBuffer:l,destinationWidth:t,destinationHeight:e,targetCanvas:c};c.width=t,c.height=e,h=window.performance.now(),a.call(d,this.gl,d),f=window.performance.now()-h,h=window.performance.now(),s.call(d,this.gl,d),f>window.performance.now()-h?(this.imageBuffer=l,this.copyGLTo2D=s):this.copyGLTo2D=a}},createWebGLCanvas:function(t,e){var n=i.util.createCanvasElement();n.width=t,n.height=e;var r={alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1},o=n.getContext("webgl",r);o||(o=n.getContext("experimental-webgl",r)),o&&(o.clearColor(0,0,0,0),this.canvas=n,this.gl=o)},applyFilters:function(t,e,n,r,i,o){var a,s=this.gl;o&&(a=this.getCachedTexture(o,e));var u={originalWidth:e.width||e.originalWidth,originalHeight:e.height||e.originalHeight,sourceWidth:n,sourceHeight:r,destinationWidth:n,destinationHeight:r,context:s,sourceTexture:this.createTexture(s,n,r,!a&&e),targetTexture:this.createTexture(s,n,r),originalTexture:a||this.createTexture(s,n,r,!a&&e),passes:t.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:i},c=s.createFramebuffer();return s.bindFramebuffer(s.FRAMEBUFFER,c),t.forEach((function(t){t&&t.applyTo(u)})),function(t){var e=t.targetCanvas,n=e.width,r=e.height,i=t.destinationWidth,o=t.destinationHeight;n===i&&r===o||(e.width=i,e.height=o)}(u),this.copyGLTo2D(s,u),s.bindTexture(s.TEXTURE_2D,null),s.deleteTexture(u.sourceTexture),s.deleteTexture(u.targetTexture),s.deleteFramebuffer(c),i.getContext("2d").setTransform(1,0,0,1,0,0),u},dispose:function(){this.canvas&&(this.canvas=null,this.gl=null),this.clearWebGLCaches()},clearWebGLCaches:function(){this.programCache={},this.textureCache={}},createTexture:function(t,e,n,r){var i=t.createTexture();return t.bindTexture(t.TEXTURE_2D,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),r?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,n,0,t.RGBA,t.UNSIGNED_BYTE,null),i},getCachedTexture:function(t,e){if(this.textureCache[t])return this.textureCache[t];var n=this.createTexture(this.gl,e.width,e.height,e);return this.textureCache[t]=n,n},evictCachesForKey:function(t){this.textureCache[t]&&(this.gl.deleteTexture(this.textureCache[t]),delete this.textureCache[t])},copyGLTo2D:a,captureGPUInfo:function(){if(this.gpuInfo)return this.gpuInfo;var t=this.gl,e={renderer:"",vendor:""};if(!t)return e;var n=t.getExtension("WEBGL_debug_renderer_info");if(n){var r=t.getParameter(n.UNMASKED_RENDERER_WEBGL),i=t.getParameter(n.UNMASKED_VENDOR_WEBGL);r&&(e.renderer=r.toLowerCase()),i&&(e.vendor=i.toLowerCase())}return this.gpuInfo=e,e}}}(),function(){"use strict";var t=function(){};function e(){}i.Canvas2dFilterBackend=e,e.prototype={evictCachesForKey:t,dispose:t,clearWebGLCaches:t,resources:{},applyFilters:function(t,e,n,r,i){var o=i.getContext("2d");o.drawImage(e,0,0,n,r);var a={sourceWidth:n,sourceHeight:r,imageData:o.getImageData(0,0,n,r),originalEl:e,originalImageData:o.getImageData(0,0,n,r),canvasEl:i,ctx:o,filterBackend:this};return t.forEach((function(t){t.applyTo(a)})),a.imageData.width===n&&a.imageData.height===r||(i.width=a.imageData.width,i.height=a.imageData.height),o.putImageData(a.imageData,0,0),a}}}(),i.Image=i.Image||{},i.Image.filters=i.Image.filters||{},i.Image.filters.BaseFilter=i.util.createClass({type:"BaseFilter",vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvoid main() {\nvTexCoord = aPosition;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nuniform sampler2D uTexture;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\n}",initialize:function(t){t&&this.setOptions(t)},setOptions:function(t){for(var e in t)this[e]=t[e]},createProgram:function(t,e,n){e=e||this.fragmentSource,n=n||this.vertexSource,"highp"!==i.webGlPrecision&&(e=e.replace(/precision highp float/g,"precision "+i.webGlPrecision+" float"));var r=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(r,n),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS))throw new Error("Vertex shader compile error for "+this.type+": "+t.getShaderInfoLog(r));var o=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(o,e),t.compileShader(o),!t.getShaderParameter(o,t.COMPILE_STATUS))throw new Error("Fragment shader compile error for "+this.type+": "+t.getShaderInfoLog(o));var a=t.createProgram();if(t.attachShader(a,r),t.attachShader(a,o),t.linkProgram(a),!t.getProgramParameter(a,t.LINK_STATUS))throw new Error('Shader link error for "${this.type}" '+t.getProgramInfoLog(a));var s=this.getAttributeLocations(t,a),u=this.getUniformLocations(t,a)||{};return u.uStepW=t.getUniformLocation(a,"uStepW"),u.uStepH=t.getUniformLocation(a,"uStepH"),{program:a,attributeLocations:s,uniformLocations:u}},getAttributeLocations:function(t,e){return{aPosition:t.getAttribLocation(e,"aPosition")}},getUniformLocations:function(){return{}},sendAttributeData:function(t,e,n){var r=e.aPosition,i=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,i),t.enableVertexAttribArray(r),t.vertexAttribPointer(r,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,n,t.STATIC_DRAW)},_setupFrameBuffer:function(t){var e,n,r=t.context;t.passes>1?(e=t.destinationWidth,n=t.destinationHeight,t.sourceWidth===e&&t.sourceHeight===n||(r.deleteTexture(t.targetTexture),t.targetTexture=t.filterBackend.createTexture(r,e,n)),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t.targetTexture,0)):(r.bindFramebuffer(r.FRAMEBUFFER,null),r.finish())},_swapTextures:function(t){t.passes--,t.pass++;var e=t.targetTexture;t.targetTexture=t.sourceTexture,t.sourceTexture=e},isNeutralState:function(){var t=this.mainParameter,e=i.Image.filters[this.type].prototype;if(t){if(Array.isArray(e[t])){for(var n=e[t].length;n--;)if(this[t][n]!==e[t][n])return!1;return!0}return e[t]===this[t]}return!1},applyTo:function(t){t.webgl?(this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)},retrieveShader:function(t){return t.programCache.hasOwnProperty(this.type)||(t.programCache[this.type]=this.createProgram(t.context)),t.programCache[this.type]},applyToWebGL:function(t){var e=t.context,n=this.retrieveShader(t);0===t.pass&&t.originalTexture?e.bindTexture(e.TEXTURE_2D,t.originalTexture):e.bindTexture(e.TEXTURE_2D,t.sourceTexture),e.useProgram(n.program),this.sendAttributeData(e,n.attributeLocations,t.aPosition),e.uniform1f(n.uniformLocations.uStepW,1/t.sourceWidth),e.uniform1f(n.uniformLocations.uStepH,1/t.sourceHeight),this.sendUniformData(e,n.uniformLocations),e.viewport(0,0,t.destinationWidth,t.destinationHeight),e.drawArrays(e.TRIANGLE_STRIP,0,4)},bindAdditionalTexture:function(t,e,n){t.activeTexture(n),t.bindTexture(t.TEXTURE_2D,e),t.activeTexture(t.TEXTURE0)},unbindAdditionalTexture:function(t,e){t.activeTexture(e),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE0)},getMainParameter:function(){return this[this.mainParameter]},setMainParameter:function(t){this[this.mainParameter]=t},sendUniformData:function(){},createHelpLayer:function(t){if(!t.helpLayer){var e=document.createElement("canvas");e.width=t.sourceWidth,e.height=t.sourceHeight,t.helpLayer=e}},toObject:function(){var t={type:this.type},e=this.mainParameter;return e&&(t[e]=this[e]),t},toJSON:function(){return this.toObject()}}),i.Image.filters.BaseFilter.fromObject=function(t,e){var n=new i.Image.filters[t.type](t);return e&&e(n),n},function(t){"use strict";var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.ColorMatrix=r(n.BaseFilter,{type:"ColorMatrix",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nuniform mat4 uColorMatrix;\nuniform vec4 uConstants;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor *= uColorMatrix;\ncolor += uConstants;\ngl_FragColor = color;\n}",matrix:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],mainParameter:"matrix",colorsOnly:!0,initialize:function(t){this.callSuper("initialize",t),this.matrix=this.matrix.slice(0)},applyTo2d:function(t){var e,n,r,i,o,a=t.imageData.data,s=a.length,u=this.matrix,c=this.colorsOnly;for(o=0;o=_||a<0||a>=b||(u=4*(s*b+a),c=y[d*g+f],e+=v[u]*c,n+=v[u+1]*c,r+=v[u+2]*c,x||(i+=v[u+3]*c));k[o]=e,k[o+1]=n,k[o+2]=r,k[o+3]=x?v[o+3]:i}t.imageData=w},getUniformLocations:function(t,e){return{uMatrix:t.getUniformLocation(e,"uMatrix"),uOpaque:t.getUniformLocation(e,"uOpaque"),uHalfSize:t.getUniformLocation(e,"uHalfSize"),uSize:t.getUniformLocation(e,"uSize")}},sendUniformData:function(t,e){t.uniform1fv(e.uMatrix,this.matrix)},toObject:function(){return n(this.callSuper("toObject"),{opaque:this.opaque,matrix:this.matrix})}}),e.Image.filters.Convolute.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.Grayscale=r(n.BaseFilter,{type:"Grayscale",fragmentSource:{average:"precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat average = (color.r + color.b + color.g) / 3.0;\ngl_FragColor = vec4(average, average, average, color.a);\n}",lightness:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;\ngl_FragColor = vec4(average, average, average, col.a);\n}",luminosity:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;\ngl_FragColor = vec4(average, average, average, col.a);\n}"},mode:"average",mainParameter:"mode",applyTo2d:function(t){var e,n,r=t.imageData.data,i=r.length,o=this.mode;for(e=0;ec[0]&&i>c[1]&&o>c[2]&&r 0.0) {\n"+this.fragmentSource[t]+"}\n}"},retrieveShader:function(t){var e,n=this.type+"_"+this.mode;return t.programCache.hasOwnProperty(n)||(e=this.buildSource(this.mode),t.programCache[n]=this.createProgram(t.context,e)),t.programCache[n]},applyTo2d:function(t){var n,r,i,o,a,s,u,c=t.imageData.data,l=c.length,h=1-this.alpha;n=(u=new e.Color(this.color).getSource())[0]*this.alpha,r=u[1]*this.alpha,i=u[2]*this.alpha;for(var f=0;f=t||e<=-t)return 0;if(e<1.1920929e-7&&e>-1.1920929e-7)return 1;var n=(e*=Math.PI)/t;return s(e)/e*s(n)/n}},applyTo2d:function(t){var e=t.imageData,n=this.scaleX,r=this.scaleY;this.rcpScaleX=1/n,this.rcpScaleY=1/r;var i,o=e.width,s=e.height,u=a(o*n),c=a(s*r);"sliceHack"===this.resizeType?i=this.sliceByTwo(t,o,s,u,c):"hermite"===this.resizeType?i=this.hermiteFastResize(t,o,s,u,c):"bilinear"===this.resizeType?i=this.bilinearFiltering(t,o,s,u,c):"lanczos"===this.resizeType&&(i=this.lanczosResize(t,o,s,u,c)),t.imageData=i},sliceByTwo:function(t,n,i,o,a){var s,u,c=t.imageData,l=!1,h=!1,f=.5*n,d=.5*i,p=e.filterBackend.resources,v=0,y=0,g=n,m=0;for(p.sliceByTwo||(p.sliceByTwo=document.createElement("canvas")),((s=p.sliceByTwo).width<1.5*n||s.height=e)){P=r(1e3*o(S-w.x)),_[P]||(_[P]={});for(var B=k.y-b;B<=k.y+b;B++)B<0||B>=a||(M=r(1e3*o(B-w.y)),_[P][M]||(_[P][M]=d(i(n(P*y,2)+n(M*g,2))/1e3)),(T=_[P][M])>0&&(O+=T,E+=T*l[C=4*(B*e+S)],I+=T*l[C+1],A+=T*l[C+2],D+=T*l[C+3]))}f[C=4*(x*s+u)]=E/O,f[C+1]=I/O,f[C+2]=A/O,f[C+3]=D/O}return++u1&&M<-1||(b=2*M*M*M-3*M*M+1)>0&&(T+=b*d[(P=4*(D+O*e))+3],w+=b,d[P+3]<255&&(b=b*d[P+3]/250),k+=b*d[P],x+=b*d[P+1],S+=b*d[P+2],_+=b)}v[m]=k/_,v[m+1]=x/_,v[m+2]=S/_,v[m+3]=T/w}return p},toObject:function(){return{type:this.type,scaleX:this.scaleX,scaleY:this.scaleY,resizeType:this.resizeType,lanczosLobes:this.lanczosLobes}}}),e.Image.filters.Resize.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.Contrast=r(n.BaseFilter,{type:"Contrast",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uContrast;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));\ncolor.rgb = contrastF * (color.rgb - 0.5) + 0.5;\ngl_FragColor = color;\n}",contrast:0,mainParameter:"contrast",applyTo2d:function(t){if(0!==this.contrast){var e,n=t.imageData.data,r=n.length,i=Math.floor(255*this.contrast),o=259*(i+255)/(255*(259-i));for(e=0;e1&&(e=1/this.aspectRatio):this.aspectRatio<1&&(e=this.aspectRatio),t=e*this.blur*.12,this.horizontal?n[0]=t:n[1]=t,n}}),n.Blur.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.Gamma=r(n.BaseFilter,{type:"Gamma",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec3 uGamma;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec3 correction = (1.0 / uGamma);\ncolor.r = pow(color.r, correction.r);\ncolor.g = pow(color.g, correction.g);\ncolor.b = pow(color.b, correction.b);\ngl_FragColor = color;\ngl_FragColor.rgb *= color.a;\n}",gamma:[1,1,1],mainParameter:"gamma",initialize:function(t){this.gamma=[1,1,1],n.BaseFilter.prototype.initialize.call(this,t)},applyTo2d:function(t){var e,n=t.imageData.data,r=this.gamma,i=n.length,o=1/r[0],a=1/r[1],s=1/r[2];for(this.rVals||(this.rVals=new Uint8Array(256),this.gVals=new Uint8Array(256),this.bVals=new Uint8Array(256)),e=0,i=256;e'},_getCacheCanvasDimensions:function(){var t=this.callSuper("_getCacheCanvasDimensions"),e=this.fontSize;return t.width+=e*t.zoomX,t.height+=e*t.zoomY,t},_render:function(t){this._setTextStyles(t),this._renderTextLinesBackground(t),this._renderTextDecoration(t,"underline"),this._renderText(t),this._renderTextDecoration(t,"overline"),this._renderTextDecoration(t,"linethrough")},_renderText:function(t){"stroke"===this.paintFirst?(this._renderTextStroke(t),this._renderTextFill(t)):(this._renderTextFill(t),this._renderTextStroke(t))},_setTextStyles:function(t,e,n){t.textBaseline="alphabetic",t.font=this._getFontDeclaration(e,n)},calcTextWidth:function(){for(var t=this.getLineWidth(0),e=1,n=this._textLines.length;et&&(t=r)}return t},_renderTextLine:function(t,e,n,r,i,o){this._renderChars(t,e,n,r,i,o)},_renderTextLinesBackground:function(t){if(this.textBackgroundColor||this.styleHas("textBackgroundColor")){for(var e,n,r,i,o,a,s=0,u=t.fillStyle,c=this._getLeftOffset(),l=this._getTopOffset(),h=0,f=0,d=0,p=this._textLines.length;d0&&!i){var f=this.__charBounds[e][n-1];h.left=f.left+f.width+u.kernedWidth-u.width}return h},getHeightOfLine:function(t){if(this.__lineHeights[t])return this.__lineHeights[t];for(var e=this._textLines[t],n=this.getHeightOfChar(t,0),r=1,i=e.length;r0?(t.fillStyle=g,c&&g&&t.fillRect(m+o+h,l+this.offsets[e]*r+a,f,this.fontSize/15),h=d.left,f=d.width,c=p,g=y,r=i,a=s):f+=d.kernedWidth;t.fillStyle=y,p&&y&&t.fillRect(m+o+h,l+this.offsets[e]*r+a,f-_,this.fontSize/15),b+=n}else b+=n;this._removeShadow(t)}},_getFontDeclaration:function(t,n){var r=t||this,i=this.fontFamily,o=e.Text.genericFonts.indexOf(i.toLowerCase())>-1,a=void 0===i||i.indexOf("'")>-1||i.indexOf(",")>-1||i.indexOf('"')>-1||o?r.fontFamily:'"'+r.fontFamily+'"';return[e.isLikelyNode?r.fontWeight:r.fontStyle,e.isLikelyNode?r.fontStyle:r.fontWeight,n?this.CACHE_FONT_SIZE+"px":r.fontSize+"px",a].join(" ")},render:function(t){this.visible&&(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._shouldClearDimensionCache()&&this.initDimensions(),this.callSuper("render",t)))},_splitTextIntoLines:function(t){for(var n=t.split(this._reNewline),r=new Array(n.length),i=["\n"],o=[],a=0;a-1&&(t.underline=!0),t.textDecoration.indexOf("line-through")>-1&&(t.linethrough=!0),t.textDecoration.indexOf("overline")>-1&&(t.overline=!0),delete t.textDecoration)}i.IText=i.util.createClass(i.Text,i.Observable,{type:"i-text",selectionStart:0,selectionEnd:0,selectionColor:"rgba(17,119,255,0.3)",isEditing:!1,editable:!0,editingBorderColor:"rgba(102,153,255,0.25)",cursorWidth:2,cursorColor:"#333",cursorDelay:1e3,cursorDuration:600,caching:!0,_reSpace:/\s|\n/,_currentCursorOpacity:0,_selectionDirection:null,_abortCursorAnimation:!1,__widthOfSpace:[],inCompositionMode:!1,initialize:function(t,e){this.callSuper("initialize",t,e),this.initBehavior()},setSelectionStart:function(t){t=Math.max(t,0),this._updateAndFire("selectionStart",t)},setSelectionEnd:function(t){t=Math.min(t,this.text.length),this._updateAndFire("selectionEnd",t)},_updateAndFire:function(t,e){this[t]!==e&&(this._fireSelectionChanged(),this[t]=e),this._updateTextarea()},_fireSelectionChanged:function(){this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})},initDimensions:function(){this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this.callSuper("initDimensions")},render:function(t){this.clearContextTop(),this.callSuper("render",t),this.cursorOffsetCache={},this.renderCursorOrSelection()},_render:function(t){this.callSuper("_render",t)},clearContextTop:function(t){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var e=this.canvas.contextTop,n=this.canvas.viewportTransform;e.save(),e.transform(n[0],n[1],n[2],n[3],n[4],n[5]),this.transform(e),this.transformMatrix&&e.transform.apply(e,this.transformMatrix),this._clearTextArea(e),t||e.restore()}},renderCursorOrSelection:function(){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var t=this._getCursorBoundaries(),e=this.canvas.contextTop;this.clearContextTop(!0),this.selectionStart===this.selectionEnd?this.renderCursor(t,e):this.renderSelection(t,e),e.restore()}},_clearTextArea:function(t){var e=this.width+4,n=this.height+4;t.clearRect(-e/2,-n/2,e,n)},_getCursorBoundaries:function(t){"undefined"===typeof t&&(t=this.selectionStart);var e=this._getLeftOffset(),n=this._getTopOffset(),r=this._getCursorBoundariesOffsets(t);return{left:e,top:n,leftOffset:r.left,topOffset:r.top}},_getCursorBoundariesOffsets:function(t){if(this.cursorOffsetCache&&"top"in this.cursorOffsetCache)return this.cursorOffsetCache;var e,n,r,i,o=0,a=0,s=this.get2DCursorLocation(t);r=s.charIndex,n=s.lineIndex;for(var u=0;u0?a:0)},this.cursorOffsetCache=i,this.cursorOffsetCache},renderCursor:function(t,e){var n=this.get2DCursorLocation(),r=n.lineIndex,i=n.charIndex>0?n.charIndex-1:0,o=this.getValueOfPropertyAt(r,i,"fontSize"),a=this.scaleX*this.canvas.getZoom(),s=this.cursorWidth/a,u=t.topOffset,c=this.getValueOfPropertyAt(r,i,"deltaY");u+=(1-this._fontSizeFraction)*this.getHeightOfLine(r)/this.lineHeight-o*(1-this._fontSizeFraction),this.inCompositionMode&&this.renderSelection(t,e),e.fillStyle=this.getValueOfPropertyAt(r,i,"fill"),e.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,e.fillRect(t.left+t.leftOffset-s/2,u+t.top+c,s,o)},renderSelection:function(t,e){for(var n=this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,r=this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd,i=-1!==this.textAlign.indexOf("justify"),o=this.get2DCursorLocation(n),a=this.get2DCursorLocation(r),s=o.lineIndex,u=a.lineIndex,c=o.charIndex<0?0:o.charIndex,l=a.charIndex<0?0:a.charIndex,h=s;h<=u;h++){var f,d=this._getLineLeftOffset(h)||0,p=this.getHeightOfLine(h),v=0,y=0;if(h===s&&(v=this.__charBounds[s][c].left),h>=s&&h1)&&(p/=this.lineHeight),this.inCompositionMode?(e.fillStyle=this.compositionColor||"black",e.fillRect(t.left+d+v,t.top+t.topOffset+p,y-v,1)):(e.fillStyle=this.selectionColor,e.fillRect(t.left+d+v,t.top+t.topOffset,y-v,p)),t.topOffset+=f}},getCurrentCharFontSize:function(){var t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,"fontSize")},getCurrentCharColor:function(){var t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,"fill")},_getCurrentCharIndex:function(){var t=this.get2DCursorLocation(this.selectionStart,!0),e=t.charIndex>0?t.charIndex-1:0;return{l:t.lineIndex,c:e}}}),i.IText.fromObject=function(e,n){if(t(e),e.styles)for(var r in e.styles)for(var o in e.styles[r])t(e.styles[r][o]);i.Object._fromObject("IText",e,n,"text")}}(),function(){var t=i.util.object.clone;i.util.object.extend(i.IText.prototype,{initBehavior:function(){this.initAddedHandler(),this.initRemovedHandler(),this.initCursorSelectionHandlers(),this.initDoubleClickSimulation(),this.mouseMoveHandler=this.mouseMoveHandler.bind(this)},onDeselect:function(){this.isEditing&&this.exitEditing(),this.selected=!1},initAddedHandler:function(){var t=this;this.on("added",(function(){var e=t.canvas;e&&(e._hasITextHandlers||(e._hasITextHandlers=!0,t._initCanvasHandlers(e)),e._iTextInstances=e._iTextInstances||[],e._iTextInstances.push(t))}))},initRemovedHandler:function(){var t=this;this.on("removed",(function(){var e=t.canvas;e&&(e._iTextInstances=e._iTextInstances||[],i.util.removeFromArray(e._iTextInstances,t),0===e._iTextInstances.length&&(e._hasITextHandlers=!1,t._removeCanvasHandlers(e)))}))},_initCanvasHandlers:function(t){t._mouseUpITextHandler=function(){t._iTextInstances&&t._iTextInstances.forEach((function(t){t.__isMousedown=!1}))},t.on("mouse:up",t._mouseUpITextHandler)},_removeCanvasHandlers:function(t){t.off("mouse:up",t._mouseUpITextHandler)},_tick:function(){this._currentTickState=this._animateCursor(this,1,this.cursorDuration,"_onTickComplete")},_animateCursor:function(t,e,n,r){var i;return i={isAborted:!1,abort:function(){this.isAborted=!0}},t.animate("_currentCursorOpacity",e,{duration:n,onComplete:function(){i.isAborted||t[r]()},onChange:function(){t.canvas&&t.selectionStart===t.selectionEnd&&t.renderCursorOrSelection()},abort:function(){return i.isAborted}}),i},_onTickComplete:function(){var t=this;this._cursorTimeout1&&clearTimeout(this._cursorTimeout1),this._cursorTimeout1=setTimeout((function(){t._currentTickCompleteState=t._animateCursor(t,0,this.cursorDuration/2,"_tick")}),100)},initDelayedCursor:function(t){var e=this,n=t?0:this.cursorDelay;this.abortCursorAnimation(),this._currentCursorOpacity=1,this._cursorTimeout2=setTimeout((function(){e._tick()}),n)},abortCursorAnimation:function(){var t=this._currentTickState||this._currentTickCompleteState,e=this.canvas;this._currentTickState&&this._currentTickState.abort(),this._currentTickCompleteState&&this._currentTickCompleteState.abort(),clearTimeout(this._cursorTimeout1),clearTimeout(this._cursorTimeout2),this._currentCursorOpacity=0,t&&e&&e.clearContext(e.contextTop||e.contextContainer)},selectAll:function(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this},getSelectedText:function(){return this._text.slice(this.selectionStart,this.selectionEnd).join("")},findWordBoundaryLeft:function(t){var e=0,n=t-1;if(this._reSpace.test(this._text[n]))for(;this._reSpace.test(this._text[n]);)e++,n--;for(;/\S/.test(this._text[n])&&n>-1;)e++,n--;return t-e},findWordBoundaryRight:function(t){var e=0,n=t;if(this._reSpace.test(this._text[n]))for(;this._reSpace.test(this._text[n]);)e++,n++;for(;/\S/.test(this._text[n])&&n-1;)e++,n--;return t-e},findLineBoundaryRight:function(t){for(var e=0,n=t;!/\n/.test(this._text[n])&&n0&&rthis.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=e):(this.selectionStart=e,this.selectionEnd=this.__selectionStartOnMouseDown),this.selectionStart===n&&this.selectionEnd===r||(this.restartCursorIfNeeded(),this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()))}},_setEditingProps:function(){this.hoverCursor="text",this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor="text"),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0},fromStringToGraphemeSelection:function(t,e,n){var r=n.slice(0,t),o=i.util.string.graphemeSplit(r).length;if(t===e)return{selectionStart:o,selectionEnd:o};var a=n.slice(t,e);return{selectionStart:o,selectionEnd:o+i.util.string.graphemeSplit(a).length}},fromGraphemeToStringSelection:function(t,e,n){var r=n.slice(0,t).join("").length;return t===e?{selectionStart:r,selectionEnd:r}:{selectionStart:r,selectionEnd:r+n.slice(t,e).join("").length}},_updateTextarea:function(){if(this.cursorOffsetCache={},this.hiddenTextarea){if(!this.inCompositionMode){var t=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=t.selectionStart,this.hiddenTextarea.selectionEnd=t.selectionEnd}this.updateTextareaPosition()}},updateFromTextArea:function(){if(this.hiddenTextarea){this.cursorOffsetCache={},this.text=this.hiddenTextarea.value,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords());var t=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value);this.selectionEnd=this.selectionStart=t.selectionEnd,this.inCompositionMode||(this.selectionStart=t.selectionStart),this.updateTextareaPosition()}},updateTextareaPosition:function(){if(this.selectionStart===this.selectionEnd){var t=this._calcTextareaPosition();this.hiddenTextarea.style.left=t.left,this.hiddenTextarea.style.top=t.top}},_calcTextareaPosition:function(){if(!this.canvas)return{x:1,y:1};var t=this.inCompositionMode?this.compositionStart:this.selectionStart,e=this._getCursorBoundaries(t),n=this.get2DCursorLocation(t),r=n.lineIndex,o=n.charIndex,a=this.getValueOfPropertyAt(r,o,"fontSize")*this.lineHeight,s=e.leftOffset,u=this.calcTransformMatrix(),c={x:e.left+s,y:e.top+e.topOffset+a},l=this.canvas.getRetinaScaling(),h=this.canvas.upperCanvasEl,f=h.width/l,d=h.height/l,p=f-a,v=d-a,y=h.clientWidth/f,g=h.clientHeight/d;return c=i.util.transformPoint(c,u),(c=i.util.transformPoint(c,this.canvas.viewportTransform)).x*=y,c.y*=g,c.x<0&&(c.x=0),c.x>p&&(c.x=p),c.y<0&&(c.y=0),c.y>v&&(c.y=v),c.x+=this.canvas._offset.left,c.y+=this.canvas._offset.top,{left:c.x+"px",top:c.y+"px",fontSize:a+"px",charHeight:a}},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){this._savedProps&&(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor))},exitEditing:function(){var t=this._textBeforeEdit!==this.text,e=this.hiddenTextarea;return this.selected=!1,this.isEditing=!1,this.selectionEnd=this.selectionStart,e&&(e.blur&&e.blur(),e.parentNode&&e.parentNode.removeChild(e)),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this.fire("editing:exited"),t&&this.fire("modified"),this.canvas&&(this.canvas.off("mouse:move",this.mouseMoveHandler),this.canvas.fire("text:editing:exited",{target:this}),t&&this.canvas.fire("object:modified",{target:this})),this},_removeExtraneousStyles:function(){for(var t in this.styles)this._textLines[t]||delete this.styles[t]},removeStyleFromTo:function(t,e){var n,r,i=this.get2DCursorLocation(t,!0),o=this.get2DCursorLocation(e,!0),a=i.lineIndex,s=i.charIndex,u=o.lineIndex,c=o.charIndex;if(a!==u){if(this.styles[a])for(n=s;n=c&&(r[l-f]=r[h],delete r[h])}},shiftLineStyles:function(e,n){var r=t(this.styles);for(var i in this.styles){var o=parseInt(i,10);o>e&&(this.styles[o+n]=r[o],r[o-n]||delete this.styles[o])}},restartCursorIfNeeded:function(){this._currentTickState&&!this._currentTickState.isAborted&&this._currentTickCompleteState&&!this._currentTickCompleteState.isAborted||this.initDelayedCursor()},insertNewlineStyleObject:function(e,n,r,i){var o,a={},s=!1,u=this._unwrappedTextLines[e].length===n;for(var c in r||(r=1),this.shiftLineStyles(e,r),this.styles[e]&&(o=this.styles[e][0===n?n:n-1]),this.styles[e]){var l=parseInt(c,10);l>=n&&(s=!0,a[l-n]=this.styles[e][c],u&&0===n||delete this.styles[e][c])}var h=!1;for(s&&!u&&(this.styles[e+r]=a,h=!0),h&&r--;r>0;)i&&i[r-1]?this.styles[e+r]={0:t(i[r-1])}:o?this.styles[e+r]={0:t(o)}:delete this.styles[e+r],r--;this._forceClearCache=!0},insertCharStyleObject:function(e,n,r,i){this.styles||(this.styles={});var o=this.styles[e],a=o?t(o):{};for(var s in r||(r=1),a){var u=parseInt(s,10);u>=n&&(o[u+r]=a[u],a[u-r]||delete o[u])}if(this._forceClearCache=!0,i)for(;r--;)Object.keys(i[r]).length&&(this.styles[e]||(this.styles[e]={}),this.styles[e][n+r]=t(i[r]));else if(o)for(var c=o[n?n-1:1];c&&r--;)this.styles[e][n+r]=t(c)},insertNewStyleBlock:function(t,e,n){for(var r=this.get2DCursorLocation(e,!0),i=[0],o=0,a=0;a0&&(this.insertCharStyleObject(r.lineIndex,r.charIndex,i[0],n),n=n&&n.slice(i[0]+1)),o&&this.insertNewlineStyleObject(r.lineIndex,r.charIndex+i[0],o);for(a=1;a0?this.insertCharStyleObject(r.lineIndex+a,0,i[a],n):n&&(this.styles[r.lineIndex+a][0]=n[0]),n=n&&n.slice(i[a]+1);i[a]>0&&this.insertCharStyleObject(r.lineIndex+a,0,i[a],n)},setSelectionStartEndWithShift:function(t,e,n){n<=t?(e===t?this._selectionDirection="left":"right"===this._selectionDirection&&(this._selectionDirection="left",this.selectionEnd=t),this.selectionStart=n):n>t&&nt?this.selectionStart=t:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>t?this.selectionEnd=t:this.selectionEnd<0&&(this.selectionEnd=0)}})}(),i.util.object.extend(i.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(t){if(this.canvas){this.__newClickTime=+new Date;var e=t.pointer;this.isTripleClick(e)&&(this.fire("tripleclick",t),this._stopEvent(t.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=e,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(t){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===t.x&&this.__lastPointer.y===t.y},_stopEvent:function(t){t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(t){this.isEditing&&this.selectWord(this.getSelectionStartFromPointer(t.e))},tripleClickHandler:function(t){this.isEditing&&this.selectLine(this.getSelectionStartFromPointer(t.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.e.button||(this.__isMousedown=!0,this.selected&&this.setCursorByClick(t.e),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.e.button||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(t){if(this.__isMousedown=!1,!(!this.editable||this.group||t.transform&&t.transform.actionPerformed||t.e.button&&1!==t.e.button)){if(this.canvas){var e=this.canvas._activeObject;if(e&&e!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(t.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(t){var e=this.getSelectionStartFromPointer(t),n=this.selectionStart,r=this.selectionEnd;t.shiftKey?this.setSelectionStartEndWithShift(n,r,e):(this.selectionStart=e,this.selectionEnd=e),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(t){for(var e=this.getLocalPointer(t),n=0,r=0,i=0,o=0,a=0,s=0,u=this._textLines.length;s0&&(o+=this._textLines[s-1].length+this.missingNewlineOffset(s-1));r=this._getLineLeftOffset(a)*this.scaleX;for(var c=0,l=this._textLines[a].length;co||a<0?0:1);return this.flipX&&(s=i-s),s>this._text.length&&(s=this._text.length),s}}),i.util.object.extend(i.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=i.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.setAttribute("autocorrect","off"),this.hiddenTextarea.setAttribute("autocomplete","off"),this.hiddenTextarea.setAttribute("spellcheck","false"),this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea",""),this.hiddenTextarea.setAttribute("wrap","off");var t=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+t.top+"; left: "+t.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding\uff70top: "+t.fontSize+";",i.document.body.appendChild(this.hiddenTextarea),i.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),i.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),i.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),i.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),i.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),i.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),i.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),i.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),i.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(i.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(t){if(this.isEditing&&!this.inCompositionMode){if(t.keyCode in this.keysMap)this[this.keysMap[t.keyCode]](t);else{if(!(t.keyCode in this.ctrlKeysMapDown)||!t.ctrlKey&&!t.metaKey)return;this[this.ctrlKeysMapDown[t.keyCode]](t)}t.stopImmediatePropagation(),t.preventDefault(),t.keyCode>=33&&t.keyCode<=40?(this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(t){!this.isEditing||this._copyDone||this.inCompositionMode?this._copyDone=!1:t.keyCode in this.ctrlKeysMapUp&&(t.ctrlKey||t.metaKey)&&(this[this.ctrlKeysMapUp[t.keyCode]](t),t.stopImmediatePropagation(),t.preventDefault(),this.canvas&&this.canvas.requestRenderAll())},onInput:function(t){var e=this.fromPaste;if(this.fromPaste=!1,t&&t.stopPropagation(),this.isEditing){var n,r,o,a,s=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,u=this._text.length,c=s.length,l=c-u,h=this.selectionStart,f=this.selectionEnd,d=h!==f;if(""===this.hiddenTextarea.value)return this.styles={},this.updateFromTextArea(),this.fire("changed"),void(this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll()));var p,v=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),y=h>v.selectionStart;d?(n=this._text.slice(h,f),l+=f-h):c0&&(r+=(n=this.__charBounds[t][e-1]).left+n.width),r},getDownCursorOffset:function(t,e){var n=this._getSelectionForOffset(t,e),r=this.get2DCursorLocation(n),i=r.lineIndex;if(i===this._textLines.length-1||t.metaKey||34===t.keyCode)return this._text.length-n;var o=r.charIndex,a=this._getWidthBeforeCursor(i,o),s=this._getIndexOnLine(i+1,a);return this._textLines[i].slice(o).length+s+1+this.missingNewlineOffset(i)},_getSelectionForOffset:function(t,e){return t.shiftKey&&this.selectionStart!==this.selectionEnd&&e?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(t,e){var n=this._getSelectionForOffset(t,e),r=this.get2DCursorLocation(n),i=r.lineIndex;if(0===i||t.metaKey||33===t.keyCode)return-n;var o=r.charIndex,a=this._getWidthBeforeCursor(i,o),s=this._getIndexOnLine(i-1,a),u=this._textLines[i].slice(0,o),c=this.missingNewlineOffset(i-1);return-this._textLines[i-1].length+s-u.length+(1-c)},_getIndexOnLine:function(t,e){for(var n,r,i=this._textLines[t],o=this._getLineLeftOffset(t),a=0,s=0,u=i.length;se){r=!0;var c=o-n,l=o,h=Math.abs(c-e);a=Math.abs(l-e)=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",t)},moveCursorUp:function(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorUpOrDown("Up",t)},_moveCursorUpOrDown:function(t,e){var n=this["get"+t+"CursorOffset"](e,"right"===this._selectionDirection);e.shiftKey?this.moveCursorWithShift(n):this.moveCursorWithoutShift(n),0!==n&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(t){var e="left"===this._selectionDirection?this.selectionStart+t:this.selectionEnd+t;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,e),0!==t},moveCursorWithoutShift:function(t){return t<0?(this.selectionStart+=t,this.selectionEnd=this.selectionStart):(this.selectionEnd+=t,this.selectionStart=this.selectionEnd),0!==t},moveCursorLeft:function(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorLeftOrRight("Left",t)},_move:function(t,e,n){var r;if(t.altKey)r=this["findWordBoundary"+n](this[e]);else{if(!t.metaKey&&35!==t.keyCode&&36!==t.keyCode)return this[e]+="Left"===n?-1:1,!0;r=this["findLineBoundary"+n](this[e])}if(void 0!==typeof r&&this[e]!==r)return this[e]=r,!0},_moveLeft:function(t,e){return this._move(t,e,"Left")},_moveRight:function(t,e){return this._move(t,e,"Right")},moveCursorLeftWithoutShift:function(t){var e=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&0!==this.selectionStart&&(e=this._moveLeft(t,"selectionStart")),this.selectionEnd=this.selectionStart,e},moveCursorLeftWithShift:function(t){return"right"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveLeft(t,"selectionEnd"):0!==this.selectionStart?(this._selectionDirection="left",this._moveLeft(t,"selectionStart")):void 0},moveCursorRight:function(t){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",t)},_moveCursorLeftOrRight:function(t,e){var n="moveCursor"+t+"With";this._currentCursorOpacity=1,e.shiftKey?n+="Shift":n+="outShift",this[n](e)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(t){return"left"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveRight(t,"selectionStart"):this.selectionEnd!==this._text.length?(this._selectionDirection="right",this._moveRight(t,"selectionEnd")):void 0},moveCursorRightWithoutShift:function(t){var e=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(e=this._moveRight(t,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,e},removeChars:function(t,e){"undefined"===typeof e&&(e=t+1),this.removeStyleFromTo(t,e),this._text.splice(t,e-t),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(t,e,n,r){"undefined"===typeof r&&(r=n),r>n&&this.removeStyleFromTo(n,r);var o=i.util.string.graphemeSplit(t);this.insertNewStyleBlock(o,n,e),this._text=[].concat(this._text.slice(0,n),o,this._text.slice(r)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var t=i.util.toFixed,e=/ +/g;i.util.object.extend(i.Text.prototype,{_toSVG:function(){var t=this._getSVGLeftTopOffsets(),e=this._getSVGTextAndBg(t.textTop,t.textLeft);return this._wrapSVGTextAndBg(e)},toSVG:function(t){return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(t){var e=this.getSvgTextDecoration(this);return[t.textBgRects.join(""),'\t\t",t.textSpans.join(""),"\n"]},_getSVGTextAndBg:function(t,e){var n,r=[],i=[],o=t;this._setSVGBg(i);for(var a=0,s=this._textLines.length;a",i.util.string.escapeXml(n),""].join("")},_setSVGTextLineText:function(t,e,n,r){var i,o,a,s,u,c=this.getHeightOfLine(e),l=-1!==this.textAlign.indexOf("justify"),h="",f=0,d=this._textLines[e];r+=c*(1-this._fontSizeFraction)/this.lineHeight;for(var p=0,v=d.length-1;p<=v;p++)u=p===v||this.charSpacing,h+=d[p],a=this.__charBounds[e][p],0===f?(n+=a.kernedWidth-a.width,f+=a.width):f+=a.kernedWidth,l&&!u&&this._reSpaceAndTab.test(d[p])&&(u=!0),u||(i=i||this.getCompleteStyleDeclaration(e,p),o=this.getCompleteStyleDeclaration(e,p+1),u=this._hasStyleChangedForSvg(i,o)),u&&(s=this._getStyleDeclaration(e,p)||{},t.push(this._createTextCharSpan(h,s,n,r)),h="",i=o,n+=f,f=0)},_pushTextBgRect:function(e,n,r,o,a,s){var u=i.Object.NUM_FRACTION_DIGITS;e.push("\t\t\n')},_setSVGTextLineBg:function(t,e,n,r){for(var i,o,a=this._textLines[e],s=this.getHeightOfLine(e)/this.lineHeight,u=0,c=0,l=this.getValueOfPropertyAt(e,0,"textBackgroundColor"),h=0,f=a.length;hthis.width&&this._set("width",this.dynamicMinWidth),-1!==this.textAlign.indexOf("justify")&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},_generateStyleMap:function(t){for(var e=0,n=0,r=0,i={},o=0;o0?(n=0,r++,e++):!this.splitByGrapheme&&this._reSpaceAndTab.test(t.graphemeText[r])&&o>0&&(n++,r++),i[o]={line:e,offset:n},r+=t.graphemeLines[o].length,n+=t.graphemeLines[o].length;return i},styleHas:function(t,n){if(this._styleMap&&!this.isWrapping){var r=this._styleMap[n];r&&(n=r.line)}return e.Text.prototype.styleHas.call(this,t,n)},isEmptyStyles:function(t){if(!this.styles)return!0;var e,n,r=0,i=!1,o=this._styleMap[t],a=this._styleMap[t+1];for(var s in o&&(t=o.line,r=o.offset),a&&(i=a.line===t,e=a.offset),n="undefined"===typeof t?this.styles:{line:this.styles[t]})for(var u in n[s])if(u>=r&&(!i||u=r&&!y?(s.push(u),u=[],o=d,y=!0):o+=g,y||a||u.push(f),u=u.concat(l),p=this._measureWord([f],n,h),h++,y=!1,d>v&&(v=d);return m&&s.push(u),v+i>this.dynamicMinWidth&&(this.dynamicMinWidth=v-g+i),s},isEndOfWrapping:function(t){return!this._styleMap[t+1]||this._styleMap[t+1].line!==this._styleMap[t].line},missingNewlineOffset:function(t){return this.splitByGrapheme?this.isEndOfWrapping(t)?1:0:1},_splitTextIntoLines:function(t){for(var n=e.Text.prototype._splitTextIntoLines.call(this,t),r=this._wrapText(n.lines,this.width),i=new Array(r.length),o=0;ot.length)&&(e=t.length);for(var n=0,r=new Array(e);n0){for(var t=new Array(arguments.length),e=0;e=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i,o=!0,a=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return o=t.done,t},e:function(t){a=!0,i=t},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}function D(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(c){return void n(c)}s.done?e(u):Promise.resolve(u).then(r,i)}function P(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){D(o,r,i,a,s,"next",t)}function s(t){D(o,r,i,a,s,"throw",t)}a(void 0)}))}}function M(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function B(t,e){for(var n=0;n>>0)+4294967296*this.high},W.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},W.Long.ZERO=new W.Long(0,0),W.Builder=function(t){if(t)e=t;else var e=1024;this.bb=W.ByteBuffer.allocate(e),this.space=e,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},W.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},W.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},W.Builder.prototype.dataBuffer=function(){return this.bb},W.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},W.Builder.prototype.prep=function(t,e){t>this.minalign&&(this.minalign=t);for(var n=1+~(this.bb.capacity()-this.space+e)&t-1;this.space=0&&0==this.vtable[e];e--);for(var n=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=(n+2)*W.SIZEOF_SHORT;this.addInt16(r);var i=0,o=this.space;t:for(e=0;e=0;r--)this.writeInt8(n.charCodeAt(r))}this.prep(this.minalign,W.SIZEOF_INT),this.addOffset(t),this.bb.setPosition(this.space)},W.Builder.prototype.requiredField=function(t,e){var n=this.bb.capacity()-t,r=n-this.bb.readInt32(n);if(!(0!=this.bb.readInt16(r+e)))throw new Error("FlatBuffers: field "+e+" must be set")},W.Builder.prototype.startVector=function(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(W.SIZEOF_INT,t*e),this.prep(n,t*e)},W.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},W.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var e=t;else{e=[];for(var n=0;n=56320)r=i;else r=(i<<10)+t.charCodeAt(n++)+-56613888;r<128?e.push(r):(r<2048?e.push(r>>6&31|192):(r<65536?e.push(r>>12&15|224):e.push(r>>18&7|240,r>>12&63|128),e.push(r>>6&63|128)),e.push(63&r|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);n=0;for(var o=this.space,a=this.bb.bytes();n>24},W.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},W.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},W.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},W.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},W.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},W.ByteBuffer.prototype.readInt64=function(t){return new W.Long(this.readInt32(t),this.readInt32(t+4))},W.ByteBuffer.prototype.readUint64=function(t){return new W.Long(this.readUint32(t),this.readUint32(t+4))},W.ByteBuffer.prototype.readFloat32=function(t){return W.int32[0]=this.readInt32(t),W.float32[0]},W.ByteBuffer.prototype.readFloat64=function(t){return W.int32[W.isLittleEndian?0:1]=this.readInt32(t),W.int32[W.isLittleEndian?1:0]=this.readInt32(t+4),W.float64[0]},W.ByteBuffer.prototype.writeInt8=function(t,e){this.bytes_[t]=e},W.ByteBuffer.prototype.writeUint8=function(t,e){this.bytes_[t]=e},W.ByteBuffer.prototype.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},W.ByteBuffer.prototype.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},W.ByteBuffer.prototype.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},W.ByteBuffer.prototype.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},W.ByteBuffer.prototype.writeInt64=function(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)},W.ByteBuffer.prototype.writeUint64=function(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)},W.ByteBuffer.prototype.writeFloat32=function(t,e){W.float32[0]=e,this.writeInt32(t,W.int32[0])},W.ByteBuffer.prototype.writeFloat64=function(t,e){W.float64[0]=e,this.writeInt32(t,W.int32[W.isLittleEndian?0:1]),this.writeInt32(t+4,W.int32[W.isLittleEndian?1:0])},W.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length>10),56320+(1023&o)))}return r},W.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},W.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+W.SIZEOF_INT},W.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},W.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=W.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+W.FILE_IDENTIFIER_LENGTH);for(var e=0;e>6*n)+r];n>0;){var o=e>>6*(n-1);i.push(128|63&o),n-=1}return i}}K.prototype={decode:function(t,e){var n;n="object"===typeof t&&t instanceof ArrayBuffer?new Uint8Array(t):"object"===typeof t&&"buffer"in t&&t.buffer instanceof ArrayBuffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(0),e=H(e),this._streaming||(this._decoder=new Q({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(e.stream);for(var r,i=new G(n),o=[];!i.endOfStream()&&-1!==(r=this._decoder.handler(i,i.read()));)null!==r&&(Array.isArray(r)?o.push.apply(o,r):o.push(r));if(!this._streaming){do{if(-1===(r=this._decoder.handler(i,i.read())))break;null!==r&&(Array.isArray(r)?o.push.apply(o,r):o.push(r))}while(!i.endOfStream());this._decoder=null}return o.length&&(-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===o[0]?(this._BOMseen=!0,o.shift()):this._BOMseen=!0)),function(t){for(var e="",n=0;n>10),56320+(1023&r)))}return e}(o)}},$.prototype={encode:function(t,e){t=t?String(t):"",e=H(e),this._streaming||(this._encoder=new J(this._options)),this._streaming=Boolean(e.stream);for(var n,r=[],i=new G(function(t){for(var e=String(t),n=e.length,r=0,i=[];r57343)i.push(o);else if(56320<=o&&o<=57343)i.push(65533);else if(55296<=o&&o<=56319)if(r===n-1)i.push(65533);else{var a=t.charCodeAt(r+1);if(56320<=a&&a<=57343){var s=1023&o,u=1023&a;i.push(65536+(s<<10)+u),r+=1}else i.push(65533)}r+=1}return i}(t));!i.endOfStream()&&-1!==(n=this._encoder.handler(i,i.read()));)Array.isArray(n)?r.push.apply(r,n):r.push(n);if(!this._streaming){for(;-1!==(n=this._encoder.handler(i,i.read()));)Array.isArray(n)?r.push.apply(r,n):r.push(n);this._encoder=null}return new Uint8Array(r)}};var Z="function"===typeof Buffer?Buffer:null,tt="function"===typeof TextDecoder&&"function"===typeof TextEncoder,et=function(t){if(tt||!Z){var e=new t("utf-8");return function(t){return e.decode(t)}}return function(t){var e=$t(t),n=e.buffer,r=e.byteOffset,i=e.length;return Z.from(n,r,i).toString()}}("undefined"!==typeof TextDecoder?TextDecoder:K),nt=function(t){if(tt||!Z){var e=new t;return function(t){return e.encode(t)}}return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return $t(Z.from(t,"utf8"))}}("undefined"!==typeof TextEncoder?TextEncoder:$);function rt(t,e){return(rt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function it(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&rt(t,e)}function ot(t){return(ot=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function at(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function st(t){return(st="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ut(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ct(t,e){return!e||"object"!==st(e)&&"function"!==typeof e?ut(t):e}function lt(t){return function(){var e,n=ot(t);if(at()){var r=ot(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return ct(this,e)}}var ht=Object.freeze({done:!0,value:void 0}),ft=function(){function t(e){M(this,t),this._json=e}return F(t,[{key:"schema",get:function(){return this._json.schema}},{key:"batches",get:function(){return this._json.batches||[]}},{key:"dictionaries",get:function(){return this._json.dictionaries||[]}}]),t}(),dt=function(){function t(){M(this,t)}return F(t,[{key:"tee",value:function(){return this._getDOMStream().tee()}},{key:"pipe",value:function(t,e){return this._getNodeStream().pipe(t,e)}},{key:"pipeTo",value:function(t,e){return this._getDOMStream().pipeTo(t,e)}},{key:"pipeThrough",value:function(t,e){return this._getDOMStream().pipeThrough(t,e)}},{key:"_getDOMStream",value:function(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}},{key:"_getNodeStream",value:function(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}]),t}(),pt=function(t){it(n,t);var e=lt(n);function n(){var t;return M(this,n),(t=e.call(this))._values=[],t.resolvers=[],t._closedPromise=new Promise((function(e){return t._closedPromiseResolve=e})),t}return F(n,[{key:"cancel",value:function(){var t=P(L.mark((function t(e){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.return(e);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"write",value:function(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}},{key:"abort",value:function(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}},{key:"close",value:function(){if(this._closedPromiseResolve){for(var t=this.resolvers;t.length>0;)t.shift().resolve(ht);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}},{key:Symbol.asyncIterator,value:function(){return this}},{key:"toDOMStream",value:function(t){return Ee.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}},{key:"toNodeStream",value:function(t){return Ee.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}},{key:"throw",value:function(){var t=P(L.mark((function t(e){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.abort(e);case 2:return t.abrupt("return",ht);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"return",value:function(){var t=P(L.mark((function t(e){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.close();case 2:return t.abrupt("return",ht);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"read",value:function(){var t=P(L.mark((function t(e){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.next(e,"read");case 2:return t.abrupt("return",t.sent.value);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"peek",value:function(){var t=P(L.mark((function t(e){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.next(e,"peek");case 2:return t.abrupt("return",t.sent.value);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"next",value:function(){var t=this;return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((function(e,n){t.resolvers.push({resolve:e,reject:n})})):Promise.resolve(ht)}},{key:"_ensureOpen",value:function(){if(this._closedPromiseResolve)return!0;throw new Error("".concat(this," is closed"))}},{key:"closed",get:function(){return this._closedPromise}}]),n}(dt),vt=function(){var t=function(){throw new Error("BigInt is not available in this environment")};function e(){throw t()}return e.asIntN=function(){throw t()},e.asUintN=function(){throw t()},"undefined"!==typeof BigInt?[BigInt,!0]:[e,!1]}(),yt=Object(j.a)(vt,2),gt=yt[0],mt=yt[1],bt=function(){var t=function(){throw new Error("BigInt64Array is not available in this environment")};return"undefined"!==typeof BigInt64Array?[BigInt64Array,!0]:[function(){function e(){throw M(this,e),t()}return F(e,null,[{key:"of",value:function(){throw t()}},{key:"from",value:function(){throw t()}},{key:"BYTES_PER_ELEMENT",get:function(){return 8}}]),e}(),!1]}(),_t=Object(j.a)(bt,2),wt=_t[0],kt=(_t[1],function(){var t=function(){throw new Error("BigUint64Array is not available in this environment")};return"undefined"!==typeof BigUint64Array?[BigUint64Array,!0]:[function(){function e(){throw M(this,e),t()}return F(e,null,[{key:"of",value:function(){throw t()}},{key:"from",value:function(){throw t()}},{key:"BYTES_PER_ELEMENT",get:function(){return 8}}]),e}(),!1]}()),xt=Object(j.a)(kt,2),St=xt[0],Tt=(xt[1],function(t){return"number"===typeof t}),Ct=function(t){return"boolean"===typeof t},Ot=function(t){return"function"===typeof t},Et=function(t){return null!=t&&Object(t)===t},It=function(t){return Et(t)&&Ot(t.then)},At=function(t){return Et(t)&&Ot(t[Symbol.iterator])},Dt=function(t){return Et(t)&&Ot(t[Symbol.asyncIterator])},Pt=function(t){return Et(t)&&Et(t.schema)},Mt=function(t){return Et(t)&&"done"in t&&"value"in t},Bt=function(t){return Et(t)&&Ot(t.stat)&&Tt(t.fd)},Ft=function(t){return Et(t)&&jt(t.body)},Lt=function(t){return Et(t)&&Ot(t.abort)&&Ot(t.getWriter)&&!(t instanceof dt)},jt=function(t){return Et(t)&&Ot(t.cancel)&&Ot(t.getReader)&&!(t instanceof dt)},Rt=function(t){return Et(t)&&Ot(t.end)&&Ot(t.write)&&Ct(t.writable)&&!(t instanceof dt)},Ut=function(t){return Et(t)&&Ot(t.read)&&Ot(t.pipe)&&Ct(t.readable)&&!(t instanceof dt)},Nt=L.mark(ie),zt=W.ByteBuffer,Vt="undefined"!==typeof SharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;function Yt(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.byteLength,i=t.byteLength,o=new Uint8Array(t.buffer,t.byteOffset,i),a=new Uint8Array(e.buffer,e.byteOffset,Math.min(r,i));return o.set(a,n),t}function Wt(t,e){for(var n,r,i,o=function(t){for(var e,n,r,i,o,a,s=t[0]?[t[0]]:[],u=0,c=0,l=t.length;++u0)do{if(t[n]!==e[n])return!1}while(++n0&&(r.push(i),s+=i.byteLength),!(e||a<=s)){d.next=22;break}case 16:return d.next=18,u();case 18:f=d.sent,o=f.cmd,a=f.size;case 21:if(a0&&(i.push(o),u+=o.byteLength),!(n||s<=u)){t.next=31;break}case 25:return t.next=27,c();case 27:d=t.sent,a=d.cmd,s=d.size;case 30:if(s0&&(i.push($t(o)),u+=o.byteLength),!(n||s<=u)){t.next=31;break}case 25:return t.next=27,c();case 27:d=t.sent,a=d.cmd,s=d.size;case 30:if(s=i)){t.next=2;break}return t.abrupt("return",{done:!1,value:new Uint8Array(n,0,i)});case 2:return t.next=4,e.read(new Uint8Array(n,r,i-r));case 4:if(o=t.sent,a=o.done,s=o.value,!((r+=s.byteLength)0&&(c.push(l),u+=l.byteLength)),!(i||s<=u)){t.next=36;break}case 30:return t.next=32,h();case 32:v=t.sent,a=v.cmd,s=v.size;case 35:if(s=0;n--)t.addInt32(e[n]);return t.endVector()}},{key:"startTypeIdsVector",value:function(t,e){t.startVector(4,e,4)}},{key:"endUnion",value:function(t){return t.endObject()}},{key:"createUnion",value:function(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}}]),e}();e.Union=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){M(this,t),this.bb=null,this.bb_pos=0}return F(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"bitWidth",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}},{key:"isSigned",value:function(){var t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}}],[{key:"getRootAsInt",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startInt",value:function(t){t.startObject(2)}},{key:"addBitWidth",value:function(t,e){t.addFieldInt32(0,e,0)}},{key:"addIsSigned",value:function(t,e){t.addFieldInt8(1,+e,0)}},{key:"endInt",value:function(t){return t.endObject()}},{key:"createInt",value:function(e,n,r){return t.startInt(e),t.addBitWidth(e,n),t.addIsSigned(e,r),t.endInt(e)}}]),t}();t.Int=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){M(this,e),this.bb=null,this.bb_pos=0}return F(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"precision",value:function(){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.Precision.HALF}}],[{key:"getRootAsFloatingPoint",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startFloatingPoint",value:function(t){t.startObject(1)}},{key:"addPrecision",value:function(e,n){e.addFieldInt16(0,n,t.apache.arrow.flatbuf.Precision.HALF)}},{key:"endFloatingPoint",value:function(t){return t.endObject()}},{key:"createFloatingPoint",value:function(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}}]),e}();e.FloatingPoint=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){M(this,t),this.bb=null,this.bb_pos=0}return F(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}}],[{key:"getRootAsUtf8",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startUtf8",value:function(t){t.startObject(0)}},{key:"endUtf8",value:function(t){return t.endObject()}},{key:"createUtf8",value:function(e){return t.startUtf8(e),t.endUtf8(e)}}]),t}();t.Utf8=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){M(this,t),this.bb=null,this.bb_pos=0}return F(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}}],[{key:"getRootAsBinary",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startBinary",value:function(t){t.startObject(0)}},{key:"endBinary",value:function(t){return t.endObject()}},{key:"createBinary",value:function(e){return t.startBinary(e),t.endBinary(e)}}]),t}();t.Binary=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){M(this,t),this.bb=null,this.bb_pos=0}return F(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}}],[{key:"getRootAsLargeUtf8",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startLargeUtf8",value:function(t){t.startObject(0)}},{key:"endLargeUtf8",value:function(t){return t.endObject()}},{key:"createLargeUtf8",value:function(e){return t.startLargeUtf8(e),t.endLargeUtf8(e)}}]),t}();t.LargeUtf8=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){M(this,t),this.bb=null,this.bb_pos=0}return F(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}}],[{key:"getRootAsLargeBinary",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startLargeBinary",value:function(t){t.startObject(0)}},{key:"endLargeBinary",value:function(t){return t.endObject()}},{key:"createLargeBinary",value:function(e){return t.startLargeBinary(e),t.endLargeBinary(e)}}]),t}();t.LargeBinary=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){M(this,t),this.bb=null,this.bb_pos=0}return F(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"byteWidth",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}}],[{key:"getRootAsFixedSizeBinary",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startFixedSizeBinary",value:function(t){t.startObject(1)}},{key:"addByteWidth",value:function(t,e){t.addFieldInt32(0,e,0)}},{key:"endFixedSizeBinary",value:function(t){return t.endObject()}},{key:"createFixedSizeBinary",value:function(e,n){return t.startFixedSizeBinary(e),t.addByteWidth(e,n),t.endFixedSizeBinary(e)}}]),t}();t.FixedSizeBinary=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){M(this,t),this.bb=null,this.bb_pos=0}return F(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}}],[{key:"getRootAsBool",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startBool",value:function(t){t.startObject(0)}},{key:"endBool",value:function(t){return t.endObject()}},{key:"createBool",value:function(e){return t.startBool(e),t.endBool(e)}}]),t}();t.Bool=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){M(this,t),this.bb=null,this.bb_pos=0}return F(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"precision",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}},{key:"scale",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}}],[{key:"getRootAsDecimal",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startDecimal",value:function(t){t.startObject(2)}},{key:"addPrecision",value:function(t,e){t.addFieldInt32(0,e,0)}},{key:"addScale",value:function(t,e){t.addFieldInt32(1,e,0)}},{key:"endDecimal",value:function(t){return t.endObject()}},{key:"createDecimal",value:function(e,n,r){return t.startDecimal(e),t.addPrecision(e,n),t.addScale(e,r),t.endDecimal(e)}}]),t}();t.Decimal=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){M(this,e),this.bb=null,this.bb_pos=0}return F(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"unit",value:function(){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.DateUnit.MILLISECOND}}],[{key:"getRootAsDate",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startDate",value:function(t){t.startObject(1)}},{key:"addUnit",value:function(e,n){e.addFieldInt16(0,n,t.apache.arrow.flatbuf.DateUnit.MILLISECOND)}},{key:"endDate",value:function(t){return t.endObject()}},{key:"createDate",value:function(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}}]),e}();e.Date=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){M(this,e),this.bb=null,this.bb_pos=0}return F(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"unit",value:function(){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.TimeUnit.MILLISECOND}},{key:"bitWidth",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}}],[{key:"getRootAsTime",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startTime",value:function(t){t.startObject(2)}},{key:"addUnit",value:function(e,n){e.addFieldInt16(0,n,t.apache.arrow.flatbuf.TimeUnit.MILLISECOND)}},{key:"addBitWidth",value:function(t,e){t.addFieldInt32(1,e,32)}},{key:"endTime",value:function(t){return t.endObject()}},{key:"createTime",value:function(t,n,r){return e.startTime(t),e.addUnit(t,n),e.addBitWidth(t,r),e.endTime(t)}}]),e}();e.Time=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){M(this,e),this.bb=null,this.bb_pos=0}return F(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"unit",value:function(){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.TimeUnit.SECOND}},{key:"timezone",value:function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}}],[{key:"getRootAsTimestamp",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startTimestamp",value:function(t){t.startObject(2)}},{key:"addUnit",value:function(e,n){e.addFieldInt16(0,n,t.apache.arrow.flatbuf.TimeUnit.SECOND)}},{key:"addTimezone",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"endTimestamp",value:function(t){return t.endObject()}},{key:"createTimestamp",value:function(t,n,r){return e.startTimestamp(t),e.addUnit(t,n),e.addTimezone(t,r),e.endTimestamp(t)}}]),e}();e.Timestamp=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){M(this,e),this.bb=null,this.bb_pos=0}return F(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"unit",value:function(){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH}}],[{key:"getRootAsInterval",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startInterval",value:function(t){t.startObject(1)}},{key:"addUnit",value:function(e,n){e.addFieldInt16(0,n,t.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH)}},{key:"endInterval",value:function(t){return t.endObject()}},{key:"createInterval",value:function(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}}]),e}();e.Interval=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){M(this,e),this.bb=null,this.bb_pos=0}return F(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"unit",value:function(){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.TimeUnit.MILLISECOND}}],[{key:"getRootAsDuration",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startDuration",value:function(t){t.startObject(1)}},{key:"addUnit",value:function(e,n){e.addFieldInt16(0,n,t.apache.arrow.flatbuf.TimeUnit.MILLISECOND)}},{key:"endDuration",value:function(t){return t.endObject()}},{key:"createDuration",value:function(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}}]),e}();e.Duration=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){M(this,t),this.bb=null,this.bb_pos=0}return F(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"key",value:function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"value",value:function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}}],[{key:"getRootAsKeyValue",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startKeyValue",value:function(t){t.startObject(2)}},{key:"addKey",value:function(t,e){t.addFieldOffset(0,e,0)}},{key:"addValue",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"endKeyValue",value:function(t){return t.endObject()}},{key:"createKeyValue",value:function(e,n,r){return t.startKeyValue(e),t.addKey(e,n),t.addValue(e,r),t.endKeyValue(e)}}]),t}();t.KeyValue=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){M(this,e),this.bb=null,this.bb_pos=0}return F(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"id",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}},{key:"indexType",value:function(e){var n=this.bb.__offset(this.bb_pos,6);return n?(e||new t.apache.arrow.flatbuf.Int).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}},{key:"isOrdered",value:function(){var t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}}],[{key:"getRootAsDictionaryEncoding",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startDictionaryEncoding",value:function(t){t.startObject(3)}},{key:"addId",value:function(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}},{key:"addIndexType",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"addIsOrdered",value:function(t,e){t.addFieldInt8(2,+e,0)}},{key:"endDictionaryEncoding",value:function(t){return t.endObject()}},{key:"createDictionaryEncoding",value:function(t,n,r,i){return e.startDictionaryEncoding(t),e.addId(t,n),e.addIndexType(t,r),e.addIsOrdered(t,i),e.endDictionaryEncoding(t)}}]),e}();e.DictionaryEncoding=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){M(this,e),this.bb=null,this.bb_pos=0}return F(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"name",value:function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"nullable",value:function(){var t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}},{key:"typeType",value:function(){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):t.apache.arrow.flatbuf.Type.NONE}},{key:"type",value:function(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}},{key:"dictionary",value:function(e){var n=this.bb.__offset(this.bb_pos,12);return n?(e||new t.apache.arrow.flatbuf.DictionaryEncoding).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}},{key:"children",value:function(e,n){var r=this.bb.__offset(this.bb_pos,14);return r?(n||new t.apache.arrow.flatbuf.Field).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}},{key:"childrenLength",value:function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"customMetadata",value:function(e,n){var r=this.bb.__offset(this.bb_pos,16);return r?(n||new t.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}},{key:"customMetadataLength",value:function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}}],[{key:"getRootAsField",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startField",value:function(t){t.startObject(7)}},{key:"addName",value:function(t,e){t.addFieldOffset(0,e,0)}},{key:"addNullable",value:function(t,e){t.addFieldInt8(1,+e,0)}},{key:"addTypeType",value:function(e,n){e.addFieldInt8(2,n,t.apache.arrow.flatbuf.Type.NONE)}},{key:"addType",value:function(t,e){t.addFieldOffset(3,e,0)}},{key:"addDictionary",value:function(t,e){t.addFieldOffset(4,e,0)}},{key:"addChildren",value:function(t,e){t.addFieldOffset(5,e,0)}},{key:"createChildrenVector",value:function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}},{key:"startChildrenVector",value:function(t,e){t.startVector(4,e,4)}},{key:"addCustomMetadata",value:function(t,e){t.addFieldOffset(6,e,0)}},{key:"createCustomMetadataVector",value:function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}},{key:"startCustomMetadataVector",value:function(t,e){t.startVector(4,e,4)}},{key:"endField",value:function(t){return t.endObject()}},{key:"createField",value:function(t,n,r,i,o,a,s,u){return e.startField(t),e.addName(t,n),e.addNullable(t,r),e.addTypeType(t,i),e.addType(t,o),e.addDictionary(t,a),e.addChildren(t,s),e.addCustomMetadata(t,u),e.endField(t)}}]),e}();e.Field=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){M(this,t),this.bb=null,this.bb_pos=0}return F(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"offset",value:function(){return this.bb.readInt64(this.bb_pos)}},{key:"length",value:function(){return this.bb.readInt64(this.bb_pos+8)}}],[{key:"createBuffer",value:function(t,e,n){return t.prep(8,16),t.writeInt64(n),t.writeInt64(e),t.offset()}}]),t}();t.Buffer=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){M(this,e),this.bb=null,this.bb_pos=0}return F(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"endianness",value:function(){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.Endianness.Little}},{key:"fields",value:function(e,n){var r=this.bb.__offset(this.bb_pos,6);return r?(n||new t.apache.arrow.flatbuf.Field).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}},{key:"fieldsLength",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"customMetadata",value:function(e,n){var r=this.bb.__offset(this.bb_pos,8);return r?(n||new t.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}},{key:"customMetadataLength",value:function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}}],[{key:"getRootAsSchema",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startSchema",value:function(t){t.startObject(3)}},{key:"addEndianness",value:function(e,n){e.addFieldInt16(0,n,t.apache.arrow.flatbuf.Endianness.Little)}},{key:"addFields",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"createFieldsVector",value:function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}},{key:"startFieldsVector",value:function(t,e){t.startVector(4,e,4)}},{key:"addCustomMetadata",value:function(t,e){t.addFieldOffset(2,e,0)}},{key:"createCustomMetadataVector",value:function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}},{key:"startCustomMetadataVector",value:function(t,e){t.startVector(4,e,4)}},{key:"endSchema",value:function(t){return t.endObject()}},{key:"finishSchemaBuffer",value:function(t,e){t.finish(e)}},{key:"createSchema",value:function(t,n,r,i){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.endSchema(t)}}]),e}();e.Schema=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Ne||(Ne={})),function(t){!function(t){!function(t){!function(t){t.Schema=Ne.apache.arrow.flatbuf.Schema}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Xe||(Xe={})),function(t){!function(t){!function(t){!function(t){!function(t){t[t.NONE=0]="NONE",t[t.Schema=1]="Schema",t[t.DictionaryBatch=2]="DictionaryBatch",t[t.RecordBatch=3]="RecordBatch",t[t.Tensor=4]="Tensor",t[t.SparseTensor=5]="SparseTensor"}(t.MessageHeader||(t.MessageHeader={}))}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Xe||(Xe={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){M(this,t),this.bb=null,this.bb_pos=0}return F(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"length",value:function(){return this.bb.readInt64(this.bb_pos)}},{key:"nullCount",value:function(){return this.bb.readInt64(this.bb_pos+8)}}],[{key:"createFieldNode",value:function(t,e,n){return t.prep(8,16),t.writeInt64(n),t.writeInt64(e),t.offset()}}]),t}();t.FieldNode=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Xe||(Xe={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){M(this,e),this.bb=null,this.bb_pos=0}return F(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"length",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}},{key:"nodes",value:function(e,n){var r=this.bb.__offset(this.bb_pos,6);return r?(n||new t.apache.arrow.flatbuf.FieldNode).__init(this.bb.__vector(this.bb_pos+r)+16*e,this.bb):null}},{key:"nodesLength",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"buffers",value:function(t,e){var n=this.bb.__offset(this.bb_pos,8);return n?(e||new Ne.apache.arrow.flatbuf.Buffer).__init(this.bb.__vector(this.bb_pos+n)+16*t,this.bb):null}},{key:"buffersLength",value:function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}}],[{key:"getRootAsRecordBatch",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startRecordBatch",value:function(t){t.startObject(3)}},{key:"addLength",value:function(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}},{key:"addNodes",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"startNodesVector",value:function(t,e){t.startVector(16,e,8)}},{key:"addBuffers",value:function(t,e){t.addFieldOffset(2,e,0)}},{key:"startBuffersVector",value:function(t,e){t.startVector(16,e,8)}},{key:"endRecordBatch",value:function(t){return t.endObject()}},{key:"createRecordBatch",value:function(t,n,r,i){return e.startRecordBatch(t),e.addLength(t,n),e.addNodes(t,r),e.addBuffers(t,i),e.endRecordBatch(t)}}]),e}();e.RecordBatch=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Xe||(Xe={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){M(this,e),this.bb=null,this.bb_pos=0}return F(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"id",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}},{key:"data",value:function(e){var n=this.bb.__offset(this.bb_pos,6);return n?(e||new t.apache.arrow.flatbuf.RecordBatch).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}},{key:"isDelta",value:function(){var t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}}],[{key:"getRootAsDictionaryBatch",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startDictionaryBatch",value:function(t){t.startObject(3)}},{key:"addId",value:function(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}},{key:"addData",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"addIsDelta",value:function(t,e){t.addFieldInt8(2,+e,0)}},{key:"endDictionaryBatch",value:function(t){return t.endObject()}},{key:"createDictionaryBatch",value:function(t,n,r,i){return e.startDictionaryBatch(t),e.addId(t,n),e.addData(t,r),e.addIsDelta(t,i),e.endDictionaryBatch(t)}}]),e}();e.DictionaryBatch=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Xe||(Xe={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){M(this,e),this.bb=null,this.bb_pos=0}return F(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"version",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ne.apache.arrow.flatbuf.MetadataVersion.V1}},{key:"headerType",value:function(){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):t.apache.arrow.flatbuf.MessageHeader.NONE}},{key:"header",value:function(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}},{key:"bodyLength",value:function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}},{key:"customMetadata",value:function(t,e){var n=this.bb.__offset(this.bb_pos,12);return n?(e||new Ne.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null}},{key:"customMetadataLength",value:function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}}],[{key:"getRootAsMessage",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startMessage",value:function(t){t.startObject(5)}},{key:"addVersion",value:function(t,e){t.addFieldInt16(0,e,Ne.apache.arrow.flatbuf.MetadataVersion.V1)}},{key:"addHeaderType",value:function(e,n){e.addFieldInt8(1,n,t.apache.arrow.flatbuf.MessageHeader.NONE)}},{key:"addHeader",value:function(t,e){t.addFieldOffset(2,e,0)}},{key:"addBodyLength",value:function(t,e){t.addFieldInt64(3,e,t.createLong(0,0))}},{key:"addCustomMetadata",value:function(t,e){t.addFieldOffset(4,e,0)}},{key:"createCustomMetadataVector",value:function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}},{key:"startCustomMetadataVector",value:function(t,e){t.startVector(4,e,4)}},{key:"endMessage",value:function(t){return t.endObject()}},{key:"finishMessageBuffer",value:function(t,e){t.finish(e)}},{key:"createMessage",value:function(t,n,r,i,o,a){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,a),e.endMessage(t)}}]),e}();e.Message=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Xe||(Xe={}));Ne.apache.arrow.flatbuf.Type;var Ge,qe,Ke=Ne.apache.arrow.flatbuf.DateUnit,$e=Ne.apache.arrow.flatbuf.TimeUnit,Qe=Ne.apache.arrow.flatbuf.Precision,Je=Ne.apache.arrow.flatbuf.UnionMode,Ze=Ne.apache.arrow.flatbuf.IntervalUnit,tn=Xe.apache.arrow.flatbuf.MessageHeader,en=Ne.apache.arrow.flatbuf.MetadataVersion;!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth"}(Ge||(Ge={})),function(t){t[t.OFFSET=0]="OFFSET",t[t.DATA=1]="DATA",t[t.VALIDITY=2]="VALIDITY",t[t.TYPE=3]="TYPE"}(qe||(qe={}));var nn=L.mark(cn);function rn(t,e,n,r){return 0!==(n&1<>r}function an(t,e,n){return n?!!(t[e>>3]|=1<>3]&=~(1<0||n.byteLength>3):un(cn(n,t,e,null,rn)).subarray(0,r)),i}return n}function un(t){var e,n=[],r=0,i=0,o=0,a=A(t);try{for(a.s();!(e=a.n()).done;){e.value&&(o|=1<0)&&(n[r++]=o);var s=new Uint8Array(n.length+7&-8);return s.set(n),s}function cn(t,e,n,r,i){var o,a,s,u,c;return L.wrap((function(l){for(;;)switch(l.prev=l.next){case 0:o=e%8,a=e>>3,s=0,u=n;case 3:if(!(u>0)){l.next=11;break}c=t[a++];case 5:return l.next=7,i(r,s++,c,o);case 7:if(--u>0&&++o<8){l.next=5;break}case 8:o=0,l.next=3;break;case 11:case"end":return l.stop()}}),nn)}function ln(t,e,n){if(n-e<=0)return 0;if(n-e<8){var r,i=0,o=A(cn(t,e,n-e,t,on));try{for(o.s();!(r=o.n()).done;){i+=r.value}}catch(u){o.e(u)}finally{o.f()}return i}var a=n>>3<<3,s=e+(e%8===0?0:8-e%8);return ln(t,e,s)+ln(t,a,n)+hn(t,s>>3,a-s>>3)}function hn(t,e,n){for(var r=0,i=0|e,o=new DataView(t.buffer,t.byteOffset,t.byteLength),a=void 0===n?t.byteLength:i+n;a-i>=4;)r+=fn(o.getUint32(i)),i+=4;for(;a-i>=2;)r+=fn(o.getUint16(i)),i+=2;for(;a-i>=1;)r+=fn(o.getUint8(i)),i+=1;return r}function fn(t){var e=0|t;return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24}var dn=n(1),pn=function(){function t(){M(this,t)}return F(t,[{key:"visitMany",value:function(t){for(var e=this,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i1&&void 0!==arguments[1])||arguments[1];return vn(this,t,e)}},{key:"visitNull",value:function(t){return null}},{key:"visitBool",value:function(t){return null}},{key:"visitInt",value:function(t){return null}},{key:"visitFloat",value:function(t){return null}},{key:"visitUtf8",value:function(t){return null}},{key:"visitBinary",value:function(t){return null}},{key:"visitFixedSizeBinary",value:function(t){return null}},{key:"visitDate",value:function(t){return null}},{key:"visitTimestamp",value:function(t){return null}},{key:"visitTime",value:function(t){return null}},{key:"visitDecimal",value:function(t){return null}},{key:"visitList",value:function(t){return null}},{key:"visitStruct",value:function(t){return null}},{key:"visitUnion",value:function(t){return null}},{key:"visitDictionary",value:function(t){return null}},{key:"visitInterval",value:function(t){return null}},{key:"visitFixedSizeList",value:function(t){return null}},{key:"visitMap",value:function(t){return null}}]),t}();function vn(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=null,i=Ge.NONE;switch(e instanceof lr||e instanceof He?i=yn(e.type):e instanceof In?i=yn(e):"number"!==typeof(i=e)&&(i=Ge[e]),i){case Ge.Null:r=t.visitNull;break;case Ge.Bool:r=t.visitBool;break;case Ge.Int:r=t.visitInt;break;case Ge.Int8:r=t.visitInt8||t.visitInt;break;case Ge.Int16:r=t.visitInt16||t.visitInt;break;case Ge.Int32:r=t.visitInt32||t.visitInt;break;case Ge.Int64:r=t.visitInt64||t.visitInt;break;case Ge.Uint8:r=t.visitUint8||t.visitInt;break;case Ge.Uint16:r=t.visitUint16||t.visitInt;break;case Ge.Uint32:r=t.visitUint32||t.visitInt;break;case Ge.Uint64:r=t.visitUint64||t.visitInt;break;case Ge.Float:r=t.visitFloat;break;case Ge.Float16:r=t.visitFloat16||t.visitFloat;break;case Ge.Float32:r=t.visitFloat32||t.visitFloat;break;case Ge.Float64:r=t.visitFloat64||t.visitFloat;break;case Ge.Utf8:r=t.visitUtf8;break;case Ge.Binary:r=t.visitBinary;break;case Ge.FixedSizeBinary:r=t.visitFixedSizeBinary;break;case Ge.Date:r=t.visitDate;break;case Ge.DateDay:r=t.visitDateDay||t.visitDate;break;case Ge.DateMillisecond:r=t.visitDateMillisecond||t.visitDate;break;case Ge.Timestamp:r=t.visitTimestamp;break;case Ge.TimestampSecond:r=t.visitTimestampSecond||t.visitTimestamp;break;case Ge.TimestampMillisecond:r=t.visitTimestampMillisecond||t.visitTimestamp;break;case Ge.TimestampMicrosecond:r=t.visitTimestampMicrosecond||t.visitTimestamp;break;case Ge.TimestampNanosecond:r=t.visitTimestampNanosecond||t.visitTimestamp;break;case Ge.Time:r=t.visitTime;break;case Ge.TimeSecond:r=t.visitTimeSecond||t.visitTime;break;case Ge.TimeMillisecond:r=t.visitTimeMillisecond||t.visitTime;break;case Ge.TimeMicrosecond:r=t.visitTimeMicrosecond||t.visitTime;break;case Ge.TimeNanosecond:r=t.visitTimeNanosecond||t.visitTime;break;case Ge.Decimal:r=t.visitDecimal;break;case Ge.List:r=t.visitList;break;case Ge.Struct:r=t.visitStruct;break;case Ge.Union:r=t.visitUnion;break;case Ge.DenseUnion:r=t.visitDenseUnion||t.visitUnion;break;case Ge.SparseUnion:r=t.visitSparseUnion||t.visitUnion;break;case Ge.Dictionary:r=t.visitDictionary;break;case Ge.Interval:r=t.visitInterval;break;case Ge.IntervalDayTime:r=t.visitIntervalDayTime||t.visitInterval;break;case Ge.IntervalYearMonth:r=t.visitIntervalYearMonth||t.visitInterval;break;case Ge.FixedSizeList:r=t.visitFixedSizeList;break;case Ge.Map:r=t.visitMap}if("function"===typeof r)return r;if(!n)return function(){return null};throw new Error("Unrecognized type '".concat(Ge[i],"'"))}function yn(t){switch(t.typeId){case Ge.Null:return Ge.Null;case Ge.Int:var e=t.bitWidth,n=t.isSigned;switch(e){case 8:return n?Ge.Int8:Ge.Uint8;case 16:return n?Ge.Int16:Ge.Uint16;case 32:return n?Ge.Int32:Ge.Uint32;case 64:return n?Ge.Int64:Ge.Uint64}return Ge.Int;case Ge.Float:switch(t.precision){case Qe.HALF:return Ge.Float16;case Qe.SINGLE:return Ge.Float32;case Qe.DOUBLE:return Ge.Float64}return Ge.Float;case Ge.Binary:return Ge.Binary;case Ge.Utf8:return Ge.Utf8;case Ge.Bool:return Ge.Bool;case Ge.Decimal:return Ge.Decimal;case Ge.Time:switch(t.unit){case $e.SECOND:return Ge.TimeSecond;case $e.MILLISECOND:return Ge.TimeMillisecond;case $e.MICROSECOND:return Ge.TimeMicrosecond;case $e.NANOSECOND:return Ge.TimeNanosecond}return Ge.Time;case Ge.Timestamp:switch(t.unit){case $e.SECOND:return Ge.TimestampSecond;case $e.MILLISECOND:return Ge.TimestampMillisecond;case $e.MICROSECOND:return Ge.TimestampMicrosecond;case $e.NANOSECOND:return Ge.TimestampNanosecond}return Ge.Timestamp;case Ge.Date:switch(t.unit){case Ke.DAY:return Ge.DateDay;case Ke.MILLISECOND:return Ge.DateMillisecond}return Ge.Date;case Ge.Interval:switch(t.unit){case Ze.DAY_TIME:return Ge.IntervalDayTime;case Ze.YEAR_MONTH:return Ge.IntervalYearMonth}return Ge.Interval;case Ge.Map:return Ge.Map;case Ge.List:return Ge.List;case Ge.Struct:return Ge.Struct;case Ge.Union:switch(t.mode){case Je.Dense:return Ge.DenseUnion;case Je.Sparse:return Ge.SparseUnion}return Ge.Union;case Ge.FixedSizeBinary:return Ge.FixedSizeBinary;case Ge.FixedSizeList:return Ge.FixedSizeList;case Ge.Dictionary:return Ge.Dictionary}throw new Error("Unrecognized type '".concat(Ge[t.typeId],"'"))}pn.prototype.visitInt8=null,pn.prototype.visitInt16=null,pn.prototype.visitInt32=null,pn.prototype.visitInt64=null,pn.prototype.visitUint8=null,pn.prototype.visitUint16=null,pn.prototype.visitUint32=null,pn.prototype.visitUint64=null,pn.prototype.visitFloat16=null,pn.prototype.visitFloat32=null,pn.prototype.visitFloat64=null,pn.prototype.visitDateDay=null,pn.prototype.visitDateMillisecond=null,pn.prototype.visitTimestampSecond=null,pn.prototype.visitTimestampMillisecond=null,pn.prototype.visitTimestampMicrosecond=null,pn.prototype.visitTimestampNanosecond=null,pn.prototype.visitTimeSecond=null,pn.prototype.visitTimeMillisecond=null,pn.prototype.visitTimeMicrosecond=null,pn.prototype.visitTimeNanosecond=null,pn.prototype.visitDenseUnion=null,pn.prototype.visitSparseUnion=null,pn.prototype.visitIntervalDayTime=null,pn.prototype.visitIntervalYearMonth=null;var gn=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,[{key:"compareSchemas",value:function(t,e){return t===e||e instanceof t.constructor&&En.compareFields(t.fields,e.fields)}},{key:"compareFields",value:function(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((function(t,n){return En.compareField(t,e[n])}))}},{key:"compareField",value:function(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&En.visit(t.type,e.type)}}]),n}(pn);function mn(t,e){return e instanceof t.constructor}function bn(t,e){return t===e||mn(t,e)}function _n(t,e){return t===e||mn(t,e)&&t.bitWidth===e.bitWidth&&t.isSigned===e.isSigned}function wn(t,e){return t===e||mn(t,e)&&t.precision===e.precision}function kn(t,e){return t===e||mn(t,e)&&t.unit===e.unit}function xn(t,e){return t===e||mn(t,e)&&t.unit===e.unit&&t.timezone===e.timezone}function Sn(t,e){return t===e||mn(t,e)&&t.unit===e.unit&&t.bitWidth===e.bitWidth}function Tn(t,e){return t===e||mn(t,e)&&t.mode===e.mode&&t.typeIds.every((function(t,n){return t===e.typeIds[n]}))&&En.compareFields(t.children,e.children)}function Cn(t,e){return t===e||mn(t,e)&&t.unit===e.unit}gn.prototype.visitNull=bn,gn.prototype.visitBool=bn,gn.prototype.visitInt=_n,gn.prototype.visitInt8=_n,gn.prototype.visitInt16=_n,gn.prototype.visitInt32=_n,gn.prototype.visitInt64=_n,gn.prototype.visitUint8=_n,gn.prototype.visitUint16=_n,gn.prototype.visitUint32=_n,gn.prototype.visitUint64=_n,gn.prototype.visitFloat=wn,gn.prototype.visitFloat16=wn,gn.prototype.visitFloat32=wn,gn.prototype.visitFloat64=wn,gn.prototype.visitUtf8=bn,gn.prototype.visitBinary=bn,gn.prototype.visitFixedSizeBinary=function(t,e){return t===e||mn(t,e)&&t.byteWidth===e.byteWidth},gn.prototype.visitDate=kn,gn.prototype.visitDateDay=kn,gn.prototype.visitDateMillisecond=kn,gn.prototype.visitTimestamp=xn,gn.prototype.visitTimestampSecond=xn,gn.prototype.visitTimestampMillisecond=xn,gn.prototype.visitTimestampMicrosecond=xn,gn.prototype.visitTimestampNanosecond=xn,gn.prototype.visitTime=Sn,gn.prototype.visitTimeSecond=Sn,gn.prototype.visitTimeMillisecond=Sn,gn.prototype.visitTimeMicrosecond=Sn,gn.prototype.visitTimeNanosecond=Sn,gn.prototype.visitDecimal=bn,gn.prototype.visitList=function(t,e){return t===e||mn(t,e)&&t.children.length===e.children.length&&En.compareFields(t.children,e.children)},gn.prototype.visitStruct=function(t,e){return t===e||mn(t,e)&&t.children.length===e.children.length&&En.compareFields(t.children,e.children)},gn.prototype.visitUnion=Tn,gn.prototype.visitDenseUnion=Tn,gn.prototype.visitSparseUnion=Tn,gn.prototype.visitDictionary=function(t,e){return t===e||mn(t,e)&&t.id===e.id&&t.isOrdered===e.isOrdered&&En.visit(t.indices,e.indices)&&En.visit(t.dictionary,e.dictionary)},gn.prototype.visitInterval=Cn,gn.prototype.visitIntervalDayTime=Cn,gn.prototype.visitIntervalYearMonth=Cn,gn.prototype.visitFixedSizeList=function(t,e){return t===e||mn(t,e)&&t.listSize===e.listSize&&t.children.length===e.children.length&&En.compareFields(t.children,e.children)},gn.prototype.visitMap=function(t,e){return t===e||mn(t,e)&&t.keysSorted===e.keysSorted&&t.children.length===e.children.length&&En.compareFields(t.children,e.children)};var On,En=new gn,In=function(){function t(){M(this,t)}return F(t,[{key:"compareTo",value:function(t){return En.visit(this,t)}},{key:"typeId",get:function(){return Ge.NONE}}],[{key:"isNull",value:function(t){return t&&t.typeId===Ge.Null}},{key:"isInt",value:function(t){return t&&t.typeId===Ge.Int}},{key:"isFloat",value:function(t){return t&&t.typeId===Ge.Float}},{key:"isBinary",value:function(t){return t&&t.typeId===Ge.Binary}},{key:"isUtf8",value:function(t){return t&&t.typeId===Ge.Utf8}},{key:"isBool",value:function(t){return t&&t.typeId===Ge.Bool}},{key:"isDecimal",value:function(t){return t&&t.typeId===Ge.Decimal}},{key:"isDate",value:function(t){return t&&t.typeId===Ge.Date}},{key:"isTime",value:function(t){return t&&t.typeId===Ge.Time}},{key:"isTimestamp",value:function(t){return t&&t.typeId===Ge.Timestamp}},{key:"isInterval",value:function(t){return t&&t.typeId===Ge.Interval}},{key:"isList",value:function(t){return t&&t.typeId===Ge.List}},{key:"isStruct",value:function(t){return t&&t.typeId===Ge.Struct}},{key:"isUnion",value:function(t){return t&&t.typeId===Ge.Union}},{key:"isFixedSizeBinary",value:function(t){return t&&t.typeId===Ge.FixedSizeBinary}},{key:"isFixedSizeList",value:function(t){return t&&t.typeId===Ge.FixedSizeList}},{key:"isMap",value:function(t){return t&&t.typeId===Ge.Map}},{key:"isDictionary",value:function(t){return t&&t.typeId===Ge.Dictionary}}]),t}();In[Symbol.toStringTag]=((On=In.prototype).children=null,On.ArrayType=Array,On[Symbol.toStringTag]="DataType");var An=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,[{key:"toString",value:function(){return"Null"}},{key:"typeId",get:function(){return Ge.Null}}]),n}(In);An[Symbol.toStringTag]=function(t){return t[Symbol.toStringTag]="Null"}(An.prototype);var Dn=function(t){it(n,t);var e=lt(n);function n(t,r){var i;return M(this,n),(i=e.call(this)).isSigned=t,i.bitWidth=r,i}return F(n,[{key:"toString",value:function(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}},{key:"typeId",get:function(){return Ge.Int}},{key:"ArrayType",get:function(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:case 64:return this.isSigned?Int32Array:Uint32Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}}]),n}(In);Dn[Symbol.toStringTag]=function(t){return t.isSigned=null,t.bitWidth=null,t[Symbol.toStringTag]="Int"}(Dn.prototype);var Pn=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this,!0,8)}return n}(Dn),Mn=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this,!0,16)}return n}(Dn),Bn=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this,!0,32)}return n}(Dn),Fn=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this,!0,64)}return n}(Dn),Ln=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this,!1,8)}return n}(Dn),jn=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this,!1,16)}return n}(Dn),Rn=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this,!1,32)}return n}(Dn),Un=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this,!1,64)}return n}(Dn);Object.defineProperty(Pn.prototype,"ArrayType",{value:Int8Array}),Object.defineProperty(Mn.prototype,"ArrayType",{value:Int16Array}),Object.defineProperty(Bn.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(Fn.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(Ln.prototype,"ArrayType",{value:Uint8Array}),Object.defineProperty(jn.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(Rn.prototype,"ArrayType",{value:Uint32Array}),Object.defineProperty(Un.prototype,"ArrayType",{value:Uint32Array});var Nn=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this)).precision=t,r}return F(n,[{key:"toString",value:function(){return"Float".concat(this.precision<<5||16)}},{key:"typeId",get:function(){return Ge.Float}},{key:"ArrayType",get:function(){switch(this.precision){case Qe.HALF:return Uint16Array;case Qe.SINGLE:return Float32Array;case Qe.DOUBLE:return Float64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}}]),n}(In);Nn[Symbol.toStringTag]=function(t){return t.precision=null,t[Symbol.toStringTag]="Float"}(Nn.prototype);var zn=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this,Qe.HALF)}return n}(Nn),Vn=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this,Qe.SINGLE)}return n}(Nn),Yn=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this,Qe.DOUBLE)}return n}(Nn);Object.defineProperty(zn.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(Vn.prototype,"ArrayType",{value:Float32Array}),Object.defineProperty(Yn.prototype,"ArrayType",{value:Float64Array});var Wn=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this)}return F(n,[{key:"toString",value:function(){return"Binary"}},{key:"typeId",get:function(){return Ge.Binary}}]),n}(In);Wn[Symbol.toStringTag]=function(t){return t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Binary"}(Wn.prototype);var Xn=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this)}return F(n,[{key:"toString",value:function(){return"Utf8"}},{key:"typeId",get:function(){return Ge.Utf8}}]),n}(In);Xn[Symbol.toStringTag]=function(t){return t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Utf8"}(Xn.prototype);var Hn=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this)}return F(n,[{key:"toString",value:function(){return"Bool"}},{key:"typeId",get:function(){return Ge.Bool}}]),n}(In);Hn[Symbol.toStringTag]=function(t){return t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Bool"}(Hn.prototype);var Gn=function(t){it(n,t);var e=lt(n);function n(t,r){var i;return M(this,n),(i=e.call(this)).scale=t,i.precision=r,i}return F(n,[{key:"toString",value:function(){return"Decimal[".concat(this.precision,"e").concat(this.scale>0?"+":"").concat(this.scale,"]")}},{key:"typeId",get:function(){return Ge.Decimal}}]),n}(In);Gn[Symbol.toStringTag]=function(t){return t.scale=null,t.precision=null,t.ArrayType=Uint32Array,t[Symbol.toStringTag]="Decimal"}(Gn.prototype);var qn=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this)).unit=t,r}return F(n,[{key:"toString",value:function(){return"Date".concat(32*(this.unit+1),"<").concat(Ke[this.unit],">")}},{key:"typeId",get:function(){return Ge.Date}}]),n}(In);qn[Symbol.toStringTag]=function(t){return t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Date"}(qn.prototype);var Kn=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this,Ke.DAY)}return n}(qn),$n=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.call(this,Ke.MILLISECOND)}return n}(qn),Qn=function(t){it(n,t);var e=lt(n);function n(t,r){var i;return M(this,n),(i=e.call(this)).unit=t,i.bitWidth=r,i}return F(n,[{key:"toString",value:function(){return"Time".concat(this.bitWidth,"<").concat($e[this.unit],">")}},{key:"typeId",get:function(){return Ge.Time}}]),n}(In);Qn[Symbol.toStringTag]=function(t){return t.unit=null,t.bitWidth=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Time"}(Qn.prototype);var Jn=function(t){it(n,t);var e=lt(n);function n(t,r){var i;return M(this,n),(i=e.call(this)).unit=t,i.timezone=r,i}return F(n,[{key:"toString",value:function(){return"Timestamp<".concat($e[this.unit]).concat(this.timezone?", ".concat(this.timezone):"",">")}},{key:"typeId",get:function(){return Ge.Timestamp}}]),n}(In);Jn[Symbol.toStringTag]=function(t){return t.unit=null,t.timezone=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Timestamp"}(Jn.prototype);var Zn=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this)).unit=t,r}return F(n,[{key:"toString",value:function(){return"Interval<".concat(Ze[this.unit],">")}},{key:"typeId",get:function(){return Ge.Interval}}]),n}(In);Zn[Symbol.toStringTag]=function(t){return t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Interval"}(Zn.prototype);var tr=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this)).children=[t],r}return F(n,[{key:"toString",value:function(){return"List<".concat(this.valueType,">")}},{key:"typeId",get:function(){return Ge.List}},{key:"valueType",get:function(){return this.children[0].type}},{key:"valueField",get:function(){return this.children[0]}},{key:"ArrayType",get:function(){return this.valueType.ArrayType}}]),n}(In);tr[Symbol.toStringTag]=function(t){return t.children=null,t[Symbol.toStringTag]="List"}(tr.prototype);var er=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this)).children=t,r}return F(n,[{key:"toString",value:function(){return"Struct<{".concat(this.children.map((function(t){return"".concat(t.name,":").concat(t.type)})).join(", "),"}>")}},{key:"typeId",get:function(){return Ge.Struct}}]),n}(In);er[Symbol.toStringTag]=function(t){return t.children=null,t[Symbol.toStringTag]="Struct"}(er.prototype);var nr=function(t){it(n,t);var e=lt(n);function n(t,r,i){var o;return M(this,n),(o=e.call(this)).mode=t,o.children=i,o.typeIds=r=Int32Array.from(r),o.typeIdToChildIndex=r.reduce((function(t,e,n){return(t[e]=n)&&t||t}),Object.create(null)),o}return F(n,[{key:"toString",value:function(){return"".concat(this[Symbol.toStringTag],"<").concat(this.children.map((function(t){return"".concat(t.type)})).join(" | "),">")}},{key:"typeId",get:function(){return Ge.Union}}]),n}(In);nr[Symbol.toStringTag]=function(t){return t.mode=null,t.typeIds=null,t.children=null,t.typeIdToChildIndex=null,t.ArrayType=Int8Array,t[Symbol.toStringTag]="Union"}(nr.prototype);var rr=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this)).byteWidth=t,r}return F(n,[{key:"toString",value:function(){return"FixedSizeBinary[".concat(this.byteWidth,"]")}},{key:"typeId",get:function(){return Ge.FixedSizeBinary}}]),n}(In);rr[Symbol.toStringTag]=function(t){return t.byteWidth=null,t.ArrayType=Uint8Array,t[Symbol.toStringTag]="FixedSizeBinary"}(rr.prototype);var ir=function(t){it(n,t);var e=lt(n);function n(t,r){var i;return M(this,n),(i=e.call(this)).listSize=t,i.children=[r],i}return F(n,[{key:"toString",value:function(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}},{key:"typeId",get:function(){return Ge.FixedSizeList}},{key:"valueType",get:function(){return this.children[0].type}},{key:"valueField",get:function(){return this.children[0]}},{key:"ArrayType",get:function(){return this.valueType.ArrayType}}]),n}(In);ir[Symbol.toStringTag]=function(t){return t.children=null,t.listSize=null,t[Symbol.toStringTag]="FixedSizeList"}(ir.prototype);var or=function(t){it(n,t);var e=lt(n);function n(t){var r,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return M(this,n),(r=e.call(this)).children=[t],r.keysSorted=i,r}return F(n,[{key:"toString",value:function(){return"Map<{".concat(this.children[0].type.children.map((function(t){return"".concat(t.name,":").concat(t.type)})).join(", "),"}>")}},{key:"typeId",get:function(){return Ge.Map}},{key:"keyType",get:function(){return this.children[0].type.children[0].type}},{key:"valueType",get:function(){return this.children[0].type.children[1].type}}]),n}(In);or[Symbol.toStringTag]=function(t){return t.children=null,t.keysSorted=null,t[Symbol.toStringTag]="Map_"}(or.prototype);var ar,sr=(ar=-1,function(){return++ar}),ur=function(t){it(n,t);var e=lt(n);function n(t,r,i,o){var a;return M(this,n),(a=e.call(this)).indices=r,a.dictionary=t,a.isOrdered=o||!1,a.id=null==i?sr():"number"===typeof i?i:i.low,a}return F(n,[{key:"toString",value:function(){return"Dictionary<".concat(this.indices,", ").concat(this.dictionary,">")}},{key:"typeId",get:function(){return Ge.Dictionary}},{key:"children",get:function(){return this.dictionary.children}},{key:"valueType",get:function(){return this.dictionary}},{key:"ArrayType",get:function(){return this.dictionary.ArrayType}}]),n}(In);function cr(t){var e=t;switch(t.typeId){case Ge.Decimal:return 4;case Ge.Timestamp:return 2;case Ge.Date:case Ge.Interval:return 1+e.unit;case Ge.Int:case Ge.Time:return+(e.bitWidth>32)+1;case Ge.FixedSizeList:return e.listSize;case Ge.FixedSizeBinary:return e.byteWidth;default:return 1}}ur[Symbol.toStringTag]=function(t){return t.id=null,t.indices=null,t.isOrdered=null,t.dictionary=null,t[Symbol.toStringTag]="Dictionary"}(ur.prototype);var lr=function(){function t(e,n,r,i,o,a,s){var u;M(this,t),this.type=e,this.dictionary=s,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1)),this.childData=(a||[]).map((function(e){return e instanceof t?e:e.data})),o instanceof t?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=cr(e),o&&((u=o[0])&&(this.valueOffsets=u),(u=o[1])&&(this.values=u),(u=o[2])&&(this.nullBitmap=u),(u=o[3])&&(this.typeIds=u)))}return F(t,[{key:"clone",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.offset,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.length,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._nullCount,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:this.childData;return new t(e,n,r,i,o,a,this.dictionary)}},{key:"slice",value:function(t,e){var n=this.stride,r=this.typeId,i=this.childData,o=+(0===this._nullCount)-1,a=16===r?n:1,s=this._sliceBuffers(t,e,n,r);return this.clone(this.type,this.offset+t,e,o,s,!i.length||this.valueOffsets?i:this._sliceChildren(i,a*t,a*e))}},{key:"_changeLengthAndBackfillNullBitmap",value:function(t){if(this.typeId===Ge.Null)return this.clone(this.type,0,t,0);var e=this.length,n=this.nullCount,r=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);r[e>>3]=(1<0&&r.set(sn(this.offset,e,this.nullBitmap),0);var i=this.buffers;return i[qe.VALIDITY]=r,this.clone(this.type,0,t,n+(t-e),i)}},{key:"_sliceBuffers",value:function(t,e,n,r){var i,o=this.buffers;return(i=o[qe.TYPE])&&(o[qe.TYPE]=i.subarray(t,t+e)),(i=o[qe.OFFSET])&&(o[qe.OFFSET]=i.subarray(t,t+e+1))||(i=o[qe.DATA])&&(o[qe.DATA]=6===r?i:i.subarray(n*t,n*(t+e))),o}},{key:"_sliceChildren",value:function(t,e,n){return t.map((function(t){return t.slice(e,n)}))}},{key:"typeId",get:function(){return this.type.typeId}},{key:"ArrayType",get:function(){return this.type.ArrayType}},{key:"buffers",get:function(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}},{key:"byteLength",get:function(){var t=0,e=this.valueOffsets,n=this.values,r=this.nullBitmap,i=this.typeIds;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),this.childData.reduce((function(t,e){return t+e.byteLength}),t)}},{key:"nullCount",get:function(){var t,e=this._nullCount;return e<=-1&&(t=this.nullBitmap)&&(this._nullCount=e=this.length-ln(t,this.offset,this.offset+this.length)),e}}],[{key:"new",value:function(e,n,r,i,o,a,s){switch(o instanceof t?o=o.buffers:o||(o=[]),e.typeId){case Ge.Null:return t.Null(e,n,r);case Ge.Int:return t.Int(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ge.Dictionary:return t.Dictionary(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[],s);case Ge.Float:return t.Float(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ge.Bool:return t.Bool(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ge.Decimal:return t.Decimal(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ge.Date:return t.Date(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ge.Time:return t.Time(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ge.Timestamp:return t.Timestamp(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ge.Interval:return t.Interval(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ge.FixedSizeBinary:return t.FixedSizeBinary(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ge.Binary:return t.Binary(e,n,r,i||0,o[qe.VALIDITY],o[qe.OFFSET]||[],o[qe.DATA]||[]);case Ge.Utf8:return t.Utf8(e,n,r,i||0,o[qe.VALIDITY],o[qe.OFFSET]||[],o[qe.DATA]||[]);case Ge.List:return t.List(e,n,r,i||0,o[qe.VALIDITY],o[qe.OFFSET]||[],(a||[])[0]);case Ge.FixedSizeList:return t.FixedSizeList(e,n,r,i||0,o[qe.VALIDITY],(a||[])[0]);case Ge.Struct:return t.Struct(e,n,r,i||0,o[qe.VALIDITY],a||[]);case Ge.Map:return t.Map(e,n,r,i||0,o[qe.VALIDITY],o[qe.OFFSET]||[],(a||[])[0]);case Ge.Union:return t.Union(e,n,r,i||0,o[qe.VALIDITY],o[qe.TYPE]||[],o[qe.OFFSET]||a,a)}throw new Error("Unrecognized typeId ".concat(e.typeId))}},{key:"Null",value:function(e,n,r){return new t(e,n,r,0)}},{key:"Int",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Xt(e.ArrayType,a),$t(o)])}},{key:"Dictionary",value:function(e,n,r,i,o,a,s){return new t(e,n,r,i,[void 0,Xt(e.indices.ArrayType,a),$t(o)],[],s)}},{key:"Float",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Xt(e.ArrayType,a),$t(o)])}},{key:"Bool",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Xt(e.ArrayType,a),$t(o)])}},{key:"Decimal",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Xt(e.ArrayType,a),$t(o)])}},{key:"Date",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Xt(e.ArrayType,a),$t(o)])}},{key:"Time",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Xt(e.ArrayType,a),$t(o)])}},{key:"Timestamp",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Xt(e.ArrayType,a),$t(o)])}},{key:"Interval",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Xt(e.ArrayType,a),$t(o)])}},{key:"FixedSizeBinary",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Xt(e.ArrayType,a),$t(o)])}},{key:"Binary",value:function(e,n,r,i,o,a,s){return new t(e,n,r,i,[qt(a),$t(s),$t(o)])}},{key:"Utf8",value:function(e,n,r,i,o,a,s){return new t(e,n,r,i,[qt(a),$t(s),$t(o)])}},{key:"List",value:function(e,n,r,i,o,a,s){return new t(e,n,r,i,[qt(a),void 0,$t(o)],[s])}},{key:"FixedSizeList",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,void 0,$t(o)],[a])}},{key:"Struct",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,void 0,$t(o)],a)}},{key:"Map",value:function(e,n,r,i,o,a,s){return new t(e,n,r,i,[qt(a),void 0,$t(o)],[s])}},{key:"Union",value:function(e,n,r,i,o,a,s,u){var c=[void 0,void 0,$t(o),Xt(e.ArrayType,a)];return e.mode===Je.Sparse?new t(e,n,r,i,c,s):(c[qe.OFFSET]=qt(s),new t(e,n,r,i,c,u))}}]),t}();lr.prototype.childData=Object.freeze([]);function hr(t){if(null===t)return"null";if(void 0===t)return"undefined";switch(typeof t){case"number":case"bigint":return"".concat(t);case"string":return'"'.concat(t,'"')}return"function"===typeof t[Symbol.toPrimitive]?t[Symbol.toPrimitive]("string"):ArrayBuffer.isView(t)?"[".concat(t,"]"):JSON.stringify(t)}function fr(t){if(!t||t.length<=0)return function(t){return!0};var e="",n=t.filter((function(t){return t===t}));return n.length>0&&(e="\n switch (x) {".concat(n.map((function(t){return"\n case ".concat(function(t){if("bigint"!==typeof t)return hr(t);if(mt)return"".concat(hr(t),"n");return'"'.concat(hr(t),'"')}(t),":")})).join(""),"\n return false;\n }")),t.length!==n.length&&(e="if (x !== x) return false;\n".concat(e)),new Function("x","".concat(e,"\nreturn true;"))}var dr=function(t,e){return(t*e+63&-64||64)/e},pr=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.length>=e?t.subarray(0,e):Yt(new t.constructor(e),t,0)},vr=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;M(this,t),this.buffer=e,this.stride=n,this.BYTES_PER_ELEMENT=e.BYTES_PER_ELEMENT,this.ArrayType=e.constructor,this._resize(this.length=e.length/n|0)}return F(t,[{key:"set",value:function(t,e){return this}},{key:"append",value:function(t){return this.set(this.length,t)}},{key:"reserve",value:function(t){if(t>0){this.length+=t;var e=this.stride,n=this.length*e,r=this.buffer.length;n>=r&&this._resize(dr(0===r?1*n:2*n,this.BYTES_PER_ELEMENT))}return this}},{key:"flush",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length;t=dr(t*this.stride,this.BYTES_PER_ELEMENT);var e=pr(this.buffer,t);return this.clear(),e}},{key:"clear",value:function(){return this.length=0,this._resize(0),this}},{key:"_resize",value:function(t){return this.buffer=Yt(new this.ArrayType(t),this.buffer)}},{key:"byteLength",get:function(){return this.length*this.stride*this.BYTES_PER_ELEMENT|0}},{key:"reservedLength",get:function(){return this.buffer.length/this.stride}},{key:"reservedByteLength",get:function(){return this.buffer.byteLength}}]),t}();vr.prototype.offset=0;var yr=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,[{key:"last",value:function(){return this.get(this.length-1)}},{key:"get",value:function(t){return this.buffer[t]}},{key:"set",value:function(t,e){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=e,this}}]),n}(vr),gr=function(t){it(n,t);var e=lt(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array(0);return M(this,n),(t=e.call(this,r,1/8)).numValid=0,t}return F(n,[{key:"get",value:function(t){return this.buffer[t>>3]>>t%8&1}},{key:"set",value:function(t,e){var n=this.reserve(t-this.length+1).buffer,r=t>>3,i=t%8,o=n[r]>>i&1;return e?0===o&&(n[r]|=1<0&&void 0!==arguments[0]?arguments[0]:new Int32Array(1);return M(this,n),e.call(this,t,1)}return F(n,[{key:"append",value:function(t){return this.set(this.length-1,t)}},{key:"set",value:function(t,e){var n=this.length-1,r=this.reserve(t-n+1).buffer;return n0&&void 0!==arguments[0]?arguments[0]:this.length-1;return t>this.length&&this.set(t-1,0),Ue(ot(n.prototype),"flush",this).call(this,t+1)}}]),n}(yr),br=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,[{key:"set",value:function(t,e){switch(this.reserve(t-this.length+1),typeof e){case"bigint":this.buffer64[t]=e;break;case"number":this.buffer[t*this.stride]=e;break;default:this.buffer.set(e,t*this.stride)}return this}},{key:"_resize",value:function(t){var e=Ue(ot(n.prototype),"_resize",this).call(this,t),r=e.byteLength/(this.BYTES_PER_ELEMENT*this.stride);return mt&&(this.buffer64=new this.ArrayType64(e.buffer,e.byteOffset,r)),e}},{key:"ArrayType64",get:function(){return this._ArrayType64||(this._ArrayType64=this.buffer instanceof Int32Array?wt:St)}}]),n}(vr),_r=function(){function t(e){var n=e.type,r=e.nullValues;M(this,t),this.length=0,this.finished=!1,this.type=n,this.children=[],this.nullValues=r,this.stride=cr(n),this._nulls=new gr,r&&r.length>0&&(this._isValid=fr(r))}return F(t,[{key:"toVector",value:function(){return He.new(this.flush())}},{key:"append",value:function(t){return this.set(this.length,t)}},{key:"isValid",value:function(t){return this._isValid(t)}},{key:"set",value:function(t,e){return this.setValid(t,this.isValid(e))&&this.setValue(t,e),this}},{key:"setValue",value:function(t,e){this._setValue(this,t,e)}},{key:"setValid",value:function(t,e){return this.length=this._nulls.set(t,+e).length,e}},{key:"addChild",value:function(t){arguments.length>1&&void 0!==arguments[1]||"".concat(this.numChildren);throw new Error('Cannot append children to non-nested type "'.concat(this.type,'"'))}},{key:"getChildAt",value:function(t){return this.children[t]||null}},{key:"flush",value:function(){var t=[],e=this._values,n=this._offsets,r=this._typeIds,i=this.length,o=this.nullCount;r?(t[qe.TYPE]=r.flush(i),n&&(t[qe.OFFSET]=n.flush(i))):n?(e&&(t[qe.DATA]=e.flush(n.last())),t[qe.OFFSET]=n.flush(i)):e&&(t[qe.DATA]=e.flush(i)),o>0&&(t[qe.VALIDITY]=this._nulls.flush(i));var a=lr.new(this.type,0,i,o,t,this.children.map((function(t){return t.flush()})));return this.clear(),a}},{key:"finish",value:function(){return this.finished=!0,this.children.forEach((function(t){return t.finish()})),this}},{key:"clear",value:function(){return this.length=0,this._offsets&&this._offsets.clear(),this._values&&this._values.clear(),this._nulls&&this._nulls.clear(),this._typeIds&&this._typeIds.clear(),this.children.forEach((function(t){return t.clear()})),this}},{key:"ArrayType",get:function(){return this.type.ArrayType}},{key:"nullCount",get:function(){return this._nulls.numInvalid}},{key:"numChildren",get:function(){return this.children.length}},{key:"byteLength",get:function(){var t=0;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),this._typeIds&&(t+=this._typeIds.byteLength),this.children.reduce((function(t,e){return t+e.byteLength}),t)}},{key:"reservedLength",get:function(){return this._nulls.reservedLength}},{key:"reservedByteLength",get:function(){var t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((function(t,e){return t+e.reservedByteLength}),t)}},{key:"valueOffsets",get:function(){return this._offsets?this._offsets.buffer:null}},{key:"values",get:function(){return this._values?this._values.buffer:null}},{key:"nullBitmap",get:function(){return this._nulls?this._nulls.buffer:null}},{key:"typeIds",get:function(){return this._typeIds?this._typeIds.buffer:null}}],[{key:"new",value:function(t){}},{key:"throughNode",value:function(t){throw new Error('"throughNode" not available in this environment')}},{key:"throughDOM",value:function(t){throw new Error('"throughDOM" not available in this environment')}},{key:"throughIterable",value:function(t){return function(t){var e=t.queueingStrategy,n=void 0===e?"count":e,r=t.highWaterMark,i=void 0===r?"bytes"!==n?1e3:Math.pow(2,14):r,o="bytes"!==n?"length":"byteLength";return L.mark((function e(n){var r,a,s,u,c;return L.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=0,a=_r.new(t),s=A(n),e.prev=3,s.s();case 5:if((u=s.n()).done){e.next=14;break}if(c=u.value,!(a.append(c)[o]>=i)){e.next=12;break}if(e.t0=++r,!e.t0){e.next=12;break}return e.next=12,a.toVector();case 12:e.next=5;break;case 14:e.next=19;break;case 16:e.prev=16,e.t1=e.catch(3),s.e(e.t1);case 19:return e.prev=19,s.f(),e.finish(19);case 22:if(!(a.finish().length>0||0===r)){e.next=25;break}return e.next=25,a.toVector();case 25:case"end":return e.stop()}}),e,null,[[3,16,19,22]])}))}(t)}},{key:"throughAsyncIterable",value:function(t){return function(t){var e=t.queueingStrategy,n=void 0===e?"count":e,r=t.highWaterMark,i=void 0===r?"bytes"!==n?1e3:Math.pow(2,14):r,o="bytes"!==n?"length":"byteLength";return function(){var e=z(L.mark((function e(n){var r,a,s,u,c,l,h,f,d;return L.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=0,a=_r.new(t),s=!0,u=!1,e.prev=4,l=V(n);case 6:return e.next=8,U(l.next());case 8:return h=e.sent,s=h.done,e.next=12,U(h.value);case 12:if(f=e.sent,s){e.next=23;break}if(d=f,!(a.append(d)[o]>=i)){e.next=20;break}if(e.t0=++r,!e.t0){e.next=20;break}return e.next=20,a.toVector();case 20:s=!0,e.next=6;break;case 23:e.next=29;break;case 25:e.prev=25,e.t1=e.catch(4),u=!0,c=e.t1;case 29:if(e.prev=29,e.prev=30,s||null==l.return){e.next=34;break}return e.next=34,U(l.return());case 34:if(e.prev=34,!u){e.next=37;break}throw c;case 37:return e.finish(34);case 38:return e.finish(29);case 39:if(!(a.finish().length>0||0===r)){e.next=42;break}return e.next=42,a.toVector();case 42:case"end":return e.stop()}}),e,null,[[4,25,29,39],[30,,34,38]])})));return function(t){return e.apply(this,arguments)}}()}(t)}}]),t}();_r.prototype.length=1,_r.prototype.stride=1,_r.prototype.children=null,_r.prototype.finished=!1,_r.prototype.nullValues=null,_r.prototype._isValid=function(){return!0};var wr=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this,t))._values=new yr(new r.ArrayType(0),r.stride),r}return F(n,[{key:"setValue",value:function(t,e){var r=this._values;return r.reserve(t-r.length+1),Ue(ot(n.prototype),"setValue",this).call(this,t,e)}}]),n}(_r),kr=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this,t))._pendingLength=0,r._offsets=new mr,r}return F(n,[{key:"setValue",value:function(t,e){var n=this._pending||(this._pending=new Map),r=n.get(t);r&&(this._pendingLength-=r.length),this._pendingLength+=e.length,n.set(t,e)}},{key:"setValid",value:function(t,e){return!!Ue(ot(n.prototype),"setValid",this).call(this,t,e)||((this._pending||(this._pending=new Map)).set(t,void 0),!1)}},{key:"clear",value:function(){return this._pendingLength=0,this._pending=void 0,Ue(ot(n.prototype),"clear",this).call(this)}},{key:"flush",value:function(){return this._flush(),Ue(ot(n.prototype),"flush",this).call(this)}},{key:"finish",value:function(){return this._flush(),Ue(ot(n.prototype),"finish",this).call(this)}},{key:"_flush",value:function(){var t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}}]),n}(_r);var xr=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this,t))._values=new gr,r}return F(n,[{key:"setValue",value:function(t,e){this._values.set(t,+e)}}]),n}(_r),Sr=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,[{key:"setValue",value:function(t,e){}},{key:"setValid",value:function(t,e){return this.length=Math.max(t+1,this.length),e}}]),n}(_r),Tr=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(wr),Cr=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(Tr),Or=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(Tr),Er=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(wr),Ir=function(t){it(n,t);var e=lt(n);function n(t){var r,i=t.type,o=t.nullValues,a=t.dictionaryHashFunction;return M(this,n),(r=e.call(this,{type:new ur(i.dictionary,i.indices,i.id,i.isOrdered)}))._nulls=null,r._dictionaryOffset=0,r._keysToIndices=Object.create(null),r.indices=_r.new({type:r.type.indices,nullValues:o}),r.dictionary=_r.new({type:r.type.dictionary,nullValues:null}),"function"===typeof a&&(r.valueToKey=a),r}return F(n,[{key:"isValid",value:function(t){return this.indices.isValid(t)}},{key:"setValid",value:function(t,e){var n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}},{key:"setValue",value:function(t,e){var n=this._keysToIndices,r=this.valueToKey(e),i=n[r];return void 0===i&&(n[r]=i=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,i)}},{key:"flush",value:function(){var t=this.type,e=this._dictionary,n=this.dictionary.toVector(),r=this.indices.flush().clone(t);return r.dictionary=e?e.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=r.dictionary,this.clear(),r}},{key:"finish",value:function(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),Ue(ot(n.prototype),"finish",this).call(this)}},{key:"clear",value:function(){return this.indices.clear(),this.dictionary.clear(),Ue(ot(n.prototype),"clear",this).call(this)}},{key:"valueToKey",value:function(t){return"string"===typeof t?t:"".concat(t)}},{key:"values",get:function(){return this.indices.values}},{key:"nullCount",get:function(){return this.indices.nullCount}},{key:"nullBitmap",get:function(){return this.indices.nullBitmap}},{key:"byteLength",get:function(){return this.indices.byteLength+this.dictionary.byteLength}},{key:"reservedLength",get:function(){return this.indices.reservedLength+this.dictionary.reservedLength}},{key:"reservedByteLength",get:function(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}}]),n}(_r),Ar=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(wr),Dr=new Float64Array(1),Pr=new Uint32Array(Dr.buffer);function Mr(t){var e=(31744&t)>>10,n=(1023&t)/1024,r=Math.pow(-1,(32768&t)>>15);switch(e){case 31:return r*(n?NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,e-15)*(1+n)}function Br(t){if(t!==t)return 32256;Dr[0]=t;var e=(2147483648&Pr[1])>>16&65535,n=2146435072&Pr[1],r=0;return n>=1089470464?Pr[0]>0?n=31744:(n=(2080374784&n)>>16,r=(1048575&Pr[1])>>10):n<=1056964608?(r=1048576+((r=1048576+(1048575&Pr[1]))<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=512+(1048575&Pr[1])>>10),e|n|65535&r}var Fr=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(wr),Lr=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,[{key:"setValue",value:function(t,e){this._values.set(t,Br(e))}}]),n}(Fr),jr=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,[{key:"setValue",value:function(t,e){this._values.set(t,e)}}]),n}(Fr),Rr=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,[{key:"setValue",value:function(t,e){this._values.set(t,e)}}]),n}(Fr);function Ur(t,e,n){return(Ur=at()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&rt(i,n.prototype),i}).apply(null,arguments)}var Nr,zr,Vr=Symbol.for("isArrowBigNum");function Yr(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r>>=0),u+=(n>>>0)+e*Math.pow(c,32);return u}function qr(t){var e="",n=new Uint32Array(2),r=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),o=-1,a=r.length-1;do{for(n[0]=r[o=0];o0&&void 0!==arguments[0]?arguments[0]:"default";switch(t){case"number":return Gr(this);case"string":return Nr(this);case"default":return zr(this)}return Nr(this)},Object.setPrototypeOf(Wr.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(Xr.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(Hr.prototype,Object.create(Uint32Array.prototype)),Object.assign(Wr.prototype,Yr.prototype,{constructor:Wr,signed:!0,TypedArray:Int32Array,BigIntArray:wt}),Object.assign(Xr.prototype,Yr.prototype,{constructor:Xr,signed:!1,TypedArray:Uint32Array,BigIntArray:St}),Object.assign(Hr.prototype,Yr.prototype,{constructor:Hr,signed:!0,TypedArray:Uint32Array,BigIntArray:St}),mt?(zr=function(t){return 8===t.byteLength?new t.BigIntArray(t.buffer,t.byteOffset,1)[0]:qr(t)},Nr=function(t){return 8===t.byteLength?"".concat(new t.BigIntArray(t.buffer,t.byteOffset,1)[0]):qr(t)}):zr=Nr=qr;var Kr,$r=function(){function t(e,n){return M(this,t),t.new(e,n)}return F(t,null,[{key:"new",value:function(t,e){switch(e){case!0:return new Wr(t);case!1:return new Xr(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case wt:return new Wr(t)}return 16===t.byteLength?new Hr(t):new Xr(t)}},{key:"signed",value:function(t){return new Wr(t)}},{key:"unsigned",value:function(t){return new Xr(t)}},{key:"decimal",value:function(t){return new Hr(t)}}]),t}(),Qr=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,[{key:"setValue",value:function(t,e){this._values.set(t,e)}}]),n}(wr),Jr=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(Qr),Zr=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(Qr),ti=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(Qr),ei=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),t.nullValues&&(t.nullValues=t.nullValues.map(ai)),(r=e.call(this,t))._values=new br(new Int32Array(0),2),r}return F(n,[{key:"isValid",value:function(t){return Ue(ot(n.prototype),"isValid",this).call(this,ai(t))}},{key:"values64",get:function(){return this._values.buffer64}}]),n}(Qr),ni=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(Qr),ri=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(Qr),ii=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(Qr),oi=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),t.nullValues&&(t.nullValues=t.nullValues.map(ai)),(r=e.call(this,t))._values=new br(new Uint32Array(0),2),r}return F(n,[{key:"isValid",value:function(t){return Ue(ot(n.prototype),"isValid",this).call(this,ai(t))}},{key:"values64",get:function(){return this._values.buffer64}}]),n}(Qr),ai=(Kr={BigIntArray:wt},function(t){return ArrayBuffer.isView(t)&&(Kr.buffer=t.buffer,Kr.byteOffset=t.byteOffset,Kr.byteLength=t.byteLength,t=zr(Kr),Kr.buffer=null),t}),si=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(wr),ui=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(si),ci=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(si),li=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(si),hi=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(si),fi=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(wr),di=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(fi),pi=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(fi),vi=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(fi),yi=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(fi),gi=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(wr),mi=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(gi),bi=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(gi),_i=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this,t))._values=new vr(new Uint8Array(0)),r}return F(n,[{key:"setValue",value:function(t,e){return Ue(ot(n.prototype),"setValue",this).call(this,t,$t(e))}},{key:"_flushPending",value:function(t,e){var n,r,i=this._offsets,o=this._values.reserve(e).buffer,a=0,s=0,u=0,c=A(t);try{for(c.s();!(r=c.n()).done;){var l=Object(j.a)(r.value,2);a=l[0],void 0===(n=l[1])?i.set(a,0):(s=n.length,o.set(n,u),i.set(a,s),u+=s)}}catch(h){c.e(h)}finally{c.f()}}},{key:"byteLength",get:function(){var t=this._pendingLength+4*this.length;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}}]),n}(kr),wi=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this,t))._values=new vr(new Uint8Array(0)),r}return F(n,[{key:"setValue",value:function(t,e){return Ue(ot(n.prototype),"setValue",this).call(this,t,nt(e))}},{key:"_flushPending",value:function(t,e){}},{key:"byteLength",get:function(){var t=this._pendingLength+4*this.length;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}}]),n}(kr);wi.prototype._flushPending=_i.prototype._flushPending;var ki=function(){function t(){M(this,t)}return F(t,[{key:"get",value:function(t){return this._values[t]}},{key:"clear",value:function(){return this._values=null,this}},{key:"bind",value:function(t){return t instanceof He?t:(this._values=t,this)}},{key:"length",get:function(){return this._values.length}}]),t}(),xi=n(5),Si=Symbol.for("parent"),Ti=Symbol.for("rowIndex"),Ci=Symbol.for("keyToIdx"),Oi=Symbol.for("idxToVal"),Ei=Symbol.for("nodejs.util.inspect.custom"),Ii=function(){function t(e,n){M(this,t),this[Si]=e,this.size=n}return F(t,[{key:"entries",value:function(){return this[Symbol.iterator]()}},{key:"has",value:function(t){return void 0!==this.get(t)}},{key:"get",value:function(t){var e=void 0;if(null!==t&&void 0!==t){var n=this[Ci]||(this[Ci]=new Map),r=n.get(t);if(void 0!==r){var i=this[Oi]||(this[Oi]=new Array(this.size));void 0!==(e=i[r])||(i[r]=e=this.getValue(r))}else if((r=this.getIndex(t))>-1){n.set(t,r);var o=this[Oi]||(this[Oi]=new Array(this.size));void 0!==(e=o[r])||(o[r]=e=this.getValue(r))}}return e}},{key:"set",value:function(t,e){if(null!==t&&void 0!==t){var n=this[Ci]||(this[Ci]=new Map),r=n.get(t);if(void 0===r&&n.set(t,r=this.getIndex(t)),r>-1)(this[Oi]||(this[Oi]=new Array(this.size)))[r]=this.setValue(r,e)}return this}},{key:"clear",value:function(){throw new Error("Clearing ".concat(this[Symbol.toStringTag]," not supported."))}},{key:"delete",value:function(t){throw new Error("Deleting ".concat(this[Symbol.toStringTag]," values not supported."))}},{key:Symbol.iterator,value:L.mark((function t(){var e,n,r,i,o,a,s,u,c;return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=this.keys(),n=this.values(),r=this[Ci]||(this[Ci]=new Map),i=this[Oi]||(this[Oi]=new Array(this.size)),s=0;case 5:if((u=e.next()).done||(c=n.next()).done){t.next=15;break}return o=u.value,a=c.value,i[s]=a,r.has(o)||r.set(o,s),t.next=12,[o,a];case 12:++s,t.next=5;break;case 15:case"end":return t.stop()}}),t,this)}))},{key:"forEach",value:function(t,e){for(var n,r,i,o,a=this.keys(),s=this.values(),u=void 0===e?t:function(n,r,i){return t.call(e,n,r,i)},c=this[Ci]||(this[Ci]=new Map),l=this[Oi]||(this[Oi]=new Array(this.size)),h=0;!(i=a.next()).done&&!(o=s.next()).done;++h)n=i.value,r=o.value,l[h]=r,c.has(n)||c.set(n,h),u(r,n,this)}},{key:"toArray",value:function(){return Object(dn.a)(this.values())}},{key:"toJSON",value:function(){var t={};return this.forEach((function(e,n){return t[n]=e})),t}},{key:"inspect",value:function(){return this.toString()}},{key:Ei,value:function(){return this.toString()}},{key:"toString",value:function(){var t=[];return this.forEach((function(e,n){n=hr(n),e=hr(e),t.push("".concat(n,": ").concat(e))})),"{ ".concat(t.join(", ")," }")}}]),t}();Ii[Symbol.toStringTag]=function(t){var e;return Object.defineProperties(t,(e={size:{writable:!0,enumerable:!1,configurable:!1,value:0}},Object(xi.a)(e,Si,{writable:!0,enumerable:!1,configurable:!1,value:null}),Object(xi.a)(e,Ti,{writable:!0,enumerable:!1,configurable:!1,value:-1}),e)),t[Symbol.toStringTag]="Row"}(Ii.prototype);var Ai=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),ct(r=e.call(this,t,t.length),Bi(ut(r)))}return F(n,[{key:"keys",value:function(){return this[Si].getChildAt(0)[Symbol.iterator]()}},{key:"values",value:function(){return this[Si].getChildAt(1)[Symbol.iterator]()}},{key:"getKey",value:function(t){return this[Si].getChildAt(0).get(t)}},{key:"getIndex",value:function(t){return this[Si].getChildAt(0).indexOf(t)}},{key:"getValue",value:function(t){return this[Si].getChildAt(1).get(t)}},{key:"setValue",value:function(t,e){this[Si].getChildAt(1).set(t,e)}}]),n}(Ii),Di=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),ct(r=e.call(this,t,t.type.children.length),Mi(ut(r)))}return F(n,[{key:"keys",value:L.mark((function t(){var e,n,r;return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=A(this[Si].type.children),t.prev=1,e.s();case 3:if((n=e.n()).done){t.next=9;break}return r=n.value,t.next=7,r.name;case 7:t.next=3;break;case 9:t.next=14;break;case 11:t.prev=11,t.t0=t.catch(1),e.e(t.t0);case 14:return t.prev=14,e.f(),t.finish(14);case 17:case"end":return t.stop()}}),t,this,[[1,11,14,17]])}))},{key:"values",value:L.mark((function t(){var e,n,r;return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=A(this[Si].type.children),t.prev=1,e.s();case 3:if((n=e.n()).done){t.next=9;break}return r=n.value,t.next=7,this[r.name];case 7:t.next=3;break;case 9:t.next=14;break;case 11:t.prev=11,t.t0=t.catch(1),e.e(t.t0);case 14:return t.prev=14,e.f(),t.finish(14);case 17:case"end":return t.stop()}}),t,this,[[1,11,14,17]])}))},{key:"getKey",value:function(t){return this[Si].type.children[t].name}},{key:"getIndex",value:function(t){return this[Si].type.children.findIndex((function(e){return e.name===t}))}},{key:"getValue",value:function(t){return this[Si].getChildAt(t).get(this[Ti])}},{key:"setValue",value:function(t,e){return this[Si].getChildAt(t).set(this[Ti],e)}}]),n}(Ii);Object.setPrototypeOf(Ii.prototype,Map.prototype);var Pi,Mi=function(){var t={enumerable:!0,configurable:!1,get:null,set:null};return function(e){var n,r=-1,i=e[Ci]||(e[Ci]=new Map),o=function(t){return function(){return this.get(t)}},a=function(t){return function(e){return this.set(t,e)}},s=A(e.keys());try{for(s.s();!(n=s.n()).done;){var u=n.value;i.set(u,++r),t.get=o(u),t.set=a(u),e.hasOwnProperty(u)||(t.enumerable=!0,Object.defineProperty(e,u,t)),e.hasOwnProperty(r)||(t.enumerable=!1,Object.defineProperty(e,r,t))}}catch(c){s.e(c)}finally{s.f()}return t.get=t.set=null,e}}(),Bi=function(){if("undefined"===typeof Proxy)return Mi;var t=Ii.prototype.has,e=Ii.prototype.get,n=Ii.prototype.set,r=Ii.prototype.getKey,i={isExtensible:function(){return!1},deleteProperty:function(){return!1},preventExtensions:function(){return!0},ownKeys:function(t){return Object(dn.a)(t.keys()).map((function(t){return"".concat(t)}))},has:function(t,e){switch(e){case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:case Si:case Ti:case Oi:case Ci:case Ei:return!0}return"number"!==typeof e||t.has(e)||(e=t.getKey(e)),t.has(e)},get:function(n,i,o){switch(i){case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:case Si:case Ti:case Oi:case Ci:case Ei:return Reflect.get(n,i,o)}return"number"!==typeof i||t.call(o,i)||(i=r.call(o,i)),e.call(o,i)},set:function(e,i,o,a){switch(i){case Si:case Ti:case Oi:case Ci:return Reflect.set(e,i,o,a);case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:return!1}return"number"!==typeof i||t.call(a,i)||(i=r.call(a,i)),!!t.call(a,i)&&!!n.call(a,i,o)}};return function(t){return new Proxy(t,i)}}();function Fi(t,e,n){var r=t.length,i=e>-1?e:r+e%r;return n?n(t,i):i}function Li(t,e,n,r){var i=t.length,o=void 0===i?0:i,a="number"!==typeof e?0:e,s="number"!==typeof n?o:n;return a<0&&(a=(a%o+o)%o),s<0&&(s=(s%o+o)%o),so&&(s=o),r?r(t,a,s):[a,s]}var ji=mt?gt(0):0,Ri=function(t){return t!==t};function Ui(t){var e=typeof t;if("object"!==e||null===t)return Ri(t)?Ri:"bigint"!==e?function(e){return e===t}:function(e){return ji+e===t};if(t instanceof Date){var n=t.valueOf();return function(t){return t instanceof Date&&t.valueOf()===n}}return ArrayBuffer.isView(t)?function(e){return!!e&&Ce(t,e)}:t instanceof Map?function(t){var e=-1,n=[];return t.forEach((function(t){return n[++e]=Ui(t)})),Ni(n)}(t):Array.isArray(t)?function(t){for(var e=[],n=-1,r=t.length;++n1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Yi(i);return M(this,n),(r=e.call(this))._nullCount=-1,r._type=t,r._chunks=i,r._chunkOffsets=o,r._length=o[o.length-1],r._numChildren=(r._type.children||[]).length,r}return F(n,[{key:Symbol.iterator,value:L.mark((function t(){var e,n,r;return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=A(this._chunks),t.prev=1,e.s();case 3:if((n=e.n()).done){t.next=8;break}return r=n.value,t.delegateYield(r,"t0",6);case 6:t.next=3;break;case 8:t.next=13;break;case 10:t.prev=10,t.t1=t.catch(1),e.e(t.t1);case 13:return t.prev=13,e.f(),t.finish(13);case 16:case"end":return t.stop()}}),t,this,[[1,10,13,16]])}))},{key:"clone",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._chunks;return new n(this._type,t)}},{key:"concat",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r=this._numChildren)return null;var e,r,i,o=this._children||(this._children=[]);return(e=o[t])?e:(r=(this._type.children||[])[t])&&(i=this._chunks.map((function(e){return e.getChildAt(t)})).filter((function(t){return null!=t}))).length>0?o[t]=new n(r.type,i):null}},{key:"search",value:function(t,e){var n=t,r=this._chunkOffsets,i=r.length-1;if(n<0)return null;if(n>=r[i])return null;if(i<=1)return e?e(this,0,n):[0,n];var o=0,a=0,s=0;do{if(o+1===i)return e?e(this,o,n-a):[o,n-a];n>=r[s=o+(i-o)/2|0]?o=s:i=s}while(n=(a=r[o]));return null}},{key:"isValid",value:function(t){return!!this.search(t,this.isValidInternal)}},{key:"get",value:function(t){return this.search(t,this.getInternal)}},{key:"set",value:function(t,e){this.search(t,(function(t,n,r){return t.chunks[n].set(r,e)}))}},{key:"indexOf",value:function(t,e){var n=this;return e&&"number"===typeof e?this.search(e,(function(e,r,i){return n.indexOfInternal(e,r,i,t)})):this.indexOfInternal(this,0,Math.max(0,e||0),t)}},{key:"toArray",value:function(){var t=this.chunks,e=t.length,n=this._type.ArrayType;if(e<=0)return new n(0);if(e<=1)return t[0].toArray();for(var r=0,i=new Array(e),o=-1;++o=n)break;if(!(e>=l+c))if(l>=e&&l+c<=n)r.push(u);else{var h=Math.max(0,e-l),f=Math.min(n-l,c);r.push(u.slice(h,f))}}return t.clone(r)}},{key:"type",get:function(){return this._type}},{key:"length",get:function(){return this._length}},{key:"chunks",get:function(){return this._chunks}},{key:"typeId",get:function(){return this._type.typeId}},{key:"VectorName",get:function(){return"Chunked<".concat(this._type,">")}},{key:"data",get:function(){return this._chunks[0]?this._chunks[0].data:null}},{key:"ArrayType",get:function(){return this._type.ArrayType}},{key:"numChildren",get:function(){return this._numChildren}},{key:"stride",get:function(){return this._chunks[0]?this._chunks[0].stride:1}},{key:"byteLength",get:function(){return this._chunks.reduce((function(t,e){return t+e.byteLength}),0)}},{key:"nullCount",get:function(){var t=this._nullCount;return t<0&&(this._nullCount=t=this._chunks.reduce((function(t,e){return t+e.nullCount}),0)),t}},{key:"indices",get:function(){if(In.isDictionary(this._type)){if(!this._indices){var t=this._chunks;this._indices=1===t.length?t[0].indices:n.concat.apply(n,Object(dn.a)(t.map((function(t){return t.indices}))))}return this._indices}return null}},{key:"dictionary",get:function(){return In.isDictionary(this._type)?this._chunks[this._chunks.length-1].data.dictionary:null}}],[{key:"flatten",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2?arguments[2]:void 0;return M(this,n),i=Vi.flatten.apply(Vi,Object(dn.a)(i)),(r=e.call(this,t.type,i,o))._field=t,1!==i.length||ut(r)instanceof Gi?r:ct(r,new Gi(t,i[0],r._chunkOffsets))}return F(n,[{key:"clone",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._chunks;return new n(this._field,t)}},{key:"getChildAt",value:function(t){if(t<0||t>=this.numChildren)return null;var e,r,i,o=this._children||(this._children=[]);return(e=o[t])?e:(r=(this.type.children||[])[t])&&(i=this._chunks.map((function(e){return e.getChildAt(t)})).filter((function(t){return null!=t}))).length>0?o[t]=new n(r,i):null}},{key:"field",get:function(){return this._field}},{key:"name",get:function(){return this._field.name}},{key:"nullable",get:function(){return this._field.nullable}},{key:"metadata",get:function(){return this._field.metadata}}],[{key:"new",value:function(t,e){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o0}))&&(t=t.clone({nullable:!0}));return new n(t,a)}}]),n}(Vi),Gi=function(t){it(n,t);var e=lt(n);function n(t,r,i){var o;return M(this,n),(o=e.call(this,t,[r],i))._chunk=r,o}return F(n,[{key:"search",value:function(t,e){return e?e(this,0,t):[0,t]}},{key:"isValid",value:function(t){return this._chunk.isValid(t)}},{key:"get",value:function(t){return this._chunk.get(t)}},{key:"set",value:function(t,e){this._chunk.set(t,e)}},{key:"indexOf",value:function(t,e){return this._chunk.indexOf(t,e)}}]),n}(Hi),qi=Array.isArray,Ki=function(t,e){return to(t,e,[],0)},$i=function(t){var e=no(t,[[],[]]),n=Object(j.a)(e,2),r=n[0];return n[1].map((function(t,e){return t instanceof Hi?Hi.new(t.field.clone(r[e]),t):t instanceof He?Hi.new(r[e],t):Hi.new(r[e],[])}))},Qi=function(t){return no(t,[[],[]])},Ji=function(t,e){return function t(e,n,r,i){var o,a=i,s=-1,u=n.length;for(;++s0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;M(this,t),this.fields=e||[],this.metadata=n||new Map,r||(r=ao(e)),this.dictionaries=r}return F(t,[{key:"toString",value:function(){return"Schema<{ ".concat(this.fields.map((function(t,e){return"".concat(e,": ").concat(t)})).join(", ")," }>")}},{key:"compareTo",value:function(t){return En.compareSchemas(this,t)}},{key:"select",value:function(){for(var e=arguments.length,n=new Array(e),r=0;r2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;M(this,t),this.name=e,this.type=n,this.nullable=r,this.metadata=i||new Map}return F(t,[{key:"toString",value:function(){return"".concat(this.name,": ").concat(this.type)}},{key:"compareTo",value:function(t){return En.compareField(this,t)}},{key:"clone",value:function(){for(var e,n,r,i,o,a,s,u,c,l,h,f=arguments.length,d=new Array(f),p=0;p1&&void 0!==arguments[1]?arguments[1]:new Map,n=-1,r=t.length;++n0&&ao(o.children,e)}return e}ro.prototype.fields=null,ro.prototype.metadata=null,ro.prototype.dictionaries=null,io.prototype.type=null,io.prototype.name=null,io.prototype.nullable=null,io.prototype.metadata=null;var so=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this,t))._run=new ki,r._offsets=new mr,r}return F(n,[{key:"addChild",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0";if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new tr(new io(e,t.type,!0)),this.numChildren-1}},{key:"clear",value:function(){return this._run.clear(),Ue(ot(n.prototype),"clear",this).call(this)}},{key:"_flushPending",value:function(t){var e,n,r=this._run,i=this._offsets,o=this._setValue,a=0,s=A(t);try{for(s.s();!(n=s.n()).done;){var u=Object(j.a)(n.value,2);a=u[0],void 0===(e=u[1])?i.set(a,0):(i.set(a,e.length),o(this,a,r.bind(e)))}}catch(c){s.e(c)}finally{s.f()}}}]),n}(kr),uo=function(t){it(n,t);var e=lt(n);function n(){var t;return M(this,n),(t=e.apply(this,arguments))._run=new ki,t}return F(n,[{key:"setValue",value:function(t,e){Ue(ot(n.prototype),"setValue",this).call(this,t,this._run.bind(e))}},{key:"addChild",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0";if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");var n=this.children.push(t);return this.type=new ir(this.type.listSize,new io(e,t.type,!0)),n}},{key:"clear",value:function(){return this._run.clear(),Ue(ot(n.prototype),"clear",this).call(this)}}]),n}(_r),co=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,[{key:"set",value:function(t,e){return Ue(ot(n.prototype),"set",this).call(this,t,e)}},{key:"setValue",value:function(t,e){e=e instanceof Map?e:new Map(Object.entries(e));var n=this._pending||(this._pending=new Map),r=n.get(t);r&&(this._pendingLength-=r.size),this._pendingLength+=e.size,n.set(t,e)}},{key:"addChild",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"".concat(this.numChildren);if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new or(new io(e,t.type,!0),this.type.keysSorted),this.numChildren-1}},{key:"_flushPending",value:function(t){var e=this,n=this._offsets,r=this._setValue;t.forEach((function(t,i){void 0===t?n.set(i,0):(n.set(i,t.size),r(e,i,t))}))}}]),n}(kr),lo=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,[{key:"addChild",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"".concat(this.numChildren),n=this.children.push(t);return this.type=new er([].concat(Object(dn.a)(this.type.children),[new io(e,t.type,!0)])),n}}]),n}(_r),ho=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this,t))._typeIds=new yr(new Int8Array(0),1),"function"===typeof t.valueToChildTypeId&&(r._valueToChildTypeId=t.valueToChildTypeId),r}return F(n,[{key:"append",value:function(t,e){return this.set(this.length,t,e)}},{key:"set",value:function(t,e,n){return void 0===n&&(n=this._valueToChildTypeId(this,e,t)),this.setValid(t,this.isValid(e))&&this.setValue(t,e,n),this}},{key:"setValue",value:function(t,e,r){this._typeIds.set(t,r),Ue(ot(n.prototype),"setValue",this).call(this,t,e)}},{key:"addChild",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"".concat(this.children.length),n=this.children.push(t),r=this.type,i=r.children,o=r.mode,a=r.typeIds,s=[].concat(Object(dn.a)(i),[new io(e,t.type)]);return this.type=new nr(o,[].concat(Object(dn.a)(a),[n]),s),n}},{key:"_valueToChildTypeId",value:function(t,e,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},{key:"typeIdToChildIndex",get:function(){return this.type.typeIdToChildIndex}}]),n}(_r),fo=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(ho),po=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this,t))._offsets=new yr(new Int32Array(0)),r}return F(n,[{key:"setValue",value:function(t,e,r){var i=this.type.typeIdToChildIndex[r];return this._offsets.set(t,this.getChildAt(i).length),Ue(ot(n.prototype),"setValue",this).call(this,t,e,r)}}]),n}(ho),vo=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(pn),yo=function(t,e,n){t[e]=n%4294967296|0,t[e+1]=n/4294967296|0},go=function(t,e,n,r){var i=e[n],o=e[n+1];null!=i&&null!=o&&t.set(r.subarray(0,o-i),i)},mo=function(t,e,n){!function(t,e,n){t[e]=n/864e5|0}(t.values,e,n.valueOf())},bo=function(t,e,n){var r=t.values;yo(r,2*e,n.valueOf())},_o=function(t,e,n){var r=t.stride;t.values[r*e]=n},wo=function(t,e,n){var r=t.stride;t.values[r*e]=Br(n)},ko=function(t,e,n){switch(typeof n){case"bigint":t.values64[e]=n;break;case"number":t.values[e*t.stride]=n;break;default:var r=n,i=t.stride,o=Xt(t.ArrayType,r);t.values.set(o.subarray(0,i),i*e)}},xo=function(t,e,n){var r=t.values;return yo(r,2*e,n/1e3)},So=function(t,e,n){var r=t.values;return yo(r,2*e,n)},To=function(t,e,n){return function(t,e,n){t[e]=1e3*n%4294967296|0,t[e+1]=1e3*n/4294967296|0}(t.values,2*e,n)},Co=function(t,e,n){return function(t,e,n){t[e]=1e6*n%4294967296|0,t[e+1]=1e6*n/4294967296|0}(t.values,2*e,n)},Oo=function(t,e,n){t.values[t.stride*e]=n},Eo=function(t,e,n){t.values[t.stride*e]=n},Io=function(t,e,n){t.values.set(n.subarray(0,2),2*e)},Ao=function(t,e,n){t.values.set(n.subarray(0,2),2*e)},Do=function(t,e,n){var r=t.typeIdToChildIndex[t.typeIds[e]],i=t.getChildAt(r);i&&i.set(t.valueOffsets[e],n)},Po=function(t,e,n){var r=t.typeIdToChildIndex[t.typeIds[e]],i=t.getChildAt(r);i&&i.set(e,n)},Mo=function(t,e,n){t.values.set(n.subarray(0,2),2*e)},Bo=function(t,e,n){t.values[e]=12*n[0]+n[1]%12};vo.prototype.visitBool=function(t,e,n){var r=t.offset,i=t.values,o=r+e;n?i[o>>3]|=1<>3]&=~(1<0){var i=e.children||[],o={nullValues:e.nullValues},a=Array.isArray(i)?function(t,e){return i[e]||o}:function(t){var e=t.name;return i[e]||o};n.children.forEach((function(e,n){var i=e.type,o=a(e,n);r.children.push(t(Object(Re.a)(Object(Re.a)({},o),{},{type:i})))}))}return r},Object.keys(Ge).map((function(t){return Ge[t]})).filter((function(t){return"number"===typeof t&&t!==Ge.NONE})).forEach((function(t){jo.visit(t).prototype._setValue=Lo.getVisitFn(t)})),wi.prototype._setValue=Lo.visitBinary,function(t){!function(e){!function(e){!function(e){var n=function(){function e(){M(this,e),this.bb=null,this.bb_pos=0}return F(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"version",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ne.apache.arrow.flatbuf.MetadataVersion.V1}},{key:"schema",value:function(t){var e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ne.apache.arrow.flatbuf.Schema).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}},{key:"dictionaries",value:function(e,n){var r=this.bb.__offset(this.bb_pos,8);return r?(n||new t.apache.arrow.flatbuf.Block).__init(this.bb.__vector(this.bb_pos+r)+24*e,this.bb):null}},{key:"dictionariesLength",value:function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"recordBatches",value:function(e,n){var r=this.bb.__offset(this.bb_pos,10);return r?(n||new t.apache.arrow.flatbuf.Block).__init(this.bb.__vector(this.bb_pos+r)+24*e,this.bb):null}},{key:"recordBatchesLength",value:function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}}],[{key:"getRootAsFooter",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startFooter",value:function(t){t.startObject(4)}},{key:"addVersion",value:function(t,e){t.addFieldInt16(0,e,Ne.apache.arrow.flatbuf.MetadataVersion.V1)}},{key:"addSchema",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"addDictionaries",value:function(t,e){t.addFieldOffset(2,e,0)}},{key:"startDictionariesVector",value:function(t,e){t.startVector(24,e,8)}},{key:"addRecordBatches",value:function(t,e){t.addFieldOffset(3,e,0)}},{key:"startRecordBatchesVector",value:function(t,e){t.startVector(24,e,8)}},{key:"endFooter",value:function(t){return t.endObject()}},{key:"finishFooterBuffer",value:function(t,e){t.finish(e)}},{key:"createFooter",value:function(t,n,r,i,o){return e.startFooter(t),e.addVersion(t,n),e.addSchema(t,r),e.addDictionaries(t,i),e.addRecordBatches(t,o),e.endFooter(t)}}]),e}();e.Footer=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Fo||(Fo={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){M(this,t),this.bb=null,this.bb_pos=0}return F(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"offset",value:function(){return this.bb.readInt64(this.bb_pos)}},{key:"metaDataLength",value:function(){return this.bb.readInt32(this.bb_pos+8)}},{key:"bodyLength",value:function(){return this.bb.readInt64(this.bb_pos+16)}}],[{key:"createBlock",value:function(t,e,n,r){return t.prep(8,24),t.writeInt64(r),t.pad(4),t.writeInt32(n),t.writeInt64(e),t.offset()}}]),t}();t.Block=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Fo||(Fo={}));var Ro=W.Long,Uo=W.Builder,No=W.ByteBuffer,zo=Fo.apache.arrow.flatbuf.Block,Vo=Fo.apache.arrow.flatbuf.Footer,Yo=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:en.V4,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;M(this,t),this.schema=e,this.version=n,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}return F(t,[{key:"recordBatches",value:L.mark((function t(){var e,n,r;return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=-1,r=this.numRecordBatches;case 1:if(!(++n=0&&t=0&&t=0&&t=0&&t0)return Ue(ot(n.prototype),"write",this).call(this,t)}},{key:"toString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t?et(this.toUint8Array(!0)):this.toUint8Array(!1).then(et)}},{key:"toUint8Array",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?Wt(this._values)[0]:P(L.mark((function e(){var n,r,i,o,a,s,u,c,l;return L.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=[],r=0,i=!0,o=!1,e.prev=3,s=V(t);case 5:return e.next=7,s.next();case 7:return u=e.sent,i=u.done,e.next=11,u.value;case 11:if(c=e.sent,i){e.next=19;break}l=c,n.push(l),r+=l.byteLength;case 16:i=!0,e.next=5;break;case 19:e.next=25;break;case 21:e.prev=21,e.t0=e.catch(3),o=!0,a=e.t0;case 25:if(e.prev=25,e.prev=26,i||null==s.return){e.next=30;break}return e.next=30,s.return();case 30:if(e.prev=30,!o){e.next=33;break}throw a;case 33:return e.finish(30);case 34:return e.finish(25);case 35:return e.abrupt("return",Wt(n,r)[0]);case 36:case"end":return e.stop()}}),e,null,[[3,21,25,35],[26,,30,34]])})))()}}]),n}(pt),Go=function(){function t(e){M(this,t),e&&(this.source=new Ko(Ee.fromIterable(e)))}return F(t,[{key:Symbol.iterator,value:function(){return this}},{key:"next",value:function(t){return this.source.next(t)}},{key:"throw",value:function(t){return this.source.throw(t)}},{key:"return",value:function(t){return this.source.return(t)}},{key:"peek",value:function(t){return this.source.peek(t)}},{key:"read",value:function(t){return this.source.read(t)}}]),t}(),qo=function(){function t(e){M(this,t),e instanceof t?this.source=e.source:e instanceof Ho?this.source=new $o(Ee.fromAsyncIterable(e)):Ut(e)?this.source=new $o(Ee.fromNodeStream(e)):jt(e)?this.source=new $o(Ee.fromDOMStream(e)):Ft(e)?this.source=new $o(Ee.fromDOMStream(e.body)):At(e)?this.source=new $o(Ee.fromIterable(e)):(It(e)||Dt(e))&&(this.source=new $o(Ee.fromAsyncIterable(e)))}return F(t,[{key:Symbol.asyncIterator,value:function(){return this}},{key:"next",value:function(t){return this.source.next(t)}},{key:"throw",value:function(t){return this.source.throw(t)}},{key:"return",value:function(t){return this.source.return(t)}},{key:"cancel",value:function(t){return this.source.cancel(t)}},{key:"peek",value:function(t){return this.source.peek(t)}},{key:"read",value:function(t){return this.source.read(t)}},{key:"closed",get:function(){return this.source.closed}}]),t}(),Ko=function(){function t(e){M(this,t),this.source=e}return F(t,[{key:"cancel",value:function(t){this.return(t)}},{key:"peek",value:function(t){return this.next(t,"peek").value}},{key:"read",value:function(t){return this.next(t,"read").value}},{key:"next",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"read";return this.source.next({cmd:e,size:t})}},{key:"throw",value:function(t){return Object.create(this.source.throw&&this.source.throw(t)||ht)}},{key:"return",value:function(t){return Object.create(this.source.return&&this.source.return(t)||ht)}}]),t}(),$o=function(){function t(e){var n=this;M(this,t),this.source=e,this._closedPromise=new Promise((function(t){return n._closedPromiseResolve=t}))}return F(t,[{key:"cancel",value:function(){var t=P(L.mark((function t(e){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.return(e);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"read",value:function(){var t=P(L.mark((function t(e){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.next(e,"read");case 2:return t.abrupt("return",t.sent.value);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"peek",value:function(){var t=P(L.mark((function t(e){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.next(e,"peek");case 2:return t.abrupt("return",t.sent.value);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"next",value:function(){var t=P(L.mark((function t(e){var n,r=arguments;return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:"read",t.next=3,this.source.next({cmd:n,size:e});case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"throw",value:function(){var t=P(L.mark((function t(e){var n;return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t1=this.source.throw,!t.t1){t.next=5;break}return t.next=4,this.source.throw(e);case 4:t.t1=t.sent;case 5:if(t.t0=t.t1,t.t0){t.next=8;break}t.t0=ht;case 8:return n=t.t0,this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,t.abrupt("return",Object.create(n));case 12:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"return",value:function(){var t=P(L.mark((function t(e){var n;return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t1=this.source.return,!t.t1){t.next=5;break}return t.next=4,this.source.return(e);case 4:t.t1=t.sent;case 5:if(t.t0=t.t1,t.t0){t.next=8;break}t.t0=ht;case 8:return n=t.t0,this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,t.abrupt("return",Object.create(n));case 12:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"closed",get:function(){return this._closedPromise}}]),t}(),Qo=function(t){it(n,t);var e=lt(n);function n(t,r){var i;return M(this,n),(i=e.call(this)).position=0,i.buffer=$t(t),i.size="undefined"===typeof r?i.buffer.byteLength:r,i}return F(n,[{key:"readInt32",value:function(t){var e=this.readAt(t,4),n=e.buffer,r=e.byteOffset;return new DataView(n,r).getInt32(0,!0)}},{key:"seek",value:function(t){return this.position=Math.min(t,this.size),t>>16,65535&this.buffer[1],this.buffer[0]>>>16,65535&this.buffer[0]]),n=new Uint32Array([t.buffer[1]>>>16,65535&t.buffer[1],t.buffer[0]>>>16,65535&t.buffer[0]]),r=e[3]*n[3];this.buffer[0]=65535&r;var i=r>>>16;return i+=r=e[2]*n[3],i+=r=e[3]*n[2]>>>0,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}},{key:"_plus",value:function(t){var e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e>>0&&++this.buffer[1],this.buffer[0]=e}},{key:"lessThan",value:function(t){return this.buffer[1]1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(2);return n.fromString("string"===typeof t?t:t.toString(),e)}},{key:"fromNumber",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(2);return n.fromString(t.toString(),e)}},{key:"fromString",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(2),r=t.length,i=new n(e),o=0;o1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(2);return n.fromString("string"===typeof t?t:t.toString(),e)}},{key:"fromNumber",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(2);return n.fromString(t.toString(),e)}},{key:"fromString",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(2),r=t.startsWith("-"),i=t.length,o=new n(e),a=r?1:0;a>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]>>0&&++e[1],e[1]>>0&&++e[2],e[2]>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}},{key:"hex",value:function(){return"".concat(Zo(this.buffer[3])," ").concat(Zo(this.buffer[2])," ").concat(Zo(this.buffer[1])," ").concat(Zo(this.buffer[0]))}}],[{key:"multiply",value:function(e,n){return new t(new Uint32Array(e.buffer)).times(n)}},{key:"add",value:function(e,n){return new t(new Uint32Array(e.buffer)).plus(n)}},{key:"from",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(4);return t.fromString("string"===typeof e?e:e.toString(),n)}},{key:"fromNumber",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(4);return t.fromString(e.toString(),n)}},{key:"fromString",value:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(4),r=e.startsWith("-"),i=e.length,o=new t(n),a=r?1:0;a1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length;return lr.Null(t,0,n)}},{key:"visitBool",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Bool(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitInt",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Int(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitFloat",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Float(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitUtf8",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Utf8(t,0,n,r,this.readNullBitmap(t,r),this.readOffsets(t),this.readData(t))}},{key:"visitBinary",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Binary(t,0,n,r,this.readNullBitmap(t,r),this.readOffsets(t),this.readData(t))}},{key:"visitFixedSizeBinary",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.FixedSizeBinary(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitDate",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Date(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitTimestamp",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Timestamp(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitTime",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Time(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitDecimal",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Decimal(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitList",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.List(t,0,n,r,this.readNullBitmap(t,r),this.readOffsets(t),this.visit(t.children[0]))}},{key:"visitStruct",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Struct(t,0,n,r,this.readNullBitmap(t,r),this.visitMany(t.children))}},{key:"visitUnion",value:function(t){return t.mode===Je.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}},{key:"visitDenseUnion",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Union(t,0,n,r,this.readNullBitmap(t,r),this.readTypeIds(t),this.readOffsets(t),this.visitMany(t.children))}},{key:"visitSparseUnion",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Union(t,0,n,r,this.readNullBitmap(t,r),this.readTypeIds(t),this.visitMany(t.children))}},{key:"visitDictionary",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Dictionary(t,0,n,r,this.readNullBitmap(t,r),this.readData(t.indices),this.readDictionary(t))}},{key:"visitInterval",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Interval(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitFixedSizeList",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.FixedSizeList(t,0,n,r,this.readNullBitmap(t,r),this.visit(t.children[0]))}},{key:"visitMap",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return lr.Map(t,0,n,r,this.readNullBitmap(t,r),this.readOffsets(t),this.visit(t.children[0]))}},{key:"nextFieldNode",value:function(){return this.nodes[++this.nodesIndex]}},{key:"nextBufferRange",value:function(){return this.buffers[++this.buffersIndex]}},{key:"readNullBitmap",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.nextBufferRange();return e>0&&this.readData(t,n)||new Uint8Array(0)}},{key:"readOffsets",value:function(t,e){return this.readData(t,e)}},{key:"readTypeIds",value:function(t,e){return this.readData(t,e)}},{key:"readData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextBufferRange(),n=e.length,r=e.offset;return this.bytes.subarray(r,r+n)}},{key:"readDictionary",value:function(t){return this.dictionaries.get(t.id)}}]),n}(pn),aa=function(t){it(n,t);var e=lt(n);function n(t,r,i,o){var a;return M(this,n),(a=e.call(this,new Uint8Array(0),r,i,o)).sources=t,a}return F(n,[{key:"readNullBitmap",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.nextBufferRange(),r=n.offset;return e<=0?new Uint8Array(0):un(this.sources[r])}},{key:"readOffsets",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextBufferRange(),n=e.offset;return Xt(Uint8Array,Xt(Int32Array,this.sources[n]))}},{key:"readTypeIds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextBufferRange(),n=e.offset;return Xt(Uint8Array,Xt(t.ArrayType,this.sources[n]))}},{key:"readData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextBufferRange(),n=e.offset,r=this.sources;return In.isTimestamp(t)||(In.isInt(t)||In.isTime(t))&&64===t.bitWidth||In.isDate(t)&&t.unit===Ke.MILLISECOND?Xt(Uint8Array,ra.convertArray(r[n])):In.isDecimal(t)?Xt(Uint8Array,ia.convertArray(r[n])):In.isBinary(t)||In.isFixedSizeBinary(t)?sa(r[n]):In.isBool(t)?un(r[n]):In.isUtf8(t)?nt(r[n].join("")):Xt(Uint8Array,Xt(t.ArrayType,r[n].map((function(t){return+t}))))}}]),n}(oa);function sa(t){for(var e=t.join(""),n=new Uint8Array(e.length/2),r=0;r>1]=parseInt(e.substr(r,2),16);return n}var ua=W.Long,ca=Ne.apache.arrow.flatbuf.Null,la=Ne.apache.arrow.flatbuf.Int,ha=Ne.apache.arrow.flatbuf.FloatingPoint,fa=Ne.apache.arrow.flatbuf.Binary,da=Ne.apache.arrow.flatbuf.Bool,pa=Ne.apache.arrow.flatbuf.Utf8,va=Ne.apache.arrow.flatbuf.Decimal,ya=Ne.apache.arrow.flatbuf.Date,ga=Ne.apache.arrow.flatbuf.Time,ma=Ne.apache.arrow.flatbuf.Timestamp,ba=Ne.apache.arrow.flatbuf.Interval,_a=Ne.apache.arrow.flatbuf.List,wa=Ne.apache.arrow.flatbuf.Struct_,ka=Ne.apache.arrow.flatbuf.Union,xa=Ne.apache.arrow.flatbuf.DictionaryEncoding,Sa=Ne.apache.arrow.flatbuf.FixedSizeBinary,Ta=Ne.apache.arrow.flatbuf.FixedSizeList,Ca=Ne.apache.arrow.flatbuf.Map,Oa=new(function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,[{key:"visit",value:function(t,e){return null==t||null==e?void 0:Ue(ot(n.prototype),"visit",this).call(this,t,e)}},{key:"visitNull",value:function(t,e){return ca.startNull(e),ca.endNull(e)}},{key:"visitInt",value:function(t,e){return la.startInt(e),la.addBitWidth(e,t.bitWidth),la.addIsSigned(e,t.isSigned),la.endInt(e)}},{key:"visitFloat",value:function(t,e){return ha.startFloatingPoint(e),ha.addPrecision(e,t.precision),ha.endFloatingPoint(e)}},{key:"visitBinary",value:function(t,e){return fa.startBinary(e),fa.endBinary(e)}},{key:"visitBool",value:function(t,e){return da.startBool(e),da.endBool(e)}},{key:"visitUtf8",value:function(t,e){return pa.startUtf8(e),pa.endUtf8(e)}},{key:"visitDecimal",value:function(t,e){return va.startDecimal(e),va.addScale(e,t.scale),va.addPrecision(e,t.precision),va.endDecimal(e)}},{key:"visitDate",value:function(t,e){return ya.startDate(e),ya.addUnit(e,t.unit),ya.endDate(e)}},{key:"visitTime",value:function(t,e){return ga.startTime(e),ga.addUnit(e,t.unit),ga.addBitWidth(e,t.bitWidth),ga.endTime(e)}},{key:"visitTimestamp",value:function(t,e){var n=t.timezone&&e.createString(t.timezone)||void 0;return ma.startTimestamp(e),ma.addUnit(e,t.unit),void 0!==n&&ma.addTimezone(e,n),ma.endTimestamp(e)}},{key:"visitInterval",value:function(t,e){return ba.startInterval(e),ba.addUnit(e,t.unit),ba.endInterval(e)}},{key:"visitList",value:function(t,e){return _a.startList(e),_a.endList(e)}},{key:"visitStruct",value:function(t,e){return wa.startStruct_(e),wa.endStruct_(e)}},{key:"visitUnion",value:function(t,e){ka.startTypeIdsVector(e,t.typeIds.length);var n=ka.createTypeIdsVector(e,t.typeIds);return ka.startUnion(e),ka.addMode(e,t.mode),ka.addTypeIds(e,n),ka.endUnion(e)}},{key:"visitDictionary",value:function(t,e){var n=this.visit(t.indices,e);return xa.startDictionaryEncoding(e),xa.addId(e,new ua(t.id,0)),xa.addIsOrdered(e,t.isOrdered),void 0!==n&&xa.addIndexType(e,n),xa.endDictionaryEncoding(e)}},{key:"visitFixedSizeBinary",value:function(t,e){return Sa.startFixedSizeBinary(e),Sa.addByteWidth(e,t.byteWidth),Sa.endFixedSizeBinary(e)}},{key:"visitFixedSizeList",value:function(t,e){return Ta.startFixedSizeList(e),Ta.addListSize(e,t.listSize),Ta.endFixedSizeList(e)}},{key:"visitMap",value:function(t,e){return Ca.startMap(e),Ca.addKeysSorted(e,t.keysSorted),Ca.endMap(e)}}]),n}(pn));function Ea(t){return new qa(t.count,function t(e){return(e||[]).reduce((function(e,n){return[].concat(Object(dn.a)(e),[new Qa(n.count,(r=n.VALIDITY,(r||[]).reduce((function(t,e){return t+ +(0===e)}),0)))],Object(dn.a)(t(n.children)));var r}),[])}(t.columns),function t(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=-1,i=(e||[]).length;++r1&&void 0!==arguments[1]?arguments[1]:0;if(e instanceof ro)return new t(0,en.V4,tn.Schema,e);if(e instanceof qa)return new t(n,en.V4,tn.RecordBatch,e);if(e instanceof Ka)return new t(n,en.V4,tn.DictionaryBatch,e);throw new Error("Unrecognized Message header: ".concat(e))}}]),t}(),qa=function(){function t(e,n,r){M(this,t),this._nodes=n,this._buffers=r,this._length="number"===typeof e?e:e.low}return F(t,[{key:"nodes",get:function(){return this._nodes}},{key:"length",get:function(){return this._length}},{key:"buffers",get:function(){return this._buffers}}]),t}(),Ka=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];M(this,t),this._data=e,this._isDelta=r,this._id="number"===typeof n?n:n.low}return F(t,[{key:"id",get:function(){return this._id}},{key:"data",get:function(){return this._data}},{key:"isDelta",get:function(){return this._isDelta}},{key:"length",get:function(){return this.data.length}},{key:"nodes",get:function(){return this.data.nodes}},{key:"buffers",get:function(){return this.data.buffers}}]),t}(),$a=function t(e,n){M(this,t),this.offset="number"===typeof e?e:e.low,this.length="number"===typeof n?n:n.low},Qa=function t(e,n){M(this,t),this.length="number"===typeof e?e:e.low,this.nullCount="number"===typeof n?n:n.low};function Ja(t){for(var e,n=[],r=-1,i=-1,o=t.nodesLength();++r0?Ra.createCustomMetadataVector(t,Object(dn.a)(e.metadata).map((function(e){var n=Object(j.a)(e,2),r=n[0],i=n[1],o=t.createString("".concat(r)),a=t.createString("".concat(i));return Va.startKeyValue(t),Va.addKey(t,o),Va.addValue(t,a),Va.endKeyValue(t)}))):-1;e.name&&(n=t.createString(e.name));Ra.startField(t),Ra.addType(t,r),Ra.addTypeType(t,a),Ra.addChildren(t,u),Ra.addNullable(t,!!e.nullable),-1!==n&&Ra.addName(t,n);-1!==i&&Ra.addDictionary(t,i);-1!==c&&Ra.addCustomMetadata(t,c);return Ra.endField(t)},io.decode=function(t,e){var n,r,i,o,a,s;e&&(s=t.dictionary())?e.has(n=s.id().low)?(o=(o=s.indexType())?rs(o):new Bn,a=new ur(e.get(n),o,n,s.isOrdered()),r=new io(t.name(),a,t.nullable(),ns(t))):(o=(o=s.indexType())?rs(o):new Bn,e.set(n,i=is(t,es(t,e))),a=new ur(i,o,n,s.isOrdered()),r=new io(t.name(),a,t.nullable(),ns(t))):(i=is(t,es(t,e)),r=new io(t.name(),i,t.nullable(),ns(t)));return r||null},io.fromJSON=function(t,e){var n,r,i,o,a,s;return e&&(o=t.dictionary)?e.has(n=o.id)?(r=(r=o.indexType)?Pa(r):new Bn,s=new ur(e.get(n),r,n,o.isOrdered),i=new io(t.name,s,t.nullable,Da(t.customMetadata))):(r=(r=o.indexType)?Pa(r):new Bn,e.set(n,a=Ma(t,Aa(t,e))),s=new ur(a,r,n,o.isOrdered),i=new io(t.name,s,t.nullable,Da(t.customMetadata))):(a=Ma(t,Aa(t,e)),i=new io(t.name,a,t.nullable,Da(t.customMetadata))),i||null},ro.encode=function(t,e){var n=e.fields.map((function(e){return io.encode(t,e)}));Ua.startFieldsVector(t,n.length);var r=Ua.createFieldsVector(t,n),i=e.metadata&&e.metadata.size>0?Ua.createCustomMetadataVector(t,Object(dn.a)(e.metadata).map((function(e){var n=Object(j.a)(e,2),r=n[0],i=n[1],o=t.createString("".concat(r)),a=t.createString("".concat(i));return Va.startKeyValue(t),Va.addKey(t,o),Va.addValue(t,a),Va.endKeyValue(t)}))):-1;Ua.startSchema(t),Ua.addFields(t,r),Ua.addEndianness(t,os?Wa.Little:Wa.Big),-1!==i&&Ua.addCustomMetadata(t,i);return Ua.endSchema(t)},ro.decode=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Map,n=ts(t,e);return new ro(n,ns(t),e)},ro.fromJSON=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Map;return new ro(Ia(t,e),Da(t.customMetadata),e)},qa.encode=function(t,e){var n=e.nodes||[],r=e.buffers||[];Xa.startNodesVector(t,n.length),n.slice().reverse().forEach((function(e){return Qa.encode(t,e)}));var i=t.endVector();Xa.startBuffersVector(t,r.length),r.slice().reverse().forEach((function(e){return $a.encode(t,e)}));var o=t.endVector();return Xa.startRecordBatch(t),Xa.addLength(t,new Ba(e.length,0)),Xa.addNodes(t,i),Xa.addBuffers(t,o),Xa.endRecordBatch(t)},qa.decode=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:en.V4;return new qa(t.length(),Ja(t),Za(t,e))},qa.fromJSON=Ea,Ka.encode=function(t,e){var n=qa.encode(t,e.data);return Ha.startDictionaryBatch(t),Ha.addId(t,new Ba(e.id,0)),Ha.addIsDelta(t,e.isDelta),Ha.addData(t,n),Ha.endDictionaryBatch(t)},Ka.decode=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:en.V4;return new Ka(qa.decode(t.data(),e),t.id(),t.isDelta())},Ka.fromJSON=function(t){return new Ka(Ea(t.data),t.id,t.isDelta)},Qa.encode=function(t,e){return Ya.createFieldNode(t,new Ba(e.length,0),new Ba(e.nullCount,0))},Qa.decode=function(t){return new Qa(t.length(),t.nullCount())},$a.encode=function(t,e){return Na.createBuffer(t,new Ba(e.offset,0),new Ba(e.length,0))},$a.decode=function(t){return new $a(t.offset(),t.length())};for(var os=function(){var t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),256===new Int16Array(t)[0]}(),as=W.ByteBuffer,ss=function(t){return"Expected ".concat(tn[t]," Message in stream, but was null or length 0.")},us=function(t){return"Header pointer of flatbuffer-encoded ".concat(tn[t]," Message is null or length 0.")},cs=function(t,e){return"Expected to read ".concat(t," metadata bytes, but only read ").concat(e,".")},ls=function(t,e){return"Expected to read ".concat(t," bytes for message body, but only read ").concat(e,".")},hs=function(){function t(e){M(this,t),this.source=e instanceof Go?e:new Go(e)}return F(t,[{key:Symbol.iterator,value:function(){return this}},{key:"next",value:function(){var t;return(t=this.readMetadataLength()).done||-1===t.value&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?ht:t}},{key:"throw",value:function(t){return this.source.throw(t)}},{key:"return",value:function(t){return this.source.return(t)}},{key:"readMessage",value:function(t){var e;if((e=this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(ss(t));return e.value}},{key:"readMessageBody",value:function(t){if(t<=0)return new Uint8Array(0);var e=$t(this.source.read(t));if(e.byteLength0&&void 0!==arguments[0]&&arguments[0],e=tn.Schema,n=this.readMessage(e),r=n&&n.header();if(t&&!r)throw new Error(us(e));return r}},{key:"readMetadataLength",value:function(){var t=this.source.read(ps),e=t&&new as(t),n=e&&e.readInt32(0)||0;return{done:0===n,value:n}}},{key:"readMetadata",value:function(t){var e=this.source.read(t);if(!e)return ht;if(e.byteLength0&&void 0!==o[0]&&o[0],n=tn.Schema,t.next=4,this.readMessage(n);case 4:if(r=t.sent,i=r&&r.header(),!e||i){t.next=8;break}throw new Error(us(n));case 8:return t.abrupt("return",i);case 9:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"readMetadataLength",value:function(){var t=P(L.mark((function t(){var e,n,r;return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.source.read(ps);case 2:return e=t.sent,n=e&&new as(e),r=n&&n.readInt32(0)||0,t.abrupt("return",{done:0===r,value:r});case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"readMetadata",value:function(){var t=P(L.mark((function t(e){var n;return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.source.read(e);case 2:if(n=t.sent){t.next=5;break}return t.abrupt("return",ht);case 5:if(!(n.byteLength1&&void 0!==arguments[1]?arguments[1]:0,n=-1,r=vs.length;++n2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");In.isNull(t.type)||ks.call(this,i<=0?new Uint8Array(0):sn(e.offset,r,e.nullBitmap)),this.nodes.push(new Qa(r,i))}return Ue(ot(n.prototype),"visit",this).call(this,t)}},{key:"visitNull",value:function(t){return this}},{key:"visitDictionary",value:function(t){return this.visit(t.indices)}},{key:"nodes",get:function(){return this._nodes}},{key:"buffers",get:function(){return this._buffers}},{key:"byteLength",get:function(){return this._byteLength}},{key:"bufferRegions",get:function(){return this._bufferRegions}}],[{key:"assemble",value:function(){for(var t=new n,e=arguments.length,r=new Array(e),i=0;i=t.length?ks.call(this,new Uint8Array(0)):(e=t.values)instanceof Uint8Array?ks.call(this,sn(t.offset,t.length,e)):ks.call(this,un(t))},ws.prototype.visitInt=xs,ws.prototype.visitFloat=xs,ws.prototype.visitUtf8=Ss,ws.prototype.visitBinary=Ss,ws.prototype.visitFixedSizeBinary=xs,ws.prototype.visitDate=xs,ws.prototype.visitTimestamp=xs,ws.prototype.visitTime=xs,ws.prototype.visitDecimal=xs,ws.prototype.visitList=Ts,ws.prototype.visitStruct=Cs,ws.prototype.visitUnion=function(t){var e=t.type,n=t.length,r=t.typeIds,i=t.valueOffsets;if(ks.call(this,r),e.mode===Je.Sparse)return Cs.call(this,t);if(e.mode===Je.Dense){if(t.offset<=0)return ks.call(this,i),Cs.call(this,t);for(var o,a,s=r.reduce((function(t,e){return Math.max(t,e)}),r[0]),u=new Int32Array(s+1),c=new Int32Array(s+1).fill(-1),l=new Int32Array(n),h=Te(-i[0],n,i),f=-1;++f0&&void 0!==arguments[0]&&arguments[0];return this._sink.toString(t)}},{key:"toUint8Array",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._sink.toUint8Array(t)}},{key:"writeAll",value:function(t){var e=this;return It(t)?t.then((function(t){return e.writeAll(t)})):Dt(t)?Ds(this,t):As(this,t)}},{key:Symbol.asyncIterator,value:function(){return this._sink[Symbol.asyncIterator]()}},{key:"toDOMStream",value:function(t){return this._sink.toDOMStream(t)}},{key:"toNodeStream",value:function(t){return this._sink.toNodeStream(t)}},{key:"close",value:function(){return this.reset()._sink.close()}},{key:"abort",value:function(t){return this.reset()._sink.abort(t)}},{key:"finish",value:function(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}},{key:"reset",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._sink,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t===this._sink||t instanceof Ho?this._sink=t:(this._sink=new Ho,t&&Lt(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Rt(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,e&&e.compareTo(this._schema)||(null===e?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}},{key:"write",value:function(t){var e=null;if(!this._sink)throw new Error("RecordBatchWriter is closed");if(null===t||void 0===t)return this.finish()&&void 0;if(t instanceof kc&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof xc&&!(e=t.schema))return this.finish()&&void 0;if(e&&!e.compareTo(this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof xc?t instanceof Sc||this._writeRecordBatch(t):t instanceof kc?this.writeAll(t.chunks):At(t)&&this.writeAll(t)}},{key:"_writeMessage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,n=e-1,r=Ga.encode(t),i=r.byteLength,o=this._writeLegacyIpcFormat?4:8,a=i+o+n&~n,s=a-i-o;return t.headerType===tn.RecordBatch?this._recordBatchBlocks.push(new Xo(a,t.bodyLength,this._position)):t.headerType===tn.DictionaryBatch&&this._dictionaryBlocks.push(new Xo(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),i>0&&this._write(r),this._writePadding(s)}},{key:"_write",value:function(t){if(this._started){var e=$t(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}},{key:"_writeSchema",value:function(t){return this._writeMessage(Ga.from(t))}},{key:"_writeFooter",value:function(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}},{key:"_writeMagic",value:function(){return this._write(vs)}},{key:"_writePadding",value:function(t){return t>0?this._write(new Uint8Array(t)):this}},{key:"_writeRecordBatch",value:function(t){var e=ws.assemble(t),n=e.byteLength,r=e.nodes,i=e.bufferRegions,o=e.buffers,a=new qa(t.length,r,i),s=Ga.from(a,n);return this._writeDictionaries(t)._writeMessage(s)._writeBodyBuffers(o)}},{key:"_writeDictionaryBatch",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));var r=ws.assemble(t),i=r.byteLength,o=r.nodes,a=r.bufferRegions,s=r.buffers,u=new qa(t.length,o,a),c=new Ka(u,e,n),l=Ga.from(c,i);return this._writeMessage(l)._writeBodyBuffers(s)}},{key:"_writeBodyBuffers",value:function(t){for(var e,n,r,i=-1,o=t.length;++i0&&(this._write(e),(r=(n+7&-8)-n)>0&&this._writePadding(r));return this}},{key:"_writeDictionaries",value:function(t){var e,n=A(t.dictionaries);try{for(n.s();!(e=n.n()).done;){var r=Object(j.a)(e.value,2),i=r[0],o=r[1],a=this._dictionaryDeltaOffsets.get(i)||0;if(0===a||(o=o.slice(a)).length>0){var s,u=A("chunks"in o?o.chunks:[o]);try{for(u.s();!(s=u.n()).done;){var c=s.value;this._writeDictionaryBatch(c,i,a>0),a+=c.length}}catch(l){u.e(l)}finally{u.f()}}}}catch(l){n.e(l)}finally{n.f()}return this}},{key:"closed",get:function(){return this._sink.closed}}],[{key:"throughNode",value:function(t){throw new Error('"throughNode" not available in this environment')}},{key:"throughDOM",value:function(t,e){throw new Error('"throughDOM" not available in this environment')}}]),n}(dt),Es=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,null,[{key:"writeAll",value:function(t,e){var r=new n(e);return It(t)?t.then((function(t){return r.writeAll(t)})):Dt(t)?Ds(r,t):As(r,t)}}]),n}(Os),Is=function(t){it(n,t);var e=lt(n);function n(){var t;return M(this,n),(t=e.call(this))._autoDestroy=!0,t}return F(n,[{key:"_writeSchema",value:function(t){return this._writeMagic()._writePadding(2)}},{key:"_writeFooter",value:function(t){var e=Yo.encode(new Yo(t,en.V4,this._recordBatchBlocks,this._dictionaryBlocks));return Ue(ot(n.prototype),"_writeFooter",this).call(this,t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}}],[{key:"writeAll",value:function(t){var e=new n;return It(t)?t.then((function(t){return e.writeAll(t)})):Dt(t)?Ds(e,t):As(e,t)}}]),n}(Os);function As(t,e){var n=e;e instanceof kc&&(n=e.chunks,t.reset(void 0,e.schema));var r,i=A(n);try{for(i.s();!(r=i.n()).done;){var o=r.value;t.write(o)}}catch(a){i.e(a)}finally{i.f()}return t.finish()}function Ds(t,e){return Ps.apply(this,arguments)}function Ps(){return(Ps=P(L.mark((function t(e,n){var r,i,o,a,s,u,c;return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=!0,i=!1,t.prev=2,a=V(n);case 4:return t.next=6,a.next();case 6:return s=t.sent,r=s.done,t.next=10,s.value;case 10:if(u=t.sent,r){t.next=17;break}c=u,e.write(c);case 14:r=!0,t.next=4;break;case 17:t.next=23;break;case 19:t.prev=19,t.t0=t.catch(2),i=!0,o=t.t0;case 23:if(t.prev=23,t.prev=24,r||null==a.return){t.next=28;break}return t.next=28,a.return();case 28:if(t.prev=28,!i){t.next=31;break}throw o;case 31:return t.finish(28);case 32:return t.finish(23);case 33:return t.abrupt("return",e.finish());case 34:case"end":return t.stop()}}),t,null,[[2,19,23,33],[24,,28,32]])})))).apply(this,arguments)}var Ms=new Uint8Array(0),Bs=function(t){return[Ms,Ms,new Uint8Array(t),Ms]};function Fs(t,e){for(var n,r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.reduce((function(t,e){return Math.max(t,e.length)}),0),o=-1,a=e.length,s=Object(dn.a)(t.fields),u=[],c=(i+63&-64)>>3;++o0;){for(s=Number.POSITIVE_INFINITY,u=-1;++u0&&(i[a++]=[s,l.slice()]))}return[t=new ro(r,t.metadata),i.map((function(e){return Ur(xc,[t].concat(Object(dn.a)(e)))}))]}(t,e.map((function(t){return t instanceof Vi?t.chunks.map((function(t){return t.data})):[t.data]})))}function Rs(t,e,n,r,i){for(var o,a,s=0,u=-1,c=r.length,l=(e+63&-64)>>3;++u=e?s===e?n[u]=o:(n[u]=o.slice(0,e),o=o.slice(e,s-e),i.numBatches=Math.max(i.numBatches,r[u].unshift(o))):((a=t[u]).nullable||(t[u]=a.clone({nullable:!0})),n[u]=o?o._changeLengthAndBackfillNullBitmap(e):lr.new(a.type,0,e,e,Bs(l)));return n}function Us(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}var Ns=function(t){it(n,t);var e=lt(n);function n(t,r){var i;return M(this,n),(i=e.call(this))._children=r,i.numChildren=t.childData.length,i._bindDataAccessors(i.data=t),i}return F(n,[{key:"clone",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._children;return He.new(t,e)}},{key:"concat",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n0){var e=this.offset+t;return 0!==(this.nullBitmap[e>>3]&1<=this.numChildren?null:(this._children||(this._children=[]))[t]||(this._children[t]=He.new(this.data.childData[t]))}},{key:"toJSON",value:function(){return Object(dn.a)(this)}},{key:"_sliceInternal",value:function(t,e,n){return t.clone(t.data.slice(e,n-e),null)}},{key:"_bindDataAccessors",value:function(t){}},{key:"type",get:function(){return this.data.type}},{key:"typeId",get:function(){return this.data.typeId}},{key:"length",get:function(){return this.data.length}},{key:"offset",get:function(){return this.data.offset}},{key:"stride",get:function(){return this.data.stride}},{key:"nullCount",get:function(){return this.data.nullCount}},{key:"byteLength",get:function(){return this.data.byteLength}},{key:"VectorName",get:function(){return"".concat(Ge[this.typeId],"Vector")}},{key:"ArrayType",get:function(){return this.type.ArrayType}},{key:"values",get:function(){return this.data.values}},{key:"typeIds",get:function(){return this.data.typeIds}},{key:"nullBitmap",get:function(){return this.data.nullBitmap}},{key:"valueOffsets",get:function(){return this.data.valueOffsets}},{key:Symbol.toStringTag,get:function(){return"".concat(this.VectorName,"<").concat(this.type[Symbol.toStringTag],">")}}]),n}(He);Ns.prototype[Symbol.isConcatSpreadable]=!0;var zs=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,[{key:"asUtf8",value:function(){return He.new(this.data.clone(new Xn))}}]),n}(Ns),Vs=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,null,[{key:"from",value:function(t){return wc((function(){return new Hn}),t)}}]),n}(Ns),Ys=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,null,[{key:"from",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n>>0)},zu=function(t){return new Date(t)},Vu=function(t,e,n){var r=e[n],i=e[n+1];return null!=r&&null!=i?t.subarray(r,i):null},Yu=function(t,e){return function(t,e){return zu(function(t,e){return 864e5*t[e]}(t,e))}(t.values,e)},Wu=function(t,e){return function(t,e){return zu(Nu(t,e))}(t.values,2*e)},Xu=function(t,e){var n=t.stride;return t.values[n*e]},Hu=function(t,e){var n=t.stride;return Mr(t.values[n*e])},Gu=function(t,e){var n=t.stride,r=t.values,i=t.type;return $r.new(r.subarray(n*e,n*(e+1)),i.isSigned)},qu=function(t,e){var n=t.values;return 1e3*Nu(n,2*e)},Ku=function(t,e){var n=t.values;return Nu(n,2*e)},$u=function(t,e){return function(t,e){return t[e+1]/1e3*4294967296+(t[e]>>>0)/1e3}(t.values,2*e)},Qu=function(t,e){return function(t,e){return t[e+1]/1e6*4294967296+(t[e]>>>0)/1e6}(t.values,2*e)},Ju=function(t,e){return t.values[t.stride*e]},Zu=function(t,e){return t.values[t.stride*e]},tc=function(t,e){var n=t.values;return $r.signed(n.subarray(2*e,2*(e+1)))},ec=function(t,e){var n=t.values;return $r.signed(n.subarray(2*e,2*(e+1)))},nc=function(t,e){var n=t.typeIdToChildIndex[t.typeIds[e]],r=t.getChildAt(n);return r?r.get(t.valueOffsets[e]):null},rc=function(t,e){var n=t.typeIdToChildIndex[t.typeIds[e]],r=t.getChildAt(n);return r?r.get(e):null},ic=function(t,e){return t.values.subarray(2*e,2*(e+1))},oc=function(t,e){var n=t.values[e],r=new Int32Array(2);return r[0]=n/12|0,r[1]=n%12|0,r};Uu.prototype.visitNull=function(t,e){return null},Uu.prototype.visitBool=function(t,e){var n=t.offset+e;return 0!==(t.values[n>>3]&1<0?0:-1},sc.prototype.visitBool=uc,sc.prototype.visitInt=uc,sc.prototype.visitInt8=uc,sc.prototype.visitInt16=uc,sc.prototype.visitInt32=uc,sc.prototype.visitInt64=uc,sc.prototype.visitUint8=uc,sc.prototype.visitUint16=uc,sc.prototype.visitUint32=uc,sc.prototype.visitUint64=uc,sc.prototype.visitFloat=uc,sc.prototype.visitFloat16=uc,sc.prototype.visitFloat32=uc,sc.prototype.visitFloat64=uc,sc.prototype.visitUtf8=uc,sc.prototype.visitBinary=uc,sc.prototype.visitFixedSizeBinary=uc,sc.prototype.visitDate=uc,sc.prototype.visitDateDay=uc,sc.prototype.visitDateMillisecond=uc,sc.prototype.visitTimestamp=uc,sc.prototype.visitTimestampSecond=uc,sc.prototype.visitTimestampMillisecond=uc,sc.prototype.visitTimestampMicrosecond=uc,sc.prototype.visitTimestampNanosecond=uc,sc.prototype.visitTime=uc,sc.prototype.visitTimeSecond=uc,sc.prototype.visitTimeMillisecond=uc,sc.prototype.visitTimeMicrosecond=uc,sc.prototype.visitTimeNanosecond=uc,sc.prototype.visitDecimal=uc,sc.prototype.visitList=uc,sc.prototype.visitStruct=uc,sc.prototype.visitUnion=uc,sc.prototype.visitDenseUnion=cc,sc.prototype.visitSparseUnion=cc,sc.prototype.visitDictionary=uc,sc.prototype.visitInterval=uc,sc.prototype.visitIntervalDayTime=uc,sc.prototype.visitIntervalYearMonth=uc,sc.prototype.visitFixedSizeList=uc,sc.prototype.visitMap=uc;var lc=new sc,hc=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return n}(pn);function fc(t){if(t.nullCount>0)return function(t){var e=ac.getVisitFn(t);return cn(t.nullBitmap,t.offset,t.length,t,(function(t,n,r,i){return 0!==(r&1<0)?t.values.subarray(0,r)[Symbol.iterator]():L.mark((function e(n){var i;return L.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=-1;case 1:if(!(++i1?e-1:0),r=1;r0&&(this.get=(e=this.get,function(t){return this.isValid(t)?e.call(this,t):null}),this.set=function(t){return function(e,n){an(this.nullBitmap,this.offset+e,!(null===n||void 0===n))&&t.call(this,e,n)}}(this.set));var e},Object.keys(Ge).map((function(t){return Ge[t]})).filter((function(t){return"number"===typeof t})).filter((function(t){return t!==Ge.NONE})).forEach((function(t){var e,n=_c.visit(t);n.prototype.get=(e=ac.getVisitFn(t),function(t){return e(this,t)}),n.prototype.set=Ru(Lo.getVisitFn(t)),n.prototype.indexOf=Ru(lc.getVisitFn(t)),n.prototype.toArray=ju(yc.getVisitFn(t)),n.prototype.getByteWidth=function(t){return function(){return t(this.type)}}(bc.getVisitFn(t)),n.prototype[Symbol.iterator]=ju(dc.getVisitFn(t))}));var kc=function(t){it(n,t);var e=lt(n);function n(){var t;M(this,n);for(var r=null,i=arguments.length,o=new Array(i),a=0;a0&&void 0!==arguments[0]?arguments[0]:this._chunks;return new n(this._schema,t)}},{key:"getColumn",value:function(t){return this.getColumnAt(this.getColumnIndex(t))}},{key:"getColumnAt",value:function(t){return this.getChildAt(t)}},{key:"getColumnIndex",value:function(t){return this._schema.fields.findIndex((function(e){return e.name===t}))}},{key:"getChildAt",value:function(t){if(t<0||t>=this.numChildren)return null;var e,n,r=this._schema.fields,i=this._children||(this._children=[]);if(n=i[t])return n;if(e=r[t]){var o=this._chunks.map((function(e){return e.getChildAt(t)})).filter((function(t){return null!=t}));if(o.length>0)return i[t]=new Hi(e,o)}return null}},{key:"serialize",value:function(){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],e=t?Es:Is;return e.writeAll(this).toUint8Array(!0)}},{key:"count",value:function(){return this._length}},{key:"select",value:function(){for(var t=this._schema.fields.reduce((function(t,e,n){return t.set(e.name,n)}),new Map),e=arguments.length,n=new Array(e),r=0;r-1}))))}},{key:"selectAt",value:function(){for(var t,e=arguments.length,r=new Array(e),i=0;i3&&void 0!==arguments[3]?arguments[3]:s[r];return void 0===o?e.getColumnAt(r):t.getColumnAt(o)}))),Object(dn.a)(a.map((function(e){return t.getColumnAt(e)})))).filter(Boolean);return Ur(n,Object(dn.a)(js(u,c)))}},{key:"schema",get:function(){return this._schema}},{key:"length",get:function(){return this._length}},{key:"chunks",get:function(){return this._chunks}},{key:"numCols",get:function(){return this._numChildren}}],[{key:"empty",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ro([]);return new n(t,[])}},{key:"from",value:function(t){if(!t)return n.empty();if("object"===typeof t){var e=At(t.values)?function(t){if(t.type instanceof er)return kc.fromStruct(ku.from(t));return null}(t):Dt(t.values)?function(t){if(t.type instanceof er)return ku.from(t).then((function(t){return kc.fromStruct(t)}));return null}(t):null;if(null!==e)return e}var r=Oc.from(t);return It(r)?P(L.mark((function t(){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=n,t.next=3,r;case 3:return t.t1=t.sent,t.next=6,t.t0.from.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})))():r.isSync()&&(r=r.open())?r.schema?new n(r.schema,Object(dn.a)(r)):n.empty():function(){var t=P(L.mark((function t(e){var r,i,o,a,s,u,c,l,h,f;return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e;case 2:if(r=t.sent,i=r.schema,o=[],!i){t.next=40;break}a=!0,s=!1,t.prev=8,c=V(r);case 10:return t.next=12,c.next();case 12:return l=t.sent,a=l.done,t.next=16,l.value;case 16:if(h=t.sent,a){t.next=23;break}f=h,o.push(f);case 20:a=!0,t.next=10;break;case 23:t.next=29;break;case 25:t.prev=25,t.t0=t.catch(8),s=!0,u=t.t0;case 29:if(t.prev=29,t.prev=30,a||null==c.return){t.next=34;break}return t.next=34,c.return();case 34:if(t.prev=34,!s){t.next=37;break}throw u;case 37:return t.finish(34);case 38:return t.finish(29);case 39:return t.abrupt("return",new n(i,o));case 40:return t.abrupt("return",n.empty());case 41:case"end":return t.stop()}}),t,null,[[8,25,29,39],[30,,34,38]])})));return function(e){return t.apply(this,arguments)}}()(r.open())}},{key:"fromAsync",value:function(){var t=P(L.mark((function t(e){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.from(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},{key:"fromStruct",value:function(t){return n.new(t.data.childData,t.type.children)}},{key:"new",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r1&&void 0!==arguments[1]?arguments[1]:this._children;return new n(this._schema,t,e)}},{key:"concat",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r-1}))))}},{key:"selectAt",value:function(){for(var t,e=this,r=arguments.length,i=new Array(r),o=0;o0&&this.dictionaries.set(e.id,n),this}}],[{key:"collect",value:function(t){return(new n).visit(t.data,new er(t.schema.fields)).dictionaries}}]),n}(pn),Cc=L.mark(Uc),Oc=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this))._impl=t,r}return F(n,[{key:"isSync",value:function(){return this._impl.isSync()}},{key:"isAsync",value:function(){return this._impl.isAsync()}},{key:"isFile",value:function(){return this._impl.isFile()}},{key:"isStream",value:function(){return this._impl.isStream()}},{key:"next",value:function(){return this._impl.next()}},{key:"throw",value:function(t){return this._impl.throw(t)}},{key:"return",value:function(t){return this._impl.return(t)}},{key:"cancel",value:function(){return this._impl.cancel()}},{key:"reset",value:function(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}},{key:"open",value:function(t){var e=this,n=this._impl.open(t);return It(n)?n.then((function(){return e})):this}},{key:"readRecordBatch",value:function(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}},{key:Symbol.iterator,value:function(){return this._impl[Symbol.iterator]()}},{key:Symbol.asyncIterator,value:function(){return this._impl[Symbol.asyncIterator]()}},{key:"toDOMStream",value:function(){var t=this;return Ee.toDOMStream(this.isSync()?Object(xi.a)({},Symbol.iterator,(function(){return t})):Object(xi.a)({},Symbol.asyncIterator,(function(){return t})))}},{key:"toNodeStream",value:function(){var t=this;return Ee.toNodeStream(this.isSync()?Object(xi.a)({},Symbol.iterator,(function(){return t})):Object(xi.a)({},Symbol.asyncIterator,(function(){return t})),{objectMode:!0})}},{key:"closed",get:function(){return this._impl.closed}},{key:"schema",get:function(){return this._impl.schema}},{key:"autoDestroy",get:function(){return this._impl.autoDestroy}},{key:"dictionaries",get:function(){return this._impl.dictionaries}},{key:"numDictionaries",get:function(){return this._impl.numDictionaries}},{key:"numRecordBatches",get:function(){return this._impl.numRecordBatches}},{key:"footer",get:function(){return this._impl.isFile()?this._impl.footer:null}}],[{key:"throughNode",value:function(t){throw new Error('"throughNode" not available in this environment')}},{key:"throughDOM",value:function(t,e){throw new Error('"throughDOM" not available in this environment')}},{key:"from",value:function(t){return t instanceof n?t:Pt(t)?function(t){return new Ec(new jc(t))}(t):Bt(t)?function(t){return Yc.apply(this,arguments)}(t):It(t)?P(L.mark((function e(){return L.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=n,e.next=3,t;case 3:return e.t1=e.sent,e.next=6,e.t0.from.call(e.t0,e.t1);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))():Ft(t)||jt(t)||Ut(t)||Dt(t)?function(t){return Vc.apply(this,arguments)}(new qo(t)):function(t){var e=t.peek(ms+7&-8);return e&&e.byteLength>=4?gs(e)?new Ac(new Fc(t.read())):new Ec(new Mc(t)):new Ec(new Mc(L.mark((function t(){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))()))}(new Go(t))}},{key:"readAll",value:function(t){return t instanceof n?t.isSync()?Uc(t):Nc(t):Pt(t)||ArrayBuffer.isView(t)||At(t)||Mt(t)?Uc(t):Nc(t)}}]),n}(dt),Ec=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this,t))._impl=t,r}return F(n,[{key:Symbol.iterator,value:function(){return this._impl[Symbol.iterator]()}},{key:Symbol.asyncIterator,value:function(){var t=this;return z(L.mark((function e(){return L.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.delegateYield(Y(V(t[Symbol.iterator]()),U),"t0",1);case 1:case"end":return e.stop()}}),e)})))()}}]),n}(Oc),Ic=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this,t))._impl=t,r}return F(n,[{key:Symbol.iterator,value:function(){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}},{key:Symbol.asyncIterator,value:function(){return this._impl[Symbol.asyncIterator]()}}]),n}(Oc),Ac=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this,t))._impl=t,r}return n}(Ec),Dc=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this,t))._impl=t,r}return n}(Ic),Pc=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;M(this,t),this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}return F(t,[{key:"isSync",value:function(){return!1}},{key:"isAsync",value:function(){return!1}},{key:"isFile",value:function(){return!1}},{key:"isStream",value:function(){return!1}},{key:"reset",value:function(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}},{key:"_loadRecordBatch",value:function(t,e){return new xc(this.schema,t.length,this._loadVectors(t,e,this.schema.fields))}},{key:"_loadDictionaryBatch",value:function(t,e){var n=t.id,r=t.isDelta,i=t.data,o=this.dictionaries,a=this.schema,s=o.get(n);if(r||!s){var u=a.dictionaries.get(n);return s&&r?s.concat(He.new(this._loadVectors(i,e,[u])[0])):He.new(this._loadVectors(i,e,[u])[0])}return s}},{key:"_loadVectors",value:function(t,e,n){return new oa(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}},{key:"numDictionaries",get:function(){return this._dictionaryIndex}},{key:"numRecordBatches",get:function(){return this._recordBatchIndex}}]),t}(),Mc=function(t){it(n,t);var e=lt(n);function n(t,r){var i;return M(this,n),(i=e.call(this,r))._reader=Pt(t)?new ds(i._handle=t):new hs(i._handle=t),i}return F(n,[{key:"isSync",value:function(){return!0}},{key:"isStream",value:function(){return!0}},{key:Symbol.iterator,value:function(){return this}},{key:"cancel",value:function(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}},{key:"open",value:function(t){return this.closed||(this.autoDestroy=Rc(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}},{key:"throw",value:function(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):ht}},{key:"return",value:function(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):ht}},{key:"next",value:function(){if(this.closed)return ht;for(var t,e=this._reader;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else{if(t.isRecordBatch()){this._recordBatchIndex++;var n=t.header(),r=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r)}}if(t.isDictionaryBatch()){this._dictionaryIndex++;var i=t.header(),o=e.readMessageBody(t.bodyLength),a=this._loadDictionaryBatch(i,o);this.dictionaries.set(i.id,a)}}return this.schema&&0===this._recordBatchIndex?(this._recordBatchIndex++,{done:!1,value:new Sc(this.schema)}):this.return()}},{key:"_readNextMessageAndValidate",value:function(t){return this._reader.readMessage(t)}}]),n}(Pc),Bc=function(t){it(n,t);var e=lt(n);function n(t,r){var i;return M(this,n),(i=e.call(this,r))._reader=new fs(i._handle=t),i}return F(n,[{key:"isAsync",value:function(){return!0}},{key:"isStream",value:function(){return!0}},{key:Symbol.asyncIterator,value:function(){return this}},{key:"cancel",value:function(){var t=P(L.mark((function t(){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.closed||!(this.closed=!0)){t.next=5;break}return t.next=3,this.reset()._reader.return();case 3:this._reader=null,this.dictionaries=null;case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"open",value:function(){var t=P(L.mark((function t(e){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.closed){t.next=10;break}if(this.autoDestroy=Rc(this,e),t.t0=this.schema,t.t0){t.next=7;break}return t.next=6,this._reader.readSchema();case 6:t.t0=this.schema=t.sent;case 7:if(t.t0){t.next=10;break}return t.next=10,this.cancel();case 10:return t.abrupt("return",this);case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"throw",value:function(){var t=P(L.mark((function t(e){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.closed||!this.autoDestroy||!(this.closed=!0)){t.next=4;break}return t.next=3,this.reset()._reader.throw(e);case 3:return t.abrupt("return",t.sent);case 4:return t.abrupt("return",ht);case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"return",value:function(){var t=P(L.mark((function t(e){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.closed||!this.autoDestroy||!(this.closed=!0)){t.next=4;break}return t.next=3,this.reset()._reader.return(e);case 3:return t.abrupt("return",t.sent);case 4:return t.abrupt("return",ht);case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"next",value:function(){var t=P(L.mark((function t(){var e,n,r,i,o,a,s,u;return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.closed){t.next=2;break}return t.abrupt("return",ht);case 2:n=this._reader;case 3:return t.next=5,this._readNextMessageAndValidate();case 5:if(!(e=t.sent)){t.next=31;break}if(!e.isSchema()){t.next=11;break}return t.next=9,this.reset(e.header());case 9:t.next=29;break;case 11:if(!e.isRecordBatch()){t.next=21;break}return this._recordBatchIndex++,r=e.header(),t.next=16,n.readMessageBody(e.bodyLength);case 16:return i=t.sent,o=this._loadRecordBatch(r,i),t.abrupt("return",{done:!1,value:o});case 21:if(!e.isDictionaryBatch()){t.next=29;break}return this._dictionaryIndex++,a=e.header(),t.next=26,n.readMessageBody(e.bodyLength);case 26:s=t.sent,u=this._loadDictionaryBatch(a,s),this.dictionaries.set(a.id,u);case 29:t.next=3;break;case 31:if(!this.schema||0!==this._recordBatchIndex){t.next=34;break}return this._recordBatchIndex++,t.abrupt("return",{done:!1,value:new Sc(this.schema)});case 34:return t.next=36,this.return();case 36:return t.abrupt("return",t.sent);case 37:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"_readNextMessageAndValidate",value:function(){var t=P(L.mark((function t(e){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._reader.readMessage(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()}]),n}(Pc),Fc=function(t){it(n,t);var e=lt(n);function n(t,r){return M(this,n),e.call(this,t instanceof Qo?t:new Qo(t),r)}return F(n,[{key:"isSync",value:function(){return!0}},{key:"isFile",value:function(){return!0}},{key:"open",value:function(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;var e,r=A(this._footer.dictionaryBatches());try{for(r.s();!(e=r.n()).done;){e.value&&this._readDictionaryBatch(this._dictionaryIndex++)}}catch(i){r.e(i)}finally{r.f()}}return Ue(ot(n.prototype),"open",this).call(this,t)}},{key:"readRecordBatch",value:function(t){if(this.closed)return null;this._footer||this.open();var e=this._footer&&this._footer.getRecordBatch(t);if(e&&this._handle.seek(e.offset)){var n=this._reader.readMessage(tn.RecordBatch);if(n&&n.isRecordBatch()){var r=n.header(),i=this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(r,i)}}return null}},{key:"_readDictionaryBatch",value:function(t){var e=this._footer&&this._footer.getDictionaryBatch(t);if(e&&this._handle.seek(e.offset)){var n=this._reader.readMessage(tn.DictionaryBatch);if(n&&n.isDictionaryBatch()){var r=n.header(),i=this._reader.readMessageBody(n.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}}}},{key:"_readFooter",value:function(){var t=this._handle,e=t.size-bs,n=t.readInt32(e),r=t.readAt(e-n,n);return Yo.decode(r)}},{key:"_readNextMessageAndValidate",value:function(t){if(this._footer||this.open(),this._footer&&this._recordBatchIndex1?r-1:0),o=1;o=4)){t.next=18;break}if(gs(n)){t.next=8;break}t.t1=new Ic(new Bc(e)),t.next=15;break;case 8:return t.t2=Ac,t.t3=Fc,t.next=12,e.read();case 12:t.t4=t.sent,t.t5=new t.t3(t.t4),t.t1=new t.t2(t.t5);case 15:t.t0=t.t1,t.next=19;break;case 18:t.t0=new Ic(new Bc(z(L.mark((function t(){return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)})))()));case 19:return t.abrupt("return",t.t0);case 20:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Yc(){return(Yc=P(L.mark((function t(e){var n,r,i;return L.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.stat();case 2:if(n=t.sent,r=n.size,i=new Jo(e,r),!(r>=_s)){t.next=12;break}return t.t0=gs,t.next=9,i.readAt(0,ms+7&-8);case 9:if(t.t1=t.sent,!(0,t.t0)(t.t1)){t.next=12;break}return t.abrupt("return",new Dc(new Lc(i)));case 12:return t.abrupt("return",new Ic(new Bc(i)));case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Wc=function(){function t(e){var n,r,i=this;M(this,t),this._numChunks=0,this._finished=!1,this._bufferedSize=0;var o=e.readableStrategy,a=e.writableStrategy,s=e.queueingStrategy,u=void 0===s?"count":s,c=Us(e,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=_r.new(c),this._getSize="bytes"!==u?Xc:Hc;var l=Object(Re.a)({},o).highWaterMark,h=void 0===l?"bytes"===u?Math.pow(2,14):1e3:l,f=Object(Re.a)({},a).highWaterMark,d=void 0===f?"bytes"===u?Math.pow(2,14):1e3:f;this.readable=new ReadableStream((n={},Object(xi.a)(n,"cancel",(function(){i._builder.clear()})),Object(xi.a)(n,"pull",(function(t){i._maybeFlush(i._builder,i._controller=t)})),Object(xi.a)(n,"start",(function(t){i._maybeFlush(i._builder,i._controller=t)})),n),{highWaterMark:h,size:"bytes"!==u?Xc:Hc}),this.writable=new WritableStream((r={},Object(xi.a)(r,"abort",(function(){i._builder.clear()})),Object(xi.a)(r,"write",(function(){i._maybeFlush(i._builder,i._controller)})),Object(xi.a)(r,"close",(function(){i._maybeFlush(i._builder.finish(),i._controller)})),r),{highWaterMark:d,size:function(t){return i._writeValueAndReturnChunkSize(t)}})}return F(t,[{key:"_writeValueAndReturnChunkSize",value:function(t){var e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}},{key:"_maybeFlush",value:function(t,e){null!==e&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||0===this._numChunks)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}},{key:"_enqueue",value:function(t,e){this._bufferedSize=0,this._controller=null,null===e?t.close():t.enqueue(e)}}]),t}(),Xc=function(t){return t.length},Hc=function(t){return t.byteLength};var Gc=function(){function t(){M(this,t)}return F(t,[{key:"eq",value:function(e){return e instanceof t||(e=new qc(e)),new el(this,e)}},{key:"le",value:function(e){return e instanceof t||(e=new qc(e)),new nl(this,e)}},{key:"ge",value:function(e){return e instanceof t||(e=new qc(e)),new rl(this,e)}},{key:"lt",value:function(t){return new il(this.ge(t))}},{key:"gt",value:function(t){return new il(this.le(t))}},{key:"ne",value:function(t){return new il(this.eq(t))}}]),t}(),qc=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this)).v=t,r}return n}(Gc),Kc=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this)).name=t,r}return F(n,[{key:"bind",value:function(t){if(!this.colidx){this.colidx=-1;for(var e=t.schema.fields,n=-1;++n=n.v;return function(){return r}}},{key:"_bindColCol",value:function(t,e,n){var r=e.bind(t),i=n.bind(t);return function(t,e){return r(t,e)>=i(t,e)}}},{key:"_bindColLit",value:function(t,e,n){var r=e.bind(t);return function(t,e){return r(t,e)>=n.v}}},{key:"_bindLitCol",value:function(t,e,n){var r=n.bind(t);return function(t,n){return e.v>=r(t,n)}}}]),n}(Qc),il=function(t){it(n,t);var e=lt(n);function n(t){var r;return M(this,n),(r=e.call(this)).child=t,r}return F(n,[{key:"bind",value:function(t){var e=this.child.bind(t);return function(t,n){return!e(t,n)}}}]),n}($c);kc.prototype.countBy=function(t){return new ol(this.chunks).countBy(t)},kc.prototype.scan=function(t,e){return new ol(this.chunks).scan(t,e)},kc.prototype.scanReverse=function(t,e){return new ol(this.chunks).scanReverse(t,e)},kc.prototype.filter=function(t){return new ol(this.chunks).filter(t)};var ol=function(t){it(n,t);var e=lt(n);function n(){return M(this,n),e.apply(this,arguments)}return F(n,[{key:"filter",value:function(t){return new sl(this.chunks,t)}},{key:"scan",value:function(t,e){for(var n=this.chunks,r=n.length,i=-1;++i=0;){var i=n[r];e&&e(i);for(var o=i.length;--o>=0;)t(o,i)}}},{key:"countBy",value:function(t){var e=this.chunks,n=e.length,r="string"===typeof t?new Kc(t):t;r.bind(e[n-1]);var i=r.vector;if(!In.isDictionary(i.type))throw new Error("countBy currently only supports dictionary-encoded columns");for(var o=Math.ceil(Math.log(i.length)/Math.log(256)),a=new(4==o?Uint32Array:o>=2?Uint16Array:Uint8Array)(i.dictionary.length),s=-1;++s=0;)for(var i=n[r],o=this._predicate.bind(i),a=!1,s=i.length;--s>=0;)o(s,i)&&(e&&!a&&(e(i),a=!0),t(s,i))}},{key:"count",value:function(){for(var t=0,e=this._chunks,n=e.length,r=-1;++r=2?Uint16Array:Uint8Array)(i.dictionary.length),s=-1;++s=i.headerRows&&e=i.headerColumns;if(n){var a=["blank"];return e>0&&a.push("level"+t),{type:"blank",classNames:a.join(" "),content:""}}if(o)return{type:"columns",classNames:(a=["col_heading","level"+t,"col"+(u=e-i.headerColumns)]).join(" "),content:i.getContent(i.columnsTable,u,t)};if(r){a=["row_heading","level"+e,"row"+(s=t-i.headerRows)];return{type:"index",id:"T_"+i.uuid+"level"+e+"_row"+s,classNames:a.join(" "),content:i.getContent(i.indexTable,s,e)}}a=["data","row"+(s=t-i.headerRows),"col"+(u=e-i.headerColumns)];var s,u,c=i.styler?i.getContent(i.styler.displayValuesTable,s,u):i.getContent(i.dataTable,s,u);return{type:"data",id:"T_"+i.uuid+"row"+s+"_col"+u,classNames:a.join(" "),content:c}},this.getContent=function(t,e,n){var r=t.getColumnAt(n);if(null===r)return"";switch(i.getColumnTypeId(t,n)){case Ge.Timestamp:return i.nanosToDate(r.get(e));default:return r.get(e)}},this.dataTable=kc.from(t),this.indexTable=kc.from(e),this.columnsTable=kc.from(n),this.styler=r?{caption:r.caption,displayValuesTable:kc.from(r.displayValues),styles:r.styles,uuid:r.uuid}:void 0}return Object.defineProperty(t.prototype,"rows",{get:function(){return this.indexTable.length+this.columnsTable.numCols},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"columns",{get:function(){return this.indexTable.numCols+this.columnsTable.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"headerRows",{get:function(){return this.rows-this.dataRows},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"headerColumns",{get:function(){return this.columns-this.dataColumns},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataRows",{get:function(){return this.dataTable.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataColumns",{get:function(){return this.dataTable.numCols},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"uuid",{get:function(){return this.styler&&this.styler.uuid},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"caption",{get:function(){return this.styler&&this.styler.caption},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"styles",{get:function(){return this.styler&&this.styler.styles},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"table",{get:function(){return this.dataTable},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"index",{get:function(){return this.indexTable},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"columnTable",{get:function(){return this.columnsTable},enumerable:!0,configurable:!0}),t.prototype.serialize=function(){return{data:this.dataTable.serialize(),index:this.indexTable.serialize(),columns:this.columnsTable.serialize()}},t.prototype.getColumnTypeId=function(t,e){return t.schema.fields[e].type.typeId},t.prototype.nanosToDate=function(t){return new Date(t/1e6)},t}(),ll=function(){return(ll=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0?t.argsDataframeToObject(e.dfs):{};n=ll(ll({},n),r);var i={disabled:Boolean(e.disabled),args:n},o=new CustomEvent(t.RENDER_EVENT,{detail:i});t.events.dispatchEvent(o)},t.argsDataframeToObject=function(e){var n=e.map((function(e){var n=e.key,r=e.value;return[n,t.toArrowTable(r)]}));return Object.fromEntries(n)},t.toArrowTable=function(t){var e=t.data,n=e.data,r=e.index,i=e.columns,o=e.styler;return new cl(n,r,i,o)},t.sendBackMsg=function(t,e){window.parent.postMessage(ll({isStreamlitMessage:!0,type:t},e),"*")},t}();var fl=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}fl(e,t),e.prototype.componentDidMount=function(){hl.setFrameHeight()},e.prototype.componentDidUpdate=function(){hl.setFrameHeight()}}(f.a.PureComponent);function dl(t){var e=function(e){function n(n){var r=e.call(this,n)||this;return r.componentDidMount=function(){hl.events.addEventListener(hl.RENDER_EVENT,r.onRenderEvent),hl.setComponentReady()},r.componentDidUpdate=function(){null!=r.state.componentError&&hl.setFrameHeight()},r.componentWillUnmount=function(){hl.events.removeEventListener(hl.RENDER_EVENT,r.onRenderEvent)},r.onRenderEvent=function(t){var e=t;r.setState({renderData:e.detail})},r.render=function(){return null!=r.state.componentError?f.a.createElement("div",null,f.a.createElement("h1",null,"Component Error"),f.a.createElement("span",null,r.state.componentError.message)):null==r.state.renderData?null:f.a.createElement(t,{width:window.innerWidth,disabled:r.state.renderData.disabled,args:r.state.renderData.args})},r.state={renderData:void 0,componentError:void 0},r}return fl(n,e),n.getDerivedStateFromError=function(t){return{componentError:t}},n}(f.a.PureComponent);return l()(e,t)}},function(t,e,n){"use strict";var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function a(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(i){return!1}}()?Object.assign:function(t,e){for(var n,s,u=a(t),c=1;cA.length&&A.push(t)}function M(t,e,n){return null==t?0:function t(e,n,r,i){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var u=!1;if(null===e)u=!0;else switch(s){case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case o:case a:u=!0}}if(u)return r(i,e,""===n?"."+B(e,0):n),1;if(u=0,n=""===n?".":n+":",Array.isArray(e))for(var c=0;c