/* https://github.com/pbeshai/d3-interpolate-path Copyright 2016, Peter Beshai */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).d3=t.d3||{})}(this,function(t){"use strict";function i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function u(t){var e={};return 4===t.length&&(e.x2=t[2][0],e.y2=t[2][1]),3<=t.length&&(e.x1=t[1][0],e.y1=t[1][1]),e.x=t[t.length-1][0],e.y=t[t.length-1][1],4===t.length?e.type="C":3===t.length?e.type="Q":e.type="L",e}var a=/[MLCSTQAHVmlcstqahv]|[\d.-]+/g,j={M:["x","y"],L:["x","y"],H:["x"],V:["y"],C:["x1","y1","x2","y2","x","y"],S:["x2","y2","x","y"],Q:["x1","y1","x","y"],T:["x","y"],A:["rx","ry","xAxisRotation","largeArcFlag","sweepFlag","x","y"]};function f(t,e){for(var n=Array(t),r=0;r<t;r++)n[r]=e;return n}function w(e){return"".concat(e.type).concat(j[e.type].map(function(t){return e[t]}).join(","))}function o(t,e,n){var r=[];if("L"===e.type||"Q"===e.type||"C"===e.type)r=r.concat(function(t,e,n){var r=[[t.x,t.y]];return null!=e.x1&&r.push([e.x1,e.y1]),null!=e.x2&&r.push([e.x2,e.y2]),r.push([e.x,e.y]),function(t,e){for(var n,r,u,l,o=[],a=t,i=1/(e=e||2),f=0;f<e-1;f++){var c=(r=i/(1-i*f),l=u=void 0,u=[],l=[],(n=a).length&&function t(e,n){if(1===e.length)u.push(e[0]),l.push(e[0]);else{for(var r=Array(e.length-1),o=0;o<r.length;o++)0===o&&u.push(e[0]),o===r.length-1&&l.push(e[o+1]),r[o]=[(1-n)*e[o][0]+n*e[o+1][0],(1-n)*e[o][1]+n*e[o+1][1]];t(r,n)}}(n,r),{left:u,right:l.reverse()});o.push(c.left),a=c.right}return o.push(a),o}(r,n).map(u)}(t,e,n));else{var o=i({},t);"M"===o.type&&(o.type="L"),(r=r.concat(f(n-1).map(function(){return o}))).push(e)}return r}function n(u,t,l){var e=u.length-1,n=t.length-1,a=e/n,r=f(n).reduce(function(t,e,n){var r=Math.floor(a*n);if(l&&r<u.length-1&&l(u[r],u[r+1])){var o=a*n%1<.5;t[r]&&(o?0<r?r-=1:r<u.length-1&&(r+=1):r<u.length-1?r+=1:0<r&&(r-=1))}return t[r]=(t[r]||0)+1,t},[]).reduce(function(t,e,n){if(n!==u.length-1)return t.concat(o(u[n],u[n+1],e));var r=f(e,i({},u[u.length-1]));return"M"===r[0].type&&r.forEach(function(t){t.type="L"}),t.concat(r)},[]);return r.unshift(u[0]),r}function r(t){for(var e,n,r=(t||"").match(a)||[],o=[],u=0;u<r.length;++u)if(e=j[r[u]]){n={type:r[u]};for(var l=0;l<e.length;++l)n[e[l]]=+r[u+l+1];u+=e.length,o.push(n)}return o}Object.keys(j).forEach(function(t){j[t.toLowerCase()]=j[t]}),t.interpolatePath=function(t,x,e){var d=r(t),b=r(x);if(!d.length&&!b.length)return function(){return""};d.length?b.length||b.push(d[0]):d.push(b[0]),0!==Math.abs(b.length-d.length)&&(b.length>d.length?d=n(d,b,e):b.length<d.length&&(b=n(b,d,e)));var m=(d=d.map(function(t,e){return function(r,o){var u={x1:"x",y1:"y",x2:"x",y2:"y"},l=["xAxisRotation","largeArcFlag","sweepFlag"];if(r.type!==o.type&&"M"!==o.type.toUpperCase()){var a={};Object.keys(o).forEach(function(t){var e=o[t],n=r[t];void 0===n&&(l.includes(t)?n=e:(void 0===n&&u[t]&&(n=r[u[t]]),void 0===n&&(n=0))),a[t]=n}),a.type=o.type,r=a}return r}(t,b[e])})).map(function(t){return function(o){for(var t=1;t<arguments.length;t++){var u=null!=arguments[t]?arguments[t]:{},e=Object.keys(u);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(u).filter(function(t){return Object.getOwnPropertyDescriptor(u,t).enumerable}))),e.forEach(function(t){var e,n,r;e=o,r=u[n=t],n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r})}return o}({},t)}),O=!(null!=t&&"Z"!==t[t.length-1]||null!=x&&"Z"!==x[x.length-1]);return function(t){if(1===t)return null==x?"":x;if(0<t)for(var e=0;e<m.length;++e){var n=d[e],r=b[e],o=m[e],u=!0,l=!1,a=void 0;try{for(var i,f=j[o.type][Symbol.iterator]();!(u=(i=f.next()).done);u=!0){var c=i.value;o[c]=(1-t)*n[c]+t*r[c]}}catch(t){l=!0,a=t}finally{try{u||null==f.return||f.return()}finally{if(l)throw a}}}var y="",h=!0,p=!1,g=void 0;try{for(var s,v=m[Symbol.iterator]();!(h=(s=v.next()).done);h=!0){y+=w(s.value)}}catch(t){p=!0,g=t}finally{try{h||null==v.return||v.return()}finally{if(p)throw g}}return O&&(y+="Z"),y}},Object.defineProperty(t,"__esModule",{value:!0})});