{"version":3,"file":"projection_definition.mjs","names":[],"sources":["../../../src/expression/types/projection_definition.ts"],"sourcesContent":["export class ProjectionDefinition {\n    readonly from: string;\n    readonly to: string;\n    readonly transition: number;\n\n    constructor(from: string, to: string, transition: number) {\n        this.from = from;\n        this.to = to;\n        this.transition = transition;\n    }\n\n    toString(): string {\n        if (this.from === this.to && this.transition === 1) {\n            return this.from;\n        }\n        return JSON.stringify([this.from, this.to, this.transition]);\n    }\n\n    static interpolate(from: string, to: string, t: number) {\n        return new ProjectionDefinition(from, to, t);\n    }\n\n    static parse(input?: any): ProjectionDefinition {\n        if (input instanceof ProjectionDefinition) {\n            return input;\n        }\n        if (\n            Array.isArray(input) &&\n            input.length === 3 &&\n            typeof input[0] === 'string' &&\n            typeof input[1] === 'string' &&\n            typeof input[2] === 'number'\n        ) {\n            return new ProjectionDefinition(input[0], input[1], input[2]);\n        }\n\n        if (\n            typeof input === 'object' &&\n            typeof input.from === 'string' &&\n            typeof input.to === 'string' &&\n            typeof input.transition === 'number'\n        ) {\n            return new ProjectionDefinition(input.from, input.to, input.transition);\n        }\n\n        if (typeof input === 'string') {\n            return new ProjectionDefinition(input, input, 1);\n        }\n        return undefined;\n    }\n}\n"],"mappings":";AAAA,IAAa,uBAAb,MAAa,qBAAqB;CAK9B,YAAY,MAAc,IAAY,YAAoB;EACtD,KAAK,OAAO;EACZ,KAAK,KAAK;EACV,KAAK,aAAa;CACtB;CAEA,WAAmB;EACf,IAAI,KAAK,SAAS,KAAK,MAAM,KAAK,eAAe,GAC7C,OAAO,KAAK;EAEhB,OAAO,KAAK,UAAU;GAAC,KAAK;GAAM,KAAK;GAAI,KAAK;EAAU,CAAC;CAC/D;CAEA,OAAO,YAAY,MAAc,IAAY,GAAW;EACpD,OAAO,IAAI,qBAAqB,MAAM,IAAI,CAAC;CAC/C;CAEA,OAAO,MAAM,OAAmC;EAC5C,IAAI,iBAAiB,sBACjB,OAAO;EAEX,IACI,MAAM,QAAQ,KAAK,KACnB,MAAM,WAAW,KACjB,OAAO,MAAM,OAAO,YACpB,OAAO,MAAM,OAAO,YACpB,OAAO,MAAM,OAAO,UAEpB,OAAO,IAAI,qBAAqB,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE;EAGhE,IACI,OAAO,UAAU,YACjB,OAAO,MAAM,SAAS,YACtB,OAAO,MAAM,OAAO,YACpB,OAAO,MAAM,eAAe,UAE5B,OAAO,IAAI,qBAAqB,MAAM,MAAM,MAAM,IAAI,MAAM,UAAU;EAG1E,IAAI,OAAO,UAAU,UACjB,OAAO,IAAI,qBAAqB,OAAO,OAAO,CAAC;CAGvD;AACJ"}