{"version":3,"file":"edgeStyle.js","names":[],"sources":["jsx/edges/edgeStyle.js"],"sourcesContent":["const edgeAppearances = {\n  flow: { path: \"smoothstep\", stroke: \"$color-9\", marker: \"arrowclosed\", weight: \"control\" },\n  data: { path: \"bezier\", stroke: \"$color-8\", marker: \"arrow\", weight: \"value\" },\n  error: {\n    path: \"smoothstep\",\n    stroke: \"$red-9\",\n    dash: \"6 4\",\n    marker: \"arrowclosed\",\n    weight: \"control\"\n  },\n  conditional: { path: \"step\", stroke: \"$color-8\", dash: \"2 4\", marker: \"arrow\", weight: \"value\" }\n};\nconst controlEdgeWeight = 1.5;\nconst edgeStrokeWidths = {\n  none: 1,\n  small: 1.5,\n  medium: 2,\n  large: 3\n};\nfunction edgeStrokeWidth(borderWidth, weight = \"value\") {\n  const base = edgeStrokeWidths[borderWidth];\n  return weight === \"control\" ? base * controlEdgeWeight : base;\n}\nconst dashAnimation = \"mp-graph-dash 0.5s linear infinite\";\nfunction isBuiltin(name) {\n  return name in edgeAppearances;\n}\nfunction edgeMarkerEnd(input) {\n  const named = input.appearance ?? input.kind;\n  return { type: edgeAppearances[isBuiltin(named) ? named : \"flow\"].marker };\n}\nconst edgeArrowhead = {\n  viewBox: \"-10 -10 20 20\",\n  size: 12.5,\n  refX: 0,\n  refY: 0,\n  points: {\n    arrow: \"-5,-4 0,0 -5,4\",\n    arrowclosed: \"-5,-4 0,0 -5,4 -5,-4\"\n  }\n};\nfunction edgeArrowheadLength(strokeWidth) {\n  const xs = edgeArrowhead.points.arrowclosed.split(\" \").map((pair) => Number(pair.split(\",\")[0]));\n  const reach = Math.max(...xs) - Math.min(...xs);\n  const unitsPerViewBox = Number(edgeArrowhead.viewBox.split(\" \")[2]);\n  return reach / unitsPerViewBox * edgeArrowhead.size * strokeWidth;\n}\nfunction themeTokenName(stroke) {\n  return stroke.startsWith(\"$\") ? stroke.slice(1) : stroke;\n}\nfunction resolveEdgeStyle(input) {\n  const named = input.appearance ?? input.kind;\n  const appearance = edgeAppearances[isBuiltin(named) ? named : \"flow\"];\n  return {\n    path: appearance.path,\n    stroke: appearance.stroke,\n    strokeWidth: edgeStrokeWidth(input.borderWidth, appearance.weight),\n    strokeDasharray: appearance.dash,\n    marker: appearance.marker,\n    // Stopping the march is not the same as erasing the dashes: the PATTERN is\n    // how a reader tells an error edge from a flow edge, so it survives\n    // `animation: \"none\"` and a reduced-motion user keeps the channel.\n    animation: appearance.dash !== void 0 && input.animation !== \"none\" ? dashAnimation : \"none\"\n  };\n}\nexport {\n  controlEdgeWeight,\n  dashAnimation,\n  edgeAppearances,\n  edgeArrowhead,\n  edgeArrowheadLength,\n  edgeMarkerEnd,\n  edgeStrokeWidth,\n  edgeStrokeWidths,\n  resolveEdgeStyle,\n  themeTokenName\n};\n//# sourceMappingURL=edgeStyle.js.map\n"],"mappings":";AAAA,MAAM,kBAAkB;CACtB,MAAM;EAAE,MAAM;EAAc,QAAQ;EAAY,QAAQ;EAAe,QAAQ;CAAU;CACzF,MAAM;EAAE,MAAM;EAAU,QAAQ;EAAY,QAAQ;EAAS,QAAQ;CAAQ;CAC7E,OAAO;EACL,MAAM;EACN,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,QAAQ;CACV;CACA,aAAa;EAAE,MAAM;EAAQ,QAAQ;EAAY,MAAM;EAAO,QAAQ;EAAS,QAAQ;CAAQ;AACjG;AACA,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;CACvB,MAAM;CACN,OAAO;CACP,QAAQ;CACR,OAAO;AACT;AACA,SAAS,gBAAgB,aAAa,SAAS,SAAS;CACtD,MAAM,OAAO,iBAAiB;CAC9B,OAAO,WAAW,YAAY,OAAO,oBAAoB;AAC3D;AACA,MAAM,gBAAgB;AACtB,SAAS,UAAU,MAAM;CACvB,OAAO,QAAQ;AACjB;AACA,SAAS,cAAc,OAAO;CAC5B,MAAM,QAAQ,MAAM,cAAc,MAAM;CACxC,OAAO,EAAE,MAAM,gBAAgB,UAAU,KAAK,IAAI,QAAQ,OAAO,CA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