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ACFzD,KAAK,MAEXoG,UAAW,CACP7C,QAAS,UACTC,MAAM,EACNC,YAAa,gDAGjB4C,iBAAkB,CACd9C,QAAS,SACTC,KAAM,EACNrN,IAAK,EACL0O,IAAK,EACLpB,YAAa,CACT,iDACA,2DACA,4BACFzD,KAAK,MAGXsG,cAAe,CACX/C,QAAS,MACTC,KAAM,cACNC,YAAa,CACT,uEACA,4BACA,gFACA,4BACA,6EACFzD,KAAK,MAGXuG,YAAa,CACThD,QAAS,SACTkC,SAAS,EACTjC,KAAM,uBACNC,YAAa,CACT,8CACA,+DACA,mCACA,qCACA,0DACA,wCACFzD,KAAK,MAGXwG,kBAAmB,CACfjD,QAAS,SACTC,KAAM,KACNC,YAAa,CACT,4DACA,yDACA,gFACFzD,KAAK,MAGXyG,QAAS,CACLlD,QAAS,UACTpN,IAAK,EACL0O,IAAK,EACLrB,KAAM,EACNC,YAAa,CACT,6DACA,mDACA,oBACA,aACA,yDACA,mBACFzD,KAAK,MAGX0G,gBAAiB,CACbnD,QAAS,UACTpN,IAAK,EACL0O,IAAK,EACLrB,KAAM,EACNC,YAAa,CACT,wCACA,mDACA,oBACA,sBACA,yDACA,mBACFzD,KAAK,MAGX2G,YAAa,CACTpD,QAAS,UACTpN,IAAK,EACLqN,KAAM,EACNC,YAAa,2CAGjBmD,iBAAkB,CACdrD,QAAS,MACTC,KAAM,GACNC,YAAa,CACT,2DACA,wBACFzD,KAAK,MAGX6G,OAAQ,CACJtD,QAAS,SACTC,KAAM,QACNC,YAAa,CACT,oCACA,4CACFzD,KAAK,MAGX8G,QAAS,CACLvD,QAAS,MACTC,KAAM,CAAC,EACPC,YAAa,CACT,2BACA,0EACA,kCACA,8EACA,IACA,UACA,2DACA,oDACA,OACA,QACA,IACA,4EACA,yEACA,4EACA,4EACA,4EACA,6EACA,0EACA,2EACFzD,KAAK,OAIX+G,EAAa,CAAC,GAElB,SAASC,EAAMC,EAAKzI,GAChB,IAAI,IAAI0I,KAAKD,EAAK,CACd,IAAIr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AAYC,eAAiBhsB,IAIzDhnB,KAAOiS,CACnB,CAEA,SAAS2+B,EAAgB3+B,EAAQjS,GAC7B,OAAGA,KAAOiS,EAAeA,EAAOjS,GAIzBiS,EAFK6gC,EAAS9yC,GAED+yC,WACxB,CAEA,IAAIE,EAAU93C,EAAImqB,aAAa,YAE/B,SAASwtB,EAAS9yC,GACd,IAAIkzC,EAAUlzC,EAAIiK,MAAMgpC,GAExB,MAAO,CACHF,WAAYG,GAAWA,EAAQ,GAC/BlsB,GAAIksB,GAAWA,EAAQ,GAE/B,C","sources":["../node_modules/plotly.js/src/plot_api/helpers.js","../node_modules/plotly.js/src/plot_api/container_array_match.js","../node_modules/plotly.js/src/plot_api/plot_config.js","../node_modules/plotly.js/src/plot_api/index.js","../node_modules/plotly.js/src/plot_api/plot_schema.js","../node_modules/plotly.js/src/plot_api/plot_template.js","../node_modules/plotly.js/src/plot_api/plot_api.js","../node_modules/plotly.js/src/plot_api/template_api.js","../node_modules/plotly.js/src/plot_api/edit_types.js","../node_modules/plotly.js/src/plot_api/to_image.js","../node_modules/plotly.js/src/plot_api/subroutines.js","../node_modules/plotly.js/src/plot_api/manage_arrays.js","../node_modules/plotly.js/src/plot_api/validate.js"],"sourcesContent":["'use strict';\n\nvar isNumeric = require('fast-isnumeric');\nvar m4FromQuat = require('gl-mat4/fromQuat');\n\nvar Registry = require('../registry');\nvar Lib = require('../lib');\nvar Plots = require('../plots/plots');\nvar AxisIds = require('../plots/cartesian/axis_ids');\nvar Color = require('../components/color');\n\nvar cleanId = AxisIds.cleanId;\nvar getFromTrace = AxisIds.getFromTrace;\nvar traceIs = Registry.traceIs;\n\n// clear the promise queue if one of them got rejected\nexports.clearPromiseQueue = function(gd) {\n if(Array.isArray(gd._promises) && gd._promises.length > 0) {\n Lib.log('Clearing previous rejected promises from queue.');\n }\n\n gd._promises = [];\n};\n\n// make a few changes to the layout right away\n// before it gets used for anything\n// backward compatibility and cleanup of nonstandard options\nexports.cleanLayout = function(layout) {\n var i, j;\n\n if(!layout) layout = {};\n\n // cannot have (x|y)axis1, numbering goes axis, axis2, axis3...\n if(layout.xaxis1) {\n if(!layout.xaxis) layout.xaxis = layout.xaxis1;\n delete layout.xaxis1;\n }\n if(layout.yaxis1) {\n if(!layout.yaxis) layout.yaxis = layout.yaxis1;\n delete layout.yaxis1;\n }\n if(layout.scene1) {\n if(!layout.scene) layout.scene = layout.scene1;\n delete layout.scene1;\n }\n\n var axisAttrRegex = (Plots.subplotsRegistry.cartesian || {}).attrRegex;\n var polarAttrRegex = (Plots.subplotsRegistry.polar || {}).attrRegex;\n var ternaryAttrRegex = (Plots.subplotsRegistry.ternary || {}).attrRegex;\n var sceneAttrRegex = (Plots.subplotsRegistry.gl3d || {}).attrRegex;\n\n var keys = Object.keys(layout);\n for(i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n if(axisAttrRegex && axisAttrRegex.test(key)) {\n // modifications to cartesian axes\n\n var ax = layout[key];\n if(ax.anchor && ax.anchor !== 'free') {\n ax.anchor = cleanId(ax.anchor);\n }\n if(ax.overlaying) ax.overlaying = cleanId(ax.overlaying);\n\n // old method of axis type - isdate and islog (before category existed)\n if(!ax.type) {\n if(ax.isdate) ax.type = 'date';\n else if(ax.islog) ax.type = 'log';\n else if(ax.isdate === false && ax.islog === false) ax.type = 'linear';\n }\n if(ax.autorange === 'withzero' || ax.autorange === 'tozero') {\n ax.autorange = true;\n ax.rangemode = 'tozero';\n }\n\n if(ax.insiderange) delete ax.range;\n\n delete ax.islog;\n delete ax.isdate;\n delete ax.categories; // replaced by _categories\n\n // prune empty domain arrays made before the new nestedProperty\n if(emptyContainer(ax, 'domain')) delete ax.domain;\n\n // autotick -> tickmode\n if(ax.autotick !== undefined) {\n if(ax.tickmode === undefined) {\n ax.tickmode = ax.autotick ? 'auto' : 'linear';\n }\n delete ax.autotick;\n }\n\n cleanTitle(ax);\n } else if(polarAttrRegex && polarAttrRegex.test(key)) {\n // modifications for polar\n\n var polar = layout[key];\n cleanTitle(polar.radialaxis);\n } else if(ternaryAttrRegex && ternaryAttrRegex.test(key)) {\n // modifications for ternary\n\n var ternary = layout[key];\n cleanTitle(ternary.aaxis);\n cleanTitle(ternary.baxis);\n cleanTitle(ternary.caxis);\n } else if(sceneAttrRegex && sceneAttrRegex.test(key)) {\n // modifications for 3D scenes\n\n var scene = layout[key];\n\n // clean old Camera coords\n var cameraposition = scene.cameraposition;\n\n if(Array.isArray(cameraposition) && cameraposition[0].length === 4) {\n var rotation = cameraposition[0];\n var center = cameraposition[1];\n var radius = cameraposition[2];\n var mat = m4FromQuat([], rotation);\n var eye = [];\n\n for(j = 0; j < 3; ++j) {\n eye[j] = center[j] + radius * mat[2 + 4 * j];\n }\n\n scene.camera = {\n eye: {x: eye[0], y: eye[1], z: eye[2]},\n center: {x: center[0], y: center[1], z: center[2]},\n up: {x: 0, y: 0, z: 1} // we just ignore calculating camera z up in this case\n };\n\n delete scene.cameraposition;\n }\n\n // clean axis titles\n cleanTitle(scene.xaxis);\n cleanTitle(scene.yaxis);\n cleanTitle(scene.zaxis);\n }\n }\n\n var annotationsLen = Array.isArray(layout.annotations) ? layout.annotations.length : 0;\n for(i = 0; i < annotationsLen; i++) {\n var ann = layout.annotations[i];\n\n if(!Lib.isPlainObject(ann)) continue;\n\n if(ann.ref) {\n if(ann.ref === 'paper') {\n ann.xref = 'paper';\n ann.yref = 'paper';\n } else if(ann.ref === 'data') {\n ann.xref = 'x';\n ann.yref = 'y';\n }\n delete ann.ref;\n }\n\n cleanAxRef(ann, 'xref');\n cleanAxRef(ann, 'yref');\n }\n\n var shapesLen = Array.isArray(layout.shapes) ? layout.shapes.length : 0;\n for(i = 0; i < shapesLen; i++) {\n var shape = layout.shapes[i];\n\n if(!Lib.isPlainObject(shape)) continue;\n\n cleanAxRef(shape, 'xref');\n cleanAxRef(shape, 'yref');\n }\n\n var imagesLen = Array.isArray(layout.images) ? layout.images.length : 0;\n for(i = 0; i < imagesLen; i++) {\n var image = layout.images[i];\n\n if(!Lib.isPlainObject(image)) continue;\n\n cleanAxRef(image, 'xref');\n cleanAxRef(image, 'yref');\n }\n\n var legend = layout.legend;\n if(legend) {\n // check for old-style legend positioning (x or y is +/- 100)\n if(legend.x > 3) {\n legend.x = 1.02;\n legend.xanchor = 'left';\n } else if(legend.x < -2) {\n legend.x = -0.02;\n legend.xanchor = 'right';\n }\n\n if(legend.y > 3) {\n legend.y = 1.02;\n legend.yanchor = 'bottom';\n } else if(legend.y < -2) {\n legend.y = -0.02;\n legend.yanchor = 'top';\n }\n }\n\n // clean plot title\n cleanTitle(layout);\n\n /*\n * Moved from rotate -> orbit for dragmode\n */\n if(layout.dragmode === 'rotate') layout.dragmode = 'orbit';\n\n // sanitize rgb(fractions) and rgba(fractions) that old tinycolor\n // supported, but new tinycolor does not because they're not valid css\n Color.clean(layout);\n\n // clean the layout container in layout.template\n if(layout.template && layout.template.layout) {\n exports.cleanLayout(layout.template.layout);\n }\n\n return layout;\n};\n\nfunction cleanAxRef(container, attr) {\n var valIn = container[attr];\n var axLetter = attr.charAt(0);\n if(valIn && valIn !== 'paper') {\n container[attr] = cleanId(valIn, axLetter, true);\n }\n}\n\n/**\n * Cleans up old title attribute structure (flat) in favor of the new one (nested).\n *\n * @param {Object} titleContainer - an object potentially including deprecated title attributes\n */\nfunction cleanTitle(titleContainer) {\n if(titleContainer) {\n // title -> title.text\n // (although title used to be a string attribute,\n // numbers are accepted as well)\n if(typeof titleContainer.title === 'string' || typeof titleContainer.title === 'number') {\n titleContainer.title = {\n text: titleContainer.title\n };\n }\n\n rewireAttr('titlefont', 'font');\n rewireAttr('titleposition', 'position');\n rewireAttr('titleside', 'side');\n rewireAttr('titleoffset', 'offset');\n }\n\n function rewireAttr(oldAttrName, newAttrName) {\n var oldAttrSet = titleContainer[oldAttrName];\n var newAttrSet = titleContainer.title && titleContainer.title[newAttrName];\n\n if(oldAttrSet && !newAttrSet) {\n // Ensure title object exists\n if(!titleContainer.title) {\n titleContainer.title = {};\n }\n\n titleContainer.title[newAttrName] = titleContainer[oldAttrName];\n delete titleContainer[oldAttrName];\n }\n }\n}\n\n/*\n * cleanData: Make a few changes to the data for backward compatibility\n * before it gets used for anything. Modifies the data traces users provide.\n *\n * Important: if you're going to add something here that modifies a data array,\n * update it in place so the new array === the old one.\n */\nexports.cleanData = function(data) {\n for(var tracei = 0; tracei < data.length; tracei++) {\n var trace = data[tracei];\n var i;\n\n // use xbins to bin data in x, and ybins to bin data in y\n if(trace.type === 'histogramy' && 'xbins' in trace && !('ybins' in trace)) {\n trace.ybins = trace.xbins;\n delete trace.xbins;\n }\n\n // error_y.opacity is obsolete - merge into color\n if(trace.error_y && 'opacity' in trace.error_y) {\n var dc = Color.defaults;\n var yeColor = trace.error_y.color || (traceIs(trace, 'bar') ?\n Color.defaultLine :\n dc[tracei % dc.length]);\n trace.error_y.color = Color.addOpacity(\n Color.rgb(yeColor),\n Color.opacity(yeColor) * trace.error_y.opacity);\n delete trace.error_y.opacity;\n }\n\n // convert bardir to orientation, and put the data into\n // the axes it's eventually going to be used with\n if('bardir' in trace) {\n if(trace.bardir === 'h' && (traceIs(trace, 'bar') ||\n trace.type.substr(0, 9) === 'histogram')) {\n trace.orientation = 'h';\n exports.swapXYData(trace);\n }\n delete trace.bardir;\n }\n\n // now we have only one 1D histogram type, and whether\n // it uses x or y data depends on trace.orientation\n if(trace.type === 'histogramy') exports.swapXYData(trace);\n if(trace.type === 'histogramx' || trace.type === 'histogramy') {\n trace.type = 'histogram';\n }\n\n // scl->scale, reversescl->reversescale\n if('scl' in trace && !('colorscale' in trace)) {\n trace.colorscale = trace.scl;\n delete trace.scl;\n }\n if('reversescl' in trace && !('reversescale' in trace)) {\n trace.reversescale = trace.reversescl;\n delete trace.reversescl;\n }\n\n // axis ids x1 -> x, y1-> y\n if(trace.xaxis) trace.xaxis = cleanId(trace.xaxis, 'x');\n if(trace.yaxis) trace.yaxis = cleanId(trace.yaxis, 'y');\n\n // scene ids scene1 -> scene\n if(traceIs(trace, 'gl3d') && trace.scene) {\n trace.scene = Plots.subplotsRegistry.gl3d.cleanId(trace.scene);\n }\n\n if(!traceIs(trace, 'pie-like') && !traceIs(trace, 'bar-like')) {\n if(Array.isArray(trace.textposition)) {\n for(i = 0; i < trace.textposition.length; i++) {\n trace.textposition[i] = cleanTextPosition(trace.textposition[i]);\n }\n } else if(trace.textposition) {\n trace.textposition = cleanTextPosition(trace.textposition);\n }\n }\n\n // fix typo in colorscale definition\n var _module = Registry.getModule(trace);\n if(_module && _module.colorbar) {\n var containerName = _module.colorbar.container;\n var container = containerName ? trace[containerName] : trace;\n if(container && container.colorscale) {\n if(container.colorscale === 'YIGnBu') container.colorscale = 'YlGnBu';\n if(container.colorscale === 'YIOrRd') container.colorscale = 'YlOrRd';\n }\n }\n\n // fix typo in surface 'highlight*' definitions\n if(trace.type === 'surface' && Lib.isPlainObject(trace.contours)) {\n var dims = ['x', 'y', 'z'];\n\n for(i = 0; i < dims.length; i++) {\n var opts = trace.contours[dims[i]];\n\n if(!Lib.isPlainObject(opts)) continue;\n\n if(opts.highlightColor) {\n opts.highlightcolor = opts.highlightColor;\n delete opts.highlightColor;\n }\n\n if(opts.highlightWidth) {\n opts.highlightwidth = opts.highlightWidth;\n delete opts.highlightWidth;\n }\n }\n }\n\n // fixes from converting finance from transforms to real trace types\n if(trace.type === 'candlestick' || trace.type === 'ohlc') {\n var increasingShowlegend = (trace.increasing || {}).showlegend !== false;\n var decreasingShowlegend = (trace.decreasing || {}).showlegend !== false;\n var increasingName = cleanFinanceDir(trace.increasing);\n var decreasingName = cleanFinanceDir(trace.decreasing);\n\n // now figure out something smart to do with the separate direction\n // names we removed\n if((increasingName !== false) && (decreasingName !== false)) {\n // both sub-names existed: base name previously had no effect\n // so ignore it and try to find a shared part of the sub-names\n\n var newName = commonPrefix(\n increasingName, decreasingName,\n increasingShowlegend, decreasingShowlegend\n );\n // if no common part, leave whatever name was (or wasn't) there\n if(newName) trace.name = newName;\n } else if((increasingName || decreasingName) && !trace.name) {\n // one sub-name existed but not the base name - just use the sub-name\n trace.name = increasingName || decreasingName;\n }\n }\n\n // transforms backward compatibility fixes\n if(Array.isArray(trace.transforms)) {\n var transforms = trace.transforms;\n\n for(i = 0; i < transforms.length; i++) {\n var transform = transforms[i];\n\n if(!Lib.isPlainObject(transform)) continue;\n\n switch(transform.type) {\n case 'filter':\n if(transform.filtersrc) {\n transform.target = transform.filtersrc;\n delete transform.filtersrc;\n }\n\n if(transform.calendar) {\n if(!transform.valuecalendar) {\n transform.valuecalendar = transform.calendar;\n }\n delete transform.calendar;\n }\n break;\n\n case 'groupby':\n // Name has changed from `style` to `styles`, so use `style` but prefer `styles`:\n transform.styles = transform.styles || transform.style;\n\n if(transform.styles && !Array.isArray(transform.styles)) {\n var prevStyles = transform.styles;\n var styleKeys = Object.keys(prevStyles);\n\n transform.styles = [];\n for(var j = 0; j < styleKeys.length; j++) {\n transform.styles.push({\n target: styleKeys[j],\n value: prevStyles[styleKeys[j]]\n });\n }\n }\n break;\n }\n }\n }\n\n // prune empty containers made before the new nestedProperty\n if(emptyContainer(trace, 'line')) delete trace.line;\n if('marker' in trace) {\n if(emptyContainer(trace.marker, 'line')) delete trace.marker.line;\n if(emptyContainer(trace, 'marker')) delete trace.marker;\n }\n\n // sanitize rgb(fractions) and rgba(fractions) that old tinycolor\n // supported, but new tinycolor does not because they're not valid css\n Color.clean(trace);\n\n // remove obsolete autobin(x|y) attributes, but only if true\n // if false, this needs to happen in Histogram.calc because it\n // can be a one-time autobin so we need to know the results before\n // we can push them back into the trace.\n if(trace.autobinx) {\n delete trace.autobinx;\n delete trace.xbins;\n }\n if(trace.autobiny) {\n delete trace.autobiny;\n delete trace.ybins;\n }\n\n cleanTitle(trace);\n if(trace.colorbar) cleanTitle(trace.colorbar);\n if(trace.marker && trace.marker.colorbar) cleanTitle(trace.marker.colorbar);\n if(trace.line && trace.line.colorbar) cleanTitle(trace.line.colorbar);\n if(trace.aaxis) cleanTitle(trace.aaxis);\n if(trace.baxis) cleanTitle(trace.baxis);\n }\n};\n\nfunction cleanFinanceDir(dirContainer) {\n if(!Lib.isPlainObject(dirContainer)) return false;\n\n var dirName = dirContainer.name;\n\n delete dirContainer.name;\n delete dirContainer.showlegend;\n\n return (typeof dirName === 'string' || typeof dirName === 'number') && String(dirName);\n}\n\nfunction commonPrefix(name1, name2, show1, show2) {\n // if only one is shown in the legend, use that\n if(show1 && !show2) return name1;\n if(show2 && !show1) return name2;\n\n // if both or neither are in the legend, check if one is blank (or whitespace)\n // and use the other one\n // note that hover labels can still use the name even if the legend doesn't\n if(!name1.trim()) return name2;\n if(!name2.trim()) return name1;\n\n var minLen = Math.min(name1.length, name2.length);\n var i;\n for(i = 0; i < minLen; i++) {\n if(name1.charAt(i) !== name2.charAt(i)) break;\n }\n\n var out = name1.substr(0, i);\n return out.trim();\n}\n\n// textposition - support partial attributes (ie just 'top')\n// and incorrect use of middle / center etc.\nfunction cleanTextPosition(textposition) {\n var posY = 'middle';\n var posX = 'center';\n\n if(typeof textposition === 'string') {\n if(textposition.indexOf('top') !== -1) posY = 'top';\n else if(textposition.indexOf('bottom') !== -1) posY = 'bottom';\n\n if(textposition.indexOf('left') !== -1) posX = 'left';\n else if(textposition.indexOf('right') !== -1) posX = 'right';\n }\n\n return posY + ' ' + posX;\n}\n\nfunction emptyContainer(outer, innerStr) {\n return (innerStr in outer) &&\n (typeof outer[innerStr] === 'object') &&\n (Object.keys(outer[innerStr]).length === 0);\n}\n\n\n// swap all the data and data attributes associated with x and y\nexports.swapXYData = function(trace) {\n var i;\n Lib.swapAttrs(trace, ['?', '?0', 'd?', '?bins', 'nbins?', 'autobin?', '?src', 'error_?']);\n if(Array.isArray(trace.z) && Array.isArray(trace.z[0])) {\n if(trace.transpose) delete trace.transpose;\n else trace.transpose = true;\n }\n if(trace.error_x && trace.error_y) {\n var errorY = trace.error_y;\n var copyYstyle = ('copy_ystyle' in errorY) ?\n errorY.copy_ystyle :\n !(errorY.color || errorY.thickness || errorY.width);\n Lib.swapAttrs(trace, ['error_?.copy_ystyle']);\n if(copyYstyle) {\n Lib.swapAttrs(trace, ['error_?.color', 'error_?.thickness', 'error_?.width']);\n }\n }\n if(typeof trace.hoverinfo === 'string') {\n var hoverInfoParts = trace.hoverinfo.split('+');\n for(i = 0; i < hoverInfoParts.length; i++) {\n if(hoverInfoParts[i] === 'x') hoverInfoParts[i] = 'y';\n else if(hoverInfoParts[i] === 'y') hoverInfoParts[i] = 'x';\n }\n trace.hoverinfo = hoverInfoParts.join('+');\n }\n};\n\n// coerce traceIndices input to array of trace indices\nexports.coerceTraceIndices = function(gd, traceIndices) {\n if(isNumeric(traceIndices)) {\n return [traceIndices];\n } else if(!Array.isArray(traceIndices) || !traceIndices.length) {\n return gd.data.map(function(_, i) { return i; });\n } else if(Array.isArray(traceIndices)) {\n var traceIndicesOut = [];\n for(var i = 0; i < traceIndices.length; i++) {\n if(Lib.isIndex(traceIndices[i], gd.data.length)) {\n traceIndicesOut.push(traceIndices[i]);\n } else {\n Lib.warn('trace index (', traceIndices[i], ') is not a number or is out of bounds');\n }\n }\n return traceIndicesOut;\n }\n\n return traceIndices;\n};\n\n/**\n * Manages logic around array container item creation / deletion / update\n * that nested property alone can't handle.\n *\n * @param {Object} np\n * nested property of update attribute string about trace or layout object\n * @param {*} newVal\n * update value passed to restyle / relayout / update\n * @param {Object} undoit\n * undo hash (N.B. undoit may be mutated here).\n *\n */\nexports.manageArrayContainers = function(np, newVal, undoit) {\n var obj = np.obj;\n var parts = np.parts;\n var pLength = parts.length;\n var pLast = parts[pLength - 1];\n\n var pLastIsNumber = isNumeric(pLast);\n\n if(pLastIsNumber && newVal === null) {\n // delete item\n\n // Clear item in array container when new value is null\n var contPath = parts.slice(0, pLength - 1).join('.');\n var cont = Lib.nestedProperty(obj, contPath).get();\n cont.splice(pLast, 1);\n\n // Note that nested property clears null / undefined at end of\n // array container, but not within them.\n } else if(pLastIsNumber && np.get() === undefined) {\n // create item\n\n // When adding a new item, make sure undo command will remove it\n if(np.get() === undefined) undoit[np.astr] = null;\n\n np.set(newVal);\n } else {\n // update item\n\n // If the last part of attribute string isn't a number,\n // np.set is all we need.\n np.set(newVal);\n }\n};\n\n/*\n * Match the part to strip off to turn an attribute into its parent\n * really it should be either '.some_characters' or '[number]'\n * but we're a little more permissive here and match either\n * '.not_brackets_or_dot' or '[not_brackets_or_dot]'\n */\nvar ATTR_TAIL_RE = /(\\.[^\\[\\]\\.]+|\\[[^\\[\\]\\.]+\\])$/;\n\nfunction getParent(attr) {\n var tail = attr.search(ATTR_TAIL_RE);\n if(tail > 0) return attr.substr(0, tail);\n}\n\n/*\n * hasParent: does an attribute object contain a parent of the given attribute?\n * for example, given 'images[2].x' do we also have 'images' or 'images[2]'?\n *\n * @param {Object} aobj\n * update object, whose keys are attribute strings and values are their new settings\n * @param {string} attr\n * the attribute string to test against\n * @returns {Boolean}\n * is a parent of attr present in aobj?\n */\nexports.hasParent = function(aobj, attr) {\n var attrParent = getParent(attr);\n while(attrParent) {\n if(attrParent in aobj) return true;\n attrParent = getParent(attrParent);\n }\n return false;\n};\n\n/**\n * Empty out types for all axes containing these traces so we auto-set them again\n *\n * @param {object} gd\n * @param {[integer]} traces: trace indices to search for axes to clear the types of\n * @param {object} layoutUpdate: any update being done concurrently to the layout,\n * which may supercede clearing the axis types\n */\nvar axLetters = ['x', 'y', 'z'];\nexports.clearAxisTypes = function(gd, traces, layoutUpdate) {\n for(var i = 0; i < traces.length; i++) {\n var trace = gd._fullData[i];\n for(var j = 0; j < 3; j++) {\n var ax = getFromTrace(gd, trace, axLetters[j]);\n\n // do not clear log type - that's never an auto result so must have been intentional\n if(ax && ax.type !== 'log') {\n var axAttr = ax._name;\n var sceneName = ax._id.substr(1);\n if(sceneName.substr(0, 5) === 'scene') {\n if(layoutUpdate[sceneName] !== undefined) continue;\n axAttr = sceneName + '.' + axAttr;\n }\n var typeAttr = axAttr + '.type';\n\n if(layoutUpdate[axAttr] === undefined && layoutUpdate[typeAttr] === undefined) {\n Lib.nestedProperty(gd.layout, typeAttr).set(null);\n }\n }\n }\n }\n};\n","'use strict';\n\nvar Registry = require('../registry');\n\n/*\n * containerArrayMatch: does this attribute string point into a\n * layout container array?\n *\n * @param {String} astr: an attribute string, like *annotations[2].text*\n *\n * @returns {Object | false} Returns false if `astr` doesn't match a container\n * array. If it does, returns:\n * {array: {String}, index: {Number}, property: {String}}\n * ie the attribute string for the array, the index within the array (or ''\n * if the whole array) and the property within that (or '' if the whole array\n * or the whole object)\n */\nmodule.exports = function containerArrayMatch(astr) {\n var rootContainers = Registry.layoutArrayContainers;\n var regexpContainers = Registry.layoutArrayRegexes;\n var rootPart = astr.split('[')[0];\n var arrayStr;\n var match;\n\n // look for regexp matches first, because they may be nested inside root matches\n // eg updatemenus[i].buttons is nested inside updatemenus\n for(var i = 0; i < regexpContainers.length; i++) {\n match = astr.match(regexpContainers[i]);\n if(match && match.index === 0) {\n arrayStr = match[0];\n break;\n }\n }\n\n // now look for root matches\n if(!arrayStr) arrayStr = rootContainers[rootContainers.indexOf(rootPart)];\n\n if(!arrayStr) return false;\n\n var tail = astr.substr(arrayStr.length);\n if(!tail) return {array: arrayStr, index: '', property: ''};\n\n match = tail.match(/^\\[(0|[1-9][0-9]*)\\](\\.(.+))?$/);\n if(!match) return false;\n\n return {array: arrayStr, index: Number(match[1]), property: match[3] || ''};\n};\n","'use strict';\n\n/**\n * This will be transferred over to gd and overridden by\n * config args to Plotly.newPlot.\n *\n * The defaults are the appropriate settings for plotly.js,\n * so we get the right experience without any config argument.\n *\n * N.B. the config options are not coerced using Lib.coerce so keys\n * like `valType` and `values` are only set for documentation purposes\n * at the moment.\n */\n\nvar configAttributes = {\n staticPlot: {\n valType: 'boolean',\n dflt: false,\n description: [\n 'Determines whether the graphs are interactive or not.',\n 'If *false*, no interactivity, for export or image generation.'\n ].join(' ')\n },\n\n typesetMath: {\n valType: 'boolean',\n dflt: true,\n description: [\n 'Determines whether math should be typeset or not,',\n 'when MathJax (either v2 or v3) is present on the page.'\n ].join(' ')\n },\n\n plotlyServerURL: {\n valType: 'string',\n dflt: '',\n description: [\n 'When set it determines base URL for',\n 'the \\'Edit in Chart Studio\\' `showEditInChartStudio`/`showSendToCloud` mode bar button',\n 'and the showLink/sendData on-graph link.',\n 'To enable sending your data to Chart Studio Cloud, you need to',\n 'set both `plotlyServerURL` to \\'https://chart-studio.plotly.com\\' and',\n 'also set `showSendToCloud` to true.'\n ].join(' ')\n },\n\n editable: {\n valType: 'boolean',\n dflt: false,\n description: [\n 'Determines whether the graph is editable or not.',\n 'Sets all pieces of `edits`',\n 'unless a separate `edits` config item overrides individual parts.'\n ].join(' ')\n },\n edits: {\n annotationPosition: {\n valType: 'boolean',\n dflt: false,\n description: [\n 'Determines if the main anchor of the annotation is editable.',\n 'The main anchor corresponds to the',\n 'text (if no arrow) or the arrow (which drags the whole thing leaving',\n 'the arrow length & direction unchanged).'\n ].join(' ')\n },\n annotationTail: {\n valType: 'boolean',\n dflt: false,\n description: [\n 'Has only an effect for annotations with arrows.',\n 'Enables changing the length and direction of the arrow.'\n ].join(' ')\n },\n annotationText: {\n valType: 'boolean',\n dflt: false,\n description: 'Enables editing annotation text.'\n },\n axisTitleText: {\n valType: 'boolean',\n dflt: false,\n description: 'Enables editing axis title text.'\n },\n colorbarPosition: {\n valType: 'boolean',\n dflt: false,\n description: 'Enables moving colorbars.'\n },\n colorbarTitleText: {\n valType: 'boolean',\n dflt: false,\n description: 'Enables editing colorbar title text.'\n },\n legendPosition: {\n valType: 'boolean',\n dflt: false,\n description: 'Enables moving the legend.'\n },\n legendText: {\n valType: 'boolean',\n dflt: false,\n description: 'Enables editing the trace name fields from the legend'\n },\n shapePosition: {\n valType: 'boolean',\n dflt: false,\n description: 'Enables moving shapes.'\n },\n titleText: {\n valType: 'boolean',\n dflt: false,\n description: 'Enables editing the global layout title.'\n }\n },\n\n editSelection: {\n valType: 'boolean',\n dflt: true,\n description: 'Enables moving selections.'\n },\n\n autosizable: {\n valType: 'boolean',\n dflt: false,\n description: [\n 'Determines whether the graphs are plotted with respect to',\n 'layout.autosize:true and infer its container size.'\n ].join(' ')\n },\n responsive: {\n valType: 'boolean',\n dflt: false,\n description: [\n 'Determines whether to change the layout size when window is resized.',\n 'In v3, this option will be removed and will always be true.'\n ].join(' ')\n },\n fillFrame: {\n valType: 'boolean',\n dflt: false,\n description: [\n 'When `layout.autosize` is turned on, determines whether the graph',\n 'fills the container (the default) or the screen (if set to *true*).'\n ].join(' ')\n },\n frameMargins: {\n valType: 'number',\n dflt: 0,\n min: 0,\n max: 0.5,\n description: [\n 'When `layout.autosize` is turned on, set the frame margins',\n 'in fraction of the graph size.'\n ].join(' ')\n },\n\n scrollZoom: {\n valType: 'flaglist',\n flags: ['cartesian', 'gl3d', 'geo', 'mapbox'],\n extras: [true, false],\n dflt: 'gl3d+geo+mapbox',\n description: [\n 'Determines whether mouse wheel or two-finger scroll zooms is enable.',\n 'Turned on by default for gl3d, geo and mapbox subplots',\n '(as these subplot types do not have zoombox via pan),',\n 'but turned off by default for cartesian subplots.',\n 'Set `scrollZoom` to *false* to disable scrolling for all subplots.'\n ].join(' ')\n },\n doubleClick: {\n valType: 'enumerated',\n values: [false, 'reset', 'autosize', 'reset+autosize'],\n dflt: 'reset+autosize',\n description: [\n 'Sets the double click interaction mode.',\n 'Has an effect only in cartesian plots.',\n 'If *false*, double click is disable.',\n 'If *reset*, double click resets the axis ranges to their initial values.',\n 'If *autosize*, double click set the axis ranges to their autorange values.',\n 'If *reset+autosize*, the odd double clicks resets the axis ranges',\n 'to their initial values and even double clicks set the axis ranges',\n 'to their autorange values.'\n ].join(' ')\n },\n doubleClickDelay: {\n valType: 'number',\n dflt: 300,\n min: 0,\n description: [\n 'Sets the delay for registering a double-click in ms.',\n 'This is the time interval (in ms) between first mousedown and',\n '2nd mouseup to constitute a double-click.',\n 'This setting propagates to all on-subplot double clicks',\n '(except for geo and mapbox) and on-legend double clicks.'\n ].join(' ')\n },\n\n showAxisDragHandles: {\n valType: 'boolean',\n dflt: true,\n description: [\n 'Set to *false* to omit cartesian axis pan/zoom drag handles.'\n ].join(' ')\n },\n showAxisRangeEntryBoxes: {\n valType: 'boolean',\n dflt: true,\n description: [\n 'Set to *false* to omit direct range entry at the pan/zoom drag points,',\n 'note that `showAxisDragHandles` must be enabled to have an effect.'\n ].join(' ')\n },\n\n showTips: {\n valType: 'boolean',\n dflt: true,\n description: [\n 'Determines whether or not tips are shown while interacting',\n 'with the resulting graphs.'\n ].join(' ')\n },\n\n showLink: {\n valType: 'boolean',\n dflt: false,\n description: [\n 'Determines whether a link to Chart Studio Cloud is displayed',\n 'at the bottom right corner of resulting graphs.',\n 'Use with `sendData` and `linkText`.'\n ].join(' ')\n },\n linkText: {\n valType: 'string',\n dflt: 'Edit chart',\n noBlank: true,\n description: [\n 'Sets the text appearing in the `showLink` link.'\n ].join(' ')\n },\n sendData: {\n valType: 'boolean',\n dflt: true,\n description: [\n 'If *showLink* is true, does it contain data',\n 'just link to a Chart Studio Cloud file?'\n ].join(' ')\n },\n showSources: {\n valType: 'any',\n dflt: false,\n description: [\n 'Adds a source-displaying function to show sources on',\n 'the resulting graphs.'\n ].join(' ')\n },\n\n displayModeBar: {\n valType: 'enumerated',\n values: ['hover', true, false],\n dflt: 'hover',\n description: [\n 'Determines the mode bar display mode.',\n 'If *true*, the mode bar is always visible.',\n 'If *false*, the mode bar is always hidden.',\n 'If *hover*, the mode bar is visible while the mouse cursor',\n 'is on the graph container.'\n ].join(' ')\n },\n showSendToCloud: {\n valType: 'boolean',\n dflt: false,\n description: [\n 'Should we include a ModeBar button, labeled \"Edit in Chart Studio\",',\n 'that sends this chart to chart-studio.plotly.com (formerly plot.ly) or another plotly server',\n 'as specified by `plotlyServerURL` for editing, export, etc? Prior to version 1.43.0',\n 'this button was included by default, now it is opt-in using this flag.',\n 'Note that this button can (depending on `plotlyServerURL` being set) send your data',\n 'to an external server. However that server does not persist your data',\n 'until you arrive at the Chart Studio and explicitly click \"Save\".'\n ].join(' ')\n },\n showEditInChartStudio: {\n valType: 'boolean',\n dflt: false,\n description: [\n 'Same as `showSendToCloud`, but use a pencil icon instead of a floppy-disk.',\n 'Note that if both `showSendToCloud` and `showEditInChartStudio` are turned,',\n 'only `showEditInChartStudio` will be honored.'\n ].join(' ')\n },\n modeBarButtonsToRemove: {\n valType: 'any',\n dflt: [],\n description: [\n 'Remove mode bar buttons by name.',\n 'See ./components/modebar/buttons.js for the list of names.'\n ].join(' ')\n },\n modeBarButtonsToAdd: {\n valType: 'any',\n dflt: [],\n description: [\n 'Add mode bar button using config objects',\n 'See ./components/modebar/buttons.js for list of arguments.',\n 'To enable predefined modebar buttons e.g. shape drawing, hover and spikelines,',\n 'simply provide their string name(s). This could include:',\n '*v1hovermode*, *hoverclosest*, *hovercompare*, *togglehover*, *togglespikelines*,',\n '*drawline*, *drawopenpath*, *drawclosedpath*, *drawcircle*, *drawrect* and *eraseshape*.',\n 'Please note that these predefined buttons will only be shown if they are compatible',\n 'with all trace types used in a graph.'\n ].join(' ')\n },\n modeBarButtons: {\n valType: 'any',\n dflt: false,\n description: [\n 'Define fully custom mode bar buttons as nested array,',\n 'where the outer arrays represents button groups, and',\n 'the inner arrays have buttons config objects or names of default buttons',\n 'See ./components/modebar/buttons.js for more info.'\n ].join(' ')\n },\n toImageButtonOptions: {\n valType: 'any',\n dflt: {},\n description: [\n 'Statically override options for toImage modebar button',\n 'allowed keys are format, filename, width, height, scale',\n 'see ../components/modebar/buttons.js'\n ].join(' ')\n },\n displaylogo: {\n valType: 'boolean',\n dflt: true,\n description: [\n 'Determines whether or not the plotly logo is displayed',\n 'on the end of the mode bar.'\n ].join(' ')\n },\n watermark: {\n valType: 'boolean',\n dflt: false,\n description: 'watermark the images with the company\\'s logo'\n },\n\n plotGlPixelRatio: {\n valType: 'number',\n dflt: 2,\n min: 1,\n max: 4,\n description: [\n 'Set the pixel ratio during WebGL image export.',\n 'This config option was formerly named `plot3dPixelRatio`',\n 'which is now deprecated.'\n ].join(' ')\n },\n\n setBackground: {\n valType: 'any',\n dflt: 'transparent',\n description: [\n 'Set function to add the background color (i.e. `layout.paper_color`)',\n 'to a different container.',\n 'This function take the graph div as first argument and the current background',\n 'color as second argument.',\n 'Alternatively, set to string *opaque* to ensure there is white behind it.'\n ].join(' ')\n },\n\n topojsonURL: {\n valType: 'string',\n noBlank: true,\n dflt: 'https://cdn.plot.ly/',\n description: [\n 'Set the URL to topojson used in geo charts.',\n 'By default, the topojson files are fetched from cdn.plot.ly.',\n 'For example, set this option to:',\n '/dist/topojson/',\n 'to render geographical feature using the topojson files',\n 'that ship with the plotly.js module.'\n ].join(' ')\n },\n\n mapboxAccessToken: {\n valType: 'string',\n dflt: null,\n description: [\n 'Mapbox access token (required to plot mapbox trace types)',\n 'If using an Mapbox Atlas server, set this option to \\'\\'',\n 'so that plotly.js won\\'t attempt to authenticate to the public Mapbox server.'\n ].join(' ')\n },\n\n logging: {\n valType: 'integer',\n min: 0,\n max: 2,\n dflt: 1,\n description: [\n 'Turn all console logging on or off (errors will be thrown)',\n 'This should ONLY be set via Plotly.setPlotConfig',\n 'Available levels:',\n '0: no logs',\n '1: warnings and errors, but not informational messages',\n '2: verbose logs'\n ].join(' ')\n },\n\n notifyOnLogging: {\n valType: 'integer',\n min: 0,\n max: 2,\n dflt: 0,\n description: [\n 'Set on-graph logging (notifier) level',\n 'This should ONLY be set via Plotly.setPlotConfig',\n 'Available levels:',\n '0: no on-graph logs',\n '1: warnings and errors, but not informational messages',\n '2: verbose logs'\n ].join(' ')\n },\n\n queueLength: {\n valType: 'integer',\n min: 0,\n dflt: 0,\n description: 'Sets the length of the undo/redo queue.'\n },\n\n globalTransforms: {\n valType: 'any',\n dflt: [],\n description: [\n 'Set global transform to be applied to all traces with no',\n 'specification needed'\n ].join(' ')\n },\n\n locale: {\n valType: 'string',\n dflt: 'en-US',\n description: [\n 'Which localization should we use?',\n 'Should be a string like \\'en\\' or \\'en-US\\'.'\n ].join(' ')\n },\n\n locales: {\n valType: 'any',\n dflt: {},\n description: [\n 'Localization definitions',\n 'Locales can be provided either here (specific to one chart) or globally',\n 'by registering them as modules.',\n 'Should be an object of objects {locale: {dictionary: {...}, format: {...}}}',\n '{',\n ' da: {',\n ' dictionary: {\\'Reset axes\\': \\'Nulstil aksler\\', ...},',\n ' format: {months: [...], shortMonths: [...]}',\n ' },',\n ' ...',\n '}',\n 'All parts are optional. When looking for translation or format fields, we',\n 'look first for an exact match in a config locale, then in a registered',\n 'module. If those fail, we strip off any regionalization (\\'en-US\\' -> \\'en\\')',\n 'and try each (config, registry) again. The final fallback for translation',\n 'is untranslated (which is US English) and for formats is the base English',\n '(the only consequence being the last fallback date format %x is DD/MM/YYYY',\n 'instead of MM/DD/YYYY). Currently `grouping` and `currency` are ignored',\n 'for our automatic number formatting, but can be used in custom formats.'\n ].join(' ')\n }\n};\n\nvar dfltConfig = {};\n\nfunction crawl(src, target) {\n for(var k in src) {\n var obj = src[k];\n if(obj.valType) {\n target[k] = obj.dflt;\n } else {\n if(!target[k]) {\n target[k] = {};\n }\n crawl(obj, target[k]);\n }\n }\n}\n\ncrawl(configAttributes, dfltConfig);\n\nmodule.exports = {\n configAttributes: configAttributes,\n dfltConfig: dfltConfig\n};\n","'use strict';\n\nvar main = require('./plot_api');\n\nexports._doPlot = main._doPlot;\nexports.newPlot = main.newPlot;\nexports.restyle = main.restyle;\nexports.relayout = main.relayout;\nexports.redraw = main.redraw;\nexports.update = main.update;\nexports._guiRestyle = main._guiRestyle;\nexports._guiRelayout = main._guiRelayout;\nexports._guiUpdate = main._guiUpdate;\nexports._storeDirectGUIEdit = main._storeDirectGUIEdit;\nexports.react = main.react;\nexports.extendTraces = main.extendTraces;\nexports.prependTraces = main.prependTraces;\nexports.addTraces = main.addTraces;\nexports.deleteTraces = main.deleteTraces;\nexports.moveTraces = main.moveTraces;\nexports.purge = main.purge;\nexports.addFrames = main.addFrames;\nexports.deleteFrames = main.deleteFrames;\nexports.animate = main.animate;\nexports.setPlotConfig = main.setPlotConfig;\n\nvar getGraphDiv = require('../lib/dom').getGraphDiv;\nvar eraseActiveShape = require('../components/shapes/draw').eraseActiveShape;\nexports.deleteActiveShape = function(gd) {\n return eraseActiveShape(getGraphDiv(gd));\n};\n\nexports.toImage = require('./to_image');\nexports.validate = require('./validate');\nexports.downloadImage = require('../snapshot/download');\n\nvar templateApi = require('./template_api');\nexports.makeTemplate = templateApi.makeTemplate;\nexports.validateTemplate = templateApi.validateTemplate;\n","'use strict';\n\nvar Registry = require('../registry');\nvar Lib = require('../lib');\n\nvar baseAttributes = require('../plots/attributes');\nvar baseLayoutAttributes = require('../plots/layout_attributes');\nvar frameAttributes = require('../plots/frame_attributes');\nvar animationAttributes = require('../plots/animation_attributes');\nvar configAttributes = require('./plot_config').configAttributes;\n\nvar editTypes = require('./edit_types');\n\nvar extendDeepAll = Lib.extendDeepAll;\nvar isPlainObject = Lib.isPlainObject;\nvar isArrayOrTypedArray = Lib.isArrayOrTypedArray;\nvar nestedProperty = Lib.nestedProperty;\nvar valObjectMeta = Lib.valObjectMeta;\n\nvar IS_SUBPLOT_OBJ = '_isSubplotObj';\nvar IS_LINKED_TO_ARRAY = '_isLinkedToArray';\nvar ARRAY_ATTR_REGEXPS = '_arrayAttrRegexps';\nvar DEPRECATED = '_deprecated';\nvar UNDERSCORE_ATTRS = [IS_SUBPLOT_OBJ, IS_LINKED_TO_ARRAY, ARRAY_ATTR_REGEXPS, DEPRECATED];\n\nexports.IS_SUBPLOT_OBJ = IS_SUBPLOT_OBJ;\nexports.IS_LINKED_TO_ARRAY = IS_LINKED_TO_ARRAY;\nexports.DEPRECATED = DEPRECATED;\nexports.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS;\n\n/** Outputs the full plotly.js plot schema\n *\n * @return {object}\n * - defs\n * - traces\n * - layout\n * - transforms\n * - frames\n * - animations\n * - config\n */\nexports.get = function() {\n var traces = {};\n\n Registry.allTypes.forEach(function(type) {\n traces[type] = getTraceAttributes(type);\n });\n\n var transforms = {};\n\n Object.keys(Registry.transformsRegistry).forEach(function(type) {\n transforms[type] = getTransformAttributes(type);\n });\n\n return {\n defs: {\n valObjects: valObjectMeta,\n metaKeys: UNDERSCORE_ATTRS.concat(['description', 'role', 'editType', 'impliedEdits']),\n editType: {\n traces: editTypes.traces,\n layout: editTypes.layout\n },\n impliedEdits: {\n description: [\n 'Sometimes when an attribute is changed, other attributes',\n 'must be altered as well in order to achieve the intended',\n 'result. For example, when `range` is specified, it is',\n 'important to set `autorange` to `false` or the new `range`',\n 'value would be lost in the redraw. `impliedEdits` is the',\n 'mechanism to do this: `impliedEdits: {autorange: false}`.',\n 'Each key is a relative paths to the attribute string to',\n 'change, using *^* to ascend into the parent container,',\n 'for example `range[0]` has `impliedEdits: {*^autorange*: false}`.',\n 'A value of `undefined` means that the attribute will not be',\n 'changed, but its previous value should be recorded in case',\n 'we want to reverse this change later. For example, `autorange`',\n 'has `impliedEdits: {*range[0]*: undefined, *range[1]*:undefined}',\n 'because the range will likely be changed by redraw.'\n ].join(' ')\n }\n },\n\n traces: traces,\n layout: getLayoutAttributes(),\n\n transforms: transforms,\n\n frames: getFramesAttributes(),\n animation: formatAttributes(animationAttributes),\n\n config: formatAttributes(configAttributes)\n };\n};\n\n/**\n * Crawl the attribute tree, recursively calling a callback function\n *\n * @param {object} attrs\n * The node of the attribute tree (e.g. the root) from which recursion originates\n * @param {Function} callback\n * A callback function with the signature:\n * @callback callback\n * @param {object} attr an attribute\n * @param {String} attrName name string\n * @param {object[]} attrs all the attributes\n * @param {Number} level the recursion level, 0 at the root\n * @param {String} fullAttrString full attribute name (ie 'marker.line')\n * @param {Number} [specifiedLevel]\n * The level in the tree, in order to let the callback function detect descend or backtrack,\n * typically unsupplied (implied 0), just used by the self-recursive call.\n * The necessity arises because the tree traversal is not controlled by callback return values.\n * The decision to not use callback return values for controlling tree pruning arose from\n * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions\n * precedes the callback call.\n * @param {string} [attrString]\n * the path to the current attribute, as an attribute string (ie 'marker.line')\n * typically unsupplied, but you may supply it if you want to disambiguate which attrs tree you\n * are starting from\n *\n * @return {object} transformOut\n * copy of transformIn that contains attribute defaults\n */\nexports.crawl = function(attrs, callback, specifiedLevel, attrString) {\n var level = specifiedLevel || 0;\n attrString = attrString || '';\n\n Object.keys(attrs).forEach(function(attrName) {\n var attr = attrs[attrName];\n\n if(UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return;\n\n var fullAttrString = (attrString ? attrString + '.' : '') + attrName;\n callback(attr, attrName, attrs, level, fullAttrString);\n\n if(exports.isValObject(attr)) return;\n\n if(isPlainObject(attr) && attrName !== 'impliedEdits') {\n exports.crawl(attr, callback, level + 1, fullAttrString);\n }\n });\n};\n\n/** Is object a value object (or a container object)?\n *\n * @param {object} obj\n * @return {boolean}\n * returns true for a valid value object and\n * false for tree nodes in the attribute hierarchy\n */\nexports.isValObject = function(obj) {\n return obj && obj.valType !== undefined;\n};\n\n/**\n * Find all data array attributes in a given trace object - including\n * `arrayOk` attributes.\n *\n * @param {object} trace\n * full trace object that contains a reference to `_module.attributes`\n *\n * @return {array} arrayAttributes\n * list of array attributes for the given trace\n */\nexports.findArrayAttributes = function(trace) {\n var arrayAttributes = [];\n var stack = [];\n var isArrayStack = [];\n var baseContainer, baseAttrName;\n\n function callback(attr, attrName, attrs, level) {\n stack = stack.slice(0, level).concat([attrName]);\n isArrayStack = isArrayStack.slice(0, level).concat([attr && attr._isLinkedToArray]);\n\n var splittableAttr = (\n attr &&\n (attr.valType === 'data_array' || attr.arrayOk === true) &&\n !(stack[level - 1] === 'colorbar' && (attrName === 'ticktext' || attrName === 'tickvals'))\n );\n\n // Manually exclude 'colorbar.tickvals' and 'colorbar.ticktext' for now\n // which are declared as `valType: 'data_array'` but scale independently of\n // the coordinate arrays.\n //\n // Down the road, we might want to add a schema field (e.g `uncorrelatedArray: true`)\n // to distinguish attributes of the likes.\n\n if(!splittableAttr) return;\n\n crawlIntoTrace(baseContainer, 0, '');\n }\n\n function crawlIntoTrace(container, i, astrPartial) {\n var item = container[stack[i]];\n var newAstrPartial = astrPartial + stack[i];\n if(i === stack.length - 1) {\n if(isArrayOrTypedArray(item)) {\n arrayAttributes.push(baseAttrName + newAstrPartial);\n }\n } else {\n if(isArrayStack[i]) {\n if(Array.isArray(item)) {\n for(var j = 0; j < item.length; j++) {\n if(isPlainObject(item[j])) {\n crawlIntoTrace(item[j], i + 1, newAstrPartial + '[' + j + '].');\n }\n }\n }\n } else if(isPlainObject(item)) {\n crawlIntoTrace(item, i + 1, newAstrPartial + '.');\n }\n }\n }\n\n baseContainer = trace;\n baseAttrName = '';\n exports.crawl(baseAttributes, callback);\n if(trace._module && trace._module.attributes) {\n exports.crawl(trace._module.attributes, callback);\n }\n\n var transforms = trace.transforms;\n if(transforms) {\n for(var i = 0; i < transforms.length; i++) {\n var transform = transforms[i];\n var module = transform._module;\n\n if(module) {\n baseAttrName = 'transforms[' + i + '].';\n baseContainer = transform;\n\n exports.crawl(module.attributes, callback);\n }\n }\n }\n\n return arrayAttributes;\n};\n\n/*\n * Find the valObject for one attribute in an existing trace\n *\n * @param {object} trace\n * full trace object that contains a reference to `_module.attributes`\n * @param {object} parts\n * an array of parts, like ['transforms', 1, 'value']\n * typically from nestedProperty(...).parts\n *\n * @return {object|false}\n * the valObject for this attribute, or the last found parent\n * in some cases the innermost valObject will not exist, for example\n * `valType: 'any'` attributes where we might set a part of the attribute.\n * In that case, stop at the deepest valObject we *do* find.\n */\nexports.getTraceValObject = function(trace, parts) {\n var head = parts[0];\n var i = 1; // index to start recursing from\n var moduleAttrs, valObject;\n\n if(head === 'transforms') {\n if(parts.length === 1) {\n return baseAttributes.transforms;\n }\n var transforms = trace.transforms;\n if(!Array.isArray(transforms) || !transforms.length) return false;\n var tNum = parts[1];\n if(!isIndex(tNum) || tNum >= transforms.length) {\n return false;\n }\n moduleAttrs = (Registry.transformsRegistry[transforms[tNum].type] || {}).attributes;\n valObject = moduleAttrs && moduleAttrs[parts[2]];\n i = 3; // start recursing only inside the transform\n } else {\n // first look in the module for this trace\n // components have already merged their trace attributes in here\n var _module = trace._module;\n if(!_module) _module = (Registry.modules[trace.type || baseAttributes.type.dflt] || {})._module;\n if(!_module) return false;\n\n moduleAttrs = _module.attributes;\n valObject = moduleAttrs && moduleAttrs[head];\n\n // then look in the subplot attributes\n if(!valObject) {\n var subplotModule = _module.basePlotModule;\n if(subplotModule && subplotModule.attributes) {\n valObject = subplotModule.attributes[head];\n }\n }\n\n // finally look in the global attributes\n if(!valObject) valObject = baseAttributes[head];\n }\n\n return recurseIntoValObject(valObject, parts, i);\n};\n\n/*\n * Find the valObject for one layout attribute\n *\n * @param {array} parts\n * an array of parts, like ['annotations', 1, 'x']\n * typically from nestedProperty(...).parts\n *\n * @return {object|false}\n * the valObject for this attribute, or the last found parent\n * in some cases the innermost valObject will not exist, for example\n * `valType: 'any'` attributes where we might set a part of the attribute.\n * In that case, stop at the deepest valObject we *do* find.\n */\nexports.getLayoutValObject = function(fullLayout, parts) {\n var valObject = layoutHeadAttr(fullLayout, parts[0]);\n\n return recurseIntoValObject(valObject, parts, 1);\n};\n\nfunction layoutHeadAttr(fullLayout, head) {\n var i, key, _module, attributes;\n\n // look for attributes of the subplot types used on the plot\n var basePlotModules = fullLayout._basePlotModules;\n if(basePlotModules) {\n var out;\n for(i = 0; i < basePlotModules.length; i++) {\n _module = basePlotModules[i];\n if(_module.attrRegex && _module.attrRegex.test(head)) {\n // if a module defines overrides, these take precedence\n // initially this is to allow gl2d different editTypes from svg cartesian\n if(_module.layoutAttrOverrides) return _module.layoutAttrOverrides;\n\n // otherwise take the first attributes we find\n if(!out && _module.layoutAttributes) out = _module.layoutAttributes;\n }\n\n // a module can also override the behavior of base (and component) module layout attrs\n // again see gl2d for initial use case\n var baseOverrides = _module.baseLayoutAttrOverrides;\n if(baseOverrides && head in baseOverrides) return baseOverrides[head];\n }\n if(out) return out;\n }\n\n // look for layout attributes contributed by traces on the plot\n var modules = fullLayout._modules;\n if(modules) {\n for(i = 0; i < modules.length; i++) {\n attributes = modules[i].layoutAttributes;\n if(attributes && head in attributes) {\n return attributes[head];\n }\n }\n }\n\n /*\n * Next look in components.\n * Components that define a schema have already merged this into\n * base and subplot attribute defs, so ignore these.\n * Others (older style) all put all their attributes\n * inside a container matching the module `name`\n * eg `attributes` (array) or `legend` (object)\n */\n for(key in Registry.componentsRegistry) {\n _module = Registry.componentsRegistry[key];\n if(_module.name === 'colorscale' && head.indexOf('coloraxis') === 0) {\n return _module.layoutAttributes[head];\n } else if(!_module.schema && (head === _module.name)) {\n return _module.layoutAttributes;\n }\n }\n\n if(head in baseLayoutAttributes) return baseLayoutAttributes[head];\n\n return false;\n}\n\nfunction recurseIntoValObject(valObject, parts, i) {\n if(!valObject) return false;\n\n if(valObject._isLinkedToArray) {\n // skip array index, abort if we try to dive into an array without an index\n if(isIndex(parts[i])) i++;\n else if(i < parts.length) return false;\n }\n\n // now recurse as far as we can. Occasionally we have an attribute\n // setting an internal part below what's in the schema; just return\n // the innermost schema item we find.\n for(; i < parts.length; i++) {\n var newValObject = valObject[parts[i]];\n if(isPlainObject(newValObject)) valObject = newValObject;\n else break;\n\n if(i === parts.length - 1) break;\n\n if(valObject._isLinkedToArray) {\n i++;\n if(!isIndex(parts[i])) return false;\n } else if(valObject.valType === 'info_array') {\n i++;\n var index = parts[i];\n if(!isIndex(index)) return false;\n\n var items = valObject.items;\n if(Array.isArray(items)) {\n if(index >= items.length) return false;\n if(valObject.dimensions === 2) {\n i++;\n if(parts.length === i) return valObject;\n var index2 = parts[i];\n if(!isIndex(index2)) return false;\n valObject = items[index][index2];\n } else valObject = items[index];\n } else {\n valObject = items;\n }\n }\n }\n\n return valObject;\n}\n\n// note: this is different from Lib.isIndex, this one doesn't accept numeric\n// strings, only actual numbers.\nfunction isIndex(val) {\n return val === Math.round(val) && val >= 0;\n}\n\nfunction getTraceAttributes(type) {\n var _module, basePlotModule;\n\n _module = Registry.modules[type]._module,\n basePlotModule = _module.basePlotModule;\n\n var attributes = {};\n\n // make 'type' the first attribute in the object\n attributes.type = null;\n\n var copyBaseAttributes = extendDeepAll({}, baseAttributes);\n var copyModuleAttributes = extendDeepAll({}, _module.attributes);\n\n // prune global-level trace attributes that are already defined in a trace\n exports.crawl(copyModuleAttributes, function(attr, attrName, attrs, level, fullAttrString) {\n nestedProperty(copyBaseAttributes, fullAttrString).set(undefined);\n // Prune undefined attributes\n if(attr === undefined) nestedProperty(copyModuleAttributes, fullAttrString).set(undefined);\n });\n\n // base attributes (same for all trace types)\n extendDeepAll(attributes, copyBaseAttributes);\n\n // prune-out base attributes based on trace module categories\n if(Registry.traceIs(type, 'noOpacity')) {\n delete attributes.opacity;\n }\n if(!Registry.traceIs(type, 'showLegend')) {\n delete attributes.showlegend;\n delete attributes.legendgroup;\n }\n if(Registry.traceIs(type, 'noHover')) {\n delete attributes.hoverinfo;\n delete attributes.hoverlabel;\n }\n if(!_module.selectPoints) {\n delete attributes.selectedpoints;\n }\n\n // module attributes\n extendDeepAll(attributes, copyModuleAttributes);\n\n // subplot attributes\n if(basePlotModule.attributes) {\n extendDeepAll(attributes, basePlotModule.attributes);\n }\n\n // 'type' gets overwritten by baseAttributes; reset it here\n attributes.type = type;\n\n var out = {\n meta: _module.meta || {},\n categories: _module.categories || {},\n animatable: Boolean(_module.animatable),\n type: type,\n attributes: formatAttributes(attributes),\n };\n\n // trace-specific layout attributes\n if(_module.layoutAttributes) {\n var layoutAttributes = {};\n\n extendDeepAll(layoutAttributes, _module.layoutAttributes);\n out.layoutAttributes = formatAttributes(layoutAttributes);\n }\n\n // drop anim:true in non-animatable modules\n if(!_module.animatable) {\n exports.crawl(out, function(attr) {\n if(exports.isValObject(attr) && 'anim' in attr) {\n delete attr.anim;\n }\n });\n }\n\n return out;\n}\n\nfunction getLayoutAttributes() {\n var layoutAttributes = {};\n var key, _module;\n\n // global layout attributes\n extendDeepAll(layoutAttributes, baseLayoutAttributes);\n\n // add base plot module layout attributes\n for(key in Registry.subplotsRegistry) {\n _module = Registry.subplotsRegistry[key];\n\n if(!_module.layoutAttributes) continue;\n\n if(Array.isArray(_module.attr)) {\n for(var i = 0; i < _module.attr.length; i++) {\n handleBasePlotModule(layoutAttributes, _module, _module.attr[i]);\n }\n } else {\n var astr = _module.attr === 'subplot' ? _module.name : _module.attr;\n handleBasePlotModule(layoutAttributes, _module, astr);\n }\n }\n\n // add registered components layout attributes\n for(key in Registry.componentsRegistry) {\n _module = Registry.componentsRegistry[key];\n var schema = _module.schema;\n\n if(schema && (schema.subplots || schema.layout)) {\n /*\n * Components with defined schema have already been merged in at register time\n * but a few components define attributes that apply only to xaxis\n * not yaxis (rangeselector, rangeslider) - delete from y schema.\n * Note that the input attributes for xaxis/yaxis are the same object\n * so it's not possible to only add them to xaxis from the start.\n * If we ever have such asymmetry the other way, or anywhere else,\n * we will need to extend both this code and mergeComponentAttrsToSubplot\n * (which will not find yaxis only for example)\n */\n var subplots = schema.subplots;\n if(subplots && subplots.xaxis && !subplots.yaxis) {\n for(var xkey in subplots.xaxis) {\n delete layoutAttributes.yaxis[xkey];\n }\n }\n\n /*\n * Also some attributes e.g. shift & autoshift only implemented on the yaxis\n * at the moment. Remove them from the xaxis.\n */\n delete layoutAttributes.xaxis.shift;\n delete layoutAttributes.xaxis.autoshift;\n } else if(_module.name === 'colorscale') {\n extendDeepAll(layoutAttributes, _module.layoutAttributes);\n } else if(_module.layoutAttributes) {\n // older style without schema need to be explicitly merged in now\n insertAttrs(layoutAttributes, _module.layoutAttributes, _module.name);\n }\n }\n\n return {\n layoutAttributes: formatAttributes(layoutAttributes)\n };\n}\n\nfunction getTransformAttributes(type) {\n var _module = Registry.transformsRegistry[type];\n var attributes = extendDeepAll({}, _module.attributes);\n\n // add registered components transform attributes\n Object.keys(Registry.componentsRegistry).forEach(function(k) {\n var _module = Registry.componentsRegistry[k];\n\n if(_module.schema && _module.schema.transforms && _module.schema.transforms[type]) {\n Object.keys(_module.schema.transforms[type]).forEach(function(v) {\n insertAttrs(attributes, _module.schema.transforms[type][v], v);\n });\n }\n });\n\n return {\n attributes: formatAttributes(attributes)\n };\n}\n\nfunction getFramesAttributes() {\n var attrs = {\n frames: extendDeepAll({}, frameAttributes)\n };\n\n formatAttributes(attrs);\n\n return attrs.frames;\n}\n\nfunction formatAttributes(attrs) {\n mergeValTypeAndRole(attrs);\n formatArrayContainers(attrs);\n stringify(attrs);\n\n return attrs;\n}\n\nfunction mergeValTypeAndRole(attrs) {\n function makeSrcAttr(attrName) {\n return {\n valType: 'string',\n description: 'Sets the source reference on Chart Studio Cloud for `' + attrName + '`.',\n editType: 'none'\n };\n }\n\n function callback(attr, attrName, attrs) {\n if(exports.isValObject(attr)) {\n if(attr.arrayOk === true || attr.valType === 'data_array') {\n // all 'arrayOk' and 'data_array' attrs have a corresponding 'src' attr\n attrs[attrName + 'src'] = makeSrcAttr(attrName);\n }\n } else if(isPlainObject(attr)) {\n // all attrs container objects get role 'object'\n attr.role = 'object';\n }\n }\n\n exports.crawl(attrs, callback);\n}\n\nfunction formatArrayContainers(attrs) {\n function callback(attr, attrName, attrs) {\n if(!attr) return;\n\n var itemName = attr[IS_LINKED_TO_ARRAY];\n\n if(!itemName) return;\n\n delete attr[IS_LINKED_TO_ARRAY];\n\n attrs[attrName] = { items: {} };\n attrs[attrName].items[itemName] = attr;\n attrs[attrName].role = 'object';\n }\n\n exports.crawl(attrs, callback);\n}\n\n// this can take around 10ms and should only be run from PlotSchema.get(),\n// to ensure JSON.stringify(PlotSchema.get()) gives the intended result.\nfunction stringify(attrs) {\n function walk(attr) {\n for(var k in attr) {\n if(isPlainObject(attr[k])) {\n walk(attr[k]);\n } else if(Array.isArray(attr[k])) {\n for(var i = 0; i < attr[k].length; i++) {\n walk(attr[k][i]);\n }\n } else {\n // as JSON.stringify(/test/) // => {}\n if(attr[k] instanceof RegExp) {\n attr[k] = attr[k].toString();\n }\n }\n }\n }\n\n walk(attrs);\n}\n\n\nfunction handleBasePlotModule(layoutAttributes, _module, astr) {\n var np = nestedProperty(layoutAttributes, astr);\n var attrs = extendDeepAll({}, _module.layoutAttributes);\n\n attrs[IS_SUBPLOT_OBJ] = true;\n np.set(attrs);\n}\n\nfunction insertAttrs(baseAttrs, newAttrs, astr) {\n var np = nestedProperty(baseAttrs, astr);\n\n np.set(extendDeepAll(np.get() || {}, newAttrs));\n}\n","'use strict';\n\nvar Lib = require('../lib');\nvar plotAttributes = require('../plots/attributes');\n\nvar TEMPLATEITEMNAME = 'templateitemname';\n\nvar templateAttrs = {\n name: {\n valType: 'string',\n editType: 'none',\n description: [\n 'When used in a template, named items are created in the output figure',\n 'in addition to any items the figure already has in this array.',\n 'You can modify these items in the output figure by making your own',\n 'item with `templateitemname` matching this `name`',\n 'alongside your modifications (including `visible: false` or',\n '`enabled: false` to hide it).',\n 'Has no effect outside of a template.'\n ].join(' ')\n }\n};\ntemplateAttrs[TEMPLATEITEMNAME] = {\n valType: 'string',\n editType: 'calc',\n description: [\n 'Used to refer to a named item in this array in the template. Named',\n 'items from the template will be created even without a matching item',\n 'in the input figure, but you can modify one by making an item with',\n '`templateitemname` matching its `name`, alongside your modifications',\n '(including `visible: false` or `enabled: false` to hide it).',\n 'If there is no template or no matching item, this item will be',\n 'hidden unless you explicitly show it with `visible: true`.'\n ].join(' ')\n};\n\n/**\n * templatedArray: decorate an attributes object with templating (and array)\n * properties.\n *\n * @param {string} name: the singular form of the array name. Sets\n * `_isLinkedToArray` to this, so the schema knows to treat this as an array.\n * @param {object} attrs: the item attributes. Since all callers are expected\n * to be constructing this object on the spot, we mutate it here for\n * performance, rather than extending a new object with it.\n *\n * @returns {object}: the decorated `attrs` object\n */\nexports.templatedArray = function(name, attrs) {\n attrs._isLinkedToArray = name;\n attrs.name = templateAttrs.name;\n attrs[TEMPLATEITEMNAME] = templateAttrs[TEMPLATEITEMNAME];\n return attrs;\n};\n\n/**\n * traceTemplater: logic for matching traces to trace templates\n *\n * @param {object} dataTemplate: collection of {traceType: [{template}, ...]}\n * ie each type the template applies to contains a list of template objects,\n * to be provided cyclically to data traces of that type.\n *\n * @returns {object}: {newTrace}, a function:\n * newTrace(traceIn): that takes the input traceIn, coerces its type, then\n * uses that type to find the next template to apply. returns the output\n * traceOut with template attached, ready to continue supplyDefaults.\n */\nexports.traceTemplater = function(dataTemplate) {\n var traceCounts = {};\n var traceType, typeTemplates;\n\n for(traceType in dataTemplate) {\n typeTemplates = dataTemplate[traceType];\n if(Array.isArray(typeTemplates) && typeTemplates.length) {\n traceCounts[traceType] = 0;\n }\n }\n\n function newTrace(traceIn) {\n traceType = Lib.coerce(traceIn, {}, plotAttributes, 'type');\n var traceOut = {type: traceType, _template: null};\n if(traceType in traceCounts) {\n typeTemplates = dataTemplate[traceType];\n // cycle through traces in the template set for this type\n var typei = traceCounts[traceType] % typeTemplates.length;\n traceCounts[traceType]++;\n traceOut._template = typeTemplates[typei];\n } else {\n // TODO: anything we should do for types missing from the template?\n // try to apply some other type? Or just bail as we do here?\n // Actually I think yes, we should apply other types; would be nice\n // if all scatter* could inherit from each other, and if histogram\n // could inherit from bar, etc... but how to specify this? And do we\n // compose them, or if a type is present require it to be complete?\n // Actually this could apply to layout too - 3D annotations\n // inheriting from 2D, axes of different types inheriting from each\n // other...\n }\n return traceOut;\n }\n\n return {\n newTrace: newTrace\n // TODO: function to figure out what's left & what didn't work\n };\n};\n\n/**\n * newContainer: Create a new sub-container inside `container` and propagate any\n * applicable template to it. If there's no template, still propagates\n * `undefined` so relinkPrivate will not retain an old template!\n *\n * @param {object} container: the outer container, should already have _template\n * if there *is* a template for this plot\n * @param {string} name: the key of the new container to make\n * @param {string} baseName: if applicable, a base attribute to take the\n * template from, ie for xaxis3 the base would be xaxis\n *\n * @returns {object}: an object for inclusion _full*, empty except for the\n * appropriate template piece\n */\nexports.newContainer = function(container, name, baseName) {\n var template = container._template;\n var part = template && (template[name] || (baseName && template[baseName]));\n if(!Lib.isPlainObject(part)) part = null;\n\n var out = container[name] = {_template: part};\n return out;\n};\n\n/**\n * arrayTemplater: special logic for templating both defaults and specific items\n * in a container array (annotations etc)\n *\n * @param {object} container: the outer container, should already have _template\n * if there *is* a template for this plot\n * @param {string} name: the name of the array to template (ie 'annotations')\n * will be used to find default ('annotationdefaults' object) and specific\n * ('annotations' array) template specs.\n * @param {string} inclusionAttr: the attribute determining this item's\n * inclusion in the output, usually 'visible' or 'enabled'\n *\n * @returns {object}: {newItem, defaultItems}, both functions:\n * newItem(itemIn): create an output item, bare except for the correct\n * template and name(s), as the base for supplyDefaults\n * defaultItems(): to be called after all newItem calls, return any\n * specific template items that have not already beeen included,\n * also as bare output items ready for supplyDefaults.\n */\nexports.arrayTemplater = function(container, name, inclusionAttr) {\n var template = container._template;\n var defaultsTemplate = template && template[arrayDefaultKey(name)];\n var templateItems = template && template[name];\n if(!Array.isArray(templateItems) || !templateItems.length) {\n templateItems = [];\n }\n\n var usedNames = {};\n\n function newItem(itemIn) {\n // include name and templateitemname in the output object for ALL\n // container array items. Note: you could potentially use different\n // name and templateitemname, if you're using one template to make\n // another template. templateitemname would be the name in the original\n // template, and name is the new \"subclassed\" item name.\n var out = {name: itemIn.name, _input: itemIn};\n var templateItemName = out[TEMPLATEITEMNAME] = itemIn[TEMPLATEITEMNAME];\n\n // no itemname: use the default template\n if(!validItemName(templateItemName)) {\n out._template = defaultsTemplate;\n return out;\n }\n\n // look for an item matching this itemname\n // note these do not inherit from the default template, only the item.\n for(var i = 0; i < templateItems.length; i++) {\n var templateItem = templateItems[i];\n if(templateItem.name === templateItemName) {\n // Note: it's OK to use a template item more than once\n // but using it at least once will stop it from generating\n // a default item at the end.\n usedNames[templateItemName] = 1;\n out._template = templateItem;\n return out;\n }\n }\n\n // Didn't find a matching template item, so since this item is intended\n // to only be modifications it's most likely broken. Hide it unless\n // it's explicitly marked visible - in which case it gets NO template,\n // not even the default.\n out[inclusionAttr] = itemIn[inclusionAttr] || false;\n // special falsy value we can look for in validateTemplate\n out._template = false;\n return out;\n }\n\n function defaultItems() {\n var out = [];\n for(var i = 0; i < templateItems.length; i++) {\n var templateItem = templateItems[i];\n var name = templateItem.name;\n // only allow named items to be added as defaults,\n // and only allow each name once\n if(validItemName(name) && !usedNames[name]) {\n var outi = {\n _template: templateItem,\n name: name,\n _input: {_templateitemname: name}\n };\n outi[TEMPLATEITEMNAME] = templateItem[TEMPLATEITEMNAME];\n out.push(outi);\n usedNames[name] = 1;\n }\n }\n return out;\n }\n\n return {\n newItem: newItem,\n defaultItems: defaultItems\n };\n};\n\nfunction validItemName(name) {\n return name && typeof name === 'string';\n}\n\nfunction arrayDefaultKey(name) {\n var lastChar = name.length - 1;\n if(name.charAt(lastChar) !== 's') {\n Lib.warn('bad argument to arrayDefaultKey: ' + name);\n }\n return name.substr(0, name.length - 1) + 'defaults';\n}\nexports.arrayDefaultKey = arrayDefaultKey;\n\n/**\n * arrayEditor: helper for editing array items that may have come from\n * template defaults (in which case they will not exist in the input yet)\n *\n * @param {object} parentIn: the input container (eg gd.layout)\n * @param {string} containerStr: the attribute string for the container inside\n * `parentIn`.\n * @param {object} itemOut: the _full* item (eg gd._fullLayout.annotations[0])\n * that we'll be editing. Assumed to have been created by `arrayTemplater`.\n *\n * @returns {object}: {modifyBase, modifyItem, getUpdateObj, applyUpdate}, all functions:\n * modifyBase(attr, value): Add an update that's *not* related to the item.\n * `attr` is the full attribute string.\n * modifyItem(attr, value): Add an update to the item. `attr` is just the\n * portion of the attribute string inside the item.\n * getUpdateObj(): Get the final constructed update object, to use in\n * `restyle` or `relayout`. Also resets the update object in case this\n * update was canceled.\n * applyUpdate(attr, value): optionally add an update `attr: value`,\n * then apply it to `parent` which should be the parent of `containerIn`,\n * ie the object to which `containerStr` is the attribute string.\n */\nexports.arrayEditor = function(parentIn, containerStr, itemOut) {\n var lengthIn = (Lib.nestedProperty(parentIn, containerStr).get() || []).length;\n var index = itemOut._index;\n // Check that we are indeed off the end of this container.\n // Otherwise a devious user could put a key `_templateitemname` in their\n // own input and break lots of things.\n var templateItemName = (index >= lengthIn) && (itemOut._input || {})._templateitemname;\n if(templateItemName) index = lengthIn;\n var itemStr = containerStr + '[' + index + ']';\n\n var update;\n function resetUpdate() {\n update = {};\n if(templateItemName) {\n update[itemStr] = {};\n update[itemStr][TEMPLATEITEMNAME] = templateItemName;\n }\n }\n resetUpdate();\n\n function modifyBase(attr, value) {\n update[attr] = value;\n }\n\n function modifyItem(attr, value) {\n if(templateItemName) {\n // we're making a new object: edit that object\n Lib.nestedProperty(update[itemStr], attr).set(value);\n } else {\n // we're editing an existing object: include *just* the edit\n update[itemStr + '.' + attr] = value;\n }\n }\n\n function getUpdateObj() {\n var updateOut = update;\n resetUpdate();\n return updateOut;\n }\n\n function applyUpdate(attr, value) {\n if(attr) modifyItem(attr, value);\n var updateToApply = getUpdateObj();\n for(var key in updateToApply) {\n Lib.nestedProperty(parentIn, key).set(updateToApply[key]);\n }\n }\n\n return {\n modifyBase: modifyBase,\n modifyItem: modifyItem,\n getUpdateObj: getUpdateObj,\n applyUpdate: applyUpdate\n };\n};\n","'use strict';\n\nvar d3 = require('@plotly/d3');\nvar isNumeric = require('fast-isnumeric');\nvar hasHover = require('has-hover');\n\nvar Lib = require('../lib');\nvar nestedProperty = Lib.nestedProperty;\n\nvar Events = require('../lib/events');\nvar Queue = require('../lib/queue');\n\nvar Registry = require('../registry');\nvar PlotSchema = require('./plot_schema');\nvar Plots = require('../plots/plots');\n\nvar Axes = require('../plots/cartesian/axes');\nvar handleRangeDefaults = require('../plots/cartesian/range_defaults');\n\nvar cartesianLayoutAttributes = require('../plots/cartesian/layout_attributes');\nvar Drawing = require('../components/drawing');\nvar Color = require('../components/color');\nvar initInteractions = require('../plots/cartesian/graph_interact').initInteractions;\nvar xmlnsNamespaces = require('../constants/xmlns_namespaces');\nvar clearOutline = require('../components/selections').clearOutline;\n\nvar dfltConfig = require('./plot_config').dfltConfig;\nvar manageArrays = require('./manage_arrays');\nvar helpers = require('./helpers');\nvar subroutines = require('./subroutines');\nvar editTypes = require('./edit_types');\n\nvar AX_NAME_PATTERN = require('../plots/cartesian/constants').AX_NAME_PATTERN;\n\nvar numericNameWarningCount = 0;\nvar numericNameWarningCountLimit = 5;\n\n/**\n * Internal plot-creation function\n *\n * @param {string id or DOM element} gd\n * the id or DOM element of the graph container div\n * @param {array of objects} data\n * array of traces, containing the data and display information for each trace\n * @param {object} layout\n * object describing the overall display of the plot,\n * all the stuff that doesn't pertain to any individual trace\n * @param {object} config\n * configuration options (see ./plot_config.js for more info)\n *\n * OR\n *\n * @param {string id or DOM element} gd\n * the id or DOM element of the graph container div\n * @param {object} figure\n * object containing `data`, `layout`, `config`, and `frames` members\n *\n */\nfunction _doPlot(gd, data, layout, config) {\n var frames;\n\n gd = Lib.getGraphDiv(gd);\n\n // Events.init is idempotent and bails early if gd has already been init'd\n Events.init(gd);\n\n if(Lib.isPlainObject(data)) {\n var obj = data;\n data = obj.data;\n layout = obj.layout;\n config = obj.config;\n frames = obj.frames;\n }\n\n var okToPlot = Events.triggerHandler(gd, 'plotly_beforeplot', [data, layout, config]);\n if(okToPlot === false) return Promise.reject();\n\n // if there's no data or layout, and this isn't yet a plotly plot\n // container, log a warning to help plotly.js users debug\n if(!data && !layout && !Lib.isPlotDiv(gd)) {\n Lib.warn('Calling _doPlot as if redrawing ' +\n 'but this container doesn\\'t yet have a plot.', gd);\n }\n\n function addFrames() {\n if(frames) {\n return exports.addFrames(gd, frames);\n }\n }\n\n // transfer configuration options to gd until we move over to\n // a more OO like model\n setPlotContext(gd, config);\n\n if(!layout) layout = {};\n\n // hook class for plots main container (in case of plotly.js\n // this won't be #embedded-graph or .js-tab-contents)\n d3.select(gd).classed('js-plotly-plot', true);\n\n // off-screen getBoundingClientRect testing space,\n // in #js-plotly-tester (and stored as Drawing.tester)\n // so we can share cached text across tabs\n Drawing.makeTester();\n\n // collect promises for any async actions during plotting\n // any part of the plotting code can push to gd._promises, then\n // before we move to the next step, we check that they're all\n // complete, and empty out the promise list again.\n if(!Array.isArray(gd._promises)) gd._promises = [];\n\n var graphWasEmpty = ((gd.data || []).length === 0 && Array.isArray(data));\n\n // if there is already data on the graph, append the new data\n // if you only want to redraw, pass a non-array for data\n if(Array.isArray(data)) {\n helpers.cleanData(data);\n\n if(graphWasEmpty) gd.data = data;\n else gd.data.push.apply(gd.data, data);\n\n // for routines outside graph_obj that want a clean tab\n // (rather than appending to an existing one) gd.empty\n // is used to determine whether to make a new tab\n gd.empty = false;\n }\n\n if(!gd.layout || graphWasEmpty) {\n gd.layout = helpers.cleanLayout(layout);\n }\n\n Plots.supplyDefaults(gd);\n\n var fullLayout = gd._fullLayout;\n var hasCartesian = fullLayout._has('cartesian');\n\n // so we don't try to re-call _doPlot from inside\n // legend and colorbar, if margins changed\n fullLayout._replotting = true;\n\n // make or remake the framework if we need to\n if(graphWasEmpty || fullLayout._shouldCreateBgLayer) {\n makePlotFramework(gd);\n\n if(fullLayout._shouldCreateBgLayer) {\n delete fullLayout._shouldCreateBgLayer;\n }\n }\n\n // clear gradient and pattern defs on each .plot call, because we know we'll loop through all traces\n Drawing.initGradients(gd);\n Drawing.initPatterns(gd);\n\n // save initial show spikes once per graph\n if(graphWasEmpty) Axes.saveShowSpikeInitial(gd);\n\n // prepare the data and find the autorange\n\n // generate calcdata, if we need to\n // to force redoing calcdata, just delete it before calling _doPlot\n var recalc = !gd.calcdata || gd.calcdata.length !== (gd._fullData || []).length;\n if(recalc) Plots.doCalcdata(gd);\n\n // in case it has changed, attach fullData traces to calcdata\n for(var i = 0; i < gd.calcdata.length; i++) {\n gd.calcdata[i][0].trace = gd._fullData[i];\n }\n\n // make the figure responsive\n if(gd._context.responsive) {\n if(!gd._responsiveChartHandler) {\n // Keep a reference to the resize handler to purge it down the road\n gd._responsiveChartHandler = function() { if(!Lib.isHidden(gd)) Plots.resize(gd); };\n\n // Listen to window resize\n window.addEventListener('resize', gd._responsiveChartHandler);\n }\n } else {\n Lib.clearResponsive(gd);\n }\n\n /*\n * start async-friendly code - now we're actually drawing things\n */\n\n var oldMargins = Lib.extendFlat({}, fullLayout._size);\n\n // draw framework first so that margin-pushing\n // components can position themselves correctly\n var drawFrameworkCalls = 0;\n function drawFramework() {\n var basePlotModules = fullLayout._basePlotModules;\n\n for(var i = 0; i < basePlotModules.length; i++) {\n if(basePlotModules[i].drawFramework) {\n basePlotModules[i].drawFramework(gd);\n }\n }\n\n if(!fullLayout._glcanvas && fullLayout._has('gl')) {\n fullLayout._glcanvas = fullLayout._glcontainer.selectAll('.gl-canvas').data([{\n key: 'contextLayer',\n context: true,\n pick: false\n }, {\n key: 'focusLayer',\n context: false,\n pick: false\n }, {\n key: 'pickLayer',\n context: false,\n pick: true\n }], function(d) { return d.key; });\n\n fullLayout._glcanvas.enter().append('canvas')\n .attr('class', function(d) {\n return 'gl-canvas gl-canvas-' + d.key.replace('Layer', '');\n })\n .style({\n position: 'absolute',\n top: 0,\n left: 0,\n overflow: 'visible',\n 'pointer-events': 'none'\n });\n }\n\n var plotGlPixelRatio = gd._context.plotGlPixelRatio;\n if(fullLayout._glcanvas) {\n fullLayout._glcanvas\n .attr('width', fullLayout.width * plotGlPixelRatio)\n .attr('height', fullLayout.height * plotGlPixelRatio)\n .style('width', fullLayout.width + 'px')\n .style('height', fullLayout.height + 'px');\n\n var regl = fullLayout._glcanvas.data()[0].regl;\n if(regl) {\n // Unfortunately, this can happen when relayouting to large\n // width/height on some browsers.\n if(Math.floor(fullLayout.width * plotGlPixelRatio) !== regl._gl.drawingBufferWidth ||\n Math.floor(fullLayout.height * plotGlPixelRatio) !== regl._gl.drawingBufferHeight\n ) {\n var msg = 'WebGL context buffer and canvas dimensions do not match due to browser/WebGL bug.';\n if(drawFrameworkCalls) {\n Lib.error(msg);\n } else {\n Lib.log(msg + ' Clearing graph and plotting again.');\n Plots.cleanPlot([], {}, gd._fullData, fullLayout);\n Plots.supplyDefaults(gd);\n fullLayout = gd._fullLayout;\n Plots.doCalcdata(gd);\n drawFrameworkCalls++;\n return drawFramework();\n }\n }\n }\n }\n\n if(fullLayout.modebar.orientation === 'h') {\n fullLayout._modebardiv\n .style('height', null)\n .style('width', '100%');\n } else {\n fullLayout._modebardiv\n .style('width', null)\n .style('height', fullLayout.height + 'px');\n }\n\n return Plots.previousPromises(gd);\n }\n\n // draw anything that can affect margins.\n function marginPushers() {\n // First reset the list of things that are allowed to change the margins\n // So any deleted traces or components will be wiped out of the\n // automargin calculation.\n // This means *every* margin pusher must be listed here, even if it\n // doesn't actually try to push the margins until later.\n Plots.clearAutoMarginIds(gd);\n\n subroutines.drawMarginPushers(gd);\n Axes.allowAutoMargin(gd);\n if(gd._fullLayout.title.text && gd._fullLayout.title.automargin) Plots.allowAutoMargin(gd, 'title.automargin');\n\n // TODO can this be moved elsewhere?\n if(fullLayout._has('pie')) {\n var fullData = gd._fullData;\n for(var i = 0; i < fullData.length; i++) {\n var trace = fullData[i];\n if(trace.type === 'pie' && trace.automargin) {\n Plots.allowAutoMargin(gd, 'pie.' + trace.uid + '.automargin');\n }\n }\n }\n\n Plots.doAutoMargin(gd);\n return Plots.previousPromises(gd);\n }\n\n // in case the margins changed, draw margin pushers again\n function marginPushersAgain() {\n if(!Plots.didMarginChange(oldMargins, fullLayout._size)) return;\n\n return Lib.syncOrAsync([\n marginPushers,\n subroutines.layoutStyles\n ], gd);\n }\n\n function positionAndAutorange() {\n if(!recalc) {\n doAutoRangeAndConstraints();\n return;\n }\n\n // TODO: autosize extra for text markers and images\n // see https://github.com/plotly/plotly.js/issues/1111\n return Lib.syncOrAsync([\n Registry.getComponentMethod('shapes', 'calcAutorange'),\n Registry.getComponentMethod('annotations', 'calcAutorange'),\n doAutoRangeAndConstraints\n ], gd);\n }\n\n function doAutoRangeAndConstraints() {\n if(gd._transitioning) return;\n\n subroutines.doAutoRangeAndConstraints(gd);\n\n // store initial ranges *after* enforcing constraints, otherwise\n // we will never look like we're at the initial ranges\n if(graphWasEmpty) Axes.saveRangeInitial(gd);\n\n // this one is different from shapes/annotations calcAutorange\n // the others incorporate those components into ax._extremes,\n // this one actually sets the ranges in rangesliders.\n Registry.getComponentMethod('rangeslider', 'calcAutorange')(gd);\n }\n\n // draw ticks, titles, and calculate axis scaling (._b, ._m)\n function drawAxes() {\n return Axes.draw(gd, graphWasEmpty ? '' : 'redraw');\n }\n\n var seq = [\n Plots.previousPromises,\n addFrames,\n drawFramework,\n marginPushers,\n marginPushersAgain\n ];\n\n if(hasCartesian) seq.push(positionAndAutorange);\n\n seq.push(subroutines.layoutStyles);\n if(hasCartesian) {\n seq.push(\n drawAxes,\n function insideTickLabelsAutorange(gd) {\n var insideTickLabelsUpdaterange = gd._fullLayout._insideTickLabelsUpdaterange;\n if(insideTickLabelsUpdaterange) {\n gd._fullLayout._insideTickLabelsUpdaterange = undefined;\n\n return relayout(gd, insideTickLabelsUpdaterange).then(function() {\n Axes.saveRangeInitial(gd, true);\n });\n }\n }\n );\n }\n\n seq.push(\n subroutines.drawData,\n subroutines.finalDraw,\n initInteractions,\n Plots.addLinks,\n Plots.rehover,\n Plots.redrag,\n Plots.reselect,\n // TODO: doAutoMargin is only needed here for axis automargin, which\n // happens outside of marginPushers where all the other automargins are\n // calculated. Would be much better to separate margin calculations from\n // component drawing - see https://github.com/plotly/plotly.js/issues/2704\n Plots.doAutoMargin,\n Plots.previousPromises\n );\n\n // even if everything we did was synchronous, return a promise\n // so that the caller doesn't care which route we took\n var plotDone = Lib.syncOrAsync(seq, gd);\n if(!plotDone || !plotDone.then) plotDone = Promise.resolve();\n\n return plotDone.then(function() {\n emitAfterPlot(gd);\n return gd;\n });\n}\n\nfunction emitAfterPlot(gd) {\n var fullLayout = gd._fullLayout;\n\n if(fullLayout._redrawFromAutoMarginCount) {\n fullLayout._redrawFromAutoMarginCount--;\n } else {\n gd.emit('plotly_afterplot');\n }\n}\n\nfunction setPlotConfig(obj) {\n return Lib.extendFlat(dfltConfig, obj);\n}\n\nfunction setBackground(gd, bgColor) {\n try {\n gd._fullLayout._paper.style('background', bgColor);\n } catch(e) {\n Lib.error(e);\n }\n}\n\nfunction opaqueSetBackground(gd, bgColor) {\n var blend = Color.combine(bgColor, 'white');\n setBackground(gd, blend);\n}\n\nfunction setPlotContext(gd, config) {\n if(!gd._context) {\n gd._context = Lib.extendDeep({}, dfltConfig);\n\n // stash href, used to make robust clipPath URLs\n var base = d3.select('base');\n gd._context._baseUrl = base.size() && base.attr('href') ?\n window.location.href.split('#')[0] :\n '';\n }\n\n var context = gd._context;\n\n var i, keys, key;\n\n if(config) {\n keys = Object.keys(config);\n for(i = 0; i < keys.length; i++) {\n key = keys[i];\n if(key === 'editable' || key === 'edits') continue;\n if(key in context) {\n if(key === 'setBackground' && config[key] === 'opaque') {\n context[key] = opaqueSetBackground;\n } else {\n context[key] = config[key];\n }\n }\n }\n\n // map plot3dPixelRatio to plotGlPixelRatio for backward compatibility\n if(config.plot3dPixelRatio && !context.plotGlPixelRatio) {\n context.plotGlPixelRatio = context.plot3dPixelRatio;\n }\n\n // now deal with editable and edits - first editable overrides\n // everything, then edits refines\n var editable = config.editable;\n if(editable !== undefined) {\n // we're not going to *use* context.editable, we're only going to\n // use context.edits... but keep it for the record\n context.editable = editable;\n\n keys = Object.keys(context.edits);\n for(i = 0; i < keys.length; i++) {\n context.edits[keys[i]] = editable;\n }\n }\n if(config.edits) {\n keys = Object.keys(config.edits);\n for(i = 0; i < keys.length; i++) {\n key = keys[i];\n if(key in context.edits) {\n context.edits[key] = config.edits[key];\n }\n }\n }\n\n // not part of the user-facing config options\n context._exportedPlot = config._exportedPlot;\n }\n\n // staticPlot forces a bunch of others:\n if(context.staticPlot) {\n context.editable = false;\n context.edits = {};\n context.autosizable = false;\n context.scrollZoom = false;\n context.doubleClick = false;\n context.showTips = false;\n context.showLink = false;\n context.displayModeBar = false;\n }\n\n // make sure hover-only devices have mode bar visible\n if(context.displayModeBar === 'hover' && !hasHover) {\n context.displayModeBar = true;\n }\n\n // default and fallback for setBackground\n if(context.setBackground === 'transparent' || typeof context.setBackground !== 'function') {\n context.setBackground = setBackground;\n }\n\n // Check if gd has a specified widht/height to begin with\n context._hasZeroHeight = context._hasZeroHeight || gd.clientHeight === 0;\n context._hasZeroWidth = context._hasZeroWidth || gd.clientWidth === 0;\n\n // fill context._scrollZoom helper to help manage scrollZoom flaglist\n var szIn = context.scrollZoom;\n var szOut = context._scrollZoom = {};\n if(szIn === true) {\n szOut.cartesian = 1;\n szOut.gl3d = 1;\n szOut.geo = 1;\n szOut.mapbox = 1;\n } else if(typeof szIn === 'string') {\n var parts = szIn.split('+');\n for(i = 0; i < parts.length; i++) {\n szOut[parts[i]] = 1;\n }\n } else if(szIn !== false) {\n szOut.gl3d = 1;\n szOut.geo = 1;\n szOut.mapbox = 1;\n }\n}\n\n\n// convenience function to force a full redraw, mostly for use by plotly.js\nfunction redraw(gd) {\n gd = Lib.getGraphDiv(gd);\n\n if(!Lib.isPlotDiv(gd)) {\n throw new Error('This element is not a Plotly plot: ' + gd);\n }\n\n helpers.cleanData(gd.data);\n helpers.cleanLayout(gd.layout);\n\n gd.calcdata = undefined;\n return exports._doPlot(gd).then(function() {\n gd.emit('plotly_redraw');\n return gd;\n });\n}\n\n/**\n * Convenience function to make idempotent plot option obvious to users.\n *\n * @param gd\n * @param {Object[]} data\n * @param {Object} layout\n * @param {Object} config\n */\nfunction newPlot(gd, data, layout, config) {\n gd = Lib.getGraphDiv(gd);\n\n // remove gl contexts\n Plots.cleanPlot([], {}, gd._fullData || [], gd._fullLayout || {});\n\n Plots.purge(gd);\n return exports._doPlot(gd, data, layout, config);\n}\n\n/**\n * Wrap negative indicies to their positive counterparts.\n *\n * @param {Number[]} indices An array of indices\n * @param {Number} maxIndex The maximum index allowable (arr.length - 1)\n */\nfunction positivifyIndices(indices, maxIndex) {\n var parentLength = maxIndex + 1;\n var positiveIndices = [];\n var i;\n var index;\n\n for(i = 0; i < indices.length; i++) {\n index = indices[i];\n if(index < 0) {\n positiveIndices.push(parentLength + index);\n } else {\n positiveIndices.push(index);\n }\n }\n return positiveIndices;\n}\n\n/**\n * Ensures that an index array for manipulating gd.data is valid.\n *\n * Intended for use with addTraces, deleteTraces, and moveTraces.\n *\n * @param gd\n * @param indices\n * @param arrayName\n */\nfunction assertIndexArray(gd, indices, arrayName) {\n var i,\n index;\n\n for(i = 0; i < indices.length; i++) {\n index = indices[i];\n\n // validate that indices are indeed integers\n if(index !== parseInt(index, 10)) {\n throw new Error('all values in ' + arrayName + ' must be integers');\n }\n\n // check that all indices are in bounds for given gd.data array length\n if(index >= gd.data.length || index < -gd.data.length) {\n throw new Error(arrayName + ' must be valid indices for gd.data.');\n }\n\n // check that indices aren't repeated\n if(indices.indexOf(index, i + 1) > -1 ||\n index >= 0 && indices.indexOf(-gd.data.length + index) > -1 ||\n index < 0 && indices.indexOf(gd.data.length + index) > -1) {\n throw new Error('each index in ' + arrayName + ' must be unique.');\n }\n }\n}\n\n/**\n * Private function used by Plotly.moveTraces to check input args\n *\n * @param gd\n * @param currentIndices\n * @param newIndices\n */\nfunction checkMoveTracesArgs(gd, currentIndices, newIndices) {\n // check that gd has attribute 'data' and 'data' is array\n if(!Array.isArray(gd.data)) {\n throw new Error('gd.data must be an array.');\n }\n\n // validate currentIndices array\n if(typeof currentIndices === 'undefined') {\n throw new Error('currentIndices is a required argument.');\n } else if(!Array.isArray(currentIndices)) {\n currentIndices = [currentIndices];\n }\n assertIndexArray(gd, currentIndices, 'currentIndices');\n\n // validate newIndices array if it exists\n if(typeof newIndices !== 'undefined' && !Array.isArray(newIndices)) {\n newIndices = [newIndices];\n }\n if(typeof newIndices !== 'undefined') {\n assertIndexArray(gd, newIndices, 'newIndices');\n }\n\n // check currentIndices and newIndices are the same length if newIdices exists\n if(typeof newIndices !== 'undefined' && currentIndices.length !== newIndices.length) {\n throw new Error('current and new indices must be of equal length.');\n }\n}\n/**\n * A private function to reduce the type checking clutter in addTraces.\n *\n * @param gd\n * @param traces\n * @param newIndices\n */\nfunction checkAddTracesArgs(gd, traces, newIndices) {\n var i, value;\n\n // check that gd has attribute 'data' and 'data' is array\n if(!Array.isArray(gd.data)) {\n throw new Error('gd.data must be an array.');\n }\n\n // make sure traces exists\n if(typeof traces === 'undefined') {\n throw new Error('traces must be defined.');\n }\n\n // make sure traces is an array\n if(!Array.isArray(traces)) {\n traces = [traces];\n }\n\n // make sure each value in traces is an object\n for(i = 0; i < traces.length; i++) {\n value = traces[i];\n if(typeof value !== 'object' || (Array.isArray(value) || value === null)) {\n throw new Error('all values in traces array must be non-array objects');\n }\n }\n\n // make sure we have an index for each trace\n if(typeof newIndices !== 'undefined' && !Array.isArray(newIndices)) {\n newIndices = [newIndices];\n }\n if(typeof newIndices !== 'undefined' && newIndices.length !== traces.length) {\n throw new Error(\n 'if indices is specified, traces.length must equal indices.length'\n );\n }\n}\n\n/**\n * A private function to reduce the type checking clutter in spliceTraces.\n * Get all update Properties from gd.data. Validate inputs and outputs.\n * Used by prependTrace and extendTraces\n *\n * @param gd\n * @param update\n * @param indices\n * @param maxPoints\n */\nfunction assertExtendTracesArgs(gd, update, indices, maxPoints) {\n var maxPointsIsObject = Lib.isPlainObject(maxPoints);\n\n if(!Array.isArray(gd.data)) {\n throw new Error('gd.data must be an array');\n }\n if(!Lib.isPlainObject(update)) {\n throw new Error('update must be a key:value object');\n }\n\n if(typeof indices === 'undefined') {\n throw new Error('indices must be an integer or array of integers');\n }\n\n assertIndexArray(gd, indices, 'indices');\n\n for(var key in update) {\n /*\n * Verify that the attribute to be updated contains as many trace updates\n * as indices. Failure must result in throw and no-op\n */\n if(!Array.isArray(update[key]) || update[key].length !== indices.length) {\n throw new Error('attribute ' + key + ' must be an array of length equal to indices array length');\n }\n\n /*\n * if maxPoints is an object it must match keys and array lengths of 'update' 1:1\n */\n if(maxPointsIsObject &&\n (!(key in maxPoints) || !Array.isArray(maxPoints[key]) ||\n maxPoints[key].length !== update[key].length)) {\n throw new Error('when maxPoints is set as a key:value object it must contain a 1:1 ' +\n 'corrispondence with the keys and number of traces in the update object');\n }\n }\n}\n\n/**\n * A private function to reduce the type checking clutter in spliceTraces.\n *\n * @param {Object|HTMLDivElement} gd\n * @param {Object} update\n * @param {Number[]} indices\n * @param {Number||Object} maxPoints\n * @return {Object[]}\n */\nfunction getExtendProperties(gd, update, indices, maxPoints) {\n var maxPointsIsObject = Lib.isPlainObject(maxPoints);\n var updateProps = [];\n var trace, target, prop, insert, maxp;\n\n // allow scalar index to represent a single trace position\n if(!Array.isArray(indices)) indices = [indices];\n\n // negative indices are wrapped around to their positive value. Equivalent to python indexing.\n indices = positivifyIndices(indices, gd.data.length - 1);\n\n // loop through all update keys and traces and harvest validated data.\n for(var key in update) {\n for(var j = 0; j < indices.length; j++) {\n /*\n * Choose the trace indexed by the indices map argument and get the prop setter-getter\n * instance that references the key and value for this particular trace.\n */\n trace = gd.data[indices[j]];\n prop = nestedProperty(trace, key);\n\n /*\n * Target is the existing gd.data.trace.dataArray value like \"x\" or \"marker.size\"\n * Target must exist as an Array to allow the extend operation to be performed.\n */\n target = prop.get();\n insert = update[key][j];\n\n if(!Lib.isArrayOrTypedArray(insert)) {\n throw new Error('attribute: ' + key + ' index: ' + j + ' must be an array');\n }\n if(!Lib.isArrayOrTypedArray(target)) {\n throw new Error('cannot extend missing or non-array attribute: ' + key);\n }\n if(target.constructor !== insert.constructor) {\n throw new Error('cannot extend array with an array of a different type: ' + key);\n }\n\n /*\n * maxPoints may be an object map or a scalar. If object select the key:value, else\n * Use the scalar maxPoints for all key and trace combinations.\n */\n maxp = maxPointsIsObject ? maxPoints[key][j] : maxPoints;\n\n // could have chosen null here, -1 just tells us to not take a window\n if(!isNumeric(maxp)) maxp = -1;\n\n /*\n * Wrap the nestedProperty in an object containing required data\n * for lengthening and windowing this particular trace - key combination.\n * Flooring maxp mirrors the behaviour of floats in the Array.slice JSnative function.\n */\n updateProps.push({\n prop: prop,\n target: target,\n insert: insert,\n maxp: Math.floor(maxp)\n });\n }\n }\n\n // all target and insertion data now validated\n return updateProps;\n}\n\n/**\n * A private function to key Extend and Prepend traces DRY\n *\n * @param {Object|HTMLDivElement} gd\n * @param {Object} update\n * @param {Number[]} indices\n * @param {Number||Object} maxPoints\n * @param {Function} updateArray\n * @return {Object}\n */\nfunction spliceTraces(gd, update, indices, maxPoints, updateArray) {\n assertExtendTracesArgs(gd, update, indices, maxPoints);\n\n var updateProps = getExtendProperties(gd, update, indices, maxPoints);\n var undoUpdate = {};\n var undoPoints = {};\n\n for(var i = 0; i < updateProps.length; i++) {\n var prop = updateProps[i].prop;\n var maxp = updateProps[i].maxp;\n\n // return new array and remainder\n var out = updateArray(updateProps[i].target, updateProps[i].insert, maxp);\n prop.set(out[0]);\n\n // build the inverse update object for the undo operation\n if(!Array.isArray(undoUpdate[prop.astr])) undoUpdate[prop.astr] = [];\n undoUpdate[prop.astr].push(out[1]);\n\n // build the matching maxPoints undo object containing original trace lengths\n if(!Array.isArray(undoPoints[prop.astr])) undoPoints[prop.astr] = [];\n undoPoints[prop.astr].push(updateProps[i].target.length);\n }\n\n return {update: undoUpdate, maxPoints: undoPoints};\n}\n\nfunction concatTypedArray(arr0, arr1) {\n var arr2 = new arr0.constructor(arr0.length + arr1.length);\n arr2.set(arr0);\n arr2.set(arr1, arr0.length);\n return arr2;\n}\n\n/**\n * extend && prepend traces at indices with update arrays, window trace lengths to maxPoints\n *\n * Extend and Prepend have identical APIs. Prepend inserts an array at the head while Extend\n * inserts an array off the tail. Prepend truncates the tail of the array - counting maxPoints\n * from the head, whereas Extend truncates the head of the array, counting backward maxPoints\n * from the tail.\n *\n * If maxPoints is undefined, nonNumeric, negative or greater than extended trace length no\n * truncation / windowing will be performed. If its zero, well the whole trace is truncated.\n *\n * @param {Object|HTMLDivElement} gd The graph div\n * @param {Object} update The key:array map of target attributes to extend\n * @param {Number|Number[]} indices The locations of traces to be extended\n * @param {Number|Object} [maxPoints] Number of points for trace window after lengthening.\n *\n */\nfunction extendTraces(gd, update, indices, maxPoints) {\n gd = Lib.getGraphDiv(gd);\n\n function updateArray(target, insert, maxp) {\n var newArray, remainder;\n\n if(Lib.isTypedArray(target)) {\n if(maxp < 0) {\n var none = new target.constructor(0);\n var both = concatTypedArray(target, insert);\n\n if(maxp < 0) {\n newArray = both;\n remainder = none;\n } else {\n newArray = none;\n remainder = both;\n }\n } else {\n newArray = new target.constructor(maxp);\n remainder = new target.constructor(target.length + insert.length - maxp);\n\n if(maxp === insert.length) {\n newArray.set(insert);\n remainder.set(target);\n } else if(maxp < insert.length) {\n var numberOfItemsFromInsert = insert.length - maxp;\n\n newArray.set(insert.subarray(numberOfItemsFromInsert));\n remainder.set(target);\n remainder.set(insert.subarray(0, numberOfItemsFromInsert), target.length);\n } else {\n var numberOfItemsFromTarget = maxp - insert.length;\n var targetBegin = target.length - numberOfItemsFromTarget;\n\n newArray.set(target.subarray(targetBegin));\n newArray.set(insert, numberOfItemsFromTarget);\n remainder.set(target.subarray(0, targetBegin));\n }\n }\n } else {\n newArray = target.concat(insert);\n remainder = (maxp >= 0 && maxp < newArray.length) ?\n newArray.splice(0, newArray.length - maxp) :\n [];\n }\n\n return [newArray, remainder];\n }\n\n var undo = spliceTraces(gd, update, indices, maxPoints, updateArray);\n var promise = exports.redraw(gd);\n var undoArgs = [gd, undo.update, indices, undo.maxPoints];\n Queue.add(gd, exports.prependTraces, undoArgs, extendTraces, arguments);\n\n return promise;\n}\n\nfunction prependTraces(gd, update, indices, maxPoints) {\n gd = Lib.getGraphDiv(gd);\n\n function updateArray(target, insert, maxp) {\n var newArray, remainder;\n\n if(Lib.isTypedArray(target)) {\n if(maxp <= 0) {\n var none = new target.constructor(0);\n var both = concatTypedArray(insert, target);\n\n if(maxp < 0) {\n newArray = both;\n remainder = none;\n } else {\n newArray = none;\n remainder = both;\n }\n } else {\n newArray = new target.constructor(maxp);\n remainder = new target.constructor(target.length + insert.length - maxp);\n\n if(maxp === insert.length) {\n newArray.set(insert);\n remainder.set(target);\n } else if(maxp < insert.length) {\n var numberOfItemsFromInsert = insert.length - maxp;\n\n newArray.set(insert.subarray(0, numberOfItemsFromInsert));\n remainder.set(insert.subarray(numberOfItemsFromInsert));\n remainder.set(target, numberOfItemsFromInsert);\n } else {\n var numberOfItemsFromTarget = maxp - insert.length;\n\n newArray.set(insert);\n newArray.set(target.subarray(0, numberOfItemsFromTarget), insert.length);\n remainder.set(target.subarray(numberOfItemsFromTarget));\n }\n }\n } else {\n newArray = insert.concat(target);\n remainder = (maxp >= 0 && maxp < newArray.length) ?\n newArray.splice(maxp, newArray.length) :\n [];\n }\n\n return [newArray, remainder];\n }\n\n var undo = spliceTraces(gd, update, indices, maxPoints, updateArray);\n var promise = exports.redraw(gd);\n var undoArgs = [gd, undo.update, indices, undo.maxPoints];\n Queue.add(gd, exports.extendTraces, undoArgs, prependTraces, arguments);\n\n return promise;\n}\n\n/**\n * Add data traces to an existing graph div.\n *\n * @param {Object|HTMLDivElement} gd The graph div\n * @param {Object[]} gd.data The array of traces we're adding to\n * @param {Object[]|Object} traces The object or array of objects to add\n * @param {Number[]|Number} [newIndices=[gd.data.length]] Locations to add traces\n *\n */\nfunction addTraces(gd, traces, newIndices) {\n gd = Lib.getGraphDiv(gd);\n\n var currentIndices = [];\n var undoFunc = exports.deleteTraces;\n var redoFunc = addTraces;\n var undoArgs = [gd, currentIndices];\n var redoArgs = [gd, traces]; // no newIndices here\n var i;\n var promise;\n\n // all validation is done elsewhere to remove clutter here\n checkAddTracesArgs(gd, traces, newIndices);\n\n // make sure traces is an array\n if(!Array.isArray(traces)) {\n traces = [traces];\n }\n\n // make sure traces do not repeat existing ones\n traces = traces.map(function(trace) {\n return Lib.extendFlat({}, trace);\n });\n\n helpers.cleanData(traces);\n\n // add the traces to gd.data (no redrawing yet!)\n for(i = 0; i < traces.length; i++) {\n gd.data.push(traces[i]);\n }\n\n // to continue, we need to call moveTraces which requires currentIndices\n for(i = 0; i < traces.length; i++) {\n currentIndices.push(-traces.length + i);\n }\n\n // if the user didn't define newIndices, they just want the traces appended\n // i.e., we can simply redraw and be done\n if(typeof newIndices === 'undefined') {\n promise = exports.redraw(gd);\n Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);\n return promise;\n }\n\n // make sure indices is property defined\n if(!Array.isArray(newIndices)) {\n newIndices = [newIndices];\n }\n\n try {\n // this is redundant, but necessary to not catch later possible errors!\n checkMoveTracesArgs(gd, currentIndices, newIndices);\n } catch(error) {\n // something went wrong, reset gd to be safe and rethrow error\n gd.data.splice(gd.data.length - traces.length, traces.length);\n throw error;\n }\n\n // if we're here, the user has defined specific places to place the new traces\n // this requires some extra work that moveTraces will do\n Queue.startSequence(gd);\n Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);\n promise = exports.moveTraces(gd, currentIndices, newIndices);\n Queue.stopSequence(gd);\n return promise;\n}\n\n/**\n * Delete traces at `indices` from gd.data array.\n *\n * @param {Object|HTMLDivElement} gd The graph div\n * @param {Object[]} gd.data The array of traces we're removing from\n * @param {Number|Number[]} indices The indices\n */\nfunction deleteTraces(gd, indices) {\n gd = Lib.getGraphDiv(gd);\n\n var traces = [];\n var undoFunc = exports.addTraces;\n var redoFunc = deleteTraces;\n var undoArgs = [gd, traces, indices];\n var redoArgs = [gd, indices];\n var i;\n var deletedTrace;\n\n // make sure indices are defined\n if(typeof indices === 'undefined') {\n throw new Error('indices must be an integer or array of integers.');\n } else if(!Array.isArray(indices)) {\n indices = [indices];\n }\n assertIndexArray(gd, indices, 'indices');\n\n // convert negative indices to positive indices\n indices = positivifyIndices(indices, gd.data.length - 1);\n\n // we want descending here so that splicing later doesn't affect indexing\n indices.sort(Lib.sorterDes);\n for(i = 0; i < indices.length; i += 1) {\n deletedTrace = gd.data.splice(indices[i], 1)[0];\n traces.push(deletedTrace);\n }\n\n var promise = exports.redraw(gd);\n Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);\n\n return promise;\n}\n\n/**\n * Move traces at currentIndices array to locations in newIndices array.\n *\n * If newIndices is omitted, currentIndices will be moved to the end. E.g.,\n * these are equivalent:\n *\n * Plotly.moveTraces(gd, [1, 2, 3], [-3, -2, -1])\n * Plotly.moveTraces(gd, [1, 2, 3])\n *\n * @param {Object|HTMLDivElement} gd The graph div\n * @param {Object[]} gd.data The array of traces we're removing from\n * @param {Number|Number[]} currentIndices The locations of traces to be moved\n * @param {Number|Number[]} [newIndices] The locations to move traces to\n *\n * Example calls:\n *\n * // move trace i to location x\n * Plotly.moveTraces(gd, i, x)\n *\n * // move trace i to end of array\n * Plotly.moveTraces(gd, i)\n *\n * // move traces i, j, k to end of array (i != j != k)\n * Plotly.moveTraces(gd, [i, j, k])\n *\n * // move traces [i, j, k] to [x, y, z] (i != j != k) (x != y != z)\n * Plotly.moveTraces(gd, [i, j, k], [x, y, z])\n *\n * // reorder all traces (assume there are 5--a, b, c, d, e)\n * Plotly.moveTraces(gd, [b, d, e, a, c]) // same as 'move to end'\n */\nfunction moveTraces(gd, currentIndices, newIndices) {\n gd = Lib.getGraphDiv(gd);\n\n var newData = [];\n var movingTraceMap = [];\n var undoFunc = moveTraces;\n var redoFunc = moveTraces;\n var undoArgs = [gd, newIndices, currentIndices];\n var redoArgs = [gd, currentIndices, newIndices];\n var i;\n\n // to reduce complexity here, check args elsewhere\n // this throws errors where appropriate\n checkMoveTracesArgs(gd, currentIndices, newIndices);\n\n // make sure currentIndices is an array\n currentIndices = Array.isArray(currentIndices) ? currentIndices : [currentIndices];\n\n // if undefined, define newIndices to point to the end of gd.data array\n if(typeof newIndices === 'undefined') {\n newIndices = [];\n for(i = 0; i < currentIndices.length; i++) {\n newIndices.push(-currentIndices.length + i);\n }\n }\n\n // make sure newIndices is an array if it's user-defined\n newIndices = Array.isArray(newIndices) ? newIndices : [newIndices];\n\n // convert negative indices to positive indices (they're the same length)\n currentIndices = positivifyIndices(currentIndices, gd.data.length - 1);\n newIndices = positivifyIndices(newIndices, gd.data.length - 1);\n\n // at this point, we've coerced the index arrays into predictable forms\n\n // get the traces that aren't being moved around\n for(i = 0; i < gd.data.length; i++) {\n // if index isn't in currentIndices, include it in ignored!\n if(currentIndices.indexOf(i) === -1) {\n newData.push(gd.data[i]);\n }\n }\n\n // get a mapping of indices to moving traces\n for(i = 0; i < currentIndices.length; i++) {\n movingTraceMap.push({newIndex: newIndices[i], trace: gd.data[currentIndices[i]]});\n }\n\n // reorder this mapping by newIndex, ascending\n movingTraceMap.sort(function(a, b) {\n return a.newIndex - b.newIndex;\n });\n\n // now, add the moving traces back in, in order!\n for(i = 0; i < movingTraceMap.length; i += 1) {\n newData.splice(movingTraceMap[i].newIndex, 0, movingTraceMap[i].trace);\n }\n\n gd.data = newData;\n\n var promise = exports.redraw(gd);\n Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);\n\n return promise;\n}\n\n/**\n * restyle: update trace attributes of an existing plot\n *\n * Can be called two ways.\n *\n * Signature 1:\n * @param {String | HTMLDivElement} gd\n * the id or DOM element of the graph container div\n * @param {String} astr\n * attribute string (like `'marker.symbol'`) to update\n * @param {*} val\n * value to give this attribute\n * @param {Number[] | Number} [traces]\n * integer or array of integers for the traces to alter (all if omitted)\n *\n * Signature 2:\n * @param {String | HTMLDivElement} gd\n * (as in signature 1)\n * @param {Object} aobj\n * attribute object `{astr1: val1, astr2: val2 ...}`\n * allows setting multiple attributes simultaneously\n * @param {Number[] | Number} [traces]\n * (as in signature 1)\n *\n * `val` (or `val1`, `val2` ... in the object form) can be an array,\n * to apply different values to each trace.\n *\n * If the array is too short, it will wrap around (useful for\n * style files that want to specify cyclical default values).\n */\nfunction restyle(gd, astr, val, _traces) {\n gd = Lib.getGraphDiv(gd);\n helpers.clearPromiseQueue(gd);\n\n var aobj = {};\n if(typeof astr === 'string') aobj[astr] = val;\n else if(Lib.isPlainObject(astr)) {\n // the 3-arg form\n aobj = Lib.extendFlat({}, astr);\n if(_traces === undefined) _traces = val;\n } else {\n Lib.warn('Restyle fail.', astr, val, _traces);\n return Promise.reject();\n }\n\n if(Object.keys(aobj).length) gd.changed = true;\n\n var traces = helpers.coerceTraceIndices(gd, _traces);\n\n var specs = _restyle(gd, aobj, traces);\n var flags = specs.flags;\n\n // clear calcdata and/or axis types if required so they get regenerated\n if(flags.calc) gd.calcdata = undefined;\n if(flags.clearAxisTypes) helpers.clearAxisTypes(gd, traces, {});\n\n // fill in redraw sequence\n var seq = [];\n\n if(flags.fullReplot) {\n seq.push(exports._doPlot);\n } else {\n seq.push(Plots.previousPromises);\n\n // maybe only call Plots.supplyDataDefaults in the splom case,\n // to skip over long and slow axes defaults\n Plots.supplyDefaults(gd);\n\n if(flags.markerSize) {\n Plots.doCalcdata(gd);\n addAxRangeSequence(seq);\n\n // TODO\n // if all axes have autorange:false, then\n // proceed to subroutines.doTraceStyle(),\n // otherwise we must go through addAxRangeSequence,\n // which in general must redraws 'all' axes\n }\n\n if(flags.style) seq.push(subroutines.doTraceStyle);\n if(flags.colorbars) seq.push(subroutines.doColorBars);\n\n seq.push(emitAfterPlot);\n }\n\n seq.push(\n Plots.rehover,\n Plots.redrag,\n Plots.reselect\n );\n\n Queue.add(gd,\n restyle, [gd, specs.undoit, specs.traces],\n restyle, [gd, specs.redoit, specs.traces]\n );\n\n var plotDone = Lib.syncOrAsync(seq, gd);\n if(!plotDone || !plotDone.then) plotDone = Promise.resolve();\n\n return plotDone.then(function() {\n gd.emit('plotly_restyle', specs.eventData);\n return gd;\n });\n}\n\n// for undo: undefined initial vals must be turned into nulls\n// so that we unset rather than ignore them\nfunction undefinedToNull(val) {\n if(val === undefined) return null;\n return val;\n}\n\n/**\n * Factory function to wrap nestedProperty with GUI edits if necessary\n * with GUI edits we add an optional prefix to the nestedProperty constructor\n * to prepend to the attribute string in the preGUI store.\n */\nfunction makeNP(preGUI, guiEditFlag) {\n if(!guiEditFlag) return nestedProperty;\n\n return function(container, attr, prefix) {\n var np = nestedProperty(container, attr);\n var npSet = np.set;\n np.set = function(val) {\n var fullAttr = (prefix || '') + attr;\n storeCurrent(fullAttr, np.get(), val, preGUI);\n npSet(val);\n };\n return np;\n };\n}\n\nfunction storeCurrent(attr, val, newVal, preGUI) {\n if(Array.isArray(val) || Array.isArray(newVal)) {\n var arrayVal = Array.isArray(val) ? val : [];\n var arrayNew = Array.isArray(newVal) ? newVal : [];\n var maxLen = Math.max(arrayVal.length, arrayNew.length);\n for(var i = 0; i < maxLen; i++) {\n storeCurrent(attr + '[' + i + ']', arrayVal[i], arrayNew[i], preGUI);\n }\n } else if(Lib.isPlainObject(val) || Lib.isPlainObject(newVal)) {\n var objVal = Lib.isPlainObject(val) ? val : {};\n var objNew = Lib.isPlainObject(newVal) ? newVal : {};\n var objBoth = Lib.extendFlat({}, objVal, objNew);\n for(var key in objBoth) {\n storeCurrent(attr + '.' + key, objVal[key], objNew[key], preGUI);\n }\n } else if(preGUI[attr] === undefined) {\n preGUI[attr] = undefinedToNull(val);\n }\n}\n\n/**\n * storeDirectGUIEdit: for routines that skip restyle/relayout and mock it\n * by emitting a plotly_restyle or plotly_relayout event, this routine\n * keeps track of the initial state in _preGUI for use by uirevision\n * Does *not* apply these changes to data/layout - that's the responsibility\n * of the calling routine.\n *\n * @param {object} container: the input attributes container (eg `layout` or a `trace`)\n * @param {object} preGUI: where original values should be stored, either\n * `layout._preGUI` or `layout._tracePreGUI[uid]`\n * @param {object} edits: the {attr: val} object as normally passed to `relayout` etc\n */\nfunction _storeDirectGUIEdit(container, preGUI, edits) {\n for(var attr in edits) {\n var np = nestedProperty(container, attr);\n storeCurrent(attr, np.get(), edits[attr], preGUI);\n }\n}\n\nfunction _restyle(gd, aobj, traces) {\n var fullLayout = gd._fullLayout;\n var fullData = gd._fullData;\n var data = gd.data;\n var guiEditFlag = fullLayout._guiEditing;\n var layoutNP = makeNP(fullLayout._preGUI, guiEditFlag);\n var eventData = Lib.extendDeepAll({}, aobj);\n var i;\n\n cleanDeprecatedAttributeKeys(aobj);\n\n // initialize flags\n var flags = editTypes.traceFlags();\n\n // copies of the change (and previous values of anything affected)\n // for the undo / redo queue\n var redoit = {};\n var undoit = {};\n var axlist;\n\n // make a new empty vals array for undoit\n function a0() { return traces.map(function() { return undefined; }); }\n\n // for autoranging multiple axes\n function addToAxlist(axid) {\n var axName = Axes.id2name(axid);\n if(axlist.indexOf(axName) === -1) axlist.push(axName);\n }\n\n function autorangeAttr(axName) { return 'LAYOUT' + axName + '.autorange'; }\n\n function rangeAttr(axName) { return 'LAYOUT' + axName + '.range'; }\n\n function getFullTrace(traceIndex) {\n // usually fullData maps 1:1 onto data, but with groupby transforms\n // the fullData index can be greater. Take the *first* matching trace.\n for(var j = traceIndex; j < fullData.length; j++) {\n if(fullData[j]._input === data[traceIndex]) return fullData[j];\n }\n // should never get here - and if we *do* it should cause an error\n // later on undefined fullTrace is passed to nestedProperty.\n }\n\n // for attrs that interact (like scales & autoscales), save the\n // old vals before making the change\n // val=undefined will not set a value, just record what the value was.\n // val=null will delete the attribute\n // attr can be an array to set several at once (all to the same val)\n function doextra(attr, val, i) {\n if(Array.isArray(attr)) {\n attr.forEach(function(a) { doextra(a, val, i); });\n return;\n }\n // quit if explicitly setting this elsewhere\n if(attr in aobj || helpers.hasParent(aobj, attr)) return;\n\n var extraparam;\n if(attr.substr(0, 6) === 'LAYOUT') {\n extraparam = layoutNP(gd.layout, attr.replace('LAYOUT', ''));\n } else {\n var tracei = traces[i];\n var preGUI = fullLayout._tracePreGUI[getFullTrace(tracei)._fullInput.uid];\n extraparam = makeNP(preGUI, guiEditFlag)(data[tracei], attr);\n }\n\n if(!(attr in undoit)) {\n undoit[attr] = a0();\n }\n if(undoit[attr][i] === undefined) {\n undoit[attr][i] = undefinedToNull(extraparam.get());\n }\n if(val !== undefined) {\n extraparam.set(val);\n }\n }\n\n function allBins(binAttr) {\n return function(j) {\n return fullData[j][binAttr];\n };\n }\n\n function arrayBins(binAttr) {\n return function(vij, j) {\n return vij === false ? fullData[traces[j]][binAttr] : null;\n };\n }\n\n // now make the changes to gd.data (and occasionally gd.layout)\n // and figure out what kind of graphics update we need to do\n for(var ai in aobj) {\n if(helpers.hasParent(aobj, ai)) {\n throw new Error('cannot set ' + ai + ' and a parent attribute simultaneously');\n }\n\n var vi = aobj[ai];\n var cont;\n var contFull;\n var param;\n var oldVal;\n var newVal;\n var valObject;\n\n // Backward compatibility shim for turning histogram autobin on,\n // or freezing previous autobinned values.\n // Replace obsolete `autobin(x|y): true` with `(x|y)bins: null`\n // and `autobin(x|y): false` with the `(x|y)bins` in `fullData`\n if(ai === 'autobinx' || ai === 'autobiny') {\n ai = ai.charAt(ai.length - 1) + 'bins';\n if(Array.isArray(vi)) vi = vi.map(arrayBins(ai));\n else if(vi === false) vi = traces.map(allBins(ai));\n else vi = null;\n }\n\n redoit[ai] = vi;\n\n if(ai.substr(0, 6) === 'LAYOUT') {\n param = layoutNP(gd.layout, ai.replace('LAYOUT', ''));\n undoit[ai] = [undefinedToNull(param.get())];\n // since we're allowing val to be an array, allow it here too,\n // even though that's meaningless\n param.set(Array.isArray(vi) ? vi[0] : vi);\n // ironically, the layout attrs in restyle only require replot,\n // not relayout\n flags.calc = true;\n continue;\n }\n\n // set attribute in gd.data\n undoit[ai] = a0();\n for(i = 0; i < traces.length; i++) {\n cont = data[traces[i]];\n contFull = getFullTrace(traces[i]);\n var preGUI = fullLayout._tracePreGUI[contFull._fullInput.uid];\n param = makeNP(preGUI, guiEditFlag)(cont, ai);\n oldVal = param.get();\n newVal = Array.isArray(vi) ? vi[i % vi.length] : vi;\n\n if(newVal === undefined) continue;\n\n var finalPart = param.parts[param.parts.length - 1];\n var prefix = ai.substr(0, ai.length - finalPart.length - 1);\n var prefixDot = prefix ? prefix + '.' : '';\n var innerContFull = prefix ?\n nestedProperty(contFull, prefix).get() : contFull;\n\n valObject = PlotSchema.getTraceValObject(contFull, param.parts);\n\n if(valObject && valObject.impliedEdits && newVal !== null) {\n for(var impliedKey in valObject.impliedEdits) {\n doextra(Lib.relativeAttr(ai, impliedKey), valObject.impliedEdits[impliedKey], i);\n }\n } else if((finalPart === 'thicknessmode' || finalPart === 'lenmode') &&\n oldVal !== newVal &&\n (newVal === 'fraction' || newVal === 'pixels') &&\n innerContFull\n ) {\n // changing colorbar size modes,\n // make the resulting size not change\n // note that colorbar fractional sizing is based on the\n // original plot size, before anything (like a colorbar)\n // increases the margins\n\n var gs = fullLayout._size;\n var orient = innerContFull.orient;\n var topOrBottom = (orient === 'top') || (orient === 'bottom');\n if(finalPart === 'thicknessmode') {\n var thicknorm = topOrBottom ? gs.h : gs.w;\n doextra(prefixDot + 'thickness', innerContFull.thickness *\n (newVal === 'fraction' ? 1 / thicknorm : thicknorm), i);\n } else {\n var lennorm = topOrBottom ? gs.w : gs.h;\n doextra(prefixDot + 'len', innerContFull.len *\n (newVal === 'fraction' ? 1 / lennorm : lennorm), i);\n }\n } else if(ai === 'type' && (\n (newVal === 'pie') !== (oldVal === 'pie') ||\n (newVal === 'funnelarea') !== (oldVal === 'funnelarea')\n )) {\n var labelsTo = 'x';\n var valuesTo = 'y';\n if((newVal === 'bar' || oldVal === 'bar') && cont.orientation === 'h') {\n labelsTo = 'y';\n valuesTo = 'x';\n }\n Lib.swapAttrs(cont, ['?', '?src'], 'labels', labelsTo);\n Lib.swapAttrs(cont, ['d?', '?0'], 'label', labelsTo);\n Lib.swapAttrs(cont, ['?', '?src'], 'values', valuesTo);\n\n if(oldVal === 'pie' || oldVal === 'funnelarea') {\n nestedProperty(cont, 'marker.color')\n .set(nestedProperty(cont, 'marker.colors').get());\n\n // super kludgy - but if all pies are gone we won't remove them otherwise\n fullLayout._pielayer.selectAll('g.trace').remove();\n } else if(Registry.traceIs(cont, 'cartesian')) {\n nestedProperty(cont, 'marker.colors')\n .set(nestedProperty(cont, 'marker.color').get());\n }\n }\n\n undoit[ai][i] = undefinedToNull(oldVal);\n // set the new value - if val is an array, it's one el per trace\n // first check for attributes that get more complex alterations\n var swapAttrs = [\n 'swapxy', 'swapxyaxes', 'orientation', 'orientationaxes'\n ];\n if(swapAttrs.indexOf(ai) !== -1) {\n // setting an orientation: make sure it's changing\n // before we swap everything else\n if(ai === 'orientation') {\n param.set(newVal);\n // obnoxious that we need this level of coupling... but in order to\n // properly handle setting orientation to `null` we need to mimic\n // the logic inside Bars.supplyDefaults for default orientation\n var defaultOrientation = (cont.x && !cont.y) ? 'h' : 'v';\n if((param.get() || defaultOrientation) === contFull.orientation) {\n continue;\n }\n } else if(ai === 'orientationaxes') {\n // orientationaxes has no value,\n // it flips everything and the axes\n\n cont.orientation =\n {v: 'h', h: 'v'}[contFull.orientation];\n }\n helpers.swapXYData(cont);\n flags.calc = flags.clearAxisTypes = true;\n } else if(Plots.dataArrayContainers.indexOf(param.parts[0]) !== -1) {\n // TODO: use manageArrays.applyContainerArrayChanges here too\n helpers.manageArrayContainers(param, newVal, undoit);\n flags.calc = true;\n } else {\n if(valObject) {\n // must redo calcdata when restyling array values of arrayOk attributes\n // ... but no need to this for regl-based traces\n if(valObject.arrayOk &&\n !Registry.traceIs(contFull, 'regl') &&\n (Lib.isArrayOrTypedArray(newVal) || Lib.isArrayOrTypedArray(oldVal))\n ) {\n flags.calc = true;\n } else editTypes.update(flags, valObject);\n } else {\n /*\n * if we couldn't find valObject, assume a full recalc.\n * This can happen if you're changing type and making\n * some other edits too, so the modules we're\n * looking at don't have these attributes in them.\n */\n flags.calc = true;\n }\n\n // all the other ones, just modify that one attribute\n param.set(newVal);\n }\n }\n\n // swap the data attributes of the relevant x and y axes?\n if(['swapxyaxes', 'orientationaxes'].indexOf(ai) !== -1) {\n Axes.swap(gd, traces);\n }\n\n // swap hovermode if set to \"compare x/y data\"\n if(ai === 'orientationaxes') {\n var hovermode = nestedProperty(gd.layout, 'hovermode');\n var h = hovermode.get();\n if(h === 'x') {\n hovermode.set('y');\n } else if(h === 'y') {\n hovermode.set('x');\n } else if(h === 'x unified') {\n hovermode.set('y unified');\n } else if(h === 'y unified') {\n hovermode.set('x unified');\n }\n }\n\n // Major enough changes deserve autoscale and\n // non-reversed axes so people don't get confused\n //\n // Note: autobin (or its new analog bin clearing) is not included here\n // since we're not pushing bins back to gd.data, so if we have bin\n // info it was explicitly provided by the user.\n if(['orientation', 'type'].indexOf(ai) !== -1) {\n axlist = [];\n for(i = 0; i < traces.length; i++) {\n var trace = data[traces[i]];\n\n if(Registry.traceIs(trace, 'cartesian')) {\n addToAxlist(trace.xaxis || 'x');\n addToAxlist(trace.yaxis || 'y');\n }\n }\n\n doextra(axlist.map(autorangeAttr), true, 0);\n doextra(axlist.map(rangeAttr), [0, 1], 0);\n }\n }\n\n if(flags.calc || flags.plot) {\n flags.fullReplot = true;\n }\n\n return {\n flags: flags,\n undoit: undoit,\n redoit: redoit,\n traces: traces,\n eventData: Lib.extendDeepNoArrays([], [eventData, traces])\n };\n}\n\n/**\n * Converts deprecated attribute keys to\n * the current API to ensure backwards compatibility.\n *\n * This is needed for the update mechanism to determine which\n * subroutines to run based on the actual attribute\n * definitions (that don't include the deprecated ones).\n *\n * E.g. Maps {'xaxis.title': 'A chart'} to {'xaxis.title.text': 'A chart'}\n * and {titlefont: {...}} to {'title.font': {...}}.\n *\n * @param aobj\n */\nfunction cleanDeprecatedAttributeKeys(aobj) {\n var oldAxisTitleRegex = Lib.counterRegex('axis', '\\.title', false, false);\n var colorbarRegex = /colorbar\\.title$/;\n var keys = Object.keys(aobj);\n var i, key, value;\n\n for(i = 0; i < keys.length; i++) {\n key = keys[i];\n value = aobj[key];\n\n if((key === 'title' || oldAxisTitleRegex.test(key) || colorbarRegex.test(key)) &&\n (typeof value === 'string' || typeof value === 'number')) {\n replace(key, key.replace('title', 'title.text'));\n } else if(key.indexOf('titlefont') > -1 && key.indexOf('grouptitlefont') === -1) {\n replace(key, key.replace('titlefont', 'title.font'));\n } else if(key.indexOf('titleposition') > -1) {\n replace(key, key.replace('titleposition', 'title.position'));\n } else if(key.indexOf('titleside') > -1) {\n replace(key, key.replace('titleside', 'title.side'));\n } else if(key.indexOf('titleoffset') > -1) {\n replace(key, key.replace('titleoffset', 'title.offset'));\n }\n }\n\n function replace(oldAttrStr, newAttrStr) {\n aobj[newAttrStr] = aobj[oldAttrStr];\n delete aobj[oldAttrStr];\n }\n}\n\n/**\n * relayout: update layout attributes of an existing plot\n *\n * Can be called two ways:\n *\n * Signature 1:\n * @param {String | HTMLDivElement} gd\n * the id or dom element of the graph container div\n * @param {String} astr\n * attribute string (like `'xaxis.range[0]'`) to update\n * @param {*} val\n * value to give this attribute\n *\n * Signature 2:\n * @param {String | HTMLDivElement} gd\n * (as in signature 1)\n * @param {Object} aobj\n * attribute object `{astr1: val1, astr2: val2 ...}`\n * allows setting multiple attributes simultaneously\n */\nfunction relayout(gd, astr, val) {\n gd = Lib.getGraphDiv(gd);\n helpers.clearPromiseQueue(gd);\n\n var aobj = {};\n if(typeof astr === 'string') {\n aobj[astr] = val;\n } else if(Lib.isPlainObject(astr)) {\n aobj = Lib.extendFlat({}, astr);\n } else {\n Lib.warn('Relayout fail.', astr, val);\n return Promise.reject();\n }\n\n if(Object.keys(aobj).length) gd.changed = true;\n\n var specs = _relayout(gd, aobj);\n var flags = specs.flags;\n\n // clear calcdata if required\n if(flags.calc) gd.calcdata = undefined;\n\n // fill in redraw sequence\n\n // even if we don't have anything left in aobj,\n // something may have happened within relayout that we\n // need to wait for\n var seq = [Plots.previousPromises];\n if(flags.layoutReplot) {\n seq.push(subroutines.layoutReplot);\n } else if(Object.keys(aobj).length) {\n axRangeSupplyDefaultsByPass(gd, flags, specs) || Plots.supplyDefaults(gd);\n\n if(flags.legend) seq.push(subroutines.doLegend);\n if(flags.layoutstyle) seq.push(subroutines.layoutStyles);\n if(flags.axrange) addAxRangeSequence(seq, specs.rangesAltered);\n if(flags.ticks) seq.push(subroutines.doTicksRelayout);\n if(flags.modebar) seq.push(subroutines.doModeBar);\n if(flags.camera) seq.push(subroutines.doCamera);\n if(flags.colorbars) seq.push(subroutines.doColorBars);\n\n seq.push(emitAfterPlot);\n }\n\n seq.push(\n Plots.rehover,\n Plots.redrag,\n Plots.reselect\n );\n\n Queue.add(gd,\n relayout, [gd, specs.undoit],\n relayout, [gd, specs.redoit]\n );\n\n var plotDone = Lib.syncOrAsync(seq, gd);\n if(!plotDone || !plotDone.then) plotDone = Promise.resolve(gd);\n\n return plotDone.then(function() {\n gd.emit('plotly_relayout', specs.eventData);\n return gd;\n });\n}\n\n// Optimization mostly for large splom traces where\n// Plots.supplyDefaults can take > 100ms\nfunction axRangeSupplyDefaultsByPass(gd, flags, specs) {\n var fullLayout = gd._fullLayout;\n\n if(!flags.axrange) return false;\n\n for(var k in flags) {\n if(k !== 'axrange' && flags[k]) return false;\n }\n\n var axIn, axOut;\n var coerce = function(attr, dflt) {\n return Lib.coerce(axIn, axOut, cartesianLayoutAttributes, attr, dflt);\n };\n\n var options = {}; // passing empty options for now!\n\n for(var axId in specs.rangesAltered) {\n var axName = Axes.id2name(axId);\n axIn = gd.layout[axName];\n axOut = fullLayout[axName];\n\n handleRangeDefaults(axIn, axOut, coerce, options);\n\n if(axOut._matchGroup) {\n for(var axId2 in axOut._matchGroup) {\n if(axId2 !== axId) {\n var ax2 = fullLayout[Axes.id2name(axId2)];\n ax2.autorange = axOut.autorange;\n ax2.range = axOut.range.slice();\n ax2._input.range = axOut.range.slice();\n }\n }\n }\n }\n\n return true;\n}\n\nfunction addAxRangeSequence(seq, rangesAltered) {\n // N.B. leave as sequence of subroutines (for now) instead of\n // subroutine of its own so that finalDraw always gets\n // executed after drawData\n var drawAxes = rangesAltered ?\n function(gd) {\n var axIds = [];\n var skipTitle = true;\n\n for(var id in rangesAltered) {\n var ax = Axes.getFromId(gd, id);\n axIds.push(id);\n\n if((ax.ticklabelposition || '').indexOf('inside') !== -1) {\n if(ax._anchorAxis) {\n axIds.push(ax._anchorAxis._id);\n }\n }\n\n if(ax._matchGroup) {\n for(var id2 in ax._matchGroup) {\n if(!rangesAltered[id2]) {\n axIds.push(id2);\n }\n }\n }\n }\n\n return Axes.draw(gd, axIds, {skipTitle: skipTitle});\n } :\n function(gd) {\n return Axes.draw(gd, 'redraw');\n };\n\n seq.push(\n clearOutline,\n subroutines.doAutoRangeAndConstraints,\n drawAxes,\n subroutines.drawData,\n subroutines.finalDraw\n );\n}\n\nvar AX_RANGE_RE = /^[xyz]axis[0-9]*\\.range(\\[[0|1]\\])?$/;\nvar AX_AUTORANGE_RE = /^[xyz]axis[0-9]*\\.autorange$/;\nvar AX_DOMAIN_RE = /^[xyz]axis[0-9]*\\.domain(\\[[0|1]\\])?$/;\n\nfunction _relayout(gd, aobj) {\n var layout = gd.layout;\n var fullLayout = gd._fullLayout;\n var guiEditFlag = fullLayout._guiEditing;\n var layoutNP = makeNP(fullLayout._preGUI, guiEditFlag);\n var keys = Object.keys(aobj);\n var axes = Axes.list(gd);\n var eventData = Lib.extendDeepAll({}, aobj);\n var arrayEdits = {};\n\n var arrayStr, i, j;\n\n cleanDeprecatedAttributeKeys(aobj);\n keys = Object.keys(aobj);\n\n // look for 'allaxes', split out into all axes\n // in case of 3D the axis are nested within a scene which is held in _id\n for(i = 0; i < keys.length; i++) {\n if(keys[i].indexOf('allaxes') === 0) {\n for(j = 0; j < axes.length; j++) {\n var scene = axes[j]._id.substr(1);\n var axisAttr = (scene.indexOf('scene') !== -1) ? (scene + '.') : '';\n var newkey = keys[i].replace('allaxes', axisAttr + axes[j]._name);\n\n if(!aobj[newkey]) aobj[newkey] = aobj[keys[i]];\n }\n\n delete aobj[keys[i]];\n }\n }\n\n // initialize flags\n var flags = editTypes.layoutFlags();\n\n // copies of the change (and previous values of anything affected)\n // for the undo / redo queue\n var redoit = {};\n var undoit = {};\n\n // for attrs that interact (like scales & autoscales), save the\n // old vals before making the change\n // val=undefined will not set a value, just record what the value was.\n // attr can be an array to set several at once (all to the same val)\n function doextra(attr, val) {\n if(Array.isArray(attr)) {\n attr.forEach(function(a) { doextra(a, val); });\n return;\n }\n\n // if we have another value for this attribute (explicitly or\n // via a parent) do not override with this auto-generated extra\n if(attr in aobj || helpers.hasParent(aobj, attr)) return;\n\n var p = layoutNP(layout, attr);\n if(!(attr in undoit)) {\n undoit[attr] = undefinedToNull(p.get());\n }\n if(val !== undefined) p.set(val);\n }\n\n // for constraint enforcement: keep track of all axes (as {id: name})\n // we're editing the (auto)range of, so we can tell the others constrained\n // to scale with them that it's OK for them to shrink\n var rangesAltered = {};\n var ax;\n\n function recordAlteredAxis(pleafPlus) {\n var axId = Axes.name2id(pleafPlus.split('.')[0]);\n rangesAltered[axId] = 1;\n return axId;\n }\n\n // alter gd.layout\n for(var ai in aobj) {\n if(helpers.hasParent(aobj, ai)) {\n throw new Error('cannot set ' + ai + ' and a parent attribute simultaneously');\n }\n\n var p = layoutNP(layout, ai);\n var vi = aobj[ai];\n var plen = p.parts.length;\n // p.parts may end with an index integer if the property is an array\n var pend = plen - 1;\n while(pend > 0 && typeof p.parts[pend] !== 'string') pend--;\n // last property in chain (leaf node)\n var pleaf = p.parts[pend];\n // leaf plus immediate parent\n var pleafPlus = p.parts[pend - 1] + '.' + pleaf;\n // trunk nodes (everything except the leaf)\n var ptrunk = p.parts.slice(0, pend).join('.');\n var parentIn = nestedProperty(gd.layout, ptrunk).get();\n var parentFull = nestedProperty(fullLayout, ptrunk).get();\n var vOld = p.get();\n\n if(vi === undefined) continue;\n\n redoit[ai] = vi;\n\n // axis reverse is special - it is its own inverse\n // op and has no flag.\n undoit[ai] = (pleaf === 'reverse') ? vi : undefinedToNull(vOld);\n\n var valObject = PlotSchema.getLayoutValObject(fullLayout, p.parts);\n\n if(valObject && valObject.impliedEdits && vi !== null) {\n for(var impliedKey in valObject.impliedEdits) {\n doextra(Lib.relativeAttr(ai, impliedKey), valObject.impliedEdits[impliedKey]);\n }\n }\n\n // Setting width or height to null must reset the graph's width / height\n // back to its initial value as computed during the first pass in Plots.plotAutoSize.\n //\n // To do so, we must manually set them back here using the _initialAutoSize cache.\n // can't use impliedEdits for this because behavior depends on vi\n if(['width', 'height'].indexOf(ai) !== -1) {\n if(vi) {\n doextra('autosize', null);\n // currently we don't support autosize one dim only - so\n // explicitly set the other one. Note that doextra will\n // ignore this if the same relayout call also provides oppositeAttr\n var oppositeAttr = ai === 'height' ? 'width' : 'height';\n doextra(oppositeAttr, fullLayout[oppositeAttr]);\n } else {\n fullLayout[ai] = gd._initialAutoSize[ai];\n }\n } else if(ai === 'autosize') {\n // depends on vi here too, so again can't use impliedEdits\n doextra('width', vi ? null : fullLayout.width);\n doextra('height', vi ? null : fullLayout.height);\n } else if(pleafPlus.match(AX_RANGE_RE)) {\n // check autorange vs range\n\n recordAlteredAxis(pleafPlus);\n nestedProperty(fullLayout, ptrunk + '._inputRange').set(null);\n } else if(pleafPlus.match(AX_AUTORANGE_RE)) {\n recordAlteredAxis(pleafPlus);\n nestedProperty(fullLayout, ptrunk + '._inputRange').set(null);\n var axFull = nestedProperty(fullLayout, ptrunk).get();\n if(axFull._inputDomain) {\n // if we're autoranging and this axis has a constrained domain,\n // reset it so we don't get locked into a shrunken size\n axFull._input.domain = axFull._inputDomain.slice();\n }\n } else if(pleafPlus.match(AX_DOMAIN_RE)) {\n nestedProperty(fullLayout, ptrunk + '._inputDomain').set(null);\n }\n\n // toggling axis type between log and linear: we need to convert\n // positions for components that are still using linearized values,\n // not data values like newer components.\n // previously we did this for log <-> not-log, but now only do it\n // for log <-> linear\n if(pleaf === 'type') {\n ax = parentIn;\n var toLog = parentFull.type === 'linear' && vi === 'log';\n var fromLog = parentFull.type === 'log' && vi === 'linear';\n\n if(toLog || fromLog) {\n if(!ax || !ax.range) {\n // 2D never gets here, but 3D does\n // I don't think this is needed, but left here in case there\n // are edge cases I'm not thinking of.\n doextra(ptrunk + '.autorange', true);\n } else if(!parentFull.autorange) {\n // toggling log without autorange: need to also recalculate ranges\n // because log axes use linearized values for range endpoints\n var r0 = ax.range[0];\n var r1 = ax.range[1];\n if(toLog) {\n // if both limits are negative, autorange\n if(r0 <= 0 && r1 <= 0) {\n doextra(ptrunk + '.autorange', true);\n }\n // if one is negative, set it 6 orders below the other.\n if(r0 <= 0) r0 = r1 / 1e6;\n else if(r1 <= 0) r1 = r0 / 1e6;\n // now set the range values as appropriate\n doextra(ptrunk + '.range[0]', Math.log(r0) / Math.LN10);\n doextra(ptrunk + '.range[1]', Math.log(r1) / Math.LN10);\n } else {\n doextra(ptrunk + '.range[0]', Math.pow(10, r0));\n doextra(ptrunk + '.range[1]', Math.pow(10, r1));\n }\n } else if(toLog) {\n // just make sure the range is positive and in the right\n // order, it'll get recalculated later\n ax.range = (ax.range[1] > ax.range[0]) ? [1, 2] : [2, 1];\n }\n\n // clear polar view initial stash for radial range so that\n // value get recomputed in correct units\n if(Array.isArray(fullLayout._subplots.polar) &&\n fullLayout._subplots.polar.length &&\n fullLayout[p.parts[0]] &&\n p.parts[1] === 'radialaxis'\n ) {\n delete fullLayout[p.parts[0]]._subplot.viewInitial['radialaxis.range'];\n }\n\n // Annotations and images also need to convert to/from linearized coords\n // Shapes do not need this :)\n Registry.getComponentMethod('annotations', 'convertCoords')(gd, parentFull, vi, doextra);\n Registry.getComponentMethod('images', 'convertCoords')(gd, parentFull, vi, doextra);\n } else {\n // any other type changes: the range from the previous type\n // will not make sense, so autorange it.\n doextra(ptrunk + '.autorange', true);\n doextra(ptrunk + '.range', null);\n }\n nestedProperty(fullLayout, ptrunk + '._inputRange').set(null);\n } else if(pleaf.match(AX_NAME_PATTERN)) {\n var fullProp = nestedProperty(fullLayout, ai).get();\n var newType = (vi || {}).type;\n\n // This can potentially cause strange behavior if the autotype is not\n // numeric (linear, because we don't auto-log) but the previous type\n // was log. That's a very strange edge case though\n if(!newType || newType === '-') newType = 'linear';\n Registry.getComponentMethod('annotations', 'convertCoords')(gd, fullProp, newType, doextra);\n Registry.getComponentMethod('images', 'convertCoords')(gd, fullProp, newType, doextra);\n }\n\n // alter gd.layout\n\n // collect array component edits for execution all together\n // so we can ensure consistent behavior adding/removing items\n // and order-independence for add/remove/edit all together in\n // one relayout call\n var containerArrayMatch = manageArrays.containerArrayMatch(ai);\n if(containerArrayMatch) {\n arrayStr = containerArrayMatch.array;\n i = containerArrayMatch.index;\n var propStr = containerArrayMatch.property;\n var updateValObject = valObject || {editType: 'calc'};\n\n if(i !== '' && propStr === '') {\n // special handling of undoit if we're adding or removing an element\n // ie 'annotations[2]' which can be {...} (add) or null,\n // does not work when replacing the entire array\n if(manageArrays.isAddVal(vi)) {\n undoit[ai] = null;\n } else if(manageArrays.isRemoveVal(vi)) {\n undoit[ai] = (nestedProperty(layout, arrayStr).get() || [])[i];\n } else {\n Lib.warn('unrecognized full object value', aobj);\n }\n }\n editTypes.update(flags, updateValObject);\n\n // prepare the edits object we'll send to applyContainerArrayChanges\n if(!arrayEdits[arrayStr]) arrayEdits[arrayStr] = {};\n var objEdits = arrayEdits[arrayStr][i];\n if(!objEdits) objEdits = arrayEdits[arrayStr][i] = {};\n objEdits[propStr] = vi;\n\n delete aobj[ai];\n } else if(pleaf === 'reverse') {\n // handle axis reversal explicitly, as there's no 'reverse' attribute\n\n if(parentIn.range) parentIn.range.reverse();\n else {\n doextra(ptrunk + '.autorange', true);\n parentIn.range = [1, 0];\n }\n\n if(parentFull.autorange) flags.calc = true;\n else flags.plot = true;\n } else {\n if(ai === 'dragmode' && ((vi === false && vOld !== false) || (vi !== false && vOld === false))) {\n flags.plot = true;\n } else if((fullLayout._has('scatter-like') && fullLayout._has('regl')) &&\n (ai === 'dragmode' &&\n (vi === 'lasso' || vi === 'select') &&\n !(vOld === 'lasso' || vOld === 'select'))\n ) {\n flags.plot = true;\n } else if(fullLayout._has('gl2d')) {\n flags.plot = true;\n } else if(valObject) editTypes.update(flags, valObject);\n else flags.calc = true;\n\n p.set(vi);\n }\n }\n\n // now we've collected component edits - execute them all together\n for(arrayStr in arrayEdits) {\n var finished = manageArrays.applyContainerArrayChanges(gd,\n layoutNP(layout, arrayStr), arrayEdits[arrayStr], flags, layoutNP);\n if(!finished) flags.plot = true;\n }\n\n // figure out if we need to recalculate axis constraints\n for(var axId in rangesAltered) {\n ax = Axes.getFromId(gd, axId);\n var group = ax && ax._constraintGroup;\n if(group) {\n // Always recalc if we're changing constrained ranges.\n // Otherwise it's possible to violate the constraints by\n // specifying arbitrary ranges for all axes in the group.\n // this way some ranges may expand beyond what's specified,\n // as they do at first draw, to satisfy the constraints.\n flags.calc = true;\n for(var groupAxId in group) {\n if(!rangesAltered[groupAxId]) {\n Axes.getFromId(gd, groupAxId)._constraintShrinkable = true;\n }\n }\n }\n }\n\n // If the autosize changed or height or width was explicitly specified,\n // this triggers a redraw\n // TODO: do we really need special aobj.height/width handling here?\n // couldn't editType do this?\n if(updateAutosize(gd) || aobj.height || aobj.width) flags.plot = true;\n\n // update shape legends\n var shapes = fullLayout.shapes;\n for(i = 0; i < shapes.length; i++) {\n if(shapes[i].showlegend) {\n flags.calc = true;\n break;\n }\n }\n\n if(flags.plot || flags.calc) {\n flags.layoutReplot = true;\n }\n\n // now all attribute mods are done, as are\n // redo and undo so we can save them\n\n return {\n flags: flags,\n rangesAltered: rangesAltered,\n undoit: undoit,\n redoit: redoit,\n eventData: eventData\n };\n}\n\n/*\n * updateAutosize: we made a change, does it change the autosize result?\n * puts the new size into fullLayout\n * returns true if either height or width changed\n */\nfunction updateAutosize(gd) {\n var fullLayout = gd._fullLayout;\n var oldWidth = fullLayout.width;\n var oldHeight = fullLayout.height;\n\n // calculate autosizing\n if(gd.layout.autosize) Plots.plotAutoSize(gd, gd.layout, fullLayout);\n\n return (fullLayout.width !== oldWidth) || (fullLayout.height !== oldHeight);\n}\n\n/**\n * update: update trace and layout attributes of an existing plot\n *\n * @param {String | HTMLDivElement} gd\n * the id or DOM element of the graph container div\n * @param {Object} traceUpdate\n * attribute object `{astr1: val1, astr2: val2 ...}`\n * corresponding to updates in the plot's traces\n * @param {Object} layoutUpdate\n * attribute object `{astr1: val1, astr2: val2 ...}`\n * corresponding to updates in the plot's layout\n * @param {Number[] | Number} [traces]\n * integer or array of integers for the traces to alter (all if omitted)\n *\n */\nfunction update(gd, traceUpdate, layoutUpdate, _traces) {\n gd = Lib.getGraphDiv(gd);\n helpers.clearPromiseQueue(gd);\n\n if(!Lib.isPlainObject(traceUpdate)) traceUpdate = {};\n if(!Lib.isPlainObject(layoutUpdate)) layoutUpdate = {};\n\n if(Object.keys(traceUpdate).length) gd.changed = true;\n if(Object.keys(layoutUpdate).length) gd.changed = true;\n\n var traces = helpers.coerceTraceIndices(gd, _traces);\n\n var restyleSpecs = _restyle(gd, Lib.extendFlat({}, traceUpdate), traces);\n var restyleFlags = restyleSpecs.flags;\n\n var relayoutSpecs = _relayout(gd, Lib.extendFlat({}, layoutUpdate));\n var relayoutFlags = relayoutSpecs.flags;\n\n // clear calcdata and/or axis types if required\n if(restyleFlags.calc || relayoutFlags.calc) gd.calcdata = undefined;\n if(restyleFlags.clearAxisTypes) helpers.clearAxisTypes(gd, traces, layoutUpdate);\n\n // fill in redraw sequence\n var seq = [];\n\n if(relayoutFlags.layoutReplot) {\n // N.B. works fine when both\n // relayoutFlags.layoutReplot and restyleFlags.fullReplot are true\n seq.push(subroutines.layoutReplot);\n } else if(restyleFlags.fullReplot) {\n seq.push(exports._doPlot);\n } else {\n seq.push(Plots.previousPromises);\n axRangeSupplyDefaultsByPass(gd, relayoutFlags, relayoutSpecs) || Plots.supplyDefaults(gd);\n\n if(restyleFlags.style) seq.push(subroutines.doTraceStyle);\n if(restyleFlags.colorbars || relayoutFlags.colorbars) seq.push(subroutines.doColorBars);\n if(relayoutFlags.legend) seq.push(subroutines.doLegend);\n if(relayoutFlags.layoutstyle) seq.push(subroutines.layoutStyles);\n if(relayoutFlags.axrange) addAxRangeSequence(seq, relayoutSpecs.rangesAltered);\n if(relayoutFlags.ticks) seq.push(subroutines.doTicksRelayout);\n if(relayoutFlags.modebar) seq.push(subroutines.doModeBar);\n if(relayoutFlags.camera) seq.push(subroutines.doCamera);\n\n seq.push(emitAfterPlot);\n }\n\n seq.push(\n Plots.rehover,\n Plots.redrag,\n Plots.reselect\n );\n\n Queue.add(gd,\n update, [gd, restyleSpecs.undoit, relayoutSpecs.undoit, restyleSpecs.traces],\n update, [gd, restyleSpecs.redoit, relayoutSpecs.redoit, restyleSpecs.traces]\n );\n\n var plotDone = Lib.syncOrAsync(seq, gd);\n if(!plotDone || !plotDone.then) plotDone = Promise.resolve(gd);\n\n return plotDone.then(function() {\n gd.emit('plotly_update', {\n data: restyleSpecs.eventData,\n layout: relayoutSpecs.eventData\n });\n\n return gd;\n });\n}\n\n/*\n * internal-use-only restyle/relayout/update variants that record the initial\n * values in (fullLayout|fullTrace)._preGUI so changes can be persisted across\n * Plotly.react data updates, dependent on uirevision attributes\n */\nfunction guiEdit(func) {\n return function wrappedEdit(gd) {\n gd._fullLayout._guiEditing = true;\n var p = func.apply(null, arguments);\n gd._fullLayout._guiEditing = false;\n return p;\n };\n}\n\n// For connecting edited layout attributes to uirevision attrs\n// If no `attr` we use `match[1] + '.uirevision'`\n// Ordered by most common edits first, to minimize our search time\nvar layoutUIControlPatterns = [\n {pattern: /^hiddenlabels/, attr: 'legend.uirevision'},\n {pattern: /^((x|y)axis\\d*)\\.((auto)?range|title\\.text)/},\n\n // showspikes and modes include those nested inside scenes\n {pattern: /axis\\d*\\.showspikes$/, attr: 'modebar.uirevision'},\n {pattern: /(hover|drag)mode$/, attr: 'modebar.uirevision'},\n\n {pattern: /^(scene\\d*)\\.camera/},\n {pattern: /^(geo\\d*)\\.(projection|center|fitbounds)/},\n {pattern: /^(ternary\\d*\\.[abc]axis)\\.(min|title\\.text)$/},\n {pattern: /^(polar\\d*\\.radialaxis)\\.((auto)?range|angle|title\\.text)/},\n {pattern: /^(polar\\d*\\.angularaxis)\\.rotation/},\n {pattern: /^(mapbox\\d*)\\.(center|zoom|bearing|pitch)/},\n\n {pattern: /^legend\\.(x|y)$/, attr: 'editrevision'},\n {pattern: /^(shapes|annotations)/, attr: 'editrevision'},\n {pattern: /^title\\.text$/, attr: 'editrevision'}\n];\n\n// same for trace attributes: if `attr` is given it's in layout,\n// or with no `attr` we use `trace.uirevision`\nvar traceUIControlPatterns = [\n {pattern: /^selectedpoints$/, attr: 'selectionrevision'},\n // \"visible\" includes trace.transforms[i].styles[j].value.visible\n {pattern: /(^|value\\.)visible$/, attr: 'legend.uirevision'},\n {pattern: /^dimensions\\[\\d+\\]\\.constraintrange/},\n {pattern: /^node\\.(x|y|groups)/}, // for Sankey nodes\n {pattern: /^level$/}, // for Sunburst, Treemap and Icicle traces\n\n // below this you must be in editable: true mode\n // TODO: I still put name and title with `trace.uirevision`\n // reasonable or should these be `editrevision`?\n // Also applies to axis titles up in the layout section\n\n // \"name\" also includes transform.styles\n {pattern: /(^|value\\.)name$/},\n // including nested colorbar attributes (ie marker.colorbar)\n {pattern: /colorbar\\.title\\.text$/},\n {pattern: /colorbar\\.(x|y)$/, attr: 'editrevision'}\n];\n\nfunction findUIPattern(key, patternSpecs) {\n for(var i = 0; i < patternSpecs.length; i++) {\n var spec = patternSpecs[i];\n var match = key.match(spec.pattern);\n if(match) {\n var head = match[1] || '';\n return {head: head, tail: key.substr(head.length + 1), attr: spec.attr};\n }\n }\n}\n\n// We're finding the new uirevision before supplyDefaults, so do the\n// inheritance manually. Note that only `undefined` inherits - other\n// falsy values are returned.\nfunction getNewRev(revAttr, container) {\n var newRev = nestedProperty(container, revAttr).get();\n if(newRev !== undefined) return newRev;\n\n var parts = revAttr.split('.');\n parts.pop();\n while(parts.length > 1) {\n parts.pop();\n newRev = nestedProperty(container, parts.join('.') + '.uirevision').get();\n if(newRev !== undefined) return newRev;\n }\n\n return container.uirevision;\n}\n\nfunction getFullTraceIndexFromUid(uid, fullData) {\n for(var i = 0; i < fullData.length; i++) {\n if(fullData[i]._fullInput.uid === uid) return i;\n }\n return -1;\n}\n\nfunction getTraceIndexFromUid(uid, data, tracei) {\n for(var i = 0; i < data.length; i++) {\n if(data[i].uid === uid) return i;\n }\n // fall back on trace order, but only if user didn't provide a uid for that trace\n return (!data[tracei] || data[tracei].uid) ? -1 : tracei;\n}\n\nfunction valsMatch(v1, v2) {\n var v1IsObj = Lib.isPlainObject(v1);\n var v1IsArray = Array.isArray(v1);\n if(v1IsObj || v1IsArray) {\n return (\n (v1IsObj && Lib.isPlainObject(v2)) ||\n (v1IsArray && Array.isArray(v2))\n ) && JSON.stringify(v1) === JSON.stringify(v2);\n }\n return v1 === v2;\n}\n\nfunction applyUIRevisions(data, layout, oldFullData, oldFullLayout) {\n var layoutPreGUI = oldFullLayout._preGUI;\n var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal, head, tail;\n var bothInheritAutorange = [];\n var newAutorangeIn = {};\n var newRangeAccepted = {};\n for(key in layoutPreGUI) {\n match = findUIPattern(key, layoutUIControlPatterns);\n if(match) {\n head = match.head;\n tail = match.tail;\n revAttr = match.attr || (head + '.uirevision');\n oldRev = nestedProperty(oldFullLayout, revAttr).get();\n newRev = oldRev && getNewRev(revAttr, layout);\n\n if(newRev && (newRev === oldRev)) {\n preGUIVal = layoutPreGUI[key];\n if(preGUIVal === null) preGUIVal = undefined;\n newNP = nestedProperty(layout, key);\n newVal = newNP.get();\n\n if(valsMatch(newVal, preGUIVal)) {\n if(newVal === undefined && tail === 'autorange') {\n bothInheritAutorange.push(head);\n }\n newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));\n continue;\n } else if(tail === 'autorange' || tail.substr(0, 6) === 'range[') {\n // Special case for (auto)range since we push it back into the layout\n // so all null should be treated equivalently to autorange: true with any range\n var pre0 = layoutPreGUI[head + '.range[0]'];\n var pre1 = layoutPreGUI[head + '.range[1]'];\n var preAuto = layoutPreGUI[head + '.autorange'];\n if(preAuto || (preAuto === null && pre0 === null && pre1 === null)) {\n // Only read the input layout once and stash the result,\n // so we get it before we start modifying it\n if(!(head in newAutorangeIn)) {\n var newContainer = nestedProperty(layout, head).get();\n newAutorangeIn[head] = newContainer && (\n newContainer.autorange ||\n (newContainer.autorange !== false && (\n !newContainer.range || newContainer.range.length !== 2)\n )\n );\n }\n if(newAutorangeIn[head]) {\n newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));\n continue;\n }\n }\n }\n }\n } else {\n Lib.warn('unrecognized GUI edit: ' + key);\n }\n // if we got this far, the new value was accepted as the new starting\n // point (either because it changed or revision changed)\n // so remove it from _preGUI for next time.\n delete layoutPreGUI[key];\n\n if(match && match.tail.substr(0, 6) === 'range[') {\n newRangeAccepted[match.head] = 1;\n }\n }\n\n // More special logic for `autorange`, since it interacts with `range`:\n // If the new figure's matching `range` was kept, and `autorange`\n // wasn't supplied explicitly in either the original or the new figure,\n // we shouldn't alter that - but we may just have done that, so fix it.\n for(var i = 0; i < bothInheritAutorange.length; i++) {\n var axAttr = bothInheritAutorange[i];\n if(newRangeAccepted[axAttr]) {\n var newAx = nestedProperty(layout, axAttr).get();\n if(newAx) delete newAx.autorange;\n }\n }\n\n // Now traces - try to match them up by uid (in case we added/deleted in\n // the middle), then fall back on index.\n var allTracePreGUI = oldFullLayout._tracePreGUI;\n for(var uid in allTracePreGUI) {\n var tracePreGUI = allTracePreGUI[uid];\n var newTrace = null;\n var fullInput;\n for(key in tracePreGUI) {\n // wait until we know we have preGUI values to look for traces\n // but if we don't find both, stop looking at this uid\n if(!newTrace) {\n var fulli = getFullTraceIndexFromUid(uid, oldFullData);\n if(fulli < 0) {\n // Somehow we didn't even have this trace in oldFullData...\n // I guess this could happen with `deleteTraces` or something\n delete allTracePreGUI[uid];\n break;\n }\n var fullTrace = oldFullData[fulli];\n fullInput = fullTrace._fullInput;\n\n var newTracei = getTraceIndexFromUid(uid, data, fullInput.index);\n if(newTracei < 0) {\n // No match in new data\n delete allTracePreGUI[uid];\n break;\n }\n newTrace = data[newTracei];\n }\n\n match = findUIPattern(key, traceUIControlPatterns);\n if(match) {\n if(match.attr) {\n oldRev = nestedProperty(oldFullLayout, match.attr).get();\n newRev = oldRev && getNewRev(match.attr, layout);\n } else {\n oldRev = fullInput.uirevision;\n // inheritance for trace.uirevision is simple, just layout.uirevision\n newRev = newTrace.uirevision;\n if(newRev === undefined) newRev = layout.uirevision;\n }\n\n if(newRev && newRev === oldRev) {\n preGUIVal = tracePreGUI[key];\n if(preGUIVal === null) preGUIVal = undefined;\n newNP = nestedProperty(newTrace, key);\n newVal = newNP.get();\n if(valsMatch(newVal, preGUIVal)) {\n newNP.set(undefinedToNull(nestedProperty(fullInput, key).get()));\n continue;\n }\n }\n } else {\n Lib.warn('unrecognized GUI edit: ' + key + ' in trace uid ' + uid);\n }\n delete tracePreGUI[key];\n }\n }\n}\n\n/**\n * Plotly.react:\n * A plot/update method that takes the full plot state (same API as plot/newPlot)\n * and diffs to determine the minimal update pathway\n *\n * @param {string id or DOM element} gd\n * the id or DOM element of the graph container div\n * @param {array of objects} data\n * array of traces, containing the data and display information for each trace\n * @param {object} layout\n * object describing the overall display of the plot,\n * all the stuff that doesn't pertain to any individual trace\n * @param {object} config\n * configuration options (see ./plot_config.js for more info)\n *\n * OR\n *\n * @param {string id or DOM element} gd\n * the id or DOM element of the graph container div\n * @param {object} figure\n * object containing `data`, `layout`, `config`, and `frames` members\n *\n */\nfunction react(gd, data, layout, config) {\n var frames, plotDone;\n\n function addFrames() { return exports.addFrames(gd, frames); }\n\n gd = Lib.getGraphDiv(gd);\n helpers.clearPromiseQueue(gd);\n\n var oldFullData = gd._fullData;\n var oldFullLayout = gd._fullLayout;\n\n // you can use this as the initial draw as well as to update\n if(!Lib.isPlotDiv(gd) || !oldFullData || !oldFullLayout) {\n plotDone = exports.newPlot(gd, data, layout, config);\n } else {\n if(Lib.isPlainObject(data)) {\n var obj = data;\n data = obj.data;\n layout = obj.layout;\n config = obj.config;\n frames = obj.frames;\n }\n\n var configChanged = false;\n // assume that if there's a config at all, we're reacting to it too,\n // and completely replace the previous config\n if(config) {\n var oldConfig = Lib.extendDeep({}, gd._context);\n gd._context = undefined;\n setPlotContext(gd, config);\n configChanged = diffConfig(oldConfig, gd._context);\n }\n\n gd.data = data || [];\n helpers.cleanData(gd.data);\n gd.layout = layout || {};\n helpers.cleanLayout(gd.layout);\n\n applyUIRevisions(gd.data, gd.layout, oldFullData, oldFullLayout);\n\n // \"true\" skips updating calcdata and remapping arrays from calcTransforms,\n // which supplyDefaults usually does at the end, but we may need to NOT do\n // if the diff (which we haven't determined yet) says we'll recalc\n Plots.supplyDefaults(gd, {skipUpdateCalc: true});\n\n var newFullData = gd._fullData;\n var newFullLayout = gd._fullLayout;\n var immutable = newFullLayout.datarevision === undefined;\n var transition = newFullLayout.transition;\n\n var relayoutFlags = diffLayout(gd, oldFullLayout, newFullLayout, immutable, transition);\n var newDataRevision = relayoutFlags.newDataRevision;\n var restyleFlags = diffData(gd, oldFullData, newFullData, immutable, transition, newDataRevision);\n\n // TODO: how to translate this part of relayout to Plotly.react?\n // // Setting width or height to null must reset the graph's width / height\n // // back to its initial value as computed during the first pass in Plots.plotAutoSize.\n // //\n // // To do so, we must manually set them back here using the _initialAutoSize cache.\n // if(['width', 'height'].indexOf(ai) !== -1 && vi === null) {\n // fullLayout[ai] = gd._initialAutoSize[ai];\n // }\n\n if(updateAutosize(gd)) relayoutFlags.layoutReplot = true;\n\n // clear calcdata and empty categories if required\n if(restyleFlags.calc || relayoutFlags.calc) {\n gd.calcdata = undefined;\n var allNames = Object.getOwnPropertyNames(newFullLayout);\n for(var q = 0; q < allNames.length; q++) {\n var name = allNames[q];\n var start = name.substring(0, 5);\n if(start === 'xaxis' || start === 'yaxis') {\n var emptyCategories = newFullLayout[name]._emptyCategories;\n if(emptyCategories) emptyCategories();\n }\n }\n // otherwise do the calcdata updates and calcTransform array remaps that we skipped earlier\n } else {\n Plots.supplyDefaultsUpdateCalc(gd.calcdata, newFullData);\n }\n\n // Note: what restyle/relayout use impliedEdits and clearAxisTypes for\n // must be handled by the user when using Plotly.react.\n\n // fill in redraw sequence\n var seq = [];\n\n if(frames) {\n gd._transitionData = {};\n Plots.createTransitionData(gd);\n seq.push(addFrames);\n }\n\n // Transition pathway,\n // only used when 'transition' is set by user and\n // when at least one animatable attribute has changed,\n // N.B. config changed aren't animatable\n if(newFullLayout.transition && !configChanged && (restyleFlags.anim || relayoutFlags.anim)) {\n if(relayoutFlags.ticks) seq.push(subroutines.doTicksRelayout);\n\n Plots.doCalcdata(gd);\n subroutines.doAutoRangeAndConstraints(gd);\n\n seq.push(function() {\n return Plots.transitionFromReact(gd, restyleFlags, relayoutFlags, oldFullLayout);\n });\n } else if(restyleFlags.fullReplot || relayoutFlags.layoutReplot || configChanged) {\n gd._fullLayout._skipDefaults = true;\n seq.push(exports._doPlot);\n } else {\n for(var componentType in relayoutFlags.arrays) {\n var indices = relayoutFlags.arrays[componentType];\n if(indices.length) {\n var drawOne = Registry.getComponentMethod(componentType, 'drawOne');\n if(drawOne !== Lib.noop) {\n for(var i = 0; i < indices.length; i++) {\n drawOne(gd, indices[i]);\n }\n } else {\n var draw = Registry.getComponentMethod(componentType, 'draw');\n if(draw === Lib.noop) {\n throw new Error('cannot draw components: ' + componentType);\n }\n draw(gd);\n }\n }\n }\n\n seq.push(Plots.previousPromises);\n if(restyleFlags.style) seq.push(subroutines.doTraceStyle);\n if(restyleFlags.colorbars || relayoutFlags.colorbars) seq.push(subroutines.doColorBars);\n if(relayoutFlags.legend) seq.push(subroutines.doLegend);\n if(relayoutFlags.layoutstyle) seq.push(subroutines.layoutStyles);\n if(relayoutFlags.axrange) addAxRangeSequence(seq);\n if(relayoutFlags.ticks) seq.push(subroutines.doTicksRelayout);\n if(relayoutFlags.modebar) seq.push(subroutines.doModeBar);\n if(relayoutFlags.camera) seq.push(subroutines.doCamera);\n seq.push(emitAfterPlot);\n }\n\n seq.push(\n Plots.rehover,\n Plots.redrag,\n Plots.reselect\n );\n\n plotDone = Lib.syncOrAsync(seq, gd);\n if(!plotDone || !plotDone.then) plotDone = Promise.resolve(gd);\n }\n\n return plotDone.then(function() {\n gd.emit('plotly_react', {\n data: data,\n layout: layout\n });\n\n return gd;\n });\n}\n\nfunction diffData(gd, oldFullData, newFullData, immutable, transition, newDataRevision) {\n var sameTraceLength = oldFullData.length === newFullData.length;\n\n if(!transition && !sameTraceLength) {\n return {\n fullReplot: true,\n calc: true\n };\n }\n\n var flags = editTypes.traceFlags();\n flags.arrays = {};\n flags.nChanges = 0;\n flags.nChangesAnim = 0;\n\n var i, trace;\n\n function getTraceValObject(parts) {\n var out = PlotSchema.getTraceValObject(trace, parts);\n if(!trace._module.animatable && out.anim) {\n out.anim = false;\n }\n return out;\n }\n\n var diffOpts = {\n getValObject: getTraceValObject,\n flags: flags,\n immutable: immutable,\n transition: transition,\n newDataRevision: newDataRevision,\n gd: gd\n };\n\n var seenUIDs = {};\n\n for(i = 0; i < oldFullData.length; i++) {\n if(newFullData[i]) {\n trace = newFullData[i]._fullInput;\n if(Plots.hasMakesDataTransform(trace)) trace = newFullData[i];\n if(seenUIDs[trace.uid]) continue;\n seenUIDs[trace.uid] = 1;\n\n getDiffFlags(oldFullData[i]._fullInput, trace, [], diffOpts);\n }\n }\n\n if(flags.calc || flags.plot) {\n flags.fullReplot = true;\n }\n\n if(transition && flags.nChanges && flags.nChangesAnim) {\n flags.anim = (flags.nChanges === flags.nChangesAnim) && sameTraceLength ? 'all' : 'some';\n }\n\n return flags;\n}\n\nfunction diffLayout(gd, oldFullLayout, newFullLayout, immutable, transition) {\n var flags = editTypes.layoutFlags();\n flags.arrays = {};\n flags.rangesAltered = {};\n flags.nChanges = 0;\n flags.nChangesAnim = 0;\n\n function getLayoutValObject(parts) {\n return PlotSchema.getLayoutValObject(newFullLayout, parts);\n }\n\n var diffOpts = {\n getValObject: getLayoutValObject,\n flags: flags,\n immutable: immutable,\n transition: transition,\n gd: gd\n };\n\n getDiffFlags(oldFullLayout, newFullLayout, [], diffOpts);\n\n if(flags.plot || flags.calc) {\n flags.layoutReplot = true;\n }\n\n if(transition && flags.nChanges && flags.nChangesAnim) {\n flags.anim = flags.nChanges === flags.nChangesAnim ? 'all' : 'some';\n }\n\n return flags;\n}\n\nfunction getDiffFlags(oldContainer, newContainer, outerparts, opts) {\n var valObject, key, astr;\n\n var getValObject = opts.getValObject;\n var flags = opts.flags;\n var immutable = opts.immutable;\n var inArray = opts.inArray;\n var arrayIndex = opts.arrayIndex;\n\n function changed() {\n var editType = valObject.editType;\n if(inArray && editType.indexOf('arraydraw') !== -1) {\n Lib.pushUnique(flags.arrays[inArray], arrayIndex);\n return;\n }\n editTypes.update(flags, valObject);\n\n if(editType !== 'none') {\n flags.nChanges++;\n }\n\n // track animatable changes\n if(opts.transition && valObject.anim) {\n flags.nChangesAnim++;\n }\n\n // track cartesian axes with altered ranges\n if(AX_RANGE_RE.test(astr) || AX_AUTORANGE_RE.test(astr)) {\n flags.rangesAltered[outerparts[0]] = 1;\n }\n\n // clear _inputDomain on cartesian axes with altered domains\n if(AX_DOMAIN_RE.test(astr)) {\n nestedProperty(newContainer, '_inputDomain').set(null);\n }\n\n // track datarevision changes\n if(key === 'datarevision') {\n flags.newDataRevision = 1;\n }\n }\n\n function valObjectCanBeDataArray(valObject) {\n return valObject.valType === 'data_array' || valObject.arrayOk;\n }\n\n for(key in oldContainer) {\n // short-circuit based on previous calls or previous keys that already maximized the pathway\n if(flags.calc && !opts.transition) return;\n\n var oldVal = oldContainer[key];\n var newVal = newContainer[key];\n var parts = outerparts.concat(key);\n astr = parts.join('.');\n\n if(key.charAt(0) === '_' || typeof oldVal === 'function' || oldVal === newVal) continue;\n\n // FIXME: ax.tick0 and dtick get filled in during plotting (except for geo subplots),\n // and unlike other auto values they don't make it back into the input,\n // so newContainer won't have them.\n if((key === 'tick0' || key === 'dtick') && outerparts[0] !== 'geo') {\n var tickMode = newContainer.tickmode;\n if(tickMode === 'auto' || tickMode === 'array' || !tickMode) continue;\n }\n // FIXME: Similarly for axis ranges for 3D\n // contourcarpet doesn't HAVE zmin/zmax, they're just auto-added. It needs them.\n if(key === 'range' && newContainer.autorange) continue;\n if((key === 'zmin' || key === 'zmax') && newContainer.type === 'contourcarpet') continue;\n\n valObject = getValObject(parts);\n\n // in case type changed, we may not even *have* a valObject.\n if(!valObject) continue;\n\n if(valObject._compareAsJSON && JSON.stringify(oldVal) === JSON.stringify(newVal)) continue;\n\n var valType = valObject.valType;\n var i;\n\n var canBeDataArray = valObjectCanBeDataArray(valObject);\n var wasArray = Array.isArray(oldVal);\n var nowArray = Array.isArray(newVal);\n\n // hack for traces that modify the data in supplyDefaults, like\n // converting 1D to 2D arrays, which will always create new objects\n if(wasArray && nowArray) {\n var inputKey = '_input_' + key;\n var oldValIn = oldContainer[inputKey];\n var newValIn = newContainer[inputKey];\n if(Array.isArray(oldValIn) && oldValIn === newValIn) continue;\n }\n\n if(newVal === undefined) {\n if(canBeDataArray && wasArray) flags.calc = true;\n else changed();\n } else if(valObject._isLinkedToArray) {\n var arrayEditIndices = [];\n var extraIndices = false;\n if(!inArray) flags.arrays[key] = arrayEditIndices;\n\n var minLen = Math.min(oldVal.length, newVal.length);\n var maxLen = Math.max(oldVal.length, newVal.length);\n if(minLen !== maxLen) {\n if(valObject.editType === 'arraydraw') {\n extraIndices = true;\n } else {\n changed();\n continue;\n }\n }\n\n for(i = 0; i < minLen; i++) {\n getDiffFlags(oldVal[i], newVal[i], parts.concat(i),\n // add array indices, but not if we're already in an array\n Lib.extendFlat({inArray: key, arrayIndex: i}, opts));\n }\n\n // put this at the end so that we know our collected array indices are sorted\n // but the check for length changes happens up front so we can short-circuit\n // diffing if appropriate\n if(extraIndices) {\n for(i = minLen; i < maxLen; i++) {\n arrayEditIndices.push(i);\n }\n }\n } else if(!valType && Lib.isPlainObject(oldVal)) {\n getDiffFlags(oldVal, newVal, parts, opts);\n } else if(canBeDataArray) {\n if(wasArray && nowArray) {\n // don't try to diff two data arrays. If immutable we know the data changed,\n // if not, assume it didn't and let `layout.datarevision` tell us if it did\n if(immutable) {\n flags.calc = true;\n }\n\n // look for animatable attributes when the data changed\n if(immutable || opts.newDataRevision) {\n changed();\n }\n } else if(wasArray !== nowArray) {\n flags.calc = true;\n } else changed();\n } else if(wasArray && nowArray) {\n // info array, colorscale, 'any' - these are short, just stringify.\n // I don't *think* that covers up any real differences post-validation, does it?\n // otherwise we need to dive in 1 (info_array) or 2 (colorscale) levels and compare\n // all elements.\n if(oldVal.length !== newVal.length || String(oldVal) !== String(newVal)) {\n changed();\n }\n } else {\n changed();\n }\n }\n\n for(key in newContainer) {\n if(!(key in oldContainer || key.charAt(0) === '_' || typeof newContainer[key] === 'function')) {\n valObject = getValObject(outerparts.concat(key));\n\n if(valObjectCanBeDataArray(valObject) && Array.isArray(newContainer[key])) {\n flags.calc = true;\n return;\n } else changed();\n }\n }\n}\n\n/*\n * simple diff for config - for now, just treat all changes as equivalent\n */\nfunction diffConfig(oldConfig, newConfig) {\n var key;\n\n for(key in oldConfig) {\n if(key.charAt(0) === '_') continue;\n var oldVal = oldConfig[key];\n var newVal = newConfig[key];\n if(oldVal !== newVal) {\n if(Lib.isPlainObject(oldVal) && Lib.isPlainObject(newVal)) {\n if(diffConfig(oldVal, newVal)) {\n return true;\n }\n } else if(Array.isArray(oldVal) && Array.isArray(newVal)) {\n if(oldVal.length !== newVal.length) {\n return true;\n }\n for(var i = 0; i < oldVal.length; i++) {\n if(oldVal[i] !== newVal[i]) {\n if(Lib.isPlainObject(oldVal[i]) && Lib.isPlainObject(newVal[i])) {\n if(diffConfig(oldVal[i], newVal[i])) {\n return true;\n }\n } else {\n return true;\n }\n }\n }\n } else {\n return true;\n }\n }\n }\n}\n\n/**\n * Animate to a frame, sequence of frame, frame group, or frame definition\n *\n * @param {string id or DOM element} gd\n * the id or DOM element of the graph container div\n *\n * @param {string or object or array of strings or array of objects} frameOrGroupNameOrFrameList\n * a single frame, array of frames, or group to which to animate. The intent is\n * inferred by the type of the input. Valid inputs are:\n *\n * - string, e.g. 'groupname': animate all frames of a given `group` in the order\n * in which they are defined via `Plotly.addFrames`.\n *\n * - array of strings, e.g. ['frame1', frame2']: a list of frames by name to which\n * to animate in sequence\n *\n * - object: {data: ...}: a frame definition to which to animate. The frame is not\n * and does not need to be added via `Plotly.addFrames`. It may contain any of\n * the properties of a frame, including `data`, `layout`, and `traces`. The\n * frame is used as provided and does not use the `baseframe` property.\n *\n * - array of objects, e.g. [{data: ...}, {data: ...}]: a list of frame objects,\n * each following the same rules as a single `object`.\n *\n * @param {object} animationOpts\n * configuration for the animation\n */\nfunction animate(gd, frameOrGroupNameOrFrameList, animationOpts) {\n gd = Lib.getGraphDiv(gd);\n\n if(!Lib.isPlotDiv(gd)) {\n throw new Error(\n 'This element is not a Plotly plot: ' + gd + '. It\\'s likely that you\\'ve failed ' +\n 'to create a plot before animating it. For more details, see ' +\n 'https://plotly.com/javascript/animations/'\n );\n }\n\n var trans = gd._transitionData;\n\n // This is the queue of frames that will be animated as soon as possible. They\n // are popped immediately upon the *start* of a transition:\n if(!trans._frameQueue) {\n trans._frameQueue = [];\n }\n\n animationOpts = Plots.supplyAnimationDefaults(animationOpts);\n var transitionOpts = animationOpts.transition;\n var frameOpts = animationOpts.frame;\n\n // Since frames are popped immediately, an empty queue only means all frames have\n // *started* to transition, not that the animation is complete. To solve that,\n // track a separate counter that increments at the same time as frames are added\n // to the queue, but decrements only when the transition is complete.\n if(trans._frameWaitingCnt === undefined) {\n trans._frameWaitingCnt = 0;\n }\n\n function getTransitionOpts(i) {\n if(Array.isArray(transitionOpts)) {\n if(i >= transitionOpts.length) {\n return transitionOpts[0];\n } else {\n return transitionOpts[i];\n }\n } else {\n return transitionOpts;\n }\n }\n\n function getFrameOpts(i) {\n if(Array.isArray(frameOpts)) {\n if(i >= frameOpts.length) {\n return frameOpts[0];\n } else {\n return frameOpts[i];\n }\n } else {\n return frameOpts;\n }\n }\n\n // Execute a callback after the wrapper function has been called n times.\n // This is used to defer the resolution until a transition has resolved *and*\n // the frame has completed. If it's not done this way, then we get a race\n // condition in which the animation might resolve before a transition is complete\n // or vice versa.\n function callbackOnNthTime(cb, n) {\n var cnt = 0;\n return function() {\n if(cb && ++cnt === n) {\n return cb();\n }\n };\n }\n\n return new Promise(function(resolve, reject) {\n function discardExistingFrames() {\n if(trans._frameQueue.length === 0) {\n return;\n }\n\n while(trans._frameQueue.length) {\n var next = trans._frameQueue.pop();\n if(next.onInterrupt) {\n next.onInterrupt();\n }\n }\n\n gd.emit('plotly_animationinterrupted', []);\n }\n\n function queueFrames(frameList) {\n if(frameList.length === 0) return;\n\n for(var i = 0; i < frameList.length; i++) {\n var computedFrame;\n\n if(frameList[i].type === 'byname') {\n // If it's a named frame, compute it:\n computedFrame = Plots.computeFrame(gd, frameList[i].name);\n } else {\n // Otherwise we must have been given a simple object, so treat\n // the input itself as the computed frame.\n computedFrame = frameList[i].data;\n }\n\n var frameOpts = getFrameOpts(i);\n var transitionOpts = getTransitionOpts(i);\n\n // It doesn't make much sense for the transition duration to be greater than\n // the frame duration, so limit it:\n transitionOpts.duration = Math.min(transitionOpts.duration, frameOpts.duration);\n\n var nextFrame = {\n frame: computedFrame,\n name: frameList[i].name,\n frameOpts: frameOpts,\n transitionOpts: transitionOpts,\n };\n if(i === frameList.length - 1) {\n // The last frame in this .animate call stores the promise resolve\n // and reject callbacks. This is how we ensure that the animation\n // loop (which may exist as a result of a *different* .animate call)\n // still resolves or rejecdts this .animate call's promise. once it's\n // complete.\n nextFrame.onComplete = callbackOnNthTime(resolve, 2);\n nextFrame.onInterrupt = reject;\n }\n\n trans._frameQueue.push(nextFrame);\n }\n\n // Set it as never having transitioned to a frame. This will cause the animation\n // loop to immediately transition to the next frame (which, for immediate mode,\n // is the first frame in the list since all others would have been discarded\n // below)\n if(animationOpts.mode === 'immediate') {\n trans._lastFrameAt = -Infinity;\n }\n\n // Only it's not already running, start a RAF loop. This could be avoided in the\n // case that there's only one frame, but it significantly complicated the logic\n // and only sped things up by about 5% or so for a lorenz attractor simulation.\n // It would be a fine thing to implement, but the benefit of that optimization\n // doesn't seem worth the extra complexity.\n if(!trans._animationRaf) {\n beginAnimationLoop();\n }\n }\n\n function stopAnimationLoop() {\n gd.emit('plotly_animated');\n\n // Be sure to unset also since it's how we know whether a loop is already running:\n window.cancelAnimationFrame(trans._animationRaf);\n trans._animationRaf = null;\n }\n\n function nextFrame() {\n if(trans._currentFrame && trans._currentFrame.onComplete) {\n // Execute the callback and unset it to ensure it doesn't\n // accidentally get called twice\n trans._currentFrame.onComplete();\n }\n\n var newFrame = trans._currentFrame = trans._frameQueue.shift();\n\n if(newFrame) {\n // Since it's sometimes necessary to do deep digging into frame data,\n // we'll consider it not 100% impossible for nulls or numbers to sneak through,\n // so check when casting the name, just to be absolutely certain:\n var stringName = newFrame.name ? newFrame.name.toString() : null;\n gd._fullLayout._currentFrame = stringName;\n\n trans._lastFrameAt = Date.now();\n trans._timeToNext = newFrame.frameOpts.duration;\n\n // This is simply called and it's left to .transition to decide how to manage\n // interrupting current transitions. That means we don't need to worry about\n // how it resolves or what happens after this:\n Plots.transition(gd,\n newFrame.frame.data,\n newFrame.frame.layout,\n helpers.coerceTraceIndices(gd, newFrame.frame.traces),\n newFrame.frameOpts,\n newFrame.transitionOpts\n ).then(function() {\n if(newFrame.onComplete) {\n newFrame.onComplete();\n }\n });\n\n gd.emit('plotly_animatingframe', {\n name: stringName,\n frame: newFrame.frame,\n animation: {\n frame: newFrame.frameOpts,\n transition: newFrame.transitionOpts,\n }\n });\n } else {\n // If there are no more frames, then stop the RAF loop:\n stopAnimationLoop();\n }\n }\n\n function beginAnimationLoop() {\n gd.emit('plotly_animating');\n\n // If no timer is running, then set last frame = long ago so that the next\n // frame is immediately transitioned:\n trans._lastFrameAt = -Infinity;\n trans._timeToNext = 0;\n trans._runningTransitions = 0;\n trans._currentFrame = null;\n\n var doFrame = function() {\n // This *must* be requested before nextFrame since nextFrame may decide\n // to cancel it if there's nothing more to animated:\n trans._animationRaf = window.requestAnimationFrame(doFrame);\n\n // Check if we're ready for a new frame:\n if(Date.now() - trans._lastFrameAt > trans._timeToNext) {\n nextFrame();\n }\n };\n\n doFrame();\n }\n\n // This is an animate-local counter that helps match up option input list\n // items with the particular frame.\n var configCounter = 0;\n function setTransitionConfig(frame) {\n if(Array.isArray(transitionOpts)) {\n if(configCounter >= transitionOpts.length) {\n frame.transitionOpts = transitionOpts[configCounter];\n } else {\n frame.transitionOpts = transitionOpts[0];\n }\n } else {\n frame.transitionOpts = transitionOpts;\n }\n configCounter++;\n return frame;\n }\n\n // Disambiguate what's sort of frames have been received\n var i, frame;\n var frameList = [];\n var allFrames = frameOrGroupNameOrFrameList === undefined || frameOrGroupNameOrFrameList === null;\n var isFrameArray = Array.isArray(frameOrGroupNameOrFrameList);\n var isSingleFrame = !allFrames && !isFrameArray && Lib.isPlainObject(frameOrGroupNameOrFrameList);\n\n if(isSingleFrame) {\n // In this case, a simple object has been passed to animate.\n frameList.push({\n type: 'object',\n data: setTransitionConfig(Lib.extendFlat({}, frameOrGroupNameOrFrameList))\n });\n } else if(allFrames || ['string', 'number'].indexOf(typeof frameOrGroupNameOrFrameList) !== -1) {\n // In this case, null or undefined has been passed so that we want to\n // animate *all* currently defined frames\n for(i = 0; i < trans._frames.length; i++) {\n frame = trans._frames[i];\n\n if(!frame) continue;\n\n if(allFrames || String(frame.group) === String(frameOrGroupNameOrFrameList)) {\n frameList.push({\n type: 'byname',\n name: String(frame.name),\n data: setTransitionConfig({name: frame.name})\n });\n }\n }\n } else if(isFrameArray) {\n for(i = 0; i < frameOrGroupNameOrFrameList.length; i++) {\n var frameOrName = frameOrGroupNameOrFrameList[i];\n if(['number', 'string'].indexOf(typeof frameOrName) !== -1) {\n frameOrName = String(frameOrName);\n // In this case, there's an array and this frame is a string name:\n frameList.push({\n type: 'byname',\n name: frameOrName,\n data: setTransitionConfig({name: frameOrName})\n });\n } else if(Lib.isPlainObject(frameOrName)) {\n frameList.push({\n type: 'object',\n data: setTransitionConfig(Lib.extendFlat({}, frameOrName))\n });\n }\n }\n }\n\n // Verify that all of these frames actually exist; return and reject if not:\n for(i = 0; i < frameList.length; i++) {\n frame = frameList[i];\n if(frame.type === 'byname' && !trans._frameHash[frame.data.name]) {\n Lib.warn('animate failure: frame not found: \"' + frame.data.name + '\"');\n reject();\n return;\n }\n }\n\n // If the mode is either next or immediate, then all currently queued frames must\n // be dumped and the corresponding .animate promises rejected.\n if(['next', 'immediate'].indexOf(animationOpts.mode) !== -1) {\n discardExistingFrames();\n }\n\n if(animationOpts.direction === 'reverse') {\n frameList.reverse();\n }\n\n var currentFrame = gd._fullLayout._currentFrame;\n if(currentFrame && animationOpts.fromcurrent) {\n var idx = -1;\n for(i = 0; i < frameList.length; i++) {\n frame = frameList[i];\n if(frame.type === 'byname' && frame.name === currentFrame) {\n idx = i;\n break;\n }\n }\n\n if(idx > 0 && idx < frameList.length - 1) {\n var filteredFrameList = [];\n for(i = 0; i < frameList.length; i++) {\n frame = frameList[i];\n if(frameList[i].type !== 'byname' || i > idx) {\n filteredFrameList.push(frame);\n }\n }\n frameList = filteredFrameList;\n }\n }\n\n if(frameList.length > 0) {\n queueFrames(frameList);\n } else {\n // This is the case where there were simply no frames. It's a little strange\n // since there's not much to do:\n gd.emit('plotly_animated');\n resolve();\n }\n });\n}\n\n/**\n * Register new frames\n *\n * @param {string id or DOM element} gd\n * the id or DOM element of the graph container div\n *\n * @param {array of objects} frameList\n * list of frame definitions, in which each object includes any of:\n * - name: {string} name of frame to add\n * - data: {array of objects} trace data\n * - layout {object} layout definition\n * - traces {array} trace indices\n * - baseframe {string} name of frame from which this frame gets defaults\n *\n * @param {array of integers} indices\n * an array of integer indices matching the respective frames in `frameList`. If not\n * provided, an index will be provided in serial order. If already used, the frame\n * will be overwritten.\n */\nfunction addFrames(gd, frameList, indices) {\n gd = Lib.getGraphDiv(gd);\n\n if(frameList === null || frameList === undefined) {\n return Promise.resolve();\n }\n\n if(!Lib.isPlotDiv(gd)) {\n throw new Error(\n 'This element is not a Plotly plot: ' + gd + '. It\\'s likely that you\\'ve failed ' +\n 'to create a plot before adding frames. For more details, see ' +\n 'https://plotly.com/javascript/animations/'\n );\n }\n\n var i, frame, j, idx;\n var _frames = gd._transitionData._frames;\n var _frameHash = gd._transitionData._frameHash;\n\n\n if(!Array.isArray(frameList)) {\n throw new Error('addFrames failure: frameList must be an Array of frame definitions' + frameList);\n }\n\n // Create a sorted list of insertions since we run into lots of problems if these\n // aren't in ascending order of index:\n //\n // Strictly for sorting. Make sure this is guaranteed to never collide with any\n // already-exisisting indices:\n var bigIndex = _frames.length + frameList.length * 2;\n\n var insertions = [];\n var _frameHashLocal = {};\n for(i = frameList.length - 1; i >= 0; i--) {\n if(!Lib.isPlainObject(frameList[i])) continue;\n\n // The entire logic for checking for this type of name collision can be removed once we migrate to ES6 and\n // use a Map instead of an Object instance, as Map keys aren't converted to strings.\n var lookupName = frameList[i].name;\n var name = (_frameHash[lookupName] || _frameHashLocal[lookupName] || {}).name;\n var newName = frameList[i].name;\n var collisionPresent = _frameHash[name] || _frameHashLocal[name];\n\n if(name && newName && typeof newName === 'number' && collisionPresent && numericNameWarningCount < numericNameWarningCountLimit) {\n numericNameWarningCount++;\n\n Lib.warn('addFrames: overwriting frame \"' + (_frameHash[name] || _frameHashLocal[name]).name +\n '\" with a frame whose name of type \"number\" also equates to \"' +\n name + '\". This is valid but may potentially lead to unexpected ' +\n 'behavior since all plotly.js frame names are stored internally ' +\n 'as strings.');\n\n if(numericNameWarningCount === numericNameWarningCountLimit) {\n Lib.warn('addFrames: This API call has yielded too many of these warnings. ' +\n 'For the rest of this call, further warnings about numeric frame ' +\n 'names will be suppressed.');\n }\n }\n\n _frameHashLocal[lookupName] = {name: lookupName};\n\n insertions.push({\n frame: Plots.supplyFrameDefaults(frameList[i]),\n index: (indices && indices[i] !== undefined && indices[i] !== null) ? indices[i] : bigIndex + i\n });\n }\n\n // Sort this, taking note that undefined insertions end up at the end:\n insertions.sort(function(a, b) {\n if(a.index > b.index) return -1;\n if(a.index < b.index) return 1;\n return 0;\n });\n\n var ops = [];\n var revops = [];\n var frameCount = _frames.length;\n\n for(i = insertions.length - 1; i >= 0; i--) {\n frame = insertions[i].frame;\n\n if(typeof frame.name === 'number') {\n Lib.warn('Warning: addFrames accepts frames with numeric names, but the numbers are' +\n 'implicitly cast to strings');\n }\n\n if(!frame.name) {\n // Repeatedly assign a default name, incrementing the counter each time until\n // we get a name that's not in the hashed lookup table:\n while(_frameHash[(frame.name = 'frame ' + gd._transitionData._counter++)]);\n }\n\n if(_frameHash[frame.name]) {\n // If frame is present, overwrite its definition:\n for(j = 0; j < _frames.length; j++) {\n if((_frames[j] || {}).name === frame.name) break;\n }\n ops.push({type: 'replace', index: j, value: frame});\n revops.unshift({type: 'replace', index: j, value: _frames[j]});\n } else {\n // Otherwise insert it at the end of the list:\n idx = Math.max(0, Math.min(insertions[i].index, frameCount));\n\n ops.push({type: 'insert', index: idx, value: frame});\n revops.unshift({type: 'delete', index: idx});\n frameCount++;\n }\n }\n\n var undoFunc = Plots.modifyFrames;\n var redoFunc = Plots.modifyFrames;\n var undoArgs = [gd, revops];\n var redoArgs = [gd, ops];\n\n if(Queue) Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);\n\n return Plots.modifyFrames(gd, ops);\n}\n\n/**\n * Delete frame\n *\n * @param {string id or DOM element} gd\n * the id or DOM element of the graph container div\n *\n * @param {array of integers} frameList\n * list of integer indices of frames to be deleted\n */\nfunction deleteFrames(gd, frameList) {\n gd = Lib.getGraphDiv(gd);\n\n if(!Lib.isPlotDiv(gd)) {\n throw new Error('This element is not a Plotly plot: ' + gd);\n }\n\n var i, idx;\n var _frames = gd._transitionData._frames;\n var ops = [];\n var revops = [];\n\n if(!frameList) {\n frameList = [];\n for(i = 0; i < _frames.length; i++) {\n frameList.push(i);\n }\n }\n\n frameList = frameList.slice();\n frameList.sort();\n\n for(i = frameList.length - 1; i >= 0; i--) {\n idx = frameList[i];\n ops.push({type: 'delete', index: idx});\n revops.unshift({type: 'insert', index: idx, value: _frames[idx]});\n }\n\n var undoFunc = Plots.modifyFrames;\n var redoFunc = Plots.modifyFrames;\n var undoArgs = [gd, revops];\n var redoArgs = [gd, ops];\n\n if(Queue) Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);\n\n return Plots.modifyFrames(gd, ops);\n}\n\n/**\n * Purge a graph container div back to its initial pre-_doPlot state\n *\n * @param {string id or DOM element} gd\n * the id or DOM element of the graph container div\n */\nfunction purge(gd) {\n gd = Lib.getGraphDiv(gd);\n\n var fullLayout = gd._fullLayout || {};\n var fullData = gd._fullData || [];\n\n // remove gl contexts\n Plots.cleanPlot([], {}, fullData, fullLayout);\n\n // purge properties\n Plots.purge(gd);\n\n // purge event emitter methods\n Events.purge(gd);\n\n // remove plot container\n if(fullLayout._container) fullLayout._container.remove();\n\n // in contrast to _doPlots.purge which does NOT clear _context!\n delete gd._context;\n\n return gd;\n}\n\n// determines if the graph div requires a recalculation of its inverse matrix transforms by comparing old + new bounding boxes.\nfunction calcInverseTransform(gd) {\n var fullLayout = gd._fullLayout;\n\n var newBBox = gd.getBoundingClientRect();\n if(Lib.equalDomRects(newBBox, fullLayout._lastBBox)) return;\n\n var m = fullLayout._invTransform = Lib.inverseTransformMatrix(Lib.getFullTransformMatrix(gd));\n fullLayout._invScaleX = Math.sqrt(m[0][0] * m[0][0] + m[0][1] * m[0][1] + m[0][2] * m[0][2]);\n fullLayout._invScaleY = Math.sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2]);\n fullLayout._lastBBox = newBBox;\n}\n\n// -------------------------------------------------------\n// makePlotFramework: Create the plot container and axes\n// -------------------------------------------------------\nfunction makePlotFramework(gd) {\n var gd3 = d3.select(gd);\n var fullLayout = gd._fullLayout;\n\n fullLayout._calcInverseTransform = calcInverseTransform;\n fullLayout._calcInverseTransform(gd);\n\n // Plot container\n fullLayout._container = gd3.selectAll('.plot-container').data([0]);\n fullLayout._container.enter()\n .insert('div', ':first-child')\n .classed('plot-container', true)\n .classed('plotly', true);\n\n // Make the svg container\n fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]);\n fullLayout._paperdiv.enter().append('div')\n .classed('user-select-none', true)\n .classed('svg-container', true)\n .style('position', 'relative');\n\n // Make the graph containers\n // start fresh each time we get here, so we know the order comes out\n // right, rather than enter/exit which can muck up the order\n // TODO: sort out all the ordering so we don't have to\n // explicitly delete anything\n // FIXME: parcoords reuses this object, not the best pattern\n fullLayout._glcontainer = fullLayout._paperdiv.selectAll('.gl-container')\n .data([{}]);\n\n fullLayout._glcontainer.enter().append('div')\n .classed('gl-container', true);\n\n fullLayout._paperdiv.selectAll('.main-svg').remove();\n fullLayout._paperdiv.select('.modebar-container').remove();\n\n fullLayout._paper = fullLayout._paperdiv.insert('svg', ':first-child')\n .classed('main-svg', true);\n\n fullLayout._toppaper = fullLayout._paperdiv.append('svg')\n .classed('main-svg', true);\n\n fullLayout._modebardiv = fullLayout._paperdiv.append('div');\n delete fullLayout._modeBar;\n\n fullLayout._hoverpaper = fullLayout._paperdiv.append('svg')\n .classed('main-svg', true);\n\n if(!fullLayout._uid) {\n var otherUids = {};\n d3.selectAll('defs').each(function() {\n if(this.id) otherUids[this.id.split('-')[1]] = 1;\n });\n fullLayout._uid = Lib.randstr(otherUids);\n }\n\n fullLayout._paperdiv.selectAll('.main-svg')\n .attr(xmlnsNamespaces.svgAttrs);\n\n fullLayout._defs = fullLayout._paper.append('defs')\n .attr('id', 'defs-' + fullLayout._uid);\n\n fullLayout._clips = fullLayout._defs.append('g')\n .classed('clips', true);\n\n fullLayout._topdefs = fullLayout._toppaper.append('defs')\n .attr('id', 'topdefs-' + fullLayout._uid);\n\n fullLayout._topclips = fullLayout._topdefs.append('g')\n .classed('clips', true);\n\n fullLayout._bgLayer = fullLayout._paper.append('g')\n .classed('bglayer', true);\n\n fullLayout._draggers = fullLayout._paper.append('g')\n .classed('draglayer', true);\n\n // lower shape/image layer - note that this is behind\n // all subplots data/grids but above the backgrounds\n // except inset subplots, whose backgrounds are drawn\n // inside their own group so that they appear above\n // the data for the main subplot\n // lower shapes and images which are fully referenced to\n // a subplot still get drawn within the subplot's group\n // so they will work correctly on insets\n var layerBelow = fullLayout._paper.append('g')\n .classed('layer-below', true);\n fullLayout._imageLowerLayer = layerBelow.append('g')\n .classed('imagelayer', true);\n fullLayout._shapeLowerLayer = layerBelow.append('g')\n .classed('shapelayer', true);\n\n // single cartesian layer for the whole plot\n fullLayout._cartesianlayer = fullLayout._paper.append('g').classed('cartesianlayer', true);\n\n // single polar layer for the whole plot\n fullLayout._polarlayer = fullLayout._paper.append('g').classed('polarlayer', true);\n\n // single smith layer for the whole plot\n fullLayout._smithlayer = fullLayout._paper.append('g').classed('smithlayer', true);\n\n // single ternary layer for the whole plot\n fullLayout._ternarylayer = fullLayout._paper.append('g').classed('ternarylayer', true);\n\n // single geo layer for the whole plot\n fullLayout._geolayer = fullLayout._paper.append('g').classed('geolayer', true);\n\n // single funnelarea layer for the whole plot\n fullLayout._funnelarealayer = fullLayout._paper.append('g').classed('funnelarealayer', true);\n\n // single pie layer for the whole plot\n fullLayout._pielayer = fullLayout._paper.append('g').classed('pielayer', true);\n\n // single treemap layer for the whole plot\n fullLayout._iciclelayer = fullLayout._paper.append('g').classed('iciclelayer', true);\n\n // single treemap layer for the whole plot\n fullLayout._treemaplayer = fullLayout._paper.append('g').classed('treemaplayer', true);\n\n // single sunburst layer for the whole plot\n fullLayout._sunburstlayer = fullLayout._paper.append('g').classed('sunburstlayer', true);\n\n // single indicator layer for the whole plot\n fullLayout._indicatorlayer = fullLayout._toppaper.append('g').classed('indicatorlayer', true);\n\n // fill in image server scrape-svg\n fullLayout._glimages = fullLayout._paper.append('g').classed('glimages', true);\n\n // lastly upper shapes, info (legend, annotations) and hover layers go on top\n // these are in a different svg element normally, but get collapsed into a single\n // svg when exporting (after inserting 3D)\n // upper shapes/images are only those drawn above the whole plot, including subplots\n var layerAbove = fullLayout._toppaper.append('g')\n .classed('layer-above', true);\n fullLayout._imageUpperLayer = layerAbove.append('g')\n .classed('imagelayer', true);\n fullLayout._shapeUpperLayer = layerAbove.append('g')\n .classed('shapelayer', true);\n\n fullLayout._selectionLayer = fullLayout._toppaper.append('g').classed('selectionlayer', true);\n fullLayout._infolayer = fullLayout._toppaper.append('g').classed('infolayer', true);\n fullLayout._menulayer = fullLayout._toppaper.append('g').classed('menulayer', true);\n fullLayout._zoomlayer = fullLayout._toppaper.append('g').classed('zoomlayer', true);\n fullLayout._hoverlayer = fullLayout._hoverpaper.append('g').classed('hoverlayer', true);\n\n // Make the modebar container\n fullLayout._modebardiv\n .classed('modebar-container', true)\n .style('position', 'absolute')\n .style('top', '0px')\n .style('right', '0px');\n\n gd.emit('plotly_framework');\n}\n\nexports.animate = animate;\nexports.addFrames = addFrames;\nexports.deleteFrames = deleteFrames;\n\nexports.addTraces = addTraces;\nexports.deleteTraces = deleteTraces;\nexports.extendTraces = extendTraces;\nexports.moveTraces = moveTraces;\nexports.prependTraces = prependTraces;\n\nexports.newPlot = newPlot;\nexports._doPlot = _doPlot;\nexports.purge = purge;\n\nexports.react = react;\nexports.redraw = redraw;\nexports.relayout = relayout;\nexports.restyle = restyle;\n\nexports.setPlotConfig = setPlotConfig;\n\nexports.update = update;\n\nexports._guiRelayout = guiEdit(relayout);\nexports._guiRestyle = guiEdit(restyle);\nexports._guiUpdate = guiEdit(update);\n\nexports._storeDirectGUIEdit = _storeDirectGUIEdit;\n","'use strict';\n\nvar Lib = require('../lib');\nvar isPlainObject = Lib.isPlainObject;\nvar PlotSchema = require('./plot_schema');\nvar Plots = require('../plots/plots');\nvar plotAttributes = require('../plots/attributes');\nvar Template = require('./plot_template');\nvar dfltConfig = require('./plot_config').dfltConfig;\n\n/**\n * Plotly.makeTemplate: create a template off an existing figure to reuse\n * style attributes on other figures.\n *\n * Note: separated from the rest of templates because otherwise we get circular\n * references due to PlotSchema.\n *\n * @param {object|DOM element|string} figure: The figure to base the template on\n * should contain a trace array `figure.data`\n * and a layout object `figure.layout`\n * @returns {object} template: the extracted template - can then be used as\n * `layout.template` in another figure.\n */\nexports.makeTemplate = function(figure) {\n figure = Lib.isPlainObject(figure) ? figure : Lib.getGraphDiv(figure);\n figure = Lib.extendDeep({_context: dfltConfig}, {data: figure.data, layout: figure.layout});\n Plots.supplyDefaults(figure);\n var data = figure.data || [];\n var layout = figure.layout || {};\n // copy over a few items to help follow the schema\n layout._basePlotModules = figure._fullLayout._basePlotModules;\n layout._modules = figure._fullLayout._modules;\n\n var template = {\n data: {},\n layout: {}\n };\n\n /*\n * Note: we do NOT validate template values, we just take what's in the\n * user inputs data and layout, not the validated values in fullData and\n * fullLayout. Even if we were to validate here, there's no guarantee that\n * these values would still be valid when applied to a new figure, which\n * may contain different trace modes, different axes, etc. So it's\n * important that when applying a template we still validate the template\n * values, rather than just using them as defaults.\n */\n\n data.forEach(function(trace) {\n // TODO: What if no style info is extracted for this trace. We may\n // not want an empty object as the null value.\n // TODO: allow transforms to contribute to templates?\n // as it stands they are ignored, which may be for the best...\n\n var traceTemplate = {};\n walkStyleKeys(trace, traceTemplate, getTraceInfo.bind(null, trace));\n\n var traceType = Lib.coerce(trace, {}, plotAttributes, 'type');\n var typeTemplates = template.data[traceType];\n if(!typeTemplates) typeTemplates = template.data[traceType] = [];\n typeTemplates.push(traceTemplate);\n });\n\n walkStyleKeys(layout, template.layout, getLayoutInfo.bind(null, layout));\n\n /*\n * Compose the new template with an existing one to the same effect\n *\n * NOTE: there's a possibility of slightly different behavior: if the plot\n * has an invalid value and the old template has a valid value for the same\n * attribute, the plot will use the old template value but this routine\n * will pull the invalid value (resulting in the original default).\n * In the general case it's not possible to solve this with a single value,\n * since valid options can be context-dependent. It could be solved with\n * a *list* of values, but that would be huge complexity for little gain.\n */\n delete template.layout.template;\n var oldTemplate = layout.template;\n if(isPlainObject(oldTemplate)) {\n var oldLayoutTemplate = oldTemplate.layout;\n\n var i, traceType, oldTypeTemplates, oldTypeLen, typeTemplates, typeLen;\n\n if(isPlainObject(oldLayoutTemplate)) {\n mergeTemplates(oldLayoutTemplate, template.layout);\n }\n var oldDataTemplate = oldTemplate.data;\n if(isPlainObject(oldDataTemplate)) {\n for(traceType in template.data) {\n oldTypeTemplates = oldDataTemplate[traceType];\n if(Array.isArray(oldTypeTemplates)) {\n typeTemplates = template.data[traceType];\n typeLen = typeTemplates.length;\n oldTypeLen = oldTypeTemplates.length;\n for(i = 0; i < typeLen; i++) {\n mergeTemplates(oldTypeTemplates[i % oldTypeLen], typeTemplates[i]);\n }\n for(i = typeLen; i < oldTypeLen; i++) {\n typeTemplates.push(Lib.extendDeep({}, oldTypeTemplates[i]));\n }\n }\n }\n for(traceType in oldDataTemplate) {\n if(!(traceType in template.data)) {\n template.data[traceType] = Lib.extendDeep([], oldDataTemplate[traceType]);\n }\n }\n }\n }\n\n return template;\n};\n\nfunction mergeTemplates(oldTemplate, newTemplate) {\n // we don't care about speed here, just make sure we have a totally\n // distinct object from the previous template\n oldTemplate = Lib.extendDeep({}, oldTemplate);\n\n // sort keys so we always get annotationdefaults before annotations etc\n // so arrayTemplater will work right\n var oldKeys = Object.keys(oldTemplate).sort();\n var i, j;\n\n function mergeOne(oldVal, newVal, key) {\n if(isPlainObject(newVal) && isPlainObject(oldVal)) {\n mergeTemplates(oldVal, newVal);\n } else if(Array.isArray(newVal) && Array.isArray(oldVal)) {\n // Note: omitted `inclusionAttr` from arrayTemplater here,\n // it's irrelevant as we only want the resulting `_template`.\n var templater = Template.arrayTemplater({_template: oldTemplate}, key);\n for(j = 0; j < newVal.length; j++) {\n var item = newVal[j];\n var oldItem = templater.newItem(item)._template;\n if(oldItem) mergeTemplates(oldItem, item);\n }\n var defaultItems = templater.defaultItems();\n for(j = 0; j < defaultItems.length; j++) newVal.push(defaultItems[j]._template);\n\n // templateitemname only applies to receiving plots\n for(j = 0; j < newVal.length; j++) delete newVal[j].templateitemname;\n }\n }\n\n for(i = 0; i < oldKeys.length; i++) {\n var key = oldKeys[i];\n var oldVal = oldTemplate[key];\n if(key in newTemplate) {\n mergeOne(oldVal, newTemplate[key], key);\n } else newTemplate[key] = oldVal;\n\n // if this is a base key from the old template (eg xaxis), look for\n // extended keys (eg xaxis2) in the new template to merge into\n if(getBaseKey(key) === key) {\n for(var key2 in newTemplate) {\n var baseKey2 = getBaseKey(key2);\n if(key2 !== baseKey2 && baseKey2 === key && !(key2 in oldTemplate)) {\n mergeOne(oldVal, newTemplate[key2], key);\n }\n }\n }\n }\n}\n\nfunction getBaseKey(key) {\n return key.replace(/[0-9]+$/, '');\n}\n\nfunction walkStyleKeys(parent, templateOut, getAttributeInfo, path, basePath) {\n var pathAttr = basePath && getAttributeInfo(basePath);\n for(var key in parent) {\n var child = parent[key];\n var nextPath = getNextPath(parent, key, path);\n var nextBasePath = getNextPath(parent, key, basePath);\n var attr = getAttributeInfo(nextBasePath);\n if(!attr) {\n var baseKey = getBaseKey(key);\n if(baseKey !== key) {\n nextBasePath = getNextPath(parent, baseKey, basePath);\n attr = getAttributeInfo(nextBasePath);\n }\n }\n\n // we'll get an attr if path starts with a valid part, then has an\n // invalid ending. Make sure we got all the way to the end.\n if(pathAttr && (pathAttr === attr)) continue;\n\n if(!attr || attr._noTemplating ||\n attr.valType === 'data_array' ||\n (attr.arrayOk && Array.isArray(child))\n ) {\n continue;\n }\n\n if(!attr.valType && isPlainObject(child)) {\n walkStyleKeys(child, templateOut, getAttributeInfo, nextPath, nextBasePath);\n } else if(attr._isLinkedToArray && Array.isArray(child)) {\n var dfltDone = false;\n var namedIndex = 0;\n var usedNames = {};\n for(var i = 0; i < child.length; i++) {\n var item = child[i];\n if(isPlainObject(item)) {\n var name = item.name;\n if(name) {\n if(!usedNames[name]) {\n // named array items: allow all attributes except data arrays\n walkStyleKeys(item, templateOut, getAttributeInfo,\n getNextPath(child, namedIndex, nextPath),\n getNextPath(child, namedIndex, nextBasePath));\n namedIndex++;\n usedNames[name] = 1;\n }\n } else if(!dfltDone) {\n var dfltKey = Template.arrayDefaultKey(key);\n var dfltPath = getNextPath(parent, dfltKey, path);\n\n // getAttributeInfo will fail if we try to use dfltKey directly.\n // Instead put this item into the next array element, then\n // pull it out and move it to dfltKey.\n var pathInArray = getNextPath(child, namedIndex, nextPath);\n walkStyleKeys(item, templateOut, getAttributeInfo, pathInArray,\n getNextPath(child, namedIndex, nextBasePath));\n var itemPropInArray = Lib.nestedProperty(templateOut, pathInArray);\n var dfltProp = Lib.nestedProperty(templateOut, dfltPath);\n dfltProp.set(itemPropInArray.get());\n itemPropInArray.set(null);\n\n dfltDone = true;\n }\n }\n }\n } else {\n var templateProp = Lib.nestedProperty(templateOut, nextPath);\n templateProp.set(child);\n }\n }\n}\n\nfunction getLayoutInfo(layout, path) {\n return PlotSchema.getLayoutValObject(\n layout, Lib.nestedProperty({}, path).parts\n );\n}\n\nfunction getTraceInfo(trace, path) {\n return PlotSchema.getTraceValObject(\n trace, Lib.nestedProperty({}, path).parts\n );\n}\n\nfunction getNextPath(parent, key, path) {\n var nextPath;\n if(!path) nextPath = key;\n else if(Array.isArray(parent)) nextPath = path + '[' + key + ']';\n else nextPath = path + '.' + key;\n\n return nextPath;\n}\n\n/**\n * validateTemplate: Test for consistency between the given figure and\n * a template, either already included in the figure or given separately.\n * Note that not every issue we identify here is necessarily a problem,\n * it depends on what you're using the template for.\n *\n * @param {object|DOM element} figure: the plot, with {data, layout} members,\n * to test the template against\n * @param {Optional(object)} template: the template, with its own {data, layout},\n * to test. If omitted, we will look for a template already attached as the\n * plot's `layout.template` attribute.\n *\n * @returns {array} array of error objects each containing:\n * - {string} code\n * error code ('missing', 'unused', 'reused', 'noLayout', 'noData')\n * - {string} msg\n * a full readable description of the issue.\n */\nexports.validateTemplate = function(figureIn, template) {\n var figure = Lib.extendDeep({}, {\n _context: dfltConfig,\n data: figureIn.data,\n layout: figureIn.layout\n });\n var layout = figure.layout || {};\n if(!isPlainObject(template)) template = layout.template || {};\n var layoutTemplate = template.layout;\n var dataTemplate = template.data;\n var errorList = [];\n\n figure.layout = layout;\n figure.layout.template = template;\n Plots.supplyDefaults(figure);\n\n var fullLayout = figure._fullLayout;\n var fullData = figure._fullData;\n\n var layoutPaths = {};\n function crawlLayoutForContainers(obj, paths) {\n for(var key in obj) {\n if(key.charAt(0) !== '_' && isPlainObject(obj[key])) {\n var baseKey = getBaseKey(key);\n var nextPaths = [];\n var i;\n for(i = 0; i < paths.length; i++) {\n nextPaths.push(getNextPath(obj, key, paths[i]));\n if(baseKey !== key) nextPaths.push(getNextPath(obj, baseKey, paths[i]));\n }\n for(i = 0; i < nextPaths.length; i++) {\n layoutPaths[nextPaths[i]] = 1;\n }\n crawlLayoutForContainers(obj[key], nextPaths);\n }\n }\n }\n\n function crawlLayoutTemplateForContainers(obj, path) {\n for(var key in obj) {\n if(key.indexOf('defaults') === -1 && isPlainObject(obj[key])) {\n var nextPath = getNextPath(obj, key, path);\n if(layoutPaths[nextPath]) {\n crawlLayoutTemplateForContainers(obj[key], nextPath);\n } else {\n errorList.push({code: 'unused', path: nextPath});\n }\n }\n }\n }\n\n if(!isPlainObject(layoutTemplate)) {\n errorList.push({code: 'layout'});\n } else {\n crawlLayoutForContainers(fullLayout, ['layout']);\n crawlLayoutTemplateForContainers(layoutTemplate, 'layout');\n }\n\n if(!isPlainObject(dataTemplate)) {\n errorList.push({code: 'data'});\n } else {\n var typeCount = {};\n var traceType;\n for(var i = 0; i < fullData.length; i++) {\n var fullTrace = fullData[i];\n traceType = fullTrace.type;\n typeCount[traceType] = (typeCount[traceType] || 0) + 1;\n if(!fullTrace._fullInput._template) {\n // this takes care of the case of traceType in the data but not\n // the template\n errorList.push({\n code: 'missing',\n index: fullTrace._fullInput.index,\n traceType: traceType\n });\n }\n }\n for(traceType in dataTemplate) {\n var templateCount = dataTemplate[traceType].length;\n var dataCount = typeCount[traceType] || 0;\n if(templateCount > dataCount) {\n errorList.push({\n code: 'unused',\n traceType: traceType,\n templateCount: templateCount,\n dataCount: dataCount\n });\n } else if(dataCount > templateCount) {\n errorList.push({\n code: 'reused',\n traceType: traceType,\n templateCount: templateCount,\n dataCount: dataCount\n });\n }\n }\n }\n\n // _template: false is when someone tried to modify an array item\n // but there was no template with matching name\n function crawlForMissingTemplates(obj, path) {\n for(var key in obj) {\n if(key.charAt(0) === '_') continue;\n var val = obj[key];\n var nextPath = getNextPath(obj, key, path);\n if(isPlainObject(val)) {\n if(Array.isArray(obj) && val._template === false && val.templateitemname) {\n errorList.push({\n code: 'missing',\n path: nextPath,\n templateitemname: val.templateitemname\n });\n }\n crawlForMissingTemplates(val, nextPath);\n } else if(Array.isArray(val) && hasPlainObject(val)) {\n crawlForMissingTemplates(val, nextPath);\n }\n }\n }\n crawlForMissingTemplates({data: fullData, layout: fullLayout}, '');\n\n if(errorList.length) return errorList.map(format);\n};\n\nfunction hasPlainObject(arr) {\n for(var i = 0; i < arr.length; i++) {\n if(isPlainObject(arr[i])) return true;\n }\n}\n\nfunction format(opts) {\n var msg;\n switch(opts.code) {\n case 'data':\n msg = 'The template has no key data.';\n break;\n case 'layout':\n msg = 'The template has no key layout.';\n break;\n case 'missing':\n if(opts.path) {\n msg = 'There are no templates for item ' + opts.path +\n ' with name ' + opts.templateitemname;\n } else {\n msg = 'There are no templates for trace ' + opts.index +\n ', of type ' + opts.traceType + '.';\n }\n break;\n case 'unused':\n if(opts.path) {\n msg = 'The template item at ' + opts.path +\n ' was not used in constructing the plot.';\n } else if(opts.dataCount) {\n msg = 'Some of the templates of type ' + opts.traceType +\n ' were not used. The template has ' + opts.templateCount +\n ' traces, the data only has ' + opts.dataCount +\n ' of this type.';\n } else {\n msg = 'The template has ' + opts.templateCount +\n ' traces of type ' + opts.traceType +\n ' but there are none in the data.';\n }\n break;\n case 'reused':\n msg = 'Some of the templates of type ' + opts.traceType +\n ' were used more than once. The template has ' +\n opts.templateCount + ' traces, the data has ' +\n opts.dataCount + ' of this type.';\n break;\n }\n opts.msg = msg;\n\n return opts;\n}\n","'use strict';\n\nvar extendFlat = require('../lib/extend').extendFlat;\nvar isPlainObject = require('../lib/is_plain_object');\n\nvar traceOpts = {\n valType: 'flaglist',\n extras: ['none'],\n flags: ['calc', 'clearAxisTypes', 'plot', 'style', 'markerSize', 'colorbars'],\n description: [\n 'trace attributes should include an `editType` string matching this flaglist.',\n '*calc* is the most extensive: a full (re)plot starting by clearing `gd.calcdata`',\n 'to force it to be regenerated',\n '*clearAxisTypes* resets the types of the axes this trace is on, because new data could',\n 'cause the automatic axis type detection to change. Log type will not be cleared, as that',\n 'is never automatically chosen so must have been user-specified.',\n '*plot* (re)plots but without first clearing `gd.calcdata`.',\n '*style* only calls `module.style` (or module.editStyle) for all trace modules and redraws the legend.',\n '*markerSize* is like *style*, but propagate axis-range changes due to scatter `marker.size`',\n '*colorbars* only redraws colorbars.'\n ].join(' ')\n};\n\nvar layoutOpts = {\n valType: 'flaglist',\n extras: ['none'],\n flags: [\n 'calc', 'plot', 'legend', 'ticks', 'axrange',\n 'layoutstyle', 'modebar', 'camera', 'arraydraw', 'colorbars'\n ],\n description: [\n 'layout attributes should include an `editType` string matching this flaglist.',\n '*calc* is the most extensive: a full (re)plot starting by clearing `gd.calcdata`',\n 'to force it to be regenerated',\n '*plot* (re)plots but without first clearing `gd.calcdata`.',\n '*legend* only redraws the legend.',\n '*ticks* only redraws axis ticks, labels, and gridlines.',\n '*axrange* minimal sequence when updating axis ranges.',\n '*layoutstyle* reapplies global and SVG cartesian axis styles.',\n '*modebar* just updates the modebar.',\n '*camera* just updates the camera settings for gl3d scenes.',\n '*arraydraw* allows component arrays to invoke the redraw routines just for the',\n 'component(s) that changed.',\n '*colorbars* only redraws colorbars.'\n ].join(' ')\n};\n\n// flags for inside restyle/relayout include a few extras\n// that shouldn't be used in attributes, to deal with certain\n// combinations and conditionals efficiently\nvar traceEditTypeFlags = traceOpts.flags.slice()\n .concat(['fullReplot']);\n\nvar layoutEditTypeFlags = layoutOpts.flags.slice()\n .concat('layoutReplot');\n\nmodule.exports = {\n traces: traceOpts,\n layout: layoutOpts,\n /*\n * default (all false) edit flags for restyle (traces)\n * creates a new object each call, so the caller can mutate freely\n */\n traceFlags: function() { return falseObj(traceEditTypeFlags); },\n\n /*\n * default (all false) edit flags for relayout\n * creates a new object each call, so the caller can mutate freely\n */\n layoutFlags: function() { return falseObj(layoutEditTypeFlags); },\n\n /*\n * update `flags` with the `editType` values found in `attr`\n */\n update: function(flags, attr) {\n var editType = attr.editType;\n if(editType && editType !== 'none') {\n var editTypeParts = editType.split('+');\n for(var i = 0; i < editTypeParts.length; i++) {\n flags[editTypeParts[i]] = true;\n }\n }\n },\n\n overrideAll: overrideAll\n};\n\nfunction falseObj(keys) {\n var out = {};\n for(var i = 0; i < keys.length; i++) out[keys[i]] = false;\n return out;\n}\n\n/**\n * For attributes that are largely copied from elsewhere into a plot type that doesn't\n * support partial redraws - overrides the editType field of all attributes in the object\n *\n * @param {object} attrs: the attributes to override. Will not be mutated.\n * @param {string} editTypeOverride: the new editType to use\n * @param {'nested'|'from-root'} overrideContainers:\n * - 'nested' will override editType for nested containers but not the root.\n * - 'from-root' will also override editType of the root container.\n * Containers below the absolute top level (trace or layout root) DO need an\n * editType even if they are not `valObject`s themselves (eg `scatter.marker`)\n * to handle the case where you edit the whole container.\n *\n * @return {object} a new attributes object with `editType` modified as directed\n */\nfunction overrideAll(attrs, editTypeOverride, overrideContainers) {\n var out = extendFlat({}, attrs);\n for(var key in out) {\n var attr = out[key];\n if(isPlainObject(attr)) {\n out[key] = overrideOne(attr, editTypeOverride, overrideContainers, key);\n }\n }\n if(overrideContainers === 'from-root') out.editType = editTypeOverride;\n\n return out;\n}\n\nfunction overrideOne(attr, editTypeOverride, overrideContainers, key) {\n if(attr.valType) {\n var out = extendFlat({}, attr);\n out.editType = editTypeOverride;\n\n if(Array.isArray(attr.items)) {\n out.items = new Array(attr.items.length);\n for(var i = 0; i < attr.items.length; i++) {\n out.items[i] = overrideOne(attr.items[i], editTypeOverride, 'from-root');\n }\n }\n return out;\n } else {\n // don't provide an editType for the _deprecated container\n return overrideAll(attr, editTypeOverride,\n (key.charAt(0) === '_') ? 'nested' : 'from-root');\n }\n}\n","'use strict';\n\nvar isNumeric = require('fast-isnumeric');\n\nvar plotApi = require('./plot_api');\nvar plots = require('../plots/plots');\nvar Lib = require('../lib');\n\nvar helpers = require('../snapshot/helpers');\nvar toSVG = require('../snapshot/tosvg');\nvar svgToImg = require('../snapshot/svgtoimg');\nvar version = require('../version').version;\n\nvar attrs = {\n format: {\n valType: 'enumerated',\n values: ['png', 'jpeg', 'webp', 'svg', 'full-json'],\n dflt: 'png',\n description: 'Sets the format of exported image.'\n },\n width: {\n valType: 'number',\n min: 1,\n description: [\n 'Sets the exported image width.',\n 'Defaults to the value found in `layout.width`',\n 'If set to *null*, the exported image width will match the current graph width.'\n ].join(' ')\n },\n height: {\n valType: 'number',\n min: 1,\n description: [\n 'Sets the exported image height.',\n 'Defaults to the value found in `layout.height`',\n 'If set to *null*, the exported image height will match the current graph height.'\n ].join(' ')\n },\n scale: {\n valType: 'number',\n min: 0,\n dflt: 1,\n description: [\n 'Sets a scaling for the generated image.',\n 'If set, all features of a graphs (e.g. text, line width)',\n 'are scaled, unlike simply setting',\n 'a bigger *width* and *height*.'\n ].join(' ')\n },\n setBackground: {\n valType: 'any',\n dflt: false,\n description: [\n 'Sets the image background mode.',\n 'By default, the image background is determined by `layout.paper_bgcolor`,',\n 'the *transparent* mode.',\n 'One might consider setting `setBackground` to *opaque*',\n 'when exporting a *jpeg* image as JPEGs do not support opacity.'\n ].join(' ')\n },\n imageDataOnly: {\n valType: 'boolean',\n dflt: false,\n description: [\n 'Determines whether or not the return value is prefixed by',\n 'the image format\\'s corresponding \\'data:image;\\' spec.'\n ].join(' ')\n }\n};\n\n/** Plotly.toImage\n *\n * @param {object | string | HTML div} gd\n * can either be a data/layout/config object\n * or an existing graph
\n * or an id to an existing graph
\n * @param {object} opts (see above)\n * @return {promise}\n */\nfunction toImage(gd, opts) {\n opts = opts || {};\n\n var data;\n var layout;\n var config;\n var fullLayout;\n\n if(Lib.isPlainObject(gd)) {\n data = gd.data || [];\n layout = gd.layout || {};\n config = gd.config || {};\n fullLayout = {};\n } else {\n gd = Lib.getGraphDiv(gd);\n data = Lib.extendDeep([], gd.data);\n layout = Lib.extendDeep({}, gd.layout);\n config = gd._context;\n fullLayout = gd._fullLayout || {};\n }\n\n function isImpliedOrValid(attr) {\n return !(attr in opts) || Lib.validate(opts[attr], attrs[attr]);\n }\n\n if((!isImpliedOrValid('width') && opts.width !== null) ||\n (!isImpliedOrValid('height') && opts.height !== null)) {\n throw new Error('Height and width should be pixel values.');\n }\n\n if(!isImpliedOrValid('format')) {\n throw new Error('Export format is not ' + Lib.join2(attrs.format.values, ', ', ' or ') + '.');\n }\n\n var fullOpts = {};\n\n function coerce(attr, dflt) {\n return Lib.coerce(opts, fullOpts, attrs, attr, dflt);\n }\n\n var format = coerce('format');\n var width = coerce('width');\n var height = coerce('height');\n var scale = coerce('scale');\n var setBackground = coerce('setBackground');\n var imageDataOnly = coerce('imageDataOnly');\n\n // put the cloned div somewhere off screen before attaching to DOM\n var clonedGd = document.createElement('div');\n clonedGd.style.position = 'absolute';\n clonedGd.style.left = '-5000px';\n document.body.appendChild(clonedGd);\n\n // extend layout with image options\n var layoutImage = Lib.extendFlat({}, layout);\n if(width) {\n layoutImage.width = width;\n } else if(opts.width === null && isNumeric(fullLayout.width)) {\n layoutImage.width = fullLayout.width;\n }\n if(height) {\n layoutImage.height = height;\n } else if(opts.height === null && isNumeric(fullLayout.height)) {\n layoutImage.height = fullLayout.height;\n }\n\n // extend config for static plot\n var configImage = Lib.extendFlat({}, config, {\n _exportedPlot: true,\n staticPlot: true,\n setBackground: setBackground\n });\n\n var redrawFunc = helpers.getRedrawFunc(clonedGd);\n\n function wait() {\n return new Promise(function(resolve) {\n setTimeout(resolve, helpers.getDelay(clonedGd._fullLayout));\n });\n }\n\n function convert() {\n return new Promise(function(resolve, reject) {\n var svg = toSVG(clonedGd, format, scale);\n var width = clonedGd._fullLayout.width;\n var height = clonedGd._fullLayout.height;\n\n function cleanup() {\n plotApi.purge(clonedGd);\n document.body.removeChild(clonedGd);\n }\n\n if(format === 'full-json') {\n var json = plots.graphJson(clonedGd, false, 'keepdata', 'object', true, true);\n json.version = version;\n json = JSON.stringify(json);\n cleanup();\n if(imageDataOnly) {\n return resolve(json);\n } else {\n return resolve(helpers.encodeJSON(json));\n }\n }\n\n cleanup();\n\n if(format === 'svg') {\n if(imageDataOnly) {\n return resolve(svg);\n } else {\n return resolve(helpers.encodeSVG(svg));\n }\n }\n\n var canvas = document.createElement('canvas');\n canvas.id = Lib.randstr();\n\n svgToImg({\n format: format,\n width: width,\n height: height,\n scale: scale,\n canvas: canvas,\n svg: svg,\n // ask svgToImg to return a Promise\n // rather than EventEmitter\n // leave EventEmitter for backward\n // compatibility\n promise: true\n })\n .then(resolve)\n .catch(reject);\n });\n }\n\n function urlToImageData(url) {\n if(imageDataOnly) {\n return url.replace(helpers.IMAGE_URL_PREFIX, '');\n } else {\n return url;\n }\n }\n\n return new Promise(function(resolve, reject) {\n plotApi.newPlot(clonedGd, data, layoutImage, configImage)\n .then(redrawFunc)\n .then(wait)\n .then(convert)\n .then(function(url) { resolve(urlToImageData(url)); })\n .catch(function(err) { reject(err); });\n });\n}\n\nmodule.exports = toImage;\n","'use strict';\n\nvar d3 = require('@plotly/d3');\nvar Registry = require('../registry');\nvar Plots = require('../plots/plots');\n\nvar Lib = require('../lib');\nvar svgTextUtils = require('../lib/svg_text_utils');\nvar clearGlCanvases = require('../lib/clear_gl_canvases');\n\nvar Color = require('../components/color');\nvar Drawing = require('../components/drawing');\nvar Titles = require('../components/titles');\nvar ModeBar = require('../components/modebar');\n\nvar Axes = require('../plots/cartesian/axes');\nvar alignmentConstants = require('../constants/alignment');\nvar axisConstraints = require('../plots/cartesian/constraints');\nvar enforceAxisConstraints = axisConstraints.enforce;\nvar cleanAxisConstraints = axisConstraints.clean;\nvar doAutoRange = require('../plots/cartesian/autorange').doAutoRange;\n\nvar SVG_TEXT_ANCHOR_START = 'start';\nvar SVG_TEXT_ANCHOR_MIDDLE = 'middle';\nvar SVG_TEXT_ANCHOR_END = 'end';\n\nexports.layoutStyles = function(gd) {\n return Lib.syncOrAsync([Plots.doAutoMargin, lsInner], gd);\n};\n\nfunction overlappingDomain(xDomain, yDomain, domains) {\n for(var i = 0; i < domains.length; i++) {\n var existingX = domains[i][0];\n var existingY = domains[i][1];\n\n if(existingX[0] >= xDomain[1] || existingX[1] <= xDomain[0]) {\n continue;\n }\n if(existingY[0] < yDomain[1] && existingY[1] > yDomain[0]) {\n return true;\n }\n }\n return false;\n}\n\nfunction lsInner(gd) {\n var fullLayout = gd._fullLayout;\n var gs = fullLayout._size;\n var pad = gs.p;\n var axList = Axes.list(gd, '', true);\n var i, subplot, plotinfo, ax, xa, ya;\n\n fullLayout._paperdiv.style({\n width: (gd._context.responsive && fullLayout.autosize && !gd._context._hasZeroWidth && !gd.layout.width) ? '100%' : fullLayout.width + 'px',\n height: (gd._context.responsive && fullLayout.autosize && !gd._context._hasZeroHeight && !gd.layout.height) ? '100%' : fullLayout.height + 'px'\n })\n .selectAll('.main-svg')\n .call(Drawing.setSize, fullLayout.width, fullLayout.height);\n gd._context.setBackground(gd, fullLayout.paper_bgcolor);\n\n exports.drawMainTitle(gd);\n ModeBar.manage(gd);\n\n // _has('cartesian') means SVG specifically, not GL2D - but GL2D\n // can still get here because it makes some of the SVG structure\n // for shared features like selections.\n if(!fullLayout._has('cartesian')) {\n return Plots.previousPromises(gd);\n }\n\n function getLinePosition(ax, counterAx, side) {\n var lwHalf = ax._lw / 2;\n\n if(ax._id.charAt(0) === 'x') {\n if(!counterAx) return gs.t + gs.h * (1 - (ax.position || 0)) + (lwHalf % 1);\n else if(side === 'top') return counterAx._offset - pad - lwHalf;\n return counterAx._offset + counterAx._length + pad + lwHalf;\n }\n\n if(!counterAx) return gs.l + gs.w * (ax.position || 0) + (lwHalf % 1);\n else if(side === 'right') return counterAx._offset + counterAx._length + pad + lwHalf;\n return counterAx._offset - pad - lwHalf;\n }\n\n // some preparation of axis position info\n for(i = 0; i < axList.length; i++) {\n ax = axList[i];\n\n var counterAx = ax._anchorAxis;\n\n // clear axis line positions, to be set in the subplot loop below\n ax._linepositions = {};\n\n // stash crispRounded linewidth so we don't need to pass gd all over the place\n ax._lw = Drawing.crispRound(gd, ax.linewidth, 1);\n\n // figure out the main axis line and main mirror line position.\n // it's easier to follow the logic if we handle these separately from\n // ax._linepositions, which are only used by mirror=allticks\n // for non-main-subplot ticks, and mirror=all(ticks)? for zero line\n // hiding logic\n ax._mainLinePosition = getLinePosition(ax, counterAx, ax.side);\n ax._mainMirrorPosition = (ax.mirror && counterAx) ?\n getLinePosition(ax, counterAx,\n alignmentConstants.OPPOSITE_SIDE[ax.side]) : null;\n }\n\n // figure out which backgrounds we need to draw,\n // and in which layers to put them\n var lowerBackgroundIDs = [];\n var backgroundIds = [];\n var lowerDomains = [];\n // no need to draw background when paper and plot color are the same color,\n // activate mode just for large splom (which benefit the most from this\n // optimization), but this could apply to all cartesian subplots.\n var noNeedForBg = (\n Color.opacity(fullLayout.paper_bgcolor) === 1 &&\n Color.opacity(fullLayout.plot_bgcolor) === 1 &&\n fullLayout.paper_bgcolor === fullLayout.plot_bgcolor\n );\n\n for(subplot in fullLayout._plots) {\n plotinfo = fullLayout._plots[subplot];\n\n if(plotinfo.mainplot) {\n // mainplot is a reference to the main plot this one is overlaid on\n // so if it exists, this is an overlaid plot and we don't need to\n // give it its own background\n if(plotinfo.bg) {\n plotinfo.bg.remove();\n }\n plotinfo.bg = undefined;\n } else {\n var xDomain = plotinfo.xaxis.domain;\n var yDomain = plotinfo.yaxis.domain;\n var plotgroup = plotinfo.plotgroup;\n\n if(overlappingDomain(xDomain, yDomain, lowerDomains)) {\n var pgNode = plotgroup.node();\n var plotgroupBg = plotinfo.bg = Lib.ensureSingle(plotgroup, 'rect', 'bg');\n pgNode.insertBefore(plotgroupBg.node(), pgNode.childNodes[0]);\n backgroundIds.push(subplot);\n } else {\n plotgroup.select('rect.bg').remove();\n lowerDomains.push([xDomain, yDomain]);\n if(!noNeedForBg) {\n lowerBackgroundIDs.push(subplot);\n backgroundIds.push(subplot);\n }\n }\n }\n }\n\n // now create all the lower-layer backgrounds at once now that\n // we have the list of subplots that need them\n var lowerBackgrounds = fullLayout._bgLayer.selectAll('.bg')\n .data(lowerBackgroundIDs);\n\n lowerBackgrounds.enter().append('rect')\n .classed('bg', true);\n\n lowerBackgrounds.exit().remove();\n\n lowerBackgrounds.each(function(subplot) {\n fullLayout._plots[subplot].bg = d3.select(this);\n });\n\n // style all backgrounds\n for(i = 0; i < backgroundIds.length; i++) {\n plotinfo = fullLayout._plots[backgroundIds[i]];\n xa = plotinfo.xaxis;\n ya = plotinfo.yaxis;\n\n if(plotinfo.bg && xa._offset !== undefined && ya._offset !== undefined) {\n plotinfo.bg\n .call(Drawing.setRect,\n xa._offset - pad, ya._offset - pad,\n xa._length + 2 * pad, ya._length + 2 * pad)\n .call(Color.fill, fullLayout.plot_bgcolor)\n .style('stroke-width', 0);\n }\n }\n\n if(!fullLayout._hasOnlyLargeSploms) {\n for(subplot in fullLayout._plots) {\n plotinfo = fullLayout._plots[subplot];\n xa = plotinfo.xaxis;\n ya = plotinfo.yaxis;\n\n // Clip so that data only shows up on the plot area.\n var clipId = plotinfo.clipId = 'clip' + fullLayout._uid + subplot + 'plot';\n\n var plotClip = Lib.ensureSingleById(fullLayout._clips, 'clipPath', clipId, function(s) {\n s.classed('plotclip', true)\n .append('rect');\n });\n\n plotinfo.clipRect = plotClip.select('rect').attr({\n width: xa._length,\n height: ya._length\n });\n\n Drawing.setTranslate(plotinfo.plot, xa._offset, ya._offset);\n\n var plotClipId;\n var layerClipId;\n\n if(plotinfo._hasClipOnAxisFalse) {\n plotClipId = null;\n layerClipId = clipId;\n } else {\n plotClipId = clipId;\n layerClipId = null;\n }\n\n Drawing.setClipUrl(plotinfo.plot, plotClipId, gd);\n\n // stash layer clipId value (null or same as clipId)\n // to DRY up Drawing.setClipUrl calls on trace-module and trace layers\n // downstream\n plotinfo.layerClipId = layerClipId;\n }\n }\n\n var xLinesXLeft, xLinesXRight, xLinesYBottom, xLinesYTop,\n leftYLineWidth, rightYLineWidth;\n var yLinesYBottom, yLinesYTop, yLinesXLeft, yLinesXRight,\n connectYBottom, connectYTop;\n var extraSubplot;\n\n function xLinePath(y) {\n return 'M' + xLinesXLeft + ',' + y + 'H' + xLinesXRight;\n }\n\n function xLinePathFree(y) {\n return 'M' + xa._offset + ',' + y + 'h' + xa._length;\n }\n\n function yLinePath(x) {\n return 'M' + x + ',' + yLinesYTop + 'V' + yLinesYBottom;\n }\n\n function yLinePathFree(x) {\n if(ya._shift !== undefined) {\n x += ya._shift;\n }\n return 'M' + x + ',' + ya._offset + 'v' + ya._length;\n }\n\n function mainPath(ax, pathFn, pathFnFree) {\n if(!ax.showline || subplot !== ax._mainSubplot) return '';\n if(!ax._anchorAxis) return pathFnFree(ax._mainLinePosition);\n var out = pathFn(ax._mainLinePosition);\n if(ax.mirror) out += pathFn(ax._mainMirrorPosition);\n return out;\n }\n\n for(subplot in fullLayout._plots) {\n plotinfo = fullLayout._plots[subplot];\n xa = plotinfo.xaxis;\n ya = plotinfo.yaxis;\n\n /*\n * x lines get longer where they meet y lines, to make a crisp corner.\n * The x lines get the padding (margin.pad) plus the y line width to\n * fill up the corner nicely. Free x lines are excluded - they always\n * span exactly the data area of the plot\n *\n * | XXXXX\n * | XXXXX\n * |\n * +------\n * x1\n * -----\n * x2\n */\n var xPath = 'M0,0';\n if(shouldShowLinesOrTicks(xa, subplot)) {\n leftYLineWidth = findCounterAxisLineWidth(xa, 'left', ya, axList);\n xLinesXLeft = xa._offset - (leftYLineWidth ? (pad + leftYLineWidth) : 0);\n rightYLineWidth = findCounterAxisLineWidth(xa, 'right', ya, axList);\n xLinesXRight = xa._offset + xa._length + (rightYLineWidth ? (pad + rightYLineWidth) : 0);\n xLinesYBottom = getLinePosition(xa, ya, 'bottom');\n xLinesYTop = getLinePosition(xa, ya, 'top');\n\n // save axis line positions for extra ticks to reference\n // each subplot that gets ticks from \"allticks\" gets an entry:\n // [left or bottom, right or top]\n extraSubplot = (!xa._anchorAxis || subplot !== xa._mainSubplot);\n if(extraSubplot && (xa.mirror === 'allticks' || xa.mirror === 'all')) {\n xa._linepositions[subplot] = [xLinesYBottom, xLinesYTop];\n }\n\n xPath = mainPath(xa, xLinePath, xLinePathFree);\n if(extraSubplot && xa.showline && (xa.mirror === 'all' || xa.mirror === 'allticks')) {\n xPath += xLinePath(xLinesYBottom) + xLinePath(xLinesYTop);\n }\n\n plotinfo.xlines\n .style('stroke-width', xa._lw + 'px')\n .call(Color.stroke, xa.showline ?\n xa.linecolor : 'rgba(0,0,0,0)');\n }\n plotinfo.xlines.attr('d', xPath);\n\n /*\n * y lines that meet x axes get longer only by margin.pad, because\n * the x axes fill in the corner space. Free y axes, like free x axes,\n * always span exactly the data area of the plot\n *\n * | | XXXX\n * y2| y1| XXXX\n * | | XXXX\n * |\n * +-----\n */\n var yPath = 'M0,0';\n if(shouldShowLinesOrTicks(ya, subplot)) {\n connectYBottom = findCounterAxisLineWidth(ya, 'bottom', xa, axList);\n yLinesYBottom = ya._offset + ya._length + (connectYBottom ? pad : 0);\n connectYTop = findCounterAxisLineWidth(ya, 'top', xa, axList);\n yLinesYTop = ya._offset - (connectYTop ? pad : 0);\n yLinesXLeft = getLinePosition(ya, xa, 'left');\n yLinesXRight = getLinePosition(ya, xa, 'right');\n\n extraSubplot = (!ya._anchorAxis || subplot !== ya._mainSubplot);\n if(extraSubplot && (ya.mirror === 'allticks' || ya.mirror === 'all')) {\n ya._linepositions[subplot] = [yLinesXLeft, yLinesXRight];\n }\n\n yPath = mainPath(ya, yLinePath, yLinePathFree);\n if(extraSubplot && ya.showline && (ya.mirror === 'all' || ya.mirror === 'allticks')) {\n yPath += yLinePath(yLinesXLeft) + yLinePath(yLinesXRight);\n }\n\n plotinfo.ylines\n .style('stroke-width', ya._lw + 'px')\n .call(Color.stroke, ya.showline ?\n ya.linecolor : 'rgba(0,0,0,0)');\n }\n plotinfo.ylines.attr('d', yPath);\n }\n\n Axes.makeClipPaths(gd);\n\n return Plots.previousPromises(gd);\n}\n\nfunction shouldShowLinesOrTicks(ax, subplot) {\n return (ax.ticks || ax.showline) &&\n (subplot === ax._mainSubplot || ax.mirror === 'all' || ax.mirror === 'allticks');\n}\n\n/*\n * should we draw a line on counterAx at this side of ax?\n * It's assumed that counterAx is known to overlay the subplot we're working on\n * but it may not be its main axis.\n */\nfunction shouldShowLineThisSide(ax, side, counterAx) {\n // does counterAx get a line at all?\n if(!counterAx.showline || !counterAx._lw) return false;\n\n // are we drawing *all* lines for counterAx?\n if(counterAx.mirror === 'all' || counterAx.mirror === 'allticks') return true;\n\n var anchorAx = counterAx._anchorAxis;\n\n // is this a free axis? free axes can only have a subplot side-line with all(ticks)? mirroring\n if(!anchorAx) return false;\n\n // in order to handle cases where the user forgot to anchor this axis correctly\n // (because its default anchor has the same domain on the relevant end)\n // check whether the relevant position is the same.\n var sideIndex = alignmentConstants.FROM_BL[side];\n if(counterAx.side === side) {\n return anchorAx.domain[sideIndex] === ax.domain[sideIndex];\n }\n return counterAx.mirror && anchorAx.domain[1 - sideIndex] === ax.domain[1 - sideIndex];\n}\n\n/*\n * Is there another axis intersecting `side` end of `ax`?\n * First look at `counterAx` (the axis for this subplot),\n * then at all other potential counteraxes on or overlaying this subplot.\n * Take the line width from the first one that has a line.\n */\nfunction findCounterAxisLineWidth(ax, side, counterAx, axList) {\n if(shouldShowLineThisSide(ax, side, counterAx)) {\n return counterAx._lw;\n }\n for(var i = 0; i < axList.length; i++) {\n var axi = axList[i];\n if(axi._mainAxis === counterAx._mainAxis && shouldShowLineThisSide(ax, side, axi)) {\n return axi._lw;\n }\n }\n return 0;\n}\n\nexports.drawMainTitle = function(gd) {\n var title = gd._fullLayout.title;\n var fullLayout = gd._fullLayout;\n var textAnchor = getMainTitleTextAnchor(fullLayout);\n var dy = getMainTitleDy(fullLayout);\n var y = getMainTitleY(fullLayout, dy);\n var x = getMainTitleX(fullLayout, textAnchor);\n\n Titles.draw(gd, 'gtitle', {\n propContainer: fullLayout,\n propName: 'title.text',\n placeholder: fullLayout._dfltTitle.plot,\n attributes: ({\n x: x,\n y: y,\n 'text-anchor': textAnchor,\n dy: dy\n })\n });\n\n if(title.text && title.automargin) {\n var titleObj = d3.selectAll('.gtitle');\n var titleHeight = Drawing.bBox(titleObj.node()).height;\n var pushMargin = needsMarginPush(gd, title, titleHeight);\n if(pushMargin > 0) {\n applyTitleAutoMargin(gd, y, pushMargin, titleHeight);\n // Re-position the title once we know where it needs to be\n titleObj.attr({\n x: x,\n y: y,\n 'text-anchor': textAnchor,\n dy: getMainTitleDyAdj(title.yanchor)\n }).call(svgTextUtils.positionText, x, y);\n\n var extraLines = (title.text.match(svgTextUtils.BR_TAG_ALL) || []).length;\n if(extraLines) {\n var delta = alignmentConstants.LINE_SPACING * extraLines + alignmentConstants.MID_SHIFT;\n if(title.y === 0) {\n delta = -delta;\n }\n\n titleObj.selectAll('.line').each(function() {\n var newDy = +(this.getAttribute('dy')).slice(0, -2) - delta + 'em';\n this.setAttribute('dy', newDy);\n });\n }\n }\n }\n};\n\n\nfunction isOutsideContainer(gd, title, position, y, titleHeight) {\n var plotHeight = title.yref === 'paper' ? gd._fullLayout._size.h : gd._fullLayout.height;\n var yPosTop = Lib.isTopAnchor(title) ? y : y - titleHeight; // Standardize to the top of the title\n var yPosRel = position === 'b' ? plotHeight - yPosTop : yPosTop; // Position relative to the top or bottom of plot\n if((Lib.isTopAnchor(title) && position === 't') || Lib.isBottomAnchor(title) && position === 'b') {\n return false;\n } else {\n return yPosRel < titleHeight;\n }\n}\n\nfunction containerPushVal(position, titleY, titleYanchor, height, titleDepth) {\n var push = 0;\n if(titleYanchor === 'middle') {\n push += titleDepth / 2;\n }\n if(position === 't') {\n if(titleYanchor === 'top') {\n push += titleDepth;\n }\n push += (height - titleY * height);\n } else {\n if(titleYanchor === 'bottom') {\n push += titleDepth;\n }\n push += titleY * height;\n }\n return push;\n}\n\nfunction needsMarginPush(gd, title, titleHeight) {\n var titleY = title.y;\n var titleYanchor = title.yanchor;\n var position = titleY > 0.5 ? 't' : 'b';\n var curMargin = gd._fullLayout.margin[position];\n var pushMargin = 0;\n if(title.yref === 'paper') {\n pushMargin = (\n titleHeight +\n title.pad.t +\n title.pad.b\n );\n } else if(title.yref === 'container') {\n pushMargin = (\n containerPushVal(position, titleY, titleYanchor, gd._fullLayout.height, titleHeight) +\n title.pad.t +\n title.pad.b\n );\n }\n if(pushMargin > curMargin) {\n return pushMargin;\n }\n return 0;\n}\n\nfunction applyTitleAutoMargin(gd, y, pushMargin, titleHeight) {\n var titleID = 'title.automargin';\n var title = gd._fullLayout.title;\n var position = title.y > 0.5 ? 't' : 'b';\n var push = {\n x: title.x,\n y: title.y,\n t: 0,\n b: 0\n };\n var reservedPush = {};\n\n if(title.yref === 'paper' && isOutsideContainer(gd, title, position, y, titleHeight)) {\n push[position] = pushMargin;\n } else if(title.yref === 'container') {\n reservedPush[position] = pushMargin;\n gd._fullLayout._reservedMargin[titleID] = reservedPush;\n }\n Plots.allowAutoMargin(gd, titleID);\n Plots.autoMargin(gd, titleID, push);\n}\n\nfunction getMainTitleX(fullLayout, textAnchor) {\n var title = fullLayout.title;\n var gs = fullLayout._size;\n var hPadShift = 0;\n\n if(textAnchor === SVG_TEXT_ANCHOR_START) {\n hPadShift = title.pad.l;\n } else if(textAnchor === SVG_TEXT_ANCHOR_END) {\n hPadShift = -title.pad.r;\n }\n\n switch(title.xref) {\n case 'paper':\n return gs.l + gs.w * title.x + hPadShift;\n case 'container':\n default:\n return fullLayout.width * title.x + hPadShift;\n }\n}\n\nfunction getMainTitleY(fullLayout, dy) {\n var title = fullLayout.title;\n var gs = fullLayout._size;\n var vPadShift = 0;\n if(dy === '0em' || !dy) {\n vPadShift = -title.pad.b;\n } else if(dy === alignmentConstants.CAP_SHIFT + 'em') {\n vPadShift = title.pad.t;\n }\n\n if(title.y === 'auto') {\n return gs.t / 2;\n } else {\n switch(title.yref) {\n case 'paper':\n return gs.t + gs.h - gs.h * title.y + vPadShift;\n case 'container':\n default:\n return fullLayout.height - fullLayout.height * title.y + vPadShift;\n }\n }\n}\n\nfunction getMainTitleDyAdj(yanchor) {\n if(yanchor === 'top') {\n return alignmentConstants.CAP_SHIFT + 0.3 + 'em';\n } else if(yanchor === 'bottom') {\n return '-0.3em';\n } else {\n return alignmentConstants.MID_SHIFT + 'em';\n }\n}\n\nfunction getMainTitleTextAnchor(fullLayout) {\n var title = fullLayout.title;\n\n var textAnchor = SVG_TEXT_ANCHOR_MIDDLE;\n if(Lib.isRightAnchor(title)) {\n textAnchor = SVG_TEXT_ANCHOR_END;\n } else if(Lib.isLeftAnchor(title)) {\n textAnchor = SVG_TEXT_ANCHOR_START;\n }\n\n return textAnchor;\n}\n\nfunction getMainTitleDy(fullLayout) {\n var title = fullLayout.title;\n\n var dy = '0em';\n if(Lib.isTopAnchor(title)) {\n dy = alignmentConstants.CAP_SHIFT + 'em';\n } else if(Lib.isMiddleAnchor(title)) {\n dy = alignmentConstants.MID_SHIFT + 'em';\n }\n\n return dy;\n}\n\nexports.doTraceStyle = function(gd) {\n var calcdata = gd.calcdata;\n var editStyleCalls = [];\n var i;\n\n for(i = 0; i < calcdata.length; i++) {\n var cd = calcdata[i];\n var cd0 = cd[0] || {};\n var trace = cd0.trace || {};\n var _module = trace._module || {};\n\n // See if we need to do arraysToCalcdata\n // call it regardless of what change we made, in case\n // supplyDefaults brought in an array that was already\n // in gd.data but not in gd._fullData previously\n var arraysToCalcdata = _module.arraysToCalcdata;\n if(arraysToCalcdata) arraysToCalcdata(cd, trace);\n\n var editStyle = _module.editStyle;\n if(editStyle) editStyleCalls.push({fn: editStyle, cd0: cd0});\n }\n\n if(editStyleCalls.length) {\n for(i = 0; i < editStyleCalls.length; i++) {\n var edit = editStyleCalls[i];\n edit.fn(gd, edit.cd0);\n }\n clearGlCanvases(gd);\n exports.redrawReglTraces(gd);\n }\n\n Plots.style(gd);\n Registry.getComponentMethod('legend', 'draw')(gd);\n\n return Plots.previousPromises(gd);\n};\n\nexports.doColorBars = function(gd) {\n Registry.getComponentMethod('colorbar', 'draw')(gd);\n return Plots.previousPromises(gd);\n};\n\n// force plot() to redo the layout and replot with the modified layout\nexports.layoutReplot = function(gd) {\n var layout = gd.layout;\n gd.layout = undefined;\n return Registry.call('_doPlot', gd, '', layout);\n};\n\nexports.doLegend = function(gd) {\n Registry.getComponentMethod('legend', 'draw')(gd);\n return Plots.previousPromises(gd);\n};\n\nexports.doTicksRelayout = function(gd) {\n Axes.draw(gd, 'redraw');\n\n if(gd._fullLayout._hasOnlyLargeSploms) {\n Registry.subplotsRegistry.splom.updateGrid(gd);\n clearGlCanvases(gd);\n exports.redrawReglTraces(gd);\n }\n\n exports.drawMainTitle(gd);\n return Plots.previousPromises(gd);\n};\n\nexports.doModeBar = function(gd) {\n var fullLayout = gd._fullLayout;\n\n ModeBar.manage(gd);\n\n for(var i = 0; i < fullLayout._basePlotModules.length; i++) {\n var updateFx = fullLayout._basePlotModules[i].updateFx;\n if(updateFx) updateFx(gd);\n }\n\n return Plots.previousPromises(gd);\n};\n\nexports.doCamera = function(gd) {\n var fullLayout = gd._fullLayout;\n var sceneIds = fullLayout._subplots.gl3d;\n\n for(var i = 0; i < sceneIds.length; i++) {\n var sceneLayout = fullLayout[sceneIds[i]];\n var scene = sceneLayout._scene;\n\n scene.setViewport(sceneLayout);\n }\n};\n\nexports.drawData = function(gd) {\n var fullLayout = gd._fullLayout;\n\n clearGlCanvases(gd);\n\n // loop over the base plot modules present on graph\n var basePlotModules = fullLayout._basePlotModules;\n for(var i = 0; i < basePlotModules.length; i++) {\n basePlotModules[i].plot(gd);\n }\n\n exports.redrawReglTraces(gd);\n\n // styling separate from drawing\n Plots.style(gd);\n\n // draw components that can be drawn on axes,\n // and that do not push the margins\n Registry.getComponentMethod('selections', 'draw')(gd);\n Registry.getComponentMethod('shapes', 'draw')(gd);\n Registry.getComponentMethod('annotations', 'draw')(gd);\n Registry.getComponentMethod('images', 'draw')(gd);\n\n // Mark the first render as complete\n fullLayout._replotting = false;\n\n return Plots.previousPromises(gd);\n};\n\n// Draw (or redraw) all regl-based traces in one go,\n// useful during drag and selection where buffers of targeted traces are updated,\n// but all traces need to be redrawn following clearGlCanvases.\n//\n// Note that _module.plot for regl trace does NOT draw things\n// on the canvas, they only update the buffers.\n// Drawing is perform here.\n//\n// TODO try adding per-subplot option using gl.SCISSOR_TEST for\n// non-overlaying, disjoint subplots.\n//\n// TODO try to include parcoords in here.\n// https://github.com/plotly/plotly.js/issues/3069\nexports.redrawReglTraces = function(gd) {\n var fullLayout = gd._fullLayout;\n\n if(fullLayout._has('regl')) {\n var fullData = gd._fullData;\n var cartesianIds = [];\n var polarIds = [];\n var i, sp;\n\n if(fullLayout._hasOnlyLargeSploms) {\n fullLayout._splomGrid.draw();\n }\n\n // N.B.\n // - Loop over fullData (not _splomScenes) to preserve splom trace-to-trace ordering\n // - Fill list if subplot ids (instead of fullLayout._subplots) to handle cases where all traces\n // of a given module are `visible !== true`\n for(i = 0; i < fullData.length; i++) {\n var trace = fullData[i];\n\n if(trace.visible === true && trace._length !== 0) {\n if(trace.type === 'splom') {\n fullLayout._splomScenes[trace.uid].draw();\n } else if(trace.type === 'scattergl') {\n Lib.pushUnique(cartesianIds, trace.xaxis + trace.yaxis);\n } else if(trace.type === 'scatterpolargl') {\n Lib.pushUnique(polarIds, trace.subplot);\n }\n }\n }\n\n for(i = 0; i < cartesianIds.length; i++) {\n sp = fullLayout._plots[cartesianIds[i]];\n if(sp._scene) sp._scene.draw();\n }\n\n for(i = 0; i < polarIds.length; i++) {\n sp = fullLayout[polarIds[i]]._subplot;\n if(sp._scene) sp._scene.draw();\n }\n }\n};\n\nexports.doAutoRangeAndConstraints = function(gd) {\n var axList = Axes.list(gd, '', true);\n var ax;\n\n var autoRangeDone = {};\n\n for(var i = 0; i < axList.length; i++) {\n ax = axList[i];\n\n if(!autoRangeDone[ax._id]) {\n autoRangeDone[ax._id] = 1;\n cleanAxisConstraints(gd, ax);\n doAutoRange(gd, ax);\n\n // For matching axes, just propagate this autorange to the group.\n // The extra arg to doAutoRange avoids recalculating the range,\n // since doAutoRange by itself accounts for all matching axes. but\n // there are other side-effects of doAutoRange that we still want.\n var matchGroup = ax._matchGroup;\n if(matchGroup) {\n for(var id2 in matchGroup) {\n var ax2 = Axes.getFromId(gd, id2);\n doAutoRange(gd, ax2, ax.range);\n autoRangeDone[id2] = 1;\n }\n }\n }\n }\n\n enforceAxisConstraints(gd);\n};\n\n// An initial paint must be completed before these components can be\n// correctly sized and the whole plot re-margined. fullLayout._replotting must\n// be set to false before these will work properly.\nexports.finalDraw = function(gd) {\n // TODO: rangesliders really belong in marginPushers but they need to be\n // drawn after data - can we at least get the margin pushing part separated\n // out and done earlier?\n Registry.getComponentMethod('rangeslider', 'draw')(gd);\n // TODO: rangeselector only needs to be here (in addition to drawMarginPushers)\n // because the margins need to be fully determined before we can call\n // autorange and update axis ranges (which rangeselector needs to know which\n // button is active). Can we break out its automargin step from its draw step?\n Registry.getComponentMethod('rangeselector', 'draw')(gd);\n};\n\nexports.drawMarginPushers = function(gd) {\n Registry.getComponentMethod('legend', 'draw')(gd);\n Registry.getComponentMethod('rangeselector', 'draw')(gd);\n Registry.getComponentMethod('sliders', 'draw')(gd);\n Registry.getComponentMethod('updatemenus', 'draw')(gd);\n Registry.getComponentMethod('colorbar', 'draw')(gd);\n};\n","'use strict';\n\nvar isPlainObject = require('../lib/is_plain_object');\nvar noop = require('../lib/noop');\nvar Loggers = require('../lib/loggers');\nvar sorterAsc = require('../lib/search').sorterAsc;\nvar Registry = require('../registry');\n\n\nexports.containerArrayMatch = require('./container_array_match');\n\nvar isAddVal = exports.isAddVal = function isAddVal(val) {\n return val === 'add' || isPlainObject(val);\n};\n\nvar isRemoveVal = exports.isRemoveVal = function isRemoveVal(val) {\n return val === null || val === 'remove';\n};\n\n/*\n * applyContainerArrayChanges: for managing arrays of layout components in relayout\n * handles them all with a consistent interface.\n *\n * Here are the supported actions -> relayout calls -> edits we get here\n * (as prepared in _relayout):\n *\n * add an empty obj -> {'annotations[2]': 'add'} -> {2: {'': 'add'}}\n * add a specific obj -> {'annotations[2]': {attrs}} -> {2: {'': {attrs}}}\n * delete an obj -> {'annotations[2]': 'remove'} -> {2: {'': 'remove'}}\n * -> {'annotations[2]': null} -> {2: {'': null}}\n * delete the whole array -> {'annotations': 'remove'} -> {'': {'': 'remove'}}\n * -> {'annotations': null} -> {'': {'': null}}\n * edit an object -> {'annotations[2].text': 'boo'} -> {2: {'text': 'boo'}}\n *\n * You can combine many edits to different objects. Objects are added and edited\n * in ascending order, then removed in descending order.\n * For example, starting with [a, b, c], if you want to:\n * - replace b with d:\n * {'annotations[1]': d, 'annotations[2]': null} (b is item 2 after adding d)\n * - add a new item d between a and b, and edit b:\n * {'annotations[1]': d, 'annotations[2].x': newX} (b is item 2 after adding d)\n * - delete b and edit c:\n * {'annotations[1]': null, 'annotations[2].x': newX} (c is edited before b is removed)\n *\n * You CANNOT combine adding/deleting an item at index `i` with edits to the same index `i`\n * You CANNOT combine replacing/deleting the whole array with anything else (for the same array).\n *\n * @param {HTMLDivElement} gd\n * the DOM element of the graph container div\n * @param {Lib.nestedProperty} componentType: the array we are editing\n * @param {Object} edits\n * the changes to make; keys are indices to edit, values are themselves objects:\n * {attr: newValue} of changes to make to that index (with add/remove behavior\n * in special values of the empty attr)\n * @param {Object} flags\n * the flags for which actions we're going to perform to display these (and\n * any other) changes. If we're already `recalc`ing, we don't need to redraw\n * individual items\n * @param {function} _nestedProperty\n * a (possibly modified for gui edits) nestedProperty constructor\n * The modified version takes a 3rd argument, for a prefix to the attribute\n * string necessary for storing GUI edits\n *\n * @returns {bool} `true` if it managed to complete drawing of the changes\n * `false` would mean the parent should replot.\n */\nexports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, edits, flags, _nestedProperty) {\n var componentType = np.astr;\n var supplyComponentDefaults = Registry.getComponentMethod(componentType, 'supplyLayoutDefaults');\n var draw = Registry.getComponentMethod(componentType, 'draw');\n var drawOne = Registry.getComponentMethod(componentType, 'drawOne');\n var replotLater = flags.replot || flags.recalc || (supplyComponentDefaults === noop) || (draw === noop);\n var layout = gd.layout;\n var fullLayout = gd._fullLayout;\n\n if(edits['']) {\n if(Object.keys(edits).length > 1) {\n Loggers.warn('Full array edits are incompatible with other edits',\n componentType);\n }\n\n var fullVal = edits[''][''];\n\n if(isRemoveVal(fullVal)) np.set(null);\n else if(Array.isArray(fullVal)) np.set(fullVal);\n else {\n Loggers.warn('Unrecognized full array edit value', componentType, fullVal);\n return true;\n }\n\n if(replotLater) return false;\n\n supplyComponentDefaults(layout, fullLayout);\n draw(gd);\n return true;\n }\n\n var componentNums = Object.keys(edits).map(Number).sort(sorterAsc);\n var componentArrayIn = np.get();\n var componentArray = componentArrayIn || [];\n // componentArrayFull is used just to keep splices in line between\n // full and input arrays, so private keys can be copied over after\n // redoing supplyDefaults\n // TODO: this assumes componentArray is in gd.layout - which will not be\n // true after we extend this to restyle\n var componentArrayFull = _nestedProperty(fullLayout, componentType).get();\n\n var deletes = [];\n var firstIndexChange = -1;\n var maxIndex = componentArray.length;\n var i;\n var j;\n var componentNum;\n var objEdits;\n var objKeys;\n var objVal;\n var adding, prefix;\n\n // first make the add and edit changes\n for(i = 0; i < componentNums.length; i++) {\n componentNum = componentNums[i];\n objEdits = edits[componentNum];\n objKeys = Object.keys(objEdits);\n objVal = objEdits[''],\n adding = isAddVal(objVal);\n\n if(componentNum < 0 || componentNum > componentArray.length - (adding ? 0 : 1)) {\n Loggers.warn('index out of range', componentType, componentNum);\n continue;\n }\n\n if(objVal !== undefined) {\n if(objKeys.length > 1) {\n Loggers.warn(\n 'Insertion & removal are incompatible with edits to the same index.',\n componentType, componentNum);\n }\n\n if(isRemoveVal(objVal)) {\n deletes.push(componentNum);\n } else if(adding) {\n if(objVal === 'add') objVal = {};\n componentArray.splice(componentNum, 0, objVal);\n if(componentArrayFull) componentArrayFull.splice(componentNum, 0, {});\n } else {\n Loggers.warn('Unrecognized full object edit value',\n componentType, componentNum, objVal);\n }\n\n if(firstIndexChange === -1) firstIndexChange = componentNum;\n } else {\n for(j = 0; j < objKeys.length; j++) {\n prefix = componentType + '[' + componentNum + '].';\n _nestedProperty(componentArray[componentNum], objKeys[j], prefix)\n .set(objEdits[objKeys[j]]);\n }\n }\n }\n\n // now do deletes\n for(i = deletes.length - 1; i >= 0; i--) {\n componentArray.splice(deletes[i], 1);\n // TODO: this drops private keys that had been stored in componentArrayFull\n // does this have any ill effects?\n if(componentArrayFull) componentArrayFull.splice(deletes[i], 1);\n }\n\n if(!componentArray.length) np.set(null);\n else if(!componentArrayIn) np.set(componentArray);\n\n if(replotLater) return false;\n\n supplyComponentDefaults(layout, fullLayout);\n\n // finally draw all the components we need to\n // if we added or removed any, redraw all after it\n if(drawOne !== noop) {\n var indicesToDraw;\n if(firstIndexChange === -1) {\n // there's no re-indexing to do, so only redraw components that changed\n indicesToDraw = componentNums;\n } else {\n // in case the component array was shortened, we still need do call\n // drawOne on the latter items so they get properly removed\n maxIndex = Math.max(componentArray.length, maxIndex);\n indicesToDraw = [];\n for(i = 0; i < componentNums.length; i++) {\n componentNum = componentNums[i];\n if(componentNum >= firstIndexChange) break;\n indicesToDraw.push(componentNum);\n }\n for(i = firstIndexChange; i < maxIndex; i++) {\n indicesToDraw.push(i);\n }\n }\n for(i = 0; i < indicesToDraw.length; i++) {\n drawOne(gd, indicesToDraw[i]);\n }\n } else draw(gd);\n\n return true;\n};\n","'use strict';\n\nvar Lib = require('../lib');\nvar Plots = require('../plots/plots');\nvar PlotSchema = require('./plot_schema');\nvar dfltConfig = require('./plot_config').dfltConfig;\n\nvar isPlainObject = Lib.isPlainObject;\nvar isArray = Array.isArray;\nvar isArrayOrTypedArray = Lib.isArrayOrTypedArray;\n\n/**\n * Validate a data array and layout object.\n *\n * @param {array} data\n * @param {object} layout\n *\n * @return {array} array of error objects each containing:\n * - {string} code\n * error code ('object', 'array', 'schema', 'unused', 'invisible' or 'value')\n * - {string} container\n * container where the error occurs ('data' or 'layout')\n * - {number} trace\n * trace index of the 'data' container where the error occurs\n * - {array} path\n * nested path to the key that causes the error\n * - {string} astr\n * attribute string variant of 'path' compatible with Plotly.restyle and\n * Plotly.relayout.\n * - {string} msg\n * error message (shown in console in logger config argument is enable)\n */\nmodule.exports = function validate(data, layout) {\n if(data === undefined) data = [];\n if(layout === undefined) layout = {};\n\n var schema = PlotSchema.get();\n var errorList = [];\n var gd = {_context: Lib.extendFlat({}, dfltConfig)};\n\n var dataIn, layoutIn;\n\n if(isArray(data)) {\n gd.data = Lib.extendDeep([], data);\n dataIn = data;\n } else {\n gd.data = [];\n dataIn = [];\n errorList.push(format('array', 'data'));\n }\n\n if(isPlainObject(layout)) {\n gd.layout = Lib.extendDeep({}, layout);\n layoutIn = layout;\n } else {\n gd.layout = {};\n layoutIn = {};\n if(arguments.length > 1) {\n errorList.push(format('object', 'layout'));\n }\n }\n\n // N.B. dataIn and layoutIn are in general not the same as\n // gd.data and gd.layout after supplyDefaults as some attributes\n // in gd.data and gd.layout (still) get mutated during this step.\n\n Plots.supplyDefaults(gd);\n\n var dataOut = gd._fullData;\n var len = dataIn.length;\n\n for(var i = 0; i < len; i++) {\n var traceIn = dataIn[i];\n var base = ['data', i];\n\n if(!isPlainObject(traceIn)) {\n errorList.push(format('object', base));\n continue;\n }\n\n var traceOut = dataOut[i];\n var traceType = traceOut.type;\n var traceSchema = schema.traces[traceType].attributes;\n\n // PlotSchema does something fancy with trace 'type', reset it here\n // to make the trace schema compatible with Lib.validate.\n traceSchema.type = {\n valType: 'enumerated',\n values: [traceType]\n };\n\n if(traceOut.visible === false && traceIn.visible !== false) {\n errorList.push(format('invisible', base));\n }\n\n crawl(traceIn, traceOut, traceSchema, errorList, base);\n\n var transformsIn = traceIn.transforms;\n var transformsOut = traceOut.transforms;\n\n if(transformsIn) {\n if(!isArray(transformsIn)) {\n errorList.push(format('array', base, ['transforms']));\n }\n\n base.push('transforms');\n\n for(var j = 0; j < transformsIn.length; j++) {\n var path = ['transforms', j];\n var transformType = transformsIn[j].type;\n\n if(!isPlainObject(transformsIn[j])) {\n errorList.push(format('object', base, path));\n continue;\n }\n\n var transformSchema = schema.transforms[transformType] ?\n schema.transforms[transformType].attributes :\n {};\n\n // add 'type' to transform schema to validate the transform type\n transformSchema.type = {\n valType: 'enumerated',\n values: Object.keys(schema.transforms)\n };\n\n crawl(transformsIn[j], transformsOut[j], transformSchema, errorList, base, path);\n }\n }\n }\n\n var layoutOut = gd._fullLayout;\n var layoutSchema = fillLayoutSchema(schema, dataOut);\n\n crawl(layoutIn, layoutOut, layoutSchema, errorList, 'layout');\n\n // return undefined if no validation errors were found\n return (errorList.length === 0) ? void(0) : errorList;\n};\n\nfunction crawl(objIn, objOut, schema, list, base, path) {\n path = path || [];\n\n var keys = Object.keys(objIn);\n\n for(var i = 0; i < keys.length; i++) {\n var k = keys[i];\n\n // transforms are handled separately\n if(k === 'transforms') continue;\n\n var p = path.slice();\n p.push(k);\n\n var valIn = objIn[k];\n var valOut = objOut[k];\n\n var nestedSchema = getNestedSchema(schema, k);\n var nestedValType = (nestedSchema || {}).valType;\n var isInfoArray = nestedValType === 'info_array';\n var isColorscale = nestedValType === 'colorscale';\n var items = (nestedSchema || {}).items;\n\n if(!isInSchema(schema, k)) {\n list.push(format('schema', base, p));\n } else if(isPlainObject(valIn) && isPlainObject(valOut) && nestedValType !== 'any') {\n crawl(valIn, valOut, nestedSchema, list, base, p);\n } else if(isInfoArray && isArray(valIn)) {\n if(valIn.length > valOut.length) {\n list.push(format('unused', base, p.concat(valOut.length)));\n }\n var len = valOut.length;\n var arrayItems = Array.isArray(items);\n if(arrayItems) len = Math.min(len, items.length);\n var m, n, item, valInPart, valOutPart;\n if(nestedSchema.dimensions === 2) {\n for(n = 0; n < len; n++) {\n if(isArray(valIn[n])) {\n if(valIn[n].length > valOut[n].length) {\n list.push(format('unused', base, p.concat(n, valOut[n].length)));\n }\n var len2 = valOut[n].length;\n for(m = 0; m < (arrayItems ? Math.min(len2, items[n].length) : len2); m++) {\n item = arrayItems ? items[n][m] : items;\n valInPart = valIn[n][m];\n valOutPart = valOut[n][m];\n if(!Lib.validate(valInPart, item)) {\n list.push(format('value', base, p.concat(n, m), valInPart));\n } else if(valOutPart !== valInPart && valOutPart !== +valInPart) {\n list.push(format('dynamic', base, p.concat(n, m), valInPart, valOutPart));\n }\n }\n } else {\n list.push(format('array', base, p.concat(n), valIn[n]));\n }\n }\n } else {\n for(n = 0; n < len; n++) {\n item = arrayItems ? items[n] : items;\n valInPart = valIn[n];\n valOutPart = valOut[n];\n if(!Lib.validate(valInPart, item)) {\n list.push(format('value', base, p.concat(n), valInPart));\n } else if(valOutPart !== valInPart && valOutPart !== +valInPart) {\n list.push(format('dynamic', base, p.concat(n), valInPart, valOutPart));\n }\n }\n }\n } else if(nestedSchema.items && !isInfoArray && isArray(valIn)) {\n var _nestedSchema = items[Object.keys(items)[0]];\n var indexList = [];\n\n var j, _p;\n\n // loop over valOut items while keeping track of their\n // corresponding input container index (given by _index)\n for(j = 0; j < valOut.length; j++) {\n var _index = valOut[j]._index || j;\n\n _p = p.slice();\n _p.push(_index);\n\n if(isPlainObject(valIn[_index]) && isPlainObject(valOut[j])) {\n indexList.push(_index);\n var valInj = valIn[_index];\n var valOutj = valOut[j];\n if(isPlainObject(valInj) && valInj.visible !== false && valOutj.visible === false) {\n list.push(format('invisible', base, _p));\n } else crawl(valInj, valOutj, _nestedSchema, list, base, _p);\n }\n }\n\n // loop over valIn to determine where it went wrong for some items\n for(j = 0; j < valIn.length; j++) {\n _p = p.slice();\n _p.push(j);\n\n if(!isPlainObject(valIn[j])) {\n list.push(format('object', base, _p, valIn[j]));\n } else if(indexList.indexOf(j) === -1) {\n list.push(format('unused', base, _p));\n }\n }\n } else if(!isPlainObject(valIn) && isPlainObject(valOut)) {\n list.push(format('object', base, p, valIn));\n } else if(!isArrayOrTypedArray(valIn) && isArrayOrTypedArray(valOut) && !isInfoArray && !isColorscale) {\n list.push(format('array', base, p, valIn));\n } else if(!(k in objOut)) {\n list.push(format('unused', base, p, valIn));\n } else if(!Lib.validate(valIn, nestedSchema)) {\n list.push(format('value', base, p, valIn));\n } else if(nestedSchema.valType === 'enumerated' &&\n ((nestedSchema.coerceNumber && valIn !== +valOut) || valIn !== valOut)\n ) {\n list.push(format('dynamic', base, p, valIn, valOut));\n }\n }\n\n return list;\n}\n\n// the 'full' layout schema depends on the traces types presents\nfunction fillLayoutSchema(schema, dataOut) {\n var layoutSchema = schema.layout.layoutAttributes;\n\n for(var i = 0; i < dataOut.length; i++) {\n var traceOut = dataOut[i];\n var traceSchema = schema.traces[traceOut.type];\n var traceLayoutAttr = traceSchema.layoutAttributes;\n\n if(traceLayoutAttr) {\n if(traceOut.subplot) {\n Lib.extendFlat(layoutSchema[traceSchema.attributes.subplot.dflt], traceLayoutAttr);\n } else {\n Lib.extendFlat(layoutSchema, traceLayoutAttr);\n }\n }\n }\n\n return layoutSchema;\n}\n\n// validation error codes\nvar code2msgFunc = {\n object: function(base, astr) {\n var prefix;\n\n if(base === 'layout' && astr === '') prefix = 'The layout argument';\n else if(base[0] === 'data' && astr === '') {\n prefix = 'Trace ' + base[1] + ' in the data argument';\n } else prefix = inBase(base) + 'key ' + astr;\n\n return prefix + ' must be linked to an object container';\n },\n array: function(base, astr) {\n var prefix;\n\n if(base === 'data') prefix = 'The data argument';\n else prefix = inBase(base) + 'key ' + astr;\n\n return prefix + ' must be linked to an array container';\n },\n schema: function(base, astr) {\n return inBase(base) + 'key ' + astr + ' is not part of the schema';\n },\n unused: function(base, astr, valIn) {\n var target = isPlainObject(valIn) ? 'container' : 'key';\n\n return inBase(base) + target + ' ' + astr + ' did not get coerced';\n },\n dynamic: function(base, astr, valIn, valOut) {\n return [\n inBase(base) + 'key',\n astr,\n '(set to \\'' + valIn + '\\')',\n 'got reset to',\n '\\'' + valOut + '\\'',\n 'during defaults.'\n ].join(' ');\n },\n invisible: function(base, astr) {\n return (\n astr ? (inBase(base) + 'item ' + astr) : ('Trace ' + base[1])\n ) + ' got defaulted to be not visible';\n },\n value: function(base, astr, valIn) {\n return [\n inBase(base) + 'key ' + astr,\n 'is set to an invalid value (' + valIn + ')'\n ].join(' ');\n }\n};\n\nfunction inBase(base) {\n if(isArray(base)) return 'In data trace ' + base[1] + ', ';\n\n return 'In ' + base + ', ';\n}\n\nfunction format(code, base, path, valIn, valOut) {\n path = path || '';\n\n var container, trace;\n\n // container is either 'data' or 'layout\n // trace is the trace index if 'data', null otherwise\n\n if(isArray(base)) {\n container = base[0];\n trace = base[1];\n } else {\n container = base;\n trace = null;\n }\n\n var astr = convertPathToAttributeString(path);\n var msg = code2msgFunc[code](base, astr, valIn, valOut);\n\n // log to console if logger config option is enabled\n Lib.log(msg);\n\n return {\n code: code,\n container: container,\n trace: trace,\n path: path,\n astr: astr,\n msg: msg\n };\n}\n\nfunction isInSchema(schema, key) {\n var parts = splitKey(key);\n var keyMinusId = parts.keyMinusId;\n var id = parts.id;\n\n if((keyMinusId in schema) && schema[keyMinusId]._isSubplotObj && id) {\n return true;\n }\n\n return (key in schema);\n}\n\nfunction getNestedSchema(schema, key) {\n if(key in schema) return schema[key];\n\n var parts = splitKey(key);\n\n return schema[parts.keyMinusId];\n}\n\nvar idRegex = Lib.counterRegex('([a-z]+)');\n\nfunction splitKey(key) {\n var idMatch = key.match(idRegex);\n\n return {\n keyMinusId: idMatch && idMatch[1],\n id: idMatch && idMatch[2]\n };\n}\n\nfunction convertPathToAttributeString(path) {\n if(!isArray(path)) return String(path);\n\n var astr = '';\n\n for(var i = 0; i < path.length; i++) {\n var p = path[i];\n\n if(typeof p === 'number') {\n astr = astr.substr(0, astr.length - 1) + '[' + p + ']';\n } else {\n astr += p;\n }\n\n if(i < path.length - 1) astr += '.';\n }\n\n return astr;\n}\n"],"names":["isNumeric","require","m4FromQuat","Registry","Lib","Plots","AxisIds","Color","cleanId","getFromTrace","traceIs","cleanAxRef","container","attr","valIn","axLetter","charAt","cleanTitle","titleContainer","rewireAttr","oldAttrName","newAttrName","oldAttrSet","newAttrSet","title","text","cleanFinanceDir","dirContainer","isPlainObject","dirName","name","showlegend","String","commonPrefix","name1","name2","show1","show2","trim","i","minLen","Math","min","length","substr","cleanTextPosition","textposition","posY","posX","indexOf","emptyContainer","outer","innerStr","Object","keys","exports","clearPromiseQueue","gd","Array","isArray","_promises","log","cleanLayout","layout","j","xaxis1","xaxis","yaxis1","yaxis","scene1","scene","axisAttrRegex","subplotsRegistry","cartesian","attrRegex","polarAttrRegex","polar","ternaryAttrRegex","ternary","sceneAttrRegex","gl3d","key","test","ax","anchor","overlaying","type","isdate","islog","autorange","rangemode","insiderange","range","categories","domain","undefined","autotick","tickmode","radialaxis","aaxis","baxis","caxis","cameraposition","rotation","center","radius","mat","eye","camera","x","y","z","up","zaxis","annotationsLen","annotations","ann","ref","xref","yref","shapesLen","shapes","shape","imagesLen","images","image","legend","xanchor","yanchor","dragmode","clean","template","cleanData","data","tracei","trace","ybins","xbins","error_y","dc","defaults","yeColor","color","defaultLine","addOpacity","rgb","opacity","bardir","orientation","swapXYData","colorscale","scl","reversescale","reversescl","_module","getModule","colorbar","containerName","contours","dims","opts","highlightColor","highlightcolor","highlightWidth","highlightwidth","increasingShowlegend","increasing","decreasingShowlegend","decreasing","increasingName","decreasingName","newName","transforms","transform","filtersrc","target","calendar","valuecalendar","styles","style","prevStyles","styleKeys","push","value","line","marker","autobinx","autobiny","swapAttrs","transpose","error_x","errorY","copyYstyle","copy_ystyle","thickness","width","hoverinfo","hoverInfoParts","split","join","coerceTraceIndices","traceIndices","map","_","traceIndicesOut","isIndex","warn","manageArrayContainers","np","newVal","undoit","obj","parts","pLength","pLast","pLastIsNumber","contPath","slice","nestedProperty","get","splice","astr","set","ATTR_TAIL_RE","getParent","tail","search","hasParent","aobj","attrParent","axLetters","clearAxisTypes","traces","layoutUpdate","_fullData","axAttr","_name","sceneName","_id","typeAttr","module","arrayStr","match","rootContainers","layoutArrayContainers","regexpContainers","layoutArrayRegexes","rootPart","index","array","Number","property","configAttributes","staticPlot","valType","dflt","description","typesetMath","plotlyServerURL","editable","edits","annotationPosition","annotationTail","annotationText","axisTitleText","colorbarPosition","colorbarTitleText","legendPosition","legendText","shapePosition","titleText","editSelection","autosizable","responsive","fillFrame","frameMargins","max","scrollZoom","flags","extras","doubleClick","values","doubleClickDelay","showAxisDragHandles","showAxisRangeEntryBoxes","showTips","showLink","linkText","noBlank","sendData","showSources","displayModeBar","showSendToCloud","showEditInChartStudio","modeBarButtonsToRemove","modeBarButtonsToAdd","modeBarButtons","toImageButtonOptions","displaylogo","watermark","plotGlPixelRatio","setBackground","topojsonURL","mapboxAccessToken","logging","notifyOnLogging","queueLength","globalTransforms","locale","locales","dfltConfig","crawl","src","k","main","_doPlot","newPlot","restyle","relayout","redraw","update","_guiRestyle","_guiRelayout","_guiUpdate","_storeDirectGUIEdit","react","extendTraces","prependTraces","addTraces","deleteTraces","moveTraces","purge","addFrames","deleteFrames","animate","setPlotConfig","getGraphDiv","eraseActiveShape","deleteActiveShape","toImage","validate","downloadImage","templateApi","makeTemplate","validateTemplate","baseAttributes","baseLayoutAttributes","frameAttributes","animationAttributes","editTypes","extendDeepAll","isArrayOrTypedArray","valObjectMeta","IS_SUBPLOT_OBJ","IS_LINKED_TO_ARRAY","DEPRECATED","UNDERSCORE_ATTRS","recurseIntoValObject","valObject","_isLinkedToArray","newValObject","items","dimensions","index2","val","round","getLayoutAttributes","layoutAttributes","handleBasePlotModule","componentsRegistry","schema","subplots","xkey","shift","autoshift","insertAttrs","formatAttributes","getFramesAttributes","attrs","frames","makeSrcAttr","attrName","editType","callback","isValObject","arrayOk","role","mergeValTypeAndRole","itemName","formatArrayContainers","walk","RegExp","toString","stringify","baseAttrs","newAttrs","allTypes","forEach","basePlotModule","modules","attributes","copyBaseAttributes","copyModuleAttributes","level","fullAttrString","legendgroup","hoverlabel","selectPoints","selectedpoints","out","meta","animatable","Boolean","anim","getTraceAttributes","transformsRegistry","v","getTransformAttributes","defs","valObjects","metaKeys","concat","impliedEdits","animation","config","specifiedLevel","attrString","findArrayAttributes","baseContainer","baseAttrName","arrayAttributes","stack","isArrayStack","crawlIntoTrace","astrPartial","item","newAstrPartial","getTraceValObject","moduleAttrs","head","tNum","subplotModule","getLayoutValObject","fullLayout","basePlotModules","_basePlotModules","layoutAttrOverrides","baseOverrides","baseLayoutAttrOverrides","_modules","layoutHeadAttr","plotAttributes","TEMPLATEITEMNAME","templateAttrs","validItemName","arrayDefaultKey","lastChar","templatedArray","traceTemplater","dataTemplate","traceType","typeTemplates","traceCounts","newTrace","traceIn","traceOut","coerce","_template","typei","newContainer","baseName","part","arrayTemplater","inclusionAttr","defaultsTemplate","templateItems","usedNames","newItem","itemIn","_input","templateItemName","templateItem","defaultItems","outi","_templateitemname","arrayEditor","parentIn","containerStr","itemOut","lengthIn","_index","itemStr","resetUpdate","modifyItem","getUpdateObj","updateOut","modifyBase","applyUpdate","updateToApply","d3","hasHover","Events","Queue","PlotSchema","Axes","handleRangeDefaults","cartesianLayoutAttributes","Drawing","initInteractions","xmlnsNamespaces","clearOutline","manageArrays","helpers","subroutines","AX_NAME_PATTERN","numericNameWarningCount","emitAfterPlot","_fullLayout","_redrawFromAutoMarginCount","emit","bgColor","_paper","e","error","opaqueSetBackground","combine","setPlotContext","_context","extendDeep","base","select","_baseUrl","size","window","location","href","context","plot3dPixelRatio","_exportedPlot","_hasZeroHeight","clientHeight","_hasZeroWidth","clientWidth","szIn","szOut","_scrollZoom","geo","mapbox","positivifyIndices","indices","maxIndex","parentLength","positiveIndices","assertIndexArray","arrayName","parseInt","Error","checkMoveTracesArgs","currentIndices","newIndices","spliceTraces","maxPoints","updateArray","maxPointsIsObject","assertExtendTracesArgs","updateProps","prop","insert","maxp","constructor","floor","getExtendProperties","undoUpdate","undoPoints","concatTypedArray","arr0","arr1","arr2","_traces","Promise","reject","extendFlat","changed","specs","_restyle","calc","calcdata","seq","fullReplot","previousPromises","supplyDefaults","markerSize","doCalcdata","addAxRangeSequence","doTraceStyle","colorbars","doColorBars","rehover","redrag","reselect","add","redoit","plotDone","syncOrAsync","then","resolve","eventData","undefinedToNull","makeNP","preGUI","guiEditFlag","prefix","npSet","storeCurrent","arrayVal","arrayNew","maxLen","objVal","objNew","objBoth","fullData","_guiEditing","layoutNP","_preGUI","cleanDeprecatedAttributeKeys","axlist","traceFlags","a0","addToAxlist","axid","axName","id2name","autorangeAttr","rangeAttr","getFullTrace","traceIndex","doextra","a","extraparam","replace","_tracePreGUI","_fullInput","uid","allBins","binAttr","arrayBins","vij","ai","cont","contFull","param","oldVal","vi","finalPart","prefixDot","innerContFull","impliedKey","relativeAttr","labelsTo","valuesTo","_pielayer","selectAll","remove","gs","_size","orient","topOrBottom","thicknorm","h","w","lennorm","len","defaultOrientation","dataArrayContainers","swap","hovermode","plot","extendDeepNoArrays","oldAxisTitleRegex","counterRegex","colorbarRegex","oldAttrStr","newAttrStr","_relayout","layoutReplot","axRangeSupplyDefaultsByPass","doLegend","layoutstyle","layoutStyles","axrange","rangesAltered","ticks","doTicksRelayout","modebar","doModeBar","doCamera","axIn","axOut","options","axId","_matchGroup","axId2","ax2","drawAxes","axIds","id","getFromId","ticklabelposition","_anchorAxis","id2","draw","skipTitle","doAutoRangeAndConstraints","drawData","finalDraw","AX_RANGE_RE","AX_AUTORANGE_RE","AX_DOMAIN_RE","axes","list","arrayEdits","axisAttr","newkey","layoutFlags","p","recordAlteredAxis","pleafPlus","name2id","pend","pleaf","ptrunk","parentFull","vOld","oppositeAttr","_initialAutoSize","height","axFull","_inputDomain","toLog","fromLog","r0","r1","LN10","pow","_subplots","_subplot","viewInitial","getComponentMethod","fullProp","newType","containerArrayMatch","propStr","updateValObject","isAddVal","isRemoveVal","objEdits","reverse","_has","applyContainerArrayChanges","group","_constraintGroup","groupAxId","_constraintShrinkable","updateAutosize","oldWidth","oldHeight","autosize","plotAutoSize","traceUpdate","restyleSpecs","restyleFlags","relayoutSpecs","relayoutFlags","guiEdit","func","apply","arguments","layoutUIControlPatterns","pattern","traceUIControlPatterns","findUIPattern","patternSpecs","spec","getNewRev","revAttr","newRev","pop","uirevision","getFullTraceIndexFromUid","getTraceIndexFromUid","valsMatch","v1","v2","v1IsObj","v1IsArray","JSON","getDiffFlags","oldContainer","outerparts","getValObject","immutable","inArray","arrayIndex","pushUnique","arrays","nChanges","transition","nChangesAnim","newDataRevision","valObjectCanBeDataArray","tickMode","_compareAsJSON","canBeDataArray","wasArray","nowArray","inputKey","oldValIn","newValIn","arrayEditIndices","extraIndices","diffConfig","oldConfig","newConfig","calcInverseTransform","newBBox","getBoundingClientRect","equalDomRects","_lastBBox","m","_invTransform","inverseTransformMatrix","getFullTransformMatrix","_invScaleX","sqrt","_invScaleY","frameOrGroupNameOrFrameList","animationOpts","isPlotDiv","trans","_transitionData","_frameQueue","transitionOpts","supplyAnimationDefaults","frameOpts","frame","getTransitionOpts","getFrameOpts","callbackOnNthTime","cb","n","cnt","_frameWaitingCnt","nextFrame","_currentFrame","onComplete","newFrame","stringName","_lastFrameAt","Date","now","_timeToNext","duration","cancelAnimationFrame","_animationRaf","beginAnimationLoop","Infinity","_runningTransitions","doFrame","requestAnimationFrame","configCounter","setTransitionConfig","frameList","allFrames","isFrameArray","_frames","frameOrName","_frameHash","mode","next","onInterrupt","discardExistingFrames","direction","currentFrame","fromcurrent","idx","filteredFrameList","computedFrame","computeFrame","queueFrames","bigIndex","insertions","_frameHashLocal","lookupName","collisionPresent","supplyFrameDefaults","sort","b","ops","revops","frameCount","_counter","unshift","undoFunc","modifyFrames","redoFunc","undoArgs","redoArgs","promise","checkAddTracesArgs","startSequence","stopSequence","deletedTrace","sorterDes","undo","newArray","remainder","isTypedArray","none","both","numberOfItemsFromInsert","subarray","numberOfItemsFromTarget","targetBegin","newData","movingTraceMap","newIndex","cleanPlot","init","triggerHandler","classed","makeTester","graphWasEmpty","empty","hasCartesian","_replotting","_shouldCreateBgLayer","gd3","_calcInverseTransform","_container","enter","_paperdiv","append","_glcontainer","_toppaper","_modebardiv","_modeBar","_hoverpaper","_uid","otherUids","each","this","randstr","svgAttrs","_defs","_clips","_topdefs","_topclips","_bgLayer","_draggers","layerBelow","_imageLowerLayer","_shapeLowerLayer","_cartesianlayer","_polarlayer","_smithlayer","_ternarylayer","_geolayer","_funnelarealayer","_iciclelayer","_treemaplayer","_sunburstlayer","_indicatorlayer","_glimages","layerAbove","_imageUpperLayer","_shapeUpperLayer","_selectionLayer","_infolayer","_menulayer","_zoomlayer","_hoverlayer","makePlotFramework","initGradients","initPatterns","saveShowSpikeInitial","recalc","_responsiveChartHandler","isHidden","resize","addEventListener","clearResponsive","oldMargins","drawFrameworkCalls","marginPushers","clearAutoMarginIds","drawMarginPushers","allowAutoMargin","automargin","doAutoMargin","_transitioning","saveRangeInitial","drawFramework","_glcanvas","pick","d","position","top","left","overflow","regl","_gl","drawingBufferWidth","drawingBufferHeight","msg","didMarginChange","insideTickLabelsUpdaterange","_insideTickLabelsUpdaterange","addLinks","oldFullData","oldFullLayout","configChanged","oldRev","preGUIVal","newNP","layoutPreGUI","bothInheritAutorange","newAutorangeIn","newRangeAccepted","pre0","pre1","preAuto","newAx","allTracePreGUI","fullInput","tracePreGUI","fulli","newTracei","applyUIRevisions","skipUpdateCalc","newFullData","newFullLayout","datarevision","diffOpts","diffLayout","sameTraceLength","seenUIDs","hasMakesDataTransform","diffData","allNames","getOwnPropertyNames","q","start","substring","emptyCategories","_emptyCategories","supplyDefaultsUpdateCalc","createTransitionData","transitionFromReact","_skipDefaults","componentType","drawOne","noop","Template","mergeTemplates","oldTemplate","newTemplate","oldKeys","mergeOne","templater","oldItem","templateitemname","getBaseKey","key2","baseKey2","walkStyleKeys","parent","templateOut","getAttributeInfo","path","basePath","pathAttr","child","nextPath","getNextPath","nextBasePath","baseKey","_noTemplating","dfltDone","namedIndex","dfltPath","pathInArray","itemPropInArray","getLayoutInfo","getTraceInfo","hasPlainObject","arr","format","code","dataCount","templateCount","figure","traceTemplate","bind","oldTypeTemplates","oldTypeLen","typeLen","oldLayoutTemplate","oldDataTemplate","figureIn","layoutTemplate","errorList","layoutPaths","crawlLayoutForContainers","paths","nextPaths","crawlLayoutTemplateForContainers","typeCount","fullTrace","crawlForMissingTemplates","traceOpts","layoutOpts","traceEditTypeFlags","layoutEditTypeFlags","falseObj","overrideAll","editTypeOverride","overrideContainers","overrideOne","editTypeParts","plotApi","plots","toSVG","svgToImg","version","scale","imageDataOnly","isImpliedOrValid","join2","fullOpts","clonedGd","document","createElement","body","appendChild","layoutImage","configImage","redrawFunc","getRedrawFunc","wait","setTimeout","getDelay","convert","svg","cleanup","removeChild","json","graphJson","encodeJSON","encodeSVG","canvas","catch","url","IMAGE_URL_PREFIX","urlToImageData","err","svgTextUtils","clearGlCanvases","Titles","ModeBar","alignmentConstants","axisConstraints","enforceAxisConstraints","enforce","cleanAxisConstraints","doAutoRange","SVG_TEXT_ANCHOR_START","SVG_TEXT_ANCHOR_MIDDLE","SVG_TEXT_ANCHOR_END","overlappingDomain","xDomain","yDomain","domains","existingX","existingY","lsInner","subplot","plotinfo","xa","ya","pad","axList","call","setSize","paper_bgcolor","drawMainTitle","manage","getLinePosition","counterAx","side","lwHalf","_lw","_offset","_length","t","l","_linepositions","crispRound","linewidth","_mainLinePosition","_mainMirrorPosition","mirror","OPPOSITE_SIDE","lowerBackgroundIDs","backgroundIds","lowerDomains","noNeedForBg","plot_bgcolor","_plots","mainplot","bg","plotgroup","pgNode","node","plotgroupBg","ensureSingle","insertBefore","childNodes","xLinesXLeft","xLinesXRight","xLinesYBottom","xLinesYTop","leftYLineWidth","rightYLineWidth","yLinesYBottom","yLinesYTop","yLinesXLeft","yLinesXRight","connectYBottom","connectYTop","extraSubplot","lowerBackgrounds","exit","setRect","fill","_hasOnlyLargeSploms","plotClipId","layerClipId","clipId","plotClip","ensureSingleById","s","clipRect","setTranslate","_hasClipOnAxisFalse","setClipUrl","xLinePath","xLinePathFree","yLinePath","yLinePathFree","_shift","mainPath","pathFn","pathFnFree","showline","_mainSubplot","xPath","shouldShowLinesOrTicks","findCounterAxisLineWidth","xlines","stroke","linecolor","yPath","ylines","makeClipPaths","shouldShowLineThisSide","anchorAx","sideIndex","FROM_BL","axi","_mainAxis","getMainTitleDyAdj","CAP_SHIFT","MID_SHIFT","textAnchor","isRightAnchor","isLeftAnchor","getMainTitleTextAnchor","dy","isTopAnchor","isMiddleAnchor","getMainTitleDy","vPadShift","getMainTitleY","hPadShift","r","getMainTitleX","propContainer","propName","placeholder","_dfltTitle","titleObj","titleHeight","bBox","pushMargin","titleY","titleYanchor","curMargin","margin","titleDepth","containerPushVal","needsMarginPush","titleID","reservedPush","plotHeight","yPosTop","yPosRel","isBottomAnchor","isOutsideContainer","_reservedMargin","autoMargin","applyTitleAutoMargin","positionText","extraLines","BR_TAG_ALL","delta","LINE_SPACING","newDy","getAttribute","setAttribute","editStyleCalls","cd","cd0","arraysToCalcdata","editStyle","fn","edit","redrawReglTraces","splom","updateGrid","updateFx","sceneIds","sceneLayout","_scene","setViewport","sp","cartesianIds","polarIds","_splomGrid","visible","_splomScenes","autoRangeDone","matchGroup","Loggers","sorterAsc","_nestedProperty","supplyComponentDefaults","replotLater","replot","fullVal","componentNum","objKeys","adding","componentNums","componentArrayIn","componentArray","componentArrayFull","deletes","firstIndexChange","indicesToDraw","objIn","objOut","valOut","nestedSchema","getNestedSchema","nestedValType","isInfoArray","isColorscale","isInSchema","valInPart","valOutPart","arrayItems","len2","_p","_nestedSchema","indexList","valInj","valOutj","coerceNumber","dataIn","layoutIn","dataOut","traceSchema","transformsIn","transformsOut","transformType","transformSchema","layoutOut","layoutSchema","traceLayoutAttr","fillLayoutSchema","code2msgFunc","object","inBase","unused","dynamic","invisible","convertPathToAttributeString","splitKey","keyMinusId","_isSubplotObj","idRegex","idMatch"],"sourceRoot":""}