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ACf,MAAe;IAEf,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QACX,OAAO,CAAC,IAAI,CACV,wBAAwB;YACtB,UAAU;YACV,GAAG;YACH,MAAM;YACN,YAAY;YACZ,UAAU;YACV,2BAA2B,CAC9B,CAAC;IACJ,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,OAAO,CAAC,IAAI,CACV,kCAAgC,UAAU,oCAAiC,CAC5E,CAAC;IACJ,CAAC;IACD,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QACX,OAAO,CAAC,IAAI,CACV,iBAAe,UAAU,4CAAuC,MAAM,MAAG,CAC1E,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,UAAkB,EAAE,MAAe;IAC7D,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QACX,OAAO,CAAC,IAAI,CACV,wBAAwB;YACtB,UAAU;YACV,GAAG;YACH,MAAM;YACN,8FAA8F,CACjG,CAAC;IACJ,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,OAAO,CAAC,IAAI,CACV,8BAA8B;YAC5B,UAAU;YACV,oGAAoG,CACvG,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","file":"util.js","sourceRoot":"","sourcesContent":["declare const window: any;\n\n/**\n * @private\n */\nexport const get = (element: Element | Window, path: string): any => {\n const paths: string[] = path.split('.');\n let obj: any = element;\n for (let i: number = 0; i < paths.length; i++) {\n if (!obj) {\n return null;\n }\n obj = obj[paths[i]];\n }\n return obj;\n};\n\n/**\n * @private\n */\nexport const getPromise = (callback: Function): Promise => {\n const tryNativePromise = () => {\n if (window.Promise) {\n return new Promise((resolve, reject) => {\n callback(resolve, reject);\n });\n } else {\n console.error(\n 'No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular or on a recent browser.'\n );\n }\n };\n\n return tryNativePromise();\n};\n\n/**\n * @private\n * @param pluginRef\n * @returns {null|*}\n */\nexport const getPlugin = (pluginRef: string): any => {\n return get(window, pluginRef);\n};\n\n/**\n * @private\n */\nexport const pluginWarn = (\n pluginName: string,\n plugin?: string,\n method?: string\n): void => {\n if (method) {\n console.warn(\n 'Native: tried calling ' +\n pluginName +\n '.' +\n method +\n ', but the ' +\n pluginName +\n ' plugin is not installed.'\n );\n } else {\n console.warn(\n `'Native: tried accessing the ${pluginName} plugin but it's not installed.`\n );\n }\n if (plugin) {\n console.warn(\n `Install the ${pluginName} plugin: 'ionic cordova plugin add ${plugin}'`\n );\n }\n};\n\n/**\n * @private\n * @param pluginName\n * @param method\n */\nexport const cordovaWarn = (pluginName: string, method?: string): void => {\n if (method) {\n console.warn(\n 'Native: tried calling ' +\n pluginName +\n '.' +\n method +\n ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'\n );\n } else {\n console.warn(\n 'Native: tried accessing the ' +\n pluginName +\n ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'\n );\n }\n};\n"]}