Last active
July 6, 2016 02:28
-
-
Save chenkaie/8d6bbb933ca349ba92fd2af2d443b02a to your computer and use it in GitHub Desktop.
FB video upload parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (self.CavalryLogger) { | |
| CavalryLogger.start_js(["xTY7O"]); | |
| } | |
| __d('FileHasher', ['WebWorker', 'fileSliceName', 'emptyFunction', 'FileHashWorkerResource'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| h.isSupported = function() { | |
| 'use strict'; | |
| return c('WebWorker').isSupported(); | |
| }; | |
| function h() { | |
| 'use strict'; | |
| var i = c('FileHashWorkerResource'); | |
| c('WebWorker').prepareResource(i); | |
| this.$FileHasher1 = new(c('WebWorker'))(i).setMessageHandler(function(j) { | |
| this.$FileHasher2(j); | |
| }.bind(this)).execute(); | |
| } | |
| h.prototype.hash = function(i, j) { | |
| 'use strict'; | |
| this.$FileHasher2 = j; | |
| this.$FileHasher1.postMessage({ | |
| file: i, | |
| fileSliceName: c('fileSliceName') | |
| }); | |
| return this; | |
| }; | |
| h.prototype.destroy = function() { | |
| 'use strict'; | |
| this.$FileHasher2 = c('emptyFunction'); | |
| this.$FileHasher1.terminate(); | |
| }; | |
| f.exports = h; | |
| }, null); | |
| /* | |
| * @preserve-header | |
| * | |
| * Javascript EXIF Reader 0.1.6 | |
| * Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/ | |
| * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt] | |
| */ | |
| __d("exif/exif", [], function a(b, c, d, e, f, g) { | |
| c.__markCompiled && c.__markCompiled(); | |
| var h = (function() { | |
| var i = { | |
| 36864: "ExifVersion", | |
| 40960: "FlashpixVersion", | |
| 40961: "ColorSpace", | |
| 40962: "PixelXDimension", | |
| 40963: "PixelYDimension", | |
| 37121: "ComponentsConfiguration", | |
| 37122: "CompressedBitsPerPixel", | |
| 37500: "MakerNote", | |
| 37510: "UserComment", | |
| 40964: "RelatedSoundFile", | |
| 36867: "DateTimeOriginal", | |
| 36868: "DateTimeDigitized", | |
| 37520: "SubsecTime", | |
| 37521: "SubsecTimeOriginal", | |
| 37522: "SubsecTimeDigitized", | |
| 33434: "ExposureTime", | |
| 33437: "FNumber", | |
| 34850: "ExposureProgram", | |
| 34852: "SpectralSensitivity", | |
| 34855: "ISOSpeedRatings", | |
| 34856: "OECF", | |
| 37377: "ShutterSpeedValue", | |
| 37378: "ApertureValue", | |
| 37379: "BrightnessValue", | |
| 37380: "ExposureBias", | |
| 37381: "MaxApertureValue", | |
| 37382: "SubjectDistance", | |
| 37383: "MeteringMode", | |
| 37384: "LightSource", | |
| 37385: "Flash", | |
| 37396: "SubjectArea", | |
| 37386: "FocalLength", | |
| 41483: "FlashEnergy", | |
| 41484: "SpatialFrequencyResponse", | |
| 41486: "FocalPlaneXResolution", | |
| 41487: "FocalPlaneYResolution", | |
| 41488: "FocalPlaneResolutionUnit", | |
| 41492: "SubjectLocation", | |
| 41493: "ExposureIndex", | |
| 41495: "SensingMethod", | |
| 41728: "FileSource", | |
| 41729: "SceneType", | |
| 41730: "CFAPattern", | |
| 41985: "CustomRendered", | |
| 41986: "ExposureMode", | |
| 41987: "WhiteBalance", | |
| 41988: "DigitalZoomRation", | |
| 41989: "FocalLengthIn35mmFilm", | |
| 41990: "SceneCaptureType", | |
| 41991: "GainControl", | |
| 41992: "Contrast", | |
| 41993: "Saturation", | |
| 41994: "Sharpness", | |
| 41995: "DeviceSettingDescription", | |
| 41996: "SubjectDistanceRange", | |
| 40965: "InteroperabilityIFDPointer", | |
| 42016: "ImageUniqueID" | |
| }, | |
| j = { | |
| 256: "ImageWidth", | |
| 257: "ImageHeight", | |
| 34665: "ExifIFDPointer", | |
| 34853: "GPSInfoIFDPointer", | |
| 40965: "InteroperabilityIFDPointer", | |
| 258: "BitsPerSample", | |
| 259: "Compression", | |
| 262: "PhotometricInterpretation", | |
| 274: "Orientation", | |
| 277: "SamplesPerPixel", | |
| 284: "PlanarConfiguration", | |
| 530: "YCbCrSubSampling", | |
| 531: "YCbCrPositioning", | |
| 282: "XResolution", | |
| 283: "YResolution", | |
| 296: "ResolutionUnit", | |
| 273: "StripOffsets", | |
| 278: "RowsPerStrip", | |
| 279: "StripByteCounts", | |
| 513: "JPEGInterchangeFormat", | |
| 514: "JPEGInterchangeFormatLength", | |
| 301: "TransferFunction", | |
| 318: "WhitePoint", | |
| 319: "PrimaryChromaticities", | |
| 529: "YCbCrCoefficients", | |
| 532: "ReferenceBlackWhite", | |
| 306: "DateTime", | |
| 270: "ImageDescription", | |
| 271: "Make", | |
| 272: "Model", | |
| 305: "Software", | |
| 315: "Artist", | |
| 33432: "Copyright" | |
| }, | |
| k = { | |
| 0: "GPSVersionID", | |
| 1: "GPSLatitudeRef", | |
| 2: "GPSLatitude", | |
| 3: "GPSLongitudeRef", | |
| 4: "GPSLongitude", | |
| 5: "GPSAltitudeRef", | |
| 6: "GPSAltitude", | |
| 7: "GPSTimeStamp", | |
| 8: "GPSSatellites", | |
| 9: "GPSStatus", | |
| 10: "GPSMeasureMode", | |
| 11: "GPSDOP", | |
| 12: "GPSSpeedRef", | |
| 13: "GPSSpeed", | |
| 14: "GPSTrackRef", | |
| 15: "GPSTrack", | |
| 16: "GPSImgDirectionRef", | |
| 17: "GPSImgDirection", | |
| 18: "GPSMapDatum", | |
| 19: "GPSDestLatitudeRef", | |
| 20: "GPSDestLatitude", | |
| 21: "GPSDestLongitudeRef", | |
| 22: "GPSDestLongitude", | |
| 23: "GPSDestBearingRef", | |
| 24: "GPSDestBearing", | |
| 25: "GPSDestDistanceRef", | |
| 26: "GPSDestDistance", | |
| 27: "GPSProcessingMethod", | |
| 28: "GPSAreaInformation", | |
| 29: "GPSDateStamp", | |
| 30: "GPSDifferential" | |
| }, | |
| l = { | |
| ExposureProgram: { | |
| 0: "Not defined", | |
| 1: "Manual", | |
| 2: "Normal program", | |
| 3: "Aperture priority", | |
| 4: "Shutter priority", | |
| 5: "Creative program", | |
| 6: "Action program", | |
| 7: "Portrait mode", | |
| 8: "Landscape mode" | |
| }, | |
| MeteringMode: { | |
| 0: "Unknown", | |
| 1: "Average", | |
| 2: "CenterWeightedAverage", | |
| 3: "Spot", | |
| 4: "MultiSpot", | |
| 5: "Pattern", | |
| 6: "Partial", | |
| 255: "Other" | |
| }, | |
| LightSource: { | |
| 0: "Unknown", | |
| 1: "Daylight", | |
| 2: "Fluorescent", | |
| 3: "Tungsten (incandescent light)", | |
| 4: "Flash", | |
| 9: "Fine weather", | |
| 10: "Cloudy weather", | |
| 11: "Shade", | |
| 12: "Daylight fluorescent (D 5700 - 7100K)", | |
| 13: "Day white fluorescent (N 4600 - 5400K)", | |
| 14: "Cool white fluorescent (W 3900 - 4500K)", | |
| 15: "White fluorescent (WW 3200 - 3700K)", | |
| 17: "Standard light A", | |
| 18: "Standard light B", | |
| 19: "Standard light C", | |
| 20: "D55", | |
| 21: "D65", | |
| 22: "D75", | |
| 23: "D50", | |
| 24: "ISO studio tungsten", | |
| 255: "Other" | |
| }, | |
| Flash: { | |
| 0: "Flash did not fire", | |
| 1: "Flash fired", | |
| 5: "Strobe return light not detected", | |
| 7: "Strobe return light detected", | |
| 9: "Flash fired, compulsory flash mode", | |
| 13: "Flash fired, compulsory flash mode, return light not detected", | |
| 15: "Flash fired, compulsory flash mode, return light detected", | |
| 16: "Flash did not fire, compulsory flash mode", | |
| 24: "Flash did not fire, auto mode", | |
| 25: "Flash fired, auto mode", | |
| 29: "Flash fired, auto mode, return light not detected", | |
| 31: "Flash fired, auto mode, return light detected", | |
| 32: "No flash function", | |
| 65: "Flash fired, red-eye reduction mode", | |
| 69: "Flash fired, red-eye reduction mode, return light not detected", | |
| 71: "Flash fired, red-eye reduction mode, return light detected", | |
| 73: "Flash fired, compulsory flash mode, red-eye reduction mode", | |
| 77: "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected", | |
| 79: "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected", | |
| 89: "Flash fired, auto mode, red-eye reduction mode", | |
| 93: "Flash fired, auto mode, return light not detected, red-eye reduction mode", | |
| 95: "Flash fired, auto mode, return light detected, red-eye reduction mode" | |
| }, | |
| SensingMethod: { | |
| 1: "Not defined", | |
| 2: "One-chip color area sensor", | |
| 3: "Two-chip color area sensor", | |
| 4: "Three-chip color area sensor", | |
| 5: "Color sequential area sensor", | |
| 7: "Trilinear sensor", | |
| 8: "Color sequential linear sensor" | |
| }, | |
| SceneCaptureType: { | |
| 0: "Standard", | |
| 1: "Landscape", | |
| 2: "Portrait", | |
| 3: "Night scene" | |
| }, | |
| SceneType: { | |
| 1: "Directly photographed" | |
| }, | |
| CustomRendered: { | |
| 0: "Normal process", | |
| 1: "Custom process" | |
| }, | |
| WhiteBalance: { | |
| 0: "Auto white balance", | |
| 1: "Manual white balance" | |
| }, | |
| GainControl: { | |
| 0: "None", | |
| 1: "Low gain up", | |
| 2: "High gain up", | |
| 3: "Low gain down", | |
| 4: "High gain down" | |
| }, | |
| Contrast: { | |
| 0: "Normal", | |
| 1: "Soft", | |
| 2: "Hard" | |
| }, | |
| Saturation: { | |
| 0: "Normal", | |
| 1: "Low saturation", | |
| 2: "High saturation" | |
| }, | |
| Sharpness: { | |
| 0: "Normal", | |
| 1: "Soft", | |
| 2: "Hard" | |
| }, | |
| SubjectDistanceRange: { | |
| 0: "Unknown", | |
| 1: "Macro", | |
| 2: "Close view", | |
| 3: "Distant view" | |
| }, | |
| FileSource: { | |
| 3: "DSC" | |
| }, | |
| Components: { | |
| 0: "", | |
| 1: "Y", | |
| 2: "Cb", | |
| 3: "Cr", | |
| 4: "R", | |
| 5: "G", | |
| 6: "B" | |
| } | |
| }; | |
| function m(y, event, z) { | |
| if (y.addEventListener) { | |
| y.addEventListener(event, z, false); | |
| } else if (y.attachEvent) y.attachEvent("on" + event, z); | |
| } | |
| function n(y) { | |
| return !!(y.exifdata); | |
| } | |
| function o(y, z) { | |
| BinaryAjax(y.src, function(aa) { | |
| var ba = p(aa.binaryResponse); | |
| y.exifdata = ba || {}; | |
| if (z) z.call(y); | |
| }); | |
| } | |
| function p(y) { | |
| if (y.getByteAt(0) != 255 || y.getByteAt(1) != 216) return false; | |
| var z = 2, | |
| aa = y.getLength(), | |
| ba; | |
| while (z < aa) { | |
| if (y.getByteAt(z) != 255) return false; | |
| ba = y.getByteAt(z + 1); | |
| if (ba == 22400) { | |
| return s(y, z + 4, y.getShortAt(z + 2, true) - 2); | |
| } else if (ba == 225) { | |
| return s(y, z + 4, y.getShortAt(z + 2, true) - 2); | |
| } else z += 2 + y.getShortAt(z + 2, true); | |
| } | |
| } | |
| function q(y, z, aa, ba, ca) { | |
| var da = y.getShortAt(aa, ca), | |
| ea = {}, | |
| fa, ga, ha; | |
| for (ha = 0; ha < da; ha++) { | |
| fa = aa + ha * 12 + 2; | |
| ga = ba[y.getShortAt(fa, ca)]; | |
| ea[ga] = r(y, fa, z, aa, ca); | |
| } | |
| return ea; | |
| } | |
| function r(y, z, aa, ba, ca) { | |
| var da = y.getShortAt(z + 2, ca), | |
| ea = y.getLongAt(z + 4, ca), | |
| fa = y.getLongAt(z + 8, ca) + aa, | |
| ga, ha, ia, ja, ka, la; | |
| switch (da) { | |
| case 1: | |
| case 7: | |
| if (ea == 1) { | |
| return y.getByteAt(z + 8, ca); | |
| } else { | |
| ga = ea > 4 ? fa : (z + 8); | |
| ha = []; | |
| for (ja = 0; ja < ea; ja++) ha[ja] = y.getByteAt(ga + ja); | |
| return ha; | |
| } | |
| case 2: | |
| ga = ea > 4 ? fa : (z + 8); | |
| return y.getStringAt(ga, ea - 1); | |
| case 3: | |
| if (ea == 1) { | |
| return y.getShortAt(z + 8, ca); | |
| } else { | |
| ga = ea > 2 ? fa : (z + 8); | |
| ha = []; | |
| for (ja = 0; ja < ea; ja++) ha[ja] = y.getShortAt(ga + 2 * ja, ca); | |
| return ha; | |
| } | |
| case 4: | |
| if (ea == 1) { | |
| return y.getLongAt(z + 8, ca); | |
| } else { | |
| ha = []; | |
| for (var ja = 0; ja < ea; ja++) ha[ja] = y.getLongAt(fa + 4 * ja, ca); | |
| return ha; | |
| } | |
| case 5: | |
| if (ea == 1) { | |
| ka = y.getLongAt(fa, ca); | |
| la = y.getLongAt(fa + 4, ca); | |
| ia = new Number(ka / la); | |
| ia.numerator = ka; | |
| ia.denominator = la; | |
| return ia; | |
| } else { | |
| ha = []; | |
| for (ja = 0; ja < ea; ja++) { | |
| ka = y.getLongAt(fa + 8 * ja, ca); | |
| la = y.getLongAt(fa + 4 + 8 * ja, ca); | |
| ha[ja] = new Number(ka / la); | |
| ha[ja].numerator = ka; | |
| ha[ja].denominator = la; | |
| } | |
| return ha; | |
| } | |
| case 9: | |
| if (ea == 1) { | |
| return y.getSLongAt(z + 8, ca); | |
| } else { | |
| ha = []; | |
| for (ja = 0; ja < ea; ja++) ha[ja] = y.getSLongAt(fa + 4 * ja, ca); | |
| return ha; | |
| } | |
| case 10: | |
| if (ea == 1) { | |
| return y.getSLongAt(fa, ca) / y.getSLongAt(fa + 4, ca); | |
| } else { | |
| ha = []; | |
| for (ja = 0; ja < ea; ja++) ha[ja] = y.getSLongAt(fa + 8 * ja, ca) / y.getSLongAt(fa + 4 + 8 * ja, ca); | |
| return ha; | |
| } | |
| } | |
| } | |
| function s(y, z) { | |
| if (y.getStringAt(z, 4) != "Exif") return false; | |
| var aa, ba, ca, da, ea, fa = z + 6; | |
| if (y.getShortAt(fa) == 18761) { | |
| aa = false; | |
| } else if (y.getShortAt(fa) == 19789) { | |
| aa = true; | |
| } else return false; | |
| if (y.getShortAt(fa + 2, aa) != 42) return false; | |
| if (y.getLongAt(fa + 4, aa) != 8) return false; | |
| ba = q(y, fa, fa + 8, j, aa); | |
| if (ba.ExifIFDPointer) { | |
| da = q(y, fa, fa + ba.ExifIFDPointer, i, aa); | |
| for (ca in da) { | |
| switch (ca) { | |
| case "LightSource": | |
| case "Flash": | |
| case "MeteringMode": | |
| case "ExposureProgram": | |
| case "SensingMethod": | |
| case "SceneCaptureType": | |
| case "SceneType": | |
| case "CustomRendered": | |
| case "WhiteBalance": | |
| case "GainControl": | |
| case "Contrast": | |
| case "Saturation": | |
| case "Sharpness": | |
| case "SubjectDistanceRange": | |
| case "FileSource": | |
| da[ca] = l[ca][da[ca]]; | |
| break; | |
| case "ExifVersion": | |
| case "FlashpixVersion": | |
| da[ca] = String.fromCharCode(da[ca][0], da[ca][1], da[ca][2], da[ca][3]); | |
| break; | |
| case "ComponentsConfiguration": | |
| da[ca] = l.Components[da[ca][0]] + l.Components[da[ca][1]] + l.Components[da[ca][2]] + l.Components[da[ca][3]]; | |
| break; | |
| } | |
| ba[ca] = da[ca]; | |
| } | |
| } | |
| if (ba.GPSInfoIFDPointer) { | |
| ea = q(y, fa, fa + ba.GPSInfoIFDPointer, k, aa); | |
| for (ca in ea) { | |
| switch (ca) { | |
| case "GPSVersionID": | |
| ea[ca] = ea[ca][0] + "." + ea[ca][1] + "." + ea[ca][2] + "." + ea[ca][3]; | |
| break; | |
| } | |
| ba[ca] = ea[ca]; | |
| } | |
| } | |
| return ba; | |
| } | |
| function t(y, z) { | |
| if (!y.complete) return false; | |
| if (!n(y)) { | |
| o(y, z); | |
| } else if (z) z.call(y); | |
| return true; | |
| } | |
| function u(y, z) { | |
| if (!n(y)) return; | |
| return y.exifdata[z]; | |
| } | |
| function v(y) { | |
| if (!n(y)) return {}; | |
| var z, aa = y.exifdata, | |
| ba = {}; | |
| for (z in aa) | |
| if (aa.hasOwnProperty(z)) ba[z] = aa[z]; | |
| return ba; | |
| } | |
| function w(y) { | |
| if (!n(y)) return ""; | |
| var z, aa = y.exifdata, | |
| ba = ""; | |
| for (z in aa) | |
| if (aa.hasOwnProperty(z)) | |
| if (typeof aa[z] == "object") { | |
| if (aa[z] instanceof Number) { | |
| ba += z + " : " + aa[z] + " [" + aa[z].numerator + "/" + aa[z].denominator + "]\r\n"; | |
| } else ba += z + " : [" + aa[z].length + " values]\r\n"; | |
| } else ba += z + " : " + aa[z] + "\r\n"; | |
| return ba; | |
| } | |
| function x(y) { | |
| return p(y); | |
| } | |
| return { | |
| readFromBinaryFile: x, | |
| pretty: w, | |
| getTag: u, | |
| getAllTags: v, | |
| getData: t, | |
| Tags: i, | |
| TiffTags: j, | |
| GPSTags: k, | |
| StringValues: l | |
| }; | |
| })(); | |
| f.exports = h; | |
| }, null); | |
| __d('ImageExif', ['exif/exif'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| function h(k) { | |
| this.getByteAt = function(l) { | |
| return k.getUint8(l); | |
| }; | |
| this.getShortAt = function(l, m) { | |
| return k.getUint16(l, !m); | |
| }; | |
| this.getSShortAt = function(l, m) { | |
| return k.getInt16(l, !m); | |
| }; | |
| this.getLongAt = function(l, m) { | |
| return k.getUint32(l, !m); | |
| }; | |
| this.getSLongAt = function(l, m) { | |
| return k.getInt32(l, !m); | |
| }; | |
| this.getStringAt = function(l, m) { | |
| var n = Array(m); | |
| for (var o = 0; o < m; o++) n.push(String.fromCharCode(this.getByteAt(l + o))); | |
| return n.join(''); | |
| }; | |
| this.getLength = function() { | |
| return k.byteLength; | |
| }; | |
| } | |
| function i(k) { | |
| var l = function(m) { | |
| return k.charCodeAt(m) & 255; | |
| }; | |
| this.getByteAt = l; | |
| this.getShortAt = function(m, n) { | |
| var o = this.getSShortAt(m, n); | |
| return o > 0 ? o : o + 65536; | |
| }; | |
| this.getSShortAt = function(m, n) { | |
| var o = l(m), | |
| p = l(m + 1); | |
| return n ? (o << 8) + p : (p << 8) + o; | |
| }; | |
| this.getLongAt = function(m, n) { | |
| var o = this.getSLongAt(m, n); | |
| return o > 0 ? o : o + 4294967296; | |
| }; | |
| this.getSLongAt = function(m, n) { | |
| var o = l(m), | |
| p = l(m + 1), | |
| q = l(m + 2), | |
| r = l(m + 3); | |
| return n ? (((o << 8) + p << 8) + q << 8) + r : (((r << 8) + q << 8) + p << 8) + o; | |
| }; | |
| this.getStringAt = function(m, n) { | |
| return k.substr(m, n); | |
| }; | |
| this.getLength = function() { | |
| return k.length; | |
| }; | |
| } | |
| var j = { | |
| readFromFile: function(k, l) { | |
| var m = new FileReader(); | |
| m.addEventListener('load', function(event) { | |
| var n = event.target.result, | |
| o = n instanceof ArrayBuffer ? this.readFromArrayBuffer(n) : this.readFromBinaryString(n); | |
| l(o); | |
| }.bind(this), false); | |
| if (window.DataView) { | |
| m.readAsArrayBuffer(k); | |
| } else m.readAsBinaryString(k); | |
| }, | |
| readFromBinaryString: function(k) { | |
| return c('exif/exif').readFromBinaryFile(new i(k)); | |
| }, | |
| readFromArrayBuffer: function(k) { | |
| return c('exif/exif').readFromBinaryFile(new h(new DataView(k))); | |
| } | |
| }; | |
| f.exports = j; | |
| }, null); | |
| __d('TimelineMapScrollableArea', ['Animation', 'ArbiterMixin', 'CSS', 'DOM', 'Event', 'Run', 'Scroll', 'SimpleDrag', 'Style', 'Vector', '$', 'shield'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| function h(i, j) { | |
| i && this.init(c('$')(i), j); | |
| } | |
| Object.assign(h.prototype, c('ArbiterMixin'), { | |
| init: function(i, j) { | |
| j = j || {}; | |
| this._elem = i; | |
| this._wrap = c('DOM').find(i, 'div.fbScrollableAreaWrap'); | |
| this._body = c('DOM').find(this._wrap, 'div.fbScrollableAreaBody'); | |
| this._track = c('DOM').find(i, 'div.fbScrollableAreaTrack'); | |
| this._gripper = c('DOM').find(this._track, 'div.fbScrollableAreaGripper'); | |
| this._options = j; | |
| this.adjustGripper(); | |
| this._listeners = [c('Event').listen(this._wrap, 'scroll', this._handleScroll.bind(this))]; | |
| if (j.fade !== false) this._listeners.push(c('Event').listen(i, 'mouseenter', c('shield')(this.adjustGripper, this)), c('Event').listen(i, 'mouseenter', c('shield')(this.showScrollbar, this)), c('Event').listen(i, 'mousemove', this._handleMousemove.bind(this)), c('Event').listen(i, 'mouseout', c('shield')(this.hideScrollbar, this))); | |
| if (j.fade !== undefined) this._listeners.push(c('Event').listen(this._track, 'click', this.clickToScroll.bind(this))); | |
| if (j.verticalscroll) this._listeners.push(c('Event').listen(this._wrap, 'mousewheel', this.mouseWheel.bind(this)), c('Event').listen(this._wrap, 'DOMMouseScroll', this.mouseWheel.bind(this))); | |
| this.initDrag(); | |
| if (!j.persistent) c('Run').onLeave(this.destroy.bind(this)); | |
| }, | |
| getRoot: function() { | |
| return this._elem; | |
| }, | |
| initDrag: function() { | |
| var i = new(c('SimpleDrag'))(this._gripper); | |
| i.subscribe('start', function(j, event) { | |
| if (!(event.which && event.which === 1 || event.button && event.button === 1)) return; | |
| this.inform('dragstart'); | |
| var k = c('Vector').getEventPosition(event).x, | |
| l = this._gripper.offsetLeft, | |
| m = i.subscribe('update', function(o, p) { | |
| var q = c('Vector').getEventPosition(p).x - k, | |
| r = this._elem.clientWidth, | |
| s = this._body.offsetWidth, | |
| t = this._track.offsetWidth, | |
| u = r / s * t, | |
| v = s - this._wrap.offsetWidth, | |
| w = l + q, | |
| x = t - u; | |
| w = Math.max(Math.min(w, x), 0); | |
| var y = w / x * v; | |
| c('Scroll').setLeft(this._wrap, y); | |
| }.bind(this)), | |
| n = i.subscribe('end', function() { | |
| i.unsubscribe(m); | |
| i.unsubscribe(n); | |
| this.inform('dragend'); | |
| }.bind(this)); | |
| }.bind(this)); | |
| }, | |
| adjustGripper: function() { | |
| var i = this._elem.clientWidth, | |
| j = this._body.offsetWidth, | |
| k = this._track.offsetWidth, | |
| l = i / j * k; | |
| if (l < k) { | |
| c('Style').set(this._gripper, 'width', l + 'px'); | |
| var m = c('Scroll').getLeft(this._wrap) / j * k; | |
| c('Style').set(this._gripper, 'left', m + 'px'); | |
| c('CSS').show(this._gripper); | |
| } else c('CSS').hide(this._gripper); | |
| this._checkContentBoundaries(); | |
| return this; | |
| }, | |
| _checkContentBoundaries: function() { | |
| var i = c('Scroll').getLeft(this._wrap), | |
| j = this._wrap.scrollWidth - this._wrap.clientWidth; | |
| c('CSS').conditionClass(this._elem, 'contentBefore', i > 0); | |
| c('CSS').conditionClass(this._elem, 'contentAfter', i < j); | |
| }, | |
| destroy: function() { | |
| this._listeners.forEach(function(i) { | |
| i.remove(); | |
| }); | |
| this._listeners.length = 0; | |
| }, | |
| _handleMousemove: function(event) { | |
| var i = c('Vector').getElementPosition(this._track).y, | |
| j = c('Vector').getElementDimensions(this._track).y; | |
| if (Math.abs(i + j / 2 - c('Vector').getEventPosition(event).y) < 25) { | |
| this.showScrollbar(false); | |
| } else this.hideScrollbar(); | |
| }, | |
| _handleScroll: function(event) { | |
| this.adjustGripper(); | |
| if (this._options.fade !== false) this.showScrollbar(); | |
| }, | |
| hideScrollbar: function() { | |
| if (!this._scrollbarVisible) return this; | |
| this._scrollbarVisible = false; | |
| if (this._hideTimeout) { | |
| clearTimeout(this._hideTimeout); | |
| this._hideTimeout = null; | |
| } | |
| this._hideTimeout = setTimeout(function() { | |
| if (this._scrollbarAnimation) { | |
| this._scrollbarAnimation.stop(); | |
| this._scrollbarAnimation = null; | |
| } | |
| this._scrollbarAnimation = new(c('Animation'))(this._track).from('opacity', 1).to('opacity', 0).duration(250).ondone(c('CSS').addClass.bind(null, this._track, 'invisible_elem')).go(); | |
| }.bind(this), 750); | |
| return this; | |
| }, | |
| showScrollbar: function(i) { | |
| if (this._scrollbarVisible) return this; | |
| this._scrollbarVisible = true; | |
| if (this._hideTimeout) { | |
| clearTimeout(this._hideTimeout); | |
| this._hideTimeout = null; | |
| } | |
| if (this._scrollbarAnimation) { | |
| this._scrollbarAnimation.stop(); | |
| this._scrollbarAnimation = null; | |
| } | |
| this.adjustGripper(); | |
| c('Style').set(this._track, 'opacity', 1); | |
| c('CSS').removeClass(this._track, 'invisible_elem'); | |
| if (i !== false) this.hideScrollbar(); | |
| return this; | |
| }, | |
| clickToScroll: function(event) { | |
| var i = c('Vector').getEventPosition(event).x, | |
| j = this._elem.clientWidth, | |
| k = this._body.offsetWidth, | |
| l = this._track.offsetWidth, | |
| m = j / k * l, | |
| n = c('Vector').getElementPosition(this._gripper); | |
| if (i >= n.x && i <= n.x + m) return; | |
| var o = i < n.x ? -1 : 1, | |
| p = this._wrap.offsetWidth * .8 * o; | |
| this.scrollBy(p); | |
| }, | |
| scrollBy: function(i) { | |
| this.setScroll(c('Scroll').getLeft(this._wrap) + i); | |
| }, | |
| getMaxBodyOffset: function() { | |
| return this._body.offsetWidth - this._wrap.offsetWidth; | |
| }, | |
| setScroll: function(i) { | |
| var j = i; | |
| j = Math.max(Math.min(j, this.getMaxBodyOffset()), 0); | |
| c('Scroll').setLeft(this._wrap, j); | |
| }, | |
| scrollIntoView: function(i) { | |
| var j = this._wrap.clientWidth, | |
| k = i.offsetWidth, | |
| l = c('Scroll').getLeft(this._wrap), | |
| m = l + j, | |
| n = i.offsetLeft, | |
| o = n + k; | |
| if (n < l || j < k) { | |
| this.setScroll(n); | |
| } else if (o > m) this.setScroll(l + (o - m)); | |
| }, | |
| mouseWheel: function(event) { | |
| if (this.getMaxBodyOffset() <= 0) return; | |
| var i = 0; | |
| if (event.wheelDelta) { | |
| var j = event.wheelDelta; | |
| if (event.wheelDeltaX && event.wheelDeltaY) j = Math.abs(event.wheelDeltaX) > Math.abs(event.wheelDeltaY) ? event.wheelDeltaX : event.wheelDeltaY; | |
| i = -j * 10 / 40; | |
| } else if (event.detail) i = event.detail * 10; | |
| this.scrollBy(i); | |
| event.prevent(); | |
| } | |
| }); | |
| f.exports = b.TimelineMapScrollableArea || h; | |
| }, null); | |
| __d('PhotoEditorSaveStates', ['requireWeak', 'Map'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| var h; | |
| c('requireWeak')('PhotoEditorGraphic', function(l) { | |
| h = l.Sticker; | |
| }); | |
| var i = new(c('Map'))(), | |
| j = new(c('Map'))(), | |
| k = { | |
| setState: function(l, m) { | |
| i.set(l, m); | |
| }, | |
| getState: function(l) { | |
| return i.get(l); | |
| }, | |
| setLoggingData: function(l, m) { | |
| j.set(l, m); | |
| }, | |
| getLoggingData: function(l) { | |
| return j.get(l); | |
| }, | |
| getTotalNumOfStickersOnPhoto: function(l) { | |
| if (i.get(l)) return i.get(l).graphics.filter(function(m) { | |
| return h && m.type === h; | |
| }).length; | |
| return 0; | |
| } | |
| }; | |
| f.exports = k; | |
| }, null); | |
| __d('StringEncoding', [], function a(b, c, d, e, f, g) { | |
| 'use strict'; | |
| if (c.__markCompiled) c.__markCompiled(); | |
| function h(o, p) { | |
| var q = new Uint8Array(o), | |
| r = 0, | |
| s = []; | |
| while (r < q.length) { | |
| var t = q[r], | |
| u = void 0; | |
| if (t >> 7 === 0) { | |
| u = 1; | |
| } else if (t >> 5 === 6) { | |
| t &= 31; | |
| u = 2; | |
| } else if (t >> 4 === 14) { | |
| t &= 15; | |
| u = 3; | |
| } else if (t >> 3 === 30) { | |
| t &= 7; | |
| u = 4; | |
| } else if (t >> 2 === 62) { | |
| t &= 3; | |
| u = 5; | |
| } else if (t >> 1 === 126) { | |
| t &= 1; | |
| u = 6; | |
| } else throw new Error('Cannot decode as UTF-8 - ' + 'unrecognised codepoint header'); | |
| if (r + u > q.length) throw new Error('Cannot decode as UTF-8 - ' + 'incomplete codepoint'); | |
| for (var v = 1; v < u; v++) { | |
| var w = q[r + v]; | |
| if (w >> 6 !== 2) throw new Error('Cannot decode as UTF-8 - ' + 'unrecognised codepoint subsequent byte'); | |
| w &= 63; | |
| t <<= 6; | |
| t |= w; | |
| } | |
| if (t > 1114111) throw new Error('Cannot decode as UTF-8 - ' + "JavaScript doesn't support codepoints over 0x10FFFF"); | |
| if (!t) switch (p) { | |
| case 'error': | |
| throw new Error('Cannot decode as UTF-8 - ' + "contains a null and we're not allowing them"); | |
| case 'ignore': | |
| continue; | |
| case 'truncate': | |
| return String.fromCodePoint.apply(String, s); | |
| case 'include': | |
| break; | |
| } | |
| s.push(t); | |
| r += u; | |
| } | |
| return String.fromCodePoint.apply(String, s); | |
| } | |
| function i(o) { | |
| return (o & 255) << 8 | o >> 8; | |
| } | |
| function j(o, p) { | |
| if (o.byteLength % 2 !== 0) throw new Error('Cannot decode as UTF-16 - ' + 'data length mod 2 != 0'); | |
| var q = new Uint16Array(o), | |
| r = 0, | |
| s = [], | |
| t = false; | |
| if (q[0] === 65279) { | |
| ++r; | |
| } else if (q[0] == 65534) { | |
| ++r; | |
| t = true; | |
| } | |
| while (r < q.length) { | |
| var u = q[r]; | |
| if (t) u = i(u); | |
| var v = u; | |
| if (u > 55295 && u < 57344) { | |
| if ((u & 64512) !== 55296) throw new Error('Cannot decode as UTF-16 - ' + 'incorrect signature for high surrogate'); | |
| if (r + 1 >= q.length) throw new Error('Cannot decode as UTF-16 - ' + 'incomplete codepoint'); | |
| ++r; | |
| var w = q[r]; | |
| if (t) w = i(w); | |
| if ((w & 64512) !== 56320) throw new Error('Cannot decode as UTF-16 - ' + 'incorrect signature for low surrogate'); | |
| v = ((u & 1023) << 10 | w & 1023) + 65536; | |
| } | |
| if (!v) switch (p) { | |
| case 'error': | |
| throw new Error('Cannot decode as UTF-16 - ' + "contains a null and we're not allowing them"); | |
| case 'ignore': | |
| continue; | |
| case 'truncate': | |
| return String.fromCodePoint.apply(String, s); | |
| case 'include': | |
| break; | |
| } | |
| s.push(v); | |
| ++r; | |
| } | |
| return String.fromCodePoint.apply(String, s); | |
| } | |
| function k(o) { | |
| return ((o & 255) << 24 | (o & 255 << 8) << 8 | (o & 255 << 16) >> 8 | o >>> 24); | |
| } | |
| function l(o, p) { | |
| if (o.byteLength % 4 !== 0) throw new Error('Cannot decode as UTF-32 - ' + 'data length mod 4 != 0'); | |
| var q = new Uint32Array(o), | |
| r = 0, | |
| s = [], | |
| t = false; | |
| if (q[0] === 65279) { | |
| ++r; | |
| } else if (q[0] == 4294836224) { | |
| ++r; | |
| t = true; | |
| } | |
| while (r < q.length) { | |
| var u = q[r]; | |
| if (t) u = k(u); | |
| if (u & 2147483648) throw new Error('Cannot decode as UTF-32 - ' + 'invalid codepoint'); | |
| if (u > 1114111) throw new Error('Cannot decode as UTF-32 - ' + "JavaScript doesn't support codepoints over 0x10FFFF"); | |
| if (!u) switch (p) { | |
| case 'error': | |
| throw new Error('Cannot decode as UTF-32 - ' + "contains a null and we're not allowing them"); | |
| case 'ignore': | |
| continue; | |
| case 'truncate': | |
| return String.fromCodePoint.apply(String, s); | |
| case 'include': | |
| break; | |
| } | |
| s.push(u); | |
| ++r; | |
| } | |
| return String.fromCodePoint.apply(String, s); | |
| } | |
| var m = { | |
| 'utf-8': h, | |
| 'utf-16': j, | |
| 'utf-32': l | |
| }; | |
| function n(o, p) { | |
| if (o) { | |
| this.$Decoder1 = o; | |
| } else this.$Decoder1 = ['utf-8', 'utf-16', 'utf-32']; | |
| if (!p) p = 'error'; | |
| this.$Decoder2 = p; | |
| for (var q = this.$Decoder1, r = Array.isArray(q), s = 0, q = r ? q : q[typeof Symbol === 'function' ? Symbol.iterator : '@@iterator']();;) { | |
| var t; | |
| if (r) { | |
| if (s >= q.length) break; | |
| t = q[s++]; | |
| } else { | |
| s = q.next(); | |
| if (s.done) break; | |
| t = s.value; | |
| } | |
| var u = t; | |
| this.$Decoder3(u); | |
| } | |
| } | |
| n.prototype.getPrecedence = function() { | |
| return this.$Decoder1; | |
| }; | |
| n.prototype.decode = function(o) { | |
| var p = []; | |
| for (var q = this.$Decoder1, r = Array.isArray(q), s = 0, q = r ? q : q[typeof Symbol === 'function' ? Symbol.iterator : '@@iterator']();;) { | |
| var t; | |
| if (r) { | |
| if (s >= q.length) break; | |
| t = q[s++]; | |
| } else { | |
| s = q.next(); | |
| if (s.done) break; | |
| t = s.value; | |
| } | |
| var u = t, | |
| v = this.$Decoder3(u); | |
| try { | |
| return v(o, this.$Decoder2); | |
| } catch (w) { | |
| p.push(w); | |
| } | |
| } | |
| throw new Error(p.join(', ')); | |
| }; | |
| n.prototype.$Decoder3 = function(o) { | |
| var p = m[o]; | |
| if (!p) throw new Error('Unknown encoding ' + o); | |
| return p; | |
| }; | |
| f.exports.Decoder = n; | |
| }, null); | |
| __d('ImageMetadata', ['regeneratorRuntime', 'Promise', 'StringEncoding', 'ImageExif'], function a(b, c, d, e, f, g) { | |
| 'use strict'; | |
| if (c.__markCompiled) c.__markCompiled(); | |
| function h(m) { | |
| this.$ImageMetadata4 = m; | |
| this.$ImageMetadata5 = new Uint8Array(m); | |
| this.$ImageMetadata6(); | |
| } | |
| h.prototype.$ImageMetadata6 = function() { | |
| var m = 0; | |
| while (m < this.$ImageMetadata5.length) { | |
| m = this.$ImageMetadata7(m); | |
| if (m === -1) return; | |
| var n = this.$ImageMetadata5[m + 1], | |
| o = i[n]; | |
| if (!o) return; | |
| var p = o.length; | |
| if (p === undefined) p = this.$ImageMetadata5[m + 2] * 256 + this.$ImageMetadata5[m + 3]; | |
| this.$ImageMetadata8(m, p, o); | |
| if (o.name === 'SOS') return; | |
| m += 2 + p; | |
| } | |
| }; | |
| h.prototype.$ImageMetadata8 = function(m, n, o) { | |
| switch (o.name) { | |
| case 'APP1': | |
| if (this.$ImageMetadata9(m + 4, j)) { | |
| this.$ImageMetadata10(m + 4 + j.length, n - 2 - j.length); | |
| } else if (this.$ImageMetadata9(m + 4, k)) { | |
| this.$ImageMetadata11(m + 4 + k.length, n - 2 - k.length); | |
| } else if (this.$ImageMetadata9(m + 4, l)) this.$ImageMetadata12(m + 4 + l.length, n - 2 - l.length); | |
| break; | |
| case 'SOF0': | |
| case 'SOF1': | |
| case 'SOF2': | |
| case 'SOF3': | |
| case 'SOF5': | |
| case 'SOF6': | |
| case 'SOF7': | |
| case 'JPG': | |
| case 'SOF9': | |
| case 'SOF10': | |
| case 'SOF11': | |
| case 'SOF13': | |
| case 'SOF14': | |
| case 'SOF15': | |
| this.$ImageMetadata13(m + 4, n - 2); | |
| break; | |
| } | |
| }; | |
| h.prototype.$ImageMetadata13 = function(m, n) { | |
| var o = this.$ImageMetadata5[m + 3] * 256 + this.$ImageMetadata5[m + 4], | |
| p = this.$ImageMetadata5[m + 1] * 256 + this.$ImageMetadata5[m + 2]; | |
| if (o > 0 && p > 0) this.$ImageMetadata3 = { | |
| x: o, | |
| y: p | |
| }; | |
| }; | |
| h.prototype.$ImageMetadata10 = function(m, n) { | |
| var o = c('ImageExif').readFromArrayBuffer(this.$ImageMetadata4) || {}, | |
| p = {}; | |
| for (var q in o) { | |
| var r = o[q]; | |
| if (typeof r === 'string') r = r.trim(); | |
| p[q.trim()] = r; | |
| } | |
| this.$ImageMetadata1 = p; | |
| }; | |
| h.prototype.$ImageMetadata11 = function(m, n) { | |
| this.$ImageMetadata2 = {}; | |
| var o = this.$ImageMetadata2, | |
| p = new(c('StringEncoding').Decoder)(null, 'truncate'); | |
| try { | |
| var r = p.decode(this.$ImageMetadata4.slice(m, m + n)); | |
| } catch (q) { | |
| return; | |
| } | |
| for (var s = 0; s < r.length; ++s) { | |
| var t = r.indexOf('<GPano:', s); | |
| if (t == -1) break; | |
| var u = r.indexOf('>', t), | |
| v = r.substring(t + 1, u).trim(), | |
| w = r.indexOf('<', u), | |
| x = r.substring(u + 1, w).trim(); | |
| o[v] = x; | |
| s = w; | |
| } | |
| for (var y = 0; y < r.length; ++y) { | |
| var z = r.indexOf('GPano:', y); | |
| if (z == -1) break; | |
| var aa = r.indexOf('=', z), | |
| ba = r.substring(z, aa).trim(), | |
| ca = r.indexOf('"', z); | |
| if (ba.indexOf('>') == -1 && ba.indexOf('<') == -1) { | |
| var da = r.indexOf('"', ca + 1), | |
| ea = r.substring(ca + 1, da).trim(); | |
| o[ba] = ea; | |
| y = da; | |
| } | |
| } | |
| }; | |
| h.prototype.$ImageMetadata12 = function(m) {}; | |
| h.prototype.$ImageMetadata9 = function(m, n) { | |
| return n.split('').every(function(o) { | |
| return this.$ImageMetadata5[m++] === o.charCodeAt(0); | |
| }.bind(this)); | |
| }; | |
| h.prototype.$ImageMetadata7 = function(m) { | |
| for (var n = m; n + 1 < this.$ImageMetadata5.length; ++n) | |
| if (this.$ImageMetadata5[n] === 255 && this.$ImageMetadata5[n + 1] !== 0 && this.$ImageMetadata5[n + 1] !== 255) return n; | |
| return -1; | |
| }; | |
| h.prototype.hasExif = function() { | |
| return Boolean(this.$ImageMetadata1); | |
| }; | |
| h.prototype.hasXMP = function() { | |
| return Boolean(this.$ImageMetadata2); | |
| }; | |
| h.prototype.hasSize = function() { | |
| return Boolean(this.$ImageMetadata3); | |
| }; | |
| h.prototype.getExif = function() { | |
| if (!this.$ImageMetadata1) throw new Error('Image has no Exif data'); | |
| return this.$ImageMetadata1; | |
| }; | |
| h.prototype.getXMP = function() { | |
| if (!this.$ImageMetadata2) throw new Error('Image has no XMP data'); | |
| return this.$ImageMetadata2; | |
| }; | |
| h.prototype.getSize = function() { | |
| if (!this.$ImageMetadata3) throw new Error('Could not find size data?!'); | |
| return this.$ImageMetadata3; | |
| }; | |
| h.genMetadataFromBlob = function m(n) { | |
| return c('regeneratorRuntime').async(function o(p) { | |
| while (1) switch (p.prev = p.next) { | |
| case 0: | |
| p.t0 = h; | |
| p.next = 3; | |
| return c('regeneratorRuntime').awrap(h.$ImageMetadata14(n)); | |
| case 3: | |
| p.t1 = p.sent; | |
| return p.abrupt('return', new p.t0(p.t1)); | |
| case 5: | |
| case 'end': | |
| return p.stop(); | |
| } | |
| }, null, this); | |
| }; | |
| h.$ImageMetadata14 = function(m) { | |
| return new(c('Promise'))(function(n, o) { | |
| var p = new b.FileReader(); | |
| p.onabort = o; | |
| p.onerror = o; | |
| p.onload = n; | |
| p.readAsArrayBuffer(m); | |
| }); | |
| }; | |
| var i = []; | |
| i[216] = { | |
| name: 'SOI', | |
| length: 0 | |
| }; | |
| i[192] = { | |
| name: 'SOF0' | |
| }; | |
| i[193] = { | |
| name: 'SOF1' | |
| }; | |
| i[194] = { | |
| name: 'SOF2' | |
| }; | |
| i[195] = { | |
| name: 'SOF3' | |
| }; | |
| i[197] = { | |
| name: 'SOF5' | |
| }; | |
| i[198] = { | |
| name: 'SOF6' | |
| }; | |
| i[199] = { | |
| name: 'SOF7' | |
| }; | |
| i[200] = { | |
| name: 'JPG' | |
| }; | |
| i[201] = { | |
| name: 'SOF9' | |
| }; | |
| i[202] = { | |
| name: 'SOF10' | |
| }; | |
| i[203] = { | |
| name: 'SOF11' | |
| }; | |
| i[205] = { | |
| name: 'SOF13' | |
| }; | |
| i[206] = { | |
| name: 'SOF14' | |
| }; | |
| i[207] = { | |
| name: 'SOF15' | |
| }; | |
| i[196] = { | |
| name: 'DHT' | |
| }; | |
| i[219] = { | |
| name: 'DQT' | |
| }; | |
| i[221] = { | |
| name: 'DRI', | |
| length: 2 | |
| }; | |
| i[218] = { | |
| name: 'SOS' | |
| }; | |
| i[208] = { | |
| name: 'RST0', | |
| length: 0 | |
| }; | |
| i[209] = { | |
| name: 'RST1', | |
| length: 0 | |
| }; | |
| i[210] = { | |
| name: 'RST2', | |
| length: 0 | |
| }; | |
| i[211] = { | |
| name: 'RST3', | |
| length: 0 | |
| }; | |
| i[212] = { | |
| name: 'RST4', | |
| length: 0 | |
| }; | |
| i[213] = { | |
| name: 'RST5', | |
| length: 0 | |
| }; | |
| i[214] = { | |
| name: 'RST6', | |
| length: 0 | |
| }; | |
| i[215] = { | |
| name: 'RST7', | |
| length: 0 | |
| }; | |
| i[224] = { | |
| name: 'APP0' | |
| }; | |
| i[225] = { | |
| name: 'APP1' | |
| }; | |
| i[226] = { | |
| name: 'APP2' | |
| }; | |
| i[227] = { | |
| name: 'APP3' | |
| }; | |
| i[228] = { | |
| name: 'APP4' | |
| }; | |
| i[229] = { | |
| name: 'APP5' | |
| }; | |
| i[230] = { | |
| name: 'APP6' | |
| }; | |
| i[231] = { | |
| name: 'APP7' | |
| }; | |
| i[232] = { | |
| name: 'APP8' | |
| }; | |
| i[233] = { | |
| name: 'APP9' | |
| }; | |
| i[234] = { | |
| name: 'APP10' | |
| }; | |
| i[235] = { | |
| name: 'APP11' | |
| }; | |
| i[236] = { | |
| name: 'APP12' | |
| }; | |
| i[237] = { | |
| name: 'APP13' | |
| }; | |
| i[238] = { | |
| name: 'APP14' | |
| }; | |
| i[239] = { | |
| name: 'APP15' | |
| }; | |
| i[254] = { | |
| name: 'COM' | |
| }; | |
| i[217] = { | |
| name: 'EOI', | |
| length: 0 | |
| }; | |
| var j = 'Exif\0\0', | |
| k = 'http://ns.adobe.com/xap/1.0/\0', | |
| l = 'http://ns.adobe.com/xmp/extension/\0'; | |
| f.exports = h; | |
| }, null); | |
| __d('SphericalImage', ['Promise', 'regeneratorRuntime', 'ImageMetadata'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| var h = 100, | |
| i = 345; | |
| function j(v) { | |
| return new(c('Promise'))(function(w, x) { | |
| var y = new b.FileReader(); | |
| y.onabort = x; | |
| y.onerror = x; | |
| y.onload = function(event) { | |
| return w(event.target.result); | |
| }; | |
| y.readAsArrayBuffer(v); | |
| }); | |
| } | |
| function k(v) { | |
| if (!v.hasXMP()) return false; | |
| var w = v.getXMP(), | |
| x = Boolean(w['GPano:CroppedAreaImageWidthPixels'] && w['GPano:CroppedAreaImageHeightPixels'] && w['GPano:FullPanoWidthPixels'] && w['GPano:FullPanoHeightPixels']); | |
| if (x) return true; | |
| var y = v.getSize(), | |
| z = Math.abs(y.x - y.y * 2) <= 2; | |
| return Boolean(w['GPano:ProjectionType'] === 'equirectangular' && z); | |
| } | |
| var l = { | |
| 'iPhone 4S': { | |
| x: 19334, | |
| y: 3264 | |
| }, | |
| 'iPhone 5': { | |
| x: 18521, | |
| y: 3264 | |
| }, | |
| 'iPhone 5c': { | |
| x: 18521, | |
| y: 3264 | |
| }, | |
| 'iPhone 5s': { | |
| x: 17279, | |
| y: 3264 | |
| }, | |
| 'iPhone 6': { | |
| x: 17731, | |
| y: 3264 | |
| }, | |
| 'iPhone 6 Plus': { | |
| x: 17731, | |
| y: 3264 | |
| }, | |
| 'iPhone 6s': { | |
| x: 21729, | |
| y: 4000 | |
| }, | |
| 'iPhone 6s Plus': { | |
| x: 21729, | |
| y: 4000 | |
| }, | |
| 'iPhone SE': { | |
| x: 21729, | |
| y: 4000 | |
| }, | |
| 'iPad Air': { | |
| x: 14810, | |
| y: 2592 | |
| }, | |
| 'iPad Air 2': { | |
| x: 18512, | |
| y: 3264 | |
| }, | |
| 'iPad Mini 2': { | |
| x: 14810, | |
| y: 2592 | |
| }, | |
| 'iPad Mini 3': { | |
| x: 14810, | |
| y: 2592 | |
| }, | |
| 'iPad Mini 4': { | |
| x: 18512, | |
| y: 3264 | |
| }, | |
| 'iPad Pro': { | |
| x: 18512, | |
| y: 3264 | |
| } | |
| }, | |
| m = { | |
| 'sm-g90': { | |
| minHeight: 2200, | |
| fullWidth: 17000 | |
| }, | |
| 'sm-n91': { | |
| minHeight: 2200, | |
| fullWidth: 17000 | |
| }, | |
| 'sm-g92': { | |
| minHeight: 2200, | |
| fullWidth: 15550 | |
| }, | |
| 'sm-n92': { | |
| minHeight: 2200, | |
| fullWidth: 15550 | |
| }, | |
| 'sm-g93': { | |
| minHeight: 2800, | |
| fullWidth: 20200 | |
| } | |
| }; | |
| function n(v) { | |
| if (!v.hasExif()) return false; | |
| return (p(v) || o(v) || q(v)); | |
| } | |
| function o(v) { | |
| var w = v.getExif(), | |
| x = v.getSize(); | |
| return (w.Make === 'RICOH' && w.Model === 'RICOH THETA S' && x.x === 2 * x.y); | |
| } | |
| function p(v) { | |
| var w = v.getExif(); | |
| if (w.Make != 'Apple') return false; | |
| var x = l[w.Model]; | |
| if (!x) return false; | |
| var y = void 0, | |
| z = void 0; | |
| if (w.ExifImageWidth && w.ExifImageLength) | |
| if (!z || w.ExifImageWidth > z.x) z = { | |
| x: w.ExifImageWidth, | |
| y: w.ExifImageLength | |
| }; | |
| if (w.ImageWidth && w.ImageLength) | |
| if (!z || w.ImageWidth > z.x) z = { | |
| x: w.ImageWidth, | |
| y: w.ImageLength | |
| }; | |
| if (w.OriginalImageWidth && w.OriginalImageHeight) | |
| if (!z || w.OriginalImageWidth > z.x) z = { | |
| x: w.OriginalImageWidth, | |
| y: w.OriginalImageHeight | |
| }; | |
| if (w.PixelXDimension && w.PixelYDimension) | |
| if (!z || w.PixelXDimension > z.x) z = { | |
| x: w.PixelXDimension, | |
| y: w.PixelYDimension | |
| }; | |
| if (v.hasSize()) { | |
| y = v.getSize(); | |
| var aa = r(y); | |
| if (z) { | |
| var ba = r(z); | |
| if (!s(aa, ba)) return false; | |
| } | |
| if (aa < 2) return false; | |
| } | |
| var ca = z || y; | |
| if (!ca) return false; | |
| if (!s(ca.y, x.y, .3)) return false; | |
| return true; | |
| } | |
| function q(v) { | |
| var w = v.getExif(), | |
| x = v.getSize(), | |
| y = x.x, | |
| z = x.y; | |
| if (String(w.Make).toLowerCase() != 'samsung') return false; | |
| var aa = String(w.Model).toLowerCase().trim(), | |
| ba = null; | |
| Object.keys(m).forEach(function(ea) { | |
| if (aa.startsWith(ea)) ba = m[ea]; | |
| }); | |
| if (!ba) return false; | |
| if (w.Orientation === 6) { | |
| var ca = y; | |
| y = z; | |
| z = ca; | |
| } | |
| if (y > ba.fullWidth || z < ba.minHeight) return false; | |
| var da = y / ba.fullWidth * 360; | |
| if (da < h || da > i || y < 2 * z) return false; | |
| return true; | |
| } | |
| function r(v) { | |
| return v.x / v.y; | |
| } | |
| function s(v, w) { | |
| var x = arguments.length <= 2 || arguments[2] === undefined ? .05 : arguments[2]; | |
| return v > (1 - x) * w && v < (1 + x) * w; | |
| } | |
| function t(v) { | |
| return (k(v) || n(v)); | |
| } | |
| function u(v) { | |
| var w, x; | |
| return c('regeneratorRuntime').async(function y(z) { | |
| while (1) switch (z.prev = z.next) { | |
| case 0: | |
| z.next = 2; | |
| return c('regeneratorRuntime').awrap(j(v)); | |
| case 2: | |
| w = z.sent; | |
| x = new(c('ImageMetadata'))(w); | |
| return z.abrupt('return', t(x)); | |
| case 5: | |
| case 'end': | |
| return z.stop(); | |
| } | |
| }, null, this); | |
| } | |
| f.exports = { | |
| isSphericalBlob: u, | |
| isSphericalMetadata: t | |
| }; | |
| }, null); | |
| __d('ReactComposerMediaUploadType', [], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| f.exports = { | |
| PHOTO: 'PHOTO', | |
| VIDEO: 'VIDEO' | |
| }; | |
| }, null); | |
| __d('ReactComposerPhotoActions', ['ReactComposerPhotoActionType', 'ReactComposerDispatcher', 'ReactComposerPhotoStore'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| c('ReactComposerPhotoStore'); | |
| var h = { | |
| startRecognizing: function(i, j) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| photoID: j, | |
| type: c('ReactComposerPhotoActionType').PHOTO_RECOGNITION_STARTED | |
| }); | |
| }, | |
| finishRecognizingPhoto: function(i, j) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerPhotoActionType').PHOTO_RECOGNITION_FINISHED, | |
| photoID: j | |
| }); | |
| }, | |
| finishRecognizing: function(i, j, k) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerPhotoActionType').PHOTO_RECOGNITION_ALL_FINISHED, | |
| photos: j, | |
| facerecWaterfallEvent: k | |
| }); | |
| }, | |
| addFacebox: function(i, j, k) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerPhotoActionType').PHOTO_ADD_FACEBOX, | |
| photoID: j, | |
| facebox: k | |
| }); | |
| }, | |
| tagXY: function(i, j, k, l, m, n, o) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerPhotoActionType').PHOTO_TAG_XY, | |
| value: k, | |
| photoID: j, | |
| source: l, | |
| subject: m, | |
| x: n, | |
| y: o | |
| }); | |
| }, | |
| tagXYProduct: function(i, j, k, l, m, n, o) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerPhotoActionType').PHOTO_TAG_XY_PRODUCT, | |
| value: k, | |
| photoID: j, | |
| source: l, | |
| subject: m, | |
| x: n, | |
| y: o | |
| }); | |
| }, | |
| tagFacebox: function(i, j, k, l, m) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerPhotoActionType').PHOTO_TAG_FACEBOX, | |
| photoID: j, | |
| faceboxID: k, | |
| subjectID: l, | |
| value: m | |
| }); | |
| }, | |
| untagFacebox: function(i, j, k, l) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerPhotoActionType').PHOTO_UNTAG_FACEBOX, | |
| photoID: j, | |
| faceboxID: k, | |
| subjectID: l | |
| }); | |
| }, | |
| removePhoto: function(i, j, k) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerPhotoActionType').PHOTO_REMOVE, | |
| photoID: j, | |
| uploadID: k | |
| }); | |
| }, | |
| untagSubjectFromAllPhotos: function(i, j) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerPhotoActionType').PHOTO_UNTAG_SUBJECT_FROM_ALL_PHOTOS, | |
| subjectID: j | |
| }); | |
| }, | |
| untagAllForPhoto: function(i, j) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerPhotoActionType').PHOTO_UNTAG_ALL, | |
| photoID: j | |
| }); | |
| }, | |
| startPhotoEdit: function(i, j) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| photoID: j, | |
| type: c('ReactComposerPhotoActionType').PHOTO_EDIT_STARTED | |
| }); | |
| }, | |
| finishPhotoEdit: function(i) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerPhotoActionType').PHOTO_EDIT_FINISHED | |
| }); | |
| }, | |
| setPhotoBeingTagged: function(i, j) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| photoID: j, | |
| type: c('ReactComposerPhotoActionType').PHOTO_SET_BEING_TAGGED | |
| }); | |
| }, | |
| finishLoadingPhotoEdit: function(i, j) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerPhotoActionType').PHOTO_LOADING_EDIT_FINISHED, | |
| photoID: j | |
| }); | |
| } | |
| }; | |
| f.exports = h; | |
| }, null); | |
| __d('ReactComposerPhotoPrefillConfig', ['React'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| var h = c('React').PropTypes; | |
| f.exports = h.shape({ | |
| uploadID: h.string, | |
| photoID: h.string, | |
| thumbSrc: h.string, | |
| cubestripURI: h.string | |
| }); | |
| }, null); | |
| __d('ReactComposerPhotoUploadState', [], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| f.exports = { | |
| PHOTO_UPLOAD_ENQUEUED: 'PHOTO_UPLOAD_ENQUEUED', | |
| PHOTO_UPLOAD_RESIZE_STARTED: 'PHOTO_UPLOAD_RESIZE_STARTED', | |
| PHOTO_UPLOAD_RESIZE_DONE: 'PHOTO_UPLOAD_RESIZE_DONE', | |
| PHOTO_UPLOAD_RESIZE_FAILED: 'PHOTO_UPLOAD_RESIZE_FAILED', | |
| PHOTO_UPLOAD_UPLOADING: 'PHOTO_UPLOAD_UPLOADING', | |
| PHOTO_UPLOAD_DONE: 'PHOTO_UPLOAD_DONE', | |
| PHOTO_UPLOAD_FAILED: 'PHOTO_UPLOAD_FAILED' | |
| }; | |
| }, null); | |
| __d('ReactComposerMediaUploadActions', ['ReactComposerDispatcher', 'ReactComposerMediaUploadType', 'ReactComposerPhotoPrefillConfig', 'ReactComposerPhotoActions', 'ReactComposerPhotoUploadState', 'ReactComposerMediaUploadActionType', 'immutable'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| var h = { | |
| enqueue: function(i, j, k, l, m, n, o) { | |
| var p = arguments.length <= 7 || arguments[7] === undefined ? [] : arguments[7], | |
| q = arguments.length <= 8 || arguments[8] === undefined ? false : arguments[8]; | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| mediaType: n, | |
| uploadID: j, | |
| type: m, | |
| filename: k, | |
| fileURL: o ? o : '', | |
| index: l, | |
| xyTags: p, | |
| isSpherical: q | |
| }); | |
| }, | |
| startResizing: function(i, j, k) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| loggingData: k, | |
| uploadID: j, | |
| type: c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_RESIZE_STARTED | |
| }); | |
| }, | |
| progressResizing: function(i, j, k) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| uploadID: j, | |
| type: c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_RESIZE_PROGRESS, | |
| progress: k | |
| }); | |
| }, | |
| doneResizing: function(i, j, k) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| loggingData: k, | |
| uploadID: j, | |
| type: c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_RESIZE_DONE | |
| }); | |
| }, | |
| failResizing: function(i, j, k) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| loggingData: k, | |
| uploadID: j, | |
| type: c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_RESIZE_FAILED | |
| }); | |
| }, | |
| startUploading: function(i, j, k, l) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| uploadID: j, | |
| type: l, | |
| fileUpload: k | |
| }); | |
| }, | |
| progressUploading: function(i, j, k) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| uploadID: j, | |
| type: c('ReactComposerMediaUploadActionType').MEDIA_UPLOAD_PROGRESS, | |
| progress: k | |
| }); | |
| }, | |
| isSpherical: function(i, j, k) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| uploadID: j, | |
| type: c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_IS_SPHERICAL, | |
| isSpherical: k | |
| }); | |
| }, | |
| doneUploading: function(i, j, k, l, m, n, o, p, q, r, s, t, u) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| uploadID: j, | |
| fileUpload: l, | |
| mediaLocation: q, | |
| timeToUpload: m, | |
| type: k, | |
| photoID: n, | |
| thumbSrc: o, | |
| originalPhotoID: p, | |
| cubestripURI: r, | |
| imageSrc: s, | |
| width: t, | |
| height: u | |
| }); | |
| }, | |
| failUploading: function(i, j, k, l, m, n) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| uploadID: j, | |
| type: n, | |
| error: m, | |
| fileUpload: k, | |
| timeToUpload: l | |
| }); | |
| }, | |
| removeAllPhotoUploads: function(i, j) { | |
| j.forEach(function(k) { | |
| return this.removePhotoAndPhotoUpload(i, k); | |
| }.bind(this)); | |
| }, | |
| removePhotoAndPhotoUpload: function(i, j) { | |
| if (j.state === c('ReactComposerPhotoUploadState').PHOTO_UPLOAD_DONE) { | |
| c('ReactComposerPhotoActions').removePhoto(i, j.photoID, j.id); | |
| } else this.removeMediaUpload(i, j.id); | |
| }, | |
| removeMediaUpload: function(i, j) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerMediaUploadActionType').MEDIA_UPLOAD_REMOVE, | |
| uploadID: j | |
| }); | |
| }, | |
| mediaMoved: function(i, j, k) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerMediaUploadActionType').MEDIA_UPLOAD_MOVED, | |
| from: j, | |
| to: k | |
| }); | |
| }, | |
| resizerUnavailable: function(i) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_RESIZER_UNAVAILABLE | |
| }); | |
| }, | |
| photosSelect: function(i, j, k) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| method: k, | |
| numPhotos: j, | |
| type: c('ReactComposerMediaUploadActionType').PHOTOS_SELECT | |
| }); | |
| }, | |
| retryMediaUpload: function(i, j) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: j | |
| }); | |
| }, | |
| prefillPhotos: function(i, j) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| photos: j, | |
| type: c('ReactComposerMediaUploadActionType').PREFILL_PHOTOS | |
| }); | |
| }, | |
| setVideoThumbnail: function(i, j, k) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerMediaUploadActionType').VIDEO_SET_THUMBNAIL, | |
| thumbSrc: k, | |
| uploadID: j | |
| }); | |
| } | |
| }; | |
| f.exports = h; | |
| }, null); | |
| __d('ReactComposerPhotoUpload', ['immutable'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| f.exports = c('immutable').Record({ | |
| id: null, | |
| error: {}, | |
| filename: null, | |
| fileUpload: null, | |
| fileURL: null, | |
| photoID: null, | |
| originalPhotoID: null, | |
| progress: null, | |
| state: null, | |
| xyTags: [], | |
| mediaType: null, | |
| isSpherical: false, | |
| canShowSphericalSingletonNux: false, | |
| thumbSrc: null | |
| }); | |
| }, null); | |
| __d('ReactComposerMediaUploadStore', ['ReactComposerDispatcher', 'ReactComposerMediaUploadType', 'ReactComposerStoreBase', 'ReactComposerMediaUploadActionType', 'ReactComposerPhotoUploadState', 'ReactComposerPhotoActionType', 'ReactComposerPhotoStore', 'ReactComposerPhotoUpload', 'ReactComposerVideoXUploader', 'immutable', 'PhotoEditorSaveStates'], function a(b, c, d, e, f, g) { | |
| var h, i; | |
| if (c.__markCompiled) c.__markCompiled(); | |
| h = babelHelpers.inherits(j, c('ReactComposerStoreBase')); | |
| i = h && h.prototype; | |
| function j() { | |
| 'use strict'; | |
| var k; | |
| i.constructor.call(this, function() { | |
| return { | |
| removedIDs: c('immutable').Set(), | |
| uploads: c('immutable').List(), | |
| uploadsByID: c('immutable').Map(), | |
| videoUploader: null | |
| }; | |
| }, function(l) { | |
| if (k && k.$ReactComposerMediaUploadStore1(l)) return; | |
| switch (l.type) { | |
| case c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_ENQUEUED: | |
| case c('ReactComposerMediaUploadActionType').VIDEO_UPLOAD_ENQUEUED: | |
| k && k.$ReactComposerMediaUploadStore2(l); | |
| break; | |
| case c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_RESIZE_STARTED: | |
| k && k.$ReactComposerMediaUploadStore3(l); | |
| break; | |
| case c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_RESIZE_PROGRESS: | |
| k && k.$ReactComposerMediaUploadStore4(l); | |
| break; | |
| case c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_RESIZE_DONE: | |
| k && k.$ReactComposerMediaUploadStore5(l, c('ReactComposerPhotoUploadState').PHOTO_UPLOAD_RESIZE_DONE); | |
| break; | |
| case c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_RESIZE_FAILED: | |
| k && k.$ReactComposerMediaUploadStore5(l, c('ReactComposerPhotoUploadState').PHOTO_UPLOAD_RESIZE_FAILED); | |
| break; | |
| case c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_UPLOADING: | |
| case c('ReactComposerMediaUploadActionType').VIDEO_UPLOAD_UPLOADING: | |
| k && k.$ReactComposerMediaUploadStore6(l); | |
| break; | |
| case c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_IS_SPHERICAL: | |
| k && k.$ReactComposerMediaUploadStore7(l); | |
| break; | |
| case c('ReactComposerMediaUploadActionType').VIDEO_SET_THUMBNAIL: | |
| k && k.$ReactComposerMediaUploadStore8(l); | |
| break; | |
| case c('ReactComposerMediaUploadActionType').MEDIA_UPLOAD_PROGRESS: | |
| k && k.$ReactComposerMediaUploadStore4(l); | |
| break; | |
| case c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_DONE: | |
| case c('ReactComposerMediaUploadActionType').VIDEO_UPLOAD_DONE: | |
| c('ReactComposerDispatcher').waitFor([c('ReactComposerPhotoStore').getDispatchToken()]); | |
| k && k.$ReactComposerMediaUploadStore9(l); | |
| break; | |
| case c('ReactComposerMediaUploadActionType').PHOTO_UPLOAD_FAILED: | |
| case c('ReactComposerMediaUploadActionType').VIDEO_UPLOAD_FAILED: | |
| k && k.$ReactComposerMediaUploadStore10(l); | |
| break; | |
| case c('ReactComposerMediaUploadActionType').MEDIA_UPLOAD_REMOVE: | |
| case c('ReactComposerPhotoActionType').PHOTO_REMOVE: | |
| k && k.$ReactComposerMediaUploadStore11(l); | |
| break; | |
| case c('ReactComposerMediaUploadActionType').MEDIA_UPLOAD_MOVED: | |
| k && k.$ReactComposerMediaUploadStore12(l); | |
| break; | |
| case c('ReactComposerMediaUploadActionType').PREFILL_PHOTOS: | |
| k && k.$ReactComposerMediaUploadStore13(l); | |
| break; | |
| default: | |
| } | |
| }); | |
| k = this; | |
| } | |
| j.prototype.getMediaUploadExists = function(k, l) { | |
| 'use strict'; | |
| var m = this.getComposerData(k); | |
| return m.uploadsByID.get(l) !== undefined; | |
| }; | |
| j.prototype.getMediaUpload = function(k, l) { | |
| 'use strict'; | |
| return this.$ReactComposerMediaUploadStore14(this.getComposerData(k), l); | |
| }; | |
| j.prototype.getUploadIndex = function(k, l) { | |
| 'use strict'; | |
| return this.$ReactComposerMediaUploadStore15(this.getComposerData(k), l); | |
| }; | |
| j.prototype.getUploads = function(k) { | |
| 'use strict'; | |
| return this.getComposerData(k).uploads; | |
| }; | |
| j.prototype.getUploadsOfType = function(k, l) { | |
| 'use strict'; | |
| var m = this.getComposerData(k).uploads.filter(function(n) { | |
| return (n.mediaType === l); | |
| }); | |
| return m; | |
| }; | |
| j.prototype.getUploadsCount = function(k, l) { | |
| 'use strict'; | |
| if (!l) return this.getComposerData(k).uploads.size; | |
| return this.getComposerData(k).uploads.filter(function(m) { | |
| return m.mediaType === l; | |
| }).size; | |
| }; | |
| j.prototype.getHasUploadBeenRemoved = function(k, l) { | |
| 'use strict'; | |
| var m = this.getComposerData(k); | |
| return m.removedIDs.has(l); | |
| }; | |
| j.prototype.isUploading = function(k) { | |
| 'use strict'; | |
| return this.getComposerData(k).uploads.some(function(l) { | |
| return (l.state !== c('ReactComposerPhotoUploadState').PHOTO_UPLOAD_RESIZE_FAILED && l.state !== c('ReactComposerPhotoUploadState').PHOTO_UPLOAD_DONE && l.state !== c('ReactComposerPhotoUploadState').PHOTO_UPLOAD_FAILED); | |
| }); | |
| }; | |
| j.prototype.getTotalNumberOfStickersOnPhotos = function(k) { | |
| 'use strict'; | |
| var l = 0; | |
| this.getComposerData(k).uploads.forEach(function(m) { | |
| var n = m.get('originalPhotoID'); | |
| if (n) l += c('PhotoEditorSaveStates').getTotalNumOfStickersOnPhoto(n); | |
| }); | |
| return l; | |
| }; | |
| j.prototype.getVideoUploader = function(k, l) { | |
| 'use strict'; | |
| var m = this.getComposerData(k); | |
| if (!m.videoUploader) { | |
| var n = new(c('ReactComposerVideoXUploader'))({ | |
| composerID: k, | |
| uploaderParams: l | |
| }); | |
| m.videoUploader = n; | |
| } | |
| return m.videoUploader; | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore2 = function(k) { | |
| 'use strict'; | |
| var l = this.validateAction(k, ['composerID', 'mediaType', 'uploadID', 'filename', 'fileURL', 'index', 'xyTags', 'isSpherical']), | |
| m = l[0], | |
| n = l[1], | |
| o = l[2], | |
| p = l[3], | |
| q = l[4], | |
| r = l[5], | |
| s = l[6], | |
| t = l[7]; | |
| this.$ReactComposerMediaUploadStore16(m, r, new(c('ReactComposerPhotoUpload'))({ | |
| id: o, | |
| mediaType: n, | |
| state: c('ReactComposerPhotoUploadState').PHOTO_UPLOAD_ENQUEUED, | |
| filename: p, | |
| fileURL: q, | |
| xyTags: s, | |
| isSpherical: t | |
| })); | |
| this.$ReactComposerMediaUploadStore17(m); | |
| this.emitChange(m); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore17 = function(k) { | |
| 'use strict'; | |
| var l = this.getUploads(k); | |
| if (l.size > 1) l.forEach(function(m) { | |
| this.$ReactComposerMediaUploadStore18(this.getComposerData(k), m.id, function(n) { | |
| if (n.isSpherical) n = n.set('canShowSphericalSingletonNux', true); | |
| return n.set('isSpherical', false); | |
| }); | |
| }.bind(this)); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore3 = function(k) { | |
| 'use strict'; | |
| var l = this.validateAction(k, ['composerID', 'uploadID']), | |
| m = l[0], | |
| n = l[1], | |
| o = this.getComposerData(m); | |
| this.$ReactComposerMediaUploadStore18(o, n, function(p) { | |
| return p.withMutations(function(q) { | |
| return q.set('state', c('ReactComposerPhotoUploadState').PHOTO_UPLOAD_RESIZE_STARTED).set('progress', 0); | |
| }); | |
| }); | |
| this.emitChange(m); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore6 = function(k) { | |
| 'use strict'; | |
| var l = this.validateAction(k, ['composerID', 'uploadID', 'fileUpload']), | |
| m = l[0], | |
| n = l[1], | |
| o = l[2], | |
| p = this.getComposerData(m); | |
| this.$ReactComposerMediaUploadStore18(p, n, function(q) { | |
| return q.withMutations(function(r) { | |
| return r.set('state', c('ReactComposerPhotoUploadState').PHOTO_UPLOAD_UPLOADING).set('progress', 0).set('fileUpload', o); | |
| }); | |
| }); | |
| this.emitChange(m); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore4 = function(k) { | |
| 'use strict'; | |
| var l = this.validateAction(k, ['composerID', 'uploadID', 'progress']), | |
| m = l[0], | |
| n = l[1], | |
| o = l[2], | |
| p = this.getComposerData(m); | |
| this.$ReactComposerMediaUploadStore18(p, n, function(q) { | |
| return q.set('progress', o); | |
| }); | |
| this.emitChange(m); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore9 = function(k) { | |
| 'use strict'; | |
| var l = this.validateAction(k, ['composerID', 'uploadID', 'photoID']), | |
| m = l[0], | |
| n = l[1], | |
| o = l[2], | |
| p = this.getComposerData(m); | |
| this.$ReactComposerMediaUploadStore18(p, n, function(q) { | |
| return q.withMutations(function(r) { | |
| return r.set('state', c('ReactComposerPhotoUploadState').PHOTO_UPLOAD_DONE).set('photoID', o).set('originalPhotoID', k.originalPhotoID || o).remove('fileUpload'); | |
| }); | |
| }); | |
| if (!k.cubestripURI) this.$ReactComposerMediaUploadStore18(p, n, function(q) { | |
| return q.set('isSpherical', false); | |
| }); | |
| this.emitChange(m); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore7 = function(k) { | |
| 'use strict'; | |
| var l = this.validateAction(k, ['composerID', 'uploadID', 'isSpherical']), | |
| m = l[0], | |
| n = l[1], | |
| o = l[2]; | |
| this.$ReactComposerMediaUploadStore18(this.getComposerData(m), n, function(p) { | |
| return p.set('isSpherical', o); | |
| }); | |
| this.$ReactComposerMediaUploadStore17(m); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore10 = function(k) { | |
| 'use strict'; | |
| var l = this.validateAction(k, ['composerID', 'uploadID']), | |
| m = l[0], | |
| n = l[1], | |
| o = this.getComposerData(m); | |
| this.$ReactComposerMediaUploadStore18(o, n, function(p) { | |
| return p.withMutations(function(q) { | |
| return q.set('state', c('ReactComposerPhotoUploadState').PHOTO_UPLOAD_FAILED).set('error', k.error); | |
| }); | |
| }); | |
| this.emitChange(m); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore11 = function(k) { | |
| 'use strict'; | |
| var l = this.validateAction(k, ['composerID', 'uploadID']), | |
| m = l[0], | |
| n = l[1], | |
| o = this.getComposerData(m), | |
| p = this.$ReactComposerMediaUploadStore15(o, n); | |
| o.uploads = o.uploads['delete'](p); | |
| o.uploadsByID = o.uploadsByID['delete'](n); | |
| for (var q = p; q < o.uploads.size; q++) { | |
| var r = o.uploads.get(q).id; | |
| o.uploadsByID = o.uploadsByID.set(r, q); | |
| } | |
| o.removedIDs = o.removedIDs.add(n); | |
| this.emitChange(m); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore8 = function(k) { | |
| 'use strict'; | |
| var l = this.validateAction(k, ['composerID', 'uploadID', 'thumbSrc']), | |
| m = l[0], | |
| n = l[1], | |
| o = l[2], | |
| p = this.getComposerData(m); | |
| this.$ReactComposerMediaUploadStore18(p, n, function(q) { | |
| return q.set('thumbSrc', o); | |
| }); | |
| this.emitChange(m); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore5 = function(k, l) { | |
| 'use strict'; | |
| var m = this.validateAction(k, ['composerID', 'uploadID']), | |
| n = m[0], | |
| o = m[1]; | |
| this.$ReactComposerMediaUploadStore19(n, o, l); | |
| this.emitChange(n); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore12 = function(k) { | |
| 'use strict'; | |
| var l = this.validateAction(k, ['composerID', 'from', 'to']), | |
| m = l[0], | |
| n = l[1], | |
| o = l[2], | |
| p = this.getComposerData(m); | |
| p.uploads = p.uploads.splice(n, 1).splice(o, 0, p.uploads.get(n)); | |
| p.uploadsByID = p.uploads.groupBy(function(q, r) { | |
| return r; | |
| }).toMap().map(function(q) { | |
| return q.first().id; | |
| }).flip(); | |
| this.emitChange(m); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore13 = function(k) { | |
| 'use strict'; | |
| var l = this.validateAction(k, ['composerID', 'photos']), | |
| m = l[0], | |
| n = l[1]; | |
| n.forEach(function(o, p) { | |
| this.$ReactComposerMediaUploadStore16(m, p, new(c('ReactComposerPhotoUpload'))({ | |
| id: o.uploadID, | |
| photoID: o.photoID, | |
| mediaType: c('ReactComposerMediaUploadType').PHOTO, | |
| originalPhotoID: o.photoID, | |
| state: c('ReactComposerPhotoUploadState').PHOTO_UPLOAD_DONE, | |
| isSpherical: Boolean(o.cubestripURI) | |
| })); | |
| }.bind(this)); | |
| this.emitChange(m); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore19 = function(k, l, m) { | |
| 'use strict'; | |
| var n = this.getComposerData(k); | |
| this.$ReactComposerMediaUploadStore18(n, l, function(o) { | |
| return o.set('state', m); | |
| }); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore18 = function(k, l, m) { | |
| 'use strict'; | |
| var n = this.$ReactComposerMediaUploadStore20(k, l), | |
| o = n[0], | |
| p = n[1]; | |
| k.uploads = k.uploads.set(p, m(o, p)); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore20 = function(k, l) { | |
| 'use strict'; | |
| var m = this.$ReactComposerMediaUploadStore15(k, l); | |
| return [k.uploads.get(m), m]; | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore15 = function(k, l) { | |
| 'use strict'; | |
| var m = k.uploadsByID.get(l); | |
| if (m === undefined) throw new Error('Upload ' + l + ' hasn\'t been registered'); | |
| return m; | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore14 = function(k, l) { | |
| 'use strict'; | |
| var m = this.$ReactComposerMediaUploadStore15(k, l); | |
| return k.uploads.get(m); | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore1 = function(k) { | |
| 'use strict'; | |
| if (c('ReactComposerMediaUploadActionType')[k.type]) { | |
| var l = k.composerID, | |
| m = k.uploadID; | |
| if (m == null) return false; | |
| return this.getHasUploadBeenRemoved(l, m); | |
| } | |
| return false; | |
| }; | |
| j.prototype.$ReactComposerMediaUploadStore16 = function(k, l, m) { | |
| 'use strict'; | |
| var n = this.getComposerData(k); | |
| n.uploads = n.uploads.splice(l, 0, m); | |
| for (var o = l; o < n.uploads.size; o++) { | |
| var p = n.uploads.get(o).id; | |
| n.uploadsByID = n.uploadsByID.set(p, o); | |
| } | |
| }; | |
| f.exports = new j(); | |
| }, null); | |
| __d('MultimediaUploadProcessingDialog.react', ['fbt', 'React', 'XUIDialog.react', 'XUIDialogTitle.react', 'XUIDialogBody.react'], function a(b, c, d, e, f, g, h) { | |
| 'use strict'; | |
| if (c.__markCompiled) c.__markCompiled(); | |
| var i = c('React').PropTypes, | |
| j = c('React').createClass({ | |
| displayName: 'MultimediaUploadProcessingDialog', | |
| propTypes: { | |
| numOfVideos: i.number.isRequired | |
| }, | |
| getInitialState: function() { | |
| return { | |
| dialogShown: true | |
| }; | |
| }, | |
| componentWillReceiveProps: function(k) { | |
| if (k.show) this.setState({ | |
| dialogShown: true | |
| }); | |
| }, | |
| _getProcessingText: function() { | |
| return this.props.numOfVideos === 1 ? h._("The video in your post is being processed. We'll send you a notification when it's done and your post is ready to view.") : h._("The videos in your post are being processed. We'll send you a notification when they're done and your post is ready to view."); | |
| }, | |
| _getTitle: function() { | |
| return h._("Processing Videos"); | |
| }, | |
| render: function() { | |
| return (c('React').createElement(c('XUIDialog.react'), { | |
| shown: this.state.dialogShown, | |
| width: 400 | |
| }, c('React').createElement(c('XUIDialogTitle.react'), null, this._getTitle()), c('React').createElement(c('XUIDialogBody.react'), null, this._getProcessingText()))); | |
| } | |
| }); | |
| f.exports = j; | |
| }, null); | |
| __d('ReactComposerMediaFilterUtils', ['ComposerXNativeAudioUploadsConfig', 'VideoUploadConfig'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| var h = { | |
| hasVideos: function(i) { | |
| return this.filterVideos(i).length > 0; | |
| }, | |
| hasAudioFiles: function(i) { | |
| return this.filterAudioFiles(i).length > 0; | |
| }, | |
| filterVideos: function(i) { | |
| return this.filterFileOfSupportedType(i, c('VideoUploadConfig').videoExtensions); | |
| }, | |
| filterAudioFiles: function(i) { | |
| return this.filterFileOfSupportedType(i, c('ComposerXNativeAudioUploadsConfig').audioExtensions); | |
| }, | |
| filterFileOfSupportedType: function(i, j) { | |
| return i.filter(function(k) { | |
| var l = k.indexOf('.') !== -1 ? k.split('.').pop().toLowerCase() : ''; | |
| return j[l]; | |
| }); | |
| } | |
| }; | |
| f.exports = h; | |
| }, null); | |
| __d('VideoUploadProgressBar', ['cx', 'CSS', 'VideoUploadFeatureDetector'], function a(b, c, d, e, f, g, h) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| function i(j) { | |
| 'use strict'; | |
| this.$VideoUploadProgressBar1 = j.progress_bar; | |
| this.$VideoUploadProgressBar2 = j.throbber; | |
| this.$VideoUploadProgressBar3 = j.uploader; | |
| this.$VideoUploadProgressBar4 = j.start_margin; | |
| this.$VideoUploadProgressBar5 = j.start_delay; | |
| this.$VideoUploadProgressBar6 = j.end_margin; | |
| this.$VideoUploadProgressBar7 = j.end_delay; | |
| this.$VideoUploadProgressBar8 = j.progress_bar_label; | |
| this.$VideoUploadProgressBar9(); | |
| } | |
| i.prototype.reset = function() { | |
| 'use strict'; | |
| this.$VideoUploadProgressBar1.setPosition(0); | |
| }; | |
| i.prototype.getRoot = function() { | |
| 'use strict'; | |
| return this.$VideoUploadProgressBar1.getRoot(); | |
| }; | |
| i.computeProgress = function(j, k, l, m, n) { | |
| 'use strict'; | |
| var o = Math.min(j + k, l); | |
| return o / l * (100 - m - n) + m; | |
| }; | |
| i.prototype.$VideoUploadProgressBar9 = function() { | |
| 'use strict'; | |
| if (c('VideoUploadFeatureDetector').supportsFileAPI()) { | |
| this.$VideoUploadProgressBar3.subscribe('upload-requested', this.$VideoUploadProgressBar10.bind(this)); | |
| this.$VideoUploadProgressBar3.subscribe('upload-progressed', this.$VideoUploadProgressBar11.bind(this)); | |
| this.$VideoUploadProgressBar3.subscribe('online', this.$VideoUploadProgressBar12.bind(this)); | |
| this.$VideoUploadProgressBar3.subscribe('offline', this.$VideoUploadProgressBar13.bind(this)); | |
| } else this.$VideoUploadProgressBar3.subscribe('upload-requested', this.$VideoUploadProgressBar14.bind(this)); | |
| }; | |
| i.prototype.$VideoUploadProgressBar10 = function(event) { | |
| 'use strict'; | |
| c('CSS').show(this.$VideoUploadProgressBar1.getRoot()); | |
| c('CSS').removeClass(this.$VideoUploadProgressBar1.getRoot(), "_5r5a"); | |
| this.$VideoUploadProgressBar1.setTarget(this.$VideoUploadProgressBar4, this.$VideoUploadProgressBar5); | |
| this.$VideoUploadProgressBar15(0); | |
| }; | |
| i.prototype.$VideoUploadProgressBar15 = function(j) { | |
| 'use strict'; | |
| if (this.$VideoUploadProgressBar8) this.$VideoUploadProgressBar1.changeLabel('' + j.toFixed(1) + '%'); | |
| }; | |
| i.prototype.$VideoUploadProgressBar11 = function(event, j) { | |
| 'use strict'; | |
| c('CSS').removeClass(this.$VideoUploadProgressBar1.getRoot(), "_5r5a"); | |
| var k = i.computeProgress(j.start_offset, j.sent_bytes, j.file_size, this.$VideoUploadProgressBar4, this.$VideoUploadProgressBar6); | |
| this.$VideoUploadProgressBar1.setPosition(k); | |
| this.$VideoUploadProgressBar15(k); | |
| if (k >= 100 - this.$VideoUploadProgressBar6) { | |
| this.$VideoUploadProgressBar1.setTarget(100, this.$VideoUploadProgressBar7); | |
| this.$VideoUploadProgressBar15(100); | |
| } | |
| }; | |
| i.prototype.$VideoUploadProgressBar12 = function(event) { | |
| 'use strict'; | |
| c('CSS').removeClass(this.$VideoUploadProgressBar1.getRoot(), "_5r5a"); | |
| }; | |
| i.prototype.$VideoUploadProgressBar13 = function(event) { | |
| 'use strict'; | |
| c('CSS').addClass(this.$VideoUploadProgressBar1.getRoot(), "_5r5a"); | |
| }; | |
| i.prototype.$VideoUploadProgressBar14 = function(event) { | |
| 'use strict'; | |
| c('CSS').show(this.$VideoUploadProgressBar2); | |
| }; | |
| f.exports = i; | |
| }, null); | |
| __d('VideoUploadLogger', ['Banzai'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| function h(i) { | |
| this._source = i.source; | |
| this._waterfallID = i.waterfall_id; | |
| this._targetID = i.target_id; | |
| this._delay = i.delay; | |
| this._times = []; | |
| this._isChunkedUpload = i.is_chunked_upload; | |
| this._actorID = i.actor_id; | |
| this._composerEntryPointRef = i.composer_entry_point_ref; | |
| } | |
| Object.assign(h, { | |
| BANZAI_GK: 'videos', | |
| BANZAI_ROUTE: 'video_waterfall', | |
| SOURCE_SIMPLE: 'simple', | |
| SOURCE_COMPOSER: 'composer', | |
| EVENT_STARTED_GENERATE_THUMBNAILS: 'upload.client.started_generate_thumbnails', | |
| EVENT_FINISHED_GENERATE_THUMBNAILS: 'upload.client.finished_generate_thumbnails', | |
| EVENT_SELECTED_CUSTOM_THUMBNAIL: 'upload.client.selected_custom_thumbnail', | |
| EVENT_VIDEO_DIMENSIONS_UNREADABLE: 'upload.client.video_dimensions_unreadable', | |
| EVENT_REPLACE_VIDEO: 'upload.client.replace_video', | |
| EVENT_STARTED_FLOW: 'upload.client.started_flow', | |
| EVENT_FINISHED_FLOW: 'upload.client.finished_flow', | |
| EVENT_FAILED_FLOW: 'upload.client.failed_flow', | |
| EVENT_CANCELED_FLOW: 'upload.client.canceled_flow', | |
| EVENT_RESIGNED_FLOW: 'upload.client.resigned_flow', | |
| EVENT_REQUESTED_UPLOADING: 'upload.client.requested_uploading', | |
| EVENT_INVALIDATED_UPLOADING: 'upload.client.invalidated_uploading', | |
| EVENT_STARTED_UPLOADING: 'upload.client.started_uploading', | |
| EVENT_PROGRESS_UPLOADING_START_REQUEST: 'upload.client.progress_uploading_start_request', | |
| EVENT_FINISHED_UPLOADING: 'upload.client.finished_uploading', | |
| EVENT_CANCELED_UPLOADING: 'upload.client.canceled_uploading', | |
| EVENT_ABANDONED_UPLOADING: 'upload.client.abandoned_uploading', | |
| EVENT_FAILED_UPLOADING: 'upload.client.failed_uploading', | |
| EVENT_STARTED_SENDING_BYTES: 'upload.client.started_sending_bytes', | |
| EVENT_FINISHED_SENDING_BYTES: 'upload.client.finished_sending_bytes', | |
| EVENT_CANCELED_SENDING_BYTES: 'upload.client.canceled_sending_bytes', | |
| EVENT_FAILED_SENDING_BYTES: 'upload.client.failed_sending_bytes', | |
| EVENT_STARTED_START_REQUEST: 'upload.client.started_sending_start_request', | |
| EVENT_FINISHED_START_REQUEST: 'upload.client.finished_sending_start_request', | |
| EVENT_FAILED_START_REQUEST: 'upload.client.failed_sending_start_request', | |
| EVENT_STARTED_POST_REQUEST: 'upload.client.started_sending_post_request', | |
| EVENT_FINISHED_POST_REQUEST: 'upload.client.finished_sending_post_request', | |
| EVENT_FAILED_POST_REQUEST: 'upload.client.failed_sending_post_request', | |
| EVENT_STARTED_SENDING_CHUNK_BYTES: 'upload.client.started_sending_chunk_bytes', | |
| EVENT_FINISHED_SENDING_CHUNK_BYTES: 'upload.client.finished_sending_chunk_bytes', | |
| EVENT_CANCELED_SENDING_CHUNK_BYTES: 'upload.client.canceled_sending_chunk_bytes', | |
| EVENT_FAILED_SENDING_CHUNK_BYTES: 'upload.client.failed_sending_chunk_bytes', | |
| EVENT_TIMEOUT_SENDING_CHUNK_BYTES: 'upload.client.timeout_sending_chunk_bytes', | |
| EVENT_ENCODING_START_OBSERVED: 'encode.client.encoding_start_observed', | |
| EVENT_ENCODING_SUCCESS_OBSERVED: 'encode.client.encoding_success_observed', | |
| EVENT_ENCODING_FAIL_OBSERVED: 'encode.client.encoding_fail_observed', | |
| EVENT_RECEIVED_RESPONSE: 'upload.client.received_response' | |
| }); | |
| Object.assign(h.prototype, { | |
| logEvent: function(event, i) { | |
| var j = babelHelpers['extends']({}, i); | |
| if (j.elapsed_time == null) | |
| if (event.indexOf('started') !== -1) { | |
| this._times[event] = Date.now(); | |
| } else if (event.indexOf('finished') !== -1) { | |
| j.elapsed_time = this._computeElapsedTime(event, 'finished'); | |
| } else if (event.indexOf('canceled') !== -1) { | |
| j.elapsed_time = this._computeElapsedTime(event, 'canceled'); | |
| } else if (event.indexOf('failed') !== -1) j.elapsed_time = this._computeElapsedTime(event, 'failed'); | |
| j.event = event; | |
| j.source = this._source; | |
| j.waterfall_id = this._waterfallID; | |
| j.target_id = this._targetID; | |
| j.is_chunked_upload = this._isChunkedUpload; | |
| j.actor_id = this._actorID; | |
| j.composer_entry_point_ref = this._composerEntryPointRef; | |
| c('Banzai').post(h.BANZAI_ROUTE, j, { | |
| delay: this._delay | |
| }); | |
| }, | |
| _computeElapsedTime: function(event, i) { | |
| var j = event.replace(i, 'started'), | |
| k = this._times[j]; | |
| return k ? Date.now() - k : null; | |
| } | |
| }); | |
| f.exports = h; | |
| }, null); | |
| __d('VideoUploadCrashMonitor', ['Bandicoot', 'VideoUploadLogger'], function a(b, c, d, e, f, g) { | |
| var h, i; | |
| if (c.__markCompiled) c.__markCompiled(); | |
| h = babelHelpers.inherits(j, c('Bandicoot')); | |
| i = h && h.prototype; | |
| function j(k, l, m, n, o, p, q, r) { | |
| 'use strict'; | |
| i.constructor.call(this, 'VideoUploadSession'); | |
| this.$VideoUploadCrashMonitor1 = { | |
| waterfallID: k, | |
| actorID: l, | |
| source: m, | |
| targetID: n, | |
| loggingDelay: o, | |
| supportsChunking: p, | |
| composerEntryPointRef: q, | |
| flowStarted: r | |
| }; | |
| } | |
| j.prototype.flowStarted = function() { | |
| 'use strict'; | |
| this.$VideoUploadCrashMonitor1.flowStarted = true; | |
| }; | |
| j.prototype.getCrashTimeData = function() { | |
| 'use strict'; | |
| return this.$VideoUploadCrashMonitor1; | |
| }; | |
| j.prototype.logCrash = function(k, l, m) { | |
| 'use strict'; | |
| if (!l.waterfallID) return; | |
| var n = new(c('VideoUploadLogger'))({ | |
| actor_id: l.actorID, | |
| source: l.source, | |
| waterfall_id: l.waterfallID, | |
| target_id: l.targetID, | |
| delay: l.loggingDelay, | |
| is_chunked_upload: l.supportsChunking, | |
| composer_entry_point_ref: l.composerEntryPointRef | |
| }), | |
| o = { | |
| error: 'Crash Detected', | |
| error_description: 'Detected video upload did not complete due to a crash' | |
| }; | |
| n.logEvent(c('VideoUploadLogger').EVENT_FAILED_UPLOADING, o); | |
| if (l.flowStarted) n.logEvent(c('VideoUploadLogger').EVENT_RESIGNED_FLOW, {}); | |
| }; | |
| f.exports = j; | |
| }, null); | |
| __d('VideoUploadFileValidator', ['fbt', 'errorCode', 'ErrorDialog', 'JSXDOM'], function a(b, c, d, e, f, g, h, i) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| var j = [1363019, 1363020, 1363021, 1363022, 1363023, 1363024, 1363025, 1363026, 1363027, 1363030, 1363031, 1363032, 1363033, 1363038, 1363039, 1363040, 1363048]; | |
| function k(l) { | |
| 'use strict'; | |
| this.$VideoUploadFileValidator1 = l; | |
| } | |
| k.prototype.validate = function(l, m) { | |
| 'use strict'; | |
| return this.$VideoUploadFileValidator2(l) && this.$VideoUploadFileValidator3(l) && this.$VideoUploadFileValidator4(m); | |
| }; | |
| k.prototype.getValidationErrorMessage = function(l, m) { | |
| 'use strict'; | |
| return this.$VideoUploadFileValidator5(l) || this.$VideoUploadFileValidator6(l) || this.$VideoUploadFileValidator7(m); | |
| }; | |
| k.canReplaceVideoForError = function(l) { | |
| 'use strict'; | |
| if (!l) return true; | |
| if (j.indexOf(l) > -1) return true; | |
| return false; | |
| }; | |
| k.prototype.$VideoUploadFileValidator2 = function(l) { | |
| 'use strict'; | |
| var m = this.$VideoUploadFileValidator5(l); | |
| if (m) { | |
| c('ErrorDialog').show(m.summary, m.description); | |
| return false; | |
| } else return true; | |
| }; | |
| k.prototype.$VideoUploadFileValidator5 = function(l) { | |
| 'use strict'; | |
| if (this.$VideoUploadFileValidator1.extensions[l.getExtension()]) return; | |
| var m = "http://www.facebook.com/help/" + "?faq=218673814818907#What-formats-of-video-files-can-I-upload?", | |
| n = c('JSXDOM').a({ | |
| href: m | |
| }, h._("recommended formats")); | |
| return { | |
| summary: h._("Unsupported File Format"), | |
| description: h._("Sorry, the file you selected is in a format that we don't support. Please use one of our {link} for video files.", [h.param('link', n)]) | |
| }; | |
| }; | |
| k.prototype.$VideoUploadFileValidator3 = function(l) { | |
| 'use strict'; | |
| var m = this.$VideoUploadFileValidator6(l); | |
| if (m) { | |
| c('ErrorDialog').show(m.summary, m.description); | |
| return false; | |
| } else return true; | |
| }; | |
| k.prototype.$VideoUploadFileValidator6 = function(l) { | |
| 'use strict'; | |
| var m; | |
| if (l.getSize() === null) return; | |
| if (l.getSize() < this.$VideoUploadFileValidator1.minSize) m = this.$VideoUploadFileValidator8(); | |
| if (l.getSize() > this.$VideoUploadFileValidator1.maxSize) m = this.$VideoUploadFileValidator9(); | |
| return m; | |
| }; | |
| k.prototype.$VideoUploadFileValidator8 = function() { | |
| 'use strict'; | |
| var l = Math.round(this.$VideoUploadFileValidator1.minSize / 1024); | |
| return { | |
| summary: h._("Video File Too Small"), | |
| description: h._("The video file you tried to upload is too small. The minimum size for a video file is {min-size} KB. Please try again with a larger file.", [h.param('min-size', l)]) | |
| }; | |
| }; | |
| k.prototype.$VideoUploadFileValidator9 = function() { | |
| 'use strict'; | |
| var l = this.$VideoUploadFileValidator1.maxSize / 1024 / 1024; | |
| return { | |
| summary: h._("Video File Too Large"), | |
| description: h._("The video file you tried to upload is too large. The maximum size for a video file is {max-size} MB. Please try again with a smaller file.", [h.param('max-size', l)]) | |
| }; | |
| }; | |
| k.prototype.$VideoUploadFileValidator4 = function(l) { | |
| 'use strict'; | |
| var m = this.$VideoUploadFileValidator7(l); | |
| if (m) { | |
| c('ErrorDialog').show(m.summary, m.description); | |
| return false; | |
| } else return true; | |
| }; | |
| k.prototype.$VideoUploadFileValidator7 = function(l) { | |
| 'use strict'; | |
| var m; | |
| if (!l) return; | |
| var n = l.format.duration; | |
| if (n > this.$VideoUploadFileValidator1.maxLength) m = this.$VideoUploadFileValidator10(); | |
| if (n < this.$VideoUploadFileValidator1.minLength) m = this.$VideoUploadFileValidator11(); | |
| if (!l.streams.primaryVideo && l.streams.primaryAudio) m = this.$VideoUploadFileValidator12(); | |
| if (l.streams.primaryVideo.width < this.$VideoUploadFileValidator1.minWidth) m = this.$VideoUploadFileValidator13(); | |
| if (l.streams.primaryVideo.height < this.$VideoUploadFileValidator1.minHeight) m = this.$VideoUploadFileValidator14(); | |
| return m; | |
| }; | |
| k.prototype.$VideoUploadFileValidator10 = function() { | |
| 'use strict'; | |
| return { | |
| summary: h._("Video Duration Too Long"), | |
| description: h._("The duration of the video you tried to upload is too long. The maximum duration for a video is {max-length} minutes. Please upload a shorter video.", [h.param('max-length', Math.round(this.$VideoUploadFileValidator1.maxLength / 60))]) | |
| }; | |
| }; | |
| k.prototype.$VideoUploadFileValidator11 = function() { | |
| 'use strict'; | |
| return { | |
| summary: h._("Video File Too Short"), | |
| description: h._({ | |
| "second": "The duration of the video you tried to upload is too short. The minimum length for a video is {min-length} second. Please upload a longer video.", | |
| "seconds": "The duration of the video you tried to upload is too short. The minimum length for a video is {min-length} seconds. Please upload a longer video." | |
| }, [h.param('min-length', this.$VideoUploadFileValidator1.minLength), h['enum'](this.$VideoUploadFileValidator1.minLength === 1 ? 'second' : 'seconds', { | |
| second: 'second', | |
| seconds: 'seconds' | |
| })]) | |
| }; | |
| }; | |
| k.prototype.$VideoUploadFileValidator12 = function() { | |
| 'use strict'; | |
| var l = "http://www.facebook.com/help/" + "?faq=218673814818907#What-formats-of-video-files-can-I-upload?", | |
| m = c('JSXDOM').a({ | |
| href: l | |
| }, h._("supported video format")); | |
| return { | |
| summary: h._("No Video Detected"), | |
| description: h._("It looks like you're trying to upload a file that isn't a video. Please try uploading a {supported-video-format link}", [h.param('supported-video-format link', m)]) | |
| }; | |
| }; | |
| k.prototype.$VideoUploadFileValidator13 = function() { | |
| 'use strict'; | |
| return { | |
| summary: h._("Video Width Too Narrow"), | |
| description: h._("The width of the video you tried to upload is too short. The minimum width for a video is {min-width}. Please upload a wider video.", [h.param('min-width', this.$VideoUploadFileValidator1.minWidth)]) | |
| }; | |
| }; | |
| k.prototype.$VideoUploadFileValidator14 = function() { | |
| 'use strict'; | |
| return { | |
| summary: h._("Video Height Too Short"), | |
| description: h._("The height of the video you tried to upload is too short. The minimum height for a video is {min-height}. Please upload a taller video.", [h.param('min-height', this.$VideoUploadFileValidator1.minHeight)]) | |
| }; | |
| }; | |
| f.exports = k; | |
| }, null); | |
| __d('VideoUploadSphericalLogger', ['Banzai', 'throttle'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| function h() { | |
| 'use strict'; | |
| this.$VideoUploadSphericalLogger1 = {}; | |
| this.log = c('throttle')(this.log, 3000, this); | |
| } | |
| h.prototype.log = function() { | |
| 'use strict'; | |
| c('Banzai').post('spherical_video_composer_upload', babelHelpers['extends']({}, this.$VideoUploadSphericalLogger1)); | |
| }; | |
| h.prototype.setDirectorsCutEnabled = function(i) { | |
| 'use strict'; | |
| this.$VideoUploadSphericalLogger1.directors_cut_enabled = i; | |
| return this; | |
| }; | |
| h.prototype.setFieldOfView = function(i) { | |
| 'use strict'; | |
| this.$VideoUploadSphericalLogger1.field_of_view = i; | |
| return this; | |
| }; | |
| h.prototype.setFileExtension = function(i) { | |
| 'use strict'; | |
| this.$VideoUploadSphericalLogger1.file_extension = i; | |
| return this; | |
| }; | |
| h.prototype.setHasSphericalMetadata = function(i) { | |
| 'use strict'; | |
| this.$VideoUploadSphericalLogger1.has_spherical_metadata = i; | |
| return this; | |
| }; | |
| h.prototype.setPitchDegrees = function(i) { | |
| 'use strict'; | |
| this.$VideoUploadSphericalLogger1.pitch_degrees = i; | |
| return this; | |
| }; | |
| h.prototype.setTargetID = function(i) { | |
| 'use strict'; | |
| this.$VideoUploadSphericalLogger1.target_id = i; | |
| return this; | |
| }; | |
| h.prototype.setVideoID = function(i) { | |
| 'use strict'; | |
| this.$VideoUploadSphericalLogger1.video_id = i; | |
| return this; | |
| }; | |
| h.prototype.setUserAction = function(i) { | |
| 'use strict'; | |
| this.$VideoUploadSphericalLogger1.user_action = i; | |
| return this; | |
| }; | |
| h.prototype.setVideoPreviewPosition = function(i) { | |
| 'use strict'; | |
| this.$VideoUploadSphericalLogger1.video_preview_position = i; | |
| return this; | |
| }; | |
| h.prototype.setYawDegrees = function(i) { | |
| 'use strict'; | |
| this.$VideoUploadSphericalLogger1.yaw_degrees = i; | |
| return this; | |
| }; | |
| f.exports = new h(); | |
| }, null); | |
| __d('VideoUploadMetadataParser', ['VideoUploadFeatureDetector', 'VideoUploadSphericalLogger', 'fileSlice'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| var h = 4, | |
| i = 4, | |
| j = 5242880, | |
| k = 24, | |
| l = 88, | |
| m = 20, | |
| n = 16, | |
| o = 4, | |
| p = 84, | |
| q = [255, 204, 130, 99, 248, 85, 74, 147, 136, 20, 88, 122, 2, 82, 31, 221]; | |
| function r(s, t) { | |
| 'use strict'; | |
| this.$VideoUploadMetadataParser1 = s; | |
| this.$VideoUploadMetadataParser2 = t; | |
| } | |
| r.prototype.getHandler = function() { | |
| 'use strict'; | |
| return this.$VideoUploadMetadataParser2; | |
| }; | |
| r.prototype.parse = function() { | |
| 'use strict'; | |
| if (!c('VideoUploadFeatureDetector').supportsFileReading()) { | |
| this.$VideoUploadMetadataParser2(null); | |
| return; | |
| } | |
| switch (this.$VideoUploadMetadataParser1.getExtension()) { | |
| case 'mp4': | |
| case 'mov': | |
| case 'm4v': | |
| case '3gp': | |
| case '3g2': | |
| c('VideoUploadSphericalLogger').setFileExtension(this.$VideoUploadMetadataParser1.getExtension()); | |
| break; | |
| default: | |
| this.$VideoUploadMetadataParser2(null); | |
| return; | |
| } | |
| this.$VideoUploadMetadataParser3(0, Math.min(j, this.$VideoUploadMetadataParser1.getSize()), null); | |
| }; | |
| r.prototype.$VideoUploadMetadataParser3 = function(s, t, u) { | |
| 'use strict'; | |
| var v = new FileReader(); | |
| v.onload = function(event) { | |
| try { | |
| var y = this.$VideoUploadMetadataParser4(new DataView(v.result), 0, t - s, s, u); | |
| if (y.completed) { | |
| y = this.$VideoUploadMetadataParser5(y); | |
| this.$VideoUploadMetadataParser2(y); | |
| } else this.$VideoUploadMetadataParser3(s + y.nextOffset, Math.min(this.$VideoUploadMetadataParser1.getSize(), s + y.nextOffset + j), y); | |
| } catch (x) { | |
| this.$VideoUploadMetadataParser2(null); | |
| } | |
| }.bind(this); | |
| var w = this.$VideoUploadMetadataParser1.getFile(); | |
| v.readAsArrayBuffer(c('fileSlice').call(w, s, t)); | |
| }; | |
| r.prototype.$VideoUploadMetadataParser6 = function(s, t, u) { | |
| 'use strict'; | |
| var v = []; | |
| for (var w = 0; w < u; w++) v.push(String.fromCharCode(s.getUint8(t + w))); | |
| return v.join(''); | |
| }; | |
| r.prototype.$VideoUploadMetadataParser7 = function(s, t, u) { | |
| 'use strict'; | |
| try { | |
| var w = i + h; | |
| if (w + q.length < u && this.$VideoUploadMetadataParser8(s, t + w)) { | |
| w += q.length; | |
| if (w < u) { | |
| var x = this.$VideoUploadMetadataParser6(s, t + w, u - w), | |
| y; | |
| if (window.DOMParser) { | |
| var z = new DOMParser(); | |
| y = z.parseFromString(x, 'text/xml'); | |
| } else { | |
| y = new window.ActiveXObject('Microsoft.XMLDOM'); | |
| y.async = 'false'; | |
| y.loadXML(x); | |
| } | |
| var aa = y.getElementsByTagNameNS('*', 'Spherical')[0].childNodes[0].nodeValue; | |
| return aa.toLowerCase() === 'true'; | |
| } | |
| } | |
| } catch (v) {} | |
| return false; | |
| }; | |
| r.prototype.$VideoUploadMetadataParser8 = function(s, t) { | |
| 'use strict'; | |
| for (var u = 0; u < q.length; u++) | |
| if (s.getUint8(t + u) !== q[u]) return false; | |
| return true; | |
| }; | |
| r.prototype.$VideoUploadMetadataParser4 = function(s, t, u, v, w) { | |
| 'use strict'; | |
| if (!w) w = { | |
| widths: [], | |
| heights: [], | |
| streamTypes: [], | |
| streamDurations: [], | |
| isSpherical: false | |
| }; | |
| while (t < u) { | |
| var x = s.getUint32(t), | |
| y = this.$VideoUploadMetadataParser6(s, t + h, i); | |
| if (t + x > u) { | |
| w.completed = false; | |
| w.nextOffset = t; | |
| if (x > u) w.nextOffset += x; | |
| return w; | |
| } | |
| if (t + v === 0 && y !== 'ftyp') throw new Error('No ftyp atom'); | |
| if (x === 0) throw new Error('len is 0'); | |
| var z = function() { | |
| var da = s.getUint32(t + m), | |
| ea = s.getUint32(t + k); | |
| return ea / da; | |
| }; | |
| switch (y) { | |
| case 'moov': | |
| case 'trak': | |
| case 'mdia': | |
| t += h + i; | |
| break; | |
| case 'mvhd': | |
| w.duration = z(); | |
| t += x; | |
| break; | |
| case 'tkhd': | |
| var aa = s.getUint16(t + p), | |
| ba = s.getUint16(t + l); | |
| w.widths.push(aa); | |
| w.heights.push(ba); | |
| t += x; | |
| break; | |
| case 'hdlr': | |
| var ca = this.$VideoUploadMetadataParser6(s, t + n, o); | |
| switch (ca) { | |
| case 'vide': | |
| ca = 'video'; | |
| break; | |
| case 'soun': | |
| ca = 'audio'; | |
| break; | |
| case 'subt': | |
| ca = 'subtitle'; | |
| break; | |
| default: | |
| ca = 'data'; | |
| } | |
| w.streamTypes.push(ca); | |
| t += x; | |
| break; | |
| case 'mdhd': | |
| w.streamDurations.push(z()); | |
| t += x; | |
| break; | |
| case 'uuid': | |
| w.isSpherical = w.isSpherical || this.$VideoUploadMetadataParser7(s, t, x); | |
| t += x; | |
| break; | |
| default: | |
| t += x; | |
| } | |
| } | |
| w.completed = true; | |
| return w; | |
| }; | |
| r.prototype.$VideoUploadMetadataParser5 = function(s) { | |
| 'use strict'; | |
| var t = { | |
| streams: {}, | |
| format: {} | |
| }, | |
| u = s.widths.length, | |
| v = s.heights.length, | |
| w = s.streamTypes.length, | |
| x = s.streamDurations.length; | |
| if (u !== v || u !== w || u !== x) return null; | |
| for (var y = 0; y < u; y++) { | |
| var z = { | |
| width: s.widths[y], | |
| height: s.heights[y], | |
| duration: s.streamDurations[y], | |
| type: s.streamTypes[y] | |
| }; | |
| if (z.type === 'video') { | |
| var aa = z.width * z.height, | |
| ba = t.streams.primaryVideo; | |
| if (!ba || ba.width * ba.height > aa) t.streams.primaryVideo = z; | |
| } else if (z.type === 'audio') { | |
| var ca = t.streams.primaryAudio; | |
| if (!ca || ca.duration < z.duration) t.streams.primaryAudio = z; | |
| } | |
| } | |
| t.format.duration = s.duration; | |
| t.format.isSpherical = s.isSpherical; | |
| c('VideoUploadSphericalLogger').setHasSphericalMetadata(s.isSpherical); | |
| return t; | |
| }; | |
| f.exports = r; | |
| }, null); | |
| __d('VideoUploadRequest', ['AsyncRequest', 'DOM', 'DTSG', 'FileForm', 'Form', 'PHPQuerySerializer', 'VideoUploadFeatureDetector', 'emptyFunction', 'flattenPHPQueryData', 'submitForm'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| var h = 'video'; | |
| function i(j) { | |
| 'use strict'; | |
| this.$VideoUploadRequest1 = j; | |
| this.$VideoUploadRequest2 = null; | |
| this.$VideoUploadRequest3 = false; | |
| this.$VideoUploadRequest4 = null; | |
| this.$VideoUploadRequest5 = null; | |
| this.$VideoUploadRequest6 = null; | |
| this.$VideoUploadRequest7 = c('emptyFunction'); | |
| this.$VideoUploadRequest8 = c('emptyFunction'); | |
| this.$VideoUploadRequest9 = c('emptyFunction'); | |
| this.$VideoUploadRequest10 = c('emptyFunction'); | |
| this.$VideoUploadRequest11 = null; | |
| } | |
| i.prototype.setAllowCrossOrigin = function(j) { | |
| 'use strict'; | |
| this.$VideoUploadRequest3 = j; | |
| return this; | |
| }; | |
| i.prototype.setData = function(j) { | |
| 'use strict'; | |
| this.$VideoUploadRequest4 = j; | |
| return this; | |
| }; | |
| i.prototype.setWaterfallID = function(j) { | |
| 'use strict'; | |
| this.$VideoUploadRequest5 = j; | |
| return this; | |
| }; | |
| i.prototype.setSuccessHandler = function(j) { | |
| 'use strict'; | |
| this.$VideoUploadRequest7 = j; | |
| return this; | |
| }; | |
| i.prototype.setErrorHandler = function(j) { | |
| 'use strict'; | |
| this.$VideoUploadRequest8 = j; | |
| return this; | |
| }; | |
| i.prototype.setTransportErrorHandler = function(j) { | |
| 'use strict'; | |
| this.$VideoUploadRequest9 = j; | |
| return this; | |
| }; | |
| i.prototype.setUploadProgressHandler = function(j) { | |
| 'use strict'; | |
| this.$VideoUploadRequest10 = j; | |
| return this; | |
| }; | |
| i.prototype.setTimeoutHandler = function(j, k) { | |
| 'use strict'; | |
| this.$VideoUploadRequest6 = j; | |
| this.$VideoUploadRequest11 = k; | |
| return this; | |
| }; | |
| i.prototype.setThumbnail = function(j) { | |
| 'use strict'; | |
| this.$VideoUploadRequest12 = j; | |
| return this; | |
| }; | |
| i.prototype.setCaptions = function(j) { | |
| 'use strict'; | |
| this.$VideoUploadRequest13 = j; | |
| return this; | |
| }; | |
| i.prototype.send = function() { | |
| 'use strict'; | |
| if (this.$VideoUploadRequest2) throw new Error('An upload request is already in progress.'); | |
| if (c('VideoUploadFeatureDetector').supportsXHR()) { | |
| this.$VideoUploadRequest2 = this.$VideoUploadRequest14(); | |
| if (this.$VideoUploadRequest12 || this.$VideoUploadRequest13) { | |
| var j = new FormData(); | |
| if (this.$VideoUploadRequest12) j.append('thumb', this.$VideoUploadRequest12); | |
| if (this.$VideoUploadRequest13) this.$VideoUploadRequest13.forEach(function(l, m) { | |
| var n = l.getIsDefault() ? 'captions_default' : 'captions_file' + m; | |
| j.append(n, l.getFile()); | |
| }); | |
| if (this.$VideoUploadRequest4) { | |
| var k = c('flattenPHPQueryData')(this.$VideoUploadRequest4); | |
| Object.keys(k).forEach(function(l) { | |
| j.append(l, k[l]); | |
| }); | |
| } | |
| this.$VideoUploadRequest2.setRawData(j); | |
| } | |
| this.$VideoUploadRequest2.send(); | |
| } else { | |
| this.$VideoUploadRequest2 = this.$VideoUploadRequest15(); | |
| this.$VideoUploadRequest16(this.$VideoUploadRequest2); | |
| } | |
| }; | |
| i.prototype.sendChunk = function(j) { | |
| 'use strict'; | |
| if (this.$VideoUploadRequest2) throw new Error('An upload request is already in progress.'); | |
| var k = new FormData(); | |
| k.append('video_file_chunk', j); | |
| this.$VideoUploadRequest2 = this.$VideoUploadRequest14(); | |
| this.$VideoUploadRequest2.setRawData(k); | |
| this.$VideoUploadRequest2.send(); | |
| }; | |
| i.prototype.sendFile = function(j) { | |
| 'use strict'; | |
| if (this.$VideoUploadRequest2) throw new Error('An upload request is already in progress.'); | |
| this.$VideoUploadRequest2 = this.$VideoUploadRequest15(); | |
| var k = j.cloneNode(false); | |
| j.name = h; | |
| c('DOM').replace(j, k); | |
| c('DOM').appendContent(this.$VideoUploadRequest2.getRoot(), j); | |
| this.$VideoUploadRequest16(this.$VideoUploadRequest2); | |
| j.name = k.name; | |
| c('DOM').replace(k, j); | |
| }; | |
| i.prototype.abort = function() { | |
| 'use strict'; | |
| if (!this.$VideoUploadRequest2) throw new Error('There is no upload request in progress.'); | |
| this.$VideoUploadRequest2.abort(); | |
| this.$VideoUploadRequest2 = null; | |
| }; | |
| i.prototype.$VideoUploadRequest14 = function() { | |
| 'use strict'; | |
| var j = this.__getAsyncRequest().setAllowCrossOrigin(this.$VideoUploadRequest3).setURI(this.$VideoUploadRequest1).setData(this.$VideoUploadRequest4).setRequestHeader('X_FB_VIDEO_WATERFALL_ID', this.$VideoUploadRequest5).setHandler(this.$VideoUploadRequest7).setErrorHandler(this.$VideoUploadRequest8).setTransportErrorHandler(this.$VideoUploadRequest9).setUploadProgressHandler(this.$VideoUploadRequest10); | |
| if (this.$VideoUploadRequest11) j.setTimeoutHandler(this.$VideoUploadRequest6, this.$VideoUploadRequest11); | |
| return j; | |
| }; | |
| i.prototype.__getAsyncRequest = function() { | |
| 'use strict'; | |
| return new(c('AsyncRequest'))(); | |
| }; | |
| i.prototype.$VideoUploadRequest15 = function() { | |
| 'use strict'; | |
| var j = c('DOM').create('form', { | |
| action: this.$VideoUploadRequest1, | |
| method: 'POST' | |
| }); | |
| c('Form').createHiddenInputs(babelHelpers['extends']({ | |
| fb_dtsg: c('DTSG').getToken() | |
| }, this.$VideoUploadRequest4), j); | |
| var k = new(c('FileForm'))(j, null, { | |
| allowCrossOrigin: this.$VideoUploadRequest3 | |
| }); | |
| k.subscribe('success', this.$VideoUploadRequest17.bind(this)); | |
| k.subscribe('failure', this.$VideoUploadRequest18.bind(this)); | |
| k.subscribe('progress', this.$VideoUploadRequest19.bind(this)); | |
| return k; | |
| }; | |
| i.prototype.$VideoUploadRequest16 = function(j) { | |
| 'use strict'; | |
| c('DOM').appendContent(document.body, j.getRoot()); | |
| c('submitForm')(j.getRoot()); | |
| }; | |
| i.prototype.$VideoUploadRequest17 = function(event, j) { | |
| 'use strict'; | |
| this.$VideoUploadRequest7(j.response); | |
| }; | |
| i.prototype.$VideoUploadRequest18 = function(event, j) { | |
| 'use strict'; | |
| this.$VideoUploadRequest8(j.response); | |
| }; | |
| i.prototype.$VideoUploadRequest19 = function(event, j) { | |
| 'use strict'; | |
| this.$VideoUploadRequest10(j.event); | |
| }; | |
| f.exports = i; | |
| }, null); | |
| __d('VideoUploadPostRequestManager', ['ArbiterMixin', 'VideoUploadRequest', 'mixin'], function a(b, c, d, e, f, g) { | |
| var h, i; | |
| if (c.__markCompiled) c.__markCompiled(); | |
| h = babelHelpers.inherits(j, c('mixin')(c('ArbiterMixin'))); | |
| i = h && h.prototype; | |
| function j(k, l, m, n, o) { | |
| 'use strict'; | |
| i.constructor.call(this); | |
| this.$VideoUploadPostRequestManager1 = k; | |
| this.$VideoUploadPostRequestManager2 = l; | |
| this.$VideoUploadPostRequestManager3 = m; | |
| this.$VideoUploadPostRequestManager4 = 0; | |
| this.$VideoUploadPostRequestManager5 = n; | |
| this.$VideoUploadPostRequestManager6 = o; | |
| this.$VideoUploadPostRequestManager7 = 0; | |
| } | |
| j.prototype.getRequest = function() { | |
| 'use strict'; | |
| return this.$VideoUploadPostRequestManager8; | |
| }; | |
| j.prototype.sendRequest = function(k) { | |
| 'use strict'; | |
| if (this.$VideoUploadPostRequestManager8) return; | |
| this.$VideoUploadPostRequestManager9 = babelHelpers['extends']({}, k.getMetadata(), this.__createRequestData(k)); | |
| this.$VideoUploadPostRequestManager10 = this.$VideoUploadPostRequestManager9.thumb; | |
| delete this.$VideoUploadPostRequestManager9.thumb; | |
| this.$VideoUploadPostRequestManager11 = this.$VideoUploadPostRequestManager9.captions; | |
| delete this.$VideoUploadPostRequestManager9.captions; | |
| this.$VideoUploadPostRequestManager12 = k.getWaterfallID(); | |
| this.$VideoUploadPostRequestManager13(); | |
| this.inform('request-started'); | |
| }; | |
| j.prototype.$VideoUploadPostRequestManager13 = function() { | |
| 'use strict'; | |
| clearTimeout(this.$VideoUploadPostRequestManager14); | |
| this.$VideoUploadPostRequestManager14 = null; | |
| this.$VideoUploadPostRequestManager8 = this.__getVideoUploadRequest(this.$VideoUploadPostRequestManager1).setAllowCrossOrigin(true).setData(this.$VideoUploadPostRequestManager9).setThumbnail(this.$VideoUploadPostRequestManager10).setCaptions(this.$VideoUploadPostRequestManager11).setWaterfallID(this.$VideoUploadPostRequestManager12).setSuccessHandler(this.$VideoUploadPostRequestManager15.bind(this)).setErrorHandler(this.$VideoUploadPostRequestManager16.bind(this)).setTransportErrorHandler(this.$VideoUploadPostRequestManager17.bind(this)); | |
| this.$VideoUploadPostRequestManager8.send(); | |
| }; | |
| j.prototype.__createRequestData = function(k) { | |
| 'use strict'; | |
| return { | |
| video_id: k.getVideoID(), | |
| target_id: k.getTargetID(), | |
| source: k.getSource(), | |
| waterfall_id: k.getWaterfallID(), | |
| creator_product: k.getCreatorProduct(), | |
| composer_entry_point_ref: k.getComposerEntryPointRef && k.getComposerEntryPointRef(), | |
| supports_chunking: k.getSupportsChunking() | |
| }; | |
| }; | |
| j.prototype.__getVideoUploadRequest = function(k) { | |
| 'use strict'; | |
| return new(c('VideoUploadRequest'))(k); | |
| }; | |
| j.prototype.clearRequest = function() { | |
| 'use strict'; | |
| this.$VideoUploadPostRequestManager8 = null; | |
| this.$VideoUploadPostRequestManager7 = 0; | |
| this.$VideoUploadPostRequestManager4 = 0; | |
| }; | |
| j.prototype.isInProgress = function() { | |
| 'use strict'; | |
| return !!this.$VideoUploadPostRequestManager8; | |
| }; | |
| j.prototype.$VideoUploadPostRequestManager18 = function(k) { | |
| 'use strict'; | |
| clearTimeout(this.$VideoUploadPostRequestManager14); | |
| this.$VideoUploadPostRequestManager14 = setTimeout(this.$VideoUploadPostRequestManager13.bind(this), k); | |
| }; | |
| j.prototype.$VideoUploadPostRequestManager19 = function(k, l) { | |
| 'use strict'; | |
| return Math.pow(k, l) * 1000; | |
| }; | |
| j.prototype.$VideoUploadPostRequestManager15 = function(k) { | |
| 'use strict'; | |
| var l = k.getPayload(); | |
| this.inform('request-finished', { | |
| video_id: l.video_id, | |
| video_asset_id: l.video_asset_id, | |
| container_type: l.container_type, | |
| transport_retries: this.$VideoUploadPostRequestManager4, | |
| server_retries: this.$VideoUploadPostRequestManager7 | |
| }); | |
| this.clearRequest(); | |
| }; | |
| j.prototype.$VideoUploadPostRequestManager20 = function(k) { | |
| 'use strict'; | |
| this.inform('request-failed', { | |
| error_code: k.getError(), | |
| error_description: k.getErrorDescription(), | |
| error_summary: k.getErrorSummary(), | |
| transport_retries: this.$VideoUploadPostRequestManager4, | |
| server_retries: this.$VideoUploadPostRequestManager7, | |
| error_is_transient: k.isTransient() | |
| }); | |
| this.clearRequest(); | |
| }; | |
| j.prototype.$VideoUploadPostRequestManager16 = function(k) { | |
| 'use strict'; | |
| this.$VideoUploadPostRequestManager8 = null; | |
| this.$VideoUploadPostRequestManager4 = 0; | |
| if (k.isTransient() && this.$VideoUploadPostRequestManager7 < this.$VideoUploadPostRequestManager5) { | |
| this.$VideoUploadPostRequestManager7++; | |
| this.$VideoUploadPostRequestManager18(this.$VideoUploadPostRequestManager19(this.$VideoUploadPostRequestManager6, this.$VideoUploadPostRequestManager7)); | |
| } else this.$VideoUploadPostRequestManager20(k); | |
| }; | |
| j.prototype.$VideoUploadPostRequestManager17 = function(k) { | |
| 'use strict'; | |
| if (this.$VideoUploadPostRequestManager2 === 0 || this.$VideoUploadPostRequestManager4 >= this.$VideoUploadPostRequestManager2) { | |
| this.$VideoUploadPostRequestManager20(k); | |
| } else { | |
| this.$VideoUploadPostRequestManager4++; | |
| this.$VideoUploadPostRequestManager8 = null; | |
| this.$VideoUploadPostRequestManager18(this.$VideoUploadPostRequestManager19(this.$VideoUploadPostRequestManager3, this.$VideoUploadPostRequestManager4)); | |
| } | |
| }; | |
| f.exports = j; | |
| }, null); | |
| __d('VideoUploadConnectionMonitor', ['ArbiterMixin', 'Network', 'VideoUploadFeatureDetector', 'debounce', 'mixin'], function a(b, c, d, e, f, g) { | |
| var h, i; | |
| if (c.__markCompiled) c.__markCompiled(); | |
| h = babelHelpers.inherits(j, c('mixin')(c('ArbiterMixin'))); | |
| i = h && h.prototype; | |
| function j() { | |
| 'use strict'; | |
| i.constructor.call(this); | |
| this.$VideoUploadConnectionMonitor1 = false; | |
| this.$VideoUploadConnectionMonitor2 = []; | |
| this.$VideoUploadConnectionMonitor3 = false; | |
| this.$VideoUploadConnectionMonitor4 = true; | |
| this.$VideoUploadConnectionMonitor5 = c('debounce')(function() { | |
| this.$VideoUploadConnectionMonitor6(false); | |
| }.bind(this), 2000); | |
| } | |
| j.prototype.notifyStart = function() { | |
| 'use strict'; | |
| if (this.$VideoUploadConnectionMonitor3) return; | |
| if (this.$VideoUploadConnectionMonitor2.length === 0) { | |
| this.$VideoUploadConnectionMonitor2.push(c('Network').addListener('online', function() { | |
| this.$VideoUploadConnectionMonitor6(true); | |
| }.bind(this))); | |
| this.$VideoUploadConnectionMonitor2.push(c('Network').addListener('offline', function() { | |
| if (this.$VideoUploadConnectionMonitor1) { | |
| this.$VideoUploadConnectionMonitor5(); | |
| } else { | |
| this.$VideoUploadConnectionMonitor5.reset(); | |
| setTimeout(this.$VideoUploadConnectionMonitor5, 2000); | |
| } | |
| }.bind(this))); | |
| } | |
| this.$VideoUploadConnectionMonitor3 = true; | |
| }; | |
| j.prototype.notifyProgress = function(event) { | |
| 'use strict'; | |
| if (!this.$VideoUploadConnectionMonitor3) return; | |
| if (!event) return; | |
| if (c('VideoUploadFeatureDetector').supportsFullProgress()) { | |
| this.$VideoUploadConnectionMonitor1 = true; | |
| if (event.total && event.loaded === event.total) { | |
| this.$VideoUploadConnectionMonitor5.reset(); | |
| } else this.$VideoUploadConnectionMonitor5(); | |
| } | |
| }; | |
| j.prototype.notifySuccess = function() { | |
| 'use strict'; | |
| if (!this.$VideoUploadConnectionMonitor3) return; | |
| this.reset(); | |
| this.$VideoUploadConnectionMonitor6(true); | |
| }; | |
| j.prototype.notifyTransportError = function() { | |
| 'use strict'; | |
| if (!this.$VideoUploadConnectionMonitor3) return; | |
| this.$VideoUploadConnectionMonitor3 = false; | |
| this.$VideoUploadConnectionMonitor6(false); | |
| }; | |
| j.prototype.notifyError = function() { | |
| 'use strict'; | |
| if (!this.$VideoUploadConnectionMonitor3) return; | |
| this.reset(); | |
| this.$VideoUploadConnectionMonitor6(true); | |
| }; | |
| j.prototype.isOnline = function() { | |
| 'use strict'; | |
| return this.$VideoUploadConnectionMonitor4; | |
| }; | |
| j.prototype.reset = function() { | |
| 'use strict'; | |
| while (this.$VideoUploadConnectionMonitor2.length) this.$VideoUploadConnectionMonitor2.pop().remove(); | |
| this.$VideoUploadConnectionMonitor5.reset(); | |
| this.$VideoUploadConnectionMonitor3 = false; | |
| }; | |
| j.prototype.$VideoUploadConnectionMonitor6 = function(k) { | |
| 'use strict'; | |
| this.$VideoUploadConnectionMonitor5.reset(); | |
| if (this.$VideoUploadConnectionMonitor4 !== k) { | |
| this.$VideoUploadConnectionMonitor4 = k; | |
| if (this.$VideoUploadConnectionMonitor4) { | |
| this.inform('online'); | |
| } else this.inform('offline'); | |
| } | |
| }; | |
| f.exports = j; | |
| }, null); | |
| __d('VideoUploadReceiveRequestManager', ['fbt', 'ArbiterMixin', 'VideoUploadConnectionMonitor', 'VideoUploadRequest', 'mixin'], function a(b, c, d, e, f, g, h) { | |
| var i, j; | |
| if (c.__markCompiled) c.__markCompiled(); | |
| var k = 1363037; | |
| i = babelHelpers.inherits(l, c('mixin')(c('ArbiterMixin'))); | |
| j = i && i.prototype; | |
| function l(m, n, o, p, q, r, s, t, u) { | |
| 'use strict'; | |
| j.constructor.call(this); | |
| this.$VideoUploadReceiveRequestManager1 = m; | |
| this.$VideoUploadReceiveRequestManager2 = n; | |
| this.$VideoUploadReceiveRequestManager3 = o; | |
| this.$VideoUploadReceiveRequestManager4 = p; | |
| this.$VideoUploadReceiveRequestManager5 = q; | |
| this.$VideoUploadReceiveRequestManager6 = r; | |
| this.$VideoUploadReceiveRequestManager7 = s; | |
| this.$VideoUploadReceiveRequestManager8 = t; | |
| this.$VideoUploadReceiveRequestManager9 = u; | |
| this.$VideoUploadReceiveRequestManager10 = 0; | |
| this.$VideoUploadReceiveRequestManager11 = 0; | |
| this.$VideoUploadReceiveRequestManager12 = 0; | |
| this.$VideoUploadReceiveRequestManager13 = null; | |
| this.$VideoUploadReceiveRequestManager14 = null; | |
| this.$VideoUploadReceiveRequestManager15 = 0; | |
| this.$VideoUploadReceiveRequestManager16 = 'constructed'; | |
| this.$VideoUploadReceiveRequestManager17 = new(c('VideoUploadConnectionMonitor'))(); | |
| this.$VideoUploadReceiveRequestManager17.subscribe('online', this.$VideoUploadReceiveRequestManager18.bind(this)); | |
| this.$VideoUploadReceiveRequestManager17.subscribe('offline', this.$VideoUploadReceiveRequestManager19.bind(this)); | |
| } | |
| l.prototype.sendRequest = function(m) { | |
| 'use strict'; | |
| this.$VideoUploadReceiveRequestManager16 = 'sending request'; | |
| if (this.$VideoUploadReceiveRequestManager20) { | |
| this.$VideoUploadReceiveRequestManager16 = 'request already in progress'; | |
| return; | |
| } | |
| this.$VideoUploadReceiveRequestManager15 = m.getEndOffset() - m.getStartOffset(); | |
| this.$VideoUploadReceiveRequestManager21 = m; | |
| this.$VideoUploadReceiveRequestManager22(); | |
| }; | |
| l.prototype.cancelRequest = function() { | |
| 'use strict'; | |
| if (!this.$VideoUploadReceiveRequestManager20) return; | |
| this.$VideoUploadReceiveRequestManager20.abort(); | |
| this.$VideoUploadReceiveRequestManager23(); | |
| }; | |
| l.prototype.appendStateLogData = function(m, n) { | |
| 'use strict'; | |
| m[n + 'last_log_entry'] = this.$VideoUploadReceiveRequestManager16; | |
| m[n + 'upload_speed'] = this.$VideoUploadReceiveRequestManager14; | |
| m[n + 'transport_retries'] = this.$VideoUploadReceiveRequestManager10; | |
| m[n + 'server_retries'] = this.$VideoUploadReceiveRequestManager11; | |
| m[n + 'timeout_retries'] = this.$VideoUploadReceiveRequestManager12; | |
| m[n + 'last_timeout_value'] = this.$VideoUploadReceiveRequestManager24; | |
| m[n + 'last_request_start_time'] = this.$VideoUploadReceiveRequestManager13; | |
| m[n + 'pending_request'] = this.$VideoUploadReceiveRequestManager20 != null; | |
| m[n + 'pending_timer'] = this.$VideoUploadReceiveRequestManager25 != null; | |
| m[n + 'cached_chunk'] = this.$VideoUploadReceiveRequestManager26 != null; | |
| if (this.$VideoUploadReceiveRequestManager21 != null) { | |
| m[n + 'start_offset'] = this.$VideoUploadReceiveRequestManager21.getStartOffset(); | |
| m[n + 'end_offset'] = this.$VideoUploadReceiveRequestManager21.getEndOffset(); | |
| m[n + 'partition_start_offset'] = this.$VideoUploadReceiveRequestManager21.getPartitionStartOffset(); | |
| m[n + 'partition_end_offset'] = this.$VideoUploadReceiveRequestManager21.getPartitionEndOffset(); | |
| } | |
| if (this.$VideoUploadReceiveRequestManager17 != null) m[n + 'connection_monitor_online'] = this.$VideoUploadReceiveRequestManager17.isOnline(); | |
| }; | |
| l.prototype.$VideoUploadReceiveRequestManager23 = function() { | |
| 'use strict'; | |
| this.$VideoUploadReceiveRequestManager20 = null; | |
| this.$VideoUploadReceiveRequestManager26 = null; | |
| this.$VideoUploadReceiveRequestManager10 = 0; | |
| this.$VideoUploadReceiveRequestManager11 = 0; | |
| this.$VideoUploadReceiveRequestManager12 = 0; | |
| this.$VideoUploadReceiveRequestManager13 = null; | |
| this.$VideoUploadReceiveRequestManager14 = null; | |
| this.$VideoUploadReceiveRequestManager15 = 0; | |
| this.$VideoUploadReceiveRequestManager21.reset(); | |
| this.$VideoUploadReceiveRequestManager17.reset(); | |
| clearTimeout(this.$VideoUploadReceiveRequestManager25); | |
| this.$VideoUploadReceiveRequestManager25 = null; | |
| }; | |
| l.prototype.$VideoUploadReceiveRequestManager22 = function(m) { | |
| 'use strict'; | |
| clearTimeout(this.$VideoUploadReceiveRequestManager25); | |
| this.$VideoUploadReceiveRequestManager25 = null; | |
| if (this.$VideoUploadReceiveRequestManager21.getSupportsChunking() && this.$VideoUploadReceiveRequestManager21.getStartOffset() >= this.$VideoUploadReceiveRequestManager21.getPartitionEndOffset()) { | |
| if (!m) { | |
| this.inform('request-finished', { | |
| start_offset: this.$VideoUploadReceiveRequestManager21.getEndOffset() - 1, | |
| end_offset: this.$VideoUploadReceiveRequestManager21.getEndOffset(), | |
| transport_retries: this.$VideoUploadReceiveRequestManager10, | |
| server_retries: this.$VideoUploadReceiveRequestManager11, | |
| upload_speed: this.$VideoUploadReceiveRequestManager14 | |
| }); | |
| this.$VideoUploadReceiveRequestManager16 = 'request finished - notified'; | |
| } else this.$VideoUploadReceiveRequestManager16 = 'request finished - not notified'; | |
| return; | |
| } | |
| this.$VideoUploadReceiveRequestManager20 = this.__getVideoUploadRequest(this.$VideoUploadReceiveRequestManager1).setAllowCrossOrigin(true).setData(this.__createRequestData(this.$VideoUploadReceiveRequestManager21)).setWaterfallID(this.$VideoUploadReceiveRequestManager21.getWaterfallID()).setSuccessHandler(this.__handleSuccessResponse.bind(this)).setErrorHandler(this.__handleServerFailureResponse.bind(this)).setTransportErrorHandler(this.$VideoUploadReceiveRequestManager27.bind(this)).setUploadProgressHandler(this.$VideoUploadReceiveRequestManager28.bind(this)); | |
| this.$VideoUploadReceiveRequestManager13 = Date.now(); | |
| if (this.$VideoUploadReceiveRequestManager21.getSupportsChunking()) { | |
| if (this.$VideoUploadReceiveRequestManager4) { | |
| var n = this.$VideoUploadReceiveRequestManager29(this.$VideoUploadReceiveRequestManager21.getEndOffset() - this.$VideoUploadReceiveRequestManager21.getStartOffset(), this.$VideoUploadReceiveRequestManager14); | |
| this.$VideoUploadReceiveRequestManager20.setTimeoutHandler(n, this.__handleResponseTimeout.bind(this)); | |
| this.$VideoUploadReceiveRequestManager16 = 'sending chunk with timeout = ' + n; | |
| this.$VideoUploadReceiveRequestManager24 = n; | |
| } else this.$VideoUploadReceiveRequestManager16 = 'sending chunk without timeout'; | |
| this.$VideoUploadReceiveRequestManager20.sendChunk(this.$VideoUploadReceiveRequestManager30()); | |
| } else { | |
| this.$VideoUploadReceiveRequestManager16 = 'sending file'; | |
| this.$VideoUploadReceiveRequestManager20.sendFile(this.$VideoUploadReceiveRequestManager21.getFile().getFileInput()); | |
| } | |
| this.$VideoUploadReceiveRequestManager17.notifyStart(); | |
| this.inform('request-started', { | |
| start_offset: this.$VideoUploadReceiveRequestManager21.getStartOffset(), | |
| end_offset: this.$VideoUploadReceiveRequestManager21.getEndOffset(), | |
| transport_retries: this.$VideoUploadReceiveRequestManager10, | |
| server_retries: this.$VideoUploadReceiveRequestManager11, | |
| upload_speed: this.$VideoUploadReceiveRequestManager14 | |
| }); | |
| }; | |
| l.prototype.__getVideoUploadRequest = function(m) { | |
| 'use strict'; | |
| return new(c('VideoUploadRequest'))(m); | |
| }; | |
| l.prototype.$VideoUploadReceiveRequestManager31 = function(m) { | |
| 'use strict'; | |
| this.$VideoUploadReceiveRequestManager16 = 'setting request to send after' + m; | |
| clearTimeout(this.$VideoUploadReceiveRequestManager25); | |
| this.$VideoUploadReceiveRequestManager25 = setTimeout(this.$VideoUploadReceiveRequestManager22.bind(this), m); | |
| }; | |
| l.prototype.$VideoUploadReceiveRequestManager30 = function() { | |
| 'use strict'; | |
| if (this.$VideoUploadReceiveRequestManager26) return this.$VideoUploadReceiveRequestManager26; | |
| this.$VideoUploadReceiveRequestManager26 = this.$VideoUploadReceiveRequestManager21.getFile().getChunk(this.$VideoUploadReceiveRequestManager21.getStartOffset(), this.$VideoUploadReceiveRequestManager21.getEndOffset()); | |
| return this.$VideoUploadReceiveRequestManager26; | |
| }; | |
| l.prototype.__createRequestData = function(m) { | |
| 'use strict'; | |
| return { | |
| video_id: m.getVideoID(), | |
| start_offset: m.getStartOffset(), | |
| source: m.getSource(), | |
| target_id: m.getTargetID(), | |
| waterfall_id: m.getWaterfallID(), | |
| composer_entry_point_ref: m.getComposerEntryPointRef && m.getComposerEntryPointRef(), | |
| supports_chunking: m.getSupportsChunking(), | |
| upload_speed: this.$VideoUploadReceiveRequestManager14, | |
| partition_start_offset: m.getPartitionStartOffset(), | |
| partition_end_offset: m.getPartitionEndOffset() | |
| }; | |
| }; | |
| l.prototype.__handleSuccessResponse = function(m) { | |
| 'use strict'; | |
| this.$VideoUploadReceiveRequestManager16 = 'success response received'; | |
| var n = Date.now() - this.$VideoUploadReceiveRequestManager13; | |
| n = n === 0 ? 1 : n; | |
| var o = m.getPayload(); | |
| if (o.start_offset === this.$VideoUploadReceiveRequestManager21.getEndOffset()) { | |
| var p = this.$VideoUploadReceiveRequestManager21.getEndOffset() - this.$VideoUploadReceiveRequestManager21.getStartOffset(); | |
| this.$VideoUploadReceiveRequestManager14 = Math.floor(p / n); | |
| } else this.$VideoUploadReceiveRequestManager14 = null; | |
| this.$VideoUploadReceiveRequestManager17.notifySuccess(); | |
| this.inform('request-finished', { | |
| start_offset: this.$VideoUploadReceiveRequestManager21.getStartOffset(), | |
| end_offset: this.$VideoUploadReceiveRequestManager21.getEndOffset(), | |
| transport_retries: this.$VideoUploadReceiveRequestManager10, | |
| server_retries: this.$VideoUploadReceiveRequestManager11, | |
| upload_speed: this.$VideoUploadReceiveRequestManager14 | |
| }); | |
| this.$VideoUploadReceiveRequestManager21.setStartOffset(o.start_offset); | |
| this.$VideoUploadReceiveRequestManager21.setEndOffset(o.end_offset); | |
| this.$VideoUploadReceiveRequestManager20 = null; | |
| this.$VideoUploadReceiveRequestManager26 = null; | |
| this.$VideoUploadReceiveRequestManager10 = 0; | |
| this.$VideoUploadReceiveRequestManager11 = 0; | |
| this.$VideoUploadReceiveRequestManager12 = 0; | |
| if (this.$VideoUploadReceiveRequestManager21.getSupportsChunking()) this.$VideoUploadReceiveRequestManager22(true); | |
| }; | |
| l.prototype.__handleServerFailureResponse = function(m) { | |
| 'use strict'; | |
| this.$VideoUploadReceiveRequestManager16 = 'failure response received'; | |
| this.$VideoUploadReceiveRequestManager20 = null; | |
| this.$VideoUploadReceiveRequestManager10 = 0; | |
| this.$VideoUploadReceiveRequestManager14 = null; | |
| this.$VideoUploadReceiveRequestManager12 = 0; | |
| this.$VideoUploadReceiveRequestManager17.notifyError(); | |
| if (this.__hasInvalidStartOffsetAndHasRetries(m.getError())) { | |
| this.$VideoUploadReceiveRequestManager11++; | |
| var n = m.getPayload(); | |
| this.$VideoUploadReceiveRequestManager16 = 'invalid offset response received start=' + n.start_offset + ' end=' + n.end_offset; | |
| if (this.$VideoUploadReceiveRequestManager21.getStartOffset() != n.start_offset || this.$VideoUploadReceiveRequestManager21.getEndOffset() != n.end_offset) { | |
| this.$VideoUploadReceiveRequestManager21.setStartOffset(n.start_offset); | |
| this.$VideoUploadReceiveRequestManager21.setEndOffset(n.end_offset); | |
| this.$VideoUploadReceiveRequestManager26 = null; | |
| } | |
| this.$VideoUploadReceiveRequestManager22(); | |
| } else if ((m.isTransient() || this.$VideoUploadReceiveRequestManager9) && this.$VideoUploadReceiveRequestManager11 < this.$VideoUploadReceiveRequestManager3) { | |
| this.$VideoUploadReceiveRequestManager16 = 'transient server error'; | |
| this.$VideoUploadReceiveRequestManager11++; | |
| this.$VideoUploadReceiveRequestManager31(this.$VideoUploadReceiveRequestManager32(this.$VideoUploadReceiveRequestManager8, this.$VideoUploadReceiveRequestManager11)); | |
| } else this.$VideoUploadReceiveRequestManager33(m); | |
| }; | |
| l.prototype.__handleResponseTimeout = function(m) { | |
| 'use strict'; | |
| this.inform('request-timeout', { | |
| start_offset: this.$VideoUploadReceiveRequestManager21.getStartOffset(), | |
| end_offset: this.$VideoUploadReceiveRequestManager21.getEndOffset(), | |
| transport_retries: this.$VideoUploadReceiveRequestManager10, | |
| server_retries: this.$VideoUploadReceiveRequestManager11, | |
| timeout_retries: this.$VideoUploadReceiveRequestManager12, | |
| upload_speed: this.$VideoUploadReceiveRequestManager14 | |
| }); | |
| this.$VideoUploadReceiveRequestManager20.abort(); | |
| this.$VideoUploadReceiveRequestManager20 = null; | |
| this.$VideoUploadReceiveRequestManager14 = null; | |
| this.$VideoUploadReceiveRequestManager17.notifyTransportError(); | |
| if (++this.$VideoUploadReceiveRequestManager12 <= this.$VideoUploadReceiveRequestManager5) { | |
| var n = this.$VideoUploadReceiveRequestManager21.getEndOffset() - this.$VideoUploadReceiveRequestManager21.getStartOffset(); | |
| n = Math.floor(n / 2); | |
| n = Math.max(n, this.$VideoUploadReceiveRequestManager15); | |
| var o = this.$VideoUploadReceiveRequestManager21.getEndOffset(); | |
| o = Math.min(o, this.$VideoUploadReceiveRequestManager21.getStartOffset() + n); | |
| this.$VideoUploadReceiveRequestManager21.setEndOffset(o); | |
| this.$VideoUploadReceiveRequestManager26 = null; | |
| this.$VideoUploadReceiveRequestManager16 = 'resending after timeout with chunksize=' + n; | |
| this.$VideoUploadReceiveRequestManager22(); | |
| } else this.$VideoUploadReceiveRequestManager34({ | |
| error_code: 1006, | |
| error_description: h._("Your browser appears to be offline. Please check your internet connection and try again."), | |
| error_summary: h._("No Network Connection"), | |
| error_is_transient: true | |
| }); | |
| }; | |
| l.prototype.__hasInvalidStartOffsetAndHasRetries = function(m) { | |
| 'use strict'; | |
| return m === k && this.$VideoUploadReceiveRequestManager11 < this.$VideoUploadReceiveRequestManager3; | |
| }; | |
| l.prototype.$VideoUploadReceiveRequestManager27 = function(m) { | |
| 'use strict'; | |
| this.$VideoUploadReceiveRequestManager17.notifyTransportError(); | |
| this.$VideoUploadReceiveRequestManager14 = null; | |
| this.$VideoUploadReceiveRequestManager12 = 0; | |
| if (this.$VideoUploadReceiveRequestManager10 < this.$VideoUploadReceiveRequestManager2) { | |
| this.$VideoUploadReceiveRequestManager16 = 'resending after transport failure'; | |
| this.$VideoUploadReceiveRequestManager10++; | |
| this.$VideoUploadReceiveRequestManager20 = null; | |
| this.$VideoUploadReceiveRequestManager31(this.$VideoUploadReceiveRequestManager32(this.$VideoUploadReceiveRequestManager7, this.$VideoUploadReceiveRequestManager10)); | |
| } else this.$VideoUploadReceiveRequestManager33(m); | |
| }; | |
| l.prototype.$VideoUploadReceiveRequestManager33 = function(m) { | |
| 'use strict'; | |
| this.$VideoUploadReceiveRequestManager34({ | |
| error_code: m.getError(), | |
| error_description: m.getErrorDescription(), | |
| error_summary: m.getErrorSummary(), | |
| error_is_transient: m.isTransient() | |
| }); | |
| }; | |
| l.prototype.$VideoUploadReceiveRequestManager34 = function(m) { | |
| 'use strict'; | |
| this.$VideoUploadReceiveRequestManager16 = 'handling failure error'; | |
| this.inform('request-failed', m); | |
| this.$VideoUploadReceiveRequestManager23(); | |
| }; | |
| l.prototype.$VideoUploadReceiveRequestManager28 = function(event) { | |
| 'use strict'; | |
| this.$VideoUploadReceiveRequestManager17.notifyProgress(event); | |
| this.inform('request-progressed', { | |
| file_size: this.$VideoUploadReceiveRequestManager21.getFile().getSize(), | |
| start_offset: this.$VideoUploadReceiveRequestManager21.getStartOffset(), | |
| sent_bytes: event.loaded | |
| }); | |
| }; | |
| l.prototype.$VideoUploadReceiveRequestManager18 = function(event) { | |
| 'use strict'; | |
| this.inform('online'); | |
| this.$VideoUploadReceiveRequestManager10 = 0; | |
| this.$VideoUploadReceiveRequestManager12 = 0; | |
| if (this.$VideoUploadReceiveRequestManager25) this.$VideoUploadReceiveRequestManager22(); | |
| }; | |
| l.prototype.$VideoUploadReceiveRequestManager19 = function(event) { | |
| 'use strict'; | |
| this.inform('offline'); | |
| }; | |
| l.prototype.$VideoUploadReceiveRequestManager32 = function(m, n) { | |
| 'use strict'; | |
| return Math.pow(m, n) * 1000; | |
| }; | |
| l.prototype.$VideoUploadReceiveRequestManager29 = function(m, n) { | |
| 'use strict'; | |
| var o; | |
| if (n > 0) { | |
| o = n; | |
| } else o = 10; | |
| var p = Math.floor(m / o * this.$VideoUploadReceiveRequestManager6 / 100); | |
| return Math.max(p, 30000); | |
| }; | |
| f.exports = l; | |
| }, null); | |
| __d("VideoUploadRequestContext", [], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| function h() { | |
| "use strict"; | |
| this.reset(); | |
| } | |
| h.prototype.setFile = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext1 = i; | |
| return this; | |
| }; | |
| h.prototype.getFile = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext1; | |
| }; | |
| h.prototype.setMetadata = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext2 = i; | |
| return this; | |
| }; | |
| h.prototype.getMetadata = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext2; | |
| }; | |
| h.prototype.setVideoID = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext3 = i; | |
| return this; | |
| }; | |
| h.prototype.getVideoID = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext3; | |
| }; | |
| h.prototype.setStartOffset = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext4 = i; | |
| return this; | |
| }; | |
| h.prototype.getStartOffset = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext4; | |
| }; | |
| h.prototype.setEndOffset = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext5 = i; | |
| return this; | |
| }; | |
| h.prototype.getEndOffset = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext5; | |
| }; | |
| h.prototype.setPartitionStartOffset = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext6 = i; | |
| return this; | |
| }; | |
| h.prototype.getPartitionStartOffset = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext6; | |
| }; | |
| h.prototype.setPartitionEndOffset = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext7 = i; | |
| return this; | |
| }; | |
| h.prototype.getPartitionEndOffset = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext7; | |
| }; | |
| h.prototype.setTargetID = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext8 = i; | |
| return this; | |
| }; | |
| h.prototype.getTargetID = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext8; | |
| }; | |
| h.prototype.setSource = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext9 = i; | |
| return this; | |
| }; | |
| h.prototype.getSource = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext9; | |
| }; | |
| h.prototype.setWaterfallID = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext10 = i; | |
| return this; | |
| }; | |
| h.prototype.getWaterfallID = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext10; | |
| }; | |
| h.prototype.setComposerEntryPointRef = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext11 = i; | |
| }; | |
| h.prototype.getComposerEntryPointRef = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext11; | |
| }; | |
| h.prototype.setSupportsChunking = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext12 = i; | |
| return this; | |
| }; | |
| h.prototype.getSupportsChunking = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext12; | |
| }; | |
| h.prototype.setSupportsFileAPI = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext13 = i; | |
| return this; | |
| }; | |
| h.prototype.getSupportsFileAPI = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext13; | |
| }; | |
| h.prototype.setCreatorProduct = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext14 = i; | |
| return this; | |
| }; | |
| h.prototype.getCreatorProduct = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext14; | |
| }; | |
| h.prototype.setThumbnailConfig = function(i) { | |
| "use strict"; | |
| this.$VideoUploadRequestContext15 = i; | |
| return this; | |
| }; | |
| h.prototype.getThumbnailConfig = function() { | |
| "use strict"; | |
| return this.$VideoUploadRequestContext15 || {}; | |
| }; | |
| h.prototype.reset = function() { | |
| "use strict"; | |
| this.$VideoUploadRequestContext1 = null; | |
| this.$VideoUploadRequestContext3 = null; | |
| this.$VideoUploadRequestContext4 = null; | |
| this.$VideoUploadRequestContext5 = null; | |
| this.$VideoUploadRequestContext8 = null; | |
| this.$VideoUploadRequestContext9 = null; | |
| this.$VideoUploadRequestContext10 = null; | |
| this.$VideoUploadRequestContext11 = null; | |
| this.$VideoUploadRequestContext12 = null; | |
| this.$VideoUploadRequestContext13 = null; | |
| this.$VideoUploadRequestContext6 = null; | |
| this.$VideoUploadRequestContext7 = null; | |
| this.$VideoUploadRequestContext14 = null; | |
| this.$VideoUploadRequestContext15 = null; | |
| }; | |
| f.exports = h; | |
| }, null); | |
| __d('VideoUploadStartRequestManager', ['ArbiterMixin', 'VideoUploadRequest', 'FileHasher', 'performanceNow', 'mixin', 'Assert'], function a(b, c, d, e, f, g) { | |
| var h, i; | |
| if (c.__markCompiled) c.__markCompiled(); | |
| h = babelHelpers.inherits(j, c('mixin')(c('ArbiterMixin'))); | |
| i = h && h.prototype; | |
| function j(k, l, m, n, o, p, q) { | |
| 'use strict'; | |
| i.constructor.call(this); | |
| this.$VideoUploadStartRequestManager1 = k; | |
| this.$VideoUploadStartRequestManager2 = l; | |
| this.$VideoUploadStartRequestManager3 = m; | |
| this.$VideoUploadStartRequestManager4 = 0; | |
| this.$VideoUploadStartRequestManager5 = n; | |
| this.$VideoUploadStartRequestManager6 = o; | |
| this.$VideoUploadStartRequestManager7 = p; | |
| this.$VideoUploadStartRequestManager8 = q; | |
| this.$VideoUploadStartRequestManager9 = 0; | |
| } | |
| j.prototype.getRequest = function() { | |
| 'use strict'; | |
| return this.$VideoUploadStartRequestManager10; | |
| }; | |
| j.prototype.sendRequest = function(k) { | |
| 'use strict'; | |
| if (this.$VideoUploadStartRequestManager11 || this.$VideoUploadStartRequestManager10) return; | |
| this.$VideoUploadStartRequestManager12 = k; | |
| if (this.$VideoUploadStartRequestManager5 && this.$VideoUploadStartRequestManager12.getFile().getFile() && this.$VideoUploadStartRequestManager12.getFile().getFile().size < this.$VideoUploadStartRequestManager6 && c('FileHasher').isSupported()) { | |
| this.$VideoUploadStartRequestManager13 = c('performanceNow')(); | |
| this.$VideoUploadStartRequestManager11 = new(c('FileHasher'))(); | |
| this.$VideoUploadStartRequestManager11.hash(this.$VideoUploadStartRequestManager12.getFile().getFile(), function(l) { | |
| this.$VideoUploadStartRequestManager13 = c('performanceNow')() - this.$VideoUploadStartRequestManager13; | |
| this.$VideoUploadStartRequestManager14 = l.hash; | |
| this.$VideoUploadStartRequestManager11.destroy(); | |
| this.$VideoUploadStartRequestManager11 = null; | |
| if (!l.hash) this.$VideoUploadStartRequestManager15 = l.exception; | |
| this.$VideoUploadStartRequestManager16(); | |
| }.bind(this)); | |
| } else this.$VideoUploadStartRequestManager16(); | |
| }; | |
| j.prototype.$VideoUploadStartRequestManager16 = function() { | |
| 'use strict'; | |
| this.$VideoUploadStartRequestManager17(); | |
| this.inform('request-started', { | |
| hash_time: this.$VideoUploadStartRequestManager13, | |
| hash_exception: this.$VideoUploadStartRequestManager15 | |
| }); | |
| }; | |
| j.prototype.$VideoUploadStartRequestManager17 = function() { | |
| 'use strict'; | |
| clearTimeout(this.$VideoUploadStartRequestManager18); | |
| this.$VideoUploadStartRequestManager18 = null; | |
| this.$VideoUploadStartRequestManager10 = this.__getVideoUploadRequest(this.$VideoUploadStartRequestManager1).setAllowCrossOrigin(true).setData(this.__getDataToSend(this.$VideoUploadStartRequestManager12, this.$VideoUploadStartRequestManager14)).setWaterfallID(this.$VideoUploadStartRequestManager12.getWaterfallID()).setSuccessHandler(this.$VideoUploadStartRequestManager19.bind(this)).setErrorHandler(this.$VideoUploadStartRequestManager20.bind(this)).setTransportErrorHandler(this.$VideoUploadStartRequestManager21.bind(this)); | |
| this.$VideoUploadStartRequestManager10.send(); | |
| }; | |
| j.prototype.__getVideoUploadRequest = function(k) { | |
| 'use strict'; | |
| return new(c('VideoUploadRequest'))(k); | |
| }; | |
| j.prototype.__getDataToSend = function(k, l) { | |
| 'use strict'; | |
| return { | |
| file_size: k.getFile().getSize(), | |
| file_extension: k.getFile().getExtension(), | |
| target_id: k.getTargetID(), | |
| source: k.getSource(), | |
| waterfall_id: k.getWaterfallID(), | |
| composer_entry_point_ref: k.getComposerEntryPointRef && k.getComposerEntryPointRef(), | |
| supports_chunking: k.getSupportsChunking(), | |
| supports_file_api: k.getSupportsFileAPI(), | |
| partition_start_offset: k.getPartitionStartOffset(), | |
| partition_end_offset: k.getPartitionEndOffset(), | |
| creator_product: k.getCreatorProduct(), | |
| original_file_hash: l | |
| }; | |
| }; | |
| j.prototype.cancelRequest = function() { | |
| 'use strict'; | |
| this.$VideoUploadStartRequestManager22(); | |
| }; | |
| j.prototype.$VideoUploadStartRequestManager23 = function(k) { | |
| 'use strict'; | |
| clearTimeout(this.$VideoUploadStartRequestManager18); | |
| this.$VideoUploadStartRequestManager18 = setTimeout(this.$VideoUploadStartRequestManager17.bind(this), k); | |
| }; | |
| j.prototype.$VideoUploadStartRequestManager22 = function() { | |
| 'use strict'; | |
| if (this.$VideoUploadStartRequestManager11) { | |
| this.$VideoUploadStartRequestManager11.destroy(); | |
| this.$VideoUploadStartRequestManager11 = null; | |
| } | |
| if (this.$VideoUploadStartRequestManager10) { | |
| this.$VideoUploadStartRequestManager10.abort(); | |
| this.$VideoUploadStartRequestManager10 = null; | |
| } | |
| this.$VideoUploadStartRequestManager9 = 0; | |
| this.$VideoUploadStartRequestManager4 = 0; | |
| this.$VideoUploadStartRequestManager12 = null; | |
| clearTimeout(this.$VideoUploadStartRequestManager18); | |
| this.$VideoUploadStartRequestManager18 = null; | |
| }; | |
| j.prototype.$VideoUploadStartRequestManager24 = function(k, l) { | |
| 'use strict'; | |
| return Math.pow(k, l) * 1000; | |
| }; | |
| j.prototype.$VideoUploadStartRequestManager19 = function(k) { | |
| 'use strict'; | |
| var l = k.getPayload(); | |
| this.inform('request-finished', this.__getSuccessInformData(l)); | |
| this.$VideoUploadStartRequestManager10 = null; | |
| c('Assert').isTrue(this.$VideoUploadStartRequestManager11 == null, 'Unexpected: if file hasher is not null, clean up is required.'); | |
| }; | |
| j.prototype.__getSuccessInformData = function(k) { | |
| 'use strict'; | |
| return { | |
| video_id: k.video_id, | |
| start_offset: k.start_offset, | |
| end_offset: k.end_offset, | |
| transport_retries: this.$VideoUploadStartRequestManager4, | |
| server_retries: this.$VideoUploadStartRequestManager9, | |
| skip_upload: k.skip_upload, | |
| hash_time: this.$VideoUploadStartRequestManager13 | |
| }; | |
| }; | |
| j.prototype.$VideoUploadStartRequestManager25 = function(k) { | |
| 'use strict'; | |
| this.inform('request-failed', this.$VideoUploadStartRequestManager26(k)); | |
| this.$VideoUploadStartRequestManager10 = null; | |
| c('Assert').isTrue(this.$VideoUploadStartRequestManager11 == null, 'Unexpected: if file hasher is not null, clean up is required.'); | |
| }; | |
| j.prototype.$VideoUploadStartRequestManager20 = function(k) { | |
| 'use strict'; | |
| this.$VideoUploadStartRequestManager10 = null; | |
| this.$VideoUploadStartRequestManager4 = 0; | |
| if (k.isTransient() && this.$VideoUploadStartRequestManager9 < this.$VideoUploadStartRequestManager7) { | |
| this.$VideoUploadStartRequestManager9++; | |
| this.$VideoUploadStartRequestManager23(this.$VideoUploadStartRequestManager24(this.$VideoUploadStartRequestManager8, this.$VideoUploadStartRequestManager9)); | |
| } else this.$VideoUploadStartRequestManager25(k); | |
| }; | |
| j.prototype.$VideoUploadStartRequestManager21 = function(k) { | |
| 'use strict'; | |
| if (this.$VideoUploadStartRequestManager2 === 0 || this.$VideoUploadStartRequestManager4 >= this.$VideoUploadStartRequestManager2) { | |
| this.$VideoUploadStartRequestManager25(k); | |
| } else { | |
| this.$VideoUploadStartRequestManager4++; | |
| this.$VideoUploadStartRequestManager10 = null; | |
| this.$VideoUploadStartRequestManager23(this.$VideoUploadStartRequestManager24(this.$VideoUploadStartRequestManager3, this.$VideoUploadStartRequestManager4)); | |
| } | |
| }; | |
| j.prototype.$VideoUploadStartRequestManager26 = function(k) { | |
| 'use strict'; | |
| return { | |
| error_code: k.getError(), | |
| error_description: k.getErrorDescription(), | |
| error_summary: k.getErrorSummary(), | |
| transport_retries: this.$VideoUploadStartRequestManager4, | |
| server_retries: this.$VideoUploadStartRequestManager9, | |
| error_is_transient: k.isTransient() | |
| }; | |
| }; | |
| f.exports = j; | |
| }, null); | |
| __d('VideoUploadSession', ['ArbiterMixin', 'AsyncRequest', 'VideoUploadCrashMonitor', 'VideoUploadFeatureDetector', 'VideoUploadFileValidator', 'VideoUploadLogger', 'VideoUploadMetadataParser', 'VideoUploadPostRequestManager', 'VideoUploadReceiveRequestManager', 'VideoUploadRequestContext', 'VideoUploadStartRequestManager', 'WaterfallIDGenerator', 'mixin'], function a(b, c, d, e, f, g) { | |
| var h, i; | |
| if (c.__markCompiled) c.__markCompiled(); | |
| h = babelHelpers.inherits(j, c('mixin')(c('ArbiterMixin'))); | |
| i = h && h.prototype; | |
| function j(k) { | |
| 'use strict'; | |
| i.constructor.call(this); | |
| this.$VideoUploadSession1 = k.source; | |
| this.$VideoUploadSession2 = k.target_id; | |
| this.$VideoUploadSession3 = k.logging_delay; | |
| this.$VideoUploadSession4 = k.silent_file_validation; | |
| this.$VideoUploadSession5 = k.background_upload; | |
| this.$VideoUploadSession6 = k.actor_id; | |
| this.$VideoUploadSession7 = k.composer_entry_point_ref; | |
| this.$VideoUploadSession8 = k.monitor_crashes; | |
| this.$VideoUploadSession9 = k.isMultiMediaPost; | |
| this.$VideoUploadSession10 = k.thumbnail_config; | |
| this.$VideoUploadSession11 = new(c('VideoUploadFileValidator'))({ | |
| minSize: k.min_size, | |
| maxSize: k.max_size, | |
| minLength: k.min_length, | |
| maxLength: k.max_length, | |
| minWidth: k.min_width, | |
| minHeight: k.min_height, | |
| extensions: k.extensions | |
| }); | |
| this.$VideoUploadSession12 = c('VideoUploadFeatureDetector').supportsChunking(); | |
| this.$VideoUploadSession13 = c('VideoUploadFeatureDetector').supportsFileAPI(); | |
| if (this.$VideoUploadSession12) { | |
| this.$VideoUploadSession14 = k.parallel_chunk_uploads; | |
| if (this.$VideoUploadSession14) { | |
| this.$VideoUploadSession15 = k.parallel_chunk_upload_filesize; | |
| this.$VideoUploadSession16 = k.default_chunk_size; | |
| } | |
| } else this.$VideoUploadSession14 = false; | |
| this.$VideoUploadSession17 = this.$VideoUploadSession18(k); | |
| this.$VideoUploadSession19 = this.$VideoUploadSession20(k); | |
| if (this.$VideoUploadSession14) this.$VideoUploadSession21 = this.$VideoUploadSession20(k); | |
| this.$VideoUploadSession22 = this.$VideoUploadSession23(k); | |
| } | |
| j.prototype.$VideoUploadSession24 = function() { | |
| 'use strict'; | |
| this.$VideoUploadSession25 = c('WaterfallIDGenerator').generate(); | |
| this.$VideoUploadSession26 = new(c('VideoUploadLogger'))({ | |
| actor_id: this.$VideoUploadSession6, | |
| source: this.$VideoUploadSession1, | |
| waterfall_id: this.$VideoUploadSession25, | |
| target_id: this.$VideoUploadSession2, | |
| delay: this.$VideoUploadSession3, | |
| is_chunked_upload: this.$VideoUploadSession12, | |
| composer_entry_point_ref: this.$VideoUploadSession7 | |
| }); | |
| }; | |
| j.prototype.getLogger = function() { | |
| 'use strict'; | |
| if (!this.$VideoUploadSession26) return null; | |
| return this.$VideoUploadSession26; | |
| }; | |
| j.prototype.start = function(k) { | |
| 'use strict'; | |
| this.$VideoUploadSession27 = null; | |
| this.$VideoUploadSession28 = false; | |
| this.$VideoUploadSession29 = false; | |
| this.$VideoUploadSession30 = k; | |
| this.$VideoUploadSession31 = 0; | |
| this.$VideoUploadSession32 = false; | |
| this.$VideoUploadSession24(); | |
| this.__logEvent(c('VideoUploadLogger').EVENT_REQUESTED_UPLOADING); | |
| this.inform('upload-requested'); | |
| var l = new(c('VideoUploadMetadataParser'))(this.$VideoUploadSession30, this.$VideoUploadSession33.bind(this)); | |
| l.parse(); | |
| }; | |
| j.prototype.post = function(k) { | |
| 'use strict'; | |
| this.__logEvent(c('VideoUploadLogger').EVENT_STARTED_POST_REQUEST); | |
| this.inform('post-started', k); | |
| var l = this.__createPostRequestContext(k); | |
| this.$VideoUploadSession22.sendRequest(l); | |
| this.$VideoUploadSession34 = k; | |
| }; | |
| j.prototype.__createPostRequestContext = function(k) { | |
| 'use strict'; | |
| var l = new(c('VideoUploadRequestContext'))(); | |
| this.__setupPostRequestContext(l, k); | |
| return l; | |
| }; | |
| j.prototype.__setupPostRequestContext = function(k, l) { | |
| 'use strict'; | |
| k.setMetadata(l).setVideoID(this.$VideoUploadSession27).setTargetID(this.$VideoUploadSession2).setSource(this.$VideoUploadSession1).setWaterfallID(this.$VideoUploadSession25).setSupportsChunking(this.$VideoUploadSession12).setCreatorProduct(this.$VideoUploadSession30.getCreatorProduct()).setThumbnailConfig(this.$VideoUploadSession10).setFile(this.$VideoUploadSession30); | |
| if (k.setComposerEntryPointRef) k.setComposerEntryPointRef(this.$VideoUploadSession7); | |
| }; | |
| j.prototype.cancel = function() { | |
| 'use strict'; | |
| if (!this.$VideoUploadSession28) return; | |
| var k = this.__fetchReceiveRequestManagerStateLogData(); | |
| this.$VideoUploadSession35(); | |
| if (this.$VideoUploadSession5) { | |
| if (!this.$VideoUploadSession29) this.__logEvent(c('VideoUploadLogger').EVENT_CANCELED_UPLOADING); | |
| if (this.$VideoUploadSession36) { | |
| this.__logEvent(c('VideoUploadLogger').EVENT_CANCELED_FLOW, k); | |
| this.$VideoUploadSession36 = false; | |
| } | |
| } else { | |
| this.__logEvent(c('VideoUploadLogger').EVENT_CANCELED_UPLOADING); | |
| this.__logEvent(c('VideoUploadLogger').EVENT_CANCELED_FLOW, k); | |
| } | |
| }; | |
| j.prototype.abandon = function() { | |
| 'use strict'; | |
| if (!this.$VideoUploadSession28) return; | |
| var k = this.__fetchReceiveRequestManagerStateLogData(); | |
| this.$VideoUploadSession35(); | |
| if (this.$VideoUploadSession5) { | |
| if (!this.$VideoUploadSession29) this.__logEvent(c('VideoUploadLogger').EVENT_ABANDONED_UPLOADING); | |
| if (this.$VideoUploadSession36) { | |
| this.__logEvent(c('VideoUploadLogger').EVENT_CANCELED_FLOW, k); | |
| this.$VideoUploadSession36 = false; | |
| } | |
| } else { | |
| this.__logEvent(c('VideoUploadLogger').EVENT_ABANDONED_UPLOADING); | |
| this.__logEvent(c('VideoUploadLogger').EVENT_CANCELED_FLOW, k); | |
| } | |
| }; | |
| j.prototype.isPostInProgress = function() { | |
| 'use strict'; | |
| return this.$VideoUploadSession22.isInProgress(); | |
| }; | |
| j.prototype.isInProgress = function() { | |
| 'use strict'; | |
| return this.$VideoUploadSession28; | |
| }; | |
| j.prototype.getVideoID = function() { | |
| 'use strict'; | |
| return this.$VideoUploadSession27; | |
| }; | |
| j.prototype.getUploadTime = function() { | |
| 'use strict'; | |
| return this.$VideoUploadSession37; | |
| }; | |
| j.prototype.startFlow = function() { | |
| 'use strict'; | |
| if (!this.$VideoUploadSession5 || this.$VideoUploadSession36) return; | |
| this.__logEvent(c('VideoUploadLogger').EVENT_STARTED_FLOW, { | |
| is_spherical: this.$VideoUploadSession32 ? 'true' : null | |
| }); | |
| this.$VideoUploadSession36 = true; | |
| if (this.$VideoUploadSession38) this.$VideoUploadSession38.flowStarted(); | |
| }; | |
| j.prototype.$VideoUploadSession33 = function(k) { | |
| 'use strict'; | |
| var l, m; | |
| if (this.$VideoUploadSession4) { | |
| var n = this.$VideoUploadSession11.getValidationErrorMessage(this.$VideoUploadSession30, k); | |
| if (n) { | |
| m = { | |
| error_summary: n.summary, | |
| error_description: n.description | |
| }; | |
| l = false; | |
| } else l = true; | |
| } else l = this.$VideoUploadSession11.validate(this.$VideoUploadSession30, k); | |
| if (!l) { | |
| this.__logEvent(c('VideoUploadLogger').EVENT_INVALIDATED_UPLOADING); | |
| this.inform('upload-failed', m); | |
| return; | |
| } | |
| if (k && k.format) this.$VideoUploadSession32 = k.format.isSpherical; | |
| if (!this.$VideoUploadSession5) this.__logEvent(c('VideoUploadLogger').EVENT_STARTED_FLOW, { | |
| is_spherical: this.$VideoUploadSession32 ? 'true' : null | |
| }); | |
| this.$VideoUploadSession39 = this.$VideoUploadSession14 && this.$VideoUploadSession30.getSize() >= this.$VideoUploadSession15; | |
| this.$VideoUploadSession40 = false; | |
| this.$VideoUploadSession41 = false; | |
| this.$VideoUploadSession42 = 0; | |
| this.$VideoUploadSession43 = this.$VideoUploadSession42; | |
| this.$VideoUploadSession44 = 0; | |
| if (this.$VideoUploadSession39) { | |
| this.$VideoUploadSession45 = Math.floor(this.$VideoUploadSession30.getSize() / 2); | |
| this.$VideoUploadSession46 = this.$VideoUploadSession45; | |
| this.$VideoUploadSession47 = this.$VideoUploadSession46; | |
| this.$VideoUploadSession48 = 0; | |
| this.$VideoUploadSession49 = this.$VideoUploadSession30.getSize(); | |
| } else this.$VideoUploadSession45 = this.$VideoUploadSession30.getSize(); | |
| var o = new(c('VideoUploadRequestContext'))().setFile(this.$VideoUploadSession30).setTargetID(this.$VideoUploadSession2).setSource(this.$VideoUploadSession1).setWaterfallID(this.$VideoUploadSession25).setSupportsChunking(this.$VideoUploadSession12).setSupportsFileAPI(this.$VideoUploadSession13).setCreatorProduct(this.$VideoUploadSession30.getCreatorProduct()).setThumbnailConfig(this.$VideoUploadSession10).setPartitionStartOffset(this.$VideoUploadSession42).setPartitionEndOffset(this.$VideoUploadSession45); | |
| if (o.setComposerEntryPointRef) o.setComposerEntryPointRef(this.$VideoUploadSession7); | |
| this.$VideoUploadSession50(); | |
| this.$VideoUploadSession17.sendRequest(o); | |
| this.inform('metadata-parsed', k); | |
| }; | |
| j.prototype.$VideoUploadSession18 = function(k) { | |
| 'use strict'; | |
| var l = this.$VideoUploadSession12 ? k.chunk_start_uri : k.start_uri, | |
| m = this.__getVideoUploadStartRequestManager(l, k.start_max_transport_retries, k.start_transport_retry_interval_base, k.skip_upload_enabled, k.skip_upload_file_size_limit, k.start_max_server_retries, k.start_server_retry_interval_base); | |
| m.subscribe('request-started', this.$VideoUploadSession51.bind(this)); | |
| m.subscribe('request-finished', this.$VideoUploadSession52.bind(this)); | |
| m.subscribe('request-failed', this.$VideoUploadSession53.bind(this)); | |
| return m; | |
| }; | |
| j.prototype.$VideoUploadSession20 = function(k) { | |
| 'use strict'; | |
| var l = this.$VideoUploadSession12 ? k.chunk_receive_uri : k.receive_uri, | |
| m = this.__getVideoUploadReceiveRequestManager(l, k); | |
| m.subscribe('request-started', this.$VideoUploadSession54.bind(this)); | |
| m.subscribe('request-progressed', this.$VideoUploadSession55.bind(this)); | |
| m.subscribe('request-finished', this.$VideoUploadSession56.bind(this)); | |
| m.subscribe('request-failed', this.$VideoUploadSession57.bind(this)); | |
| m.subscribe('request-timeout', this.$VideoUploadSession58.bind(this)); | |
| m.subscribe('online', this.$VideoUploadSession59.bind(this)); | |
| m.subscribe('offline', this.$VideoUploadSession60.bind(this)); | |
| return m; | |
| }; | |
| j.prototype.$VideoUploadSession23 = function(k) { | |
| 'use strict'; | |
| var l = this.$VideoUploadSession12 ? k.chunk_post_uri : k.post_uri, | |
| m = this.__getVideoUploadPostRequestManager(l, k); | |
| m.subscribe('request-finished', this.__handlePostRequestFinished.bind(this)); | |
| m.subscribe('request-failed', this.$VideoUploadSession61.bind(this)); | |
| return m; | |
| }; | |
| j.prototype.$VideoUploadSession51 = function(event, k) { | |
| 'use strict'; | |
| this.__logEvent(c('VideoUploadLogger').EVENT_STARTED_UPLOADING, { | |
| hash_time: k.hash_time, | |
| hash_exception: k.hash_exception | |
| }); | |
| this.__logEvent(c('VideoUploadLogger').EVENT_STARTED_START_REQUEST); | |
| this.$VideoUploadSession62 = Date.now(); | |
| this.inform('upload-started'); | |
| }; | |
| j.prototype.$VideoUploadSession52 = function(event, k) { | |
| 'use strict'; | |
| this.__logEvent(c('VideoUploadLogger').EVENT_PROGRESS_UPLOADING_START_REQUEST, { | |
| transport_retries: k.transport_retries, | |
| hash_time: k.hash_time, | |
| skip_upload: k.skip_upload ? 1 : null | |
| }); | |
| this.__logEvent(c('VideoUploadLogger').EVENT_FINISHED_START_REQUEST); | |
| this.$VideoUploadSession27 = k.video_id; | |
| this.$VideoUploadSession63 = k.skip_upload; | |
| if (!k.skip_upload) { | |
| var l; | |
| l = this.__createReceiveRequestContext(k, false); | |
| this.$VideoUploadSession19.sendRequest(l); | |
| if (this.$VideoUploadSession39) { | |
| l = this.__createReceiveRequestContext(k, true); | |
| this.$VideoUploadSession21.sendRequest(l); | |
| } | |
| } else { | |
| this.inform('upload-progressed', { | |
| start_offset: 0, | |
| end_offset: this.$VideoUploadSession30.getSize(), | |
| file_size: this.$VideoUploadSession30.getSize(), | |
| sent_bytes: this.$VideoUploadSession30.getSize(), | |
| video_id: k.video_id | |
| }); | |
| if (this.$VideoUploadSession5) this.__logFinishedUploading(); | |
| this.inform('upload-finished', { | |
| start_offset: 0, | |
| end_offset: this.$VideoUploadSession30.getSize(), | |
| video_id: k.video_id | |
| }); | |
| } | |
| }; | |
| j.prototype.__fetchReceiveRequestManagerStateLogData = function() { | |
| 'use strict'; | |
| var k = {}; | |
| if (this.$VideoUploadSession19 != null) this.$VideoUploadSession19.appendStateLogData(k, 'requestManager_'); | |
| if (this.$VideoUploadSession21 != null) this.$VideoUploadSession21.appendStateLogData(k, 'requestManagerEx_'); | |
| return k; | |
| }; | |
| j.prototype.__createReceiveRequestContext = function(k, l) { | |
| 'use strict'; | |
| if (!l) l = false; | |
| var m = new(c('VideoUploadRequestContext'))(); | |
| this.__setupReceiveRequestContext(m, k, l); | |
| return m; | |
| }; | |
| j.prototype.__setupReceiveRequestContext = function(k, l, m) { | |
| 'use strict'; | |
| var n, o, p, q; | |
| if (!m) { | |
| n = this.$VideoUploadSession42; | |
| o = this.$VideoUploadSession45; | |
| p = l.start_offset; | |
| q = l.end_offset; | |
| } else { | |
| n = this.$VideoUploadSession46; | |
| o = this.$VideoUploadSession49; | |
| p = this.$VideoUploadSession46; | |
| q = this.$VideoUploadSession46 + this.$VideoUploadSession16 >= this.$VideoUploadSession49 ? this.$VideoUploadSession49 : this.$VideoUploadSession46 + this.$VideoUploadSession16; | |
| } | |
| k.setFile(this.$VideoUploadSession30).setVideoID(l.video_id).setStartOffset(p).setEndOffset(q).setPartitionStartOffset(n).setPartitionEndOffset(o).setTargetID(this.$VideoUploadSession2).setSource(this.$VideoUploadSession1).setWaterfallID(this.$VideoUploadSession25).setThumbnailConfig(this.$VideoUploadSession10).setSupportsChunking(this.$VideoUploadSession12); | |
| if (k.setComposerEntryPointRef) k.setComposerEntryPointRef(this.$VideoUploadSession7); | |
| }; | |
| j.prototype.$VideoUploadSession53 = function(event, k) { | |
| 'use strict'; | |
| var l = this.__getLogErrorData(k); | |
| this.__logEvent(c('VideoUploadLogger').EVENT_FAILED_START_REQUEST, l); | |
| this.__logEvent(c('VideoUploadLogger').EVENT_FAILED_UPLOADING, l); | |
| var m = k.error_is_transient ? c('VideoUploadLogger').EVENT_RESIGNED_FLOW : c('VideoUploadLogger').EVENT_FAILED_FLOW; | |
| if (this.$VideoUploadSession5) { | |
| if (this.$VideoUploadSession36) { | |
| this.__logEvent(m); | |
| this.$VideoUploadSession36 = false; | |
| } | |
| } else this.__logEvent(m); | |
| this.$VideoUploadSession64(); | |
| this.inform('upload-failed', k); | |
| }; | |
| j.prototype.$VideoUploadSession54 = function(event, k) { | |
| 'use strict'; | |
| if (!k.start_offset && !k.transport_retries && !k.server_retries) this.__logEvent(c('VideoUploadLogger').EVENT_STARTED_SENDING_BYTES, { | |
| total_bytes: this.$VideoUploadSession30.getSize() | |
| }); | |
| if (this.$VideoUploadSession12) this.__logEvent(c('VideoUploadLogger').EVENT_STARTED_SENDING_CHUNK_BYTES, { | |
| start_offset: k.start_offset, | |
| total_bytes: k.end_offset - k.start_offset, | |
| transport_retries: k.transport_retries, | |
| server_retries: k.server_retries, | |
| upload_speed: k.upload_speed | |
| }); | |
| }; | |
| j.prototype.$VideoUploadSession55 = function(event, k) { | |
| 'use strict'; | |
| if (k.start_offset < this.$VideoUploadSession45) { | |
| this.$VideoUploadSession43 = k.start_offset; | |
| this.$VideoUploadSession44 = k.sent_bytes; | |
| } else { | |
| this.$VideoUploadSession47 = k.start_offset; | |
| this.$VideoUploadSession48 = k.sent_bytes; | |
| } | |
| k.start_offset = this.$VideoUploadSession43; | |
| k.sent_bytes = this.$VideoUploadSession44; | |
| if (this.$VideoUploadSession39) { | |
| k.start_offset += this.$VideoUploadSession47 - this.$VideoUploadSession46; | |
| k.sent_bytes += this.$VideoUploadSession48; | |
| } | |
| var l = Math.min(k.start_offset + k.sent_bytes, k.file_size); | |
| if (l > this.$VideoUploadSession31) { | |
| this.$VideoUploadSession31 = l; | |
| this.inform('upload-progressed', k); | |
| } | |
| }; | |
| j.prototype.$VideoUploadSession56 = function(event, k) { | |
| 'use strict'; | |
| if (this.$VideoUploadSession12) this.__logEvent(c('VideoUploadLogger').EVENT_FINISHED_SENDING_CHUNK_BYTES, { | |
| start_offset: k.start_offset, | |
| sent_bytes: k.end_offset - k.start_offset, | |
| transport_retries: k.transport_retries, | |
| server_retries: k.server_retries, | |
| upload_speed: k.upload_speed | |
| }); | |
| if (k.start_offset < this.$VideoUploadSession45) { | |
| this.$VideoUploadSession40 = k.end_offset >= this.$VideoUploadSession45; | |
| } else this.$VideoUploadSession41 = k.end_offset >= this.$VideoUploadSession49; | |
| if (!this.$VideoUploadSession13 || this.$VideoUploadSession40 && (!this.$VideoUploadSession39 || this.$VideoUploadSession41)) { | |
| this.__logEvent(c('VideoUploadLogger').EVENT_FINISHED_SENDING_BYTES, { | |
| sent_bytes: this.$VideoUploadSession30.getSize() | |
| }); | |
| this.$VideoUploadSession37 = Date.now() - this.$VideoUploadSession62; | |
| if (this.$VideoUploadSession5) this.__logFinishedUploading(); | |
| k.video_id = this.$VideoUploadSession27; | |
| this.inform('upload-finished', k); | |
| if (this.$VideoUploadSession9) { | |
| this.__logEvent(c('VideoUploadLogger').EVENT_FINISHED_FLOW); | |
| this.$VideoUploadSession36 = false; | |
| this.$VideoUploadSession64(); | |
| this.inform('multimedia-upload-finished', k); | |
| } | |
| } | |
| }; | |
| j.prototype.$VideoUploadSession57 = function(event, k) { | |
| 'use strict'; | |
| var l = this.__getLogErrorData(k); | |
| if (this.$VideoUploadSession12) this.__logEvent(c('VideoUploadLogger').EVENT_FAILED_SENDING_CHUNK_BYTES, l); | |
| this.__logEvent(c('VideoUploadLogger').EVENT_FAILED_UPLOADING, l); | |
| var m = k.error_is_transient ? c('VideoUploadLogger').EVENT_RESIGNED_FLOW : c('VideoUploadLogger').EVENT_FAILED_FLOW; | |
| if (this.$VideoUploadSession5) { | |
| if (this.$VideoUploadSession36) { | |
| this.__logEvent(m); | |
| this.$VideoUploadSession36 = false; | |
| } | |
| } else this.__logEvent(m); | |
| this.$VideoUploadSession64(); | |
| this.inform('upload-failed', k); | |
| }; | |
| j.prototype.$VideoUploadSession58 = function(event, k) { | |
| 'use strict'; | |
| this.__logEvent(c('VideoUploadLogger').EVENT_TIMEOUT_SENDING_CHUNK_BYTES, { | |
| start_offset: k.start_offset, | |
| sent_bytes: k.end_offset - k.start_offset, | |
| transport_retries: k.transport_retries, | |
| server_retries: k.server_retries, | |
| timeout_retries: k.timeout_retries, | |
| upload_speed: k.upload_speed | |
| }); | |
| }; | |
| j.prototype.$VideoUploadSession59 = function(event, k) { | |
| 'use strict'; | |
| this.inform('online', k); | |
| }; | |
| j.prototype.$VideoUploadSession60 = function(event, k) { | |
| 'use strict'; | |
| this.inform('offline', k); | |
| }; | |
| j.prototype.__handlePostRequestFinished = function(event, k) { | |
| 'use strict'; | |
| this.__logEvent(c('VideoUploadLogger').EVENT_FINISHED_POST_REQUEST); | |
| if (!k.video_id) k.video_id = this.$VideoUploadSession27; | |
| if (!this.$VideoUploadSession5) this.__logFinishedUploading(); | |
| this.__logEvent(c('VideoUploadLogger').EVENT_FINISHED_FLOW); | |
| this.$VideoUploadSession36 = false; | |
| this.$VideoUploadSession64(); | |
| var l = babelHelpers['extends']({}, k, this.$VideoUploadSession34); | |
| this.inform('post-finished', l); | |
| }; | |
| j.prototype.__logFinishedUploading = function() { | |
| 'use strict'; | |
| this.__logEvent(c('VideoUploadLogger').EVENT_FINISHED_UPLOADING, { | |
| elapsed_time: this.$VideoUploadSession37, | |
| skip_upload: this.$VideoUploadSession63 ? 1 : null | |
| }); | |
| this.$VideoUploadSession29 = true; | |
| }; | |
| j.prototype.$VideoUploadSession61 = function(event, k) { | |
| 'use strict'; | |
| var l = this.__getLogErrorData(k); | |
| this.__logEvent(c('VideoUploadLogger').EVENT_FAILED_POST_REQUEST, l); | |
| if (this.$VideoUploadSession28) { | |
| this.__logEvent(c('VideoUploadLogger').EVENT_FAILED_UPLOADING, l); | |
| var m = k.error_is_transient ? c('VideoUploadLogger').EVENT_RESIGNED_FLOW : c('VideoUploadLogger').EVENT_FAILED_FLOW; | |
| this.__logEvent(m); | |
| } | |
| this.$VideoUploadSession64(); | |
| this.inform('post-failed', k); | |
| }; | |
| j.prototype.$VideoUploadSession35 = function() { | |
| 'use strict'; | |
| this.$VideoUploadSession17.cancelRequest(); | |
| this.$VideoUploadSession19.cancelRequest(); | |
| if (this.$VideoUploadSession39) this.$VideoUploadSession21.cancelRequest(); | |
| this.$VideoUploadSession64(); | |
| if (this.$VideoUploadSession27) { | |
| new(c('AsyncRequest'))('/ajax/video/actions/delete').setData({ | |
| fbid: this.$VideoUploadSession27, | |
| redirect: false | |
| }).send(); | |
| this.$VideoUploadSession27 = null; | |
| } | |
| }; | |
| j.prototype.$VideoUploadSession50 = function() { | |
| 'use strict'; | |
| this.$VideoUploadSession28 = true; | |
| if (this.$VideoUploadSession8) { | |
| this.$VideoUploadSession38 = new(c('VideoUploadCrashMonitor'))(this.$VideoUploadSession25, this.$VideoUploadSession6, this.$VideoUploadSession1, this.$VideoUploadSession2, this.$VideoUploadSession3, this.$VideoUploadSession12, this.$VideoUploadSession7, !this.$VideoUploadSession5 || this.$VideoUploadSession36); | |
| this.$VideoUploadSession38.startSession(); | |
| } | |
| }; | |
| j.prototype.$VideoUploadSession64 = function() { | |
| 'use strict'; | |
| this.$VideoUploadSession28 = false; | |
| if (this.$VideoUploadSession38) { | |
| this.$VideoUploadSession38.endSession(); | |
| this.$VideoUploadSession38 = null; | |
| } | |
| }; | |
| j.prototype.__getLogErrorData = function(k) { | |
| 'use strict'; | |
| return { | |
| error: k.error_summary, | |
| error_code: k.error_code, | |
| error_description: k.error_description, | |
| transport_retries: k.transport_retries, | |
| server_retries: k.server_retries | |
| }; | |
| }; | |
| j.prototype.__logEvent = function(event, k) { | |
| 'use strict'; | |
| var l = this.getLogger(); | |
| k = k || {}; | |
| if (this.$VideoUploadSession30) { | |
| k.file_size = this.$VideoUploadSession30.getSize(); | |
| k.file_extension = this.$VideoUploadSession30.getExtension(); | |
| k.sent_bytes = this.$VideoUploadSession31; | |
| } | |
| l.logEvent(event, k); | |
| }; | |
| j.prototype.__getVideoUploadStartRequestManager = function(k, l, m, n, o, p, q) { | |
| 'use strict'; | |
| return new(c('VideoUploadStartRequestManager'))(k, l, m, n, o, p, q); | |
| }; | |
| j.prototype.__getVideoUploadReceiveRequestManager = function(k, l) { | |
| 'use strict'; | |
| return new(c('VideoUploadReceiveRequestManager'))(k, l.max_transport_retries, l.max_server_retries, l.response_timeout_enabled, l.max_response_timeout_retries, l.response_timeout_speed_variation_factor_ppt, l.transport_retry_interval_base, l.server_retry_interval_base, l.receive_errors_force_retry); | |
| }; | |
| j.prototype.__getVideoUploadPostRequestManager = function(k, l) { | |
| 'use strict'; | |
| return new(c('VideoUploadPostRequestManager'))(k, l.post_max_transport_retries, l.post_transport_retry_interval_base, l.post_max_server_retries, l.post_server_retry_interval_base); | |
| }; | |
| f.exports = j; | |
| }, null); | |
| __d('VideoUploader', ['ArbiterMixin', 'VideoUploadCrashMonitor', 'VideoUploadLogger', 'VideoUploadSession', 'arrayContains', 'mixin'], function a(b, c, d, e, f, g) { | |
| var h, i; | |
| if (c.__markCompiled) c.__markCompiled(); | |
| h = babelHelpers.inherits(j, c('mixin')(c('ArbiterMixin'))); | |
| i = h && h.prototype; | |
| function j(k) { | |
| 'use strict'; | |
| i.constructor.call(this); | |
| this.$VideoUploader1 = k; | |
| this.$VideoUploader2 = null; | |
| if (k.monitor_crashes) { | |
| this.$VideoUploader3 = new(c('VideoUploadCrashMonitor'))(); | |
| this.$VideoUploader3.logKnownCrashes(); | |
| } | |
| } | |
| j.prototype.getLogger = function() { | |
| 'use strict'; | |
| if (!this.$VideoUploader2) return; | |
| if (this.$VideoUploader2.getLogger) return this.$VideoUploader2.getLogger(); | |
| }; | |
| j.prototype.upload = function(k) { | |
| 'use strict'; | |
| if (this.$VideoUploader2) return; | |
| this.$VideoUploader2 = this.__getVideoUploadSession(this.$VideoUploader1); | |
| this.$VideoUploader2.subscribe(this.__getEventsWhichShouldListenFromSession(), function(event, l) { | |
| return this.$VideoUploader4(event, l); | |
| }.bind(this)); | |
| this.$VideoUploader2.start(k); | |
| }; | |
| j.prototype.__getVideoUploadSession = function(k) { | |
| 'use strict'; | |
| return new(c('VideoUploadSession'))(k); | |
| }; | |
| j.prototype.__getEventsWhichShouldListenFromSession = function() { | |
| 'use strict'; | |
| return ['upload-requested', 'upload-started', 'upload-progressed', 'upload-finished', 'upload-failed', 'post-started', 'post-finished', 'post-failed', 'online', 'offline', 'metadata-parsed']; | |
| }; | |
| j.prototype.postUserRequest = function() { | |
| 'use strict'; | |
| if (!this.$VideoUploader2) return; | |
| if (this.$VideoUploader2.startFlow) this.$VideoUploader2.startFlow(); | |
| }; | |
| j.prototype.post = function(k) { | |
| 'use strict'; | |
| if (!this.$VideoUploader2) return; | |
| this.$VideoUploader2.post(k); | |
| }; | |
| j.prototype.getVideoID = function() { | |
| 'use strict'; | |
| return this.$VideoUploader2.getVideoID(); | |
| }; | |
| j.prototype.cancel = function() { | |
| 'use strict'; | |
| if (!this.$VideoUploader2) return; | |
| this.$VideoUploader2.cancel(); | |
| this.$VideoUploader2 = null; | |
| }; | |
| j.prototype.abandon = function() { | |
| 'use strict'; | |
| if (!this.$VideoUploader2) return; | |
| this.$VideoUploader2.abandon(); | |
| this.$VideoUploader2 = null; | |
| }; | |
| j.prototype.reset = function() { | |
| 'use strict'; | |
| this.$VideoUploader2 = null; | |
| }; | |
| j.prototype.getUploadSession = function() { | |
| 'use strict'; | |
| return this.$VideoUploader2; | |
| }; | |
| j.prototype.getLoggerData = function() { | |
| 'use strict'; | |
| return { | |
| waterfall_id: this.$VideoUploader2 ? this.$VideoUploader2.$VideoUploader5 : null, | |
| actor_id: this.$VideoUploader1.actor_id, | |
| target_id: this.$VideoUploader1.target_id, | |
| target_type: this.$VideoUploader1.target_type, | |
| composer_entry_point_ref: this.$VideoUploader1.composer_entry_point_ref | |
| }; | |
| }; | |
| j.prototype.isPostInProgress = function() { | |
| 'use strict'; | |
| return !!this.$VideoUploader2 && this.$VideoUploader2.isPostInProgress(); | |
| }; | |
| j.prototype.isSessionInProgress = function() { | |
| 'use strict'; | |
| return !!this.$VideoUploader2 && this.$VideoUploader2.isInProgress(); | |
| }; | |
| j.prototype.getUploadParameters = function() { | |
| 'use strict'; | |
| return this.$VideoUploader1; | |
| }; | |
| j.prototype.__getSession = function() { | |
| 'use strict'; | |
| return this.$VideoUploader2; | |
| }; | |
| j.prototype.__getEventsForWhichSessionShouldBeSetToNull = function() { | |
| 'use strict'; | |
| return ['upload-failed', 'post-finished', 'multimedia-upload-finished']; | |
| }; | |
| j.prototype.$VideoUploader4 = function(event, k) { | |
| 'use strict'; | |
| if (c('arrayContains')(this.__getEventsForWhichSessionShouldBeSetToNull(), event)) this.$VideoUploader2 = null; | |
| this.__delegateEvent(event, k); | |
| }; | |
| j.prototype.__delegateEvent = function(event, k) { | |
| 'use strict'; | |
| this.inform(event, k); | |
| }; | |
| f.exports = j; | |
| }, null); | |
| __d('ReactComposerVideoXUploader', ['invariant', 'ReactComposerEvents', 'ReactComposerMediaUploadActions', 'ReactComposerMediaUploadStore', 'ReactComposerMediaUploadType', 'ReactComposerMediaFilterUtils', 'ReactComposerMediaUploadActionType', 'VideoUploader', 'VideoUploadProgressBar', 'Arbiter', 'DOM', 'JSLogger', 'PhotosUploadID', 'SubscriptionsHandler', 'VideoUploadFile', 'MultimediaUploadProcessingDialog.react', 'React', 'ReactDOM', 'throttle'], function a(b, c, d, e, f, g, h) { | |
| 'use strict'; | |
| if (c.__markCompiled) c.__markCompiled(); | |
| var i = 250; | |
| function j(k) { | |
| this.$ReactComposerVideoXUploader3 = k; | |
| this.$ReactComposerVideoXUploader2 = new(c('SubscriptionsHandler'))(); | |
| this.$ReactComposerVideoXUploader6 = 0; | |
| !k.composerID ? h(0) : void 0; | |
| !k.uploaderParams ? h(0) : void 0; | |
| this.$ReactComposerVideoXUploader2.addSubscriptions(c('Arbiter').subscribe(c('ReactComposerEvents').POST_SUCCEEDED + k.composerID, c('throttle')(this.$ReactComposerVideoXUploader7, i, this)), c('Arbiter').subscribe(c('ReactComposerEvents').POST_STARTED + k.composerID, c('throttle')(this.$ReactComposerVideoXUploader8, i, this))); | |
| this.$ReactComposerVideoXUploader1 = k.composerID; | |
| this.$ReactComposerVideoXUploader4 = k.uploaderParams; | |
| this.$ReactComposerVideoXUploader5 = c('JSLogger').create('composer'); | |
| } | |
| j.prototype.upload = function(k) { | |
| k.forEach(function(l) { | |
| if (!c('ReactComposerMediaFilterUtils').hasVideos([l.name])) return; | |
| if (!l.uploadID) l.uploadID = c('PhotosUploadID').getNewID(); | |
| this.$ReactComposerVideoXUploader9({ | |
| uploadID: l.uploadID, | |
| fileName: l.name, | |
| fileURL: URL.createObjectURL(l) | |
| }); | |
| this.uploadVideo(l); | |
| }.bind(this)); | |
| }; | |
| j.prototype.uploadVideo = function(k) { | |
| var l = JSON.parse(JSON.stringify(this.$ReactComposerVideoXUploader4)); | |
| l.isMultiMediaPost = true; | |
| var m = new(c('VideoUploader'))(l), | |
| n = c('VideoUploadFile').fromFile(k); | |
| this.$ReactComposerVideoXUploader2.addSubscriptions(m.subscribe('upload-started', this.$ReactComposerVideoXUploader10.bind(this, k)), m.subscribe('upload-progressed', this.$ReactComposerVideoXUploader11.bind(this, k)), m.subscribe('upload-failed', this.$ReactComposerVideoXUploader12.bind(this, k)), m.subscribe('upload-finished', this.$ReactComposerVideoXUploader13.bind(this, k))); | |
| try { | |
| m.upload(n); | |
| } catch (o) { | |
| this.$ReactComposerVideoXUploader5.error('error_send_unpublished_files', o); | |
| throw o; | |
| } | |
| }; | |
| j.prototype.$ReactComposerVideoXUploader9 = function(k) { | |
| c('ReactComposerMediaUploadActions').enqueue(this.$ReactComposerVideoXUploader1, k.uploadID, k.fileName, c('ReactComposerMediaUploadStore').getUploads(this.$ReactComposerVideoXUploader1).size, c('ReactComposerMediaUploadActionType').VIDEO_UPLOAD_ENQUEUED, c('ReactComposerMediaUploadType').VIDEO, k.fileURL); | |
| }; | |
| j.prototype.$ReactComposerVideoXUploader10 = function(k, l) { | |
| c('ReactComposerMediaUploadActions').startUploading(this.$ReactComposerVideoXUploader1, k.uploadID, k, c('ReactComposerMediaUploadActionType').VIDEO_UPLOAD_UPLOADING); | |
| }; | |
| j.prototype.$ReactComposerVideoXUploader11 = function(k, l, m) { | |
| var n = c('VideoUploadProgressBar').computeProgress(m.start_offset, m.sent_bytes, m.file_size, 0, 0); | |
| c('ReactComposerMediaUploadActions').progressUploading(this.$ReactComposerVideoXUploader1, k.uploadID, Math.round(n)); | |
| }; | |
| j.prototype.$ReactComposerVideoXUploader13 = function(k, l, m) { | |
| c('ReactComposerMediaUploadActions').doneUploading(this.$ReactComposerVideoXUploader1, k.uploadID, c('ReactComposerMediaUploadActionType').VIDEO_UPLOAD_DONE, k, 0, m.video_id, ''); | |
| }; | |
| j.prototype.$ReactComposerVideoXUploader12 = function(k, l, m) { | |
| var n = { | |
| code: m.error_code, | |
| description: m.error_description, | |
| summary: m.error_summary, | |
| transient: m.error_is_transient | |
| }; | |
| c('ReactComposerMediaUploadActions').failUploading(this.$ReactComposerVideoXUploader1, k.uploadID, k, 0, n, c('ReactComposerMediaUploadActionType').VIDEO_UPLOAD_FAILED); | |
| }; | |
| j.prototype.$ReactComposerVideoXUploader7 = function() { | |
| var k = c('DOM').create('div'); | |
| c('DOM').appendContent(document.body, k); | |
| if (this.$ReactComposerVideoXUploader6 > 0) c('ReactDOM').render(c('React').createElement(c('MultimediaUploadProcessingDialog.react'), { | |
| numOfVideos: this.$ReactComposerVideoXUploader6 | |
| }), k); | |
| }; | |
| j.prototype.$ReactComposerVideoXUploader8 = function() { | |
| this.$ReactComposerVideoXUploader6 = c('ReactComposerMediaUploadStore').getUploadsCount(this.$ReactComposerVideoXUploader1, c('ReactComposerMediaUploadType').VIDEO); | |
| }; | |
| j.prototype.destroy = function() { | |
| this.$ReactComposerVideoXUploader2.release(); | |
| }; | |
| f.exports = j; | |
| }, null); | |
| __d('ReactComposerPhotoLegacyLimitExceededDialog', ['fbt', 'DOM', 'LayerDestroyOnHide', 'React', 'ReactDOM', 'XUIDialog.react', 'XUIDialogBody.react', 'XUIDialogFooter.react', 'XUIDialogOkayButton.react', 'XUIDialogTitle.react'], function a(b, c, d, e, f, g, h) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| var i = { | |
| show: function(j) { | |
| var k = h._("Too Many Photos Added"), | |
| l = h._("You can only add {maxselect} photos to a post. To add more photos, try creating an album.", [h.param('maxselect', j)]), | |
| m = c('DOM').create('div'); | |
| c('ReactDOM').render(c('React').createElement(c('XUIDialog.react'), { | |
| shown: true, | |
| behaviors: { | |
| LayerDestroyOnHide: c('LayerDestroyOnHide') | |
| }, | |
| width: 600 | |
| }, c('React').createElement(c('XUIDialogTitle.react'), null, c('React').createElement('span', null, k)), c('React').createElement(c('XUIDialogBody.react'), null, l), c('React').createElement(c('XUIDialogFooter.react'), null, c('React').createElement(c('XUIDialogOkayButton.react'), { | |
| use: 'confirm', | |
| action: 'cancel' | |
| }))), m); | |
| } | |
| }; | |
| f.exports = i; | |
| }, null); | |
| __d('ReactComposerVideoUploadActionType', ['keyMirrorRecursive'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| f.exports = c('keyMirrorRecursive')({ | |
| VIDEO_SET_UPLOADER: null, | |
| VIDEO_UPLOAD_ADD: null, | |
| VIDEO_UPLOAD_REMOVE: null | |
| }, 'ReactComposerVideoUploadActionType'); | |
| }, null); | |
| __d('ReactComposerVideoUploadStore', ['ReactComposerStoreBase', 'ReactComposerVideoUploadActionType', 'immutable'], function a(b, c, d, e, f, g) { | |
| var h, i; | |
| if (c.__markCompiled) c.__markCompiled(); | |
| var j = c('immutable').Record({ | |
| file: null | |
| }); | |
| h = babelHelpers.inherits(k, c('ReactComposerStoreBase')); | |
| i = h && h.prototype; | |
| function k() { | |
| 'use strict'; | |
| var l; | |
| i.constructor.call(this, function() { | |
| return { | |
| uploader: null, | |
| video: null | |
| }; | |
| }, function(m) { | |
| switch (m.type) { | |
| case c('ReactComposerVideoUploadActionType').VIDEO_SET_UPLOADER: | |
| l && l.$ReactComposerVideoUploadStore1(m); | |
| break; | |
| case c('ReactComposerVideoUploadActionType').VIDEO_UPLOAD_ADD: | |
| l && l.$ReactComposerVideoUploadStore2(m); | |
| break; | |
| case c('ReactComposerVideoUploadActionType').VIDEO_UPLOAD_REMOVE: | |
| l && l.$ReactComposerVideoUploadStore3(m); | |
| break; | |
| default: | |
| } | |
| }); | |
| l = this; | |
| } | |
| k.prototype.getUploader = function(l) { | |
| 'use strict'; | |
| return this.getComposerData(l).uploader; | |
| }; | |
| k.prototype.getVideo = function(l) { | |
| 'use strict'; | |
| return this.getComposerData(l).video; | |
| }; | |
| k.prototype.$ReactComposerVideoUploadStore1 = function(l) { | |
| 'use strict'; | |
| var m = this.validateAction(l, ['composerID', 'uploader']), | |
| n = m[0], | |
| o = m[1], | |
| p = this.getComposerData(n); | |
| p.uploader = o; | |
| this.emitChange(n); | |
| }; | |
| k.prototype.$ReactComposerVideoUploadStore2 = function(l) { | |
| 'use strict'; | |
| var m = this.validateAction(l, ['composerID', 'file']), | |
| n = m[0], | |
| o = m[1], | |
| p = this.getComposerData(n); | |
| p.video = new j({ | |
| file: o | |
| }); | |
| this.emitChange(n); | |
| }; | |
| k.prototype.$ReactComposerVideoUploadStore3 = function(l) { | |
| 'use strict'; | |
| var m = this.validateAction(l, 'composerID'), | |
| n = this.getComposerData(m); | |
| n.video = null; | |
| n.input && n.input.clear(); | |
| this.emitChange(m); | |
| }; | |
| f.exports = new k(); | |
| }, null); | |
| __d('ReactComposerVideoUploadActions', ['ReactComposerDispatcher', 'ReactComposerVideoUploadActionType', 'ReactComposerVideoUploadStore'], function a(b, c, d, e, f, g) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| c('ReactComposerVideoUploadStore'); | |
| var h = { | |
| setUploader: function(i, j) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerVideoUploadActionType').VIDEO_SET_UPLOADER, | |
| uploader: j | |
| }); | |
| }, | |
| add: function(i, j) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerVideoUploadActionType').VIDEO_UPLOAD_ADD, | |
| file: j | |
| }); | |
| }, | |
| remove: function(i) { | |
| c('ReactComposerDispatcher').dispatch({ | |
| composerID: i, | |
| type: c('ReactComposerVideoUploadActionType').VIDEO_UPLOAD_REMOVE | |
| }); | |
| } | |
| }; | |
| f.exports = h; | |
| }, null); | |
| __d('ReactComposerMediaUtils', ['invariant', 'ReactComposerAttachmentStore', 'ReactComposerAttachmentType', 'ReactComposerMediaUploadType', 'ReactComposerMediaFilterUtils', 'ReactComposerPhotoActions', 'ReactComposerPhotoLegacyLimitExceededDialog', 'ReactComposerMediaUploadActions', 'ReactComposerMediaUploadStore', 'ReactComposerVideoLegacyLimitExceededDialog', 'ReactComposerVideoUploadStore', 'ReactComposerVideoUploadActions', 'Arbiter', 'Bootloader', 'Map', 'PUWMethods', 'VideoUploadFeatureDetector', 'VideoUploader', 'VideoUploadFile', 'curry', 'uniqueID'], function a(b, c, d, e, f, g, h) { | |
| if (c.__markCompiled) c.__markCompiled(); | |
| var i = { | |
| clearInput: function(j) { | |
| var k = this.getFileNamesFromFileInput(j.getInput()); | |
| if (!i.hasVideos(k)) j.clear(); | |
| }, | |
| getFileNames: function(j) { | |
| var k = []; | |
| for (var l = 0; l < j.length; l++) k.push(j[l].name); | |
| return k; | |
| }, | |
| getFileNamesFromFileInput: function(j) { | |
| if (c('VideoUploadFeatureDetector').supportsFileAPI()) { | |
| return this.getFileNames(j.files); | |
| } else return [j.value.split('/').pop().split('\\').pop()]; | |
| }, | |
| hasVideos: function(j) { | |
| return c('ReactComposerMediaFilterUtils').hasVideos(j); | |
| }, | |
| hasAudioFiles: function(j) { | |
| return c('ReactComposerMediaFilterUtils').hasAudioFiles(j); | |
| }, | |
| filterVideos: function(j) { | |
| return c('ReactComposerMediaFilterUtils').filterVideos(j); | |
| }, | |
| filterAudioFiles: function(j) { | |
| return c('ReactComposerMediaFilterUtils').filterAudioFiles(j); | |
| }, | |
| filterFileOfSupportedType: function(j, k) { | |
| return c('ReactComposerMediaFilterUtils').filterFileOfSupportedType(j, k); | |
| }, | |
| uploadVideo: function(j, k) { | |
| var l = c('ReactComposerMediaUploadStore').getUploadsOfType(j, c('ReactComposerMediaUploadType').PHOTO); | |
| if (l.size > 0) c('ReactComposerMediaUploadActions').removeAllPhotoUploads(j, l); | |
| c('ReactComposerVideoUploadActions').add(j, k); | |
| }, | |
| uploadPhotos: function(j, k, l, m, n, o) { | |
| var p = l.isUploadLimitExceeded(m, k); | |
| if (p) { | |
| c('ReactComposerPhotoLegacyLimitExceededDialog').show(l.getMaxSelectableFilesCount(m)); | |
| return; | |
| } | |
| var q = k ? k.length : 1; | |
| if (q < 1) return; | |
| if (c('ReactComposerVideoUploadStore').getVideo(j)) c('ReactComposerVideoUploadActions').remove(j); | |
| c('ReactComposerMediaUploadActions').photosSelect(j, q, n); | |
| o && o(); | |
| }, | |
| uploadVideosFromTarget: function(j, k, l, m, n) { | |
| if (n) { | |
| this.uploadMultiMediaFromTarget(j, k, l, m, n); | |
| } else { | |
| if (k.files && k.files.length > 1) { | |
| c('ReactComposerVideoLegacyLimitExceededDialog').show(); | |
| return; | |
| } | |
| this.uploadVideo(j, c('VideoUploadFile').fromFileInput(k)); | |
| } | |
| }, | |
| uploadVideos: function(j, k, l, m, n) { | |
| if (n) { | |
| this.uploadMultiMedia(j, k, l, m); | |
| } else { | |
| if (k && k.length > 1) { | |
| c('ReactComposerVideoLegacyLimitExceededDialog').show(); | |
| return; | |
| } | |
| this.uploadVideo(j, c('VideoUploadFile').fromFile(k[0])); | |
| } | |
| }, | |
| uploadMultiMediaFromTarget: function(j, k, l, m, n) { | |
| var o = this.getVideoXUploader(j); | |
| o.upload(Array.from(k.files)); | |
| this.uploadPhotos(j, k.files, l, m, c('PUWMethods').FILE_SELECTOR, function() { | |
| l && l.upload(k); | |
| }, n); | |
| }, | |
| uploadPhotosOrVideoFromTarget: function(j, k, l, m, n) { | |
| var o = this.getFileNamesFromFileInput(k); | |
| if (this.hasVideos(o)) { | |
| this.uploadVideosFromTarget(j, k, l, m, n); | |
| } else this.uploadPhotos(j, k.files, l, m, c('PUWMethods').FILE_SELECTOR, function() { | |
| l && l.upload(k); | |
| }); | |
| }, | |
| uploadMultiMedia: function(j, k, l, m) { | |
| var n = arguments.length <= 4 || arguments[4] === undefined ? c('PUWMethods').FILE_SELECTOR : arguments[4], | |
| o = this.getVideoXUploader(j); | |
| o.upload(k); | |
| var p = k.filter(function(q) { | |
| return !this.hasVideos([q.name]); | |
| }.bind(this)); | |
| this.uploadPhotos(j, p, l, m, n, function() { | |
| p.forEach(function(q) { | |
| q.uploadID = c('uniqueID')(); | |
| q.filename = ''; | |
| }); | |
| l.enqueueAsyncUploadRequest(j, p, {}, {}, false); | |
| }); | |
| }, | |
| uploadPhotosOrVideo: function(j, k, l, m) { | |
| var n = arguments.length <= 4 || arguments[4] === undefined ? c('PUWMethods').FILE_SELECTOR : arguments[4], | |
| o = arguments[5], | |
| p = this.getFileNames(k); | |
| if (this.hasVideos(p)) { | |
| this.uploadVideos(j, k, l, m, o); | |
| } else this.uploadPhotos(j, k, l, m, n, function() { | |
| k.forEach(function(q) { | |
| q.uploadID = c('uniqueID')(); | |
| q.filename = ''; | |
| }); | |
| l.enqueueAsyncUploadRequest(j, k, {}, {}, false); | |
| }); | |
| }, | |
| subscribeToImageEdit: function(j, k) { | |
| return c('Arbiter').subscribe(['AttachmentsPhotoEditor/newImage' + j, 'AttachmentsPhotoEditor/tagsUpdated' + j], c('curry')(i.onImageEdited, j, k)); | |
| }, | |
| onImageEdited: function(j, k, l, m) { | |
| if (l === 'AttachmentsPhotoEditor/newImage' + j) { | |
| var n = c('ReactComposerMediaUploadStore').getUploadsOfType(j, c('ReactComposerMediaUploadType').PHOTO), | |
| o = n.find(function(s) { | |
| return (s.photoID === m.fbid || s.originalPhotoID === m.fbid); | |
| }), | |
| p = c('ReactComposerMediaUploadStore').getUploadIndex(j, o.id); | |
| c('ReactComposerPhotoActions').removePhoto(j, o.photoID, o.id); | |
| var q = m.blob; | |
| q.uploadID = c('uniqueID')(); | |
| q.filename = o.filename; | |
| var r = new(c('Map'))([ | |
| [q.uploadID, p] | |
| ]); | |
| k && k.enqueueAsyncUploadRequest(j, [q], { | |
| data: { | |
| original_fbid: m.fbid, | |
| xy_tags: m.xyTags, | |
| stickers: m.stickers, | |
| text_overlays: m.textOverlays, | |
| has_crop: m.hasCrop, | |
| has_filter: m.hasFilter | |
| }, | |
| indexMap: r | |
| }, { | |
| xyTags: m.xyTags | |
| }, false); | |
| c('ReactComposerMediaUploadActions').photosSelect(j, 1, c('PUWMethods').METHOD_EDITOR); | |
| } else if (l === 'AttachmentsPhotoEditor/tagsUpdated' + j) i.handleFaceboxAndXYTags(j, m.fbid, m.xyTags); | |
| c('ReactComposerPhotoActions').finishPhotoEdit(j); | |
| }, | |
| handleFaceboxAndXYTags: function(j, k, l) { | |
| c('ReactComposerPhotoActions').untagAllForPhoto(j, k); | |
| l.forEach(function(m) { | |
| if (m.from_facebox) { | |
| c('ReactComposerPhotoActions').tagFacebox(j, k, m.facebox, m.subject, m.name); | |
| } else if (m.is_product_tag) { | |
| c('ReactComposerPhotoActions').tagXYProduct(j, k, m.name, m.source, m.subject, m.x, m.y); | |
| } else c('ReactComposerPhotoActions').tagXY(j, k, m.name, m.source, m.subject, m.x, m.y); | |
| }); | |
| }, | |
| handleXYTagsOnly: function(j, k, l) { | |
| l.forEach(function(m) { | |
| if (m.from_facebox) { | |
| return; | |
| } else c('ReactComposerPhotoActions').tagXY(j, k, m.name, m.source, m.subject, m.x, m.y); | |
| }); | |
| }, | |
| handleSpecialMediaUpload: function(event, j, k, l) { | |
| var m = c('ReactComposerMediaUploadStore').getUploadsCount(l.composerID) > 0; | |
| if (!k.useVideoUploadDialog || m) return false; | |
| var n = event.target; | |
| if (!n || !n.files || n.files.length !== 1) return false; | |
| var o = i.getFileNamesFromFileInput(n), | |
| p = i.hasVideos(o), | |
| q = i.hasAudioFiles(o); | |
| if (q && k.canUploadAudio) { | |
| c('Bootloader').loadModules(["ComposerXAudioUploadDialogController"], function(r) { | |
| return (r.showDialog({ | |
| targetID: l.targetID, | |
| fileInput: j | |
| })); | |
| }, 'ReactComposerMediaUtils'); | |
| return true; | |
| } else if (p) { | |
| c('Bootloader').loadModules(["ComposerXVideoUploadDialogController"], function(r) { | |
| return (r.showDialog({ | |
| targetID: l.targetID, | |
| fileInput: j, | |
| composerEntryPointRef: l.composerType, | |
| canShowOptimisticPost: k.shouldShowOptimisticVideoPost | |
| })); | |
| }, 'ReactComposerMediaUtils'); | |
| return true; | |
| } | |
| return false; | |
| }, | |
| isMultimediaPost: function(j) { | |
| return (c('ReactComposerMediaUploadStore').getUploadsCount(j, c('ReactComposerMediaUploadType').VIDEO) > 0 && c('ReactComposerMediaUploadStore').getUploadsCount(j, c('ReactComposerMediaUploadType').PHOTO) > 0); | |
| }, | |
| getVideoXUploader: function(j) { | |
| var k = c('ReactComposerAttachmentStore').getAttachmentsConfig(j, c('ReactComposerAttachmentType').MEDIA); | |
| !k ? h(0) : void 0; | |
| var l = c('ReactComposerMediaUploadStore').getVideoUploader(j, k.videoUploadParams); | |
| return l; | |
| }, | |
| getVideoUploader: function(j) { | |
| var k = c('ReactComposerAttachmentStore').getAttachmentsConfig(j, c('ReactComposerAttachmentType').MEDIA); | |
| !k ? h(0) : void 0; | |
| var l = JSON.parse(JSON.stringify(k.videoUploadParams)); | |
| return new(c('VideoUploader'))(l); | |
| } | |
| }; | |
| f.exports = i; | |
| }, null); | |
| __d('XComposerPhotoUploader', ['regeneratorRuntime', 'Promise', 'AsyncUploadRequest', 'ReactComposerMediaUtils', 'FileInputUploader', 'JSLogger', 'PhotosMimeType', 'PhotosUploadID', 'SphericalPhotoConfig', 'SphericalImage', 'curry', 'emptyFunction', 'performanceNow'], function a(b, c, d, e, f, g) { | |
| 'use strict'; | |
| if (c.__markCompiled) c.__markCompiled(); | |
| function h(i) { | |
| this.$XComposerPhotoUploader2 = i.uploadData || {}; | |
| this.$XComposerPhotoUploader1 = i.uploadEndpoint; | |
| this.$XComposerPhotoUploader3 = i.retryLimit; | |
| this.$XComposerPhotoUploader4 = i.concurrentLimit; | |
| this.$XComposerPhotoUploader5 = i.resizer; | |
| this.$XComposerPhotoUploader6 = i.onUploadEnqueued || c('emptyFunction'); | |
| this.$XComposerPhotoUploader7 = i.onUploadsEnqueued || c('emptyFunction'); | |
| this.$XComposerPhotoUploader8 = i.onResizeStart || c('emptyFunction'); | |
| this.$XComposerPhotoUploader11 = i.onResizeProgress || c('emptyFunction'); | |
| this.$XComposerPhotoUploader9 = i.onResizeSuccess || c('emptyFunction'); | |
| this.$XComposerPhotoUploader10 = i.onResizeFailure || c('emptyFunction'); | |
| this.$XComposerPhotoUploader12 = i.onUploadIsSpherical || c('emptyFunction'); | |
| this.$XComposerPhotoUploader13 = i.onUploadSent || c('emptyFunction'); | |
| this.$XComposerPhotoUploader14 = i.onUploadStart || c('emptyFunction'); | |
| this.$XComposerPhotoUploader15 = i.onUploadProgress || c('emptyFunction'); | |
| this.$XComposerPhotoUploader16 = i.onUploadSuccess || c('emptyFunction'); | |
| this.$XComposerPhotoUploader17 = i.onUploadFailure || c('emptyFunction'); | |
| this.$XComposerPhotoUploader18 = c('JSLogger').create('composer'); | |
| } | |
| h.prototype.upload = function(i, j) { | |
| j = j || 0; | |
| var k = Object.assign({}, this.$XComposerPhotoUploader2), | |
| l = null; | |
| if (!this.$XComposerPhotoUploader19(i)) { | |
| var m = c('PhotosUploadID').getNewID(); | |
| i.uploadID = m; | |
| k.upload_id = m; | |
| this.$XComposerPhotoUploader6({ | |
| uploadID: m, | |
| fileName: i.value.split('/').pop().split('\\').pop() | |
| }); | |
| } else { | |
| l = Array.from(i.files); | |
| l = l.filter(function(q) { | |
| return !c('ReactComposerMediaUtils').hasVideos([q.name]); | |
| }); | |
| if (l.length === 0) return; | |
| var n = l.length + j; | |
| l.forEach(function(q) { | |
| if (!q.uploadID) q.uploadID = c('PhotosUploadID').getNewID(); | |
| var r = false; | |
| if (c('SphericalPhotoConfig').spherical_photo_www_upload) r = null; | |
| this.$XComposerPhotoUploader6({ | |
| uploadID: q.uploadID, | |
| fileName: q.name, | |
| isSpherical: r | |
| }); | |
| }.bind(this)); | |
| if (n > 1 || !c('SphericalPhotoConfig').spherical_photo_www_upload) k.allow_spherical_photo = false; | |
| } | |
| this.$XComposerPhotoUploader7(); | |
| var o = new(c('FileInputUploader'))(i).setURI(this.$XComposerPhotoUploader1).setData(k).setAllowCrossOrigin(true).setNetworkErrorRetryLimit(this.$XComposerPhotoUploader3).setUploadInParallel(true); | |
| if (l && l.length > 0) { | |
| o.setFiles({ | |
| farr: l | |
| }); | |
| if (this.$XComposerPhotoUploader5) { | |
| o.setPreprocessHandler(this.$XComposerPhotoUploader20.bind(this)); | |
| } else o.setPreprocessHandler(this.$XComposerPhotoUploader21.bind(this)); | |
| if (this.$XComposerPhotoUploader4) o.setConcurrentLimit(this.$XComposerPhotoUploader4); | |
| } | |
| o.subscribe('progress', function(q, r) { | |
| return (this.$XComposerPhotoUploader15(this.$XComposerPhotoUploader22(r, i), r)); | |
| }.bind(this)); | |
| o.subscribe('failure', function(q, r) { | |
| return (this.$XComposerPhotoUploader17(this.$XComposerPhotoUploader22(r, i), r, l)); | |
| }.bind(this)); | |
| o.subscribe('start', function(q, r) { | |
| return (this.$XComposerPhotoUploader14(this.$XComposerPhotoUploader22(r, i), r)); | |
| }.bind(this)); | |
| o.subscribe('success', function(q, r) { | |
| return (this.$XComposerPhotoUploader16(this.$XComposerPhotoUploader22(r, i), r)); | |
| }.bind(this)); | |
| try { | |
| o.send(); | |
| this.$XComposerPhotoUploader13(i); | |
| } catch (p) { | |
| this.$XComposerPhotoUploader18.error('error_send_unpublished_files', p); | |
| throw p; | |
| } | |
| }; | |
| h.prototype.getAsyncUploadRequest = function(i, j) { | |
| var k = new(c('AsyncUploadRequest'))().setData(Object.assign({}, j && j.data, this.$XComposerPhotoUploader2)).setFiles({ | |
| farr: i | |
| }).setAllowCrossOrigin(true).setURI(this.$XComposerPhotoUploader1); | |
| if (this.$XComposerPhotoUploader4) k.setLimit(this.$XComposerPhotoUploader4); | |
| if (this.$XComposerPhotoUploader5) k.setPreprocessHandler(this.$XComposerPhotoUploader20.bind(this)); | |
| k.subscribe('start', function(l, m) { | |
| return (this.$XComposerPhotoUploader14(m.getFile().uploadID, { | |
| upload: m | |
| })); | |
| }.bind(this)); | |
| k.subscribe('progress', function(l, m) { | |
| return (this.$XComposerPhotoUploader15(m.getFile().uploadID, { | |
| upload: m, | |
| event: m.getProgressEvent() | |
| })); | |
| }.bind(this)); | |
| k.subscribe('success', function(l, m) { | |
| return (this.$XComposerPhotoUploader16(m.getFile().uploadID, { | |
| upload: m, | |
| response: m.getResponse() | |
| })); | |
| }.bind(this)); | |
| k.subscribe('failure', function(l, m) { | |
| return (this.$XComposerPhotoUploader17(m.getFile().uploadID, { | |
| upload: m, | |
| response: m.getResponse() | |
| }, i)); | |
| }.bind(this)); | |
| return k; | |
| }; | |
| h.prototype.$XComposerPhotoUploader22 = function(i, j) { | |
| if (i.upload) { | |
| return i.upload.getFile().uploadID; | |
| } else return j.uploadID; | |
| }; | |
| h.prototype.$XComposerPhotoUploader21 = function(i, j) { | |
| (function k() { | |
| return c('regeneratorRuntime').async(function l(m) { | |
| while (1) switch (m.prev = m.next) { | |
| case 0: | |
| m.next = 2; | |
| return c('regeneratorRuntime').awrap(this.$XComposerPhotoUploader23(i, j)); | |
| case 2: | |
| return m.abrupt('return', m.sent); | |
| case 3: | |
| case 'end': | |
| return m.stop(); | |
| } | |
| }, null, this); | |
| }).bind(this)().done(); | |
| }; | |
| h.prototype.$XComposerPhotoUploader23 = function i(j, k) { | |
| var l, m; | |
| return c('regeneratorRuntime').async(function n(o) { | |
| while (1) switch (o.prev = o.next) { | |
| case 0: | |
| l = j.getFile(); | |
| o.next = 3; | |
| return c('regeneratorRuntime').awrap(this.$XComposerPhotoUploader24(l)); | |
| case 3: | |
| m = o.sent; | |
| this.$XComposerPhotoUploader12(l, m); | |
| k(j); | |
| case 6: | |
| case 'end': | |
| return o.stop(); | |
| } | |
| }, null, this); | |
| }; | |
| h.prototype.$XComposerPhotoUploader20 = function(i, j) { | |
| (function k() { | |
| return c('regeneratorRuntime').async(function l(m) { | |
| while (1) switch (m.prev = m.next) { | |
| case 0: | |
| m.next = 2; | |
| return c('regeneratorRuntime').awrap(this.$XComposerPhotoUploader25(i, j)); | |
| case 2: | |
| return m.abrupt('return', m.sent); | |
| case 3: | |
| case 'end': | |
| return m.stop(); | |
| } | |
| }, null, this); | |
| }).bind(this)().done(); | |
| }; | |
| h.prototype.$XComposerPhotoUploader24 = function i(j) { | |
| return c('regeneratorRuntime').async(function k(l) { | |
| while (1) switch (l.prev = l.next) { | |
| case 0: | |
| l.next = 2; | |
| return c('regeneratorRuntime').awrap(c('SphericalImage').isSphericalBlob(j)); | |
| case 2: | |
| return l.abrupt('return', l.sent); | |
| case 3: | |
| case 'end': | |
| return l.stop(); | |
| } | |
| }, null, this); | |
| }; | |
| h.prototype.$XComposerPhotoUploader26 = function(i) { | |
| return this.$XComposerPhotoUploader27(this.$XComposerPhotoUploader5.resizeBlob.bind(this.$XComposerPhotoUploader5), i); | |
| }; | |
| h.prototype.$XComposerPhotoUploader28 = function(i) { | |
| return this.$XComposerPhotoUploader27(this.$XComposerPhotoUploader5.resize360Blob.bind(this.$XComposerPhotoUploader5), i); | |
| }; | |
| h.prototype.$XComposerPhotoUploader27 = function(i, j) { | |
| var k = c('curry')(this.$XComposerPhotoUploader11, j.uploadID), | |
| l = function() { | |
| return this.$XComposerPhotoUploader8(j); | |
| }.bind(this); | |
| return new(c('Promise'))(function(m, n) { | |
| l(); | |
| i(j, function(o, p, q) { | |
| if (o) { | |
| n(o); | |
| } else if (q) { | |
| m(null); | |
| } else m(p); | |
| }, k); | |
| }); | |
| }; | |
| h.prototype.$XComposerPhotoUploader25 = function i(j, k) { | |
| var l, m, n, o, p, q; | |
| return c('regeneratorRuntime').async(function r(s) { | |
| while (1) switch (s.prev = s.next) { | |
| case 0: | |
| l = j.getFile(); | |
| if (!(!l || !c('PhotosMimeType').isJpeg(l.type))) { | |
| s.next = 5; | |
| break; | |
| } | |
| this.$XComposerPhotoUploader12(l, false); | |
| k(j); | |
| return s.abrupt('return'); | |
| case 5: | |
| m = c('performanceNow')(); | |
| s.prev = 6; | |
| n = false; | |
| if (!c('SphericalPhotoConfig').spherical_photo_www_upload) { | |
| s.next = 12; | |
| break; | |
| } | |
| s.next = 11; | |
| return c('regeneratorRuntime').awrap(this.$XComposerPhotoUploader24(l)); | |
| case 11: | |
| n = s.sent; | |
| case 12: | |
| if (!n) { | |
| s.next = 19; | |
| break; | |
| } | |
| this.$XComposerPhotoUploader12(l, true); | |
| s.next = 16; | |
| return c('regeneratorRuntime').awrap(this.$XComposerPhotoUploader28(l)); | |
| case 16: | |
| o = s.sent; | |
| s.next = 23; | |
| break; | |
| case 19: | |
| this.$XComposerPhotoUploader12(l, false); | |
| s.next = 22; | |
| return c('regeneratorRuntime').awrap(this.$XComposerPhotoUploader26(l)); | |
| case 22: | |
| o = s.sent; | |
| case 23: | |
| if (o) { | |
| o.uploadID = l.uploadID; | |
| o.name = l.name; | |
| j.setFile(o); | |
| } | |
| p = o === null; | |
| j.getFile().filename = l.name; | |
| this.$XComposerPhotoUploader9(l, o || l, p, c('performanceNow')() - m); | |
| s.next = 34; | |
| break; | |
| case 29: | |
| s.prev = 29; | |
| s.t0 = s['catch'](6); | |
| q = c('performanceNow')() - m; | |
| this.$XComposerPhotoUploader10(l, o || l, s.t0, q); | |
| case 34: | |
| k(j); | |
| case 35: | |
| case 'end': | |
| return s.stop(); | |
| } | |
| }, null, this, [ | |
| [6, 29] | |
| ]); | |
| }; | |
| h.prototype.$XComposerPhotoUploader19 = function(i) { | |
| return !!i.files && c('AsyncUploadRequest').isSupported(); | |
| }; | |
| f.exports = h; | |
| }, null); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment