夏邑12345_前端

webuploader.min.js 92KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517
  1. /* WebUploader 0.1.5 */ ! function(a, b) {
  2. var c, d = {},
  3. e = function(a, b) {
  4. var c, d, e;
  5. if("string" == typeof a) return h(a);
  6. for(c = [], d = a.length, e = 0; d > e; e++) c.push(h(a[e]));
  7. return b.apply(null, c)
  8. },
  9. f = function(a, b, c) {
  10. 2 === arguments.length && (c = b, b = null), e(b || [], function() {
  11. g(a, c, arguments)
  12. })
  13. },
  14. g = function(a, b, c) {
  15. var f, g = {
  16. exports: b
  17. };
  18. "function" == typeof b && (c.length || (c = [e, g.exports, g]), f = b.apply(null, c), void 0 !== f && (g.exports = f)), d[a] = g.exports
  19. },
  20. h = function(b) {
  21. var c = d[b] || a[b];
  22. if(!c) throw new Error("`" + b + "` is undefined");
  23. return c
  24. },
  25. i = function(a) {
  26. var b, c, e, f, g, h;
  27. h = function(a) {
  28. return a && a.charAt(0).toUpperCase() + a.substr(1)
  29. };
  30. for(b in d)
  31. if(c = a, d.hasOwnProperty(b)) {
  32. for(e = b.split("/"), g = h(e.pop()); f = h(e.shift());) c[f] = c[f] || {}, c = c[f];
  33. c[g] = d[b]
  34. }
  35. return a
  36. },
  37. j = function(c) {
  38. return a.__dollar = c, i(b(a, f, e))
  39. };
  40. "object" == typeof module && "object" == typeof module.exports ? module.exports = j() : "function" == typeof define && define.amd ? define(["jquery"], j) : (c = a.WebUploader, a.WebUploader = j(), a.WebUploader.noConflict = function() {
  41. a.WebUploader = c
  42. })
  43. }(window, function(a, b, c) {
  44. return b("dollar-third", [], function() {
  45. var b = a.__dollar || a.jQuery || a.Zepto;
  46. if(!b) throw new Error("jQuery or Zepto not found!");
  47. return b
  48. }), b("dollar", ["dollar-third"], function(a) {
  49. return a
  50. }), b("promise-third", ["dollar"], function(a) {
  51. return {
  52. Deferred: a.Deferred,
  53. when: a.when,
  54. isPromise: function(a) {
  55. return a && "function" == typeof a.then
  56. }
  57. }
  58. }), b("promise", ["promise-third"], function(a) {
  59. return a
  60. }), b("base", ["dollar", "promise"], function(b, c) {
  61. function d(a) {
  62. return function() {
  63. return h.apply(a, arguments)
  64. }
  65. }
  66. function e(a, b) {
  67. return function() {
  68. return a.apply(b, arguments)
  69. }
  70. }
  71. function f(a) {
  72. var b;
  73. return Object.create ? Object.create(a) : (b = function() {}, b.prototype = a, new b)
  74. }
  75. var g = function() {},
  76. h = Function.call;
  77. return {
  78. version: "0.1.5",
  79. $: b,
  80. Deferred: c.Deferred,
  81. isPromise: c.isPromise,
  82. when: c.when,
  83. browser: function(a) {
  84. var b = {},
  85. c = a.match(/WebKit\/([\d.]+)/),
  86. d = a.match(/Chrome\/([\d.]+)/) || a.match(/CriOS\/([\d.]+)/),
  87. e = a.match(/MSIE\s([\d\.]+)/) || a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),
  88. f = a.match(/Firefox\/([\d.]+)/),
  89. g = a.match(/Safari\/([\d.]+)/),
  90. h = a.match(/OPR\/([\d.]+)/);
  91. return c && (b.webkit = parseFloat(c[1])), d && (b.chrome = parseFloat(d[1])), e && (b.ie = parseFloat(e[1])), f && (b.firefox = parseFloat(f[1])), g && (b.safari = parseFloat(g[1])), h && (b.opera = parseFloat(h[1])), b
  92. }(navigator.userAgent),
  93. os: function(a) {
  94. var b = {},
  95. c = a.match(/(?:Android);?[\s\/]+([\d.]+)?/),
  96. d = a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);
  97. return c && (b.android = parseFloat(c[1])), d && (b.ios = parseFloat(d[1].replace(/_/g, "."))), b
  98. }(navigator.userAgent),
  99. inherits: function(a, c, d) {
  100. var e;
  101. return "function" == typeof c ? (e = c, c = null) : e = c && c.hasOwnProperty("constructor") ? c.constructor : function() {
  102. return a.apply(this, arguments)
  103. }, b.extend(!0, e, a, d || {}), e.__super__ = a.prototype, e.prototype = f(a.prototype), c && b.extend(!0, e.prototype, c), e
  104. },
  105. noop: g,
  106. bindFn: e,
  107. log: function() {
  108. return a.console ? e(console.log, console) : g
  109. }(),
  110. nextTick: function() {
  111. return function(a) {
  112. setTimeout(a, 1)
  113. }
  114. }(),
  115. slice: d([].slice),
  116. guid: function() {
  117. var a = 0;
  118. return function(b) {
  119. for(var c = (+new Date).toString(32), d = 0; 5 > d; d++) c += Math.floor(65535 * Math.random()).toString(32);
  120. return(b || "wu_") + c + (a++).toString(32)
  121. }
  122. }(),
  123. formatSize: function(a, b, c) {
  124. var d;
  125. for(c = c || ["B", "K", "M", "G", "TB"];
  126. (d = c.shift()) && a > 1024;) a /= 1024;
  127. return("B" === d ? a : a.toFixed(b || 2)) + d
  128. }
  129. }
  130. }), b("mediator", ["base"], function(a) {
  131. function b(a, b, c, d) {
  132. return f.grep(a, function(a) {
  133. return !(!a || b && a.e !== b || c && a.cb !== c && a.cb._cb !== c || d && a.ctx !== d)
  134. })
  135. }
  136. function c(a, b, c) {
  137. f.each((a || "").split(h), function(a, d) {
  138. c(d, b)
  139. })
  140. }
  141. function d(a, b) {
  142. for(var c, d = !1, e = -1, f = a.length; ++e < f;)
  143. if(c = a[e], c.cb.apply(c.ctx2, b) === !1) {
  144. d = !0;
  145. break
  146. }
  147. return !d
  148. }
  149. var e, f = a.$,
  150. g = [].slice,
  151. h = /\s+/;
  152. return e = {
  153. on: function(a, b, d) {
  154. var e, f = this;
  155. return b ? (e = this._events || (this._events = []), c(a, b, function(a, b) {
  156. var c = {
  157. e: a
  158. };
  159. c.cb = b, c.ctx = d, c.ctx2 = d || f, c.id = e.length, e.push(c)
  160. }), this) : this
  161. },
  162. once: function(a, b, d) {
  163. var e = this;
  164. return b ? (c(a, b, function(a, b) {
  165. var c = function() {
  166. return e.off(a, c), b.apply(d || e, arguments)
  167. };
  168. c._cb = b, e.on(a, c, d)
  169. }), e) : e
  170. },
  171. off: function(a, d, e) {
  172. var g = this._events;
  173. return g ? a || d || e ? (c(a, d, function(a, c) {
  174. f.each(b(g, a, c, e), function() {
  175. delete g[this.id]
  176. })
  177. }), this) : (this._events = [], this) : this
  178. },
  179. trigger: function(a) {
  180. var c, e, f;
  181. return this._events && a ? (c = g.call(arguments, 1), e = b(this._events, a), f = b(this._events, "all"), d(e, c) && d(f, arguments)) : this
  182. }
  183. }, f.extend({
  184. installTo: function(a) {
  185. return f.extend(a, e)
  186. }
  187. }, e)
  188. }), b("uploader", ["base", "mediator"], function(a, b) {
  189. function c(a) {
  190. this.options = d.extend(!0, {}, c.options, a), this._init(this.options)
  191. }
  192. var d = a.$;
  193. return c.options = {}, b.installTo(c.prototype), d.each({
  194. upload: "start-upload",
  195. stop: "stop-upload",
  196. getFile: "get-file",
  197. getFiles: "get-files",
  198. addFile: "add-file",
  199. addFiles: "add-file",
  200. sort: "sort-files",
  201. removeFile: "remove-file",
  202. cancelFile: "cancel-file",
  203. skipFile: "skip-file",
  204. retry: "retry",
  205. isInProgress: "is-in-progress",
  206. makeThumb: "make-thumb",
  207. md5File: "md5-file",
  208. getDimension: "get-dimension",
  209. addButton: "add-btn",
  210. predictRuntimeType: "predict-runtime-type",
  211. refresh: "refresh",
  212. disable: "disable",
  213. enable: "enable",
  214. reset: "reset"
  215. }, function(a, b) {
  216. c.prototype[a] = function() {
  217. return this.request(b, arguments)
  218. }
  219. }), d.extend(c.prototype, {
  220. state: "pending",
  221. _init: function(a) {
  222. var b = this;
  223. b.request("init", a, function() {
  224. b.state = "ready", b.trigger("ready")
  225. })
  226. },
  227. option: function(a, b) {
  228. var c = this.options;
  229. return arguments.length > 1 ? void(d.isPlainObject(b) && d.isPlainObject(c[a]) ? d.extend(c[a], b) : c[a] = b) : a ? c[a] : c
  230. },
  231. getStats: function() {
  232. var a = this.request("get-stats");
  233. return a ? {
  234. successNum: a.numOfSuccess,
  235. progressNum: a.numOfProgress,
  236. cancelNum: a.numOfCancel,
  237. invalidNum: a.numOfInvalid,
  238. uploadFailNum: a.numOfUploadFailed,
  239. queueNum: a.numOfQueue,
  240. interruptNum: a.numofInterrupt
  241. } : {}
  242. },
  243. trigger: function(a) {
  244. var c = [].slice.call(arguments, 1),
  245. e = this.options,
  246. f = "on" + a.substring(0, 1).toUpperCase() + a.substring(1);
  247. return b.trigger.apply(this, arguments) === !1 || d.isFunction(e[f]) && e[f].apply(this, c) === !1 || d.isFunction(this[f]) && this[f].apply(this, c) === !1 || b.trigger.apply(b, [this, a].concat(c)) === !1 ? !1 : !0
  248. },
  249. destroy: function() {
  250. this.request("destroy", arguments), this.off()
  251. },
  252. request: a.noop
  253. }), a.create = c.create = function(a) {
  254. return new c(a)
  255. }, a.Uploader = c, c
  256. }), b("runtime/runtime", ["base", "mediator"], function(a, b) {
  257. function c(b) {
  258. this.options = d.extend({
  259. container: document.body
  260. }, b), this.uid = a.guid("rt_")
  261. }
  262. var d = a.$,
  263. e = {},
  264. f = function(a) {
  265. for(var b in a)
  266. if(a.hasOwnProperty(b)) return b;
  267. return null
  268. };
  269. return d.extend(c.prototype, {
  270. getContainer: function() {
  271. var a, b, c = this.options;
  272. return this._container ? this._container : (a = d(c.container || document.body), b = d(document.createElement("div")), b.attr("id", "rt_" + this.uid), b.css({
  273. position: "absolute",
  274. top: "0px",
  275. left: "0px",
  276. width: "1px",
  277. height: "1px",
  278. overflow: "hidden"
  279. }), a.append(b), a.addClass("webuploader-container"), this._container = b, this._parent = a, b)
  280. },
  281. init: a.noop,
  282. exec: a.noop,
  283. destroy: function() {
  284. this._container && this._container.remove(), this._parent && this._parent.removeClass("webuploader-container"), this.off()
  285. }
  286. }), c.orders = "html5,flash", c.addRuntime = function(a, b) {
  287. e[a] = b
  288. }, c.hasRuntime = function(a) {
  289. return !!(a ? e[a] : f(e))
  290. }, c.create = function(a, b) {
  291. var g, h;
  292. if(b = b || c.orders, d.each(b.split(/\s*,\s*/g), function() {
  293. return e[this] ? (g = this, !1) : void 0
  294. }), g = g || f(e), !g) throw new Error("Runtime Error");
  295. return h = new e[g](a)
  296. }, b.installTo(c.prototype), c
  297. }), b("runtime/client", ["base", "mediator", "runtime/runtime"], function(a, b, c) {
  298. function d(b, d) {
  299. var f, g = a.Deferred();
  300. this.uid = a.guid("client_"), this.runtimeReady = function(a) {
  301. return g.done(a)
  302. }, this.connectRuntime = function(b, h) {
  303. if(f) throw new Error("already connected!");
  304. return g.done(h), "string" == typeof b && e.get(b) && (f = e.get(b)), f = f || e.get(null, d), f ? (a.$.extend(f.options, b), f.__promise.then(g.resolve), f.__client++) : (f = c.create(b, b.runtimeOrder), f.__promise = g.promise(), f.once("ready", g.resolve), f.init(), e.add(f), f.__client = 1), d && (f.__standalone = d), f
  305. }, this.getRuntime = function() {
  306. return f
  307. }, this.disconnectRuntime = function() {
  308. f && (f.__client--, f.__client <= 0 && (e.remove(f), delete f.__promise, f.destroy()), f = null)
  309. }, this.exec = function() {
  310. if(f) {
  311. var c = a.slice(arguments);
  312. return b && c.unshift(b), f.exec.apply(this, c)
  313. }
  314. }, this.getRuid = function() {
  315. return f && f.uid
  316. }, this.destroy = function(a) {
  317. return function() {
  318. a && a.apply(this, arguments), this.trigger("destroy"), this.off(), this.exec("destroy"), this.disconnectRuntime()
  319. }
  320. }(this.destroy)
  321. }
  322. var e;
  323. return e = function() {
  324. var a = {};
  325. return {
  326. add: function(b) {
  327. a[b.uid] = b
  328. },
  329. get: function(b, c) {
  330. var d;
  331. if(b) return a[b];
  332. for(d in a)
  333. if(!c || !a[d].__standalone) return a[d];
  334. return null
  335. },
  336. remove: function(b) {
  337. delete a[b.uid]
  338. }
  339. }
  340. }(), b.installTo(d.prototype), d
  341. }), b("lib/dnd", ["base", "mediator", "runtime/client"], function(a, b, c) {
  342. function d(a) {
  343. a = this.options = e.extend({}, d.options, a), a.container = e(a.container), a.container.length && c.call(this, "DragAndDrop")
  344. }
  345. var e = a.$;
  346. return d.options = {
  347. accept: null,
  348. disableGlobalDnd: !1
  349. }, a.inherits(c, {
  350. constructor: d,
  351. init: function() {
  352. var a = this;
  353. a.connectRuntime(a.options, function() {
  354. a.exec("init"), a.trigger("ready")
  355. })
  356. }
  357. }), b.installTo(d.prototype), d
  358. }), b("widgets/widget", ["base", "uploader"], function(a, b) {
  359. function c(a) {
  360. if(!a) return !1;
  361. var b = a.length,
  362. c = e.type(a);
  363. return 1 === a.nodeType && b ? !0 : "array" === c || "function" !== c && "string" !== c && (0 === b || "number" == typeof b && b > 0 && b - 1 in a)
  364. }
  365. function d(a) {
  366. this.owner = a, this.options = a.options
  367. }
  368. var e = a.$,
  369. f = b.prototype._init,
  370. g = b.prototype.destroy,
  371. h = {},
  372. i = [];
  373. return e.extend(d.prototype, {
  374. init: a.noop,
  375. invoke: function(a, b) {
  376. var c = this.responseMap;
  377. return c && a in c && c[a] in this && e.isFunction(this[c[a]]) ? this[c[a]].apply(this, b) : h
  378. },
  379. request: function() {
  380. return this.owner.request.apply(this.owner, arguments)
  381. }
  382. }), e.extend(b.prototype, {
  383. _init: function() {
  384. var a = this,
  385. b = a._widgets = [],
  386. c = a.options.disableWidgets || "";
  387. return e.each(i, function(d, e) {
  388. (!c || !~c.indexOf(e._name)) && b.push(new e(a))
  389. }), f.apply(a, arguments)
  390. },
  391. request: function(b, d, e) {
  392. var f, g, i, j, k = 0,
  393. l = this._widgets,
  394. m = l && l.length,
  395. n = [],
  396. o = [];
  397. for(d = c(d) ? d : [d]; m > k; k++) f = l[k], g = f.invoke(b, d), g !== h && (a.isPromise(g) ? o.push(g) : n.push(g));
  398. return e || o.length ? (i = a.when.apply(a, o), j = i.pipe ? "pipe" : "then", i[j](function() {
  399. var b = a.Deferred(),
  400. c = arguments;
  401. return 1 === c.length && (c = c[0]), setTimeout(function() {
  402. b.resolve(c)
  403. }, 1), b.promise()
  404. })[e ? j : "done"](e || a.noop)) : n[0]
  405. },
  406. destroy: function() {
  407. g.apply(this, arguments), this._widgets = null
  408. }
  409. }), b.register = d.register = function(b, c) {
  410. var f, g = {
  411. init: "init",
  412. destroy: "destroy",
  413. name: "anonymous"
  414. };
  415. return 1 === arguments.length ? (c = b, e.each(c, function(a) {
  416. return "_" === a[0] || "name" === a ? void("name" === a && (g.name = c.name)) : void(g[a.replace(/[A-Z]/g, "-$&").toLowerCase()] = a)
  417. })) : g = e.extend(g, b), c.responseMap = g, f = a.inherits(d, c), f._name = g.name, i.push(f), f
  418. }, b.unRegister = d.unRegister = function(a) {
  419. if(a && "anonymous" !== a)
  420. for(var b = i.length; b--;) i[b]._name === a && i.splice(b, 1)
  421. }, d
  422. }), b("widgets/filednd", ["base", "uploader", "lib/dnd", "widgets/widget"], function(a, b, c) {
  423. var d = a.$;
  424. return b.options.dnd = "", b.register({
  425. name: "dnd",
  426. init: function(b) {
  427. if(b.dnd && "html5" === this.request("predict-runtime-type")) {
  428. var e, f = this,
  429. g = a.Deferred(),
  430. h = d.extend({}, {
  431. disableGlobalDnd: b.disableGlobalDnd,
  432. container: b.dnd,
  433. accept: b.accept
  434. });
  435. return this.dnd = e = new c(h), e.once("ready", g.resolve), e.on("drop", function(a) {
  436. f.request("add-file", [a])
  437. }), e.on("accept", function(a) {
  438. return f.owner.trigger("dndAccept", a)
  439. }), e.init(), g.promise()
  440. }
  441. },
  442. destroy: function() {
  443. this.dnd && this.dnd.destroy()
  444. }
  445. })
  446. }), b("lib/filepaste", ["base", "mediator", "runtime/client"], function(a, b, c) {
  447. function d(a) {
  448. a = this.options = e.extend({}, a), a.container = e(a.container || document.body), c.call(this, "FilePaste")
  449. }
  450. var e = a.$;
  451. return a.inherits(c, {
  452. constructor: d,
  453. init: function() {
  454. var a = this;
  455. a.connectRuntime(a.options, function() {
  456. a.exec("init"), a.trigger("ready")
  457. })
  458. }
  459. }), b.installTo(d.prototype), d
  460. }), b("widgets/filepaste", ["base", "uploader", "lib/filepaste", "widgets/widget"], function(a, b, c) {
  461. var d = a.$;
  462. return b.register({
  463. name: "paste",
  464. init: function(b) {
  465. if(b.paste && "html5" === this.request("predict-runtime-type")) {
  466. var e, f = this,
  467. g = a.Deferred(),
  468. h = d.extend({}, {
  469. container: b.paste,
  470. accept: b.accept
  471. });
  472. return this.paste = e = new c(h), e.once("ready", g.resolve), e.on("paste", function(a) {
  473. f.owner.request("add-file", [a])
  474. }), e.init(), g.promise()
  475. }
  476. },
  477. destroy: function() {
  478. this.paste && this.paste.destroy()
  479. }
  480. })
  481. }), b("lib/blob", ["base", "runtime/client"], function(a, b) {
  482. function c(a, c) {
  483. var d = this;
  484. d.source = c, d.ruid = a, this.size = c.size || 0, this.type = !c.type && this.ext && ~"jpg,jpeg,png,gif,bmp".indexOf(this.ext) ? "image/" + ("jpg" === this.ext ? "jpeg" : this.ext) : c.type || "application/octet-stream", b.call(d, "Blob"), this.uid = c.uid || this.uid, a && d.connectRuntime(a)
  485. }
  486. return a.inherits(b, {
  487. constructor: c,
  488. slice: function(a, b) {
  489. return this.exec("slice", a, b)
  490. },
  491. getSource: function() {
  492. return this.source
  493. }
  494. }), c
  495. }), b("lib/file", ["base", "lib/blob"], function(a, b) {
  496. function c(a, c) {
  497. var f;
  498. this.name = c.name || "untitled" + d++, f = e.exec(c.name) ? RegExp.$1.toLowerCase() : "", !f && c.type && (f = /\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type) ? RegExp.$1.toLowerCase() : "", this.name += "." + f), this.ext = f, this.lastModifiedDate = c.lastModifiedDate || (new Date).toLocaleString(), b.apply(this, arguments)
  499. }
  500. var d = 1,
  501. e = /\.([^.]+)$/;
  502. return a.inherits(b, c)
  503. }), b("lib/filepicker", ["base", "runtime/client", "lib/file"], function(b, c, d) {
  504. function e(a) {
  505. if(a = this.options = f.extend({}, e.options, a), a.container = f(a.id), !a.container.length) throw new Error("按钮指定错误");
  506. a.innerHTML = a.innerHTML || a.label || a.container.html() || "", a.button = f(a.button || document.createElement("div")), a.button.html(a.innerHTML), a.container.html(a.button), c.call(this, "FilePicker", !0)
  507. }
  508. var f = b.$;
  509. return e.options = {
  510. button: null,
  511. container: null,
  512. label: null,
  513. innerHTML: null,
  514. multiple: !0,
  515. accept: null,
  516. name: "file"
  517. }, b.inherits(c, {
  518. constructor: e,
  519. init: function() {
  520. var c = this,
  521. e = c.options,
  522. g = e.button;
  523. g.addClass("webuploader-pick"), c.on("all", function(a) {
  524. var b;
  525. switch(a) {
  526. case "mouseenter":
  527. g.addClass("webuploader-pick-hover");
  528. break;
  529. case "mouseleave":
  530. g.removeClass("webuploader-pick-hover");
  531. break;
  532. case "change":
  533. b = c.exec("getFiles"), c.trigger("select", f.map(b, function(a) {
  534. return a = new d(c.getRuid(), a), a._refer = e.container, a
  535. }), e.container)
  536. }
  537. }), c.connectRuntime(e, function() {
  538. c.refresh(), c.exec("init", e), c.trigger("ready")
  539. }), this._resizeHandler = b.bindFn(this.refresh, this), f(a).on("resize", this._resizeHandler)
  540. },
  541. refresh: function() {
  542. var a = this.getRuntime().getContainer(),
  543. b = this.options.button,
  544. c = b.outerWidth ? b.outerWidth() : b.width(),
  545. d = b.outerHeight ? b.outerHeight() : b.height(),
  546. e = b.offset();
  547. c && d && a.css({
  548. bottom: "auto",
  549. right: "auto",
  550. width:'65px',
  551. height:'65px'
  552. }).offset(e)
  553. },
  554. enable: function() {
  555. var a = this.options.button;
  556. a.removeClass("webuploader-pick-disable"), this.refresh()
  557. },
  558. disable: function() {
  559. var a = this.options.button;
  560. this.getRuntime().getContainer().css({
  561. top: "-99999px"
  562. }), a.addClass("webuploader-pick-disable")
  563. },
  564. destroy: function() {
  565. var b = this.options.button;
  566. f(a).off("resize", this._resizeHandler), b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")
  567. }
  568. }), e
  569. }), b("widgets/filepicker", ["base", "uploader", "lib/filepicker", "widgets/widget"], function(a, b, c) {
  570. var d = a.$;
  571. return d.extend(b.options, {
  572. pick: null,
  573. accept: null
  574. }), b.register({
  575. name: "picker",
  576. init: function(a) {
  577. return this.pickers = [], a.pick && this.addBtn(a.pick)
  578. },
  579. refresh: function() {
  580. d.each(this.pickers, function() {
  581. this.refresh()
  582. })
  583. },
  584. addBtn: function(b) {
  585. var e = this,
  586. f = e.options,
  587. g = f.accept,
  588. h = [];
  589. if(b) return d.isPlainObject(b) || (b = {
  590. id: b
  591. }), d(b.id).each(function() {
  592. var i, j, k;
  593. k = a.Deferred(), i = d.extend({}, b, {
  594. accept: d.isPlainObject(g) ? [g] : g,
  595. swf: f.swf,
  596. runtimeOrder: f.runtimeOrder,
  597. id: this
  598. }), j = new c(i), j.once("ready", k.resolve), j.on("select", function(a) {
  599. e.owner.request("add-file", [a])
  600. }), j.init(), e.pickers.push(j), h.push(k.promise())
  601. }), a.when.apply(a, h)
  602. },
  603. disable: function() {
  604. d.each(this.pickers, function() {
  605. this.disable()
  606. })
  607. },
  608. enable: function() {
  609. d.each(this.pickers, function() {
  610. this.enable()
  611. })
  612. },
  613. destroy: function() {
  614. d.each(this.pickers, function() {
  615. this.destroy()
  616. }), this.pickers = null
  617. }
  618. })
  619. }), b("lib/image", ["base", "runtime/client", "lib/blob"], function(a, b, c) {
  620. function d(a) {
  621. this.options = e.extend({}, d.options, a), b.call(this, "Image"), this.on("load", function() {
  622. this._info = this.exec("info"), this._meta = this.exec("meta")
  623. })
  624. }
  625. var e = a.$;
  626. return d.options = {
  627. quality: 90,
  628. crop: !1,
  629. preserveHeaders: !1,
  630. allowMagnify: !1
  631. }, a.inherits(b, {
  632. constructor: d,
  633. info: function(a) {
  634. return a ? (this._info = a, this) : this._info
  635. },
  636. meta: function(a) {
  637. return a ? (this._meta = a, this) : this._meta
  638. },
  639. loadFromBlob: function(a) {
  640. var b = this,
  641. c = a.getRuid();
  642. this.connectRuntime(c, function() {
  643. b.exec("init", b.options), b.exec("loadFromBlob", a)
  644. })
  645. },
  646. resize: function() {
  647. var b = a.slice(arguments);
  648. return this.exec.apply(this, ["resize"].concat(b))
  649. },
  650. crop: function() {
  651. var b = a.slice(arguments);
  652. return this.exec.apply(this, ["crop"].concat(b))
  653. },
  654. getAsDataUrl: function(a) {
  655. return this.exec("getAsDataUrl", a)
  656. },
  657. getAsBlob: function(a) {
  658. var b = this.exec("getAsBlob", a);
  659. return new c(this.getRuid(), b)
  660. }
  661. }), d
  662. }), b("widgets/image", ["base", "uploader", "lib/image", "widgets/widget"], function(a, b, c) {
  663. var d, e = a.$;
  664. return d = function(a) {
  665. var b = 0,
  666. c = [],
  667. d = function() {
  668. for(var d; c.length && a > b;) d = c.shift(), b += d[0], d[1]()
  669. };
  670. return function(a, e, f) {
  671. c.push([e, f]), a.once("destroy", function() {
  672. b -= e, setTimeout(d, 1)
  673. }), setTimeout(d, 1)
  674. }
  675. }(5242880), e.extend(b.options, {
  676. thumb: {
  677. width: 110,
  678. height: 110,
  679. quality: 70,
  680. allowMagnify: !0,
  681. crop: !0,
  682. preserveHeaders: !1,
  683. type: "image/jpeg"
  684. },
  685. compress: {
  686. width: 1600,
  687. height: 1600,
  688. quality: 90,
  689. allowMagnify: !1,
  690. crop: !1,
  691. preserveHeaders: !0
  692. }
  693. }), b.register({
  694. name: "image",
  695. makeThumb: function(a, b, f, g) {
  696. var h, i;
  697. return a = this.request("get-file", a), a.type.match(/^image/) ? (h = e.extend({}, this.options.thumb), e.isPlainObject(f) && (h = e.extend(h, f), f = null), f = f || h.width, g = g || h.height, i = new c(h), i.once("load", function() {
  698. a._info = a._info || i.info(), a._meta = a._meta || i.meta(), 1 >= f && f > 0 && (f = a._info.width * f), 1 >= g && g > 0 && (g = a._info.height * g), i.resize(f, g)
  699. }), i.once("complete", function() {
  700. b(!1, i.getAsDataUrl(h.type)), i.destroy()
  701. }), i.once("error", function(a) {
  702. b(a || !0), i.destroy()
  703. }), void d(i, a.source.size, function() {
  704. a._info && i.info(a._info), a._meta && i.meta(a._meta), i.loadFromBlob(a.source)
  705. })) : void b(!0)
  706. },
  707. beforeSendFile: function(b) {
  708. var d, f, g = this.options.compress || this.options.resize,
  709. h = g && g.compressSize || 0,
  710. i = g && g.noCompressIfLarger || !1;
  711. return b = this.request("get-file", b), !g || !~"image/jpeg,image/jpg".indexOf(b.type) || b.size < h || b._compressed ? void 0 : (g = e.extend({}, g), f = a.Deferred(), d = new c(g), f.always(function() {
  712. d.destroy(), d = null
  713. }), d.once("error", f.reject), d.once("load", function() {
  714. var a = g.width,
  715. c = g.height;
  716. b._info = b._info || d.info(), b._meta = b._meta || d.meta(), 1 >= a && a > 0 && (a = b._info.width * a), 1 >= c && c > 0 && (c = b._info.height * c), d.resize(a, c)
  717. }), d.once("complete", function() {
  718. var a, c;
  719. try {
  720. a = d.getAsBlob(g.type), c = b.size, (!i || a.size < c) && (b.source = a, b.size = a.size, b.trigger("resize", a.size, c)), b._compressed = !0, f.resolve()
  721. } catch(e) {
  722. f.resolve()
  723. }
  724. }), b._info && d.info(b._info), b._meta && d.meta(b._meta), d.loadFromBlob(b.source), f.promise())
  725. }
  726. })
  727. }), b("file", ["base", "mediator"], function(a, b) {
  728. function c() {
  729. return f + g++
  730. }
  731. function d(a) {
  732. this.name = a.name || "Untitled", this.size = a.size || 0, this.type = a.type || "application/octet-stream", this.lastModifiedDate = a.lastModifiedDate || 1 * new Date, this.id = c(), this.ext = h.exec(this.name) ? RegExp.$1 : "", this.statusText = "", i[this.id] = d.Status.INITED, this.source = a, this.loaded = 0, this.on("error", function(a) {
  733. this.setStatus(d.Status.ERROR, a)
  734. })
  735. }
  736. var e = a.$,
  737. f = "WU_FILE_",
  738. g = 0,
  739. h = /\.([^.]+)$/,
  740. i = {};
  741. return e.extend(d.prototype, {
  742. setStatus: function(a, b) {
  743. var c = i[this.id];
  744. "undefined" != typeof b && (this.statusText = b), a !== c && (i[this.id] = a, this.trigger("statuschange", a, c))
  745. },
  746. getStatus: function() {
  747. return i[this.id]
  748. },
  749. getSource: function() {
  750. return this.source
  751. },
  752. destroy: function() {
  753. this.off(), delete i[this.id]
  754. }
  755. }), b.installTo(d.prototype), d.Status = {
  756. INITED: "inited",
  757. QUEUED: "queued",
  758. PROGRESS: "progress",
  759. ERROR: "error",
  760. COMPLETE: "complete",
  761. CANCELLED: "cancelled",
  762. INTERRUPT: "interrupt",
  763. INVALID: "invalid"
  764. }, d
  765. }), b("queue", ["base", "mediator", "file"], function(a, b, c) {
  766. function d() {
  767. this.stats = {
  768. numOfQueue: 0,
  769. numOfSuccess: 0,
  770. numOfCancel: 0,
  771. numOfProgress: 0,
  772. numOfUploadFailed: 0,
  773. numOfInvalid: 0,
  774. numofDeleted: 0,
  775. numofInterrupt: 0
  776. }, this._queue = [], this._map = {}
  777. }
  778. var e = a.$,
  779. f = c.Status;
  780. return e.extend(d.prototype, {
  781. append: function(a) {
  782. return this._queue.push(a), this._fileAdded(a), this
  783. },
  784. prepend: function(a) {
  785. return this._queue.unshift(a), this._fileAdded(a), this
  786. },
  787. getFile: function(a) {
  788. return "string" != typeof a ? a : this._map[a]
  789. },
  790. fetch: function(a) {
  791. var b, c, d = this._queue.length;
  792. for(a = a || f.QUEUED, b = 0; d > b; b++)
  793. if(c = this._queue[b], a === c.getStatus()) return c;
  794. return null
  795. },
  796. sort: function(a) {
  797. "function" == typeof a && this._queue.sort(a)
  798. },
  799. getFiles: function() {
  800. for(var a, b = [].slice.call(arguments, 0), c = [], d = 0, f = this._queue.length; f > d; d++) a = this._queue[d], (!b.length || ~e.inArray(a.getStatus(), b)) && c.push(a);
  801. return c
  802. },
  803. removeFile: function(a) {
  804. var b = this._map[a.id];
  805. b && (delete this._map[a.id], a.destroy(), this.stats.numofDeleted++)
  806. },
  807. _fileAdded: function(a) {
  808. var b = this,
  809. c = this._map[a.id];
  810. c || (this._map[a.id] = a, a.on("statuschange", function(a, c) {
  811. b._onFileStatusChange(a, c)
  812. }))
  813. },
  814. _onFileStatusChange: function(a, b) {
  815. var c = this.stats;
  816. switch(b) {
  817. case f.PROGRESS:
  818. c.numOfProgress--;
  819. break;
  820. case f.QUEUED:
  821. c.numOfQueue--;
  822. break;
  823. case f.ERROR:
  824. c.numOfUploadFailed--;
  825. break;
  826. case f.INVALID:
  827. c.numOfInvalid--;
  828. break;
  829. case f.INTERRUPT:
  830. c.numofInterrupt--
  831. }
  832. switch(a) {
  833. case f.QUEUED:
  834. c.numOfQueue++;
  835. break;
  836. case f.PROGRESS:
  837. c.numOfProgress++;
  838. break;
  839. case f.ERROR:
  840. c.numOfUploadFailed++;
  841. break;
  842. case f.COMPLETE:
  843. c.numOfSuccess++;
  844. break;
  845. case f.CANCELLED:
  846. c.numOfCancel++;
  847. break;
  848. case f.INVALID:
  849. c.numOfInvalid++;
  850. break;
  851. case f.INTERRUPT:
  852. c.numofInterrupt++
  853. }
  854. }
  855. }), b.installTo(d.prototype), d
  856. }), b("widgets/queue", ["base", "uploader", "queue", "file", "lib/file", "runtime/client", "widgets/widget"], function(a, b, c, d, e, f) {
  857. var g = a.$,
  858. h = /\.\w+$/,
  859. i = d.Status;
  860. return b.register({
  861. name: "queue",
  862. init: function(b) {
  863. var d, e, h, i, j, k, l, m = this;
  864. if(g.isPlainObject(b.accept) && (b.accept = [b.accept]), b.accept) {
  865. for(j = [], h = 0, e = b.accept.length; e > h; h++) i = b.accept[h].extensions, i && j.push(i);
  866. j.length && (k = "\\." + j.join(",").replace(/,/g, "$|\\.").replace(/\*/g, ".*") + "$"), m.accept = new RegExp(k, "i")
  867. }
  868. return m.queue = new c, m.stats = m.queue.stats, "html5" === this.request("predict-runtime-type") ? (d = a.Deferred(), this.placeholder = l = new f("Placeholder"), l.connectRuntime({
  869. runtimeOrder: "html5"
  870. }, function() {
  871. m._ruid = l.getRuid(), d.resolve()
  872. }), d.promise()) : void 0
  873. },
  874. _wrapFile: function(a) {
  875. if(!(a instanceof d)) {
  876. if(!(a instanceof e)) {
  877. if(!this._ruid) throw new Error("Can't add external files.");
  878. a = new e(this._ruid, a)
  879. }
  880. a = new d(a)
  881. }
  882. return a
  883. },
  884. acceptFile: function(a) {
  885. var b = !a || !a.size || this.accept && h.exec(a.name) && !this.accept.test(a.name);
  886. return !b
  887. },
  888. _addFile: function(a) {
  889. var b = this;
  890. return a = b._wrapFile(a), b.owner.trigger("beforeFileQueued", a) ? b.acceptFile(a) ? (b.queue.append(a), b.owner.trigger("fileQueued", a), a) : void b.owner.trigger("error", "Q_TYPE_DENIED", a) : void 0
  891. },
  892. getFile: function(a) {
  893. return this.queue.getFile(a)
  894. },
  895. addFile: function(a) {
  896. var b = this;
  897. a.length || (a = [a]), a = g.map(a, function(a) {
  898. return b._addFile(a)
  899. }), b.owner.trigger("filesQueued", a), b.options.auto && setTimeout(function() {
  900. b.request("start-upload")
  901. }, 20)
  902. },
  903. getStats: function() {
  904. return this.stats
  905. },
  906. removeFile: function(a, b) {
  907. var c = this;
  908. a = a.id ? a : c.queue.getFile(a), this.request("cancel-file", a), b && this.queue.removeFile(a)
  909. },
  910. getFiles: function() {
  911. return this.queue.getFiles.apply(this.queue, arguments)
  912. },
  913. fetchFile: function() {
  914. return this.queue.fetch.apply(this.queue, arguments)
  915. },
  916. retry: function(a, b) {
  917. var c, d, e, f = this;
  918. if(a) return a = a.id ? a : f.queue.getFile(a), a.setStatus(i.QUEUED), void(b || f.request("start-upload"));
  919. for(c = f.queue.getFiles(i.ERROR), d = 0, e = c.length; e > d; d++) a = c[d], a.setStatus(i.QUEUED);
  920. f.request("start-upload")
  921. },
  922. sortFiles: function() {
  923. return this.queue.sort.apply(this.queue, arguments)
  924. },
  925. reset: function() {
  926. this.owner.trigger("reset"), this.queue = new c, this.stats = this.queue.stats
  927. },
  928. destroy: function() {
  929. this.reset(), this.placeholder && this.placeholder.destroy()
  930. }
  931. })
  932. }), b("widgets/runtime", ["uploader", "runtime/runtime", "widgets/widget"], function(a, b) {
  933. return a.support = function() {
  934. return b.hasRuntime.apply(b, arguments)
  935. }, a.register({
  936. name: "runtime",
  937. init: function() {
  938. if(!this.predictRuntimeType()) throw Error("Runtime Error")
  939. },
  940. predictRuntimeType: function() {
  941. var a, c, d = this.options.runtimeOrder || b.orders,
  942. e = this.type;
  943. if(!e)
  944. for(d = d.split(/\s*,\s*/g), a = 0, c = d.length; c > a; a++)
  945. if(b.hasRuntime(d[a])) {
  946. this.type = e = d[a];
  947. break
  948. }
  949. return e
  950. }
  951. })
  952. }), b("lib/transport", ["base", "runtime/client", "mediator"], function(a, b, c) {
  953. function d(a) {
  954. var c = this;
  955. a = c.options = e.extend(!0, {}, d.options, a || {}), b.call(this, "Transport"), this._blob = null, this._formData = a.formData || {}, this._headers = a.headers || {}, this.on("progress", this._timeout), this.on("load error", function() {
  956. c.trigger("progress", 1), clearTimeout(c._timer)
  957. })
  958. }
  959. var e = a.$;
  960. return d.options = {
  961. server: "",
  962. method: "POST",
  963. withCredentials: !1,
  964. fileVal: "file",
  965. timeout: 12e4,
  966. formData: {},
  967. headers: {},
  968. sendAsBinary: !1
  969. }, e.extend(d.prototype, {
  970. appendBlob: function(a, b, c) {
  971. var d = this,
  972. e = d.options;
  973. d.getRuid() && d.disconnectRuntime(), d.connectRuntime(b.ruid, function() {
  974. d.exec("init")
  975. }), d._blob = b, e.fileVal = a || e.fileVal, e.filename = c || e.filename
  976. },
  977. append: function(a, b) {
  978. "object" == typeof a ? e.extend(this._formData, a) : this._formData[a] = b
  979. },
  980. setRequestHeader: function(a, b) {
  981. "object" == typeof a ? e.extend(this._headers, a) : this._headers[a] = b
  982. },
  983. send: function(a) {
  984. this.exec("send", a), this._timeout()
  985. },
  986. abort: function() {
  987. return clearTimeout(this._timer), this.exec("abort")
  988. },
  989. destroy: function() {
  990. this.trigger("destroy"), this.off(), this.exec("destroy"), this.disconnectRuntime()
  991. },
  992. getResponse: function() {
  993. return this.exec("getResponse")
  994. },
  995. getResponseAsJson: function() {
  996. return this.exec("getResponseAsJson")
  997. },
  998. getStatus: function() {
  999. return this.exec("getStatus")
  1000. },
  1001. _timeout: function() {
  1002. var a = this,
  1003. b = a.options.timeout;
  1004. b && (clearTimeout(a._timer), a._timer = setTimeout(function() {
  1005. a.abort(), a.trigger("error", "timeout")
  1006. }, b))
  1007. }
  1008. }), c.installTo(d.prototype), d
  1009. }), b("widgets/upload", ["base", "uploader", "file", "lib/transport", "widgets/widget"], function(a, b, c, d) {
  1010. function e(a, b) {
  1011. var c, d, e = [],
  1012. f = a.source,
  1013. g = f.size,
  1014. h = b ? Math.ceil(g / b) : 1,
  1015. i = 0,
  1016. j = 0;
  1017. for(d = {
  1018. file: a,
  1019. has: function() {
  1020. return !!e.length
  1021. },
  1022. shift: function() {
  1023. return e.shift()
  1024. },
  1025. unshift: function(a) {
  1026. e.unshift(a)
  1027. }
  1028. }; h > j;) c = Math.min(b, g - i), e.push({
  1029. file: a,
  1030. start: i,
  1031. end: b ? i + c : g,
  1032. total: g,
  1033. chunks: h,
  1034. chunk: j++,
  1035. cuted: d
  1036. }), i += c;
  1037. return a.blocks = e.concat(), a.remaning = e.length, d
  1038. }
  1039. var f = a.$,
  1040. g = a.isPromise,
  1041. h = c.Status;
  1042. f.extend(b.options, {
  1043. prepareNextFile: !1,
  1044. chunked: !1,
  1045. chunkSize: 5242880,
  1046. chunkRetry: 2,
  1047. threads: 3,
  1048. formData: {}
  1049. }), b.register({
  1050. name: "upload",
  1051. init: function() {
  1052. var b = this.owner,
  1053. c = this;
  1054. this.runing = !1, this.progress = !1, b.on("startUpload", function() {
  1055. c.progress = !0
  1056. }).on("uploadFinished", function() {
  1057. c.progress = !1
  1058. }), this.pool = [], this.stack = [], this.pending = [], this.remaning = 0, this.__tick = a.bindFn(this._tick, this), b.on("uploadComplete", function(a) {
  1059. a.blocks && f.each(a.blocks, function(a, b) {
  1060. b.transport && (b.transport.abort(), b.transport.destroy()), delete b.transport
  1061. }), delete a.blocks, delete a.remaning
  1062. })
  1063. },
  1064. reset: function() {
  1065. this.request("stop-upload", !0), this.runing = !1, this.pool = [], this.stack = [], this.pending = [], this.remaning = 0, this._trigged = !1, this._promise = null
  1066. },
  1067. startUpload: function(b) {
  1068. var c = this;
  1069. if(f.each(c.request("get-files", h.INVALID), function() {
  1070. c.request("remove-file", this)
  1071. }), b)
  1072. if(b = b.id ? b : c.request("get-file", b), b.getStatus() === h.INTERRUPT) f.each(c.pool, function(a, c) {
  1073. c.file === b && c.transport && c.transport.send()
  1074. }), b.setStatus(h.QUEUED);
  1075. else {
  1076. if(b.getStatus() === h.PROGRESS) return;
  1077. b.setStatus(h.QUEUED)
  1078. }
  1079. else f.each(c.request("get-files", [h.INITED]), function() {
  1080. this.setStatus(h.QUEUED)
  1081. });
  1082. if(!c.runing) {
  1083. c.runing = !0;
  1084. var d = [];
  1085. f.each(c.pool, function(a, b) {
  1086. var e = b.file;
  1087. e.getStatus() === h.INTERRUPT && (d.push(e), c._trigged = !1, b.transport && b.transport.send())
  1088. });
  1089. for(var b; b = d.shift();) b.setStatus(h.PROGRESS);
  1090. b || f.each(c.request("get-files", h.INTERRUPT), function() {
  1091. this.setStatus(h.PROGRESS)
  1092. }), c._trigged = !1, a.nextTick(c.__tick), c.owner.trigger("startUpload")
  1093. }
  1094. },
  1095. stopUpload: function(b, c) {
  1096. var d = this;
  1097. if(b === !0 && (c = b, b = null), d.runing !== !1) {
  1098. if(b) {
  1099. if(b = b.id ? b : d.request("get-file", b), b.getStatus() !== h.PROGRESS && b.getStatus() !== h.QUEUED) return;
  1100. return b.setStatus(h.INTERRUPT), f.each(d.pool, function(a, c) {
  1101. c.file === b && (c.transport && c.transport.abort(), d._putback(c), d._popBlock(c))
  1102. }), a.nextTick(d.__tick)
  1103. }
  1104. d.runing = !1, this._promise && this._promise.file && this._promise.file.setStatus(h.INTERRUPT), c && f.each(d.pool, function(a, b) {
  1105. b.transport && b.transport.abort(), b.file.setStatus(h.INTERRUPT)
  1106. }), d.owner.trigger("stopUpload")
  1107. }
  1108. },
  1109. cancelFile: function(a) {
  1110. a = a.id ? a : this.request("get-file", a), a.blocks && f.each(a.blocks, function(a, b) {
  1111. var c = b.transport;
  1112. c && (c.abort(), c.destroy(), delete b.transport)
  1113. }), a.setStatus(h.CANCELLED), this.owner.trigger("fileDequeued", a)
  1114. },
  1115. isInProgress: function() {
  1116. return !!this.progress
  1117. },
  1118. _getStats: function() {
  1119. return this.request("get-stats")
  1120. },
  1121. skipFile: function(a, b) {
  1122. a = a.id ? a : this.request("get-file", a), a.setStatus(b || h.COMPLETE), a.skipped = !0, a.blocks && f.each(a.blocks, function(a, b) {
  1123. var c = b.transport;
  1124. c && (c.abort(), c.destroy(), delete b.transport)
  1125. }), this.owner.trigger("uploadSkip", a)
  1126. },
  1127. _tick: function() {
  1128. var b, c, d = this,
  1129. e = d.options;
  1130. return d._promise ? d._promise.always(d.__tick) : void(d.pool.length < e.threads && (c = d._nextBlock()) ? (d._trigged = !1, b = function(b) {
  1131. d._promise = null, b && b.file && d._startSend(b), a.nextTick(d.__tick)
  1132. }, d._promise = g(c) ? c.always(b) : b(c)) : d.remaning || d._getStats().numOfQueue || d._getStats().numofInterrupt || (d.runing = !1, d._trigged || a.nextTick(function() {
  1133. d.owner.trigger("uploadFinished")
  1134. }), d._trigged = !0))
  1135. },
  1136. _putback: function(a) {
  1137. var b;
  1138. a.cuted.unshift(a), b = this.stack.indexOf(a.cuted), ~b || this.stack.unshift(a.cuted)
  1139. },
  1140. _getStack: function() {
  1141. for(var a, b = 0; a = this.stack[b++];) {
  1142. if(a.has() && a.file.getStatus() === h.PROGRESS) return a;
  1143. (!a.has() || a.file.getStatus() !== h.PROGRESS && a.file.getStatus() !== h.INTERRUPT) && this.stack.splice(--b, 1)
  1144. }
  1145. return null
  1146. },
  1147. _nextBlock: function() {
  1148. var a, b, c, d, f = this,
  1149. h = f.options;
  1150. return(a = this._getStack()) ? (h.prepareNextFile && !f.pending.length && f._prepareNextFile(), a.shift()) : f.runing ? (!f.pending.length && f._getStats().numOfQueue && f._prepareNextFile(), b = f.pending.shift(), c = function(b) {
  1151. return b ? (a = e(b, h.chunked ? h.chunkSize : 0), f.stack.push(a), a.shift()) : null
  1152. }, g(b) ? (d = b.file, b = b[b.pipe ? "pipe" : "then"](c), b.file = d, b) : c(b)) : void 0
  1153. },
  1154. _prepareNextFile: function() {
  1155. var a, b = this,
  1156. c = b.request("fetch-file"),
  1157. d = b.pending;
  1158. c && (a = b.request("before-send-file", c, function() {
  1159. return c.getStatus() === h.PROGRESS || c.getStatus() === h.INTERRUPT ? c : b._finishFile(c)
  1160. }), b.owner.trigger("uploadStart", c), c.setStatus(h.PROGRESS), a.file = c, a.done(function() {
  1161. var b = f.inArray(a, d);
  1162. ~b && d.splice(b, 1, c)
  1163. }), a.fail(function(a) {
  1164. c.setStatus(h.ERROR, a), b.owner.trigger("uploadError", c, a), b.owner.trigger("uploadComplete", c)
  1165. }), d.push(a))
  1166. },
  1167. _popBlock: function(a) {
  1168. var b = f.inArray(a, this.pool);
  1169. this.pool.splice(b, 1), a.file.remaning--, this.remaning--
  1170. },
  1171. _startSend: function(b) {
  1172. var c, d = this,
  1173. e = b.file;
  1174. return e.getStatus() !== h.PROGRESS ? void(e.getStatus() === h.INTERRUPT && d._putback(b)) : (d.pool.push(b), d.remaning++, b.blob = 1 === b.chunks ? e.source : e.source.slice(b.start, b.end), c = d.request("before-send", b, function() {
  1175. e.getStatus() === h.PROGRESS ? d._doSend(b) : (d._popBlock(b), a.nextTick(d.__tick))
  1176. }), void c.fail(function() {
  1177. 1 === e.remaning ? d._finishFile(e).always(function() {
  1178. b.percentage = 1, d._popBlock(b), d.owner.trigger("uploadComplete", e), a.nextTick(d.__tick)
  1179. }) : (b.percentage = 1, d.updateFileProgress(e), d._popBlock(b), a.nextTick(d.__tick))
  1180. }))
  1181. },
  1182. _doSend: function(b) {
  1183. var c, e, g = this,
  1184. i = g.owner,
  1185. j = g.options,
  1186. k = b.file,
  1187. l = new d(j),
  1188. m = f.extend({}, j.formData),
  1189. n = f.extend({}, j.headers);
  1190. b.transport = l, l.on("destroy", function() {
  1191. delete b.transport, g._popBlock(b), a.nextTick(g.__tick)
  1192. }), l.on("progress", function(a) {
  1193. b.percentage = a, g.updateFileProgress(k)
  1194. }), c = function(a) {
  1195. var c;
  1196. return e = l.getResponseAsJson() || {}, e._raw = l.getResponse(), c = function(b) {
  1197. a = b
  1198. }, i.trigger("uploadAccept", b, e, c) || (a = a || "server"), a
  1199. }, l.on("error", function(a, d) {
  1200. b.retried = b.retried || 0, b.chunks > 1 && ~"http,abort".indexOf(a) && b.retried < j.chunkRetry ? (b.retried++, l.send()) : (d || "server" !== a || (a = c(a)), k.setStatus(h.ERROR, a), i.trigger("uploadError", k, a), i.trigger("uploadComplete", k))
  1201. }), l.on("load", function() {
  1202. var a;
  1203. return(a = c()) ? void l.trigger("error", a, !0) : void(1 === k.remaning ? g._finishFile(k, e) : l.destroy())
  1204. }), m = f.extend(m, {
  1205. id: k.id,
  1206. name: k.name,
  1207. type: k.type,
  1208. lastModifiedDate: k.lastModifiedDate,
  1209. size: k.size
  1210. }), b.chunks > 1 && f.extend(m, {
  1211. chunks: b.chunks,
  1212. chunk: b.chunk
  1213. }), i.trigger("uploadBeforeSend", b, m, n), l.appendBlob(j.fileVal, b.blob, k.name), l.append(m), l.setRequestHeader(n), l.send()
  1214. },
  1215. _finishFile: function(a, b, c) {
  1216. var d = this.owner;
  1217. return d.request("after-send-file", arguments, function() {
  1218. a.setStatus(h.COMPLETE), d.trigger("uploadSuccess", a, b, c)
  1219. }).fail(function(b) {
  1220. a.getStatus() === h.PROGRESS && a.setStatus(h.ERROR, b), d.trigger("uploadError", a, b)
  1221. }).always(function() {
  1222. d.trigger("uploadComplete", a)
  1223. })
  1224. },
  1225. updateFileProgress: function(a) {
  1226. var b = 0,
  1227. c = 0;
  1228. a.blocks && (f.each(a.blocks, function(a, b) {
  1229. c += (b.percentage || 0) * (b.end - b.start)
  1230. }), b = c / a.size, this.owner.trigger("uploadProgress", a, b || 0))
  1231. }
  1232. })
  1233. }), b("widgets/validator", ["base", "uploader", "file", "widgets/widget"], function(a, b, c) {
  1234. var d, e = a.$,
  1235. f = {};
  1236. return d = {
  1237. addValidator: function(a, b) {
  1238. f[a] = b
  1239. },
  1240. removeValidator: function(a) {
  1241. delete f[a]
  1242. }
  1243. }, b.register({
  1244. name: "validator",
  1245. init: function() {
  1246. var b = this;
  1247. a.nextTick(function() {
  1248. e.each(f, function() {
  1249. this.call(b.owner)
  1250. })
  1251. })
  1252. }
  1253. }), d.addValidator("fileNumLimit", function() {
  1254. var a = this,
  1255. b = a.options,
  1256. c = 0,
  1257. d = parseInt(b.fileNumLimit, 10),
  1258. e = !0;
  1259. d && (a.on("beforeFileQueued", function(a) {
  1260. return c >= d && e && (e = !1, this.trigger("error", "Q_EXCEED_NUM_LIMIT", d, a), setTimeout(function() {
  1261. e = !0
  1262. }, 1)), c >= d ? !1 : !0
  1263. }), a.on("fileQueued", function() {
  1264. c++
  1265. }), a.on("fileDequeued", function() {
  1266. c--
  1267. }), a.on("reset", function() {
  1268. c = 0
  1269. }))
  1270. }), d.addValidator("fileSizeLimit", function() {
  1271. var a = this,
  1272. b = a.options,
  1273. c = 0,
  1274. d = parseInt(b.fileSizeLimit, 10),
  1275. e = !0;
  1276. d && (a.on("beforeFileQueued", function(a) {
  1277. var b = c + a.size > d;
  1278. return b && e && (e = !1, this.trigger("error", "Q_EXCEED_SIZE_LIMIT", d, a), setTimeout(function() {
  1279. e = !0
  1280. }, 1)), b ? !1 : !0
  1281. }), a.on("fileQueued", function(a) {
  1282. c += a.size
  1283. }), a.on("fileDequeued", function(a) {
  1284. c -= a.size
  1285. }), a.on("reset", function() {
  1286. c = 0
  1287. }))
  1288. }), d.addValidator("fileSingleSizeLimit", function() {
  1289. var a = this,
  1290. b = a.options,
  1291. d = b.fileSingleSizeLimit;
  1292. d && a.on("beforeFileQueued", function(a) {
  1293. return a.size > d ? (a.setStatus(c.Status.INVALID, "exceed_size"), this.trigger("error", "F_EXCEED_SIZE", d, a), !1) : void 0
  1294. })
  1295. }), d.addValidator("duplicate", function() {
  1296. function a(a) {
  1297. for(var b, c = 0, d = 0, e = a.length; e > d; d++) b = a.charCodeAt(d), c = b + (c << 6) + (c << 16) - c;
  1298. return c
  1299. }
  1300. var b = this,
  1301. c = b.options,
  1302. d = {};
  1303. c.duplicate || (b.on("beforeFileQueued", function(b) {
  1304. var c = b.__hash || (b.__hash = a(b.name + b.size + b.lastModifiedDate));
  1305. return d[c] ? (this.trigger("error", "F_DUPLICATE", b), !1) : void 0
  1306. }), b.on("fileQueued", function(a) {
  1307. var b = a.__hash;
  1308. b && (d[b] = !0)
  1309. }), b.on("fileDequeued", function(a) {
  1310. var b = a.__hash;
  1311. b && delete d[b]
  1312. }), b.on("reset", function() {
  1313. d = {}
  1314. }))
  1315. }), d
  1316. }), b("lib/md5", ["runtime/client", "mediator"], function(a, b) {
  1317. function c() {
  1318. a.call(this, "Md5")
  1319. }
  1320. return b.installTo(c.prototype), c.prototype.loadFromBlob = function(a) {
  1321. var b = this;
  1322. b.getRuid() && b.disconnectRuntime(), b.connectRuntime(a.ruid, function() {
  1323. b.exec("init"), b.exec("loadFromBlob", a)
  1324. })
  1325. }, c.prototype.getResult = function() {
  1326. return this.exec("getResult")
  1327. }, c
  1328. }), b("widgets/md5", ["base", "uploader", "lib/md5", "lib/blob", "widgets/widget"], function(a, b, c, d) {
  1329. return b.register({
  1330. name: "md5",
  1331. md5File: function(b, e, f) {
  1332. var g = new c,
  1333. h = a.Deferred(),
  1334. i = b instanceof d ? b : this.request("get-file", b).source;
  1335. return g.on("progress load", function(a) {
  1336. a = a || {}, h.notify(a.total ? a.loaded / a.total : 1)
  1337. }), g.on("complete", function() {
  1338. h.resolve(g.getResult())
  1339. }), g.on("error", function(a) {
  1340. h.reject(a)
  1341. }), arguments.length > 1 && (e = e || 0, f = f || 0, 0 > e && (e = i.size + e), 0 > f && (f = i.size + f), f = Math.min(f, i.size), i = i.slice(e, f)), g.loadFromBlob(i), h.promise()
  1342. }
  1343. })
  1344. }), b("runtime/compbase", [], function() {
  1345. function a(a, b) {
  1346. this.owner = a, this.options = a.options, this.getRuntime = function() {
  1347. return b
  1348. }, this.getRuid = function() {
  1349. return b.uid
  1350. }, this.trigger = function() {
  1351. return a.trigger.apply(a, arguments)
  1352. }
  1353. }
  1354. return a
  1355. }), b("runtime/html5/runtime", ["base", "runtime/runtime", "runtime/compbase"], function(b, c, d) {
  1356. function e() {
  1357. var a = {},
  1358. d = this,
  1359. e = this.destroy;
  1360. c.apply(d, arguments), d.type = f, d.exec = function(c, e) {
  1361. var f, h = this,
  1362. i = h.uid,
  1363. j = b.slice(arguments, 2);
  1364. return g[c] && (f = a[i] = a[i] || new g[c](h, d), f[e]) ? f[e].apply(f, j) : void 0
  1365. }, d.destroy = function() {
  1366. return e && e.apply(this, arguments)
  1367. }
  1368. }
  1369. var f = "html5",
  1370. g = {};
  1371. return b.inherits(c, {
  1372. constructor: e,
  1373. init: function() {
  1374. var a = this;
  1375. setTimeout(function() {
  1376. a.trigger("ready")
  1377. }, 1)
  1378. }
  1379. }), e.register = function(a, c) {
  1380. var e = g[a] = b.inherits(d, c);
  1381. return e
  1382. }, a.Blob && a.FileReader && a.DataView && c.addRuntime(f, e), e
  1383. }), b("runtime/html5/blob", ["runtime/html5/runtime", "lib/blob"], function(a, b) {
  1384. return a.register("Blob", {
  1385. slice: function(a, c) {
  1386. var d = this.owner.source,
  1387. e = d.slice || d.webkitSlice || d.mozSlice;
  1388. return d = e.call(d, a, c), new b(this.getRuid(), d)
  1389. }
  1390. })
  1391. }), b("runtime/html5/dnd", ["base", "runtime/html5/runtime", "lib/file"], function(a, b, c) {
  1392. var d = a.$,
  1393. e = "webuploader-dnd-";
  1394. return b.register("DragAndDrop", {
  1395. init: function() {
  1396. var b = this.elem = this.options.container;
  1397. this.dragEnterHandler = a.bindFn(this._dragEnterHandler, this), this.dragOverHandler = a.bindFn(this._dragOverHandler, this), this.dragLeaveHandler = a.bindFn(this._dragLeaveHandler, this), this.dropHandler = a.bindFn(this._dropHandler, this), this.dndOver = !1, b.on("dragenter", this.dragEnterHandler), b.on("dragover", this.dragOverHandler), b.on("dragleave", this.dragLeaveHandler), b.on("drop", this.dropHandler), this.options.disableGlobalDnd && (d(document).on("dragover", this.dragOverHandler), d(document).on("drop", this.dropHandler))
  1398. },
  1399. _dragEnterHandler: function(a) {
  1400. var b, c = this,
  1401. d = c._denied || !1;
  1402. return a = a.originalEvent || a, c.dndOver || (c.dndOver = !0, b = a.dataTransfer.items, b && b.length && (c._denied = d = !c.trigger("accept", b)), c.elem.addClass(e + "over"), c.elem[d ? "addClass" : "removeClass"](e + "denied")), a.dataTransfer.dropEffect = d ? "none" : "copy", !1
  1403. },
  1404. _dragOverHandler: function(a) {
  1405. var b = this.elem.parent().get(0);
  1406. return b && !d.contains(b, a.currentTarget) ? !1 : (clearTimeout(this._leaveTimer), this._dragEnterHandler.call(this, a), !1)
  1407. },
  1408. _dragLeaveHandler: function() {
  1409. var a, b = this;
  1410. return a = function() {
  1411. b.dndOver = !1, b.elem.removeClass(e + "over " + e + "denied")
  1412. }, clearTimeout(b._leaveTimer), b._leaveTimer = setTimeout(a, 100), !1
  1413. },
  1414. _dropHandler: function(a) {
  1415. var b, f, g = this,
  1416. h = g.getRuid(),
  1417. i = g.elem.parent().get(0);
  1418. if(i && !d.contains(i, a.currentTarget)) return !1;
  1419. a = a.originalEvent || a, b = a.dataTransfer;
  1420. try {
  1421. f = b.getData("text/html")
  1422. } catch(j) {}
  1423. return f ? void 0 : (g._getTansferFiles(b, function(a) {
  1424. g.trigger("drop", d.map(a, function(a) {
  1425. return new c(h, a)
  1426. }))
  1427. }), g.dndOver = !1, g.elem.removeClass(e + "over"), !1)
  1428. },
  1429. _getTansferFiles: function(b, c) {
  1430. var d, e, f, g, h, i, j, k = [],
  1431. l = [];
  1432. for(d = b.items, e = b.files, j = !(!d || !d[0].webkitGetAsEntry), h = 0, i = e.length; i > h; h++) f = e[h], g = d && d[h], j && g.webkitGetAsEntry().isDirectory ? l.push(this._traverseDirectoryTree(g.webkitGetAsEntry(), k)) : k.push(f);
  1433. a.when.apply(a, l).done(function() {
  1434. k.length && c(k)
  1435. })
  1436. },
  1437. _traverseDirectoryTree: function(b, c) {
  1438. var d = a.Deferred(),
  1439. e = this;
  1440. return b.isFile ? b.file(function(a) {
  1441. c.push(a), d.resolve()
  1442. }) : b.isDirectory && b.createReader().readEntries(function(b) {
  1443. var f, g = b.length,
  1444. h = [],
  1445. i = [];
  1446. for(f = 0; g > f; f++) h.push(e._traverseDirectoryTree(b[f], i));
  1447. a.when.apply(a, h).then(function() {
  1448. c.push.apply(c, i), d.resolve()
  1449. }, d.reject)
  1450. }), d.promise()
  1451. },
  1452. destroy: function() {
  1453. var a = this.elem;
  1454. a && (a.off("dragenter", this.dragEnterHandler), a.off("dragover", this.dragOverHandler), a.off("dragleave", this.dragLeaveHandler), a.off("drop", this.dropHandler), this.options.disableGlobalDnd && (d(document).off("dragover", this.dragOverHandler), d(document).off("drop", this.dropHandler)))
  1455. }
  1456. })
  1457. }), b("runtime/html5/filepaste", ["base", "runtime/html5/runtime", "lib/file"], function(a, b, c) {
  1458. return b.register("FilePaste", {
  1459. init: function() {
  1460. var b, c, d, e, f = this.options,
  1461. g = this.elem = f.container,
  1462. h = ".*";
  1463. if(f.accept) {
  1464. for(b = [], c = 0, d = f.accept.length; d > c; c++) e = f.accept[c].mimeTypes, e && b.push(e);
  1465. b.length && (h = b.join(","), h = h.replace(/,/g, "|").replace(/\*/g, ".*"))
  1466. }
  1467. this.accept = h = new RegExp(h, "i"), this.hander = a.bindFn(this._pasteHander, this), g.on("paste", this.hander)
  1468. },
  1469. _pasteHander: function(a) {
  1470. var b, d, e, f, g, h = [],
  1471. i = this.getRuid();
  1472. for(a = a.originalEvent || a, b = a.clipboardData.items, f = 0, g = b.length; g > f; f++) d = b[f], "file" === d.kind && (e = d.getAsFile()) && h.push(new c(i, e));
  1473. h.length && (a.preventDefault(), a.stopPropagation(), this.trigger("paste", h))
  1474. },
  1475. destroy: function() {
  1476. this.elem.off("paste", this.hander)
  1477. }
  1478. })
  1479. }), b("runtime/html5/filepicker", ["base", "runtime/html5/runtime"], function(a, b) {
  1480. var c = a.$;
  1481. return b.register("FilePicker", {
  1482. init: function() {
  1483. var a, b, d, e, f = this.getRuntime().getContainer(),
  1484. g = this,
  1485. h = g.owner,
  1486. i = g.options,
  1487. j = this.label = c(document.createElement("div")),
  1488. k = this.input = c(document.createElement("input"));
  1489. if(k.attr("type", "file"), k.attr("name", i.name), k.addClass("webuploader-element-invisible"), j.on("click", function() {
  1490. k.trigger("click")
  1491. }), j.css({
  1492. opacity: 0,
  1493. width: "100%",
  1494. height: "100%",
  1495. display: "block",
  1496. cursor: "pointer",
  1497. background: "#ffffff"
  1498. }), i.multiple && k.attr("multiple", "multiple"), i.accept && i.accept.length > 0) {
  1499. for(a = [], b = 0, d = i.accept.length; d > b; b++) a.push(i.accept[b].mimeTypes);
  1500. k.attr("accept", a.join(","))
  1501. }
  1502. f.append(k), f.append(j), e = function(a) {
  1503. h.trigger(a.type)
  1504. }, k.on("change", function(a) {
  1505. var b, d = arguments.callee;
  1506. g.files = a.target.files, b = this.cloneNode(!0), b.value = null, this.parentNode.replaceChild(b, this), k.off(), k = c(b).on("change", d).on("mouseenter mouseleave", e), h.trigger("change")
  1507. }), j.on("mouseenter mouseleave", e)
  1508. },
  1509. getFiles: function() {
  1510. return this.files
  1511. },
  1512. destroy: function() {
  1513. this.input.off(), this.label.off()
  1514. }
  1515. })
  1516. }), b("runtime/html5/util", ["base"], function(b) {
  1517. var c = a.createObjectURL && a || a.URL && URL.revokeObjectURL && URL || a.webkitURL,
  1518. d = b.noop,
  1519. e = d;
  1520. return c && (d = function() {
  1521. return c.createObjectURL.apply(c, arguments)
  1522. }, e = function() {
  1523. return c.revokeObjectURL.apply(c, arguments)
  1524. }), {
  1525. createObjectURL: d,
  1526. revokeObjectURL: e,
  1527. dataURL2Blob: function(a) {
  1528. var b, c, d, e, f, g;
  1529. for(g = a.split(","), b = ~g[0].indexOf("base64") ? atob(g[1]) : decodeURIComponent(g[1]), d = new ArrayBuffer(b.length), c = new Uint8Array(d), e = 0; e < b.length; e++) c[e] = b.charCodeAt(e);
  1530. return f = g[0].split(":")[1].split(";")[0], this.arrayBufferToBlob(d, f)
  1531. },
  1532. dataURL2ArrayBuffer: function(a) {
  1533. var b, c, d, e;
  1534. for(e = a.split(","), b = ~e[0].indexOf("base64") ? atob(e[1]) : decodeURIComponent(e[1]), c = new Uint8Array(b.length), d = 0; d < b.length; d++) c[d] = b.charCodeAt(d);
  1535. return c.buffer
  1536. },
  1537. arrayBufferToBlob: function(b, c) {
  1538. var d, e = a.BlobBuilder || a.WebKitBlobBuilder;
  1539. return e ? (d = new e, d.append(b), d.getBlob(c)) : new Blob([b], c ? {
  1540. type: c
  1541. } : {})
  1542. },
  1543. canvasToDataUrl: function(a, b, c) {
  1544. return a.toDataURL(b, c / 100)
  1545. },
  1546. parseMeta: function(a, b) {
  1547. b(!1, {})
  1548. },
  1549. updateImageHead: function(a) {
  1550. return a
  1551. }
  1552. }
  1553. }), b("runtime/html5/imagemeta", ["runtime/html5/util"], function(a) {
  1554. var b;
  1555. return b = {
  1556. parsers: {
  1557. 65505: []
  1558. },
  1559. maxMetaDataSize: 262144,
  1560. parse: function(a, b) {
  1561. var c = this,
  1562. d = new FileReader;
  1563. d.onload = function() {
  1564. b(!1, c._parse(this.result)), d = d.onload = d.onerror = null
  1565. }, d.onerror = function(a) {
  1566. b(a.message), d = d.onload = d.onerror = null
  1567. }, a = a.slice(0, c.maxMetaDataSize), d.readAsArrayBuffer(a.getSource())
  1568. },
  1569. _parse: function(a, c) {
  1570. if(!(a.byteLength < 6)) {
  1571. var d, e, f, g, h = new DataView(a),
  1572. i = 2,
  1573. j = h.byteLength - 4,
  1574. k = i,
  1575. l = {};
  1576. if(65496 === h.getUint16(0)) {
  1577. for(; j > i && (d = h.getUint16(i), d >= 65504 && 65519 >= d || 65534 === d) && (e = h.getUint16(i + 2) + 2, !(i + e > h.byteLength));) {
  1578. if(f = b.parsers[d], !c && f)
  1579. for(g = 0; g < f.length; g += 1) f[g].call(b, h, i, e, l);
  1580. i += e, k = i
  1581. }
  1582. k > 6 && (l.imageHead = a.slice ? a.slice(2, k) : new Uint8Array(a).subarray(2, k))
  1583. }
  1584. return l
  1585. }
  1586. },
  1587. updateImageHead: function(a, b) {
  1588. var c, d, e, f = this._parse(a, !0);
  1589. return e = 2, f.imageHead && (e = 2 + f.imageHead.byteLength), d = a.slice ? a.slice(e) : new Uint8Array(a).subarray(e), c = new Uint8Array(b.byteLength + 2 + d.byteLength), c[0] = 255, c[1] = 216, c.set(new Uint8Array(b), 2), c.set(new Uint8Array(d), b.byteLength + 2), c.buffer
  1590. }
  1591. }, a.parseMeta = function() {
  1592. return b.parse.apply(b, arguments)
  1593. }, a.updateImageHead = function() {
  1594. return b.updateImageHead.apply(b, arguments)
  1595. }, b
  1596. }), b("runtime/html5/imagemeta/exif", ["base", "runtime/html5/imagemeta"], function(a, b) {
  1597. var c = {};
  1598. return c.ExifMap = function() {
  1599. return this
  1600. }, c.ExifMap.prototype.map = {
  1601. Orientation: 274
  1602. }, c.ExifMap.prototype.get = function(a) {
  1603. return this[a] || this[this.map[a]]
  1604. }, c.exifTagTypes = {
  1605. 1: {
  1606. getValue: function(a, b) {
  1607. return a.getUint8(b)
  1608. },
  1609. size: 1
  1610. },
  1611. 2: {
  1612. getValue: function(a, b) {
  1613. return String.fromCharCode(a.getUint8(b))
  1614. },
  1615. size: 1,
  1616. ascii: !0
  1617. },
  1618. 3: {
  1619. getValue: function(a, b, c) {
  1620. return a.getUint16(b, c)
  1621. },
  1622. size: 2
  1623. },
  1624. 4: {
  1625. getValue: function(a, b, c) {
  1626. return a.getUint32(b, c)
  1627. },
  1628. size: 4
  1629. },
  1630. 5: {
  1631. getValue: function(a, b, c) {
  1632. return a.getUint32(b, c) / a.getUint32(b + 4, c)
  1633. },
  1634. size: 8
  1635. },
  1636. 9: {
  1637. getValue: function(a, b, c) {
  1638. return a.getInt32(b, c)
  1639. },
  1640. size: 4
  1641. },
  1642. 10: {
  1643. getValue: function(a, b, c) {
  1644. return a.getInt32(b, c) / a.getInt32(b + 4, c)
  1645. },
  1646. size: 8
  1647. }
  1648. }, c.exifTagTypes[7] = c.exifTagTypes[1], c.getExifValue = function(b, d, e, f, g, h) {
  1649. var i, j, k, l, m, n, o = c.exifTagTypes[f];
  1650. if(!o) return void a.log("Invalid Exif data: Invalid tag type.");
  1651. if(i = o.size * g, j = i > 4 ? d + b.getUint32(e + 8, h) : e + 8, j + i > b.byteLength) return void a.log("Invalid Exif data: Invalid data offset.");
  1652. if(1 === g) return o.getValue(b, j, h);
  1653. for(k = [], l = 0; g > l; l += 1) k[l] = o.getValue(b, j + l * o.size, h);
  1654. if(o.ascii) {
  1655. for(m = "", l = 0; l < k.length && (n = k[l], "\x00" !== n); l += 1) m += n;
  1656. return m
  1657. }
  1658. return k
  1659. }, c.parseExifTag = function(a, b, d, e, f) {
  1660. var g = a.getUint16(d, e);
  1661. f.exif[g] = c.getExifValue(a, b, d, a.getUint16(d + 2, e), a.getUint32(d + 4, e), e)
  1662. }, c.parseExifTags = function(b, c, d, e, f) {
  1663. var g, h, i;
  1664. if(d + 6 > b.byteLength) return void a.log("Invalid Exif data: Invalid directory offset.");
  1665. if(g = b.getUint16(d, e), h = d + 2 + 12 * g, h + 4 > b.byteLength) return void a.log("Invalid Exif data: Invalid directory size.");
  1666. for(i = 0; g > i; i += 1) this.parseExifTag(b, c, d + 2 + 12 * i, e, f);
  1667. return b.getUint32(h, e)
  1668. }, c.parseExifData = function(b, d, e, f) {
  1669. var g, h, i = d + 10;
  1670. if(1165519206 === b.getUint32(d + 4)) {
  1671. if(i + 8 > b.byteLength) return void a.log("Invalid Exif data: Invalid segment size.");
  1672. if(0 !== b.getUint16(d + 8)) return void a.log("Invalid Exif data: Missing byte alignment offset.");
  1673. switch(b.getUint16(i)) {
  1674. case 18761:
  1675. g = !0;
  1676. break;
  1677. case 19789:
  1678. g = !1;
  1679. break;
  1680. default:
  1681. return void a.log("Invalid Exif data: Invalid byte alignment marker.")
  1682. }
  1683. if(42 !== b.getUint16(i + 2, g)) return void a.log("Invalid Exif data: Missing TIFF marker.");
  1684. h = b.getUint32(i + 4, g), f.exif = new c.ExifMap, h = c.parseExifTags(b, i, i + h, g, f)
  1685. }
  1686. }, b.parsers[65505].push(c.parseExifData), c
  1687. }), b("runtime/html5/jpegencoder", [], function() {
  1688. function a(a) {
  1689. function b(a) {
  1690. for(var b = [16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, 69, 56, 14, 17, 22, 29, 51, 87, 80, 62, 18, 22, 37, 56, 68, 109, 103, 77, 24, 35, 55, 64, 81, 104, 113, 92, 49, 64, 78, 87, 103, 121, 120, 101, 72, 92, 95, 98, 112, 100, 103, 99], c = 0; 64 > c; c++) {
  1691. var d = y((b[c] * a + 50) / 100);
  1692. 1 > d ? d = 1 : d > 255 && (d = 255), z[P[c]] = d
  1693. }
  1694. for(var e = [17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99, 24, 26, 56, 99, 99, 99, 99, 99, 47, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99], f = 0; 64 > f; f++) {
  1695. var g = y((e[f] * a + 50) / 100);
  1696. 1 > g ? g = 1 : g > 255 && (g = 255), A[P[f]] = g
  1697. }
  1698. for(var h = [1, 1.387039845, 1.306562965, 1.175875602, 1, .785694958, .5411961, .275899379], i = 0, j = 0; 8 > j; j++)
  1699. for(var k = 0; 8 > k; k++) B[i] = 1 / (z[P[i]] * h[j] * h[k] * 8), C[i] = 1 / (A[P[i]] * h[j] * h[k] * 8), i++
  1700. }
  1701. function c(a, b) {
  1702. for(var c = 0, d = 0, e = new Array, f = 1; 16 >= f; f++) {
  1703. for(var g = 1; g <= a[f]; g++) e[b[d]] = [], e[b[d]][0] = c, e[b[d]][1] = f, d++, c++;
  1704. c *= 2
  1705. }
  1706. return e
  1707. }
  1708. function d() {
  1709. t = c(Q, R), u = c(U, V), v = c(S, T), w = c(W, X)
  1710. }
  1711. function e() {
  1712. for(var a = 1, b = 2, c = 1; 15 >= c; c++) {
  1713. for(var d = a; b > d; d++) E[32767 + d] = c, D[32767 + d] = [], D[32767 + d][1] = c, D[32767 + d][0] = d;
  1714. for(var e = -(b - 1); - a >= e; e++) E[32767 + e] = c, D[32767 + e] = [], D[32767 + e][1] = c, D[32767 + e][0] = b - 1 + e;
  1715. a <<= 1, b <<= 1
  1716. }
  1717. }
  1718. function f() {
  1719. for(var a = 0; 256 > a; a++) O[a] = 19595 * a, O[a + 256 >> 0] = 38470 * a, O[a + 512 >> 0] = 7471 * a + 32768, O[a + 768 >> 0] = -11059 * a, O[a + 1024 >> 0] = -21709 * a, O[a + 1280 >> 0] = 32768 * a + 8421375, O[a + 1536 >> 0] = -27439 * a, O[a + 1792 >> 0] = -5329 * a
  1720. }
  1721. function g(a) {
  1722. for(var b = a[0], c = a[1] - 1; c >= 0;) b & 1 << c && (I |= 1 << J), c--, J--, 0 > J && (255 == I ? (h(255), h(0)) : h(I), J = 7, I = 0)
  1723. }
  1724. function h(a) {
  1725. H.push(N[a])
  1726. }
  1727. function i(a) {
  1728. h(a >> 8 & 255), h(255 & a)
  1729. }
  1730. function j(a, b) {
  1731. var c, d, e, f, g, h, i, j, k, l = 0,
  1732. m = 8,
  1733. n = 64;
  1734. for(k = 0; m > k; ++k) {
  1735. c = a[l], d = a[l + 1], e = a[l + 2], f = a[l + 3], g = a[l + 4], h = a[l + 5], i = a[l + 6], j = a[l + 7];
  1736. var o = c + j,
  1737. p = c - j,
  1738. q = d + i,
  1739. r = d - i,
  1740. s = e + h,
  1741. t = e - h,
  1742. u = f + g,
  1743. v = f - g,
  1744. w = o + u,
  1745. x = o - u,
  1746. y = q + s,
  1747. z = q - s;
  1748. a[l] = w + y, a[l + 4] = w - y;
  1749. var A = .707106781 * (z + x);
  1750. a[l + 2] = x + A, a[l + 6] = x - A, w = v + t, y = t + r, z = r + p;
  1751. var B = .382683433 * (w - z),
  1752. C = .5411961 * w + B,
  1753. D = 1.306562965 * z + B,
  1754. E = .707106781 * y,
  1755. G = p + E,
  1756. H = p - E;
  1757. a[l + 5] = H + C, a[l + 3] = H - C, a[l + 1] = G + D, a[l + 7] = G - D, l += 8
  1758. }
  1759. for(l = 0, k = 0; m > k; ++k) {
  1760. c = a[l], d = a[l + 8], e = a[l + 16], f = a[l + 24], g = a[l + 32], h = a[l + 40], i = a[l + 48], j = a[l + 56];
  1761. var I = c + j,
  1762. J = c - j,
  1763. K = d + i,
  1764. L = d - i,
  1765. M = e + h,
  1766. N = e - h,
  1767. O = f + g,
  1768. P = f - g,
  1769. Q = I + O,
  1770. R = I - O,
  1771. S = K + M,
  1772. T = K - M;
  1773. a[l] = Q + S, a[l + 32] = Q - S;
  1774. var U = .707106781 * (T + R);
  1775. a[l + 16] = R + U, a[l + 48] = R - U, Q = P + N, S = N + L, T = L + J;
  1776. var V = .382683433 * (Q - T),
  1777. W = .5411961 * Q + V,
  1778. X = 1.306562965 * T + V,
  1779. Y = .707106781 * S,
  1780. Z = J + Y,
  1781. $ = J - Y;
  1782. a[l + 40] = $ + W, a[l + 24] = $ - W, a[l + 8] = Z + X, a[l + 56] = Z - X, l++
  1783. }
  1784. var _;
  1785. for(k = 0; n > k; ++k) _ = a[k] * b[k], F[k] = _ > 0 ? _ + .5 | 0 : _ - .5 | 0;
  1786. return F
  1787. }
  1788. function k() {
  1789. i(65504), i(16), h(74), h(70), h(73), h(70), h(0), h(1), h(1), h(0), i(1), i(1), h(0), h(0)
  1790. }
  1791. function l(a, b) {
  1792. i(65472), i(17), h(8), i(b), i(a), h(3), h(1), h(17), h(0), h(2), h(17), h(1), h(3), h(17), h(1)
  1793. }
  1794. function m() {
  1795. i(65499), i(132), h(0);
  1796. for(var a = 0; 64 > a; a++) h(z[a]);
  1797. h(1);
  1798. for(var b = 0; 64 > b; b++) h(A[b])
  1799. }
  1800. function n() {
  1801. i(65476), i(418), h(0);
  1802. for(var a = 0; 16 > a; a++) h(Q[a + 1]);
  1803. for(var b = 0; 11 >= b; b++) h(R[b]);
  1804. h(16);
  1805. for(var c = 0; 16 > c; c++) h(S[c + 1]);
  1806. for(var d = 0; 161 >= d; d++) h(T[d]);
  1807. h(1);
  1808. for(var e = 0; 16 > e; e++) h(U[e + 1]);
  1809. for(var f = 0; 11 >= f; f++) h(V[f]);
  1810. h(17);
  1811. for(var g = 0; 16 > g; g++) h(W[g + 1]);
  1812. for(var j = 0; 161 >= j; j++) h(X[j])
  1813. }
  1814. function o() {
  1815. i(65498), i(12), h(3), h(1), h(0), h(2), h(17), h(3), h(17), h(0), h(63), h(0)
  1816. }
  1817. function p(a, b, c, d, e) {
  1818. for(var f, h = e[0], i = e[240], k = 16, l = 63, m = 64, n = j(a, b), o = 0; m > o; ++o) G[P[o]] = n[o];
  1819. var p = G[0] - c;
  1820. c = G[0], 0 == p ? g(d[0]) : (f = 32767 + p, g(d[E[f]]), g(D[f]));
  1821. for(var q = 63; q > 0 && 0 == G[q]; q--);
  1822. if(0 == q) return g(h), c;
  1823. for(var r, s = 1; q >= s;) {
  1824. for(var t = s; 0 == G[s] && q >= s; ++s);
  1825. var u = s - t;
  1826. if(u >= k) {
  1827. r = u >> 4;
  1828. for(var v = 1; r >= v; ++v) g(i);
  1829. u = 15 & u
  1830. }
  1831. f = 32767 + G[s], g(e[(u << 4) + E[f]]), g(D[f]), s++
  1832. }
  1833. return q != l && g(h), c
  1834. }
  1835. function q() {
  1836. for(var a = String.fromCharCode, b = 0; 256 > b; b++) N[b] = a(b)
  1837. }
  1838. function r(a) {
  1839. if(0 >= a && (a = 1), a > 100 && (a = 100), x != a) {
  1840. var c = 0;
  1841. c = Math.floor(50 > a ? 5e3 / a : 200 - 2 * a), b(c), x = a
  1842. }
  1843. }
  1844. function s() {
  1845. a || (a = 50), q(), d(), e(), f(), r(a)
  1846. }
  1847. var t, u, v, w, x, y = (Math.round, Math.floor),
  1848. z = new Array(64),
  1849. A = new Array(64),
  1850. B = new Array(64),
  1851. C = new Array(64),
  1852. D = new Array(65535),
  1853. E = new Array(65535),
  1854. F = new Array(64),
  1855. G = new Array(64),
  1856. H = [],
  1857. I = 0,
  1858. J = 7,
  1859. K = new Array(64),
  1860. L = new Array(64),
  1861. M = new Array(64),
  1862. N = new Array(256),
  1863. O = new Array(2048),
  1864. P = [0, 1, 5, 6, 14, 15, 27, 28, 2, 4, 7, 13, 16, 26, 29, 42, 3, 8, 12, 17, 25, 30, 41, 43, 9, 11, 18, 24, 31, 40, 44, 53, 10, 19, 23, 32, 39, 45, 52, 54, 20, 22, 33, 38, 46, 51, 55, 60, 21, 34, 37, 47, 50, 56, 59, 61, 35, 36, 48, 49, 57, 58, 62, 63],
  1865. Q = [0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
  1866. R = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
  1867. S = [0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125],
  1868. T = [1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, 50, 129, 145, 161, 8, 35, 66, 177, 193, 21, 82, 209, 240, 36, 51, 98, 114, 130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250],
  1869. U = [0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
  1870. V = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
  1871. W = [0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119],
  1872. X = [0, 1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34, 50, 129, 8, 20, 66, 145, 161, 177, 193, 9, 35, 51, 82, 240, 21, 98, 114, 209, 10, 22, 36, 52, 225, 37, 241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 130, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 226, 227, 228, 229, 230, 231, 232, 233, 234, 242, 243, 244, 245, 246, 247, 248, 249, 250];
  1873. this.encode = function(a, b) {
  1874. b && r(b), H = new Array, I = 0, J = 7, i(65496), k(), m(), l(a.width, a.height), n(), o();
  1875. var c = 0,
  1876. d = 0,
  1877. e = 0;
  1878. I = 0, J = 7, this.encode.displayName = "_encode_";
  1879. for(var f, h, j, q, s, x, y, z, A, D = a.data, E = a.width, F = a.height, G = 4 * E, N = 0; F > N;) {
  1880. for(f = 0; G > f;) {
  1881. for(s = G * N + f, x = s, y = -1, z = 0, A = 0; 64 > A; A++) z = A >> 3, y = 4 * (7 & A), x = s + z * G + y, N + z >= F && (x -= G * (N + 1 + z - F)), f + y >= G && (x -= f + y - G + 4), h = D[x++], j = D[x++], q = D[x++], K[A] = (O[h] + O[j + 256 >> 0] + O[q + 512 >> 0] >> 16) - 128, L[A] = (O[h + 768 >> 0] + O[j + 1024 >> 0] + O[q + 1280 >> 0] >> 16) - 128, M[A] = (O[h + 1280 >> 0] + O[j + 1536 >> 0] + O[q + 1792 >> 0] >> 16) - 128;
  1882. c = p(K, B, c, t, v), d = p(L, C, d, u, w), e = p(M, C, e, u, w), f += 32
  1883. }
  1884. N += 8
  1885. }
  1886. if(J >= 0) {
  1887. var P = [];
  1888. P[1] = J + 1, P[0] = (1 << J + 1) - 1, g(P)
  1889. }
  1890. i(65497);
  1891. var Q = "data:image/jpeg;base64," + btoa(H.join(""));
  1892. return H = [], Q
  1893. }, s()
  1894. }
  1895. return a.encode = function(b, c) {
  1896. var d = new a(c);
  1897. return d.encode(b)
  1898. }, a
  1899. }), b("runtime/html5/androidpatch", ["runtime/html5/util", "runtime/html5/jpegencoder", "base"], function(a, b, c) {
  1900. var d, e = a.canvasToDataUrl;
  1901. a.canvasToDataUrl = function(a, f, g) {
  1902. var h, i, j, k, l;
  1903. return c.os.android ? ("image/jpeg" === f && "undefined" == typeof d && (k = e.apply(null, arguments), l = k.split(","), k = ~l[0].indexOf("base64") ? atob(l[1]) : decodeURIComponent(l[1]), k = k.substring(0, 2), d = 255 === k.charCodeAt(0) && 216 === k.charCodeAt(1)), "image/jpeg" !== f || d ? e.apply(null, arguments) : (i = a.width, j = a.height, h = a.getContext("2d"), b.encode(h.getImageData(0, 0, i, j), g))) : e.apply(null, arguments)
  1904. }
  1905. }), b("runtime/html5/image", ["base", "runtime/html5/runtime", "runtime/html5/util"], function(a, b, c) {
  1906. var d = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D";
  1907. return b.register("Image", {
  1908. modified: !1,
  1909. init: function() {
  1910. var a = this,
  1911. b = new Image;
  1912. b.onload = function() {
  1913. a._info = {
  1914. type: a.type,
  1915. width: this.width,
  1916. height: this.height
  1917. }, a._metas || "image/jpeg" !== a.type ? a.owner.trigger("load") : c.parseMeta(a._blob, function(b, c) {
  1918. a._metas = c, a.owner.trigger("load")
  1919. })
  1920. }, b.onerror = function() {
  1921. a.owner.trigger("error")
  1922. }, a._img = b
  1923. },
  1924. loadFromBlob: function(a) {
  1925. var b = this,
  1926. d = b._img;
  1927. b._blob = a, b.type = a.type, d.src = c.createObjectURL(a.getSource()), b.owner.once("load", function() {
  1928. c.revokeObjectURL(d.src)
  1929. })
  1930. },
  1931. resize: function(a, b) {
  1932. var c = this._canvas || (this._canvas = document.createElement("canvas"));
  1933. this._resize(this._img, c, a, b), this._blob = null, this.modified = !0, this.owner.trigger("complete", "resize")
  1934. },
  1935. crop: function(a, b, c, d, e) {
  1936. var f = this._canvas || (this._canvas = document.createElement("canvas")),
  1937. g = this.options,
  1938. h = this._img,
  1939. i = h.naturalWidth,
  1940. j = h.naturalHeight,
  1941. k = this.getOrientation();
  1942. e = e || 1, f.width = c, f.height = d, g.preserveHeaders || this._rotate2Orientaion(f, k), this._renderImageToCanvas(f, h, -a, -b, i * e, j * e), this._blob = null, this.modified = !0, this.owner.trigger("complete", "crop")
  1943. },
  1944. getAsBlob: function(a) {
  1945. var b, d = this._blob,
  1946. e = this.options;
  1947. if(a = a || this.type, this.modified || this.type !== a) {
  1948. if(b = this._canvas, "image/jpeg" === a) {
  1949. if(d = c.canvasToDataUrl(b, a, e.quality), e.preserveHeaders && this._metas && this._metas.imageHead) return d = c.dataURL2ArrayBuffer(d), d = c.updateImageHead(d, this._metas.imageHead), d = c.arrayBufferToBlob(d, a)
  1950. } else d = c.canvasToDataUrl(b, a);
  1951. d = c.dataURL2Blob(d)
  1952. }
  1953. return d
  1954. },
  1955. getAsDataUrl: function(a) {
  1956. var b = this.options;
  1957. return a = a || this.type, "image/jpeg" === a ? c.canvasToDataUrl(this._canvas, a, b.quality) : this._canvas.toDataURL(a)
  1958. },
  1959. getOrientation: function() {
  1960. return this._metas && this._metas.exif && this._metas.exif.get("Orientation") || 1
  1961. },
  1962. info: function(a) {
  1963. return a ? (this._info = a, this) : this._info
  1964. },
  1965. meta: function(a) {
  1966. return a ? (this._meta = a, this) : this._meta
  1967. },
  1968. destroy: function() {
  1969. var a = this._canvas;
  1970. this._img.onload = null, a && (a.getContext("2d").clearRect(0, 0, a.width, a.height), a.width = a.height = 0, this._canvas = null), this._img.src = d, this._img = this._blob = null
  1971. },
  1972. _resize: function(a, b, c, d) {
  1973. var e, f, g, h, i, j = this.options,
  1974. k = a.width,
  1975. l = a.height,
  1976. m = this.getOrientation();
  1977. ~[5, 6, 7, 8].indexOf(m) && (c ^= d, d ^= c, c ^= d), e = Math[j.crop ? "max" : "min"](c / k, d / l), j.allowMagnify || (e = Math.min(1, e)), f = k * e, g = l * e, j.crop ? (b.width = c, b.height = d) : (b.width = f, b.height = g), h = (b.width - f) / 2, i = (b.height - g) / 2, j.preserveHeaders || this._rotate2Orientaion(b, m), this._renderImageToCanvas(b, a, h, i, f, g)
  1978. },
  1979. _rotate2Orientaion: function(a, b) {
  1980. var c = a.width,
  1981. d = a.height,
  1982. e = a.getContext("2d");
  1983. switch(b) {
  1984. case 5:
  1985. case 6:
  1986. case 7:
  1987. case 8:
  1988. a.width = d, a.height = c
  1989. }
  1990. switch(b) {
  1991. case 2:
  1992. e.translate(c, 0), e.scale(-1, 1);
  1993. break;
  1994. case 3:
  1995. e.translate(c, d), e.rotate(Math.PI);
  1996. break;
  1997. case 4:
  1998. e.translate(0, d), e.scale(1, -1);
  1999. break;
  2000. case 5:
  2001. e.rotate(.5 * Math.PI), e.scale(1, -1);
  2002. break;
  2003. case 6:
  2004. e.rotate(.5 * Math.PI), e.translate(0, -d);
  2005. break;
  2006. case 7:
  2007. e.rotate(.5 * Math.PI), e.translate(c, -d), e.scale(-1, 1);
  2008. break;
  2009. case 8:
  2010. e.rotate(-.5 * Math.PI), e.translate(-c, 0)
  2011. }
  2012. },
  2013. _renderImageToCanvas: function() {
  2014. function b(a, b, c) {
  2015. var d, e, f, g = document.createElement("canvas"),
  2016. h = g.getContext("2d"),
  2017. i = 0,
  2018. j = c,
  2019. k = c;
  2020. for(g.width = 1, g.height = c, h.drawImage(a, 0, 0), d = h.getImageData(0, 0, 1, c).data; k > i;) e = d[4 * (k - 1) + 3], 0 === e ? j = k : i = k, k = j + i >> 1;
  2021. return f = k / c, 0 === f ? 1 : f
  2022. }
  2023. function c(a) {
  2024. var b, c, d = a.naturalWidth,
  2025. e = a.naturalHeight;
  2026. return d * e > 1048576 ? (b = document.createElement("canvas"), b.width = b.height = 1, c = b.getContext("2d"), c.drawImage(a, -d + 1, 0), 0 === c.getImageData(0, 0, 1, 1).data[3]) : !1
  2027. }
  2028. return a.os.ios ? a.os.ios >= 7 ? function(a, c, d, e, f, g) {
  2029. var h = c.naturalWidth,
  2030. i = c.naturalHeight,
  2031. j = b(c, h, i);
  2032. return a.getContext("2d").drawImage(c, 0, 0, h * j, i * j, d, e, f, g)
  2033. } : function(a, d, e, f, g, h) {
  2034. var i, j, k, l, m, n, o, p = d.naturalWidth,
  2035. q = d.naturalHeight,
  2036. r = a.getContext("2d"),
  2037. s = c(d),
  2038. t = "image/jpeg" === this.type,
  2039. u = 1024,
  2040. v = 0,
  2041. w = 0;
  2042. for(s && (p /= 2, q /= 2), r.save(), i = document.createElement("canvas"), i.width = i.height = u, j = i.getContext("2d"), k = t ? b(d, p, q) : 1, l = Math.ceil(u * g / p), m = Math.ceil(u * h / q / k); q > v;) {
  2043. for(n = 0, o = 0; p > n;) j.clearRect(0, 0, u, u), j.drawImage(d, -n, -v), r.drawImage(i, 0, 0, u, u, e + o, f + w, l, m), n += u, o += l;
  2044. v += u, w += m
  2045. }
  2046. r.restore(), i = j = null
  2047. } : function(b) {
  2048. var c = a.slice(arguments, 1),
  2049. d = b.getContext("2d");
  2050. d.drawImage.apply(d, c)
  2051. }
  2052. }()
  2053. })
  2054. }), b("runtime/html5/transport", ["base", "runtime/html5/runtime"], function(a, b) {
  2055. var c = a.noop,
  2056. d = a.$;
  2057. return b.register("Transport", {
  2058. init: function() {
  2059. this._status = 0, this._response = null
  2060. },
  2061. send: function() {
  2062. var b, c, e, f = this.owner,
  2063. g = this.options,
  2064. h = this._initAjax(),
  2065. i = f._blob,
  2066. j = g.server;
  2067. g.sendAsBinary ? (j += (/\?/.test(j) ? "&" : "?") + d.param(f._formData), c = i.getSource()) : (b = new FormData, d.each(f._formData, function(a, c) {
  2068. b.append(a, c)
  2069. }), b.append(g.fileVal, i.getSource(), g.filename || f._formData.name || "")), g.withCredentials && "withCredentials" in h ? (h.open(g.method, j, !0), h.withCredentials = !0) : h.open(g.method, j), this._setRequestHeader(h, g.headers), c ? (h.overrideMimeType && h.overrideMimeType("application/octet-stream"), a.os.android ? (e = new FileReader, e.onload = function() {
  2070. h.send(this.result), e = e.onload = null
  2071. }, e.readAsArrayBuffer(c)) : h.send(c)) : h.send(b)
  2072. },
  2073. getResponse: function() {
  2074. return this._response
  2075. },
  2076. getResponseAsJson: function() {
  2077. return this._parseJson(this._response)
  2078. },
  2079. getStatus: function() {
  2080. return this._status
  2081. },
  2082. abort: function() {
  2083. var a = this._xhr;
  2084. a && (a.upload.onprogress = c, a.onreadystatechange = c, a.abort(), this._xhr = a = null)
  2085. },
  2086. destroy: function() {
  2087. this.abort()
  2088. },
  2089. _initAjax: function() {
  2090. var a = this,
  2091. b = new XMLHttpRequest,
  2092. d = this.options;
  2093. return !d.withCredentials || "withCredentials" in b || "undefined" == typeof XDomainRequest || (b = new XDomainRequest), b.upload.onprogress = function(b) {
  2094. var c = 0;
  2095. return b.lengthComputable && (c = b.loaded / b.total), a.trigger("progress", c)
  2096. }, b.onreadystatechange = function() {
  2097. return 4 === b.readyState ? (b.upload.onprogress = c, b.onreadystatechange = c, a._xhr = null, a._status = b.status, b.status >= 200 && b.status < 300 ? (a._response = b.responseText, a.trigger("load")) : b.status >= 500 && b.status < 600 ? (a._response = b.responseText, a.trigger("error", "server")) : a.trigger("error", a._status ? "http" : "abort")) : void 0
  2098. }, a._xhr = b, b
  2099. },
  2100. _setRequestHeader: function(a, b) {
  2101. d.each(b, function(b, c) {
  2102. a.setRequestHeader(b, c)
  2103. })
  2104. },
  2105. _parseJson: function(a) {
  2106. var b;
  2107. try {
  2108. b = JSON.parse(a)
  2109. } catch(c) {
  2110. b = {}
  2111. }
  2112. return b
  2113. }
  2114. })
  2115. }), b("runtime/html5/md5", ["runtime/html5/runtime"], function(a) {
  2116. var b = function(a, b) {
  2117. return a + b & 4294967295
  2118. },
  2119. c = function(a, c, d, e, f, g) {
  2120. return c = b(b(c, a), b(e, g)), b(c << f | c >>> 32 - f, d)
  2121. },
  2122. d = function(a, b, d, e, f, g, h) {
  2123. return c(b & d | ~b & e, a, b, f, g, h)
  2124. },
  2125. e = function(a, b, d, e, f, g, h) {
  2126. return c(b & e | d & ~e, a, b, f, g, h)
  2127. },
  2128. f = function(a, b, d, e, f, g, h) {
  2129. return c(b ^ d ^ e, a, b, f, g, h)
  2130. },
  2131. g = function(a, b, d, e, f, g, h) {
  2132. return c(d ^ (b | ~e), a, b, f, g, h)
  2133. },
  2134. h = function(a, c) {
  2135. var h = a[0],
  2136. i = a[1],
  2137. j = a[2],
  2138. k = a[3];
  2139. h = d(h, i, j, k, c[0], 7, -680876936), k = d(k, h, i, j, c[1], 12, -389564586), j = d(j, k, h, i, c[2], 17, 606105819), i = d(i, j, k, h, c[3], 22, -1044525330), h = d(h, i, j, k, c[4], 7, -176418897), k = d(k, h, i, j, c[5], 12, 1200080426), j = d(j, k, h, i, c[6], 17, -1473231341), i = d(i, j, k, h, c[7], 22, -45705983), h = d(h, i, j, k, c[8], 7, 1770035416), k = d(k, h, i, j, c[9], 12, -1958414417), j = d(j, k, h, i, c[10], 17, -42063), i = d(i, j, k, h, c[11], 22, -1990404162), h = d(h, i, j, k, c[12], 7, 1804603682), k = d(k, h, i, j, c[13], 12, -40341101), j = d(j, k, h, i, c[14], 17, -1502002290), i = d(i, j, k, h, c[15], 22, 1236535329), h = e(h, i, j, k, c[1], 5, -165796510), k = e(k, h, i, j, c[6], 9, -1069501632), j = e(j, k, h, i, c[11], 14, 643717713), i = e(i, j, k, h, c[0], 20, -373897302), h = e(h, i, j, k, c[5], 5, -701558691), k = e(k, h, i, j, c[10], 9, 38016083), j = e(j, k, h, i, c[15], 14, -660478335), i = e(i, j, k, h, c[4], 20, -405537848), h = e(h, i, j, k, c[9], 5, 568446438), k = e(k, h, i, j, c[14], 9, -1019803690), j = e(j, k, h, i, c[3], 14, -187363961), i = e(i, j, k, h, c[8], 20, 1163531501), h = e(h, i, j, k, c[13], 5, -1444681467), k = e(k, h, i, j, c[2], 9, -51403784), j = e(j, k, h, i, c[7], 14, 1735328473), i = e(i, j, k, h, c[12], 20, -1926607734), h = f(h, i, j, k, c[5], 4, -378558), k = f(k, h, i, j, c[8], 11, -2022574463), j = f(j, k, h, i, c[11], 16, 1839030562), i = f(i, j, k, h, c[14], 23, -35309556), h = f(h, i, j, k, c[1], 4, -1530992060), k = f(k, h, i, j, c[4], 11, 1272893353), j = f(j, k, h, i, c[7], 16, -155497632), i = f(i, j, k, h, c[10], 23, -1094730640), h = f(h, i, j, k, c[13], 4, 681279174), k = f(k, h, i, j, c[0], 11, -358537222), j = f(j, k, h, i, c[3], 16, -722521979), i = f(i, j, k, h, c[6], 23, 76029189), h = f(h, i, j, k, c[9], 4, -640364487), k = f(k, h, i, j, c[12], 11, -421815835), j = f(j, k, h, i, c[15], 16, 530742520), i = f(i, j, k, h, c[2], 23, -995338651), h = g(h, i, j, k, c[0], 6, -198630844), k = g(k, h, i, j, c[7], 10, 1126891415), j = g(j, k, h, i, c[14], 15, -1416354905), i = g(i, j, k, h, c[5], 21, -57434055), h = g(h, i, j, k, c[12], 6, 1700485571), k = g(k, h, i, j, c[3], 10, -1894986606), j = g(j, k, h, i, c[10], 15, -1051523), i = g(i, j, k, h, c[1], 21, -2054922799), h = g(h, i, j, k, c[8], 6, 1873313359), k = g(k, h, i, j, c[15], 10, -30611744), j = g(j, k, h, i, c[6], 15, -1560198380), i = g(i, j, k, h, c[13], 21, 1309151649), h = g(h, i, j, k, c[4], 6, -145523070), k = g(k, h, i, j, c[11], 10, -1120210379), j = g(j, k, h, i, c[2], 15, 718787259), i = g(i, j, k, h, c[9], 21, -343485551), a[0] = b(h, a[0]), a[1] = b(i, a[1]), a[2] = b(j, a[2]), a[3] = b(k, a[3])
  2140. },
  2141. i = function(a) {
  2142. var b, c = [];
  2143. for(b = 0; 64 > b; b += 4) c[b >> 2] = a.charCodeAt(b) + (a.charCodeAt(b + 1) << 8) + (a.charCodeAt(b + 2) << 16) + (a.charCodeAt(b + 3) << 24);
  2144. return c
  2145. },
  2146. j = function(a) {
  2147. var b, c = [];
  2148. for(b = 0; 64 > b; b += 4) c[b >> 2] = a[b] + (a[b + 1] << 8) + (a[b + 2] << 16) + (a[b + 3] << 24);
  2149. return c
  2150. },
  2151. k = function(a) {
  2152. var b, c, d, e, f, g, j = a.length,
  2153. k = [1732584193, -271733879, -1732584194, 271733878];
  2154. for(b = 64; j >= b; b += 64) h(k, i(a.substring(b - 64, b)));
  2155. for(a = a.substring(b - 64), c = a.length, d = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], b = 0; c > b; b += 1) d[b >> 2] |= a.charCodeAt(b) << (b % 4 << 3);
  2156. if(d[b >> 2] |= 128 << (b % 4 << 3), b > 55)
  2157. for(h(k, d), b = 0; 16 > b; b += 1) d[b] = 0;
  2158. return e = 8 * j, e = e.toString(16).match(/(.*?)(.{0,8})$/), f = parseInt(e[2], 16), g = parseInt(e[1], 16) || 0, d[14] = f, d[15] = g, h(k, d), k
  2159. },
  2160. l = function(a) {
  2161. var b, c, d, e, f, g, i = a.length,
  2162. k = [1732584193, -271733879, -1732584194, 271733878];
  2163. for(b = 64; i >= b; b += 64) h(k, j(a.subarray(b - 64, b)));
  2164. for(a = i > b - 64 ? a.subarray(b - 64) : new Uint8Array(0), c = a.length, d = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], b = 0; c > b; b += 1) d[b >> 2] |= a[b] << (b % 4 << 3);
  2165. if(d[b >> 2] |= 128 << (b % 4 << 3), b > 55)
  2166. for(h(k, d), b = 0; 16 > b; b += 1) d[b] = 0;
  2167. return e = 8 * i, e = e.toString(16).match(/(.*?)(.{0,8})$/), f = parseInt(e[2], 16), g = parseInt(e[1], 16) || 0, d[14] = f, d[15] = g, h(k, d), k
  2168. },
  2169. m = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"],
  2170. n = function(a) {
  2171. var b, c = "";
  2172. for(b = 0; 4 > b; b += 1) c += m[a >> 8 * b + 4 & 15] + m[a >> 8 * b & 15];
  2173. return c
  2174. },
  2175. o = function(a) {
  2176. var b;
  2177. for(b = 0; b < a.length; b += 1) a[b] = n(a[b]);
  2178. return a.join("")
  2179. },
  2180. p = function(a) {
  2181. return o(k(a))
  2182. },
  2183. q = function() {
  2184. this.reset()
  2185. };
  2186. return "5d41402abc4b2a76b9719d911017c592" !== p("hello") && (b = function(a, b) {
  2187. var c = (65535 & a) + (65535 & b),
  2188. d = (a >> 16) + (b >> 16) + (c >> 16);
  2189. return d << 16 | 65535 & c
  2190. }), q.prototype.append = function(a) {
  2191. return /[\u0080-\uFFFF]/.test(a) && (a = unescape(encodeURIComponent(a))), this.appendBinary(a), this
  2192. }, q.prototype.appendBinary = function(a) {
  2193. this._buff += a, this._length += a.length;
  2194. var b, c = this._buff.length;
  2195. for(b = 64; c >= b; b += 64) h(this._state, i(this._buff.substring(b - 64, b)));
  2196. return this._buff = this._buff.substr(b - 64), this
  2197. }, q.prototype.end = function(a) {
  2198. var b, c, d = this._buff,
  2199. e = d.length,
  2200. f = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  2201. for(b = 0; e > b; b += 1) f[b >> 2] |= d.charCodeAt(b) << (b % 4 << 3);
  2202. return this._finish(f, e), c = a ? this._state : o(this._state), this.reset(), c
  2203. }, q.prototype._finish = function(a, b) {
  2204. var c, d, e, f = b;
  2205. if(a[f >> 2] |= 128 << (f % 4 << 3), f > 55)
  2206. for(h(this._state, a), f = 0; 16 > f; f += 1) a[f] = 0;
  2207. c = 8 * this._length, c = c.toString(16).match(/(.*?)(.{0,8})$/), d = parseInt(c[2], 16), e = parseInt(c[1], 16) || 0, a[14] = d, a[15] = e, h(this._state, a)
  2208. }, q.prototype.reset = function() {
  2209. return this._buff = "", this._length = 0, this._state = [1732584193, -271733879, -1732584194, 271733878], this
  2210. }, q.prototype.destroy = function() {
  2211. delete this._state, delete this._buff, delete this._length
  2212. }, q.hash = function(a, b) {
  2213. /[\u0080-\uFFFF]/.test(a) && (a = unescape(encodeURIComponent(a)));
  2214. var c = k(a);
  2215. return b ? c : o(c)
  2216. }, q.hashBinary = function(a, b) {
  2217. var c = k(a);
  2218. return b ? c : o(c)
  2219. }, q.ArrayBuffer = function() {
  2220. this.reset()
  2221. }, q.ArrayBuffer.prototype.append = function(a) {
  2222. var b, c = this._concatArrayBuffer(this._buff, a),
  2223. d = c.length;
  2224. for(this._length += a.byteLength, b = 64; d >= b; b += 64) h(this._state, j(c.subarray(b - 64, b)));
  2225. return this._buff = d > b - 64 ? c.subarray(b - 64) : new Uint8Array(0), this
  2226. }, q.ArrayBuffer.prototype.end = function(a) {
  2227. var b, c, d = this._buff,
  2228. e = d.length,
  2229. f = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  2230. for(b = 0; e > b; b += 1) f[b >> 2] |= d[b] << (b % 4 << 3);
  2231. return this._finish(f, e), c = a ? this._state : o(this._state), this.reset(), c
  2232. }, q.ArrayBuffer.prototype._finish = q.prototype._finish, q.ArrayBuffer.prototype.reset = function() {
  2233. return this._buff = new Uint8Array(0), this._length = 0, this._state = [1732584193, -271733879, -1732584194, 271733878], this
  2234. }, q.ArrayBuffer.prototype.destroy = q.prototype.destroy, q.ArrayBuffer.prototype._concatArrayBuffer = function(a, b) {
  2235. var c = a.length,
  2236. d = new Uint8Array(c + b.byteLength);
  2237. return d.set(a), d.set(new Uint8Array(b), c), d
  2238. }, q.ArrayBuffer.hash = function(a, b) {
  2239. var c = l(new Uint8Array(a));
  2240. return b ? c : o(c)
  2241. }, a.register("Md5", {
  2242. init: function() {},
  2243. loadFromBlob: function(a) {
  2244. var b, c, d = a.getSource(),
  2245. e = 2097152,
  2246. f = Math.ceil(d.size / e),
  2247. g = 0,
  2248. h = this.owner,
  2249. i = new q.ArrayBuffer,
  2250. j = this,
  2251. k = d.mozSlice || d.webkitSlice || d.slice;
  2252. c = new FileReader, (b = function() {
  2253. var l, m;
  2254. l = g * e, m = Math.min(l + e, d.size), c.onload = function(b) {
  2255. i.append(b.target.result), h.trigger("progress", {
  2256. total: a.size,
  2257. loaded: m
  2258. })
  2259. }, c.onloadend = function() {
  2260. c.onloadend = c.onload = null, ++g < f ? setTimeout(b, 1) : setTimeout(function() {
  2261. h.trigger("load"), j.result = i.end(), b = a = d = i = null, h.trigger("complete")
  2262. }, 50)
  2263. }, c.readAsArrayBuffer(k.call(d, l, m))
  2264. })()
  2265. },
  2266. getResult: function() {
  2267. return this.result
  2268. }
  2269. })
  2270. }), b("runtime/flash/runtime", ["base", "runtime/runtime", "runtime/compbase"], function(b, c, d) {
  2271. function e() {
  2272. var a;
  2273. try {
  2274. a = navigator.plugins["Shockwave Flash"], a = a.description
  2275. } catch(b) {
  2276. try {
  2277. a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")
  2278. } catch(c) {
  2279. a = "0.0"
  2280. }
  2281. }
  2282. return a = a.match(/\d+/g), parseFloat(a[0] + "." + a[1], 10)
  2283. }
  2284. function f() {
  2285. function d(a, b) {
  2286. var c, d, e = a.type || a;
  2287. c = e.split("::"), d = c[0], e = c[1], "Ready" === e && d === j.uid ? j.trigger("ready") : f[d] && f[d].trigger(e.toLowerCase(), a, b)
  2288. }
  2289. var e = {},
  2290. f = {},
  2291. g = this.destroy,
  2292. j = this,
  2293. k = b.guid("webuploader_");
  2294. c.apply(j, arguments), j.type = h, j.exec = function(a, c) {
  2295. var d, g = this,
  2296. h = g.uid,
  2297. k = b.slice(arguments, 2);
  2298. return f[h] = g, i[a] && (e[h] || (e[h] = new i[a](g, j)), d = e[h], d[c]) ? d[c].apply(d, k) : j.flashExec.apply(g, arguments)
  2299. }, a[k] = function() {
  2300. var a = arguments;
  2301. setTimeout(function() {
  2302. d.apply(null, a)
  2303. }, 1)
  2304. }, this.jsreciver = k, this.destroy = function() {
  2305. return g && g.apply(this, arguments)
  2306. }, this.flashExec = function(a, c) {
  2307. var d = j.getFlash(),
  2308. e = b.slice(arguments, 2);
  2309. return d.exec(this.uid, a, c, e)
  2310. }
  2311. }
  2312. var g = b.$,
  2313. h = "flash",
  2314. i = {};
  2315. return b.inherits(c, {
  2316. constructor: f,
  2317. init: function() {
  2318. var a, c = this.getContainer(),
  2319. d = this.options;
  2320. c.css({
  2321. position: "absolute",
  2322. top: "-8px",
  2323. left: "-8px",
  2324. width: "9px",
  2325. height: "9px",
  2326. overflow: "hidden"
  2327. }), a = '<object id="' + this.uid + '" type="application/x-shockwave-flash" data="' + d.swf + '" ', b.browser.ie && (a += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '), a += 'width="100%" height="100%" style="outline:0"><param name="movie" value="' + d.swf + '" /><param name="flashvars" value="uid=' + this.uid + "&jsreciver=" + this.jsreciver + '" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>', c.html(a)
  2328. },
  2329. getFlash: function() {
  2330. return this._flash ? this._flash : (this._flash = g("#" + this.uid).get(0), this._flash)
  2331. }
  2332. }), f.register = function(a, c) {
  2333. return c = i[a] = b.inherits(d, g.extend({
  2334. flashExec: function() {
  2335. var a = this.owner,
  2336. b = this.getRuntime();
  2337. return b.flashExec.apply(a, arguments)
  2338. }
  2339. }, c))
  2340. }, e() >= 11.4 && c.addRuntime(h, f), f
  2341. }), b("runtime/flash/filepicker", ["base", "runtime/flash/runtime"], function(a, b) {
  2342. var c = a.$;
  2343. return b.register("FilePicker", {
  2344. init: function(a) {
  2345. var b, d, e = c.extend({}, a);
  2346. for(b = e.accept && e.accept.length, d = 0; b > d; d++) e.accept[d].title || (e.accept[d].title = "Files");
  2347. delete e.button, delete e.id, delete e.container, this.flashExec("FilePicker", "init", e)
  2348. },
  2349. destroy: function() {
  2350. this.flashExec("FilePicker", "destroy")
  2351. }
  2352. })
  2353. }), b("runtime/flash/image", ["runtime/flash/runtime"], function(a) {
  2354. return a.register("Image", {
  2355. loadFromBlob: function(a) {
  2356. var b = this.owner;
  2357. b.info() && this.flashExec("Image", "info", b.info()), b.meta() && this.flashExec("Image", "meta", b.meta()), this.flashExec("Image", "loadFromBlob", a.uid)
  2358. }
  2359. })
  2360. }), b("runtime/flash/transport", ["base", "runtime/flash/runtime", "runtime/client"], function(b, c, d) {
  2361. var e = b.$;
  2362. return c.register("Transport", {
  2363. init: function() {
  2364. this._status = 0, this._response = null, this._responseJson = null
  2365. },
  2366. send: function() {
  2367. var a, b = this.owner,
  2368. c = this.options,
  2369. d = this._initAjax(),
  2370. f = b._blob,
  2371. g = c.server;
  2372. d.connectRuntime(f.ruid), c.sendAsBinary ? (g += (/\?/.test(g) ? "&" : "?") + e.param(b._formData), a = f.uid) : (e.each(b._formData, function(a, b) {
  2373. d.exec("append", a, b)
  2374. }), d.exec("appendBlob", c.fileVal, f.uid, c.filename || b._formData.name || "")), this._setRequestHeader(d, c.headers), d.exec("send", {
  2375. method: c.method,
  2376. url: g,
  2377. forceURLStream: c.forceURLStream,
  2378. mimeType: "application/octet-stream"
  2379. }, a)
  2380. },
  2381. getStatus: function() {
  2382. return this._status
  2383. },
  2384. getResponse: function() {
  2385. return this._response || ""
  2386. },
  2387. getResponseAsJson: function() {
  2388. return this._responseJson
  2389. },
  2390. abort: function() {
  2391. var a = this._xhr;
  2392. a && (a.exec("abort"), a.destroy(), this._xhr = a = null)
  2393. },
  2394. destroy: function() {
  2395. this.abort()
  2396. },
  2397. _initAjax: function() {
  2398. var b = this,
  2399. c = new d("XMLHttpRequest");
  2400. return c.on("uploadprogress progress", function(a) {
  2401. var c = a.loaded / a.total;
  2402. return c = Math.min(1, Math.max(0, c)), b.trigger("progress", c)
  2403. }), c.on("load", function() {
  2404. var d, e = c.exec("getStatus"),
  2405. f = !1,
  2406. g = "";
  2407. return c.off(), b._xhr = null, e >= 200 && 300 > e ? f = !0 : e >= 500 && 600 > e ? (f = !0, g = "server") : g = "http", f && (b._response = c.exec("getResponse"), b._response = decodeURIComponent(b._response), d = a.JSON && a.JSON.parse || function(a) {
  2408. try {
  2409. return new Function("return " + a).call()
  2410. } catch(b) {
  2411. return {}
  2412. }
  2413. }, b._responseJson = b._response ? d(b._response) : {}), c.destroy(), c = null, g ? b.trigger("error", g) : b.trigger("load")
  2414. }), c.on("error", function() {
  2415. c.off(), b._xhr = null, b.trigger("error", "http")
  2416. }), b._xhr = c, c
  2417. },
  2418. _setRequestHeader: function(a, b) {
  2419. e.each(b, function(b, c) {
  2420. a.exec("setRequestHeader", b, c)
  2421. })
  2422. }
  2423. })
  2424. }), b("runtime/flash/blob", ["runtime/flash/runtime", "lib/blob"], function(a, b) {
  2425. return a.register("Blob", {
  2426. slice: function(a, c) {
  2427. var d = this.flashExec("Blob", "slice", a, c);
  2428. return new b(d.uid, d)
  2429. }
  2430. })
  2431. }), b("runtime/flash/md5", ["runtime/flash/runtime"], function(a) {
  2432. return a.register("Md5", {
  2433. init: function() {},
  2434. loadFromBlob: function(a) {
  2435. return this.flashExec("Md5", "loadFromBlob", a.uid)
  2436. }
  2437. })
  2438. }), b("preset/all", ["base", "widgets/filednd", "widgets/filepaste", "widgets/filepicker", "widgets/image", "widgets/queue", "widgets/runtime", "widgets/upload", "widgets/validator", "widgets/md5", "runtime/html5/blob", "runtime/html5/dnd", "runtime/html5/filepaste", "runtime/html5/filepicker", "runtime/html5/imagemeta/exif", "runtime/html5/androidpatch", "runtime/html5/image", "runtime/html5/transport", "runtime/html5/md5", "runtime/flash/filepicker", "runtime/flash/image", "runtime/flash/transport", "runtime/flash/blob", "runtime/flash/md5"], function(a) {
  2439. return a
  2440. }), b("widgets/log", ["base", "uploader", "widgets/widget"], function(a, b) {
  2441. function c(a) {
  2442. var b = e.extend({}, d, a),
  2443. c = f.replace(/^(.*)\?/, "$1" + e.param(b)),
  2444. g = new Image;
  2445. g.src = c
  2446. }
  2447. var d, e = a.$,
  2448. f = " http://static.tieba.baidu.com/tb/pms/img/st.gif??",
  2449. g = (location.hostname || location.host || "protected").toLowerCase(),
  2450. h = g && /baidu/i.exec(g);
  2451. if(h) return d = {
  2452. dv: 3,
  2453. master: "webuploader",
  2454. online: /test/.exec(g) ? 0 : 1,
  2455. module: "",
  2456. product: g,
  2457. type: 0
  2458. }, b.register({
  2459. name: "log",
  2460. init: function() {
  2461. var a = this.owner,
  2462. b = 0,
  2463. d = 0;
  2464. a.on("error", function(a) {
  2465. c({
  2466. type: 2,
  2467. c_error_code: a
  2468. })
  2469. }).on("uploadError", function(a, b) {
  2470. c({
  2471. type: 2,
  2472. c_error_code: "UPLOAD_ERROR",
  2473. c_reason: "" + b
  2474. })
  2475. }).on("uploadComplete", function(a) {
  2476. b++, d += a.size
  2477. }).on("uploadFinished", function() {
  2478. c({
  2479. c_count: b,
  2480. c_size: d
  2481. }), b = d = 0
  2482. }), c({
  2483. c_usage: 1
  2484. })
  2485. }
  2486. })
  2487. }), b("webuploader", ["preset/all", "widgets/log"], function(a) {
  2488. return a
  2489. }), c("webuploader")
  2490. });