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O,GAAM,SAAS,EAAI,EAAM,EAAM,GACrC,QAAQ,IAAI,gBAAiB,EAAM,IAAI,EAAK,MAAM,IAAI,EAAK,OAAO,KAClE,KAAK,EAAQ,KACR,IAAQ,KAAK,EAAI,MACD,KAAd,aACL,GAAG,cAAc,iBAAiB,KAClC,GAAG,cAAc,iBAAiB,KAEtC,GACJ,CAEA,SAAS,UAAU,GAGjB,IAFA,IAAI,EAAa,EAAQ,MAAM,KAC3B,EAAe,KACT,EAAI,EAAG,EAAI,EAAW,OAAQ,IACtC,GAAgB,IAAI,EAAW,GACzB,GAAG,WAAY,IACnB,GAAG,UAAU,EAAc,IAGjC,CAEA,SAAS,oBAAoB,EAAQ,EAAO,GAC1C,GAAe,MAAV,EAAL,CAIA,IAHA,IAAI,EAAa,IACb,GAAS,EACT,EAAM,EAAM,EACP,EAAI,EAAG,EAAI,EAAO,OAAQ,IAAK,CACtC,IAAI,EAAM,EAAO,GACjB,GAAiB,QAAZ,EAAI,MAA8B,SAAZ,EAAI,MAAoB,EAAI,MAAQ,GAAS,EAAI,OAAS,EAAU,CAC7F,IAAI,EAAO,KAAK,IAAI,EAAI,EAAI,OACvB,EAAO,IACV,EAAa,EACb,EAAQ,EAEZ,CACF,CACA,OAAe,GAAV,EAAuB,EAAO,QAAnC,CAdoC,CAetC","file":"/npm/phonegap-icon-splash-generator@2.0.0/phonegap-icon-splash-generator.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/phonegap-icon-splash-generator@2.0.0/phonegap-icon-splash-generator.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const gm          = require(\"gm\").subClass({ imageMagick: true })\nconst fs          = require(\"fs\")\nconst path        = process.argv[1].replace(/\\\\/,'/').replace(\"/phonegap-icon-splash-generator.js\",\"\").replace(\"\\\\phonegap-icon-splash-generator.js\",\"\")\n\nvar xml = \"\"\nvar log = \"\"\nvar images = {}\nvar sorting = 0\nvar processing = 0\nvar sizes = JSON.parse(fs.readFileSync(path+\"/sizes.json\", \"UTF-8\"))\n\nfunction ImageProcessor( path, type, source ) {\n  const self = this\n\n  this.path     = path+\"/resources/source/\"+type+\"/\"+source\n  this.gm       = gm(this.path)\n  this.events   = {}\n  this.type     = type\n  this.source   = source\n  \n  this.gm.identify(function(nan, props) {\n    self.background = props['Background color']\n    self.format     = props.format\n    self.width      = props.size.width\n    self.height     = props.size.height\n    self.ratio      = self.width / self.height\n    self.gcd = gcd( self.width, self.height )\n    self.aspect_ratio = getAspectRatio( self.width, self.height )\n    self.resolution   = Number(props[\"Number pixels\"].replace(\"K\",\"000\").replace(\"M\",\"000000\"))\n    self.trigger('init')\n  })\n\n  this.gm.quality(100)\n}\nImageProcessor.prototype.trigger = function(type, params) {\n  if ( typeof this.events[type] == 'undefined' ) { return; }\n  for (var i = this.events[type].length - 1; i >= 0; i--) {\n    var event = this.events[type][i]\n    if ( event.callback.call(this, params) || event.temp ) { this.events[type].splice(i,1) }\n  }\n}\nImageProcessor.prototype.on = function(type, callback, id) {\n  if ( typeof this.events[type] == 'undefined' ) { this.events[type] = [] }\n  this.events[type].push({ callback: callback, id: id })\n}\nImageProcessor.prototype.once = function(type, callback, id) {\n  if ( typeof this.events[type] == 'undefined' ) { this.events[type] = [] }\n  this.events[type].push({ callback: callback, id: id, temp: true })\n}\n\nfunction gcd(a,b) {\n  if ( b == 0 ) { return a }\n  return gcd( b, a % b )\n}\nfunction getAspectRatio(width, height) {\n  var r = gcd(width, height)\n  return (width/r).toString() + \":\" + (height/r).toString()\n}\n\nvar types = fs.readdirSync(path+\"/resources/source\")\nfor ( var type of types ) {\n  var sources = fs.readdirSync(path+\"/resources/source/\"+type)\n  for ( var source of sources ) {\n    sorting++\n    console.log(\"Found source\", type, source)\n    var ip = new ImageProcessor( path, type, source )\n    ip.once('init', function(_type){\n      return function() {\n        sortImages(this, _type)\n        if ( --sorting == 0 ) {  processImages(images) }\n      }\n    }(type))\n  }\n}\n\nfunction sortImages( image_processor, type ) {\n  if ( typeof images[type] == \"undefined\" ) { images[type] = [] }\n  for (var i = images[type].length - 1; i >= 0; i--) {\n    if (images[type][i].aspect_ratio === image_processor.aspect_ratio) {\n      if ( image_processor.resolution > images[type][i].resolution ) {\n        console.log(\"Discarding\",images[type][i].type,images[type][i].width+\"x\"+images[type][i].height,\"for higher res image\")\n        images[type].splice(i, 1)\n        break;\n      } else {\n        return;\n      }\n    }\n  }\n  console.log(\"Using\",image_processor.type,image_processor.width+\"x\"+image_processor.height)\n  images[type].push(image_processor)\n}\n\nfunction processImages(images) {\n  for ( var type in sizes ) {\n    for ( var platform in sizes[type] ) {\n      for ( var size of sizes[type][platform].sizes ) {\n        if ( typeof images[type] != \"undefined\" ) {\n          var ar = getAspectRatio( size.width, size.height )\n          var found = false\n          for ( var image of images[type] ) {\n            if ( image.aspect_ratio == ar ) {\n              found = true\n              processImage( size, sizes[type][platform].path, image, type, platform )\n              break;\n            }\n          }\n          if ( !found ) {\n            console.log(\"WARN: Missing \"+type+\" \"+size.width+\"x\"+size.height+\" (\"+ar+\") for \"+platform+\" \"+size.name)\n            var image = getBestFitProcessor( images[type], size.width, size.height, type )\n            if ( !image ) {\n              console.log(\"ERR: No appropriate images found\")\n            } else {\n              console.log(\"Using best fit\", image.width+\"x\"+image.height, \"for\", size.width, size.height)\n              switch ( type ) {\n                case \"icon\" :\n                case \"store\": extendImage( size, sizes[type][platform].path, image, type, platform ); break;\n                default     : cutImage( size, sizes[type][platform].path, image, type, platform );    break;\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n\nfunction processImage( size, path, image, type, platform ) {\n  checkPath(path)\n  var dest = path+\"/\"+size.name+\".png\"\n  processing++\n  switch ( type ) {\n    case 'icon':\n    case 'splash':\n      switch ( platform ) {\n        case \"windows\": xml += '<'+type+' platform=\"winphone\" width=\"'+size.width+'\" height=\"'+size.height+'\" src=\"'+dest.replace(\"www/\",\"\")+'\"></'+type+'>\\n'; break;\n        case \"android\": xml += '<'+type+' platform=\"android\" qualifier=\"'+size.qualifier+'\" width=\"'+size.width+'\" height=\"'+size.height+'\" src=\"'+dest.replace(\"www/\",\"\")+'\"></'+type+'>\\n'; break;\n        default       : xml += '<'+type+' platform=\"'+platform+'\" width=\"'+size.width+'\" height=\"'+size.height+'\" src=\"'+dest.replace(\"www/\",\"\")+'\"></'+type+'>\\n';\n      }\n    break;\n  }\n  gm(image.path)\n    .quality(100)\n    .gravity('Center')\n    .scale(size.width, size.height)\n    .write( dest, function(err,data2,data2,command) {\n      console.log(\"Image created\", dest, \"(\"+size.width+\"x\"+size.height+\")\")\n      log+=command+\"\\n\"\n      if ( err ) { log+=err+\"\\n\" }\n      if ( --processing == 0 ) {\n        fs.writeFileSync(\"iconsplash.xml\",xml)\n        fs.writeFileSync(\"iconsplash.log\",log)\n      }\n    })\n}\nfunction extendImage( size, path, image, type, platform ) {\n  checkPath(path)\n  var dest = path+\"/\"+size.name+\".png\"\n  var icon = {\n    width : image.width,\n    height: image.height\n  }\n  if ( icon.width > size.width ) {\n    var r = size.width/icon.width\n    icon.width = Math.floor(icon.width*r)\n    icon.height = Math.floor(icon.height*r)\n  }\n  if ( icon.height > size.height ) {\n    var r = size.height/icon.height\n    icon.width = Math.floor(icon.width*r)\n    icon.height = Math.floor(icon.height*r)\n  }\n  processing++\n  switch ( type ) {\n    case 'icon':\n    case 'splash':\n      switch ( platform ) {\n        case \"windows\": xml += '<'+type+' platform=\"winphone\" width=\"'+size.width+'\" height=\"'+size.height+'\" src=\"'+dest.replace(\"www/\",\"\")+'\"></'+type+'>\\n'; break;\n        case \"android\": xml += '<'+type+' platform=\"android\" qualifier=\"'+size.qualifier+'\" width=\"'+size.width+'\" height=\"'+size.height+'\" src=\"'+dest.replace(\"www/\",\"\")+'\"></'+type+'>\\n'; break;\n        default       : xml += '<'+type+' platform=\"'+platform+'\" width=\"'+size.width+'\" height=\"'+size.height+'\" src=\"'+dest.replace(\"www/\",\"\")+'\"></'+type+'>\\n';\n      }\n    break;\n  }\n  gm(image.path)\n    .resize( icon.width, icon.height )\n    .gravity(\"Center\")\n    .alpha('remove')\n    .background(image.background)\n    .extent( size.width, size.height )\n    .write( dest, function(err,data2,data2,command) {\n      console.log(\"Image created\", dest, \"(\"+size.width+\"x\"+size.height+\")\")\n      log+=command+\"\\n\"\n      if ( err ) { log+=err+\"\\n\" }\n      if ( --processing == 0 ) {\n        fs.writeFileSync(\"iconsplash.xml\",xml)\n        fs.writeFileSync(\"iconsplash.log\",log)\n      }\n    })\n}\n\nfunction cutImage( size, path, image, type, platform ) {\n  checkPath(path)\n  var dest = path+\"/\"+size.name+\".png\"\n  processing++\n  switch ( type ) {\n    case 'icon':\n    case 'splash':\n      switch ( platform ) {\n        case \"windows\": xml += '<'+type+' platform=\"winphone\" width=\"'+size.width+'\" height=\"'+size.height+'\" src=\"'+dest.replace(\"www/\",\"\")+'\"></'+type+'>\\n'; break;\n        case \"android\": xml += '<'+type+' platform=\"android\" qualifier=\"'+size.qualifier+'\" width=\"'+size.width+'\" height=\"'+size.height+'\" src=\"'+dest.replace(\"www/\",\"\")+'\"></'+type+'>\\n'; break;\n        default       : xml += '<'+type+' platform=\"'+platform+'\" width=\"'+size.width+'\" height=\"'+size.height+'\" src=\"'+dest.replace(\"www/\",\"\")+'\"></'+type+'>\\n';\n      }\n    break;\n  }\n  gm(image.path)\n    .crop( size.width, size.height, (image.width-size.width)/2, (image.height-size.height)/2 )\n    .gravity(\"Center\")\n    .alpha('remove')\n    .write( dest, function(err,data2,data2,command) {\n      console.log(\"Image created\", dest, \"(\"+size.width+\"x\"+size.height+\")\")\n      log+=command+\"\\n\"\n      if ( err ) { log+=err+\"\\n\" }\n      if ( --processing == 0 ) {\n        fs.writeFileSync(\"iconsplash.xml\",xml)\n        fs.writeFileSync(\"iconsplash.log\",log)\n      }\n    })\n}\n\nfunction checkPath(dirpath) {\n  var path_parts = dirpath.split('/')\n  var current_path = path\n  for ( var i = 0; i < path_parts.length; i++ ) {\n    current_path += \"/\"+path_parts[i]\n    if ( !fs.existsSync( current_path ) ) {\n      fs.mkdirSync(current_path, 0744);\n    }\n  }\n}\n\nfunction getBestFitProcessor(images, width, height) {\n  if ( images == undefined ) { return }\n  var ratio_diff = 1000\n  var index = -1\n  var scl = width/height\n  for (var i = 0; i < images.length; i++) {\n    var img = images[i]\n    if ( img.type == \"icon\" || img.type == \"store\" || (img.width > width && img.height > height) ) {\n      var diff = Math.abs(scl-img.ratio)\n      if ( diff < ratio_diff ) {\n        ratio_diff = diff\n        index = i\n      }\n    }\n  }\n  if ( index != -1 ) { return images[index] }\n}"]}