{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_bc/cartridge/client/default/js/cloudinaryVideos.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","pushEventVideo","action","event","title","$","Player","options","videojsOptions","id","data","document","trigger","eventAction","eventLabel","initCloudinaryVideos","cld","each","videoRef","this","videoCong","videoId","confObj","JSON","parse","playerConfig","colors","accent","fluid","fontFace","playedEventPercents","conf","cloud_name","cloudName","cname","secure_distribution","private_cdn","cloudinary","Cloudinary","config","secure","window","parent","hasClass","playerConf","is","videoPlayer","source","publicId","sourceConfig","on","e","error","videojs","elemernt","hide","code","message","controls","eventData","percent","initializeCloudinaryPlayer","restartInizializedVideo","videoConf","autoplay","inizializedVideo","players","play"],"mappings":"aACE,IAAIA,EAAmB,CAAC,EAGxB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,CAAC,GAUX,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,OACf,CAIAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,GAEhE,EAGAZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,GACvD,EA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QC,eAAekD,UAEhCzD,EADY,cAAgBkD,EAAEQ,UAAUC,QAAU,IAC5BT,EAE9B,GAxDA,CAyDJ,CAiCYU,CAA2B7C,EAAKK,EAASC,EAEjD,GACJ,CAEAjB,EAAEoC,QAAQS,GAAG,OAAQnC,GAErB/C,EAAOD,QAAU,CACbgD,qBAAsBA,EACtB+C,wBArHJ,WACIzD,EAAE,wBAAwBY,MAAK,WAC3B,IAAIC,EAAWb,EAAEc,MACb4C,EAAY7C,EAASR,KAAK,aAC1BW,EAAUH,EAASR,KAAK,WAE5B,GADca,KAAKC,MAAMD,KAAKC,MAAMuC,IACxBtC,aAAauC,SAAU,CAC/B,IAAIC,EAAmBZ,QAAQa,QAAQ7C,GACnC4C,GACAA,EAAiBE,MAEzB,CACJ,GACJ,E","file":"cloudinaryVideos.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 39);\n","\nfunction pushEventVideo(action, event) {\n var title = $('.js-cloudinary-video[data-videoid=\"' + event.Player.options.videojsOptions.id + '\"]').data('analyticstitle');\n $(document).trigger('analytics:video', { eventAction: action, eventLabel: title });\n}\n\nfunction restartInizializedVideo(videoId) {\n $('.js-cloudinary-video').each(function() {\n var videoRef = $(this);\n var videoConf = videoRef.data('videoconf');\n var videoId = videoRef.data('videoid');\n var confObj = JSON.parse(JSON.parse(videoConf));\n if (confObj.playerConfig.autoplay) {\n var inizializedVideo = videojs.players[videoId];\n if (inizializedVideo) {\n inizializedVideo.play();\n }\n };\n });\n}\n\nfunction initializeCloudinaryPlayer(cld, videoId, playerConf) {\n if (!$('#' + videoId).is('video')) {\n return; // prevent multi vidoe initialization\n }\n var p = cld.videoPlayer(videoId, playerConf.playerConfig);\n // avoid overriding of video transformation defined on page designer video config\n // var currentTransformations = playerConf.sourceConfig.transformation;\n\n // var cropActive = false;\n // searching for current page designer video transformation\n // for (var i = 0; i < currentTransformations.length; i++) {\n // var transf = currentTransformations[i];\n // for (const [key, value] of Object.entries(transf)) {\n // // if (value.indexOf('c_') > -1) {\n // // cropActive = true;\n // // }\n // }\n // }\n // var chain = p.transformation();\n // if (!cropActive) {\n // var videoNativeWidth = playerConf.sourceConfig.video.asset.width;\n // var width = $('[data-videoid=\"' + videoId + '\"]').width();\n // if (width) {\n // var ceil = Math.ceil(width);\n // if (ceil < videoNativeWidth) {\n // chain.crop('scale').width(ceil);\n // }\n // }\n // TODO: si generano troppe trasformazioni, gestire i breakpoint? 4k, fullhd, tablet ( mobile può restare come è )\n // chain.crop('scale');\n // }\n\n p.source(playerConf.publicId, playerConf.sourceConfig);\n p.on('error', function(e) {\n const error = e.Player.videojs.error();\n var elemernt = $('[data-videoid=\"' + videoId + '\"]');\n $(elemernt).hide();\n if (error && error.code === 10) {\n p.videojs.error(null);\n p.videojs.error({\n code: null, message: 'Generating the video, please wait.'\n });\n }\n });\n p.on('pause', function(e) {\n if (e.Player.options.videojsOptions.controls) {\n pushEventVideo('pause', e);\n }\n });\n p.on('play', function(e) {\n if (e.Player.options.videojsOptions.controls) {\n pushEventVideo('play', e);\n }\n });\n p.on('percentsplayed', function(e) {\n if (e.Player.options.videojsOptions.controls) {\n var event = 'progress - ' + e.eventData.percent + '%';\n pushEventVideo(event, e);\n }\n });\n}\n\nfunction initCloudinaryVideos(e) {\n var cld;\n $('.js-cloudinary-video').each(function() {\n var videoRef = $(this);\n var videoCong = videoRef.data('videoconf');\n var videoId = videoRef.data('videoid');\n var confObj = JSON.parse(JSON.parse(videoCong));\n confObj.playerConfig.colors = {\n accent: '#7c7c7c'\n };\n confObj.playerConfig.fluid = true;\n confObj.playerConfig.fontFace = 'inherit';\n confObj.playerConfig.playedEventPercents = [25, 50, 75, 100];\n // confObj.playerConfig.analytics = true; NON compatibile con datalayer\n if (!cld) {\n let conf = {\n cloud_name: confObj.cloudName\n };\n if (confObj.cname) {\n conf.secure_distribution = confObj.cname;\n conf.private_cdn = true;\n }\n cld = cloudinary.Cloudinary.new(conf);\n let config = cld.config();\n if (config.secure === false) {\n delete cld.config({ cname: window.cname }).secure_distribution;\n }\n }\n if ((!videoRef.parent().hasClass('cc-content-video-mobile') && !videoRef.parent().hasClass('cc-content-video-desktop')) || // only desktop video available\n (videoRef.parent().hasClass('cc-content-video-mobile') && $('body').hasClass('cc-mobile')) || // video mobile and body mobile\n (videoRef.parent().hasClass('cc-content-video-desktop') && !$('body').hasClass('cc-mobile'))) { // video desktop and body desktop\n initializeCloudinaryPlayer(cld, videoId, confObj);\n }\n });\n}\n\n$(window).on('load', initCloudinaryVideos);\n\nmodule.exports = {\n initCloudinaryVideos: initCloudinaryVideos,\n restartInizializedVideo: restartInizializedVideo\n};\n"],"sourceRoot":""}