1{ 2 "version": 3, 3 "sources": ["../script/SketchCanvas.js", "../script/js-yaml.mjs", "https://deno.land/x/i18next@v23.11.4/logger.js", "https://deno.land/x/i18next@v23.11.4/EventEmitter.js", "https://deno.land/x/i18next@v23.11.4/utils.js", "https://deno.land/x/i18next@v23.11.4/ResourceStore.js", "https://deno.land/x/i18next@v23.11.4/postProcessor.js", "https://deno.land/x/i18next@v23.11.4/Translator.js", "https://deno.land/x/i18next@v23.11.4/LanguageUtils.js", "https://deno.land/x/i18next@v23.11.4/PluralResolver.js", "https://deno.land/x/i18next@v23.11.4/Interpolator.js", "https://deno.land/x/i18next@v23.11.4/Formatter.js", "https://deno.land/x/i18next@v23.11.4/BackendConnector.js", "https://deno.land/x/i18next@v23.11.4/defaults.js", "https://deno.land/x/i18next@v23.11.4/i18next.js", "https://deno.land/x/i18next@v23.11.4/index.js", "../script/translation.js"], 4 "sourcesContent": ["/// @brief The SketchCanvas class accepts a canvas object to draw on.\r\n/// @param canvas The canvas to draw the figure to.\r\n/// @param options An initialization parameters table that contains following items:\r\n/// editmode: The canvas is used for editing when true.\r\n/// debug: A function with one argument to output debug string.\r\n///\r\n/// Make sure to invoke this class's constructor with \"new\" prepended\r\n/// and keep the returned object to some variable.\r\n///\r\n/// It has following event handlers that can be assigned as this object's method.\r\n///\r\n/// function onLocalChange();\r\n/// This event is invoked when the canvas saves its contents into localStorage of the\r\n/// browser. Use this event to update list of locally saved figures.\r\n///\r\n/// function onUpdateServerList(list);\r\n/// This event is invoked when the object requests the server to refresh figure list\r\n/// and receives response.\r\n///\r\n/// function onUpdateData(data);\r\n/// This event is invoked when the contents of figure data is modified.\r\nimport jsyaml from './js-yaml.mjs';\r\nimport i18n from 'https://deno.land/x/i18next@v23.11.4/index.js';\r\nimport { resources } from './translation.js';\r\n\r\nexport function SketchCanvas(canvas, options){\r\n'use strict';\r\nvar editmode = options && options.editmode;\r\nvar scale = options && options.scale ? options.scale : 1;\r\n\r\n// Obtain the browser's preferred language.\r\nvar currentLanguage = (window.navigator.language || window.navigator.userLanguage || window.navigator.userLanguage);\r\ncurrentLanguage = currentLanguage.substr(0, 2);\r\n\r\ni18n.init({lng: currentLanguage, fallbackLng: 'en', resources: resources, getAsync: false});\r\n\r\nvar dobjs; // Drawing objects\r\nvar dhistory; // Drawing object history (for undoing)\r\nvar selectobj = [];\r\n\r\nvar handleSize = 4;\r\nvar gridEnable = false;\r\nvar gridSize = 8;\r\nvar toolButtonInterval = 36;\r\n\r\n// Called at the end of the constructor\r\nfunction onload(){\r\n\r\n // Check existence of canvas element and treating not compatible browsers\r\n if ( ! canvas || ! canvas.getContext ) {\r\n return false;\r\n }\r\n\r\n\t// Ignore mouse events if it's non-edit mode.\r\n\tif(editmode){\r\n\t\tcanvas.onclick = mouseLeftClick;\r\n\t\tcanvas.onmousedown = mouseDown;\r\n\t\tcanvas.onmouseup = mouseUp;\r\n\t\tcanvas.onmousemove = mouseMove;\r\n\t\tcanvas.onmouseout = mouseleave;\r\n\t\tcanvas.setAttribute(\"tabindex\", 0); // Make sure the canvas can have a key focus\r\n\t\tcanvas.onkeydown = keyDown;\r\n\t}\r\n\telse\r\n\t\tcanvas.onclick = viewModeClick;\r\n\r\n // 2D context\r\n ctx = canvas.getContext('2d');\r\n\t// Set a placeholder function to ignore setLineDash method for browsers that don't support it.\r\n\t// The method is not compatible with many browsers, but we don't care if it's not supported\r\n\t// because it's only used for selected object designation.\r\n\tif(!ctx.setLineDash) {\r\n\t\tctx.setLineDash = function(){};\r\n\t}\r\n\r\n\tvar aw = 20; // Arrow width\r\n\r\n\t// Previous toolbar page button\r\n\tbuttons.push(new Button(mx0, my0, mx0 + aw, my0 + mh0, function(){\r\n\t\tctx.fillStyle = 'rgb(127,127,127)';\r\n\t\tctx.beginPath();\r\n\t\tctx.moveTo(mx0, my0 + mh0 / 2);\r\n\t\tctx.lineTo(mx0 + aw, my0);\r\n\t\tctx.lineTo(mx0 + aw, my0 + mh0);\r\n\t\tctx.closePath();\r\n\t\tctx.fill();\r\n\t}, function(){\r\n\t\tdebug(\"clicked left\");\r\n\t\ttoolbarPage = Math.max(toolbarPage - 1, 0);\r\n\t\ttoolbar = toolbars[toolbarPage];\r\n\t\tcur_tool = toolbar[0];\r\n\t\tdraw();\r\n\t}));\r\n\r\n\t// Next toolbar page button\r\n\tbuttons.push(new Button(mx0 + mw0 - aw, my0, mx0 + mw0, my0 + mh0, function(){\r\n\t\tctx.beginPath();\r\n\t\tctx.moveTo(mx0 + mw0, my0 + mh0 / 2);\r\n\t\tctx.lineTo(mx0 + mw0 - aw, my0);\r\n\t\tctx.lineTo(mx0 + mw0 - aw, my0 + mh0);\r\n\t\tctx.closePath();\r\n\t\tctx.fill();\r\n\t}, function(){\r\n\t\tdebug(\"clicked right\");\r\n\t\ttoolbarPage = Math.min(toolbarPage + 1, toolbars.length-1);\r\n\t\ttoolbar = toolbars[toolbarPage];\r\n\t\tcur_tool = toolbar[0];\r\n\t\tdraw();\r\n\t}));\r\n\r\n resizeCanvas();\r\n draw();\r\n\r\n // Draw objects\r\n dobjs = [];\r\n\r\n // And the history of operations\r\n dhistory = [];\r\n}\r\n\r\nvar datadir = \"data\";\r\n\r\nfunction draw() {\r\n\tif(!editmode)\r\n\t\treturn;\r\n\t// Draw a rectangle\r\n\tctx.beginPath();\r\n\tctx.strokeStyle = 'rgb(192, 192, 77)'; // yellow\r\n\t\tctx.font = i18n.t(\"14px 'Courier'\");\r\n\tctx.strokeText('SketchCanvas Editor v0.1.6', 420, 10);\r\n\tctx.rect(x0, y0, w0, h0);\r\n\tctx.rect(x1, y1, w1, h1);\r\n\tctx.closePath();\r\n\tctx.stroke();\r\n\r\n\t// Background for the page text\r\n\tctx.fillStyle = 'rgb(255,255,255)';\r\n\tctx.fillRect(x0 + 1, y0 + 1, x1 - 2, y0 + h0 - 2);\r\n\r\n\t// Text indicating current toolbar page\r\n\tctx.fillStyle = 'rgb(0,0,0)';\r\n\tvar text = (toolbarPage + 1) + \"/\" + (toolbars.length);\r\n\tvar width = ctx.measureText(text).width;\r\n\tctx.fillText(text, mx0 + mw0 / 2 - width / 2, my0 + mh0 / 2);\r\n\r\n\t// menu\r\n\tdrawMenu();\r\n\tdrawTBox();\r\n\tdrawButtons();\r\n\tdrawCBox(cur_col);\r\n\tdrawHBox(cur_thin);\r\n}\r\n\r\n// draw coord(for Debug)\r\nfunction drawPos(x, y) {\r\n ctx.strokeText('X='+x+' Y='+y, x, y);\r\n}\r\n\r\n// Menu\r\nfunction drawMenu() {\r\n\tfor(var i=0;i<menus.length;i++) {\r\n\t\tctx.fillStyle = 'rgb(100, 200, 100)'; // green\r\n\t\tctx.fillRect(mx1+(i+0)*(mw1+10), my0, mw1, mh0);\r\n\t\t//ctx.strokeStyle = 'rgb(50, 192, 177)'; // cyan\r\n\t\tctx.strokeStyle = 'rgb(250, 250, 250)'; // white\r\n\t\tctx.strokeText(menus[i].text, mx1+10+(i+0)*(mw1+10), my0+20);\r\n\t}\r\n}\r\n\r\n/// Returns bounding box of a toolbar button.\r\nfunction getTBox(i){\r\n\treturn {minx: mx0, miny: my0 + toolButtonInterval + toolButtonInterval*i,\r\n\t\tmaxx: mx0 + mw0, maxy: my0 + toolButtonInterval + toolButtonInterval*i+mh0};\r\n}\r\n\r\n// Tool Box\r\nfunction drawTBox() {\r\n\tctx.fillStyle = 'rgb(255,255,255)';\r\n\tctx.fillRect(x0 + 1, my0 + mh0 + 1, x1 - 2, my0 + h0 - 2);\r\n\r\n\tfor(var i=0;i<toolbar.length;i++) {\r\n\t\tif (cur_tool === toolbar[i])\r\n\t\t\tctx.fillStyle = 'rgb(255, 80, 77)'; // red\r\n\t\telse\r\n\t\t\tctx.fillStyle = 'rgb(192, 80, 77)'; // red\r\n\t\tvar r = getTBox(i);\r\n\t\tctx.fillRect(r.minx, r.miny, r.maxx - r.minx, r.maxy - r.miny);\r\n\t\tctx.strokeStyle = 'rgb(250, 250, 250)'; // white\r\n\t\tdrawParts(toolbar[i], mx0+10, my0 + toolButtonInterval + 10 + (mh0+8)*i);\r\n\t}\r\n}\r\n\r\nfunction drawButtons(){\r\n\tfor(var i = 0; i < buttons.length; i++){\r\n\t\tif(\"ondraw\" in buttons[i])\r\n\t\t\tbuttons[i].ondraw();\r\n\t}\r\n}\r\n\r\n// Color Palette\r\nfunction drawCBox(no) {\r\n\tfor(var i=0;i<5;i++) {\r\n\t\tctx.beginPath();\r\n\t\tctx.fillStyle = colstr[i];\r\n\t\tvar x = mx2+(mw2+10)*i;\r\n\t\tctx.fillRect(x, my0, mw2, mh0);\r\n\t\tctx.stroke();\r\n\t\tif (4==i) {\t\t// border line if white\r\n\t\t\tctx.beginPath();\r\n\t\t\t//ctx.lineWidth = 1;\r\n\t\t\tctx.strokeStyle = gray;\r\n\t\t\tctx.rect(x, my0, mw2, mh0);\r\n\t\t\tctx.stroke();\r\n\t\t}\r\n\t\tif (no == i+31) {\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.strokeStyle = gray;\r\n\t\t\tctx.strokeText('\u25CB', x+9, my0+20);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// Thin Box\r\nfunction drawHBox(no) {\r\n\tfor(var i=0;i<3;i++) {\r\n\t\tctx.beginPath();\r\n\t\tif (no == i+41)\r\n\t\t\tctx.fillStyle = 'rgb(255, 80, 77)'; // red\r\n\t\telse\r\n\t\t\tctx.fillStyle = 'rgb(192, 80, 77)'; // red\r\n\t\tctx.fillRect(mx3+(mw2+10)*i, my0, mw2, mh0);\r\n\t\tctx.beginPath();\r\n\t\tctx.strokeStyle = white;\r\n\t\tctx.lineWidth = i + 1;\r\n\t\tctx.moveTo(mx3+(mw2+10)*i+10, my0+15);\r\n\t\tctx.lineTo(mx3+(mw2+10)*i+25, my0+15);\r\n\t\tctx.stroke();\r\n\t}\r\n\tctx.lineWidth = 1;\r\n}\r\n\r\n// draw toolbox\r\nfunction drawParts(tool, x, y) {\r\n\tif(tool.drawTool)\r\n\t\ttool.drawTool(x, y);\r\n\telse\r\n\t\tctx.strokeText(i18n.t('Unimplemented'), x, y);\r\n}\r\n\r\n// Returns bounding box for a drawing object.\r\nfunction objBounds(obj, rawvalue){\r\n\tvar ret = obj.getBoundingRect(rawvalue);\r\n\tif(!rawvalue){\r\n\t\tret.minx += offset.x;\r\n\t\tret.maxx += offset.x;\r\n\t\tret.miny += offset.y;\r\n\t\tret.maxy += offset.y;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\n// Expand given rectangle by an offset\r\nfunction expandRect(r, offset){\r\n\treturn {minx: r.minx - offset, miny : r.miny - offset,\r\n\t\tmaxx: r.maxx + offset, maxy: r.maxy + offset};\r\n}\r\n\r\n// Check if a point intersects with a rectangle\r\nfunction hitRect(r, x, y){\r\n\treturn r.minx < x && x < r.maxx && r.miny < y && y < r.maxy;\r\n}\r\n\r\n// Check if two rectangles intersect each other\r\nfunction intersectRect(r1, r2){\r\n\treturn r1.minx < r2.maxx && r2.minx < r1.maxx && r1.miny < r2.maxy && r2.miny < r1.maxy;\r\n}\r\n\r\nfunction mouseLeftClick(e) {\r\n\tif (3 == e.which) mouseRightClick(e);\r\n\telse {\r\n\t\tvar clrect = canvas.getBoundingClientRect();\r\n\t\tvar mx = e.clientX - clrect.left;\r\n\t\tvar my = e.clientY - clrect.top;\r\n\r\n\t\tfor(var i = 0; i < buttons.length; i++){\r\n\t\t\tif(hitRect(buttons[i], mx, my)){\r\n\t\t\t\tbuttons[i].onclick();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif(choiceTBox(mx, my))\r\n\t\t\treturn;\r\n\r\n\t\tvar menuno = checkMenu(mx, my);\r\n\t\tdebug(menuno);\r\n\t\tif (menuno < 0) {\t\t// draw area\r\n\t\t\tif(mx < offset.x || my < offset.y)\r\n\t\t\t\treturn;\r\n\t\t\tif(cur_tool.name === \"delete\"){ // delete\r\n\t\t\t\tfor(var i = 0; i < dobjs.length; i++){\r\n\t\t\t\t\t// For the time being, we use the bounding boxes of the objects\r\n\t\t\t\t\t// to determine the clicked object. It may be surprising\r\n\t\t\t\t\t// when a diagonal line gets deleted by clicking on seemingly\r\n\t\t\t\t\t// empty space, but we could fix it in the future.\r\n\t\t\t\t\tvar bounds = expandRect(objBounds(dobjs[i]), 10);\r\n\t\t\t\t\tif(hitRect(bounds, mx, my)){\r\n\t\t\t\t\t\t// If any dobj hits, save the current state to the undo buffer and delete the object.\r\n\t\t\t\t\t\tdhistory.push(cloneObject(dobjs));\r\n\t\t\t\t\t\t// Delete from selected object list, too.\r\n\t\t\t\t\t\tfor(var j = 0; j < selectobj.length;){\r\n\t\t\t\t\t\t\tif(selectobj[j] === dobjs[i])\r\n\t\t\t\t\t\t\t\tselectobj.splice(j, 1);\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\tj++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdobjs.splice(i, 1);\r\n\t\t\t\t\t\tredraw(dobjs);\r\n\t\t\t\t\t\tupdateDrawData();\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\telse if(cur_tool.name !== \"select\" && cur_tool.name !== \"pathedit\")\r\n\t\t\t\tcur_tool.appendPoint(mx, my);\r\n\t\t}\r\n\t\telse if (menuno < 10) {\r\n\t\t\tdrawMenu();\r\n\t\t\tmenus[menuno].onclick();\r\n\t\t}\r\n\t\telse if (menuno <= 40) {\r\n\t\t\tdrawCBox(menuno);\r\n\t\t\tcur_col = colnames[menuno-31];\r\n\t\t\tif(0 < selectobj.length){\r\n\t\t\t\tdhistory.push(cloneObject(dobjs));\r\n\t\t\t\tfor(var i = 0; i < selectobj.length; i++)\r\n\t\t\t\t\tselectobj[i].color = cur_col;\r\n\t\t\t\tupdateDrawData();\r\n\t\t\t\tredraw(dobjs);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tdrawHBox(menuno);\r\n\t\t\tcur_thin = menuno - 40;\r\n\t\t\tif(0 < selectobj.length){\r\n\t\t\t\tdhistory.push(cloneObject(dobjs));\r\n\t\t\t\tfor(var i = 0; i < selectobj.length; i++)\r\n\t\t\t\t\tselectobj[i].width = cur_thin;\r\n\t\t\t\tupdateDrawData();\r\n\t\t\t\tredraw(dobjs);\r\n\t\t\t}\r\n\t\t}\r\n\t\t//if (1 == menuno) debug('x='+arr[0].x + 'y='+arr[0].y);\r\n\t}\r\n}\r\n\r\nfunction mouseRightClick(e) {\r\n\t//drawPos(e.pageX, e.pageY);\r\n\t//cood = { x:e.pageX, y:e.pageY }\r\n\t//arr[idx] = cood;\r\n\t//idx++;\r\n\tdebug('idx='+idx);\r\n}\r\n\r\nvar movebase = [0,0];\r\nvar dragstart = [0,0];\r\nvar dragend = [0,0];\r\nvar moving = false;\r\nvar sizing = null; // Reference to object being resized. Null if no resizing is in progress.\r\nvar sizedir = 0;\r\nvar pointMoving = null;\r\nvar pointMovingIdx = 0;\r\nvar pointMovingCP = \"\"; ///< Control point for moving, \"\": vertex, \"c\": first control point, \"d\": second control point\r\nvar boxselecting = false;\r\nfunction pathEditMouseDown(e){\r\n\tvar clrect = canvas.getBoundingClientRect();\r\n\tvar mx = e.clientX - clrect.left;\r\n\tvar my = e.clientY - clrect.top;\r\n\r\n\t// Prioritize path editing over shape selection.\r\n\r\n\t// Check to see if we are dragging any of control points.\r\n\tfor(var n = 0; n < selectobj.length; n++){\r\n\t\t// Do not try to change shape of non-sizeable object.\r\n\t\tif(!selectobj[n].isSizeable())\r\n\t\t\tcontinue;\r\n\t\tvar pts = selectobj[n].points;\r\n\t\t// Grab a control point uder the mouse cursor to move it.\r\n\t\tfor(var i = 0; i < pts.length; i++){\r\n\t\t\tvar p = pts[i];\r\n\r\n\t\t\t// Function to check if we should start dragging one of vertices or\r\n\t\t\t// control points. Written as a local function to clarify logic.\r\n\t\t\tvar checkVertexHandle = function(self){\r\n\t\t\t\tif(!hitRect(pointHandle(p.x, p.y), mx - offset.x, my - offset.y))\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t// Check control points for only the \"path\" shapes.\r\n\t\t\t\t// Pressing Ctrl key before dragging the handle pulls out the\r\n\t\t\t\t// control point, even if the vertex didn't have one.\r\n\t\t\t\tif(selectobj[n].tool === \"path\" && e.ctrlKey){\r\n\t\t\t\t\tif(0 < i && !(\"dx\" in p))\r\n\t\t\t\t\t\tpointMovingCP = \"d\";\r\n\t\t\t\t\telse if(i+1 < pts.length && !(\"cx\" in pts[i+1])){\r\n\t\t\t\t\t\tpointMovingCP = \"c\";\r\n\t\t\t\t\t\tpointMoving = selectobj[n];\r\n\t\t\t\t\t\tpointMovingIdx = i+1;\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t\tpointMovingCP = \"\";\r\n\t\t\t\tpointMoving = selectobj[n];\r\n\t\t\t\tpointMovingIdx = i;\r\n\r\n\t\t\t\t// Remember clicked vertex for showing control handles\r\n\t\t\t\tvar needsRedraw = self.selectPointShape !== selectobj[n] || self.selectPointIdx !== pointMovingIdx;\r\n\t\t\t\tself.selectPointShape = selectobj[n];\r\n\t\t\t\tself.selectPointIdx = pointMovingIdx;\r\n\t\t\t\tif(needsRedraw) // Redraw only if the selected\r\n\t\t\t\t\tredraw(dobjs);\r\n\r\n\t\t\t\tdhistory.push(cloneObject(dobjs));\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\r\n\t\t\t// do{ ... }while(false) statement could do a similar trick, but we prefer\r\n\t\t\t// local functions for the ease of debugging and more concise expression.\r\n\t\t\tif(checkVertexHandle(this))\r\n\t\t\t\treturn;\r\n\r\n\t\t\t// Check for existing control points\r\n\t\t\t// Select only the control points around the selected vertex\r\n\t\t\tif(this.selectPointShape !== selectobj[n] || i < this.selectPointIdx || this.selectPointIdx + 1 < i)\r\n\t\t\t\tcontinue;\r\n\t\t\tif(\"cx\" in p && \"cy\" in p && hitRect(pointHandle(p.cx, p.cy), mx - offset.x, my - offset.y)){\r\n\t\t\t\tpointMoving = selectobj[n];\r\n\t\t\t\tpointMovingIdx = i;\r\n\t\t\t\tpointMovingCP = \"c\";\r\n\t\t\t\tdhistory.push(cloneObject(dobjs));\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif(\"dx\" in p && \"dy\" in p && hitRect(pointHandle(p.dx, p.dy), mx - offset.x, my - offset.y)){\r\n\t\t\t\tpointMoving = selectobj[n];\r\n\t\t\t\tpointMovingIdx = i;\r\n\t\t\t\tpointMovingCP = \"d\";\r\n\t\t\t\tdhistory.push(cloneObject(dobjs));\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tselectCommonMouseDown(mx, my);\r\n}\r\n\r\n/// A common method to select and pathedit tools.\r\n/// The pathedit tool can select objects, not to mention the select tool.\r\nfunction selectCommonMouseDown(mx, my){\r\n\r\n\tvar menuno = checkMenu(mx, my);\r\n\tif(0 <= menuno) // If we are clicking on a menu button, ignore this event\r\n\t\treturn null;\r\n\r\n\t// First, check if we clicked on one of already selected shapes.\r\n\t// if so, do not clear the selection and get ready to manipulate already selected shapes.\r\n\tfor(var i = 0; i < selectobj.length; i++){\r\n\t\tvar bounds = expandRect(objBounds(selectobj[i]), 10);\r\n\t\tif(hitRect(bounds, mx, my))\r\n\t\t\treturn true;\r\n\t}\r\n\r\n\t// Second, check if we clicked other shapes.\r\n\t// If so, clear the selection and select the new shape.\r\n\tfor(var i = 0; i < dobjs.length; i++){\r\n\t\t// For the time being, we use the bounding boxes of the objects\r\n\t\t// to determine the clicked object. It may be surprising\r\n\t\t// when a diagonal line gets deleted by clicking on seemingly\r\n\t\t// empty space, but we could fix it in the future.\r\n\t\tvar bounds = expandRect(objBounds(dobjs[i]), 10);\r\n\t\tif(hitRect(bounds, mx, my)){\r\n\t\t\t// If we haven't selected an object but clicked on an object, select it.\r\n\t\t\t// Single click always selects a single shape.\r\n\t\t\tselectobj = [dobjs[i]];\r\n\t\t\t// Forget point selection in pathedit tool if shape selection is changed.\r\n\t\t\ttoolmap.pathedit.selectPointIdx = -1;\r\n\t\t\tredraw(dobjs);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\n\treturn false;\r\n}\r\n\r\nfunction selectMouseDown(e){\r\n\tvar clrect = canvas.getBoundingClientRect();\r\n\tvar mx = e.clientX - clrect.left;\r\n\tvar my = e.clientY - clrect.top;\r\n\r\n\t// Prevent the select tool from clearing selection even if the mouse is on the\r\n\t// toolbar or the menu bar.\r\n\tif(mx < offset.x || my < offset.y)\r\n\t\treturn;\r\n\r\n\t// Enter sizing, moving or box-selecting mode only with select tool.\r\n\t// The pathedit tool should not bother interfering with these modes.\r\n\r\n\t// Check to see if we are dragging any of scaling handles.\r\n\tfor(var n = 0; n < selectobj.length; n++){\r\n\t\t// Do not try to change size of non-sizeable object.\r\n\t\tif(!selectobj[n].isSizeable())\r\n\t\t\tcontinue;\r\n\t\tvar bounds = objBounds(selectobj[n]);\r\n\t\t// Do not enter sizing mode if the object is point sized.\r\n\t\tif(1 <= Math.abs(bounds.maxx - bounds.minx) && 1 <= Math.abs(bounds.maxy - bounds.miny)){\r\n\t\t\tfor(var i = 0; i < 8; i++){\r\n\t\t\t\tif(hitRect(getHandleRect(bounds, i), mx, my)){\r\n\t\t\t\t\tsizedir = i;\r\n\t\t\t\t\tsizing = selectobj[n];\r\n\t\t\t\t\tdhistory.push(cloneObject(dobjs));\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tvar pointOnSelection = selectCommonMouseDown(mx, my);\r\n\r\n\t// If we're starting dragging on a selected object, enter moving mode.\r\n\tif(pointOnSelection){\r\n\t\tvar mx = gridEnable ? Math.round(mx / gridSize) * gridSize : mx;\r\n\t\tvar my = gridEnable ? Math.round(my / gridSize) * gridSize : my;\r\n\t\tmovebase = [mx, my];\r\n\t\tmoving = true;\r\n\t\tdhistory.push(cloneObject(dobjs));\r\n\t}\r\n\telse{\r\n\t\t// If no object is selected and dragging is started, it's box selection mode.\r\n\t\tboxselecting = true;\r\n\t\tselectobj = [];\r\n\t\tdragstart = [mx, my];\r\n\t}\r\n}\r\n\r\nfunction mouseDown(e){\r\n\tif(cur_tool)\r\n\t\tcur_tool.mouseDown(e);\r\n}\r\n\r\nfunction mouseUp(e){\r\n\tif(cur_tool)\r\n\t\tcur_tool.mouseUp(e);\r\n}\r\n\r\nfunction selectMouseMove(e){\r\n\tvar clrect = canvas.getBoundingClientRect();\r\n\tvar mx = (gridEnable ? Math.round(e.clientX / gridSize) * gridSize : e.clientX) - clrect.left;\r\n\tvar my = (gridEnable ? Math.round(e.clientY / gridSize) * gridSize : e.clientY) - clrect.top;\r\n\r\n\tif(0 < selectobj.length){\r\n\t\tif(moving){\r\n\t\t\tvar dx = mx - movebase[0];\r\n\t\t\tvar dy = my - movebase[1];\r\n\t\t\tfor(var n = 0; n < selectobj.length; n++){\r\n\t\t\t\tvar obj = selectobj[n];\r\n\t\t\t\tfor(var i = 0; i < obj.points.length; i++){\r\n\t\t\t\t\tvar pt = obj.points[i];\r\n\t\t\t\t\tpt.x += dx;\r\n\t\t\t\t\tpt.y += dy;\r\n\t\t\t\t\t// Move control points, too\r\n\t\t\t\t\tif(\"cx\" in pt && \"cy\" in pt)\r\n\t\t\t\t\t\tpt.cx += dx, pt.cy += dy;\r\n\t\t\t\t\tif(\"dx\" in pt && \"dy\" in pt)\r\n\t\t\t\t\t\tpt.dx += dx, pt.dy += dy;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tmovebase = [mx, my];\r\n\t\t\tredraw(dobjs);\r\n\t\t}\r\n\t\telse if(sizing){\r\n\t\t\t/* Definition of handle index and position\r\n\t\t\t\t0 --- 1 --- 2\r\n\t\t\t\t| |\r\n\t\t\t\t7 3\r\n\t\t\t\t| |\r\n\t\t\t\t6 --- 5 --- 4\r\n\t\t\t*/\r\n\t\t\tmx -= offset.x;\r\n\t\t\tmy -= offset.y;\r\n\t\t\tvar bounds = objBounds(sizing, true);\r\n\t\t\tvar ux = [-1,0,1,1,1,0,-1,-1][sizedir];\r\n\t\t\tvar uy = [-1,-1,-1,0,1,1,1,0][sizedir];\r\n\t\t\tvar xscale = ux === 0 ? 1 : (ux === 1 ? mx - bounds.minx : bounds.maxx - mx) / (bounds.maxx - bounds.minx);\r\n\t\t\tvar yscale = uy === 0 ? 1 : (uy === 1 ? my - bounds.miny : bounds.maxy - my) / (bounds.maxy - bounds.miny);\r\n\t\t\tvar obj = sizing;\r\n\t\t\tfor(var i = 0; i < obj.points.length; i++){\r\n\t\t\t\tvar pt = obj.points[i];\r\n\t\t\t\tif(ux !== 0 && xscale !== 0){\r\n\t\t\t\t\t// Scale control points, too\r\n\t\t\t\t\tvar props = [\"x\", \"cx\", \"dx\"];\r\n\t\t\t\t\tfor(var j = 0; j < props.length; j++){\r\n\t\t\t\t\t\tvar prop = props[j];\r\n\t\t\t\t\t\tif(!(prop in pt))\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\tpt[prop] = ux === 1 ?\r\n\t\t\t\t\t\t\t(pt[prop] - bounds.minx) * xscale + bounds.minx :\r\n\t\t\t\t\t\t\t(pt[prop] - bounds.maxx) * xscale + bounds.maxx;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(uy !== 0 && yscale !== 0){\r\n\t\t\t\t\t// Scale control points, too\r\n\t\t\t\t\tvar props = [\"y\", \"cy\", \"dy\"];\r\n\t\t\t\t\tfor(var j = 0; j < props.length; j++){\r\n\t\t\t\t\t\tvar prop = props[j];\r\n\t\t\t\t\t\tif(!(prop in pt))\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\tpt[prop] = uy === 1 ?\r\n\t\t\t\t\t\t\t(pt[prop] - bounds.miny) * yscale + bounds.miny :\r\n\t\t\t\t\t\t\t(pt[prop] - bounds.maxy) * yscale + bounds.maxy;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// Invert handle selection when the handle is dragged to the other side to enable mirror scaling.\r\n\t\t\tif(ux !== 0 && xscale < 0)\r\n\t\t\t\tsizedir = [2,1,0,7,6,5,4,3][sizedir];\r\n\t\t\tif(uy !== 0 && yscale < 0)\r\n\t\t\t\tsizedir = [6,5,4,3,2,1,0,7][sizedir];\r\n\t\t\tredraw(dobjs);\r\n\t\t}\r\n\t}\r\n\r\n\t// We could use e.buttons to check if it's supported by all the browsers,\r\n\t// but it seems not much trusty.\r\n\tif(!moving && !sizing && boxselecting){\r\n\t\tdragend = [mx, my];\r\n\t\tvar box = {\r\n\t\t\tminx: Math.min(dragstart[0], mx),\r\n\t\t\tmaxx: Math.max(dragstart[0], mx),\r\n\t\t\tminy: Math.min(dragstart[1], my),\r\n\t\t\tmaxy: Math.max(dragstart[1], my),\r\n\t\t}\r\n\t\tselectobj = [];\r\n\t\t// Select all intersecting objects with the dragged box.\r\n\t\tfor(var i = 0; i < dobjs.length; i++){\r\n\t\t\tvar bounds = expandRect(objBounds(dobjs[i]), 10);\r\n\t\t\tif(intersectRect(bounds, box))\r\n\t\t\t\tselectobj.push(dobjs[i]);\r\n\t\t}\r\n\t\tredraw(dobjs);\r\n\t}\r\n}\r\n\r\nfunction pathEditMouseMove(e){\r\n\tvar clrect = canvas.getBoundingClientRect();\r\n\tvar mx = (gridEnable ? Math.round(e.clientX / gridSize) * gridSize : e.clientX) - clrect.left;\r\n\tvar my = (gridEnable ? Math.round(e.clientY / gridSize) * gridSize : e.clientY) - clrect.top;\r\n\r\n\tif(0 < selectobj.length){\r\n\t\tif(pointMoving){\r\n\t\t\tmx -= offset.x;\r\n\t\t\tmy -= offset.y;\r\n\r\n\t\t\t// Relatively move a control point if it exists\r\n\t\t\tvar relmove = function(name, idx, dx, dy){\r\n\t\t\t\tif(pointMovingIdx + idx < 0 || pointMoving.points.length <= pointMovingIdx + idx)\r\n\t\t\t\t\treturn;\r\n\t\t\t\tvar p1 = pointMoving.points[pointMovingIdx + idx];\r\n\t\t\t\tif((name + \"x\") in p1) p1[name + \"x\"] += dx;\r\n\t\t\t\tif((name + \"y\") in p1) p1[name + \"y\"] += dy;\r\n\t\t\t}\r\n\r\n\t\t\tif(pointMovingCP === \"\"){\r\n\t\t\t\t// When moving a vertex, Bezier control points associated with that vertex\r\n\t\t\t\t// should move as well. We remember delta of position change and apply it\r\n\t\t\t\t// to the control points later.\r\n\t\t\t\tvar dx = mx - pointMoving.points[pointMovingIdx].x;\r\n\t\t\t\tvar dy = my - pointMoving.points[pointMovingIdx].y;\r\n\t\t\t\tpointMoving.points[pointMovingIdx].x = mx;\r\n\t\t\t\tpointMoving.points[pointMovingIdx].y = my;\r\n\t\t\t\t// If it's the last vertex, there's no control point toward the next vertex.\r\n\t\t\t\tif(pointMovingIdx + 1 < pointMoving.points.length)\r\n\t\t\t\t\trelmove(\"c\", 1, dx, dy);\r\n\t\t\t\trelmove(\"d\", 0, dx, dy);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tvar curpoint = pointMoving.points[pointMovingIdx];\r\n\t\t\t\tcurpoint[pointMovingCP + \"x\"] = mx;\r\n\t\t\t\tcurpoint[pointMovingCP + \"y\"] = my;\r\n\r\n\t\t\t\t// Move the control point in the opposite side of the vertex so that the\r\n\t\t\t\t// curve seems smooth. A line between a cubic Bezier spline curve's control point\r\n\t\t\t\t// and its vertex is tangent to the curve, so keeping the control points parallel\r\n\t\t\t\t// makes the connected Bezier curves look smooth. This could be done by hand-editing,\r\n\t\t\t\t// but it's very cumbersome to do everytime even single control point of spline is\r\n\t\t\t\t// edited.\r\n\t\t\t\t// Note that SVG's \"S\" or \"s\" path command can reflect the Bezier control point to\r\n\t\t\t\t// achieve similar effect, but the commands cannot specify distinct lengths for each\r\n\t\t\t\t// control points from the central vertex. So we keep using \"C\" command.\r\n\t\t\t\t// Sometimes the user wants to make a non-smooth path, so this functionality can be\r\n\t\t\t\t// disabled by pressing ALT key while dragging.\r\n\t\t\t\tif(!e.altKey && pointMovingCP === \"d\" && pointMovingIdx + 1 < pointMoving.points.length){\r\n\t\t\t\t\tvar nextpoint = pointMoving.points[pointMovingIdx + 1];\r\n\t\t\t\t\tif(\"cx\" in nextpoint && \"cy\" in nextpoint){\r\n\t\t\t\t\t\tvar dx = nextpoint.cx - curpoint.x;\r\n\t\t\t\t\t\tvar dy = nextpoint.cy - curpoint.y;\r\n\t\t\t\t\t\tvar len = Math.sqrt(dx * dx + dy * dy);\r\n\t\t\t\t\t\tvar angle = Math.atan2(dy, dx);\r\n\t\t\t\t\t\tvar newangle = Math.atan2(curpoint.y - curpoint.dy, curpoint.x - curpoint.dx);\r\n\t\t\t\t\t\tnextpoint.cx = curpoint.x + len * Math.cos(newangle);\r\n\t\t\t\t\t\tnextpoint.cy = curpoint.y + len * Math.sin(newangle);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse if(!e.altKey && pointMovingCP === \"c\" && 0 <= pointMovingIdx - 1){\r\n\t\t\t\t\tvar prevpoint = pointMoving.points[pointMovingIdx - 1];\r\n\t\t\t\t\tif(\"dx\" in prevpoint && \"dy\" in prevpoint){\r\n\t\t\t\t\t\tvar dx = prevpoint.dx - prevpoint.x;\r\n\t\t\t\t\t\tvar dy = prevpoint.dy - prevpoint.y;\r\n\t\t\t\t\t\tvar len = Math.sqrt(dx * dx + dy * dy);\r\n\t\t\t\t\t\tvar angle = Math.atan2(dy, dx);\r\n\t\t\t\t\t\tvar newangle = Math.atan2(prevpoint.y - curpoint.cy, prevpoint.x - curpoint.cx);\r\n\t\t\t\t\t\tprevpoint.dx = prevpoint.x + len * Math.cos(newangle);\r\n\t\t\t\t\t\tprevpoint.dy = prevpoint.y + len * Math.sin(newangle);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tredraw(dobjs);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction mouseMove(e){\r\n\tif(cur_tool.mouseMove)\r\n\t\tcur_tool.mouseMove(e);\r\n}\r\n\r\nfunction mouseleave(e){\r\n\tmoving = false;\r\n\tsizing = null;\r\n\tboxselecting = false;\r\n}\r\n\r\n/// Mouse click event handler for view mode.\r\n/// Some shapes respond to the event in view mode.\r\nfunction viewModeClick(e){\r\n\tvar clrect = canvas.getBoundingClientRect();\r\n\tvar mx = (gridEnable ? Math.round(e.clientX / gridSize) * gridSize : e.clientX) - clrect.left;\r\n\tvar my = (gridEnable ? Math.round(e.clientY / gridSize) * gridSize : e.clientY) - clrect.top;\r\n\tvar m = {x: mx / scale, y: my / scale}; /// Convert to the logical coordinate system before hit test\r\n\r\n\t// Check to see if we are dragging any of scaling handles.\r\n\tfor(var i = 0; i < dobjs.length; i++){\r\n\t\tif(!(\"viewModeClick\" in dobjs[i]))\r\n\t\t\tcontinue;\r\n\t\tvar bounds = expandRect(objBounds(dobjs[i]), 10);\r\n\t\tif(hitRect(bounds, m.x, m.y)){\r\n\t\t\tif(dobjs[i].viewModeClick(e))\r\n\t\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\nfunction keyDown(e){\r\n\te = e || window.event;\r\n\tif(cur_tool.keyDown)\r\n\t\tcur_tool.keyDown(e);\r\n}\r\n\r\n/// Delete given shapes from the canvas.\r\n/// Also deletes from selection list if matched.\r\n/// Passing selectobj variable itself as the argument clears the whole selection.\r\nfunction deleteShapes(shapes){\r\n\tfor (var i = 0; i < shapes.length; i++) {\r\n\t\tvar s = shapes[i];\r\n\t\tfor (var j = 0; j < dobjs.length; j++) {\r\n\t\t\tif(dobjs[j] === s){\r\n\t\t\t\tdobjs.splice(j, 1);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(shapes !== selectobj){\r\n\t\t\tfor (var j = 0; j < selectobj.length; j++) {\r\n\t\t\t\tif(selectobj[j] === s){\r\n\t\t\t\t\tselectobj.splice(j, 1);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif(shapes === selectobj)\r\n\t\tselectobj = [];\r\n}\r\n\r\n/// Constrain coordinate values if the grid is enabled.\r\nfunction constrainCoord(coord){\r\n\tif(gridEnable)\r\n\t\treturn { x: Math.round(coord.x / gridSize) * gridSize, y: Math.round(coord.y / gridSize) * gridSize };\r\n\telse\r\n\t\treturn { x: coord.x, y: coord.y };\r\n}\r\n\r\n/// Convert canvas coordinates to the source coordinates.\r\n/// These coordinates can differ when offset is not zero.\r\nfunction canvasToSrc(coord){\r\n\treturn { x: (coord.x - offset.x) / scale, y: (coord.y - offset.y) / scale };\r\n}\r\n\r\n// A local function to set font size with the global scaling factor in mind.\r\nfunction setFont(baseSize) {\r\n\tctx.font = baseSize + \"px 'Noto Sans Japanese', sans-serif\";\r\n}\r\n\r\n/// Draw a shape on the canvas.\r\nfunction drawCanvas(obj) {\r\n\tvar tool = toolmap[obj.tool];\r\n\tvar numPoints = tool.points;\r\n\r\n\ttool.setColor(coltable[obj.color]);\r\n\ttool.setWidth(obj.width);\r\n\tif(numPoints <= obj.points.length)\r\n\t\tif(tool.draw(obj))\r\n\t\t\treturn;\r\n}\r\n\r\nfunction getHandleRect(bounds, i){\r\n\tvar x, y;\r\n\tswitch(i){\r\n\tcase 0: x = bounds.minx, y = bounds.miny; break;\r\n\tcase 1: x = (bounds.minx+bounds.maxx)/2, y = bounds.miny; break;\r\n\tcase 2: x = bounds.maxx, y = bounds.miny; break;\r\n\tcase 3: x = bounds.maxx, y = (bounds.miny+bounds.maxy)/2; break;\r\n\tcase 4: x = bounds.maxx, y = bounds.maxy; break;\r\n\tcase 5: x = (bounds.minx+bounds.maxx)/2, y = bounds.maxy; break;\r\n\tcase 6: x = bounds.minx, y = bounds.maxy; break;\r\n\tcase 7: x = bounds.minx, y = (bounds.miny+bounds.maxy)/2; break;\r\n\tdefault: return;\r\n\t}\r\n\treturn pointHandle(x, y);\r\n}\r\n\r\n/// Returns a small rectangle surrounding the given point which is suitable for mouse-picking.\r\nfunction pointHandle(x, y){\r\n\treturn {minx: x - handleSize, miny: y - handleSize, maxx: x + handleSize, maxy: y + handleSize};\r\n}\r\n\r\n// Resize the canvas so that it fits the contents.\r\n// Note that the canvas contents are also cleared, so we might need to redraw everything.\r\nfunction resizeCanvas(){\r\n\tif(!editmode){\r\n\t\t// Resize the canvas so that the figure fits the size of canvas.\r\n\t\t// It's only done in view mode because we should show the toolbar and the menu bar\r\n\t\t// in edit mode.\r\n\t\tcanvas.width = metaObj.size[0] * scale;\r\n\t\tcanvas.height = metaObj.size[1] * scale;\r\n\t\tx1 = 0;\r\n\t\ty1 = 0;\r\n\t\toffset = {x:0, y:0};\r\n\t}\r\n\telse{\r\n\t\tcanvas.width = 1024;\r\n\t\tcanvas.height = 640;\r\n\t\tx1 = 90;\r\n\t\ty1 = 50;\r\n\t\toffset = {x:x1, y:y1};\r\n\t}\r\n}\r\n\r\n/// Draw a handle rectangle or a circle around a vertex or a control point\r\nfunction drawHandle(x, y, color, circle){\r\n\tvar r = pointHandle(x, y);\r\n\tctx.fillStyle = color;\r\n\tif(!circle)\r\n\t\tctx.fillRect(r.minx, r.miny, r.maxx - r.minx, r.maxy-r.miny);\r\n\tctx.beginPath();\r\n\tctx.strokeStyle = '#000';\r\n\tif(circle){\r\n\t\tctx.arc((r.minx + r.maxx) / 2., (r.miny + r.maxy) / 2, handleSize, 0, 2 * Math.PI, false);\r\n\t\tctx.fill();\r\n\t}\r\n\telse\r\n\t\tctx.rect(r.minx, r.miny, r.maxx - r.minx, r.maxy-r.miny);\r\n\tctx.stroke();\r\n}\r\n\r\n// redraw\r\nfunction redraw(pt) {\r\n\r\n\tclearCanvas();\r\n\r\n\t// Clip the drawing region when in edit mode in order to prevent shapes from\r\n\t// contaminate the menu bar and the toolbar.\r\n\tif(editmode){\r\n\t\tctx.save();\r\n\t\tctx.beginPath();\r\n\t\tctx.rect(x1,y1, w1, h1);\r\n\t\tctx.clip();\r\n\t}\r\n\r\n\tif(gridEnable){\r\n\t\tctx.fillStyle = \"#000\";\r\n\t\tfor(var ix = Math.ceil(x1 / gridSize); ix < (x1 + w1) / gridSize; ix++){\r\n\t\t\tfor(var iy = Math.ceil(y1 / gridSize); iy < (y1 + h1) / gridSize; iy++){\r\n\t\t\t\tctx.fillRect(ix * gridSize, iy * gridSize, 1, 1);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Translate and scale the coordinates by applying matrices before invoking drawCanvas().\r\n\tctx.save();\r\n\tctx.translate(offset.x, offset.y);\r\n\tctx.scale(scale, scale);\r\n\tfor (var i=0; i<pt.length; i++)\r\n\t\tdrawCanvas(pt[i]);\r\n\r\n\tif(cur_shape)\r\n\t\tdrawCanvas(cur_shape);\r\n\r\n\tctx.restore();\r\n\r\n\tif(boxselecting){\r\n\t\tctx.beginPath();\r\n\t\tctx.lineWidth = 1;\r\n\t\tctx.strokeStyle = '#000';\r\n\t\tctx.setLineDash([5]);\r\n\t\tctx.rect(dragstart[0], dragstart[1], dragend[0] - dragstart[0], dragend[1] - dragstart[1]);\r\n\t\tctx.stroke();\r\n\t\tctx.setLineDash([]);\r\n\t}\r\n\r\n\tfor(var n = 0; n < selectobj.length; n++)\r\n\t\tcur_tool.selectDraw(selectobj[n]);\r\n\r\n\tif(editmode)\r\n\t\tctx.restore();\r\n}\r\n\r\n// When pathedit tool is selected, draw handles on the shape's control points\r\n// and the path that connecting control points, but not the\r\n// bounding boxes and scaling handles, which could be annoying\r\n// because they're nothing to do with path editing.\r\nfunction pathEditSelectDraw(shape){\r\n\tvar pts = shape.points;\r\n\tctx.beginPath();\r\n\tctx.lineWidth = 1;\r\n\tctx.strokeStyle = '#000';\r\n\tif(toolmap[shape.tool].isArc){\r\n\t\tctx.setLineDash([5]);\r\n\t\tctx.moveTo(pts[0].x + offset.x, pts[0].y + offset.y);\r\n\t\tfor(var i = 1; i < pts.length; i++)\r\n\t\t\tctx.lineTo(pts[i].x + offset.x, pts[i].y + offset.y);\r\n\t\tctx.stroke();\r\n\t\tctx.setLineDash([]);\r\n\t}\r\n\r\n\t// Draws dashed line that connects a control point and its associated vertex\r\n\tfunction drawGuidingLine(pt0, name){\r\n\t\tctx.setLineDash([5]);\r\n\t\tctx.beginPath();\r\n\t\tctx.moveTo(pt0.x + offset.x, pt0.y + offset.y);\r\n\t\tctx.lineTo(pt[name + \"x\"] + offset.x, pt[name + \"y\"] + offset.y);\r\n\t\tctx.stroke();\r\n\t\tctx.setLineDash([]);\r\n\t}\r\n\r\n\tfor(var i = 0; i < pts.length; i++){\r\n\t\tvar pt = pts[i];\r\n\t\t// Indicate currently selected vertex with blue handle, otherwise gray\r\n\t\tdrawHandle(pt.x + offset.x, pt.y + offset.y,\r\n\t\t\tshape === this.selectPointShape && i === this.selectPointIdx ? '#7f7fff' : '#7f7f7f');\r\n\r\n\t\t// Draw handles for control point only around the selected vertex\r\n\t\tif(shape !== this.selectPointShape || i < this.selectPointIdx || this.selectPointIdx + 1 < i)\r\n\t\t\tcontinue;\r\n\r\n\t\t// Handles and guiding lines for the control points\r\n\t\tif(0 < i && \"cx\" in pt && \"cy\" in pt){\r\n\t\t\tdrawHandle(pt.cx + offset.x, pt.cy + offset.y, '#ff7f7f', true);\r\n\t\t\tdrawGuidingLine(pts[i-1], \"c\");\r\n\t\t}\r\n\t\tif(\"dx\" in pt && \"dy\" in pt){\r\n\t\t\tdrawHandle(pt.dx + offset.x, pt.dy + offset.y, '#ff7f7f', true);\r\n\t\t\tdrawGuidingLine(pt, \"d\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// ==================== Shape class definition ================================= //\r\nfunction Shape(){\r\n\tthis.tool = \"line\";\r\n\tthis.color = \"black\";\r\n\tthis.width = 1;\r\n\tthis.points = [];\r\n}\r\n//inherit(Shape, Object);\r\n\r\nShape.prototype.serialize = function(){\r\n\tfunction set_default(t,k,v,def){\r\n\t\tif(v !== def) \r\n\t\t\tt[k] = v;\r\n\t}\r\n\r\n\t// send parts to server\r\n\tvar dat = \"\";\r\n\tfor (var i=0; i<this.points.length; i++){\r\n\t\tif(i !== 0) dat += \":\";\r\n\t\t// Prepend control points if this vertex has them.\r\n\t\tif(\"cx\" in this.points[i] && \"cy\" in this.points[i])\r\n\t\t\tdat += this.points[i].cx+\",\"+this.points[i].cy+\",\";\r\n\t\tif(\"dx\" in this.points[i] && \"dy\" in this.points[i])\r\n\t\t\tdat += this.points[i].dx+\",\"+this.points[i].dy+\",\";\r\n\t\tdat += this.points[i].x+\",\"+this.points[i].y;\r\n\t}\r\n\tvar alldat = {\r\n\t\ttype: this.tool,\r\n\t\tpoints: dat\r\n\t};\r\n\t// Values with defaults needs not assigned a value when saved.\r\n\t// This will save space if the drawn element properties use many default values.\r\n\tset_default(alldat, \"color\", this.color, \"black\");\r\n\tset_default(alldat, \"width\", this.width, 1);\r\n\treturn alldat;\r\n};\r\n\r\nShape.prototype.isSizeable = function(){\r\n\treturn true;\r\n}\r\n\r\nShape.prototype.deserialize = function(obj){\r\n\tthis.color = obj.color || \"black\";\r\n\tthis.width = obj.width || 1;\r\n\tif(\"points\" in obj){\r\n\t\tvar pt1 = obj.points.split(\":\");\r\n\t\tvar arr = [];\r\n\t\tfor(var j = 0; j < pt1.length; j++){\r\n\t\t\tvar pt2 = pt1[j].split(\",\");\r\n\t\t\tvar pt = {};\r\n\t\t\tif(6 <= pt2.length){\r\n\t\t\t\tpt.cx = parseFloat(pt2[0]);\r\n\t\t\t\tpt.cy = parseFloat(pt2[1]);\r\n\t\t\t}\r\n\t\t\tif(4 <= pt2.length){\r\n\t\t\t\tpt.dx = parseFloat(pt2[pt2.length-4]);\r\n\t\t\t\tpt.dy = parseFloat(pt2[pt2.length-3]);\r\n\t\t\t}\r\n\t\t\tpt.x = parseFloat(pt2[pt2.length-2]);\r\n\t\t\tpt.y = parseFloat(pt2[pt2.length-1]);\r\n\t\t\tarr.push(pt);\r\n\t\t}\r\n\t\tthis.points = arr;\r\n\t}\r\n};\r\n\r\nShape.prototype.getBoundingRect = function(){\r\n\t// Get bounding box of the object\r\n\tvar maxx, maxy, minx, miny;\r\n\tfor(var j = 0; j < this.points.length; j++){\r\n\t\tvar x = this.points[j].x;\r\n\t\tif(maxx === undefined || maxx < x)\r\n\t\t\tmaxx = x;\r\n\t\tif(minx === undefined || x < minx)\r\n\t\t\tminx = x;\r\n\t\tvar y = this.points[j].y;\r\n\t\tif(maxy === undefined || maxy < y)\r\n\t\t\tmaxy = y;\r\n\t\tif(miny === undefined || y < miny)\r\n\t\t\tminy = y;\r\n\t}\r\n\treturn {minx: minx, miny: miny, maxx: maxx, maxy: maxy};\r\n};\r\n// ==================== Shape class definition end ================================= //\r\n\r\n// ==================== PointShape class definition ================================= //\r\nfunction PointShape(){\r\n\tShape.call(this);\r\n}\r\ninherit(PointShape, Shape);\r\n\r\nPointShape.prototype.isSizeable = function(){\r\n\treturn false;\r\n}\r\n\r\nPointShape.prototype.getBoundingRect = function(){\r\n\tvar height = 20;\r\n\tvar width = 20;\r\n\treturn {minx: this.points[0].x, miny: this.points[0].y,\r\n\t\tmaxx: this.points[0].x + width, maxy: this.points[0].y + height};\r\n}\r\n// ==================== PointOject class definition end ================================= //\r\n\r\n// ==================== TextShape class definition ================================= //\r\nfunction TextShape(){\r\n\tShape.call(this);\r\n\tthis.text = \"\";\r\n\tthis.link = \"\";\r\n}\r\ninherit(TextShape, Shape);\r\n\r\nTextShape.prototype.serialize = function(){\r\n\tvar alldat = Shape.prototype.serialize.call(this);\r\n\talldat.text = this.text;\r\n\tif(this.link) alldat.link = this.link; // Do not serialize blank URL\r\n\treturn alldat;\r\n}\r\n\r\nTextShape.prototype.deserialize = function(obj){\r\n\tShape.prototype.deserialize.call(this, obj);\r\n\tif (undefined !== obj.text) this.text = obj.text;\r\n\tif(undefined !== obj.link) this.link = obj.link;\r\n};\r\n\r\nTextShape.prototype.isSizeable = function(){\r\n\treturn false;\r\n}\r\n\r\nTextShape.prototype.getBoundingRect = function(){\r\n\tvar height = this.width === 1 ? 14 : this.width === 2 ? 16 : 20;\r\n\tvar oldfont = ctx.font;\r\n\tctx.font = setFont(height);\r\n\tvar width = ctx.measureText(this.text).width;\r\n\tctx.font = oldfont;\r\n\treturn {minx: this.points[0].x, miny: this.points[0].y - height,\r\n\t\tmaxx: this.points[0].x + width, maxy: this.points[0].y};\r\n}\r\n\r\n/// Click event in view mode\r\nTextShape.prototype.viewModeClick = function(e){\r\n\tif(\"link\" in this && this.link){\r\n\t\tlocation.href = this.link;\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n// ==================== TextShape class definition end ================================= //\r\n\r\n// ==================== PathShape class definition ================================= //\r\nfunction PathShape(){\r\n\tShape.call(this);\r\n}\r\ninherit(PathShape, Shape);\r\n\r\n/// Custom serializer for SVG-compatible path data\r\nPathShape.prototype.serialize = function(){\r\n\tvar alldat = Shape.prototype.serialize.call(this);\r\n\tvar src = \"\";\r\n\tfor (var i=0; i<this.points.length; i++){\r\n\t\tvar pt = this.points[i];\r\n\t\tif(i !== 0 && (\"cx\" in pt && \"cy\" in pt || \"dx\" in pt && \"dy\" in pt)){\r\n\t\t\tsrc += \"C\"; // Bezier curve command. 'S' command is not yet supported.\r\n\t\t\t// Prepend control points if this vertex has them.\r\n\t\t\tif(\"cx\" in pt && \"cy\" in pt)\r\n\t\t\t\tsrc += pt.cx+\",\"+pt.cy+\" \";\r\n\t\t\telse\r\n\t\t\t\tsrc += this.points[i-1].x+\",\"+this.points[i-1].y+\" \";\r\n\t\t\tif(\"dx\" in pt && \"dy\" in pt)\r\n\t\t\t\tsrc += pt.dx+\",\"+pt.dy+\" \";\r\n\t\t\telse\r\n\t\t\t\tsrc += pt.x+\",\"+pt.y+\" \";\r\n\t\t}\r\n\t\telse if(i === 0)\r\n\t\t\tsrc += \"M\"; // Moveto command\r\n\t\telse\r\n\t\t\tsrc += \"L\"; // Lineto command\r\n\t\tsrc += pt.x+\",\"+pt.y;\r\n\t}\r\n\talldat.d = src;\r\n\t// Set point data source to src and forget about old field\r\n\tdelete alldat.points;\r\n\tif(\"arrow\" in this)\r\n\t\talldat.arrow = set2seq(this.arrow);\r\n\treturn alldat;\r\n}\r\n\r\n/// Custom deserializer for SVG-compatible path data\r\nPathShape.prototype.deserialize = function(obj){\r\n\tShape.prototype.deserialize.call(this, obj);\r\n\tif(\"arrow\" in obj)\r\n\t\tthis.arrow = seq2set(obj.arrow);\r\n\tif(!(\"d\" in obj))\r\n\t\treturn;\r\n\tvar arr = [];\r\n\tvar src = obj.d;\r\n\tvar pt2 = [];\r\n\tvar last = 0;\r\n\r\n\tfunction process(){\r\n\t\tif(k <= last)\r\n\t\t\treturn;\r\n\t\tvar ssrc = src.slice(last+1, k);\r\n\t\tpt2 = ssrc.split(/[, \\t]/);\r\n\t\tvar pt = {};\r\n\t\tif(6 <= pt2.length){\r\n\t\t\tpt.cx = parseFloat(pt2[0]);\r\n\t\t\tpt.cy = parseFloat(pt2[1]);\r\n\t\t}\r\n\t\tif(4 <= pt2.length){\r\n\t\t\tpt.dx = parseFloat(pt2[pt2.length-4]);\r\n\t\t\tpt.dy = parseFloat(pt2[pt2.length-3]);\r\n\t\t}\r\n\t\tpt.x = parseFloat(pt2[pt2.length-2]);\r\n\t\tpt.y = parseFloat(pt2[pt2.length-1]);\r\n\t\tarr.push(pt);\r\n\t\tlast = k;\r\n\t}\r\n\r\n\tfor(var k = 0; k < src.length; k++){\r\n\t\tif(\"MCLS\".indexOf(src.charAt(k)) >= 0)\r\n\t\t\tprocess();\r\n\t}\r\n\tprocess();\r\n\r\n\tthis.points = arr;\r\n};\r\n// ==================== PathShape class definition end ================================= //\r\n\r\n\r\nfunction serialize(dobjs){\r\n\tvar ret = [metaObj];\r\n\tfor(var i = 0; i < dobjs.length; i++)\r\n\t\tret.push(dobjs[i].serialize());\r\n\treturn ret;\r\n}\r\n\r\nfunction deserialize(dat){\r\n\t// Reset the metaObj before deserialization\r\n\tmetaObj = cloneObject(defaultMetaObj);\r\n\tvar ret = [];\r\n\tfor (var i=0; i<dat.length; i++) {\r\n\t\tvar obj = dat[i];\r\n\t\tif(obj.type === 'meta'){\r\n\t\t\tmetaObj = obj;\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif(!(obj.type in toolmap))\r\n\t\t\tcontinue;\r\n\t\tvar robj = new toolmap[obj.type].objctor();\r\n\t\trobj.tool = obj.type;\r\n\t\trobj.deserialize(obj);\r\n\t\tret.push(robj);\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nthis.loadData = function(value){\r\n\ttry{\r\n\t\tdobjs = deserialize(jsyaml.load(value));\r\n\t\tselectobj = []; // Clear the selection explicitly\r\n\t\tresizeCanvas();\r\n\t\tdraw();\r\n\t\tredraw(dobjs);\r\n\t} catch(e){\r\n\t\tconsole.log(e);\r\n\t}\r\n}\r\n\r\nthis.saveAsImage = function(img){\r\n\tvar reset = editmode;\r\n\tif(editmode){\r\n\t\teditmode = false;\r\n\t\tresizeCanvas();\r\n\t\tredraw(dobjs);\r\n\t}\r\n\timg.src = canvas.toDataURL();\r\n\tif(reset){\r\n\t\teditmode = true;\r\n\t\tresizeCanvas();\r\n\t\tdraw();\r\n\t\tredraw(dobjs);\r\n\t}\r\n}\r\n\r\n/// @brief Loads a data from local storage of the browser\r\n/// @param name The name of the sketch in the local storage to load.\r\nthis.loadLocal = function(name){\r\n\ttry{\r\n\t\tvar origData = localStorage.getItem(\"canvasDrawData\");\r\n\t\tif(origData === null)\r\n\t\t\treturn;\r\n\t\tvar selData = jsyaml.load(origData);\r\n\t\tdobjs = deserialize(jsyaml.load(selData[name]));\r\n\t\tselectobj = []; // Clear the selection explicitly\r\n\t\tupdateDrawData();\r\n\t\tredraw(dobjs);\r\n\t} catch(e){\r\n\t\tdebug(e);\r\n\t}\r\n}\r\n\r\n// Downloads the file list from the server.\r\nfunction downloadList(){\r\n\t// Asynchronous request for getting figure data in the server.\r\n\tvar xmlHttp = createXMLHttpRequest();\r\n\tif(xmlHttp){\r\n\t\t// The event handler is assigned here because xmlHttp is a free variable\r\n\t\t// implicitly passed to the anonymous function without polluting the\r\n\t\t// global namespace.\r\n\t\txmlHttp.onreadystatechange = function(){\r\n\t\t\tif(xmlHttp.readyState !== 4 || xmlHttp.status !== 200)\r\n\t\t\t\treturn;\r\n\t\t\ttry{\r\n\t\t\t\tvar selData = xmlHttp.responseText;\r\n\t\t\t\tif(!selData)\r\n\t\t\t\t\treturn;\r\n\t\t\t\tif(self.onUpdateServerList)\r\n\t\t\t\t\tself.onUpdateServerList(selData.split(\"\\n\"));\r\n\t\t\t}\r\n\t\t\tcatch(e){\r\n\t\t\t\tconsole.log(e);\r\n\t\t\t}\r\n\t\t};\r\n\t\txmlHttp.open(\"GET\", \"list.php\", true);\r\n\t\txmlHttp.send();\r\n\t}\r\n}\r\n\r\nthis.listServer = downloadList;\r\n\r\nthis.requestServerFile = function(item, hash){\r\n\t// Asynchronous request for getting figure data in the server.\r\n\tvar xmlHttp = createXMLHttpRequest();\r\n\tif(xmlHttp){\r\n\t\tvar request;\r\n\t\t// The event handler is assigned here because xmlHttp is a free variable\r\n\t\t// implicitly passed to the anonymous function without polluting the\r\n\t\t// global namespace.\r\n\t\txmlHttp.onreadystatechange = function(){\r\n\t\t\tif(xmlHttp.readyState !== 4 || xmlHttp.status !== 200)\r\n\t\t\t\treturn;\r\n\t\t\ttry{\r\n\t\t\t\tvar selData = xmlHttp.responseText;\r\n\t\t\t\tif(!selData)\r\n\t\t\t\t\treturn;\r\n\t\t\t\tif(hash){\r\n\t\t\t\t\tvar firstLine = selData.split(\"\\n\", 1)[0];\r\n\t\t\t\t\tif(firstLine !== \"succeeded\")\r\n\t\t\t\t\t\tthrow \"Failed to obtain revision \" + selData;\r\n\t\t\t\t\tselData = selData.substr(selData.indexOf(\"\\n\")+1);\r\n\t\t\t\t}\r\n\t\t\t\tdobjs = deserialize(jsyaml.load(selData));\r\n\t\t\t\tselectobj = [];\r\n\t\t\t\tupdateDrawData();\r\n\t\t\t\tresizeCanvas();\r\n\t\t\t\tdraw();\r\n\t\t\t\tredraw(dobjs);\r\n\t\t\t}\r\n\t\t\tcatch(e){\r\n\t\t\t\tdebug(e);\r\n\t\t\t}\r\n\t\t};\r\n\t\tif(!hash)\r\n\t\t\trequest = datadir + \"/\" + encodeURI(item);\r\n\t\telse\r\n\t\t\trequest = \"history.php?fname=\" + encodeURI(item) + \"&hash=\" + encodeURI(hash);\r\n\t\txmlHttp.open(\"GET\", request, true);\r\n\t\txmlHttp.send();\r\n\t}\r\n}\r\n\r\nthis.requestServerFileHistory = function(item, responseCallback){\r\n\tvar historyQuery = createXMLHttpRequest();\r\n\tif(historyQuery){\r\n\t\thistoryQuery.onreadystatechange = function(){\r\n\t\t\tif(historyQuery.readyState !== 4 || historyQuery.status !== 200)\r\n\t\t\t\treturn;\r\n\t\t\ttry{\r\n\t\t\t\tvar res = historyQuery.responseText;\r\n\t\t\t\tif(!res)\r\n\t\t\t\t\treturn;\r\n\t\t\t\tvar historyData = res.split(\"\\n\");\r\n\t\t\t\tif(historyData[0] !== \"succeeded\")\r\n\t\t\t\t\treturn;\r\n\t\t\t\thistoryData = historyData.splice(1);\r\n\t\t\t\tresponseCallback(historyData);\r\n\t\t\t}\r\n\t\t\tcatch(e){\r\n\t\t\t\tconsole.log(e);\r\n\t\t\t}\r\n\t\t};\r\n\t\thistoryQuery.open(\"GET\", \"history.php?fname=\" + encodeURI(item), true);\r\n\t\thistoryQuery.send();\r\n\t}\r\n}\r\n\r\n// clear canvas\r\nfunction clearCanvas() {\r\n\tif(editmode){\r\n\t\t// Fill outside of valid figure area defined by metaObj.size with gray color.\r\n\t\tctx.fillStyle = '#7f7f7f';\r\n\t\tctx.fillRect(x1,y1, w1, h1);\r\n\t}\r\n\tctx.fillStyle = white;\r\n\tctx.fillRect(x1, y1, Math.min(w1, metaObj.size[0]), Math.min(h1, metaObj.size[1]));\r\n}\r\n\r\n// Sets the size of the canvas\r\nfunction setSize(sx, sy){\r\n\tmetaObj.size[0] = sx;\r\n\tmetaObj.size[1] = sy;\r\n\tupdateDrawData();\r\n\tredraw(dobjs);\r\n}\r\n\r\n// check all menu\r\nfunction checkMenu(x, y) {\r\n\tvar no = choiceMenu(x, y);\r\n\tif (no >= 0) return no;\r\n\tno = choiceCBox(x, y);\r\n\tif (no > 0) return no;\r\n\tno = choiceHBox(x, y);\r\n\tif (no > 0) return no;\r\n\r\n\tif (x > w0 || y > h0) no = -1;\r\n\treturn no;\r\n}\r\n\r\nfunction choiceMenu(x, y) {\r\n\t// menu\r\n\tif (y < my0 || y > my0+mh0) return -1;\r\n\tfor(var i=0;i<menus.length;i++) {\r\n\t\tif (x >= mx1+(mw1+10)*i && x <= mx1+mw0+(mw1+10)*i) return i;\r\n\t}\r\n\r\n\treturn -1;\r\n}\r\n\r\n/// Selects a toolbar button. Returns true if the coordinates hit a button.\r\nfunction choiceTBox(x, y) {\r\n\t// ToolBox\r\n\tif (x < mx0 || x > mx0+mw0) return false;\r\n\tfor(var i=0;i<toolbar.length;i++) {\r\n\t\tvar r = getTBox(i);\r\n\t\tif(hitRect(r, x, y)){\r\n\t\t\tcur_tool = toolbar[i];\r\n\t\t\tdrawTBox();\r\n\t\t\tcur_shape = null;\r\n\t\t\tredraw(dobjs);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn false;\r\n}\r\n\r\n\t// Color Parett\r\nfunction choiceCBox(x, y) {\r\n\tif (y < my0 || y > my0+mh0) return -1;\r\n\tfor(var i=0;i<5;i++) {\r\n\t\tif (x >= mx2+(mw2+10)*i && x <= mx2+mw2+(mw2+10)*i) return i+31;\r\n\t}\r\n\t\r\n\treturn -1;\r\n}\r\n\t// Thin Box\r\nfunction choiceHBox(x, y) {\r\n\tif (y < my0 || y > my0+mh0) return -1;\r\n\tfor(var i=0;i<3;i++) {\r\n\t\tif (x >= mx3+(mw2+10)*i && x <= mx3+mw2+(mw2+10)*i) return i+41;\r\n\t}\r\n\t\r\n\treturn -1;\r\n}\r\n\r\n/// @brief Save a sketch data to a local storage entry with name\r\n/// @param name Name of the sketch which can be used in loadLocal() to restore\r\nthis.saveLocal = function(name){\r\n\tif(typeof(Storage) !== \"undefined\"){\r\n\t\tvar str = localStorage.getItem(\"canvasDrawData\");\r\n\t\tvar origData = str === null ? {} : jsyaml.load(str);\r\n\t\tvar newEntry = !(name in origData);\r\n\t\torigData[name] = jsyaml.dump(serialize(dobjs));\r\n\t\tlocalStorage.setItem(\"canvasDrawData\", jsyaml.dump(origData));\r\n\t\t// If the named sketch didn't exist, fire up the event of local storage change.\r\n\t\tif(newEntry && ('onLocalChange' in this) && this.onLocalChange)\r\n\t\t\tthis.onLocalChange();\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n};\r\n\r\n/// @brief Returns list of sketches saved in local storage\r\n/// @returns An array with sketch names in each element\r\nthis.listLocal = function() {\r\n\r\n\tif(typeof(Storage) !== \"undefined\"){\r\n\t\tvar str = localStorage.getItem(\"canvasDrawData\");\r\n\t\tvar origData = str === null ? {} : jsyaml.load(str);\r\n\r\n\t\t// Enumerating keys array would be simpler if we could use Object.keys(),\r\n\t\t// but the method won't work for IE6, 7, 8.\r\n\t\t// If we'd repeat this procedure, we may be able to use a shim in:\r\n\t\t// https://github/com/es-shims/es5-shim/blob/v2.0.5/es5-shim.js\r\n\t\tvar keys = [];\r\n\t\tfor(var name in origData)\r\n\t\t\tkeys.push(name);\r\n\r\n\t\treturn keys;\r\n\t}\r\n\r\n}\r\n\r\n/// Custom inheritance function that prevents the super class's constructor\r\n/// from being called on inehritance.\r\n/// Also assigns constructor property of the subclass properly.\r\n/// Inheriting is closely related to cloneObject()\r\nfunction inherit(subclass,base){\r\n\t// If the browser or ECMAScript supports Object.create, use it\r\n\t// (but don't remember to redirect constructor pointer to subclass)\r\n\tif(Object.create){\r\n\t\tsubclass.prototype = Object.create(base.prototype);\r\n\t}\r\n\telse{\r\n\t\tvar sub = function(){};\r\n\t\tsub.prototype = base.prototype;\r\n\t\tsubclass.prototype = new sub;\r\n\t}\r\n\tsubclass.prototype.constructor = subclass;\r\n}\r\n\r\n/// Copy all properties in src to target, retaining target's existing properties\r\n/// that have different names from src's.\r\nfunction mixin(target, src){\r\n\tfor(var k in src){\r\n\t\ttarget[k] = src[k];\r\n\t}\r\n}\r\n\r\n// Create a deep clone of objects\r\nfunction cloneObject(obj) {\r\n\tif (obj === null || typeof obj !== 'object') {\r\n\t\treturn obj;\r\n\t}\r\n\r\n\t// give temp the original obj's constructor\r\n\t// this 'new' is important in case obj is user-defined class which was created by\r\n\t// 'new ClassName()', no matter inherited or not.\r\n\t// I wonder why Array and Object (built-in classes) don't need new operator.\r\n\tvar temp = new obj.constructor();\r\n\tfor (var key in obj) {\r\n\t\ttemp[key] = cloneObject(obj[key]);\r\n\t}\r\n\r\n\treturn temp;\r\n}\r\n\r\nfunction updateDrawData(){\r\n\ttry{\r\n\t\tvar text = jsyaml.dump(serialize(dobjs), {flowLevel: 2});\r\n\t\tif(('onUpdateData' in self) && self.onUpdateData)\r\n\t\t\tself.onUpdateData(text);\r\n\t} catch(e){\r\n\t\tconsole.log(e);\r\n\t}\r\n}\r\n\r\n// clear data\r\nfunction ajaxclear() {\r\n\tdobjs = [];\r\n\tselectobj = [];\r\n\tupdateDrawData();\r\n\tclearCanvas();\r\n}\r\n\r\n// undo\r\nfunction ajaxundo() {\r\n\tif(dhistory.length < 1)\r\n\t\treturn;\r\n\tdobjs = dhistory[dhistory.length-1];\r\n\tdhistory.pop();\r\n\tselectobj = [];\r\n\tupdateDrawData();\r\n\tredraw(dobjs);\r\n}\r\n\r\nvar createXMLHttpRequest = this.createXMLHttpRequest;\r\n\r\n/// @brief Posts a sketch data to the server\r\n/// @param fname The file name of the added sketch.\r\n/// @param target The target URL for posting.\r\n/// @param requestDelete If true, it will post delete request instead of new data.\r\nthis.postData = function(fname, target, requestDelete){\r\n\tvar data = jsyaml.dump(serialize(dobjs), {flowLevel: 2});\r\n\t// Asynchronous request for getting figure data in the server.\r\n\tvar xmlHttp = createXMLHttpRequest();\r\n\tif(xmlHttp){\r\n\t\t// The event handler is assigned here because xmlHttp is a free variable\r\n\t\t// implicitly passed to the anonymous function without polluting the\r\n\t\t// global namespace.\r\n\t\txmlHttp.onreadystatechange = function(){\r\n\t\t\tif(xmlHttp.readyState !== 4 || xmlHttp.status !== 200)\r\n\t\t\t\treturn;\r\n\t\t\tdebug(xmlHttp.responseText);\r\n\t\t\tdownloadList();\r\n\t\t};\r\n\t\txmlHttp.open(\"POST\", target, true);\r\n\t\txmlHttp.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\r\n\t\tvar request = \"fname=\" + encodeURI(fname);\r\n\t\tif(requestDelete)\r\n\t\t\trequest += \"&action=delete\";\r\n\t\telse\r\n\t\t\trequest += \"&drawdata=\" + encodeURI(data);\r\n\t\txmlHttp.send(request);\r\n\t}\r\n};\r\n\r\n/// @brief Posts a request to server to pull from remote (respective to the server)\r\n/// @param remoteName The remote name (defined in the server)\r\nthis.pull = function(remoteName){\r\n\t// Asynchronous request for pulling.\r\n\tvar xmlHttp = createXMLHttpRequest();\r\n\tif(xmlHttp){\r\n\t\t// The event handler is assigned here because xmlHttp is a free variable\r\n\t\t// implicitly passed to the anonymous function without polluting the\r\n\t\t// global namespace.\r\n\t\txmlHttp.onreadystatechange = function(){\r\n\t\t\tif(xmlHttp.readyState !== 4 || xmlHttp.status !== 200)\r\n\t\t\t\treturn;\r\n\t\t\tdebug(xmlHttp.responseText);\r\n\t\t\tdownloadList();\r\n\t\t};\r\n\t\txmlHttp.open(\"GET\", \"pull.php?remote=\" + encodeURI(remoteName), true);\r\n\t\txmlHttp.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\r\n\t\txmlHttp.send();\r\n\t}\r\n}\r\n\r\n/// @brief Posts a request to server to push to remote (respective to the server)\r\n/// @param remoteName The remote name (defined in the server)\r\nthis.push = function(remoteName){\r\n\t// Asynchronous request for pulling.\r\n\tvar xmlHttp = createXMLHttpRequest();\r\n\tif(xmlHttp){\r\n\t\t// The event handler is assigned here because xmlHttp is a free variable\r\n\t\t// implicitly passed to the anonymous function without polluting the\r\n\t\t// global namespace.\r\n\t\txmlHttp.onreadystatechange = function(){\r\n\t\t\tif(xmlHttp.readyState !== 4 || xmlHttp.status !== 200)\r\n\t\t\t\treturn;\r\n\t\t\tdebug(xmlHttp.responseText);\r\n\t\t\tdownloadList();\r\n\t\t};\r\n\t\txmlHttp.open(\"GET\", \"push.php?remote=\" + encodeURI(remoteName), true);\r\n\t\txmlHttp.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\r\n\t\txmlHttp.send();\r\n\t}\r\n}\r\n\r\n//------------------------ debug ------------------------\r\nfunction debug(msg) {\r\n\tif(options && options.debug)\r\n\t\toptions.debug(msg);\r\n}\r\n\r\n// ==================== Button class definition ================================= //\r\n/// An abstract button class.\r\n/// SVG or canvas graphics libraries like EaselJS would do this sort of thing\r\n/// much better, but I don't feel like to port to it at once.\r\nfunction Button(minx, miny, maxx, maxy, ondraw, onclick){\r\n\tthis.minx = minx;\r\n\tthis.miny = miny;\r\n\tthis.maxx = maxx;\r\n\tthis.maxy = maxy;\r\n\tthis.ondraw = ondraw;\r\n\tthis.onclick = onclick;\r\n}\r\n\r\n// ==================== Menu class definition ================================= //\r\nfunction MenuItem(text, onclick){\r\n\tthis.text = i18n.t(text);\r\n\tthis.onclick = onclick;\r\n}\r\n\r\n// init --------------------------------------------------\r\n//window.captureEvents(Event.click);\r\n//onclick=mouseLeftClick;\r\nvar ctx;\r\nvar menus = [\r\n\tnew MenuItem(\"Grid\", function(){\r\n\t\tgridEnable = !gridEnable;\r\n\t\tredraw(dobjs);\r\n\t}),\r\n\tnew MenuItem(\"Grid+\", function(){\r\n\t\tif(gridSize < 32)\r\n\t\t\tgridSize *= 2;\r\n\t\tif(gridEnable)\r\n\t\t\tredraw(dobjs);\r\n\t}),\r\n\tnew MenuItem(\"Grid-\", function(){\r\n\t\tif(4 < gridSize)\r\n\t\t\tgridSize /= 2;\r\n\t\tif(gridEnable)\r\n\t\t\tredraw(dobjs);\r\n\t}),\r\n\tnew MenuItem(\"Clear\", function(){\t// clear\r\n\t\tclearCanvas();\r\n\t\tajaxclear();\r\n\t}),\r\n\tnew MenuItem(\"Redraw\", function(){redraw(dobjs);}),// redraw\r\n\tnew MenuItem(\"Undo\", function(){\t// undo\r\n\t\tclearCanvas();\r\n\t\tajaxundo();\r\n\t}),\r\n\tnew MenuItem(\"Size\", function(){\r\n\t\t// Show size input layer on top of the canvas because the canvas cannot have\r\n\t\t// a text input element.\r\n\t\tif(!sizeLayer){\r\n\t\t\tsizeLayer = document.createElement('div');\r\n\t\t\tvar lay = sizeLayer;\r\n\t\t\tlay.id = 'bookingLayer';\r\n\t\t\tlay.style.position = 'absolute';\r\n\t\t\tlay.style.padding = '5px 5px 5px 5px';\r\n\t\t\tlay.style.borderStyle = 'solid';\r\n\t\t\tlay.style.borderColor = '#cf0000';\r\n\t\t\tlay.style.borderWidth = '2px';\r\n\t\t\t// Drop shadow to make it distinguishable from the figure contents.\r\n\t\t\tlay.style.boxShadow = '0px 0px 20px grey';\r\n\t\t\tlay.style.background = '#cfffcf';\r\n\t\t\tlay.innerHTML = i18n.t('Input image size in pixels') + ':<br>'\r\n\t\t\t\t+ 'x:<input id=\"sizeinputx\" type=\"text\">'\r\n\t\t\t\t+ 'y:<input id=\"sizeinputy\" type=\"text\">';\r\n\t\t\tvar okbutton = document.createElement('input');\r\n\t\t\tokbutton.type = 'button';\r\n\t\t\tokbutton.value = 'OK';\r\n\t\t\tokbutton.onclick = function(s){\r\n\t\t\t\tlay.style.display = 'none';\r\n\t\t\t\tsetSize(parseFloat(document.getElementById('sizeinputx').value),\r\n\t\t\t\t\tparseFloat(document.getElementById('sizeinputy').value));\r\n\t\t\t}\r\n\t\t\tvar cancelbutton = document.createElement('input');\r\n\t\t\tcancelbutton.type = 'button';\r\n\t\t\tcancelbutton.value = 'Cancel';\r\n\t\t\tcancelbutton.onclick = function(s){\r\n\t\t\t\tlay.style.display = 'none';\r\n\t\t\t}\r\n\t\t\tlay.appendChild(document.createElement('br'));\r\n\t\t\tlay.appendChild(okbutton);\r\n\t\t\tlay.appendChild(cancelbutton);\r\n\t\t\t// Append as the body element's child because style.position = \"absolute\" would\r\n\t\t\t// screw up in deeply nested DOM tree (which may have a positioned ancestor).\r\n\t\t\tdocument.body.appendChild(lay);\r\n\t\t}\r\n\t\telse // Just show the created layer in the second invocation.\r\n\t\t\tsizeLayer.style.display = 'block';\r\n\t\tvar canvasRect = canvas.getBoundingClientRect();\r\n\t\t// Cross-browser scroll position query\r\n\t\tvar scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;\r\n\t\tvar scrollY = document.documentElement.scrollTop || document.body.scrollTop;\r\n\t\t// getBoundingClientRect() returns coordinates relative to view, which means we have to\r\n\t\t// add scroll position into them.\r\n\t\tsizeLayer.style.left = (canvasRect.left + scrollX + 150) + 'px';\r\n\t\tsizeLayer.style.top = (canvasRect.top + scrollY + 50) + 'px';\r\n\t\tdocument.getElementById('sizeinputx').value = metaObj.size[0];\r\n\t\tdocument.getElementById('sizeinputy').value = metaObj.size[1];\r\n\t}), // size\r\n];\r\n\r\nvar buttons = [];\r\n\r\n\r\n/// @brief Converts a sequence (array) to a set (object)\r\n///\r\n/// We wish if we could use YAML's !!set type (which is described in\r\n/// http://yaml.org/type/set.html ), but JavaScript doesn't natively\r\n/// support set type and js-yaml library converts YAML's !!set type\r\n/// into an object with property names as keys in the set.\r\n/// The values associated with the keys are not meaningful and\r\n/// null is assigned by the library.\r\n/// If we serialize the object, it would be an !!map instead of a !!set.\r\n/// For example, a !!set {head, tail} would be serialized as\r\n/// \"{head: null, tail: null}\", which is far from beautiful.\r\n///\r\n/// So we had to pretend as if !!set is encoded as !!seq in the serialized\r\n/// YAML document by converting JavaScript objects into arrays.\r\n/// It would be \"[head, tail]\" in the case of the former example.\r\n///\r\n/// The seq2set function converts sequence from YAML parser into\r\n/// a set-like object, while set2seq does the opposite.\r\n///\r\n/// Note that these functions work only for sets of strings.\r\n///\r\n/// @sa set2seq\r\nfunction seq2set(seq){\r\n\tvar ret = {};\r\n\tfor(var i = 0; i < seq.length; i++){\r\n\t\tif(seq[i] === \"\")\r\n\t\t\tcontinue;\r\n\t\tret[seq[i]] = null;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\n/// @brief Converts a set (object) to a sequence (array)\r\n/// @sa seq2set\r\nfunction set2seq(set){\r\n\tvar ret = [];\r\n\tfor(var i in set){\r\n\t\tif(i === \"\")\r\n\t\t\tcontinue;\r\n\t\tret.push(i);\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\n// ==================== Tool class definition ================================= //\r\n\r\n// A mapping of tool names and tool objects. Automatically updated in the Tool class's constructor.\r\nvar toolmap = {};\r\n\r\n/// @brief A class that represents a tool in the toolbar.\r\n/// @param name Name of the tool, used in serialized text\r\n/// @param points Number of points which are used to describe points\r\n/// @param params A table of initialization parameters:\r\n/// objctor: The constructor function that is used to create Shape, stands for OBJect ConsTructOR\r\n/// drawTool: A function(x, y) to draw icon on the toolbar.\r\n/// setColor: A function(color) that is called before drawing.\r\n/// setWidth: A function(width) that is called before drawing.\r\n/// draw: A function(mode,str) to actually draw a shape.\r\nfunction Tool(name, points, params){\r\n\tthis.name = name;\r\n\tthis.points = points || 1;\r\n\tthis.objctor = params && params.objctor || Shape;\r\n\tthis.drawTool = params && params.drawTool;\r\n\tmixin(this, params);\r\n\t// The path tool shares the same shape type identifier among multiple\r\n\t// tools, so duplicate assignments should be avoided.\r\n\tif(!(name in toolmap))\r\n\t\ttoolmap[name] = this;\r\n}\r\n\r\nTool.prototype.setColor = function(color){\r\n\tctx.strokeStyle = color;\r\n};\r\n\r\nfunction setColorFill(color){\r\n\tctx.fillStyle = color;\r\n}\r\n\r\nTool.prototype.setWidth = function(width){\r\n\tctx.lineWidth = width;\r\n};\r\n\r\nfunction nop(){}\r\n\r\nTool.prototype.draw = nop;\r\n\r\n/// Append a point to the shape by mouse click\r\nTool.prototype.appendPoint = function(x, y) {\r\n\tfunction addPoint(x, y){\r\n\t\tif (cur_shape.points.length === cur_tool.points){\r\n\t\t\tdhistory.push(cloneObject(dobjs));\r\n\t\t\tdobjs.push(cur_shape);\r\n\t\t\tupdateDrawData();\r\n\t\t\tcur_shape = null;\r\n\t\t\tredraw(dobjs);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse{\r\n\t\t\tcur_shape.points.push(canvasToSrc(constrainCoord({x:x, y:y})));\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\tif(!cur_shape){\r\n\t\tvar obj = new cur_tool.objctor();\r\n\t\tobj.tool = cur_tool.name;\r\n\t\tobj.color = cur_col;\r\n\t\tobj.width = cur_thin;\r\n\t\tcur_shape = obj;\r\n\t\t// Add two points for previewing shapes that consist of multiple points,\r\n\t\t// but single-point shapes will finish with just single click.\r\n\t\tif(!addPoint(x, y))\r\n\t\t\taddPoint(x, y);\r\n\t}\r\n\telse{\r\n\t\taddPoint(x, y);\r\n\t}\r\n}\r\n\r\nTool.prototype.mouseDown = function(e){\r\n\t// Do nothing by default\r\n}\r\n\r\nTool.prototype.mouseMove = function(e){\r\n\tif(cur_shape && 0 < cur_shape.points.length){\r\n\t\tvar clrect = canvas.getBoundingClientRect();\r\n\t\tvar mx = (gridEnable ? Math.round(e.clientX / gridSize) * gridSize : e.clientX) - clrect.left;\r\n\t\tvar my = (gridEnable ? Math.round(e.clientY / gridSize) * gridSize : e.clientY) - clrect.top;\r\n\t\t// Live preview of the shape being added.\r\n\t\tvar coord = {x: mx, y: my};\r\n\t\tcur_shape.points[cur_shape.points.length-1] = canvasToSrc(constrainCoord(coord));\r\n\t\tredraw(dobjs);\r\n\t}\r\n}\r\n\r\nTool.prototype.mouseUp = function(e){\r\n\tmoving = false;\r\n\tsizing = null;\r\n\tpointMoving = null;\r\n\tvar needsRedraw = boxselecting;\r\n\tboxselecting = false;\r\n\tif(needsRedraw) // Redraw to clear selection box\r\n\t\tredraw(dobjs);\r\n}\r\n\r\nTool.prototype.keyDown = function(e){\r\n\tvar code = e.keyCode || e.which;\r\n\tif(code === 46){ // Delete key\r\n\t\tdhistory.push(cloneObject(dobjs)); // Push undo buffer\r\n\t\t// Delete all selected objects\r\n\t\tdeleteShapes(selectobj);\r\n\t\tupdateDrawData();\r\n\t\tredraw(dobjs);\r\n\t}\r\n}\r\n\r\n// All other tools than the pathedit, draw scaling handles and\r\n// bounding boxes around selected objects.\r\n// Aside from the select tool, the user cannot grab the scaling handles,\r\n// but they're useful to visually appeal that the object is selected.\r\nTool.prototype.selectDraw = function(shape){\r\n\tvar bounds = objBounds(shape);\r\n\r\n\tctx.beginPath();\r\n\tctx.lineWidth = 1;\r\n\tctx.strokeStyle = '#000';\r\n\tctx.setLineDash([5]);\r\n\tctx.rect(bounds.minx, bounds.miny, bounds.maxx-bounds.minx, bounds.maxy-bounds.miny);\r\n\tctx.stroke();\r\n\tctx.setLineDash([]);\r\n\r\n\tctx.beginPath();\r\n\tctx.strokeStyle = '#000';\r\n\tfor(var i = 0; i < 8; i++){\r\n\t\tvar r = getHandleRect(bounds, i);\r\n\t\tctx.fillStyle = sizing === shape && i === sizedir ? '#7fff7f' : '#ffff7f';\r\n\t\tctx.fillRect(r.minx, r.miny, r.maxx - r.minx, r.maxy-r.miny);\r\n\t\tctx.rect(r.minx, r.miny, r.maxx - r.minx, r.maxy-r.miny);\r\n\t}\r\n\tctx.stroke();\r\n}\r\n\r\n// ==================== Tool class definition end ============================= //\r\n\r\n\r\n// List of tools in the toolbar.\r\nvar toolbar = [\r\n\tnew Tool(\"select\", 1, {drawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(x, y-5);\r\n\t\t\tctx.lineTo(x, y+10);\r\n\t\t\tctx.lineTo(x+4, y+7);\r\n\t\t\tctx.lineTo(x+6, y+11);\r\n\t\t\tctx.lineTo(x+8, y+9);\r\n\t\t\tctx.lineTo(x+6, y+5);\r\n\t\t\tctx.lineTo(x+10, y+3);\r\n\t\t\tctx.closePath();\r\n\t\t\tctx.stroke();\r\n\t\t\tctx.strokeText('1', x+45, y+10);\r\n\t\t},\r\n\t\tmouseDown: selectMouseDown,\r\n\t\tmouseMove: selectMouseMove,\r\n\t\tmouseUp: function(e){\r\n\t\t\tif(0 < selectobj.length && (moving || sizing))\r\n\t\t\t\tupdateDrawData();\r\n\t\t\tTool.prototype.mouseUp.call(this, e);\r\n\t\t}\r\n\t}),\r\n\tnew Tool(\"pathedit\", 1, {\r\n\t\t// The path editing tool. This is especially useful when editing\r\n\t\t// existing curves. The icon is identical to that of select tool,\r\n\t\t// except that the mouse cursor graphic is filled.\r\n\t\tdrawTool: function(x, y){\r\n\t\t\tctx.fillStyle = 'rgb(250, 250, 250)';\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(x, y-5);\r\n\t\t\tctx.lineTo(x, y+10);\r\n\t\t\tctx.lineTo(x+4, y+7);\r\n\t\t\tctx.lineTo(x+6, y+11);\r\n\t\t\tctx.lineTo(x+8, y+9);\r\n\t\t\tctx.lineTo(x+6, y+5);\r\n\t\t\tctx.lineTo(x+10, y+3);\r\n\t\t\tctx.closePath();\r\n\t\t\tctx.fill();\r\n\t\t\tctx.strokeText('1', x+45, y+10);\r\n\t\t},\r\n\t\tmouseDown: pathEditMouseDown,\r\n\t\tmouseMove: pathEditMouseMove,\r\n\t\tmouseUp: function(e){\r\n\t\t\tif(0 < selectobj.length && pointMoving)\r\n\t\t\t\tupdateDrawData();\r\n\t\t\tTool.prototype.mouseUp.call(this, e);\r\n\t\t},\r\n\t\tkeyDown: function(e){\r\n\t\t\tvar code = e.keyCode || e.which;\r\n\t\t\tif(code === 46){ // Delete key\r\n\t\t\t\t// Pathedit tool's delete key just delete single vertex in a path\r\n\t\t\t\tif(this.selectPointShape && this.selectPointShape.tool === \"path\" && 0 <= this.selectPointIdx){\r\n\t\t\t\t\tdhistory.push(cloneObject(dobjs)); // Push undo buffer\r\n\t\t\t\t\tif(this.selectPointShape.points.length <= 2){\r\n\t\t\t\t\t\tdeleteShapes([this.selectPointShape]);\r\n\t\t\t\t\t\tthis.selectPointShape = null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tthis.selectPointShape.points.splice(this.selectPointIdx, 1);\r\n\t\t\t\t\tupdateDrawData();\r\n\t\t\t\t\tredraw(dobjs);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\tselectDraw: pathEditSelectDraw,\r\n\t\tselectPointShape: null, // Default value for the variable\r\n\t\tselectPointIdx: -1, // Default value for the variable\r\n\t}),\r\n\tnew Tool(\"line\", 2, {\r\n\t\tdrawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(x, y);\r\n\t\t\tctx.lineTo(x+40, y+10);\r\n\t\t\tctx.stroke();\r\n\t\t\tctx.strokeText('2', x+45, y+10);\r\n\t\t},\r\n\t\tdraw: function(obj){\r\n\t\t\tvar arr = obj.points;\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(arr[0].x, arr[0].y);\r\n\t\t\tctx.lineTo(arr[1].x, arr[1].y);\r\n\t\t\tctx.stroke();\r\n\t\t\tctx.lineWidth = 1;\r\n\t\t},\r\n\t}),\r\n\tnew Tool(\"arrow\", 2, {\r\n\t\tdrawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tl_arrow(ctx, [{x:x, y:y+5}, {x:x+40, y:y+5}]);\r\n\t\t\tctx.strokeText('2', x+45, y+10);\r\n\t\t},\r\n\t\tdraw: function(obj){\r\n\t\t\tvar arr = obj.points;\r\n\t\t\tctx.beginPath();\r\n\t\t\tl_arrow(ctx, arr);\r\n\t\t\tctx.lineWidth = 1;\r\n\t\t}\r\n\t}),\r\n\tnew Tool(\"barrow\", 2, {\r\n\t\tdrawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tl_tarrow(ctx, [{x:x, y:y+5}, {x:x+40, y:y+5}]);\r\n\t\t\tctx.strokeText('2', x+45, y+10);\r\n\t\t},\r\n\t\tdraw: function(obj){\r\n\t\t\tvar arr = obj.points;\r\n\t\t\tctx.beginPath();\r\n\t\t\tl_tarrow(ctx, arr);\r\n\t\t\tctx.lineWidth = 1;\r\n\t\t}\r\n\t}),\r\n\tnew Tool(\"darrow\", 2, {\r\n\t\tdrawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(x, y+3);\r\n\t\t\tctx.lineTo(x+39, y+3);\r\n\t\t\tctx.moveTo(x, y+7);\r\n\t\t\tctx.lineTo(x+39, y+7);\r\n\t\t\tctx.moveTo(x+35, y);\r\n\t\t\tctx.lineTo(x+40, y+5);\r\n\t\t\tctx.lineTo(x+35, y+10);\r\n\t\t\tctx.stroke();\r\n\t\t\tctx.strokeText('2', x+45, y+10);\r\n\t\t},\r\n\t\tdraw: function(obj){\r\n\t\t\tvar arr = obj.points;\r\n\t\t\tctx.beginPath();\r\n\t\t\tl_darrow(ctx, arr);\r\n\t\t\tctx.lineWidth = 1;\r\n\t\t}\r\n\t}),\r\n\tnew Tool(\"arc\", 3, {\r\n\t\tisArc: true,\r\n\t\tdrawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(x, y);\r\n\t\t\tctx.quadraticCurveTo(x+20, y+20, x+40, y);\r\n\t\t\tctx.stroke();\r\n\t\t\tctx.strokeText('3', x+45, y+10);\r\n\t\t},\r\n\t\tdraw: function(obj){\r\n\t\t\tvar arr = obj.points;\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(arr[0].x, arr[0].y);\r\n\t\t\tctx.quadraticCurveTo(arr[1].x, arr[1].y, arr[2].x, arr[2].y);\r\n\t\t\tctx.stroke();\r\n\t\t\tctx.lineWidth = 1;\r\n\t\t}\r\n\t}),\r\n\tnew Tool(\"arcarrow\", 3, {\r\n\t\tisArc: true,\r\n\t\tdrawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(x, y);\r\n\t\t\tctx.quadraticCurveTo(x+20, y+20, x+40, y);\r\n\t\t\tl_hige(ctx, [{x:x+20, y:y+20}, {x:x+40, y:y}]);\r\n\t\t\tctx.strokeText('3', x+45, y+10);\r\n\t\t},\r\n\t\tdraw: function(obj){\r\n\t\t\tvar arr = obj.points;\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(arr[0].x, arr[0].y);\r\n\t\t\tctx.quadraticCurveTo(arr[1].x, arr[1].y, arr[2].x, arr[2].y);\r\n\t\t\tl_hige(ctx, [arr[1], arr[2]]);\r\n\t\t\tctx.lineWidth = 1;\r\n\t\t}\r\n\t}),\r\n\tnew Tool(\"arcbarrow\", 3, {\r\n\t\tisArc: true,\r\n\t\tdrawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(x, y);\r\n\t\t\tctx.quadraticCurveTo(x+20, y+20, x+40, y);\r\n\t\t\tvar a = [{x:x+20, y:y+20}, {x:x+40, y:y}];\r\n\t\t\tl_hige(ctx, a);\r\n\t\t\t//a[0] = {x:x+10, y:y+10};\r\n\t\t\ta[1] = {x:x, y:y};\r\n\t\t\tl_hige(ctx, a);\r\n\t\t\tctx.strokeText('3', x+45, y+10);\r\n\t\t},\r\n\t\tdraw: function(obj){\r\n\t\t\tvar arr = obj.points;\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(arr[0].x, arr[0].y);\r\n\t\t\tctx.quadraticCurveTo(arr[1].x, arr[1].y, arr[2].x, arr[2].y);\r\n\t\t\tvar a = new Array(2);\r\n\t\t\ta[0] = arr[1];\r\n\t\t\ta[1] = arr[2];\r\n\t\t\tl_hige(ctx, a);\r\n\t\t\ta[1] = arr[0];\r\n\t\t\tl_hige(ctx, a);\r\n\t\t\tctx.lineWidth = 1;\r\n\t\t}\r\n\t}),\r\n\tnew Tool(\"rect\", 2, {\r\n\t\tdrawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.rect(x, y, 40, 10);\r\n\t\t\tctx.stroke();\r\n\t\t\tctx.strokeText('2', x+45, y+10);\r\n\t\t},\r\n\t\tdraw: function(obj){\r\n\t\t\tvar arr = obj.points;\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.rect(arr[0].x, arr[0].y, arr[1].x-arr[0].x, arr[1].y-arr[0].y);\r\n\t\t\tctx.stroke();\r\n\t\t\tctx.lineWidth = 1;\r\n\t\t}\r\n\t}),\r\n\tnew Tool(\"ellipse\", 2, {\r\n\t\tdrawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.scale(1.0, 0.5);\t\t// vertically half\r\n\t\t\tctx.arc(x+20, (y+5)*2, 20, 0, 2 * Math.PI, false);\r\n\t\t\tctx.stroke();\r\n\t\t\tctx.scale(1.0, 2.0);\r\n\t\t\tctx.strokeText('2', x+45, y+10);\r\n\t\t},\r\n\t\tdraw: function(obj){\r\n\t\t\tvar arr = obj.points;\r\n\t\t\tctx.beginPath();\r\n\t\t\tl_elipse(ctx, arr);\r\n\t\t\tctx.lineWidth = 1;\r\n\t\t}\r\n\t}),\r\n\tnew Tool(\"rectfill\", 2, {\r\n\t\tdrawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.fillStyle = 'rgb(250, 250, 250)';\r\n\t\t\tctx.fillRect(x, y, 40, 10);\r\n\t\t\tctx.strokeText('2', x+45, y+10);\r\n\t\t},\r\n\t\tsetColor: setColorFill,\r\n\t\tsetWidth: nop,\r\n\t\tdraw: function(obj){\r\n\t\t\tvar arr = obj.points;\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.fillRect(arr[0].x, arr[0].y, arr[1].x-arr[0].x, arr[1].y-arr[0].y);\r\n\t\t}\r\n\t}),\r\n\tnew Tool(\"ellipsefill\", 2, {drawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.fillStyle = 'rgb(250, 250, 250)';\r\n\t\t\tctx.scale(1.0, 0.5);\t\t// vertically half\r\n\t\t\tctx.arc(x+20, (y+5)*2, 20, 0, 2 * Math.PI, false);\r\n\t\t\tctx.fill();\r\n\t\t\tctx.scale(1.0, 2.0);\r\n\t\t\tctx.strokeText('2', x+45, y+10);\r\n\t\t},\r\n\t\tsetColor: setColorFill,\r\n\t\tsetWidth: nop,\r\n\t\tdraw: function(obj){\r\n\t\t\tvar arr = obj.points;\r\n\t\t\tctx.beginPath();\r\n\t\t\tl_elipsef(ctx, arr);\r\n\t\t\tctx.lineWidth = 1;\r\n\t\t}\r\n\t}),\r\n\tnew Tool(\"star\", 1, {objctor: PointShape,\r\n\t\tdrawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(x+8, y-3);\r\n\t\t\tctx.lineTo(x+14, y+13);\r\n\t\t\tctx.lineTo(x, y+2);\r\n\t\t\tctx.lineTo(x+16, y+2);\r\n\t\t\tctx.lineTo(x+2, y+13);\r\n\t\t\tctx.closePath();\r\n\t\t\tctx.stroke();\r\n\t\t\tctx.strokeText('1', x+45, y+10);\r\n\t\t},\r\n\t\tdraw: function(obj){\r\n\t\t\tvar arr = obj.points;\r\n\t\t\tctx.beginPath();\r\n\t\t\t//ctx.lineWidth = cur_thin - 40;\r\n\t\t\tl_star(ctx, arr);\r\n\t\t\tctx.lineWidth = 1;\r\n\t\t}\r\n\t}),\r\n\tnew Tool(\"check\", 1, {objctor: PointShape,\r\n\t\tdrawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(x, y);\r\n\t\t\tctx.lineTo(x+5, y+7);\r\n\t\t\tctx.lineTo(x+20, y);\r\n\t\t\tctx.stroke();\r\n\t\t\tctx.strokeText('1', x+45, y+10);\r\n\t\t},\r\n\t\tsetWidth: nop,\r\n\t\tdraw: function(obj){\r\n\t\t\tvar arr = obj.points;\r\n\t\t\tctx.beginPath();\r\n\t\t\tl_check(ctx, arr);\r\n\t\t}\r\n\t}),\r\n\tnew Tool(\"text\", 1, {objctor: TextShape,\r\n\t\tdrawTool: function(x, y){\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.strokeText(i18n.t('Text'), x+3, y+10);\r\n\t\t\tctx.strokeText('1', x+45, y+10);\r\n\t\t},\r\n\t\tsetColor: setColorFill,\r\n\t\tdraw: function(obj){\r\n\t\t\tvar str = obj.text;\r\n\t\t\tif (null == str) {\t\t// cancel\r\n//\t\t\t\t\tidx = 0;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tctx.beginPath();\r\n\t\t\tif (1 == obj.width) setFont(14);\r\n\t\t\telse if (2 == obj.width) setFont(16);\r\n\t\t\telse setFont(20);\r\n\t\t\tctx.fillText(str, obj.points[0].x, obj.points[0].y);\r\n\r\n\t\t\t// Draw blue underline for linked text\r\n\t\t\tif(obj.link){\r\n\t\t\t\tctx.strokeStyle = '#0000ff';\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tctx.moveTo(obj.points[0].x, obj.points[0].y + 4);\r\n\t\t\t\tctx.lineTo(obj.points[0].x + ctx.measureText(str).width, obj.points[0].y + 4);\r\n\t\t\t\tctx.stroke();\r\n\t\t\t}\r\n\r\n\t\t\tctx.font = setFont(14);\r\n\t\t},\r\n\t\tappendPoint: function(x, y){\r\n\t\t\tvar textTool = this;\r\n\t\t\t// Show size input layer on top of the canvas because the canvas cannot have\r\n\t\t\t// a text input element.\r\n\t\t\tif(!textLayer){\r\n\t\t\t\ttextLayer = document.createElement('div');\r\n\t\t\t\t// Create field for remembering position of text being inserted.\r\n\t\t\t\t// Free variables won't work well.\r\n\t\t\t\ttextLayer.canvasPos = {x:0, y:0};\r\n\t\t\t\tvar lay = textLayer;\r\n\t\t\t\tlay.id = 'textLayer';\r\n\t\t\t\tlay.style.position = 'absolute';\r\n\t\t\t\tlay.style.padding = '5px 5px 5px 5px';\r\n\t\t\t\tlay.style.borderStyle = 'solid';\r\n\t\t\t\tlay.style.borderColor = '#cf0000';\r\n\t\t\t\tlay.style.borderWidth = '2px';\r\n\t\t\t\t// Drop shadow to make it distinguishable from the figure contents.\r\n\t\t\t\tlay.style.boxShadow = '0px 0px 20px grey';\r\n\t\t\t\tlay.style.background = '#cfffcf';\r\n\r\n\t\t\t\t// Create and assign the input element to a field of the textLayer object\r\n\t\t\t\t// to keep track of the input element after this function is exited.\r\n\t\t\t\tlay.textInput = document.createElement('input');\r\n\t\t\t\tlay.textInput.id = \"textinput\";\r\n\t\t\t\tlay.textInput.type = \"text\";\r\n\t\t\t\tlay.textInput.style.width = \"30em\";\r\n\t\t\t\tlay.textInput.onkeyup = function(e){\r\n\t\t\t\t\t// Convert enter key event to OK button click\r\n\t\t\t\t\tif(e.keyCode === 13)\r\n\t\t\t\t\t\tokbutton.onclick();\r\n\t\t\t\t};\r\n\t\t\t\tlay.appendChild(lay.textInput);\r\n\r\n\t\t\t\t// Add a text area for link\r\n\t\t\t\tlay.appendChild(document.createElement('br'));\r\n\t\t\t\tlay.linkInput = document.createElement('input');\r\n\t\t\t\tlay.linkInput.id = \"linkinput\";\r\n\t\t\t\tlay.linkInput.type = \"text\";\r\n\t\t\t\tlay.linkInput.onkeyup = lay.textInput.onkeyup;\r\n\t\t\t\tvar linkdiv = document.createElement('div');\r\n\t\t\t\tlinkdiv.innerHTML = \"Link:\";\r\n\t\t\t\tlinkdiv.appendChild(lay.linkInput);\r\n\t\t\t\tlay.appendChild(linkdiv);\r\n\r\n\t\t\t\tvar okbutton = document.createElement('input');\r\n\t\t\t\tokbutton.type = 'button';\r\n\t\t\t\tokbutton.value = 'OK';\r\n\t\t\t\tokbutton.onclick = function(e){\r\n\t\t\t\t\tlay.style.display = 'none';\r\n\t\t\t\t\t// Ignore blank text\r\n\t\t\t\t\tif(lay.textInput.value == '')\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\tdhistory.push(cloneObject(dobjs));\r\n\t\t\t\t\t// If a shape is clicked, alter its value instead of adding a new one.\r\n\t\t\t\t\tif(lay.dobj){\r\n\t\t\t\t\t\tlay.dobj.text = lay.textInput.value;\r\n\t\t\t\t\t\tlay.dobj.link = lay.linkInput.value;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tvar obj = new textTool.objctor();\r\n\t\t\t\t\t\tobj.tool = cur_tool.name;\r\n\t\t\t\t\t\tobj.color = cur_col;\r\n\t\t\t\t\t\tobj.width = cur_thin;\r\n\t\t\t\t\t\tobj.points.push({x: lay.canvasPos.x, y: lay.canvasPos.y});\r\n\t\t\t\t\t\tobj.text = lay.textInput.value;\r\n\t\t\t\t\t\tobj.link = lay.linkInput.value;\r\n\t\t\t\t\t\tdobjs.push(obj);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tupdateDrawData();\r\n\t\t\t\t\tredraw(dobjs);\r\n\t\t\t\t}\r\n\t\t\t\tvar cancelbutton = document.createElement('input');\r\n\t\t\t\tcancelbutton.type = 'button';\r\n\t\t\t\tcancelbutton.value = 'Cancel';\r\n\t\t\t\tcancelbutton.onclick = function(s){\r\n\t\t\t\t\tlay.style.display = 'none';\r\n\t\t\t\t}\r\n//\t\t\t\tlay.appendChild(document.createElement('br')); // It seems to add an extra line break\r\n\t\t\t\tlay.appendChild(okbutton);\r\n\t\t\t\tlay.appendChild(cancelbutton);\r\n\t\t\t\t// Append as the body element's child because style.position = \"absolute\" would\r\n\t\t\t\t// screw up in deeply nested DOM tree (which may have a positioned ancestor).\r\n\t\t\t\tdocument.body.appendChild(lay);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\ttextLayer.style.display = 'block';\r\n\t\t\tvar coord = canvasToSrc(constrainCoord({x:x, y:y}));\r\n\t\t\ttextLayer.canvasPos.x = coord.x;\r\n\t\t\ttextLayer.canvasPos.y = coord.y;\r\n\r\n\t\t\t// Find if any TextShape is under the mouse cursor.\r\n\t\t\ttextLayer.dobj = null;\r\n\t\t\ttextLayer.textInput.value = \"\";\r\n\t\t\tfor (var i = 0; i < dobjs.length; i++) {\r\n\t\t\t\tif(dobjs[i] instanceof TextShape && hitRect(objBounds(dobjs[i], true), coord.x, coord.y)){\r\n\t\t\t\t\ttextLayer.dobj = dobjs[i]; // Remember the shape being clicked on.\r\n\t\t\t\t\ttextLayer.textInput.value = dobjs[i].text; // Initialized the input buffer with the previous content.\r\n\t\t\t\t\ttextLayer.linkInput.value = dobjs[i].link;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Adjust the text area's width so that two of them uses the div element's space efficiently.\r\n\t\t\tvar textInputRect = textLayer.textInput.getBoundingClientRect();\r\n\t\t\tvar linkInputRect = textLayer.linkInput.getBoundingClientRect();\r\n\t\t\ttextLayer.linkInput.style.width = textInputRect.width - (linkInputRect.left - textInputRect.left) + \"px\";\r\n\r\n\t\t\tvar canvasRect = canvas.getBoundingClientRect();\r\n\t\t\t// Cross-browser scroll position query\r\n\t\t\tvar scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;\r\n\t\t\tvar scrollY = document.documentElement.scrollTop || document.body.scrollTop;\r\n\t\t\t// getBoundingClientRect() returns coordinates relative to view, which means we have to\r\n\t\t\t// add scroll position into them.\r\n\t\t\ttextLayer.style.left = (canvasRect.left + scrollX + offset.x + coord.x) + 'px';\r\n\t\t\ttextLayer.style.top = (canvasRect.top + scrollY + offset.y + coord.y) + 'px';\r\n\t\t\t// focus() should be called after textLayer is positioned, otherwise the page may\r\n\t\t\t// unexpectedly scroll to somewhere.\r\n\t\t\ttextLayer.textInput.focus();\r\n\r\n\t\t\t// Reset the point buffer\r\n//\t\t\t\tidx = 0;\r\n\t\t\treturn true; // Skip registration\r\n\t\t}\r\n\t})\r\n];\r\n\r\nvar toolbars = [toolbar,\r\n\t[\r\n\t\ttoolmap.select,\r\n\t\ttoolmap.pathedit,\r\n\t\tnew Tool(\"delete\", 1, {\r\n\t\t\tdrawTool: function(x, y){\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tctx.moveTo(x, y);\r\n\t\t\t\tctx.lineTo(x+10, y+10);\r\n\t\t\t\tctx.moveTo(x, y+10);\r\n\t\t\t\tctx.lineTo(x+10, y);\r\n\t\t\t\tctx.stroke();\r\n\t\t\t\tctx.strokeText('1', x+45, y+10);\r\n\t\t\t}\r\n\t\t}),\r\n\t\tnew Tool(\"done\", 1, {objctor: PointShape,\r\n\t\t\tdrawTool: function(x, y){\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tctx.strokeText(i18n.t('Done'), x+3, y+10);\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tctx.arc(x+9, y+5, 8, 0, 6.28, false);\r\n\t\t\t\tctx.stroke();\r\n\t\t\t\tctx.strokeText('1', x+45, y+10);\r\n\t\t\t},\r\n\t\t\tsetWidth: nop,\r\n\t\t\tdraw: function(obj){\r\n\t\t\t\tvar arr = obj.points;\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tl_complete(ctx, arr);\r\n\t\t\t}\r\n\t\t}),\r\n\t\tnew Tool(\"path\", 2, {\r\n\t\t\tobjctor: PathShape,\r\n\t\t\tdrawTool: function(x, y){\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tctx.moveTo(x, y);\r\n\t\t\t\tctx.bezierCurveTo(x+10, y+20, x+20, y-10, x+30, y+10);\r\n\t\t\t\tctx.stroke();\r\n\t\t\t\tctx.strokeText('n', x+45, y+10);\r\n\t\t\t},\r\n\t\t\tdraw: function(obj){\r\n\t\t\t\tvar arr = obj.points;\r\n\t\t\t\tif(arr.length < 2)\r\n\t\t\t\t\treturn;\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tctx.moveTo(arr[0].x, arr[0].y);\r\n\t\t\t\tfor(var i = 1; i < arr.length; i++){\r\n\t\t\t\t\tif(\"cx\" in arr[i] && \"cy\" in arr[i]){\r\n\t\t\t\t\t\tif(\"dx\" in arr[i] && \"dy\" in arr[i])\r\n\t\t\t\t\t\t\tctx.bezierCurveTo(arr[i].cx, arr[i].cy, arr[i].dx, arr[i].dy, arr[i].x, arr[i].y);\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tctx.bezierCurveTo(arr[i].cx, arr[i].cy, arr[i].x, arr[i].y, arr[i].x, arr[i].y);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(\"dx\" in arr[i] && \"dy\" in arr[i])\r\n\t\t\t\t\t\tctx.bezierCurveTo(arr[i-1].x, arr[i-1].y, arr[i].dx, arr[i].dy, arr[i].x, arr[i].y);\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tctx.lineTo(arr[i].x, arr[i].y);\r\n\t\t\t\t}\r\n\t\t\t\tctx.stroke();\r\n\t\t\t\tif(\"arrow\" in obj && \"head\" in obj.arrow && 1 < arr.length){\r\n\t\t\t\t\tvar first = arr[0], first2 = arr[1], a = [];\r\n\t\t\t\t\tif(\"cx\" in first2 && \"cy\" in first2 && (first2.cx !== first.x || first2.cy !== first.y))\r\n\t\t\t\t\t\ta[0] = {x: first2.cx, y: first2.cy};\r\n\t\t\t\t\telse if(\"dx\" in first2 && \"dy\" in first2 && (first2.dx !== first.x || first2.dy !== first.y))\r\n\t\t\t\t\t\ta[0] = {x: first2.dx, y: first2.dy};\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\ta[0] = first2;\r\n\t\t\t\t\ta[1] = first;\r\n\t\t\t\t\tctx.beginPath();\r\n\t\t\t\t\tl_hige(ctx, a);\r\n\t\t\t\t}\r\n\t\t\t\tif(\"arrow\" in obj && \"tail\" in obj.arrow && 1 < arr.length){\r\n\t\t\t\t\tvar last = arr[arr.length-1], last2 = arr[arr.length-2], a = [];\r\n\t\t\t\t\tif(\"dx\" in last && \"dy\" in last && (last.dx !== last.x || last.dy !== last.y))\r\n\t\t\t\t\t\ta[0] = {x: last.dx, y: last.dy};\r\n\t\t\t\t\telse if(\"cx\" in last && \"cy\" in last && (last.cx !== last.x || last.cy !== last.y))\r\n\t\t\t\t\t\ta[0] = {x: last.cx, y: last.cy};\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\ta[0] = last2;\r\n\t\t\t\t\ta[1] = last;\r\n\t\t\t\t\tctx.beginPath();\r\n\t\t\t\t\tl_hige(ctx, a);\r\n\t\t\t\t}\r\n\t\t\t\tctx.lineWidth = 1;\r\n\r\n\t\t\t\t// Draws dashed line that connects a control point and its associated vertex\r\n\t\t\t\t// This one does not take offset into account since the transformation is done\r\n\t\t\t\t// before this function.\r\n\t\t\t\tfunction drawGuidingLineNoOffset(pt0, pt, name){\r\n\t\t\t\t\tctx.setLineDash([5]);\r\n\t\t\t\t\tctx.beginPath();\r\n\t\t\t\t\tctx.moveTo(pt0.x, pt0.y);\r\n\t\t\t\t\tctx.lineTo(pt[name + \"x\"], pt[name + \"y\"]);\r\n\t\t\t\t\tctx.stroke();\r\n\t\t\t\t\tctx.setLineDash([]);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(obj === cur_shape){\r\n\t\t\t\t\tvar last = arr[arr.length-1];\r\n\t\t\t\t\tdrawGuidingLineNoOffset(last ,last, \"d\");\r\n\t\t\t\t\tdrawHandle(last.dx, last.dy, \"#ff7f7f\", true);\r\n\t\t\t\t\tvar next = {x: 2 * last.x - last.dx, y: 2 * last.y - last.dy};\r\n\t\t\t\t\tdrawGuidingLineNoOffset(last, next, \"\");\r\n\t\t\t\t\tdrawHandle(next.x, next.y, \"#ff7f7f\", true);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tonNewShape: function(shape){}, /// Virtual event handler on creation of a new shape\r\n\t\t\tappendPoint: function(x, y){\r\n\t\t\t\tfunction addPoint(){\r\n\t\t\t\t\tvar pts = cur_shape.points;\r\n\t\t\t\t\tpts.push(cloneObject(d));\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar d = canvasToSrc(constrainCoord({x:x, y:y}));\r\n\t\t\t\tif(!cur_shape){\r\n\t\t\t\t\tvar obj = new cur_tool.objctor();\r\n\t\t\t\t\tobj.tool = cur_tool.name;\r\n\t\t\t\t\tobj.color = cur_col;\r\n\t\t\t\t\tobj.width = cur_thin;\r\n\t\t\t\t\tthis.onNewShape(obj);\r\n\t\t\t\t\tcur_shape = obj;\r\n\t\t\t\t\taddPoint();\r\n\t\t\t\t\taddPoint();\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tvar pts = cur_shape.points;\r\n\t\t\t\t\tif(pts.length !== 1){\r\n\t\t\t\t\t\tvar prev = pts[pts.length-2];\r\n\t\t\t\t\t\tif(d.x === prev.x && d.y === prev.y){\r\n\t\t\t\t\t\t\tcur_shape.points.pop();\r\n\t\t\t\t\t\t\tdhistory.push(cloneObject(dobjs));\r\n\t\t\t\t\t\t\tdobjs.push(cur_shape);\r\n\t\t\t\t\t\t\tupdateDrawData();\r\n\t\t\t\t\t\t\tcur_shape = null;\r\n\t\t\t\t\t\t\tredraw(dobjs);\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(0 < pts.length){\r\n\t\t\t\t\t\tvar prev = pts[pts.length-1];\r\n\t\t\t\t\t\t// Mirror position of control point for smooth curve\r\n\t\t\t\t\t\tif(\"dx\" in prev && \"dy\" in prev){\r\n\t\t\t\t\t\t\td.cx = 2 * prev.x - prev.dx;\r\n\t\t\t\t\t\t\td.cy = 2 * prev.y - prev.dy;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\taddPoint();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tmouseDown: function(e){\r\n\t\t\t\tif(cur_shape){\r\n\t\t\t\t\tvar clrect = canvas.getBoundingClientRect();\r\n\t\t\t\t\tvar mx = e.clientX - clrect.left;\r\n\t\t\t\t\tvar my = e.clientY - clrect.top;\r\n\t\t\t\t\t// Remember mouse stat to this (Path tool) object for later use\r\n\t\t\t\t\t// in mouseMove().\r\n\t\t\t\t\tthis.lastx = mx;\r\n\t\t\t\t\tthis.lasty = my;\r\n\t\t\t\t\tthis.lastPoint = cur_shape.points[cur_shape.points.length-1];\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tmouseMove: function(e){\r\n\t\t\t\tif(!cur_shape)\r\n\t\t\t\t\treturn;\r\n\t\t\t\tvar clrect = canvas.getBoundingClientRect();\r\n\t\t\t\tvar mx = e.clientX - clrect.left;\r\n\t\t\t\tvar my = e.clientY - clrect.top;\r\n\t\t\t\tif(this.lastPoint){\r\n\t\t\t\t\tvar pt = this.lastPoint;\r\n\t\t\t\t\tvar d = canvasToSrc(constrainCoord({x:mx, y:my}));\r\n\t\t\t\t\tif(0 < cur_shape.points.length && (pt.x !== d.x && pt.y !== d.y)){\r\n\t\t\t\t\t\tvar prev = cur_shape.points[cur_shape.points.length-2];\r\n\t\t\t\t\t\t// Extend control point by mouse dragging.\r\n\t\t\t\t\t\tpt.dx = 2 * pt.x - d.x;\r\n\t\t\t\t\t\tpt.dy = 2 * pt.y - d.y;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tredraw(dobjs);\r\n\t\t\t\t}\r\n\t\t\t\telse if(0 < cur_shape.points.length){\r\n\t\t\t\t\t// Live preview of the shape being added.\r\n\t\t\t\t\tvar coord = canvasToSrc(constrainCoord({x: mx, y: my}));\r\n\t\t\t\t\tvar pt = cur_shape.points[cur_shape.points.length-1];\r\n\t\t\t\t\tvar dx = coord.x - pt.x;\r\n\t\t\t\t\tvar dy = coord.y - pt.y;\r\n\t\t\t\t\tpt.x = coord.x;\r\n\t\t\t\t\tpt.y = coord.y;\r\n\t\t\t\t\t// Only move dx and dy along with x, y.\r\n\t\t\t\t\t// cx and cy should be moved with the previous vertex.\r\n\t\t\t\t\tif(\"dx\" in pt && \"dy\" in pt)\r\n\t\t\t\t\t\tpt.dx += dx, pt.dy += dy;\r\n\t\t\t\t\tredraw(dobjs);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tmouseUp: function(e){\r\n\t\t\t\tthis.lastPoint = null;\r\n\t\t\t},\r\n\t\t}),\r\n\t\tnew Tool(\"path\", 2, {\r\n\t\t\tobjctor: PathShape,\r\n\t\t\tdrawTool: function(x, y){\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tctx.moveTo(x, y);\r\n\t\t\t\tctx.bezierCurveTo(x+10, y+20, x+20, y-10, x+30, y+10);\r\n\t\t\t\tctx.stroke();\r\n\t\t\t\tl_hige(ctx, [{x: x+20, y: y-10}, {x: x+30, y: y+10}]);\r\n\t\t\t\tctx.strokeText('n', x+45, y+10);\r\n\t\t\t},\r\n\t\t\tdraw: toolmap.path.draw,\r\n\t\t\tonNewShape: function(shape){shape.arrow = {\"tail\": null}},\r\n\t\t\tappendPoint: toolmap.path.appendPoint,\r\n\t\t\tmouseDown: toolmap.path.mouseDown,\r\n\t\t\tmouseMove: toolmap.path.mouseMove,\r\n\t\t\tmouseUp: toolmap.path.mouseUp,\r\n\t\t}),\r\n\t\tnew Tool(\"path\", 2, {\r\n\t\t\tobjctor: PathShape,\r\n\t\t\tdrawTool: function(x, y){\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tctx.moveTo(x, y);\r\n\t\t\t\tctx.bezierCurveTo(x+10, y+20, x+20, y-10, x+30, y+10);\r\n\t\t\t\tctx.stroke();\r\n\t\t\t\tl_hige(ctx, [{x: x+10, y: y+20}, {x: x, y: y}]);\r\n\t\t\t\tl_hige(ctx, [{x: x+20, y: y-10}, {x: x+30, y: y+10}]);\r\n\t\t\t\tctx.strokeText('n', x+45, y+10);\r\n\t\t\t},\r\n\t\t\tdraw: toolmap.path.draw,\r\n\t\t\tonNewShape: function(shape){shape.arrow = {head: null, \"tail\": null}},\r\n\t\t\tappendPoint: toolmap.path.appendPoint,\r\n\t\t\tmouseDown: toolmap.path.mouseDown,\r\n\t\t\tmouseMove: toolmap.path.mouseMove,\r\n\t\t\tmouseUp: toolmap.path.mouseUp,\r\n\t\t})\r\n\t]\r\n];\r\nvar toolbarPage = 0;\r\n\r\nvar white = \"rgb(255, 255, 255)\";\r\nvar black = \"rgb(0, 0, 0)\";\r\nvar blue = \"rgb(0, 100, 255)\";\r\nvar green = \"rgb(0, 255, 0)\";\r\nvar red = \"rgb(255, 0, 0)\";\r\nvar gray = \"rgb(150, 150, 150)\";\r\nvar colstr = new Array(black,blue,red,green,white);\r\nvar colnames = [\"black\", \"blue\", \"red\", \"green\", \"white\"];\r\nvar coltable = {\"black\": black, \"blue\": blue, \"red\": red, \"green\": green, \"white\": white};\r\nvar x0 = 0, y0 = 0, w0 = 1024, h0 = 640;\r\nvar x1 = 90, y1 = 50, w1 = 930, h1 = 580;\r\nvar mx0 = 10, mx1 = x1, mx2 = 600, mx3 = 820;\r\nvar mw0 = 70, mw1 = 60, mw2 = 30, my0 = 20, mh0 = 28;\r\nvar cur_tool = toolmap.select, cur_col = \"black\", cur_thin = 1;\r\nvar cur_shape = null;\r\nvar offset = editmode ? {x:x1, y:y1} : {x:0, y:0};\r\n\r\n// The layer to show input controls for width and height sizes of the figure.\r\n// It's kept as a member variable in order to reuse in the second and later invocations.\r\nvar sizeLayer = null;\r\n\r\n// The layer to input text.\r\n// It used to be prompt() function, but it's not beautiful.\r\nvar textLayer = null;\r\n\r\n// The default metaObj values used for resetting.\r\nvar defaultMetaObj = {type: \"meta\", size: [1024-x1, 640-y1]};\r\n\r\n// The meta object is always the first element in the serialized figure text,\r\n// but is not an element of dobjs array.\r\n// It's automatically loaded when deserialized and included when serialized.\r\nvar metaObj = cloneObject(defaultMetaObj);\r\n\r\n// A pseudo-this pointer that can be used in private methods.\r\n// Private methods mean local functions in this constructor, which\r\n// don't share this pointer with the constructor itself unless the\r\n// form \"function.call(this)\" is used.\r\nvar self = this;\r\n\r\nonload();\r\n}\r\n\r\n// Create and return a XMLHttpRequest object or ActiveXObject for IE6-\r\nSketchCanvas.prototype.createXMLHttpRequest = function(){\r\n\tvar xmlHttp = null;\r\n\ttry{\r\n\t\t// for IE7+, Fireforx, Chrome, Opera, Safari\r\n\t\txmlHttp = new XMLHttpRequest();\r\n\t}\r\n\tcatch(e){\r\n\t\ttry{\r\n\t\t\t// for IE6, IE5 (canvas element wouldn't work from the start, though)\r\n\t\t\txmlHttp = new ActiveXObject(\"Msxml2.XMLHTTP\");\r\n\t\t}\r\n\t\tcatch(e){\r\n\t\t\ttry{\r\n\t\t\t\txmlHttp = new ActiveXObject(\"Microsoft.XMLHttp\");\r\n\t\t\t}\r\n\t\t\tcatch(e){\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn xmlHttp;\r\n}\r\n", "\r\n/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */\r\nfunction isNothing(subject) {\r\n return (typeof subject === 'undefined') || (subject === null);\r\n}\r\n\r\n\r\nfunction isObject(subject) {\r\n return (typeof subject === 'object') && (subject !== null);\r\n}\r\n\r\n\r\nfunction toArray(sequence) {\r\n if (Array.isArray(sequence)) return sequence;\r\n else if (isNothing(sequence)) return [];\r\n\r\n return [ sequence ];\r\n}\r\n\r\n\r\nfunction extend(target, source) {\r\n var index, length, key, sourceKeys;\r\n\r\n if (source) {\r\n sourceKeys = Object.keys(source);\r\n\r\n for (index = 0, length = sourceKeys.length; index < length; index += 1) {\r\n key = sourceKeys[index];\r\n target[key] = source[key];\r\n }\r\n }\r\n\r\n return target;\r\n}\r\n\r\n\r\nfunction repeat(string, count) {\r\n var result = '', cycle;\r\n\r\n for (cycle = 0; cycle < count; cycle += 1) {\r\n result += string;\r\n }\r\n\r\n return result;\r\n}\r\n\r\n\r\nfunction isNegativeZero(number) {\r\n return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);\r\n}\r\n\r\n\r\nvar isNothing_1 = isNothing;\r\nvar isObject_1 = isObject;\r\nvar toArray_1 = toArray;\r\nvar repeat_1 = repeat;\r\nvar isNegativeZero_1 = isNegativeZero;\r\nvar extend_1 = extend;\r\n\r\nvar common = {\r\n\tisNothing: isNothing_1,\r\n\tisObject: isObject_1,\r\n\ttoArray: toArray_1,\r\n\trepeat: repeat_1,\r\n\tisNegativeZero: isNegativeZero_1,\r\n\textend: extend_1\r\n};\r\n\r\n// YAML error class. http://stackoverflow.com/questions/8458984\r\n\r\n\r\nfunction formatError(exception, compact) {\r\n var where = '', message = exception.reason || '(unknown reason)';\r\n\r\n if (!exception.mark) return message;\r\n\r\n if (exception.mark.name) {\r\n where += 'in \"' + exception.mark.name + '\" ';\r\n }\r\n\r\n where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')';\r\n\r\n if (!compact && exception.mark.snippet) {\r\n where += '\\n\\n' + exception.mark.snippet;\r\n }\r\n\r\n return message + ' ' + where;\r\n}\r\n\r\n\r\nfunction YAMLException$1(reason, mark) {\r\n // Super constructor\r\n Error.call(this);\r\n\r\n this.name = 'YAMLException';\r\n this.reason = reason;\r\n this.mark = mark;\r\n this.message = formatError(this, false);\r\n\r\n // Include stack trace in error object\r\n if (Error.captureStackTrace) {\r\n // Chrome and NodeJS\r\n Error.captureStackTrace(this, this.constructor);\r\n } else {\r\n // FF, IE 10+ and Safari 6+. Fallback for others\r\n this.stack = (new Error()).stack || '';\r\n }\r\n}\r\n\r\n\r\n// Inherit from Error\r\nYAMLException$1.prototype = Object.create(Error.prototype);\r\nYAMLException$1.prototype.constructor = YAMLException$1;\r\n\r\n\r\nYAMLException$1.prototype.toString = function toString(compact) {\r\n return this.name + ': ' + formatError(this, compact);\r\n};\r\n\r\n\r\nvar exception = YAMLException$1;\r\n\r\n// get snippet for a single line, respecting maxLength\r\nfunction getLine(buffer, lineStart, lineEnd, position, maxLineLength) {\r\n var head = '';\r\n var tail = '';\r\n var maxHalfLength = Math.floor(maxLineLength / 2) - 1;\r\n\r\n if (position - lineStart > maxHalfLength) {\r\n head = ' ... ';\r\n lineStart = position - maxHalfLength + head.length;\r\n }\r\n\r\n if (lineEnd - position > maxHalfLength) {\r\n tail = ' ...';\r\n lineEnd = position + maxHalfLength - tail.length;\r\n }\r\n\r\n return {\r\n str: head + buffer.slice(lineStart, lineEnd).replace(/\\t/g, '\u2192') + tail,\r\n pos: position - lineStart + head.length // relative position\r\n };\r\n}\r\n\r\n\r\nfunction padStart(string, max) {\r\n return common.repeat(' ', max - string.length) + string;\r\n}\r\n\r\n\r\nfunction makeSnippet(mark, options) {\r\n options = Object.create(options || null);\r\n\r\n if (!mark.buffer) return null;\r\n\r\n if (!options.maxLength) options.maxLength = 79;\r\n if (typeof options.indent !== 'number') options.indent = 1;\r\n if (typeof options.linesBefore !== 'number') options.linesBefore = 3;\r\n if (typeof options.linesAfter !== 'number') options.linesAfter = 2;\r\n\r\n var re = /\\r?\\n|\\r|\\0/g;\r\n var lineStarts = [ 0 ];\r\n var lineEnds = [];\r\n var match;\r\n var foundLineNo = -1;\r\n\r\n while ((match = re.exec(mark.buffer))) {\r\n lineEnds.push(match.index);\r\n lineStarts.push(match.index + match[0].length);\r\n\r\n if (mark.position <= match.index && foundLineNo < 0) {\r\n foundLineNo = lineStarts.length - 2;\r\n }\r\n }\r\n\r\n if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;\r\n\r\n var result = '', i, line;\r\n var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;\r\n var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);\r\n\r\n for (i = 1; i <= options.linesBefore; i++) {\r\n if (foundLineNo - i < 0) break;\r\n line = getLine(\r\n mark.buffer,\r\n lineStarts[foundLineNo - i],\r\n lineEnds[foundLineNo - i],\r\n mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),\r\n maxLineLength\r\n );\r\n result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) +\r\n ' | ' + line.str + '\\n' + result;\r\n }\r\n\r\n line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);\r\n result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) +\r\n ' | ' + line.str + '\\n';\r\n result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\\n';\r\n\r\n for (i = 1; i <= options.linesAfter; i++) {\r\n if (foundLineNo + i >= lineEnds.length) break;\r\n line = getLine(\r\n mark.buffer,\r\n lineStarts[foundLineNo + i],\r\n lineEnds[foundLineNo + i],\r\n mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),\r\n maxLineLength\r\n );\r\n result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) +\r\n ' | ' + line.str + '\\n';\r\n }\r\n\r\n return result.replace(/\\n$/, '');\r\n}\r\n\r\n\r\nvar snippet = makeSnippet;\r\n\r\nvar TYPE_CONSTRUCTOR_OPTIONS = [\r\n 'kind',\r\n 'multi',\r\n 'resolve',\r\n 'construct',\r\n 'instanceOf',\r\n 'predicate',\r\n 'represent',\r\n 'representName',\r\n 'defaultStyle',\r\n 'styleAliases'\r\n];\r\n\r\nvar YAML_NODE_KINDS = [\r\n 'scalar',\r\n 'sequence',\r\n 'mapping'\r\n];\r\n\r\nfunction compileStyleAliases(map) {\r\n var result = {};\r\n\r\n if (map !== null) {\r\n Object.keys(map).forEach(function (style) {\r\n map[style].forEach(function (alias) {\r\n result[String(alias)] = style;\r\n });\r\n });\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction Type$1(tag, options) {\r\n options = options || {};\r\n\r\n Object.keys(options).forEach(function (name) {\r\n if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {\r\n throw new exception('Unknown option \"' + name + '\" is met in definition of \"' + tag + '\" YAML type.');\r\n }\r\n });\r\n\r\n // TODO: Add tag format check.\r\n this.options = options; // keep original options in case user wants to extend this type later\r\n this.tag = tag;\r\n this.kind = options['kind'] || null;\r\n this.resolve = options['resolve'] || function () { return true; };\r\n this.construct = options['construct'] || function (data) { return data; };\r\n this.instanceOf = options['instanceOf'] || null;\r\n this.predicate = options['predicate'] || null;\r\n this.represent = options['represent'] || null;\r\n this.representName = options['representName'] || null;\r\n this.defaultStyle = options['defaultStyle'] || null;\r\n this.multi = options['multi'] || false;\r\n this.styleAliases = compileStyleAliases(options['styleAliases'] || null);\r\n\r\n if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {\r\n throw new exception('Unknown kind \"' + this.kind + '\" is specified for \"' + tag + '\" YAML type.');\r\n }\r\n}\r\n\r\nvar type = Type$1;\r\n\r\n/*eslint-disable max-len*/\r\n\r\n\r\n\r\n\r\n\r\nfunction compileList(schema, name) {\r\n var result = [];\r\n\r\n schema[name].forEach(function (currentType) {\r\n var newIndex = result.length;\r\n\r\n result.forEach(function (previousType, previousIndex) {\r\n if (previousType.tag === currentType.tag &&\r\n previousType.kind === currentType.kind &&\r\n previousType.multi === currentType.multi) {\r\n\r\n newIndex = previousIndex;\r\n }\r\n });\r\n\r\n result[newIndex] = currentType;\r\n });\r\n\r\n return result;\r\n}\r\n\r\n\r\nfunction compileMap(/* lists... */) {\r\n var result = {\r\n scalar: {},\r\n sequence: {},\r\n mapping: {},\r\n fallback: {},\r\n multi: {\r\n scalar: [],\r\n sequence: [],\r\n mapping: [],\r\n fallback: []\r\n }\r\n }, index, length;\r\n\r\n function collectType(type) {\r\n if (type.multi) {\r\n result.multi[type.kind].push(type);\r\n result.multi['fallback'].push(type);\r\n } else {\r\n result[type.kind][type.tag] = result['fallback'][type.tag] = type;\r\n }\r\n }\r\n\r\n for (index = 0, length = arguments.length; index < length; index += 1) {\r\n arguments[index].forEach(collectType);\r\n }\r\n return result;\r\n}\r\n\r\n\r\nfunction Schema$1(definition) {\r\n return this.extend(definition);\r\n}\r\n\r\n\r\nSchema$1.prototype.extend = function extend(definition) {\r\n var implicit = [];\r\n var explicit = [];\r\n\r\n if (definition instanceof type) {\r\n // Schema.extend(type)\r\n explicit.push(definition);\r\n\r\n } else if (Array.isArray(definition)) {\r\n // Schema.extend([ type1, type2, ... ])\r\n explicit = explicit.concat(definition);\r\n\r\n } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {\r\n // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] })\r\n if (definition.implicit) implicit = implicit.concat(definition.implicit);\r\n if (definition.explicit) explicit = explicit.concat(definition.explicit);\r\n\r\n } else {\r\n throw new exception('Schema.extend argument should be a Type, [ Type ], ' +\r\n 'or a schema definition ({ implicit: [...], explicit: [...] })');\r\n }\r\n\r\n implicit.forEach(function (type$1) {\r\n if (!(type$1 instanceof type)) {\r\n throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');\r\n }\r\n\r\n if (type$1.loadKind && type$1.loadKind !== 'scalar') {\r\n throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');\r\n }\r\n\r\n if (type$1.multi) {\r\n throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.');\r\n }\r\n });\r\n\r\n explicit.forEach(function (type$1) {\r\n if (!(type$1 instanceof type)) {\r\n throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');\r\n }\r\n });\r\n\r\n var result = Object.create(Schema$1.prototype);\r\n\r\n result.implicit = (this.implicit || []).concat(implicit);\r\n result.explicit = (this.explicit || []).concat(explicit);\r\n\r\n result.compiledImplicit = compileList(result, 'implicit');\r\n result.compiledExplicit = compileList(result, 'explicit');\r\n result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);\r\n\r\n return result;\r\n};\r\n\r\n\r\nvar schema = Schema$1;\r\n\r\nvar str = new type('tag:yaml.org,2002:str', {\r\n kind: 'scalar',\r\n construct: function (data) { return data !== null ? data : ''; }\r\n});\r\n\r\nvar seq = new type('tag:yaml.org,2002:seq', {\r\n kind: 'sequence',\r\n construct: function (data) { return data !== null ? data : []; }\r\n});\r\n\r\nvar map = new type('tag:yaml.org,2002:map', {\r\n kind: 'mapping',\r\n construct: function (data) { return data !== null ? data : {}; }\r\n});\r\n\r\nvar failsafe = new schema({\r\n explicit: [\r\n str,\r\n seq,\r\n map\r\n ]\r\n});\r\n\r\nfunction resolveYamlNull(data) {\r\n if (data === null) return true;\r\n\r\n var max = data.length;\r\n\r\n return (max === 1 && data === '~') ||\r\n (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));\r\n}\r\n\r\nfunction constructYamlNull() {\r\n return null;\r\n}\r\n\r\nfunction isNull(object) {\r\n return object === null;\r\n}\r\n\r\nvar _null = new type('tag:yaml.org,2002:null', {\r\n kind: 'scalar',\r\n resolve: resolveYamlNull,\r\n construct: constructYamlNull,\r\n predicate: isNull,\r\n represent: {\r\n canonical: function () { return '~'; },\r\n lowercase: function () { return 'null'; },\r\n uppercase: function () { return 'NULL'; },\r\n camelcase: function () { return 'Null'; },\r\n empty: function () { return ''; }\r\n },\r\n defaultStyle: 'lowercase'\r\n});\r\n\r\nfunction resolveYamlBoolean(data) {\r\n if (data === null) return false;\r\n\r\n var max = data.length;\r\n\r\n return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||\r\n (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));\r\n}\r\n\r\nfunction constructYamlBoolean(data) {\r\n return data === 'true' ||\r\n data === 'True' ||\r\n data === 'TRUE';\r\n}\r\n\r\nfunction isBoolean(object) {\r\n return Object.prototype.toString.call(object) === '[object Boolean]';\r\n}\r\n\r\nvar bool = new type('tag:yaml.org,2002:bool', {\r\n kind: 'scalar',\r\n resolve: resolveYamlBoolean,\r\n construct: constructYamlBoolean,\r\n predicate: isBoolean,\r\n represent: {\r\n lowercase: function (object) { return object ? 'true' : 'false'; },\r\n uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },\r\n camelcase: function (object) { return object ? 'True' : 'False'; }\r\n },\r\n defaultStyle: 'lowercase'\r\n});\r\n\r\nfunction isHexCode(c) {\r\n return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||\r\n ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||\r\n ((0x61/* a */ <= c) && (c <= 0x66/* f */));\r\n}\r\n\r\nfunction isOctCode(c) {\r\n return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));\r\n}\r\n\r\nfunction isDecCode(c) {\r\n return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));\r\n}\r\n\r\nfunction resolveYamlInteger(data) {\r\n if (data === null) return false;\r\n\r\n var max = data.length,\r\n index = 0,\r\n hasDigits = false,\r\n ch;\r\n\r\n if (!max) return false;\r\n\r\n ch = data[index];\r\n\r\n // sign\r\n if (ch === '-' || ch === '+') {\r\n ch = data[++index];\r\n }\r\n\r\n if (ch === '0') {\r\n // 0\r\n if (index + 1 === max) return true;\r\n ch = data[++index];\r\n\r\n // base 2, base 8, base 16\r\n\r\n if (ch === 'b') {\r\n // base 2\r\n index++;\r\n\r\n for (; index < max; index++) {\r\n ch = data[index];\r\n if (ch === '_') continue;\r\n if (ch !== '0' && ch !== '1') return false;\r\n hasDigits = true;\r\n }\r\n return hasDigits && ch !== '_';\r\n }\r\n\r\n\r\n if (ch === 'x') {\r\n // base 16\r\n index++;\r\n\r\n for (; index < max; index++) {\r\n ch = data[index];\r\n if (ch === '_') continue;\r\n if (!isHexCode(data.charCodeAt(index))) return false;\r\n hasDigits = true;\r\n }\r\n return hasDigits && ch !== '_';\r\n }\r\n\r\n\r\n if (ch === 'o') {\r\n // base 8\r\n index++;\r\n\r\n for (; index < max; index++) {\r\n ch = data[index];\r\n if (ch === '_') continue;\r\n if (!isOctCode(data.charCodeAt(index))) return false;\r\n hasDigits = true;\r\n }\r\n return hasDigits && ch !== '_';\r\n }\r\n }\r\n\r\n // base 10 (except 0)\r\n\r\n // value should not start with `_`;\r\n if (ch === '_') return false;\r\n\r\n for (; index < max; index++) {\r\n ch = data[index];\r\n if (ch === '_') continue;\r\n if (!isDecCode(data.charCodeAt(index))) {\r\n return false;\r\n }\r\n hasDigits = true;\r\n }\r\n\r\n // Should have digits and should not end with `_`\r\n if (!hasDigits || ch === '_') return false;\r\n\r\n return true;\r\n}\r\n\r\nfunction constructYamlInteger(data) {\r\n var value = data, sign = 1, ch;\r\n\r\n if (value.indexOf('_') !== -1) {\r\n value = value.replace(/_/g, '');\r\n }\r\n\r\n ch = value[0];\r\n\r\n if (ch === '-' || ch === '+') {\r\n if (ch === '-') sign = -1;\r\n value = value.slice(1);\r\n ch = value[0];\r\n }\r\n\r\n if (value === '0') return 0;\r\n\r\n if (ch === '0') {\r\n if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);\r\n if (value[1] === 'x') return sign * parseInt(value.slice(2), 16);\r\n if (value[1] === 'o') return sign * parseInt(value.slice(2), 8);\r\n }\r\n\r\n return sign * parseInt(value, 10);\r\n}\r\n\r\nfunction isInteger(object) {\r\n return (Object.prototype.toString.call(object)) === '[object Number]' &&\r\n (object % 1 === 0 && !common.isNegativeZero(object));\r\n}\r\n\r\nvar int = new type('tag:yaml.org,2002:int', {\r\n kind: 'scalar',\r\n resolve: resolveYamlInteger,\r\n construct: constructYamlInteger,\r\n predicate: isInteger,\r\n represent: {\r\n binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },\r\n octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); },\r\n decimal: function (obj) { return obj.toString(10); },\r\n /* eslint-disable max-len */\r\n hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }\r\n },\r\n defaultStyle: 'decimal',\r\n styleAliases: {\r\n binary: [ 2, 'bin' ],\r\n octal: [ 8, 'oct' ],\r\n decimal: [ 10, 'dec' ],\r\n hexadecimal: [ 16, 'hex' ]\r\n }\r\n});\r\n\r\nvar YAML_FLOAT_PATTERN = new RegExp(\r\n // 2.5e4, 2.5 and integers\r\n '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +\r\n // .2e4, .2\r\n // special case, seems not from spec\r\n '|\\\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +\r\n // .inf\r\n '|[-+]?\\\\.(?:inf|Inf|INF)' +\r\n // .nan\r\n '|\\\\.(?:nan|NaN|NAN))$');\r\n\r\nfunction resolveYamlFloat(data) {\r\n if (data === null) return false;\r\n\r\n if (!YAML_FLOAT_PATTERN.test(data) ||\r\n // Quick hack to not allow integers end with `_`\r\n // Probably should update regexp & check speed\r\n data[data.length - 1] === '_') {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n\r\nfunction constructYamlFloat(data) {\r\n var value, sign;\r\n\r\n value = data.replace(/_/g, '').toLowerCase();\r\n sign = value[0] === '-' ? -1 : 1;\r\n\r\n if ('+-'.indexOf(value[0]) >= 0) {\r\n value = value.slice(1);\r\n }\r\n\r\n if (value === '.inf') {\r\n return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;\r\n\r\n } else if (value === '.nan') {\r\n return NaN;\r\n }\r\n return sign * parseFloat(value, 10);\r\n}\r\n\r\n\r\nvar SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;\r\n\r\nfunction representYamlFloat(object, style) {\r\n var res;\r\n\r\n if (isNaN(object)) {\r\n switch (style) {\r\n case 'lowercase': return '.nan';\r\n case 'uppercase': return '.NAN';\r\n case 'camelcase': return '.NaN';\r\n }\r\n } else if (Number.POSITIVE_INFINITY === object) {\r\n switch (style) {\r\n case 'lowercase': return '.inf';\r\n case 'uppercase': return '.INF';\r\n case 'camelcase': return '.Inf';\r\n }\r\n } else if (Number.NEGATIVE_INFINITY === object) {\r\n switch (style) {\r\n case 'lowercase': return '-.inf';\r\n case 'uppercase': return '-.INF';\r\n case 'camelcase': return '-.Inf';\r\n }\r\n } else if (common.isNegativeZero(object)) {\r\n return '-0.0';\r\n }\r\n\r\n res = object.toString(10);\r\n\r\n // JS stringifier can build scientific format without dots: 5e-100,\r\n // while YAML requres dot: 5.e-100. Fix it with simple hack\r\n\r\n return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;\r\n}\r\n\r\nfunction isFloat(object) {\r\n return (Object.prototype.toString.call(object) === '[object Number]') &&\r\n (object % 1 !== 0 || common.isNegativeZero(object));\r\n}\r\n\r\nvar float = new type('tag:yaml.org,2002:float', {\r\n kind: 'scalar',\r\n resolve: resolveYamlFloat,\r\n construct: constructYamlFloat,\r\n predicate: isFloat,\r\n represent: representYamlFloat,\r\n defaultStyle: 'lowercase'\r\n});\r\n\r\nvar json = failsafe.extend({\r\n implicit: [\r\n _null,\r\n bool,\r\n int,\r\n float\r\n ]\r\n});\r\n\r\nvar core = json;\r\n\r\nvar YAML_DATE_REGEXP = new RegExp(\r\n '^([0-9][0-9][0-9][0-9])' + // [1] year\r\n '-([0-9][0-9])' + // [2] month\r\n '-([0-9][0-9])$'); // [3] day\r\n\r\nvar YAML_TIMESTAMP_REGEXP = new RegExp(\r\n '^([0-9][0-9][0-9][0-9])' + // [1] year\r\n '-([0-9][0-9]?)' + // [2] month\r\n '-([0-9][0-9]?)' + // [3] day\r\n '(?:[Tt]|[ \\\\t]+)' + // ...\r\n '([0-9][0-9]?)' + // [4] hour\r\n ':([0-9][0-9])' + // [5] minute\r\n ':([0-9][0-9])' + // [6] second\r\n '(?:\\\\.([0-9]*))?' + // [7] fraction\r\n '(?:[ \\\\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour\r\n '(?::([0-9][0-9]))?))?$'); // [11] tz_minute\r\n\r\nfunction resolveYamlTimestamp(data) {\r\n if (data === null) return false;\r\n if (YAML_DATE_REGEXP.exec(data) !== null) return true;\r\n if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;\r\n return false;\r\n}\r\n\r\nfunction constructYamlTimestamp(data) {\r\n var match, year, month, day, hour, minute, second, fraction = 0,\r\n delta = null, tz_hour, tz_minute, date;\r\n\r\n match = YAML_DATE_REGEXP.exec(data);\r\n if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);\r\n\r\n if (match === null) throw new Error('Date resolve error');\r\n\r\n // match: [1] year [2] month [3] day\r\n\r\n year = +(match[1]);\r\n month = +(match[2]) - 1; // JS month starts with 0\r\n day = +(match[3]);\r\n\r\n if (!match[4]) { // no hour\r\n return new Date(Date.UTC(year, month, day));\r\n }\r\n\r\n // match: [4] hour [5] minute [6] second [7] fraction\r\n\r\n hour = +(match[4]);\r\n minute = +(match[5]);\r\n second = +(match[6]);\r\n\r\n if (match[7]) {\r\n fraction = match[7].slice(0, 3);\r\n while (fraction.length < 3) { // milli-seconds\r\n fraction += '0';\r\n }\r\n fraction = +fraction;\r\n }\r\n\r\n // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute\r\n\r\n if (match[9]) {\r\n tz_hour = +(match[10]);\r\n tz_minute = +(match[11] || 0);\r\n delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds\r\n if (match[9] === '-') delta = -delta;\r\n }\r\n\r\n date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));\r\n\r\n if (delta) date.setTime(date.getTime() - delta);\r\n\r\n return date;\r\n}\r\n\r\nfunction representYamlTimestamp(object /*, style*/) {\r\n return object.toISOString();\r\n}\r\n\r\nvar timestamp = new type('tag:yaml.org,2002:timestamp', {\r\n kind: 'scalar',\r\n resolve: resolveYamlTimestamp,\r\n construct: constructYamlTimestamp,\r\n instanceOf: Date,\r\n represent: representYamlTimestamp\r\n});\r\n\r\nfunction resolveYamlMerge(data) {\r\n return data === '<<' || data === null;\r\n}\r\n\r\nvar merge = new type('tag:yaml.org,2002:merge', {\r\n kind: 'scalar',\r\n resolve: resolveYamlMerge\r\n});\r\n\r\n/*eslint-disable no-bitwise*/\r\n\r\n\r\n\r\n\r\n\r\n// [ 64, 65, 66 ] -> [ padding, CR, LF ]\r\nvar BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\\n\\r';\r\n\r\n\r\nfunction resolveYamlBinary(data) {\r\n if (data === null) return false;\r\n\r\n var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;\r\n\r\n // Convert one by one.\r\n for (idx = 0; idx < max; idx++) {\r\n code = map.indexOf(data.charAt(idx));\r\n\r\n // Skip CR/LF\r\n if (code > 64) continue;\r\n\r\n // Fail on illegal characters\r\n if (code < 0) return false;\r\n\r\n bitlen += 6;\r\n }\r\n\r\n // If there are any bits left, source was corrupted\r\n return (bitlen % 8) === 0;\r\n}\r\n\r\nfunction constructYamlBinary(data) {\r\n var idx, tailbits,\r\n input = data.replace(/[\\r\\n=]/g, ''), // remove CR/LF & padding to simplify scan\r\n max = input.length,\r\n map = BASE64_MAP,\r\n bits = 0,\r\n result = [];\r\n\r\n // Collect by 6*4 bits (3 bytes)\r\n\r\n for (idx = 0; idx < max; idx++) {\r\n if ((idx % 4 === 0) && idx) {\r\n result.push((bits >> 16) & 0xFF);\r\n result.push((bits >> 8) & 0xFF);\r\n result.push(bits & 0xFF);\r\n }\r\n\r\n bits = (bits << 6) | map.indexOf(input.charAt(idx));\r\n }\r\n\r\n // Dump tail\r\n\r\n tailbits = (max % 4) * 6;\r\n\r\n if (tailbits === 0) {\r\n result.push((bits >> 16) & 0xFF);\r\n result.push((bits >> 8) & 0xFF);\r\n result.push(bits & 0xFF);\r\n } else if (tailbits === 18) {\r\n result.push((bits >> 10) & 0xFF);\r\n result.push((bits >> 2) & 0xFF);\r\n } else if (tailbits === 12) {\r\n result.push((bits >> 4) & 0xFF);\r\n }\r\n\r\n return new Uint8Array(result);\r\n}\r\n\r\nfunction representYamlBinary(object /*, style*/) {\r\n var result = '', bits = 0, idx, tail,\r\n max = object.length,\r\n map = BASE64_MAP;\r\n\r\n // Convert every three bytes to 4 ASCII characters.\r\n\r\n for (idx = 0; idx < max; idx++) {\r\n if ((idx % 3 === 0) && idx) {\r\n result += map[(bits >> 18) & 0x3F];\r\n result += map[(bits >> 12) & 0x3F];\r\n result += map[(bits >> 6) & 0x3F];\r\n result += map[bits & 0x3F];\r\n }\r\n\r\n bits = (bits << 8) + object[idx];\r\n }\r\n\r\n // Dump tail\r\n\r\n tail = max % 3;\r\n\r\n if (tail === 0) {\r\n result += map[(bits >> 18) & 0x3F];\r\n result += map[(bits >> 12) & 0x3F];\r\n result += map[(bits >> 6) & 0x3F];\r\n result += map[bits & 0x3F];\r\n } else if (tail === 2) {\r\n result += map[(bits >> 10) & 0x3F];\r\n result += map[(bits >> 4) & 0x3F];\r\n result += map[(bits << 2) & 0x3F];\r\n result += map[64];\r\n } else if (tail === 1) {\r\n result += map[(bits >> 2) & 0x3F];\r\n result += map[(bits << 4) & 0x3F];\r\n result += map[64];\r\n result += map[64];\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction isBinary(obj) {\r\n return Object.prototype.toString.call(obj) === '[object Uint8Array]';\r\n}\r\n\r\nvar binary = new type('tag:yaml.org,2002:binary', {\r\n kind: 'scalar',\r\n resolve: resolveYamlBinary,\r\n construct: constructYamlBinary,\r\n predicate: isBinary,\r\n represent: representYamlBinary\r\n});\r\n\r\nvar _hasOwnProperty$3 = Object.prototype.hasOwnProperty;\r\nvar _toString$2 = Object.prototype.toString;\r\n\r\nfunction resolveYamlOmap(data) {\r\n if (data === null) return true;\r\n\r\n var objectKeys = [], index, length, pair, pairKey, pairHasKey,\r\n object = data;\r\n\r\n for (index = 0, length = object.length; index < length; index += 1) {\r\n pair = object[index];\r\n pairHasKey = false;\r\n\r\n if (_toString$2.call(pair) !== '[object Object]') return false;\r\n\r\n for (pairKey in pair) {\r\n if (_hasOwnProperty$3.call(pair, pairKey)) {\r\n if (!pairHasKey) pairHasKey = true;\r\n else return false;\r\n }\r\n }\r\n\r\n if (!pairHasKey) return false;\r\n\r\n if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);\r\n else return false;\r\n }\r\n\r\n return true;\r\n}\r\n\r\nfunction constructYamlOmap(data) {\r\n return data !== null ? data : [];\r\n}\r\n\r\nvar omap = new type('tag:yaml.org,2002:omap', {\r\n kind: 'sequence',\r\n resolve: resolveYamlOmap,\r\n construct: constructYamlOmap\r\n});\r\n\r\nvar _toString$1 = Object.prototype.toString;\r\n\r\nfunction resolveYamlPairs(data) {\r\n if (data === null) return true;\r\n\r\n var index, length, pair, keys, result,\r\n object = data;\r\n\r\n result = new Array(object.length);\r\n\r\n for (index = 0, length = object.length; index < length; index += 1) {\r\n pair = object[index];\r\n\r\n if (_toString$1.call(pair) !== '[object Object]') return false;\r\n\r\n keys = Object.keys(pair);\r\n\r\n if (keys.length !== 1) return false;\r\n\r\n result[index] = [ keys[0], pair[keys[0]] ];\r\n }\r\n\r\n return true;\r\n}\r\n\r\nfunction constructYamlPairs(data) {\r\n if (data === null) return [];\r\n\r\n var index, length, pair, keys, result,\r\n object = data;\r\n\r\n result = new Array(object.length);\r\n\r\n for (index = 0, length = object.length; index < length; index += 1) {\r\n pair = object[index];\r\n\r\n keys = Object.keys(pair);\r\n\r\n result[index] = [ keys[0], pair[keys[0]] ];\r\n }\r\n\r\n return result;\r\n}\r\n\r\nvar pairs = new type('tag:yaml.org,2002:pairs', {\r\n kind: 'sequence',\r\n resolve: resolveYamlPairs,\r\n construct: constructYamlPairs\r\n});\r\n\r\nvar _hasOwnProperty$2 = Object.prototype.hasOwnProperty;\r\n\r\nfunction resolveYamlSet(data) {\r\n if (data === null) return true;\r\n\r\n var key, object = data;\r\n\r\n for (key in object) {\r\n if (_hasOwnProperty$2.call(object, key)) {\r\n if (object[key] !== null) return false;\r\n }\r\n }\r\n\r\n return true;\r\n}\r\n\r\nfunction constructYamlSet(data) {\r\n return data !== null ? data : {};\r\n}\r\n\r\nvar set = new type('tag:yaml.org,2002:set', {\r\n kind: 'mapping',\r\n resolve: resolveYamlSet,\r\n construct: constructYamlSet\r\n});\r\n\r\nvar _default = core.extend({\r\n implicit: [\r\n timestamp,\r\n merge\r\n ],\r\n explicit: [\r\n binary,\r\n omap,\r\n pairs,\r\n set\r\n ]\r\n});\r\n\r\n/*eslint-disable max-len,no-use-before-define*/\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar _hasOwnProperty$1 = Object.prototype.hasOwnProperty;\r\n\r\n\r\nvar CONTEXT_FLOW_IN = 1;\r\nvar CONTEXT_FLOW_OUT = 2;\r\nvar CONTEXT_BLOCK_IN = 3;\r\nvar CONTEXT_BLOCK_OUT = 4;\r\n\r\n\r\nvar CHOMPING_CLIP = 1;\r\nvar CHOMPING_STRIP = 2;\r\nvar CHOMPING_KEEP = 3;\r\n\r\n\r\nvar PATTERN_NON_PRINTABLE = /[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F-\\x84\\x86-\\x9F\\uFFFE\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/;\r\nvar PATTERN_NON_ASCII_LINE_BREAKS = /[\\x85\\u2028\\u2029]/;\r\nvar PATTERN_FLOW_INDICATORS = /[,\\[\\]\\{\\}]/;\r\nvar PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\\-]+!)$/i;\r\nvar PATTERN_TAG_URI = /^(?:!|[^,\\[\\]\\{\\}])(?:%[0-9a-f]{2}|[0-9a-z\\-#;\\/\\?:@&=\\+\\$,_\\.!~\\*'\\(\\)\\[\\]])*$/i;\r\n\r\n\r\nfunction _class(obj) { return Object.prototype.toString.call(obj); }\r\n\r\nfunction is_EOL(c) {\r\n return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);\r\n}\r\n\r\nfunction is_WHITE_SPACE(c) {\r\n return (c === 0x09/* Tab */) || (c === 0x20/* Space */);\r\n}\r\n\r\nfunction is_WS_OR_EOL(c) {\r\n return (c === 0x09/* Tab */) ||\r\n (c === 0x20/* Space */) ||\r\n (c === 0x0A/* LF */) ||\r\n (c === 0x0D/* CR */);\r\n}\r\n\r\nfunction is_FLOW_INDICATOR(c) {\r\n return c === 0x2C/* , */ ||\r\n c === 0x5B/* [ */ ||\r\n c === 0x5D/* ] */ ||\r\n c === 0x7B/* { */ ||\r\n c === 0x7D/* } */;\r\n}\r\n\r\nfunction fromHexCode(c) {\r\n var lc;\r\n\r\n if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {\r\n return c - 0x30;\r\n }\r\n\r\n /*eslint-disable no-bitwise*/\r\n lc = c | 0x20;\r\n\r\n if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {\r\n return lc - 0x61 + 10;\r\n }\r\n\r\n return -1;\r\n}\r\n\r\nfunction escapedHexLen(c) {\r\n if (c === 0x78/* x */) { return 2; }\r\n if (c === 0x75/* u */) { return 4; }\r\n if (c === 0x55/* U */) { return 8; }\r\n return 0;\r\n}\r\n\r\nfunction fromDecimalCode(c) {\r\n if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {\r\n return c - 0x30;\r\n }\r\n\r\n return -1;\r\n}\r\n\r\nfunction simpleEscapeSequence(c) {\r\n /* eslint-disable indent */\r\n return (c === 0x30/* 0 */) ? '\\x00' :\r\n (c === 0x61/* a */) ? '\\x07' :\r\n (c === 0x62/* b */) ? '\\x08' :\r\n (c === 0x74/* t */) ? '\\x09' :\r\n (c === 0x09/* Tab */) ? '\\x09' :\r\n (c === 0x6E/* n */) ? '\\x0A' :\r\n (c === 0x76/* v */) ? '\\x0B' :\r\n (c === 0x66/* f */) ? '\\x0C' :\r\n (c === 0x72/* r */) ? '\\x0D' :\r\n (c === 0x65/* e */) ? '\\x1B' :\r\n (c === 0x20/* Space */) ? ' ' :\r\n (c === 0x22/* \" */) ? '\\x22' :\r\n (c === 0x2F/* / */) ? '/' :\r\n (c === 0x5C/* \\ */) ? '\\x5C' :\r\n (c === 0x4E/* N */) ? '\\x85' :\r\n (c === 0x5F/* _ */) ? '\\xA0' :\r\n (c === 0x4C/* L */) ? '\\u2028' :\r\n (c === 0x50/* P */) ? '\\u2029' : '';\r\n}\r\n\r\nfunction charFromCodepoint(c) {\r\n if (c <= 0xFFFF) {\r\n return String.fromCharCode(c);\r\n }\r\n // Encode UTF-16 surrogate pair\r\n // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF\r\n return String.fromCharCode(\r\n ((c - 0x010000) >> 10) + 0xD800,\r\n ((c - 0x010000) & 0x03FF) + 0xDC00\r\n );\r\n}\r\n\r\nvar simpleEscapeCheck = new Array(256); // integer, for fast access\r\nvar simpleEscapeMap = new Array(256);\r\nfor (var i = 0; i < 256; i++) {\r\n simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;\r\n simpleEscapeMap[i] = simpleEscapeSequence(i);\r\n}\r\n\r\n\r\nfunction State$1(input, options) {\r\n this.input = input;\r\n\r\n this.filename = options['filename'] || null;\r\n this.schema = options['schema'] || _default;\r\n this.onWarning = options['onWarning'] || null;\r\n // (Hidden) Remove? makes the loader to expect YAML 1.1 documents\r\n // if such documents have no explicit %YAML directive\r\n this.legacy = options['legacy'] || false;\r\n\r\n this.json = options['json'] || false;\r\n this.listener = options['listener'] || null;\r\n\r\n this.implicitTypes = this.schema.compiledImplicit;\r\n this.typeMap = this.schema.compiledTypeMap;\r\n\r\n this.length = input.length;\r\n this.position = 0;\r\n this.line = 0;\r\n this.lineStart = 0;\r\n this.lineIndent = 0;\r\n\r\n // position of first leading tab in the current line,\r\n // used to make sure there are no tabs in the indentation\r\n this.firstTabInLine = -1;\r\n\r\n this.documents = [];\r\n\r\n /*\r\n this.version;\r\n this.checkLineBreaks;\r\n this.tagMap;\r\n this.anchorMap;\r\n this.tag;\r\n this.anchor;\r\n this.kind;\r\n this.result;*/\r\n\r\n}\r\n\r\n\r\nfunction generateError(state, message) {\r\n var mark = {\r\n name: state.filename,\r\n buffer: state.input.slice(0, -1), // omit trailing \\0\r\n position: state.position,\r\n line: state.line,\r\n column: state.position - state.lineStart\r\n };\r\n\r\n mark.snippet = snippet(mark);\r\n\r\n return new exception(message, mark);\r\n}\r\n\r\nfunction throwError(state, message) {\r\n throw generateError(state, message);\r\n}\r\n\r\nfunction throwWarning(state, message) {\r\n if (state.onWarning) {\r\n state.onWarning.call(null, generateError(state, message));\r\n }\r\n}\r\n\r\n\r\nvar directiveHandlers = {\r\n\r\n YAML: function handleYamlDirective(state, name, args) {\r\n\r\n var match, major, minor;\r\n\r\n if (state.version !== null) {\r\n throwError(state, 'duplication of %YAML directive');\r\n }\r\n\r\n if (args.length !== 1) {\r\n throwError(state, 'YAML directive accepts exactly one argument');\r\n }\r\n\r\n match = /^([0-9]+)\\.([0-9]+)$/.exec(args[0]);\r\n\r\n if (match === null) {\r\n throwError(state, 'ill-formed argument of the YAML directive');\r\n }\r\n\r\n major = parseInt(match[1], 10);\r\n minor = parseInt(match[2], 10);\r\n\r\n if (major !== 1) {\r\n throwError(state, 'unacceptable YAML version of the document');\r\n }\r\n\r\n state.version = args[0];\r\n state.checkLineBreaks = (minor < 2);\r\n\r\n if (minor !== 1 && minor !== 2) {\r\n throwWarning(state, 'unsupported YAML version of the document');\r\n }\r\n },\r\n\r\n TAG: function handleTagDirective(state, name, args) {\r\n\r\n var handle, prefix;\r\n\r\n if (args.length !== 2) {\r\n throwError(state, 'TAG directive accepts exactly two arguments');\r\n }\r\n\r\n handle = args[0];\r\n prefix = args[1];\r\n\r\n if (!PATTERN_TAG_HANDLE.test(handle)) {\r\n throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');\r\n }\r\n\r\n if (_hasOwnProperty$1.call(state.tagMap, handle)) {\r\n throwError(state, 'there is a previously declared suffix for \"' + handle + '\" tag handle');\r\n }\r\n\r\n if (!PATTERN_TAG_URI.test(prefix)) {\r\n throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');\r\n }\r\n\r\n try {\r\n prefix = decodeURIComponent(prefix);\r\n } catch (err) {\r\n throwError(state, 'tag prefix is malformed: ' + prefix);\r\n }\r\n\r\n state.tagMap[handle] = prefix;\r\n }\r\n};\r\n\r\n\r\nfunction captureSegment(state, start, end, checkJson) {\r\n var _position, _length, _character, _result;\r\n\r\n if (start < end) {\r\n _result = state.input.slice(start, end);\r\n\r\n if (checkJson) {\r\n for (_position = 0, _length = _result.length; _position < _length; _position += 1) {\r\n _character = _result.charCodeAt(_position);\r\n if (!(_character === 0x09 ||\r\n (0x20 <= _character && _character <= 0x10FFFF))) {\r\n throwError(state, 'expected valid JSON character');\r\n }\r\n }\r\n } else if (PATTERN_NON_PRINTABLE.test(_result)) {\r\n throwError(state, 'the stream contains non-printable characters');\r\n }\r\n\r\n state.result += _result;\r\n }\r\n}\r\n\r\nfunction mergeMappings(state, destination, source, overridableKeys) {\r\n var sourceKeys, key, index, quantity;\r\n\r\n if (!common.isObject(source)) {\r\n throwError(state, 'cannot merge mappings; the provided source object is unacceptable');\r\n }\r\n\r\n sourceKeys = Object.keys(source);\r\n\r\n for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {\r\n key = sourceKeys[index];\r\n\r\n if (!_hasOwnProperty$1.call(destination, key)) {\r\n destination[key] = source[key];\r\n overridableKeys[key] = true;\r\n }\r\n }\r\n}\r\n\r\nfunction storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode,\r\n startLine, startLineStart, startPos) {\r\n\r\n var index, quantity;\r\n\r\n // The output is a plain object here, so keys can only be strings.\r\n // We need to convert keyNode to a string, but doing so can hang the process\r\n // (deeply nested arrays that explode exponentially using aliases).\r\n if (Array.isArray(keyNode)) {\r\n keyNode = Array.prototype.slice.call(keyNode);\r\n\r\n for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {\r\n if (Array.isArray(keyNode[index])) {\r\n throwError(state, 'nested arrays are not supported inside keys');\r\n }\r\n\r\n if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {\r\n keyNode[index] = '[object Object]';\r\n }\r\n }\r\n }\r\n\r\n // Avoid code execution in load() via toString property\r\n // (still use its own toString for arrays, timestamps,\r\n // and whatever user schema extensions happen to have @@toStringTag)\r\n if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {\r\n keyNode = '[object Object]';\r\n }\r\n\r\n\r\n keyNode = String(keyNode);\r\n\r\n if (_result === null) {\r\n _result = {};\r\n }\r\n\r\n if (keyTag === 'tag:yaml.org,2002:merge') {\r\n if (Array.isArray(valueNode)) {\r\n for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {\r\n mergeMappings(state, _result, valueNode[index], overridableKeys);\r\n }\r\n } else {\r\n mergeMappings(state, _result, valueNode, overridableKeys);\r\n }\r\n } else {\r\n if (!state.json &&\r\n !_hasOwnProperty$1.call(overridableKeys, keyNode) &&\r\n _hasOwnProperty$1.call(_result, keyNode)) {\r\n state.line = startLine || state.line;\r\n state.lineStart = startLineStart || state.lineStart;\r\n state.position = startPos || state.position;\r\n throwError(state, 'duplicated mapping key');\r\n }\r\n\r\n // used for this specific key only because Object.defineProperty is slow\r\n if (keyNode === '__proto__') {\r\n Object.defineProperty(_result, keyNode, {\r\n configurable: true,\r\n enumerable: true,\r\n writable: true,\r\n value: valueNode\r\n });\r\n } else {\r\n _result[keyNode] = valueNode;\r\n }\r\n delete overridableKeys[keyNode];\r\n }\r\n\r\n return _result;\r\n}\r\n\r\nfunction readLineBreak(state) {\r\n var ch;\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n if (ch === 0x0A/* LF */) {\r\n state.position++;\r\n } else if (ch === 0x0D/* CR */) {\r\n state.position++;\r\n if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {\r\n state.position++;\r\n }\r\n } else {\r\n throwError(state, 'a line break is expected');\r\n }\r\n\r\n state.line += 1;\r\n state.lineStart = state.position;\r\n state.firstTabInLine = -1;\r\n}\r\n\r\nfunction skipSeparationSpace(state, allowComments, checkIndent) {\r\n var lineBreaks = 0,\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n while (ch !== 0) {\r\n while (is_WHITE_SPACE(ch)) {\r\n if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) {\r\n state.firstTabInLine = state.position;\r\n }\r\n ch = state.input.charCodeAt(++state.position);\r\n }\r\n\r\n if (allowComments && ch === 0x23/* # */) {\r\n do {\r\n ch = state.input.charCodeAt(++state.position);\r\n } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);\r\n }\r\n\r\n if (is_EOL(ch)) {\r\n readLineBreak(state);\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n lineBreaks++;\r\n state.lineIndent = 0;\r\n\r\n while (ch === 0x20/* Space */) {\r\n state.lineIndent++;\r\n ch = state.input.charCodeAt(++state.position);\r\n }\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {\r\n throwWarning(state, 'deficient indentation');\r\n }\r\n\r\n return lineBreaks;\r\n}\r\n\r\nfunction testDocumentSeparator(state) {\r\n var _position = state.position,\r\n ch;\r\n\r\n ch = state.input.charCodeAt(_position);\r\n\r\n // Condition state.position === state.lineStart is tested\r\n // in parent on each call, for efficiency. No needs to test here again.\r\n if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&\r\n ch === state.input.charCodeAt(_position + 1) &&\r\n ch === state.input.charCodeAt(_position + 2)) {\r\n\r\n _position += 3;\r\n\r\n ch = state.input.charCodeAt(_position);\r\n\r\n if (ch === 0 || is_WS_OR_EOL(ch)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\nfunction writeFoldedLines(state, count) {\r\n if (count === 1) {\r\n state.result += ' ';\r\n } else if (count > 1) {\r\n state.result += common.repeat('\\n', count - 1);\r\n }\r\n}\r\n\r\n\r\nfunction readPlainScalar(state, nodeIndent, withinFlowCollection) {\r\n var preceding,\r\n following,\r\n captureStart,\r\n captureEnd,\r\n hasPendingContent,\r\n _line,\r\n _lineStart,\r\n _lineIndent,\r\n _kind = state.kind,\r\n _result = state.result,\r\n ch;\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n if (is_WS_OR_EOL(ch) ||\r\n is_FLOW_INDICATOR(ch) ||\r\n ch === 0x23/* # */ ||\r\n ch === 0x26/* & */ ||\r\n ch === 0x2A/* * */ ||\r\n ch === 0x21/* ! */ ||\r\n ch === 0x7C/* | */ ||\r\n ch === 0x3E/* > */ ||\r\n ch === 0x27/* ' */ ||\r\n ch === 0x22/* \" */ ||\r\n ch === 0x25/* % */ ||\r\n ch === 0x40/* @ */ ||\r\n ch === 0x60/* ` */) {\r\n return false;\r\n }\r\n\r\n if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {\r\n following = state.input.charCodeAt(state.position + 1);\r\n\r\n if (is_WS_OR_EOL(following) ||\r\n withinFlowCollection && is_FLOW_INDICATOR(following)) {\r\n return false;\r\n }\r\n }\r\n\r\n state.kind = 'scalar';\r\n state.result = '';\r\n captureStart = captureEnd = state.position;\r\n hasPendingContent = false;\r\n\r\n while (ch !== 0) {\r\n if (ch === 0x3A/* : */) {\r\n following = state.input.charCodeAt(state.position + 1);\r\n\r\n if (is_WS_OR_EOL(following) ||\r\n withinFlowCollection && is_FLOW_INDICATOR(following)) {\r\n break;\r\n }\r\n\r\n } else if (ch === 0x23/* # */) {\r\n preceding = state.input.charCodeAt(state.position - 1);\r\n\r\n if (is_WS_OR_EOL(preceding)) {\r\n break;\r\n }\r\n\r\n } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||\r\n withinFlowCollection && is_FLOW_INDICATOR(ch)) {\r\n break;\r\n\r\n } else if (is_EOL(ch)) {\r\n _line = state.line;\r\n _lineStart = state.lineStart;\r\n _lineIndent = state.lineIndent;\r\n skipSeparationSpace(state, false, -1);\r\n\r\n if (state.lineIndent >= nodeIndent) {\r\n hasPendingContent = true;\r\n ch = state.input.charCodeAt(state.position);\r\n continue;\r\n } else {\r\n state.position = captureEnd;\r\n state.line = _line;\r\n state.lineStart = _lineStart;\r\n state.lineIndent = _lineIndent;\r\n break;\r\n }\r\n }\r\n\r\n if (hasPendingContent) {\r\n captureSegment(state, captureStart, captureEnd, false);\r\n writeFoldedLines(state, state.line - _line);\r\n captureStart = captureEnd = state.position;\r\n hasPendingContent = false;\r\n }\r\n\r\n if (!is_WHITE_SPACE(ch)) {\r\n captureEnd = state.position + 1;\r\n }\r\n\r\n ch = state.input.charCodeAt(++state.position);\r\n }\r\n\r\n captureSegment(state, captureStart, captureEnd, false);\r\n\r\n if (state.result) {\r\n return true;\r\n }\r\n\r\n state.kind = _kind;\r\n state.result = _result;\r\n return false;\r\n}\r\n\r\nfunction readSingleQuotedScalar(state, nodeIndent) {\r\n var ch,\r\n captureStart, captureEnd;\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n if (ch !== 0x27/* ' */) {\r\n return false;\r\n }\r\n\r\n state.kind = 'scalar';\r\n state.result = '';\r\n state.position++;\r\n captureStart = captureEnd = state.position;\r\n\r\n while ((ch = state.input.charCodeAt(state.position)) !== 0) {\r\n if (ch === 0x27/* ' */) {\r\n captureSegment(state, captureStart, state.position, true);\r\n ch = state.input.charCodeAt(++state.position);\r\n\r\n if (ch === 0x27/* ' */) {\r\n captureStart = state.position;\r\n state.position++;\r\n captureEnd = state.position;\r\n } else {\r\n return true;\r\n }\r\n\r\n } else if (is_EOL(ch)) {\r\n captureSegment(state, captureStart, captureEnd, true);\r\n writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));\r\n captureStart = captureEnd = state.position;\r\n\r\n } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\r\n throwError(state, 'unexpected end of the document within a single quoted scalar');\r\n\r\n } else {\r\n state.position++;\r\n captureEnd = state.position;\r\n }\r\n }\r\n\r\n throwError(state, 'unexpected end of the stream within a single quoted scalar');\r\n}\r\n\r\nfunction readDoubleQuotedScalar(state, nodeIndent) {\r\n var captureStart,\r\n captureEnd,\r\n hexLength,\r\n hexResult,\r\n tmp,\r\n ch;\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n if (ch !== 0x22/* \" */) {\r\n return false;\r\n }\r\n\r\n state.kind = 'scalar';\r\n state.result = '';\r\n state.position++;\r\n captureStart = captureEnd = state.position;\r\n\r\n while ((ch = state.input.charCodeAt(state.position)) !== 0) {\r\n if (ch === 0x22/* \" */) {\r\n captureSegment(state, captureStart, state.position, true);\r\n state.position++;\r\n return true;\r\n\r\n } else if (ch === 0x5C/* \\ */) {\r\n captureSegment(state, captureStart, state.position, true);\r\n ch = state.input.charCodeAt(++state.position);\r\n\r\n if (is_EOL(ch)) {\r\n skipSeparationSpace(state, false, nodeIndent);\r\n\r\n // TODO: rework to inline fn with no type cast?\r\n } else if (ch < 256 && simpleEscapeCheck[ch]) {\r\n state.result += simpleEscapeMap[ch];\r\n state.position++;\r\n\r\n } else if ((tmp = escapedHexLen(ch)) > 0) {\r\n hexLength = tmp;\r\n hexResult = 0;\r\n\r\n for (; hexLength > 0; hexLength--) {\r\n ch = state.input.charCodeAt(++state.position);\r\n\r\n if ((tmp = fromHexCode(ch)) >= 0) {\r\n hexResult = (hexResult << 4) + tmp;\r\n\r\n } else {\r\n throwError(state, 'expected hexadecimal character');\r\n }\r\n }\r\n\r\n state.result += charFromCodepoint(hexResult);\r\n\r\n state.position++;\r\n\r\n } else {\r\n throwError(state, 'unknown escape sequence');\r\n }\r\n\r\n captureStart = captureEnd = state.position;\r\n\r\n } else if (is_EOL(ch)) {\r\n captureSegment(state, captureStart, captureEnd, true);\r\n writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));\r\n captureStart = captureEnd = state.position;\r\n\r\n } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\r\n throwError(state, 'unexpected end of the document within a double quoted scalar');\r\n\r\n } else {\r\n state.position++;\r\n captureEnd = state.position;\r\n }\r\n }\r\n\r\n throwError(state, 'unexpected end of the stream within a double quoted scalar');\r\n}\r\n\r\nfunction readFlowCollection(state, nodeIndent) {\r\n var readNext = true,\r\n _line,\r\n _lineStart,\r\n _pos,\r\n _tag = state.tag,\r\n _result,\r\n _anchor = state.anchor,\r\n following,\r\n terminator,\r\n isPair,\r\n isExplicitPair,\r\n isMapping,\r\n overridableKeys = Object.create(null),\r\n keyNode,\r\n keyTag,\r\n valueNode,\r\n ch;\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n if (ch === 0x5B/* [ */) {\r\n terminator = 0x5D;/* ] */\r\n isMapping = false;\r\n _result = [];\r\n } else if (ch === 0x7B/* { */) {\r\n terminator = 0x7D;/* } */\r\n isMapping = true;\r\n _result = {};\r\n } else {\r\n return false;\r\n }\r\n\r\n if (state.anchor !== null) {\r\n state.anchorMap[state.anchor] = _result;\r\n }\r\n\r\n ch = state.input.charCodeAt(++state.position);\r\n\r\n while (ch !== 0) {\r\n skipSeparationSpace(state, true, nodeIndent);\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n if (ch === terminator) {\r\n state.position++;\r\n state.tag = _tag;\r\n state.anchor = _anchor;\r\n state.kind = isMapping ? 'mapping' : 'sequence';\r\n state.result = _result;\r\n return true;\r\n } else if (!readNext) {\r\n throwError(state, 'missed comma between flow collection entries');\r\n } else if (ch === 0x2C/* , */) {\r\n // \"flow collection entries can never be completely empty\", as per YAML 1.2, section 7.4\r\n throwError(state, \"expected the node content, but found ','\");\r\n }\r\n\r\n keyTag = keyNode = valueNode = null;\r\n isPair = isExplicitPair = false;\r\n\r\n if (ch === 0x3F/* ? */) {\r\n following = state.input.charCodeAt(state.position + 1);\r\n\r\n if (is_WS_OR_EOL(following)) {\r\n isPair = isExplicitPair = true;\r\n state.position++;\r\n skipSeparationSpace(state, true, nodeIndent);\r\n }\r\n }\r\n\r\n _line = state.line; // Save the current line.\r\n _lineStart = state.lineStart;\r\n _pos = state.position;\r\n composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);\r\n keyTag = state.tag;\r\n keyNode = state.result;\r\n skipSeparationSpace(state, true, nodeIndent);\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {\r\n isPair = true;\r\n ch = state.input.charCodeAt(++state.position);\r\n skipSeparationSpace(state, true, nodeIndent);\r\n composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);\r\n valueNode = state.result;\r\n }\r\n\r\n if (isMapping) {\r\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);\r\n } else if (isPair) {\r\n _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));\r\n } else {\r\n _result.push(keyNode);\r\n }\r\n\r\n skipSeparationSpace(state, true, nodeIndent);\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n if (ch === 0x2C/* , */) {\r\n readNext = true;\r\n ch = state.input.charCodeAt(++state.position);\r\n } else {\r\n readNext = false;\r\n }\r\n }\r\n\r\n throwError(state, 'unexpected end of the stream within a flow collection');\r\n}\r\n\r\nfunction readBlockScalar(state, nodeIndent) {\r\n var captureStart,\r\n folding,\r\n chomping = CHOMPING_CLIP,\r\n didReadContent = false,\r\n detectedIndent = false,\r\n textIndent = nodeIndent,\r\n emptyLines = 0,\r\n atMoreIndented = false,\r\n tmp,\r\n ch;\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n if (ch === 0x7C/* | */) {\r\n folding = false;\r\n } else if (ch === 0x3E/* > */) {\r\n folding = true;\r\n } else {\r\n return false;\r\n }\r\n\r\n state.kind = 'scalar';\r\n state.result = '';\r\n\r\n while (ch !== 0) {\r\n ch = state.input.charCodeAt(++state.position);\r\n\r\n if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {\r\n if (CHOMPING_CLIP === chomping) {\r\n chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;\r\n } else {\r\n throwError(state, 'repeat of a chomping mode identifier');\r\n }\r\n\r\n } else if ((tmp = fromDecimalCode(ch)) >= 0) {\r\n if (tmp === 0) {\r\n throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');\r\n } else if (!detectedIndent) {\r\n textIndent = nodeIndent + tmp - 1;\r\n detectedIndent = true;\r\n } else {\r\n throwError(state, 'repeat of an indentation width identifier');\r\n }\r\n\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n if (is_WHITE_SPACE(ch)) {\r\n do { ch = state.input.charCodeAt(++state.position); }\r\n while (is_WHITE_SPACE(ch));\r\n\r\n if (ch === 0x23/* # */) {\r\n do { ch = state.input.charCodeAt(++state.position); }\r\n while (!is_EOL(ch) && (ch !== 0));\r\n }\r\n }\r\n\r\n while (ch !== 0) {\r\n readLineBreak(state);\r\n state.lineIndent = 0;\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n while ((!detectedIndent || state.lineIndent < textIndent) &&\r\n (ch === 0x20/* Space */)) {\r\n state.lineIndent++;\r\n ch = state.input.charCodeAt(++state.position);\r\n }\r\n\r\n if (!detectedIndent && state.lineIndent > textIndent) {\r\n textIndent = state.lineIndent;\r\n }\r\n\r\n if (is_EOL(ch)) {\r\n emptyLines++;\r\n continue;\r\n }\r\n\r\n // End of the scalar.\r\n if (state.lineIndent < textIndent) {\r\n\r\n // Perform the chomping.\r\n if (chomping === CHOMPING_KEEP) {\r\n state.result += common.repeat('\\n', didReadContent ? 1 + emptyLines : emptyLines);\r\n } else if (chomping === CHOMPING_CLIP) {\r\n if (didReadContent) { // i.e. only if the scalar is not empty.\r\n state.result += '\\n';\r\n }\r\n }\r\n\r\n // Break this `while` cycle and go to the funciton's epilogue.\r\n break;\r\n }\r\n\r\n // Folded style: use fancy rules to handle line breaks.\r\n if (folding) {\r\n\r\n // Lines starting with white space characters (more-indented lines) are not folded.\r\n if (is_WHITE_SPACE(ch)) {\r\n atMoreIndented = true;\r\n // except for the first content line (cf. Example 8.1)\r\n state.result += common.repeat('\\n', didReadContent ? 1 + emptyLines : emptyLines);\r\n\r\n // End of more-indented block.\r\n } else if (atMoreIndented) {\r\n atMoreIndented = false;\r\n state.result += common.repeat('\\n', emptyLines + 1);\r\n\r\n // Just one line break - perceive as the same line.\r\n } else if (emptyLines === 0) {\r\n if (didReadContent) { // i.e. only if we have already read some scalar content.\r\n state.result += ' ';\r\n }\r\n\r\n // Several line breaks - perceive as different lines.\r\n } else {\r\n state.result += common.repeat('\\n', emptyLines);\r\n }\r\n\r\n // Literal style: just add exact number of line breaks between content lines.\r\n } else {\r\n // Keep all line breaks except the header line break.\r\n state.result += common.repeat('\\n', didReadContent ? 1 + emptyLines : emptyLines);\r\n }\r\n\r\n didReadContent = true;\r\n detectedIndent = true;\r\n emptyLines = 0;\r\n captureStart = state.position;\r\n\r\n while (!is_EOL(ch) && (ch !== 0)) {\r\n ch = state.input.charCodeAt(++state.position);\r\n }\r\n\r\n captureSegment(state, captureStart, state.position, false);\r\n }\r\n\r\n return true;\r\n}\r\n\r\nfunction readBlockSequence(state, nodeIndent) {\r\n var _line,\r\n _tag = state.tag,\r\n _anchor = state.anchor,\r\n _result = [],\r\n following,\r\n detected = false,\r\n ch;\r\n\r\n // there is a leading tab before this token, so it can't be a block sequence/mapping;\r\n // it can still be flow sequence/mapping or a scalar\r\n if (state.firstTabInLine !== -1) return false;\r\n\r\n if (state.anchor !== null) {\r\n state.anchorMap[state.anchor] = _result;\r\n }\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n while (ch !== 0) {\r\n if (state.firstTabInLine !== -1) {\r\n state.position = state.firstTabInLine;\r\n throwError(state, 'tab characters must not be used in indentation');\r\n }\r\n\r\n if (ch !== 0x2D/* - */) {\r\n break;\r\n }\r\n\r\n following = state.input.charCodeAt(state.position + 1);\r\n\r\n if (!is_WS_OR_EOL(following)) {\r\n break;\r\n }\r\n\r\n detected = true;\r\n state.position++;\r\n\r\n if (skipSeparationSpace(state, true, -1)) {\r\n if (state.lineIndent <= nodeIndent) {\r\n _result.push(null);\r\n ch = state.input.charCodeAt(state.position);\r\n continue;\r\n }\r\n }\r\n\r\n _line = state.line;\r\n composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);\r\n _result.push(state.result);\r\n skipSeparationSpace(state, true, -1);\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {\r\n throwError(state, 'bad indentation of a sequence entry');\r\n } else if (state.lineIndent < nodeIndent) {\r\n break;\r\n }\r\n }\r\n\r\n if (detected) {\r\n state.tag = _tag;\r\n state.anchor = _anchor;\r\n state.kind = 'sequence';\r\n state.result = _result;\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\nfunction readBlockMapping(state, nodeIndent, flowIndent) {\r\n var following,\r\n allowCompact,\r\n _line,\r\n _keyLine,\r\n _keyLineStart,\r\n _keyPos,\r\n _tag = state.tag,\r\n _anchor = state.anchor,\r\n _result = {},\r\n overridableKeys = Object.create(null),\r\n keyTag = null,\r\n keyNode = null,\r\n valueNode = null,\r\n atExplicitKey = false,\r\n detected = false,\r\n ch;\r\n\r\n // there is a leading tab before this token, so it can't be a block sequence/mapping;\r\n // it can still be flow sequence/mapping or a scalar\r\n if (state.firstTabInLine !== -1) return false;\r\n\r\n if (state.anchor !== null) {\r\n state.anchorMap[state.anchor] = _result;\r\n }\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n while (ch !== 0) {\r\n if (!atExplicitKey && state.firstTabInLine !== -1) {\r\n state.position = state.firstTabInLine;\r\n throwError(state, 'tab characters must not be used in indentation');\r\n }\r\n\r\n following = state.input.charCodeAt(state.position + 1);\r\n _line = state.line; // Save the current line.\r\n\r\n //\r\n // Explicit notation case. There are two separate blocks:\r\n // first for the key (denoted by \"?\") and second for the value (denoted by \":\")\r\n //\r\n if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {\r\n\r\n if (ch === 0x3F/* ? */) {\r\n if (atExplicitKey) {\r\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);\r\n keyTag = keyNode = valueNode = null;\r\n }\r\n\r\n detected = true;\r\n atExplicitKey = true;\r\n allowCompact = true;\r\n\r\n } else if (atExplicitKey) {\r\n // i.e. 0x3A/* : */ === character after the explicit key.\r\n atExplicitKey = false;\r\n allowCompact = true;\r\n\r\n } else {\r\n throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');\r\n }\r\n\r\n state.position += 1;\r\n ch = following;\r\n\r\n //\r\n // Implicit notation case. Flow-style node as the key first, then \":\", and the value.\r\n //\r\n } else {\r\n _keyLine = state.line;\r\n _keyLineStart = state.lineStart;\r\n _keyPos = state.position;\r\n\r\n if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {\r\n // Neither implicit nor explicit notation.\r\n // Reading is done. Go to the epilogue.\r\n break;\r\n }\r\n\r\n if (state.line === _line) {\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n while (is_WHITE_SPACE(ch)) {\r\n ch = state.input.charCodeAt(++state.position);\r\n }\r\n\r\n if (ch === 0x3A/* : */) {\r\n ch = state.input.charCodeAt(++state.position);\r\n\r\n if (!is_WS_OR_EOL(ch)) {\r\n throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');\r\n }\r\n\r\n if (atExplicitKey) {\r\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);\r\n keyTag = keyNode = valueNode = null;\r\n }\r\n\r\n detected = true;\r\n atExplicitKey = false;\r\n allowCompact = false;\r\n keyTag = state.tag;\r\n keyNode = state.result;\r\n\r\n } else if (detected) {\r\n throwError(state, 'can not read an implicit mapping pair; a colon is missed');\r\n\r\n } else {\r\n state.tag = _tag;\r\n state.anchor = _anchor;\r\n return true; // Keep the result of `composeNode`.\r\n }\r\n\r\n } else if (detected) {\r\n throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');\r\n\r\n } else {\r\n state.tag = _tag;\r\n state.anchor = _anchor;\r\n return true; // Keep the result of `composeNode`.\r\n }\r\n }\r\n\r\n //\r\n // Common reading code for both explicit and implicit notations.\r\n //\r\n if (state.line === _line || state.lineIndent > nodeIndent) {\r\n if (atExplicitKey) {\r\n _keyLine = state.line;\r\n _keyLineStart = state.lineStart;\r\n _keyPos = state.position;\r\n }\r\n\r\n if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {\r\n if (atExplicitKey) {\r\n keyNode = state.result;\r\n } else {\r\n valueNode = state.result;\r\n }\r\n }\r\n\r\n if (!atExplicitKey) {\r\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);\r\n keyTag = keyNode = valueNode = null;\r\n }\r\n\r\n skipSeparationSpace(state, true, -1);\r\n ch = state.input.charCodeAt(state.position);\r\n }\r\n\r\n if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {\r\n throwError(state, 'bad indentation of a mapping entry');\r\n } else if (state.lineIndent < nodeIndent) {\r\n break;\r\n }\r\n }\r\n\r\n //\r\n // Epilogue.\r\n //\r\n\r\n // Special case: last mapping's node contains only the key in explicit notation.\r\n if (atExplicitKey) {\r\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);\r\n }\r\n\r\n // Expose the resulting mapping.\r\n if (detected) {\r\n state.tag = _tag;\r\n state.anchor = _anchor;\r\n state.kind = 'mapping';\r\n state.result = _result;\r\n }\r\n\r\n return detected;\r\n}\r\n\r\nfunction readTagProperty(state) {\r\n var _position,\r\n isVerbatim = false,\r\n isNamed = false,\r\n tagHandle,\r\n tagName,\r\n ch;\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n if (ch !== 0x21/* ! */) return false;\r\n\r\n if (state.tag !== null) {\r\n throwError(state, 'duplication of a tag property');\r\n }\r\n\r\n ch = state.input.charCodeAt(++state.position);\r\n\r\n if (ch === 0x3C/* < */) {\r\n isVerbatim = true;\r\n ch = state.input.charCodeAt(++state.position);\r\n\r\n } else if (ch === 0x21/* ! */) {\r\n isNamed = true;\r\n tagHandle = '!!';\r\n ch = state.input.charCodeAt(++state.position);\r\n\r\n } else {\r\n tagHandle = '!';\r\n }\r\n\r\n _position = state.position;\r\n\r\n if (isVerbatim) {\r\n do { ch = state.input.charCodeAt(++state.position); }\r\n while (ch !== 0 && ch !== 0x3E/* > */);\r\n\r\n if (state.position < state.length) {\r\n tagName = state.input.slice(_position, state.position);\r\n ch = state.input.charCodeAt(++state.position);\r\n } else {\r\n throwError(state, 'unexpected end of the stream within a verbatim tag');\r\n }\r\n } else {\r\n while (ch !== 0 && !is_WS_OR_EOL(ch)) {\r\n\r\n if (ch === 0x21/* ! */) {\r\n if (!isNamed) {\r\n tagHandle = state.input.slice(_position - 1, state.position + 1);\r\n\r\n if (!PATTERN_TAG_HANDLE.test(tagHandle)) {\r\n throwError(state, 'named tag handle cannot contain such characters');\r\n }\r\n\r\n isNamed = true;\r\n _position = state.position + 1;\r\n } else {\r\n throwError(state, 'tag suffix cannot contain exclamation marks');\r\n }\r\n }\r\n\r\n ch = state.input.charCodeAt(++state.position);\r\n }\r\n\r\n tagName = state.input.slice(_position, state.position);\r\n\r\n if (PATTERN_FLOW_INDICATORS.test(tagName)) {\r\n throwError(state, 'tag suffix cannot contain flow indicator characters');\r\n }\r\n }\r\n\r\n if (tagName && !PATTERN_TAG_URI.test(tagName)) {\r\n throwError(state, 'tag name cannot contain such characters: ' + tagName);\r\n }\r\n\r\n try {\r\n tagName = decodeURIComponent(tagName);\r\n } catch (err) {\r\n throwError(state, 'tag name is malformed: ' + tagName);\r\n }\r\n\r\n if (isVerbatim) {\r\n state.tag = tagName;\r\n\r\n } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {\r\n state.tag = state.tagMap[tagHandle] + tagName;\r\n\r\n } else if (tagHandle === '!') {\r\n state.tag = '!' + tagName;\r\n\r\n } else if (tagHandle === '!!') {\r\n state.tag = 'tag:yaml.org,2002:' + tagName;\r\n\r\n } else {\r\n throwError(state, 'undeclared tag handle \"' + tagHandle + '\"');\r\n }\r\n\r\n return true;\r\n}\r\n\r\nfunction readAnchorProperty(state) {\r\n var _position,\r\n ch;\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n if (ch !== 0x26/* & */) return false;\r\n\r\n if (state.anchor !== null) {\r\n throwError(state, 'duplication of an anchor property');\r\n }\r\n\r\n ch = state.input.charCodeAt(++state.position);\r\n _position = state.position;\r\n\r\n while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {\r\n ch = state.input.charCodeAt(++state.position);\r\n }\r\n\r\n if (state.position === _position) {\r\n throwError(state, 'name of an anchor node must contain at least one character');\r\n }\r\n\r\n state.anchor = state.input.slice(_position, state.position);\r\n return true;\r\n}\r\n\r\nfunction readAlias(state) {\r\n var _position, alias,\r\n ch;\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n if (ch !== 0x2A/* * */) return false;\r\n\r\n ch = state.input.charCodeAt(++state.position);\r\n _position = state.position;\r\n\r\n while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {\r\n ch = state.input.charCodeAt(++state.position);\r\n }\r\n\r\n if (state.position === _position) {\r\n throwError(state, 'name of an alias node must contain at least one character');\r\n }\r\n\r\n alias = state.input.slice(_position, state.position);\r\n\r\n if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {\r\n throwError(state, 'unidentified alias \"' + alias + '\"');\r\n }\r\n\r\n state.result = state.anchorMap[alias];\r\n skipSeparationSpace(state, true, -1);\r\n return true;\r\n}\r\n\r\nfunction composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {\r\n var allowBlockStyles,\r\n allowBlockScalars,\r\n allowBlockCollections,\r\n indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent\r\n atNewLine = false,\r\n hasContent = false,\r\n typeIndex,\r\n typeQuantity,\r\n typeList,\r\n type,\r\n flowIndent,\r\n blockIndent;\r\n\r\n if (state.listener !== null) {\r\n state.listener('open', state);\r\n }\r\n\r\n state.tag = null;\r\n state.anchor = null;\r\n state.kind = null;\r\n state.result = null;\r\n\r\n allowBlockStyles = allowBlockScalars = allowBlockCollections =\r\n CONTEXT_BLOCK_OUT === nodeContext ||\r\n CONTEXT_BLOCK_IN === nodeContext;\r\n\r\n if (allowToSeek) {\r\n if (skipSeparationSpace(state, true, -1)) {\r\n atNewLine = true;\r\n\r\n if (state.lineIndent > parentIndent) {\r\n indentStatus = 1;\r\n } else if (state.lineIndent === parentIndent) {\r\n indentStatus = 0;\r\n } else if (state.lineIndent < parentIndent) {\r\n indentStatus = -1;\r\n }\r\n }\r\n }\r\n\r\n if (indentStatus === 1) {\r\n while (readTagProperty(state) || readAnchorProperty(state)) {\r\n if (skipSeparationSpace(state, true, -1)) {\r\n atNewLine = true;\r\n allowBlockCollections = allowBlockStyles;\r\n\r\n if (state.lineIndent > parentIndent) {\r\n indentStatus = 1;\r\n } else if (state.lineIndent === parentIndent) {\r\n indentStatus = 0;\r\n } else if (state.lineIndent < parentIndent) {\r\n indentStatus = -1;\r\n }\r\n } else {\r\n allowBlockCollections = false;\r\n }\r\n }\r\n }\r\n\r\n if (allowBlockCollections) {\r\n allowBlockCollections = atNewLine || allowCompact;\r\n }\r\n\r\n if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {\r\n if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {\r\n flowIndent = parentIndent;\r\n } else {\r\n flowIndent = parentIndent + 1;\r\n }\r\n\r\n blockIndent = state.position - state.lineStart;\r\n\r\n if (indentStatus === 1) {\r\n if (allowBlockCollections &&\r\n (readBlockSequence(state, blockIndent) ||\r\n readBlockMapping(state, blockIndent, flowIndent)) ||\r\n readFlowCollection(state, flowIndent)) {\r\n hasContent = true;\r\n } else {\r\n if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||\r\n readSingleQuotedScalar(state, flowIndent) ||\r\n readDoubleQuotedScalar(state, flowIndent)) {\r\n hasContent = true;\r\n\r\n } else if (readAlias(state)) {\r\n hasContent = true;\r\n\r\n if (state.tag !== null || state.anchor !== null) {\r\n throwError(state, 'alias node should not have any properties');\r\n }\r\n\r\n } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {\r\n hasContent = true;\r\n\r\n if (state.tag === null) {\r\n state.tag = '?';\r\n }\r\n }\r\n\r\n if (state.anchor !== null) {\r\n state.anchorMap[state.anchor] = state.result;\r\n }\r\n }\r\n } else if (indentStatus === 0) {\r\n // Special case: block sequences are allowed to have same indentation level as the parent.\r\n // http://www.yaml.org/spec/1.2/spec.html#id2799784\r\n hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);\r\n }\r\n }\r\n\r\n if (state.tag === null) {\r\n if (state.anchor !== null) {\r\n state.anchorMap[state.anchor] = state.result;\r\n }\r\n\r\n } else if (state.tag === '?') {\r\n // Implicit resolving is not allowed for non-scalar types, and '?'\r\n // non-specific tag is only automatically assigned to plain scalars.\r\n //\r\n // We only need to check kind conformity in case user explicitly assigns '?'\r\n // tag, for example like this: \"!<?> [0]\"\r\n //\r\n if (state.result !== null && state.kind !== 'scalar') {\r\n throwError(state, 'unacceptable node kind for !<?> tag; it should be \"scalar\", not \"' + state.kind + '\"');\r\n }\r\n\r\n for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {\r\n type = state.implicitTypes[typeIndex];\r\n\r\n if (type.resolve(state.result)) { // `state.result` updated in resolver if matched\r\n state.result = type.construct(state.result);\r\n state.tag = type.tag;\r\n if (state.anchor !== null) {\r\n state.anchorMap[state.anchor] = state.result;\r\n }\r\n break;\r\n }\r\n }\r\n } else if (state.tag !== '!') {\r\n if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) {\r\n type = state.typeMap[state.kind || 'fallback'][state.tag];\r\n } else {\r\n // looking for multi type\r\n type = null;\r\n typeList = state.typeMap.multi[state.kind || 'fallback'];\r\n\r\n for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {\r\n if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {\r\n type = typeList[typeIndex];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (!type) {\r\n throwError(state, 'unknown tag !<' + state.tag + '>');\r\n }\r\n\r\n if (state.result !== null && type.kind !== state.kind) {\r\n throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be \"' + type.kind + '\", not \"' + state.kind + '\"');\r\n }\r\n\r\n if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched\r\n throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');\r\n } else {\r\n state.result = type.construct(state.result, state.tag);\r\n if (state.anchor !== null) {\r\n state.anchorMap[state.anchor] = state.result;\r\n }\r\n }\r\n }\r\n\r\n if (state.listener !== null) {\r\n state.listener('close', state);\r\n }\r\n return state.tag !== null || state.anchor !== null || hasContent;\r\n}\r\n\r\nfunction readDocument(state) {\r\n var documentStart = state.position,\r\n _position,\r\n directiveName,\r\n directiveArgs,\r\n hasDirectives = false,\r\n ch;\r\n\r\n state.version = null;\r\n state.checkLineBreaks = state.legacy;\r\n state.tagMap = Object.create(null);\r\n state.anchorMap = Object.create(null);\r\n\r\n while ((ch = state.input.charCodeAt(state.position)) !== 0) {\r\n skipSeparationSpace(state, true, -1);\r\n\r\n ch = state.input.charCodeAt(state.position);\r\n\r\n if (state.lineIndent > 0 || ch !== 0x25/* % */) {\r\n break;\r\n }\r\n\r\n hasDirectives = true;\r\n ch = state.input.charCodeAt(++state.position);\r\n _position = state.position;\r\n\r\n while (ch !== 0 && !is_WS_OR_EOL(ch)) {\r\n ch = state.input.charCodeAt(++state.position);\r\n }\r\n\r\n directiveName = state.input.slice(_position, state.position);\r\n directiveArgs = [];\r\n\r\n if (directiveName.length < 1) {\r\n throwError(state, 'directive name must not be less than one character in length');\r\n }\r\n\r\n while (ch !== 0) {\r\n while (is_WHITE_SPACE(ch)) {\r\n ch = state.input.charCodeAt(++state.position);\r\n }\r\n\r\n if (ch === 0x23/* # */) {\r\n do { ch = state.input.charCodeAt(++state.position); }\r\n while (ch !== 0 && !is_EOL(ch));\r\n break;\r\n }\r\n\r\n if (is_EOL(ch)) break;\r\n\r\n _position = state.position;\r\n\r\n while (ch !== 0 && !is_WS_OR_EOL(ch)) {\r\n ch = state.input.charCodeAt(++state.position);\r\n }\r\n\r\n directiveArgs.push(state.input.slice(_position, state.position));\r\n }\r\n\r\n if (ch !== 0) readLineBreak(state);\r\n\r\n if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {\r\n directiveHandlers[directiveName](state, directiveName, directiveArgs);\r\n } else {\r\n throwWarning(state, 'unknown document directive \"' + directiveName + '\"');\r\n }\r\n }\r\n\r\n skipSeparationSpace(state, true, -1);\r\n\r\n if (state.lineIndent === 0 &&\r\n state.input.charCodeAt(state.position) === 0x2D/* - */ &&\r\n state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&\r\n state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {\r\n state.position += 3;\r\n skipSeparationSpace(state, true, -1);\r\n\r\n } else if (hasDirectives) {\r\n throwError(state, 'directives end mark is expected');\r\n }\r\n\r\n composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);\r\n skipSeparationSpace(state, true, -1);\r\n\r\n if (state.checkLineBreaks &&\r\n PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {\r\n throwWarning(state, 'non-ASCII line breaks are interpreted as content');\r\n }\r\n\r\n state.documents.push(state.result);\r\n\r\n if (state.position === state.lineStart && testDocumentSeparator(state)) {\r\n\r\n if (state.input.charCodeAt(state.position) === 0x2E/* . */) {\r\n state.position += 3;\r\n skipSeparationSpace(state, true, -1);\r\n }\r\n return;\r\n }\r\n\r\n if (state.position < (state.length - 1)) {\r\n throwError(state, 'end of the stream or a document separator is expected');\r\n } else {\r\n return;\r\n }\r\n}\r\n\r\n\r\nfunction loadDocuments(input, options) {\r\n input = String(input);\r\n options = options || {};\r\n\r\n if (input.length !== 0) {\r\n\r\n // Add tailing `\\n` if not exists\r\n if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&\r\n input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {\r\n input += '\\n';\r\n }\r\n\r\n // Strip BOM\r\n if (input.charCodeAt(0) === 0xFEFF) {\r\n input = input.slice(1);\r\n }\r\n }\r\n\r\n var state = new State$1(input, options);\r\n\r\n var nullpos = input.indexOf('\\0');\r\n\r\n if (nullpos !== -1) {\r\n state.position = nullpos;\r\n throwError(state, 'null byte is not allowed in input');\r\n }\r\n\r\n // Use 0 as string terminator. That significantly simplifies bounds check.\r\n state.input += '\\0';\r\n\r\n while (state.input.charCodeAt(state.position) === 0x20/* Space */) {\r\n state.lineIndent += 1;\r\n state.position += 1;\r\n }\r\n\r\n while (state.position < (state.length - 1)) {\r\n readDocument(state);\r\n }\r\n\r\n return state.documents;\r\n}\r\n\r\n\r\nfunction loadAll$1(input, iterator, options) {\r\n if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {\r\n options = iterator;\r\n iterator = null;\r\n }\r\n\r\n var documents = loadDocuments(input, options);\r\n\r\n if (typeof iterator !== 'function') {\r\n return documents;\r\n }\r\n\r\n for (var index = 0, length = documents.length; index < length; index += 1) {\r\n iterator(documents[index]);\r\n }\r\n}\r\n\r\n\r\nfunction load$1(input, options) {\r\n var documents = loadDocuments(input, options);\r\n\r\n if (documents.length === 0) {\r\n /*eslint-disable no-undefined*/\r\n return undefined;\r\n } else if (documents.length === 1) {\r\n return documents[0];\r\n }\r\n throw new exception('expected a single document in the stream, but found more');\r\n}\r\n\r\n\r\nvar loadAll_1 = loadAll$1;\r\nvar load_1 = load$1;\r\n\r\nvar loader = {\r\n\tloadAll: loadAll_1,\r\n\tload: load_1\r\n};\r\n\r\n/*eslint-disable no-use-before-define*/\r\n\r\n\r\n\r\n\r\n\r\nvar _toString = Object.prototype.toString;\r\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\r\n\r\nvar CHAR_BOM = 0xFEFF;\r\nvar CHAR_TAB = 0x09; /* Tab */\r\nvar CHAR_LINE_FEED = 0x0A; /* LF */\r\nvar CHAR_CARRIAGE_RETURN = 0x0D; /* CR */\r\nvar CHAR_SPACE = 0x20; /* Space */\r\nvar CHAR_EXCLAMATION = 0x21; /* ! */\r\nvar CHAR_DOUBLE_QUOTE = 0x22; /* \" */\r\nvar CHAR_SHARP = 0x23; /* # */\r\nvar CHAR_PERCENT = 0x25; /* % */\r\nvar CHAR_AMPERSAND = 0x26; /* & */\r\nvar CHAR_SINGLE_QUOTE = 0x27; /* ' */\r\nvar CHAR_ASTERISK = 0x2A; /* * */\r\nvar CHAR_COMMA = 0x2C; /* , */\r\nvar CHAR_MINUS = 0x2D; /* - */\r\nvar CHAR_COLON = 0x3A; /* : */\r\nvar CHAR_EQUALS = 0x3D; /* = */\r\nvar CHAR_GREATER_THAN = 0x3E; /* > */\r\nvar CHAR_QUESTION = 0x3F; /* ? */\r\nvar CHAR_COMMERCIAL_AT = 0x40; /* @ */\r\nvar CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */\r\nvar CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */\r\nvar CHAR_GRAVE_ACCENT = 0x60; /* ` */\r\nvar CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */\r\nvar CHAR_VERTICAL_LINE = 0x7C; /* | */\r\nvar CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */\r\n\r\nvar ESCAPE_SEQUENCES = {};\r\n\r\nESCAPE_SEQUENCES[0x00] = '\\\\0';\r\nESCAPE_SEQUENCES[0x07] = '\\\\a';\r\nESCAPE_SEQUENCES[0x08] = '\\\\b';\r\nESCAPE_SEQUENCES[0x09] = '\\\\t';\r\nESCAPE_SEQUENCES[0x0A] = '\\\\n';\r\nESCAPE_SEQUENCES[0x0B] = '\\\\v';\r\nESCAPE_SEQUENCES[0x0C] = '\\\\f';\r\nESCAPE_SEQUENCES[0x0D] = '\\\\r';\r\nESCAPE_SEQUENCES[0x1B] = '\\\\e';\r\nESCAPE_SEQUENCES[0x22] = '\\\\\"';\r\nESCAPE_SEQUENCES[0x5C] = '\\\\\\\\';\r\nESCAPE_SEQUENCES[0x85] = '\\\\N';\r\nESCAPE_SEQUENCES[0xA0] = '\\\\_';\r\nESCAPE_SEQUENCES[0x2028] = '\\\\L';\r\nESCAPE_SEQUENCES[0x2029] = '\\\\P';\r\n\r\nvar DEPRECATED_BOOLEANS_SYNTAX = [\r\n 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',\r\n 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'\r\n];\r\n\r\nvar DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\\.[0-9_]*)?$/;\r\n\r\nfunction compileStyleMap(schema, map) {\r\n var result, keys, index, length, tag, style, type;\r\n\r\n if (map === null) return {};\r\n\r\n result = {};\r\n keys = Object.keys(map);\r\n\r\n for (index = 0, length = keys.length; index < length; index += 1) {\r\n tag = keys[index];\r\n style = String(map[tag]);\r\n\r\n if (tag.slice(0, 2) === '!!') {\r\n tag = 'tag:yaml.org,2002:' + tag.slice(2);\r\n }\r\n type = schema.compiledTypeMap['fallback'][tag];\r\n\r\n if (type && _hasOwnProperty.call(type.styleAliases, style)) {\r\n style = type.styleAliases[style];\r\n }\r\n\r\n result[tag] = style;\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction encodeHex(character) {\r\n var string, handle, length;\r\n\r\n string = character.toString(16).toUpperCase();\r\n\r\n if (character <= 0xFF) {\r\n handle = 'x';\r\n length = 2;\r\n } else if (character <= 0xFFFF) {\r\n handle = 'u';\r\n length = 4;\r\n } else if (character <= 0xFFFFFFFF) {\r\n handle = 'U';\r\n length = 8;\r\n } else {\r\n throw new exception('code point within a string may not be greater than 0xFFFFFFFF');\r\n }\r\n\r\n return '\\\\' + handle + common.repeat('0', length - string.length) + string;\r\n}\r\n\r\n\r\nvar QUOTING_TYPE_SINGLE = 1,\r\n QUOTING_TYPE_DOUBLE = 2;\r\n\r\nfunction State(options) {\r\n this.schema = options['schema'] || _default;\r\n this.indent = Math.max(1, (options['indent'] || 2));\r\n this.noArrayIndent = options['noArrayIndent'] || false;\r\n this.skipInvalid = options['skipInvalid'] || false;\r\n this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);\r\n this.styleMap = compileStyleMap(this.schema, options['styles'] || null);\r\n this.sortKeys = options['sortKeys'] || false;\r\n this.lineWidth = options['lineWidth'] || 80;\r\n this.noRefs = options['noRefs'] || false;\r\n this.noCompatMode = options['noCompatMode'] || false;\r\n this.condenseFlow = options['condenseFlow'] || false;\r\n this.quotingType = options['quotingType'] === '\"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;\r\n this.forceQuotes = options['forceQuotes'] || false;\r\n this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null;\r\n\r\n this.implicitTypes = this.schema.compiledImplicit;\r\n this.explicitTypes = this.schema.compiledExplicit;\r\n\r\n this.tag = null;\r\n this.result = '';\r\n\r\n this.duplicates = [];\r\n this.usedDuplicates = null;\r\n}\r\n\r\n// Indents every line in a string. Empty lines (\\n only) are not indented.\r\nfunction indentString(string, spaces) {\r\n var ind = common.repeat(' ', spaces),\r\n position = 0,\r\n next = -1,\r\n result = '',\r\n line,\r\n length = string.length;\r\n\r\n while (position < length) {\r\n next = string.indexOf('\\n', position);\r\n if (next === -1) {\r\n line = string.slice(position);\r\n position = length;\r\n } else {\r\n line = string.slice(position, next + 1);\r\n position = next + 1;\r\n }\r\n\r\n if (line.length && line !== '\\n') result += ind;\r\n\r\n result += line;\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction generateNextLine(state, level) {\r\n return '\\n' + common.repeat(' ', state.indent * level);\r\n}\r\n\r\nfunction testImplicitResolving(state, str) {\r\n var index, length, type;\r\n\r\n for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {\r\n type = state.implicitTypes[index];\r\n\r\n if (type.resolve(str)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\n// [33] s-white ::= s-space | s-tab\r\nfunction isWhitespace(c) {\r\n return c === CHAR_SPACE || c === CHAR_TAB;\r\n}\r\n\r\n// Returns true if the character can be printed without escaping.\r\n// From YAML 1.2: \"any allowed characters known to be non-printable\r\n// should also be escaped. [However,] This isn\u2019t mandatory\"\r\n// Derived from nb-char - \\t - #x85 - #xA0 - #x2028 - #x2029.\r\nfunction isPrintable(c) {\r\n return (0x00020 <= c && c <= 0x00007E)\r\n || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)\r\n || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM)\r\n || (0x10000 <= c && c <= 0x10FFFF);\r\n}\r\n\r\n// [34] ns-char ::= nb-char - s-white\r\n// [27] nb-char ::= c-printable - b-char - c-byte-order-mark\r\n// [26] b-char ::= b-line-feed | b-carriage-return\r\n// Including s-white (for some reason, examples doesn't match specs in this aspect)\r\n// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark\r\nfunction isNsCharOrWhitespace(c) {\r\n return isPrintable(c)\r\n && c !== CHAR_BOM\r\n // - b-char\r\n && c !== CHAR_CARRIAGE_RETURN\r\n && c !== CHAR_LINE_FEED;\r\n}\r\n\r\n// [127] ns-plain-safe(c) ::= c = flow-out \u21D2 ns-plain-safe-out\r\n// c = flow-in \u21D2 ns-plain-safe-in\r\n// c = block-key \u21D2 ns-plain-safe-out\r\n// c = flow-key \u21D2 ns-plain-safe-in\r\n// [128] ns-plain-safe-out ::= ns-char\r\n// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator\r\n// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - \u201C:\u201D - \u201C#\u201D )\r\n// | ( /* An ns-char preceding */ \u201C#\u201D )\r\n// | ( \u201C:\u201D /* Followed by an ns-plain-safe(c) */ )\r\nfunction isPlainSafe(c, prev, inblock) {\r\n var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);\r\n var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);\r\n return (\r\n // ns-plain-safe\r\n inblock ? // c = flow-in\r\n cIsNsCharOrWhitespace\r\n : cIsNsCharOrWhitespace\r\n // - c-flow-indicator\r\n && c !== CHAR_COMMA\r\n && c !== CHAR_LEFT_SQUARE_BRACKET\r\n && c !== CHAR_RIGHT_SQUARE_BRACKET\r\n && c !== CHAR_LEFT_CURLY_BRACKET\r\n && c !== CHAR_RIGHT_CURLY_BRACKET\r\n )\r\n // ns-plain-char\r\n && c !== CHAR_SHARP // false on '#'\r\n && !(prev === CHAR_COLON && !cIsNsChar) // false on ': '\r\n || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#'\r\n || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]'\r\n}\r\n\r\n// Simplified test for values allowed as the first character in plain style.\r\nfunction isPlainSafeFirst(c) {\r\n // Uses a subset of ns-char - c-indicator\r\n // where ns-char = nb-char - s-white.\r\n // No support of ( ( \u201C?\u201D | \u201C:\u201D | \u201C-\u201D ) /* Followed by an ns-plain-safe(c)) */ ) part\r\n return isPrintable(c) && c !== CHAR_BOM\r\n && !isWhitespace(c) // - s-white\r\n // - (c-indicator ::=\r\n // \u201C-\u201D | \u201C?\u201D | \u201C:\u201D | \u201C,\u201D | \u201C[\u201D | \u201C]\u201D | \u201C{\u201D | \u201C}\u201D\r\n && c !== CHAR_MINUS\r\n && c !== CHAR_QUESTION\r\n && c !== CHAR_COLON\r\n && c !== CHAR_COMMA\r\n && c !== CHAR_LEFT_SQUARE_BRACKET\r\n && c !== CHAR_RIGHT_SQUARE_BRACKET\r\n && c !== CHAR_LEFT_CURLY_BRACKET\r\n && c !== CHAR_RIGHT_CURLY_BRACKET\r\n // | \u201C#\u201D | \u201C&\u201D | \u201C*\u201D | \u201C!\u201D | \u201C|\u201D | \u201C=\u201D | \u201C>\u201D | \u201C'\u201D | \u201C\"\u201D\r\n && c !== CHAR_SHARP\r\n && c !== CHAR_AMPERSAND\r\n && c !== CHAR_ASTERISK\r\n && c !== CHAR_EXCLAMATION\r\n && c !== CHAR_VERTICAL_LINE\r\n && c !== CHAR_EQUALS\r\n && c !== CHAR_GREATER_THAN\r\n && c !== CHAR_SINGLE_QUOTE\r\n && c !== CHAR_DOUBLE_QUOTE\r\n // | \u201C%\u201D | \u201C@\u201D | \u201C`\u201D)\r\n && c !== CHAR_PERCENT\r\n && c !== CHAR_COMMERCIAL_AT\r\n && c !== CHAR_GRAVE_ACCENT;\r\n}\r\n\r\n// Simplified test for values allowed as the last character in plain style.\r\nfunction isPlainSafeLast(c) {\r\n // just not whitespace or colon, it will be checked to be plain character later\r\n return !isWhitespace(c) && c !== CHAR_COLON;\r\n}\r\n\r\n// Same as 'string'.codePointAt(pos), but works in older browsers.\r\nfunction codePointAt(string, pos) {\r\n var first = string.charCodeAt(pos), second;\r\n if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) {\r\n second = string.charCodeAt(pos + 1);\r\n if (second >= 0xDC00 && second <= 0xDFFF) {\r\n // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\r\n return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\r\n }\r\n }\r\n return first;\r\n}\r\n\r\n// Determines whether block indentation indicator is required.\r\nfunction needIndentIndicator(string) {\r\n var leadingSpaceRe = /^\\n* /;\r\n return leadingSpaceRe.test(string);\r\n}\r\n\r\nvar STYLE_PLAIN = 1,\r\n STYLE_SINGLE = 2,\r\n STYLE_LITERAL = 3,\r\n STYLE_FOLDED = 4,\r\n STYLE_DOUBLE = 5;\r\n\r\n// Determines which scalar styles are possible and returns the preferred style.\r\n// lineWidth = -1 => no limit.\r\n// Pre-conditions: str.length > 0.\r\n// Post-conditions:\r\n// STYLE_PLAIN or STYLE_SINGLE => no \\n are in the string.\r\n// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).\r\n// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).\r\nfunction chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth,\r\n testAmbiguousType, quotingType, forceQuotes, inblock) {\r\n\r\n var i;\r\n var char = 0;\r\n var prevChar = null;\r\n var hasLineBreak = false;\r\n var hasFoldableLine = false; // only checked if shouldTrackWidth\r\n var shouldTrackWidth = lineWidth !== -1;\r\n var previousLineBreak = -1; // count the first line correctly\r\n var plain = isPlainSafeFirst(codePointAt(string, 0))\r\n && isPlainSafeLast(codePointAt(string, string.length - 1));\r\n\r\n if (singleLineOnly || forceQuotes) {\r\n // Case: no block styles.\r\n // Check for disallowed characters to rule out plain and single.\r\n for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {\r\n char = codePointAt(string, i);\r\n if (!isPrintable(char)) {\r\n return STYLE_DOUBLE;\r\n }\r\n plain = plain && isPlainSafe(char, prevChar, inblock);\r\n prevChar = char;\r\n }\r\n } else {\r\n // Case: block styles permitted.\r\n for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {\r\n char = codePointAt(string, i);\r\n if (char === CHAR_LINE_FEED) {\r\n hasLineBreak = true;\r\n // Check if any line can be folded.\r\n if (shouldTrackWidth) {\r\n hasFoldableLine = hasFoldableLine ||\r\n // Foldable line = too long, and not more-indented.\r\n (i - previousLineBreak - 1 > lineWidth &&\r\n string[previousLineBreak + 1] !== ' ');\r\n previousLineBreak = i;\r\n }\r\n } else if (!isPrintable(char)) {\r\n return STYLE_DOUBLE;\r\n }\r\n plain = plain && isPlainSafe(char, prevChar, inblock);\r\n prevChar = char;\r\n }\r\n // in case the end is missing a \\n\r\n hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&\r\n (i - previousLineBreak - 1 > lineWidth &&\r\n string[previousLineBreak + 1] !== ' '));\r\n }\r\n // Although every style can represent \\n without escaping, prefer block styles\r\n // for multiline, since they're more readable and they don't add empty lines.\r\n // Also prefer folding a super-long line.\r\n if (!hasLineBreak && !hasFoldableLine) {\r\n // Strings interpretable as another type have to be quoted;\r\n // e.g. the string 'true' vs. the boolean true.\r\n if (plain && !forceQuotes && !testAmbiguousType(string)) {\r\n return STYLE_PLAIN;\r\n }\r\n return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;\r\n }\r\n // Edge case: block indentation indicator can only have one digit.\r\n if (indentPerLevel > 9 && needIndentIndicator(string)) {\r\n return STYLE_DOUBLE;\r\n }\r\n // At this point we know block styles are valid.\r\n // Prefer literal style unless we want to fold.\r\n if (!forceQuotes) {\r\n return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;\r\n }\r\n return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;\r\n}\r\n\r\n// Note: line breaking/folding is implemented for only the folded style.\r\n// NB. We drop the last trailing newline (if any) of a returned block scalar\r\n// since the dumper adds its own newline. This always works:\r\n// \u2022 No ending newline => unaffected; already using strip \"-\" chomping.\r\n// \u2022 Ending newline => removed then restored.\r\n// Importantly, this keeps the \"+\" chomp indicator from gaining an extra line.\r\nfunction writeScalar(state, string, level, iskey, inblock) {\r\n state.dump = (function () {\r\n if (string.length === 0) {\r\n return state.quotingType === QUOTING_TYPE_DOUBLE ? '\"\"' : \"''\";\r\n }\r\n if (!state.noCompatMode) {\r\n if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {\r\n return state.quotingType === QUOTING_TYPE_DOUBLE ? ('\"' + string + '\"') : (\"'\" + string + \"'\");\r\n }\r\n }\r\n\r\n var indent = state.indent * Math.max(1, level); // no 0-indent scalars\r\n // As indentation gets deeper, let the width decrease monotonically\r\n // to the lower bound min(state.lineWidth, 40).\r\n // Note that this implies\r\n // state.lineWidth \u2264 40 + state.indent: width is fixed at the lower bound.\r\n // state.lineWidth > 40 + state.indent: width decreases until the lower bound.\r\n // This behaves better than a constant minimum width which disallows narrower options,\r\n // or an indent threshold which causes the width to suddenly increase.\r\n var lineWidth = state.lineWidth === -1\r\n ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);\r\n\r\n // Without knowing if keys are implicit/explicit, assume implicit for safety.\r\n var singleLineOnly = iskey\r\n // No block styles in flow mode.\r\n || (state.flowLevel > -1 && level >= state.flowLevel);\r\n function testAmbiguity(string) {\r\n return testImplicitResolving(state, string);\r\n }\r\n\r\n switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth,\r\n testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {\r\n\r\n case STYLE_PLAIN:\r\n return string;\r\n case STYLE_SINGLE:\r\n return \"'\" + string.replace(/'/g, \"''\") + \"'\";\r\n case STYLE_LITERAL:\r\n return '|' + blockHeader(string, state.indent)\r\n + dropEndingNewline(indentString(string, indent));\r\n case STYLE_FOLDED:\r\n return '>' + blockHeader(string, state.indent)\r\n + dropEndingNewline(indentString(foldString(string, lineWidth), indent));\r\n case STYLE_DOUBLE:\r\n return '\"' + escapeString(string) + '\"';\r\n default:\r\n throw new exception('impossible error: invalid scalar style');\r\n }\r\n }());\r\n}\r\n\r\n// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.\r\nfunction blockHeader(string, indentPerLevel) {\r\n var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';\r\n\r\n // note the special case: the string '\\n' counts as a \"trailing\" empty line.\r\n var clip = string[string.length - 1] === '\\n';\r\n var keep = clip && (string[string.length - 2] === '\\n' || string === '\\n');\r\n var chomp = keep ? '+' : (clip ? '' : '-');\r\n\r\n return indentIndicator + chomp + '\\n';\r\n}\r\n\r\n// (See the note for writeScalar.)\r\nfunction dropEndingNewline(string) {\r\n return string[string.length - 1] === '\\n' ? string.slice(0, -1) : string;\r\n}\r\n\r\n// Note: a long line without a suitable break point will exceed the width limit.\r\n// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.\r\nfunction foldString(string, width) {\r\n // In folded style, $k$ consecutive newlines output as $k+1$ newlines\u2014\r\n // unless they're before or after a more-indented line, or at the very\r\n // beginning or end, in which case $k$ maps to $k$.\r\n // Therefore, parse each chunk as newline(s) followed by a content line.\r\n var lineRe = /(\\n+)([^\\n]*)/g;\r\n\r\n // first line (possibly an empty line)\r\n var result = (function () {\r\n var nextLF = string.indexOf('\\n');\r\n nextLF = nextLF !== -1 ? nextLF : string.length;\r\n lineRe.lastIndex = nextLF;\r\n return foldLine(string.slice(0, nextLF), width);\r\n }());\r\n // If we haven't reached the first content line yet, don't add an extra \\n.\r\n var prevMoreIndented = string[0] === '\\n' || string[0] === ' ';\r\n var moreIndented;\r\n\r\n // rest of the lines\r\n var match;\r\n while ((match = lineRe.exec(string))) {\r\n var prefix = match[1], line = match[2];\r\n moreIndented = (line[0] === ' ');\r\n result += prefix\r\n + (!prevMoreIndented && !moreIndented && line !== ''\r\n ? '\\n' : '')\r\n + foldLine(line, width);\r\n prevMoreIndented = moreIndented;\r\n }\r\n\r\n return result;\r\n}\r\n\r\n// Greedy line breaking.\r\n// Picks the longest line under the limit each time,\r\n// otherwise settles for the shortest line over the limit.\r\n// NB. More-indented lines *cannot* be folded, as that would add an extra \\n.\r\nfunction foldLine(line, width) {\r\n if (line === '' || line[0] === ' ') return line;\r\n\r\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\r\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\r\n var match;\r\n // start is an inclusive index. end, curr, and next are exclusive.\r\n var start = 0, end, curr = 0, next = 0;\r\n var result = '';\r\n\r\n // Invariants: 0 <= start <= length-1.\r\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\r\n // Inside the loop:\r\n // A match implies length >= 2, so curr and next are <= length-2.\r\n while ((match = breakRe.exec(line))) {\r\n next = match.index;\r\n // maintain invariant: curr - start <= width\r\n if (next - start > width) {\r\n end = (curr > start) ? curr : next; // derive end <= length-2\r\n result += '\\n' + line.slice(start, end);\r\n // skip the space that was output as \\n\r\n start = end + 1; // derive start <= length-1\r\n }\r\n curr = next;\r\n }\r\n\r\n // By the invariants, start <= length-1, so there is something left over.\r\n // It is either the whole string or a part starting from non-whitespace.\r\n result += '\\n';\r\n // Insert a break if the remainder is too long and there is a break available.\r\n if (line.length - start > width && curr > start) {\r\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\r\n } else {\r\n result += line.slice(start);\r\n }\r\n\r\n return result.slice(1); // drop extra \\n joiner\r\n}\r\n\r\n// Escapes a double-quoted string.\r\nfunction escapeString(string) {\r\n var result = '';\r\n var char = 0;\r\n var escapeSeq;\r\n\r\n for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {\r\n char = codePointAt(string, i);\r\n escapeSeq = ESCAPE_SEQUENCES[char];\r\n\r\n if (!escapeSeq && isPrintable(char)) {\r\n result += string[i];\r\n if (char >= 0x10000) result += string[i + 1];\r\n } else {\r\n result += escapeSeq || encodeHex(char);\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction writeFlowSequence(state, level, object) {\r\n var _result = '',\r\n _tag = state.tag,\r\n index,\r\n length,\r\n value;\r\n\r\n for (index = 0, length = object.length; index < length; index += 1) {\r\n value = object[index];\r\n\r\n if (state.replacer) {\r\n value = state.replacer.call(object, String(index), value);\r\n }\r\n\r\n // Write only valid elements, put null instead of invalid elements.\r\n if (writeNode(state, level, value, false, false) ||\r\n (typeof value === 'undefined' &&\r\n writeNode(state, level, null, false, false))) {\r\n\r\n if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : '');\r\n _result += state.dump;\r\n }\r\n }\r\n\r\n state.tag = _tag;\r\n state.dump = '[' + _result + ']';\r\n}\r\n\r\nfunction writeBlockSequence(state, level, object, compact) {\r\n var _result = '',\r\n _tag = state.tag,\r\n index,\r\n length,\r\n value;\r\n\r\n for (index = 0, length = object.length; index < length; index += 1) {\r\n value = object[index];\r\n\r\n if (state.replacer) {\r\n value = state.replacer.call(object, String(index), value);\r\n }\r\n\r\n // Write only valid elements, put null instead of invalid elements.\r\n if (writeNode(state, level + 1, value, true, true, false, true) ||\r\n (typeof value === 'undefined' &&\r\n writeNode(state, level + 1, null, true, true, false, true))) {\r\n\r\n if (!compact || _result !== '') {\r\n _result += generateNextLine(state, level);\r\n }\r\n\r\n if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {\r\n _result += '-';\r\n } else {\r\n _result += '- ';\r\n }\r\n\r\n _result += state.dump;\r\n }\r\n }\r\n\r\n state.tag = _tag;\r\n state.dump = _result || '[]'; // Empty sequence if no valid values.\r\n}\r\n\r\nfunction writeFlowMapping(state, level, object) {\r\n var _result = '',\r\n _tag = state.tag,\r\n objectKeyList = Object.keys(object),\r\n index,\r\n length,\r\n objectKey,\r\n objectValue,\r\n pairBuffer;\r\n\r\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\r\n\r\n pairBuffer = '';\r\n if (_result !== '') pairBuffer += ', ';\r\n\r\n if (state.condenseFlow) pairBuffer += '\"';\r\n\r\n objectKey = objectKeyList[index];\r\n objectValue = object[objectKey];\r\n\r\n if (state.replacer) {\r\n objectValue = state.replacer.call(object, objectKey, objectValue);\r\n }\r\n\r\n if (!writeNode(state, level, objectKey, false, false)) {\r\n continue; // Skip this pair because of invalid key;\r\n }\r\n\r\n if (state.dump.length > 1024) pairBuffer += '? ';\r\n\r\n pairBuffer += state.dump + (state.condenseFlow ? '\"' : '') + ':' + (state.condenseFlow ? '' : ' ');\r\n\r\n if (!writeNode(state, level, objectValue, false, false)) {\r\n continue; // Skip this pair because of invalid value.\r\n }\r\n\r\n pairBuffer += state.dump;\r\n\r\n // Both key and value are valid.\r\n _result += pairBuffer;\r\n }\r\n\r\n state.tag = _tag;\r\n state.dump = '{' + _result + '}';\r\n}\r\n\r\nfunction writeBlockMapping(state, level, object, compact) {\r\n var _result = '',\r\n _tag = state.tag,\r\n objectKeyList = Object.keys(object),\r\n index,\r\n length,\r\n objectKey,\r\n objectValue,\r\n explicitPair,\r\n pairBuffer;\r\n\r\n // Allow sorting keys so that the output file is deterministic\r\n if (state.sortKeys === true) {\r\n // Default sorting\r\n objectKeyList.sort();\r\n } else if (typeof state.sortKeys === 'function') {\r\n // Custom sort function\r\n objectKeyList.sort(state.sortKeys);\r\n } else if (state.sortKeys) {\r\n // Something is wrong\r\n throw new exception('sortKeys must be a boolean or a function');\r\n }\r\n\r\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\r\n pairBuffer = '';\r\n\r\n if (!compact || _result !== '') {\r\n pairBuffer += generateNextLine(state, level);\r\n }\r\n\r\n objectKey = objectKeyList[index];\r\n objectValue = object[objectKey];\r\n\r\n if (state.replacer) {\r\n objectValue = state.replacer.call(object, objectKey, objectValue);\r\n }\r\n\r\n if (!writeNode(state, level + 1, objectKey, true, true, true)) {\r\n continue; // Skip this pair because of invalid key.\r\n }\r\n\r\n explicitPair = (state.tag !== null && state.tag !== '?') ||\r\n (state.dump && state.dump.length > 1024);\r\n\r\n if (explicitPair) {\r\n if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {\r\n pairBuffer += '?';\r\n } else {\r\n pairBuffer += '? ';\r\n }\r\n }\r\n\r\n pairBuffer += state.dump;\r\n\r\n if (explicitPair) {\r\n pairBuffer += generateNextLine(state, level);\r\n }\r\n\r\n if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {\r\n continue; // Skip this pair because of invalid value.\r\n }\r\n\r\n if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {\r\n pairBuffer += ':';\r\n } else {\r\n pairBuffer += ': ';\r\n }\r\n\r\n pairBuffer += state.dump;\r\n\r\n // Both key and value are valid.\r\n _result += pairBuffer;\r\n }\r\n\r\n state.tag = _tag;\r\n state.dump = _result || '{}'; // Empty mapping if no valid pairs.\r\n}\r\n\r\nfunction detectType(state, object, explicit) {\r\n var _result, typeList, index, length, type, style;\r\n\r\n typeList = explicit ? state.explicitTypes : state.implicitTypes;\r\n\r\n for (index = 0, length = typeList.length; index < length; index += 1) {\r\n type = typeList[index];\r\n\r\n if ((type.instanceOf || type.predicate) &&\r\n (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&\r\n (!type.predicate || type.predicate(object))) {\r\n\r\n if (explicit) {\r\n if (type.multi && type.representName) {\r\n state.tag = type.representName(object);\r\n } else {\r\n state.tag = type.tag;\r\n }\r\n } else {\r\n state.tag = '?';\r\n }\r\n\r\n if (type.represent) {\r\n style = state.styleMap[type.tag] || type.defaultStyle;\r\n\r\n if (_toString.call(type.represent) === '[object Function]') {\r\n _result = type.represent(object, style);\r\n } else if (_hasOwnProperty.call(type.represent, style)) {\r\n _result = type.represent[style](object, style);\r\n } else {\r\n throw new exception('!<' + type.tag + '> tag resolver accepts not \"' + style + '\" style');\r\n }\r\n\r\n state.dump = _result;\r\n }\r\n\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\n// Serializes `object` and writes it to global `result`.\r\n// Returns true on success, or false on invalid object.\r\n//\r\nfunction writeNode(state, level, object, block, compact, iskey, isblockseq) {\r\n state.tag = null;\r\n state.dump = object;\r\n\r\n if (!detectType(state, object, false)) {\r\n detectType(state, object, true);\r\n }\r\n\r\n var type = _toString.call(state.dump);\r\n var inblock = block;\r\n var tagStr;\r\n\r\n if (block) {\r\n block = (state.flowLevel < 0 || state.flowLevel > level);\r\n }\r\n\r\n var objectOrArray = type === '[object Object]' || type === '[object Array]',\r\n duplicateIndex,\r\n duplicate;\r\n\r\n if (objectOrArray) {\r\n duplicateIndex = state.duplicates.indexOf(object);\r\n duplicate = duplicateIndex !== -1;\r\n }\r\n\r\n if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {\r\n compact = false;\r\n }\r\n\r\n if (duplicate && state.usedDuplicates[duplicateIndex]) {\r\n state.dump = '*ref_' + duplicateIndex;\r\n } else {\r\n if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {\r\n state.usedDuplicates[duplicateIndex] = true;\r\n }\r\n if (type === '[object Object]') {\r\n if (block && (Object.keys(state.dump).length !== 0)) {\r\n writeBlockMapping(state, level, state.dump, compact);\r\n if (duplicate) {\r\n state.dump = '&ref_' + duplicateIndex + state.dump;\r\n }\r\n } else {\r\n writeFlowMapping(state, level, state.dump);\r\n if (duplicate) {\r\n state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;\r\n }\r\n }\r\n } else if (type === '[object Array]') {\r\n if (block && (state.dump.length !== 0)) {\r\n if (state.noArrayIndent && !isblockseq && level > 0) {\r\n writeBlockSequence(state, level - 1, state.dump, compact);\r\n } else {\r\n writeBlockSequence(state, level, state.dump, compact);\r\n }\r\n if (duplicate) {\r\n state.dump = '&ref_' + duplicateIndex + state.dump;\r\n }\r\n } else {\r\n writeFlowSequence(state, level, state.dump);\r\n if (duplicate) {\r\n state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;\r\n }\r\n }\r\n } else if (type === '[object String]') {\r\n if (state.tag !== '?') {\r\n writeScalar(state, state.dump, level, iskey, inblock);\r\n }\r\n } else if (type === '[object Undefined]') {\r\n return false;\r\n } else {\r\n if (state.skipInvalid) return false;\r\n throw new exception('unacceptable kind of an object to dump ' + type);\r\n }\r\n\r\n if (state.tag !== null && state.tag !== '?') {\r\n // Need to encode all characters except those allowed by the spec:\r\n //\r\n // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */\r\n // [36] ns-hex-digit ::= ns-dec-digit\r\n // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */\r\n // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */\r\n // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | \u201C-\u201D\r\n // [39] ns-uri-char ::= \u201C%\u201D ns-hex-digit ns-hex-digit | ns-word-char | \u201C#\u201D\r\n // | \u201C;\u201D | \u201C/\u201D | \u201C?\u201D | \u201C:\u201D | \u201C@\u201D | \u201C&\u201D | \u201C=\u201D | \u201C+\u201D | \u201C$\u201D | \u201C,\u201D\r\n // | \u201C_\u201D | \u201C.\u201D | \u201C!\u201D | \u201C~\u201D | \u201C*\u201D | \u201C'\u201D | \u201C(\u201D | \u201C)\u201D | \u201C[\u201D | \u201C]\u201D\r\n //\r\n // Also need to encode '!' because it has special meaning (end of tag prefix).\r\n //\r\n tagStr = encodeURI(\r\n state.tag[0] === '!' ? state.tag.slice(1) : state.tag\r\n ).replace(/!/g, '%21');\r\n\r\n if (state.tag[0] === '!') {\r\n tagStr = '!' + tagStr;\r\n } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') {\r\n tagStr = '!!' + tagStr.slice(18);\r\n } else {\r\n tagStr = '!<' + tagStr + '>';\r\n }\r\n\r\n state.dump = tagStr + ' ' + state.dump;\r\n }\r\n }\r\n\r\n return true;\r\n}\r\n\r\nfunction getDuplicateReferences(object, state) {\r\n var objects = [],\r\n duplicatesIndexes = [],\r\n index,\r\n length;\r\n\r\n inspectNode(object, objects, duplicatesIndexes);\r\n\r\n for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {\r\n state.duplicates.push(objects[duplicatesIndexes[index]]);\r\n }\r\n state.usedDuplicates = new Array(length);\r\n}\r\n\r\nfunction inspectNode(object, objects, duplicatesIndexes) {\r\n var objectKeyList,\r\n index,\r\n length;\r\n\r\n if (object !== null && typeof object === 'object') {\r\n index = objects.indexOf(object);\r\n if (index !== -1) {\r\n if (duplicatesIndexes.indexOf(index) === -1) {\r\n duplicatesIndexes.push(index);\r\n }\r\n } else {\r\n objects.push(object);\r\n\r\n if (Array.isArray(object)) {\r\n for (index = 0, length = object.length; index < length; index += 1) {\r\n inspectNode(object[index], objects, duplicatesIndexes);\r\n }\r\n } else {\r\n objectKeyList = Object.keys(object);\r\n\r\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\r\n inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction dump$1(input, options) {\r\n options = options || {};\r\n\r\n var state = new State(options);\r\n\r\n if (!state.noRefs) getDuplicateReferences(input, state);\r\n\r\n var value = input;\r\n\r\n if (state.replacer) {\r\n value = state.replacer.call({ '': value }, '', value);\r\n }\r\n\r\n if (writeNode(state, 0, value, true, true)) return state.dump + '\\n';\r\n\r\n return '';\r\n}\r\n\r\nvar dump_1 = dump$1;\r\n\r\nvar dumper = {\r\n\tdump: dump_1\r\n};\r\n\r\nfunction renamed(from, to) {\r\n return function () {\r\n throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' +\r\n 'Use yaml.' + to + ' instead, which is now safe by default.');\r\n };\r\n}\r\n\r\n\r\nvar Type = type;\r\nvar Schema = schema;\r\nvar FAILSAFE_SCHEMA = failsafe;\r\nvar JSON_SCHEMA = json;\r\nvar CORE_SCHEMA = core;\r\nvar DEFAULT_SCHEMA = _default;\r\nvar load = loader.load;\r\nvar loadAll = loader.loadAll;\r\nvar dump = dumper.dump;\r\nvar YAMLException = exception;\r\n\r\n// Re-export all types in case user wants to create custom schema\r\nvar types = {\r\n binary: binary,\r\n float: float,\r\n map: map,\r\n null: _null,\r\n pairs: pairs,\r\n set: set,\r\n timestamp: timestamp,\r\n bool: bool,\r\n int: int,\r\n merge: merge,\r\n omap: omap,\r\n seq: seq,\r\n str: str\r\n};\r\n\r\n// Removed functions from JS-YAML 3.0.x\r\nvar safeLoad = renamed('safeLoad', 'load');\r\nvar safeLoadAll = renamed('safeLoadAll', 'loadAll');\r\nvar safeDump = renamed('safeDump', 'dump');\r\n\r\nvar jsYaml = {\r\n\tType: Type,\r\n\tSchema: Schema,\r\n\tFAILSAFE_SCHEMA: FAILSAFE_SCHEMA,\r\n\tJSON_SCHEMA: JSON_SCHEMA,\r\n\tCORE_SCHEMA: CORE_SCHEMA,\r\n\tDEFAULT_SCHEMA: DEFAULT_SCHEMA,\r\n\tload: load,\r\n\tloadAll: loadAll,\r\n\tdump: dump,\r\n\tYAMLException: YAMLException,\r\n\ttypes: types,\r\n\tsafeLoad: safeLoad,\r\n\tsafeLoadAll: safeLoadAll,\r\n\tsafeDump: safeDump\r\n};\r\n\r\nexport default jsYaml;\r\nexport { CORE_SCHEMA, DEFAULT_SCHEMA, FAILSAFE_SCHEMA, JSON_SCHEMA, Schema, Type, YAMLException, dump, load, loadAll, safeDump, safeLoad, safeLoadAll, types };\r\n", "const consoleLogger = {\n type: 'logger',\n\n log(args) {\n this.output('log', args);\n },\n\n warn(args) {\n this.output('warn', args);\n },\n\n error(args) {\n this.output('error', args);\n },\n\n output(type, args) {\n /* eslint no-console: 0 */\n if (console && console[type]) console[type].apply(console, args);\n },\n};\n\nclass Logger {\n constructor(concreteLogger, options = {}) {\n this.init(concreteLogger, options);\n }\n\n init(concreteLogger, options = {}) {\n this.prefix = options.prefix || 'i18next:';\n this.logger = concreteLogger || consoleLogger;\n this.options = options;\n this.debug = options.debug;\n }\n\n log(...args) {\n return this.forward(args, 'log', '', true);\n }\n\n warn(...args) {\n return this.forward(args, 'warn', '', true);\n }\n\n error(...args) {\n return this.forward(args, 'error', '');\n }\n\n deprecate(...args) {\n return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);\n }\n\n forward(args, lvl, prefix, debugOnly) {\n if (debugOnly && !this.debug) return null;\n if (typeof args[0] === 'string') args[0] = `${prefix}${this.prefix} ${args[0]}`;\n return this.logger[lvl](args);\n }\n\n create(moduleName) {\n return new Logger(this.logger, {\n ...{ prefix: `${this.prefix}:${moduleName}:` },\n ...this.options,\n });\n }\n\n clone(options) {\n options = options || this.options;\n options.prefix = options.prefix || this.prefix;\n return new Logger(this.logger, options);\n }\n}\n\nexport default new Logger();\n", "class EventEmitter {\n constructor() {\n // This is an Object containing Maps:\n //\n // { [event: string]: Map<listener: function, numTimesAdded: number> }\n //\n // We use a Map for O(1) insertion/deletion and because it can have functions as keys.\n //\n // We keep track of numTimesAdded (the number of times it was added) because if you attach the same listener twice,\n // we should actually call it twice for each emitted event.\n this.observers = {};\n }\n\n on(events, listener) {\n events.split(' ').forEach((event) => {\n if (!this.observers[event]) this.observers[event] = new Map();\n const numListeners = this.observers[event].get(listener) || 0;\n this.observers[event].set(listener, numListeners + 1);\n });\n return this;\n }\n\n off(event, listener) {\n if (!this.observers[event]) return;\n if (!listener) {\n delete this.observers[event];\n return;\n }\n\n this.observers[event].delete(listener);\n }\n\n emit(event, ...args) {\n if (this.observers[event]) {\n const cloned = Array.from(this.observers[event].entries());\n cloned.forEach(([observer, numTimesAdded]) => {\n for (let i = 0; i < numTimesAdded; i++) {\n observer(...args);\n }\n });\n }\n\n if (this.observers['*']) {\n const cloned = Array.from(this.observers['*'].entries());\n cloned.forEach(([observer, numTimesAdded]) => {\n for (let i = 0; i < numTimesAdded; i++) {\n observer.apply(observer, [event, ...args]);\n }\n });\n }\n }\n}\n\nexport default EventEmitter;\n", "// http://lea.verou.me/2016/12/resolve-promises-externally-with-this-one-weird-trick/\nexport function defer() {\n let res;\n let rej;\n\n const promise = new Promise((resolve, reject) => {\n res = resolve;\n rej = reject;\n });\n\n promise.resolve = res;\n promise.reject = rej;\n\n return promise;\n}\n\nexport function makeString(object) {\n if (object == null) return '';\n /* eslint prefer-template: 0 */\n return '' + object;\n}\n\nexport function copy(a, s, t) {\n a.forEach((m) => {\n if (s[m]) t[m] = s[m];\n });\n}\n\n// We extract out the RegExp definition to improve performance with React Native Android, which has poor RegExp\n// initialization performance\nconst lastOfPathSeparatorRegExp = /###/g;\n\nfunction getLastOfPath(object, path, Empty) {\n function cleanKey(key) {\n return key && key.indexOf('###') > -1 ? key.replace(lastOfPathSeparatorRegExp, '.') : key;\n }\n\n function canNotTraverseDeeper() {\n return !object || typeof object === 'string';\n }\n\n const stack = typeof path !== 'string' ? path : path.split('.');\n let stackIndex = 0;\n // iterate through the stack, but leave the last item\n while (stackIndex < stack.length - 1) {\n if (canNotTraverseDeeper()) return {};\n\n const key = cleanKey(stack[stackIndex]);\n if (!object[key] && Empty) object[key] = new Empty();\n // prevent prototype pollution\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n object = object[key];\n } else {\n object = {};\n }\n ++stackIndex;\n }\n\n if (canNotTraverseDeeper()) return {};\n return {\n obj: object,\n k: cleanKey(stack[stackIndex]),\n };\n}\n\nexport function setPath(object, path, newValue) {\n const { obj, k } = getLastOfPath(object, path, Object);\n if (obj !== undefined || path.length === 1) {\n obj[k] = newValue;\n return;\n }\n\n let e = path[path.length - 1];\n let p = path.slice(0, path.length - 1);\n let last = getLastOfPath(object, p, Object);\n while (last.obj === undefined && p.length) {\n e = `${p[p.length - 1]}.${e}`;\n p = p.slice(0, p.length - 1);\n last = getLastOfPath(object, p, Object);\n if (last && last.obj && typeof last.obj[`${last.k}.${e}`] !== 'undefined') {\n last.obj = undefined;\n }\n }\n last.obj[`${last.k}.${e}`] = newValue;\n}\n\nexport function pushPath(object, path, newValue, concat) {\n const { obj, k } = getLastOfPath(object, path, Object);\n\n obj[k] = obj[k] || [];\n if (concat) obj[k] = obj[k].concat(newValue);\n if (!concat) obj[k].push(newValue);\n}\n\nexport function getPath(object, path) {\n const { obj, k } = getLastOfPath(object, path);\n\n if (!obj) return undefined;\n return obj[k];\n}\n\nexport function getPathWithDefaults(data, defaultData, key) {\n const value = getPath(data, key);\n if (value !== undefined) {\n return value;\n }\n // Fallback to default values\n return getPath(defaultData, key);\n}\n\nexport function deepExtend(target, source, overwrite) {\n /* eslint no-restricted-syntax: 0 */\n for (const prop in source) {\n if (prop !== '__proto__' && prop !== 'constructor') {\n if (prop in target) {\n // If we reached a leaf string in target or source then replace with source or skip depending on the 'overwrite' switch\n if (\n typeof target[prop] === 'string' ||\n target[prop] instanceof String ||\n typeof source[prop] === 'string' ||\n source[prop] instanceof String\n ) {\n if (overwrite) target[prop] = source[prop];\n } else {\n deepExtend(target[prop], source[prop], overwrite);\n }\n } else {\n target[prop] = source[prop];\n }\n }\n }\n return target;\n}\n\nexport function regexEscape(str) {\n /* eslint no-useless-escape: 0 */\n return str.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, '\\\\$&');\n}\n\n/* eslint-disable */\nvar _entityMap = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n '/': '/',\n};\n/* eslint-enable */\n\nexport function escape(data) {\n if (typeof data === 'string') {\n return data.replace(/[&<>\"'\\/]/g, (s) => _entityMap[s]);\n }\n\n return data;\n}\n\n/**\n * This is a reusable regular expression cache class. Given a certain maximum number of regular expressions we're\n * allowed to store in the cache, it provides a way to avoid recreating regular expression objects over and over.\n * When it needs to evict something, it evicts the oldest one.\n */\nclass RegExpCache {\n constructor(capacity) {\n this.capacity = capacity;\n this.regExpMap = new Map();\n // Since our capacity tends to be fairly small, `.shift()` will be fairly quick despite being O(n). We just use a\n // normal array to keep it simple.\n this.regExpQueue = [];\n }\n\n getRegExp(pattern) {\n const regExpFromCache = this.regExpMap.get(pattern);\n if (regExpFromCache !== undefined) {\n return regExpFromCache;\n }\n const regExpNew = new RegExp(pattern);\n if (this.regExpQueue.length === this.capacity) {\n this.regExpMap.delete(this.regExpQueue.shift());\n }\n this.regExpMap.set(pattern, regExpNew);\n this.regExpQueue.push(pattern);\n return regExpNew;\n }\n}\n\nconst chars = [' ', ',', '?', '!', ';'];\n// We cache RegExps to improve performance with React Native Android, which has poor RegExp initialization performance.\n// Capacity of 20 should be plenty, as nsSeparator/keySeparator don't tend to vary much across calls.\nconst looksLikeObjectPathRegExpCache = new RegExpCache(20);\n\nexport function looksLikeObjectPath(key, nsSeparator, keySeparator) {\n nsSeparator = nsSeparator || '';\n keySeparator = keySeparator || '';\n const possibleChars = chars.filter(\n (c) => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0,\n );\n if (possibleChars.length === 0) return true;\n const r = looksLikeObjectPathRegExpCache.getRegExp(\n `(${possibleChars.map((c) => (c === '?' ? '\\\\?' : c)).join('|')})`,\n );\n let matched = !r.test(key);\n if (!matched) {\n const ki = key.indexOf(keySeparator);\n if (ki > 0 && !r.test(key.substring(0, ki))) {\n matched = true;\n }\n }\n return matched;\n}\n\n/**\n * Given\n *\n * 1. a top level object obj, and\n * 2. a path to a deeply nested string or object within it\n *\n * Find and return that deeply nested string or object. The caveat is that the keys of objects within the nesting chain\n * may contain period characters. Therefore, we need to DFS and explore all possible keys at each step until we find the\n * deeply nested string or object.\n */\nexport function deepFind(obj, path, keySeparator = '.') {\n if (!obj) return undefined;\n if (obj[path]) return obj[path];\n const tokens = path.split(keySeparator);\n let current = obj;\n for (let i = 0; i < tokens.length; ) {\n if (!current || typeof current !== 'object') {\n return undefined;\n }\n let next;\n let nextPath = '';\n for (let j = i; j < tokens.length; ++j) {\n if (j !== i) {\n nextPath += keySeparator;\n }\n nextPath += tokens[j];\n next = current[nextPath];\n if (next !== undefined) {\n if (['string', 'number', 'boolean'].indexOf(typeof next) > -1 && j < tokens.length - 1) {\n continue;\n }\n i += j - i + 1;\n break;\n }\n }\n current = next;\n }\n return current;\n}\n\nexport function getCleanedCode(code) {\n if (code && code.indexOf('_') > 0) return code.replace('_', '-');\n return code;\n}\n", "import EventEmitter from './EventEmitter.js';\nimport * as utils from './utils.js';\n\nclass ResourceStore extends EventEmitter {\n constructor(data, options = { ns: ['translation'], defaultNS: 'translation' }) {\n super();\n\n this.data = data || {};\n this.options = options;\n if (this.options.keySeparator === undefined) {\n this.options.keySeparator = '.';\n }\n if (this.options.ignoreJSONStructure === undefined) {\n this.options.ignoreJSONStructure = true;\n }\n }\n\n addNamespaces(ns) {\n if (this.options.ns.indexOf(ns) < 0) {\n this.options.ns.push(ns);\n }\n }\n\n removeNamespaces(ns) {\n const index = this.options.ns.indexOf(ns);\n if (index > -1) {\n this.options.ns.splice(index, 1);\n }\n }\n\n getResource(lng, ns, key, options = {}) {\n const keySeparator =\n options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;\n\n const ignoreJSONStructure =\n options.ignoreJSONStructure !== undefined\n ? options.ignoreJSONStructure\n : this.options.ignoreJSONStructure;\n\n let path;\n if (lng.indexOf('.') > -1) {\n path = lng.split('.');\n } else {\n path = [lng, ns];\n if (key) {\n if (Array.isArray(key)) {\n path.push(...key);\n } else if (typeof key === 'string' && keySeparator) {\n path.push(...key.split(keySeparator));\n } else {\n path.push(key);\n }\n }\n }\n\n const result = utils.getPath(this.data, path);\n if (!result && !ns && !key && lng.indexOf('.') > -1) {\n lng = path[0];\n ns = path[1];\n key = path.slice(2).join('.');\n }\n if (result || !ignoreJSONStructure || typeof key !== 'string') return result;\n\n return utils.deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);\n }\n\n addResource(lng, ns, key, value, options = { silent: false }) {\n const keySeparator =\n options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;\n\n let path = [lng, ns];\n if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);\n\n if (lng.indexOf('.') > -1) {\n path = lng.split('.');\n value = ns;\n ns = path[1];\n }\n\n this.addNamespaces(ns);\n\n utils.setPath(this.data, path, value);\n\n if (!options.silent) this.emit('added', lng, ns, key, value);\n }\n\n addResources(lng, ns, resources, options = { silent: false }) {\n /* eslint no-restricted-syntax: 0 */\n for (const m in resources) {\n if (\n typeof resources[m] === 'string' ||\n Object.prototype.toString.apply(resources[m]) === '[object Array]'\n )\n this.addResource(lng, ns, m, resources[m], { silent: true });\n }\n if (!options.silent) this.emit('added', lng, ns, resources);\n }\n\n addResourceBundle(\n lng,\n ns,\n resources,\n deep,\n overwrite,\n options = { silent: false, skipCopy: false },\n ) {\n let path = [lng, ns];\n if (lng.indexOf('.') > -1) {\n path = lng.split('.');\n deep = resources;\n resources = ns;\n ns = path[1];\n }\n\n this.addNamespaces(ns);\n\n let pack = utils.getPath(this.data, path) || {};\n\n if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources)); // make a copy to fix #2081\n\n if (deep) {\n utils.deepExtend(pack, resources, overwrite);\n } else {\n pack = { ...pack, ...resources };\n }\n\n utils.setPath(this.data, path, pack);\n\n if (!options.silent) this.emit('added', lng, ns, resources);\n }\n\n removeResourceBundle(lng, ns) {\n if (this.hasResourceBundle(lng, ns)) {\n delete this.data[lng][ns];\n }\n this.removeNamespaces(ns);\n\n this.emit('removed', lng, ns);\n }\n\n hasResourceBundle(lng, ns) {\n return this.getResource(lng, ns) !== undefined;\n }\n\n getResourceBundle(lng, ns) {\n if (!ns) ns = this.options.defaultNS;\n\n // COMPATIBILITY: remove extend in v2.1.0\n if (this.options.compatibilityAPI === 'v1') return { ...{}, ...this.getResource(lng, ns) };\n\n return this.getResource(lng, ns);\n }\n\n getDataByLanguage(lng) {\n return this.data[lng];\n }\n\n hasLanguageSomeTranslations(lng) {\n const data = this.getDataByLanguage(lng);\n const n = (data && Object.keys(data)) || [];\n return !!n.find((v) => data[v] && Object.keys(data[v]).length > 0);\n }\n\n toJSON() {\n return this.data;\n }\n}\n\nexport default ResourceStore;\n", "export default {\n processors: {},\n\n addPostProcessor(module) {\n this.processors[module.name] = module;\n },\n\n handle(processors, value, key, options, translator) {\n processors.forEach((processor) => {\n if (this.processors[processor])\n value = this.processors[processor].process(value, key, options, translator);\n });\n\n return value;\n },\n};\n", "import baseLogger from './logger.js';\nimport EventEmitter from './EventEmitter.js';\nimport postProcessor from './postProcessor.js';\nimport * as utils from './utils.js';\n\nconst checkedLoadedFor = {};\n\nclass Translator extends EventEmitter {\n constructor(services, options = {}) {\n super();\n\n utils.copy(\n [\n 'resourceStore',\n 'languageUtils',\n 'pluralResolver',\n 'interpolator',\n 'backendConnector',\n 'i18nFormat',\n 'utils',\n ],\n services,\n this,\n );\n\n this.options = options;\n if (this.options.keySeparator === undefined) {\n this.options.keySeparator = '.';\n }\n\n this.logger = baseLogger.create('translator');\n }\n\n changeLanguage(lng) {\n if (lng) this.language = lng;\n }\n\n exists(key, options = { interpolation: {} }) {\n if (key === undefined || key === null) {\n return false;\n }\n\n const resolved = this.resolve(key, options);\n return resolved && resolved.res !== undefined;\n }\n\n extractFromKey(key, options) {\n let nsSeparator =\n options.nsSeparator !== undefined ? options.nsSeparator : this.options.nsSeparator;\n if (nsSeparator === undefined) nsSeparator = ':';\n\n const keySeparator =\n options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;\n\n let namespaces = options.ns || this.options.defaultNS || [];\n const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;\n const seemsNaturalLanguage =\n !this.options.userDefinedKeySeparator &&\n !options.keySeparator &&\n !this.options.userDefinedNsSeparator &&\n !options.nsSeparator &&\n !utils.looksLikeObjectPath(key, nsSeparator, keySeparator);\n if (wouldCheckForNsInKey && !seemsNaturalLanguage) {\n const m = key.match(this.interpolator.nestingRegexp);\n if (m && m.length > 0) {\n return {\n key,\n namespaces,\n };\n }\n const parts = key.split(nsSeparator);\n if (\n nsSeparator !== keySeparator ||\n (nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1)\n )\n namespaces = parts.shift();\n key = parts.join(keySeparator);\n }\n if (typeof namespaces === 'string') namespaces = [namespaces];\n\n return {\n key,\n namespaces,\n };\n }\n\n translate(keys, options, lastKey) {\n if (typeof options !== 'object' && this.options.overloadTranslationOptionHandler) {\n /* eslint prefer-rest-params: 0 */\n options = this.options.overloadTranslationOptionHandler(arguments);\n }\n if (typeof options === 'object') options = { ...options };\n if (!options) options = {};\n\n // non valid keys handling\n if (keys === undefined || keys === null /* || keys === '' */) return '';\n if (!Array.isArray(keys)) keys = [String(keys)];\n\n const returnDetails =\n options.returnDetails !== undefined ? options.returnDetails : this.options.returnDetails;\n\n // separators\n const keySeparator =\n options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;\n\n // get namespace(s)\n const { key, namespaces } = this.extractFromKey(keys[keys.length - 1], options);\n const namespace = namespaces[namespaces.length - 1];\n\n // return key on CIMode\n const lng = options.lng || this.language;\n const appendNamespaceToCIMode =\n options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;\n if (lng && lng.toLowerCase() === 'cimode') {\n if (appendNamespaceToCIMode) {\n const nsSeparator = options.nsSeparator || this.options.nsSeparator;\n if (returnDetails) {\n return {\n res: `${namespace}${nsSeparator}${key}`,\n usedKey: key,\n exactUsedKey: key,\n usedLng: lng,\n usedNS: namespace,\n usedParams: this.getUsedParamsDetails(options),\n };\n }\n return `${namespace}${nsSeparator}${key}`;\n }\n\n if (returnDetails) {\n return {\n res: key,\n usedKey: key,\n exactUsedKey: key,\n usedLng: lng,\n usedNS: namespace,\n usedParams: this.getUsedParamsDetails(options),\n };\n }\n return key;\n }\n\n // resolve from store\n const resolved = this.resolve(keys, options);\n let res = resolved && resolved.res;\n const resUsedKey = (resolved && resolved.usedKey) || key;\n const resExactUsedKey = (resolved && resolved.exactUsedKey) || key;\n\n const resType = Object.prototype.toString.apply(res);\n const noObject = ['[object Number]', '[object Function]', '[object RegExp]'];\n const joinArrays =\n options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;\n\n // object\n const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;\n const handleAsObject =\n typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';\n if (\n handleAsObjectInI18nFormat &&\n res &&\n handleAsObject &&\n noObject.indexOf(resType) < 0 &&\n !(typeof joinArrays === 'string' && resType === '[object Array]')\n ) {\n if (!options.returnObjects && !this.options.returnObjects) {\n if (!this.options.returnedObjectHandler) {\n this.logger.warn('accessing an object - but returnObjects options is not enabled!');\n }\n const r = this.options.returnedObjectHandler\n ? this.options.returnedObjectHandler(resUsedKey, res, { ...options, ns: namespaces })\n : `key '${key} (${this.language})' returned an object instead of string.`;\n if (returnDetails) {\n resolved.res = r;\n resolved.usedParams = this.getUsedParamsDetails(options);\n return resolved;\n }\n return r;\n }\n\n // if we got a separator we loop over children - else we just return object as is\n // as having it set to false means no hierarchy so no lookup for nested values\n if (keySeparator) {\n const resTypeIsArray = resType === '[object Array]';\n const copy = resTypeIsArray ? [] : {}; // apply child translation on a copy\n\n /* eslint no-restricted-syntax: 0 */\n const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;\n for (const m in res) {\n if (Object.prototype.hasOwnProperty.call(res, m)) {\n const deepKey = `${newKeyToUse}${keySeparator}${m}`;\n copy[m] = this.translate(deepKey, {\n ...options,\n ...{ joinArrays: false, ns: namespaces },\n });\n if (copy[m] === deepKey) copy[m] = res[m]; // if nothing found use original value as fallback\n }\n }\n res = copy;\n }\n } else if (\n handleAsObjectInI18nFormat &&\n typeof joinArrays === 'string' &&\n resType === '[object Array]'\n ) {\n // array special treatment\n res = res.join(joinArrays);\n if (res) res = this.extendTranslation(res, keys, options, lastKey);\n } else {\n // string, empty or null\n let usedDefault = false;\n let usedKey = false;\n\n const needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';\n const hasDefaultValue = Translator.hasDefaultValue(options);\n const defaultValueSuffix = needsPluralHandling\n ? this.pluralResolver.getSuffix(lng, options.count, options)\n : '';\n const defaultValueSuffixOrdinalFallback =\n options.ordinal && needsPluralHandling\n ? this.pluralResolver.getSuffix(lng, options.count, { ordinal: false })\n : '';\n const needsZeroSuffixLookup =\n needsPluralHandling &&\n !options.ordinal &&\n options.count === 0 &&\n this.pluralResolver.shouldUseIntlApi();\n const defaultValue =\n (needsZeroSuffixLookup && options[`defaultValue${this.options.pluralSeparator}zero`]) ||\n options[`defaultValue${defaultValueSuffix}`] ||\n options[`defaultValue${defaultValueSuffixOrdinalFallback}`] ||\n options.defaultValue;\n\n // fallback value\n if (!this.isValidLookup(res) && hasDefaultValue) {\n usedDefault = true;\n res = defaultValue;\n }\n if (!this.isValidLookup(res)) {\n usedKey = true;\n res = key;\n }\n\n const missingKeyNoValueFallbackToKey =\n options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;\n const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;\n\n // save missing\n const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;\n if (usedKey || usedDefault || updateMissing) {\n this.logger.log(\n updateMissing ? 'updateKey' : 'missingKey',\n lng,\n namespace,\n key,\n updateMissing ? defaultValue : res,\n );\n if (keySeparator) {\n const fk = this.resolve(key, { ...options, keySeparator: false });\n if (fk && fk.res)\n this.logger.warn(\n 'Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.',\n );\n }\n\n let lngs = [];\n const fallbackLngs = this.languageUtils.getFallbackCodes(\n this.options.fallbackLng,\n options.lng || this.language,\n );\n if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {\n for (let i = 0; i < fallbackLngs.length; i++) {\n lngs.push(fallbackLngs[i]);\n }\n } else if (this.options.saveMissingTo === 'all') {\n lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);\n } else {\n lngs.push(options.lng || this.language);\n }\n\n const send = (l, k, specificDefaultValue) => {\n const defaultForMissing =\n hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;\n if (this.options.missingKeyHandler) {\n this.options.missingKeyHandler(\n l,\n namespace,\n k,\n defaultForMissing,\n updateMissing,\n options,\n );\n } else if (this.backendConnector && this.backendConnector.saveMissing) {\n this.backendConnector.saveMissing(\n l,\n namespace,\n k,\n defaultForMissing,\n updateMissing,\n options,\n );\n }\n this.emit('missingKey', l, namespace, k, res);\n };\n\n if (this.options.saveMissing) {\n if (this.options.saveMissingPlurals && needsPluralHandling) {\n lngs.forEach((language) => {\n const suffixes = this.pluralResolver.getSuffixes(language, options);\n if (\n needsZeroSuffixLookup &&\n options[`defaultValue${this.options.pluralSeparator}zero`] &&\n suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0\n ) {\n suffixes.push(`${this.options.pluralSeparator}zero`);\n }\n suffixes.forEach((suffix) => {\n send([language], key + suffix, options[`defaultValue${suffix}`] || defaultValue);\n });\n });\n } else {\n send(lngs, key, defaultValue);\n }\n }\n }\n\n // extend\n res = this.extendTranslation(res, keys, options, resolved, lastKey);\n\n // append namespace if still key\n if (usedKey && res === key && this.options.appendNamespaceToMissingKey)\n res = `${namespace}:${key}`;\n\n // parseMissingKeyHandler\n if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {\n if (this.options.compatibilityAPI !== 'v1') {\n res = this.options.parseMissingKeyHandler(\n this.options.appendNamespaceToMissingKey ? `${namespace}:${key}` : key,\n usedDefault ? res : undefined,\n );\n } else {\n res = this.options.parseMissingKeyHandler(res);\n }\n }\n }\n\n // return\n if (returnDetails) {\n resolved.res = res;\n resolved.usedParams = this.getUsedParamsDetails(options);\n return resolved;\n }\n return res;\n }\n\n extendTranslation(res, key, options, resolved, lastKey) {\n if (this.i18nFormat && this.i18nFormat.parse) {\n res = this.i18nFormat.parse(\n res,\n { ...this.options.interpolation.defaultVariables, ...options },\n options.lng || this.language || resolved.usedLng,\n resolved.usedNS,\n resolved.usedKey,\n { resolved },\n );\n } else if (!options.skipInterpolation) {\n // i18next.parsing\n if (options.interpolation)\n this.interpolator.init({\n ...options,\n ...{ interpolation: { ...this.options.interpolation, ...options.interpolation } },\n });\n const skipOnVariables =\n typeof res === 'string' &&\n (options && options.interpolation && options.interpolation.skipOnVariables !== undefined\n ? options.interpolation.skipOnVariables\n : this.options.interpolation.skipOnVariables);\n let nestBef;\n if (skipOnVariables) {\n const nb = res.match(this.interpolator.nestingRegexp);\n // has nesting aftbeforeer interpolation\n nestBef = nb && nb.length;\n }\n\n // interpolate\n let data = options.replace && typeof options.replace !== 'string' ? options.replace : options;\n if (this.options.interpolation.defaultVariables)\n data = { ...this.options.interpolation.defaultVariables, ...data };\n res = this.interpolator.interpolate(res, data, options.lng || this.language, options);\n\n // nesting\n if (skipOnVariables) {\n const na = res.match(this.interpolator.nestingRegexp);\n // has nesting after interpolation\n const nestAft = na && na.length;\n if (nestBef < nestAft) options.nest = false;\n }\n if (!options.lng && this.options.compatibilityAPI !== 'v1' && resolved && resolved.res)\n options.lng = resolved.usedLng;\n if (options.nest !== false)\n res = this.interpolator.nest(\n res,\n (...args) => {\n if (lastKey && lastKey[0] === args[0] && !options.context) {\n this.logger.warn(\n `It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`,\n );\n return null;\n }\n return this.translate(...args, key);\n },\n options,\n );\n\n if (options.interpolation) this.interpolator.reset();\n }\n\n // post process\n const postProcess = options.postProcess || this.options.postProcess;\n const postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;\n\n if (\n res !== undefined &&\n res !== null &&\n postProcessorNames &&\n postProcessorNames.length &&\n options.applyPostProcessor !== false\n ) {\n res = postProcessor.handle(\n postProcessorNames,\n res,\n key,\n this.options && this.options.postProcessPassResolved\n ? {\n i18nResolved: { ...resolved, usedParams: this.getUsedParamsDetails(options) },\n ...options,\n }\n : options,\n this,\n );\n }\n\n return res;\n }\n\n resolve(keys, options = {}) {\n let found;\n let usedKey; // plain key\n let exactUsedKey; // key with context / plural\n let usedLng;\n let usedNS;\n\n if (typeof keys === 'string') keys = [keys];\n\n // forEach possible key\n keys.forEach((k) => {\n if (this.isValidLookup(found)) return;\n const extracted = this.extractFromKey(k, options);\n const key = extracted.key;\n usedKey = key;\n let namespaces = extracted.namespaces;\n if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);\n\n const needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';\n const needsZeroSuffixLookup =\n needsPluralHandling &&\n !options.ordinal &&\n options.count === 0 &&\n this.pluralResolver.shouldUseIntlApi();\n const needsContextHandling =\n options.context !== undefined &&\n (typeof options.context === 'string' || typeof options.context === 'number') &&\n options.context !== '';\n\n const codes = options.lngs\n ? options.lngs\n : this.languageUtils.toResolveHierarchy(options.lng || this.language, options.fallbackLng);\n\n namespaces.forEach((ns) => {\n if (this.isValidLookup(found)) return;\n usedNS = ns;\n\n if (\n !checkedLoadedFor[`${codes[0]}-${ns}`] &&\n this.utils &&\n this.utils.hasLoadedNamespace &&\n !this.utils.hasLoadedNamespace(usedNS)\n ) {\n checkedLoadedFor[`${codes[0]}-${ns}`] = true;\n this.logger.warn(\n `key \"${usedKey}\" for languages \"${codes.join(\n ', ',\n )}\" won't get resolved as namespace \"${usedNS}\" was not yet loaded`,\n 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!',\n );\n }\n\n codes.forEach((code) => {\n if (this.isValidLookup(found)) return;\n usedLng = code;\n\n const finalKeys = [key];\n\n if (this.i18nFormat && this.i18nFormat.addLookupKeys) {\n this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);\n } else {\n let pluralSuffix;\n if (needsPluralHandling)\n pluralSuffix = this.pluralResolver.getSuffix(code, options.count, options);\n const zeroSuffix = `${this.options.pluralSeparator}zero`;\n const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;\n // get key for plural if needed\n if (needsPluralHandling) {\n finalKeys.push(key + pluralSuffix);\n if (options.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {\n finalKeys.push(\n key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator),\n );\n }\n if (needsZeroSuffixLookup) {\n finalKeys.push(key + zeroSuffix);\n }\n }\n\n // get key for context if needed\n if (needsContextHandling) {\n const contextKey = `${key}${this.options.contextSeparator}${options.context}`;\n finalKeys.push(contextKey);\n\n // get key for context + plural if needed\n if (needsPluralHandling) {\n finalKeys.push(contextKey + pluralSuffix);\n if (options.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {\n finalKeys.push(\n contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator),\n );\n }\n if (needsZeroSuffixLookup) {\n finalKeys.push(contextKey + zeroSuffix);\n }\n }\n }\n }\n\n // iterate over finalKeys starting with most specific pluralkey (-> contextkey only) -> singularkey only\n let possibleKey;\n /* eslint no-cond-assign: 0 */\n while ((possibleKey = finalKeys.pop())) {\n if (!this.isValidLookup(found)) {\n exactUsedKey = possibleKey;\n found = this.getResource(code, ns, possibleKey, options);\n }\n }\n });\n });\n });\n\n return { res: found, usedKey, exactUsedKey, usedLng, usedNS };\n }\n\n isValidLookup(res) {\n return (\n res !== undefined &&\n !(!this.options.returnNull && res === null) &&\n !(!this.options.returnEmptyString && res === '')\n );\n }\n\n getResource(code, ns, key, options = {}) {\n if (this.i18nFormat && this.i18nFormat.getResource)\n return this.i18nFormat.getResource(code, ns, key, options);\n return this.resourceStore.getResource(code, ns, key, options);\n }\n\n getUsedParamsDetails(options = {}) {\n // we need to remember to extend this array whenever new option properties are added\n const optionsKeys = [\n 'defaultValue',\n 'ordinal',\n 'context',\n 'replace',\n 'lng',\n 'lngs',\n 'fallbackLng',\n 'ns',\n 'keySeparator',\n 'nsSeparator',\n 'returnObjects',\n 'returnDetails',\n 'joinArrays',\n 'postProcess',\n 'interpolation',\n ];\n\n const useOptionsReplaceForData = options.replace && typeof options.replace !== 'string';\n let data = useOptionsReplaceForData ? options.replace : options;\n if (useOptionsReplaceForData && typeof options.count !== 'undefined') {\n data.count = options.count;\n }\n\n if (this.options.interpolation.defaultVariables) {\n data = { ...this.options.interpolation.defaultVariables, ...data };\n }\n\n // avoid reporting options (execpt count) as usedParams\n if (!useOptionsReplaceForData) {\n data = { ...data };\n for (const key of optionsKeys) {\n delete data[key];\n }\n }\n\n return data;\n }\n\n static hasDefaultValue(options) {\n const prefix = 'defaultValue';\n\n for (const option in options) {\n if (\n Object.prototype.hasOwnProperty.call(options, option) &&\n prefix === option.substring(0, prefix.length) &&\n undefined !== options[option]\n ) {\n return true;\n }\n }\n\n return false;\n }\n}\n\nexport default Translator;\n", "import baseLogger from './logger.js';\nimport { getCleanedCode } from './utils.js';\n\nfunction capitalize(string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n}\n\nclass LanguageUtil {\n constructor(options) {\n this.options = options;\n\n this.supportedLngs = this.options.supportedLngs || false;\n this.logger = baseLogger.create('languageUtils');\n }\n\n getScriptPartFromCode(code) {\n code = getCleanedCode(code);\n if (!code || code.indexOf('-') < 0) return null;\n\n const p = code.split('-');\n if (p.length === 2) return null;\n p.pop();\n if (p[p.length - 1].toLowerCase() === 'x') return null;\n return this.formatLanguageCode(p.join('-'));\n }\n\n getLanguagePartFromCode(code) {\n code = getCleanedCode(code);\n if (!code || code.indexOf('-') < 0) return code;\n\n const p = code.split('-');\n return this.formatLanguageCode(p[0]);\n }\n\n formatLanguageCode(code) {\n // http://www.iana.org/assignments/language-tags/language-tags.xhtml\n if (typeof code === 'string' && code.indexOf('-') > -1) {\n const specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];\n let p = code.split('-');\n\n if (this.options.lowerCaseLng) {\n p = p.map((part) => part.toLowerCase());\n } else if (p.length === 2) {\n p[0] = p[0].toLowerCase();\n p[1] = p[1].toUpperCase();\n\n if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());\n } else if (p.length === 3) {\n p[0] = p[0].toLowerCase();\n\n // if length 2 guess it's a country\n if (p[1].length === 2) p[1] = p[1].toUpperCase();\n if (p[0] !== 'sgn' && p[2].length === 2) p[2] = p[2].toUpperCase();\n\n if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());\n if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize(p[2].toLowerCase());\n }\n\n return p.join('-');\n }\n\n return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;\n }\n\n isSupportedCode(code) {\n if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {\n code = this.getLanguagePartFromCode(code);\n }\n return (\n !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1\n );\n }\n\n getBestMatchFromCodes(codes) {\n if (!codes) return null;\n\n let found;\n\n // pick first supported code or if no restriction pick the first one (highest prio)\n codes.forEach((code) => {\n if (found) return;\n const cleanedLng = this.formatLanguageCode(code);\n if (!this.options.supportedLngs || this.isSupportedCode(cleanedLng)) found = cleanedLng;\n });\n\n // if we got no match in supportedLngs yet - check for similar locales\n // first de-CH --> de\n // second de-CH --> de-DE\n if (!found && this.options.supportedLngs) {\n codes.forEach((code) => {\n if (found) return;\n\n const lngOnly = this.getLanguagePartFromCode(code);\n // eslint-disable-next-line no-return-assign\n if (this.isSupportedCode(lngOnly)) return (found = lngOnly);\n\n // eslint-disable-next-line array-callback-return\n found = this.options.supportedLngs.find((supportedLng) => {\n if (supportedLng === lngOnly) return supportedLng;\n if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;\n if (\n supportedLng.indexOf('-') > 0 &&\n lngOnly.indexOf('-') < 0 &&\n supportedLng.substring(0, supportedLng.indexOf('-')) === lngOnly\n )\n return supportedLng;\n if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1) return supportedLng;\n });\n });\n }\n // if nothing found, use fallbackLng\n if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];\n\n return found;\n }\n\n getFallbackCodes(fallbacks, code) {\n if (!fallbacks) return [];\n if (typeof fallbacks === 'function') fallbacks = fallbacks(code);\n if (typeof fallbacks === 'string') fallbacks = [fallbacks];\n if (Object.prototype.toString.apply(fallbacks) === '[object Array]') return fallbacks;\n\n if (!code) return fallbacks.default || [];\n\n // assume we have an object defining fallbacks\n let found = fallbacks[code];\n if (!found) found = fallbacks[this.getScriptPartFromCode(code)];\n if (!found) found = fallbacks[this.formatLanguageCode(code)];\n if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];\n if (!found) found = fallbacks.default;\n\n return found || [];\n }\n\n toResolveHierarchy(code, fallbackCode) {\n const fallbackCodes = this.getFallbackCodes(\n fallbackCode || this.options.fallbackLng || [],\n code,\n );\n\n const codes = [];\n const addCode = (c) => {\n if (!c) return;\n if (this.isSupportedCode(c)) {\n codes.push(c);\n } else {\n this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);\n }\n };\n\n if (typeof code === 'string' && (code.indexOf('-') > -1 || code.indexOf('_') > -1)) {\n if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));\n if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly')\n addCode(this.getScriptPartFromCode(code));\n if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));\n } else if (typeof code === 'string') {\n addCode(this.formatLanguageCode(code));\n }\n\n fallbackCodes.forEach((fc) => {\n if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));\n });\n\n return codes;\n }\n}\n\nexport default LanguageUtil;\n", "import baseLogger from './logger.js';\nimport { getCleanedCode } from './utils.js'\n\n// definition http://translate.sourceforge.net/wiki/l10n/pluralforms\n/* eslint-disable */\nlet sets = [\n { lngs: ['ach','ak','am','arn','br','fil','gun','ln','mfe','mg','mi','oc', 'pt', 'pt-BR',\n 'tg', 'tl', 'ti','tr','uz','wa'], nr: [1,2], fc: 1 },\n\n { lngs: ['af','an','ast','az','bg','bn','ca','da','de','dev','el','en',\n 'eo','es','et','eu','fi','fo','fur','fy','gl','gu','ha','hi',\n 'hu','hy','ia','it','kk','kn','ku','lb','mai','ml','mn','mr','nah','nap','nb',\n 'ne','nl','nn','no','nso','pa','pap','pms','ps','pt-PT','rm','sco',\n 'se','si','so','son','sq','sv','sw','ta','te','tk','ur','yo'], nr: [1,2], fc: 2 },\n\n { lngs: ['ay','bo','cgg','fa','ht','id','ja','jbo','ka','km','ko','ky','lo',\n 'ms','sah','su','th','tt','ug','vi','wo','zh'], nr: [1], fc: 3 },\n\n { lngs: ['be','bs', 'cnr', 'dz','hr','ru','sr','uk'], nr: [1,2,5], fc: 4 },\n\n { lngs: ['ar'], nr: [0,1,2,3,11,100], fc: 5 },\n { lngs: ['cs','sk'], nr: [1,2,5], fc: 6 },\n { lngs: ['csb','pl'], nr: [1,2,5], fc: 7 },\n { lngs: ['cy'], nr: [1,2,3,8], fc: 8 },\n { lngs: ['fr'], nr: [1,2], fc: 9 },\n { lngs: ['ga'], nr: [1,2,3,7,11], fc: 10 },\n { lngs: ['gd'], nr: [1,2,3,20], fc: 11 },\n { lngs: ['is'], nr: [1,2], fc: 12 },\n { lngs: ['jv'], nr: [0,1], fc: 13 },\n { lngs: ['kw'], nr: [1,2,3,4], fc: 14 },\n { lngs: ['lt'], nr: [1,2,10], fc: 15 },\n { lngs: ['lv'], nr: [1,2,0], fc: 16 },\n { lngs: ['mk'], nr: [1,2], fc: 17 },\n { lngs: ['mnk'], nr: [0,1,2], fc: 18 },\n { lngs: ['mt'], nr: [1,2,11,20], fc: 19 },\n { lngs: ['or'], nr: [2,1], fc: 2 },\n { lngs: ['ro'], nr: [1,2,20], fc: 20 },\n { lngs: ['sl'], nr: [5,1,2,3], fc: 21 },\n { lngs: ['he','iw'], nr: [1,2,20,21], fc: 22 }\n]\n\nlet _rulesPluralsTypes = {\n 1: function(n) {return Number(n > 1);},\n 2: function(n) {return Number(n != 1);},\n 3: function(n) {return 0;},\n 4: function(n) {return Number(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);},\n 5: function(n) {return Number(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5);},\n 6: function(n) {return Number((n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2);},\n 7: function(n) {return Number(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);},\n 8: function(n) {return Number((n==1) ? 0 : (n==2) ? 1 : (n != 8 && n != 11) ? 2 : 3);},\n 9: function(n) {return Number(n >= 2);},\n 10: function(n) {return Number(n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : 4) ;},\n 11: function(n) {return Number((n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3);},\n 12: function(n) {return Number(n%10!=1 || n%100==11);},\n 13: function(n) {return Number(n !== 0);},\n 14: function(n) {return Number((n==1) ? 0 : (n==2) ? 1 : (n == 3) ? 2 : 3);},\n 15: function(n) {return Number(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);},\n 16: function(n) {return Number(n%10==1 && n%100!=11 ? 0 : n !== 0 ? 1 : 2);},\n 17: function(n) {return Number(n==1 || n%10==1 && n%100!=11 ? 0 : 1);},\n 18: function(n) {return Number(n==0 ? 0 : n==1 ? 1 : 2);},\n 19: function(n) {return Number(n==1 ? 0 : n==0 || ( n%100>1 && n%100<11) ? 1 : (n%100>10 && n%100<20 ) ? 2 : 3);},\n 20: function(n) {return Number(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2);},\n 21: function(n) {return Number(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0); },\n 22: function(n) {return Number(n==1 ? 0 : n==2 ? 1 : (n<0 || n>10) && n%10==0 ? 2 : 3); }\n};\n/* eslint-enable */\n\nconst nonIntlVersions = ['v1', 'v2', 'v3'];\nconst intlVersions = ['v4'];\nconst suffixesOrder = {\n zero: 0,\n one: 1,\n two: 2,\n few: 3,\n many: 4,\n other: 5,\n};\n\nfunction createRules() {\n const rules = {};\n sets.forEach((set) => {\n set.lngs.forEach((l) => {\n rules[l] = {\n numbers: set.nr,\n plurals: _rulesPluralsTypes[set.fc]\n };\n });\n });\n return rules;\n}\n\nclass PluralResolver {\n constructor(languageUtils, options = {}) {\n this.languageUtils = languageUtils;\n this.options = options;\n\n this.logger = baseLogger.create('pluralResolver');\n\n if ((!this.options.compatibilityJSON || intlVersions.includes(this.options.compatibilityJSON)) && (typeof Intl === 'undefined' || !Intl.PluralRules)) {\n this.options.compatibilityJSON = 'v3';\n this.logger.error('Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.');\n }\n\n this.rules = createRules();\n }\n\n addRule(lng, obj) {\n this.rules[lng] = obj;\n }\n\n getRule(code, options = {}) {\n if (this.shouldUseIntlApi()) {\n try {\n return new Intl.PluralRules(getCleanedCode(code === 'dev' ? 'en' : code), { type: options.ordinal ? 'ordinal' : 'cardinal' });\n } catch (err) {\n return;\n }\n }\n\n return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];\n }\n\n needsPlural(code, options = {}) {\n const rule = this.getRule(code, options);\n\n if (this.shouldUseIntlApi()) {\n return rule && rule.resolvedOptions().pluralCategories.length > 1;\n }\n\n return rule && rule.numbers.length > 1;\n }\n\n getPluralFormsOfKey(code, key, options = {}) {\n return this.getSuffixes(code, options).map((suffix) => `${key}${suffix}`);\n }\n\n getSuffixes(code, options = {}) {\n const rule = this.getRule(code, options);\n\n if (!rule) {\n return [];\n }\n\n if (this.shouldUseIntlApi()) {\n return rule.resolvedOptions().pluralCategories\n .sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2])\n .map(pluralCategory => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${pluralCategory}`);\n }\n\n return rule.numbers.map((number) => this.getSuffix(code, number, options));\n }\n\n getSuffix(code, count, options = {}) {\n const rule = this.getRule(code, options);\n\n if (rule) {\n if (this.shouldUseIntlApi()) {\n return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${rule.select(count)}`;\n }\n\n return this.getSuffixRetroCompatible(rule, count);\n }\n\n this.logger.warn(`no plural rule found for: ${code}`);\n return '';\n }\n\n getSuffixRetroCompatible(rule, count) {\n const idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));\n let suffix = rule.numbers[idx];\n\n // special treatment for lngs only having singular and plural\n if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {\n if (suffix === 2) {\n suffix = 'plural';\n } else if (suffix === 1) {\n suffix = '';\n }\n }\n\n const returnSuffix = () => (\n this.options.prepend && suffix.toString() ? this.options.prepend + suffix.toString() : suffix.toString()\n );\n\n // COMPATIBILITY JSON\n // v1\n if (this.options.compatibilityJSON === 'v1') {\n if (suffix === 1) return '';\n if (typeof suffix === 'number') return `_plural_${suffix.toString()}`;\n return returnSuffix();\n // eslint-disable-next-line no-else-return\n } else if (/* v2 */ this.options.compatibilityJSON === 'v2') {\n return returnSuffix();\n } else if (/* v3 - gettext index */ this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {\n return returnSuffix();\n }\n return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();\n }\n\n shouldUseIntlApi() {\n return !nonIntlVersions.includes(this.options.compatibilityJSON);\n }\n}\n\nexport default PluralResolver;\n", "import * as utils from './utils.js';\nimport baseLogger from './logger.js';\n\nfunction deepFindWithDefaults(\n data,\n defaultData,\n key,\n keySeparator = '.',\n ignoreJSONStructure = true,\n) {\n let path = utils.getPathWithDefaults(data, defaultData, key);\n if (!path && ignoreJSONStructure && typeof key === 'string') {\n path = utils.deepFind(data, key, keySeparator);\n if (path === undefined) path = utils.deepFind(defaultData, key, keySeparator);\n }\n return path;\n}\n\nclass Interpolator {\n constructor(options = {}) {\n this.logger = baseLogger.create('interpolator');\n\n this.options = options;\n this.format = (options.interpolation && options.interpolation.format) || ((value) => value);\n this.init(options);\n }\n\n /* eslint no-param-reassign: 0 */\n init(options = {}) {\n if (!options.interpolation) options.interpolation = { escapeValue: true };\n\n const {\n escape,\n escapeValue,\n useRawValueToEscape,\n prefix,\n prefixEscaped,\n suffix,\n suffixEscaped,\n formatSeparator,\n unescapeSuffix,\n unescapePrefix,\n nestingPrefix,\n nestingPrefixEscaped,\n nestingSuffix,\n nestingSuffixEscaped,\n nestingOptionsSeparator,\n maxReplaces,\n alwaysFormat,\n } = options.interpolation;\n\n this.escape = escape !== undefined ? escape : utils.escape;\n this.escapeValue = escapeValue !== undefined ? escapeValue : true;\n this.useRawValueToEscape = useRawValueToEscape !== undefined ? useRawValueToEscape : false;\n\n this.prefix = prefix ? utils.regexEscape(prefix) : prefixEscaped || '{{';\n this.suffix = suffix ? utils.regexEscape(suffix) : suffixEscaped || '}}';\n\n this.formatSeparator = formatSeparator || ',';\n\n this.unescapePrefix = unescapeSuffix ? '' : unescapePrefix || '-';\n this.unescapeSuffix = this.unescapePrefix ? '' : unescapeSuffix || '';\n\n this.nestingPrefix = nestingPrefix\n ? utils.regexEscape(nestingPrefix)\n : nestingPrefixEscaped || utils.regexEscape('$t(');\n this.nestingSuffix = nestingSuffix\n ? utils.regexEscape(nestingSuffix)\n : nestingSuffixEscaped || utils.regexEscape(')');\n\n this.nestingOptionsSeparator = nestingOptionsSeparator || ',';\n\n this.maxReplaces = maxReplaces || 1000;\n\n this.alwaysFormat = alwaysFormat !== undefined ? alwaysFormat : false;\n\n // the regexp\n this.resetRegExp();\n }\n\n reset() {\n if (this.options) this.init(this.options);\n }\n\n resetRegExp() {\n const getOrResetRegExp = (existingRegExp, pattern) => {\n if (existingRegExp && existingRegExp.source === pattern) {\n existingRegExp.lastIndex = 0;\n return existingRegExp;\n }\n return new RegExp(pattern, 'g');\n };\n\n this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);\n this.regexpUnescape = getOrResetRegExp(\n this.regexpUnescape,\n `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`,\n );\n this.nestingRegexp = getOrResetRegExp(\n this.nestingRegexp,\n `${this.nestingPrefix}(.+?)${this.nestingSuffix}`,\n );\n }\n\n interpolate(str, data, lng, options) {\n let match;\n let value;\n let replaces;\n\n const defaultData =\n (this.options && this.options.interpolation && this.options.interpolation.defaultVariables) ||\n {};\n\n function regexSafe(val) {\n return val.replace(/\\$/g, '$$$$');\n }\n\n const handleFormat = (key) => {\n if (key.indexOf(this.formatSeparator) < 0) {\n const path = deepFindWithDefaults(\n data,\n defaultData,\n key,\n this.options.keySeparator,\n this.options.ignoreJSONStructure,\n );\n return this.alwaysFormat\n ? this.format(path, undefined, lng, { ...options, ...data, interpolationkey: key })\n : path;\n }\n\n const p = key.split(this.formatSeparator);\n const k = p.shift().trim();\n const f = p.join(this.formatSeparator).trim();\n\n return this.format(\n deepFindWithDefaults(\n data,\n defaultData,\n k,\n this.options.keySeparator,\n this.options.ignoreJSONStructure,\n ),\n f,\n lng,\n {\n ...options,\n ...data,\n interpolationkey: k,\n },\n );\n };\n\n this.resetRegExp();\n\n const missingInterpolationHandler =\n (options && options.missingInterpolationHandler) || this.options.missingInterpolationHandler;\n\n const skipOnVariables =\n options && options.interpolation && options.interpolation.skipOnVariables !== undefined\n ? options.interpolation.skipOnVariables\n : this.options.interpolation.skipOnVariables;\n\n const todos = [\n {\n // unescape if has unescapePrefix/Suffix\n regex: this.regexpUnescape,\n safeValue: (val) => regexSafe(val),\n },\n {\n // regular escape on demand\n regex: this.regexp,\n safeValue: (val) => (this.escapeValue ? regexSafe(this.escape(val)) : regexSafe(val)),\n },\n ];\n todos.forEach((todo) => {\n replaces = 0;\n /* eslint no-cond-assign: 0 */\n while ((match = todo.regex.exec(str))) {\n const matchedVar = match[1].trim();\n value = handleFormat(matchedVar);\n if (value === undefined) {\n if (typeof missingInterpolationHandler === 'function') {\n const temp = missingInterpolationHandler(str, match, options);\n value = typeof temp === 'string' ? temp : '';\n } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {\n value = ''; // undefined becomes empty string\n } else if (skipOnVariables) {\n value = match[0];\n continue; // this makes sure it continues to detect others\n } else {\n this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);\n value = '';\n }\n } else if (typeof value !== 'string' && !this.useRawValueToEscape) {\n value = utils.makeString(value);\n }\n const safeValue = todo.safeValue(value);\n str = str.replace(match[0], safeValue);\n if (skipOnVariables) {\n todo.regex.lastIndex += value.length;\n todo.regex.lastIndex -= match[0].length;\n } else {\n todo.regex.lastIndex = 0;\n }\n replaces++;\n if (replaces >= this.maxReplaces) {\n break;\n }\n }\n });\n return str;\n }\n\n nest(str, fc, options = {}) {\n let match;\n let value;\n\n let clonedOptions;\n\n // if value is something like \"myKey\": \"lorem $(anotherKey, { \"count\": {{aValueInOptions}} })\"\n function handleHasOptions(key, inheritedOptions) {\n const sep = this.nestingOptionsSeparator;\n if (key.indexOf(sep) < 0) return key;\n\n const c = key.split(new RegExp(`${sep}[ ]*{`));\n\n let optionsString = `{${c[1]}`;\n key = c[0];\n optionsString = this.interpolate(optionsString, clonedOptions);\n const matchedSingleQuotes = optionsString.match(/'/g);\n const matchedDoubleQuotes = optionsString.match(/\"/g);\n if (\n (matchedSingleQuotes && matchedSingleQuotes.length % 2 === 0 && !matchedDoubleQuotes) ||\n matchedDoubleQuotes.length % 2 !== 0\n ) {\n optionsString = optionsString.replace(/'/g, '\"');\n }\n\n try {\n clonedOptions = JSON.parse(optionsString);\n\n if (inheritedOptions) clonedOptions = { ...inheritedOptions, ...clonedOptions };\n } catch (e) {\n this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);\n return `${key}${sep}${optionsString}`;\n }\n\n // assert we do not get a endless loop on interpolating defaultValue again and again\n if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1)\n delete clonedOptions.defaultValue;\n return key;\n }\n\n // regular escape on demand\n while ((match = this.nestingRegexp.exec(str))) {\n let formatters = [];\n\n clonedOptions = { ...options };\n clonedOptions =\n clonedOptions.replace && typeof clonedOptions.replace !== 'string'\n ? clonedOptions.replace\n : clonedOptions;\n clonedOptions.applyPostProcessor = false; // avoid post processing on nested lookup\n delete clonedOptions.defaultValue; // assert we do not get a endless loop on interpolating defaultValue again and again\n\n /**\n * If there is more than one parameter (contains the format separator). E.g.:\n * - t(a, b)\n * - t(a, b, c)\n *\n * And those parameters are not dynamic values (parameters do not include curly braces). E.g.:\n * - Not t(a, { \"key\": \"{{variable}}\" })\n * - Not t(a, b, {\"keyA\": \"valueA\", \"keyB\": \"valueB\"})\n */\n let doReduce = false;\n if (match[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match[1])) {\n const r = match[1].split(this.formatSeparator).map((elem) => elem.trim());\n match[1] = r.shift();\n formatters = r;\n doReduce = true;\n }\n\n value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);\n\n // is only the nesting key (key1 = '$(key2)') return the value without stringify\n if (value && match[0] === str && typeof value !== 'string') return value;\n\n // no string to include or empty\n if (typeof value !== 'string') value = utils.makeString(value);\n if (!value) {\n this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);\n value = '';\n }\n\n if (doReduce) {\n value = formatters.reduce(\n // eslint-disable-next-line no-loop-func\n (v, f) =>\n this.format(v, f, options.lng, { ...options, interpolationkey: match[1].trim() }),\n value.trim(),\n );\n }\n\n // Nested keys should not be escaped by default #854\n // value = this.escapeValue ? regexSafe(utils.escape(value)) : regexSafe(value);\n str = str.replace(match[0], value);\n this.regexp.lastIndex = 0;\n }\n return str;\n }\n}\n\nexport default Interpolator;\n", "import baseLogger from './logger.js';\nimport { getCleanedCode } from './utils.js';\n\nfunction parseFormatStr(formatStr) {\n let formatName = formatStr.toLowerCase().trim();\n const formatOptions = {};\n if (formatStr.indexOf('(') > -1) {\n const p = formatStr.split('(');\n formatName = p[0].toLowerCase().trim();\n\n const optStr = p[1].substring(0, p[1].length - 1);\n\n // extra for currency\n if (formatName === 'currency' && optStr.indexOf(':') < 0) {\n if (!formatOptions.currency) formatOptions.currency = optStr.trim();\n } else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {\n if (!formatOptions.range) formatOptions.range = optStr.trim();\n } else {\n const opts = optStr.split(';');\n\n opts.forEach((opt) => {\n if (!opt) return;\n const [key, ...rest] = opt.split(':');\n const val = rest\n .join(':')\n .trim()\n .replace(/^'+|'+$/g, ''); // trim and replace ''\n\n if (!formatOptions[key.trim()]) formatOptions[key.trim()] = val;\n if (val === 'false') formatOptions[key.trim()] = false;\n if (val === 'true') formatOptions[key.trim()] = true;\n // eslint-disable-next-line no-restricted-globals\n if (!isNaN(val)) formatOptions[key.trim()] = parseInt(val, 10);\n });\n }\n }\n\n return {\n formatName,\n formatOptions,\n };\n}\n\nfunction createCachedFormatter(fn) {\n const cache = {};\n return function invokeFormatter(val, lng, options) {\n const key = lng + JSON.stringify(options);\n let formatter = cache[key];\n if (!formatter) {\n formatter = fn(getCleanedCode(lng), options);\n cache[key] = formatter;\n }\n return formatter(val);\n };\n}\n\nclass Formatter {\n constructor(options = {}) {\n this.logger = baseLogger.create('formatter');\n\n this.options = options;\n this.formats = {\n number: createCachedFormatter((lng, opt) => {\n const formatter = new Intl.NumberFormat(lng, { ...opt });\n return (val) => formatter.format(val);\n }),\n currency: createCachedFormatter((lng, opt) => {\n const formatter = new Intl.NumberFormat(lng, { ...opt, style: 'currency' });\n return (val) => formatter.format(val);\n }),\n datetime: createCachedFormatter((lng, opt) => {\n const formatter = new Intl.DateTimeFormat(lng, { ...opt });\n return (val) => formatter.format(val);\n }),\n relativetime: createCachedFormatter((lng, opt) => {\n const formatter = new Intl.RelativeTimeFormat(lng, { ...opt });\n return (val) => formatter.format(val, opt.range || 'day');\n }),\n list: createCachedFormatter((lng, opt) => {\n const formatter = new Intl.ListFormat(lng, { ...opt });\n return (val) => formatter.format(val);\n }),\n };\n this.init(options);\n }\n\n /* eslint no-param-reassign: 0 */\n init(services, options = { interpolation: {} }) {\n const iOpts = options.interpolation;\n\n this.formatSeparator = iOpts.formatSeparator\n ? iOpts.formatSeparator\n : iOpts.formatSeparator || ',';\n }\n\n add(name, fc) {\n this.formats[name.toLowerCase().trim()] = fc;\n }\n\n addCached(name, fc) {\n this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);\n }\n\n format(value, format, lng, options = {}) {\n const formats = format.split(this.formatSeparator);\n\n const result = formats.reduce((mem, f) => {\n const { formatName, formatOptions } = parseFormatStr(f);\n\n if (this.formats[formatName]) {\n let formatted = mem;\n try {\n // options passed explicit for that formatted value\n const valOptions =\n (options && options.formatParams && options.formatParams[options.interpolationkey]) ||\n {};\n\n // language\n const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;\n\n formatted = this.formats[formatName](mem, l, {\n ...formatOptions,\n ...options,\n ...valOptions,\n });\n } catch (error) {\n this.logger.warn(error);\n }\n return formatted;\n // eslint-disable-next-line no-else-return\n } else {\n this.logger.warn(`there was no format function for ${formatName}`);\n }\n return mem;\n }, value);\n\n return result;\n }\n}\n\nexport default Formatter;\n", "import * as utils from './utils.js';\nimport baseLogger from './logger.js';\nimport EventEmitter from './EventEmitter.js';\n\nfunction removePending(q, name) {\n if (q.pending[name] !== undefined) {\n delete q.pending[name];\n q.pendingCount--;\n }\n}\n\nclass Connector extends EventEmitter {\n constructor(backend, store, services, options = {}) {\n super();\n\n this.backend = backend;\n this.store = store;\n this.services = services;\n this.languageUtils = services.languageUtils;\n this.options = options;\n this.logger = baseLogger.create('backendConnector');\n\n this.waitingReads = [];\n this.maxParallelReads = options.maxParallelReads || 10;\n this.readingCalls = 0;\n\n this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;\n this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;\n\n this.state = {};\n this.queue = [];\n\n if (this.backend && this.backend.init) {\n this.backend.init(services, options.backend, options);\n }\n }\n\n queueLoad(languages, namespaces, options, callback) {\n // find what needs to be loaded\n const toLoad = {};\n const pending = {};\n const toLoadLanguages = {};\n const toLoadNamespaces = {};\n\n languages.forEach((lng) => {\n let hasAllNamespaces = true;\n\n namespaces.forEach((ns) => {\n const name = `${lng}|${ns}`;\n\n if (!options.reload && this.store.hasResourceBundle(lng, ns)) {\n this.state[name] = 2; // loaded\n } else if (this.state[name] < 0) {\n // nothing to do for err\n } else if (this.state[name] === 1) {\n if (pending[name] === undefined) pending[name] = true;\n } else {\n this.state[name] = 1; // pending\n\n hasAllNamespaces = false;\n\n if (pending[name] === undefined) pending[name] = true;\n if (toLoad[name] === undefined) toLoad[name] = true;\n if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;\n }\n });\n\n if (!hasAllNamespaces) toLoadLanguages[lng] = true;\n });\n\n if (Object.keys(toLoad).length || Object.keys(pending).length) {\n this.queue.push({\n pending,\n pendingCount: Object.keys(pending).length,\n loaded: {},\n errors: [],\n callback,\n });\n }\n\n return {\n toLoad: Object.keys(toLoad),\n pending: Object.keys(pending),\n toLoadLanguages: Object.keys(toLoadLanguages),\n toLoadNamespaces: Object.keys(toLoadNamespaces),\n };\n }\n\n loaded(name, err, data) {\n const s = name.split('|');\n const lng = s[0];\n const ns = s[1];\n\n if (err) this.emit('failedLoading', lng, ns, err);\n\n if (data) {\n this.store.addResourceBundle(lng, ns, data, undefined, undefined, { skipCopy: true });\n }\n\n // set loaded\n this.state[name] = err ? -1 : 2;\n\n // consolidated loading done in this run - only emit once for a loaded namespace\n const loaded = {};\n\n // callback if ready\n this.queue.forEach((q) => {\n utils.pushPath(q.loaded, [lng], ns);\n removePending(q, name);\n\n if (err) q.errors.push(err);\n\n if (q.pendingCount === 0 && !q.done) {\n // only do once per loaded -> this.emit('loaded', q.loaded);\n Object.keys(q.loaded).forEach((l) => {\n if (!loaded[l]) loaded[l] = {};\n const loadedKeys = q.loaded[l];\n if (loadedKeys.length) {\n loadedKeys.forEach((n) => {\n if (loaded[l][n] === undefined) loaded[l][n] = true;\n });\n }\n });\n\n /* eslint no-param-reassign: 0 */\n q.done = true;\n if (q.errors.length) {\n q.callback(q.errors);\n } else {\n q.callback();\n }\n }\n });\n\n // emit consolidated loaded event\n this.emit('loaded', loaded);\n\n // remove done load requests\n this.queue = this.queue.filter((q) => !q.done);\n }\n\n read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {\n if (!lng.length) return callback(null, {}); // noting to load\n\n // Limit parallelism of calls to backend\n // This is needed to prevent trying to open thousands of\n // sockets or file descriptors, which can cause failures\n // and actually make the entire process take longer.\n if (this.readingCalls >= this.maxParallelReads) {\n this.waitingReads.push({ lng, ns, fcName, tried, wait, callback });\n return;\n }\n this.readingCalls++;\n\n const resolver = (err, data) => {\n this.readingCalls--;\n if (this.waitingReads.length > 0) {\n const next = this.waitingReads.shift();\n this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);\n }\n if (err && data /* = retryFlag */ && tried < this.maxRetries) {\n setTimeout(() => {\n this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);\n }, wait);\n return;\n }\n callback(err, data);\n };\n\n const fc = this.backend[fcName].bind(this.backend);\n if (fc.length === 2) {\n // no callback\n try {\n const r = fc(lng, ns);\n if (r && typeof r.then === 'function') {\n // promise\n r.then((data) => resolver(null, data)).catch(resolver);\n } else {\n // sync\n resolver(null, r);\n }\n } catch (err) {\n resolver(err);\n }\n return;\n }\n\n // normal with callback\n return fc(lng, ns, resolver);\n }\n\n /* eslint consistent-return: 0 */\n prepareLoading(languages, namespaces, options = {}, callback) {\n if (!this.backend) {\n this.logger.warn('No backend was added via i18next.use. Will not load resources.');\n return callback && callback();\n }\n\n if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);\n if (typeof namespaces === 'string') namespaces = [namespaces];\n\n const toLoad = this.queueLoad(languages, namespaces, options, callback);\n if (!toLoad.toLoad.length) {\n if (!toLoad.pending.length) callback(); // nothing to load and no pendings...callback now\n return null; // pendings will trigger callback\n }\n\n toLoad.toLoad.forEach((name) => {\n this.loadOne(name);\n });\n }\n\n load(languages, namespaces, callback) {\n this.prepareLoading(languages, namespaces, {}, callback);\n }\n\n reload(languages, namespaces, callback) {\n this.prepareLoading(languages, namespaces, { reload: true }, callback);\n }\n\n loadOne(name, prefix = '') {\n const s = name.split('|');\n const lng = s[0];\n const ns = s[1];\n\n this.read(lng, ns, 'read', undefined, undefined, (err, data) => {\n if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);\n if (!err && data)\n this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);\n\n this.loaded(name, err, data);\n });\n }\n\n saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {}) {\n if (\n this.services.utils &&\n this.services.utils.hasLoadedNamespace &&\n !this.services.utils.hasLoadedNamespace(namespace)\n ) {\n this.logger.warn(\n `did not save key \"${key}\" as the namespace \"${namespace}\" was not yet loaded`,\n 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!',\n );\n return;\n }\n\n // ignore non valid keys\n if (key === undefined || key === null || key === '') return;\n\n if (this.backend && this.backend.create) {\n const opts = {\n ...options,\n isUpdate,\n };\n const fc = this.backend.create.bind(this.backend);\n if (fc.length < 6) {\n // no callback\n try {\n let r;\n if (fc.length === 5) {\n // future callback-less api for i18next-locize-backend\n r = fc(languages, namespace, key, fallbackValue, opts);\n } else {\n r = fc(languages, namespace, key, fallbackValue);\n }\n if (r && typeof r.then === 'function') {\n // promise\n r.then((data) => clb(null, data)).catch(clb);\n } else {\n // sync\n clb(null, r);\n }\n } catch (err) {\n clb(err);\n }\n } else {\n // normal with callback\n fc(languages, namespace, key, fallbackValue, clb /* unused callback */, opts);\n }\n }\n\n // write to store to avoid resending\n if (!languages || !languages[0]) return;\n this.store.addResource(languages[0], namespace, key, fallbackValue);\n }\n}\n\nexport default Connector;\n", "export function get() {\n return {\n debug: false,\n initImmediate: true,\n\n ns: ['translation'],\n defaultNS: ['translation'],\n fallbackLng: ['dev'],\n fallbackNS: false, // string or array of namespaces\n\n supportedLngs: false, // array with supported languages\n nonExplicitSupportedLngs: false,\n load: 'all', // | currentOnly | languageOnly\n preload: false, // array with preload languages\n\n simplifyPluralSuffix: true,\n keySeparator: '.',\n nsSeparator: ':',\n pluralSeparator: '_',\n contextSeparator: '_',\n\n partialBundledLanguages: false, // allow bundling certain languages that are not remotely fetched\n saveMissing: false, // enable to send missing values\n updateMissing: false, // enable to update default values if different from translated value (only useful on initial development, or when keeping code as source of truth)\n saveMissingTo: 'fallback', // 'current' || 'all'\n saveMissingPlurals: true, // will save all forms not only singular key\n missingKeyHandler: false, // function(lng, ns, key, fallbackValue) -> override if prefer on handling\n missingInterpolationHandler: false, // function(str, match)\n\n postProcess: false, // string or array of postProcessor names\n postProcessPassResolved: false, // pass resolved object into 'options.i18nResolved' for postprocessor\n returnNull: false, // allows null value as valid translation\n returnEmptyString: true, // allows empty string value as valid translation\n returnObjects: false,\n joinArrays: false, // or string to join array\n returnedObjectHandler: false, // function(key, value, options) triggered if key returns object but returnObjects is set to false\n parseMissingKeyHandler: false, // function(key) parsed a key that was not found in t() before returning\n appendNamespaceToMissingKey: false,\n appendNamespaceToCIMode: false,\n overloadTranslationOptionHandler: function handle(args) {\n let ret = {};\n if (typeof args[1] === 'object') ret = args[1];\n if (typeof args[1] === 'string') ret.defaultValue = args[1];\n if (typeof args[2] === 'string') ret.tDescription = args[2];\n if (typeof args[2] === 'object' || typeof args[3] === 'object') {\n const options = args[3] || args[2];\n Object.keys(options).forEach((key) => {\n ret[key] = options[key];\n });\n }\n return ret;\n },\n interpolation: {\n escapeValue: true,\n /** @type {import('i18next').FormatFunction} */\n format: (value) => value,\n prefix: '{{',\n suffix: '}}',\n formatSeparator: ',',\n // prefixEscaped: '{{',\n // suffixEscaped: '}}',\n // unescapeSuffix: '',\n unescapePrefix: '-',\n\n nestingPrefix: '$t(',\n nestingSuffix: ')',\n nestingOptionsSeparator: ',',\n // nestingPrefixEscaped: '$t(',\n // nestingSuffixEscaped: ')',\n // defaultVariables: undefined // object that can have values to interpolate on - extends passed in interpolation data\n maxReplaces: 1000, // max replaces to prevent endless loop\n skipOnVariables: true,\n },\n };\n}\n\n/* eslint no-param-reassign: 0 */\nexport function transformOptions(options) {\n // create namespace object if namespace is passed in as string\n if (typeof options.ns === 'string') options.ns = [options.ns];\n if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];\n if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];\n\n // extend supportedLngs with cimode\n if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {\n options.supportedLngs = options.supportedLngs.concat(['cimode']);\n }\n\n return options;\n}\n", "import baseLogger from './logger.js';\nimport EventEmitter from './EventEmitter.js';\nimport ResourceStore from './ResourceStore.js';\nimport Translator from './Translator.js';\nimport LanguageUtils from './LanguageUtils.js';\nimport PluralResolver from './PluralResolver.js';\nimport Interpolator from './Interpolator.js';\nimport Formatter from './Formatter.js';\nimport BackendConnector from './BackendConnector.js';\nimport { get as getDefaults, transformOptions } from './defaults.js';\nimport postProcessor from './postProcessor.js';\nimport { defer } from './utils.js';\n\nfunction noop() { }\n\n// Binds the member functions of the given class instance so that they can be\n// destructured or used as callbacks.\nfunction bindMemberFunctions(inst) {\n const mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst))\n mems.forEach((mem) => {\n if (typeof inst[mem] === 'function') {\n inst[mem] = inst[mem].bind(inst)\n }\n })\n}\n\nclass I18n extends EventEmitter {\n constructor(options = {}, callback) {\n super();\n\n this.options = transformOptions(options);\n this.services = {};\n this.logger = baseLogger;\n this.modules = { external: [] };\n\n bindMemberFunctions(this);\n\n if (callback && !this.isInitialized && !options.isClone) {\n // https://github.com/i18next/i18next/issues/879\n if (!this.options.initImmediate) {\n this.init(options, callback);\n return this;\n }\n setTimeout(() => {\n this.init(options, callback);\n }, 0);\n }\n }\n\n init(options = {}, callback) {\n this.isInitializing = true;\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n\n if (!options.defaultNS && options.defaultNS !== false && options.ns) {\n if (typeof options.ns === 'string') {\n options.defaultNS = options.ns;\n } else if (options.ns.indexOf('translation') < 0) {\n options.defaultNS = options.ns[0];\n }\n }\n\n const defOpts = getDefaults();\n this.options = { ...defOpts, ...this.options, ...transformOptions(options) };\n if (this.options.compatibilityAPI !== 'v1') {\n this.options.interpolation = { ...defOpts.interpolation, ...this.options.interpolation }; // do not use reference\n }\n if (options.keySeparator !== undefined) {\n this.options.userDefinedKeySeparator = options.keySeparator;\n }\n if (options.nsSeparator !== undefined) {\n this.options.userDefinedNsSeparator = options.nsSeparator;\n }\n\n function createClassOnDemand(ClassOrObject) {\n if (!ClassOrObject) return null;\n if (typeof ClassOrObject === 'function') return new ClassOrObject();\n return ClassOrObject;\n }\n\n // init services\n if (!this.options.isClone) {\n if (this.modules.logger) {\n baseLogger.init(createClassOnDemand(this.modules.logger), this.options);\n } else {\n baseLogger.init(null, this.options);\n }\n\n let formatter;\n if (this.modules.formatter) {\n formatter = this.modules.formatter;\n } else if (typeof Intl !== 'undefined') {\n formatter = Formatter;\n }\n\n const lu = new LanguageUtils(this.options);\n this.store = new ResourceStore(this.options.resources, this.options);\n\n const s = this.services;\n s.logger = baseLogger;\n s.resourceStore = this.store;\n s.languageUtils = lu;\n s.pluralResolver = new PluralResolver(lu, {\n prepend: this.options.pluralSeparator,\n compatibilityJSON: this.options.compatibilityJSON,\n simplifyPluralSuffix: this.options.simplifyPluralSuffix,\n });\n\n if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {\n s.formatter = createClassOnDemand(formatter);\n s.formatter.init(s, this.options);\n\n this.options.interpolation.format = s.formatter.format.bind(s.formatter);\n }\n\n s.interpolator = new Interpolator(this.options);\n s.utils = {\n hasLoadedNamespace: this.hasLoadedNamespace.bind(this)\n }\n\n s.backendConnector = new BackendConnector(\n createClassOnDemand(this.modules.backend),\n s.resourceStore,\n s,\n this.options,\n );\n // pipe events from backendConnector\n s.backendConnector.on('*', (event, ...args) => {\n this.emit(event, ...args);\n });\n\n if (this.modules.languageDetector) {\n s.languageDetector = createClassOnDemand(this.modules.languageDetector);\n if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);\n }\n\n if (this.modules.i18nFormat) {\n s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);\n if (s.i18nFormat.init) s.i18nFormat.init(this);\n }\n\n this.translator = new Translator(this.services, this.options);\n // pipe events from translator\n this.translator.on('*', (event, ...args) => {\n this.emit(event, ...args);\n });\n\n this.modules.external.forEach(m => {\n if (m.init) m.init(this);\n });\n }\n\n this.format = this.options.interpolation.format;\n if (!callback) callback = noop;\n\n if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {\n const codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng)\n if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0]\n }\n if (!this.services.languageDetector && !this.options.lng) {\n this.logger.warn('init: no languageDetector is used and no lng is defined');\n }\n\n // append api\n const storeApi = [\n 'getResource',\n 'hasResourceBundle',\n 'getResourceBundle',\n 'getDataByLanguage',\n ];\n storeApi.forEach(fcName => {\n this[fcName] = (...args) => this.store[fcName](...args);\n });\n const storeApiChained = [\n 'addResource',\n 'addResources',\n 'addResourceBundle',\n 'removeResourceBundle',\n ];\n storeApiChained.forEach(fcName => {\n this[fcName] = (...args) => {\n this.store[fcName](...args);\n return this;\n };\n });\n\n const deferred = defer();\n\n const load = () => {\n const finish = (err, t) => {\n this.isInitializing = false;\n if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn('init: i18next is already initialized. You should call init just once!');\n this.isInitialized = true;\n if (!this.options.isClone) this.logger.log('initialized', this.options);\n this.emit('initialized', this.options);\n\n deferred.resolve(t); // not rejecting on err (as err is only a loading translation failed warning)\n callback(err, t);\n };\n // fix for use cases when calling changeLanguage before finished to initialized (i.e. https://github.com/i18next/i18next/issues/1552)\n if (this.languages && this.options.compatibilityAPI !== 'v1' && !this.isInitialized) return finish(null, this.t.bind(this));\n this.changeLanguage(this.options.lng, finish);\n };\n\n if (this.options.resources || !this.options.initImmediate) {\n load();\n } else {\n setTimeout(load, 0);\n }\n\n return deferred;\n }\n\n /* eslint consistent-return: 0 */\n loadResources(language, callback = noop) {\n let usedCallback = callback;\n const usedLng = typeof language === 'string' ? language : this.language;\n if (typeof language === 'function') usedCallback = language;\n\n if (!this.options.resources || this.options.partialBundledLanguages) {\n if (usedLng && usedLng.toLowerCase() === 'cimode' && (!this.options.preload || this.options.preload.length === 0)) return usedCallback(); // avoid loading resources for cimode\n\n const toLoad = [];\n\n const append = lng => {\n if (!lng) return;\n if (lng === 'cimode') return;\n const lngs = this.services.languageUtils.toResolveHierarchy(lng);\n lngs.forEach(l => {\n if (l === 'cimode') return;\n if (toLoad.indexOf(l) < 0) toLoad.push(l);\n });\n };\n\n if (!usedLng) {\n // at least load fallbacks in this case\n const fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);\n fallbacks.forEach(l => append(l));\n } else {\n append(usedLng);\n }\n\n if (this.options.preload) {\n this.options.preload.forEach(l => append(l));\n }\n\n this.services.backendConnector.load(toLoad, this.options.ns, (e) => {\n if (!e && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);\n usedCallback(e);\n });\n } else {\n usedCallback(null);\n }\n }\n\n reloadResources(lngs, ns, callback) {\n const deferred = defer();\n if (!lngs) lngs = this.languages;\n if (!ns) ns = this.options.ns;\n if (!callback) callback = noop;\n this.services.backendConnector.reload(lngs, ns, err => {\n deferred.resolve(); // not rejecting on err (as err is only a loading translation failed warning)\n callback(err);\n });\n return deferred;\n }\n\n use(module) {\n if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()')\n if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()')\n\n if (module.type === 'backend') {\n this.modules.backend = module;\n }\n\n if (module.type === 'logger' || (module.log && module.warn && module.error)) {\n this.modules.logger = module;\n }\n\n if (module.type === 'languageDetector') {\n this.modules.languageDetector = module;\n }\n\n if (module.type === 'i18nFormat') {\n this.modules.i18nFormat = module;\n }\n\n if (module.type === 'postProcessor') {\n postProcessor.addPostProcessor(module);\n }\n\n if (module.type === 'formatter') {\n this.modules.formatter = module;\n }\n\n if (module.type === '3rdParty') {\n this.modules.external.push(module);\n }\n\n return this;\n }\n\n setResolvedLanguage(l) {\n if (!l || !this.languages) return;\n if (['cimode', 'dev'].indexOf(l) > -1) return;\n for (let li = 0; li < this.languages.length; li++) {\n const lngInLngs = this.languages[li];\n if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;\n if (this.store.hasLanguageSomeTranslations(lngInLngs)) {\n this.resolvedLanguage = lngInLngs;\n break;\n }\n }\n }\n\n changeLanguage(lng, callback) {\n this.isLanguageChangingTo = lng;\n const deferred = defer();\n this.emit('languageChanging', lng);\n\n const setLngProps = (l) => {\n this.language = l;\n this.languages = this.services.languageUtils.toResolveHierarchy(l);\n // find the first language resolved language\n this.resolvedLanguage = undefined;\n this.setResolvedLanguage(l);\n };\n\n const done = (err, l) => {\n if (l) {\n setLngProps(l);\n this.translator.changeLanguage(l);\n this.isLanguageChangingTo = undefined;\n this.emit('languageChanged', l);\n this.logger.log('languageChanged', l);\n } else {\n this.isLanguageChangingTo = undefined;\n }\n\n deferred.resolve((...args) => this.t(...args));\n if (callback) callback(err, (...args) => this.t(...args));\n };\n\n const setLng = lngs => {\n // if detected lng is falsy, set it to empty array, to make sure at least the fallbackLng will be used\n if (!lng && !lngs && this.services.languageDetector) lngs = [];\n // depending on API in detector lng can be a string (old) or an array of languages ordered in priority\n const l = typeof lngs === 'string' ? lngs : this.services.languageUtils.getBestMatchFromCodes(lngs);\n\n if (l) {\n if (!this.language) {\n setLngProps(l);\n }\n if (!this.translator.language) this.translator.changeLanguage(l);\n\n if (this.services.languageDetector && this.services.languageDetector.cacheUserLanguage) this.services.languageDetector.cacheUserLanguage(l);\n }\n\n this.loadResources(l, err => {\n done(err, l);\n });\n };\n\n if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {\n setLng(this.services.languageDetector.detect());\n } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {\n if (this.services.languageDetector.detect.length === 0) {\n this.services.languageDetector.detect().then(setLng);\n } else {\n this.services.languageDetector.detect(setLng);\n }\n } else {\n setLng(lng);\n }\n\n return deferred;\n }\n\n getFixedT(lng, ns, keyPrefix) {\n const fixedT = (key, opts, ...rest) => {\n let options;\n if (typeof opts !== 'object') {\n options = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));\n } else {\n options = { ...opts };\n }\n\n options.lng = options.lng || fixedT.lng;\n options.lngs = options.lngs || fixedT.lngs;\n options.ns = options.ns || fixedT.ns;\n options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;\n\n const keySeparator = this.options.keySeparator || '.';\n let resultKey\n if (options.keyPrefix && Array.isArray(key)) {\n resultKey = key.map(k => `${options.keyPrefix}${keySeparator}${k}`);\n } else {\n resultKey = options.keyPrefix ? `${options.keyPrefix}${keySeparator}${key}` : key;\n }\n return this.t(resultKey, options);\n };\n if (typeof lng === 'string') {\n fixedT.lng = lng;\n } else {\n fixedT.lngs = lng;\n }\n fixedT.ns = ns;\n fixedT.keyPrefix = keyPrefix;\n return fixedT;\n }\n\n t(...args) {\n return this.translator && this.translator.translate(...args);\n }\n\n exists(...args) {\n return this.translator && this.translator.exists(...args);\n }\n\n setDefaultNamespace(ns) {\n this.options.defaultNS = ns;\n }\n\n hasLoadedNamespace(ns, options = {}) {\n if (!this.isInitialized) {\n this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);\n return false;\n }\n if (!this.languages || !this.languages.length) {\n this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);\n return false;\n }\n\n const lng = options.lng || this.resolvedLanguage || this.languages[0];\n const fallbackLng = this.options ? this.options.fallbackLng : false;\n const lastLng = this.languages[this.languages.length - 1];\n\n // we're in cimode so this shall pass\n if (lng.toLowerCase() === 'cimode') return true;\n\n const loadNotPending = (l, n) => {\n const loadState = this.services.backendConnector.state[`${l}|${n}`];\n return loadState === -1 || loadState === 2;\n };\n\n // optional injected check\n if (options.precheck) {\n const preResult = options.precheck(this, loadNotPending);\n if (preResult !== undefined) return preResult;\n }\n\n // loaded -> SUCCESS\n if (this.hasResourceBundle(lng, ns)) return true;\n\n // were not loading at all -> SEMI SUCCESS\n if (!this.services.backendConnector.backend || (this.options.resources && !this.options.partialBundledLanguages)) return true;\n\n // failed loading ns - but at least fallback is not pending -> SEMI SUCCESS\n if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;\n\n return false;\n }\n\n loadNamespaces(ns, callback) {\n const deferred = defer();\n\n if (!this.options.ns) {\n if (callback) callback();\n return Promise.resolve();\n }\n if (typeof ns === 'string') ns = [ns];\n\n ns.forEach(n => {\n if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);\n });\n\n this.loadResources(err => {\n deferred.resolve();\n if (callback) callback(err);\n });\n\n return deferred;\n }\n\n loadLanguages(lngs, callback) {\n const deferred = defer();\n\n if (typeof lngs === 'string') lngs = [lngs];\n const preloaded = this.options.preload || [];\n\n const newLngs = lngs.filter(lng => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));\n // Exit early if all given languages are already preloaded\n if (!newLngs.length) {\n if (callback) callback();\n return Promise.resolve();\n }\n\n this.options.preload = preloaded.concat(newLngs);\n this.loadResources(err => {\n deferred.resolve();\n if (callback) callback(err);\n });\n\n return deferred;\n }\n\n dir(lng) {\n if (!lng) lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);\n if (!lng) return 'rtl';\n\n const rtlLngs = [\n 'ar',\n 'shu',\n 'sqr',\n 'ssh',\n 'xaa',\n 'yhd',\n 'yud',\n 'aao',\n 'abh',\n 'abv',\n 'acm',\n 'acq',\n 'acw',\n 'acx',\n 'acy',\n 'adf',\n 'ads',\n 'aeb',\n 'aec',\n 'afb',\n 'ajp',\n 'apc',\n 'apd',\n 'arb',\n 'arq',\n 'ars',\n 'ary',\n 'arz',\n 'auz',\n 'avl',\n 'ayh',\n 'ayl',\n 'ayn',\n 'ayp',\n 'bbz',\n 'pga',\n 'he',\n 'iw',\n 'ps',\n 'pbt',\n 'pbu',\n 'pst',\n 'prp',\n 'prd',\n 'ug',\n 'ur',\n 'ydd',\n 'yds',\n 'yih',\n 'ji',\n 'yi',\n 'hbo',\n 'men',\n 'xmn',\n 'fa',\n 'jpr',\n 'peo',\n 'pes',\n 'prs',\n 'dv',\n 'sam',\n 'ckb'\n ];\n\n const languageUtils = (this.services && this.services.languageUtils) || new LanguageUtils(getDefaults()) // for uninitialized usage\n\n return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1\n ? 'rtl'\n : 'ltr';\n }\n\n static createInstance(options = {}, callback) { return new I18n(options, callback) }\n\n cloneInstance(options = {}, callback = noop) {\n const forkResourceStore = options.forkResourceStore;\n if (forkResourceStore) delete options.forkResourceStore;\n const mergedOptions = { ...this.options, ...options, ...{ isClone: true } };\n const clone = new I18n(mergedOptions);\n if ((options.debug !== undefined || options.prefix !== undefined)) {\n clone.logger = clone.logger.clone(options);\n }\n const membersToCopy = ['store', 'services', 'language'];\n membersToCopy.forEach(m => {\n clone[m] = this[m];\n });\n clone.services = { ...this.services };\n clone.services.utils = {\n hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)\n };\n if (forkResourceStore) {\n clone.store = new ResourceStore(this.store.data, mergedOptions);\n clone.services.resourceStore = clone.store;\n }\n clone.translator = new Translator(clone.services, mergedOptions);\n clone.translator.on('*', (event, ...args) => {\n clone.emit(event, ...args);\n });\n clone.init(mergedOptions, callback);\n clone.translator.options = mergedOptions; // sync options\n clone.translator.backendConnector.services.utils = {\n hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)\n };\n\n return clone;\n }\n\n toJSON() {\n return {\n options: this.options,\n store: this.store,\n language: this.language,\n languages: this.languages,\n resolvedLanguage: this.resolvedLanguage\n };\n }\n}\n\nconst instance = I18n.createInstance();\ninstance.createInstance = I18n.createInstance;\n\nexport default instance;\n", "import i18next from './i18next.js';\n\nexport default i18next;\n\nexport const createInstance = i18next.createInstance;\n\nexport const dir = i18next.dir;\nexport const init = i18next.init;\nexport const loadResources = i18next.loadResources;\nexport const reloadResources = i18next.reloadResources;\nexport const use = i18next.use;\nexport const changeLanguage = i18next.changeLanguage;\nexport const getFixedT = i18next.getFixedT;\nexport const t = i18next.t;\nexport const exists = i18next.exists;\nexport const setDefaultNamespace = i18next.setDefaultNamespace;\nexport const hasLoadedNamespace = i18next.hasLoadedNamespace;\nexport const loadNamespaces = i18next.loadNamespaces;\nexport const loadLanguages = i18next.loadLanguages;\n", "export var resources = {\r\n\t\"en\": {\r\n\t\ttranslation: {}\r\n\t},\r\n\t\"ja\": {\r\n\t\ttranslation: {\r\n\t\t\t\"Select\" : \"\u9078\u629E\",\r\n\t\t\t\"Text\" : \"\u6587\u5B57\",\r\n\t\t\t\"Unimplemented\" : \"\u672A\u5B9F\u88C5\",\r\n\t\t\t\"Done\" : '\u6E08',\r\n\t\t\t\"Save\": \"\u4FDD\u5B58\",\r\n\t\t\t\"List\": \"\u4E00\u89A7\",\r\n\t\t\t\"Search\": \"\u691C\u7D22\",\r\n\t\t\t\"Clear\": \"\u30AF\u30EA\u30A2\",\r\n\t\t\t\"Redraw\": \"\u518D\u63CF\u753B\",\r\n\t\t\t\"Undo\": \"Undo\",\r\n\t\t\t\"Overwrite\": \"\u8FFD\u52A0\u4FDD\u5B58\",\r\n\t\t\t\"Select a figure to overwrite\": \"\u4E0A\u66F8\u304D\u3059\u308B\u56F3\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\",\r\n\t\t\t\"<- OK to overwrite?\": \"\u306B\u8FFD\u52A0\u66F8\u304D\u8FBC\u307F\u3057\u307E\u3059\u304B\uFF1F\",\r\n\t\t\t\"14px 'Helvetica'\": \"14px '\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF'\",\r\n\t\t\t\"16px 'Helvetica'\": \"16px '\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF'\",\r\n\t\t\t\"20px 'Helvetica'\": \"20px '\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF'\",\r\n\t\t\t\"String\": \"\u6587\u5B57\u5217\",\r\n\t\t\t\"Size\": \"\u30B5\u30A4\u30BA\",\r\n\t\t\t\"Input image size in pixels\": \"\u753B\u50CF\u30B5\u30A4\u30BA\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044(\u30D4\u30AF\u30BB\u30EB)\",\r\n\t\t},\r\n\t\tfont : {\r\n\t\t\t\"orn\" : \"10px MS Gothic\",\r\n\t\t\t\"Potato\" : \"10px MS Gothic\"\r\n\t\t}\r\n\t}\r\n}\r\n"], 5 "mappings": "icAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,kBAAAE,KCEA,SAASC,GAAUC,EAAS,CAC1B,OAAQ,OAAOA,EAAY,KAAiBA,IAAY,IAC1D,CAGA,SAASC,GAASD,EAAS,CACzB,OAAQ,OAAOA,GAAY,UAAcA,IAAY,IACvD,CAGA,SAASE,GAAQC,EAAU,CACzB,OAAI,MAAM,QAAQ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,QAAS,OAAQ,MAAO,QAAS,OAAO,EACpDyD,GAAW,CAAC,MAASoH,GAAO,KAAQC,GAAM,IAAOE,GAAK,MAASD,GAAO,MAASxM,EAAK,EACpFjC,GAAK,EAAGC,GAAK,EAAGC,GAAK,KAAMC,GAAK,IAChCC,GAAK,GAAIC,GAAK,GAAIC,GAAK,IAAKC,GAAK,IACjCnB,GAAM,GAAIkC,GAAMlB,GAAIyB,GAAM,IAAKG,GAAM,IACrCnC,GAAM,GAAI0B,GAAM,GAAIO,GAAM,GAAIzC,EAAM,GAAIC,EAAM,GAC9CK,EAAWmF,EAAQ,OAAQhE,GAAU,QAASE,GAAW,EACzD2G,EAAY,KACZpF,EAAS3E,EAAW,CAAC,EAAEwC,GAAI,EAAEC,EAAE,EAAI,CAAC,EAAE,EAAG,EAAE,CAAC,EAI5CqM,GAAY,KAIZkB,EAAY,KAGZ/D,GAAiB,CAAC,KAAM,OAAQ,KAAM,CAAC,KAAKzJ,GAAI,IAAIC,EAAE,CAAC,EAKvD+G,GAAU9D,EAAYuG,EAAc,EAMpCnF,GAAO,KAEXlG,EAAO,CACP,CAGAf,GAAa,UAAU,qBAAuB,UAAU,CACvD,IAAI6M,EAAU,KACd,GAAG,CAEFA,EAAU,IAAI,cACf,MACQ,CACP,GAAG,CAEFA,EAAU,IAAI,cAAc,gBAAgB,CAC7C,MACQ,CACP,GAAG,CACFA,EAAU,IAAI,cAAc,mBAAmB,CAChD,MACQ,CACP,OAAO,IACR,CACD,CACD,CACA,OAAOA,CACR", 6 "names": ["SketchCanvas_exports", "__export", "SketchCanvas", "isNothing", "subject", "isObject", "toArray", "sequence", "extend", "target", "source", "index", "length", "key", "sourceKeys", "repeat", "string", "count", "result", "cycle", "isNegativeZero", "number", "isNothing_1", "isObject_1", "toArray_1", "repeat_1", "isNegativeZero_1", "extend_1", "common", "formatError", "exception", "compact", "where", "message", "YAMLException$1", "reason", "mark", "getLine", "buffer", "lineStart", "lineEnd", "position", "maxLineLength", "head", "tail", "maxHalfLength", "padStart", "max", "makeSnippet", "options", "re", "lineStarts", "lineEnds", "match", "foundLineNo", "i", "line", "lineNoLength", "snippet", "TYPE_CONSTRUCTOR_OPTIONS", "YAML_NODE_KINDS", "compileStyleAliases", "map", "style", "alias", "Type$1", "tag", "name", "data", "type", "compileList", "schema", "currentType", "newIndex", "previousType", "previousIndex", "compileMap", "collectType", "Schema$1", "definition", "implicit", "explicit", "type$1", "str", "seq", "failsafe", "resolveYamlNull", "constructYamlNull", "isNull", "object", "_null", "resolveYamlBoolean", "constructYamlBoolean", "isBoolean", "bool", "isHexCode", "c", "isOctCode", "isDecCode", "resolveYamlInteger", "hasDigits", "ch", "constructYamlInteger", "value", "sign", "isInteger", "int", "obj", "YAML_FLOAT_PATTERN", "resolveYamlFloat", "constructYamlFloat", "SCIENTIFIC_WITHOUT_DOT", "representYamlFloat", "res", "isFloat", "float", "json", "core", "YAML_DATE_REGEXP", "YAML_TIMESTAMP_REGEXP", "resolveYamlTimestamp", "constructYamlTimestamp", "year", "month", "day", "hour", "minute", "second", "fraction", "delta", "tz_hour", "tz_minute", "date", "representYamlTimestamp", "timestamp", "resolveYamlMerge", "merge", "BASE64_MAP", "resolveYamlBinary", "code", "idx", "bitlen", "constructYamlBinary", "tailbits", "input", "bits", "representYamlBinary", "isBinary", "binary", "_hasOwnProperty$3", "_toString$2", "resolveYamlOmap", "objectKeys", "pair", "pairKey", "pairHasKey", "constructYamlOmap", "omap", "_toString$1", "resolveYamlPairs", "keys", "constructYamlPairs", "pairs", "_hasOwnProperty$2", "resolveYamlSet", "constructYamlSet", "set", "_default", "_hasOwnProperty$1", "CONTEXT_FLOW_IN", "CONTEXT_FLOW_OUT", "CONTEXT_BLOCK_IN", "CONTEXT_BLOCK_OUT", "CHOMPING_CLIP", "CHOMPING_STRIP", "CHOMPING_KEEP", "PATTERN_NON_PRINTABLE", "PATTERN_NON_ASCII_LINE_BREAKS", "PATTERN_FLOW_INDICATORS", "PATTERN_TAG_HANDLE", "PATTERN_TAG_URI", "_class", "is_EOL", "is_WHITE_SPACE", "is_WS_OR_EOL", "is_FLOW_INDICATOR", "fromHexCode", "lc", "escapedHexLen", "fromDecimalCode", "simpleEscapeSequence", "charFromCodepoint", "simpleEscapeCheck", "simpleEscapeMap", "State$1", "generateError", "state", "throwError", "throwWarning", "directiveHandlers", "args", "major", "minor", "handle", "prefix", "captureSegment", "start", "end", "checkJson", "_position", "_length", "_character", "_result", "mergeMappings", "destination", "overridableKeys", "quantity", "storeMappingPair", "keyTag", "keyNode", "valueNode", "startLine", "startLineStart", "startPos", "readLineBreak", "skipSeparationSpace", "allowComments", "checkIndent", "lineBreaks", "testDocumentSeparator", "writeFoldedLines", "readPlainScalar", "nodeIndent", "withinFlowCollection", "preceding", "following", "captureStart", "captureEnd", "hasPendingContent", "_line", "_lineStart", "_lineIndent", "_kind", "readSingleQuotedScalar", "readDoubleQuotedScalar", "hexLength", "hexResult", "tmp", "readFlowCollection", "readNext", "_pos", "_tag", "_anchor", "terminator", "isPair", "isExplicitPair", "isMapping", "composeNode", "readBlockScalar", "folding", "chomping", "didReadContent", "detectedIndent", "textIndent", "emptyLines", "atMoreIndented", "readBlockSequence", "detected", "readBlockMapping", "flowIndent", "allowCompact", "_keyLine", "_keyLineStart", "_keyPos", "atExplicitKey", "readTagProperty", "isVerbatim", "isNamed", "tagHandle", "tagName", "readAnchorProperty", "readAlias", "parentIndent", "nodeContext", "allowToSeek", "allowBlockStyles", "allowBlockScalars", "allowBlockCollections", "indentStatus", "atNewLine", "hasContent", "typeIndex", "typeQuantity", "typeList", "blockIndent", "readDocument", "documentStart", "directiveName", "directiveArgs", "hasDirectives", "loadDocuments", "nullpos", "loadAll$1", "iterator", "documents", "load$1", "loadAll_1", "load_1", "loader", "_toString", "_hasOwnProperty", "CHAR_BOM", "CHAR_TAB", "CHAR_LINE_FEED", "CHAR_CARRIAGE_RETURN", "CHAR_SPACE", "CHAR_EXCLAMATION", "CHAR_DOUBLE_QUOTE", "CHAR_SHARP", "CHAR_PERCENT", "CHAR_AMPERSAND", "CHAR_SINGLE_QUOTE", "CHAR_ASTERISK", "CHAR_COMMA", "CHAR_MINUS", "CHAR_COLON", "CHAR_EQUALS", "CHAR_GREATER_THAN", "CHAR_QUESTION", "CHAR_COMMERCIAL_AT", "CHAR_LEFT_SQUARE_BRACKET", "CHAR_RIGHT_SQUARE_BRACKET", "CHAR_GRAVE_ACCENT", "CHAR_LEFT_CURLY_BRACKET", "CHAR_VERTICAL_LINE", "CHAR_RIGHT_CURLY_BRACKET", "ESCAPE_SEQUENCES", "DEPRECATED_BOOLEANS_SYNTAX", "DEPRECATED_BASE60_SYNTAX", "compileStyleMap", "encodeHex", "character", "QUOTING_TYPE_SINGLE", "QUOTING_TYPE_DOUBLE", "State", "indentString", "spaces", "ind", "next", "generateNextLine", "level", "testImplicitResolving", "isWhitespace", "isPrintable", "isNsCharOrWhitespace", "isPlainSafe", "prev", "inblock", "cIsNsCharOrWhitespace", "cIsNsChar", "isPlainSafeFirst", "isPlainSafeLast", "codePointAt", "pos", "first", "needIndentIndicator", "leadingSpaceRe", "STYLE_PLAIN", "STYLE_SINGLE", "STYLE_LITERAL", "STYLE_FOLDED", "STYLE_DOUBLE", "chooseScalarStyle", "singleLineOnly", "indentPerLevel", "lineWidth", "testAmbiguousType", "quotingType", "forceQuotes", "char", "prevChar", "hasLineBreak", "hasFoldableLine", "shouldTrackWidth", "previousLineBreak", "plain", "writeScalar", "iskey", "indent", "testAmbiguity", "blockHeader", "dropEndingNewline", "foldString", "escapeString", "indentIndicator", "clip", "keep", "chomp", "width", "lineRe", "nextLF", "foldLine", "prevMoreIndented", "moreIndented", "breakRe", "curr", "escapeSeq", "writeFlowSequence", "writeNode", "writeBlockSequence", "writeFlowMapping", "objectKeyList", "objectKey", "objectValue", "pairBuffer", "writeBlockMapping", "explicitPair", "detectType", "block", "isblockseq", "tagStr", "objectOrArray", "duplicateIndex", "duplicate", "getDuplicateReferences", "objects", "duplicatesIndexes", "inspectNode", "dump$1", "dump_1", "dumper", "renamed", "from", "to", "Type", "Schema", "FAILSAFE_SCHEMA", "JSON_SCHEMA", "CORE_SCHEMA", "DEFAULT_SCHEMA", "load", "loadAll", "dump", "YAMLException", "types", "safeLoad", "safeLoadAll", "safeDump", "jsYaml", "js_yaml_default", "consoleLogger", "args", "type", "Logger", "_Logger", "concreteLogger", "options", "lvl", "prefix", "debugOnly", "moduleName", "logger_default", "EventEmitter", "events", "listener", "event", "numListeners", "args", "observer", "numTimesAdded", "i", "EventEmitter_default", "defer", "res", "rej", "promise", "resolve", "reject", "makeString", "object", "copy", "a", "s", "t", "m", "lastOfPathSeparatorRegExp", "getLastOfPath", "path", "Empty", "cleanKey", "key", "canNotTraverseDeeper", "stack", "stackIndex", "setPath", "newValue", "obj", "k", "e", "p", "last", "pushPath", "concat", "getPath", "getPathWithDefaults", "data", "defaultData", "value", "deepExtend", "target", "source", "overwrite", "prop", "regexEscape", "str", "_entityMap", "escape", "RegExpCache", "capacity", "pattern", "regExpFromCache", "regExpNew", "chars", "looksLikeObjectPathRegExpCache", "looksLikeObjectPath", "nsSeparator", "keySeparator", "possibleChars", "c", "matched", "ki", "deepFind", "tokens", "current", "i", "next", "nextPath", "j", "getCleanedCode", "code", "ResourceStore", "EventEmitter_default", "data", "options", "ns", "index", "lng", "key", "keySeparator", "ignoreJSONStructure", "path", "result", "getPath", "deepFind", "value", "setPath", "resources", "m", "deep", "overwrite", "pack", "deepExtend", "v", "ResourceStore_default", "postProcessor_default", "module", "processors", "value", "key", "options", "translator", "processor", "checkedLoadedFor", "Translator", "_Translator", "EventEmitter_default", "services", "options", "copy", "logger_default", "lng", "key", "resolved", "nsSeparator", "keySeparator", "namespaces", "wouldCheckForNsInKey", "seemsNaturalLanguage", "looksLikeObjectPath", "m", "parts", "keys", "lastKey", "returnDetails", "namespace", "appendNamespaceToCIMode", "res", "resUsedKey", "resExactUsedKey", "resType", "noObject", "joinArrays", "handleAsObjectInI18nFormat", "r", "resTypeIsArray", "newKeyToUse", "deepKey", "usedDefault", "usedKey", "needsPluralHandling", "hasDefaultValue", "defaultValueSuffix", "defaultValueSuffixOrdinalFallback", "needsZeroSuffixLookup", "defaultValue", "resForMissing", "updateMissing", "fk", "lngs", "fallbackLngs", "i", "send", "l", "k", "specificDefaultValue", "defaultForMissing", "language", "suffixes", "suffix", "skipOnVariables", "nestBef", "nb", "data", "na", "nestAft", "args", "postProcess", "postProcessorNames", "postProcessor_default", "found", "exactUsedKey", "usedLng", "usedNS", "extracted", "needsContextHandling", "codes", "ns", "code", "finalKeys", "pluralSuffix", "zeroSuffix", "ordinalPrefix", "contextKey", "possibleKey", "optionsKeys", "useOptionsReplaceForData", "prefix", "option", "Translator_default", "capitalize", "string", "LanguageUtil", "options", "logger_default", "code", "getCleanedCode", "p", "specialCases", "part", "codes", "found", "cleanedLng", "lngOnly", "supportedLng", "fallbacks", "fallbackCode", "fallbackCodes", "addCode", "c", "fc", "LanguageUtils_default", "sets", "_rulesPluralsTypes", "n", "nonIntlVersions", "intlVersions", "suffixesOrder", "createRules", "rules", "set", "l", "PluralResolver", "languageUtils", "options", "logger_default", "lng", "obj", "code", "getCleanedCode", "rule", "key", "suffix", "pluralCategory1", "pluralCategory2", "pluralCategory", "number", "count", "idx", "returnSuffix", "PluralResolver_default", "deepFindWithDefaults", "data", "defaultData", "key", "keySeparator", "ignoreJSONStructure", "path", "getPathWithDefaults", "deepFind", "Interpolator", "options", "logger_default", "value", "escape", "escapeValue", "useRawValueToEscape", "prefix", "prefixEscaped", "suffix", "suffixEscaped", "formatSeparator", "unescapeSuffix", "unescapePrefix", "nestingPrefix", "nestingPrefixEscaped", "nestingSuffix", "nestingSuffixEscaped", "nestingOptionsSeparator", "maxReplaces", "alwaysFormat", "regexEscape", "getOrResetRegExp", "existingRegExp", "pattern", "str", "lng", "match", "replaces", "regexSafe", "val", "handleFormat", "p", "k", "f", "missingInterpolationHandler", "skipOnVariables", "todo", "matchedVar", "temp", "makeString", "safeValue", "fc", "clonedOptions", "handleHasOptions", "inheritedOptions", "sep", "c", "optionsString", "matchedSingleQuotes", "matchedDoubleQuotes", "e", "formatters", "doReduce", "r", "elem", "v", "Interpolator_default", "parseFormatStr", "formatStr", "formatName", "formatOptions", "p", "optStr", "opt", "key", "rest", "val", "createCachedFormatter", "fn", "cache", "lng", "options", "formatter", "getCleanedCode", "Formatter", "logger_default", "services", "iOpts", "name", "fc", "value", "format", "mem", "f", "formatted", "valOptions", "l", "error", "Formatter_default", "removePending", "q", "name", "Connector", "EventEmitter_default", "backend", "store", "services", "options", "logger_default", "languages", "namespaces", "callback", "toLoad", "pending", "toLoadLanguages", "toLoadNamespaces", "lng", "hasAllNamespaces", "ns", "err", "data", "s", "loaded", "pushPath", "l", "loadedKeys", "n", "fcName", "tried", "wait", "resolver", "next", "fc", "r", "prefix", "namespace", "key", "fallbackValue", "isUpdate", "clb", "opts", "BackendConnector_default", "get", "args", "ret", "options", "key", "value", "transformOptions", "noop", "bindMemberFunctions", "inst", "mem", "I18n", "_I18n", "EventEmitter_default", "options", "callback", "transformOptions", "logger_default", "defOpts", "get", "createClassOnDemand", "ClassOrObject", "formatter", "Formatter_default", "lu", "LanguageUtils_default", "ResourceStore_default", "s", "PluralResolver_default", "Interpolator_default", "BackendConnector_default", "event", "args", "Translator_default", "m", "codes", "fcName", "deferred", "defer", "load", "finish", "err", "t", "language", "usedCallback", "usedLng", "toLoad", "append", "lng", "l", "e", "lngs", "ns", "module", "postProcessor_default", "li", "lngInLngs", "setLngProps", "done", "setLng", "keyPrefix", "fixedT", "key", "opts", "rest", "keySeparator", "resultKey", "k", "fallbackLng", "lastLng", "loadNotPending", "n", "loadState", "preResult", "preloaded", "newLngs", "rtlLngs", "languageUtils", "forkResourceStore", "mergedOptions", "clone", "instance", "i18next_default", "i18next_v23_11_default", "i18next_default", "createInstance", "dir", "init", "loadResources", "reloadResources", "use", "changeLanguage", "getFixedT", "t", "exists", "setDefaultNamespace", "hasLoadedNamespace", "loadNamespaces", "loadLanguages", "resources", "SketchCanvas", "canvas", "options", "editmode", "scale", "currentLanguage", "i18next_v23_11_default", "resources", "dobjs", "dhistory", "selectobj", "handleSize", "gridEnable", "gridSize", "toolButtonInterval", "onload", "mouseLeftClick", "mouseDown", "mouseUp", "mouseMove", "mouseleave", "keyDown", "viewModeClick", "ctx", "aw", "buttons", "Button", "mx0", "my0", "mh0", "debug", "toolbarPage", "toolbar", "toolbars", "cur_tool", "draw", "mw0", "resizeCanvas", "datadir", "x0", "y0", "w0", "h0", "x1", "y1", "w1", "h1", "text", "width", "drawMenu", "drawTBox", "drawButtons", "drawCBox", "cur_col", "drawHBox", "cur_thin", "drawPos", "x", "y", "i", "menus", "mx1", "mw1", "getTBox", "r", "drawParts", "no", "colstr", "mx2", "mw2", "gray", "mx3", "white", "tool", "objBounds", "obj", "rawvalue", "ret", "offset", "expandRect", "hitRect", "intersectRect", "r1", "r2", "e", "mouseRightClick", "clrect", "mx", "my", "choiceTBox", "menuno", "checkMenu", "bounds", "cloneObject", "j", "redraw", "updateDrawData", "colnames", "movebase", "dragstart", "dragend", "moving", "sizing", "sizedir", "pointMoving", "pointMovingIdx", "pointMovingCP", "boxselecting", "pathEditMouseDown", "n", "pts", "p", "checkVertexHandle", "self", "pointHandle", "needsRedraw", "selectCommonMouseDown", "toolmap", "selectMouseDown", "getHandleRect", "pointOnSelection", "selectMouseMove", "dx", "dy", "pt", "ux", "uy", "xscale", "yscale", "props", "prop", "box", "pathEditMouseMove", "relmove", "name", "idx", "p1", "curpoint", "nextpoint", "len", "angle", "newangle", "prevpoint", "m", "deleteShapes", "shapes", "s", "constrainCoord", "coord", "canvasToSrc", "setFont", "baseSize", "drawCanvas", "numPoints", "coltable", "metaObj", "drawHandle", "color", "circle", "clearCanvas", "ix", "iy", "cur_shape", "pathEditSelectDraw", "shape", "drawGuidingLine", "pt0", "Shape", "set_default", "t", "k", "v", "def", "dat", "alldat", "pt1", "arr", "pt2", "maxx", "maxy", "minx", "miny", "PointShape", "inherit", "height", "TextShape", "oldfont", "PathShape", "src", "set2seq", "seq2set", "last", "process", "ssrc", "serialize", "deserialize", "defaultMetaObj", "robj", "value", "js_yaml_default", "img", "reset", "origData", "selData", "downloadList", "xmlHttp", "createXMLHttpRequest", "item", "hash", "request", "firstLine", "responseCallback", "historyQuery", "res", "historyData", "setSize", "sx", "sy", "choiceMenu", "choiceCBox", "choiceHBox", "str", "newEntry", "keys", "subclass", "base", "sub", "mixin", "target", "temp", "key", "ajaxclear", "ajaxundo", "fname", "requestDelete", "data", "remoteName", "msg", "ondraw", "onclick", "MenuItem", "sizeLayer", "lay", "okbutton", "cancelbutton", "canvasRect", "scrollX", "scrollY", "seq", "set", "Tool", "points", "params", "setColorFill", "nop", "addPoint", "code", "a", "textTool", "textLayer", "linkdiv", "textInputRect", "linkInputRect", "first", "first2", "last2", "drawGuidingLineNoOffset", "next", "d", "prev", "black", "blue", "green", "red"] 7} 8