{"map":"{\"version\":3,\"file\":\"toPolar.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/operators/toPolar.ts\"],\"names\":[],\"mappings\":\"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,OAAO,EACL,SAAS,GACV,MAAM,eAAe,CAAC;AAavB,MAAM,sBAA2E,UAAa;IAC5F,MAAM,CAAC,KAAM,SAAQ,UAAU;QAO7B,OAAO,CAAC,EAAE,OAAO,EAAqC;YACpD,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;gBACxB,OAAO,GAAG,SAAS,CAAC,CAAC,CAAqB,CAAC;YAC7C,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;gBACvB,SAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAqB;oBAC/C,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;oBACrC,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;oBAErC,MAAM,CAAC;wBACL,kEAAkE;wBAClE,kEAAkE;wBAClE,8BAA8B;wBAC9B,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,SAAA,MAAM,EAAI,CAAC,CAAA,GAAG,SAAA,MAAM,EAAI,CAAC,CAAA,CAAC;wBAC9C,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC;qBAClC,CAAC;gBACJ,CAAC;gBACD,MAAM,EAAE;oBACN,MAAM,EAAE,OAAO;iBAChB;aACF,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC\"}","code":"/** @license\r\n *  Copyright 2016 - present The Material Motion Authors. All Rights Reserved.\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\r\n *  use this file except in compliance with the License. You may obtain a copy\r\n *  of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\r\n *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r\n *  License for the specific language governing permissions and limitations\r\n *  under the License.\r\n */\r\nimport { isDefined, } from '../typeGuards';\r\nexport function withToPolar(superclass) {\r\n    return class extends superclass {\r\n        toPolar({ origin$ }) {\r\n            if (!isDefined(origin$)) {\r\n                origin$ = arguments[0];\r\n            }\r\n            return this._reactiveMap({\r\n                transform({ upstream, origin }) {\r\n                    const deltaX = upstream.x - origin.x;\r\n                    const deltaY = upstream.y - origin.y;\r\n                    return {\r\n                        // Inlining Pythagorean theorem instead of using `combineLatest` +\r\n                        // `distanceFrom`, both for simplicity and to avoid emitting twice\r\n                        // for each upstream emission.\r\n                        distance: Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)),\r\n                        angle: Math.atan2(deltaY, deltaX),\r\n                    };\r\n                },\r\n                inputs: {\r\n                    origin: origin$,\r\n                },\r\n            });\r\n        }\r\n    };\r\n}\r\n//# sourceMappingURL=toPolar.js.map","dts":{"name":"/Users/brentons/Projects/material-motion-js/packages/core/operators/toPolar.d.ts","text":"import { Constructor, MotionReactiveMappable, Observable, ObservableWithMotionOperators, Point2D, PolarCoords } from '../types';\r\nexport declare type ToPolarOrigin<T> = (T & Point2D) | (Observable<T & Point2D>);\r\nexport declare type ToPolarArgs<T> = {\r\n    origin$: ToPolarOrigin<T>;\r\n};\r\nexport interface MotionPolarizable<T> {\r\n    toPolar(kwargs: ToPolarArgs<T>): ObservableWithMotionOperators<PolarCoords>;\r\n    toPolar(origin$: ToPolarOrigin<T>): ObservableWithMotionOperators<PolarCoords>;\r\n}\r\nexport declare function withToPolar<T, S extends Constructor<MotionReactiveMappable<T>>>(superclass: S): S & Constructor<MotionPolarizable<T>>;\r\n"}}
