{"version":3,"file":"index.umd.cjs","names":[],"sources":["../src/__package__.ts","../src/ddl/v1.ts","../src/ddl/v2.ts","../src/dermatology.ts","../src/upgrade.ts","../schema/v2.json","../src/validate.ts","../src/index.ts"],"sourcesContent":["export const PKG_NAME = \"@hpcc-js/ddl-shim\";\nexport const PKG_VERSION = \"3.5.0\";\nexport const BUILD_VERSION = \"3.34.1\";\n","export type StringStringDict = { [key: string]: string; };\n\n//  Datasource  ===============================================================\nexport type IFilterRule = \"==\" | \"!=\" | \"<\" | \"<=\" | \">\" | \">=\" | \"set\" | \"notequals\";\nexport interface IFilter {\n    fieldid: string;\n    nullable: boolean;\n    rule: IFilterRule;\n    minid?: string;\n    maxid?: string;\n}\n\nexport interface IOutput {\n    id: string;\n    from?: string;\n    filter?: IFilter[];\n    notify?: string[];\n}\n\nexport interface IDatasource {\n    id: string;\n    filter?: IFilter[];\n    outputs: IOutput[];\n}\n\nexport interface IWorkunitDatasource extends IDatasource {\n    WUID: boolean;\n}\nexport function isWorkunitDatasource(ref: IAnyDatasource): ref is IWorkunitDatasource {\n    return (ref as IWorkunitDatasource).WUID !== undefined;\n}\n\nexport interface IDatabombDatasource extends IDatasource {\n    databomb: true;\n}\nexport function isDatabombDatasource(ref: IAnyDatasource): ref is IDatabombDatasource {\n    return (ref as IDatabombDatasource).databomb === true;\n}\n\nexport interface IHipieDatasource extends IDatasource {\n    URL: string;\n}\nexport function isHipieDatasource(ref: IAnyDatasource): ref is IHipieDatasource {\n    return (ref as IHipieDatasource).URL !== undefined;\n}\n\nexport type IAnyDatasource = IWorkunitDatasource | IDatabombDatasource | IHipieDatasource;\n//  Event  ====================================================================\nexport interface IEventUpdate {\n    visualization: string;\n    instance?: string;\n    datasource: string;\n    col?: string;\n    merge: boolean;\n    mappings?: StringStringDict;\n}\n\nexport interface IEvent {\n    mappings?: StringStringDict;  // Legacy\n    updates: IEventUpdate[];\n}\n\n//  Mappings  =================================================================\nexport interface IPieMapping {\n    label: string;\n    weight: string;\n}\n\nexport interface ILineMapping {\n    x: string[];\n    y: string[];\n}\n\nexport interface ITableMapping {\n    value: string[];\n}\n\nexport interface IChoroMapping {\n    weight: string | string[];\n}\n\nexport interface IChoroUSStateMapping extends IChoroMapping {\n    state: string;\n}\n\nexport interface IChoroUSCountyMapping extends IChoroMapping {\n    county: string;\n}\n\nexport interface IChoroGeohashMapping extends IChoroMapping {\n    geohash: string;\n}\n\nexport interface IGraphMapping {\n    uid: string;\n    label: string;\n    weight: string;\n    flags: string;\n}\n\nexport interface IGraphLinkMapping {\n    uid: string;\n}\n\nexport interface IHeatMapMapping {\n    x: string;\n    y: string;\n    weight: string;\n}\n\nexport interface ISliderMapping {\n    label: string;\n}\n//  Source  ===================================================================\nexport interface ISource {\n    id: string;\n    output: string;\n    sort?: string[];\n    first?: string | number;\n    reverse?: boolean;\n    properties?: StringStringDict;  //  TODO Needed?\n}\n\nexport interface IPieSource extends ISource {\n    mappings: IPieMapping;\n}\n\nexport interface ILineSource extends ISource {\n    mappings: ILineMapping;\n}\n\nexport interface ITableSource extends ISource {\n    mappings: ITableMapping;\n}\n\nexport interface IGraphLink {\n    mappings: IGraphLinkMapping;\n    childfile: string;\n}\n\nexport interface IGraphSource extends ISource {\n    mappings: IGraphMapping;\n    link: IGraphLink;\n}\n\nexport interface IHeatMapSource extends ISource {\n    mappings: IHeatMapMapping;\n}\n\nexport interface IChoroSource extends ISource {\n    mappings: IAnyChoroMapping;\n}\n\nexport interface ISliderSource extends ISource {\n    mappings: ISliderMapping;\n}\n\n//  Visualization  ============================================================\nexport type VisualizationType = \"PIE\" | \"LINE\" | \"BAR\" | \"TABLE\" | \"CHORO\" | \"GRAPH\" | \"HEAT_MAP\" | \"SLIDER\" | \"SUMMARY\" | \"FORM\" | \"2DCHART\" | \"WORD_CLOUD\" | \"BUBBLE\";\nexport type VisualizationFieldDataType = \"bool\" | \"boolean\" | \"integer\" | \"integer4\" | \"integer8\" | \"unsigned\" | \"unsigned4\" | \"unsigned8\" | \"float\" | \"double\" | \"real\" | \"real4\" | \"real8\" | \"string\" | \"date\" | \"time\" | \"geohash\" | \"dataset\" | \"visualization\";\nexport type VisualizationFieldType = VisualizationFieldDataType | \"range\";\nexport type VisualizationFieldFuncitonType = \"SUM\" | \"AVE\" | \"MIN\" | \"MAX\" | \"SCALE\";\n\nexport interface IVisualizationField {\n    id: string;\n    properties: {\n        label?: string;\n        datatype: VisualizationFieldDataType;\n        default?: any[];\n        function?: VisualizationFieldFuncitonType;\n        params?: {\n            param1: string;\n            param2: string;\n        }\n        type: VisualizationFieldType;\n    };\n}\n\nexport interface IVisualization {\n    id: string;\n    title?: string;\n    type: VisualizationType;\n    fields?: IVisualizationField[];\n    properties?: {\n        charttype?: string,\n\n        //  TODO Split Known Properties  ---\n        [key: string]: any\n    };\n    events?: { [key: string]: IEvent };\n    onSelect?: any;  // legacy\n    color?: any; // legacy\n}\n\nexport interface IPieVisualization extends IVisualization {\n    type: \"PIE\" | \"BAR\";\n    source: IPieSource;\n}\nexport function isPieVisualization(viz: IAnyVisualization): viz is IPieVisualization {\n    return (viz as IPieVisualization).type === \"PIE\" || (viz as IPieVisualization).type === \"BAR\";\n}\n\nexport interface ILineVisualization extends IVisualization {\n    type: \"LINE\";\n    source: ILineSource;\n}\nexport function isLineVisualization(viz: IAnyVisualization): viz is ILineVisualization {\n    return (viz as ILineVisualization).type === \"LINE\";\n}\n\nexport type ChoroColor = \"default\" | \"YlGn\" | \"YlGnBu\" | \"GnBu\" | \"BuGn\" | \"PuBuGn\" | \"PuBu\" | \"BuPu\" | \"RdPu\" | \"PuRd\" | \"OrRd\" | \"YlOrRd\" | \"YlOrBr\" | \"Purples\" | \"Blues\" | \"Greens\" | \"Oranges\" | \"Reds\" | \"Greys\" | \"PuOr\" | \"BrBG\" | \"PRGn\" | \"PiYG\" | \"RdBu\" | \"RdGy\" | \"RdYlBu\" | \"Spectral\" | \"RdYlGn\" | \"RdWhGr\";\nexport interface IChoroVisualization extends IVisualization {\n    type: \"CHORO\";\n    source: IChoroSource;\n\n    visualizations?: IChoroVisualization[];\n    color?: ChoroColor;\n}\nexport function isChoroVisualization(viz: IAnyVisualization): viz is IChoroVisualization {\n    return (viz as IChoroVisualization).type === \"CHORO\";\n}\n\nexport interface ITableVisualization extends IVisualization {\n    type: \"TABLE\";\n    label: string[];\n    source: ITableSource;\n}\nexport function isTableVisualization(viz: IAnyVisualization): viz is ITableVisualization {\n    return (viz as ITableVisualization).type === \"TABLE\";\n}\n\nexport interface ISliderVisualization extends IVisualization {\n    type: \"SLIDER\";\n    source: ISliderSource;\n    range?: number[];\n}\nexport function isSliderVisualization(viz: IAnyVisualization): viz is ISliderVisualization {\n    return (viz as ISliderVisualization).type === \"SLIDER\";\n}\n\nexport interface IIcon {\n    [id: string]: string | number | boolean;\n}\n\nexport type IValueMappings = { [key: string]: IIcon; };\n\nexport interface IVisualizationIcon {\n    fieldid?: string;\n    faChar?: string;\n    valuemappings?: IValueMappings;\n}\n\nexport interface IGraphVisualization extends IVisualization {\n    type: \"GRAPH\";\n    source: IGraphSource;\n\n    label: string[];\n    icon: IVisualizationIcon;\n    flag: IVisualizationIcon[];\n}\nexport function isGraphVisualization(viz: IAnyVisualization): viz is IGraphVisualization {\n    return (viz as IGraphVisualization).type === \"GRAPH\";\n}\n\nexport interface IHeatMapVisualization extends IVisualization {\n    type: \"HEAT_MAP\";\n    source: IHeatMapSource;\n}\nexport function isHeatMapVisualization(viz: IAnyVisualization): viz is IHeatMapVisualization {\n    return (viz as IHeatMapVisualization).type === \"HEAT_MAP\";\n}\n\nexport interface IFormVisualization extends IVisualization {\n    type: \"FORM\";\n}\nexport function isFormVisualization(viz: IAnyVisualization): viz is IFormVisualization {\n    return (viz as IFormVisualization).type === \"FORM\";\n}\n\n//  Dashboard  ================================================================\nexport interface IDashboard {\n    id?: string;\n    title?: string;\n    enable?: string;\n    label?: string;\n    primary?: boolean;\n    visualizations: IAnyVisualization[];\n}\n\nexport interface IDDL {\n    dashboards: IDashboard[];\n    datasources: IAnyDatasource[];\n    hipieversion: string;\n    visualizationversion: string;\n}\n\n//  DDL  ======================================================================\nexport type DDLSchema = IDDL;\n\n//  Helpers  ==================================================================\nexport type IAnyChoroMapping = IChoroUSStateMapping | IChoroUSCountyMapping | IChoroGeohashMapping;\nexport function isUSStateMapping(mappings: IAnyChoroMapping) {\n    return (mappings as IChoroUSStateMapping).state !== undefined;\n}\nexport function isUSCountyMapping(mappings: IAnyChoroMapping) {\n    return (mappings as IChoroUSCountyMapping).county !== undefined;\n}\nexport function isGeohashMapping(mappings: IAnyChoroMapping) {\n    return (mappings as IChoroGeohashMapping).geohash !== undefined;\n}\nexport type IAnyMapping = IPieMapping | ILineMapping | IGraphMapping | IAnyChoroMapping | ITableMapping | IHeatMapMapping;\nexport type IAnySource = IPieSource | ILineSource | ITableSource | IChoroSource | IGraphSource | IHeatMapSource;\nexport type IAnyVisualization = IPieVisualization | ILineVisualization | ITableVisualization | IChoroVisualization | IGraphVisualization | IHeatMapVisualization | ISliderVisualization | IFormVisualization;\n","export type RowType = { [key: string]: any; };\n\n//  Fields  ==============================================================\nexport type Number64 = string;\nexport type Range = [number | string, number | string];\nexport type Dataset = any[];\nexport type IFieldType = \"boolean\" | \"number\" | \"number64\" | \"string\" | \"range\" | \"dataset\" | \"set\" | \"object\";\n\nexport interface IFieldBoolean {\n    type: \"boolean\";\n    id: string;\n    default?: boolean;\n}\n\nexport interface IFieldNumber {\n    type: \"number\";\n    id: string;\n    default?: number;\n}\n\nexport interface IFieldNumber64 {\n    type: \"number64\";\n    id: string;\n    default?: Number64;\n}\n\nexport interface IFieldString {\n    type: \"string\";\n    id: string;\n    default?: string;\n}\n\nexport interface IFieldRange {\n    type: \"range\";\n    id: string;\n    default?: Range;\n}\n\nexport interface IFieldDataset {\n    type: \"dataset\";\n    id: string;\n    default?: Dataset;\n    children: IField[];\n}\n\nexport interface IFieldSet {\n    type: \"set\";\n    id: string;\n    default?: Array<string | number>;\n    fieldType: \"string\" | \"number\";\n}\n\nexport interface IFieldObject {\n    type: \"object\";\n    id: string;\n    default?: object;\n    fields: { [key: string]: IField };\n}\n\nexport type IField = IFieldBoolean | IFieldNumber | IFieldNumber64 | IFieldString | IFieldRange | IFieldDataset | IFieldSet | IFieldObject;\n\n//  Datasources  ==============================================================\nexport type IDatasourceType = \"wuresult\" | \"logicalfile\" | \"roxie\" | \"hipie\" | \"rest\" | \"form\" | \"databomb\";\nexport type DatasourceType = IWUResult | ILogicalFile | IRoxieService | IHipieService | IRestService | IForm | IDatabomb;\n\nexport interface IDatasource {\n    type: IDatasourceType;\n    id: string;\n}\n\nexport interface IService extends IDatasource {\n    url: string;\n}\n\nexport interface IOutput {\n    fields: IField[];\n}\n\nexport type OutputDict = { [key: string]: IOutput };\n\nexport interface IWUResult extends IService {\n    type: \"wuresult\";\n    wuid: string;\n    outputs: OutputDict;\n}\n\nexport interface ILogicalFile extends IService {\n    type: \"logicalfile\";\n    logicalFile: string;\n    fields: IField[];\n}\n\nexport interface IRoxieService extends IService {\n    type: \"roxie\";\n    querySet: string;\n    queryID: string;\n    inputs: IField[];\n    outputs: OutputDict;\n}\n\nexport interface IHipieService extends IService {\n    type: \"hipie\";\n    querySet: string;\n    queryID: string;\n    inputs: IField[];\n    outputs: OutputDict;\n}\n\nexport interface IRestService extends IService {\n    type: \"rest\";\n    action: string;\n    mode?: \"get\" | \"post\";\n    inputs: IField[];\n    outputs: OutputDict;\n}\n\nexport interface IForm extends IDatasource {\n    type: \"form\";\n    fields: IField[];\n}\n\nexport type IDatabombFormat = \"csv\" | \"tsv\" | \"json\";\nexport interface IDatabomb extends IDatasource {\n    type: \"databomb\";\n    fields: IField[];\n    format: IDatabombFormat;\n    payload?: string;\n}\n\n//  IDatasorceRef  ---\nexport interface IDatasourceBaseRef {\n    id: string;\n}\n\nexport interface IDatabombRef extends IDatasourceBaseRef {\n}\n\nexport interface IWUResultRef extends IDatasourceBaseRef {\n    output: string;\n}\n\nexport interface IRestResultRef extends IDatasourceBaseRef {\n    responseField: string;\n}\n\nexport interface IHipieSqlRef extends IDatasourceBaseRef {\n}\n\nexport interface IRequestField {\n    localFieldID: string;\n    source: string;\n    remoteFieldID: string;\n    value: string;\n}\n\nexport interface IRoxieServiceRef extends IDatasourceBaseRef {\n    request: IRequestField[];\n    output: string;\n}\n\nexport type IDatasourceRef = IDatabombRef | IWUResultRef | IRoxieServiceRef | IHipieSqlRef;\n\nexport function isDatabombRef(ref: IDatasourceRef): ref is IDatabombRef {\n    return !isWUResultRef(ref) && !isRoxieServiceRef(ref);\n}\n\nexport function isWUResultRef(ref: IDatasourceRef): ref is IWUResultRef {\n    return (ref as IWUResultRef).output !== undefined && !isRoxieServiceRef(ref);\n}\n\nexport function isRoxieServiceRef(ref: IDatasourceRef): ref is IRoxieServiceRef {\n    return (ref as IRoxieServiceRef).request !== undefined;\n}\n\n//  Activities  ===============================================================\nexport type IActivityType = \"filter\" | \"project\" | \"groupby\" | \"sort\" | \"limit\" | \"mappings\";\nexport type ActivityType = IFilter | IProject | IGroupBy | ISort | ILimit | IMappings;\n\nexport interface IActivity {\n    type: IActivityType;\n}\n\n//  Filter  ===================================================================\nexport type IMappingConditionType = \"==\" | \"!=\" | \">\" | \">=\" | \"<\" | \"<=\" | \"range\" | \"in\";\nexport interface IMapping {\n    remoteFieldID: string;\n    localFieldID: string;\n    condition: IMappingConditionType;\n    nullable: boolean;\n}\n\nexport interface IFilterCondition {\n    viewID: string;\n    mappings: IMapping[];\n}\n\nexport interface IFilterStaticCondition {\n    localFieldID: string;\n    condition: IMappingConditionType;\n    value: string | number;\n}\n\nexport type FilterCondition = IFilterCondition | IFilterStaticCondition;\nexport function isIFilterCondition(fc: FilterCondition): fc is IFilterCondition {\n    return !!(fc as IFilterCondition).viewID;\n}\n\nexport interface IFilter extends IActivity {\n    type: \"filter\";\n    conditions: FilterCondition[];\n}\nexport function isFilterActivity(activity: IActivity): activity is IFilter {\n    return activity.type === \"filter\";\n}\n\n//  Project  ==================================================================\nexport interface IEquals {\n    fieldID: string;\n    type: \"=\";\n    sourceFieldID: string;\n    transformations?: MultiTransformationType[];\n}\nexport type ICalculatedType = \"+\" | \"-\" | \"*\" | \"/\";\nexport interface ICalculated {\n    fieldID: string;\n    type: ICalculatedType;\n    sourceFieldID1: string;\n    sourceFieldID2: string;\n}\n\nexport interface IScale {\n    fieldID: string;\n    type: \"scale\";\n    sourceFieldID: string;\n    factor: number;\n}\n\nexport interface ITemplate {\n    fieldID: string;\n    type: \"template\";\n    template: string;\n}\n\nexport interface IMapMapping {\n    value: any;\n    newValue: any;\n}\n\nexport interface IMap {\n    fieldID: string;\n    type: \"map\";\n    sourceFieldID: string;\n    default: any;\n    mappings: IMapMapping[];\n}\n\nexport type MultiTransformationType = IEquals | ICalculated | IScale | ITemplate | IMap;\nexport interface IMulti {\n    fieldID: string;\n    type: \"multi\";\n    transformations: MultiTransformationType[];\n}\n\nexport type ProjectTransformationType = MultiTransformationType | IMulti;\nexport interface IProject extends IActivity {\n    type: \"project\";\n    transformations: ProjectTransformationType[];\n}\nexport function isProjectActivity(activity: IActivity): activity is IProject {\n    return activity.type === \"project\";\n}\nexport interface IMappings extends IActivity {\n    type: \"mappings\";\n    transformations: ProjectTransformationType[];\n}\nexport function isMappingsActivity(activity: IActivity): activity is IMappings {\n    return activity.type === \"mappings\";\n}\n//  GroupBy  ==================================================================\nexport type IAggregateType = \"min\" | \"max\" | \"sum\" | \"mean\" | \"variance\" | \"deviation\";\nexport interface IAggregate {\n    fieldID: string;\n    type: IAggregateType;\n    inFieldID: string;\n    baseCountFieldID?: string;\n}\n\nexport interface ICount {\n    fieldID: string;\n    type: \"count\";\n}\n\nexport type AggregateType = IAggregate | ICount;\n\nexport interface IGroupBy extends IActivity {\n    type: \"groupby\";\n    groupByIDs: string[];\n    aggregates: AggregateType[];\n}\nexport function isGroupByActivity(activity: IActivity): activity is IGroupBy {\n    return activity.type === \"groupby\";\n}\n\n//  Sort  =====================================================================\nexport interface ISortCondition {\n    fieldID: string;\n    descending: boolean;\n}\n\nexport interface ISort extends IActivity {\n    type: \"sort\";\n    conditions: ISortCondition[];\n}\nexport function isSortActivity(activity: IActivity): activity is ISort {\n    return activity.type === \"sort\";\n}\n\n//  Limit  ====================================================================\nexport interface ILimit extends IActivity {\n    type: \"limit\";\n    limit: number;\n}\nexport function isLimitActivity(activity: IActivity): activity is ILimit {\n    return activity.type === \"limit\";\n}\n\n//  Visualization  ============================================================\nexport interface IWidgetProperties {\n    __class: string;\n    [propID: string]: string | string[] | number | boolean | undefined | IWidgetProperties | IWidgetProperties[];\n}\n\nexport interface IWidget {\n    id: string;\n    chartType: string;\n    __class: string;\n    properties: IWidgetProperties;\n}\n\nexport type VisibilityType = \"normal\" | \"flyout\";\nexport const VisibilitySet: VisibilityType[] = [\"normal\", \"flyout\"];\n\nexport interface IVisualization extends IWidget {\n    title: string;\n    description?: string;\n    visibility: VisibilityType;\n    mappings: IMappings;\n    secondaryDataviewID?: string;\n}\n\n//  View  =====================================================================\nexport interface IView {\n    id: string;\n    datasource: IDatasourceRef;\n    activities: ActivityType[];\n    visualization: IVisualization;\n}\n\n//  DDL  ======================================================================\nexport interface IProperties {\n    [propID: string]: any;\n}\n\nexport interface Schema {\n    version: \"2.2.1\";\n    createdBy: {\n        name: string;\n        version: string;\n    };\n    datasources: DatasourceType[];\n    dataviews: IView[];\n    properties?: IProperties;\n    hipieProperties?: IProperties;\n\n    //  The following defs are only provided to assist the Java code generation (from the the generated schema)  ---\n    defs?: {\n        fieldTypes: {\n            number64: Number64;\n            range: Range;\n            dataset: Dataset;\n            fieldType: IFieldType;\n            fieldBoolean: IFieldBoolean;\n            fieldNumber: IFieldNumber;\n            fieldNumber64: IFieldNumber64\n            fieldString: IFieldString;\n            fieldRange: IFieldRange;\n            fieldDataset: IFieldDataset;\n            fieldSet: IFieldSet;\n            fieldObject: IFieldObject;\n            field: IField;\n        };\n        datasourceTypes: {\n            datasource: IDatasource;\n            logicalFile: ILogicalFile;\n            form: IForm;\n            databomb: IDatabomb;\n            wuresult: IWUResult;\n            hipieService: IHipieService;\n            roxieService: IRoxieService;\n        };\n        datasourceRefTypes: {\n            wuResultRef: IWUResultRef;\n            roxieServiceRef: IRoxieServiceRef;\n        };\n        activityTypes: {\n            filter: IFilter;\n            project: IProject;\n            groupby: IGroupBy;\n            sort: ISort;\n            limit: ILimit;\n            mappings: IMappings;\n        };\n        aggregateTypes: {\n            aggregate: IAggregate;\n            count: ICount;\n        };\n        transformationTypes: {\n            equals: IEquals;\n            calculated: ICalculated;\n            scale: IScale;\n            template: ITemplate;\n            map: IMap;\n            multi: IMulti;\n        };\n    };\n}\n","import * as DDL2 from \"./ddl/v2.ts\";\n\nconst classMappings: any = {\n    c3chart_Bar: \"chart_Bar\",\n    c3chart_Column: \"chart_Column\",\n    c3chart_Pie: \"chart_Pie\",\n    c3chart_Area: \"chart_Area\",\n    c3chart_Line: \"chart_Line\",\n    amchart_Bar: \"chart_Bar\",\n    amchart_Column: \"chart_Column\",\n    amchart_Pie: \"chart_Pie\",\n    amchart_Area: \"chart_Area\",\n    amchart_Line: \"chart_Line\",\n    google_Bar: \"chart_Bar\",\n    google_Column: \"chart_Column\",\n    google_Pie: \"chart_Pie\",\n    google_Area: \"chart_Area\",\n    google_Line: \"chart_Line\",\n    other_Table: \"dgrid_Table\"\n};\nconst propertyMappings: any = {\n    xAxisLabelRotation: [\n        { name: \"xAxisOverlapMode\", transform: (n: any) => \"rotate\" },\n        { name: \"xAxisLabelRotation\", transform: (n: any) => n }\n    ],\n    tooltipLabelColor: {\n        name: \"tooltipLabelColor\"\n    },\n    tooltipSeriesColor: {\n        name: \"tooltipSeriesColor\"\n    },\n    tooltipValueColor: {\n        name: \"tooltipValueColor\"\n    },\n    tooltipValueFormat: {\n        name: \"tooltipValueFormat\"\n    },\n    timePattern: {\n        name: \"xAxisTypeTimePattern\"\n    },\n    smoothLines: {\n        name: \"interpolate\",\n        transform: (n: any) => {\n            if (n === false) return \"linear\";\n            return \"catmullRom\";\n        }\n    },\n    holePercent: {\n        name: \"innerRadius\"\n    },\n    flip: {\n        name: \"orientation\",\n        transform: (n: any) => n ? \"vertical\" : \"horizontal\"\n    },\n    bottomText: {\n        name: \"xAxisTitle\"\n    },\n    xAxisTypeTimePattern: {\n        name: \"xAxisTypeTimePattern\"\n    },\n    yAxisTypeTimePattern: {\n        name: \"yAxisTypeTimePattern\"\n    },\n    valueFormat: {\n        name: \"tooltipValueFormat\"\n    },\n    stacked: {\n        name: \"yAxisStacked\"\n    },\n    showYGrid: {\n        name: \"yAxisGuideLines\"\n    },\n    showXGrid: {\n        name: \"xAxisGuideLines\"\n    },\n    showValueLabel: {\n        name: \"showValue\"\n    },\n    low: {\n        name: \"yAxisDomainLow\"\n    },\n    high: {\n        name: \"yAxisDomainHigh\"\n    },\n    fillOpacity: {\n        name: \"interpolateFillOpacity\"\n    },\n    areaFillOpacity: {\n        name: \"interpolateFillOpacity\"\n    },\n    showToolbar: {\n        name: \"titleVisible\"\n    },\n    showCSV: {\n        name: \"downloadButtonVisible\"\n    }\n};\n\nfunction findKeyVal(object: any, key: any, val: any): any {\n    let value;\n\n    for (const k in object) {\n        if (k === key && object[k] === val) {\n            value = object;\n            break;\n        }\n        if (object[k] && typeof object[k] === \"object\") {\n            value = findKeyVal(object[k], key, val);\n            if (value !== undefined) {\n                break;\n            }\n        }\n    }\n    return value;\n}\n\nfunction apply_to_dataviews(ddl2: DDL2.Schema, dermObj: any) {\n\n    ddl2.dataviews.forEach(apply_to_dataview);\n\n    function apply_to_dataview(dv: any) {\n        const widgetId = dv.id;\n        const dermPanelObj: any = findKeyVal(dermObj, \"__id\", widgetId);\n        if (dermPanelObj) {\n            const dermPanelProps: any = dermPanelObj.__properties;\n            const dermWidgetObj: any = dermPanelObj.__properties.chart ? dermPanelObj.__properties.chart : dermPanelObj.__properties.widget;\n            const dermWidgetProps: any = dermWidgetObj.__properties;\n            apply_class_mapping(dermWidgetObj);\n            apply_panel_property_mapping(dermPanelProps, dermWidgetProps);\n            apply_widget_property_mapping(dermPanelProps, dermWidgetProps);\n            if (dv.visualization.properties.chartType) {\n                dv.visualization.properties.charttype = dv.visualization.properties.chartType;\n            }\n        } else {\n            console.warn(widgetId + \" not found in dermObj\");\n        }\n\n        function apply_class_mapping(dermWidgetObj: any) {\n            dv.visualization.__class = swap_with_supported_class(dermWidgetObj.__class);\n            dv.visualization.properties.__class = \"marshaller_VizChartPanel\";\n            if (!dv.visualization.properties.widget) dv.visualization.properties.widget = {};\n            dv.visualization.properties.widget.__class = dv.visualization.__class;\n\n            function swap_with_supported_class(_class: string): string {\n                return classMappings[_class] ? classMappings[_class] : _class;\n            }\n        }\n        function apply_panel_property_mapping(dermPanelProps: any, dermWidgetProps: any) {\n            dv.visualization.title = dermPanelProps.title || \"\";\n            dv.visualization.description = \"\";\n            dv.visualization.visibility = dv.visualization.visibility === \"flyout\" ? \"flyout\" : \"normal\";\n            dv.visualization.chartType = dv.visualization.__class.split(\"_\")[1];\n            for (const propName in dermPanelProps) {\n                if (typeof propertyMappings[propName] !== \"undefined\") {\n                    const newPropName = propertyMappings[propName].name;\n\n                    if (typeof propertyMappings[propName].transform === \"function\") {\n                        dv.visualization.properties[newPropName] = propertyMappings[propName].transform(dermPanelProps[propName]);\n                    } else {\n                        dv.visualization.properties[newPropName] = dermPanelProps[propName];\n                    }\n\n                }\n            }\n            if (dermWidgetProps && dermWidgetProps.showLegend && dv.visualization.properties) {\n                dv.visualization.properties.legendVisible = true;\n            }\n        }\n        function apply_widget_property_mapping(dermPanelProps: any, dermWidgetProps: any) {\n            dv.visualization.title = dv.visualization.title || dermWidgetProps.title || \"\";\n            dv.visualization.description = \"\"; // TODO - should this map to anything?\n            dv.visualization.visibility = dv.visualization.visibility === \"flyout\" ? \"flyout\" : \"normal\";\n            dv.visualization.chartType = dv.visualization.__class.split(\"_\")[1];\n            for (const propName in dermWidgetProps) {\n                if (typeof propertyMappings[propName] !== \"undefined\") {\n                    if (propertyMappings[propName] instanceof Array) {\n                        propertyMappings[propName].forEach((p: any) => {\n                            const newPropName = p.name;\n                            dv.visualization.properties.widget[newPropName] = p.transform(dermWidgetProps[propName]);\n                            if (typeof propertyMappings[propName].transform === \"function\") {\n                                dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);\n                            } else {\n                                dv.visualization.properties.widget[newPropName] = dermWidgetProps[propName];\n                            }\n                        });\n                    } else {\n                        const newPropName = propertyMappings[propName].name;\n                        dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);\n                    }\n                }\n            }\n        }\n    }\n}\n\ntype CellPosition = {\n    id: string;\n    position: [number, number, number, number];\n};\n\ntype DDLProperties = {\n    layout: CellPosition[]\n};\n\nfunction apply_to_properties_layout(ddl2: DDL2.Schema, dermObj: any) {\n    const retVal: DDLProperties = {\n        layout: []\n    };\n    if (!dermObj || !dermObj.__properties) return;\n    dermObj.__properties.content.forEach((cell: any) => {\n        const cellPosition: CellPosition = {\n            // TODO - if \"id\" could be avoided then layouts could apply to any dashboard with the same number of widgets\n            id: cell.__properties.widget.__id,\n            position: [\n                cell.__properties.gridCol,\n                cell.__properties.gridRow,\n                cell.__properties.gridColSpan,\n                cell.__properties.gridRowSpan\n            ]\n        };\n        retVal.layout.push(cellPosition);\n    });\n    return retVal;\n}\n\nexport function upgrade(ddl2: DDL2.Schema, dermObj: any) {\n    apply_to_dataviews(ddl2, dermObj);\n    return apply_to_properties_layout(ddl2, dermObj);\n}\n","import { PKG_NAME, PKG_VERSION } from \"./__package__.ts\";\nimport * as DDL1 from \"./ddl/v1.ts\";\nimport * as DDL2 from \"./ddl/v2.ts\";\nimport { upgrade as dermatologyUpgrade } from \"./dermatology.ts\";\n\ninterface IDatasourceOutput {\n    datasource: DDL1.IAnyDatasource;\n    output: DDL1.IOutput;\n}\n\ninterface IDatasourceOutputFilter extends IDatasourceOutput {\n    filter: DDL1.IFilter;\n}\n\nconst UPGRADE_HEX_CHAR: boolean = false;\nfunction faCharFix(faChar: any): string | undefined {\n    if (UPGRADE_HEX_CHAR && typeof faChar === \"string\") {\n        return String.fromCharCode(parseInt(faChar));\n    }\n    return faChar;\n}\n\nclass DDLUpgrade {\n    _ddl: DDL1.IDDL;\n    _baseUrl: string;\n    _wuid?: string;\n    _toLowerCase: boolean;\n\n    _datasources: { [id: string]: DDL1.IAnyDatasource } = {};\n    _datasourceUpdates: { [id: string]: { id: string, output?: string } } = {};\n    _visualizations: { [id: string]: DDL1.IAnyVisualization } = {};\n\n    _ddl2Datasources: { [id: string]: DDL2.DatasourceType } = {};\n    _ddl2DatasourceFields: { [dsid: string]: { [outputID: string]: { [fieldID: string]: DDL2.IField } } } = {};\n\n    _ddl2Dataviews: { [id: string]: DDL2.IView } = {};\n    _ddl2DataviewActivities: {\n        [viewID: string]: {\n            project: DDL2.IProject,\n            filters: DDL2.IFilter,\n            sort: DDL2.ISort,\n            groupBy: DDL2.IGroupBy,\n            limit: DDL2.ILimit,\n            mappings: DDL2.IMappings\n        }\n    } = {};\n\n    constructor(ddl: DDL1.IDDL, baseUrl: string = \"http://localhost:8010\", wuid: string = \"WUID\", toLowerCase = true) {\n        this._ddl = ddl;\n        this._baseUrl = baseUrl;\n        this._wuid = wuid;\n        this._toLowerCase = toLowerCase;\n\n        this.indexDDL();\n        this.readDDL();\n    }\n\n    toLowerCase(s: string): string {\n        return this._toLowerCase ? s.toLowerCase() : s;\n    }\n\n    isVizDatasourceRoxie(viz: DDL1.IAnyVisualization): boolean {\n        if ((viz as any).source) {\n            const ds = this._datasources[(viz as any).source.id];\n            if (DDL1.isHipieDatasource(ds)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    getDatasourceOutputs(dsID: string, vizID: string): IDatasourceOutput[] {\n        const retVal: IDatasourceOutput[] = [];\n        const datasource = this._datasources[dsID];\n        for (const output of datasource.outputs) {\n            if (output.notify) {\n                for (const notify of output.notify) {\n                    if (notify === vizID) {\n                        retVal.push({\n                            datasource,\n                            output\n                        });\n                    }\n                }\n            }\n        }\n        return retVal;\n    }\n\n    getDatasourceFilters(dsID: string, vizID: string): { [id: string]: IDatasourceOutputFilter } {\n        const retVal: { [id: string]: IDatasourceOutputFilter } = {};\n        for (const dsOut of this.getDatasourceOutputs(dsID, vizID)) {\n            if (dsOut.output.filter) {\n                for (const filter of dsOut.output.filter) {\n                    retVal[filter.fieldid] = {\n                        datasource: dsOut.datasource,\n                        output: dsOut.output,\n                        filter\n                    };\n                }\n            }\n        }\n        return retVal;\n    }\n\n    indexDDL() {\n        for (const dash of this._ddl.dashboards) {\n            for (const viz of dash.visualizations) {\n                this._visualizations[viz.id] = viz;\n            }\n        }\n\n        for (const ds of this._ddl.datasources) {\n            this._datasources[ds.id] = ds;\n            for (const output of ds.outputs) {\n                if (output.notify) {\n                    for (const notify of output.notify) {\n                        this._datasourceUpdates[notify] = {\n                            id: ds.id,\n                            output: output.from || output.id\n                        };\n                    }\n                }\n            }\n        }\n    }\n\n    readDDL() {\n        for (const ds of this._ddl.datasources) {\n            if (DDL1.isWorkunitDatasource(ds)) {\n                const ddl2DS: DDL2.IWUResult = {\n                    type: \"wuresult\",\n                    id: ds.id,\n                    url: this._baseUrl,\n                    wuid: this._wuid!,\n                    outputs: {}\n                };\n                for (const output of ds.outputs) {\n                    this.output2output(output, ddl2DS.outputs);\n                }\n                this._ddl2Datasources[ds.id] = ddl2DS;\n            } else if (DDL1.isDatabombDatasource(ds)) {\n            } else {\n                const urlParts = ds.URL!.split(\"/WsEcl/submit/query/\");\n                const hostParts = urlParts[0];\n                const roxieParts = urlParts[1].split(\"/\");\n                const ddl2DS: DDL2.IHipieService = {\n                    type: \"hipie\",\n                    id: ds.id,\n                    url: hostParts,\n                    querySet: roxieParts[0],\n                    queryID: roxieParts[1],\n                    inputs: [],\n                    outputs: {}\n                };\n                for (const output of ds.outputs) {\n                    this.output2output(output, ddl2DS.outputs);\n                }\n                this._ddl2Datasources[ds.id] = ddl2DS;\n            }\n        }\n        for (const dash of this._ddl.dashboards) {\n            for (const viz of dash.visualizations) {\n                if (viz.type === \"FORM\") {\n                    this._ddl2Datasources[viz.id] = {\n                        type: \"form\",\n                        id: viz.id,\n                        fields: this.formFields2field(viz.fields)\n                    };\n                    this._datasourceUpdates[viz.id] = { id: viz.id };\n                } else if (viz.type === \"SLIDER\") {\n                    this._ddl2Datasources[viz.id] = {\n                        type: \"form\",\n                        id: viz.id,\n                        fields: this.formFields2field(viz.fields, true)\n                    };\n                    this._datasourceUpdates[viz.id] = { id: viz.id };\n                }\n\n                this._ddl2Dataviews[viz.id] = this.anyViz2view(viz);\n            }\n        }\n\n        this.readGroupBy();\n        this.readFilters();\n        this.readSort();\n        this.readMappings();\n    }\n\n    readGroupBy() {\n        for (const dash of this._ddl.dashboards) {\n            for (const viz of dash.visualizations) {\n                if (viz.fields) {\n                    const projectTransformations: DDL2.ProjectTransformationType[] = [];\n                    const groupByColumns: string[] = [];\n                    const aggrFields: DDL2.IAggregate[] = [];\n                    for (const field of viz.fields) {\n                        if (field.properties && field.properties.function) {\n                            switch (field.properties.function) {\n                                case \"SUM\":\n                                case \"MIN\":\n                                case \"MAX\":\n                                    aggrFields.push({\n                                        type: this.func2aggr(field.properties.function),\n                                        inFieldID: this.toLowerCase(field.properties.params!.param1),\n                                        fieldID: this.toLowerCase(field.id)\n                                    } as DDL2.IAggregate);\n                                    break;\n                                case \"AVE\":\n                                    aggrFields.push({\n                                        type: this.func2aggr(field.properties.function),\n                                        inFieldID: this.toLowerCase(field.properties.params!.param1),\n                                        baseCountFieldID: field.properties.params!.param2 ? this.toLowerCase(field.properties.params!.param2) : undefined,\n                                        fieldID: this.toLowerCase(field.id)\n                                    } as DDL2.IAggregate);\n                                    break;\n                                case \"SCALE\":\n                                    if (typeof field.properties.params!.param1 === \"object\") {\n                                        const props: any = field.properties.params!.param1;\n                                        switch (props.function) {\n                                            case \"SUM\":\n                                            case \"MIN\":\n                                            case \"MAX\":\n                                                aggrFields.push({\n                                                    type: this.func2aggr(props.function),\n                                                    inFieldID: this.toLowerCase(props.params.param1),\n                                                    fieldID: this.toLowerCase(field.id)\n                                                });\n                                                break;\n                                        }\n                                    }\n                                    projectTransformations.push({\n                                        type: \"scale\",\n                                        sourceFieldID: this.toLowerCase(field.id),\n                                        fieldID: this.toLowerCase(field.id),\n                                        factor: +field.properties.params!.param2\n                                    });\n                                    break;\n                                default:\n                                    groupByColumns.push(this.toLowerCase(field.id));\n                                    throw new Error(`Unhandled field function: ${field.properties.function}`);\n                            }\n                        } else {\n                            groupByColumns.push(this.toLowerCase(field.id));\n                        }\n                    }\n                    if (projectTransformations.length) {\n                        this._ddl2DataviewActivities[viz.id].project.transformations = projectTransformations;\n                    }\n                    if (aggrFields.length) {\n                        this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = [...groupByColumns];\n                        this._ddl2DataviewActivities[viz.id].groupBy.aggregates = aggrFields;\n                    }\n                }\n            }\n        }\n    }\n\n    func2aggr(func: DDL1.VisualizationFieldFuncitonType): DDL2.IAggregateType {\n        switch (func) {\n            case \"SUM\":\n                return \"sum\";\n            case \"AVE\":\n                return \"mean\";\n            case \"MIN\":\n                return \"min\";\n            case \"MAX\":\n                return \"max\";\n        }\n        throw new Error(`Unknown DDL1 Function Type:  ${func}`);\n    }\n\n    readMappings() {\n        for (const dash of this._ddl.dashboards) {\n            for (const viz of dash.visualizations) {\n                if (DDL1.isFormVisualization(viz)) {\n                } else if (DDL1.isPieVisualization(viz)) {\n                    this.readPieMappings(viz);\n                } else if (DDL1.isChoroVisualization(viz)) {\n                    this.readChoroMappings(viz);\n                } else if (DDL1.isLineVisualization(viz)) {\n                    this.readLineMappings(viz);\n                } else if (DDL1.isTableVisualization(viz)) {\n                    this.readTableMappings(viz);\n                } else if (DDL1.isGraphVisualization(viz)) {\n                    this.readGraphMappings(viz);\n                } else if (DDL1.isSliderVisualization(viz)) {\n                    this.readSliderMappings(viz);\n                } else {\n                    throw new Error(`Unkown DDL1 mapping type:  ${viz.type}`);\n                }\n            }\n        }\n    }\n\n    readPieMappings(viz: DDL1.IPieVisualization) {\n        const mappings = this._ddl2DataviewActivities[viz.id].mappings;\n        mappings.transformations.push({\n            fieldID: \"label\",\n            type: \"=\",\n            sourceFieldID: this.toLowerCase(viz.source.mappings.label)\n        });\n        mappings.transformations.push({\n            fieldID: \"weight\",\n            type: \"=\",\n            sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])\n        });\n    }\n\n    readChoroMappings(viz: DDL1.IChoroVisualization) {\n        const mappings = this._ddl2DataviewActivities[viz.id].mappings;\n        mappings.transformations.push({\n            fieldID: \"label\",\n            type: \"=\",\n            sourceFieldID: this.toLowerCase(this.anyChoroMapping2label(viz.source.mappings))\n        });\n        mappings.transformations.push({\n            fieldID: \"weight\",\n            type: \"=\",\n            sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])\n        });\n    }\n\n    anyChoroMapping2label(mapping: any) {\n        return mapping.state || mapping.county || mapping.geohash;\n    }\n\n    readLineMappings(viz: DDL1.ILineVisualization) {\n        const mappings = this._ddl2DataviewActivities[viz.id].mappings;\n        mappings.transformations.push({\n            fieldID: viz.source.mappings.x[0],\n            type: \"=\",\n            sourceFieldID: this.toLowerCase(viz.source.mappings.x[0])\n        });\n        for (let i = 0; i < viz.source.mappings.y.length; ++i) {\n            mappings.transformations.push({\n                fieldID: viz.source.mappings.y[i],\n                type: \"=\",\n                sourceFieldID: this.toLowerCase(viz.source.mappings.y[i])\n            });\n        }\n    }\n\n    readTableMappings(viz: DDL1.ITableVisualization) {\n        const mappings = this._ddl2DataviewActivities[viz.id].mappings;\n        for (let i = 0; i < viz.label.length; ++i) {\n            mappings.transformations.push({\n                fieldID: viz.label[i],\n                type: \"=\",\n                sourceFieldID: this.toLowerCase(viz.source.mappings.value[i])\n            });\n        }\n    }\n\n    readGraphEnums(valueMappings?: DDL1.IValueMappings, annotation: boolean = false): DDL2.IMapMapping[] {\n        const retVal: DDL2.IMapMapping[] = [];\n        if (valueMappings) {\n            for (const value in valueMappings) {\n                const newValue: { [key: string]: string | number | boolean | undefined } = {};\n                for (const key in valueMappings[value]) {\n                    if (key === \"faChar\") {\n                        newValue[key] = faCharFix(valueMappings[value][key]);\n                    } else if (annotation && key.indexOf(\"icon_\") === 0) {\n                        console.warn(\"Deprecated flag property:  \" + key);\n                        newValue[key.split(\"icon_\")[1]] = valueMappings[value][key];\n                    } else {\n                        newValue[key] = valueMappings[value][key];\n                    }\n                }\n                //  remove v1.x \"0\" annotations as they equated to \"nothing\"  ---\n                if (!annotation || value !== \"0\") {\n                    retVal.push({\n                        value,\n                        newValue\n                    });\n                }\n            }\n        }\n        return retVal;\n    }\n\n    readGraphMappings(viz: DDL1.IGraphVisualization) {\n        const mappings = this._ddl2DataviewActivities[viz.id].mappings;\n        mappings.transformations.push({\n            fieldID: \"uid\",\n            type: \"=\",\n            sourceFieldID: this.toLowerCase(viz.source.mappings.uid)\n        });\n        mappings.transformations.push({\n            fieldID: \"label\",\n            type: \"=\",\n            sourceFieldID: this.toLowerCase(viz.source.mappings.label)\n        });\n        if (viz.icon.fieldid) {\n            mappings.transformations.push({\n                fieldID: \"icon\",\n                type: \"map\",\n                sourceFieldID: this.toLowerCase(viz.icon.fieldid),\n                default: { fachar: faCharFix(viz.icon.faChar) },\n                mappings: this.readGraphEnums(viz.icon.valuemappings)\n            });\n        }\n        let idx = 0;\n        if (viz.flag) {\n            for (const flag of viz.flag) {\n                if (flag.fieldid) {\n                    mappings.transformations.push({\n                        fieldID: `annotation_${idx++}`,\n                        type: \"map\",\n                        sourceFieldID: this.toLowerCase(flag.fieldid),\n                        default: {},\n                        mappings: this.readGraphEnums(flag.valuemappings, true)\n                    });\n                }\n            }\n        }\n        mappings.transformations.push({\n            fieldID: \"links\",\n            type: \"=\",\n            sourceFieldID: this.toLowerCase(viz.source.link.childfile),\n            transformations: [{\n                fieldID: \"uid\",\n                type: \"=\",\n                sourceFieldID: this.toLowerCase(viz.source.link.mappings.uid)\n            }]\n        });\n    }\n\n    readSliderMappings(viz: DDL1.ISliderVisualization) {\n        const mappings = this._ddl2DataviewActivities[viz.id].mappings;\n        mappings.transformations.push({\n            fieldID: \"label\",\n            type: \"=\",\n            sourceFieldID: this.toLowerCase(viz.source.mappings.label)\n        });\n    }\n\n    readFilters() {\n        for (const dash of this._ddl.dashboards) {\n            for (const viz of dash.visualizations) {\n                if (viz.events) {\n                    for (const eventID in viz.events) {\n                        const event = viz.events[eventID];\n                        for (const update of event.updates) {\n                            const otherViz = this._ddl2Dataviews[update.visualization];\n                            const dsFilters = this.getDatasourceFilters(update.datasource, otherViz.id);\n                            if (update.mappings) {\n                                if (DDL2.isRoxieServiceRef(otherViz.datasource)) {\n                                    for (const key in update.mappings) {\n                                        otherViz.datasource.request.push({\n                                            source: viz.id,\n                                            remoteFieldID: this.toLowerCase(key),\n                                            localFieldID: this.toLowerCase(update.mappings[key])\n                                        } as DDL2.IRequestField);\n                                    }\n                                } else {\n                                    const condition: DDL2.IFilterCondition = {\n                                        viewID: viz.id,\n                                        mappings: []\n                                    };\n                                    for (const key in update.mappings) {\n                                        const mapping = update.mappings[key];\n                                        const dsFilter = (mapping && dsFilters[mapping]) ? dsFilters[mapping].filter : undefined;\n                                        if (!dsFilter) {\n                                            console.warn(`Select Mapping \"${mapping}\" in viz \"${viz.id}\" not found in filters for \"${otherViz.id}\"`);\n                                        } else {\n                                            condition.mappings.push({\n                                                remoteFieldID: this.toLowerCase(key),\n                                                localFieldID: this.toLowerCase(update.mappings[key]),\n                                                condition: this.rule2condition(dsFilter.rule),\n                                                nullable: dsFilter.nullable\n                                            });\n                                        }\n                                    }\n                                    this._ddl2DataviewActivities[otherViz.id].filters.conditions.push(condition);\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    rule2condition(_: DDL1.IFilterRule): DDL2.IMappingConditionType {\n        switch (_) {\n            case \"set\":\n                return \"in\";\n            case \"notequals\":\n                return \"!=\";\n        }\n        return _;\n    }\n\n    readSort() {\n        for (const dash of this._ddl.dashboards) {\n            for (const viz of dash.visualizations) {\n                if ((viz as any).source) {\n                    if ((viz as any).source.sort) {\n                        const vizSort = this._ddl2DataviewActivities[viz.id].sort;\n                        vizSort.conditions = ((viz as any).source.sort as string[]).map(s => {\n                            if (s.indexOf(\"-\") === 0) {\n                                return {\n                                    fieldID: this.toLowerCase(s.substr(1)),\n                                    descending: true\n                                } as DDL2.ISortCondition;\n                            }\n                            return {\n                                fieldID: this.toLowerCase(s),\n                                descending: false\n                            } as DDL2.ISortCondition;\n                        });\n                    }\n                    if ((viz as any).source.first) {\n                        const vizLimit = this._ddl2DataviewActivities[viz.id].limit;\n                        vizLimit.limit = +(viz as any).source.first;\n                    }\n                }\n            }\n        }\n    }\n\n    anyViz2view(viz: DDL1.IAnyVisualization): DDL2.IView {\n        const project: DDL2.IProject = {\n            type: \"project\",\n            transformations: []\n        };\n        const filters: DDL2.IFilter = {\n            type: \"filter\",\n            conditions: []\n        };\n        const groupBy: DDL2.IGroupBy = {\n            type: \"groupby\",\n            groupByIDs: [],\n            aggregates: []\n        };\n        const sort: DDL2.ISort = {\n            type: \"sort\",\n            conditions: []\n        };\n        const limit: DDL2.ILimit = {\n            type: \"limit\",\n            limit: 0\n        };\n        const mappings: DDL2.IMappings = {\n            type: \"mappings\",\n            transformations: []\n        };\n        this._ddl2DataviewActivities[viz.id] = {\n            project,\n            filters,\n            sort,\n            groupBy,\n            limit,\n            mappings\n        };\n        const datasourceRef: DDL2.IDatasourceBaseRef | DDL2.IRoxieServiceRef = this.isVizDatasourceRoxie(viz) ? {\n            id: this._datasourceUpdates[viz.id].id,\n            request: [],\n            output: this._datasourceUpdates[viz.id].output\n        } : {\n            id: this._datasourceUpdates[viz.id].id,\n            output: this._datasourceUpdates[viz.id].output\n        };\n        return {\n            id: viz.id,\n            datasource: datasourceRef,\n            activities: [\n                project,\n                filters,\n                sort,\n                groupBy,\n                limit\n            ],\n            visualization: {\n                id: viz.id,\n                title: viz.title || \"\",\n                description: \"\",\n                visibility: viz.properties && viz.properties.flyout === true ? \"flyout\" : \"normal\",\n                ...this.type2chartType(viz.type),\n                mappings,\n                properties: (viz.properties || {}) as DDL2.IWidgetProperties\n            }\n        };\n    }\n\n    type2chartType(chartType: DDL1.VisualizationType): { chartType: string, __class: string } {\n        switch (chartType) {\n            case \"LINE\":\n                return { chartType: \"Line\", __class: \"chart_Line\" };\n            case \"BUBBLE\":\n                return { chartType: \"Bubble\", __class: \"chart_Bubble\" };\n            case \"PIE\":\n                return { chartType: \"Pie\", __class: \"chart_Pie\" };\n            case \"BAR\":\n                return { chartType: \"Column\", __class: \"chart_Column\" };\n            case \"FORM\":\n                return { chartType: \"FieldForm\", __class: \"form_FieldForm\" };\n            case \"WORD_CLOUD\":\n                return { chartType: \"WordCloud\", __class: \"chart_WordCloud\" };\n            case \"CHORO\":\n                return { chartType: \"ChoroplethStates\", __class: \"map_ChoroplethStates\" };\n            case \"SUMMARY\":\n                return { chartType: \"Summary\", __class: \"chart_Summary\" };\n            case \"SLIDER\":\n                return { chartType: \"FieldForm\", __class: \"form_FieldForm\" };\n            case \"HEAT_MAP\":\n                return { chartType: \"HeatMap\", __class: \"other_HeatMap\" };\n            case \"2DCHART\":\n                return { chartType: \"Column\", __class: \"chart_Column\" };\n            case \"GRAPH\":\n                return { chartType: \"AdjacencyGraph\", __class: \"graph_AdjacencyGraph\" };\n            case \"TABLE\":\n            default:\n                return { chartType: \"Table\", __class: \"dgrid_Table\" };\n        }\n    }\n\n    formFields2field(fields?: DDL1.IVisualizationField[], slider: boolean = false): DDL2.IField[] {\n        if (!fields) return [];\n        return fields.map(field => {\n            switch (field.properties.type) {\n                case \"range\":\n                    return {\n                        type: \"range\",\n                        id: field.id,\n                        default: (field.properties.default ? field.properties.default as DDL2.Range : undefined)\n                    };\n                case \"dataset\":\n                    return {\n                        type: \"dataset\",\n                        id: field.id,\n                        default: [],\n                        children: []\n                    };\n                default:\n                    return {\n                        type: this.formFieldType2fieldType(field.properties.datatype, slider),\n                        id: field.id,\n                        default: field.properties.default ? field.properties.default[0] : undefined\n                    };\n            }\n        });\n    }\n\n    formFieldType2fieldType(fieldType: DDL1.VisualizationFieldType, slider: boolean): \"string\" | \"number\" | \"boolean\" {\n        switch (fieldType) {\n            case \"bool\":\n            case \"boolean\":\n                return \"boolean\";\n            case \"integer\":\n            case \"unsigned\":\n            case \"float\":\n            case \"double\":\n            case \"real\":\n                return \"number\";\n            case \"string\":\n                return \"string\";\n            default:\n                return slider ? \"number\" : \"string\";\n        }\n    }\n\n    output2output(output: DDL1.IOutput, target: DDL2.OutputDict) {\n        target[output.from || output.id] = {\n            fields: this.filters2fields(output.filter)\n        };\n    }\n\n    filters2fields(filters?: DDL1.IFilter[]): DDL2.IField[] {\n        if (!filters) return [];\n        return filters.filter(filter => {\n            const idParts = filter.fieldid.split(\"-\");\n            return idParts.length === 1 || idParts[1] === \"range\";\n        }).map(filter => {\n            const idParts = filter.fieldid.split(\"-\");\n            const retVal: DDL2.IFieldString = {\n                type: \"string\",\n                id: idParts[0]\n            };\n            return retVal;\n        });\n    }\n\n    getVizField(vizID: string, fieldID: string): DDL2.IField {\n        return {\n            type: \"string\",\n            id: \"\",\n            default: \"\"\n        };\n    }\n\n    writeDatasources(): DDL2.DatasourceType[] {\n        const retVal: DDL2.DatasourceType[] = [];\n        for (const id in this._ddl2Datasources) {\n            retVal.push(this._ddl2Datasources[id]);\n        }\n        return retVal;\n    }\n\n    writeDataviews(): DDL2.IView[] {\n        const retVal: DDL2.IView[] = [];\n        for (const id in this._ddl2Dataviews) {\n            retVal.push(this._ddl2Dataviews[id]);\n        }\n        return retVal;\n    }\n\n    writeProperties(): DDL2.IProperties | undefined {\n        return {\n            //  TODO\n        };\n    }\n\n    write(): DDL2.Schema {\n        return {\n            version: \"2.2.1\",\n            createdBy: {\n                name: PKG_NAME,\n                version: PKG_VERSION\n            },\n            datasources: this.writeDatasources(),\n            dataviews: this.writeDataviews(),\n            properties: this.writeProperties()\n        };\n    }\n}\n\nexport function upgrade(ddl: DDL1.IDDL, baseUrl?: string, wuid?: string, toLowerCase: boolean = true, dermatologyJson = {}): DDL2.Schema {\n    const ddlUp = new DDLUpgrade(ddl, baseUrl, wuid, toLowerCase);\n    const retVal = ddlUp.write();\n    retVal.properties = dermatologyUpgrade(retVal, dermatologyJson);\n    return retVal;\n}\n","{\n  \"$ref\": \"#/definitions/Schema\",\n  \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n  \"definitions\": {\n    \"ActivityType\": {\n      \"anyOf\": [\n        {\n          \"$ref\": \"#/definitions/IFilter\"\n        },\n        {\n          \"$ref\": \"#/definitions/IProject\"\n        },\n        {\n          \"$ref\": \"#/definitions/IGroupBy\"\n        },\n        {\n          \"$ref\": \"#/definitions/ISort\"\n        },\n        {\n          \"$ref\": \"#/definitions/ILimit\"\n        },\n        {\n          \"$ref\": \"#/definitions/IMappings\"\n        }\n      ]\n    },\n    \"AggregateType\": {\n      \"anyOf\": [\n        {\n          \"$ref\": \"#/definitions/IAggregate\"\n        },\n        {\n          \"$ref\": \"#/definitions/ICount\"\n        }\n      ]\n    },\n    \"Dataset\": {\n      \"items\": {},\n      \"type\": \"array\"\n    },\n    \"DatasourceType\": {\n      \"anyOf\": [\n        {\n          \"$ref\": \"#/definitions/IWUResult\"\n        },\n        {\n          \"$ref\": \"#/definitions/ILogicalFile\"\n        },\n        {\n          \"$ref\": \"#/definitions/IRoxieService\"\n        },\n        {\n          \"$ref\": \"#/definitions/IHipieService\"\n        },\n        {\n          \"$ref\": \"#/definitions/IRestService\"\n        },\n        {\n          \"$ref\": \"#/definitions/IForm\"\n        },\n        {\n          \"$ref\": \"#/definitions/IDatabomb\"\n        }\n      ]\n    },\n    \"FilterCondition\": {\n      \"anyOf\": [\n        {\n          \"$ref\": \"#/definitions/IFilterCondition\"\n        },\n        {\n          \"$ref\": \"#/definitions/IFilterStaticCondition\"\n        }\n      ]\n    },\n    \"IAggregate\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"baseCountFieldID\": {\n          \"type\": \"string\"\n        },\n        \"fieldID\": {\n          \"type\": \"string\"\n        },\n        \"inFieldID\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"$ref\": \"#/definitions/IAggregateType\"\n        }\n      },\n      \"required\": [\n        \"fieldID\",\n        \"type\",\n        \"inFieldID\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IAggregateType\": {\n      \"enum\": [\n        \"min\",\n        \"max\",\n        \"sum\",\n        \"mean\",\n        \"variance\",\n        \"deviation\"\n      ],\n      \"type\": \"string\"\n    },\n    \"ICalculated\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"fieldID\": {\n          \"type\": \"string\"\n        },\n        \"sourceFieldID1\": {\n          \"type\": \"string\"\n        },\n        \"sourceFieldID2\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"$ref\": \"#/definitions/ICalculatedType\"\n        }\n      },\n      \"required\": [\n        \"fieldID\",\n        \"type\",\n        \"sourceFieldID1\",\n        \"sourceFieldID2\"\n      ],\n      \"type\": \"object\"\n    },\n    \"ICalculatedType\": {\n      \"enum\": [\n        \"+\",\n        \"-\",\n        \"*\",\n        \"/\"\n      ],\n      \"type\": \"string\"\n    },\n    \"ICount\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"fieldID\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"count\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"fieldID\",\n        \"type\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IDatabomb\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"fields\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/IField\"\n          },\n          \"type\": \"array\"\n        },\n        \"format\": {\n          \"$ref\": \"#/definitions/IDatabombFormat\"\n        },\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"payload\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"databomb\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"fields\",\n        \"format\",\n        \"id\",\n        \"type\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IDatabombFormat\": {\n      \"enum\": [\n        \"csv\",\n        \"tsv\",\n        \"json\"\n      ],\n      \"type\": \"string\"\n    },\n    \"IDatabombRef\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"id\": {\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"id\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IDatasource\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"$ref\": \"#/definitions/IDatasourceType\"\n        }\n      },\n      \"required\": [\n        \"type\",\n        \"id\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IDatasourceRef\": {\n      \"anyOf\": [\n        {\n          \"$ref\": \"#/definitions/IDatabombRef\"\n        },\n        {\n          \"$ref\": \"#/definitions/IWUResultRef\"\n        },\n        {\n          \"$ref\": \"#/definitions/IRoxieServiceRef\"\n        },\n        {\n          \"$ref\": \"#/definitions/IHipieSqlRef\"\n        }\n      ]\n    },\n    \"IDatasourceType\": {\n      \"enum\": [\n        \"wuresult\",\n        \"logicalfile\",\n        \"roxie\",\n        \"hipie\",\n        \"rest\",\n        \"form\",\n        \"databomb\"\n      ],\n      \"type\": \"string\"\n    },\n    \"IEquals\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"fieldID\": {\n          \"type\": \"string\"\n        },\n        \"sourceFieldID\": {\n          \"type\": \"string\"\n        },\n        \"transformations\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/MultiTransformationType\"\n          },\n          \"type\": \"array\"\n        },\n        \"type\": {\n          \"const\": \"=\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"fieldID\",\n        \"type\",\n        \"sourceFieldID\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IField\": {\n      \"anyOf\": [\n        {\n          \"$ref\": \"#/definitions/IFieldBoolean\"\n        },\n        {\n          \"$ref\": \"#/definitions/IFieldNumber\"\n        },\n        {\n          \"$ref\": \"#/definitions/IFieldNumber64\"\n        },\n        {\n          \"$ref\": \"#/definitions/IFieldString\"\n        },\n        {\n          \"$ref\": \"#/definitions/IFieldRange\"\n        },\n        {\n          \"$ref\": \"#/definitions/IFieldDataset\"\n        },\n        {\n          \"$ref\": \"#/definitions/IFieldSet\"\n        },\n        {\n          \"$ref\": \"#/definitions/IFieldObject\"\n        }\n      ]\n    },\n    \"IFieldBoolean\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"default\": {\n          \"type\": \"boolean\"\n        },\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"boolean\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"type\",\n        \"id\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IFieldDataset\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"children\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/IField\"\n          },\n          \"type\": \"array\"\n        },\n        \"default\": {\n          \"$ref\": \"#/definitions/Dataset\"\n        },\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"dataset\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"type\",\n        \"id\",\n        \"children\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IFieldNumber\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"default\": {\n          \"type\": \"number\"\n        },\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"number\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"type\",\n        \"id\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IFieldNumber64\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"default\": {\n          \"$ref\": \"#/definitions/Number64\"\n        },\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"number64\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"type\",\n        \"id\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IFieldObject\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"default\": {\n          \"type\": \"object\"\n        },\n        \"fields\": {\n          \"additionalProperties\": {\n            \"$ref\": \"#/definitions/IField\"\n          },\n          \"type\": \"object\"\n        },\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"object\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"type\",\n        \"id\",\n        \"fields\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IFieldRange\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"default\": {\n          \"$ref\": \"#/definitions/Range\"\n        },\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"range\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"type\",\n        \"id\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IFieldSet\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"default\": {\n          \"items\": {\n            \"type\": [\n              \"string\",\n              \"number\"\n            ]\n          },\n          \"type\": \"array\"\n        },\n        \"fieldType\": {\n          \"enum\": [\n            \"string\",\n            \"number\"\n          ],\n          \"type\": \"string\"\n        },\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"set\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"type\",\n        \"id\",\n        \"fieldType\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IFieldString\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"default\": {\n          \"type\": \"string\"\n        },\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"string\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"type\",\n        \"id\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IFieldType\": {\n      \"enum\": [\n        \"boolean\",\n        \"number\",\n        \"number64\",\n        \"string\",\n        \"range\",\n        \"dataset\",\n        \"set\",\n        \"object\"\n      ],\n      \"type\": \"string\"\n    },\n    \"IFilter\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"conditions\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/FilterCondition\"\n          },\n          \"type\": \"array\"\n        },\n        \"type\": {\n          \"const\": \"filter\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"conditions\",\n        \"type\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IFilterCondition\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"mappings\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/IMapping\"\n          },\n          \"type\": \"array\"\n        },\n        \"viewID\": {\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"viewID\",\n        \"mappings\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IFilterStaticCondition\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"condition\": {\n          \"$ref\": \"#/definitions/IMappingConditionType\"\n        },\n        \"localFieldID\": {\n          \"type\": \"string\"\n        },\n        \"value\": {\n          \"type\": [\n            \"string\",\n            \"number\"\n          ]\n        }\n      },\n      \"required\": [\n        \"localFieldID\",\n        \"condition\",\n        \"value\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IForm\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"fields\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/IField\"\n          },\n          \"type\": \"array\"\n        },\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"form\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"fields\",\n        \"id\",\n        \"type\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IGroupBy\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"aggregates\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/AggregateType\"\n          },\n          \"type\": \"array\"\n        },\n        \"groupByIDs\": {\n          \"items\": {\n            \"type\": \"string\"\n          },\n          \"type\": \"array\"\n        },\n        \"type\": {\n          \"const\": \"groupby\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"aggregates\",\n        \"groupByIDs\",\n        \"type\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IHipieService\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"inputs\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/IField\"\n          },\n          \"type\": \"array\"\n        },\n        \"outputs\": {\n          \"$ref\": \"#/definitions/OutputDict\"\n        },\n        \"queryID\": {\n          \"type\": \"string\"\n        },\n        \"querySet\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"hipie\",\n          \"type\": \"string\"\n        },\n        \"url\": {\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"id\",\n        \"inputs\",\n        \"outputs\",\n        \"queryID\",\n        \"querySet\",\n        \"type\",\n        \"url\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IHipieSqlRef\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"id\": {\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"id\"\n      ],\n      \"type\": \"object\"\n    },\n    \"ILimit\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"limit\": {\n          \"type\": \"number\"\n        },\n        \"type\": {\n          \"const\": \"limit\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"limit\",\n        \"type\"\n      ],\n      \"type\": \"object\"\n    },\n    \"ILogicalFile\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"fields\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/IField\"\n          },\n          \"type\": \"array\"\n        },\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"logicalFile\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"logicalfile\",\n          \"type\": \"string\"\n        },\n        \"url\": {\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"fields\",\n        \"id\",\n        \"logicalFile\",\n        \"type\",\n        \"url\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IMap\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"default\": {},\n        \"fieldID\": {\n          \"type\": \"string\"\n        },\n        \"mappings\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/IMapMapping\"\n          },\n          \"type\": \"array\"\n        },\n        \"sourceFieldID\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"map\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"fieldID\",\n        \"type\",\n        \"sourceFieldID\",\n        \"default\",\n        \"mappings\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IMapMapping\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"newValue\": {},\n        \"value\": {}\n      },\n      \"required\": [\n        \"value\",\n        \"newValue\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IMapping\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"condition\": {\n          \"$ref\": \"#/definitions/IMappingConditionType\"\n        },\n        \"localFieldID\": {\n          \"type\": \"string\"\n        },\n        \"nullable\": {\n          \"type\": \"boolean\"\n        },\n        \"remoteFieldID\": {\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"remoteFieldID\",\n        \"localFieldID\",\n        \"condition\",\n        \"nullable\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IMappingConditionType\": {\n      \"enum\": [\n        \"==\",\n        \"!=\",\n        \">\",\n        \">=\",\n        \"<\",\n        \"<=\",\n        \"range\",\n        \"in\"\n      ],\n      \"type\": \"string\"\n    },\n    \"IMappings\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"transformations\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/ProjectTransformationType\"\n          },\n          \"type\": \"array\"\n        },\n        \"type\": {\n          \"const\": \"mappings\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"transformations\",\n        \"type\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IMulti\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"fieldID\": {\n          \"type\": \"string\"\n        },\n        \"transformations\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/MultiTransformationType\"\n          },\n          \"type\": \"array\"\n        },\n        \"type\": {\n          \"const\": \"multi\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"fieldID\",\n        \"type\",\n        \"transformations\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IOutput\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"fields\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/IField\"\n          },\n          \"type\": \"array\"\n        }\n      },\n      \"required\": [\n        \"fields\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IProject\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"transformations\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/ProjectTransformationType\"\n          },\n          \"type\": \"array\"\n        },\n        \"type\": {\n          \"const\": \"project\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"transformations\",\n        \"type\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IProperties\": {\n      \"type\": \"object\"\n    },\n    \"IRequestField\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"localFieldID\": {\n          \"type\": \"string\"\n        },\n        \"remoteFieldID\": {\n          \"type\": \"string\"\n        },\n        \"source\": {\n          \"type\": \"string\"\n        },\n        \"value\": {\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"localFieldID\",\n        \"source\",\n        \"remoteFieldID\",\n        \"value\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IRestService\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"action\": {\n          \"type\": \"string\"\n        },\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"inputs\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/IField\"\n          },\n          \"type\": \"array\"\n        },\n        \"mode\": {\n          \"enum\": [\n            \"get\",\n            \"post\"\n          ],\n          \"type\": \"string\"\n        },\n        \"outputs\": {\n          \"$ref\": \"#/definitions/OutputDict\"\n        },\n        \"type\": {\n          \"const\": \"rest\",\n          \"type\": \"string\"\n        },\n        \"url\": {\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"action\",\n        \"id\",\n        \"inputs\",\n        \"outputs\",\n        \"type\",\n        \"url\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IRoxieService\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"inputs\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/IField\"\n          },\n          \"type\": \"array\"\n        },\n        \"outputs\": {\n          \"$ref\": \"#/definitions/OutputDict\"\n        },\n        \"queryID\": {\n          \"type\": \"string\"\n        },\n        \"querySet\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"roxie\",\n          \"type\": \"string\"\n        },\n        \"url\": {\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"id\",\n        \"inputs\",\n        \"outputs\",\n        \"queryID\",\n        \"querySet\",\n        \"type\",\n        \"url\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IRoxieServiceRef\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"output\": {\n          \"type\": \"string\"\n        },\n        \"request\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/IRequestField\"\n          },\n          \"type\": \"array\"\n        }\n      },\n      \"required\": [\n        \"id\",\n        \"output\",\n        \"request\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IScale\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"factor\": {\n          \"type\": \"number\"\n        },\n        \"fieldID\": {\n          \"type\": \"string\"\n        },\n        \"sourceFieldID\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"scale\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"fieldID\",\n        \"type\",\n        \"sourceFieldID\",\n        \"factor\"\n      ],\n      \"type\": \"object\"\n    },\n    \"ISort\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"conditions\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/ISortCondition\"\n          },\n          \"type\": \"array\"\n        },\n        \"type\": {\n          \"const\": \"sort\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"conditions\",\n        \"type\"\n      ],\n      \"type\": \"object\"\n    },\n    \"ISortCondition\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"descending\": {\n          \"type\": \"boolean\"\n        },\n        \"fieldID\": {\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"fieldID\",\n        \"descending\"\n      ],\n      \"type\": \"object\"\n    },\n    \"ITemplate\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"fieldID\": {\n          \"type\": \"string\"\n        },\n        \"template\": {\n          \"type\": \"string\"\n        },\n        \"type\": {\n          \"const\": \"template\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"fieldID\",\n        \"type\",\n        \"template\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IView\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"activities\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/ActivityType\"\n          },\n          \"type\": \"array\"\n        },\n        \"datasource\": {\n          \"$ref\": \"#/definitions/IDatasourceRef\"\n        },\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"visualization\": {\n          \"$ref\": \"#/definitions/IVisualization\"\n        }\n      },\n      \"required\": [\n        \"id\",\n        \"datasource\",\n        \"activities\",\n        \"visualization\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IVisualization\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"__class\": {\n          \"type\": \"string\"\n        },\n        \"chartType\": {\n          \"type\": \"string\"\n        },\n        \"description\": {\n          \"type\": \"string\"\n        },\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"mappings\": {\n          \"$ref\": \"#/definitions/IMappings\"\n        },\n        \"properties\": {\n          \"$ref\": \"#/definitions/IWidgetProperties\"\n        },\n        \"secondaryDataviewID\": {\n          \"type\": \"string\"\n        },\n        \"title\": {\n          \"type\": \"string\"\n        },\n        \"visibility\": {\n          \"$ref\": \"#/definitions/VisibilityType\"\n        }\n      },\n      \"required\": [\n        \"__class\",\n        \"chartType\",\n        \"id\",\n        \"mappings\",\n        \"properties\",\n        \"title\",\n        \"visibility\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IWUResult\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"outputs\": {\n          \"$ref\": \"#/definitions/OutputDict\"\n        },\n        \"type\": {\n          \"const\": \"wuresult\",\n          \"type\": \"string\"\n        },\n        \"url\": {\n          \"type\": \"string\"\n        },\n        \"wuid\": {\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"id\",\n        \"outputs\",\n        \"type\",\n        \"url\",\n        \"wuid\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IWUResultRef\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"id\": {\n          \"type\": \"string\"\n        },\n        \"output\": {\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"id\",\n        \"output\"\n      ],\n      \"type\": \"object\"\n    },\n    \"IWidgetProperties\": {\n      \"additionalProperties\": {\n        \"anyOf\": [\n          {\n            \"type\": \"string\"\n          },\n          {\n            \"items\": {\n              \"type\": \"string\"\n            },\n            \"type\": \"array\"\n          },\n          {\n            \"type\": \"number\"\n          },\n          {\n            \"type\": \"boolean\"\n          },\n          {\n            \"not\": {}\n          },\n          {\n            \"$ref\": \"#/definitions/IWidgetProperties\"\n          },\n          {\n            \"items\": {\n              \"$ref\": \"#/definitions/IWidgetProperties\"\n            },\n            \"type\": \"array\"\n          }\n        ]\n      },\n      \"properties\": {\n        \"__class\": {\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"__class\"\n      ],\n      \"type\": \"object\"\n    },\n    \"MultiTransformationType\": {\n      \"anyOf\": [\n        {\n          \"$ref\": \"#/definitions/IEquals\"\n        },\n        {\n          \"$ref\": \"#/definitions/ICalculated\"\n        },\n        {\n          \"$ref\": \"#/definitions/IScale\"\n        },\n        {\n          \"$ref\": \"#/definitions/ITemplate\"\n        },\n        {\n          \"$ref\": \"#/definitions/IMap\"\n        }\n      ]\n    },\n    \"Number64\": {\n      \"type\": \"string\"\n    },\n    \"OutputDict\": {\n      \"additionalProperties\": {\n        \"$ref\": \"#/definitions/IOutput\"\n      },\n      \"type\": \"object\"\n    },\n    \"ProjectTransformationType\": {\n      \"anyOf\": [\n        {\n          \"$ref\": \"#/definitions/MultiTransformationType\"\n        },\n        {\n          \"$ref\": \"#/definitions/IMulti\"\n        }\n      ]\n    },\n    \"Range\": {\n      \"items\": {\n        \"type\": [\n          \"number\",\n          \"string\"\n        ]\n      },\n      \"maxItems\": 2,\n      \"minItems\": 2,\n      \"type\": \"array\"\n    },\n    \"Schema\": {\n      \"additionalProperties\": false,\n      \"properties\": {\n        \"createdBy\": {\n          \"additionalProperties\": false,\n          \"properties\": {\n            \"name\": {\n              \"type\": \"string\"\n            },\n            \"version\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"name\",\n            \"version\"\n          ],\n          \"type\": \"object\"\n        },\n        \"datasources\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/DatasourceType\"\n          },\n          \"type\": \"array\"\n        },\n        \"dataviews\": {\n          \"items\": {\n            \"$ref\": \"#/definitions/IView\"\n          },\n          \"type\": \"array\"\n        },\n        \"defs\": {\n          \"additionalProperties\": false,\n          \"properties\": {\n            \"activityTypes\": {\n              \"additionalProperties\": false,\n              \"properties\": {\n                \"filter\": {\n                  \"$ref\": \"#/definitions/IFilter\"\n                },\n                \"groupby\": {\n                  \"$ref\": \"#/definitions/IGroupBy\"\n                },\n                \"limit\": {\n                  \"$ref\": \"#/definitions/ILimit\"\n                },\n                \"mappings\": {\n                  \"$ref\": \"#/definitions/IMappings\"\n                },\n                \"project\": {\n                  \"$ref\": \"#/definitions/IProject\"\n                },\n                \"sort\": {\n                  \"$ref\": \"#/definitions/ISort\"\n                }\n              },\n              \"required\": [\n                \"filter\",\n                \"project\",\n                \"groupby\",\n                \"sort\",\n                \"limit\",\n                \"mappings\"\n              ],\n              \"type\": \"object\"\n            },\n            \"aggregateTypes\": {\n              \"additionalProperties\": false,\n              \"properties\": {\n                \"aggregate\": {\n                  \"$ref\": \"#/definitions/IAggregate\"\n                },\n                \"count\": {\n                  \"$ref\": \"#/definitions/ICount\"\n                }\n              },\n              \"required\": [\n                \"aggregate\",\n                \"count\"\n              ],\n              \"type\": \"object\"\n            },\n            \"datasourceRefTypes\": {\n              \"additionalProperties\": false,\n              \"properties\": {\n                \"roxieServiceRef\": {\n                  \"$ref\": \"#/definitions/IRoxieServiceRef\"\n                },\n                \"wuResultRef\": {\n                  \"$ref\": \"#/definitions/IWUResultRef\"\n                }\n              },\n              \"required\": [\n                \"wuResultRef\",\n                \"roxieServiceRef\"\n              ],\n              \"type\": \"object\"\n            },\n            \"datasourceTypes\": {\n              \"additionalProperties\": false,\n              \"properties\": {\n                \"databomb\": {\n                  \"$ref\": \"#/definitions/IDatabomb\"\n                },\n                \"datasource\": {\n                  \"$ref\": \"#/definitions/IDatasource\"\n                },\n                \"form\": {\n                  \"$ref\": \"#/definitions/IForm\"\n                },\n                \"hipieService\": {\n                  \"$ref\": \"#/definitions/IHipieService\"\n                },\n                \"logicalFile\": {\n                  \"$ref\": \"#/definitions/ILogicalFile\"\n                },\n                \"roxieService\": {\n                  \"$ref\": \"#/definitions/IRoxieService\"\n                },\n                \"wuresult\": {\n                  \"$ref\": \"#/definitions/IWUResult\"\n                }\n              },\n              \"required\": [\n                \"datasource\",\n                \"logicalFile\",\n                \"form\",\n                \"databomb\",\n                \"wuresult\",\n                \"hipieService\",\n                \"roxieService\"\n              ],\n              \"type\": \"object\"\n            },\n            \"fieldTypes\": {\n              \"additionalProperties\": false,\n              \"properties\": {\n                \"dataset\": {\n                  \"$ref\": \"#/definitions/Dataset\"\n                },\n                \"field\": {\n                  \"$ref\": \"#/definitions/IField\"\n                },\n                \"fieldBoolean\": {\n                  \"$ref\": \"#/definitions/IFieldBoolean\"\n                },\n                \"fieldDataset\": {\n                  \"$ref\": \"#/definitions/IFieldDataset\"\n                },\n                \"fieldNumber\": {\n                  \"$ref\": \"#/definitions/IFieldNumber\"\n                },\n                \"fieldNumber64\": {\n                  \"$ref\": \"#/definitions/IFieldNumber64\"\n                },\n                \"fieldObject\": {\n                  \"$ref\": \"#/definitions/IFieldObject\"\n                },\n                \"fieldRange\": {\n                  \"$ref\": \"#/definitions/IFieldRange\"\n                },\n                \"fieldSet\": {\n                  \"$ref\": \"#/definitions/IFieldSet\"\n                },\n                \"fieldString\": {\n                  \"$ref\": \"#/definitions/IFieldString\"\n                },\n                \"fieldType\": {\n                  \"$ref\": \"#/definitions/IFieldType\"\n                },\n                \"number64\": {\n                  \"$ref\": \"#/definitions/Number64\"\n                },\n                \"range\": {\n                  \"$ref\": \"#/definitions/Range\"\n                }\n              },\n              \"required\": [\n                \"number64\",\n                \"range\",\n                \"dataset\",\n                \"fieldType\",\n                \"fieldBoolean\",\n                \"fieldNumber\",\n                \"fieldNumber64\",\n                \"fieldString\",\n                \"fieldRange\",\n                \"fieldDataset\",\n                \"fieldSet\",\n                \"fieldObject\",\n                \"field\"\n              ],\n              \"type\": \"object\"\n            },\n            \"transformationTypes\": {\n              \"additionalProperties\": false,\n              \"properties\": {\n                \"calculated\": {\n                  \"$ref\": \"#/definitions/ICalculated\"\n                },\n                \"equals\": {\n                  \"$ref\": \"#/definitions/IEquals\"\n                },\n                \"map\": {\n                  \"$ref\": \"#/definitions/IMap\"\n                },\n                \"multi\": {\n                  \"$ref\": \"#/definitions/IMulti\"\n                },\n                \"scale\": {\n                  \"$ref\": \"#/definitions/IScale\"\n                },\n                \"template\": {\n                  \"$ref\": \"#/definitions/ITemplate\"\n                }\n              },\n              \"required\": [\n                \"equals\",\n                \"calculated\",\n                \"scale\",\n                \"template\",\n                \"map\",\n                \"multi\"\n              ],\n              \"type\": \"object\"\n            }\n          },\n          \"required\": [\n            \"fieldTypes\",\n            \"datasourceTypes\",\n            \"datasourceRefTypes\",\n            \"activityTypes\",\n            \"aggregateTypes\",\n            \"transformationTypes\"\n          ],\n          \"type\": \"object\"\n        },\n        \"hipieProperties\": {\n          \"$ref\": \"#/definitions/IProperties\"\n        },\n        \"properties\": {\n          \"$ref\": \"#/definitions/IProperties\"\n        },\n        \"version\": {\n          \"const\": \"2.2.1\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"version\",\n        \"createdBy\",\n        \"datasources\",\n        \"dataviews\"\n      ],\n      \"type\": \"object\"\n    },\n    \"VisibilityType\": {\n      \"enum\": [\n        \"normal\",\n        \"flyout\"\n      ],\n      \"type\": \"string\"\n    }\n  }\n}\n\n","import * as _Ajv from \"ajv\";\nimport * as DDL from \"./ddl/v1.ts\";\nimport * as DDL2 from \"./ddl/v2.ts\";\n\nconst Ajv = (_Ajv as any).default || _Ajv;\n\nexport const ddl2Schema: object = _ddl2Schema;\n\nconst options: _Ajv.Options = {\n    allErrors: false,\n    verbose: true\n};\n\nfunction doValidate(ddl: DDL.DDLSchema | DDL2.Schema, schema: DDL.DDLSchema | DDL2.Schema) {\n    const ajv: _Ajv.Ajv = new Ajv(options);\n    const validate = ajv.compile(schema);\n    const success = validate(ddl);\n    return {\n        success,\n        errors: validate.errors\n    };\n}\n\n/* Not needed  ---\n// @ts-ignore\nimport * as ddlSchema from \"../schema/v1.json\";\n\nexport function validate(ddl: DDL.DDLSchema) {\n    return doValidate(ddl, ddlSchema);\n}\n*/\n\nimport _ddl2Schema from \"../schema/v2.json\" with { type: \"json\" };\n\nexport function validate2(ddl: DDL2.Schema) {\n    return doValidate(ddl, _ddl2Schema as any);\n}\n","export * from \"./__package__.ts\";\nimport * as DDL1 from \"./ddl/v1.ts\";\nimport * as DDL2 from \"./ddl/v2.ts\";\nexport * from \"./upgrade.ts\";\nexport * from \"./validate.ts\";\n\nexport { DDL1, DDL2 };\n\nexport function isDDL2Schema(ref: DDL1.DDLSchema | DDL2.Schema): ref is DDL2.Schema {\n    return (ref as DDL2.Schema).version !== undefined && (ref as DDL2.Schema).datasources !== undefined && (ref as DDL2.Schema).dataviews !== undefined;\n}\n"],"mappings":"4gCAAA,IAAa,EAAW,oBACX,EAAc,QACd,EAAgB,goBC0B7B,SAAgB,qBAAqB,EAAiD,CAClF,OAAQ,EAA4B,OAAS,IAAA,EACjD,CAKA,SAAgB,qBAAqB,EAAiD,CAClF,OAAQ,EAA4B,WAAa,EACrD,CAKA,SAAgB,kBAAkB,EAA8C,CAC5E,OAAQ,EAAyB,MAAQ,IAAA,EAC7C,CA0JA,SAAgB,mBAAmB,EAAkD,CACjF,OAAQ,EAA0B,OAAS,OAAU,EAA0B,OAAS,KAC5F,CAMA,SAAgB,oBAAoB,EAAmD,CACnF,OAAQ,EAA2B,OAAS,MAChD,CAUA,SAAgB,qBAAqB,EAAoD,CACrF,OAAQ,EAA4B,OAAS,OACjD,CAOA,SAAgB,qBAAqB,EAAoD,CACrF,OAAQ,EAA4B,OAAS,OACjD,CAOA,SAAgB,sBAAsB,EAAqD,CACvF,OAAQ,EAA6B,OAAS,QAClD,CAsBA,SAAgB,qBAAqB,EAAoD,CACrF,OAAQ,EAA4B,OAAS,OACjD,CAMA,SAAgB,uBAAuB,EAAsD,CACzF,OAAQ,EAA8B,OAAS,UACnD,CAKA,SAAgB,oBAAoB,EAAmD,CACnF,OAAQ,EAA2B,OAAS,MAChD,CAwBA,SAAgB,iBAAiB,EAA4B,CACzD,OAAQ,EAAkC,QAAU,IAAA,EACxD,CACA,SAAgB,kBAAkB,EAA4B,CAC1D,OAAQ,EAAmC,SAAW,IAAA,EAC1D,CACA,SAAgB,iBAAiB,EAA4B,CACzD,OAAQ,EAAkC,UAAY,IAAA,EAC1D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