10 __coverage__['build/uploader-queue/uploader-queue.js'] = {"path":"build/uploader-queue/uploader-queue.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":0,"133":0,"134":0,"135":0,"136":0,"137":0,"138":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0,0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":45}}},"2":{"name":"(anonymous_2)","line":18,"loc":{"start":{"line":18,"column":20},"end":{"line":18,"column":31}}},"3":{"name":"(anonymous_3)","line":48,"loc":{"start":{"line":48,"column":18},"end":{"line":48,"column":30}}},"4":{"name":"(anonymous_4)","line":57,"loc":{"start":{"line":57,"column":26},"end":{"line":57,"column":43}}},"5":{"name":"(anonymous_5)","line":72,"loc":{"start":{"line":72,"column":26},"end":{"line":72,"column":43}}},"6":{"name":"(anonymous_6)","line":121,"loc":{"start":{"line":121,"column":21},"end":{"line":121,"column":33}}},"7":{"name":"(anonymous_7)","line":151,"loc":{"start":{"line":151,"column":22},"end":{"line":151,"column":38}}},"8":{"name":"(anonymous_8)","line":162,"loc":{"start":{"line":162,"column":24},"end":{"line":162,"column":40}}},"9":{"name":"(anonymous_9)","line":173,"loc":{"start":{"line":173,"column":24},"end":{"line":173,"column":40}}},"10":{"name":"(anonymous_10)","line":188,"loc":{"start":{"line":188,"column":29},"end":{"line":188,"column":46}}},"11":{"name":"(anonymous_11)","line":207,"loc":{"start":{"line":207,"column":47},"end":{"line":207,"column":64}}},"12":{"name":"(anonymous_12)","line":232,"loc":{"start":{"line":232,"column":27},"end":{"line":232,"column":44}}},"13":{"name":"(anonymous_13)","line":250,"loc":{"start":{"line":250,"column":29},"end":{"line":250,"column":46}}},"14":{"name":"(anonymous_14)","line":263,"loc":{"start":{"line":263,"column":47},"end":{"line":263,"column":64}}},"15":{"name":"(anonymous_15)","line":279,"loc":{"start":{"line":279,"column":17},"end":{"line":279,"column":28}}},"16":{"name":"(anonymous_16)","line":300,"loc":{"start":{"line":300,"column":17},"end":{"line":300,"column":29}}},"17":{"name":"(anonymous_17)","line":309,"loc":{"start":{"line":309,"column":19},"end":{"line":309,"column":31}}},"18":{"name":"(anonymous_18)","line":324,"loc":{"start":{"line":324,"column":20},"end":{"line":324,"column":36}}},"19":{"name":"(anonymous_19)","line":342,"loc":{"start":{"line":342,"column":19},"end":{"line":342,"column":35}}},"20":{"name":"(anonymous_20)","line":353,"loc":{"start":{"line":353,"column":22},"end":{"line":353,"column":38}}},"21":{"name":"(anonymous_21)","line":366,"loc":{"start":{"line":366,"column":18},"end":{"line":366,"column":34}}},"22":{"name":"(anonymous_22)","line":501,"loc":{"start":{"line":501,"column":28},"end":{"line":501,"column":43}}},"23":{"name":"(anonymous_23)","line":520,"loc":{"start":{"line":520,"column":27},"end":{"line":520,"column":42}}},"24":{"name":"(anonymous_24)","line":561,"loc":{"start":{"line":561,"column":20},"end":{"line":561,"column":35}}},"25":{"name":"(anonymous_25)","line":563,"loc":{"start":{"line":563,"column":39},"end":{"line":563,"column":56}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":656,"column":37}},"2":{"start":{"line":18,"column":0},"end":{"line":28,"column":2}},"3":{"start":{"line":19,"column":4},"end":{"line":19,"column":26}},"4":{"start":{"line":20,"column":4},"end":{"line":20,"column":28}},"5":{"start":{"line":21,"column":4},"end":{"line":21,"column":29}},"6":{"start":{"line":22,"column":4},"end":{"line":22,"column":40}},"7":{"start":{"line":23,"column":4},"end":{"line":23,"column":27}},"8":{"start":{"line":24,"column":4},"end":{"line":24,"column":32}},"9":{"start":{"line":25,"column":4},"end":{"line":25,"column":24}},"10":{"start":{"line":27,"column":4},"end":{"line":27,"column":64}},"11":{"start":{"line":31,"column":0},"end":{"line":649,"column":3}},"12":{"start":{"line":58,"column":8},"end":{"line":58,"column":33}},"13":{"start":{"line":59,"column":8},"end":{"line":59,"column":41}},"14":{"start":{"line":60,"column":8},"end":{"line":60,"column":41}},"15":{"start":{"line":62,"column":8},"end":{"line":62,"column":47}},"16":{"start":{"line":73,"column":8},"end":{"line":76,"column":20}},"17":{"start":{"line":78,"column":8},"end":{"line":78,"column":41}},"18":{"start":{"line":79,"column":8},"end":{"line":79,"column":41}},"19":{"start":{"line":81,"column":8},"end":{"line":81,"column":32}},"20":{"start":{"line":82,"column":8},"end":{"line":82,"column":57}},"21":{"start":{"line":83,"column":8},"end":{"line":83,"column":45}},"22":{"start":{"line":85,"column":8},"end":{"line":85,"column":36}},"23":{"start":{"line":87,"column":8},"end":{"line":110,"column":9}},"24":{"start":{"line":88,"column":12},"end":{"line":88,"column":31}},"25":{"start":{"line":91,"column":13},"end":{"line":110,"column":9}},"26":{"start":{"line":92,"column":12},"end":{"line":92,"column":44}},"27":{"start":{"line":93,"column":12},"end":{"line":93,"column":54}},"28":{"start":{"line":95,"column":12},"end":{"line":98,"column":13}},"29":{"start":{"line":96,"column":16},"end":{"line":96,"column":57}},"30":{"start":{"line":97,"column":16},"end":{"line":97,"column":49}},"31":{"start":{"line":99,"column":12},"end":{"line":99,"column":34}},"32":{"start":{"line":101,"column":13},"end":{"line":110,"column":9}},"33":{"start":{"line":102,"column":12},"end":{"line":102,"column":44}},"34":{"start":{"line":103,"column":12},"end":{"line":103,"column":54}},"35":{"start":{"line":105,"column":12},"end":{"line":108,"column":13}},"36":{"start":{"line":106,"column":16},"end":{"line":106,"column":57}},"37":{"start":{"line":107,"column":16},"end":{"line":107,"column":52}},"38":{"start":{"line":109,"column":12},"end":{"line":109,"column":34}},"39":{"start":{"line":112,"column":8},"end":{"line":112,"column":47}},"40":{"start":{"line":122,"column":8},"end":{"line":142,"column":9}},"41":{"start":{"line":123,"column":12},"end":{"line":126,"column":101}},"42":{"start":{"line":128,"column":12},"end":{"line":128,"column":55}},"43":{"start":{"line":130,"column":12},"end":{"line":130,"column":74}},"44":{"start":{"line":131,"column":12},"end":{"line":131,"column":80}},"45":{"start":{"line":132,"column":12},"end":{"line":132,"column":80}},"46":{"start":{"line":133,"column":12},"end":{"line":133,"column":74}},"47":{"start":{"line":134,"column":12},"end":{"line":134,"column":76}},"48":{"start":{"line":136,"column":12},"end":{"line":136,"column":69}},"49":{"start":{"line":137,"column":12},"end":{"line":137,"column":79}},"50":{"start":{"line":139,"column":12},"end":{"line":139,"column":102}},"51":{"start":{"line":141,"column":12},"end":{"line":141,"column":46}},"52":{"start":{"line":152,"column":8},"end":{"line":152,"column":34}},"53":{"start":{"line":153,"column":8},"end":{"line":153,"column":49}},"54":{"start":{"line":163,"column":8},"end":{"line":165,"column":9}},"55":{"start":{"line":164,"column":12},"end":{"line":164,"column":38}},"56":{"start":{"line":167,"column":8},"end":{"line":167,"column":49}},"57":{"start":{"line":168,"column":8},"end":{"line":168,"column":50}},"58":{"start":{"line":170,"column":8},"end":{"line":170,"column":37}},"59":{"start":{"line":174,"column":8},"end":{"line":174,"column":61}},"60":{"start":{"line":175,"column":8},"end":{"line":175,"column":67}},"61":{"start":{"line":176,"column":8},"end":{"line":176,"column":67}},"62":{"start":{"line":177,"column":8},"end":{"line":177,"column":61}},"63":{"start":{"line":178,"column":8},"end":{"line":178,"column":63}},"64":{"start":{"line":190,"column":8},"end":{"line":190,"column":45}},"65":{"start":{"line":192,"column":8},"end":{"line":192,"column":60}},"66":{"start":{"line":193,"column":8},"end":{"line":193,"column":70}},"67":{"start":{"line":196,"column":8},"end":{"line":198,"column":9}},"68":{"start":{"line":197,"column":12},"end":{"line":197,"column":34}},"69":{"start":{"line":200,"column":8},"end":{"line":202,"column":97}},"70":{"start":{"line":204,"column":8},"end":{"line":204,"column":41}},"71":{"start":{"line":205,"column":8},"end":{"line":205,"column":41}},"72":{"start":{"line":207,"column":8},"end":{"line":209,"column":11}},"73":{"start":{"line":208,"column":12},"end":{"line":208,"column":35}},"74":{"start":{"line":211,"column":8},"end":{"line":215,"column":11}},"75":{"start":{"line":217,"column":8},"end":{"line":217,"column":50}},"76":{"start":{"line":219,"column":8},"end":{"line":222,"column":9}},"77":{"start":{"line":220,"column":12},"end":{"line":220,"column":44}},"78":{"start":{"line":221,"column":12},"end":{"line":221,"column":55}},"79":{"start":{"line":234,"column":8},"end":{"line":234,"column":33}},"80":{"start":{"line":235,"column":8},"end":{"line":235,"column":41}},"81":{"start":{"line":236,"column":8},"end":{"line":236,"column":41}},"82":{"start":{"line":238,"column":8},"end":{"line":238,"column":48}},"83":{"start":{"line":252,"column":8},"end":{"line":252,"column":83}},"84":{"start":{"line":254,"column":8},"end":{"line":256,"column":97}},"85":{"start":{"line":258,"column":8},"end":{"line":258,"column":41}},"86":{"start":{"line":259,"column":8},"end":{"line":259,"column":41}},"87":{"start":{"line":261,"column":8},"end":{"line":261,"column":50}},"88":{"start":{"line":263,"column":8},"end":{"line":265,"column":11}},"89":{"start":{"line":264,"column":12},"end":{"line":264,"column":35}},"90":{"start":{"line":267,"column":8},"end":{"line":271,"column":11}},"91":{"start":{"line":280,"column":8},"end":{"line":280,"column":57}},"92":{"start":{"line":281,"column":8},"end":{"line":281,"column":33}},"93":{"start":{"line":282,"column":8},"end":{"line":282,"column":44}},"94":{"start":{"line":283,"column":8},"end":{"line":283,"column":31}},"95":{"start":{"line":284,"column":8},"end":{"line":284,"column":36}},"96":{"start":{"line":286,"column":8},"end":{"line":286,"column":53}},"97":{"start":{"line":288,"column":8},"end":{"line":290,"column":9}},"98":{"start":{"line":289,"column":12},"end":{"line":289,"column":34}},"99":{"start":{"line":301,"column":8},"end":{"line":301,"column":51}},"100":{"start":{"line":310,"column":8},"end":{"line":310,"column":53}},"101":{"start":{"line":311,"column":8},"end":{"line":313,"column":9}},"102":{"start":{"line":312,"column":13},"end":{"line":312,"column":35}},"103":{"start":{"line":325,"column":8},"end":{"line":325,"column":32}},"104":{"start":{"line":326,"column":8},"end":{"line":331,"column":9}},"105":{"start":{"line":327,"column":12},"end":{"line":327,"column":32}},"106":{"start":{"line":328,"column":12},"end":{"line":328,"column":41}},"107":{"start":{"line":329,"column":12},"end":{"line":329,"column":37}},"108":{"start":{"line":330,"column":12},"end":{"line":330,"column":34}},"109":{"start":{"line":343,"column":12},"end":{"line":343,"column":43}},"110":{"start":{"line":354,"column":12},"end":{"line":354,"column":40}},"111":{"start":{"line":367,"column":8},"end":{"line":369,"column":16}},"112":{"start":{"line":371,"column":8},"end":{"line":401,"column":9}},"113":{"start":{"line":372,"column":12},"end":{"line":372,"column":32}},"114":{"start":{"line":374,"column":12},"end":{"line":388,"column":13}},"115":{"start":{"line":375,"column":16},"end":{"line":375,"column":53}},"116":{"start":{"line":376,"column":16},"end":{"line":376,"column":62}},"117":{"start":{"line":377,"column":16},"end":{"line":379,"column":17}},"118":{"start":{"line":378,"column":20},"end":{"line":378,"column":42}},"119":{"start":{"line":382,"column":16},"end":{"line":387,"column":17}},"120":{"start":{"line":383,"column":20},"end":{"line":386,"column":21}},"121":{"start":{"line":384,"column":24},"end":{"line":384,"column":54}},"122":{"start":{"line":385,"column":24},"end":{"line":385,"column":30}},"123":{"start":{"line":391,"column":12},"end":{"line":394,"column":13}},"124":{"start":{"line":392,"column":16},"end":{"line":392,"column":54}},"125":{"start":{"line":393,"column":16},"end":{"line":393,"column":63}},"126":{"start":{"line":396,"column":12},"end":{"line":396,"column":48}},"127":{"start":{"line":397,"column":12},"end":{"line":397,"column":35}},"128":{"start":{"line":398,"column":12},"end":{"line":398,"column":40}},"129":{"start":{"line":399,"column":12},"end":{"line":399,"column":45}},"130":{"start":{"line":400,"column":12},"end":{"line":400,"column":55}},"131":{"start":{"line":502,"column":25},"end":{"line":502,"column":55}},"132":{"start":{"line":521,"column":16},"end":{"line":526,"column":18}},"133":{"start":{"line":562,"column":16},"end":{"line":562,"column":35}},"134":{"start":{"line":563,"column":16},"end":{"line":565,"column":25}},"135":{"start":{"line":564,"column":20},"end":{"line":564,"column":57}},"136":{"start":{"line":567,"column":16},"end":{"line":567,"column":27}},"137":{"start":{"line":652,"column":0},"end":{"line":652,"column":24}},"138":{"start":{"line":653,"column":0},"end":{"line":653,"column":33}}},"branchMap":{"1":{"line":87,"type":"if","locations":[{"start":{"line":87,"column":8},"end":{"line":87,"column":8}},{"start":{"line":87,"column":8},"end":{"line":87,"column":8}}]},"2":{"line":91,"type":"if","locations":[{"start":{"line":91,"column":13},"end":{"line":91,"column":13}},{"start":{"line":91,"column":13},"end":{"line":91,"column":13}}]},"3":{"line":93,"type":"binary-expr","locations":[{"start":{"line":93,"column":22},"end":{"line":93,"column":48}},{"start":{"line":93,"column":52},"end":{"line":93,"column":53}}]},"4":{"line":95,"type":"if","locations":[{"start":{"line":95,"column":12},"end":{"line":95,"column":12}},{"start":{"line":95,"column":12},"end":{"line":95,"column":12}}]},"5":{"line":101,"type":"if","locations":[{"start":{"line":101,"column":13},"end":{"line":101,"column":13}},{"start":{"line":101,"column":13},"end":{"line":101,"column":13}}]},"6":{"line":103,"type":"binary-expr","locations":[{"start":{"line":103,"column":22},"end":{"line":103,"column":48}},{"start":{"line":103,"column":52},"end":{"line":103,"column":53}}]},"7":{"line":105,"type":"if","locations":[{"start":{"line":105,"column":12},"end":{"line":105,"column":12}},{"start":{"line":105,"column":12},"end":{"line":105,"column":12}}]},"8":{"line":122,"type":"if","locations":[{"start":{"line":122,"column":8},"end":{"line":122,"column":8}},{"start":{"line":122,"column":8},"end":{"line":122,"column":8}}]},"9":{"line":126,"type":"cond-expr","locations":[{"start":{"line":126,"column":69},"end":{"line":126,"column":87}},{"start":{"line":126,"column":90},"end":{"line":126,"column":100}}]},"10":{"line":163,"type":"if","locations":[{"start":{"line":163,"column":8},"end":{"line":163,"column":8}},{"start":{"line":163,"column":8},"end":{"line":163,"column":8}}]},"11":{"line":196,"type":"if","locations":[{"start":{"line":196,"column":8},"end":{"line":196,"column":8}},{"start":{"line":196,"column":8},"end":{"line":196,"column":8}}]},"12":{"line":196,"type":"binary-expr","locations":[{"start":{"line":196,"column":12},"end":{"line":196,"column":39}},{"start":{"line":196,"column":43},"end":{"line":196,"column":89}}]},"13":{"line":219,"type":"if","locations":[{"start":{"line":219,"column":8},"end":{"line":219,"column":8}},{"start":{"line":219,"column":8},"end":{"line":219,"column":8}}]},"14":{"line":219,"type":"binary-expr","locations":[{"start":{"line":219,"column":12},"end":{"line":219,"column":41}},{"start":{"line":219,"column":45},"end":{"line":219,"column":70}}]},"15":{"line":288,"type":"binary-expr","locations":[{"start":{"line":288,"column":15},"end":{"line":288,"column":60}},{"start":{"line":288,"column":64},"end":{"line":288,"column":91}}]},"16":{"line":326,"type":"if","locations":[{"start":{"line":326,"column":8},"end":{"line":326,"column":8}},{"start":{"line":326,"column":8},"end":{"line":326,"column":8}}]},"17":{"line":371,"type":"if","locations":[{"start":{"line":371,"column":8},"end":{"line":371,"column":8}},{"start":{"line":371,"column":8},"end":{"line":371,"column":8}}]},"18":{"line":374,"type":"if","locations":[{"start":{"line":374,"column":12},"end":{"line":374,"column":12}},{"start":{"line":374,"column":12},"end":{"line":374,"column":12}}]},"19":{"line":377,"type":"if","locations":[{"start":{"line":377,"column":16},"end":{"line":377,"column":16}},{"start":{"line":377,"column":16},"end":{"line":377,"column":16}}]},"20":{"line":383,"type":"if","locations":[{"start":{"line":383,"column":20},"end":{"line":383,"column":20}},{"start":{"line":383,"column":20},"end":{"line":383,"column":20}}]},"21":{"line":502,"type":"binary-expr","locations":[{"start":{"line":502,"column":33},"end":{"line":502,"column":41}},{"start":{"line":502,"column":45},"end":{"line":502,"column":53}}]},"22":{"line":522,"type":"binary-expr","locations":[{"start":{"line":522,"column":20},"end":{"line":522,"column":50}},{"start":{"line":523,"column":20},"end":{"line":523,"column":46}},{"start":{"line":524,"column":20},"end":{"line":524,"column":54}},{"start":{"line":525,"column":20},"end":{"line":525,"column":55}}]}},"code":["(function () { YUI.add('uploader-queue', function (Y, NAME) {","","/**","* The class manages a queue of files that should be uploaded to the server.","* It initializes the required number of uploads, tracks them as they progress,","* and automatically advances to the next upload when a preceding one has completed.","* @module uploader-queue","*/","","","","/**","* This class manages a queue of files to be uploaded to the server.","* @class Uploader.Queue","* @extends Base","* @constructor","*/","var UploaderQueue = function() {"," this.queuedFiles = [];"," this.uploadRetries = {};"," this.numberOfUploads = 0;"," this.currentUploadedByteValues = {};"," this.currentFiles = {};"," this.totalBytesUploaded = 0;"," this.totalBytes = 0;",""," UploaderQueue.superclass.constructor.apply(this, arguments);","};","","","Y.extend(UploaderQueue, Y.Base, {",""," /**"," * Stored value of the current queue state"," * @property _currentState"," * @type {String}"," * @protected"," * @default UploaderQueue.STOPPED"," */"," _currentState: UploaderQueue.STOPPED,",""," /**"," * Construction logic executed during UploaderQueue instantiation."," *"," * @method initializer"," * @protected"," */"," initializer : function () {},",""," /**"," * Handles and retransmits upload start event."," *"," * @method _uploadStartHandler"," * @param event The event dispatched during the upload process."," * @private"," */"," _uploadStartHandler : function (event) {"," var updatedEvent = event;"," updatedEvent.file = event.target;"," updatedEvent.originEvent = event;",""," this.fire(\"uploadstart\", updatedEvent);"," },",""," /**"," * Handles and retransmits upload error event."," *"," * @method _uploadErrorHandler"," * @param event The event dispatched during the upload process."," * @private"," */"," _uploadErrorHandler : function (event) {"," var errorAction = this.get(\"errorAction\"),"," updatedEvent = event,"," fileid,"," retries;",""," updatedEvent.file = event.target;"," updatedEvent.originEvent = event;",""," this.numberOfUploads-=1;"," delete this.currentFiles[event.target.get(\"id\")];"," this._detachFileEvents(event.target);",""," event.target.cancelUpload();",""," if (errorAction === UploaderQueue.STOP) {"," this.pauseUpload();"," }",""," else if (errorAction === UploaderQueue.RESTART_ASAP) {"," fileid = event.target.get(\"id\");"," retries = this.uploadRetries[fileid] || 0;",""," if (retries < this.get(\"retryCount\")) {"," this.uploadRetries[fileid] = retries + 1;"," this.addToQueueTop(event.target);"," }"," this._startNextFile();"," }"," else if (errorAction === UploaderQueue.RESTART_AFTER) {"," fileid = event.target.get(\"id\");"," retries = this.uploadRetries[fileid] || 0;",""," if (retries < this.get(\"retryCount\")) {"," this.uploadRetries[fileid] = retries + 1;"," this.addToQueueBottom(event.target);"," }"," this._startNextFile();"," }",""," this.fire(\"uploaderror\", updatedEvent);"," },",""," /**"," * Launches the upload of the next file in the queue."," *"," * @method _startNextFile"," * @private"," */"," _startNextFile : function () {"," if (this.queuedFiles.length > 0) {"," var currentFile = this.queuedFiles.shift(),"," fileId = currentFile.get(\"id\"),"," parameters = this.get(\"perFileParameters\"),"," fileParameters = parameters.hasOwnProperty(fileId) ? parameters[fileId] : parameters;",""," this.currentUploadedByteValues[fileId] = 0;",""," currentFile.on(\"uploadstart\", this._uploadStartHandler, this);"," currentFile.on(\"uploadprogress\", this._uploadProgressHandler, this);"," currentFile.on(\"uploadcomplete\", this._uploadCompleteHandler, this);"," currentFile.on(\"uploaderror\", this._uploadErrorHandler, this);"," currentFile.on(\"uploadcancel\", this._uploadCancelHandler, this);",""," currentFile.set(\"xhrHeaders\", this.get(\"uploadHeaders\"));"," currentFile.set(\"xhrWithCredentials\", this.get(\"withCredentials\"));",""," currentFile.startUpload(this.get(\"uploadURL\"), fileParameters, this.get(\"fileFieldName\"));",""," this._registerUpload(currentFile);"," }"," },",""," /**"," * Register a new upload process."," *"," * @method _registerUpload"," * @private"," */"," _registerUpload : function (file) {"," this.numberOfUploads += 1;"," this.currentFiles[file.get(\"id\")] = file;"," },",""," /**"," * Unregisters a new upload process."," *"," * @method _unregisterUpload"," * @private"," */"," _unregisterUpload : function (file) {"," if (this.numberOfUploads > 0) {"," this.numberOfUploads -= 1;"," }",""," delete this.currentFiles[file.get(\"id\")];"," delete this.uploadRetries[file.get(\"id\")];",""," this._detachFileEvents(file);"," },",""," _detachFileEvents : function (file) {"," file.detach(\"uploadstart\", this._uploadStartHandler);"," file.detach(\"uploadprogress\", this._uploadProgressHandler);"," file.detach(\"uploadcomplete\", this._uploadCompleteHandler);"," file.detach(\"uploaderror\", this._uploadErrorHandler);"," file.detach(\"uploadcancel\", this._uploadCancelHandler);"," },",""," /**"," * Handles and retransmits upload complete event."," *"," * @method _uploadCompleteHandler"," * @param event The event dispatched during the upload process."," * @private"," */"," _uploadCompleteHandler : function (event) {",""," this._unregisterUpload(event.target);",""," this.totalBytesUploaded += event.target.get(\"size\");"," delete this.currentUploadedByteValues[event.target.get(\"id\")];","",""," if (this.queuedFiles.length > 0 && this._currentState === UploaderQueue.UPLOADING) {"," this._startNextFile();"," }",""," var updatedEvent = event,"," uploadedTotal = this.totalBytesUploaded,"," percentLoaded = Math.min(100, Math.round(10000*uploadedTotal/this.totalBytes) / 100);",""," updatedEvent.file = event.target;"," updatedEvent.originEvent = event;",""," Y.each(this.currentUploadedByteValues, function (value) {"," uploadedTotal += value;"," });",""," this.fire(\"totaluploadprogress\", {"," bytesLoaded: uploadedTotal,"," bytesTotal: this.totalBytes,"," percentLoaded: percentLoaded"," });",""," this.fire(\"uploadcomplete\", updatedEvent);",""," if (this.queuedFiles.length === 0 && this.numberOfUploads <= 0) {"," this.fire(\"alluploadscomplete\");"," this._currentState = UploaderQueue.STOPPED;"," }"," },",""," /**"," * Handles and retransmits upload cancel event."," *"," * @method _uploadCancelHandler"," * @param event The event dispatched during the upload process."," * @private"," */"," _uploadCancelHandler : function (event) {",""," var updatedEvent = event;"," updatedEvent.originEvent = event;"," updatedEvent.file = event.target;",""," this.fire(\"uploadcancel\", updatedEvent);"," },","","",""," /**"," * Handles and retransmits upload progress event."," *"," * @method _uploadProgressHandler"," * @param event The event dispatched during the upload process."," * @private"," */"," _uploadProgressHandler : function (event) {",""," this.currentUploadedByteValues[event.target.get(\"id\")] = event.bytesLoaded;",""," var updatedEvent = event,"," uploadedTotal = this.totalBytesUploaded,"," percentLoaded = Math.min(100, Math.round(10000*uploadedTotal/this.totalBytes) / 100);",""," updatedEvent.originEvent = event;"," updatedEvent.file = event.target;",""," this.fire(\"uploadprogress\", updatedEvent);",""," Y.each(this.currentUploadedByteValues, function (value) {"," uploadedTotal += value;"," });",""," this.fire(\"totaluploadprogress\", {"," bytesLoaded: uploadedTotal,"," bytesTotal: this.totalBytes,"," percentLoaded: percentLoaded"," });"," },",""," /**"," * Starts uploading the queued up file list."," *"," * @method startUpload"," */"," startUpload: function() {"," this.queuedFiles = this.get(\"fileList\").slice(0);"," this.numberOfUploads = 0;"," this.currentUploadedByteValues = {};"," this.currentFiles = {};"," this.totalBytesUploaded = 0;",""," this._currentState = UploaderQueue.UPLOADING;",""," while (this.numberOfUploads < this.get(\"simUploads\") && this.queuedFiles.length > 0) {"," this._startNextFile();"," }"," },",""," /**"," * Pauses the upload process. The ongoing file uploads"," * will complete after this method is called, but no"," * new ones will be launched."," *"," * @method pauseUpload"," */"," pauseUpload: function () {"," this._currentState = UploaderQueue.STOPPED;"," },",""," /**"," * Restarts a paused upload process."," *"," * @method restartUpload"," */"," restartUpload: function () {"," this._currentState = UploaderQueue.UPLOADING;"," while (this.numberOfUploads < this.get(\"simUploads\")) {"," this._startNextFile();"," }"," },",""," /**"," * If a particular file is stuck in an ongoing upload without"," * any progress events, this method allows to force its reupload"," * by cancelling its upload and immediately relaunching it."," *"," * @method forceReupload"," * @param file {Y.File} The file to force reupload on."," */"," forceReupload : function (file) {"," var id = file.get(\"id\");"," if (this.currentFiles.hasOwnProperty(id)) {"," file.cancelUpload();"," this._unregisterUpload(file);"," this.addToQueueTop(file);"," this._startNextFile();"," }"," },",""," /**"," * Add a new file to the top of the queue (the upload will be"," * launched as soon as the current number of uploading files"," * drops below the maximum permissible value)."," *"," * @method addToQueueTop"," * @param file {Y.File} The file to add to the top of the queue."," */"," addToQueueTop: function (file) {"," this.queuedFiles.unshift(file);"," },",""," /**"," * Add a new file to the bottom of the queue (the upload will be"," * launched after all the other queued files are uploaded.)"," *"," * @method addToQueueBottom"," * @param file {Y.File} The file to add to the bottom of the queue."," */"," addToQueueBottom: function (file) {"," this.queuedFiles.push(file);"," },",""," /**"," * Cancels a specific file's upload. If no argument is passed,"," * all ongoing uploads are cancelled and the upload process is"," * stopped."," *"," * @method cancelUpload"," * @param file {Y.File} An optional parameter - the file whose upload"," * should be cancelled."," */"," cancelUpload: function (file) {"," var id,"," i,"," fid;",""," if (file) {"," id = file.get(\"id\");",""," if (this.currentFiles[id]) {"," this.currentFiles[id].cancelUpload();"," this._unregisterUpload(this.currentFiles[id]);"," if (this._currentState === UploaderQueue.UPLOADING) {"," this._startNextFile();"," }"," }"," else {"," for (i = 0, len = this.queuedFiles.length; i < len; i++) {"," if (this.queuedFiles[i].get(\"id\") === id) {"," this.queuedFiles.splice(i, 1);"," break;"," }"," }"," }"," }"," else {"," for (fid in this.currentFiles) {"," this.currentFiles[fid].cancelUpload();"," this._unregisterUpload(this.currentFiles[fid]);"," }",""," this.currentUploadedByteValues = {};"," this.currentFiles = {};"," this.totalBytesUploaded = 0;"," this.fire(\"alluploadscancelled\");"," this._currentState = UploaderQueue.STOPPED;"," }"," }","}, {"," /**"," * Static constant for the value of the `errorAction` attribute:"," * prescribes the queue to continue uploading files in case of"," * an error."," * @property CONTINUE"," * @readOnly"," * @type {String}"," * @static"," */"," CONTINUE: \"continue\",",""," /**"," * Static constant for the value of the `errorAction` attribute:"," * prescribes the queue to stop uploading files in case of"," * an error."," * @property STOP"," * @readOnly"," * @type {String}"," * @static"," */"," STOP: \"stop\",",""," /**"," * Static constant for the value of the `errorAction` attribute:"," * prescribes the queue to restart a file upload immediately in case of"," * an error."," * @property RESTART_ASAP"," * @readOnly"," * @type {String}"," * @static"," */"," RESTART_ASAP: \"restartasap\",",""," /**"," * Static constant for the value of the `errorAction` attribute:"," * prescribes the queue to restart an errored out file upload after"," * other files have finished uploading."," * @property RESTART_AFTER"," * @readOnly"," * @type {String}"," * @static"," */"," RESTART_AFTER: \"restartafter\",",""," /**"," * Static constant for the value of the `_currentState` property:"," * implies that the queue is currently not uploading files."," * @property STOPPED"," * @readOnly"," * @type {String}"," * @static"," */"," STOPPED: \"stopped\",",""," /**"," * Static constant for the value of the `_currentState` property:"," * implies that the queue is currently uploading files."," * @property UPLOADING"," * @readOnly"," * @type {String}"," * @static"," */"," UPLOADING: \"uploading\",",""," /**"," * The identity of the class."," *"," * @property NAME"," * @type String"," * @default 'uploaderqueue'"," * @readOnly"," * @protected"," * @static"," */"," NAME: 'uploaderqueue',",""," /**"," * Static property used to define the default attribute configuration of"," * the class."," *"," * @property ATTRS"," * @type {Object}"," * @protected"," * @static"," */"," ATTRS: {",""," /**"," * Maximum number of simultaneous uploads; must be in the"," * range between 1 and 5. The value of `2` is default. It"," * is recommended that this value does not exceed 3."," * @attribute simUploads"," * @type Number"," * @default 2"," */"," simUploads: {"," value: 2,"," validator: function (val) {"," return (val >= 1 && val <= 5);"," }"," },",""," /**"," * The action to take in case of error. The valid values for this attribute are:"," * `Y.Uploader.Queue.CONTINUE` (the upload process should continue on other files,"," * ignoring the error), `Y.Uploader.Queue.STOP` (the upload process"," * should stop completely), `Y.Uploader.Queue.RESTART_ASAP` (the upload"," * should restart immediately on the errored out file and continue as planned), or"," * Y.Uploader.Queue.RESTART_AFTER (the upload of the errored out file should restart"," * after all other files have uploaded)"," * @attribute errorAction"," * @type String"," * @default Y.Uploader.Queue.CONTINUE"," */"," errorAction: {"," value: \"continue\","," validator: function (val) {"," return ("," val === UploaderQueue.CONTINUE ||"," val === UploaderQueue.STOP ||"," val === UploaderQueue.RESTART_ASAP ||"," val === UploaderQueue.RESTART_AFTER"," );"," }"," },",""," /**"," * The total number of bytes that has been uploaded."," * @attribute bytesUploaded"," * @type Number"," */"," bytesUploaded: {"," readOnly: true,"," value: 0"," },",""," /**"," * The total number of bytes in the queue."," * @attribute bytesTotal"," * @type Number"," */"," bytesTotal: {"," readOnly: true,"," value: 0"," },",""," /**"," * The queue file list. This file list should only be modified"," * before the upload has been started; modifying it after starting"," * the upload has no effect, and `addToQueueTop` or `addToQueueBottom` methods"," * should be used instead."," * @attribute fileList"," * @type Array"," */"," fileList: {"," value: [],"," lazyAdd: false,"," setter: function (val) {"," var newValue = val;"," Y.Array.each(newValue, function (value) {"," this.totalBytes += value.get(\"size\");"," }, this);",""," return val;"," }"," },",""," /**"," * A String specifying what should be the POST field name for the file"," * content in the upload request."," *"," * @attribute fileFieldName"," * @type {String}"," * @default Filedata"," */"," fileFieldName: {"," value: \"Filedata\""," },",""," /**"," * The URL to POST the file upload requests to."," *"," * @attribute uploadURL"," * @type {String}"," * @default \"\""," */"," uploadURL: {"," value: \"\""," },",""," /**"," * Additional HTTP headers that should be included"," * in the upload request. Due to Flash Player security"," * restrictions, this attribute is only honored in the"," * HTML5 Uploader."," *"," * @attribute uploadHeaders"," * @type {Object}"," * @default {}"," */"," uploadHeaders: {"," value: {}"," },",""," /**"," * A Boolean that specifies whether the file should be"," * uploaded with the appropriate user credentials for the"," * domain. Due to Flash Player security restrictions, this"," * attribute is only honored in the HTML5 Uploader."," *"," * @attribute withCredentials"," * @type {Boolean}"," * @default true"," */"," withCredentials: {"," value: true"," },","",""," /**"," * An object, keyed by `fileId`, containing sets of key-value pairs"," * that should be passed as POST variables along with each corresponding"," * file."," *"," * @attribute perFileParameters"," * @type {Object}"," * @default {}"," */"," perFileParameters: {"," value: {}"," },",""," /**"," * The number of times to try re-uploading a file that failed to upload before"," * cancelling its upload."," *"," * @attribute retryCount"," * @type {Number}"," * @default 3"," */"," retryCount: {"," value: 3"," }",""," }","});","","","Y.namespace('Uploader');","Y.Uploader.Queue = UploaderQueue;","","","}, '3.13.0', {\"requires\": [\"base\"]});","","}());"]};