bfg-common 1.5.600 → 1.5.601

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,70 +1,70 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("stream")):"function"==typeof define&&define.amd?define(["stream"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).JMuxer=t(e.stream)}(this,(function(e){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(t){var i=o(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return c(e)}(this,r)}}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,i,a=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);s=!0);}catch(e){o=!0,i=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw i}}return a}(e,t)||h(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=h(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw a}}}}var p,v;function m(e){if(p){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];p.apply(void 0,[e].concat(r))}}function k(e){if(v){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];v.apply(void 0,[e].concat(r))}}var g=function(){function e(t){r(this,e),this.payload=t,this.nri=(96&this.payload[0])>>5,this.ntype=31&this.payload[0],this.isvcl=1==this.ntype||5==this.ntype,this.stype="",this.isfmb=!1}return i(e,[{key:"toString",value:function(){return"".concat(e.type(this),": NRI: ").concat(this.getNri())}},{key:"getNri",value:function(){return this.nri}},{key:"type",value:function(){return this.ntype}},{key:"isKeyframe",value:function(){return this.ntype===e.IDR}},{key:"getPayload",value:function(){return this.payload}},{key:"getPayloadSize",value:function(){return this.payload.byteLength}},{key:"getSize",value:function(){return 4+this.getPayloadSize()}},{key:"getData",value:function(){var e=new Uint8Array(this.getSize());return new DataView(e.buffer).setUint32(0,this.getSize()-4),e.set(this.getPayload(),4),e}}],[{key:"NDR",get:function(){return 1}},{key:"IDR",get:function(){return 5}},{key:"SEI",get:function(){return 6}},{key:"SPS",get:function(){return 7}},{key:"PPS",get:function(){return 8}},{key:"AUD",get:function(){return 9}},{key:"TYPES",get:function(){var t;return a(t={},e.IDR,"IDR"),a(t,e.SEI,"SEI"),a(t,e.SPS,"SPS"),a(t,e.PPS,"PPS"),a(t,e.NDR,"NDR"),a(t,e.AUD,"AUD"),t}},{key:"type",value:function(t){return t.ntype in e.TYPES?e.TYPES[t.ntype]:"UNKNOWN"}}]),e}();function b(e,t){var r=new Uint8Array((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}var S=function(){function e(t){r(this,e),this.data=t,this.index=0,this.bitLength=8*t.byteLength}return i(e,[{key:"setData",value:function(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}},{key:"bitsAvailable",get:function(){return this.bitLength-this.index}},{key:"skipBits",value:function(e){if(this.bitsAvailable<e)return!1;this.index+=e}},{key:"readBits",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}},{key:"getBits",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable<e)return 0;var n=t%8,i=this.data[t/8|0]&255>>>n,a=8-n;if(a>=e)return r&&(this.index+=e),i>>a-e;r&&(this.index+=a);var s=e-a;return i<<s|this.getBits(s,t+a,r)}},{key:"skipLZ",value:function(){var e;for(e=0;e<this.bitLength-this.index;++e)if(0!==this.getBits(1,this.index+e,!1))return this.index+=e,e;return e}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}}]),e}(),w=function(){function e(t){r(this,e),this.remuxer=t,this.track=t.mp4track}return i(e,[{key:"parseSPS",value:function(t){var r=e.readSPS(new Uint8Array(t));this.track.fps=r.fps,this.track.width=r.width,this.track.height=r.height,this.track.sps=[new Uint8Array(t)],this.track.codec="avc1.";for(var n=new DataView(t.buffer,t.byteOffset+1,4),i=0;i<3;++i){var a=n.getUint8(i).toString(16);a.length<2&&(a="0"+a),this.track.codec+=a}}},{key:"parsePPS",value:function(e){this.track.pps=[new Uint8Array(e)]}},{key:"parseNAL",value:function(e){if(!e)return!1;var t=!1;switch(e.type()){case g.IDR:case g.NDR:t=!0;break;case g.PPS:this.track.pps||(this.parsePPS(e.getPayload()),!this.remuxer.readyToDecode&&this.track.pps&&this.track.sps&&(this.remuxer.readyToDecode=!0)),t=!0;break;case g.SPS:this.track.sps||(this.parseSPS(e.getPayload()),!this.remuxer.readyToDecode&&this.track.pps&&this.track.sps&&(this.remuxer.readyToDecode=!0)),t=!0;break;case g.AUD:m("AUD - ignoing");break;case g.SEI:m("SEI - ignoing")}return t}}],[{key:"extractNALu",value:function(e){for(var t,r,n=0,i=e.byteLength,a=0,s=[],o=0;n<i;)switch(t=e[n++],a){case 0:0===t&&(a=1);break;case 1:a=0===t?2:0;break;case 2:case 3:0===t?a=3:1===t&&n<i?(o!=n-a-1&&s.push(e.subarray(o,n-a-1)),o=n,a=0):a=0}return o<i&&(r=e.subarray(o,i)),[s,r]}},{key:"skipScalingList",value:function(e,t){for(var r=8,n=8,i=0;i<t;i++)0!==n&&(n=(r+e.readEG()+256)%256),r=0===n?r:n}},{key:"readSPS",value:function(t){var r,n,i,a,s,o,u=new S(t),c=0,f=0,l=0,h=0,d=1,y=0;u.readUByte();for(var p=[],v=t.byteLength,m=1;m<v;m++)m+2<v&&3===u.readBits(24,!1)?(p.push(u.readBits(8)),p.push(u.readBits(8)),m+=2,u.readBits(8)):p.push(u.readBits(8));if(u.setData(new Uint8Array(p)),r=u.readUByte(),u.readBits(5),u.skipBits(3),u.readUByte(),u.skipUEG(),100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r){var k=u.readUEG();if(3===k&&u.skipBits(1),u.skipUEG(),u.skipUEG(),u.skipBits(1),u.readBoolean()){o=3!==k?8:12;for(var g=0;g<o;++g)u.readBoolean()&&(g<6?e.skipScalingList(u,16):e.skipScalingList(u,64))}}u.skipUEG();var b=u.readUEG();if(0===b)u.readUEG();else if(1===b){u.skipBits(1),u.skipEG(),u.skipEG(),n=u.readUEG();for(var w=0;w<n;++w)u.skipEG()}if(u.skipUEG(),u.skipBits(1),i=u.readUEG(),a=u.readUEG(),0===(s=u.readBits(1))&&u.skipBits(1),u.skipBits(1),u.readBoolean()&&(c=u.readUEG(),f=u.readUEG(),l=u.readUEG(),h=u.readUEG()),u.readBoolean()){if(u.readBoolean()){var x;switch(u.readUByte()){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:x=[u.readUByte()<<8|u.readUByte(),u.readUByte()<<8|u.readUByte()]}x&&x[0]>0&&x[1]>0&&(d=x[0]/x[1])}if(u.readBoolean()&&u.skipBits(1),u.readBoolean()&&(u.skipBits(4),u.readBoolean()&&u.skipBits(24)),u.readBoolean()&&(u.skipUEG(),u.skipUEG()),u.readBoolean()){var U=u.readUInt(),A=u.readUInt();u.readBoolean()&&(y=A/(2*U))}}return{fps:y>0?y:void 0,width:Math.ceil((16*(i+1)-2*c-2*f)*d),height:(2-s)*(a+1)*16-(s?2:4)*(l+h)}}},{key:"parseHeader",value:function(e){var t=new S(e.getPayload());t.readUByte(),e.isfmb=0===t.readUEG(),e.stype=t.readUEG()}}]),e}(),x=function(){function e(t){r(this,e),this.remuxer=t,this.track=t.mp4track}return i(e,[{key:"extractAAC",value:function(t){var r,n,i=0,a=t.byteLength,s=[];if(!e.isAACPattern(t))return k("Invalid ADTS audio format"),s;for(r=e.getHeaderLength(t),this.aacHeader||(this.aacHeader=t.subarray(0,r));i<a;)n=e.getFrameLength(t),s.push(t.subarray(r,n)),t=t.slice(n),i+=n;return s}},{key:"setAACConfig",value:function(){var e,t,r,n=new Uint8Array(2),i=this.aacHeader;i&&(e=1+((192&i[2])>>>6),t=(60&i[2])>>>2,r=(1&i[2])<<2,r|=(192&i[3])>>>6,n[0]=e<<3,n[0]|=(14&t)>>1,n[1]|=(1&t)<<7,n[1]|=r<<3,this.track.codec="mp4a.40."+e,this.track.channelCount=r,this.track.config=n,this.remuxer.readyToDecode=!0)}}],[{key:"samplingRateMap",get:function(){return[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]}},{key:"getHeaderLength",value:function(e){return 1&e[1]?7:9}},{key:"getFrameLength",value:function(e){return(3&e[3])<<11|e[4]<<3|(224&e[5])>>>5}},{key:"isAACPattern",value:function(e){return!(255!==e[0]||240&~e[1]||6&e[1])}}]),e}(),U=function(){function e(t){r(this,e),this.listener={},this.type=""|t}return i(e,[{key:"on",value:function(e,t){return this.listener[e]||(this.listener[e]=[]),this.listener[e].push(t),!0}},{key:"off",value:function(e,t){if(this.listener[e]){var r=this.listener[e].indexOf(t);return r>-1&&this.listener[e].splice(r,1),!0}return!1}},{key:"offAll",value:function(){this.listener={}}},{key:"dispatch",value:function(e,t){return!!this.listener[e]&&(this.listener[e].map((function(e){e.apply(null,[t])})),!0)}}]),e}(),A=function(){function e(){r(this,e)}return i(e,null,[{key:"init",value:function(){var t;for(t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:r,audio:n};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=a,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,s,u,s,o),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,i))}},{key:"box",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var i,a=8,s=r.length,o=s;s--;)a+=r[s].byteLength;for((i=new Uint8Array(a))[0]=a>>24&255,i[1]=a>>16&255,i[2]=a>>8&255,i[3]=255&a,i.set(e,4),s=0,a=8;s<o;++s)i.set(r[s],a),a+=r[s].byteLength;return i}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}},{key:"mdhd",value:function(t,r){return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,85,196,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"minf",value:function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}},{key:"moof",value:function(t,r,n){return e.box(e.types.moof,e.mfhd(t),e.traf(n,r))}},{key:"moov",value:function(t,r,n){for(var i=t.length,a=[];i--;)a[i]=e.trak(t[i]);return e.box.apply(null,[e.types.moov,e.mvhd(n,r)].concat(a).concat(e.mvex(t)))}},{key:"mvex",value:function(t){for(var r=t.length,n=[];r--;)n[r]=e.trex(t[r]);return e.box.apply(null,[e.types.mvex].concat(n))}},{key:"mvhd",value:function(t,r){var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24&255,r>>16&255,r>>8&255,255&r,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,n)}},{key:"sdtp",value:function(t){var r,n,i=t.samples||[],a=new Uint8Array(4+i.length);for(n=0;n<i.length;n++)r=i[n].flags,a[n+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return e.box(e.types.sdtp,a)}},{key:"stbl",value:function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))}},{key:"avc1",value:function(t){var r,n,i,a=[],s=[];for(r=0;r<t.sps.length;r++)i=(n=t.sps[r]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(n));for(r=0;r<t.pps.length;r++)i=(n=t.pps[r]).byteLength,s.push(i>>>8&255),s.push(255&i),s=s.concat(Array.prototype.slice.call(n));var o=e.box(e.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a).concat([t.pps.length]).concat(s))),u=t.width,c=t.height;return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,255&u,c>>8&255,255&c,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,98,105,110,101,108,112,114,111,46,114,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(e){var t=e.config.byteLength,r=new Uint8Array(26+t+3);return r.set([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5,t]),r.set(e.config,26),r.set([6,1,2],26+t),r}},{key:"mp4a",value:function(t){var r=t.audiosamplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))}},{key:"stsd",value:function(t){return"audio"===t.type?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))}},{key:"tkhd",value:function(t){var r=t.id,n=t.duration,i=t.width,a=t.height,s=t.volume;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,255&s,s%1*10&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,a>>8&255,255&a,0,0]))}},{key:"traf",value:function(t,r){var n=e.sdtp(t),i=t.id;return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),e.box(e.types.tfdt,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.trun(t,n.length+16+16+8+16+8+8),n)}},{key:"trak",value:function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"trex",value:function(t){var r=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(t,r){var n,i,a,s,o,u,c=t.samples||[],f=c.length,l=12+16*f,h=new Uint8Array(l);for(r+=8+l,h.set([0,0,15,1,f>>>24&255,f>>>16&255,f>>>8&255,255&f,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),n=0;n<f;n++)a=(i=c[n]).duration,s=i.size,o=i.flags,u=i.cts,h.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*n);return e.box(e.types.trun,h)}},{key:"initSegment",value:function(t,r,n){e.types||e.init();var i,a=e.moov(t,r,n);return(i=new Uint8Array(e.FTYP.byteLength+a.byteLength)).set(e.FTYP),i.set(a,e.FTYP.byteLength),i}}]),e}(),B=1,D=function(){function e(){r(this,e)}return i(e,[{key:"flush",value:function(){this.mp4track.len=0,this.mp4track.samples=[]}},{key:"isReady",value:function(){return!(!this.readyToDecode||!this.samples.length)||null}}],[{key:"getTrackID",value:function(){return B++}}]),e}(),C=function(e){s(n,e);var t=f(n);function n(e){var i;return r(this,n),(i=t.call(this)).readyToDecode=!1,i.nextDts=0,i.dts=0,i.mp4track={id:D.getTrackID(),type:"audio",channelCount:0,len:0,fragmented:!0,timescale:e,duration:e,samples:[],config:"",codec:""},i.samples=[],i.aac=new x(c(i)),i}return i(n,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.codec="",this.mp4track.channelCount="",this.mp4track.config="",this.mp4track.timescale=this.timescale,this.nextDts=0,this.dts=0}},{key:"remux",value:function(e){if(e.length>0)for(var t=0;t<e.length;t++){var r=e[t],n=r.units,i=n.byteLength;this.samples.push({units:n,size:i,duration:r.duration}),this.mp4track.len+=i,this.readyToDecode||this.aac.setAACConfig()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var e,t,r=new Uint8Array(this.mp4track.len),n=0,i=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var a=this.samples.shift();a.units,(t=a.duration)<=0?(m("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(t)),this.mp4track.len-=a.size):(this.nextDts+=t,e={size:a.size,duration:t,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},r.set(a.units,n),n+=a.size,i.push(e))}return i.length?new Uint8Array(r.buffer,0,this.mp4track.len):null}},{key:"getAacParser",value:function(){return this.aac}}]),n}(D),E=function(e){s(n,e);var t=f(n);function n(e){var i;return r(this,n),(i=t.call(this)).readyToDecode=!1,i.nextDts=0,i.dts=0,i.mp4track={id:D.getTrackID(),type:"video",len:0,fragmented:!0,sps:"",pps:"",fps:30,width:0,height:0,timescale:e,duration:e,samples:[]},i.samples=[],i.h264=new w(c(i)),i}return i(n,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.sps="",this.mp4track.pps="",this.nextDts=0,this.dts=0}},{key:"remux",value:function(e){var t,r=y(e);try{for(r.s();!(t=r.n()).done;){var n,i=t.value,a=[],s=0,o=y(i.units);try{for(o.s();!(n=o.n()).done;){var u=n.value;this.h264.parseNAL(u)&&(a.push(u),s+=u.getSize())}}catch(e){o.e(e)}finally{o.f()}a.length>0&&this.readyToDecode&&(this.mp4track.len+=s,this.samples.push({units:a,size:s,keyFrame:i.keyFrame,duration:i.duration,compositionTimeOffset:i.compositionTimeOffset}))}}catch(e){r.e(e)}finally{r.f()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var e,t,r=new Uint8Array(this.mp4track.len),n=0,i=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var a=this.samples.shift(),s=a.units;if((t=a.duration)<=0)m("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(t)),this.mp4track.len-=a.size;else{this.nextDts+=t,e={size:a.size,duration:t,cts:a.compositionTimeOffset||0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:a.keyFrame?0:1,dependsOn:a.keyFrame?2:1}};var o,u=y(s);try{for(u.s();!(o=u.n()).done;){var c=o.value;r.set(c.getData(),n),n+=c.getSize()}}catch(e){u.e(e)}finally{u.f()}i.push(e)}}return i.length?new Uint8Array(r.buffer,0,this.mp4track.len):null}}]),n}(D),T=function(e){s(n,e);var t=f(n);function n(e){var i;return r(this,n),(i=t.call(this,"remuxer")).initialized=!1,i.trackTypes=[],i.tracks={},i.seq=1,i.env=e,i.timescale=1e3,i.mediaDuration=0,i.aacParser=null,i}return i(n,[{key:"addTrack",value:function(e){if("video"!==e&&"both"!==e||(this.tracks.video=new E(this.timescale),this.trackTypes.push("video")),"audio"===e||"both"===e){var t=new C(this.timescale);this.aacParser=t.getAacParser(),this.tracks.audio=t,this.trackTypes.push("audio")}}},{key:"reset",value:function(){var e,t=y(this.trackTypes);try{for(t.s();!(e=t.n()).done;){var r=e.value;this.tracks[r].resetTrack()}}catch(e){t.e(e)}finally{t.f()}this.initialized=!1}},{key:"destroy",value:function(){this.tracks={},this.offAll()}},{key:"flush",value:function(){if(this.initialized){var e,t=y(this.trackTypes);try{for(t.s();!(e=t.n()).done;){var r=e.value,n=this.tracks[r],i=n.getPayload();if(i&&i.byteLength){var a={type:r,payload:b(A.moof(this.seq,n.dts,n.mp4track),A.mdat(i)),dts:n.dts};"video"===r&&(a.fps=n.mp4track.fps),this.dispatch("buffer",a);var s=(o=n.dts/this.timescale,u=void 0,c=void 0,f=void 0,l=void 0,l="",u=Math.floor(o),(c=parseInt(u/3600,10)%24)>0&&(l+=(c<10?"0"+c:c)+":"),l+=((f=parseInt(u/60,10)%60)<10?"0"+f:f)+":"+((u=u<0?0:u%60)<10?"0"+u:u));m("put segment (".concat(r,"): dts: ").concat(n.dts," frames: ").concat(n.mp4track.samples.length," second: ").concat(s)),n.flush(),this.seq++}}}catch(e){t.e(e)}finally{t.f()}}else this.isReady()&&(this.dispatch("ready"),this.initSegment(),this.initialized=!0,this.flush());var o,u,c,f,l}},{key:"initSegment",value:function(){var e,t=[],r=y(this.trackTypes);try{for(r.s();!(e=r.n()).done;){var n=e.value,i=this.tracks[n];if("browser"==this.env){var a={type:n,payload:A.initSegment([i.mp4track],this.mediaDuration,this.timescale)};this.dispatch("buffer",a)}else t.push(i.mp4track)}}catch(e){r.e(e)}finally{r.f()}if("node"==this.env){var s={type:"all",payload:A.initSegment(t,this.mediaDuration,this.timescale)};this.dispatch("buffer",s)}m("Initial segment generated.")}},{key:"isReady",value:function(){var e,t=y(this.trackTypes);try{for(t.s();!(e=t.n()).done;){var r=e.value;if(!this.tracks[r].readyToDecode||!this.tracks[r].samples.length)return!1}}catch(e){t.e(e)}finally{t.f()}return!0}},{key:"remux",value:function(e){var t,r=y(this.trackTypes);try{for(r.s();!(t=r.n()).done;){var n=t.value,i=e[n];"audio"===n&&this.tracks.video&&!this.tracks.video.readyToDecode||i.length>0&&this.tracks[n].remux(i)}}catch(e){r.e(e)}finally{r.f()}this.flush()}}]),n}(U),P=function(e){s(n,e);var t=f(n);function n(e,i){var a;return r(this,n),(a=t.call(this,"buffer")).type=i,a.queue=new Uint8Array,a.cleaning=!1,a.pendingCleaning=0,a.cleanOffset=30,a.cleanRanges=[],a.sourceBuffer=e,a.sourceBuffer.addEventListener("updateend",(function(){a.pendingCleaning>0&&(a.initCleanup(a.pendingCleaning),a.pendingCleaning=0),a.cleaning=!1,a.cleanRanges.length&&a.doCleanup()})),a.sourceBuffer.addEventListener("error",(function(){a.dispatch("error",{type:a.type,name:"buffer",error:"buffer error"})})),a}return i(n,[{key:"destroy",value:function(){this.queue=null,this.sourceBuffer=null,this.offAll()}},{key:"doCleanup",value:function(){if(this.cleanRanges.length){var e=this.cleanRanges.shift();m("".concat(this.type," remove range [").concat(e[0]," - ").concat(e[1],")")),this.cleaning=!0,this.sourceBuffer.remove(e[0],e[1])}else this.cleaning=!1}},{key:"initCleanup",value:function(e){try{if(this.sourceBuffer.updating)return void(this.pendingCleaning=e);if(this.sourceBuffer.buffered&&this.sourceBuffer.buffered.length&&!this.cleaning){for(var t=0;t<this.sourceBuffer.buffered.length;++t){var r=this.sourceBuffer.buffered.start(t),n=this.sourceBuffer.buffered.end(t);e-r>this.cleanOffset&&r<(n=e-this.cleanOffset)&&this.cleanRanges.push([r,n])}this.doCleanup()}}catch(e){k("Error occured while cleaning ".concat(this.type," buffer - ").concat(e.name,": ").concat(e.message))}}},{key:"doAppend",value:function(){if(this.queue.length&&this.sourceBuffer&&!this.sourceBuffer.updating)try{this.sourceBuffer.appendBuffer(this.queue),this.queue=new Uint8Array}catch(t){var e="unexpectedError";"QuotaExceededError"===t.name?(m("".concat(this.type," buffer quota full")),e="QuotaExceeded"):(k("Error occured while appending ".concat(this.type," buffer - ").concat(t.name,": ").concat(t.message)),e="InvalidStateError"),this.dispatch("error",{type:this.type,name:e,error:"buffer error"})}}},{key:"feed",value:function(e){this.queue=b(this.queue,e)}}]),n}(U);return function(n){s(o,n);var a=f(o);function o(e){var n;r(this,o),(n=a.call(this,"jmuxer")).isReset=!1;return n.options=Object.assign({},{node:"",mode:"both",flushingTime:500,maxDelay:500,clearBuffer:!0,fps:30,readFpsFromTrack:!1,debug:!1,onReady:function(){},onError:function(){}},e),n.env="object"===("undefined"==typeof process?"undefined":t(process))&&"undefined"==typeof window?"node":"browser",n.options.debug&&(p=console.log,v=console.error),n.options.fps||(n.options.fps=30),n.frameDuration=1e3/n.options.fps|0,n.remuxController=new T(n.env),n.remuxController.addTrack(n.options.mode),n.initData(),n.remuxController.on("buffer",n.onBuffer.bind(c(n))),"browser"==n.env&&(n.remuxController.on("ready",n.createBuffer.bind(c(n))),n.initBrowser()),n}return i(o,[{key:"initData",value:function(){this.lastCleaningTime=Date.now(),this.kfPosition=[],this.kfCounter=0,this.pendingUnits={},this.remainingData=new Uint8Array,this.startInterval()}},{key:"initBrowser",value:function(){"string"==typeof this.options.node&&""==this.options.node&&k("no video element were found to render, provide a valid video element"),this.node="string"==typeof this.options.node?document.getElementById(this.options.node):this.options.node,this.mseReady=!1,this.setupMSE()}},{key:"createStream",value:function(){var t=this.feed.bind(this),r=this.destroy.bind(this);return this.stream=new e.Duplex({writableObjectMode:!0,read:function(e){},write:function(e,r,n){t(e),n()},final:function(e){r(),e()}}),this.stream}},{key:"setupMSE",value:function(){if(window.MediaSource=window.MediaSource||window.WebKitMediaSource,!window.MediaSource)throw"Oops! Browser does not support media source extension.";this.isMSESupported=!!window.MediaSource,this.mediaSource=new MediaSource,this.url=URL.createObjectURL(this.mediaSource),this.node.src=this.url,this.mseEnded=!1,this.mediaSource.addEventListener("sourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("sourceclose",this.onMSEClose.bind(this)),this.mediaSource.addEventListener("webkitsourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("webkitsourceclose",this.onMSEClose.bind(this))}},{key:"endMSE",value:function(){if(!this.mseEnded)try{this.mseEnded=!0,this.mediaSource.endOfStream()}catch(e){k("mediasource is not available to end")}}},{key:"feed",value:function(e){var t,r,n,i=!1,a={video:[],audio:[]};if(e&&this.remuxController){if(n=e.duration?parseInt(e.duration):0,e.video){e.video=b(this.remainingData,e.video);var s=l(w.extractNALu(e.video),2);if(t=s[0],r=s[1],this.remainingData=r||new Uint8Array,!(t.length>0))return void k("Failed to extract any NAL units from video data:",r);a.video=this.getVideoFrames(t,n,e.compositionTimeOffset),i=!0}if(e.audio){if(!((t=this.remuxController.aacParser.extractAAC(e.audio)).length>0))return void k("Failed to extract audio data from:",e.audio);a.audio=this.getAudioFrames(t,n),i=!0}i?this.remuxController.remux(a):k("Input object must have video and/or audio property. Make sure it is a valid typed array")}}},{key:"getVideoFrames",value:function(e,t,r){var n,i=this,a=[],s=[],o=0,u=!1,c=!1;this.pendingUnits.units&&(a=this.pendingUnits.units,c=this.pendingUnits.vcl,u=this.pendingUnits.keyFrame,this.pendingUnits={});var f,l=y(e);try{for(l.s();!(f=l.n()).done;){var h=f.value,d=new g(h);d.type()!==g.IDR&&d.type()!==g.NDR||w.parseHeader(d),a.length&&c&&(d.isfmb||!d.isvcl)&&(s.push({units:a,keyFrame:u}),a=[],u=!1,c=!1),a.push(d),u=u||d.isKeyframe(),c=c||d.isvcl}}catch(e){l.e(e)}finally{l.f()}if(a.length)if(t)if(c)s.push({units:a,keyFrame:u});else{var p=s.length-1;p>=0&&(s[p].units=s[p].units.concat(a))}else this.pendingUnits={units:a,keyFrame:u,vcl:c};return n=t?t/s.length|0:this.frameDuration,o=t?t-n*s.length:0,s.map((function(e){e.duration=n,e.compositionTimeOffset=r,o>0&&(e.duration++,o--),i.kfCounter++,e.keyFrame&&i.options.clearBuffer&&i.kfPosition.push(i.kfCounter*n/1e3)})),m("jmuxer: No. of frames of the last chunk: ".concat(s.length)),s}},{key:"getAudioFrames",value:function(e,t){var r,n,i=[],a=0,s=y(e);try{for(s.s();!(n=s.n()).done;){var o=n.value;i.push({units:o})}}catch(e){s.e(e)}finally{s.f()}return r=t?t/i.length|0:this.frameDuration,a=t?t-r*i.length:0,i.map((function(e){e.duration=r,a>0&&(e.duration++,a--)})),i}},{key:"destroy",value:function(){if(this.stopInterval(),this.stream&&(this.remuxController.flush(),this.stream.push(null),this.stream=null),this.remuxController&&(this.remuxController.destroy(),this.remuxController=null),this.bufferControllers){for(var e in this.bufferControllers)this.bufferControllers[e].destroy();this.bufferControllers=null,this.endMSE()}this.node=!1,this.mseReady=!1,this.videoStarted=!1,this.mediaSource=null}},{key:"reset",value:function(){if(this.stopInterval(),this.isReset=!0,this.node.pause(),this.remuxController&&this.remuxController.reset(),this.bufferControllers){for(var e in this.bufferControllers)this.bufferControllers[e].destroy();this.bufferControllers=null,this.endMSE()}this.initData(),"browser"==this.env&&this.initBrowser(),m("JMuxer was reset")}},{key:"createBuffer",value:function(){if(this.mseReady&&this.remuxController&&this.remuxController.isReady()&&!this.bufferControllers)for(var e in this.bufferControllers={},this.remuxController.tracks){var t=this.remuxController.tracks[e];if(!o.isSupported("".concat(e,'/mp4; codecs="').concat(t.mp4track.codec,'"')))return k("Browser does not support codec"),!1;var r=this.mediaSource.addSourceBuffer("".concat(e,'/mp4; codecs="').concat(t.mp4track.codec,'"'));this.bufferControllers[e]=new P(r,e),this.bufferControllers[e].on("error",this.onBufferError.bind(this))}}},{key:"startInterval",value:function(){var e=this;this.interval=setInterval((function(){e.options.flushingTime?e.applyAndClearBuffer():e.bufferControllers&&e.cancelDelay()}),this.options.flushingTime||1e3)}},{key:"stopInterval",value:function(){this.interval&&clearInterval(this.interval)}},{key:"cancelDelay",value:function(){if(this.node.buffered&&this.node.buffered.length>0&&!this.node.seeking){var e=this.node.buffered.end(0);e-this.node.currentTime>this.options.maxDelay/1e3&&(console.log("delay"),this.node.currentTime=e-.001)}}},{key:"releaseBuffer",value:function(){for(var e in this.bufferControllers)this.bufferControllers[e].doAppend()}},{key:"applyAndClearBuffer",value:function(){this.bufferControllers&&(this.releaseBuffer(),this.clearBuffer())}},{key:"getSafeClearOffsetOfBuffer",value:function(e){for(var t,r="audio"===this.options.mode&&e||0,n=0;n<this.kfPosition.length&&!(this.kfPosition[n]>=e);n++)t=this.kfPosition[n];return t&&(this.kfPosition=this.kfPosition.filter((function(e){return e<t&&(r=e),e>=t}))),r}},{key:"clearBuffer",value:function(){if(this.options.clearBuffer&&Date.now()-this.lastCleaningTime>1e4){for(var e in this.bufferControllers){var t=this.getSafeClearOffsetOfBuffer(this.node.currentTime);this.bufferControllers[e].initCleanup(t)}this.lastCleaningTime=Date.now()}}},{key:"onBuffer",value:function(e){this.options.readFpsFromTrack&&void 0!==e.fps&&this.options.fps!=e.fps&&(this.options.fps=e.fps,this.frameDuration=Math.ceil(1e3/e.fps),m("JMuxer changed FPS to ".concat(e.fps," from track data"))),"browser"==this.env?this.bufferControllers&&this.bufferControllers[e.type]&&this.bufferControllers[e.type].feed(e.payload):this.stream&&this.stream.push(e.payload),0===this.options.flushingTime&&this.applyAndClearBuffer()}},{key:"onMSEOpen",value:function(){this.mseReady=!0,URL.revokeObjectURL(this.url),"function"==typeof this.options.onReady&&this.options.onReady.call(null,this.isReset)}},{key:"onMSEClose",value:function(){this.mseReady=!1,this.videoStarted=!1}},{key:"onBufferError",value:function(e){if("QuotaExceeded"==e.name)return m("JMuxer cleaning ".concat(e.type," buffer due to QuotaExceeded error")),void this.bufferControllers[e.type].initCleanup(this.node.currentTime);"InvalidStateError"==e.name?(m("JMuxer is reseting due to InvalidStateError"),this.reset()):this.endMSE(),"function"==typeof this.options.onError&&this.options.onError.call(null,e)}}],[{key:"isSupported",value:function(e){return window.MediaSource&&window.MediaSource.isTypeSupported(e)}}]),o}(U)}));"use strict";function strcmp(_,e){return _==e?0:_>e?1:-1}var ptr=0,EXIT_SUCCESS=0,EXIT_FAILURE=1,SEEK_CUR=1,SEEK_END=2,SEEK_SET=0,buffer8k=function(){return Arr(8800,0)};function fread(_,e,r,t){if(_.val=new buffer8k,t.data.length<r+t.data_off)return t.data_off+=r,0;for(var n=0;n<r;++n)_.val[n]=t.data[t.data_off++];return _.val.length=r,n}function ftell(_){return _.data_off}function feof(_){return _.data.length<_.data_off?1:0}var char_=0,short_=0,int_=0,long_=0,void_=0,int8_t=char_,uint8_t=char_,int16_t=short_,uint16_t=short_,int32_t=int_,uint32_t=int_,uint64_t=long_,int64_t=long_,float_=0,size_t=0,double_=0,score_t=int64_t,CHAR_BIT=8,ptrdiff_t=int_,UINT8=char_,INT16=short_;function newObjectIt(_){return void 0===_?"error":JSON.parse(JSON.stringify(_))}function memcpy(_,e,r,t,n){var i;for(i=0;i<n;++i)_[e+i]=r[t+i];return _}function memset(_,e,r,t){var n=0;for(n=0;n<t;++n)_[e+n]=r}function malloc(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(e);return t}function assert(_){if(!_)throw new Error("assert :P")}function setjmp(_){return 0}function offsetof(_,e){return e}function Arr(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(e);return t}function Arr_new(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(new e);return t}function Arr_nOI(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(newObjectIt(e));return t}function ArrM(_,e){var r;new Array;for(r=_.length-1;r>=0;--r)e=newObjectIt(Arr(_[r],e));return e}function create_obj_vals_from_arrayChilds(_,e){var r;for(r=0;r<e.length;++r)e[r]=create_obj_vals_from_array(new _,e[r]);return e}function create_obj_vals_from_array(_,e){var r=_,t=0;for(var n in r)"object"==typeof r[n]&&Object.keys(r[n]).length==e[t].length?r[n]=create_obj_vals_from_array(r[n],e[t]):r[n]=e[t],t++;return r}var DC_PRED=0,V_PRED=1,H_PRED=2,TM_PRED=3,B_PRED=4,NEARESTMV=5,NEARMV=6,ZEROMV=7,NEWMV=8,SPLITMV=9,MB_MODE_COUNT=10,B_DC_PRED=0,B_TM_PRED=1,B_VE_PRED=2,B_HE_PRED=3,B_LD_PRED=4,B_RD_PRED=5,B_VR_PRED=6,B_VL_PRED=7,B_HD_PRED=8,B_HU_PRED=9,LEFT4X4=10,ABOVE4X4=11,ZERO4X4=12,NEW4X4=13,B_MODE_COUNT=14;function CODEC_INTERFACE(_,e){window[_+"_algo"]=create_obj_vals_from_array(vpx_codec_iface_t,e)}var VPX_CODEC_INTERNAL_ABI_VERSION=3,VPX_CODEC_CAP_DECODER=1,vpx_codec_ctrl_fn_map_t=function(){this.ctrl_id=int_,this.fn=0
2
- /*!\brief Decoder algorithm interface interface 285
3
- *
4
- * All decoders \ref MUST expose a variable of this type.
5
- */},vpx_codec_iface=function(){this.name=char_,this.abi_version=int_,this.caps=long_,this.init="vpx_codec_init_fn_t",this.destroy="vpx_codec_destroy_fn_t",this.ctrl_maps=new vpx_codec_ctrl_fn_map_t,this.get_mmap="vpx_codec_get_mmap_fn_t",this.set_mmap="vpx_codec_set_mmap_fn_t",this.dec=new Object({peek_si:"vpx_codec_peek_si_fn_t",get_si:"vpx_codec_get_si_fn_t",decode:"vpx_codec_decode_fn_t",get_frame:"vpx_codec_get_frame_fn_t"})},vpx_codec_iface_t=vpx_codec_iface,VERSION_STRING=" v0.9.7",VPX_CODEC_OK=0,VPX_CODEC_MEM_ERROR=2,VPX_IMAGE_ABI_VERSION=1;VPX_IMG_FMT_I420=258,VPX_IMG_FMT_VPXI420=260;var VPX_PLANE_PACKED=0,VPX_PLANE_Y=0,VPX_PLANE_U=1,VPX_PLANE_V=2,VPX_PLANE_ALPHA=3,PLANE_PACKED=VPX_PLANE_PACKED,PLANE_Y=VPX_PLANE_Y,PLANE_U=VPX_PLANE_U,PLANE_V=VPX_PLANE_V,PLANE_ALPHA=VPX_PLANE_ALPHA,vpx_image_t=function(){this.fmt=0,this.w=this.w=int_,this.h=this.h=int_,this.d_w=this.d_w=int_,this.d_h=this.d_h=int_,this.x_chroma_shift=this.x_chroma_shift=int_,this.y_chroma_shift=this.y_chroma_shift=int_,this.planes=this.planes=new Array(4),this.planes_off=this.planes_off=new Array(4),this.stride=this.stride=new Array(4),this.bps=this.bps=int_,this.user_priv=this.user_priv=void_,this.img_data=this.img_data=char_,this.img_data_off=this.img_data_off=0,this.img_data_owner=this.img_data_owner=int_,this.self_allocd=this.self_allocd=int_},NESTEGG_TRACK_VIDEO=0,NESTEGG_TRACK_AUDIO=1,NESTEGG_CODEC_VP8=0,NESTEGG_CODEC_VORBIS=1,NESTEGG_SEEK_SET=0,NESTEGG_SEEK_CUR=1,NESTEGG_SEEK_END=2,NESTEGG_LOG_DEBUG=1,NESTEGG_LOG_INFO=10,NESTEGG_LOG_WARNING=100,NESTEGG_LOG_ERROR=1e3,NESTEGG_LOG_CRITICAL=1e4,nestegg_io=function(){this.read=int_,this.seek=int_,this.tell=int64_t,this.userdata=void_},nestegg_video_params=function(){this.width=int_,this.height=int_,this.display_width=int_,this.display_height=int_,this.crop_bottom=int_,this.crop_top=int_,this.crop_left=int_,this.crop_right=int_},ID_EBML=440786851,ID_EBML_VERSION=17030,ID_EBML_READ_VERSION=17143,ID_EBML_MAX_ID_LENGTH=17138,ID_EBML_MAX_SIZE_LENGTH=17139,ID_DOCTYPE=17026,ID_DOCTYPE_VERSION=17031,ID_DOCTYPE_READ_VERSION=17029,ID_VOID=236,ID_CRC32=191,ID_SEGMENT=408125543,ID_SEEK_HEAD=290298740,ID_SEEK=19899,ID_SEEK_ID=21419,ID_SEEK_POSITION=21420,ID_INFO=357149030,ID_TIMECODE_SCALE=2807729,ID_DURATION=17545,ID_CLUSTER=524531317,ID_TIMECODE=231,ID_BLOCK_GROUP=160,ID_SIMPLE_BLOCK=163,ID_BLOCK=161,ID_BLOCK_DURATION=155,ID_REFERENCE_BLOCK=251,ID_TRACKS=374648427,ID_TRACK_ENTRY=174,ID_TRACK_NUMBER=215,ID_TRACK_UID=29637,ID_TRACK_TYPE=131,ID_FLAG_ENABLED=185,ID_FLAG_DEFAULT=136,ID_FLAG_LACING=156,ID_TRACK_TIMECODE_SCALE=2306383,ID_LANGUAGE=2274716,ID_CODEC_ID=134,ID_CODEC_PRIVATE=25506,ID_VIDEO=224,ID_PIXEL_WIDTH=176,ID_PIXEL_HEIGHT=186,ID_PIXEL_CROP_BOTTOM=21674,ID_PIXEL_CROP_TOP=21691,ID_PIXEL_CROP_LEFT=21708,ID_PIXEL_CROP_RIGHT=21725,ID_DISPLAY_WIDTH=21680,ID_DISPLAY_HEIGHT=21690,ID_AUDIO=225,ID_SAMPLING_FREQUENCY=181,ID_CHANNELS=159,ID_BIT_DEPTH=25188,ID_CUES=475249515,ID_CUE_POINT=187,ID_CUE_TIME=179,ID_CUE_TRACK_POSITIONS=183,ID_CUE_TRACK=247,ID_CUE_CLUSTER_POSITION=241,ID_CUE_BLOCK_NUMBER=21368,TYPE_UNKNOWN=0,TYPE_MASTER=1,TYPE_UINT=2,TYPE_FLOAT=3,TYPE_INT=4,TYPE_STRING=5,TYPE_BINARY=6,LIMIT_STRING=1<<20,LIMIT_BINARY=1<<24,LIMIT_BLOCK=1<<30,LIMIT_FRAME=1<<28,DESC_FLAG_NONE=0,DESC_FLAG_MULTI=1,DESC_FLAG_SUSPEND=2,DESC_FLAG_OFFSET=4,BLOCK_FLAGS_LACING=6,LACING_NONE=0,LACING_XIPH=1,LACING_FIXED=2,LACING_EBML=3,TRACK_TYPE_VIDEO=1,TRACK_TYPE_AUDIO=2,TRACK_ID_VP8="V_VP8",TRACK_ID_VORBIS="A_VORBIS",MASK_NONE=0,MASK_FIRST_BIT=1,ebml_binary=function(){this.data=char_,this.length=size_t},ebml_list_node=function(){this.next=null,this.id=uint64_t,this.data=void_},ebml_list=function(){this.head=null,this.tail=null},ebml_type=function(){this.v=new Object({u:uint64_t,f:double_,i:int64_t,s:char_,b:new ebml_binary}),this.type=0,this.read=int_},ebml=window.ebml=function(){this.ebml_version=this.ebml_version=new ebml_type,this.ebml_read_version=this.ebml_read_version=new ebml_type,this.ebml_max_id_length=this.ebml_max_id_length=new ebml_type,this.ebml_max_size_length=this.ebml_max_size_length=new ebml_type,this.doctype=this.doctype=new ebml_type,this.doctype_version=this.doctype_version=new ebml_type,this.doctype_read_version=this.doctype_read_version=new ebml_type},seek=window.seek=function(){this.id=this.id=new ebml_type,this.position=this.position=new ebml_type},seek_head=window.seek_head=function(){this.seek=this.seek=new ebml_list},info=window.info=function(){this.timecode_scale=this.timecode_scale=new ebml_type,this.duration=this.duration=new ebml_type},block_group=window.block_group=function(){this.duration=this.duration=new ebml_type,this.reference_block=this.reference_block=new ebml_type},cluster=window.cluster=function(){this.timecode=this.timecode=new ebml_type,this.block_group=this.block_group=new ebml_list},video=window.video=function(){this.pixel_width=this.pixel_width=new ebml_type,this.pixel_height=this.pixel_height=new ebml_type,this.pixel_crop_bottom=this.pixel_crop_bottom=new ebml_type,this.pixel_crop_top=this.pixel_crop_top=new ebml_type,this.pixel_crop_left=this.pixel_crop_left=new ebml_type,this.pixel_crop_right=this.pixel_crop_right=new ebml_type,this.display_width=this.display_width=new ebml_type,this.display_height=this.display_height=new ebml_type},audio=window.audio=function(){this.sampling_frequency=this.sampling_frequency=new ebml_type,this.channels=this.channels=new ebml_type,this.bit_depth=this.bit_depth=new ebml_type},track_entry=window.track_entry=function(){this.number=this.number=new ebml_type,this.uid=this.uid=new ebml_type,this.type=this.type=new ebml_type,this.flag_enabled=this.flag_enabled=new ebml_type,this.flag_default=this.flag_default=new ebml_type,this.flag_lacing=this.flag_lacing=new ebml_type,this.track_timecode_scale=this.track_timecode_scale=new ebml_type,this.language=this.language=new ebml_type,this.codec_id=this.codec_id=new ebml_type,this.codec_private=this.codec_private=new ebml_type,this.video=this.video=new video,this.audio=this.audio=new audio},tracks=window.tracks=function(){this.track_entry=this.track_entry=new ebml_list},cue_track_positions=window.cue_track_positions=function(){this.track=this.track=new ebml_type,this.cluster_position=this.cluster_position=new ebml_type,this.block_number=this.block_number=new ebml_type},cue_point=window.cue_point=function(){this.time=this.time=new ebml_type,this.cue_track_positions=this.cue_track_positions=new ebml_list},cues=window.cues=function(){this.cue_point=this.cue_point=new ebml_list},segment=window.segment=function(){this.seek_head=this.seek_head=new ebml_list,this.info=this.info=new info,this.cluster=this.cluster=new ebml_list,this.tracks=this.tracks=new tracks,this.cues=this.cues=new cues},pool_ctx=function(){this.dummy=char_},list_node=function(){this.previous=0,this.node=new ebml_element_desc,this.data=char_},frame=function(){this.data=char_,this.length=size_t,this.next=null},nestegg=function(){this.io=new nestegg_io,this.log_=0,this.alloc_pool=new pool_ctx,this.last_id=uint64_t,this.last_size=uint64_t,this.ancestor=null,this.ebml=this.ebml=new ebml,this.segment=this.segment=new segment,this.segment_offset=int64_t,this.track_count=int_},nestegg_packet=function(){this.track=uint64_t,this.timecode=uint64_t,this.frame=new frame},ebml_element_desc=function(){this.name=char_,this.id=uint64_t,this.type=0,this.offset=size_t,this.flags=int_,this.children=null,this.size=size_t,this.data_offset=size_t};function E_FIELD(_,e,r,t,n){return new Array(_,e,r,n,DESC_FLAG_NONE,null,0,0)}function E_MASTER(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_MULTI,i,1,0)}function E_SINGLE_MASTER_O(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_OFFSET,i,0,n+"_offset")}function E_SINGLE_MASTER(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_NONE,i,0,0)}function E_SUSPEND(_,e,r){return new Array(_,e,r,0,DESC_FLAG_SUSPEND,null,0,0)}var E_LAST=new Array(null,0,0,0,DESC_FLAG_NONE,null,0,0),ne_ebml_elements=create_ebml_element_desc(new Array(E_FIELD("ID_EBML_VERSION",ID_EBML_VERSION,TYPE_UINT,"ebml","ebml_version"),E_FIELD("ID_EBML_READ_VERSION",ID_EBML_READ_VERSION,TYPE_UINT,"ebml","ebml_read_version"),E_FIELD("ID_EBML_MAX_ID_LENGTH",ID_EBML_MAX_ID_LENGTH,TYPE_UINT,"ebml","ebml_max_id_length"),E_FIELD("ID_EBML_MAX_SIZE_LENGTH",ID_EBML_MAX_SIZE_LENGTH,TYPE_UINT,"ebml","ebml_max_size_length"),E_FIELD("ID_DOCTYPE",ID_DOCTYPE,TYPE_STRING,"ebml","doctype"),E_FIELD("ID_DOCTYPE_VERSION",ID_DOCTYPE_VERSION,TYPE_UINT,"ebml","doctype_version"),E_FIELD("ID_DOCTYPE_READ_VERSION",ID_DOCTYPE_READ_VERSION,TYPE_UINT,"ebml","doctype_read_version"),E_LAST)),ne_seek_elements=create_ebml_element_desc(new Array(E_FIELD("ID_SEEK_ID",ID_SEEK_ID,TYPE_BINARY,"seek","id"),E_FIELD("ID_SEEK_POSITION",ID_SEEK_POSITION,TYPE_UINT,"seek","position"),E_LAST)),ne_seek_head_elements=create_ebml_element_desc(new Array(E_MASTER("ID_SEEK",ID_SEEK,TYPE_MASTER,"seek_head","seek",ne_seek_elements),E_LAST)),ne_info_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TIMECODE_SCALE",ID_TIMECODE_SCALE,TYPE_UINT,"info","timecode_scale"),E_FIELD("ID_DURATION",ID_DURATION,TYPE_FLOAT,"info","duration"),E_LAST)),ne_block_group_elements=create_ebml_element_desc(new Array(E_SUSPEND("ID_BLOCK",ID_BLOCK,TYPE_BINARY),E_FIELD("ID_BLOCK_DURATION",ID_BLOCK_DURATION,TYPE_UINT,"block_group","duration"),E_FIELD("ID_REFERENCE_BLOCK",ID_REFERENCE_BLOCK,TYPE_INT,"block_group","reference_block"),E_LAST)),ne_cluster_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TIMECODE",ID_TIMECODE,TYPE_UINT,"cluster","timecode"),E_MASTER("ID_BLOCK_GROUP",ID_BLOCK_GROUP,TYPE_MASTER,"cluster","block_group",ne_block_group_elements),E_SUSPEND("ID_SIMPLE_BLOCK",ID_SIMPLE_BLOCK,TYPE_BINARY),E_LAST)),ne_video_elements=create_ebml_element_desc(new Array(E_FIELD("ID_PIXEL_WIDTH",ID_PIXEL_WIDTH,TYPE_UINT,"video","pixel_width"),E_FIELD("ID_PIXEL_HEIGHT",ID_PIXEL_HEIGHT,TYPE_UINT,"video","pixel_height"),E_FIELD("ID_PIXEL_CROP_BOTTOM",ID_PIXEL_CROP_BOTTOM,TYPE_UINT,"video","pixel_crop_bottom"),E_FIELD("ID_PIXEL_CROP_TOP",ID_PIXEL_CROP_TOP,TYPE_UINT,"video","pixel_crop_top"),E_FIELD("ID_PIXEL_CROP_LEFT",ID_PIXEL_CROP_LEFT,TYPE_UINT,"video","pixel_crop_left"),E_FIELD("ID_PIXEL_CROP_RIGHT",ID_PIXEL_CROP_RIGHT,TYPE_UINT,"video","pixel_crop_right"),E_FIELD("ID_DISPLAY_WIDTH",ID_DISPLAY_WIDTH,TYPE_UINT,"video","display_width"),E_FIELD("ID_DISPLAY_HEIGHT",ID_DISPLAY_HEIGHT,TYPE_UINT,"video","display_height"),E_LAST)),ne_audio_elements=create_ebml_element_desc(new Array(E_FIELD("ID_SAMPLING_FREQUENCY",ID_SAMPLING_FREQUENCY,TYPE_FLOAT,"audio","sampling_frequency"),E_FIELD("ID_CHANNELS",ID_CHANNELS,TYPE_UINT,"audio","channels"),E_FIELD("ID_BIT_DEPTH",ID_BIT_DEPTH,TYPE_UINT,"audio","bit_depth"),E_LAST)),ne_track_entry_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TRACK_NUMBER",ID_TRACK_NUMBER,TYPE_UINT,"track_entry","number"),E_FIELD("ID_TRACK_UID",ID_TRACK_UID,TYPE_UINT,"track_entry","uid"),E_FIELD("ID_TRACK_TYPE",ID_TRACK_TYPE,TYPE_UINT,"track_entry","type"),E_FIELD("ID_FLAG_ENABLED",ID_FLAG_ENABLED,TYPE_UINT,"track_entry","flag_enabled"),E_FIELD("ID_FLAG_DEFAULT",ID_FLAG_DEFAULT,TYPE_UINT,"track_entry","flag_default"),E_FIELD("ID_FLAG_LACING",ID_FLAG_LACING,TYPE_UINT,"track_entry","flag_lacing"),E_FIELD("ID_TRACK_TIMECODE_SCALE",ID_TRACK_TIMECODE_SCALE,TYPE_FLOAT,"track_entry","track_timecode_scale"),E_FIELD("ID_LANGUAGE",ID_LANGUAGE,TYPE_STRING,"track_entry","language"),E_FIELD("ID_CODEC_ID",ID_CODEC_ID,TYPE_STRING,"track_entry","codec_id"),E_FIELD("ID_CODEC_PRIVATE",ID_CODEC_PRIVATE,TYPE_BINARY,"track_entry","codec_private"),E_SINGLE_MASTER("ID_VIDEO",ID_VIDEO,TYPE_MASTER,"track_entry","video",ne_video_elements),E_SINGLE_MASTER("ID_AUDIO",ID_AUDIO,TYPE_MASTER,"track_entry","audio",ne_audio_elements),E_LAST)),ne_tracks_elements=create_ebml_element_desc(new Array(E_MASTER("ID_TRACK_ENTRY",ID_TRACK_ENTRY,TYPE_MASTER,"tracks","track_entry",ne_track_entry_elements),E_LAST)),ne_cue_track_positions_elements=create_ebml_element_desc(new Array(E_FIELD("ID_CUE_TRACK",ID_CUE_TRACK,TYPE_UINT,"cue_track_positions","track"),E_FIELD("ID_CUE_CLUSTER_POSITION",ID_CUE_CLUSTER_POSITION,TYPE_UINT,"cue_track_positions","cluster_position"),E_FIELD("ID_CUE_BLOCK_NUMBER",ID_CUE_BLOCK_NUMBER,TYPE_UINT,"cue_track_positions","block_number"),E_LAST)),ne_cue_point_elements=create_ebml_element_desc(new Array(E_FIELD("ID_CUE_TIME",ID_CUE_TIME,TYPE_UINT,"cue_point","time"),E_MASTER("ID_CUE_TRACK_POSITIONS",ID_CUE_TRACK_POSITIONS,TYPE_MASTER,"cue_point","cue_track_positions",ne_cue_track_positions_elements),E_LAST)),ne_cues_elements=create_ebml_element_desc(new Array(E_MASTER("ID_CUE_POINT",ID_CUE_POINT,TYPE_MASTER,"cues","cue_point",ne_cue_point_elements),E_LAST)),ne_segment_elements=create_ebml_element_desc(new Array(E_MASTER("ID_SEEK_HEAD",ID_SEEK_HEAD,TYPE_MASTER,"segment","seek_head",ne_seek_head_elements),E_SINGLE_MASTER("ID_INFO",ID_INFO,TYPE_MASTER,"segment","info",ne_info_elements),E_MASTER("ID_CLUSTER",ID_CLUSTER,TYPE_MASTER,"segment","cluster",ne_cluster_elements),E_SINGLE_MASTER("ID_TRACKS",ID_TRACKS,TYPE_MASTER,"segment","tracks",ne_tracks_elements),E_SINGLE_MASTER("ID_CUES",ID_CUES,TYPE_MASTER,"segment","cues",ne_cues_elements),E_LAST)),ne_top_level_elements=create_ebml_element_desc(new Array(E_SINGLE_MASTER("ID_EBML",ID_EBML,TYPE_MASTER,"nestegg","ebml",ne_ebml_elements),E_SINGLE_MASTER_O("ID_SEGMENT",ID_SEGMENT,TYPE_MASTER,"nestegg","segment",ne_segment_elements),E_LAST));function create_ebml_element_desc(_){for(var e=new Array,r=0;r<_.length;++r){var t=0,n=new ebml_element_desc;for(var i in n)"undefined"!==_[r][t]&&(n[i]=_[r][t++]);e.push(n)}return e}function ne_pool_init(_){return new pool_ctx}var buffer_8192=Arr(8192,0);function ne_io_read_skip(_,e){for(var r=size_t,t={val:buffer_8192},n=1;e>0&&1==(n=ne_io_read(_,t,r=e<t.val.length?e:t.val.length));)e-=r;return n}function ne_io_tell(_){return _.tell(_.userdata)}function ne_bare_read_vint(_,e,r,t){var n=int_,i={val:char_},a=1,o=128;if(1!=(n=ne_io_read(_,i,1)))return n;for(;a<8&&!(i.val[0]&o);)o>>=1,a+=1;for(r&&(r.val=a),e.val=i.val[0],t==MASK_FIRST_BIT&&(e.val=i.val[0]&~o);--a;){if(1!=(n=ne_io_read(_,i,1)))return n;e.val<<=8,e.val|=i.val[0]}return 1}function ne_io_read(_,e,r){return _.read(e,r,_.userdata)}function ne_read_id(_,e,r){return ne_bare_read_vint(_,e,r,MASK_NONE)}function ne_read_vint(_,e,r){return ne_bare_read_vint(_,e,r,MASK_FIRST_BIT)}function ne_read_svint(_,e,r){var t=int_,n=[uint64_t],i=[uint64_t],a=new Array(63,8191,1048575,134217727,17179869183,2199023255551,0xffffffffffff,0x80000000000000);return 1!=(t=ne_bare_read_vint(_,n,i,MASK_FIRST_BIT))||(e[0]=n-a[i-1],r&&(r[0]=i)),t}function ne_read_uint(_,e,r){var t={val:char_},n=int_;if(0==r||r>8)return-1;if(1!=(n=ne_io_read(_,t,1)))return n;for(e[0]=t.val[0];--r;){if(1!=(n=ne_io_read(_,t,1)))return n;e[0]<<=8,e[0]|=t.val[0]}return 1}function ne_read_int(_,e,r){var t,n=[uint64_t],i=uint64_t;return 1!=(t=ne_read_uint(_,n,r))?t:(r<8?(i=1,n>=(i<<=8*r-1)?(i=1,i<<=8*r):i=0,e[0]=n-i):e[0]=n,1)}function ne_read_float(_,e,r){var t,n={u:[uint64_t],f:[float_],d:[double_]};return 4!=r&&8!=r?-1:1!=(t=ne_read_uint(_,n.u,r))?t:(e[0]=4==r?n.f=n.u:n.d=n.u,1)}function ne_read_string(_,e,r){var t,n={val:char_};if(0==r||r>LIMIT_STRING)return-1;if(1!=(t=ne_io_read(_.io,n,r)))return t;for(var i="",a=0;a<r;++a)i+=String.fromCharCode(n.val[a]);return n.val=i,e[0]=n.val,1}function ne_read_binary(_,e,r){return 0==r||r>LIMIT_BINARY?-1:(e.data={val:0},e.length=r,ne_io_read(_.io,e.data,r))}function ne_get_uint(_,e){return _.read?(assert(_.type==TYPE_UINT),e[0]=_.v.u,0):-1}function ne_get_string(_,e){return _.read?(assert(_.type==TYPE_STRING),e[0]=_.v.s,0):-1}function ne_is_ancestor_element(_,e){for(;e;e=e.previous)for(var r=e.node,t=0;r[t].id;++t)if(r[t].id==_)return 1;return 0}function ne_find_element(_,e){for(var r=e,t=0;r[t].id;++t)if(r[t].id==_)return r[t];return null}function ne_ctx_push(_,e,r){var t=new list_node;t.previous=_.ancestor,t.node=e,t.data=r,_.ancestor=t}function ne_ctx_pop(_){var e;e=_.ancestor,_.ancestor=e.previous,e=""}function ne_peek_element(_,e,r){var t=int_;return _.last_id&&_.last_size?(e&&(e[0]=_.last_id),r&&(r[0]=_.last_size),1):(_.last_id={val:_.last_id},t=ne_read_id(_.io,_.last_id,null),_.last_id=_.last_id.val,1!=t?t:(_.last_size={val:_.last_size},t=ne_read_vint(_.io,_.last_size,null),_.last_size=_.last_size.val,1!=t?t:(e&&(e[0]=_.last_id),r&&(r[0]=_.last_size),1)))}function ne_read_element(_,e,r){var t;return 1!=(t=ne_peek_element(_,e,r))?t:(_.last_id=0,_.last_size=0,1)}function ne_read_master(_,e){var r,t,n=new ebml_list_node;assert(e.type==TYPE_MASTER&&e.flags&DESC_FLAG_MULTI),_.ancestor.data[e.offset]&&(r=_.ancestor.data[e.offset]),n.id=e.id,n.data=new window[e.offset],(t=r.tail)&&(t.next=n),r.tail=n,r.head||(r.head=n),ne_ctx_push(_,e.children,n.data)}function ne_read_single_master(_,e){assert(e.type==TYPE_MASTER&&!(e.flags&DESC_FLAG_MULTI)),ne_ctx_push(_,e.children,_.ancestor.data[e.offset])}function ne_read_simple(_,e,r){var t,n=int_;if(_.ancestor.data[e.offset]&&(t=_.ancestor.data[e.offset]),t.read)return 0;switch(t.type=e.type,n=-1,e.type){case TYPE_UINT:t.v.u=[t.v.u],n=ne_read_uint(_.io,t.v.u,r),t.v.u=t.v.u[0];break;case TYPE_FLOAT:t.v.f=[t.v.f],n=ne_read_float(_.io,t.v.f,r),t.v.f=t.v.f[0];break;case TYPE_INT:t.v.i=[t.v.i],n=ne_read_int(_.io,t.v.i,r),t.v.i=t.v.i[0];break;case TYPE_STRING:t.v.s=[t.v.s],n=ne_read_string(_,t.v.s,r),t.v.s=t.v.s[0];break;case TYPE_BINARY:n=ne_read_binary(_,t.v.b,r);break;case TYPE_MASTER:case TYPE_UNKNOWN:assert(0)}return 1==n&&(t.read=1),n}function ne_parse(_,e){var r,t=int_,n=int64_t,i=[uint64_t],a=[uint64_t];if(!_.ancestor)return-1;for(;1==(t=ne_peek_element(_,i,a));)if(r=ne_find_element(i[0],_.ancestor.node)){if(r.flags&DESC_FLAG_SUSPEND){assert(r.type==TYPE_BINARY),t=1;break}if(1!=(t=ne_read_element(_,i,a)))break;if(r.flags&DESC_FLAG_OFFSET&&((n=_.ancestor.data[r.data_offset]={v:null}).v=ne_io_tell(_.io),n<0)){t=-1;break}if(r.type==TYPE_MASTER){r.flags&DESC_FLAG_MULTI?ne_read_master(_,r):ne_read_single_master(_,r);continue}if((t=ne_read_simple(_,r,a[0]))<0)break}else if(ne_is_ancestor_element(i,_.ancestor.previous)){if(e&&_.ancestor.node==e){t=1;break}ne_ctx_pop(_)}else{if(1!=(t=ne_read_element(_,i,a)))break;if(1!=(t=ne_io_read_skip(_.io,a[0])))break}if(1!=t)for(;_.ancestor;)ne_ctx_pop(_);return t}function ne_read_xiph_lace_value(_,e,r,t){var n=int_,i=[uint64_t];if(1!=(n=ne_read_uint(_,i,1)))return n;for(t[0]+=1,e[r+0]=i[0];255==i[0];){if(1!=(n=ne_read_uint(_,i,1)))return n;t[0]+=1,e[r+0]+=i[0]}return 1}function ne_read_xiph_lacing(_,e,r,t,n){for(var i=int_,a=0,o=0;--t;){if(1!=(i=ne_read_xiph_lace_value(_,n,a,r)))return i;o+=n[a],a+=1}return r[0]+o>e?-1:(n[a]=e-r[0]-o,1)}function ne_read_ebml_lacing(_,e,r,t,n){var i=int_,a=[uint64_t],o=uint64_t,s=[uint64_t],f=[int64_t],d=0;if(1!=(i=ne_read_vint(_,a,s)))return i;for(r[0]+=s[0],n[d]=a[0],o=n[d],d+=1,t-=1;--t;){if(1!=(i=ne_read_svint(_,f,s)))return i;r[0]+=s[0],n[d]=n[d-1]+f[0],o+=n[d],d+=1}return r[0]+o>e?-1:(n[d]=e-r[0]-o,1)}function ne_get_timecode_scale(_){var e=[uint64_t];return 0!=ne_get_uint(_.segment.info.timecode_scale,e)&&(e[0]=1e6),e[0]}function ne_find_track_entry(_,e){for(var r=0,t=_.segment.tracks.track_entry.head;t;){if(assert(t.id==ID_TRACK_ENTRY),e==r)return t.data;r+=1,t=t.next}return null}var frame_sizes_256=Arr(256,0);function ne_read_block(_,e,r,t){var n,i,a,o,s,f,d=int_,E=[int64_t],c={val:uint64_t},l={val:uint64_t},m=frame_sizes_256,A=[uint64_t],u=[uint64_t],p=[uint64_t],T=uint64_t,y=int_,b=[0];if(t[0]=null,r>LIMIT_BLOCK)return-1;if(1!=(d=ne_read_vint(_.io,c,l)))return d;if(0==c.val||c.val>_.track_count)return-1;if(b[0]+=l.val,1!=(d=ne_read_int(_.io,E,2)))return d;if(b[0]+=2,1!=(d=ne_read_uint(_.io,u,1)))return d;switch(b[0]+=1,p[0]=0,f=(u[0]&BLOCK_FLAGS_LACING)>>1){case LACING_NONE:p[0]=1;break;case LACING_XIPH:case LACING_FIXED:case LACING_EBML:if(1!=(d=ne_read_uint(_.io,p,1)))return d;b[0]+=1,p[0]+=1}if(p[0]>256)return-1;switch(f){case LACING_NONE:m[0]=r-b[0];break;case LACING_XIPH:if(1==p)return-1;if(1!=(d=ne_read_xiph_lacing(_.io,r,b,p,m)))return d;break;case LACING_FIXED:if((r-b[0])%p[0])return-1;for(y=0;y<p[0];++y)m[y]=(r-b[0])/p|0;break;case LACING_EBML:if(1==p[0])return-1;if(1!=(d=ne_read_ebml_lacing(_.io,r,b,p,m)))return d}for(T=b[0],y=0;y<p[0];++y)T+=m[y];if(T>r)return-1;if(!ne_find_track_entry(_,c.val-1))return-1;if(s=ne_get_timecode_scale(_),assert(_.segment.cluster.tail.id==ID_CLUSTER),0!=ne_get_uint(_.segment.cluster.tail.data.timecode,A))return-1;if((n=E[0]+A[0])<0)return-1;for((i=new nestegg_packet).track=c.val-1,i.timecode=n*s*1,o=null,y=0;y<p[0];++y){if(m[y]>LIMIT_FRAME)return nestegg_free_packet(i),-1;if((a=new frame).data=[],a.length=m[y],a.data={val:a.data},d=ne_io_read(_.io,a.data,m[y]),a.data=a.data.val,1!=d)return a.data=null,a=null,nestegg_free_packet(i),-1;o?o.next=a:i.frame=a,o=a}return t[0]=i,1}function ne_null_log_callback(_,e,r,t){}function ne_is_suspend_element(_){return _==ID_SIMPLE_BLOCK||_==ID_BLOCK?1:0}var ctx_=new nestegg;function nestegg_init(_,e,r){var t,n=[0],i=[0],a=[uint64_t],o=[char_],s=ctx_;if(!(e.read&&e.seek&&e.tell))return-1;if(s.io=e,s.alloc_pool=ne_pool_init(),1!=ne_peek_element(s,n,null))return nestegg_destroy(s),-1;if(n[0]!=ID_EBML)return nestegg_destroy(s),-1;if(ne_ctx_push(s,ne_top_level_elements,s),1!=ne_parse(s,null))return nestegg_destroy(s),-1;if(0!=ne_get_uint(s.ebml.ebml_read_version,i)&&(i=1),1!=i[0])return nestegg_destroy(s),-1;if(0!=ne_get_string(s.ebml.doctype,o)&&(o[0]="matroska"),0!=strcmp(o[0],"webm"))return nestegg_destroy(s),-1;if(0!=ne_get_uint(s.ebml.doctype_read_version,a)&&(a[0]=1),a[0]<1||a[0]>2)return nestegg_destroy(s),-1;if(!s.segment.tracks.track_entry.head)return nestegg_destroy(s),-1;for(t=s.segment.tracks.track_entry.head,s.track_count=0;t;)s.track_count+=1,t=t.next;return _[0]=s,0}function nestegg_destroy(_){}function nestegg_track_count(_,e){return e[0]=_.track_count,0}function nestegg_track_type(_,e){var r=[uint64_t],t=ne_find_track_entry(_,e);return t?0!=ne_get_uint(t.type,r)?-1:r[0]&TRACK_TYPE_VIDEO?NESTEGG_TRACK_VIDEO:r[0]&TRACK_TYPE_AUDIO?NESTEGG_TRACK_AUDIO:-1:-1}function nestegg_track_codec_id(_,e){var r=[char_],t=ne_find_track_entry(_,e);return t?0!=ne_get_string(t.codec_id,r)?-1:0==strcmp(r[0],TRACK_ID_VP8)?NESTEGG_CODEC_VP8:0==strcmp(r[0],TRACK_ID_VORBIS)?NESTEGG_CODEC_VORBIS:-1:-1}function nestegg_track_video_params(_,e,r){var t=[uint64_t],n=ne_find_track_entry(_,e);return n?nestegg_track_type(_,e)!=NESTEGG_TRACK_VIDEO||0!=ne_get_uint(n.video.pixel_width,t)?-1:(r.width=t[0],0!=ne_get_uint(n.video.pixel_height,t)?-1:(r.height=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_bottom,t),r.crop_bottom=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_top,t),r.crop_top=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_left,t),r.crop_left=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_right,t),r.crop_right=t[0],t[0]=r.width,ne_get_uint(n.video.display_width,t),r.display_width=t[0],t[0]=r.height,ne_get_uint(n.video.display_height,t),r.display_height=t[0],0)):-1}function nestegg_read_packet(_,e){var r=int_,t=[uint64_t],n=[uint64_t];for(e[0]=null;;){if(1!=(r=ne_peek_element(_,t,n)))return r;if(ne_is_suspend_element(t))return 1!=(r=ne_read_element(_,t,n))?r:r=ne_read_block(_,t,n[0],e);if(1!=(r=ne_parse(_,null)))return r}return 1}function nestegg_free_packet(_){for(var e;_.frame;)e=_.frame,_.frame=e.next,e.data="",e="";_=""}function nestegg_packet_track(_,e){return e[0]=_[0].track,0}function nestegg_packet_count(_,e){var r=_[0].frame;for(e[0]=0;r;)e[0]+=1,r=r.next;return 0}function nestegg_packet_data(_,e,r,t){var n=_[0].frame,i=0;for(r[0]=null,t[0]=0;n;){if(i==e)return r[0]=n.data,t[0]=n.length,0;i+=1,n=n.next}return-1}VPX_IMAGE_ABI_VERSION=1;var VPX_IMG_FMT_PLANAR=256,VPX_IMG_FMT_UV_FLIP=512,VPX_IMG_FMT_HAS_ALPHA=1024,VPX_IMG_FMT_NONE=0,VPX_IMG_FMT_RGB24=1,VPX_IMG_FMT_RGB32=2,VPX_IMG_FMT_RGB565=3,VPX_IMG_FMT_RGB555=4,VPX_IMG_FMT_UYVY=5,VPX_IMG_FMT_YUY2=6,VPX_IMG_FMT_YVYU=7,VPX_IMG_FMT_BGR24=8,VPX_IMG_FMT_RGB32_LE=9,VPX_IMG_FMT_ARGB=10,VPX_IMG_FMT_ARGB_LE=11,VPX_IMG_FMT_RGB565_LE=12,VPX_IMG_FMT_RGB555_LE=13,VPX_IMG_FMT_YV12=VPX_IMG_FMT_PLANAR|VPX_IMG_FMT_UV_FLIP|1,VPX_IMG_FMT_I420=2|VPX_IMG_FMT_PLANAR,VPX_IMG_FMT_VPXYV12=VPX_IMG_FMT_PLANAR|VPX_IMG_FMT_UV_FLIP|3,VPX_IMG_FMT_VPXI420=4|VPX_IMG_FMT_PLANAR,IMG_FMT_PLANAR=VPX_IMG_FMT_PLANAR,IMG_FMT_UV_FLIP=VPX_IMG_FMT_UV_FLIP,IMG_FMT_HAS_ALPHA=VPX_IMG_FMT_HAS_ALPHA,IMG_FMT_NONE=VPX_IMG_FMT_NONE,IMG_FMT_RGB24=VPX_IMG_FMT_RGB24,IMG_FMT_RGB32=VPX_IMG_FMT_RGB32,IMG_FMT_RGB565=VPX_IMG_FMT_RGB565,IMG_FMT_RGB555=VPX_IMG_FMT_RGB555,IMG_FMT_UYVY=VPX_IMG_FMT_UYVY,IMG_FMT_YUY2=VPX_IMG_FMT_YUY2,IMG_FMT_YVYU=VPX_IMG_FMT_YVYU,IMG_FMT_BGR24=VPX_IMG_FMT_BGR24,IMG_FMT_RGB32_LE=VPX_IMG_FMT_RGB32_LE,IMG_FMT_ARGB=VPX_IMG_FMT_ARGB,IMG_FMT_ARGB_LE=VPX_IMG_FMT_ARGB_LE,IMG_FMT_RGB565_LE=VPX_IMG_FMT_RGB565_LE,IMG_FMT_RGB555_LE=VPX_IMG_FMT_RGB555_LE,IMG_FMT_YV12=VPX_IMG_FMT_YV12,IMG_FMT_I420=VPX_IMG_FMT_I420,IMG_FMT_VPXYV12=VPX_IMG_FMT_VPXYV12,IMG_FMT_VPXI420=VPX_IMG_FMT_VPXI420;function img_alloc_helper(_,e,r,t,n,i){var a,o,s=int_,f=int_,d=int_,E=int_,c=int_;switch(n||(n=1),n&n-1&&alert("goto fail"),e){case VPX_IMG_FMT_RGB32:case VPX_IMG_FMT_RGB32_LE:case VPX_IMG_FMT_ARGB:case VPX_IMG_FMT_ARGB_LE:E=32;break;case VPX_IMG_FMT_RGB24:case VPX_IMG_FMT_BGR24:E=24;break;case VPX_IMG_FMT_RGB565:case VPX_IMG_FMT_RGB565_LE:case VPX_IMG_FMT_RGB555:case VPX_IMG_FMT_RGB555_LE:case VPX_IMG_FMT_UYVY:case VPX_IMG_FMT_YUY2:case VPX_IMG_FMT_YVYU:E=16;break;case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:E=12;break;default:E=16}switch(e){case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:f=1;break;default:f=0}switch(e){case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:d=1;break;default:d=0}return o=r+(c=(1<<f)-1)&~c,a=t+(c=(1<<d)-1)&~c,s=(s=e&VPX_IMG_FMT_PLANAR?o:E*o/8)+n-1&~(n-1),_||((_=new vpx_image_t)||alert("goto fail"),_.self_allocd=1),_.img_data=i,i||(_.img_data=malloc(e&VPX_IMG_FMT_PLANAR?a*o*E/8:a*s,0),_.img_data_owner=1),_.img_data||alert("goto fail"),_.fmt=_.fmt=e,_.w=_.w=o,_.h=_.h=a,_.x_chroma_shift=_.x_chroma_shift=f,_.y_chroma_shift=_.y_chroma_shift=d,_.bps=_.bps=E,_.stride[VPX_PLANE_Y]=_.stride[VPX_PLANE_ALPHA]=s,_.stride[VPX_PLANE_U]=_.stride[VPX_PLANE_V]=s>>f,vpx_img_set_rect(_,0,0,r,t)?(vpx_img_free(_),null):_}function vpx_img_alloc(_,e,r,t,n){return img_alloc_helper(_,e,r,t,n,null)}function vpx_img_set_rect(_,e,r,t,n){var i=char_,a=0;return e+t<=_.w&&r+n<=_.h?(_.d_w=_.d_w=t,_.d_h=_.d_h=n,_.fmt&VPX_IMG_FMT_PLANAR?(i=_.img_data,a=_.img_data_off,_.fmt&VPX_IMG_FMT_HAS_ALPHA&&(_.planes[VPX_PLANE_ALPHA]=i,_.planes_off[VPX_PLANE_ALPHA]=a+e+r*_.stride[VPX_PLANE_ALPHA],a+=_.h*_.stride[VPX_PLANE_ALPHA]),_.planes[VPX_PLANE_Y]=i,_.planes_off[VPX_PLANE_Y]=a+e+r*_.stride[VPX_PLANE_Y],a+=_.h*_.stride[VPX_PLANE_Y],_.fmt&VPX_IMG_FMT_UV_FLIP?(_.planes[VPX_PLANE_V]=i,_.planes_off[VPX_PLANE_V]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_V],a+=(_.h>>_.y_chroma_shift)*_.stride[VPX_PLANE_V],_.planes[VPX_PLANE_U]=i,_.planes_off[VPX_PLANE_U]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_U]):(_.planes[VPX_PLANE_U]=i,_.planes_off[VPX_PLANE_U]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_U],a+=(_.h>>_.y_chroma_shift)*_.stride[VPX_PLANE_U],_.planes[VPX_PLANE_V]=i,_.planes_off[VPX_PLANE_V]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_V])):(_.planes[VPX_PLANE_PACKED]=_.img_data,_.img_data_of,parseInt(e*_.bps/8+r*_.stride[VPX_PLANE_PACKED],10)),0):-1}function vpx_img_free(_){_&&(_.img_data&&_.img_data_owner&&(_.img_data=""),_.self_allocd&&(_=""))}var bool_decoder=function(){this.input=char_,this.input_off=0,this.input_len=size_t,this.range=int_,this.value=int_,this.bit_count=int_};function init_bool_decoder(_,e,r,t){t>=2?(_.value=e[r+0]<<8|e[r+1],_.input=e,_.input_off=r+2,_.input_len=t-2):(_.value=0,_.input=null,_.input_len=0),_.range=255,_.bit_count=0}function bool_get(_,e){var r=1+((_.range-1)*e>>8),t=r<<8,n=int_;for(_.value>=t?(n=1,_.range-=r,_.value-=t):(n=0,_.range=r);_.range<128;)_.value<<=1,_.range<<=1,8==++_.bit_count&&(_.bit_count=0,_.input_len&&(_.value|=_.input[_.input_off++],_.input_len--));return n}function bool_get_bit(_){return bool_get(_,128)}function bool_get_uint(_,e){var r=0,t=int_;for(t=e-1;t>=0;t--)r|=bool_get_bit(_)<<t;return r}function bool_get_int(_,e){var r=0,t=int_;for(t=e-1;t>=0;t--)r|=bool_get_bit(_)<<t;return bool_get_bit(_)?-r:r}function bool_maybe_get_int(_,e){return bool_get_bit(_)?bool_get_int(_,e):0}function bool_read_tree(_,e,r,t){var n=0;if(void 0!==t)for(;(n=e[n+bool_get(_,r[t+(n>>1)])])>0;);else for(;(n=e[n+bool_get(_,r[n>>1])])>0;);return-n}function BITS_MASK(_){return(1<<_)-1}function BITS_GET(_,e,r){return _>>e&BITS_MASK(r)}var vp8_frame_hdr=function(){this.is_keyframe=int_,this.is_experimental=int_,this.version=int_,this.is_shown=int_,this.part0_sz=int_,this.kf=new Object({w:int_,h:int_,scale_w:int_,scale_h:int_}),this.frame_size_updated=int_},MB_FEATURE_TREE_PROBS=3,MAX_MB_SEGMENTS=4,vp8_segment_hdr=function(){this.enabled=int_,this.update_data=int_,this.update_map=int_,this.abs_=int_,this.tree_probs=new Array(MB_FEATURE_TREE_PROBS),this.lf_level=new Array(MAX_MB_SEGMENTS),this.quant_idx=new Array(MAX_MB_SEGMENTS)},BLOCK_CONTEXTS=4,vp8_loopfilter_hdr=function(){this.use_simple=int_,this.level=int_,this.sharpness=int_,this.delta_enabled=int_,this.ref_delta=new Array(BLOCK_CONTEXTS),this.mode_delta=new Array(BLOCK_CONTEXTS)},MAX_PARTITIONS=8,vp8_token_hdr=function(){this.partitions=int_,this.partition_sz=new Array(MAX_PARTITIONS)},vp8_quant_hdr=function(){this.q_index=int_,this.delta_update=int_,this.y1_dc_delta_q=int_,this.y2_dc_delta_q=int_,this.y2_ac_delta_q=int_,this.uv_dc_delta_q=int_,this.uv_ac_delta_q=int_},vp8_reference_hdr=function(){this.refresh_last=int_,this.refresh_gf=int_,this.refresh_arf=int_,this.copy_gf=int_,this.copy_arf=int_,this.sign_bias=new Array(4),this.refresh_entropy=int_},BLOCK_TYPES=4,PREV_COEF_CONTEXTS=3,COEF_BANDS=8,ENTROPY_NODES=11,coeff_probs_table_t=function(){return ArrM(new Array(BLOCK_TYPES,COEF_BANDS,PREV_COEF_CONTEXTS,ENTROPY_NODES),char_)},MV_PROB_CNT=19,mv_component_probs_t=function(){return new Array(MV_PROB_CNT)},Arr_1056=Arr(1056,0),vp8_entropy_hdr=function(){this.coeff_probs=new coeff_probs_table_t,this.coeff_probs_=Arr(1056,0),this.mv_probs=Arr_new(2,mv_component_probs_t),this.coeff_skip_enabled=int_,this.coeff_skip_prob=char_,this.y_mode_probs=new Array(0,0,0,0),this.uv_mode_probs=new Array(0,0,0),this.prob_inter=char_,this.prob_last=char_,this.prob_gf=char_},CURRENT_FRAME=0,LAST_FRAME=1,GOLDEN_FRAME=2,ALTREF_FRAME=3,NUM_REF_FRAMES=4,filter_t=function(){return new Array(6)},mv=function(){this.d={x:int16_t,y:int16_t}},mb_base_info=function(){this.y_mode=char_,this.uv_mode=char_,this.segment_id=char_,this.ref_frame=char_,this.skip_coeff=char_,this.need_mc_border=char_,this.partitioning=null,this.mv=new mv,this.eob_mask=int_},mb_info=function(){this.base=new mb_base_info,this.splitt=new Object({mvs:Arr_new(16,mv),modes:new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)})},token_entropy_ctx_t=function(){return new Array(9)},token_decoder=function(){this.bool=new bool_decoder,this.left_token_entropy_ctx=new token_entropy_ctx_t,this.coeffs=short_},TOKEN_BLOCK_Y1=0,TOKEN_BLOCK_UV=1,TOKEN_BLOCK_Y2=2,TOKEN_BLOCK_TYPES=3,dequant_factors=function(){this.quant_idx=int_,this.factor=ArrM(new Array(TOKEN_BLOCK_TYPES,2),short_)},ref_cnt_img=function(){this.img=new vpx_image_t,this.ref_cnt=int_},vp8_decoder_ctx=function(){this.error=[],this.frame_cnt=int_,this.frame_hdr=new vp8_frame_hdr,this.segment_hdr=new vp8_segment_hdr,this.loopfilter_hdr=new vp8_loopfilter_hdr,this.token_hdr=new vp8_token_hdr,this.quant_hdr=new vp8_quant_hdr,this.reference_hdr=new vp8_reference_hdr,this.entropy_hdr=new vp8_entropy_hdr,this.saved_entropy=new vp8_entropy_hdr,this.saved_entropy_valid=int_,this.mb_rows=int_,this.mb_cols=int_,this.mb_info_storage=null,this.mb_info_storage_off=0,this.mb_info_storage_object=mb_info,this.mb_info_rows_storage=null,this.mb_info_rows_storage_off=0,this.mb_info_rows_storage_object=mb_info,this.mb_info_rows=null,this.mb_info_rows_off=0,this.above_token_entropy_ctx=null,this.above_token_entropy_ctx_object=token_entropy_ctx_t,this.tokens=Arr_new(MAX_PARTITIONS,token_decoder),this.dequant_factors=Arr_new(MAX_MB_SEGMENTS,dequant_factors),this.frame_strg=Arr_new(NUM_REF_FRAMES,ref_cnt_img),this.ref_frames=Arr_new(NUM_REF_FRAMES,ref_cnt_img),this.ref_frame_offsets=new Array(0,0,0,0),this.ref_frame_offsets_=new Array(0,0,0,0),this.subpixel_filters=new filter_t};function CLAMP_255(_){return _<0?0:_>255?255:_}function vp8_dixie_walsh(_,e,r,t){var n=int_,i=int_,a=int_,o=int_,s=int_,f=int_,d=int_,E=int_,c=int_,l=_,m=e,A=r,u=t;for(n=0;n<4;n++)i=l[m+0]+l[m+12],a=l[m+4]+l[m+8],o=l[m+4]-l[m+8],s=l[m+0]-l[m+12],A[u+0]=i+a,A[u+4]=o+s,A[u+8]=i-a,A[u+12]=s-o,m++,u++;for(l=r,m=t,A=r,u=t,n=0;n<4;n++)f=(i=l[m+0]+l[m+3])+(a=l[m+1]+l[m+2]),d=(o=l[m+1]-l[m+2])+(s=l[m+0]-l[m+3]),E=i-a,c=s-o,A[u+0]=f+3>>3,A[u+1]=d+3>>3,A[u+2]=E+3>>3,A[u+3]=c+3>>3,m+=4,u+=4}var cospi8sqrt2minus1=20091,sinpi8sqrt2=35468;function idct_columns(_,e,r,t){var n=int_,i=int_,a=int_,o=int_,s=int_,f=_,d=e,E=r,c=t;for(n=0;n<4;n++)i=f[d+0]+f[d+8],a=f[d+0]-f[d+8],o=(f[d+4]*sinpi8sqrt2>>16)-(f[d+12]+(f[d+12]*cospi8sqrt2minus1>>16)),s=f[d+4]+(f[d+4]*cospi8sqrt2minus1>>16)+(f[d+12]*sinpi8sqrt2>>16),E[c+0]=i+s,E[c+12]=i-s,E[c+4]=a+o,E[c+8]=a-o,d++,c++}var tmp_2=Arr(16,0);function vp8_dixie_idct_add(_,e,r,t,n,i,a){var o=int_,s=int_,f=int_,d=int_,E=int_;for(idct_columns(i,a,tmp_2,0),i=tmp_2,a=0,o=0;o<4;o++)s=i[a+0]+i[a+2],f=i[a+0]-i[a+2],d=(i[a+1]*sinpi8sqrt2>>16)-(i[a+3]+(i[a+3]*cospi8sqrt2minus1>>16)),E=i[a+1]+(i[a+1]*cospi8sqrt2minus1>>16)+(i[a+3]*sinpi8sqrt2>>16),_[e+0]=r[t+0]+(s+E+4>>3),_[e+3]=r[t+3]+(s-E+4>>3),_[e+1]=r[t+1]+(f+d+4>>3),_[e+2]=r[t+2]+(f-d+4>>3),a+=4,e+=n,t+=n}var k_coeff_entropy_update_probs=new Array(new Array(new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(176,246,255,255,255,255,255,255,255,255,255),new Array(223,241,252,255,255,255,255,255,255,255,255),new Array(249,253,253,255,255,255,255,255,255,255,255)),new Array(new Array(255,244,252,255,255,255,255,255,255,255,255),new Array(234,254,254,255,255,255,255,255,255,255,255),new Array(253,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,246,254,255,255,255,255,255,255,255,255),new Array(239,253,254,255,255,255,255,255,255,255,255),new Array(254,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,248,254,255,255,255,255,255,255,255,255),new Array(251,255,254,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(251,254,254,255,255,255,255,255,255,255,255),new Array(254,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,253,255,254,255,255,255,255,255,255),new Array(250,255,254,255,254,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(217,255,255,255,255,255,255,255,255,255,255),new Array(225,252,241,253,255,255,254,255,255,255,255),new Array(234,250,241,250,253,255,253,254,255,255,255)),new Array(new Array(255,254,255,255,255,255,255,255,255,255,255),new Array(223,254,254,255,255,255,255,255,255,255,255),new Array(238,253,254,254,255,255,255,255,255,255,255)),new Array(new Array(255,248,254,255,255,255,255,255,255,255,255),new Array(249,254,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,255,255,255,255,255,255,255,255,255),new Array(247,254,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(252,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,254,255,255,255,255,255,255,255,255),new Array(253,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,253,255,255,255,255,255,255,255,255),new Array(250,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(186,251,250,255,255,255,255,255,255,255,255),new Array(234,251,244,254,255,255,255,255,255,255,255),new Array(251,251,243,253,254,255,254,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(236,253,254,255,255,255,255,255,255,255,255),new Array(251,253,253,254,254,255,255,255,255,255,255)),new Array(new Array(255,254,254,255,255,255,255,255,255,255,255),new Array(254,254,254,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,255,255,255,255,255,255,255,255,255),new Array(254,254,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(248,255,255,255,255,255,255,255,255,255,255),new Array(250,254,252,254,255,255,255,255,255,255,255),new Array(248,254,249,253,255,255,255,255,255,255,255)),new Array(new Array(255,253,253,255,255,255,255,255,255,255,255),new Array(246,253,253,255,255,255,255,255,255,255,255),new Array(252,254,251,254,254,255,255,255,255,255,255)),new Array(new Array(255,254,252,255,255,255,255,255,255,255,255),new Array(248,254,253,255,255,255,255,255,255,255,255),new Array(253,255,254,254,255,255,255,255,255,255,255)),new Array(new Array(255,251,254,255,255,255,255,255,255,255,255),new Array(245,251,254,255,255,255,255,255,255,255,255),new Array(253,253,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,251,253,255,255,255,255,255,255,255,255),new Array(252,253,254,255,255,255,255,255,255,255,255),new Array(255,254,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,252,255,255,255,255,255,255,255,255,255),new Array(249,255,254,255,255,255,255,255,255,255,255),new Array(255,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,253,255,255,255,255,255,255,255,255),new Array(250,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)))),k_default_y_mode_probs=new Array(112,86,140,37),k_default_uv_mode_probs=new Array(162,101,204),k_default_coeff_probs=new Array(new Array(new Array(new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128)),new Array(new Array(253,136,254,255,228,219,128,128,128,128,128),new Array(189,129,242,255,227,213,255,219,128,128,128),new Array(106,126,227,252,214,209,255,255,128,128,128)),new Array(new Array(1,98,248,255,236,226,255,255,128,128,128),new Array(181,133,238,254,221,234,255,154,128,128,128),new Array(78,134,202,247,198,180,255,219,128,128,128)),new Array(new Array(1,185,249,255,243,255,128,128,128,128,128),new Array(184,150,247,255,236,224,128,128,128,128,128),new Array(77,110,216,255,236,230,128,128,128,128,128)),new Array(new Array(1,101,251,255,241,255,128,128,128,128,128),new Array(170,139,241,252,236,209,255,255,128,128,128),new Array(37,116,196,243,228,255,255,255,128,128,128)),new Array(new Array(1,204,254,255,245,255,128,128,128,128,128),new Array(207,160,250,255,238,128,128,128,128,128,128),new Array(102,103,231,255,211,171,128,128,128,128,128)),new Array(new Array(1,152,252,255,240,255,128,128,128,128,128),new Array(177,135,243,255,234,225,128,128,128,128,128),new Array(80,129,211,255,194,224,128,128,128,128,128)),new Array(new Array(1,1,255,128,128,128,128,128,128,128,128),new Array(246,1,255,128,128,128,128,128,128,128,128),new Array(255,128,128,128,128,128,128,128,128,128,128))),new Array(new Array(new Array(198,35,237,223,193,187,162,160,145,155,62),new Array(131,45,198,221,172,176,220,157,252,221,1),new Array(68,47,146,208,149,167,221,162,255,223,128)),new Array(new Array(1,149,241,255,221,224,255,255,128,128,128),new Array(184,141,234,253,222,220,255,199,128,128,128),new Array(81,99,181,242,176,190,249,202,255,255,128)),new Array(new Array(1,129,232,253,214,197,242,196,255,255,128),new Array(99,121,210,250,201,198,255,202,128,128,128),new Array(23,91,163,242,170,187,247,210,255,255,128)),new Array(new Array(1,200,246,255,234,255,128,128,128,128,128),new Array(109,178,241,255,231,245,255,255,128,128,128),new Array(44,130,201,253,205,192,255,255,128,128,128)),new Array(new Array(1,132,239,251,219,209,255,165,128,128,128),new Array(94,136,225,251,218,190,255,255,128,128,128),new Array(22,100,174,245,186,161,255,199,128,128,128)),new Array(new Array(1,182,249,255,232,235,128,128,128,128,128),new Array(124,143,241,255,227,234,128,128,128,128,128),new Array(35,77,181,251,193,211,255,205,128,128,128)),new Array(new Array(1,157,247,255,236,231,255,255,128,128,128),new Array(121,141,235,255,225,227,255,255,128,128,128),new Array(45,99,188,251,195,217,255,224,128,128,128)),new Array(new Array(1,1,251,255,213,255,128,128,128,128,128),new Array(203,1,248,255,255,128,128,128,128,128,128),new Array(137,1,177,255,224,255,128,128,128,128,128))),new Array(new Array(new Array(253,9,248,251,207,208,255,192,128,128,128),new Array(175,13,224,243,193,185,249,198,255,255,128),new Array(73,17,171,221,161,179,236,167,255,234,128)),new Array(new Array(1,95,247,253,212,183,255,255,128,128,128),new Array(239,90,244,250,211,209,255,255,128,128,128),new Array(155,77,195,248,188,195,255,255,128,128,128)),new Array(new Array(1,24,239,251,218,219,255,205,128,128,128),new Array(201,51,219,255,196,186,128,128,128,128,128),new Array(69,46,190,239,201,218,255,228,128,128,128)),new Array(new Array(1,191,251,255,255,128,128,128,128,128,128),new Array(223,165,249,255,213,255,128,128,128,128,128),new Array(141,124,248,255,255,128,128,128,128,128,128)),new Array(new Array(1,16,248,255,255,128,128,128,128,128,128),new Array(190,36,230,255,236,255,128,128,128,128,128),new Array(149,1,255,128,128,128,128,128,128,128,128)),new Array(new Array(1,226,255,128,128,128,128,128,128,128,128),new Array(247,192,255,128,128,128,128,128,128,128,128),new Array(240,128,255,128,128,128,128,128,128,128,128)),new Array(new Array(1,134,252,255,255,128,128,128,128,128,128),new Array(213,62,250,255,255,128,128,128,128,128,128),new Array(55,93,255,128,128,128,128,128,128,128,128)),new Array(new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128))),new Array(new Array(new Array(202,24,213,235,186,191,220,160,240,175,255),new Array(126,38,182,232,169,184,228,174,255,187,128),new Array(61,46,138,219,151,178,240,170,255,216,128)),new Array(new Array(1,112,230,250,199,191,247,159,255,255,128),new Array(166,109,228,252,211,215,255,174,128,128,128),new Array(39,77,162,232,172,180,245,178,255,255,128)),new Array(new Array(1,52,220,246,198,199,249,220,255,255,128),new Array(124,74,191,243,183,193,250,221,255,255,128),new Array(24,71,130,219,154,170,243,182,255,255,128)),new Array(new Array(1,182,225,249,219,240,255,224,128,128,128),new Array(149,150,226,252,216,205,255,171,128,128,128),new Array(28,108,170,242,183,194,254,223,255,255,128)),new Array(new Array(1,81,230,252,204,203,255,192,128,128,128),new Array(123,102,209,247,188,196,255,233,128,128,128),new Array(20,95,153,243,164,173,255,203,128,128,128)),new Array(new Array(1,222,248,255,216,213,128,128,128,128,128),new Array(168,175,246,252,235,205,255,255,128,128,128),new Array(47,116,215,255,211,212,255,255,128,128,128)),new Array(new Array(1,121,236,253,212,214,255,255,128,128,128),new Array(141,84,213,252,201,202,255,219,128,128,128),new Array(42,80,160,240,162,185,255,205,128,128,128)),new Array(new Array(1,1,255,128,128,128,128,128,128,128,128),new Array(244,1,255,128,128,128,128,128,128,128,128),new Array(238,1,255,128,128,128,128,128,128,128,128)))),k_mv_entropy_update_probs=new Array(new Array(237,246,253,253,254,254,254,254,254,254,254,254,254,254,250,250,252,254,254),new Array(231,243,245,253,254,254,254,254,254,254,254,254,254,254,251,251,254,254,254)),k_default_mv_probs=function(){return new Array(new Array(162,128,225,146,172,147,214,39,156,128,129,132,75,145,178,206,239,254,254),new Array(164,128,204,170,119,235,140,230,228,128,130,130,74,148,180,203,236,254,254))},dc_q_lookup=new Array(4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157),ac_q_lookup=new Array(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284),kf_y_mode_probs=new Array(145,156,163,128),kf_uv_mode_probs=new Array(142,114,183),kf_b_mode_probs=new Array(new Array(new Array(231,120,48,89,115,113,120,152,112),new Array(152,179,64,126,170,118,46,70,95),new Array(175,69,143,80,85,82,72,155,103),new Array(56,58,10,171,218,189,17,13,152),new Array(144,71,10,38,171,213,144,34,26),new Array(114,26,17,163,44,195,21,10,173),new Array(121,24,80,195,26,62,44,64,85),new Array(170,46,55,19,136,160,33,206,71),new Array(63,20,8,114,114,208,12,9,226),new Array(81,40,11,96,182,84,29,16,36)),new Array(new Array(134,183,89,137,98,101,106,165,148),new Array(72,187,100,130,157,111,32,75,80),new Array(66,102,167,99,74,62,40,234,128),new Array(41,53,9,178,241,141,26,8,107),new Array(104,79,12,27,217,255,87,17,7),new Array(74,43,26,146,73,166,49,23,157),new Array(65,38,105,160,51,52,31,115,128),new Array(87,68,71,44,114,51,15,186,23),new Array(47,41,14,110,182,183,21,17,194),new Array(66,45,25,102,197,189,23,18,22)),new Array(new Array(88,88,147,150,42,46,45,196,205),new Array(43,97,183,117,85,38,35,179,61),new Array(39,53,200,87,26,21,43,232,171),new Array(56,34,51,104,114,102,29,93,77),new Array(107,54,32,26,51,1,81,43,31),new Array(39,28,85,171,58,165,90,98,64),new Array(34,22,116,206,23,34,43,166,73),new Array(68,25,106,22,64,171,36,225,114),new Array(34,19,21,102,132,188,16,76,124),new Array(62,18,78,95,85,57,50,48,51)),new Array(new Array(193,101,35,159,215,111,89,46,111),new Array(60,148,31,172,219,228,21,18,111),new Array(112,113,77,85,179,255,38,120,114),new Array(40,42,1,196,245,209,10,25,109),new Array(100,80,8,43,154,1,51,26,71),new Array(88,43,29,140,166,213,37,43,154),new Array(61,63,30,155,67,45,68,1,209),new Array(142,78,78,16,255,128,34,197,171),new Array(41,40,5,102,211,183,4,1,221),new Array(51,50,17,168,209,192,23,25,82)),new Array(new Array(125,98,42,88,104,85,117,175,82),new Array(95,84,53,89,128,100,113,101,45),new Array(75,79,123,47,51,128,81,171,1),new Array(57,17,5,71,102,57,53,41,49),new Array(115,21,2,10,102,255,166,23,6),new Array(38,33,13,121,57,73,26,1,85),new Array(41,10,67,138,77,110,90,47,114),new Array(101,29,16,10,85,128,101,196,26),new Array(57,18,10,102,102,213,34,20,43),new Array(117,20,15,36,163,128,68,1,26)),new Array(new Array(138,31,36,171,27,166,38,44,229),new Array(67,87,58,169,82,115,26,59,179),new Array(63,59,90,180,59,166,93,73,154),new Array(40,40,21,116,143,209,34,39,175),new Array(57,46,22,24,128,1,54,17,37),new Array(47,15,16,183,34,223,49,45,183),new Array(46,17,33,183,6,98,15,32,183),new Array(65,32,73,115,28,128,23,128,205),new Array(40,3,9,115,51,192,18,6,223),new Array(87,37,9,115,59,77,64,21,47)),new Array(new Array(104,55,44,218,9,54,53,130,226),new Array(64,90,70,205,40,41,23,26,57),new Array(54,57,112,184,5,41,38,166,213),new Array(30,34,26,133,152,116,10,32,134),new Array(75,32,12,51,192,255,160,43,51),new Array(39,19,53,221,26,114,32,73,255),new Array(31,9,65,234,2,15,1,118,73),new Array(88,31,35,67,102,85,55,186,85),new Array(56,21,23,111,59,205,45,37,192),new Array(55,38,70,124,73,102,1,34,98)),new Array(new Array(102,61,71,37,34,53,31,243,192),new Array(69,60,71,38,73,119,28,222,37),new Array(68,45,128,34,1,47,11,245,171),new Array(62,17,19,70,146,85,55,62,70),new Array(75,15,9,9,64,255,184,119,16),new Array(37,43,37,154,100,163,85,160,1),new Array(63,9,92,136,28,64,32,201,85),new Array(86,6,28,5,64,255,25,248,1),new Array(56,8,17,132,137,255,55,116,128),new Array(58,15,20,82,135,57,26,121,40)),new Array(new Array(164,50,31,137,154,133,25,35,218),new Array(51,103,44,131,131,123,31,6,158),new Array(86,40,64,135,148,224,45,183,128),new Array(22,26,17,131,240,154,14,1,209),new Array(83,12,13,54,192,255,68,47,28),new Array(45,16,21,91,64,222,7,1,197),new Array(56,21,39,155,60,138,23,102,213),new Array(85,26,85,85,128,128,32,146,171),new Array(18,11,7,63,144,171,4,4,246),new Array(35,27,10,146,174,171,12,26,128)),new Array(new Array(190,80,35,99,180,80,126,54,45),new Array(85,126,47,87,176,51,41,20,32),new Array(101,75,128,139,118,146,116,128,85),new Array(56,41,15,176,236,85,37,9,62),new Array(146,36,19,30,171,255,97,27,20),new Array(71,30,17,119,118,255,17,18,138),new Array(101,38,60,138,55,70,43,26,142),new Array(138,45,61,62,219,1,81,188,64),new Array(32,41,20,117,151,142,20,21,163),new Array(112,19,12,61,195,128,48,4,24))),kf_y_mode_tree=new Array(-B_PRED,2,4,6,-DC_PRED,-V_PRED,-H_PRED,-TM_PRED),y_mode_tree=new Array(-DC_PRED,2,4,6,-V_PRED,-H_PRED,-TM_PRED,-B_PRED),uv_mode_tree=new Array(-DC_PRED,2,-V_PRED,4,-H_PRED,-TM_PRED),b_mode_tree=new Array(-B_DC_PRED,2,-B_TM_PRED,4,-B_VE_PRED,6,8,12,-B_HE_PRED,10,-B_RD_PRED,-B_VR_PRED,-B_LD_PRED,14,-B_VL_PRED,16,-B_HD_PRED,-B_HU_PRED),small_mv_tree=new Array(2,8,4,6,-0,-1,-2,-3,10,12,-4,-5,-6,-7),mv_ref_tree=new Array(-ZEROMV,2,-NEARESTMV,4,-NEARMV,6,-NEWMV,-SPLITMV),submv_ref_tree=new Array(-LEFT4X4,2,-ABOVE4X4,4,-ZERO4X4,-NEW4X4),split_mv_tree=new Array(-3,2,-2,4,-0,-1),default_b_mode_probs=new Array(120,90,79,133,87,85,80,111,151),mv_counts_to_probs=new Array(new Array(7,1,1,143),new Array(14,18,14,107),new Array(135,64,57,68),new Array(60,56,128,65),new Array(159,134,128,34),new Array(234,188,128,28)),split_mv_probs=new Array(110,111,150),submv_ref_probs2=new Array(new Array(147,136,18),new Array(106,145,1),new Array(179,121,1),new Array(223,1,34),new Array(208,1,1)),mv_partitions=new Array(new Array(0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1),new Array(0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1),new Array(0,0,1,1,0,0,1,1,2,2,3,3,2,2,3,3),new Array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)),mv_clamp_rect=function(){this.to_left=int_,this.to_right=int_,this.to_top=int_,this.to_bottom=int_};function clamp_mv(_,e){var r=new mv;return r.d.x=_.d.x<e.to_left?e.to_left:_.d.x,r.d.x=_.d.x>e.to_right?e.to_right:r.d.x,r.d.y=_.d.y<e.to_top?e.to_top:_.d.y,r.d.y=_.d.y>e.to_bottom?e.to_bottom:r.d.y,r}function read_segment_id(_,e){return bool_get(_,e.tree_probs[0])?2+bool_get(_,e.tree_probs[2]):bool_get(_,e.tree_probs[1])}function above_block_mode(_,e,r){if(r<4)switch(e.base.y_mode){case DC_PRED:return B_DC_PRED;case V_PRED:return B_VE_PRED;case H_PRED:return B_HE_PRED;case TM_PRED:return B_TM_PRED;case B_PRED:return e.splitt.mvs[r+12].d.x;default:assert(0)}return _.splitt.mvs[r-4].d.x}function left_block_mode(_,e,r){if(!(3&r))switch(e.base.y_mode){case DC_PRED:return B_DC_PRED;case V_PRED:return B_VE_PRED;case H_PRED:return B_HE_PRED;case TM_PRED:return B_TM_PRED;case B_PRED:return e.splitt.mvs[r+3].d.x;default:assert(0)}return _.splitt.mvs[r-1].d.x}function decode_kf_mb_mode(_,e,r,t,n,i,a){var o,s;if((o=bool_read_tree(a,kf_y_mode_tree,kf_y_mode_probs))==B_PRED){var f=int_;for(f=0;f<16;f++){var d,E=above_block_mode(_[e],n[i],f),c=left_block_mode(_[e],r[t],f);d=bool_read_tree(a,b_mode_tree,kf_b_mode_probs[E][c]),_[e].splitt.modes[f]=_[e].splitt.mvs[f].d.x=d,_[e].splitt.mvs[f].d.y=0}}s=bool_read_tree(a,uv_mode_tree,kf_uv_mode_probs),_[e].base.y_mode=o,_[e].base.uv_mode=s,_[e].base.mv.d.x=_[e].base.mv.d.y=0,_[e].base.ref_frame=0}function decode_intra_mb_mode(_,e,r){var t,n;if((t=bool_read_tree(r,y_mode_tree,e.y_mode_probs))==B_PRED){var i=int_;for(i=0;i<16;i++){var a;a=bool_read_tree(r,b_mode_tree,default_b_mode_probs),_.splitt.modes[i]=_.splitt.mvs[i].d.x=a,_.splitt.mvs[i].d.y=0}}n=bool_read_tree(r,uv_mode_tree,e.uv_mode_probs),_.base.y_mode=t,_.base.uv_mode=n,_.base.mv.d.x=_.base.mv.d.y=0,_.base.ref_frame=CURRENT_FRAME}function read_mv_component(_,e){var r=0;if(bool_get(_,e[0])){var t=0;for(t=0;t<3;t++)r+=bool_get(_,e[9+t])<<t;for(t=9;t>3;t--)r+=bool_get(_,e[9+t])<<t;65520&r&&!bool_get(_,e[12])||(r+=8)}else r=bool_read_tree(_,small_mv_tree,e,2);return r&&bool_get(_,e[1])&&(r=-r),r<<1}function above_block_mv(_,e,r){return r<4?e.base.y_mode==SPLITMV?e.splitt.mvs[r+12]:e.base.mv:_.splitt.mvs[r-4]}function left_block_mv(_,e,r){return 3&r?_.splitt.mvs[r-1]:e.base.y_mode==SPLITMV?e.splitt.mvs[r+3]:e.base.mv}function submv_ref(_,e,r){var t=!(e.d.x||e.d.y)+0,n=!(r.d.x||r.d.y)+0,i=(e.d.x==r.d.x&&e.d.y==r.d.y)+0,a=0;return i&&t?a=4:i?a=3:n?a=2:t&&(a=1),bool_read_tree(_,submv_ref_tree,submv_ref_probs2[a])}function read_mv(_,e,r){e.d.y=read_mv_component(_,r[0]),e.d.x=read_mv_component(_,r[1])}function mv_bias(_,e,r,t){e[_.base.ref_frame]^e[r]&&(t.d.x*=-1,t.d.y*=-1)}var CNT_BEST=0,CNT_ZEROZERO=0,CNT_NEAREST=1,CNT_NEAR=2,CNT_SPLITMV=3,this_mv_1=new mv,this_mv_2=new mv;function find_near_mvs(_,e,r,t,n,i,a,o){var s=t,f=n-1,d=a,E=0,c=o,l=0;d[0].d.x=d[1].d.x=d[2].d.x=0,d[0].d.y=d[1].d.y=d[2].d.y=0,o[0]=o[1]=o[2]=o[3]=0;var m,A=t[n],u=e[r],p=s[f];(A.base.ref_frame!=CURRENT_FRAME&&((A.base.mv.d.x||A.base.mv.d.y)&&(d[++E].d.x=A.base.mv.d.x,d[E].d.y=A.base.mv.d.y,mv_bias(A,i,_.base.ref_frame,d[E]),++l),c[l]+=2),u.base.ref_frame!=CURRENT_FRAME)&&(u.base.mv.d.x||u.base.mv.d.y?((m=this_mv_1).d.x=u.base.mv.d.x,m.d.y=u.base.mv.d.y,mv_bias(u,i,_.base.ref_frame,m),m.d.x==d[E].d.x&&m.d.y==d[E].d.y||(d[++E].d.x=m.d.x,d[E].d.y=m.d.y,++l),c[l]+=2):o[CNT_ZEROZERO]+=2);p.base.ref_frame!=CURRENT_FRAME&&(p.base.mv.d.x||p.base.mv.d.y?((m=this_mv_2).d.x=p.base.mv.d.x,m.d.y=p.base.mv.d.y,mv_bias(p,i,_.base.ref_frame,m),m.d.x==d[E].d.x&&m.d.y==d[E].d.y||(d[++E].d.x=m.d.x,d[E].d.y=m.d.y,++l),c[l]+=1):o[CNT_ZEROZERO]+=1);if(o[CNT_SPLITMV]&&d[E].d.x==a[CNT_NEAREST].d.x&&d[E].d.y==a[CNT_NEAREST].d.y&&(o[CNT_NEAREST]+=1),o[CNT_SPLITMV]=2*((A.base.y_mode==SPLITMV)+(u.base.y_mode==SPLITMV))+(p.base.y_mode==SPLITMV),o[CNT_NEAR]>o[CNT_NEAREST]){var T,y=int_;y=o[CNT_NEAREST],o[CNT_NEAREST]=o[CNT_NEAR],o[CNT_NEAR]=y,y=a[CNT_NEAREST].d.x,T=a[CNT_NEAREST].d.y,a[CNT_NEAREST].d.x=a[CNT_NEAR].d.x,a[CNT_NEAREST].d.y=a[CNT_NEAR].d.y,a[CNT_NEAR].d.x=y,a[CNT_NEAR].d.y=T}o[CNT_NEAREST]>=o[CNT_BEST]&&(a[CNT_BEST].d.x=a[CNT_NEAREST].d.x,a[CNT_BEST].d.y=a[CNT_NEAREST].d.y)}function decode_split_mv(_,e,r,t,n,i){var a,o,s=int_,f=int_,d=int_;for(o=bool_read_tree(i,split_mv_tree,split_mv_probs),a=mv_partitions[o],_.base.partitioning=o,s=0,d=0;d<65535;s++){var E,c,l=new mv;for(f=0;s!=a[f];f++);switch(submv_ref(i,E=left_block_mv(_,e,f),c=above_block_mv(_,r,f))){case LEFT4X4:l=E;break;case ABOVE4X4:l=c;break;case ZERO4X4:l.d.x=l.d.y=0;break;case NEW4X4:read_mv(i,l,t.mv_probs),l.d.x+=n.d.x,l.d.y+=n.d.y;break;default:assert(0)}for(;f<16;f++)s==a[f]&&(_.splitt.mvs[f].d.x=l.d.x,_.splitt.mvs[f].d.y=l.d.y,d|=1<<f)}}function need_mc_border(_,e,r,t,n,i){return e+=_.d.x>>3,r+=_.d.y>>3,e>>1<2||n-(e+t)>>1<3||r>>1<2||i-(r+t)>>1<3}var near_mvs_4=Arr_new(4,mv),mv_cnts_4=new Array(0,0,0,0),probs_4=new Array(0,0,0,0),chroma_mv_4=Arr_new(4,mv),clamped_best_mv_1=new mv;function decode_mvs(_,e,r,t,n,i,a,o,s){var f,d,E,c,l=_.entropy_hdr,m=near_mvs_4,A=clamped_best_mv_1,u=mv_cnts_4,p=probs_4,T=int_;switch(e[r].base.ref_frame=bool_get(s,l.prob_last)?2+bool_get(s,l.prob_gf):1,find_near_mvs(e[r],e,r-1,i,a,_.reference_hdr.sign_bias,m,u),p[0]=mv_counts_to_probs[u[0]][0],p[1]=mv_counts_to_probs[u[1]][1],p[2]=mv_counts_to_probs[u[2]][2],p[3]=mv_counts_to_probs[u[3]][3],(e=e[r]).base.y_mode=bool_read_tree(s,mv_ref_tree,p),e.base.uv_mode=e.base.y_mode,e.base.need_mc_border=0,f=-o.to_left-128>>3,d=-o.to_top-128>>3,E=16*_.mb_cols,c=16*_.mb_rows,e.base.y_mode){case NEARESTMV:e.base.mv=clamp_mv(m[1],o);break;case NEARMV:e.base.mv=clamp_mv(m[2],o);break;case ZEROMV:return void(e.base.mv.d.x=e.base.mv.d.y=0);case NEWMV:A=clamp_mv(m[0],o),read_mv(s,e.base.mv,l.mv_probs),e.base.mv.d.x+=A.d.x,e.base.mv.d.y+=A.d.y;break;case SPLITMV:var y=chroma_mv_4;for(A=clamp_mv(m[0],o),decode_split_mv(e,t[n],i[a],l,A,s),e.base.mv.d.x=e.splitt.mvs[15].d.x,e.base.mv.d.y=e.splitt.mvs[15].d.y,T=0;T<16;T++)if(y[(T>>1&1)+(T>>2&2)].d.x+=e.splitt.mvs[T].d.x,y[(T>>1&1)+(T>>2&2)].d.y+=e.splitt.mvs[T].d.y,need_mc_border(e.splitt.mvs[T],f+4*(3&T),d+(-4&T),4,E,c)){e.base.need_mc_border=1;break}for(T=0;T<4;T++)if(y[T].d.x+=4,y[T].d.y+=4,y[T].d.x>>=2,y[T].d.y>>=2,need_mc_border(y[T],f+8*(1&T),d+8*(T>>1),16,E,c)){e.base.need_mc_border=1;break}return;default:assert(0)}need_mc_border(e.base.mv,f,d,16,E,c)&&(e.base.need_mc_border=1)}var bounds_=new mv_clamp_rect;function vp8_dixie_modemv_process_row(_,e,r,t,n){var i,a,o=0,s=0,f=int_,d=bounds_;for(a=_.mb_info_rows[1+r],s=_.mb_info_rows_off[1+r]+t,i=_.mb_info_rows[1+r-1],o=_.mb_info_rows_off[1+r-1]+t,d.to_left=-(t+1<<7),d.to_right=_.mb_cols-t<<7,d.to_top=-(r+1<<7),d.to_bottom=_.mb_rows-r<<7,f=t;f<t+n;f++)_.segment_hdr.update_map&&(a[s].base.segment_id=read_segment_id(e,_.segment_hdr)),_.entropy_hdr.coeff_skip_enabled&&(a[s].base.skip_coeff=bool_get(e,_.entropy_hdr.coeff_skip_prob)),_.frame_hdr.is_keyframe?(_.segment_hdr.update_map||(a[s].base.segment_id=0),decode_kf_mb_mode(a,s,a,s-1,i,o,e)):(bool_get(e,_.entropy_hdr.prob_inter)?decode_mvs(_,a,s,a,s-1,i,o,d,e):decode_intra_mb_mode(a[s],_.entropy_hdr,e),d.to_left-=128,d.to_right-=128),s++,o++}function vp8_dixie_modemv_init(_){var e,r,t=int_,n=new mb_info,i=0;for(e=_.mb_cols+1,r=_.mb_rows+1,_.frame_hdr.frame_size_updated&&(_.mb_info_storage=null,_.mb_info_rows_storage=null),_.mb_info_storage||(_.mb_info_storage=Arr_new(e*r,_.mb_info_storage_object),_.mb_info_storage_off=0),_.mb_info_rows_storage||(_.mb_info_rows_storage=Arr_new(r,_.mb_info_rows_storage_object),_.mb_info_rows_storage_off=new Array(r)),n=_.mb_info_storage,i=_.mb_info_storage_off+1,t=0;t<r;t++)_.mb_info_rows_storage[t]=n,_.mb_info_rows_storage_off[t]=i,i+=e;_.mb_info_rows=_.mb_info_rows_storage,_.mb_info_rows_off=_.mb_info_rows_storage_off}var EOB_CONTEXT_NODE=0,ZERO_CONTEXT_NODE=1,ONE_CONTEXT_NODE=2,LOW_VAL_CONTEXT_NODE=3,TWO_CONTEXT_NODE=4,THREE_CONTEXT_NODE=5,HIGH_LOW_CONTEXT_NODE=6,CAT_ONE_CONTEXT_NODE=7,CAT_THREEFOUR_CONTEXT_NODE=8,CAT_THREE_CONTEXT_NODE=9,CAT_FIVE_CONTEXT_NODE=10,ZERO_TOKEN=0,ONE_TOKEN=1,TWO_TOKEN=2,THREE_TOKEN=3,FOUR_TOKEN=4,DCT_VAL_CATEGORY1=5,DCT_VAL_CATEGORY2=6,DCT_VAL_CATEGORY3=7,DCT_VAL_CATEGORY4=8,DCT_VAL_CATEGORY5=9,DCT_VAL_CATEGORY6=10,DCT_EOB_TOKEN=11,MAX_ENTROPY_TOKENS=12,left_context_index=new Array(0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,5,5,6,6,7,7,8),above_context_index=new Array(0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,4,5,4,5,6,7,6,7,8);function X(_){return _*PREV_COEF_CONTEXTS*ENTROPY_NODES}var bands_x=new Array(X(0),X(1),X(2),X(3),X(6),X(4),X(5),X(6),X(6),X(6),X(6),X(6),X(6),X(6),X(6),X(7)),extrabits=new Array({min_val:0,length:-1,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:1,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:2,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:3,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:4,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:5,length:0,probs:new Array(159,0,0,0,0,0,0,0,0,0,0,0)},{min_val:7,length:1,probs:new Array(145,165,0,0,0,0,0,0,0,0,0,0)},{min_val:11,length:2,probs:new Array(140,148,173,0,0,0,0,0,0,0,0,0)},{min_val:19,length:3,probs:new Array(135,140,155,176,0,0,0,0,0,0,0,0)},{min_val:35,length:4,probs:new Array(130,134,141,157,180,0,0,0,0,0,0,0)},{min_val:67,length:10,probs:new Array(129,130,133,140,153,177,196,230,243,254,254,0)},{min_val:0,length:-1,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)}),zigzag=new Array(0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15),BLOCK_LOOP=0,DO_WHILE=1,CHECK_0_=2,CAT_FIVE_CONTEXT_NODE_0_=3,CAT_THREEFOUR_CONTEXT_NODE_0_=4,CAT_THREE_CONTEXT_NODE_0_=5,HIGH_LOW_CONTEXT_NODE_0_=6,CAT_ONE_CONTEXT_NODE_0_=7,LOW_VAL_CONTEXT_NODE_0_=8,THREE_CONTEXT_NODE_0_=9,TWO_CONTEXT_NODE_0_=10,ONE_CONTEXT_NODE_0_=11,BLOCK_FINISHED=12,END=13;function decode_mb_tokens(_,e,r,t,n,i,a,o){function s(e){y=(bool_get_bit(_)?-e:e)*P[!!p+0]}function f(e,r){if(!bool_get(_,e))return g=r,1}function d(e,r){if(!bool_get(_,e))return D=R,p<15?(++p,D+=bands_x[p],g=r,1):(g=BLOCK_FINISHED,1)}function E(_){return s(_),D=R+2*ENTROPY_NODES,p<15?(w[I+zigzag[p]]=y,++p,g=DO_WHILE,1):(w[I+zigzag[15]]=y,g=BLOCK_FINISHED,1)}function c(e,r){b+=bool_get(_,extrabits[e].probs[r])<<r}var l,m=int_,A=int_,u=int_,p=int_,T=int_,y=int_,b=int_,v=int_,h=int_,w=short_,I=0,R=0,N=char_,D=0,P=short_;h=0,i!=B_PRED&&i!=SPLITMV?(m=24,A=24,u=1,w=t,I=n+384,P=o[TOKEN_BLOCK_Y2]):(m=0,A=16,u=3,w=t,I=n,P=o[TOKEN_BLOCK_Y1]),l=a,R=u*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES;var g=BLOCK_LOOP;do{if(g==BLOCK_LOOP&&(T=e[left_context_index[m]]+r[above_context_index[m]],p=!u+0,N=l,D=R,D+=T*ENTROPY_NODES,g=DO_WHILE),g==DO_WHILE){if(f(N[(D+=bands_x[p])+EOB_CONTEXT_NODE],BLOCK_FINISHED))continue;g=CHECK_0_}if(g==CHECK_0_){if(d(N[D+ZERO_CONTEXT_NODE],CHECK_0_))continue;if(f(N[D+ONE_CONTEXT_NODE],ONE_CONTEXT_NODE_0_))continue;if(f(N[D+LOW_VAL_CONTEXT_NODE],LOW_VAL_CONTEXT_NODE_0_))continue;if(f(N[D+HIGH_LOW_CONTEXT_NODE],HIGH_LOW_CONTEXT_NODE_0_))continue;if(f(N[D+CAT_THREEFOUR_CONTEXT_NODE],CAT_THREEFOUR_CONTEXT_NODE_0_))continue;if(f(N[D+CAT_FIVE_CONTEXT_NODE],CAT_FIVE_CONTEXT_NODE_0_))continue;b=extrabits[DCT_VAL_CATEGORY6].min_val,v=extrabits[DCT_VAL_CATEGORY6].length;do{c(DCT_VAL_CATEGORY6,v),v--}while(v>=0);if(E(b))continue}if(g!=CAT_FIVE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY5].min_val,c(DCT_VAL_CATEGORY5,4),c(DCT_VAL_CATEGORY5,3),c(DCT_VAL_CATEGORY5,2),c(DCT_VAL_CATEGORY5,1),c(DCT_VAL_CATEGORY5,0),!E(b))){if(g==CAT_THREEFOUR_CONTEXT_NODE_0_){if(f(N[D+CAT_THREE_CONTEXT_NODE],CAT_THREE_CONTEXT_NODE_0_))continue;if(b=extrabits[DCT_VAL_CATEGORY4].min_val,c(DCT_VAL_CATEGORY4,3),c(DCT_VAL_CATEGORY4,2),c(DCT_VAL_CATEGORY4,1),c(DCT_VAL_CATEGORY4,0),E(b))continue}if(g!=CAT_THREE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY3].min_val,c(DCT_VAL_CATEGORY3,2),c(DCT_VAL_CATEGORY3,1),c(DCT_VAL_CATEGORY3,0),!E(b))){if(g==HIGH_LOW_CONTEXT_NODE_0_){if(f(N[D+CAT_ONE_CONTEXT_NODE],CAT_ONE_CONTEXT_NODE_0_))continue;if(b=extrabits[DCT_VAL_CATEGORY2].min_val,c(DCT_VAL_CATEGORY2,1),c(DCT_VAL_CATEGORY2,0),E(b))continue}if(g!=CAT_ONE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY1].min_val,c(DCT_VAL_CATEGORY1,0),!E(b))){if(g==LOW_VAL_CONTEXT_NODE_0_){if(f(N[D+TWO_CONTEXT_NODE],TWO_CONTEXT_NODE_0_))continue;if(f(N[D+THREE_CONTEXT_NODE],THREE_CONTEXT_NODE_0_))continue;if(E(4))continue}if(!(g==THREE_CONTEXT_NODE_0_&&E(3)||g==TWO_CONTEXT_NODE_0_&&E(2))){if(g==ONE_CONTEXT_NODE_0_){if(s(1),D=R+ENTROPY_NODES,p<15){w[I+zigzag[p]]=y,++p,g=DO_WHILE;continue}w[I+zigzag[15]]=y,g=BLOCK_FINISHED}if(g==BLOCK_FINISHED){if(h=((h=(h|(p>1)+0<<m)>>>0)|(T=(p!=!u)+0)<<31)>>>0,e[left_context_index[m]]=r[above_context_index[m]]=T,I+=16,++m<A){g=BLOCK_LOOP;continue}if(25==m){m=0,A=16,R=(u=0)*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES,I=n,P=o[TOKEN_BLOCK_Y1],g=BLOCK_LOOP;continue}if(16==m){R=(u=2)*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES,A=24,P=o[TOKEN_BLOCK_UV],g=BLOCK_LOOP;continue}}g=END}}}}}while(g!=END);return h}function reset_row_context(_){memset(_,0,0,_.length)}function reset_above_context(_,e){var r=0;for(r=0;r<e;++r)memset(_[r],0,0,_[r].length)}function reset_mb_context(_,e,r){memset(_,0,0,8),memset(e,0,0,8),r!=B_PRED&&r!=SPLITMV&&(_[8]=0,e[8]=0)}function vp8_dixie_tokens_process_row(_,e,r,t,n){var i=_.tokens[e],a=i.coeffs,o=400*t,s=int_,f=_.above_token_entropy_ctx,d=+t,E=i.left_token_entropy_ctx,c=_.mb_info_rows[1+r],l=_.mb_info_rows_off[1+r]+t;for(0==r&&reset_above_context(f,n),0==t&&reset_row_context(E),s=t;s<t+n;s++){if(memset(a,o,0,400),c[l].base.skip_coeff)reset_mb_context(E,f[d],c[l].base.y_mode),c[l].base.eob_mask=0;else{var m,A;m=_.dequant_factors,A=+c[l].base.segment_id,c[l].base.eob_mask=decode_mb_tokens(i.bool,E,f[d],a,o,c[l].base.y_mode,_.entropy_hdr.coeff_probs_,m[A].factor)}d++,l++,o+=400}}function vp8_dixie_tokens_init(_){var e=_.token_hdr.partitions;if(_.frame_hdr.frame_size_updated){var r=int_,t=25*_.mb_cols*16;for(r=0;r<e;r++)_.tokens[r].coeffs=new Array(t),_.tokens[r].coeffs||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,null);_.above_token_entropy_ctx=Arr_new(_.mb_cols,_.above_token_entropy_ctx_object),_.above_token_entropy_ctx||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,null)}}function ABS(_){return _>=0?_:-_}function saturate_int8(_){return _<-128?-128:_>127?127:_}function saturate_uint8(_){return _<0?0:_>255?255:_}function high_edge_variance(_,e,r,t){var n=_[e-2*r],i=_[e-1*r],a=_[e+0*r],o=_[e+1*r];return ABS(n-i)>t||ABS(o-a)>t}function simple_threshold(_,e,r,t){var n=_[e-2*r],i=_[e-1*r],a=_[e+0*r],o=_[e+1*r];return 2*ABS(i-a)+(ABS(n-o)>>1)<=t}function normal_threshold(_,e,r,t,n){var i=_[e-4*r],a=_[e-3*r],o=_[e-2*r],s=_[e-1*r],f=_[e+0*r],d=_[e+1*r],E=_[e+2*r],c=_[e+3*r],l=n;return simple_threshold(_,e,r,2*t+l)&&ABS(i-a)<=l&&ABS(a-o)<=l&&ABS(o-s)<=l&&ABS(c-E)<=l&&ABS(E-d)<=l&&ABS(d-f)<=l}function filter_common(_,e,r,t){var n,i=_[e-2*r],a=_[e-1*r],o=_[e+0*r],s=_[e+1*r],f=int_;f=3*(o-a),t&&(f+=saturate_int8(i-s)),n=((f=saturate_int8(f))+4>127?127:f+4)>>3,a=saturate_uint8(a+((f+3>127?127:f+3)>>3)),o=saturate_uint8(o-n),t||(i=saturate_uint8(i+(f=n+1>>1)),s=saturate_uint8(s-f)),_[e-2*r]=i,_[e-1*r]=a,_[e+0*r]=o,_[e+1*r]=s}function filter_mb_edge(_,e,r){var t,n=_[e-3*r],i=_[e-2*r],a=_[e-1*r],o=_[e+0*r],s=_[e+1*r],f=_[e+2*r],d=int_;a=saturate_uint8(a+(d=27*(t=saturate_int8(saturate_int8(i-s)+3*(o-a)))+63>>7)),o=saturate_uint8(o-d),i=saturate_uint8(i+(d=18*t+63>>7)),s=saturate_uint8(s-d),n=saturate_uint8(n+(d=9*t+63>>7)),f=saturate_uint8(f-d),_[e-3*r]=n,_[e-2*r]=i,_[e-1*r]=a,_[e+0*r]=o,_[e+1*r]=s,_[e+2*r]=f}function filter_mb_v_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,1,t,n)&&(high_edge_variance(_,e,1,i)?filter_common(_,e,1,1):filter_mb_edge(_,e,1)),e+=r}function filter_subblock_v_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,1,t,n)&&filter_common(_,e,1,high_edge_variance(_,e,1,i)),e+=r}function filter_mb_h_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,r,t,n)&&(high_edge_variance(_,e,r,i)?filter_common(_,e,r,1):filter_mb_edge(_,e,r)),e+=1}function filter_subblock_h_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,r,t,n)&&filter_common(_,e,r,high_edge_variance(_,e,r,i)),e+=1}function filter_v_edge_simple(_,e,r,t){var n=int_;for(n=0;n<16;n++)simple_threshold(_,e,1,t)&&filter_common(_,e,1,1),e+=r}function filter_h_edge_simple(_,e,r,t){var n=int_;for(n=0;n<16;n++)simple_threshold(_,e,r,t)&&filter_common(_,e,r,1),e+=1}function calculate_filter_parameters(_,e,r,t,n){var i=int_,a=int_,o=int_;i=_.loopfilter_hdr.level,_.segment_hdr.enabled&&(_.segment_hdr.abs_?i=_.segment_hdr.lf_level[e.base.segment_id]:i+=_.segment_hdr.lf_level[e.base.segment_id]),_.loopfilter_hdr.delta_enabled&&(i+=_.loopfilter_hdr.ref_delta[e.base.ref_frame],e.base.ref_frame==CURRENT_FRAME?e.base.y_mode==B_PRED&&(i+=_.loopfilter_hdr.mode_delta[0]):e.base.y_mode==ZEROMV?i+=_.loopfilter_hdr.mode_delta[1]:e.base.y_mode==SPLITMV?i+=_.loopfilter_hdr.mode_delta[3]:i+=_.loopfilter_hdr.mode_delta[2]),i>63?i=63:i<0&&(i=0),a=i,_.loopfilter_hdr.sharpness&&(a>>=_.loopfilter_hdr.sharpness>4?2:1)>9-_.loopfilter_hdr.sharpness&&(a=9-_.loopfilter_hdr.sharpness),a<1&&(a=1),o=i>=15,i>=40&&o++,i>=20&&!_.frame_hdr.is_keyframe&&o++,r[0]=i,t[0]=a,n[0]=o}function filter_row_normal(_,e,r,t){var n,i,a,o,s,f,d=0,E=0,c=0,l=0,m=int_;for(o=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],s=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_U],n=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],d=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],i=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_U],E=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_U],a=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_V],c=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_V],d+=16*(o*e+r),E+=8*(s*e+r),c+=8*(s*e+r),f=_.mb_info_rows[1+e],l=_.mb_info_rows_off[1+e]+r,m=r;m<r+t;m++){var A=[int_],u=[int_],p=[int_];calculate_filter_parameters(_,f[l],A,u,p),A=A[0],u=u[0],p=p[0],A&&(m&&(filter_mb_v_edge(n,d,o,A+2,u,p,2),filter_mb_v_edge(i,E,s,A+2,u,p,1),filter_mb_v_edge(a,c,s,A+2,u,p,1)),(f[l].base.eob_mask||f[l].base.y_mode==SPLITMV||f[l].base.y_mode==B_PRED)&&(filter_subblock_v_edge(n,d+4,o,A,u,p,2),filter_subblock_v_edge(n,d+8,o,A,u,p,2),filter_subblock_v_edge(n,d+12,o,A,u,p,2),filter_subblock_v_edge(i,E+4,s,A,u,p,1),filter_subblock_v_edge(a,c+4,s,A,u,p,1)),e&&(filter_mb_h_edge(n,d,o,A+2,u,p,2),filter_mb_h_edge(i,E,s,A+2,u,p,1),filter_mb_h_edge(a,c,s,A+2,u,p,1)),(f[l].base.eob_mask||f[l].base.y_mode==SPLITMV||f[l].base.y_mode==B_PRED)&&(filter_subblock_h_edge(n,d+4*o,o,A,u,p,2),filter_subblock_h_edge(n,d+8*o,o,A,u,p,2),filter_subblock_h_edge(n,d+12*o,o,A,u,p,2),filter_subblock_h_edge(i,E+4*s,s,A,u,p,1),filter_subblock_h_edge(a,c+4*s,s,A,u,p,1))),d+=16,E+=8,c+=8,l++}}function filter_row_simple(_,e,r,t){var n,i,a,o=0,s=0,f=int_;for(i=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],n=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],o=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],o+=16*(i*e+r),a=_.mb_info_rows[1+e],s=_.mb_info_rows_off[1+e]+r,f=r;f<r+t;f++){var d=[int_],E=[int_],c=[int_];if(calculate_filter_parameters(_,a[s],d,E,c),d[0]){var l=(a[s].base.eob_mask||a[s].base.y_mode==SPLITMV||a[s].base.y_mode==B_PRED)+0,m=2*(d[0]+2)+E[0],A=2*d[0]+E[0];f&&filter_v_edge_simple(n,o,i,m),l&&(filter_v_edge_simple(n,o+4,i,A),filter_v_edge_simple(n,o+8,i,A),filter_v_edge_simple(n,o+12,i,A)),e&&filter_h_edge_simple(n,o,i,m),l&&(filter_h_edge_simple(n,o+4*i,i,A),filter_h_edge_simple(n,o+8*i,i,A),filter_h_edge_simple(n,o+12*i,i,A))}o+=16,s++}}function vp8_dixie_loopfilter_process_row(_,e,r,t){_.loopfilter_hdr.use_simple?filter_row_simple(_,e,r,t):filter_row_normal(_,e,r,t)}var BORDER_PIXELS=16,sixtap_filters=new Array(new Array(0,0,128,0,0,0),new Array(0,-6,123,12,-1,0),new Array(2,-11,108,36,-8,1),new Array(0,-9,93,50,-6,0),new Array(3,-16,77,77,-16,3),new Array(0,-6,50,93,-9,0),new Array(1,-8,36,108,-11,2),new Array(0,-1,12,123,-6,0)),bilinear_filters=new Array(new Array(0,0,128,0,0,0),new Array(0,0,112,16,0,0),new Array(0,0,96,32,0,0),new Array(0,0,80,48,0,0),new Array(0,0,64,64,0,0),new Array(0,0,48,80,0,0),new Array(0,0,32,96,0,0),new Array(0,0,16,112,0,0));function predict_h_nxn(_,e,r,t){var n=_,i=e-1,a=int_,o=int_;for(a=0;a<t;a++)for(o=0;o<t;o++)_[e+a*r+o]=n[i+a*r]}function predict_v_nxn(_,e,r,t){var n=_,i=e-r,a=int_,o=int_;for(a=0;a<t;a++)for(o=0;o<t;o++)_[e+a*r+o]=n[i+o]}function predict_tm_nxn(_,e,r,t){var n=_,i=e-1,a=_,o=e-r,s=a[o-1],f=int_,d=int_;for(d=0;d<t;d++){for(f=0;f<t;f++)_[e+f]=CLAMP_255(n[i]+a[o+f]-s);e+=r,i+=r}}function predict_dc_nxn(_,e,r,t){var n=_,i=e-1,a=_,o=e-r,s=int_,f=int_,d=0;for(s=0;s<t;s++)d+=n[i]+a[o+s],i+=r;switch(t){case 16:d=d+16>>5;break;case 8:d=d+8>>4;break;case 4:d=d+4>>3}for(s=0;s<t;s++)for(f=0;f<t;f++)_[e+s*r+f]=d}function predict_ve_4x4(_,e,r){var t=_,n=e-r,i=int_,a=int_;for(_[e+0]=t[n-1]+2*t[n+0]+t[n+1]+2>>2,_[e+1]=t[n+0]+2*t[n+1]+t[n+2]+2>>2,_[e+2]=t[n+1]+2*t[n+2]+t[n+3]+2>>2,_[e+3]=t[n+2]+2*t[n+3]+t[n+4]+2>>2,i=1;i<4;i++)for(a=0;a<4;a++)_[e+i*r+a]=_[e+a]}function predict_he_4x4(_,e,r){var t=_,n=e-1;_[e+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+0]+2>>2}function predict_ld_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-r;_[e+0]=s[f+0]+2*s[f+1]+s[f+2]+2>>2,_[e+1]=t=s[f+1]+2*s[f+2]+s[f+3]+2>>2,_[e+2]=n=s[f+2]+2*s[f+3]+s[f+4]+2>>2,_[e+3]=i=s[f+3]+2*s[f+4]+s[f+5]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i,_[e+3]=a=s[f+4]+2*s[f+5]+s[f+6]+2>>2,_[(e+=r)+0]=n,_[e+1]=i,_[e+2]=a,_[e+3]=o=s[f+5]+2*s[f+6]+s[f+7]+2>>2,_[(e+=r)+0]=i,_[e+1]=a,_[e+2]=o,_[e+3]=s[f+6]+2*s[f+7]+s[f+7]+2>>2}function predict_rd_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-1,d=_,E=e-r;_[e+0]=t=s[f+0]+2*d[E-1]+d[E+0]+2>>2,_[e+1]=n=d[E-1]+2*d[E+0]+d[E+1]+2>>2,_[e+2]=i=d[E+0]+2*d[E+1]+d[E+2]+2>>2,_[e+3]=d[E+1]+2*d[E+2]+d[E+3]+2>>2,_[(e+=r)+0]=a=s[f+r]+2*s[f+0]+d[E-1]+2>>2,_[e+1]=t,_[e+2]=n,_[e+3]=i,_[(e+=r)+0]=o=s[f+2*r]+2*s[f+r]+s[f+0]+2>>2,_[e+1]=a,_[e+2]=t,_[e+3]=n,_[(e+=r)+0]=s[f+3*r]+2*s[f+2*r]+s[f+r]+2>>2,_[e+1]=o,_[e+2]=a,_[e+3]=t}function predict_vr_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-1,E=_,c=e-r;_[e+0]=t=E[c-1]+E[c+0]+1>>1,_[e+1]=n=E[c+0]+E[c+1]+1>>1,_[e+2]=i=E[c+1]+E[c+2]+1>>1,_[e+3]=E[c+2]+E[c+3]+1>>1,_[(e+=r)+0]=a=f[d+0]+2*E[c-1]+E[c+0]+2>>2,_[e+1]=o=E[c-1]+2*E[c+0]+E[c+1]+2>>2,_[e+2]=s=E[c+0]+2*E[c+1]+E[c+2]+2>>2,_[e+3]=E[c+1]+2*E[c+2]+E[c+3]+2>>2,_[(e+=r)+0]=f[d+r]+2*f[d+0]+E[c-1]+2>>2,_[e+1]=t,_[e+2]=n,_[e+3]=i,_[(e+=r)+0]=f[d+2*r]+2*f[d+r]+f[d+0]+2>>2,_[e+1]=a,_[e+2]=o,_[e+3]=s}function predict_vl_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-r;_[e+0]=f[d+0]+f[d+1]+1>>1,_[e+1]=t=f[d+1]+f[d+2]+1>>1,_[e+2]=n=f[d+2]+f[d+3]+1>>1,_[e+3]=i=f[d+3]+f[d+4]+1>>1,_[(e+=r)+0]=f[d+0]+2*f[d+1]+f[d+2]+2>>2,_[e+1]=a=f[d+1]+2*f[d+2]+f[d+3]+2>>2,_[e+2]=o=f[d+2]+2*f[d+3]+f[d+4]+2>>2,_[e+3]=s=f[d+3]+2*f[d+4]+f[d+5]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i,_[e+3]=f[d+4]+2*f[d+5]+f[d+6]+2>>2,_[(e+=r)+0]=a,_[e+1]=o,_[e+2]=s,_[e+3]=f[d+5]+2*f[d+6]+f[d+7]+2>>2}function predict_hd_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-1,E=_,c=e-r;_[e+0]=t=f[d+0]+E[c-1]+1>>1,_[e+1]=n=f[d+0]+2*E[c-1]+E[c+0]+2>>2,_[e+2]=E[c-1]+2*E[c+0]+E[c+1]+2>>2,_[e+3]=E[c+0]+2*E[c+1]+E[c+2]+2>>2,_[(e+=r)+0]=i=f[d+r]+f[d+0]+1>>1,_[e+1]=a=f[d+r]+2*f[d+0]+E[c-1]+2>>2,_[e+2]=t,_[e+3]=n,_[(e+=r)+0]=o=f[d+2*r]+f[d+r]+1>>1,_[e+1]=s=f[d+2*r]+2*f[d+r]+f[d+0]+2>>2,_[e+2]=i,_[e+3]=a,_[(e+=r)+0]=f[d+3*r]+f[d+2*r]+1>>1,_[e+1]=f[d+3*r]+2*f[d+2*r]+f[d+r]+2>>2,_[e+2]=o,_[e+3]=s}function predict_hu_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-1;_[e+0]=s[f+0*r]+s[f+1*r]+1>>1,_[e+1]=s[f+0*r]+2*s[f+1*r]+s[f+2*r]+2>>2,_[e+2]=t=s[f+1*r]+s[f+2*r]+1>>1,_[e+3]=n=s[f+1*r]+2*s[f+2*r]+s[f+3*r]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i=s[f+2*r]+s[f+3*r]+1>>1,_[e+3]=a=s[f+2*r]+2*s[f+3*r]+s[f+3*r]+2>>2,_[(e+=r)+0]=i,_[e+1]=a,_[e+2]=o=s[f+3*r],_[e+3]=o,_[(e+=r)+0]=o,_[e+1]=o,_[e+2]=o,_[e+3]=o}function predict_h_16x16(_,e,r){predict_h_nxn(_,e,r,16)}function predict_v_16x16(_,e,r){predict_v_nxn(_,e,r,16)}function predict_tm_16x16(_,e,r){predict_tm_nxn(_,e,r,16)}function predict_h_8x8(_,e,r){predict_h_nxn(_,e,r,8)}function predict_v_8x8(_,e,r){predict_v_nxn(_,e,r,8)}function predict_tm_8x8(_,e,r){predict_tm_nxn(_,e,r,8)}function predict_tm_4x4(_,e,r){predict_tm_nxn(_,e,r,4)}var tmp_4=new Array(0,0,0,0);function copy_down(_,e,r){var t,n=_,i=e+16-r;for(t=0;t<4;++t)tmp_4[0+t]=n[i+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t]}function b_pred(_,e,r,t,n,i){var a=int_;for(copy_down(_,e,r),a=0;a<16;a++){var o=_,s=e+4*(3&a);switch(t.splitt.mvs[a].d.x){case B_DC_PRED:predict_dc_nxn(o,s,r,4);break;case B_TM_PRED:predict_tm_4x4(o,s,r);break;case B_VE_PRED:predict_ve_4x4(o,s,r);break;case B_HE_PRED:predict_he_4x4(o,s,r);break;case B_LD_PRED:predict_ld_4x4(o,s,r);break;case B_RD_PRED:predict_rd_4x4(o,s,r);break;case B_VR_PRED:predict_vr_4x4(o,s,r);break;case B_VL_PRED:predict_vl_4x4(o,s,r);break;case B_HD_PRED:predict_hd_4x4(o,s,r);break;case B_HU_PRED:predict_hu_4x4(o,s,r);break;default:assert(0)}vp8_dixie_idct_add(o,s,o,s,r,n,i),i+=16,3&~a||(e+=4*r)}}var y2_16=Arr(16,0);function fixup_dc_coeffs(_,e,r){var t=int_;for(vp8_dixie_walsh(e,r+384,y2_16,0),t=0;t<16;t++)e[r+16*t]=y2_16[t]}function predict_intra_luma(_,e,r,t,n,i){if(t.base.y_mode==B_PRED)b_pred(_,e,r,t,n,i);else{var a=int_;switch(t.base.y_mode){case DC_PRED:predict_dc_nxn(_,e,r,16);break;case V_PRED:predict_v_16x16(_,e,r);break;case H_PRED:predict_h_16x16(_,e,r);break;case TM_PRED:predict_tm_16x16(_,e,r);break;default:assert(0)}for(fixup_dc_coeffs(t,n,i),a=0;a<16;a++)vp8_dixie_idct_add(_,e,_,e,r,n,i),i+=16,e+=4,3&~a||(e+=4*r-16)}}function predict_intra_chroma(_,e,r,t,n,i,a,o){var s=int_;switch(i.base.uv_mode){case DC_PRED:predict_dc_nxn(_,e,n,8),predict_dc_nxn(r,t,n,8);break;case V_PRED:predict_v_8x8(_,e,n),predict_v_8x8(r,t,n);break;case H_PRED:predict_h_8x8(_,e,n),predict_h_8x8(r,t,n);break;case TM_PRED:predict_tm_8x8(_,e,n),predict_tm_8x8(r,t,n);break;default:assert(0)}for(o+=256,s=16;s<20;s++)vp8_dixie_idct_add(_,e,_,e,n,a,o),o+=16,e+=4,1&s&&(e+=4*n-8);for(s=20;s<24;s++)vp8_dixie_idct_add(r,t,r,t,n,a,o),o+=16,t+=4,1&s&&(t+=4*n-8)}function sixtap_horiz(_,e,r,t,n,i,a,o,s){var f=int_,d=int_,E=int_;for(f=0;f<o;f++){for(d=0;d<a;d++)E=t[n-2]*s[0]+t[n-1]*s[1]+t[n+0]*s[2]+t[n+1]*s[3]+t[n+2]*s[4]+t[n+3]*s[5]+64,E>>=7,_[e+d]=E,n++;n+=i-a,e+=r}}function sixtap_vert(_,e,r,t,n,i,a,o,s){var f=int_,d=int_,E=int_;for(f=0;f<o;f++){for(d=0;d<a;d++)E=t[n-2*i]*s[0]+t[n-1*i]*s[1]+t[n+0*i]*s[2]+t[n+1*i]*s[3]+t[n+2*i]*s[4]+t[n+3*i]*s[5]+64,E>>=7,_[e+d]=E,n++;n+=i-a,e+=r}}var temp_=new Array(336);function sixtap_2d(_,e,r,t,n,i,a,o,s,f,d){sixtap_horiz(temp_,0,16,t,n-2*i,i,a,o+5,d[s]),sixtap_vert(_,e,r,temp_,32,16,a,o,d[f])}var img_index=function(){this.y=char_,this.u=char_,this.v=char_,this.y_off=0,this.u_off=0,this.v_off=0,this.stride=int_,this.uv_stride=int_};function filter_block(_,e,r,t,n,i,a,o){var s,f;return a.d.x||a.d.y?(s=7&a.d.x,f=7&a.d.y,n+=(a.d.y>>3)*i+(a.d.x>>3),s|f&&(sixtap_2d(e,r,i,t,n,i,4,4,s,f,o),t=e,n=r),_[0]=n,t):(_[0]=n,t)}function recon_1_block(_,e,r,t,n,i,a,o,s,f,d){var E=[0];vp8_dixie_idct_add(_,e,filter_block(E,_,e,r,t,n,i,a),E[0],n,o,s+16*d)}function calculate_chroma_splitmv(_,e,r){var t=int_,n=new mv;return(t=_.splitt.mvs[e].d.x+_.splitt.mvs[e+1].d.x+_.splitt.mvs[e+4].d.x+_.splitt.mvs[e+5].d.x)<0?t-=4:t+=4,n.d.x=parseInt(t/8,10),(t=_.splitt.mvs[e].d.y+_.splitt.mvs[e+1].d.y+_.splitt.mvs[e+4].d.y+_.splitt.mvs[e+5].d.y)<0?t-=4:t+=4,n.d.y=parseInt(t/8,10),r&&(n.d.x&=-8,n.d.y&=-8),n}function build_mc_border(_,e,r,t,n,i,a,o,s,f,d){var E,c=char_;E=r,c=t-i-a*n,a>=d?c+=(d-1)*n:a>0&&(c+=a*n);do{var l,m=int_,A=0;(m=i<0?-i:0)>o&&(m=o),i+o>f&&(A=i+o-f),A>o&&(A=o),l=o-m-A,m&&memset(_,e,E[c+0],m),l&&memcpy(_,e+m,E,c+i+m,l),A&&memset(_,e+m+l,E[c+f-1],A),e+=n,++a<d&&a>0&&(c+=n)}while(--s)}function recon_1_edge_block(_,e,r,t,n,i,a,o,s,f,d,E,c,l,m,A,u){var p=u;c+=o.d.x>>3,l+=o.d.y>>3,(c<2||c+4-1+3>=m||l<2||l+4-1+3>=A)&&(build_mc_border(r,t,n,(i+=(o.d.x>>3)+(o.d.y>>3)*a)-2-2*a,a,c-2,l-2,9,9,m,A),n=r,i=t+2*a+2,i-=(o.d.x>>3)+(o.d.y>>3)*a);var T=[0];vp8_dixie_idct_add(_,e,filter_block(T,_,e,n,i,a,o,s),T[0],a,f,d+16*p)}var uvmv_1=new mv;function predict_inter_emulated_edge(_,e,r,t,n,i,a){var o,s,f,d=_.frame_strg[0].img.img_data,E=_.frame_strg[0].img.img_data_off,c=0,l=0,m=int_,A=int_,u=int_,p=int_,T=int_,y=Arr_new(4,mv),b=e.u,v=e.v,h=e.u_off,w=e.v_off,I=(3==_.frame_hdr.version)+0;if(u=16*i,p=16*a,m=16*_.mb_cols,A=16*_.mb_rows,s=e.y,l=e.y_off,f=_.ref_frame_offsets[n.base.ref_frame],o=_.ref_frame_offsets_[n.base.ref_frame],c=l+f,n.base.y_mode!=SPLITMV){var R=uvmv_1;R.d.x=n.base.mv.d.x,R.d.y=n.base.mv.d.y,R.d.x=R.d.x+1>>1,R.d.y=R.d.y+1>>1,I&&(R.d.x&=-8,R.d.y&=-8),y[0].d.x=R.d.x,y[0].d.y=R.d.y,y[1].d.x=R.d.x,y[1].d.y=R.d.y,y[2].d.x=R.d.x,y[2].d.y=R.d.y,y[3].d.x=R.d.x,y[3].d.y=R.d.y}else y[0]=calculate_chroma_splitmv(n,0,I),y[1]=calculate_chroma_splitmv(n,2,I),y[2]=calculate_chroma_splitmv(n,8,I),y[3]=calculate_chroma_splitmv(n,10,I);for(T=0;T<16;T++){var N;N=n.base.y_mode!=SPLITMV?n.base.mv:n.splitt.mvs[+T],recon_1_edge_block(s,l,d,E,o,c,e.stride,N,_.subpixel_filters,r,t,n,u,p,m,A,T),u+=4,l+=4,c+=4,3&~T||(u-=16,p+=4,l+=4*e.stride-16,c+=4*e.stride-16)}for(u=16*i,p=16*a,u>>=1,p>>=1,m>>=1,A>>=1,T=0;T<4;T++)recon_1_edge_block(b,h,d,E,o,h+f,e.uv_stride,y[T],_.subpixel_filters,r,t,n,u,p,m,A,T+16),recon_1_edge_block(v,w,d,E,o,w+f,e.uv_stride,y[T],_.subpixel_filters,r,t,n,u,p,m,A,T+20),h+=4,w+=4,u+=4,1&T&&(u-=8,p+=4,h+=4*e.uv_stride-8,w+=4*e.uv_stride-8)}var uvmv_2=new mv;function predict_inter(_,e,r,t,n){var i,a,o=e.y,s=e.y_off,f=e.u,d=e.u_off,E=e.v,c=e.v_off,l=Arr_new(4,mv),m=(3==_.frame_hdr.version)+0,A=int_;if(n.base.y_mode!=SPLITMV){var u=uvmv_2;u.d.x=n.base.mv.d.x,u.d.y=n.base.mv.d.y,u.d.x=u.d.x+1>>1,u.d.y=u.d.y+1>>1,m&&(u.d.x&=-8,u.d.y&=-8),l[0].d.x=l[1].d.x=l[2].d.x=l[3].d.x=u.d.x,l[0].d.y=l[1].d.y=l[2].d.y=l[3].d.y=u.d.y}else l[0]=calculate_chroma_splitmv(n,0,m),l[1]=calculate_chroma_splitmv(n,2,m),l[2]=calculate_chroma_splitmv(n,8,m),l[3]=calculate_chroma_splitmv(n,10,m);for(a=_.ref_frame_offsets[n.base.ref_frame],i=_.ref_frame_offsets_[n.base.ref_frame],A=0;A<16;A++){var p;p=n.base.y_mode!=SPLITMV?n.base.mv:n.splitt.mvs[+A],recon_1_block(o,s,i,s+a,e.stride,p,_.subpixel_filters,r,t,n,A),s+=4,3&~A||(s+=4*e.stride-16)}for(A=0;A<4;A++)recon_1_block(f,d,i,d+a,e.uv_stride,l[A],_.subpixel_filters,r,t,n,A+16),recon_1_block(E,c,i,c+a,e.uv_stride,l[A],_.subpixel_filters,r,t,n,A+20),d+=4,c+=4,1&A&&(d+=4*e.uv_stride-8,c+=4*e.uv_stride-8)}function vp8_dixie_release_ref_frame(_){_&&(assert(_.ref_cnt),_.ref_cnt--)}function vp8_dixie_ref_frame(_){return _.ref_cnt++,_}function vp8_dixie_find_free_ref_frame(_){var e=int_;for(e=0;e<NUM_REF_FRAMES;e++)if(0==_[e].ref_cnt)return _[e].ref_cnt=1,_[e];return assert(0),null}function fixup_left(_,e,r,t,n,i){var a=_,o=e-1,s=int_;if(i==DC_PRED&&n){var f=_,d=e-t;for(s=0;s<r;s++)a[o]=f[d+s],o+=t}else for(o-=t,s=-1;s<r;s++)a[o]=129,o+=t}function fixup_above(_,e,r,t,n,i){var a=_,o=e-t,s=int_;if(i==DC_PRED&&n){var f=_,d=e-1;for(s=0;s<r;s++)a[o+s]=f[d],d+=t}else memset(a,o-1,127,r+1);memset(a,o+r,127,4)}function vp8_dixie_predict_init(_){var e,r=int_;if(_.frame_hdr.frame_size_updated){for(r=0;r<NUM_REF_FRAMES;r++){var t=16*_.mb_cols+2*BORDER_PIXELS,n=16*_.mb_rows+2*BORDER_PIXELS;vpx_img_free(_.frame_strg[r].img),_.frame_strg[r].ref_cnt=0,_.ref_frames[r]=null,vpx_img_alloc(_.frame_strg[r].img,IMG_FMT_I420,t,n,16)||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,"Failed to allocate %dx%d framebuffer",t,n),vpx_img_set_rect(_.frame_strg[r].img,BORDER_PIXELS,BORDER_PIXELS,_.frame_hdr.kf.w,_.frame_hdr.kf.h)}_.frame_hdr.version?_.subpixel_filters=bilinear_filters:_.subpixel_filters=sixtap_filters}for(_.ref_frames[CURRENT_FRAME]&&vp8_dixie_release_ref_frame(_.ref_frames[CURRENT_FRAME]),_.ref_frames[CURRENT_FRAME]=vp8_dixie_find_free_ref_frame(_.frame_strg),e=_.ref_frames[CURRENT_FRAME].img.img_data,r=0;r<NUM_REF_FRAMES;r++){var i=_.ref_frames[r];_.ref_frame_offsets[r]=i?i.img.img_data_off-0:0,_.ref_frame_offsets_[r]=i?i.img.img_data:e}}var img_1=new img_index;function vp8_dixie_predict_process_row(_,e,r,t){var n,i,a=img_1,o=0,s=int_,f=0;for(a.stride=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],a.uv_stride=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_U],a.y=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],a.y_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],a.u=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_U],a.u_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_U],a.v=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_V],a.v_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_V],a.y_off+=16*(a.stride*e+r),a.u_off+=8*(a.uv_stride*e+r),a.v_off+=8*(a.uv_stride*e+r),n=_.mb_info_rows[1+e],o=_.mb_info_rows_off[1+e]+r,i=_.tokens[e&_.token_hdr.partitions-1].coeffs,f=400*r,0==r&&(fixup_left(a.y,a.y_off,16,a.stride,e,n[o].base.y_mode),fixup_left(a.u,a.u_off,8,a.uv_stride,e,n[o].base.uv_mode),fixup_left(a.v,a.v_off,8,a.uv_stride,e,n[o].base.uv_mode),0==e&&(a.y[a.y_off-a.stride-1]=127)),s=r;s<r+t;s++)0==e&&(fixup_above(a.y,a.y_off,16,a.stride,s,n[o].base.y_mode),fixup_above(a.u,a.u_off,8,a.uv_stride,s,n[o].base.uv_mode),fixup_above(a.v,a.v_off,8,a.uv_stride,s,n[o].base.uv_mode)),n[o].base.y_mode<=B_PRED?(predict_intra_luma(a.y,a.y_off,a.stride,n[o],i,f),predict_intra_chroma(a.u,a.u_off,a.v,a.v_off,a.uv_stride,n[o],i,f)):(n[o].base.y_mode!=SPLITMV&&fixup_dc_coeffs(n[o],i,f),n[o].base.need_mc_border?predict_inter_emulated_edge(_,a,i,f,n[o],s,e):predict_inter(_,a,i,f,n[o])),o++,a.y_off+=16,a.u_off+=8,a.v_off+=8,f+=400;if(s==_.mb_cols){var d=a.y,E=a.y_off+15*a.stride,c=a.y[a.y_off-1+15*a.stride];d[E]=d[E+1]=d[E+2]=d[E+3]=c}}var FRAME_HEADER_SZ=3,KEYFRAME_HEADER_SZ=7;function ARRAY_COPY(_,e){assert(_.length==e.length),memcpy(_,0,e,0,_.length)}function decode_entropy_header(_,e,r){var t=int_,n=int_,i=int_,a=int_,o=0;for(t=0;t<BLOCK_TYPES;t++)for(n=0;n<COEF_BANDS;n++)for(i=0;i<PREV_COEF_CONTEXTS;i++)for(a=0;a<ENTROPY_NODES;a++)bool_get(e,k_coeff_entropy_update_probs[t][n][i][a])&&(r.coeff_probs_[o]=r.coeff_probs[t][n][i][a]=bool_get_uint(e,8)),o++;if(r.coeff_skip_enabled=bool_get_bit(e),r.coeff_skip_enabled&&(r.coeff_skip_prob=bool_get_uint(e,8)),!_.frame_hdr.is_keyframe){if(r.prob_inter=bool_get_uint(e,8),r.prob_last=bool_get_uint(e,8),r.prob_gf=bool_get_uint(e,8),bool_get_bit(e))for(t=0;t<4;t++)r.y_mode_probs[t]=bool_get_uint(e,8);if(bool_get_bit(e))for(t=0;t<3;t++)r.uv_mode_probs[t]=bool_get_uint(e,8);for(t=0;t<2;t++)for(n=0;n<MV_PROB_CNT;n++)if(bool_get(e,k_mv_entropy_update_probs[t][n])){var s=bool_get_uint(e,7);r.mv_probs[t][n]=s?s<<1:1}}}function decode_reference_header(_,e,r){var t=_.frame_hdr.is_keyframe;r.refresh_gf=t?1:bool_get_bit(e),r.refresh_arf=t?1:bool_get_bit(e),r.copy_gf=t||r.refresh_gf?0:bool_get_uint(e,2),r.copy_arf=t||r.refresh_arf?0:bool_get_uint(e,2),r.sign_bias[GOLDEN_FRAME]=t?0:bool_get_bit(e),r.sign_bias[ALTREF_FRAME]=t?0:bool_get_bit(e),r.refresh_entropy=bool_get_bit(e),r.refresh_last=t?1:bool_get_bit(e)}function decode_quantizer_header(_,e,r){var t=int_,n=r.q_index;r.q_index=bool_get_uint(e,7),t=(n!=r.q_index)+0,t|=r.y1_dc_delta_q=bool_maybe_get_int(e,4),t|=r.y2_dc_delta_q=bool_maybe_get_int(e,4),t|=r.y2_ac_delta_q=bool_maybe_get_int(e,4),t|=r.uv_dc_delta_q=bool_maybe_get_int(e,4),t|=r.uv_ac_delta_q=bool_maybe_get_int(e,4),r.delta_update=t}function decode_and_init_token_partitions(_,e,r,t,n,i){var a=int_;for(i.partitions=1<<bool_get_uint(e,2),n<3*(i.partitions-1)&&vpx_internal_error(_.error,VPX_CODEC_CORRUPT_FRAME,"Truncated packet found parsing partition lengths."),n-=3*(i.partitions-1),a=0;a<i.partitions;a++)a<i.partitions-1?(i.partition_sz[a]=r[t+2]<<16|r[t+1]<<8|r[t+0],t+=3):i.partition_sz[a]=n,n<i.partition_sz[a]&&vpx_internal_error(_.error,VPX_CODEC_CORRUPT_FRAME,"Truncated partition %d",a),n-=i.partition_sz[a];for(a=0;a<_.token_hdr.partitions;a++)init_bool_decoder(_.tokens[a].bool,r,t,_.token_hdr.partition_sz[a]),t+=_.token_hdr.partition_sz[a]}function decode_loopfilter_header(_,e,r){if(_.frame_hdr.is_keyframe&&memset(r,0,1),r.use_simple=bool_get_bit(e),r.level=bool_get_uint(e,6),r.sharpness=bool_get_uint(e,3),r.delta_enabled=bool_get_bit(e),r.delta_enabled&&bool_get_bit(e)){var t=int_;for(t=0;t<BLOCK_CONTEXTS;t++)r.ref_delta[t]=bool_maybe_get_int(e,6);for(t=0;t<BLOCK_CONTEXTS;t++)r.mode_delta[t]=bool_maybe_get_int(e,6)}}function decode_segmentation_header(_,e,r){if(_.frame_hdr.is_keyframe&&memset(r,0,1),r.enabled=bool_get_bit(e),r.enabled){var t=int_;if(r.update_map=bool_get_bit(e),r.update_data=bool_get_bit(e),r.update_data){for(r.abs_=bool_get_bit(e),t=0;t<MAX_MB_SEGMENTS;t++)r.quant_idx[t]=bool_maybe_get_int(e,7);for(t=0;t<MAX_MB_SEGMENTS;t++)r.lf_level[t]=bool_maybe_get_int(e,6)}if(r.update_map)for(t=0;t<MB_FEATURE_TREE_PROBS;t++)r.tree_probs[t]=bool_get_bit(e)?bool_get_uint(e,8):255}else r.update_map=0,r.update_data=0}function clamp_q(_){return _<0?0:_>127?127:_}function dc_q(_){return dc_q_lookup[clamp_q(_)]}function ac_q(_){return ac_q_lookup[clamp_q(_)]}function dequant_init(_,e,r){var t=int_,n=int_,i=_,a=0;for(t=0;t<(e.enabled?MAX_MB_SEGMENTS:1);t++)n=r.q_index,e.enabled&&(n=e.abs_?e.quant_idx[t]:n+e.quant_idx[t]),(i[a].quant_idx!=n||r.delta_update)&&(i[a].factor[TOKEN_BLOCK_Y1][0]=dc_q(n+r.y1_dc_delta_q),i[a].factor[TOKEN_BLOCK_Y1][1]=ac_q(n),i[a].factor[TOKEN_BLOCK_UV][0]=dc_q(n+r.uv_dc_delta_q),i[a].factor[TOKEN_BLOCK_UV][1]=ac_q(n+r.uv_ac_delta_q),i[a].factor[TOKEN_BLOCK_Y2][0]=2*dc_q(n+r.y2_dc_delta_q),i[a].factor[TOKEN_BLOCK_Y2][1]=parseInt(155*ac_q(n+r.y2_ac_delta_q)/100),i[a].factor[TOKEN_BLOCK_Y2][1]<8&&(i[a].factor[TOKEN_BLOCK_Y2][1]=8),i[a].factor[TOKEN_BLOCK_UV][0]>132&&(i[a].factor[TOKEN_BLOCK_UV][0]=132),i[a].quant_idx=n),a++}var bool_1=new bool_decoder;function decode_frame(_,e,r,t){var n,i=bool_1,a=int_,o=int_,s=int_;if(_.saved_entropy_valid=0,(n=vp8_parse_frame_header(e,t,_.frame_hdr))&&vpx_internal_error(_.error,n,"Failed to parse frame header"),_.frame_hdr.is_experimental&&vpx_internal_error(_.error,VPX_CODEC_UNSUP_BITSTREAM,"Experimental bitstreams not supported."),r+=FRAME_HEADER_SZ,t-=FRAME_HEADER_SZ,_.frame_hdr.is_keyframe&&(r+=KEYFRAME_HEADER_SZ,t-=KEYFRAME_HEADER_SZ,_.mb_cols=parseInt((_.frame_hdr.kf.w+15)/16,10),_.mb_rows=parseInt((_.frame_hdr.kf.h+15)/16,10)),init_bool_decoder(i,e,r,_.frame_hdr.part0_sz),_.frame_hdr.is_keyframe&&bool_get_uint(i,2)&&vpx_internal_error(_.error,VPX_CODEC_UNSUP_BITSTREAM,"Reserved bits not supported."),decode_segmentation_header(_,i,_.segment_hdr),decode_loopfilter_header(_,i,_.loopfilter_hdr),decode_and_init_token_partitions(_,i,e,r+_.frame_hdr.part0_sz,t-_.frame_hdr.part0_sz,_.token_hdr),decode_quantizer_header(_,i,_.quant_hdr),decode_reference_header(_,i,_.reference_hdr),_.frame_hdr.is_keyframe){a=int_;var f=int_,d=int_,E=int_,c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)_.entropy_hdr.coeff_probs_[c]=_.entropy_hdr.coeff_probs[a][f][d][E]=k_default_coeff_probs[a][f][d][E],c++;_.entropy_hdr.mv_probs=new k_default_mv_probs,ARRAY_COPY(_.entropy_hdr.y_mode_probs,k_default_y_mode_probs),ARRAY_COPY(_.entropy_hdr.uv_mode_probs,k_default_uv_mode_probs)}if(!_.reference_hdr.refresh_entropy){var l=_.saved_entropy,m=_.entropy_hdr;c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)l.coeff_probs_[c]=l.coeff_probs[a][f][d][E]=m.coeff_probs[a][f][d][E],c++;for(l.coeff_skip_enabled=m.coeff_skip_enabled,l.coeff_skip_prob=m.coeff_skip_prob,a=0;a<2;++a)for(f=0;f<19;++f)l.mv_probs[a][f]=m.mv_probs[a][f];for(l.prob_gf=m.prob_gf,l.prob_inter=m.prob_inter,l.prob_last=m.prob_last,a=0;a<3;++a)l.uv_mode_probs[a]=m.uv_mode_probs[a];for(a=0;a<4;++a)l.y_mode_probs[a]=m.y_mode_probs[a];_.saved_entropy_valid=1}for(decode_entropy_header(_,i,_.entropy_hdr),vp8_dixie_modemv_init(_),vp8_dixie_tokens_init(_),vp8_dixie_predict_init(_),dequant_init(_.dequant_factors,_.segment_hdr,_.quant_hdr),o=0,s=0;o<_.mb_rows;o++)vp8_dixie_modemv_process_row(_,i,o,0,_.mb_cols),vp8_dixie_tokens_process_row(_,s,o,0,_.mb_cols),vp8_dixie_predict_process_row(_,o,0,_.mb_cols),_.loopfilter_hdr.level&&o&&vp8_dixie_loopfilter_process_row(_,o-1,0,_.mb_cols),++s==_.token_hdr.partitions&&(s=0);if(_.loopfilter_hdr.level&&vp8_dixie_loopfilter_process_row(_,o-1,0,_.mb_cols),_.frame_cnt++,!_.reference_hdr.refresh_entropy){l=_.entropy_hdr,m=_.saved_entropy,c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)l.coeff_probs_[c]=l.coeff_probs[a][f][d][E]=m.coeff_probs[a][f][d][E]=m.coeff_probs_[c],c++;for(l.coeff_skip_enabled=m.coeff_skip_enabled,l.coeff_skip_prob=m.coeff_skip_prob,a=0;a<2;++a)for(f=0;f<19;++f)l.mv_probs[a][f]=m.mv_probs[a][f];for(l.prob_gf=m.prob_gf,l.prob_inter=m.prob_inter,l.prob_last=m.prob_last,a=0;a<3;++a)l.uv_mode_probs[a]=m.uv_mode_probs[a];for(a=0;a<4;++a)l.y_mode_probs[a]=m.y_mode_probs[a];_.saved_entropy_valid=0}1==_.reference_hdr.copy_arf?(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[LAST_FRAME])):2==_.reference_hdr.copy_arf&&(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[GOLDEN_FRAME])),1==_.reference_hdr.copy_gf?(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[LAST_FRAME])):2==_.reference_hdr.copy_gf&&(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[ALTREF_FRAME])),_.reference_hdr.refresh_gf&&(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME])),_.reference_hdr.refresh_arf&&(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME])),_.reference_hdr.refresh_last&&(vp8_dixie_release_ref_frame(_.ref_frames[LAST_FRAME]),_.ref_frames[LAST_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME]))}function CHECK_FOR_UPDATE(_,e,r){var t=_;return r[0]|=t!=(_=e),_}function vp8_parse_frame_header(_,e,r){var t=long_;if(e<10)return VPX_CODEC_CORRUPT_FRAME;if(t=_[0]|_[1]<<8|_[2]<<16,r.is_keyframe=!BITS_GET(t,0,1),r.version=BITS_GET(t,1,2),r.is_experimental=BITS_GET(t,3,1),r.is_shown=BITS_GET(t,4,1),r.part0_sz=BITS_GET(t,5,19),e<=r.part0_sz+(r.is_keyframe?10:3))return VPX_CODEC_CORRUPT_FRAME;if(r.frame_size_updated=0,r.is_keyframe){var n=[0];if(157!=_[3]||1!=_[4]||42!=_[5])return VPX_CODEC_UNSUP_BITSTREAM;if(t=_[6]|_[7]<<8|_[8]<<16|_[9]<<24,r.kf.w=CHECK_FOR_UPDATE(r.kf.w,BITS_GET(t,0,14),n),r.kf.scale_w=CHECK_FOR_UPDATE(r.kf.scale_w,BITS_GET(t,14,2),n),r.kf.h=CHECK_FOR_UPDATE(r.kf.h,BITS_GET(t,16,14),n),r.kf.scale_h=CHECK_FOR_UPDATE(r.kf.scale_h,BITS_GET(t,30,2),n),r.frame_size_updated=n[0],!r.kf.w||!r.kf.h)return VPX_CODEC_UNSUP_BITSTREAM}return VPX_CODEC_OK}function vp8_dixie_decode_frame(_,e,r){var t=_;return _.error.error_code=VPX_CODEC_OK,_.error.has_detail=0,setjmp(_.error.jmp)||decode_frame(_,e,0,r),t.error.error_code}function vp8_dixie_decode_destroy(_){vp8_dixie_predict_destroy(_),vp8_dixie_tokens_destroy(_),vp8_dixie_modemv_destroy(_)}var vpx_codec_alg_priv=function(){decoder_ctx=new vp8_decoder_ctx,img=new vpx_image_t,img_avail=int_};function update_error_state(_,e){var r;return(r=e.error_code)&&(_.base.err_detail=e.has_detail?e.detail:null),r}function vp8_init(_){var e=VPX_CODEC_OK;if(!_.priv){var r=new vpx_codec_alg_priv_t;if(_.priv=r,!_.priv)return VPX_CODEC_MEM_ERROR;_.priv.sz=1,_.priv.iface=_.iface,_.priv.alg_priv=r,_.priv.init_flags=_.init_flags,_.config.dec&&(_.priv.alg_priv.cfg=_.config.dec,_.config.dec=_.priv.alg_priv.cfg)}return e}function vp8_destroy(_){return vp8_dixie_decode_destroy(_.decoder_ctx),_.base.alg_priv="",VPX_CODEC_OK}function vp8_peek_si(_,e,r){var t,n=new vp8_frame_hdr;return(t=vp8_parse_frame_header(_,e,n))||(r.is_kf=n.is_keyframe,r.is_kf?(r.w=n.kf.w,r.h=n.kf.h):(r.w=0,r.h=0)),t}function vp8_get_si(_,e){var r=int_;return r=(e.sz,1),memcpy(e,_.si,r),alert("todo"),e.sz=r,VPX_CODEC_OK}function vp8_decode(_,e,r,t,n){var i;return(i=vp8_dixie_decode_frame(_.decoder_ctx,e,r))&&update_error_state(_,_.decoder_ctx.error),_.img_avail=_.decoder_ctx.frame_hdr.is_shown,_.img=_.decoder_ctx.ref_frames[CURRENT_FRAME].img,i}function vp8_get_frame(_,e){var r=null;return _.img_avail&&(e[0]||(r=_.img,e[0]=r)),r}var ctf_maps=create_obj_vals_from_arrayChilds(vpx_codec_ctrl_fn_map_t,[[-1,null]]);function webmdata(_){main(_)}CODEC_INTERFACE("vpx_codec_vp8_dx",new Array('VP8 "Dixie" Decoder'+VERSION_STRING,VPX_CODEC_INTERNAL_ABI_VERSION,VPX_CODEC_CAP_DECODER,"vp8_init","vp8_destroy","ctf_maps",null,null,new Array("vp8_peek_si","vp8_get_si","vp8_decode","vp8_get_frame"))),window.webmdata=webmdata;var VP8_FOURCC=3690582,ifaces=new Array({name:char_,iface:0,fourcc:int_,fourcc_mask:int_});ifaces[0]={name:"vp8",iface:new vpx_codec_vp8_dx_algo,fourcc:VP8_FOURCC,fourcc_mask:16777215};var RAW_FILE=0,IVF_FILE=1,WEBM_FILE=2,IVF_FRAME_HDR_SZ=12,RAW_FRAME_HDR_SZ=4;function read_frame(_,e,r,t,n){new Array(IVF_FRAME_HDR_SZ);var i=size_t,a=_.infile;if(_.kind==WEBM_FILE){if(_.chunk>=_.chunks){var o=[int_];do{if(_.pkt&&nestegg_free_packet(_.pkt),nestegg_read_packet(_.nestegg_ctx,_.pkt)<=0||nestegg_packet_track(_.pkt,o))return 1}while(o!=_.video_track);if(nestegg_packet_count(_.pkt,_.chunks))return 1;_.chunk=0}return nestegg_packet_data(_.pkt,_.chunk,e,t)?1:(_.chunk++,0)}return t[0]=i,t?fread(e,1,t[0],a)!=t[0]?(fprintf(stderr,"Failed to read full frame\n"),1):0:1}var input_ctx=function(){this.kind=0,this.infile=0,this.nestegg_ctx=new nestegg,this.pkt=[null],this.chunk=int_,this.chunks=[int_],this.video_track=int_};function nestegg_read_cb(_,e,r){var t=r;return fread(_,1,e,t)<e&&feof(t)?0:1}function nestegg_seek_cb(_,e,r){switch(e){case NESTEGG_SEEK_SET:e=SEEK_SET;break;case NESTEGG_SEEK_CUR:e=SEEK_CUR;break;case NESTEGG_SEEK_END:e=SEEK_END}return fseek(r,_,e)?-1:0}function nestegg_tell_cb(_){return ftell(_)}function file_is_webm(_,e,r,t,n,i){var a=int_,o=[int_],s=-1,f={read:nestegg_read_cb,seek:nestegg_seek_cb,tell:nestegg_tell_cb,userdata:_.infile},d=new nestegg_video_params;for(_.nestegg_ctx=[_.nestegg_ctx],nestegg_init(_.nestegg_ctx,f,null)&&alert("goto fail"),_.nestegg_ctx=_.nestegg_ctx[0],nestegg_track_count(_.nestegg_ctx,o)&&alert("goto fail"),a=0;a<o&&(s=nestegg_track_type(_.nestegg_ctx,a))!=NESTEGG_TRACK_VIDEO;a++)s<0&&alert("goto fail");return nestegg_track_codec_id(_.nestegg_ctx,a)!=NESTEGG_CODEC_VP8&&(fprintf(stderr,"Not VP8 video, quitting.\n"),exit(1)),_.video_track=a,nestegg_track_video_params(_.nestegg_ctx,a,d)&&alert("goto fail"),n[0]=0,i[0]=0,e[0]=VP8_FOURCC,r[0]=d.width,t[0]=d.height,1}function main(_,e,r){var t=[null],n=[null],i=[0],a=[0],o={data:_,data_off:0},s=[int_],f=[int_],d=[int_],E=[int_],c=[int_],l=new input_ctx;if(l.infile=o,!file_is_webm(l,s,f,d,E,c))return alert("Unrecognized input file type.\n"),EXIT_FAILURE;l.kind=WEBM_FILE;var m=document.getElementById("timecode"),A=document.getElementById("render"),u=document.getElementById("frame"),p=new Date,T=0,y=new vp8_decoder_ctx;!function _(){!read_frame(l,t,n,i,a)&&setTimeout((function(){t=t[0],p=new Date,vp8_dixie_decode_frame(y,t,i),t=[t];var e=y.frame_hdr.is_shown,r=y.ref_frames[0].img;b=new Date,m.innerHTML=l.pkt[0].timecode+" ("+(l.pkt[0].timecode/1e9|0)+" sec)",e&&(A.innerHTML=b-p+"ms<br />FPS:"+(1e3/(b-p)).toFixed(2),r&&vpximg2canvas(r),T++,u.innerHTML=T),_()}),0)}();var b=new Date}/*!
6
- * jQuery JavaScript Library v2.0.3
7
- * http://jquery.com/
8
- *
9
- * Includes Sizzle.js
10
- * http://sizzlejs.com/
11
- *
12
- * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
13
- * Released under the MIT license
14
- * http://jquery.org/license
15
- *
16
- * Date: 2013-07-03T13:30Z
17
- */
18
- !function(e,t){var n,r,i=typeof t,o=e.location,s=e.document,a=s.documentElement,u=e.jQuery,l=e.$,c={},f=[],p="2.0.3",d=f.concat,h=f.push,g=f.slice,m=f.indexOf,y=c.toString,v=c.hasOwnProperty,x=p.trim,b=function(e,t){return new b.fn.init(e,t,n)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,N=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^-ms-/,E=/-([\da-z])/gi,S=function(e,t){return t.toUpperCase()},j=function(){s.removeEventListener("DOMContentLoaded",j,!1),e.removeEventListener("load",j,!1),b.ready()};function D(e){var t=e.length,n=b.type(e);return!b.isWindow(e)&&(!(1!==e.nodeType||!t)||("array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)))}b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(!(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:C.exec(e))||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:s,!0)),N.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}return(o=s.getElementById(i[2]))&&o.parentNode&&(this.length=1,this[0]=o),this.context=s,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,(function(t,n){return e.call(t,n,t)})))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,s,a=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof a&&(c=a,a=arguments[1]||{},u=2),"object"==typeof a||b.isFunction(a)||(a={}),l===u&&(a=this,--u);u<l;u++)if(null!=(e=arguments[u]))for(n in e)r=a[n],a!==(i=e[n])&&(c&&i&&(b.isPlainObject(i)||(o=b.isArray(i)))?(o?(o=!1,s=r&&b.isArray(r)?r:[]):s=r&&b.isPlainObject(r)?r:{},a[n]=b.extend(c,s,i)):i!==t&&(a[n]=i));return a},b.extend({expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===b&&(e.$=l),t&&e.jQuery===b&&(e.jQuery=u),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){(!0===e?--b.readyWait:b.isReady)||(b.isReady=!0,!0!==e&&--b.readyWait>0||(r.resolveWith(s,[b]),b.fn.trigger&&b(s).trigger("ready").off("ready")))},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?String(e):"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){if("object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}return!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||s;var r=N.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:JSON.parse,parseXML:function(e){var n;if(!e||"string"!=typeof e)return null;try{n=(new DOMParser).parseFromString(e,"text/xml")}catch(e){n=t}return n&&!n.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+e),n},noop:function(){},globalEval:function(e){var t,n=eval;(e=b.trim(e))&&(1===e.indexOf("use strict")?((t=s.createElement("script")).text=e,s.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(k,"ms-").replace(E,S)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r=0,i=e.length,o=D(e);if(n){if(o)for(;r<i&&!1!==t.apply(e[r],n);r++);else for(r in e)if(!1===t.apply(e[r],n))break}else if(o)for(;r<i&&!1!==t.call(e[r],r,e[r]);r++);else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":x.call(e)},makeArray:function(e,t){var n=t||[];return null!=e&&(D(Object(e))?b.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:m.call(t,e,n)},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;o<r;o++)e[i++]=n[o];else for(;n[o]!==t;)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r=[],i=0,o=e.length;for(n=!!n;i<o;i++)n!==!!t(e[i],i)&&r.push(e[i]);return r},map:function(e,t,n){var r,i=0,o=e.length,s=[];if(D(e))for(;i<o;i++)null!=(r=t(e[i],i,n))&&(s[s.length]=r);else for(i in e)null!=(r=t(e[i],i,n))&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(r=e[n],n=e,e=r),b.isFunction(e)?(i=g.call(arguments,2),o=function(){return e.apply(n||this,i.concat(g.call(arguments)))},o.guid=e.guid=e.guid||b.guid++,o):t},access:function(e,n,r,i,o,s,a){var u=0,l=e.length,c=null==r;if("object"===b.type(r))for(u in o=!0,r)b.access(e,n,u,r[u],!0,s,a);else if(i!==t&&(o=!0,b.isFunction(i)||(a=!0),c&&(a?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;u<l;u++)n(e[u],r,a?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):s},now:Date.now,swap:function(e,t,n,r){var i,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];for(o in i=n.apply(e,r||[]),t)e.style[o]=s[o];return i}}),b.ready.promise=function(t){return r||(r=b.Deferred(),"complete"===s.readyState?setTimeout(b.ready):(s.addEventListener("DOMContentLoaded",j,!1),e.addEventListener("load",j,!1))),r.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),(function(e,t){c["[object "+t+"]"]=t.toLowerCase()})),n=b(s),
19
- /*!
20
- * Sizzle CSS Selector Engine v1.9.4-pre
21
- * http://sizzlejs.com/
22
- *
23
- * Copyright 2013 jQuery Foundation, Inc. and other contributors
24
- * Released under the MIT license
25
- * http://jquery.org/license
26
- *
27
- * Date: 2013-06-03
28
- */
29
- function(e,t){var n,r,i,o,s,a,u,l,c,f,p,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T=0,C=0,N=se(),k=se(),E=se(),S=!1,j=function(e,t){return e===t?(S=!0,0):0},D=typeof t,A=1<<31,L={}.hasOwnProperty,q=[],H=q.pop,O=q.push,F=q.push,P=q.slice,R=q.indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(this[t]===e)return t;return-1},M="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",W="[\\x20\\t\\r\\n\\f]",$="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",B=$.replace("w","w#"),I="\\["+W+"*("+$+")"+W+"*(?:([*^$|!~]?=)"+W+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+B+")|)|)"+W+"*\\]",z=":("+$+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+I.replace(3,8)+")*)|.*)\\)|)",_=new RegExp("^"+W+"+|((?:^|[^\\\\])(?:\\\\.)*)"+W+"+$","g"),X=new RegExp("^"+W+"*,"+W+"*"),U=new RegExp("^"+W+"*([>+~]|"+W+")"+W+"*"),Y=new RegExp(W+"*[+~]"),V=new RegExp("="+W+"*([^\\]'\"]*)"+W+"*\\]","g"),G=new RegExp(z),J=new RegExp("^"+B+"$"),Q={ID:new RegExp("^#("+$+")"),CLASS:new RegExp("^\\.("+$+")"),TAG:new RegExp("^("+$.replace("w","w*")+")"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+z),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+W+"*(even|odd|(([+-]|)(\\d*)n|)"+W+"*(?:([+-]|)"+W+"*(\\d+)|))"+W+"*\\)|)","i"),bool:new RegExp("^(?:"+M+")$","i"),needsContext:new RegExp("^"+W+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+W+"*((?:-\\d)?\\d*)"+W+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/^(?:input|select|textarea|button)$/i,te=/^h\d$/i,ne=/'|\\/g,re=new RegExp("\\\\([\\da-f]{1,6}"+W+"?|("+W+")|.)","ig"),ie=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)};try{F.apply(q=P.call(w.childNodes),w.childNodes),q[w.childNodes.length].nodeType}catch(e){F={apply:q.length?function(e,t){O.apply(e,P.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function oe(e,t,n,i){var s,a,l,c,d,m,y,b,T,C;if((t?t.ownerDocument||t:w)!==p&&f(t),n=n||[],!e||"string"!=typeof e)return n;if(1!==(c=(t=t||p).nodeType)&&9!==c)return[];if(h&&!i){if(s=Z.exec(e))if(l=s[1]){if(9===c){if(!(a=t.getElementById(l))||!a.parentNode)return n;if(a.id===l)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(l))&&v(t,a)&&a.id===l)return n.push(a),n}else{if(s[2])return F.apply(n,t.getElementsByTagName(e)),n;if((l=s[3])&&r.getElementsByClassName&&t.getElementsByClassName)return F.apply(n,t.getElementsByClassName(l)),n}if(r.qsa&&(!g||!g.test(e))){if(b=y=x,T=t,C=9===c&&e,1===c&&"object"!==t.nodeName.toLowerCase()){for(m=ge(e),(y=t.getAttribute("id"))?b=y.replace(ne,"\\$&"):t.setAttribute("id",b),b="[id='"+b+"'] ",d=m.length;d--;)m[d]=b+me(m[d]);T=Y.test(e)&&t.parentNode||t,C=m.join(",")}if(C)try{return F.apply(n,T.querySelectorAll(C)),n}catch(e){}finally{y||t.removeAttribute("id")}}}return function(e,t,n,i){var s,a,l,c,f,p=ge(e);if(!i&&1===p.length){if((a=p[0]=p[0].slice(0)).length>2&&"ID"===(l=a[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[a[1].type]){if(!(t=(o.find.ID(l.matches[0].replace(re,ie),t)||[])[0]))return n;e=e.slice(a.shift().value.length)}for(s=Q.needsContext.test(e)?0:a.length;s--&&(l=a[s],!o.relative[c=l.type]);)if((f=o.find[c])&&(i=f(l.matches[0].replace(re,ie),Y.test(a[0].type)&&t.parentNode||t))){if(a.splice(s,1),!(e=i.length&&me(a)))return F.apply(n,i),n;break}}return u(e,p)(i,t,!h,n,Y.test(e)),n}(e.replace(_,"$1"),t,n,i)}function se(){var e=[];return function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}}function ae(e){return e[x]=!0,e}function ue(e){var t=p.createElement("div");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){for(var n=e.split("|"),r=e.length;r--;)o.attrHandle[n[r]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||A)-(~e.sourceIndex||A);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return ae((function(t){return t=+t,ae((function(n,r){for(var i,o=e([],n.length,t),s=o.length;s--;)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))}))}))}for(n in a=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},r=oe.support={},f=oe.setDocument=function(e){var t=e?e.ownerDocument||e:w,n=t.defaultView;return t!==p&&9===t.nodeType&&t.documentElement?(p=t,d=t.documentElement,h=!a(t),n&&n.attachEvent&&n!==n.top&&n.attachEvent("onbeforeunload",(function(){f()})),r.attributes=ue((function(e){return e.className="i",!e.getAttribute("className")})),r.getElementsByTagName=ue((function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length})),r.getElementsByClassName=ue((function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length})),r.getById=ue((function(e){return d.appendChild(e).id=x,!t.getElementsByName||!t.getElementsByName(x).length})),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==D&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(re,ie);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(re,ie);return function(e){var n=typeof e.getAttributeNode!==D&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!==D)return t.getElementsByTagName(e)}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,t){if(typeof t.getElementsByClassName!==D&&h)return t.getElementsByClassName(e)},m=[],g=[],(r.qsa=K.test(t.querySelectorAll))&&(ue((function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+W+"*(?:value|"+M+")"),e.querySelectorAll(":checked").length||g.push(":checked")})),ue((function(e){var n=t.createElement("input");n.setAttribute("type","hidden"),e.appendChild(n).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+W+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")}))),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ue((function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",z)})),g=g.length&&new RegExp(g.join("|")),m=m.length&&new RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},j=d.compareDocumentPosition?function(e,n){if(e===n)return S=!0,0;var i=n.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(n);return i?1&i||!r.sortDetached&&n.compareDocumentPosition(e)===i?e===t||v(w,e)?-1:n===t||v(w,n)?1:c?R.call(c,e)-R.call(c,n):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,n){var r,i=0,o=e.parentNode,s=n.parentNode,a=[e],u=[n];if(e===n)return S=!0,0;if(!o||!s)return e===t?-1:n===t?1:o?-1:s?1:c?R.call(c,e)-R.call(c,n):0;if(o===s)return ce(e,n);for(r=e;r=r.parentNode;)a.unshift(r);for(r=n;r=r.parentNode;)u.unshift(r);for(;a[i]===u[i];)i++;return i?ce(a[i],u[i]):a[i]===w?-1:u[i]===w?1:0},t):p},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&f(e),t=t.replace(V,"='$1']"),r.matchesSelector&&h&&(!m||!m.test(t))&&(!g||!g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){}return oe(t,p,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==p&&f(e),v(e,t)},oe.attr=function(e,n){(e.ownerDocument||e)!==p&&f(e);var i=o.attrHandle[n.toLowerCase()],s=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return s===t?r.attributes||!h?e.getAttribute(n):(s=e.getAttributeNode(n))&&s.specified?s.value:null:s},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(j),S){for(;t=e[o++];)t===e[o]&&(i=n.push(o));for(;i--;)e.splice(n[i],1)}return e},s=oe.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=oe.selectors={cacheLength:50,createPseudo:ae,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(re,ie),e[3]=(e[4]||e[5]||"").replace(re,ie),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&G.test(r)&&(n=ge(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(re,ie).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=new RegExp("(^|"+W+")"+e+"("+W+"|$)"))&&N(e,(function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==D&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==s?"nextSibling":"previousSibling",m=t.parentNode,y=a&&t.nodeName.toLowerCase(),v=!u&&!a;if(m){if(o){for(;g;){for(f=t;f=f[g];)if(a?f.nodeName.toLowerCase()===y:1===f.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[s?m.firstChild:m.lastChild],s&&v){for(d=(l=(c=m[x]||(m[x]={}))[e]||[])[0]===T&&l[1],p=l[0]===T&&l[2],f=d&&m.childNodes[d];f=++d&&f&&f[g]||(p=d=0)||h.pop();)if(1===f.nodeType&&++p&&f===t){c[e]=[T,d,p];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===T)p=l[1];else for(;(f=++d&&f&&f[g]||(p=d=0)||h.pop())&&((a?f.nodeName.toLowerCase()!==y:1!==f.nodeType)||!++p||(v&&((f[x]||(f[x]={}))[e]=[T,p]),f!==t)););return(p-=i)===r||p%r==0&&p/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?ae((function(e,n){for(var i,o=r(e,t),s=o.length;s--;)e[i=R.call(e,o[s])]=!(n[i]=o[s])})):function(e){return r(e,0,n)}):r}},pseudos:{not:ae((function(e){var t=[],n=[],r=u(e.replace(_,"$1"));return r[x]?ae((function(e,t,n,i){for(var o,s=r(e,null,i,[]),a=e.length;a--;)(o=s[a])&&(e[a]=!(t[a]=o))})):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}})),has:ae((function(e){return function(t){return oe(e,t).length>0}})),contains:ae((function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}})),lang:ae((function(e){return J.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(re,ie).toLowerCase(),function(t){var n;do{if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return!1===e.disabled},disabled:function(e){return!0===e.disabled},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return te.test(e.nodeName)},input:function(e){return ee.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:de((function(){return[0]})),last:de((function(e,t){return[t-1]})),eq:de((function(e,t,n){return[n<0?n+t:n]})),even:de((function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e})),odd:de((function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e})),lt:de((function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e})),gt:de((function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e}))}},o.pseudos.nth=o.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=fe(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=pe(n);function he(){}function ge(e,t){var n,r,i,s,a,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);for(a=e,u=[],l=o.preFilter;a;){for(s in n&&!(r=X.exec(a))||(r&&(a=a.slice(r[0].length)||a),u.push(i=[])),n=!1,(r=U.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace(_," ")}),a=a.slice(n.length)),o.filter)!(r=Q[s].exec(a))||l[s]&&!(r=l[s](r))||(n=r.shift(),i.push({value:n,type:s,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?oe.error(e):k(e,u).slice(0)}function me(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function ye(e,t,n){var r=t.dir,o=n&&"parentNode"===r,s=C++;return t.first?function(t,n,i){for(;t=t[r];)if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,a){var u,l,c,f=T+" "+s;if(a){for(;t=t[r];)if((1===t.nodeType||o)&&e(t,n,a))return!0}else for(;t=t[r];)if(1===t.nodeType||o)if((l=(c=t[x]||(t[x]={}))[r])&&l[0]===f){if(!0===(u=l[1])||u===i)return!0===u}else if((l=c[r]=[f])[1]=e(t,n,a)||i,!0===l[1])return!0}}function ve(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xe(e,t,n,r,i){for(var o,s=[],a=0,u=e.length,l=null!=t;a<u;a++)(o=e[a])&&(n&&!n(o,r,i)||(s.push(o),l&&t.push(a)));return s}function be(e,t,n,r,i,o){return r&&!r[x]&&(r=be(r)),i&&!i[x]&&(i=be(i,o)),ae((function(o,s,a,u){var l,c,f,p=[],d=[],h=s.length,g=o||function(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}(t||"*",a.nodeType?[a]:a,[]),m=!e||!o&&t?g:xe(g,p,e,a,u),y=n?i||(o?e:h||r)?[]:s:m;if(n&&n(m,y,a,u),r)for(l=xe(y,d),r(l,[],a,u),c=l.length;c--;)(f=l[c])&&(y[d[c]]=!(m[d[c]]=f));if(o){if(i||e){if(i){for(l=[],c=y.length;c--;)(f=y[c])&&l.push(m[c]=f);i(null,y=[],l,u)}for(c=y.length;c--;)(f=y[c])&&(l=i?R.call(o,f):p[c])>-1&&(o[l]=!(s[l]=f))}}else y=xe(y===s?y.splice(h,y.length):y),i?i(null,s,y,u):F.apply(s,y)}))}function we(e){for(var t,n,r,i=e.length,s=o.relative[e[0].type],a=s||o.relative[" "],u=s?1:0,c=ye((function(e){return e===t}),a,!0),f=ye((function(e){return R.call(t,e)>-1}),a,!0),p=[function(e,n,r){return!s&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r))}];u<i;u++)if(n=o.relative[e[u].type])p=[ye(ve(p),n)];else{if((n=o.filter[e[u].type].apply(null,e[u].matches))[x]){for(r=++u;r<i&&!o.relative[e[r].type];r++);return be(u>1&&ve(p),u>1&&me(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(_,"$1"),n,u<r&&we(e.slice(u,r)),r<i&&we(e=e.slice(r)),r<i&&me(e))}p.push(n)}return ve(p)}he.prototype=o.filters=o.pseudos,o.setFilters=new he,u=oe.compile=function(e,t){var n,r=[],s=[],a=E[e+" "];if(!a){for(t||(t=ge(e)),n=t.length;n--;)(a=we(t[n]))[x]?r.push(a):s.push(a);a=E(e,function(e,t){var n=0,r=t.length>0,s=e.length>0,a=function(a,u,c,f,d){var h,g,m,y=[],v=0,x="0",b=a&&[],w=null!=d,C=l,N=a||s&&o.find.TAG("*",d&&u.parentNode||u),k=T+=null==C?1:Math.random()||.1;for(w&&(l=u!==p&&u,i=n);null!=(h=N[x]);x++){if(s&&h){for(g=0;m=e[g++];)if(m(h,u,c)){f.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,a&&b.push(h))}if(v+=x,r&&x!==v){for(g=0;m=t[g++];)m(b,y,u,c);if(a){if(v>0)for(;x--;)b[x]||y[x]||(y[x]=H.call(f));y=xe(y)}F.apply(f,y),w&&!a&&y.length>0&&v+t.length>1&&oe.uniqueSort(f)}return w&&(T=k,l=C),b};return r?ae(a):a}(s,r))}return a},r.sortStable=x.split("").sort(j).join("")===x,r.detectDuplicates=S,f(),r.sortDetached=ue((function(e){return 1&e.compareDocumentPosition(p.createElement("div"))})),ue((function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")}))||le("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),r.attributes&&ue((function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||le("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),ue((function(e){return null==e.getAttribute("disabled")}))||le(M,(function(e,t,n){var r;if(!n)return(r=e.getAttributeNode(t))&&r.specified?r.value:!0===e[t]?t.toLowerCase():null})),b.find=oe,b.expr=oe.selectors,b.expr[":"]=b.expr.pseudos,b.unique=oe.uniqueSort,b.text=oe.getText,b.isXMLDoc=oe.isXML,b.contains=oe.contains}(e);var A,L,q,H,O,F,P={};b.Callbacks=function(e){e="string"==typeof e?P[e]||function(e){var t=P[e]={};return b.each(e.match(T)||[],(function(e,n){t[n]=!0})),t}(e):b.extend({},e);var n,r,i,o,s,a,u=[],l=!e.once&&[],c=function(t){for(n=e.memory&&t,r=!0,a=o||0,o=0,s=u.length,i=!0;u&&a<s;a++)if(!1===u[a].apply(t[0],t[1])&&e.stopOnFalse){n=!1;break}i=!1,u&&(l?l.length&&c(l.shift()):n?u=[]:f.disable())},f={add:function(){if(u){var t=u.length;!function t(n){b.each(n,(function(n,r){var i=b.type(r);"function"===i?e.unique&&f.has(r)||u.push(r):r&&r.length&&"string"!==i&&t(r)}))}(arguments),i?s=u.length:n&&(o=t,c(n))}return this},remove:function(){return u&&b.each(arguments,(function(e,t){for(var n;(n=b.inArray(t,u,n))>-1;)u.splice(n,1),i&&(n<=s&&s--,n<=a&&a--)})),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],s=0,this},disable:function(){return u=l=n=t,this},disabled:function(){return!u},lock:function(){return l=t,n||f.disable(),this},locked:function(){return!l},fireWith:function(e,t){return!u||r&&!l||(t=[e,(t=t||[]).slice?t.slice():t],i?l.push(t):c(t)),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!r}};return f},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred((function(n){b.each(t,(function(t,o){var s=o[0],a=b.isFunction(e[t])&&e[t];i[o[1]]((function(){var e=a&&a.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===r?n.promise():this,a?[e]:arguments)}))})),e=null})).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,(function(e,o){var s=o[2],a=o[3];r[o[1]]=s.add,a&&s.add((function(){n=a}),t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=s.fireWith})),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,i=0,o=g.call(arguments),s=o.length,a=1!==s||e&&b.isFunction(e.promise)?s:0,u=1===a?e:b.Deferred(),l=function(e,n,r){return function(i){n[e]=this,r[e]=arguments.length>1?g.call(arguments):i,r===t?u.notifyWith(n,r):--a||u.resolveWith(n,r)}};if(s>1)for(t=new Array(s),n=new Array(s),r=new Array(s);i<s;i++)o[i]&&b.isFunction(o[i].promise)?o[i].promise().done(l(i,r,o)).fail(u.reject).progress(l(i,n,t)):--a;return a||u.resolveWith(r,o),u.promise()}}),b.support=(A={},L=s.createElement("input"),q=s.createDocumentFragment(),H=s.createElement("div"),O=s.createElement("select"),F=O.appendChild(s.createElement("option")),L.type?(L.type="checkbox",A.checkOn=""!==L.value,A.optSelected=F.selected,A.reliableMarginRight=!0,A.boxSizingReliable=!0,A.pixelPosition=!1,L.checked=!0,A.noCloneChecked=L.cloneNode(!0).checked,O.disabled=!0,A.optDisabled=!F.disabled,(L=s.createElement("input")).value="t",L.type="radio",A.radioValue="t"===L.value,L.setAttribute("checked","t"),L.setAttribute("name","t"),q.appendChild(L),A.checkClone=q.cloneNode(!0).cloneNode(!0).lastChild.checked,A.focusinBubbles="onfocusin"in e,H.style.backgroundClip="content-box",H.cloneNode(!0).style.backgroundClip="",A.clearCloneStyle="content-box"===H.style.backgroundClip,b((function(){var t,n,r=s.getElementsByTagName("body")[0];r&&((t=s.createElement("div")).style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",r.appendChild(t).appendChild(H),H.innerHTML="",H.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",b.swap(r,null!=r.style.zoom?{zoom:1}:{},(function(){A.boxSizing=4===H.offsetWidth})),e.getComputedStyle&&(A.pixelPosition="1%"!==(e.getComputedStyle(H,null)||{}).top,A.boxSizingReliable="4px"===(e.getComputedStyle(H,null)||{width:"4px"}).width,(n=H.appendChild(s.createElement("div"))).style.cssText=H.style.cssText="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",n.style.marginRight=n.style.width="0",H.style.width="1px",A.reliableMarginRight=!parseFloat((e.getComputedStyle(n,null)||{}).marginRight)),r.removeChild(t))})),A):A);var R,M,W=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,$=/([A-Z])/g;function B(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=b.expando+Math.random()}function I(e,n,r){var i;if(r===t&&1===e.nodeType)if(i="data-"+n.replace($,"-$1").toLowerCase(),"string"==typeof(r=e.getAttribute(i))){try{r="true"===r||"false"!==r&&("null"===r?null:+r+""===r?+r:W.test(r)?JSON.parse(r):r)}catch(e){}R.set(e,n,r)}else r=t;return r}B.uid=1,B.accepts=function(e){return!e.nodeType||(1===e.nodeType||9===e.nodeType)},B.prototype={key:function(e){if(!B.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=B.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,b.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),o=this.cache[i];if("string"==typeof t)o[t]=n;else if(b.isEmptyObject(o))b.extend(this.cache[i],t);else for(r in t)o[r]=t[r];return o},get:function(e,n){var r=this.cache[this.key(e)];return n===t?r:r[n]},access:function(e,n,r){var i;return n===t||n&&"string"==typeof n&&r===t?(i=this.get(e,n))!==t?i:this.get(e,b.camelCase(n)):(this.set(e,n,r),r!==t?r:n)},remove:function(e,n){var r,i,o,s=this.key(e),a=this.cache[s];if(n===t)this.cache[s]={};else{b.isArray(n)?i=n.concat(n.map(b.camelCase)):(o=b.camelCase(n),i=n in a?[n,o]:(i=o)in a?[i]:i.match(T)||[]),r=i.length;for(;r--;)delete a[i[r]]}},hasData:function(e){return!b.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}},R=new B,M=new B,b.extend({acceptData:B.accepts,hasData:function(e){return R.hasData(e)||M.hasData(e)},data:function(e,t,n){return R.access(e,t,n)},removeData:function(e,t){R.remove(e,t)},_data:function(e,t,n){return M.access(e,t,n)},_removeData:function(e,t){M.remove(e,t)}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],s=0,a=null;if(e===t){if(this.length&&(a=R.get(o),1===o.nodeType&&!M.get(o,"hasDataAttrs"))){for(r=o.attributes;s<r.length;s++)0===(i=r[s].name).indexOf("data-")&&(i=b.camelCase(i.slice(5)),I(o,i,a[i]));M.set(o,"hasDataAttrs",!0)}return a}return"object"==typeof e?this.each((function(){R.set(this,e)})):b.access(this,(function(n){var r,i=b.camelCase(e);if(o&&n===t)return(r=R.get(o,e))!==t||(r=R.get(o,i))!==t||(r=I(o,i,t))!==t?r:void 0;this.each((function(){var r=R.get(this,i);R.set(this,i,n),-1!==e.indexOf("-")&&r!==t&&R.set(this,e,n)}))}),null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each((function(){R.remove(this,e)}))}}),b.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=M.get(e,t),n&&(!r||b.isArray(n)?r=M.access(e,t,b.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,(function(){b.dequeue(e,t)}),o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return M.get(e,n)||M.access(e,n,{empty:b.Callbacks("once memory").add((function(){M.remove(e,[t+"queue",n])}))})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),arguments.length<r?b.queue(this[0],e):n===t?this:this.each((function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)}))},dequeue:function(e){return this.each((function(){b.dequeue(this,e)}))},delay:function(e,t){return e=b.fx&&b.fx.speeds[e]||e,t=t||"fx",this.queue(t,(function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}}))},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),s=this,a=this.length,u=function(){--i||o.resolveWith(s,[s])};for("string"!=typeof e&&(n=e,e=t),e=e||"fx";a--;)(r=M.get(s[a],e+"queueHooks"))&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var z,_=/[\t\r\n\f]/g,X=/\r/g,U=/^(?:input|select|textarea|button)$/i;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each((function(){b.removeAttr(this,e)}))},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[b.propFix[e]||e]}))},addClass:function(e){var t,n,r,i,o,s=0,a=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each((function(t){b(this).addClass(e.call(this,t,this.className))}));if(u)for(t=(e||"").match(T)||[];s<a;s++)if(r=1===(n=this[s]).nodeType&&(n.className?(" "+n.className+" ").replace(_," "):" ")){for(o=0;i=t[o++];)r.indexOf(" "+i+" ")<0&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,s=0,a=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each((function(t){b(this).removeClass(e.call(this,t,this.className))}));if(u)for(t=(e||"").match(T)||[];s<a;s++)if(r=1===(n=this[s]).nodeType&&(n.className?(" "+n.className+" ").replace(_," "):"")){for(o=0;i=t[o++];)for(;r.indexOf(" "+i+" ")>=0;)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):b.isFunction(e)?this.each((function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)})):this.each((function(){if("string"===n)for(var t,r=0,o=b(this),s=e.match(T)||[];t=s[r++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else n!==i&&"boolean"!==n||(this.className&&M.set(this,"__className__",this.className),this.className=this.className||!1===e?"":M.get(this,"__className__")||"")}))},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;n<r;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(_," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];return arguments.length?(i=b.isFunction(e),this.each((function(r){var o;1===this.nodeType&&(null==(o=i?e.call(this,r,b(this).val()):e)?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,(function(e){return null==e?"":e+""}))),(n=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()])&&"set"in n&&n.set(this,o,"value")!==t||(this.value=o))}))):o?(n=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()])&&"get"in n&&(r=n.get(o,"value"))!==t?r:"string"==typeof(r=o.value)?r.replace(X,""):null==r?"":r:void 0}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||i<0,s=o?null:[],a=o?i+1:r.length,u=i<0?a:o?i:0;u<a;u++)if(((n=r[u]).selected||u===i)&&(b.support.optDisabled?!n.disabled:null===n.getAttribute("disabled"))&&(!n.parentNode.disabled||!b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;s.push(t)}return s},set:function(e,t){for(var n,r,i=e.options,o=b.makeArray(t),s=i.length;s--;)((r=i[s]).selected=b.inArray(b(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,s,a=e.nodeType;if(e&&3!==a&&8!==a&&2!==a)return typeof e.getAttribute===i?b.prop(e,n,r):(1===a&&b.isXMLDoc(e)||(n=n.toLowerCase(),o=b.attrHooks[n]||(b.expr.match.bool.test(n)?z:undefined)),r===t?o&&"get"in o&&null!==(s=o.get(e,n))?s:null==(s=b.find.attr(e,n))?t:s:null!==r?o&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):void b.removeAttr(e,n))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)for(;n=o[i++];)r=b.propFix[n]||n,b.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{for:"htmlFor",class:"className"},prop:function(e,n,r){var i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return(1!==s||!b.isXMLDoc(e))&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||U.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),z={set:function(e,t,n){return!1===t?b.removeAttr(e,n):e.setAttribute(n,n),n}},b.each(b.expr.match.bool.source.match(/\w+/g),(function(e,n){var r=b.expr.attrHandle[n]||b.find.attr;b.expr.attrHandle[n]=function(e,n,i){var o=b.expr.attrHandle[n],s=i?t:(b.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return b.expr.attrHandle[n]=o,s}})),b.support.optSelected||(b.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),b.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){b.propFix[this.toLowerCase()]=this})),b.each(["radio","checkbox"],(function(){b.valHooks[this]={set:function(e,t){if(b.isArray(t))return e.checked=b.inArray(b(e).val(),t)>=0}},b.support.checkOn||(b.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}));var Y=/^key/,V=/^(?:mouse|contextmenu)|click/,G=/^(?:focusinfocus|focusoutblur)$/,J=/^([^.]*)(?:\.(.+)|)$/;function Q(){return!0}function K(){return!1}function Z(){try{return s.activeElement}catch(e){}}b.event={global:{},add:function(e,n,r,o,s){var a,u,l,c,f,p,d,h,g,m,y,v=M.get(e);if(v){for(r.handler&&(r=(a=r).handler,s=a.selector),r.guid||(r.guid=b.guid++),(c=v.events)||(c=v.events={}),(u=v.handle)||(u=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(u.elem,arguments)},u.elem=e),f=(n=(n||"").match(T)||[""]).length;f--;)g=y=(l=J.exec(n[f])||[])[1],m=(l[2]||"").split(".").sort(),g&&(d=b.event.special[g]||{},g=(s?d.delegateType:d.bindType)||g,d=b.event.special[g]||{},p=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:s,needsContext:s&&b.expr.match.needsContext.test(s),namespace:m.join(".")},a),(h=c[g])||((h=c[g]=[]).delegateCount=0,d.setup&&!1!==d.setup.call(e,o,m,u)||e.addEventListener&&e.addEventListener(g,u,!1)),d.add&&(d.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?h.splice(h.delegateCount++,0,p):h.push(p),b.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,s,a,u,l,c,f,p,d,h,g,m=M.hasData(e)&&M.get(e);if(m&&(u=m.events)){for(l=(t=(t||"").match(T)||[""]).length;l--;)if(d=g=(a=J.exec(t[l])||[])[1],h=(a[2]||"").split(".").sort(),d){for(f=b.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],a=a[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=p.length;o--;)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));s&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,m.handle)||b.removeEvent(e,d,m.handle),delete u[d])}else for(d in u)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(u)&&(delete m.handle,M.remove(e,"events"))}},trigger:function(n,r,i,o){var a,u,l,c,f,p,d,h=[i||s],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=l=i=i||s,3!==i.nodeType&&8!==i.nodeType&&!G.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),f=g.indexOf(":")<0&&"on"+g,(n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n)).isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),d=b.event.special[g]||{},o||!d.trigger||!1!==d.trigger.apply(i,r))){if(!o&&!d.noBubble&&!b.isWindow(i)){for(c=d.delegateType||g,G.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),l=u;l===(i.ownerDocument||s)&&h.push(l.defaultView||l.parentWindow||e)}for(a=0;(u=h[a++])&&!n.isPropagationStopped();)n.type=a>1?c:d.bindType||g,(p=(M.get(u,"events")||{})[n.type]&&M.get(u,"handle"))&&p.apply(u,r),(p=f&&u[f])&&b.acceptData(u)&&p.apply&&!1===p.apply(u,r)&&n.preventDefault();return n.type=g,o||n.isDefaultPrevented()||d._default&&!1!==d._default.apply(h.pop(),r)||!b.acceptData(i)||f&&b.isFunction(i[g])&&!b.isWindow(i)&&((l=i[f])&&(i[f]=null),b.event.triggered=g,i[g](),b.event.triggered=t,l&&(i[f]=l)),n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,s,a,u=g.call(arguments),l=(M.get(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,e)){for(a=b.event.handlers.call(this,e,l),n=0;(o=a[n++])&&!e.isPropagationStopped();)for(e.currentTarget=o.elem,r=0;(s=o.handlers[r++])&&!e.isImmediatePropagationStopped();)e.namespace_re&&!e.namespace_re.test(s.namespace)||(e.handleObj=s,e.data=s.data,(i=((b.event.special[s.origType]||{}).handle||s.handler).apply(o.elem,u))!==t&&!1===(e.result=i)&&(e.preventDefault(),e.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,s,a=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!==this;l=l.parentNode||this)if(!0!==l.disabled||"click"!==e.type){for(i=[],r=0;r<u;r++)i[o=(s=n[r]).selector+" "]===t&&(i[o]=s.needsContext?b(o,this).index(l)>=0:b.find(o,this,null,[l]).length),i[o]&&i.push(s);i.length&&a.push({elem:l,handlers:i})}return u<n.length&&a.push({elem:this,handlers:n.slice(u)}),a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,a=n.button;return null==e.pageX&&null!=n.clientX&&(i=(r=e.target.ownerDocument||s).documentElement,o=r.body,e.pageX=n.clientX+(i&&i.scrollLeft||o&&o.scrollLeft||0)-(i&&i.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(i&&i.scrollTop||o&&o.scrollTop||0)-(i&&i.clientTop||o&&o.clientTop||0)),e.which||a===t||(e.which=1&a?1:2&a?3:4&a?2:0),e}},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,o=e,a=this.fixHooks[i];for(a||(this.fixHooks[i]=a=V.test(i)?this.mouseHooks:Y.test(i)?this.keyHooks:{}),r=a.props?this.props.concat(a.props):this.props,e=new b.Event(o),t=r.length;t--;)e[n=r[t]]=o[n];return e.target||(e.target=s),3===e.target.nodeType&&(e.target=e.target.parentNode),a.filter?a.filter(e,o):e},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Z()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Z()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&b.nodeName(this,"input"))return this.click(),!1},_default:function(e){return b.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},b.Event=function(e,t){if(!(this instanceof b.Event))return new b.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.getPreventDefault&&e.getPreventDefault()?Q:K):this.type=e,t&&b.extend(this,t),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0},b.Event.prototype={isDefaultPrevented:K,isPropagationStopped:K,isImmediatePropagationStopped:K,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Q,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Q,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Q,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},(function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=e.relatedTarget,i=e.handleObj;return r&&(r===this||b.contains(this,r))||(e.type=i.origType,n=i.handler.apply(this,arguments),e.type=t),n}}})),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},(function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0==n++&&s.addEventListener(e,r,!0)},teardown:function(){0==--n&&s.removeEventListener(e,r,!0)}}})),b.fn.extend({on:function(e,n,r,i,o){var s,a;if("object"==typeof e){for(a in"string"!=typeof n&&(r=r||n,n=t),e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),!1===i)i=K;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each((function(){b.event.add(this,e,i,r,n)}))},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return!1!==n&&"function"!=typeof n||(r=n,n=t),!1===r&&(r=K),this.each((function(){b.event.remove(this,e,r,n)}))},trigger:function(e,t){return this.each((function(){b.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return b.event.trigger(e,t,n,!0)}});var ee=/^.[^:#\[\.,]*$/,te=/^(?:parents|prev(?:Until|All))/,ne=b.expr.match.needsContext,re={children:!0,contents:!0,next:!0,prev:!0};function ie(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function oe(e,t,n){if(b.isFunction(t))return b.grep(e,(function(e,r){return!!t.call(e,r,e)!==n}));if(t.nodeType)return b.grep(e,(function(e){return e===t!==n}));if("string"==typeof t){if(ee.test(t))return b.filter(t,e,n);t=b.filter(t,e)}return b.grep(e,(function(e){return m.call(t,e)>=0!==n}))}b.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(b(e).filter((function(){for(t=0;t<i;t++)if(b.contains(r[t],this))return!0})));for(t=0;t<i;t++)b.find(e,r[t],n);return(n=this.pushStack(i>1?b.unique(n):n)).selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t=b(e,this),n=t.length;return this.filter((function(){for(var e=0;e<n;e++)if(b.contains(this,t[e]))return!0}))},not:function(e){return this.pushStack(oe(this,e||[],!0))},filter:function(e){return this.pushStack(oe(this,e||[],!1))},is:function(e){return!!oe(this,"string"==typeof e&&ne.test(e)?b(e):e||[],!1).length},closest:function(e,t){for(var n,r=0,i=this.length,o=[],s=ne.test(e)||"string"!=typeof e?b(e,t||this.context):0;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(s?s.index(n)>-1:1===n.nodeType&&b.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?m.call(b(e),this[0]):m.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return ie(e,"nextSibling")},prev:function(e){return ie(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return e.contentDocument||b.merge([],e.childNodes)}},(function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),this.length>1&&(re[e]||b.unique(i),te.test(e)&&i.reverse()),this.pushStack(i)}})),b.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?b.find.matchesSelector(r,e)?[r]:[]:b.find.matches(e,b.grep(t,(function(e){return 1===e.nodeType})))},dir:function(e,n,r){for(var i=[],o=r!==t;(e=e[n])&&9!==e.nodeType;)if(1===e.nodeType){if(o&&b(e).is(r))break;i.push(e)}return i},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});var se=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ae=/<([\w:]+)/,ue=/<|&#?\w+;/,le=/<(?:script|style|link)/i,ce=/^(?:checkbox|radio)$/i,fe=/checked\s*(?:[^=]|=\s*.checked.)/i,pe=/^$|\/(?:java|ecma)script/i,de=/^true\/(.*)/,he=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function me(e,t){return b.nodeName(e,"table")&&b.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ye(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function ve(e){var t=de.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function xe(e,t){for(var n=e.length,r=0;r<n;r++)M.set(e[r],"globalEval",!t||M.get(t[r],"globalEval"))}function be(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(M.hasData(e)&&(o=M.access(e),s=M.set(t,o),l=o.events))for(i in delete s.handle,s.events={},l)for(n=0,r=l[i].length;n<r;n++)b.event.add(t,i,l[i][n]);R.hasData(e)&&(a=R.access(e),u=b.extend({},a),R.set(t,u))}}function we(e,n){var r=e.getElementsByTagName?e.getElementsByTagName(n||"*"):e.querySelectorAll?e.querySelectorAll(n||"*"):[];return n===t||n&&b.nodeName(e,n)?b.merge([e],r):r}function Te(e,t){var n=t.nodeName.toLowerCase();"input"===n&&ce.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td,b.fn.extend({text:function(e){return b.access(this,(function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(e))}),null,e,arguments.length)},append:function(){return this.domManip(arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||me(this,e).appendChild(e)}))},prepend:function(){return this.domManip(arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=me(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return this.domManip(arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return this.domManip(arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},remove:function(e,t){for(var n,r=e?b.filter(e,this):this,i=0;null!=(n=r[i]);i++)t||1!==n.nodeType||b.cleanData(we(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&xe(we(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(b.cleanData(we(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return b.clone(this,e,t)}))},html:function(e){return b.access(this,(function(e){var n=this[0]||{},r=0,i=this.length;if(e===t&&1===n.nodeType)return n.innerHTML;if("string"==typeof e&&!le.test(e)&&!ge[(ae.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(se,"<$1></$2>");try{for(;r<i;r++)1===(n=this[r]||{}).nodeType&&(b.cleanData(we(n,!1)),n.innerHTML=e);n=0}catch(e){}}n&&this.empty().append(e)}),null,e,arguments.length)},replaceWith:function(){var e=b.map(this,(function(e){return[e.nextSibling,e.parentNode]})),t=0;return this.domManip(arguments,(function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),b(this).remove(),i.insertBefore(n,r))}),!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,s,a,u,l=0,c=this.length,f=this,p=c-1,h=e[0],g=b.isFunction(h);if(g||!(c<=1||"string"!=typeof h||b.support.checkClone)&&fe.test(h))return this.each((function(r){var i=f.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)}));if(c&&(i=(r=b.buildFragment(e,this[0].ownerDocument,!1,!n&&this)).firstChild,1===r.childNodes.length&&(r=i),i)){for(s=(o=b.map(we(r,"script"),ye)).length;l<c;l++)a=r,l!==p&&(a=b.clone(a,!0,!0),s&&b.merge(o,we(a,"script"))),t.call(this[l],a,l);if(s)for(u=o[o.length-1].ownerDocument,b.map(o,ve),l=0;l<s;l++)a=o[l],pe.test(a.type||"")&&!M.access(a,"globalEval")&&b.contains(u,a)&&(a.src?b._evalUrl(a.src):b.globalEval(a.textContent.replace(he,"")))}return this}}),b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},(function(e,t){b.fn[e]=function(e){for(var n,r=[],i=b(e),o=i.length-1,s=0;s<=o;s++)n=s===o?this:this.clone(!0),b(i[s])[t](n),h.apply(r,n.get());return this.pushStack(r)}})),b.extend({clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),u=b.contains(e.ownerDocument,e);if(!(b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(s=we(a),r=0,i=(o=we(e)).length;r<i;r++)Te(o[r],s[r]);if(t)if(n)for(o=o||we(e),s=s||we(a),r=0,i=o.length;r<i;r++)be(o[r],s[r]);else be(e,a);return(s=we(a,"script")).length>0&&xe(s,!u&&we(e,"script")),a},buildFragment:function(e,t,n,r){for(var i,o,s,a,u,l,c=0,f=e.length,p=t.createDocumentFragment(),d=[];c<f;c++)if((i=e[c])||0===i)if("object"===b.type(i))b.merge(d,i.nodeType?[i]:i);else if(ue.test(i)){for(o=o||p.appendChild(t.createElement("div")),s=(ae.exec(i)||["",""])[1].toLowerCase(),a=ge[s]||ge._default,o.innerHTML=a[1]+i.replace(se,"<$1></$2>")+a[2],l=a[0];l--;)o=o.lastChild;b.merge(d,o.childNodes),(o=p.firstChild).textContent=""}else d.push(t.createTextNode(i));for(p.textContent="",c=0;i=d[c++];)if((!r||-1===b.inArray(i,r))&&(u=b.contains(i.ownerDocument,i),o=we(p.appendChild(i),"script"),u&&xe(o),n))for(l=0;i=o[l++];)pe.test(i.type||"")&&n.push(i);return p},cleanData:function(e){for(var n,r,i,o,s,a,u=b.event.special,l=0;(r=e[l])!==t;l++){if(B.accepts(r)&&(s=r[M.expando])&&(n=M.cache[s])){if((i=Object.keys(n.events||{})).length)for(a=0;(o=i[a])!==t;a++)u[o]?b.event.remove(r,o):b.removeEvent(r,o,n.handle);M.cache[s]&&delete M.cache[s]}delete R.cache[r[R.expando]]}},_evalUrl:function(e){return b.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})}}),b.fn.extend({wrapAll:function(e){var t;return b.isFunction(e)?this.each((function(t){b(this).wrapAll(e.call(this,t))})):(this[0]&&(t=b(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this)},wrapInner:function(e){return b.isFunction(e)?this.each((function(t){b(this).wrapInner(e.call(this,t))})):this.each((function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=b.isFunction(e);return this.each((function(n){b(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(){return this.parent().each((function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)})).end()}});var Ce,Ne,ke=/^(none|table(?!-c[ea]).+)/,Ee=/^margin/,Se=new RegExp("^("+w+")(.*)$","i"),je=new RegExp("^("+w+")(?!px)[a-z%]+$","i"),De=new RegExp("^([+-])=("+w+")","i"),Ae={BODY:"block"},Le={position:"absolute",visibility:"hidden",display:"block"},qe={letterSpacing:0,fontWeight:400},He=["Top","Right","Bottom","Left"],Oe=["Webkit","O","Moz","ms"];function Fe(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Oe.length;i--;)if((t=Oe[i]+n)in e)return t;return r}function Pe(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function Re(t){return e.getComputedStyle(t,null)}function Me(e,t){for(var n,r,i,o=[],s=0,a=e.length;s<a;s++)(r=e[s]).style&&(o[s]=M.get(r,"olddisplay"),n=r.style.display,t?(o[s]||"none"!==n||(r.style.display=""),""===r.style.display&&Pe(r)&&(o[s]=M.access(r,"olddisplay",Ie(r.nodeName)))):o[s]||(i=Pe(r),(n&&"none"!==n||!i)&&M.set(r,"olddisplay",i?n:b.css(r,"display"))));for(s=0;s<a;s++)(r=e[s]).style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[s]||"":"none"));return e}function We(e,t,n){var r=Se.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function $e(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;o<4;o+=2)"margin"===n&&(s+=b.css(e,n+He[o],!0,i)),r?("content"===n&&(s-=b.css(e,"padding"+He[o],!0,i)),"margin"!==n&&(s-=b.css(e,"border"+He[o]+"Width",!0,i))):(s+=b.css(e,"padding"+He[o],!0,i),"padding"!==n&&(s+=b.css(e,"border"+He[o]+"Width",!0,i)));return s}function Be(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Re(e),s=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(i<=0||null==i){if(((i=Ce(e,t,o))<0||null==i)&&(i=e.style[t]),je.test(i))return i;r=s&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+$e(e,t,n||(s?"border":"content"),r,o)+"px"}function Ie(e){var t=s,n=Ae[e];return n||("none"!==(n=ze(e,t))&&n||((t=((Ne=(Ne||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement))[0].contentWindow||Ne[0].contentDocument).document).write("<!doctype html><html><body>"),t.close(),n=ze(e,t),Ne.detach()),Ae[e]=n),n}function ze(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.fn.extend({css:function(e,n){return b.access(this,(function(e,n,r){var i,o,s={},a=0;if(b.isArray(n)){for(i=Re(e),o=n.length;a<o;a++)s[n[a]]=b.css(e,n[a],!1,i);return s}return r!==t?b.style(e,n,r):b.css(e,n)}),e,n,arguments.length>1)},show:function(){return Me(this,!0)},hide:function(){return Me(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each((function(){Pe(this)?b(this).show():b(this).hide()}))}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ce(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:"cssFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,s,a,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=Fe(l,u)),a=b.cssHooks[n]||b.cssHooks[u],r===t)return a&&"get"in a&&(o=a.get(e,!1,i))!==t?o:l[n];"string"===(s=typeof r)&&(o=De.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),s="number"),null==r||"number"===s&&isNaN(r)||("number"!==s||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),a&&"set"in a&&(r=a.set(e,r,i))===t||(l[n]=r))}},css:function(e,n,r,i){var o,s,a,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=Fe(e.style,u)),(a=b.cssHooks[n]||b.cssHooks[u])&&"get"in a&&(o=a.get(e,!0,r)),o===t&&(o=Ce(e,n,i)),"normal"===o&&n in qe&&(o=qe[n]),""===r||r?(s=parseFloat(o),!0===r||b.isNumeric(s)?s||0:o):o}}),Ce=function(e,n,r){var i,o,s,a=r||Re(e),u=a?a.getPropertyValue(n)||a[n]:t,l=e.style;return a&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),je.test(u)&&Ee.test(n)&&(i=l.width,o=l.minWidth,s=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=a.width,l.width=i,l.minWidth=o,l.maxWidth=s)),u},b.each(["height","width"],(function(e,t){b.cssHooks[t]={get:function(e,n,r){if(n)return 0===e.offsetWidth&&ke.test(b.css(e,"display"))?b.swap(e,Le,(function(){return Be(e,t,r)})):Be(e,t,r)},set:function(e,n,r){var i=r&&Re(e);return We(0,n,r?$e(e,t,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}})),b((function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,t){if(t)return b.swap(e,{display:"inline-block"},Ce,[e,"marginRight"])}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],(function(e,t){b.cssHooks[t]={get:function(e,n){if(n)return n=Ce(e,t),je.test(n)?b(e).position()[t]+"px":n}}}))})),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},(function(e,t){b.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+He[r]+t]=o[r]||o[r-2]||o[0];return i}},Ee.test(e)||(b.cssHooks[e+t].set=We)}));var _e=/%20/g,Xe=/\[\]$/,Ue=/\r?\n/g,Ye=/^(?:submit|button|image|reset|file)$/i,Ve=/^(?:input|select|textarea|keygen)/i;function Ge(e,t,n,r){var i;if(b.isArray(t))b.each(t,(function(t,i){n||Xe.test(e)?r(e,i):Ge(e+"["+("object"==typeof i?t:"")+"]",i,n,r)}));else if(n||"object"!==b.type(t))r(e,t);else for(i in t)Ge(e+"["+i+"]",t[i],n,r)}b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&Ve.test(this.nodeName)&&!Ye.test(e)&&(this.checked||!ce.test(e))})).map((function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,(function(e){return{name:t.name,value:e.replace(Ue,"\r\n")}})):{name:t.name,value:n.replace(Ue,"\r\n")}})).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,(function(){o(this.name,this.value)}));else for(r in e)Ge(r,e[r],n,o);return i.join("&").replace(_e,"+")},b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),(function(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}})),b.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var Je,Qe,Ke=b.now(),Ze=/\?/,et=/#.*$/,tt=/([?&])_=[^&]*/,nt=/^(.*?):[ \t]*([^\r\n]*)$/gm,rt=/^(?:GET|HEAD)$/,it=/^\/\//,ot=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,st=b.fn.load,at={},ut={},lt="*/".concat("*");try{Qe=o.href}catch(e){(Qe=s.createElement("a")).href="",Qe=Qe.href}function ct(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(b.isFunction(n))for(;r=o[i++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function ft(e,t,n,r){var i={},o=e===ut;function s(a){var u;return i[a]=!0,b.each(e[a]||[],(function(e,a){var l=a(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),s(l),!1)})),u}return s(t.dataTypes[0])||!i["*"]&&s("*")}function pt(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((o[r]?e:i||(i={}))[r]=n[r]);return i&&b.extend(!0,e,i),e}Je=ot.exec(Qe.toLowerCase())||[],b.fn.load=function(e,n,r){if("string"!=typeof e&&st)return st.apply(this,arguments);var i,o,s,a=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(o="POST"),a.length>0&&b.ajax({url:e,type:o,dataType:"html",data:n}).done((function(e){s=arguments,a.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)})).complete(r&&function(e,t){a.each(r,s||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],(function(e,t){b.fn[t]=function(e){return this.on(t,e)}})),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Qe,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Je[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":lt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?pt(pt(e,b.ajaxSettings),t):pt(b.ajaxSettings,e)},ajaxPrefilter:ct(at),ajaxTransport:ct(ut),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,s,a,u,l,c,f=b.ajaxSetup({},n),p=f.context||f,d=f.context&&(p.nodeType||p.jquery)?b(p):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=f.statusCode||{},y={},v={},x=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!s)for(s={};t=nt.exec(o);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?o:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(x<2)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return r&&r.abort(t),N(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,f.url=((e||f.url||Qe)+"").replace(et,"").replace(it,Je[1]+"//"),f.type=n.method||n.type||f.method||f.type,f.dataTypes=b.trim(f.dataType||"*").toLowerCase().match(T)||[""],null==f.crossDomain&&(u=ot.exec(f.url.toLowerCase()),f.crossDomain=!(!u||u[1]===Je[1]&&u[2]===Je[2]&&(u[3]||("http:"===u[1]?"80":"443"))===(Je[3]||("http:"===Je[1]?"80":"443")))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=b.param(f.data,f.traditional)),ft(at,f,n,C),2===x)return C;for(c in(l=f.global)&&0==b.active++&&b.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!rt.test(f.type),i=f.url,f.hasContent||(f.data&&(i=f.url+=(Ze.test(i)?"&":"?")+f.data,delete f.data),!1===f.cache&&(f.url=tt.test(i)?i.replace(tt,"$1_="+Ke++):i+(Ze.test(i)?"&":"?")+"_="+Ke++)),f.ifModified&&(b.lastModified[i]&&C.setRequestHeader("If-Modified-Since",b.lastModified[i]),b.etag[i]&&C.setRequestHeader("If-None-Match",b.etag[i])),(f.data&&f.hasContent&&!1!==f.contentType||n.contentType)&&C.setRequestHeader("Content-Type",f.contentType),C.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+lt+"; q=0.01":""):f.accepts["*"]),f.headers)C.setRequestHeader(c,f.headers[c]);if(f.beforeSend&&(!1===f.beforeSend.call(p,C,f)||2===x))return C.abort();for(c in w="abort",{success:1,error:1,complete:1})C[c](f[c]);if(r=ft(ut,f,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,f]),f.async&&f.timeout>0&&(a=setTimeout((function(){C.abort("timeout")}),f.timeout));try{x=1,r.send(y,N)}catch(e){if(!(x<2))throw e;N(-1,e)}}else N(-1,"No Transport");function N(e,n,s,u){var c,y,v,w,T,N=n;2!==x&&(x=2,a&&clearTimeout(a),r=t,o=u||"",C.readyState=e>0?4:0,c=e>=200&&e<300||304===e,s&&(w=function(e,n,r){var i,o,s,a,u=e.contents,l=e.dataTypes;for(;"*"===l[0];)l.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("Content-Type"));if(i)for(o in u)if(u[o]&&u[o].test(i)){l.unshift(o);break}if(l[0]in r)s=l[0];else{for(o in r){if(!l[0]||e.converters[o+" "+l[0]]){s=o;break}a||(a=o)}s=s||a}if(s)return s!==l[0]&&l.unshift(s),r[s]}(f,C,s)),w=function(e,t,n,r){var i,o,s,a,u,l={},c=e.dataTypes.slice();if(c[1])for(s in e.converters)l[s.toLowerCase()]=e.converters[s];o=c.shift();for(;o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(s=l[u+" "+o]||l["* "+o]))for(i in l)if((a=i.split(" "))[1]===o&&(s=l[u+" "+a[0]]||l["* "+a[0]])){!0===s?s=l[i]:!0!==l[i]&&(o=a[0],c.unshift(a[1]));break}if(!0!==s)if(s&&e.throws)t=s(t);else try{t=s(t)}catch(e){return{state:"parsererror",error:s?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(f,w,C,c),c?(f.ifModified&&((T=C.getResponseHeader("Last-Modified"))&&(b.lastModified[i]=T),(T=C.getResponseHeader("etag"))&&(b.etag[i]=T)),204===e||"HEAD"===f.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,c=!(v=w.error))):(v=N,!e&&N||(N="error",e<0&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(p,[y,N,C]):h.rejectWith(p,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,f,c?y:v]),g.fireWith(p,[C,N]),l&&(d.trigger("ajaxComplete",[C,f]),--b.active||b.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return b.get(e,t,n,"json")},getScript:function(e,n){return b.get(e,t,n,"script")}}),b.each(["get","post"],(function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}})),b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",(function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),b.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain)return{send:function(r,i){t=b("<script>").prop({async:!0,charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),s.head.appendChild(t[0])},abort:function(){n&&n()}}}));var dt=[],ht=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=dt.pop()||b.expando+"_"+Ke++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",(function(n,r,i){var o,s,a,u=!1!==n.jsonp&&(ht.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&ht.test(n.data)&&"data");if(u||"jsonp"===n.dataTypes[0])return o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(ht,"$1"+o):!1!==n.jsonp&&(n.url+=(Ze.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return a||b.error(o+" was not called"),a[0]},n.dataTypes[0]="json",s=e[o],e[o]=function(){a=arguments},i.always((function(){e[o]=s,n[o]&&(n.jsonpCallback=r.jsonpCallback,dt.push(o)),a&&b.isFunction(s)&&s(a[0]),a=s=t})),"script"})),b.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var gt=b.ajaxSettings.xhr(),mt={0:200,1223:204},yt=0,vt={};e.ActiveXObject&&b(e).on("unload",(function(){for(var e in vt)vt[e]();vt=t})),b.support.cors=!!gt&&"withCredentials"in gt,b.support.ajax=gt=!!gt,b.ajaxTransport((function(e){var n;if(b.support.cors||gt&&!e.crossDomain)return{send:function(r,i){var o,s,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)a[o]=e.xhrFields[o];for(o in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)a.setRequestHeader(o,r[o]);n=function(e){return function(){n&&(delete vt[s],n=a.onload=a.onerror=null,"abort"===e?a.abort():"error"===e?i(a.status||404,a.statusText):i(mt[a.status]||a.status,a.statusText,"string"==typeof a.responseText?{text:a.responseText}:t,a.getAllResponseHeaders()))}},a.onload=n(),a.onerror=n("error"),n=vt[s=yt++]=n("abort"),a.send(e.hasContent&&e.data||null)},abort:function(){n&&n()}}}));var xt,bt,wt=/^(?:toggle|show|hide)$/,Tt=new RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Ct=/queueHooks$/,Nt=[function(e,n,r){var i,o,s,a,u,l,c=this,f={},p=e.style,d=e.nodeType&&Pe(e),h=M.get(e,"fxshow");r.queue||(null==(u=b._queueHooks(e,"fx")).unqueued&&(u.unqueued=0,l=u.empty.fire,u.empty.fire=function(){u.unqueued||l()}),u.unqueued++,c.always((function(){c.always((function(){u.unqueued--,b.queue(e,"fx").length||u.empty.fire()}))})));1===e.nodeType&&("height"in n||"width"in n)&&(r.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(p.display="inline-block"));r.overflow&&(p.overflow="hidden",c.always((function(){p.overflow=r.overflow[0],p.overflowX=r.overflow[1],p.overflowY=r.overflow[2]})));for(i in n)if(o=n[i],wt.exec(o)){if(delete n[i],s=s||"toggle"===o,o===(d?"hide":"show")){if("show"!==o||!h||h[i]===t)continue;d=!0}f[i]=h&&h[i]||b.style(e,i)}if(!b.isEmptyObject(f))for(i in h?"hidden"in h&&(d=h.hidden):h=M.access(e,"fxshow",{}),s&&(h.hidden=!d),d?b(e).show():c.done((function(){b(e).hide()})),c.done((function(){var t;for(t in M.remove(e,"fxshow"),f)b.style(e,t,f[t])})),f)a=St(d?h[i]:0,i,c),i in h||(h[i]=a.start,d&&(a.end=a.start,a.start="width"===i||"height"===i?1:0))}],kt={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Tt.exec(t),o=i&&i[3]||(b.cssNumber[e]?"":"px"),s=(b.cssNumber[e]||"px"!==o&&+r)&&Tt.exec(b.css(n.elem,e)),a=1,u=20;if(s&&s[3]!==o){o=o||s[3],i=i||[],s=+r||1;do{s/=a=a||".5",b.style(n.elem,e,s+o)}while(a!==(a=n.cur()/r)&&1!==a&&--u)}return i&&(s=n.start=+s||+r||0,n.unit=o,n.end=i[1]?s+(i[1]+1)*i[2]:+i[2]),n}]};function Et(){return setTimeout((function(){xt=t})),xt=b.now()}function St(e,t,n){for(var r,i=(kt[t]||[]).concat(kt["*"]),o=0,s=i.length;o<s;o++)if(r=i[o].call(n,t,e))return r}function jt(e,t,n){var r,i,o=0,s=Nt.length,a=b.Deferred().always((function(){delete u.elem})),u=function(){if(i)return!1;for(var t=xt||Et(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,s=l.tweens.length;o<s;o++)l.tweens[o].run(r);return a.notifyWith(e,[l,r,n]),r<1&&s?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:xt||Et(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,s;for(n in e)if(i=t[r=b.camelCase(n)],o=e[n],b.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(s=b.cssHooks[r])&&"expand"in s)for(n in o=s.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);o<s;o++)if(r=Nt[o].call(l,e,c,l.opts))return r;return b.map(c,St,l),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function Dt(e,t,n,r,i){return new Dt.prototype.init(e,t,n,r,i)}function At(e,t){var n,r={height:e},i=0;for(t=t?1:0;i<4;i+=2-t)r["margin"+(n=He[i])]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function Lt(e){return b.isWindow(e)?e:9===e.nodeType&&e.defaultView}b.Animation=b.extend(jt,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,i=e.length;r<i;r++)n=e[r],kt[n]=kt[n]||[],kt[n].unshift(t)},prefilter:function(e,t){t?Nt.unshift(e):Nt.push(e)}}),b.Tween=Dt,Dt.prototype={constructor:Dt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=Dt.propHooks[this.prop];return e&&e.get?e.get(this):Dt.propHooks._default.get(this)},run:function(e){var t,n=Dt.propHooks[this.prop];return this.options.duration?this.pos=t=b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Dt.propHooks._default.set(this),this}},Dt.prototype.init.prototype=Dt.prototype,Dt.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""))&&"auto"!==t?t:0:e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Dt.propHooks.scrollTop=Dt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],(function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(At(t,!0),e,r,i)}})),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Pe).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),s=function(){var t=jt(this,b.extend({},e),o);(i||M.get(this,"finish"))&&t.stop(!0)};return s.finish=s,i||!1===o.queue?this.each(s):this.queue(o.queue,s)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&!1!==e&&this.queue(e||"fx",[]),this.each((function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,s=M.get(this);if(n)s[n]&&s[n].stop&&i(s[n]);else for(n in s)s[n]&&s[n].stop&&Ct.test(n)&&i(s[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));!t&&r||b.dequeue(this,e)}))},finish:function(e){return!1!==e&&(e=e||"fx"),this.each((function(){var t,n=M.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,s=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<s;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish}))}}),b.each({slideDown:At("show"),slideUp:At("hide"),slideToggle:At("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},(function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}})),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=Dt.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(xt=b.now();r<n.length;r++)(e=n[r])()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),xt=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){bt||(bt=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(bt),bt=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,(function(t){return e===t.elem})).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each((function(t){b.offset.setOffset(this,e,t)}));var n,r,o=this[0],s={top:0,left:0},a=o&&o.ownerDocument;return a?(n=a.documentElement,b.contains(n,o)?(typeof o.getBoundingClientRect!==i&&(s=o.getBoundingClientRect()),r=Lt(a),{top:s.top+r.pageYOffset-n.clientTop,left:s.left+r.pageXOffset-n.clientLeft}):s):void 0},b.offset={setOffset:function(e,t,n){var r,i,o,s,a,u,l=b.css(e,"position"),c=b(e),f={};"static"===l&&(e.style.position="relative"),a=c.offset(),o=b.css(e,"top"),u=b.css(e,"left"),("absolute"===l||"fixed"===l)&&(o+u).indexOf("auto")>-1?(s=(r=c.position()).top,i=r.left):(s=parseFloat(o)||0,i=parseFloat(u)||0),b.isFunction(t)&&(t=t.call(e,n,a)),null!=t.top&&(f.top=t.top-a.top+s),null!=t.left&&(f.left=t.left-a.left+i),"using"in t?t.using.call(e,f):c.css(f)}},b.fn.extend({position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===b.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(r=e.offset()),r.top+=b.css(e[0],"borderTopWidth",!0),r.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-b.css(n,"marginTop",!0),left:t.left-r.left-b.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map((function(){for(var e=this.offsetParent||a;e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position");)e=e.offsetParent;return e||a}))}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(n,r){var i="pageYOffset"===r;b.fn[n]=function(o){return b.access(this,(function(n,o,s){var a=Lt(n);if(s===t)return a?a[r]:n[o];a?a.scrollTo(i?e.pageXOffset:s,i?s:e.pageYOffset):n[o]=s}),n,o,arguments.length,null)}})),b.each({Height:"height",Width:"width"},(function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},(function(r,i){b.fn[i]=function(i,o){var s=arguments.length&&(r||"boolean"!=typeof i),a=r||(!0===i||!0===o?"margin":"border");return b.access(this,(function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,a):b.style(n,r,i,a)}),n,s?i:t,s,null)}}))})),b.fn.size=function(){return this.length},b.fn.andSelf=b.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=b:"function"==typeof define&&define.amd&&define("jquery",[],(function(){return b})),"object"==typeof e&&"object"==typeof e.document&&(e.jQuery=e.$=b)}(window);"undefined"!=typeof module&&module.exports&&(jQuery=$={isArray:function(e){return"[object Array]"===Object.prototype.toString.apply(e)},isPlainObject:function(e){var t;if(!e||"object"!==jQuery.type(e)||e.nodeType||jQuery.isWindow(e))return!1;if(e.constructor&&!core_hasOwn.call(e,"constructor")&&!core_hasOwn.call(e.constructor.prototype,"isPrototypeOf"))return!1;for(t in e);return void 0===t||core_hasOwn.call(e,t)},extend:function(){var e,t,n,i,s,o,r=arguments[0]||{},a=1,l=arguments.length,c=!1;for("boolean"==typeof r&&(c=r,r=arguments[1]||{},a=2),l===a&&(r=this,--a);a<l;a++)if(null!=(e=arguments[a]))for(t in e)n=r[t],r!==(i=e[t])&&(c&&i&&(this.isPlainObject(i)||(s=this.isArray(i)))?(s?(s=!1,o=n&&this.isArray(n)?n:[]):o=n&&this.isPlainObject(n)?n:{},r[t]=this.extend(c,o,i)):void 0!==i&&(r[t]=i));return r}}),$.extend({spcExtend:function(e){var t=function(e){void 0!==this.init&&this.init(e||{})};t.prototype.superInit=e.init;var n=[];n.push(t.prototype);for(var i=arguments.length,s=0;s<i;s++)n.push(arguments[s]);return $.extend.apply($,n),t}}),$.extend(String.prototype,{lpad:function(e,t){for(var n=this;n.length<t;)n=e+n;return n},rpad:function(e,t){for(var n=this;n.length<t;)n+=e;return n}}),wdi={},wdi.DomainObject={},wdi.RawMessage=$.spcExtend(wdi.DomainObject,{status:null,data:null,init:function(e){this.status=e.status,this.data=e.data}}),wdi.RawSpiceMessage=$.spcExtend(wdi.DomainObject,{header:null,body:null,channel:null,set:function(e,t,n){this.header=e,this.body=t,this.channel=n}}),wdi.SpiceMessage=$.spcExtend(wdi.DomainObject,{messageType:null,args:null,channel:null,init:function(e){this.channel=e.channel,this.messageType=e.messageType,this.args=e.args}}),wdi.EventObject=$.spcExtend(wdi.DomainObject,{events:null,init:function(){this.eyeEvents={}},getListenersLength:function(e){return null==this.eyeEvents[e]&&(this.eyeEvents[e]=[]),this.eyeEvents[e].length},addListener:function(e,t,n){n=n||this,null==this.eyeEvents[e]&&(this.eyeEvents[e]=[]),this.eyeEvents[e].push({fn:t,scope:n})},removeEvent:function(e){this.eyeEvents[e]=void 0},clearEvents:function(){this.eyeEvents={}},fire:function(e,t){var n=this.eyeEvents[e];if(n)for(var i=n.length;i--;)n[i].fn.call(n[i].scope,t)}}),wdi.CHANNEL_STATUS={disconnected:-1,idle:0,establishing:1,established:2},wdi.Debug={debug:!0,log:function(e){this.debug&&console.log.apply(console,Array.prototype.slice.call(arguments))},warn:function(e){console.warn.apply(console,Array.prototype.slice.call(arguments))},info:function(e){this.debug&&console.info.apply(console,Array.prototype.slice.call(arguments))},error:function(e){console.error.apply(console,Array.prototype.slice.call(arguments))}},wdi.Utils={generateWebSocketUrl:function(e,t,n,i,s,o,r,a){return url=i&&s?CONSOLE.wsUrl:e+"://"+t+":"+n+"/websockify/destInfoToken/"+r+"/type/"+o,url}},wdi.postMessageW3CCompilant="undefined"!=typeof window&&window.bowser&&!(window.bowser.msie&&window.bowser.version>=10),wdi.Exception=$.spcExtend(wdi.DomainObject,{errorCode:null,message:null,init:function(e){this.message=e.message||"",this.errorCode=e.errorCode||0}});try{new ImageData(1,1)}catch(e){"undefined"!=typeof window&&(window.ImageData=function(e,t,n){var i=document.createElement("canvas").getContext("2d").createImageData(t,n);return i.data.set(e),i})}wdi.bppMask=[],wdi.bppMask[1]=[128,64,32,16,8,4,2,1],wdi.bppMask[4]=[240,15],wdi.bppMask[8]=[255],wdi.SeamlessIntegration=!0,wdi.Debug.debug=!1,wdi.exceptionHandling=!0,wdi.IntegrationBenchmarkEnabled=!1,wdi.useWorkers=!0,wdi.logOperations=!1;window.Modernizr=function(e,t,n){function r(e){f.cssText=e}function o(e,t){return typeof e===t}var i,a,c={},l=t.documentElement,s="modernizr",u=t.createElement(s),f=u.style,d=" -webkit- -moz- -o- -ms- ".split(" "),p="Webkit Moz O ms",h=p.split(" "),m=p.toLowerCase().split(" "),y={},v=[],g=v.slice,b=function(e,n,r,o){var i,a,c,u=t.createElement("div"),f=t.body,d=f||t.createElement("body");if(parseInt(r,10))for(;r--;)(c=t.createElement("div")).id=o?o[r]:s+(r+1),u.appendChild(c);return i=["&#173;",'<style id="s',s,'">',e,"</style>"].join(""),u.id=s,(f?u:d).innerHTML+=i,d.appendChild(u),f||(d.style.background="",l.appendChild(d)),a=n(u,e),f?u.parentNode.removeChild(u):d.parentNode.removeChild(d),!!a},E={}.hasOwnProperty;for(var C in a=o(E,"undefined")||o(E.call,"undefined")?function(e,t){return t in e&&o(e.constructor.prototype[t],"undefined")}:function(e,t){return E.call(e,t)},Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if("function"!=typeof t)throw new TypeError;var n=g.call(arguments,1),r=function(){if(this instanceof r){var o=function(){};o.prototype=t.prototype;var i=new o,a=t.apply(i,n.concat(g.call(arguments)));return Object(a)===a?a:i}return t.apply(e,n.concat(g.call(arguments)))};return r}),y.canvas=function(){var e=t.createElement("canvas");return!!e.getContext&&!!e.getContext("2d")},y.webgl=function(){return!!e.WebGLRenderingContext},y.touch=function(){var n;return"ontouchstart"in e||e.DocumentTouch&&t instanceof DocumentTouch?n=!0:b(["@media (",d.join("touch-enabled),("),s,")","{#modernizr{top:9px;position:absolute}}"].join(""),(function(e){n=9===e.offsetTop})),n},y.websockets=function(){return"WebSocket"in e||"MozWebSocket"in e},y)a(y,C)&&(i=C.toLowerCase(),c[i]=y[C](),v.push((c[i]?"":"no-")+i));return c.addTest=function(e,t){if("object"==typeof e)for(var r in e)a(e,r)&&c.addTest(r,e[r]);else{if(e=e.toLowerCase(),c[e]!==n)return c;t="function"==typeof t?t():t,l.className+=" "+(t?"":"no-")+e,c[e]=t}return c},r(""),u=null,function(e,t){function n(){var e=h.elements;return"string"==typeof e?e.split(" "):e}function r(e){var t=p[e[f]];return t||(t={},d++,e[f]=d,p[d]=t),t}function o(e,n,o){return n||(n=t),c?n.createElement(e):(o||(o=r(n)),(i=o.cache[e]?o.cache[e].cloneNode():u.test(e)?(o.cache[e]=o.createElem(e)).cloneNode():o.createElem(e)).canHaveChildren&&!s.test(e)?o.frag.appendChild(i):i);var i}function i(e){e||(e=t);var i=r(e);return h.shivCSS&&!a&&!i.hasCSS&&(i.hasCSS=!!function(e,t){var n=e.createElement("p"),r=e.getElementsByTagName("head")[0]||e.documentElement;return n.innerHTML="x<style>"+t+"</style>",r.insertBefore(n.lastChild,r.firstChild)}(e,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),c||function(e,t){t.cache||(t.cache={},t.createElem=e.createElement,t.createFrag=e.createDocumentFragment,t.frag=t.createFrag()),e.createElement=function(n){return h.shivMethods?o(n,e,t):t.createElem(n)},e.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+n().join().replace(/\w+/g,(function(e){return t.createElem(e),t.frag.createElement(e),'c("'+e+'")'}))+");return n}")(h,t.frag)}(e,i),e}var a,c,l=e.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,u=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,f="_html5shiv",d=0,p={};!function(){try{var e=t.createElement("a");e.innerHTML="<xyz></xyz>",a="hidden"in e,c=1==e.childNodes.length||function(){t.createElement("a");var e=t.createDocumentFragment();return void 0===e.cloneNode||void 0===e.createDocumentFragment||void 0===e.createElement}()}catch(e){a=!0,c=!0}}();var h={elements:l.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:!1!==l.shivCSS,supportsUnknownElements:c,shivMethods:!1!==l.shivMethods,type:"default",shivDocument:i,createElement:o,createDocumentFragment:function(e,o){if(e||(e=t),c)return e.createDocumentFragment();for(var i=(o=o||r(e)).frag.cloneNode(),a=0,l=n(),s=l.length;a<s;a++)i.createElement(l[a]);return i}};e.html5=h,i(t)}(this,t),c._version="2.6.0",c._prefixes=d,c._domPrefixes=m,c._cssomPrefixes=h,c.testStyles=b,l.className=l.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+" js "+v.join(" "),c}(this,this.document),function(e,t){function n(e){return"[object Function]"==m.call(e)}function r(e){return"string"==typeof e}function o(){}function i(e){return!e||"loaded"==e||"complete"==e||"uninitialized"==e}function a(){var e=y.shift();v=1,e?e.t?p((function(){("c"==e.t?f.injectCss:f.injectJs)(e.s,0,e.a,e.x,e.e,1)}),0):(e(),a()):v=0}function c(e,n,r,o,c,l,s){function u(t){if(!m&&i(d.readyState)&&(C.r=m=1,!v&&a(),d.onload=d.onreadystatechange=null,t))for(var r in"img"!=e&&p((function(){E.removeChild(d)}),50),x[n])x[n].hasOwnProperty(r)&&x[n][r].onload()}s=s||f.errorTimeout;var d={},m=0,g=0,C={t:r,s:n,e:c,a:l,x:s};1===x[n]&&(g=1,x[n]=[],d=t.createElement(e)),"object"==e?d.data=n:(d.src=n,d.type=e),d.width=d.height="0",d.onerror=d.onload=d.onreadystatechange=function(){u.call(this,g)},y.splice(o,0,C),"img"!=e&&(g||2===x[n]?(E.insertBefore(d,b?null:h),p(u,s)):x[n].push(d))}function l(e,t,n,o,i){return v=0,t=t||"j",r(e)?c("c"==t?w:C,e,t,this.i++,n,o,i):(y.splice(this.i++,0,e),1==y.length&&a()),this}function s(){var e=f;return e.loader={load:l,i:0},e}var u,f,d=t.documentElement,p=e.setTimeout,h=t.getElementsByTagName("script")[0],m={}.toString,y=[],v=0,g="MozAppearance"in d.style,b=g&&!!t.createRange().compareNode,E=b?d:h.parentNode,C=(d=e.opera&&"[object Opera]"==m.call(e.opera),d=!!t.attachEvent&&!d,g?"object":d?"script":"img"),w=d?"script":C,S=Array.isArray||function(e){return"[object Array]"==m.call(e)},j=[],x={},k={timeout:function(e,t){return t.length&&(e.timeout=t[0]),e}};f=function(e){function t(e,t,r,o,i){var c=function(e){e=e.split("!");var t,n,r,o=j.length,i=e.pop(),a=e.length;for(i={url:i,origUrl:i,prefixes:e},n=0;n<a;n++)r=e[n].split("="),(t=k[r.shift()])&&(i=t(i,r));for(n=0;n<o;n++)i=j[n](i);return i}(e),l=c.autoCallback;c.url.split(".").pop().split("?").shift(),c.bypass||(t&&(t=n(t)?t:t[e]||t[o]||t[e.split("/").pop().split("?")[0]]||a),c.instead?c.instead(e,t,r,o,i):(x[c.url]?c.noexec=!0:x[c.url]=1,r.load(c.url,c.forceCSS||!c.forceJS&&"css"==c.url.split(".").pop().split("?").shift()?"c":undefined,c.noexec,c.attrs,c.timeout),(n(t)||n(l))&&r.load((function(){s(),t&&t(c.origUrl,i,o),l&&l(c.origUrl,i,o),x[c.url]=2}))))}function i(e,i){function a(e,o){if(e){if(r(e))o||(f=function(){var e=[].slice.call(arguments);d.apply(this,e),p()}),t(e,f,i,0,s);else if(Object(e)===e)for(l in c=function(){var t,n=0;for(t in e)e.hasOwnProperty(t)&&n++;return n}(),e)e.hasOwnProperty(l)&&(!o&&! --c&&(n(f)?f=function(){var e=[].slice.call(arguments);d.apply(this,e),p()}:f[l]=function(e){return function(){var t=[].slice.call(arguments);e&&e.apply(this,t),p()}}(d[l])),t(e[l],f,i,l,s))}else!o&&p()}var c,l,s=!!e.test,u=e.load||e.both,f=e.callback||o,d=f,p=e.complete||o;a(s?e.yep:e.nope,!!u),u&&a(u)}var c,l,u=this.yepnope.loader;if(r(e))t(e,0,u,0);else if(S(e))for(c=0;c<e.length;c++)r(l=e[c])?t(l,0,u,0):S(l)?f(l):Object(l)===l&&i(l,u);else Object(e)===e&&i(e,u)},f.addPrefix=function(e,t){k[e]=t},f.addFilter=function(e){j.push(e)},f.errorTimeout=1e4,null==t.readyState&&t.addEventListener&&(t.readyState="loading",t.addEventListener("DOMContentLoaded",u=function(){t.removeEventListener("DOMContentLoaded",u,0),t.readyState="complete"},0)),e.yepnope=s(),e.yepnope.executeStack=a,e.yepnope.injectJs=function(e,n,r,c,l,s){var u,d,m=t.createElement("script");c=c||f.errorTimeout;for(d in m.src=e,r)m.setAttribute(d,r[d]);n=s?a:n||o,m.onreadystatechange=m.onload=function(){!u&&i(m.readyState)&&(u=1,n(),m.onload=m.onreadystatechange=null)},p((function(){u||(u=1,n(1))}),c),l?m.onload():h.parentNode.insertBefore(m,h)},e.yepnope.injectCss=function(e,n,r,i,c,l){var s;i=t.createElement("link"),n=l?a:n||o;for(s in i.href=e,i.rel="stylesheet",i.type="text/css",r)i.setAttribute(s,r[s]);c||(h.parentNode.insertBefore(i,h),p(n,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))},Modernizr.addTest("websocketsbinary",(function(){var e,t="https:"==location.protocol?"wss":"ws";if("WebSocket"in window){if(e="binaryType"in WebSocket.prototype)return e;try{return!!new WebSocket(t+"://.").binaryType}catch(e){}}return!1}));/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
30
- * Licensed under the MIT License (LICENSE.txt).
31
- *
32
- * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
33
- * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
34
- * Thanks to: Seamus Leahy for adding deltaX and deltaY
35
- *
36
- * Version: 3.0.6
37
- *
38
- * Requires: 1.2.2+
39
- */
40
- !function(e){var t=["DOMMouseScroll","mousewheel"];if(e.event.fixHooks)for(var n=t.length;n;)e.event.fixHooks[t[--n]]=e.event.mouseHooks;function i(t){var n=t||window.event,i=[].slice.call(arguments,1),l=0,s=0,o=0;return(t=e.event.fix(n)).type="mousewheel",n.wheelDelta&&(l=n.wheelDelta/120),n.detail&&(l=-n.detail/3),o=l,void 0!==n.axis&&n.axis===n.HORIZONTAL_AXIS&&(o=0,s=-1*l),void 0!==n.wheelDeltaY&&(o=n.wheelDeltaY/120),void 0!==n.wheelDeltaX&&(s=-1*n.wheelDeltaX/120),i.unshift(t,l,s,o),(e.event.dispatch||e.event.handle).apply(this,i)}e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var e=t.length;e;)this.addEventListener(t[--e],i,!1);else this.onmousewheel=i},teardown:function(){if(this.removeEventListener)for(var e=t.length;e;)this.removeEventListener(t[--e],i,!1);else this.onmousewheel=null}},e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}(jQuery);/*! jquery-visibility v1.0.11 | MIT license | http://mths.be/visibility */
41
- !function(e,i){"function"==typeof define&&define.amd?define(["jquery"],(function(t){return i(e,t)})):"object"==typeof exports?module.exports=i(e,require("jquery")):i(e,jQuery)}(this,(function(e,i,t){"use strict";function o(){"hidden"!==n&&(r.hidden=f.pageVisibility?r[n]:t)}for(var n,u,r=e.document,s=["webkit","o","ms","moz",""],f=i.support||{},c=("onfocusin"in r&&"hasFocus"in r?"focusin focusout":"focus blur");(u=s.pop())!==t;)if(n=(u?u+"H":"h")+"idden",f.pageVisibility=r[n]!==t,f.pageVisibility){c=u+"visibilitychange";break}o(),i(/blur$/.test(c)?e:r).on(c,(function(e){var u=e.type,s=e.originalEvent;if(s){var f=s.toElement;(!/^focus./.test(u)||f===t&&s.fromElement===t&&s.relatedTarget===t)&&i(r).triggerHandler(n&&r[n]||/^(?:blur|focusout)$/.test(u)?"hide":"show"),o()}}))}));/**
42
- * @license
43
- * lodash 4.0.0 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
44
- * Build: `lodash -o ./dist/lodash.js`
45
- */
46
- (function(){function n(n,t){return n.set(t[0],t[1]),n}function t(n,t){return n.add(t),n}function r(n,t,r){switch(r?r.length:0){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function e(n,t){for(var r=-1,e=n.length;++r<e&&!1!==t(n[r],r,n););return n}function u(n,t){for(var r=-1,e=n.length;++r<e;)if(!t(n[r],r,n))return!1;return!0}function o(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;){var i=n[r];t(i,r,n)&&(o[++u]=i)}return o}function i(n,t){return!!n.length&&-1<g(n,t,0)}function f(n,t,r){for(var e=-1,u=n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function c(n,t){for(var r=-1,e=n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,o=n.length;for(e&&o&&(r=n[++u]);++u<o;)r=t(r,n[u],u,n);return r}function s(n,t,r,e){var u=n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}function p(n,t,r){for(var e=-1,u=n.length;++e<u;){var o=n[e],i=t(o);if(null!=i&&(f===M?i==i:r(i,f)))var f=i,c=o}return c}function _(n,t,r,e){var u;return r(n,(function(n,r,o){return t(n,r,o)?(u=e?r:n,!1):void 0})),u}function v(n,t,r){for(var e=n.length,u=r?e:-1;r?u--:++u<e;)if(t(n[u],u,n))return u;return-1}function g(n,t,r){if(t!=t)return S(n,r);--r;for(var e=n.length;++r<e;)if(n[r]===t)return r;return-1}function d(n,t,r,e,u){return u(n,(function(n,u,o){r=e?(e=!1,n):t(r,n,u,o)})),r}function y(n,t){for(var r,e=-1,u=n.length;++e<u;){var o=t(n[e]);o!==M&&(r=r===M?o:r+o)}return r}function b(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function x(n,t){return c(t,(function(t){return[t,n[t]]}))}function j(n){return function(t){return n(t)}}function m(n,t){return c(t,(function(t){return n[t]}))}function w(n,t){for(var r=-1,e=n.length;++r<e&&-1<g(t,n[r],0););return r}function A(n,t){for(var r=n.length;r--&&-1<g(t,n[r],0););return r}function O(n){return n&&n.Object===Object?n:null}function E(n,t){if(n!==t){var r=null===n,e=n===M,u=n==n,o=null===t,i=t===M,f=t==t;if(n>t&&!o||!u||r&&!i&&f||e&&f)return 1;if(t>n&&!r||!f||o&&!e&&u||i&&u)return-1}return 0}function k(n){return Sn[n]}function I(n){return Wn[n]}function R(n){return"\\"+zn[n]}function S(n,t,r){var e=n.length;for(t+=r?0:-1;r?t--:++t<e;){var u=n[t];if(u!=u)return t}return-1}function W(n){var t=!1;if(null!=n&&"function"!=typeof n.toString)try{t=!!(n+"")}catch(n){}return t}function C(n,t){return(n="number"==typeof n||vn.test(n)?+n:-1)>-1&&0==n%1&&(null==t?9007199254740991:t)>n}function U(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function z(n){var t=-1,r=Array(n.size);return n.forEach((function(n,e){r[++t]=[e,n]})),r}function B(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;)n[r]===t&&(n[r]="__lodash_placeholder__",o[++u]=r);return o}function L(n){var t=-1,r=Array(n.size);return n.forEach((function(n){r[++t]=n})),r}function $(n){if(!n||!wn.test(n))return n.length;for(var t=mn.lastIndex=0;mn.test(n);)t++;return t}function F(n){return Cn[n]}var M,N=1/0,Z=NaN,D=/\b__p\+='';/g,q=/\b(__p\+=)''\+/g,P=/(__e\(.*?\)|\b__t\))\+'';/g,T=/&(?:amp|lt|gt|quot|#39|#96);/g,K=/[&<>"'`]/g,G=RegExp(T.source),V=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,nn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,tn=/[\\^$.*+?()[\]{}|]/g,rn=RegExp(tn.source),en=/^\s+|\s+$/g,un=/^\s+/,on=/\s+$/,fn=/\\(\\)?/g,cn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,an=/\w*$/,ln=/^0x/i,sn=/^[-+]0x[0-9a-f]+$/i,hn=/^0b[01]+$/i,pn=/^\[object .+?Constructor\]$/,_n=/^0o[0-7]+$/i,vn=/^(?:0|[1-9]\d*)$/,gn=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,dn=/($^)/,yn=/['\n\r\u2028\u2029\\]/g,bn="[\\ufe0e\\ufe0f]?(?:\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:\\ud83c[\\udffb-\\udfff])?)*",xn="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+bn,jn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23]","g"),mn=RegExp("(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe23]?|[\\u0300-\\u036f\\ufe20-\\ufe23]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])"+bn,"g"),wn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe23\\ufe0e\\ufe0f]"),An=/[a-zA-Z0-9]+/g,On=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+|\\d+(?:(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+)?",xn].join("|"),"g"),En=/[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,kn="Array Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Reflect RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),In={};In["[object Float32Array]"]=In["[object Float64Array]"]=In["[object Int8Array]"]=In["[object Int16Array]"]=In["[object Int32Array]"]=In["[object Uint8Array]"]=In["[object Uint8ClampedArray]"]=In["[object Uint16Array]"]=In["[object Uint32Array]"]=!0,In["[object Arguments]"]=In["[object Array]"]=In["[object ArrayBuffer]"]=In["[object Boolean]"]=In["[object Date]"]=In["[object Error]"]=In["[object Function]"]=In["[object Map]"]=In["[object Number]"]=In["[object Object]"]=In["[object RegExp]"]=In["[object Set]"]=In["[object String]"]=In["[object WeakMap]"]=!1;var Rn={};Rn["[object Arguments]"]=Rn["[object Array]"]=Rn["[object ArrayBuffer]"]=Rn["[object Boolean]"]=Rn["[object Date]"]=Rn["[object Float32Array]"]=Rn["[object Float64Array]"]=Rn["[object Int8Array]"]=Rn["[object Int16Array]"]=Rn["[object Int32Array]"]=Rn["[object Map]"]=Rn["[object Number]"]=Rn["[object Object]"]=Rn["[object RegExp]"]=Rn["[object Set]"]=Rn["[object String]"]=Rn["[object Symbol]"]=Rn["[object Uint8Array]"]=Rn["[object Uint8ClampedArray]"]=Rn["[object Uint16Array]"]=Rn["[object Uint32Array]"]=!0,Rn["[object Error]"]=Rn["[object Function]"]=Rn["[object WeakMap]"]=!1;var Sn={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},Wn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"},Cn={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&#96;":"`"},Un={function:!0,object:!0},zn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Bn=parseFloat,Ln=parseInt,$n=Un[typeof exports]&&exports&&!exports.nodeType?exports:null,Fn=Un[typeof module]&&module&&!module.nodeType?module:null,Mn=O(Un[typeof self]&&self),Nn=O(Un[typeof window]&&window),Zn=Fn&&Fn.exports===$n?$n:null,Dn=O(Un[typeof this]&&this),qn=O($n&&Fn&&"object"==typeof global&&global)||Nn!==(Dn&&Dn.window)&&Nn||Mn||Dn||Function("return this")(),Pn=function O(vn){function bn(n){if(ee(n)&&!xo(n)&&!(n instanceof Wn)){if(n instanceof Sn)return n;if(Pe.call(n,"__wrapped__"))return kr(n)}return new Sn(n)}function xn(){}function Sn(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=M}function Wn(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Cn(){}function Un(n){var t=-1,r=n?n.length:0;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function zn(n){var t=-1,r=n?n.length:0;for(this.__data__=new Un;++t<r;)this.push(n[t])}function $n(n,t){var r=n.__data__;return br(t)?(r=r.__data__,"__lodash_hash_undefined__"===("string"==typeof t?r.string:r.hash)[t]):r.has(t)}function Fn(n){var t=-1,r=n?n.length:0;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Mn(n,t){var r=Zn(n,t);return!(0>r)&&(r==n.length-1?n.pop():iu.call(n,r,1),!0)}function Nn(n,t){var r=Zn(n,t);return 0>r?M:n[r][1]}function Zn(n,t){for(var r=n.length;r--;)if(Gr(n[r][0],t))return r;return-1}function Dn(n,t,r){var e=Zn(n,t);0>e?n.push([t,r]):n[e][1]=r}function Tn(n,t,r,e){return n===M||Gr(n,De[r])&&!Pe.call(e,r)?t:n}function Kn(n,t,r){(r!==M&&!Gr(n[t],r)||"number"==typeof t&&r===M&&!(t in n))&&(n[t]=r)}function Gn(n,t,r){var e=n[t];(!Gr(e,r)||Gr(e,De[t])&&!Pe.call(n,t)||r===M&&!(t in n))&&(n[t]=r)}function Vn(n,t){return n&&Zt(t,je(t),n)}function Jn(n,t){for(var r=-1,e=null==n,u=t.length,o=Array(u);++r<u;)o[r]=e?M:ye(n,t[r]);return o}function Yn(n,t,r){return n==n&&(r!==M&&(n=n>r?r:n),t!==M&&(n=t>n?t:n)),n}function Hn(n,t,r,u,o,i){var f;if(r&&(f=o?r(n,u,o,i):r(n)),f!==M)return f;if(!re(n))return n;if(u=xo(n)){if(f=function(n){var t=n.length,r=n.constructor(t);return t&&"string"==typeof n[0]&&Pe.call(n,"index")&&(r.index=n.index,r.input=n.input),r}(n),!t)return Nt(n,f)}else{var c=pr(n),a="[object Function]"==c||"[object GeneratorFunction]"==c;if("[object Object]"!=c&&"[object Arguments]"!=c&&(!a||o))return Rn[c]?vr(n,c,t):o?n:{};if(W(n))return o?n:{};if(f=function(n){return n=n.constructor,Iu(Xr(n)?n.prototype:M)}(a?{}:n),!t)return qt(n,Vn(f,n))}return i||(i=new Fn),(o=i.get(n))?o:(i.set(n,f),(u?e:et)(n,(function(e,u){Gn(f,u,Hn(e,t,r,u,n,i))})),u?f:qt(n,f))}function Qn(n,t,r){if("function"!=typeof n)throw new Ne("Expected a function");return ou((function(){n.apply(M,r)}),t)}function Xn(n,t,r,e){var u=-1,o=i,a=!0,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,j(r))),e?(o=f,a=!1):t.length>=200&&(o=$n,a=!1,t=new zn(t));n:for(;++u<l;){var p=n[u],_=r?r(p):p;if(a&&_==_){for(var v=h;v--;)if(t[v]===_)continue n;s.push(p)}else o(t,_,e)||s.push(p)}return s}function nt(n,t){var r=!0;return Ru(n,(function(n,e,u){return r=!!t(n,e,u)})),r}function tt(n,t){var r=[];return Ru(n,(function(n,e,u){t(n,e,u)&&r.push(n)})),r}function rt(n,t,r,e){e||(e=[]);for(var u=-1,o=n.length;++u<o;){var i=n[u];Hr(i)&&(r||xo(i)||Jr(i))?t?rt(i,t,r,e):a(e,i):r||(e[e.length]=i)}return e}function et(n,t){return n&&Wu(n,t,je)}function ut(n,t){return n&&Cu(n,t,je)}function ot(n,t){return o(t,(function(t){return Xr(n[t])}))}function it(n,t){for(var r=0,e=(t=yr(t,n)?[t+""]:Ct(t)).length;null!=n&&e>r;)n=n[t[r++]];return r&&r==e?n:M}function ft(n,t){return Pe.call(n,t)||"object"==typeof n&&t in n&&null===tu(n)}function ct(n,t){return t in Object(n)}function at(n,t,r){for(var e=r?f:i,u=n.length,o=u,a=Array(u),l=[];o--;){var s=n[o];o&&t&&(s=c(s,j(t))),a[o]=r||!t&&120>s.length?M:new zn(o&&s)}var h=-1,p=(s=n[0]).length,_=a[0];n:for(;++h<p;){var v=s[h],g=t?t(v):v;if(_?!$n(_,g):!e(l,g,r)){for(o=u;--o;){var d=a[o];if(d?!$n(d,g):!e(n[o],g,r))continue n}_&&_.push(g),l.push(v)}}return l}function lt(n,t,e){return yr(t,n)||(n=wr(n,t=Ct(t)),t=Wr(t)),null==(t=null==n?n:n[t])?M:r(t,n,e)}function st(n,t,r,e,u){if(n===t)n=!0;else if(null==n||null==t||!re(n)&&!ee(t))n=n!=n&&t!=t;else n:{var o=xo(n),i=xo(t),f="[object Array]",c="[object Array]";o||("[object Arguments]"==(f=pr(n))?f="[object Object]":"[object Object]"!=f&&(o=le(n))),i||("[object Arguments]"==(c=pr(t))?c="[object Object]":"[object Object]"!=c&&le(t));var a="[object Object]"==f&&!W(n);i="[object Object]"==c&&!W(t);if(!(c=f==c)||o||a){if(!(2&e)&&(f=a&&Pe.call(n,"__wrapped__"),i=i&&Pe.call(t,"__wrapped__"),f||i)){n=st(f?n.value():n,i?t.value():t,r,e,u);break n}c?(u||(u=new Fn),n=(o?fr:cr)(n,t,st,r,e,u)):n=!1}else n=function(n,t,r,e,u,o){switch(r){case"[object ArrayBuffer]":if(n.byteLength!=t.byteLength||!e(new Qe(n),new Qe(t)))break;return!0;case"[object Boolean]":case"[object Date]":return+n==+t;case"[object Error]":return n.name==t.name&&n.message==t.message;case"[object Number]":return n!=+n?t!=+t:n==+t;case"[object RegExp]":case"[object String]":return n==t+"";case"[object Map]":var i=z;case"[object Set]":return i||(i=L),(2&o||n.size==t.size)&&e(i(n),i(t),u,1|o);case"[object Symbol]":return!!Ye&&Ou.call(n)==Ou.call(t)}return!1}(n,t,f,st,r,e)}return n}function ht(n,t,r,e){var u=r.length,o=u,i=!e;if(null==n)return!o;for(n=Object(n);u--;){var f=r[u];if(i&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return!1}for(;++u<o;){var c=(f=r[u])[0],a=n[c],l=f[1];if(i&&f[2]){if(a===M&&!(c in n))return!1}else if(f=new Fn,(c=e?e(a,l,c,n,t,f):M)===M?!st(l,a,e,3,f):!c)return!1}return!0}function pt(n){var t=typeof n;return"function"==t?n:null==n?Re:"object"==t?xo(n)?dt(n[0],n[1]):gt(n):ze(n)}function _t(n){n=null==n?n:Object(n);var t,r=[];for(t in n)r.push(t);return r}function vt(n,t){var r=-1,e=Yr(n)?Array(n.length):[];return Ru(n,(function(n,u,o){e[++r]=t(n,u,o)})),e}function gt(n){var t=sr(n);if(1==t.length&&t[0][2]){var r=t[0][0],e=t[0][1];return function(n){return null!=n&&(n[r]===e&&(e!==M||r in Object(n)))}}return function(r){return r===n||ht(r,n,t)}}function dt(n,t){return function(r){var e=ye(r,n);return e===M&&e===t?xe(r,n):st(t,e,M,3)}}function yt(n,t,r,u){if(n!==t){var o=xo(t)||le(t)?M:me(t);e(o||t,(function(e,i){if(o&&(e=t[i=e]),re(e)){u||(u=new Fn);var f=i,c=u,a=n[f],l=t[f];if(s=c.get(l)||c.get(a))Kn(n,f,s);else{var s,h=(s=r?r(a,l,f+"",n,t,c):M)===M;h&&(s=l,xo(l)||le(l)?s=xo(a)?a:Hr(a)?Nt(a):Hn(l):ie(l)||Jr(l)?s=Jr(a)?ge(a):re(a)?a:Hn(l):h=Xr(l)),c.set(l,s),h&&yt(s,l,r,c),Kn(n,f,s)}}else(f=r?r(n[i],e,i+"",n,t,u):M)===M&&(f=e),Kn(n,i,f)}))}}function bt(n,t,r){var e=-1,u=lr();return t=c(t.length?t:Array(1),(function(n){return u(n)})),n=vt(n,(function(n){return{a:c(t,(function(t){return t(n)})),b:++e,c:n}})),function(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].c;return n}(n,(function(n,t){var e;n:{e=-1;for(var u=n.a,o=t.a,i=u.length,f=r.length;++e<i;){var c=E(u[e],o[e]);if(c){e=f>e?c*("desc"==r[e]?-1:1):c;break n}}e=n.b-t.b}return e}))}function xt(n,t){return n=Object(n),l(t,(function(t,r){return r in n&&(t[r]=n[r]),t}),{})}function jt(n,t){var r={};return function(n,t){null==n||Wu(n,t,me)}(n,(function(n,e){t(n)&&(r[e]=n)})),r}function mt(n){return function(t){return null==t?M:t[n]}}function wt(n,t,r){var e=-1,u=t.length,o=n;for(r&&(o=c(n,(function(n){return r(n)})));++e<u;){var i=0,f=t[e];for(f=r?r(f):f;-1<(i=g(o,f,i));)o!==n&&iu.call(o,i,1),iu.call(n,i,1)}return n}function At(n,t){for(var r=n?t.length:0,e=r-1;r--;){var u=t[r];if(e==r||u!=o){var o=u;if(C(u))iu.call(n,u,1);else if(yr(u,n))delete n[u];else{var i=wr(n,u=Ct(u));null!=i&&delete i[Wr(u)]}}}}function Ot(n,t){return n+cu(vu()*(t-n+1))}function Et(n,t,r,e){for(var u=-1,o=(t=yr(t,n)?[t+""]:Ct(t)).length,i=o-1,f=n;null!=f&&++u<o;){var c=t[u];if(re(f)){var a=r;if(u!=i){var l=f[c];(a=e?e(l,c,f):M)===M&&(a=null==l?C(t[u+1])?[]:{}:l)}Gn(f,c,a)}f=f[c]}return n}function kt(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),0>(r=r>u?u:r)&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++e<u;)r[e]=n[e+t];return r}function It(n,t){var r;return Ru(n,(function(n,e,u){return!(r=t(n,e,u))})),!!r}function Rt(n,t,r){var e=0,u=n?n.length:e;if("number"==typeof t&&t==t&&2147483647>=u){for(;u>e;){var o=e+u>>>1,i=n[o];(r?t>=i:t>i)&&null!==i?e=o+1:u=o}return u}return St(n,t,Re,r)}function St(n,t,r,e){t=r(t);for(var u=0,o=n?n.length:0,i=t!=t,f=null===t,c=t===M;o>u;){var a=cu((u+o)/2),l=r(n[a]),s=l!==M,h=l==l;(i?h||e:f?h&&s&&(e||null!=l):c?h&&(e||s):null!=l&&(e?t>=l:t>l))?u=a+1:o=a}return pu(o,4294967294)}function Wt(n,t){for(var r=0,e=n.length,u=n[0],o=t?t(u):u,i=o,f=0,c=[u];++r<e;)u=n[r],Gr(o=t?t(u):u,i)||(i=o,c[++f]=u);return c}function Ct(n){return xo(n)?n:Ar(n)}function Ut(n,t,r){var e=-1,u=i,o=n.length,c=!0,a=[],l=a;if(r)c=!1,u=f;else if(o<200)l=t?[]:a;else{if(u=t?null:zu(n))return L(u);c=!1,u=$n,l=new zn}n:for(;++e<o;){var s=n[e],h=t?t(s):s;if(c&&h==h){for(var p=l.length;p--;)if(l[p]===h)continue n;t&&l.push(h),a.push(s)}else u(l,h,r)||(l!==a&&l.push(h),a.push(s))}return a}function zt(n,t,r,e){for(var u=n.length,o=e?u:-1;(e?o--:++o<u)&&t(n[o],o,n););return r?kt(n,e?0:o,e?o+1:u):kt(n,e?o+1:0,e?u:o)}function Bt(n,t){var r=n;return r instanceof Wn&&(r=r.value()),l(t,(function(n,t){return t.func.apply(t.thisArg,a([n],t.args))}),r)}function Lt(n,t,r){for(var e=-1,u=n.length;++e<u;)var o=o?a(Xn(o,n[e],t,r),Xn(n[e],o,t,r)):n[e];return o&&o.length?Ut(o,t,r):[]}function $t(n){var t=new n.constructor(n.byteLength);return new Qe(t).set(new Qe(n)),t}function Ft(n,t,r){for(var e=r.length,u=-1,o=hu(n.length-e,0),i=-1,f=t.length,c=Array(f+o);++i<f;)c[i]=t[i];for(;++u<e;)c[r[u]]=n[u];for(;o--;)c[i++]=n[u++];return c}function Mt(n,t,r){for(var e=-1,u=r.length,o=-1,i=hu(n.length-u,0),f=-1,c=t.length,a=Array(i+c);++o<i;)a[o]=n[o];for(i=o;++f<c;)a[i+f]=t[f];for(;++e<u;)a[i+r[e]]=n[o++];return a}function Nt(n,t){var r=-1,e=n.length;for(t||(t=Array(e));++r<e;)t[r]=n[r];return t}function Zt(n,t,r){return Dt(n,t,r)}function Dt(n,t,r,e){r||(r={});for(var u=-1,o=t.length;++u<o;){var i=t[u];Gn(r,i,e?e(r[i],n[i],i,r,n):n[i])}return r}function qt(n,t){return Zt(n,$u(n),t)}function Pt(n,t){return function(r,e){var u=t?t():{};if(e=lr(e),xo(r))for(var o=-1,i=r.length;++o<i;){var f=r[o];n(u,f,e(f),r)}else Ru(r,(function(t,r,o){n(u,t,e(t),o)}));return u}}function Tt(n){return Kr((function(t,r){var e=-1,u=r.length,o=u>1?r[u-1]:M,i=u>2?r[2]:M;o="function"==typeof o?(u--,o):M;for(i&&dr(r[0],r[1],i)&&(o=3>u?M:o,u=1),t=Object(t);++e<u;)(i=r[e])&&n(t,i,o);return t}))}function Kt(n,t){return function(r,e){if(null==r)return r;if(!Yr(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++o<u)&&!1!==e(i[o],o,i););return r}}function Gt(n){return function(t,r,e){for(var u=-1,o=Object(t),i=(e=e(t)).length;i--;){var f=e[n?i:++u];if(!1===r(o[f],f,o))break}return t}}function Vt(n){return function(t){t=de(t);var r=wn.test(t)?t.match(mn):M,e=r?r[0]:t.charAt(0);return t=r?r.slice(1).join(""):t.slice(1),e[n]()+t}}function Jt(n){return function(t){return l(Ie(Ee(t)),n,"")}}function Yt(n){return function(){switch((t=arguments).length){case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var t,r=Iu(n.prototype);return re(t=n.apply(r,t))?t:r}}function Ht(n,t,e){var u=Yt(n);return function o(){for(var i=arguments.length,f=i,c=Array(i),a=this&&this!==qn&&this instanceof o?u:n,l=o.placeholder;f--;)c[f]=arguments[f];return i-=(f=3>i&&c[0]!==l&&c[i-1]!==l?[]:B(c,l)).length,e>i?ur(n,t,Xt,l,M,c,f,M,M,e-i):r(a,this,c)}}function Qt(n){return Kr((function(t){var r=(t=rt(t)).length,e=r,u=Sn.prototype.thru;for(n&&t.reverse();e--;){if("function"!=typeof(i=t[e]))throw new Ne("Expected a function");if(u&&!o&&"wrapper"==ar(i))var o=new Sn([],!0)}for(e=o?e:r;++e<r;){var i,f="wrapper"==(u=ar(i=t[e]))?Bu(i):M;o=f&&xr(f[0])&&424==f[1]&&!f[4].length&&1==f[9]?o[ar(f[0])].apply(o,f[3]):1==i.length&&xr(i)?o[u]():o.thru(i)}return function(){var n=(u=arguments)[0];if(o&&1==u.length&&xo(n)&&n.length>=200)return o.plant(n).value();for(var e=0,u=r?t[e].apply(this,u):n;++e<r;)u=t[e].call(this,u);return u}}))}function Xt(n,t,r,e,u,o,i,f,c,a){var l=128&t,s=1&t,h=2&t,p=8&t,_=16&t,v=512&t,g=h?M:Yt(n);return function d(){for(var y=x=arguments.length,b=Array(x);y--;)b[y]=arguments[y];if(e&&(b=Ft(b,e,u)),o&&(b=Mt(b,o,i)),p||_){var x=x-(j=B(b,y=d.placeholder)).length;if(a>x)return ur(n,t,Xt,y,r,b,j,f,c,a-x)}if(x=s?r:this,y=h?x[n]:n,f)for(var j=b.length,m=pu(f.length,j),w=Nt(b);m--;){var A=f[m];b[m]=C(A,j)?w[A]:M}else v&&b.length>1&&b.reverse();return l&&b.length>c&&(b.length=c),this&&this!==qn&&this instanceof d&&(y=g||Yt(y)),y.apply(x,b)}}function nr(n){return Kr((function(t){return t=c(rt(t),lr()),Kr((function(e){var u=this;return n(t,(function(n){return r(n,u,e)}))}))}))}function tr(n,t,r){return t=pe(t),n=$(n),t&&t>n?(n=ke(r=r===M?" ":r+"",fu((t-=n)/$(r))),wn.test(r)?n.match(mn).slice(0,t).join(""):n.slice(0,t)):""}function rr(n,t,e,u){var o=1&t,i=Yt(n);return function t(){for(var f=-1,c=arguments.length,a=-1,l=u.length,s=Array(l+c),h=this&&this!==qn&&this instanceof t?i:n;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++f];return r(h,o?e:this,s)}}function er(n){return function(t,r,e){e&&"number"!=typeof e&&dr(t,r,e)&&(r=e=M),t=(t=ve(t))==t?t:0,r===M?(r=t,t=0):r=ve(r)||0,e=e===M?r>t?1:-1:ve(e)||0;var u=-1;r=hu(fu((r-t)/(e||1)),0);for(var o=Array(r);r--;)o[n?r:++u]=t,t+=e;return o}}function ur(n,t,r,e,u,o,i,f,c,a){var l=8&t;return f=f?Nt(f):M,4&(t=(t|(l?32:64))&~(l?64:32))||(t&=-4),t=[n,t,u,l?o:M,l?i:M,o=l?M:o,i=l?M:i,f,c,a],r=r.apply(M,t),xr(n)&&Fu(r,t),r.placeholder=e,r}function or(n){var t=Fe[n];return function(n,r){if(n=ve(n),r=pe(r)){var e=(de(n)+"e").split("e");return+((e=(de(e=t(e[0]+"e"+(+e[1]+r)))+"e").split("e"))[0]+"e"+(+e[1]-r))}return t(n)}}function ir(n,t,r,e,u,o,i,f){var c=2&t;if(!c&&"function"!=typeof n)throw new Ne("Expected a function");var a=e?e.length:0;if(a||(t&=-97,e=u=M),i=i===M?i:hu(pe(i),0),f=f===M?f:pe(f),a-=u?u.length:0,64&t){var l=e,s=u;e=u=M}var h=c?M:Bu(n);return o=[n,t,r,e,u,l,s,o,i,f],h&&(t=(r=o[1])|(n=h[1]),e=128==n&&8==r||128==n&&256==r&&h[8]>=o[7].length||384==n&&h[8]>=h[7].length&&8==r,131>t||e)&&(1&n&&(o[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=o[3],o[3]=e?Ft(e,r,h[4]):Nt(r),o[4]=e?B(o[3],"__lodash_placeholder__"):Nt(h[4])),(r=h[5])&&(e=o[5],o[5]=e?Mt(e,r,h[6]):Nt(r),o[6]=e?B(o[5],"__lodash_placeholder__"):Nt(h[6])),(r=h[7])&&(o[7]=Nt(r)),128&n&&(o[8]=null==o[8]?h[8]:pu(o[8],h[8])),null==o[9]&&(o[9]=h[9]),o[0]=h[0],o[1]=t),n=o[0],t=o[1],r=o[2],e=o[3],u=o[4],!(f=o[9]=null==o[9]?c?0:n.length:hu(o[9]-a,0))&&24&t&&(t&=-25),(h?Uu:Fu)(t&&1!=t?8==t||16==t?Ht(n,t,f):32!=t&&33!=t||u.length?Xt.apply(M,o):rr(n,t,r,e):function(n,t,r){var e=1&t,u=Yt(n);return function t(){return(this&&this!==qn&&this instanceof t?u:n).apply(e?r:this,arguments)}}(n,t,r),o)}function fr(n,t,r,e,u,o){var i=-1,f=2&u,c=1&u,a=n.length,l=t.length;if(!(a==l||f&&l>a))return!1;if(l=o.get(n))return l==t;for(l=!0,o.set(n,t);++i<a;){var s=n[i],p=t[i];if(e)var _=f?e(p,s,i,t,n,o):e(s,p,i,n,t,o);if(_!==M){if(_)continue;l=!1;break}if(c){if(!h(t,(function(n){return s===n||r(s,n,e,u,o)}))){l=!1;break}}else if(s!==p&&!r(s,p,e,u,o)){l=!1;break}}return o.delete(n),l}function cr(n,t,r,e,u,o){var i=2&u,f=1&u,c=je(n),a=c.length,l=je(t);if(a!=l.length&&!i)return!1;for(var s=a;s--;){var h=c[s];if(!(i?h in t:ft(t,h))||!f&&h!=l[s])return!1}if(h=o.get(n))return h==t;for(f=!0,o.set(n,t),l=i;++s<a;){var p=n[h=c[s]],_=t[h];if(e)var v=i?e(_,p,h,t,n,o):e(p,_,h,n,t,o);if(v===M?p!==_&&!r(p,_,e,u,o):!v){f=!1;break}l||(l="constructor"==h)}return f&&!l&&((r=n.constructor)!=(e=t.constructor)&&"constructor"in n&&"constructor"in t&&!("function"==typeof r&&r instanceof r&&"function"==typeof e&&e instanceof e)&&(f=!1)),o.delete(n),f}function ar(n){for(var t=n.name+"",r=ku[t],e=r?r.length:0;e--;){var u=r[e],o=u.func;if(null==o||o==n)return u.name}return t}function lr(){var n=(n=bn.iteratee||Se)===Se?pt:n;return arguments.length?n(arguments[0],arguments[1]):n}function sr(n){for(var t=(n=we(n)).length;t--;){var r=n[t][1];n[t][2]=r==r&&!re(r)}return n}function hr(n,t){var r=null==n?M:n[t];return ue(r)?r:M}function pr(n){return Ge.call(n)}function _r(n,t,r){if(null==n)return!1;var e=r(n,t);return e||yr(t)||null!=(n=wr(n,t=Ct(t)))&&(e=r(n,t=Wr(t))),e||te(n&&n.length)&&C(t,n.length)&&(xo(n)||ce(n)||Jr(n))}function vr(r,e,u){var o=r.constructor;switch(e){case"[object ArrayBuffer]":return $t(r);case"[object Boolean]":case"[object Date]":return new o(+r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return e=r.buffer,new r.constructor(u?$t(e):e,r.byteOffset,r.length);case"[object Map]":return u=r.constructor,l(z(r),n,new u);case"[object Number]":case"[object String]":return new o(r);case"[object RegExp]":return(u=new r.constructor(r.source,an.exec(r))).lastIndex=r.lastIndex,u;case"[object Set]":return u=r.constructor,l(L(r),t,new u);case"[object Symbol]":return Ye?Object(Ou.call(r)):{}}}function gr(n){var t=n?n.length:M;return te(t)&&(xo(n)||ce(n)||Jr(n))?b(t,String):null}function dr(n,t,r){if(!re(r))return!1;var e=typeof t;return!!("number"==e?Yr(r)&&C(t,r.length):"string"==e&&t in r)&&Gr(r[t],n)}function yr(n,t){return"number"==typeof n||!xo(n)&&(X.test(n)||!Q.test(n)||null!=t&&n in Object(t))}function br(n){var t=typeof n;return"number"==t||"boolean"==t||"string"==t&&"__proto__"!==n||null==n}function xr(n){var t=ar(n),r=bn[t];return"function"==typeof r&&t in Wn.prototype&&(n===r||!!(t=Bu(r))&&n===t[0])}function jr(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||De)}function mr(n,t,r,e,u,o){return re(n)&&re(t)&&(o.set(t,n),yt(n,t,mr,o)),n===M?Hn(t):n}function wr(n,t){return 1==t.length?n:ye(n,kt(t,0,-1))}function Ar(n){var t=[];return de(n).replace(nn,(function(n,r,e,u){t.push(e?u.replace(fn,"$1"):r||n)})),t}function Or(n){return Hr(n)?n:[]}function Er(n){return"function"==typeof n?n:Re}function kr(n){if(n instanceof Wn)return n.clone();var t=new Sn(n.__wrapped__,n.__chain__);return t.__actions__=Nt(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function Ir(n,t,r){var e=n?n.length:0;return e?kt(n,0>(t=r||t===M?1:pe(t))?0:t,e):[]}function Rr(n,t,r){var e=n?n.length:0;return e?kt(n,0,0>(t=e-(t=r||t===M?1:pe(t)))?0:t):[]}function Sr(n){return n?n[0]:M}function Wr(n){var t=n?n.length:0;return t?n[t-1]:M}function Cr(n,t){return n&&n.length&&t&&t.length?wt(n,t):n}function Ur(n){return n?gu.call(n):n}function zr(n){if(!n||!n.length)return[];var t=0;return n=o(n,(function(n){return Hr(n)?(t=hu(n.length,t),!0):void 0})),b(t,(function(t){return c(n,mt(t))}))}function Br(n,t){if(!n||!n.length)return[];var e=zr(n);return null==t?e:c(e,(function(n){return r(t,M,n)}))}function Lr(n){return(n=bn(n)).__chain__=!0,n}function $r(n,t){return t(n)}function Fr(n,t){return"function"==typeof t&&xo(n)?e(n,t):Ru(n,Er(t))}function Mr(n,t){var r;if("function"==typeof t&&xo(n)){for(r=n.length;r--&&!1!==t(n[r],r,n););r=n}else r=Su(n,Er(t));return r}function Nr(n,t){var r=-1,e=he(n),u=(o=e.length)-1;for(t=Yn(pe(t),0,o);++r<t;){var o,i=e[o=Ot(r,u)];e[o]=e[r],e[r]=i}return e.length=t,e}function Zr(n){if(null==n)return 0;if(Yr(n)){var t=n.length;return t&&ce(n)?$(n):t}return je(n).length}function Dr(n,t,r){return t=r?M:t,t=n&&null==t?n.length:t,ir(n,128,M,M,M,M,t)}function qr(n,t){var r;if("function"!=typeof t)throw new Ne("Expected a function");return n=pe(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=M),r}}function Pr(n,t,r){function e(){p&&Xe(p),a&&Xe(a),v=0,c=a=h=p=_=M}function u(t,r){r&&Xe(r),a=p=_=M,t&&(v=lo(),l=n.apply(h,c),p||a||(c=h=M))}function o(){var n=t-(lo()-s);0>=n||n>t?u(_,a):p=ou(o,n)}function i(){u(y,p)}function f(){if(c=arguments,s=lo(),h=this,_=y&&(p||!g),!1===d)var r=g&&!p;else{a||g||(v=s);var e=d-(s-v),u=0>=e||e>d;u?(a&&(a=Xe(a)),v=s,l=n.apply(h,c)):a||(a=ou(i,e))}return u&&p?p=Xe(p):p||t===d||(p=ou(o,t)),r&&(u=!0,l=n.apply(h,c)),!u||p||a||(c=h=M),l}var c,a,l,s,h,p,_,v=0,g=!1,d=!1,y=!0;if("function"!=typeof n)throw new Ne("Expected a function");return t=ve(t)||0,re(r)&&(g=!!r.leading,d="maxWait"in r&&hu(ve(r.maxWait)||0,t),y="trailing"in r?!!r.trailing:y),f.cancel=e,f.flush=function(){return(p&&_||a&&y)&&(l=n.apply(h,c)),e(),l},f}function Tr(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],o=r.cache;return o.has(u)?o.get(u):(e=n.apply(this,e),r.cache=o.set(u,e),e)}if("function"!=typeof n||t&&"function"!=typeof t)throw new Ne("Expected a function");return r.cache=new Tr.Cache,r}function Kr(n,t){if("function"!=typeof n)throw new Ne("Expected a function");return t=hu(t===M?n.length-1:pe(t),0),function(){for(var e=arguments,u=-1,o=hu(e.length-t,0),i=Array(o);++u<o;)i[u]=e[t+u];switch(t){case 0:return n.call(this,i);case 1:return n.call(this,e[0],i);case 2:return n.call(this,e[0],e[1],i)}for(o=Array(t+1),u=-1;++u<t;)o[u]=e[u];return o[t]=i,r(n,this,o)}}function Gr(n,t){return n===t||n!=n&&t!=t}function Vr(n,t){return n>t}function Jr(n){return Hr(n)&&Pe.call(n,"callee")&&(!uu.call(n,"callee")||"[object Arguments]"==Ge.call(n))}function Yr(n){return null!=n&&!("function"==typeof n&&Xr(n))&&te(Lu(n))}function Hr(n){return ee(n)&&Yr(n)}function Qr(n){return ee(n)&&"string"==typeof n.message&&"[object Error]"==Ge.call(n)}function Xr(n){return"[object Function]"==(n=re(n)?Ge.call(n):"")||"[object GeneratorFunction]"==n}function ne(n){return"number"==typeof n&&n==pe(n)}function te(n){return"number"==typeof n&&n>-1&&0==n%1&&9007199254740991>=n}function re(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function ee(n){return!!n&&"object"==typeof n}function ue(n){return null!=n&&(Xr(n)?Je.test(qe.call(n)):ee(n)&&(W(n)?Je:pn).test(n))}function oe(n){return"number"==typeof n||ee(n)&&"[object Number]"==Ge.call(n)}function ie(n){if(!ee(n)||"[object Object]"!=Ge.call(n)||W(n))return!1;var t=De;return"function"==typeof n.constructor&&(t=tu(n)),null===t||"function"==typeof(n=t.constructor)&&n instanceof n&&qe.call(n)==Ke}function fe(n){return re(n)&&"[object RegExp]"==Ge.call(n)}function ce(n){return"string"==typeof n||!xo(n)&&ee(n)&&"[object String]"==Ge.call(n)}function ae(n){return"symbol"==typeof n||ee(n)&&"[object Symbol]"==Ge.call(n)}function le(n){return ee(n)&&te(n.length)&&!!In[Ge.call(n)]}function se(n,t){return t>n}function he(n){if(!n)return[];if(Yr(n))return ce(n)?n.match(mn):Nt(n);if(eu&&n[eu])return U(n[eu]());var t=pr(n);return("[object Map]"==t?z:"[object Set]"==t?L:Ae)(n)}function pe(n){if(!n)return 0===n?n:0;if((n=ve(n))===N||n===-N)return 17976931348623157e292*(0>n?-1:1);var t=n%1;return n==n?t?n-t:n:0}function _e(n){return n?Yn(pe(n),0,4294967295):0}function ve(n){if(re(n)&&(n=re(n=Xr(n.valueOf)?n.valueOf():n)?n+"":n),"string"!=typeof n)return 0===n?n:+n;n=n.replace(en,"");var t=hn.test(n);return t||_n.test(n)?Ln(n.slice(2),t?2:8):sn.test(n)?Z:+n}function ge(n){return Zt(n,me(n))}function de(n){if("string"==typeof n)return n;if(null==n)return"";if(ae(n))return Ye?Eu.call(n):"";var t=n+"";return"0"==t&&1/n==-N?"-0":t}function ye(n,t,r){return(n=null==n?M:it(n,t))===M?r:n}function be(n,t){return _r(n,t,ft)}function xe(n,t){return _r(n,t,ct)}function je(n){var t=jr(n);if(!t&&!Yr(n))return su(Object(n));var r,e,u=!!(e=gr(n)),o=(e=e||[]).length;for(r in n)!ft(n,r)||u&&("length"==r||C(r,o))||t&&"constructor"==r||e.push(r);return e}function me(n){for(var t,r=-1,e=jr(n),u=_t(n),o=u.length,i=!!(t=gr(n)),f=(t=t||[]).length;++r<o;){var c=u[r];i&&("length"==c||C(c,f))||"constructor"==c&&(e||!Pe.call(n,c))||t.push(c)}return t}function we(n){return x(n,je(n))}function Ae(n){return n?m(n,je(n)):[]}function Oe(n){return $o(de(n).toLowerCase())}function Ee(n){return(n=de(n))&&n.replace(gn,k).replace(jn,"")}function ke(n,t){n=de(n),t=pe(t);var r="";if(!n||1>t||t>9007199254740991)return r;do{t%2&&(r+=n),t=cu(t/2),n+=n}while(t);return r}function Ie(n,t,r){return n=de(n),(t=r?M:t)===M&&(t=En.test(n)?On:An),n.match(t)||[]}function Re(n){return n}function Se(n){return ee(n)&&!xo(n)?We(n):pt(n)}function We(n){return gt(Hn(n,!0))}function Ce(n,t,r){var u=je(t),o=ot(t,u);null!=r||re(t)&&(o.length||!u.length)||(r=t,t=n,n=this,o=ot(t,je(t)));var i=!re(r)||!("chain"in r)||r.chain,f=Xr(n);return e(o,(function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(i||t){var r=n(this.__wrapped__);return(r.__actions__=Nt(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})})),n}function Ue(){}function ze(n){return yr(n)?mt(n):function(n){return function(t){return it(t,n)}}(n)}function Be(n){return n&&n.length?y(n,Re):M}var Le=(vn=vn?Pn.defaults({},vn,Pn.pick(qn,kn)):qn).Date,$e=vn.Error,Fe=vn.Math,Me=vn.RegExp,Ne=vn.TypeError,Ze=vn.Array.prototype,De=vn.Object.prototype,qe=vn.Function.prototype.toString,Pe=De.hasOwnProperty,Te=0,Ke=qe.call(Object),Ge=De.toString,Ve=qn._,Je=Me("^"+qe.call(Pe).replace(tn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ye=vn.Symbol,He=vn.f,Qe=vn.Uint8Array,Xe=vn.clearTimeout,nu=He?He.g:M,tu=Object.getPrototypeOf,ru=Object.getOwnPropertySymbols,eu="symbol"==typeof(eu=Ye&&Ye.iterator)?eu:M,uu=De.propertyIsEnumerable,ou=vn.setTimeout,iu=Ze.splice,fu=Fe.ceil,cu=Fe.floor,au=vn.isFinite,lu=Ze.join,su=Object.keys,hu=Fe.max,pu=Fe.min,_u=vn.parseInt,vu=Fe.random,gu=Ze.reverse,du=hr(vn,"Map"),yu=hr(vn,"Set"),bu=hr(vn,"WeakMap"),xu=hr(Object,"create"),ju=bu&&new bu,mu=du?qe.call(du):"",wu=yu?qe.call(yu):"",Au=Ye?Ye.prototype:M,Ou=Ye?Au.valueOf:M,Eu=Ye?Au.toString:M,ku={};bn.templateSettings={escape:J,evaluate:Y,interpolate:H,variable:"",imports:{_:bn}};var Iu=function(){function n(){}return function(t){if(re(t)){n.prototype=t;var r=new n;n.prototype=M}return r||{}}}(),Ru=Kt(et),Su=Kt(ut,!0),Wu=Gt(),Cu=Gt(!0);nu&&!uu.call({valueOf:1},"valueOf")&&(_t=function(n){return U(nu(n))});var Uu=ju?function(n,t){return ju.set(n,t),n}:Re,zu=yu&&2===new yu([1,2]).size?function(n){return new yu(n)}:Ue,Bu=ju?function(n){return ju.get(n)}:Ue,Lu=mt("length"),$u=ru||function(){return[]};(du&&"[object Map]"!=pr(new du)||yu&&"[object Set]"!=pr(new yu))&&(pr=function(n){var t=Ge.call(n);if(n="function"==typeof(n="[object Object]"==t?n.constructor:null)?qe.call(n):""){if(n==mu)return"[object Map]";if(n==wu)return"[object Set]"}return t});var Fu=function(){var n=0,t=0;return function(r,e){var u=lo(),o=16-(u-t);if(t=u,o>0){if(150<=++n)return r}else n=0;return Uu(r,e)}}(),Mu=Kr((function(n,t){t=rt(t);for(var r=xo(n)?n:[Object(n)],e=t,u=-1,o=r.length,i=-1,f=e.length,c=Array(o+f);++u<o;)c[u]=r[u];for(;++i<f;)c[u++]=e[i];return c})),Nu=Kr((function(n,t){return Hr(n)?Xn(n,rt(t,!1,!0)):[]})),Zu=Kr((function(n,t){var r=Wr(t);return Hr(r)&&(r=M),Hr(n)?Xn(n,rt(t,!1,!0),lr(r)):[]})),Du=Kr((function(n,t){var r=Wr(t);return Hr(r)&&(r=M),Hr(n)?Xn(n,rt(t,!1,!0),M,r):[]})),qu=Kr((function(n){var t=c(n,Or);return t.length&&t[0]===n[0]?at(t):[]})),Pu=Kr((function(n){var t=Wr(n),r=c(n,Or);return t===Wr(r)?t=M:r.pop(),r.length&&r[0]===n[0]?at(r,lr(t)):[]})),Tu=Kr((function(n){var t=Wr(n),r=c(n,Or);return t===Wr(r)?t=M:r.pop(),r.length&&r[0]===n[0]?at(r,M,t):[]})),Ku=Kr(Cr),Gu=Kr((function(n,t){var r=Jn(n,t=c(rt(t),String));return At(n,t.sort(E)),r})),Vu=Kr((function(n){return Ut(rt(n,!1,!0))})),Ju=Kr((function(n){var t=Wr(n);return Hr(t)&&(t=M),Ut(rt(n,!1,!0),lr(t))})),Yu=Kr((function(n){var t=Wr(n);return Hr(t)&&(t=M),Ut(rt(n,!1,!0),M,t)})),Hu=Kr((function(n,t){return Hr(n)?Xn(n,t):[]})),Qu=Kr((function(n){return Lt(o(n,Hr))})),Xu=Kr((function(n){var t=Wr(n);return Hr(t)&&(t=M),Lt(o(n,Hr),lr(t))})),no=Kr((function(n){var t=Wr(n);return Hr(t)&&(t=M),Lt(o(n,Hr),M,t)})),to=Kr(zr),ro=Kr((function(n){var t="function"==typeof(t=(t=n.length)>1?n[t-1]:M)?(n.pop(),t):M;return Br(n,t)})),eo=Kr((function(n){function t(t){return Jn(t,n)}var r=(n=rt(n)).length,e=r?n[0]:0,u=this.__wrapped__;return 1>=r&&!this.__actions__.length&&u instanceof Wn&&C(e)?((u=u.slice(e,+e+(r?1:0))).__actions__.push({func:$r,args:[t],thisArg:M}),new Sn(u,this.__chain__).thru((function(n){return r&&!n.length&&n.push(M),n}))):this.thru(t)})),uo=Pt((function(n,t,r){Pe.call(n,r)?++n[r]:n[r]=1})),oo=Pt((function(n,t,r){Pe.call(n,r)?n[r].push(t):n[r]=[t]})),io=Kr((function(n,t,e){var u=-1,o="function"==typeof t,i=yr(t),f=Yr(n)?Array(n.length):[];return Ru(n,(function(n){var c=o?t:i&&null!=n?n[t]:M;f[++u]=c?r(c,n,e):lt(n,t,e)})),f})),fo=Pt((function(n,t,r){n[r]=t})),co=Pt((function(n,t,r){n[r?0:1].push(t)}),(function(){return[[],[]]})),ao=Kr((function(n,t){if(null==n)return[];var r=t.length;return r>1&&dr(n,t[0],t[1])?t=[]:r>2&&dr(t[0],t[1],t[2])&&(t.length=1),bt(n,rt(t),[])})),lo=Le.now,so=Kr((function(n,t,r){var e=1;if(r.length){var u=B(r,so.placeholder);e=32|e}return ir(n,e,t,r,u)})),ho=Kr((function(n,t,r){var e=3;if(r.length){var u=B(r,ho.placeholder);e=32|e}return ir(t,e,n,r,u)})),po=Kr((function(n,t){return Qn(n,1,t)})),_o=Kr((function(n,t,r){return Qn(n,ve(t)||0,r)})),vo=Kr((function(n,t){var e=(t=c(rt(t),lr())).length;return Kr((function(u){for(var o=-1,i=pu(u.length,e);++o<i;)u[o]=t[o].call(this,u[o]);return r(n,this,u)}))})),go=Kr((function(n,t){var r=B(t,go.placeholder);return ir(n,32,M,t,r)})),yo=Kr((function(n,t){var r=B(t,yo.placeholder);return ir(n,64,M,t,r)})),bo=Kr((function(n,t){return ir(n,256,M,M,M,rt(t))})),xo=Array.isArray,jo=Tt((function(n,t){Zt(t,je(t),n)})),mo=Tt((function(n,t){Zt(t,me(t),n)})),wo=Tt((function(n,t,r){Dt(t,me(t),n,r)})),Ao=Tt((function(n,t,r){Dt(t,je(t),n,r)})),Oo=Kr((function(n,t){return Jn(n,rt(t))})),Eo=Kr((function(n){return n.push(M,Tn),r(wo,M,n)})),ko=Kr((function(n){return n.push(M,mr),r(So,M,n)})),Io=Kr(lt),Ro=Tt((function(n,t){yt(n,t)})),So=Tt((function(n,t,r){yt(n,t,r)})),Wo=Kr((function(n,t){return null==n?{}:(t=c(rt(t),String),xt(n,Xn(me(n),t)))})),Co=Kr((function(n,t){return null==n?{}:xt(n,rt(t))})),Uo=Jt((function(n,t,r){return t=t.toLowerCase(),n+(r?Oe(t):t)})),zo=Jt((function(n,t,r){return n+(r?"-":"")+t.toLowerCase()})),Bo=Jt((function(n,t,r){return n+(r?" ":"")+t.toLowerCase()})),Lo=Vt("toLowerCase"),$o=Vt("toUpperCase"),Fo=Jt((function(n,t,r){return n+(r?"_":"")+t.toLowerCase()})),Mo=Jt((function(n,t,r){return n+(r?" ":"")+Oe(t)})),No=Jt((function(n,t,r){return n+(r?" ":"")+t.toUpperCase()})),Zo=Kr((function(n,t){try{return r(n,M,t)}catch(n){return Qr(n)?n:new $e(n)}})),Do=Kr((function(n,t){return e(rt(t),(function(t){n[t]=so(n[t],n)})),n})),qo=Qt(),Po=Qt(!0),To=Kr((function(n,t){return function(r){return lt(r,n,t)}})),Ko=Kr((function(n,t){return function(r){return lt(n,r,t)}})),Go=nr(c),Vo=nr(u),Jo=nr(h),Yo=er(),Ho=er(!0),Qo=or("ceil"),Xo=or("floor"),ni=or("round");return bn.prototype=xn.prototype,Sn.prototype=Iu(xn.prototype),Sn.prototype.constructor=Sn,Wn.prototype=Iu(xn.prototype),Wn.prototype.constructor=Wn,Cn.prototype=xu?xu(null):De,Un.prototype.clear=function(){this.__data__={hash:new Cn,map:du?new du:[],string:new Cn}},Un.prototype.delete=function(n){var t=this.__data__;return br(n)?(t="string"==typeof n?t.string:t.hash,n=(xu?t[n]!==M:Pe.call(t,n))&&delete t[n]):n=du?t.map.delete(n):Mn(t.map,n),n},Un.prototype.get=function(n){var t=this.__data__;return br(n)?(t="string"==typeof n?t.string:t.hash,xu?n="__lodash_hash_undefined__"===(n=t[n])?M:n:n=Pe.call(t,n)?t[n]:M):n=du?t.map.get(n):Nn(t.map,n),n},Un.prototype.has=function(n){var t=this.__data__;return br(n)?(t="string"==typeof n?t.string:t.hash,n=xu?t[n]!==M:Pe.call(t,n)):n=du?t.map.has(n):-1<Zn(t.map,n),n},Un.prototype.set=function(n,t){var r=this.__data__;return br(n)?("string"==typeof n?r.string:r.hash)[n]=xu&&t===M?"__lodash_hash_undefined__":t:du?r.map.set(n,t):Dn(r.map,n,t),this},zn.prototype.push=function(n){var t=this.__data__;br(n)?(t=t.__data__,("string"==typeof n?t.string:t.hash)[n]="__lodash_hash_undefined__"):t.set(n,"__lodash_hash_undefined__")},Fn.prototype.clear=function(){this.__data__={array:[],map:null}},Fn.prototype.delete=function(n){var t=this.__data__,r=t.array;return r?Mn(r,n):t.map.delete(n)},Fn.prototype.get=function(n){var t=this.__data__,r=t.array;return r?Nn(r,n):t.map.get(n)},Fn.prototype.has=function(n){var t=this.__data__,r=t.array;return r?-1<Zn(r,n):t.map.has(n)},Fn.prototype.set=function(n,t){var r=this.__data__,e=r.array;return e&&(199>e.length?Dn(e,n,t):(r.array=null,r.map=new Un(e))),(r=r.map)&&r.set(n,t),this},Tr.Cache=Un,bn.after=function(n,t){if("function"!=typeof t)throw new Ne("Expected a function");return n=pe(n),function(){return 1>--n?t.apply(this,arguments):void 0}},bn.ary=Dr,bn.assign=jo,bn.assignIn=mo,bn.assignInWith=wo,bn.assignWith=Ao,bn.at=Oo,bn.before=qr,bn.bind=so,bn.bindAll=Do,bn.bindKey=ho,bn.chain=Lr,bn.chunk=function(n,t){t=hu(pe(t),0);var r=n?n.length:0;if(!r||1>t)return[];for(var e=0,u=-1,o=Array(fu(r/t));r>e;)o[++u]=kt(n,e,e+=t);return o},bn.compact=function(n){for(var t=-1,r=n?n.length:0,e=-1,u=[];++t<r;){var o=n[t];o&&(u[++e]=o)}return u},bn.concat=Mu,bn.cond=function(n){var t=n?n.length:0,e=lr();return n=t?c(n,(function(n){if("function"!=typeof n[1])throw new Ne("Expected a function");return[e(n[0]),n[1]]})):[],Kr((function(e){for(var u=-1;++u<t;){var o=n[u];if(r(o[0],this,e))return r(o[1],this,e)}}))},bn.conforms=function(n){return function(n){var t=je(n),r=t.length;return function(e){if(null==e)return!r;for(var u=r;u--;){var o=t[u],i=n[o],f=e[o];if(f===M&&!(o in Object(e))||!i(f))return!1}return!0}}(Hn(n,!0))},bn.constant=function(n){return function(){return n}},bn.countBy=uo,bn.create=function(n,t){var r=Iu(n);return t?Vn(r,t):r},bn.curry=function n(t,r,e){return(t=ir(t,8,M,M,M,M,M,r=e?M:r)).placeholder=n.placeholder,t},bn.curryRight=function n(t,r,e){return(t=ir(t,16,M,M,M,M,M,r=e?M:r)).placeholder=n.placeholder,t},bn.debounce=Pr,bn.defaults=Eo,bn.defaultsDeep=ko,bn.defer=po,bn.delay=_o,bn.difference=Nu,bn.differenceBy=Zu,bn.differenceWith=Du,bn.drop=Ir,bn.dropRight=Rr,bn.dropRightWhile=function(n,t){return n&&n.length?zt(n,lr(t,3),!0,!0):[]},bn.dropWhile=function(n,t){return n&&n.length?zt(n,lr(t,3),!0):[]},bn.fill=function(n,t,r,e){var u=n?n.length:0;if(!u)return[];for(r&&"number"!=typeof r&&dr(n,t,r)&&(r=0,e=u),u=n.length,0>(r=pe(r))&&(r=-r>u?0:u+r),0>(e=e===M||e>u?u:pe(e))&&(e+=u),e=r>e?0:_e(e);e>r;)n[r++]=t;return n},bn.filter=function(n,t){return(xo(n)?o:tt)(n,lr(t,3))},bn.flatMap=function(n,t){return n&&n.length?rt(c(n,lr(t,3))):[]},bn.flatten=function(n){return n&&n.length?rt(n):[]},bn.flattenDeep=function(n){return n&&n.length?rt(n,!0):[]},bn.flip=function(n){return ir(n,512)},bn.flow=qo,bn.flowRight=Po,bn.fromPairs=function(n){for(var t=-1,r=n?n.length:0,e={};++t<r;){var u=n[t];Et(e,u[0],u[1])}return e},bn.functions=function(n){return null==n?[]:ot(n,je(n))},bn.functionsIn=function(n){return null==n?[]:ot(n,me(n))},bn.groupBy=oo,bn.initial=function(n){return Rr(n,1)},bn.intersection=qu,bn.intersectionBy=Pu,bn.intersectionWith=Tu,bn.invert=function(n,t,r){return l(je(n),(function(e,u){var o=n[u];return t&&!r?Pe.call(e,o)?e[o].push(u):e[o]=[u]:e[o]=u,e}),{})},bn.invokeMap=io,bn.iteratee=Se,bn.keyBy=fo,bn.keys=je,bn.keysIn=me,bn.map=function(n,t){return(xo(n)?c:vt)(n,lr(t,3))},bn.mapKeys=function(n,t){var r={};return t=lr(t,3),et(n,(function(n,e,u){r[t(n,e,u)]=n})),r},bn.mapValues=function(n,t){var r={};return t=lr(t,3),et(n,(function(n,e,u){r[e]=t(n,e,u)})),r},bn.matches=We,bn.matchesProperty=function(n,t){return dt(n,Hn(t,!0))},bn.memoize=Tr,bn.merge=Ro,bn.mergeWith=So,bn.method=To,bn.methodOf=Ko,bn.mixin=Ce,bn.negate=function(n){if("function"!=typeof n)throw new Ne("Expected a function");return function(){return!n.apply(this,arguments)}},bn.nthArg=function(n){return n=pe(n),function(){return arguments[n]}},bn.omit=Wo,bn.omitBy=function(n,t){return t=lr(t),jt(n,(function(n){return!t(n)}))},bn.once=function(n){return qr(2,n)},bn.orderBy=function(n,t,r,e){return null==n?[]:(xo(t)||(t=null==t?[]:[t]),xo(r=e?M:r)||(r=null==r?[]:[r]),bt(n,t,r))},bn.over=Go,bn.overArgs=vo,bn.overEvery=Vo,bn.overSome=Jo,bn.partial=go,bn.partialRight=yo,bn.partition=co,bn.pick=Co,bn.pickBy=function(n,t){return null==n?{}:jt(n,lr(t))},bn.property=ze,bn.propertyOf=function(n){return function(t){return null==n?M:it(n,t)}},bn.pull=Ku,bn.pullAll=Cr,bn.pullAllBy=function(n,t,r){return n&&n.length&&t&&t.length?wt(n,t,lr(r)):n},bn.pullAt=Gu,bn.range=Yo,bn.rangeRight=Ho,bn.rearg=bo,bn.reject=function(n,t){var r=xo(n)?o:tt;return t=lr(t,3),r(n,(function(n,r,e){return!t(n,r,e)}))},bn.remove=function(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],o=n.length;for(t=lr(t,3);++e<o;){var i=n[e];t(i,e,n)&&(r.push(i),u.push(e))}return At(n,u),r},bn.rest=Kr,bn.reverse=Ur,bn.sampleSize=Nr,bn.set=function(n,t,r){return null==n?n:Et(n,t,r)},bn.setWith=function(n,t,r,e){return e="function"==typeof e?e:M,null==n?n:Et(n,t,r,e)},bn.shuffle=function(n){return Nr(n,4294967295)},bn.slice=function(n,t,r){var e=n?n.length:0;return e?(r&&"number"!=typeof r&&dr(n,t,r)?(t=0,r=e):(t=null==t?0:pe(t),r=r===M?e:pe(r)),kt(n,t,r)):[]},bn.sortBy=ao,bn.sortedUniq=function(n){return n&&n.length?Wt(n):[]},bn.sortedUniqBy=function(n,t){return n&&n.length?Wt(n,lr(t)):[]},bn.split=function(n,t,r){return de(n).split(t,r)},bn.spread=function(n){if("function"!=typeof n)throw new Ne("Expected a function");return function(t){return r(n,this,t)}},bn.tail=function(n){return Ir(n,1)},bn.take=function(n,t,r){return n&&n.length?kt(n,0,0>(t=r||t===M?1:pe(t))?0:t):[]},bn.takeRight=function(n,t,r){var e=n?n.length:0;return e?kt(n,0>(t=e-(t=r||t===M?1:pe(t)))?0:t,e):[]},bn.takeRightWhile=function(n,t){return n&&n.length?zt(n,lr(t,3),!1,!0):[]},bn.takeWhile=function(n,t){return n&&n.length?zt(n,lr(t,3)):[]},bn.tap=function(n,t){return t(n),n},bn.throttle=function(n,t,r){var e=!0,u=!0;if("function"!=typeof n)throw new Ne("Expected a function");return re(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),Pr(n,t,{leading:e,maxWait:t,trailing:u})},bn.thru=$r,bn.toArray=he,bn.toPairs=we,bn.toPairsIn=function(n){return x(n,me(n))},bn.toPath=function(n){return xo(n)?c(n,String):Ar(n)},bn.toPlainObject=ge,bn.transform=function(n,t,r){var u=xo(n)||le(n);if(t=lr(t,4),null==r)if(u||re(n)){var o=n.constructor;r=u?xo(n)?new o:[]:Iu(Xr(o)?o.prototype:M)}else r={};return(u?e:et)(n,(function(n,e,u){return t(r,n,e,u)})),r},bn.unary=function(n){return Dr(n,1)},bn.union=Vu,bn.unionBy=Ju,bn.unionWith=Yu,bn.uniq=function(n){return n&&n.length?Ut(n):[]},bn.uniqBy=function(n,t){return n&&n.length?Ut(n,lr(t)):[]},bn.uniqWith=function(n,t){return n&&n.length?Ut(n,M,t):[]},bn.unset=function(n,t){var r,e;null==n?r=!0:(r=wr(r=n,e=yr(e=t,r)?[e+""]:Ct(e)),e=Wr(e),r=null==r||!be(r,e)||delete r[e]);return r},bn.unzip=zr,bn.unzipWith=Br,bn.values=Ae,bn.valuesIn=function(n){return null==n?m(n,me(n)):[]},bn.without=Hu,bn.words=Ie,bn.wrap=function(n,t){return go(t=null==t?Re:t,n)},bn.xor=Qu,bn.xorBy=Xu,bn.xorWith=no,bn.zip=to,bn.zipObject=function(n,t){for(var r=-1,e=n?n.length:0,u=t?t.length:0,o={};++r<e;)Et(o,n[r],u>r?t[r]:M);return o},bn.zipWith=ro,bn.each=Fr,bn.eachRight=Mr,bn.extend=mo,bn.extendWith=wo,Ce(bn,bn),bn.add=function(n,t){var r;return n!==M&&(r=n),t!==M&&(r=r===M?t:r+t),r},bn.attempt=Zo,bn.camelCase=Uo,bn.capitalize=Oe,bn.ceil=Qo,bn.clamp=function(n,t,r){return r===M&&(r=t,t=M),r!==M&&(r=(r=ve(r))==r?r:0),t!==M&&(t=(t=ve(t))==t?t:0),Yn(ve(n),t,r)},bn.clone=function(n){return Hn(n)},bn.cloneDeep=function(n){return Hn(n,!0)},bn.cloneDeepWith=function(n,t){return Hn(n,!0,t)},bn.cloneWith=function(n,t){return Hn(n,!1,t)},bn.deburr=Ee,bn.endsWith=function(n,t,r){t="string"==typeof t?t:t+"";var e=(n=de(n)).length;return r=r===M?e:Yn(pe(r),0,e),(r-=t.length)>=0&&n.indexOf(t,r)==r},bn.eq=Gr,bn.escape=function(n){return(n=de(n))&&V.test(n)?n.replace(K,I):n},bn.escapeRegExp=function(n){return(n=de(n))&&rn.test(n)?n.replace(tn,"\\$&"):n},bn.every=function(n,t,r){var e=xo(n)?u:nt;return r&&dr(n,t,r)&&(t=M),e(n,lr(t,3))},bn.find=function(n,t){if(t=lr(t,3),xo(n)){var r=v(n,t);return r>-1?n[r]:M}return _(n,t,Ru)},bn.findIndex=function(n,t){return n&&n.length?v(n,lr(t,3)):-1},bn.findKey=function(n,t){return _(n,lr(t,3),et,!0)},bn.findLast=function(n,t){if(t=lr(t,3),xo(n)){var r=v(n,t,!0);return r>-1?n[r]:M}return _(n,t,Su)},bn.findLastIndex=function(n,t){return n&&n.length?v(n,lr(t,3),!0):-1},bn.findLastKey=function(n,t){return _(n,lr(t,3),ut,!0)},bn.floor=Xo,bn.forEach=Fr,bn.forEachRight=Mr,bn.forIn=function(n,t){return null==n?n:Wu(n,Er(t),me)},bn.forInRight=function(n,t){return null==n?n:Cu(n,Er(t),me)},bn.forOwn=function(n,t){return n&&et(n,Er(t))},bn.forOwnRight=function(n,t){return n&&ut(n,Er(t))},bn.get=ye,bn.gt=Vr,bn.gte=function(n,t){return n>=t},bn.has=be,bn.hasIn=xe,bn.head=Sr,bn.identity=Re,bn.includes=function(n,t,r,e){return n=Yr(n)?n:Ae(n),r=r&&!e?pe(r):0,e=n.length,0>r&&(r=hu(e+r,0)),ce(n)?e>=r&&-1<n.indexOf(t,r):!!e&&-1<g(n,t,r)},bn.indexOf=function(n,t,r){var e=n?n.length:0;return e?(0>(r=pe(r))&&(r=hu(e+r,0)),g(n,t,r)):-1},bn.inRange=function(n,t,r){return t=ve(t)||0,r===M?(r=t,t=0):r=ve(r)||0,(n=ve(n))>=pu(t,r)&&n<hu(t,r)},bn.invoke=Io,bn.isArguments=Jr,bn.isArray=xo,bn.isArrayLike=Yr,bn.isArrayLikeObject=Hr,bn.isBoolean=function(n){return!0===n||!1===n||ee(n)&&"[object Boolean]"==Ge.call(n)},bn.isDate=function(n){return ee(n)&&"[object Date]"==Ge.call(n)},bn.isElement=function(n){return!!n&&1===n.nodeType&&ee(n)&&!ie(n)},bn.isEmpty=function(n){return!ee(n)||Xr(n.splice)?!Zr(n):!je(n).length},bn.isEqual=function(n,t){return st(n,t)},bn.isEqualWith=function(n,t,r){var e=(r="function"==typeof r?r:M)?r(n,t):M;return e===M?st(n,t,r):!!e},bn.isError=Qr,bn.isFinite=function(n){return"number"==typeof n&&au(n)},bn.isFunction=Xr,bn.isInteger=ne,bn.isLength=te,bn.isMatch=function(n,t){return n===t||ht(n,t,sr(t))},bn.isMatchWith=function(n,t,r){return r="function"==typeof r?r:M,ht(n,t,sr(t),r)},bn.isNaN=function(n){return oe(n)&&n!=+n},bn.isNative=ue,bn.isNil=function(n){return null==n},bn.isNull=function(n){return null===n},bn.isNumber=oe,bn.isObject=re,bn.isObjectLike=ee,bn.isPlainObject=ie,bn.isRegExp=fe,bn.isSafeInteger=function(n){return ne(n)&&n>=-9007199254740991&&9007199254740991>=n},bn.isString=ce,bn.isSymbol=ae,bn.isTypedArray=le,bn.isUndefined=function(n){return n===M},bn.join=function(n,t){return n?lu.call(n,t):""},bn.kebabCase=zo,bn.last=Wr,bn.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(r!==M&&(u=(0>(u=pe(r))?hu(e+u,0):pu(u,e-1))+1),t!=t)return S(n,u,!0);for(;u--;)if(n[u]===t)return u;return-1},bn.lowerCase=Bo,bn.lowerFirst=Lo,bn.lt=se,bn.lte=function(n,t){return t>=n},bn.max=function(n){return n&&n.length?p(n,Re,Vr):M},bn.maxBy=function(n,t){return n&&n.length?p(n,lr(t),Vr):M},bn.mean=function(n){return Be(n)/(n?n.length:0)},bn.min=function(n){return n&&n.length?p(n,Re,se):M},bn.minBy=function(n,t){return n&&n.length?p(n,lr(t),se):M},bn.noConflict=function(){return qn._=Ve,this},bn.noop=Ue,bn.now=lo,bn.pad=function(n,t,r){n=de(n),t=pe(t);var e=$(n);return t&&t>e?(t=cu(e=(t-e)/2),e=fu(e),tr("",t,r)+n+tr("",e,r)):n},bn.padEnd=function(n,t,r){return(n=de(n))+tr(n,t,r)},bn.padStart=function(n,t,r){return tr(n=de(n),t,r)+n},bn.parseInt=function(n,t,r){return r||null==t?t=0:t&&(t=+t),n=de(n).replace(en,""),_u(n,t||(ln.test(n)?16:10))},bn.random=function(n,t,r){if(r&&"boolean"!=typeof r&&dr(n,t,r)&&(t=r=M),r===M&&("boolean"==typeof t?(r=t,t=M):"boolean"==typeof n&&(r=n,n=M)),n===M&&t===M?(n=0,t=1):(n=ve(n)||0,t===M?(t=n,n=0):t=ve(t)||0),n>t){var e=n;n=t,t=e}return r||n%1||t%1?(r=vu(),pu(n+r*(t-n+Bn("1e-"+((r+"").length-1))),t)):Ot(n,t)},bn.reduce=function(n,t,r){var e=xo(n)?l:d,u=3>arguments.length;return e(n,lr(t,4),r,u,Ru)},bn.reduceRight=function(n,t,r){var e=xo(n)?s:d,u=3>arguments.length;return e(n,lr(t,4),r,u,Su)},bn.repeat=ke,bn.replace=function(){var n=arguments,t=de(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},bn.result=function(n,t,r){if(yr(t,n))e=null==n?M:n[t];else{var e=ye(n,t=Ct(t));n=wr(n,t)}return e===M&&(e=r),Xr(e)?e.call(n):e},bn.round=ni,bn.runInContext=O,bn.sample=function(n){var t=(n=Yr(n)?n:Ae(n)).length;return t>0?n[Ot(0,t-1)]:M},bn.size=Zr,bn.snakeCase=Fo,bn.some=function(n,t,r){var e=xo(n)?h:It;return r&&dr(n,t,r)&&(t=M),e(n,lr(t,3))},bn.sortedIndex=function(n,t){return Rt(n,t)},bn.sortedIndexBy=function(n,t,r){return St(n,t,lr(r))},bn.sortedIndexOf=function(n,t){var r=n?n.length:0;if(r){var e=Rt(n,t);if(r>e&&Gr(n[e],t))return e}return-1},bn.sortedLastIndex=function(n,t){return Rt(n,t,!0)},bn.sortedLastIndexBy=function(n,t,r){return St(n,t,lr(r),!0)},bn.sortedLastIndexOf=function(n,t){if(n&&n.length){var r=Rt(n,t,!0)-1;if(Gr(n[r],t))return r}return-1},bn.startCase=Mo,bn.startsWith=function(n,t,r){return n=de(n),r=Yn(pe(r),0,n.length),n.lastIndexOf(t,r)==r},bn.subtract=function(n,t){var r;return n!==M&&(r=n),t!==M&&(r=r===M?t:r-t),r},bn.sum=Be,bn.sumBy=function(n,t){return n&&n.length?y(n,lr(t)):M},bn.template=function(n,t,r){var e=bn.templateSettings;r&&dr(n,t,r)&&(t=M),n=de(n),t=wo({},t,e,Tn);var u,o,i=je(r=wo({},t.imports,e.imports,Tn)),f=m(r,i),c=0;r=t.interpolate||dn;var a="__p+='";r=Me((t.escape||dn).source+"|"+r.source+"|"+(r===H?cn:dn).source+"|"+(t.evaluate||dn).source+"|$","g");var l="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,(function(t,r,e,i,f,l){return e||(e=i),a+=n.slice(c,l).replace(yn,R),r&&(u=!0,a+="'+__e("+r+")+'"),f&&(o=!0,a+="';"+f+";\n__p+='"),e&&(a+="'+((__t=("+e+"))==null?'':__t)+'"),c=l+t.length,t})),a+="';",(t=t.variable)||(a="with(obj){"+a+"}"),a=(o?a.replace(D,""):a).replace(q,"$1").replace(P,"$1;"),a="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",(t=Zo((function(){return Function(i,l+"return "+a).apply(M,f)}))).source=a,Qr(t))throw t;return t},bn.times=function(n,t){if(1>(n=pe(n))||n>9007199254740991)return[];var r=4294967295,e=pu(n,4294967295);for(n-=4294967295,e=b(e,t=Er(t));++r<n;)t(r);return e},bn.toInteger=pe,bn.toLength=_e,bn.toLower=function(n){return de(n).toLowerCase()},bn.toNumber=ve,bn.toSafeInteger=function(n){return Yn(pe(n),-9007199254740991,9007199254740991)},bn.toString=de,bn.toUpper=function(n){return de(n).toUpperCase()},bn.trim=function(n,t,r){return(n=de(n))?r||t===M?n.replace(en,""):(t+="")?(n=n.match(mn),t=t.match(mn),n.slice(w(n,t),A(n,t)+1).join("")):n:n},bn.trimEnd=function(n,t,r){return(n=de(n))?r||t===M?n.replace(on,""):(t+="")?(n=n.match(mn)).slice(0,A(n,t.match(mn))+1).join(""):n:n},bn.trimStart=function(n,t,r){return(n=de(n))?r||t===M?n.replace(un,""):(t+="")?(n=n.match(mn)).slice(w(n,t.match(mn))).join(""):n:n},bn.truncate=function(n,t){var r=30,e="...";if(re(t)){var u="separator"in t?t.separator:u;r="length"in t?pe(t.length):r,e="omission"in t?de(t.omission):e}var o=(n=de(n)).length;if(wn.test(n)){var i=n.match(mn);o=i.length}if(r>=o)return n;if(1>(o=r-$(e)))return e;if(r=i?i.slice(0,o).join(""):n.slice(0,o),u===M)return r+e;if(i&&(o+=r.length-o),fe(u)){if(n.slice(o).search(u)){var f=r;for(u.global||(u=Me(u.source,de(an.exec(u))+"g")),u.lastIndex=0;i=u.exec(f);)var c=i.index;r=r.slice(0,c===M?o:c)}}else n.indexOf(u,o)!=o&&((u=r.lastIndexOf(u))>-1&&(r=r.slice(0,u)));return r+e},bn.unescape=function(n){return(n=de(n))&&G.test(n)?n.replace(T,F):n},bn.uniqueId=function(n){var t=++Te;return de(n)+t},bn.upperCase=No,bn.upperFirst=$o,bn.first=Sr,Ce(bn,function(){var n={};return et(bn,(function(t,r){Pe.call(bn.prototype,r)||(n[r]=t)})),n}(),{chain:!1}),bn.VERSION="4.0.0",e("bind bindKey curry curryRight partial partialRight".split(" "),(function(n){bn[n].placeholder=bn})),e(["drop","take"],(function(n,t){Wn.prototype[n]=function(r){var e=this.__filtered__;if(e&&!t)return new Wn(this);r=r===M?1:hu(pe(r),0);var u=this.clone();return e?u.__takeCount__=pu(r,u.__takeCount__):u.__views__.push({size:pu(r,4294967295),type:n+(0>u.__dir__?"Right":"")}),u},Wn.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}})),e(["filter","map","takeWhile"],(function(n,t){var r=t+1,e=1==r||3==r;Wn.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:lr(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}})),e(["head","last"],(function(n,t){var r="take"+(t?"Right":"");Wn.prototype[n]=function(){return this[r](1).value()[0]}})),e(["initial","tail"],(function(n,t){var r="drop"+(t?"":"Right");Wn.prototype[n]=function(){return this.__filtered__?new Wn(this):this[r](1)}})),Wn.prototype.compact=function(){return this.filter(Re)},Wn.prototype.find=function(n){return this.filter(n).head()},Wn.prototype.findLast=function(n){return this.reverse().find(n)},Wn.prototype.invokeMap=Kr((function(n,t){return"function"==typeof n?new Wn(this):this.map((function(r){return lt(r,n,t)}))})),Wn.prototype.reject=function(n){return n=lr(n,3),this.filter((function(t){return!n(t)}))},Wn.prototype.slice=function(n,t){n=pe(n);var r=this;return r.__filtered__&&(n>0||0>t)?new Wn(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==M&&(r=0>(t=pe(t))?r.dropRight(-t):r.take(t-n)),r)},Wn.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Wn.prototype.toArray=function(){return this.take(4294967295)},et(Wn.prototype,(function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=bn[e?"take"+("last"==t?"Right":""):t],o=e||/^find/.test(t);u&&(bn.prototype[t]=function(){function t(n){return n=u.apply(bn,a([n],f)),e&&h?n[0]:n}var i=this.__wrapped__,f=e?[1]:arguments,c=i instanceof Wn,l=f[0],s=c||xo(i);s&&r&&"function"==typeof l&&1!=l.length&&(c=s=!1);var h=this.__chain__,p=!!this.__actions__.length;l=o&&!h,c=c&&!p;return!o&&s?(i=c?i:new Wn(this),(i=n.apply(i,f)).__actions__.push({func:$r,args:[t],thisArg:M}),new Sn(i,h)):l&&c?n.apply(this,f):(i=this.thru(t),l?e?i.value()[0]:i.value():i)})})),e("pop push shift sort splice unshift".split(" "),(function(n){var t=Ze[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);bn.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r]((function(r){return t.apply(r,n)}))}})),et(Wn.prototype,(function(n,t){var r=bn[t];if(r){var e=r.name+"";(ku[e]||(ku[e]=[])).push({name:t,func:r})}})),ku[Xt(M,2).name]=[{name:"wrapper",func:M}],Wn.prototype.clone=function(){var n=new Wn(this.__wrapped__);return n.__actions__=Nt(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Nt(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Nt(this.__views__),n},Wn.prototype.reverse=function(){if(this.__filtered__){var n=new Wn(this);n.__dir__=-1,n.__filtered__=!0}else(n=this.clone()).__dir__*=-1;return n},Wn.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=xo(t),u=0>r,o=e?t.length:0;n=o;for(var i=this.__views__,f=0,c=-1,a=i.length;++c<a;){var l=i[c],s=l.size;switch(l.type){case"drop":f+=s;break;case"dropRight":n-=s;break;case"take":n=pu(n,f+s);break;case"takeRight":f=hu(f,n-s)}}if(i=(n={start:f,end:n}).start,n=(f=n.end)-i,u=u?f:i-1,f=(i=this.__iteratees__).length,c=0,a=pu(n,this.__takeCount__),!e||200>o||o==n&&a==n)return Bt(t,this.__actions__);e=[];n:for(;n--&&a>c;){for(o=-1,l=t[u+=r];++o<f;){s=(h=i[o]).type;var h=(0,h.iteratee)(l);if(2==s)l=h;else if(!h){if(1==s)continue n;break n}}e[c++]=l}return e},bn.prototype.at=eo,bn.prototype.chain=function(){return Lr(this)},bn.prototype.commit=function(){return new Sn(this.value(),this.__chain__)},bn.prototype.flatMap=function(n){return this.map(n).flatten()},bn.prototype.next=function(){this.__values__===M&&(this.__values__=he(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?M:this.__values__[this.__index__++]}},bn.prototype.plant=function(n){for(var t,r=this;r instanceof xn;){var e=kr(r);e.__index__=0,e.__values__=M,t?u.__wrapped__=e:t=e;var u=e;r=r.__wrapped__}return u.__wrapped__=n,t},bn.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Wn?(this.__actions__.length&&(n=new Wn(this)),(n=n.reverse()).__actions__.push({func:$r,args:[Ur],thisArg:M}),new Sn(n,this.__chain__)):this.thru(Ur)},bn.prototype.toJSON=bn.prototype.valueOf=bn.prototype.value=function(){return Bt(this.__wrapped__,this.__actions__)},eu&&(bn.prototype[eu]=function(){return this}),bn}();(Nn||Mn||{})._=Pn,"function"==typeof define&&"object"==typeof define.amd&&define.amd?define((function(){return Pn})):$n&&Fn?(Zn&&((Fn.exports=Pn)._=Pn),$n._=Pn):qn._=Pn}).call(this);/**
47
- * jGestures: a jQuery plugin for gesture events
48
- * Copyright 2010, Neue Digitale / Razorfish GmbH
49
-
50
- * Licensed under the Apache License, Version 2.0 (the "License");
51
- * you may not use this file except in compliance with the License.
52
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
53
- * Unless required by applicable law or agreed to in writing, software
54
- * distributed under the License is distributed on an "AS IS" BASIS,
55
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
56
- * See the License for the specific language governing permissions and
57
- * limitations under the License.
58
- *
59
- * This is still a beta version, bugfixes and improvements appreciated.
60
- * @copyright Neue Digitale / Razorfish GmbH
61
- * @author martin.krause@neue-digitale.de
62
- * @version 0.87
63
- *
64
- * @requires
65
- * jQuery JavaScript Library v1.4.2 - http://jquery.com/
66
- * Copyright 2010, John Resig
67
- * Dual licensed under the MIT or GPL Version 2 licenses.
68
- * http://jquery.org/license
69
- */
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("stream")):"function"==typeof define&&define.amd?define(["stream"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).JMuxer=t(e.stream)}(this,(function(e){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(t){var i=o(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return c(e)}(this,r)}}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,i,a=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);s=!0);}catch(e){o=!0,i=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw i}}return a}(e,t)||h(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=h(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw a}}}}var p,v;function m(e){if(p){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];p.apply(void 0,[e].concat(r))}}function k(e){if(v){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];v.apply(void 0,[e].concat(r))}}var g=function(){function e(t){r(this,e),this.payload=t,this.nri=(96&this.payload[0])>>5,this.ntype=31&this.payload[0],this.isvcl=1==this.ntype||5==this.ntype,this.stype="",this.isfmb=!1}return i(e,[{key:"toString",value:function(){return"".concat(e.type(this),": NRI: ").concat(this.getNri())}},{key:"getNri",value:function(){return this.nri}},{key:"type",value:function(){return this.ntype}},{key:"isKeyframe",value:function(){return this.ntype===e.IDR}},{key:"getPayload",value:function(){return this.payload}},{key:"getPayloadSize",value:function(){return this.payload.byteLength}},{key:"getSize",value:function(){return 4+this.getPayloadSize()}},{key:"getData",value:function(){var e=new Uint8Array(this.getSize());return new DataView(e.buffer).setUint32(0,this.getSize()-4),e.set(this.getPayload(),4),e}}],[{key:"NDR",get:function(){return 1}},{key:"IDR",get:function(){return 5}},{key:"SEI",get:function(){return 6}},{key:"SPS",get:function(){return 7}},{key:"PPS",get:function(){return 8}},{key:"AUD",get:function(){return 9}},{key:"TYPES",get:function(){var t;return a(t={},e.IDR,"IDR"),a(t,e.SEI,"SEI"),a(t,e.SPS,"SPS"),a(t,e.PPS,"PPS"),a(t,e.NDR,"NDR"),a(t,e.AUD,"AUD"),t}},{key:"type",value:function(t){return t.ntype in e.TYPES?e.TYPES[t.ntype]:"UNKNOWN"}}]),e}();function b(e,t){var r=new Uint8Array((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}var S=function(){function e(t){r(this,e),this.data=t,this.index=0,this.bitLength=8*t.byteLength}return i(e,[{key:"setData",value:function(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}},{key:"bitsAvailable",get:function(){return this.bitLength-this.index}},{key:"skipBits",value:function(e){if(this.bitsAvailable<e)return!1;this.index+=e}},{key:"readBits",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}},{key:"getBits",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable<e)return 0;var n=t%8,i=this.data[t/8|0]&255>>>n,a=8-n;if(a>=e)return r&&(this.index+=e),i>>a-e;r&&(this.index+=a);var s=e-a;return i<<s|this.getBits(s,t+a,r)}},{key:"skipLZ",value:function(){var e;for(e=0;e<this.bitLength-this.index;++e)if(0!==this.getBits(1,this.index+e,!1))return this.index+=e,e;return e}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}}]),e}(),w=function(){function e(t){r(this,e),this.remuxer=t,this.track=t.mp4track}return i(e,[{key:"parseSPS",value:function(t){var r=e.readSPS(new Uint8Array(t));this.track.fps=r.fps,this.track.width=r.width,this.track.height=r.height,this.track.sps=[new Uint8Array(t)],this.track.codec="avc1.";for(var n=new DataView(t.buffer,t.byteOffset+1,4),i=0;i<3;++i){var a=n.getUint8(i).toString(16);a.length<2&&(a="0"+a),this.track.codec+=a}}},{key:"parsePPS",value:function(e){this.track.pps=[new Uint8Array(e)]}},{key:"parseNAL",value:function(e){if(!e)return!1;var t=!1;switch(e.type()){case g.IDR:case g.NDR:t=!0;break;case g.PPS:this.track.pps||(this.parsePPS(e.getPayload()),!this.remuxer.readyToDecode&&this.track.pps&&this.track.sps&&(this.remuxer.readyToDecode=!0)),t=!0;break;case g.SPS:this.track.sps||(this.parseSPS(e.getPayload()),!this.remuxer.readyToDecode&&this.track.pps&&this.track.sps&&(this.remuxer.readyToDecode=!0)),t=!0;break;case g.AUD:m("AUD - ignoing");break;case g.SEI:m("SEI - ignoing")}return t}}],[{key:"extractNALu",value:function(e){for(var t,r,n=0,i=e.byteLength,a=0,s=[],o=0;n<i;)switch(t=e[n++],a){case 0:0===t&&(a=1);break;case 1:a=0===t?2:0;break;case 2:case 3:0===t?a=3:1===t&&n<i?(o!=n-a-1&&s.push(e.subarray(o,n-a-1)),o=n,a=0):a=0}return o<i&&(r=e.subarray(o,i)),[s,r]}},{key:"skipScalingList",value:function(e,t){for(var r=8,n=8,i=0;i<t;i++)0!==n&&(n=(r+e.readEG()+256)%256),r=0===n?r:n}},{key:"readSPS",value:function(t){var r,n,i,a,s,o,u=new S(t),c=0,f=0,l=0,h=0,d=1,y=0;u.readUByte();for(var p=[],v=t.byteLength,m=1;m<v;m++)m+2<v&&3===u.readBits(24,!1)?(p.push(u.readBits(8)),p.push(u.readBits(8)),m+=2,u.readBits(8)):p.push(u.readBits(8));if(u.setData(new Uint8Array(p)),r=u.readUByte(),u.readBits(5),u.skipBits(3),u.readUByte(),u.skipUEG(),100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r){var k=u.readUEG();if(3===k&&u.skipBits(1),u.skipUEG(),u.skipUEG(),u.skipBits(1),u.readBoolean()){o=3!==k?8:12;for(var g=0;g<o;++g)u.readBoolean()&&(g<6?e.skipScalingList(u,16):e.skipScalingList(u,64))}}u.skipUEG();var b=u.readUEG();if(0===b)u.readUEG();else if(1===b){u.skipBits(1),u.skipEG(),u.skipEG(),n=u.readUEG();for(var w=0;w<n;++w)u.skipEG()}if(u.skipUEG(),u.skipBits(1),i=u.readUEG(),a=u.readUEG(),0===(s=u.readBits(1))&&u.skipBits(1),u.skipBits(1),u.readBoolean()&&(c=u.readUEG(),f=u.readUEG(),l=u.readUEG(),h=u.readUEG()),u.readBoolean()){if(u.readBoolean()){var x;switch(u.readUByte()){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:x=[u.readUByte()<<8|u.readUByte(),u.readUByte()<<8|u.readUByte()]}x&&x[0]>0&&x[1]>0&&(d=x[0]/x[1])}if(u.readBoolean()&&u.skipBits(1),u.readBoolean()&&(u.skipBits(4),u.readBoolean()&&u.skipBits(24)),u.readBoolean()&&(u.skipUEG(),u.skipUEG()),u.readBoolean()){var U=u.readUInt(),A=u.readUInt();u.readBoolean()&&(y=A/(2*U))}}return{fps:y>0?y:void 0,width:Math.ceil((16*(i+1)-2*c-2*f)*d),height:(2-s)*(a+1)*16-(s?2:4)*(l+h)}}},{key:"parseHeader",value:function(e){var t=new S(e.getPayload());t.readUByte(),e.isfmb=0===t.readUEG(),e.stype=t.readUEG()}}]),e}(),x=function(){function e(t){r(this,e),this.remuxer=t,this.track=t.mp4track}return i(e,[{key:"extractAAC",value:function(t){var r,n,i=0,a=t.byteLength,s=[];if(!e.isAACPattern(t))return k("Invalid ADTS audio format"),s;for(r=e.getHeaderLength(t),this.aacHeader||(this.aacHeader=t.subarray(0,r));i<a;)n=e.getFrameLength(t),s.push(t.subarray(r,n)),t=t.slice(n),i+=n;return s}},{key:"setAACConfig",value:function(){var e,t,r,n=new Uint8Array(2),i=this.aacHeader;i&&(e=1+((192&i[2])>>>6),t=(60&i[2])>>>2,r=(1&i[2])<<2,r|=(192&i[3])>>>6,n[0]=e<<3,n[0]|=(14&t)>>1,n[1]|=(1&t)<<7,n[1]|=r<<3,this.track.codec="mp4a.40."+e,this.track.channelCount=r,this.track.config=n,this.remuxer.readyToDecode=!0)}}],[{key:"samplingRateMap",get:function(){return[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]}},{key:"getHeaderLength",value:function(e){return 1&e[1]?7:9}},{key:"getFrameLength",value:function(e){return(3&e[3])<<11|e[4]<<3|(224&e[5])>>>5}},{key:"isAACPattern",value:function(e){return!(255!==e[0]||240&~e[1]||6&e[1])}}]),e}(),U=function(){function e(t){r(this,e),this.listener={},this.type=""|t}return i(e,[{key:"on",value:function(e,t){return this.listener[e]||(this.listener[e]=[]),this.listener[e].push(t),!0}},{key:"off",value:function(e,t){if(this.listener[e]){var r=this.listener[e].indexOf(t);return r>-1&&this.listener[e].splice(r,1),!0}return!1}},{key:"offAll",value:function(){this.listener={}}},{key:"dispatch",value:function(e,t){return!!this.listener[e]&&(this.listener[e].map((function(e){e.apply(null,[t])})),!0)}}]),e}(),A=function(){function e(){r(this,e)}return i(e,null,[{key:"init",value:function(){var t;for(t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:r,audio:n};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=a,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,s,u,s,o),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,i))}},{key:"box",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var i,a=8,s=r.length,o=s;s--;)a+=r[s].byteLength;for((i=new Uint8Array(a))[0]=a>>24&255,i[1]=a>>16&255,i[2]=a>>8&255,i[3]=255&a,i.set(e,4),s=0,a=8;s<o;++s)i.set(r[s],a),a+=r[s].byteLength;return i}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}},{key:"mdhd",value:function(t,r){return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,85,196,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"minf",value:function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}},{key:"moof",value:function(t,r,n){return e.box(e.types.moof,e.mfhd(t),e.traf(n,r))}},{key:"moov",value:function(t,r,n){for(var i=t.length,a=[];i--;)a[i]=e.trak(t[i]);return e.box.apply(null,[e.types.moov,e.mvhd(n,r)].concat(a).concat(e.mvex(t)))}},{key:"mvex",value:function(t){for(var r=t.length,n=[];r--;)n[r]=e.trex(t[r]);return e.box.apply(null,[e.types.mvex].concat(n))}},{key:"mvhd",value:function(t,r){var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24&255,r>>16&255,r>>8&255,255&r,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,n)}},{key:"sdtp",value:function(t){var r,n,i=t.samples||[],a=new Uint8Array(4+i.length);for(n=0;n<i.length;n++)r=i[n].flags,a[n+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return e.box(e.types.sdtp,a)}},{key:"stbl",value:function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))}},{key:"avc1",value:function(t){var r,n,i,a=[],s=[];for(r=0;r<t.sps.length;r++)i=(n=t.sps[r]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(n));for(r=0;r<t.pps.length;r++)i=(n=t.pps[r]).byteLength,s.push(i>>>8&255),s.push(255&i),s=s.concat(Array.prototype.slice.call(n));var o=e.box(e.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a).concat([t.pps.length]).concat(s))),u=t.width,c=t.height;return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,255&u,c>>8&255,255&c,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,98,105,110,101,108,112,114,111,46,114,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(e){var t=e.config.byteLength,r=new Uint8Array(26+t+3);return r.set([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5,t]),r.set(e.config,26),r.set([6,1,2],26+t),r}},{key:"mp4a",value:function(t){var r=t.audiosamplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))}},{key:"stsd",value:function(t){return"audio"===t.type?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))}},{key:"tkhd",value:function(t){var r=t.id,n=t.duration,i=t.width,a=t.height,s=t.volume;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,255&s,s%1*10&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,a>>8&255,255&a,0,0]))}},{key:"traf",value:function(t,r){var n=e.sdtp(t),i=t.id;return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),e.box(e.types.tfdt,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.trun(t,n.length+16+16+8+16+8+8),n)}},{key:"trak",value:function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"trex",value:function(t){var r=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(t,r){var n,i,a,s,o,u,c=t.samples||[],f=c.length,l=12+16*f,h=new Uint8Array(l);for(r+=8+l,h.set([0,0,15,1,f>>>24&255,f>>>16&255,f>>>8&255,255&f,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),n=0;n<f;n++)a=(i=c[n]).duration,s=i.size,o=i.flags,u=i.cts,h.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*n);return e.box(e.types.trun,h)}},{key:"initSegment",value:function(t,r,n){e.types||e.init();var i,a=e.moov(t,r,n);return(i=new Uint8Array(e.FTYP.byteLength+a.byteLength)).set(e.FTYP),i.set(a,e.FTYP.byteLength),i}}]),e}(),B=1,D=function(){function e(){r(this,e)}return i(e,[{key:"flush",value:function(){this.mp4track.len=0,this.mp4track.samples=[]}},{key:"isReady",value:function(){return!(!this.readyToDecode||!this.samples.length)||null}}],[{key:"getTrackID",value:function(){return B++}}]),e}(),C=function(e){s(n,e);var t=f(n);function n(e){var i;return r(this,n),(i=t.call(this)).readyToDecode=!1,i.nextDts=0,i.dts=0,i.mp4track={id:D.getTrackID(),type:"audio",channelCount:0,len:0,fragmented:!0,timescale:e,duration:e,samples:[],config:"",codec:""},i.samples=[],i.aac=new x(c(i)),i}return i(n,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.codec="",this.mp4track.channelCount="",this.mp4track.config="",this.mp4track.timescale=this.timescale,this.nextDts=0,this.dts=0}},{key:"remux",value:function(e){if(e.length>0)for(var t=0;t<e.length;t++){var r=e[t],n=r.units,i=n.byteLength;this.samples.push({units:n,size:i,duration:r.duration}),this.mp4track.len+=i,this.readyToDecode||this.aac.setAACConfig()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var e,t,r=new Uint8Array(this.mp4track.len),n=0,i=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var a=this.samples.shift();a.units,(t=a.duration)<=0?(m("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(t)),this.mp4track.len-=a.size):(this.nextDts+=t,e={size:a.size,duration:t,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},r.set(a.units,n),n+=a.size,i.push(e))}return i.length?new Uint8Array(r.buffer,0,this.mp4track.len):null}},{key:"getAacParser",value:function(){return this.aac}}]),n}(D),E=function(e){s(n,e);var t=f(n);function n(e){var i;return r(this,n),(i=t.call(this)).readyToDecode=!1,i.nextDts=0,i.dts=0,i.mp4track={id:D.getTrackID(),type:"video",len:0,fragmented:!0,sps:"",pps:"",fps:30,width:0,height:0,timescale:e,duration:e,samples:[]},i.samples=[],i.h264=new w(c(i)),i}return i(n,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.sps="",this.mp4track.pps="",this.nextDts=0,this.dts=0}},{key:"remux",value:function(e){var t,r=y(e);try{for(r.s();!(t=r.n()).done;){var n,i=t.value,a=[],s=0,o=y(i.units);try{for(o.s();!(n=o.n()).done;){var u=n.value;this.h264.parseNAL(u)&&(a.push(u),s+=u.getSize())}}catch(e){o.e(e)}finally{o.f()}a.length>0&&this.readyToDecode&&(this.mp4track.len+=s,this.samples.push({units:a,size:s,keyFrame:i.keyFrame,duration:i.duration,compositionTimeOffset:i.compositionTimeOffset}))}}catch(e){r.e(e)}finally{r.f()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var e,t,r=new Uint8Array(this.mp4track.len),n=0,i=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var a=this.samples.shift(),s=a.units;if((t=a.duration)<=0)m("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(t)),this.mp4track.len-=a.size;else{this.nextDts+=t,e={size:a.size,duration:t,cts:a.compositionTimeOffset||0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:a.keyFrame?0:1,dependsOn:a.keyFrame?2:1}};var o,u=y(s);try{for(u.s();!(o=u.n()).done;){var c=o.value;r.set(c.getData(),n),n+=c.getSize()}}catch(e){u.e(e)}finally{u.f()}i.push(e)}}return i.length?new Uint8Array(r.buffer,0,this.mp4track.len):null}}]),n}(D),T=function(e){s(n,e);var t=f(n);function n(e){var i;return r(this,n),(i=t.call(this,"remuxer")).initialized=!1,i.trackTypes=[],i.tracks={},i.seq=1,i.env=e,i.timescale=1e3,i.mediaDuration=0,i.aacParser=null,i}return i(n,[{key:"addTrack",value:function(e){if("video"!==e&&"both"!==e||(this.tracks.video=new E(this.timescale),this.trackTypes.push("video")),"audio"===e||"both"===e){var t=new C(this.timescale);this.aacParser=t.getAacParser(),this.tracks.audio=t,this.trackTypes.push("audio")}}},{key:"reset",value:function(){var e,t=y(this.trackTypes);try{for(t.s();!(e=t.n()).done;){var r=e.value;this.tracks[r].resetTrack()}}catch(e){t.e(e)}finally{t.f()}this.initialized=!1}},{key:"destroy",value:function(){this.tracks={},this.offAll()}},{key:"flush",value:function(){if(this.initialized){var e,t=y(this.trackTypes);try{for(t.s();!(e=t.n()).done;){var r=e.value,n=this.tracks[r],i=n.getPayload();if(i&&i.byteLength){var a={type:r,payload:b(A.moof(this.seq,n.dts,n.mp4track),A.mdat(i)),dts:n.dts};"video"===r&&(a.fps=n.mp4track.fps),this.dispatch("buffer",a);var s=(o=n.dts/this.timescale,u=void 0,c=void 0,f=void 0,l=void 0,l="",u=Math.floor(o),(c=parseInt(u/3600,10)%24)>0&&(l+=(c<10?"0"+c:c)+":"),l+=((f=parseInt(u/60,10)%60)<10?"0"+f:f)+":"+((u=u<0?0:u%60)<10?"0"+u:u));m("put segment (".concat(r,"): dts: ").concat(n.dts," frames: ").concat(n.mp4track.samples.length," second: ").concat(s)),n.flush(),this.seq++}}}catch(e){t.e(e)}finally{t.f()}}else this.isReady()&&(this.dispatch("ready"),this.initSegment(),this.initialized=!0,this.flush());var o,u,c,f,l}},{key:"initSegment",value:function(){var e,t=[],r=y(this.trackTypes);try{for(r.s();!(e=r.n()).done;){var n=e.value,i=this.tracks[n];if("browser"==this.env){var a={type:n,payload:A.initSegment([i.mp4track],this.mediaDuration,this.timescale)};this.dispatch("buffer",a)}else t.push(i.mp4track)}}catch(e){r.e(e)}finally{r.f()}if("node"==this.env){var s={type:"all",payload:A.initSegment(t,this.mediaDuration,this.timescale)};this.dispatch("buffer",s)}m("Initial segment generated.")}},{key:"isReady",value:function(){var e,t=y(this.trackTypes);try{for(t.s();!(e=t.n()).done;){var r=e.value;if(!this.tracks[r].readyToDecode||!this.tracks[r].samples.length)return!1}}catch(e){t.e(e)}finally{t.f()}return!0}},{key:"remux",value:function(e){var t,r=y(this.trackTypes);try{for(r.s();!(t=r.n()).done;){var n=t.value,i=e[n];"audio"===n&&this.tracks.video&&!this.tracks.video.readyToDecode||i.length>0&&this.tracks[n].remux(i)}}catch(e){r.e(e)}finally{r.f()}this.flush()}}]),n}(U),P=function(e){s(n,e);var t=f(n);function n(e,i){var a;return r(this,n),(a=t.call(this,"buffer")).type=i,a.queue=new Uint8Array,a.cleaning=!1,a.pendingCleaning=0,a.cleanOffset=30,a.cleanRanges=[],a.sourceBuffer=e,a.sourceBuffer.addEventListener("updateend",(function(){a.pendingCleaning>0&&(a.initCleanup(a.pendingCleaning),a.pendingCleaning=0),a.cleaning=!1,a.cleanRanges.length&&a.doCleanup()})),a.sourceBuffer.addEventListener("error",(function(){a.dispatch("error",{type:a.type,name:"buffer",error:"buffer error"})})),a}return i(n,[{key:"destroy",value:function(){this.queue=null,this.sourceBuffer=null,this.offAll()}},{key:"doCleanup",value:function(){if(this.cleanRanges.length){var e=this.cleanRanges.shift();m("".concat(this.type," remove range [").concat(e[0]," - ").concat(e[1],")")),this.cleaning=!0,this.sourceBuffer.remove(e[0],e[1])}else this.cleaning=!1}},{key:"initCleanup",value:function(e){try{if(this.sourceBuffer.updating)return void(this.pendingCleaning=e);if(this.sourceBuffer.buffered&&this.sourceBuffer.buffered.length&&!this.cleaning){for(var t=0;t<this.sourceBuffer.buffered.length;++t){var r=this.sourceBuffer.buffered.start(t),n=this.sourceBuffer.buffered.end(t);e-r>this.cleanOffset&&r<(n=e-this.cleanOffset)&&this.cleanRanges.push([r,n])}this.doCleanup()}}catch(e){k("Error occured while cleaning ".concat(this.type," buffer - ").concat(e.name,": ").concat(e.message))}}},{key:"doAppend",value:function(){if(this.queue.length&&this.sourceBuffer&&!this.sourceBuffer.updating)try{this.sourceBuffer.appendBuffer(this.queue),this.queue=new Uint8Array}catch(t){var e="unexpectedError";"QuotaExceededError"===t.name?(m("".concat(this.type," buffer quota full")),e="QuotaExceeded"):(k("Error occured while appending ".concat(this.type," buffer - ").concat(t.name,": ").concat(t.message)),e="InvalidStateError"),this.dispatch("error",{type:this.type,name:e,error:"buffer error"})}}},{key:"feed",value:function(e){this.queue=b(this.queue,e)}}]),n}(U);return function(n){s(o,n);var a=f(o);function o(e){var n;r(this,o),(n=a.call(this,"jmuxer")).isReset=!1;return n.options=Object.assign({},{node:"",mode:"both",flushingTime:500,maxDelay:500,clearBuffer:!0,fps:30,readFpsFromTrack:!1,debug:!1,onReady:function(){},onError:function(){}},e),n.env="object"===("undefined"==typeof process?"undefined":t(process))&&"undefined"==typeof window?"node":"browser",n.options.debug&&(p=console.log,v=console.error),n.options.fps||(n.options.fps=30),n.frameDuration=1e3/n.options.fps|0,n.remuxController=new T(n.env),n.remuxController.addTrack(n.options.mode),n.initData(),n.remuxController.on("buffer",n.onBuffer.bind(c(n))),"browser"==n.env&&(n.remuxController.on("ready",n.createBuffer.bind(c(n))),n.initBrowser()),n}return i(o,[{key:"initData",value:function(){this.lastCleaningTime=Date.now(),this.kfPosition=[],this.kfCounter=0,this.pendingUnits={},this.remainingData=new Uint8Array,this.startInterval()}},{key:"initBrowser",value:function(){"string"==typeof this.options.node&&""==this.options.node&&k("no video element were found to render, provide a valid video element"),this.node="string"==typeof this.options.node?document.getElementById(this.options.node):this.options.node,this.mseReady=!1,this.setupMSE()}},{key:"createStream",value:function(){var t=this.feed.bind(this),r=this.destroy.bind(this);return this.stream=new e.Duplex({writableObjectMode:!0,read:function(e){},write:function(e,r,n){t(e),n()},final:function(e){r(),e()}}),this.stream}},{key:"setupMSE",value:function(){if(window.MediaSource=window.MediaSource||window.WebKitMediaSource,!window.MediaSource)throw"Oops! Browser does not support media source extension.";this.isMSESupported=!!window.MediaSource,this.mediaSource=new MediaSource,this.url=URL.createObjectURL(this.mediaSource),this.node.src=this.url,this.mseEnded=!1,this.mediaSource.addEventListener("sourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("sourceclose",this.onMSEClose.bind(this)),this.mediaSource.addEventListener("webkitsourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("webkitsourceclose",this.onMSEClose.bind(this))}},{key:"endMSE",value:function(){if(!this.mseEnded)try{this.mseEnded=!0,this.mediaSource.endOfStream()}catch(e){k("mediasource is not available to end")}}},{key:"feed",value:function(e){var t,r,n,i=!1,a={video:[],audio:[]};if(e&&this.remuxController){if(n=e.duration?parseInt(e.duration):0,e.video){e.video=b(this.remainingData,e.video);var s=l(w.extractNALu(e.video),2);if(t=s[0],r=s[1],this.remainingData=r||new Uint8Array,!(t.length>0))return void k("Failed to extract any NAL units from video data:",r);a.video=this.getVideoFrames(t,n,e.compositionTimeOffset),i=!0}if(e.audio){if(!((t=this.remuxController.aacParser.extractAAC(e.audio)).length>0))return void k("Failed to extract audio data from:",e.audio);a.audio=this.getAudioFrames(t,n),i=!0}i?this.remuxController.remux(a):k("Input object must have video and/or audio property. Make sure it is a valid typed array")}}},{key:"getVideoFrames",value:function(e,t,r){var n,i=this,a=[],s=[],o=0,u=!1,c=!1;this.pendingUnits.units&&(a=this.pendingUnits.units,c=this.pendingUnits.vcl,u=this.pendingUnits.keyFrame,this.pendingUnits={});var f,l=y(e);try{for(l.s();!(f=l.n()).done;){var h=f.value,d=new g(h);d.type()!==g.IDR&&d.type()!==g.NDR||w.parseHeader(d),a.length&&c&&(d.isfmb||!d.isvcl)&&(s.push({units:a,keyFrame:u}),a=[],u=!1,c=!1),a.push(d),u=u||d.isKeyframe(),c=c||d.isvcl}}catch(e){l.e(e)}finally{l.f()}if(a.length)if(t)if(c)s.push({units:a,keyFrame:u});else{var p=s.length-1;p>=0&&(s[p].units=s[p].units.concat(a))}else this.pendingUnits={units:a,keyFrame:u,vcl:c};return n=t?t/s.length|0:this.frameDuration,o=t?t-n*s.length:0,s.map((function(e){e.duration=n,e.compositionTimeOffset=r,o>0&&(e.duration++,o--),i.kfCounter++,e.keyFrame&&i.options.clearBuffer&&i.kfPosition.push(i.kfCounter*n/1e3)})),m("jmuxer: No. of frames of the last chunk: ".concat(s.length)),s}},{key:"getAudioFrames",value:function(e,t){var r,n,i=[],a=0,s=y(e);try{for(s.s();!(n=s.n()).done;){var o=n.value;i.push({units:o})}}catch(e){s.e(e)}finally{s.f()}return r=t?t/i.length|0:this.frameDuration,a=t?t-r*i.length:0,i.map((function(e){e.duration=r,a>0&&(e.duration++,a--)})),i}},{key:"destroy",value:function(){if(this.stopInterval(),this.stream&&(this.remuxController.flush(),this.stream.push(null),this.stream=null),this.remuxController&&(this.remuxController.destroy(),this.remuxController=null),this.bufferControllers){for(var e in this.bufferControllers)this.bufferControllers[e].destroy();this.bufferControllers=null,this.endMSE()}this.node=!1,this.mseReady=!1,this.videoStarted=!1,this.mediaSource=null}},{key:"reset",value:function(){if(this.stopInterval(),this.isReset=!0,this.node.pause(),this.remuxController&&this.remuxController.reset(),this.bufferControllers){for(var e in this.bufferControllers)this.bufferControllers[e].destroy();this.bufferControllers=null,this.endMSE()}this.initData(),"browser"==this.env&&this.initBrowser(),m("JMuxer was reset")}},{key:"createBuffer",value:function(){if(this.mseReady&&this.remuxController&&this.remuxController.isReady()&&!this.bufferControllers)for(var e in this.bufferControllers={},this.remuxController.tracks){var t=this.remuxController.tracks[e];if(!o.isSupported("".concat(e,'/mp4; codecs="').concat(t.mp4track.codec,'"')))return k("Browser does not support codec"),!1;var r=this.mediaSource.addSourceBuffer("".concat(e,'/mp4; codecs="').concat(t.mp4track.codec,'"'));this.bufferControllers[e]=new P(r,e),this.bufferControllers[e].on("error",this.onBufferError.bind(this))}}},{key:"startInterval",value:function(){var e=this;this.interval=setInterval((function(){e.options.flushingTime?e.applyAndClearBuffer():e.bufferControllers&&e.cancelDelay()}),this.options.flushingTime||1e3)}},{key:"stopInterval",value:function(){this.interval&&clearInterval(this.interval)}},{key:"cancelDelay",value:function(){if(this.node.buffered&&this.node.buffered.length>0&&!this.node.seeking){var e=this.node.buffered.end(0);e-this.node.currentTime>this.options.maxDelay/1e3&&(console.log("delay"),this.node.currentTime=e-.001)}}},{key:"releaseBuffer",value:function(){for(var e in this.bufferControllers)this.bufferControllers[e].doAppend()}},{key:"applyAndClearBuffer",value:function(){this.bufferControllers&&(this.releaseBuffer(),this.clearBuffer())}},{key:"getSafeClearOffsetOfBuffer",value:function(e){for(var t,r="audio"===this.options.mode&&e||0,n=0;n<this.kfPosition.length&&!(this.kfPosition[n]>=e);n++)t=this.kfPosition[n];return t&&(this.kfPosition=this.kfPosition.filter((function(e){return e<t&&(r=e),e>=t}))),r}},{key:"clearBuffer",value:function(){if(this.options.clearBuffer&&Date.now()-this.lastCleaningTime>1e4){for(var e in this.bufferControllers){var t=this.getSafeClearOffsetOfBuffer(this.node.currentTime);this.bufferControllers[e].initCleanup(t)}this.lastCleaningTime=Date.now()}}},{key:"onBuffer",value:function(e){this.options.readFpsFromTrack&&void 0!==e.fps&&this.options.fps!=e.fps&&(this.options.fps=e.fps,this.frameDuration=Math.ceil(1e3/e.fps),m("JMuxer changed FPS to ".concat(e.fps," from track data"))),"browser"==this.env?this.bufferControllers&&this.bufferControllers[e.type]&&this.bufferControllers[e.type].feed(e.payload):this.stream&&this.stream.push(e.payload),0===this.options.flushingTime&&this.applyAndClearBuffer()}},{key:"onMSEOpen",value:function(){this.mseReady=!0,URL.revokeObjectURL(this.url),"function"==typeof this.options.onReady&&this.options.onReady.call(null,this.isReset)}},{key:"onMSEClose",value:function(){this.mseReady=!1,this.videoStarted=!1}},{key:"onBufferError",value:function(e){if("QuotaExceeded"==e.name)return m("JMuxer cleaning ".concat(e.type," buffer due to QuotaExceeded error")),void this.bufferControllers[e.type].initCleanup(this.node.currentTime);"InvalidStateError"==e.name?(m("JMuxer is reseting due to InvalidStateError"),this.reset()):this.endMSE(),"function"==typeof this.options.onError&&this.options.onError.call(null,e)}}],[{key:"isSupported",value:function(e){return window.MediaSource&&window.MediaSource.isTypeSupported(e)}}]),o}(U)}));"use strict";function strcmp(_,e){return _==e?0:_>e?1:-1}var ptr=0,EXIT_SUCCESS=0,EXIT_FAILURE=1,SEEK_CUR=1,SEEK_END=2,SEEK_SET=0,buffer8k=function(){return Arr(8800,0)};function fread(_,e,r,t){if(_.val=new buffer8k,t.data.length<r+t.data_off)return t.data_off+=r,0;for(var n=0;n<r;++n)_.val[n]=t.data[t.data_off++];return _.val.length=r,n}function ftell(_){return _.data_off}function feof(_){return _.data.length<_.data_off?1:0}var char_=0,short_=0,int_=0,long_=0,void_=0,int8_t=char_,uint8_t=char_,int16_t=short_,uint16_t=short_,int32_t=int_,uint32_t=int_,uint64_t=long_,int64_t=long_,float_=0,size_t=0,double_=0,score_t=int64_t,CHAR_BIT=8,ptrdiff_t=int_,UINT8=char_,INT16=short_;function newObjectIt(_){return void 0===_?"error":JSON.parse(JSON.stringify(_))}function memcpy(_,e,r,t,n){var i;for(i=0;i<n;++i)_[e+i]=r[t+i];return _}function memset(_,e,r,t){var n=0;for(n=0;n<t;++n)_[e+n]=r}function malloc(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(e);return t}function assert(_){if(!_)throw new Error("assert :P")}function setjmp(_){return 0}function offsetof(_,e){return e}function Arr(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(e);return t}function Arr_new(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(new e);return t}function Arr_nOI(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(newObjectIt(e));return t}function ArrM(_,e){var r;new Array;for(r=_.length-1;r>=0;--r)e=newObjectIt(Arr(_[r],e));return e}function create_obj_vals_from_arrayChilds(_,e){var r;for(r=0;r<e.length;++r)e[r]=create_obj_vals_from_array(new _,e[r]);return e}function create_obj_vals_from_array(_,e){var r=_,t=0;for(var n in r)"object"==typeof r[n]&&Object.keys(r[n]).length==e[t].length?r[n]=create_obj_vals_from_array(r[n],e[t]):r[n]=e[t],t++;return r}var DC_PRED=0,V_PRED=1,H_PRED=2,TM_PRED=3,B_PRED=4,NEARESTMV=5,NEARMV=6,ZEROMV=7,NEWMV=8,SPLITMV=9,MB_MODE_COUNT=10,B_DC_PRED=0,B_TM_PRED=1,B_VE_PRED=2,B_HE_PRED=3,B_LD_PRED=4,B_RD_PRED=5,B_VR_PRED=6,B_VL_PRED=7,B_HD_PRED=8,B_HU_PRED=9,LEFT4X4=10,ABOVE4X4=11,ZERO4X4=12,NEW4X4=13,B_MODE_COUNT=14;function CODEC_INTERFACE(_,e){window[_+"_algo"]=create_obj_vals_from_array(vpx_codec_iface_t,e)}var VPX_CODEC_INTERNAL_ABI_VERSION=3,VPX_CODEC_CAP_DECODER=1,vpx_codec_ctrl_fn_map_t=function(){this.ctrl_id=int_,this.fn=0
2
+ /*!\brief Decoder algorithm interface interface 285
3
+ *
4
+ * All decoders \ref MUST expose a variable of this type.
5
+ */},vpx_codec_iface=function(){this.name=char_,this.abi_version=int_,this.caps=long_,this.init="vpx_codec_init_fn_t",this.destroy="vpx_codec_destroy_fn_t",this.ctrl_maps=new vpx_codec_ctrl_fn_map_t,this.get_mmap="vpx_codec_get_mmap_fn_t",this.set_mmap="vpx_codec_set_mmap_fn_t",this.dec=new Object({peek_si:"vpx_codec_peek_si_fn_t",get_si:"vpx_codec_get_si_fn_t",decode:"vpx_codec_decode_fn_t",get_frame:"vpx_codec_get_frame_fn_t"})},vpx_codec_iface_t=vpx_codec_iface,VERSION_STRING=" v0.9.7",VPX_CODEC_OK=0,VPX_CODEC_MEM_ERROR=2,VPX_IMAGE_ABI_VERSION=1;VPX_IMG_FMT_I420=258,VPX_IMG_FMT_VPXI420=260;var VPX_PLANE_PACKED=0,VPX_PLANE_Y=0,VPX_PLANE_U=1,VPX_PLANE_V=2,VPX_PLANE_ALPHA=3,PLANE_PACKED=VPX_PLANE_PACKED,PLANE_Y=VPX_PLANE_Y,PLANE_U=VPX_PLANE_U,PLANE_V=VPX_PLANE_V,PLANE_ALPHA=VPX_PLANE_ALPHA,vpx_image_t=function(){this.fmt=0,this.w=this.w=int_,this.h=this.h=int_,this.d_w=this.d_w=int_,this.d_h=this.d_h=int_,this.x_chroma_shift=this.x_chroma_shift=int_,this.y_chroma_shift=this.y_chroma_shift=int_,this.planes=this.planes=new Array(4),this.planes_off=this.planes_off=new Array(4),this.stride=this.stride=new Array(4),this.bps=this.bps=int_,this.user_priv=this.user_priv=void_,this.img_data=this.img_data=char_,this.img_data_off=this.img_data_off=0,this.img_data_owner=this.img_data_owner=int_,this.self_allocd=this.self_allocd=int_},NESTEGG_TRACK_VIDEO=0,NESTEGG_TRACK_AUDIO=1,NESTEGG_CODEC_VP8=0,NESTEGG_CODEC_VORBIS=1,NESTEGG_SEEK_SET=0,NESTEGG_SEEK_CUR=1,NESTEGG_SEEK_END=2,NESTEGG_LOG_DEBUG=1,NESTEGG_LOG_INFO=10,NESTEGG_LOG_WARNING=100,NESTEGG_LOG_ERROR=1e3,NESTEGG_LOG_CRITICAL=1e4,nestegg_io=function(){this.read=int_,this.seek=int_,this.tell=int64_t,this.userdata=void_},nestegg_video_params=function(){this.width=int_,this.height=int_,this.display_width=int_,this.display_height=int_,this.crop_bottom=int_,this.crop_top=int_,this.crop_left=int_,this.crop_right=int_},ID_EBML=440786851,ID_EBML_VERSION=17030,ID_EBML_READ_VERSION=17143,ID_EBML_MAX_ID_LENGTH=17138,ID_EBML_MAX_SIZE_LENGTH=17139,ID_DOCTYPE=17026,ID_DOCTYPE_VERSION=17031,ID_DOCTYPE_READ_VERSION=17029,ID_VOID=236,ID_CRC32=191,ID_SEGMENT=408125543,ID_SEEK_HEAD=290298740,ID_SEEK=19899,ID_SEEK_ID=21419,ID_SEEK_POSITION=21420,ID_INFO=357149030,ID_TIMECODE_SCALE=2807729,ID_DURATION=17545,ID_CLUSTER=524531317,ID_TIMECODE=231,ID_BLOCK_GROUP=160,ID_SIMPLE_BLOCK=163,ID_BLOCK=161,ID_BLOCK_DURATION=155,ID_REFERENCE_BLOCK=251,ID_TRACKS=374648427,ID_TRACK_ENTRY=174,ID_TRACK_NUMBER=215,ID_TRACK_UID=29637,ID_TRACK_TYPE=131,ID_FLAG_ENABLED=185,ID_FLAG_DEFAULT=136,ID_FLAG_LACING=156,ID_TRACK_TIMECODE_SCALE=2306383,ID_LANGUAGE=2274716,ID_CODEC_ID=134,ID_CODEC_PRIVATE=25506,ID_VIDEO=224,ID_PIXEL_WIDTH=176,ID_PIXEL_HEIGHT=186,ID_PIXEL_CROP_BOTTOM=21674,ID_PIXEL_CROP_TOP=21691,ID_PIXEL_CROP_LEFT=21708,ID_PIXEL_CROP_RIGHT=21725,ID_DISPLAY_WIDTH=21680,ID_DISPLAY_HEIGHT=21690,ID_AUDIO=225,ID_SAMPLING_FREQUENCY=181,ID_CHANNELS=159,ID_BIT_DEPTH=25188,ID_CUES=475249515,ID_CUE_POINT=187,ID_CUE_TIME=179,ID_CUE_TRACK_POSITIONS=183,ID_CUE_TRACK=247,ID_CUE_CLUSTER_POSITION=241,ID_CUE_BLOCK_NUMBER=21368,TYPE_UNKNOWN=0,TYPE_MASTER=1,TYPE_UINT=2,TYPE_FLOAT=3,TYPE_INT=4,TYPE_STRING=5,TYPE_BINARY=6,LIMIT_STRING=1<<20,LIMIT_BINARY=1<<24,LIMIT_BLOCK=1<<30,LIMIT_FRAME=1<<28,DESC_FLAG_NONE=0,DESC_FLAG_MULTI=1,DESC_FLAG_SUSPEND=2,DESC_FLAG_OFFSET=4,BLOCK_FLAGS_LACING=6,LACING_NONE=0,LACING_XIPH=1,LACING_FIXED=2,LACING_EBML=3,TRACK_TYPE_VIDEO=1,TRACK_TYPE_AUDIO=2,TRACK_ID_VP8="V_VP8",TRACK_ID_VORBIS="A_VORBIS",MASK_NONE=0,MASK_FIRST_BIT=1,ebml_binary=function(){this.data=char_,this.length=size_t},ebml_list_node=function(){this.next=null,this.id=uint64_t,this.data=void_},ebml_list=function(){this.head=null,this.tail=null},ebml_type=function(){this.v=new Object({u:uint64_t,f:double_,i:int64_t,s:char_,b:new ebml_binary}),this.type=0,this.read=int_},ebml=window.ebml=function(){this.ebml_version=this.ebml_version=new ebml_type,this.ebml_read_version=this.ebml_read_version=new ebml_type,this.ebml_max_id_length=this.ebml_max_id_length=new ebml_type,this.ebml_max_size_length=this.ebml_max_size_length=new ebml_type,this.doctype=this.doctype=new ebml_type,this.doctype_version=this.doctype_version=new ebml_type,this.doctype_read_version=this.doctype_read_version=new ebml_type},seek=window.seek=function(){this.id=this.id=new ebml_type,this.position=this.position=new ebml_type},seek_head=window.seek_head=function(){this.seek=this.seek=new ebml_list},info=window.info=function(){this.timecode_scale=this.timecode_scale=new ebml_type,this.duration=this.duration=new ebml_type},block_group=window.block_group=function(){this.duration=this.duration=new ebml_type,this.reference_block=this.reference_block=new ebml_type},cluster=window.cluster=function(){this.timecode=this.timecode=new ebml_type,this.block_group=this.block_group=new ebml_list},video=window.video=function(){this.pixel_width=this.pixel_width=new ebml_type,this.pixel_height=this.pixel_height=new ebml_type,this.pixel_crop_bottom=this.pixel_crop_bottom=new ebml_type,this.pixel_crop_top=this.pixel_crop_top=new ebml_type,this.pixel_crop_left=this.pixel_crop_left=new ebml_type,this.pixel_crop_right=this.pixel_crop_right=new ebml_type,this.display_width=this.display_width=new ebml_type,this.display_height=this.display_height=new ebml_type},audio=window.audio=function(){this.sampling_frequency=this.sampling_frequency=new ebml_type,this.channels=this.channels=new ebml_type,this.bit_depth=this.bit_depth=new ebml_type},track_entry=window.track_entry=function(){this.number=this.number=new ebml_type,this.uid=this.uid=new ebml_type,this.type=this.type=new ebml_type,this.flag_enabled=this.flag_enabled=new ebml_type,this.flag_default=this.flag_default=new ebml_type,this.flag_lacing=this.flag_lacing=new ebml_type,this.track_timecode_scale=this.track_timecode_scale=new ebml_type,this.language=this.language=new ebml_type,this.codec_id=this.codec_id=new ebml_type,this.codec_private=this.codec_private=new ebml_type,this.video=this.video=new video,this.audio=this.audio=new audio},tracks=window.tracks=function(){this.track_entry=this.track_entry=new ebml_list},cue_track_positions=window.cue_track_positions=function(){this.track=this.track=new ebml_type,this.cluster_position=this.cluster_position=new ebml_type,this.block_number=this.block_number=new ebml_type},cue_point=window.cue_point=function(){this.time=this.time=new ebml_type,this.cue_track_positions=this.cue_track_positions=new ebml_list},cues=window.cues=function(){this.cue_point=this.cue_point=new ebml_list},segment=window.segment=function(){this.seek_head=this.seek_head=new ebml_list,this.info=this.info=new info,this.cluster=this.cluster=new ebml_list,this.tracks=this.tracks=new tracks,this.cues=this.cues=new cues},pool_ctx=function(){this.dummy=char_},list_node=function(){this.previous=0,this.node=new ebml_element_desc,this.data=char_},frame=function(){this.data=char_,this.length=size_t,this.next=null},nestegg=function(){this.io=new nestegg_io,this.log_=0,this.alloc_pool=new pool_ctx,this.last_id=uint64_t,this.last_size=uint64_t,this.ancestor=null,this.ebml=this.ebml=new ebml,this.segment=this.segment=new segment,this.segment_offset=int64_t,this.track_count=int_},nestegg_packet=function(){this.track=uint64_t,this.timecode=uint64_t,this.frame=new frame},ebml_element_desc=function(){this.name=char_,this.id=uint64_t,this.type=0,this.offset=size_t,this.flags=int_,this.children=null,this.size=size_t,this.data_offset=size_t};function E_FIELD(_,e,r,t,n){return new Array(_,e,r,n,DESC_FLAG_NONE,null,0,0)}function E_MASTER(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_MULTI,i,1,0)}function E_SINGLE_MASTER_O(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_OFFSET,i,0,n+"_offset")}function E_SINGLE_MASTER(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_NONE,i,0,0)}function E_SUSPEND(_,e,r){return new Array(_,e,r,0,DESC_FLAG_SUSPEND,null,0,0)}var E_LAST=new Array(null,0,0,0,DESC_FLAG_NONE,null,0,0),ne_ebml_elements=create_ebml_element_desc(new Array(E_FIELD("ID_EBML_VERSION",ID_EBML_VERSION,TYPE_UINT,"ebml","ebml_version"),E_FIELD("ID_EBML_READ_VERSION",ID_EBML_READ_VERSION,TYPE_UINT,"ebml","ebml_read_version"),E_FIELD("ID_EBML_MAX_ID_LENGTH",ID_EBML_MAX_ID_LENGTH,TYPE_UINT,"ebml","ebml_max_id_length"),E_FIELD("ID_EBML_MAX_SIZE_LENGTH",ID_EBML_MAX_SIZE_LENGTH,TYPE_UINT,"ebml","ebml_max_size_length"),E_FIELD("ID_DOCTYPE",ID_DOCTYPE,TYPE_STRING,"ebml","doctype"),E_FIELD("ID_DOCTYPE_VERSION",ID_DOCTYPE_VERSION,TYPE_UINT,"ebml","doctype_version"),E_FIELD("ID_DOCTYPE_READ_VERSION",ID_DOCTYPE_READ_VERSION,TYPE_UINT,"ebml","doctype_read_version"),E_LAST)),ne_seek_elements=create_ebml_element_desc(new Array(E_FIELD("ID_SEEK_ID",ID_SEEK_ID,TYPE_BINARY,"seek","id"),E_FIELD("ID_SEEK_POSITION",ID_SEEK_POSITION,TYPE_UINT,"seek","position"),E_LAST)),ne_seek_head_elements=create_ebml_element_desc(new Array(E_MASTER("ID_SEEK",ID_SEEK,TYPE_MASTER,"seek_head","seek",ne_seek_elements),E_LAST)),ne_info_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TIMECODE_SCALE",ID_TIMECODE_SCALE,TYPE_UINT,"info","timecode_scale"),E_FIELD("ID_DURATION",ID_DURATION,TYPE_FLOAT,"info","duration"),E_LAST)),ne_block_group_elements=create_ebml_element_desc(new Array(E_SUSPEND("ID_BLOCK",ID_BLOCK,TYPE_BINARY),E_FIELD("ID_BLOCK_DURATION",ID_BLOCK_DURATION,TYPE_UINT,"block_group","duration"),E_FIELD("ID_REFERENCE_BLOCK",ID_REFERENCE_BLOCK,TYPE_INT,"block_group","reference_block"),E_LAST)),ne_cluster_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TIMECODE",ID_TIMECODE,TYPE_UINT,"cluster","timecode"),E_MASTER("ID_BLOCK_GROUP",ID_BLOCK_GROUP,TYPE_MASTER,"cluster","block_group",ne_block_group_elements),E_SUSPEND("ID_SIMPLE_BLOCK",ID_SIMPLE_BLOCK,TYPE_BINARY),E_LAST)),ne_video_elements=create_ebml_element_desc(new Array(E_FIELD("ID_PIXEL_WIDTH",ID_PIXEL_WIDTH,TYPE_UINT,"video","pixel_width"),E_FIELD("ID_PIXEL_HEIGHT",ID_PIXEL_HEIGHT,TYPE_UINT,"video","pixel_height"),E_FIELD("ID_PIXEL_CROP_BOTTOM",ID_PIXEL_CROP_BOTTOM,TYPE_UINT,"video","pixel_crop_bottom"),E_FIELD("ID_PIXEL_CROP_TOP",ID_PIXEL_CROP_TOP,TYPE_UINT,"video","pixel_crop_top"),E_FIELD("ID_PIXEL_CROP_LEFT",ID_PIXEL_CROP_LEFT,TYPE_UINT,"video","pixel_crop_left"),E_FIELD("ID_PIXEL_CROP_RIGHT",ID_PIXEL_CROP_RIGHT,TYPE_UINT,"video","pixel_crop_right"),E_FIELD("ID_DISPLAY_WIDTH",ID_DISPLAY_WIDTH,TYPE_UINT,"video","display_width"),E_FIELD("ID_DISPLAY_HEIGHT",ID_DISPLAY_HEIGHT,TYPE_UINT,"video","display_height"),E_LAST)),ne_audio_elements=create_ebml_element_desc(new Array(E_FIELD("ID_SAMPLING_FREQUENCY",ID_SAMPLING_FREQUENCY,TYPE_FLOAT,"audio","sampling_frequency"),E_FIELD("ID_CHANNELS",ID_CHANNELS,TYPE_UINT,"audio","channels"),E_FIELD("ID_BIT_DEPTH",ID_BIT_DEPTH,TYPE_UINT,"audio","bit_depth"),E_LAST)),ne_track_entry_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TRACK_NUMBER",ID_TRACK_NUMBER,TYPE_UINT,"track_entry","number"),E_FIELD("ID_TRACK_UID",ID_TRACK_UID,TYPE_UINT,"track_entry","uid"),E_FIELD("ID_TRACK_TYPE",ID_TRACK_TYPE,TYPE_UINT,"track_entry","type"),E_FIELD("ID_FLAG_ENABLED",ID_FLAG_ENABLED,TYPE_UINT,"track_entry","flag_enabled"),E_FIELD("ID_FLAG_DEFAULT",ID_FLAG_DEFAULT,TYPE_UINT,"track_entry","flag_default"),E_FIELD("ID_FLAG_LACING",ID_FLAG_LACING,TYPE_UINT,"track_entry","flag_lacing"),E_FIELD("ID_TRACK_TIMECODE_SCALE",ID_TRACK_TIMECODE_SCALE,TYPE_FLOAT,"track_entry","track_timecode_scale"),E_FIELD("ID_LANGUAGE",ID_LANGUAGE,TYPE_STRING,"track_entry","language"),E_FIELD("ID_CODEC_ID",ID_CODEC_ID,TYPE_STRING,"track_entry","codec_id"),E_FIELD("ID_CODEC_PRIVATE",ID_CODEC_PRIVATE,TYPE_BINARY,"track_entry","codec_private"),E_SINGLE_MASTER("ID_VIDEO",ID_VIDEO,TYPE_MASTER,"track_entry","video",ne_video_elements),E_SINGLE_MASTER("ID_AUDIO",ID_AUDIO,TYPE_MASTER,"track_entry","audio",ne_audio_elements),E_LAST)),ne_tracks_elements=create_ebml_element_desc(new Array(E_MASTER("ID_TRACK_ENTRY",ID_TRACK_ENTRY,TYPE_MASTER,"tracks","track_entry",ne_track_entry_elements),E_LAST)),ne_cue_track_positions_elements=create_ebml_element_desc(new Array(E_FIELD("ID_CUE_TRACK",ID_CUE_TRACK,TYPE_UINT,"cue_track_positions","track"),E_FIELD("ID_CUE_CLUSTER_POSITION",ID_CUE_CLUSTER_POSITION,TYPE_UINT,"cue_track_positions","cluster_position"),E_FIELD("ID_CUE_BLOCK_NUMBER",ID_CUE_BLOCK_NUMBER,TYPE_UINT,"cue_track_positions","block_number"),E_LAST)),ne_cue_point_elements=create_ebml_element_desc(new Array(E_FIELD("ID_CUE_TIME",ID_CUE_TIME,TYPE_UINT,"cue_point","time"),E_MASTER("ID_CUE_TRACK_POSITIONS",ID_CUE_TRACK_POSITIONS,TYPE_MASTER,"cue_point","cue_track_positions",ne_cue_track_positions_elements),E_LAST)),ne_cues_elements=create_ebml_element_desc(new Array(E_MASTER("ID_CUE_POINT",ID_CUE_POINT,TYPE_MASTER,"cues","cue_point",ne_cue_point_elements),E_LAST)),ne_segment_elements=create_ebml_element_desc(new Array(E_MASTER("ID_SEEK_HEAD",ID_SEEK_HEAD,TYPE_MASTER,"segment","seek_head",ne_seek_head_elements),E_SINGLE_MASTER("ID_INFO",ID_INFO,TYPE_MASTER,"segment","info",ne_info_elements),E_MASTER("ID_CLUSTER",ID_CLUSTER,TYPE_MASTER,"segment","cluster",ne_cluster_elements),E_SINGLE_MASTER("ID_TRACKS",ID_TRACKS,TYPE_MASTER,"segment","tracks",ne_tracks_elements),E_SINGLE_MASTER("ID_CUES",ID_CUES,TYPE_MASTER,"segment","cues",ne_cues_elements),E_LAST)),ne_top_level_elements=create_ebml_element_desc(new Array(E_SINGLE_MASTER("ID_EBML",ID_EBML,TYPE_MASTER,"nestegg","ebml",ne_ebml_elements),E_SINGLE_MASTER_O("ID_SEGMENT",ID_SEGMENT,TYPE_MASTER,"nestegg","segment",ne_segment_elements),E_LAST));function create_ebml_element_desc(_){for(var e=new Array,r=0;r<_.length;++r){var t=0,n=new ebml_element_desc;for(var i in n)"undefined"!==_[r][t]&&(n[i]=_[r][t++]);e.push(n)}return e}function ne_pool_init(_){return new pool_ctx}var buffer_8192=Arr(8192,0);function ne_io_read_skip(_,e){for(var r=size_t,t={val:buffer_8192},n=1;e>0&&1==(n=ne_io_read(_,t,r=e<t.val.length?e:t.val.length));)e-=r;return n}function ne_io_tell(_){return _.tell(_.userdata)}function ne_bare_read_vint(_,e,r,t){var n=int_,i={val:char_},a=1,o=128;if(1!=(n=ne_io_read(_,i,1)))return n;for(;a<8&&!(i.val[0]&o);)o>>=1,a+=1;for(r&&(r.val=a),e.val=i.val[0],t==MASK_FIRST_BIT&&(e.val=i.val[0]&~o);--a;){if(1!=(n=ne_io_read(_,i,1)))return n;e.val<<=8,e.val|=i.val[0]}return 1}function ne_io_read(_,e,r){return _.read(e,r,_.userdata)}function ne_read_id(_,e,r){return ne_bare_read_vint(_,e,r,MASK_NONE)}function ne_read_vint(_,e,r){return ne_bare_read_vint(_,e,r,MASK_FIRST_BIT)}function ne_read_svint(_,e,r){var t=int_,n=[uint64_t],i=[uint64_t],a=new Array(63,8191,1048575,134217727,17179869183,2199023255551,0xffffffffffff,0x80000000000000);return 1!=(t=ne_bare_read_vint(_,n,i,MASK_FIRST_BIT))||(e[0]=n-a[i-1],r&&(r[0]=i)),t}function ne_read_uint(_,e,r){var t={val:char_},n=int_;if(0==r||r>8)return-1;if(1!=(n=ne_io_read(_,t,1)))return n;for(e[0]=t.val[0];--r;){if(1!=(n=ne_io_read(_,t,1)))return n;e[0]<<=8,e[0]|=t.val[0]}return 1}function ne_read_int(_,e,r){var t,n=[uint64_t],i=uint64_t;return 1!=(t=ne_read_uint(_,n,r))?t:(r<8?(i=1,n>=(i<<=8*r-1)?(i=1,i<<=8*r):i=0,e[0]=n-i):e[0]=n,1)}function ne_read_float(_,e,r){var t,n={u:[uint64_t],f:[float_],d:[double_]};return 4!=r&&8!=r?-1:1!=(t=ne_read_uint(_,n.u,r))?t:(e[0]=4==r?n.f=n.u:n.d=n.u,1)}function ne_read_string(_,e,r){var t,n={val:char_};if(0==r||r>LIMIT_STRING)return-1;if(1!=(t=ne_io_read(_.io,n,r)))return t;for(var i="",a=0;a<r;++a)i+=String.fromCharCode(n.val[a]);return n.val=i,e[0]=n.val,1}function ne_read_binary(_,e,r){return 0==r||r>LIMIT_BINARY?-1:(e.data={val:0},e.length=r,ne_io_read(_.io,e.data,r))}function ne_get_uint(_,e){return _.read?(assert(_.type==TYPE_UINT),e[0]=_.v.u,0):-1}function ne_get_string(_,e){return _.read?(assert(_.type==TYPE_STRING),e[0]=_.v.s,0):-1}function ne_is_ancestor_element(_,e){for(;e;e=e.previous)for(var r=e.node,t=0;r[t].id;++t)if(r[t].id==_)return 1;return 0}function ne_find_element(_,e){for(var r=e,t=0;r[t].id;++t)if(r[t].id==_)return r[t];return null}function ne_ctx_push(_,e,r){var t=new list_node;t.previous=_.ancestor,t.node=e,t.data=r,_.ancestor=t}function ne_ctx_pop(_){var e;e=_.ancestor,_.ancestor=e.previous,e=""}function ne_peek_element(_,e,r){var t=int_;return _.last_id&&_.last_size?(e&&(e[0]=_.last_id),r&&(r[0]=_.last_size),1):(_.last_id={val:_.last_id},t=ne_read_id(_.io,_.last_id,null),_.last_id=_.last_id.val,1!=t?t:(_.last_size={val:_.last_size},t=ne_read_vint(_.io,_.last_size,null),_.last_size=_.last_size.val,1!=t?t:(e&&(e[0]=_.last_id),r&&(r[0]=_.last_size),1)))}function ne_read_element(_,e,r){var t;return 1!=(t=ne_peek_element(_,e,r))?t:(_.last_id=0,_.last_size=0,1)}function ne_read_master(_,e){var r,t,n=new ebml_list_node;assert(e.type==TYPE_MASTER&&e.flags&DESC_FLAG_MULTI),_.ancestor.data[e.offset]&&(r=_.ancestor.data[e.offset]),n.id=e.id,n.data=new window[e.offset],(t=r.tail)&&(t.next=n),r.tail=n,r.head||(r.head=n),ne_ctx_push(_,e.children,n.data)}function ne_read_single_master(_,e){assert(e.type==TYPE_MASTER&&!(e.flags&DESC_FLAG_MULTI)),ne_ctx_push(_,e.children,_.ancestor.data[e.offset])}function ne_read_simple(_,e,r){var t,n=int_;if(_.ancestor.data[e.offset]&&(t=_.ancestor.data[e.offset]),t.read)return 0;switch(t.type=e.type,n=-1,e.type){case TYPE_UINT:t.v.u=[t.v.u],n=ne_read_uint(_.io,t.v.u,r),t.v.u=t.v.u[0];break;case TYPE_FLOAT:t.v.f=[t.v.f],n=ne_read_float(_.io,t.v.f,r),t.v.f=t.v.f[0];break;case TYPE_INT:t.v.i=[t.v.i],n=ne_read_int(_.io,t.v.i,r),t.v.i=t.v.i[0];break;case TYPE_STRING:t.v.s=[t.v.s],n=ne_read_string(_,t.v.s,r),t.v.s=t.v.s[0];break;case TYPE_BINARY:n=ne_read_binary(_,t.v.b,r);break;case TYPE_MASTER:case TYPE_UNKNOWN:assert(0)}return 1==n&&(t.read=1),n}function ne_parse(_,e){var r,t=int_,n=int64_t,i=[uint64_t],a=[uint64_t];if(!_.ancestor)return-1;for(;1==(t=ne_peek_element(_,i,a));)if(r=ne_find_element(i[0],_.ancestor.node)){if(r.flags&DESC_FLAG_SUSPEND){assert(r.type==TYPE_BINARY),t=1;break}if(1!=(t=ne_read_element(_,i,a)))break;if(r.flags&DESC_FLAG_OFFSET&&((n=_.ancestor.data[r.data_offset]={v:null}).v=ne_io_tell(_.io),n<0)){t=-1;break}if(r.type==TYPE_MASTER){r.flags&DESC_FLAG_MULTI?ne_read_master(_,r):ne_read_single_master(_,r);continue}if((t=ne_read_simple(_,r,a[0]))<0)break}else if(ne_is_ancestor_element(i,_.ancestor.previous)){if(e&&_.ancestor.node==e){t=1;break}ne_ctx_pop(_)}else{if(1!=(t=ne_read_element(_,i,a)))break;if(1!=(t=ne_io_read_skip(_.io,a[0])))break}if(1!=t)for(;_.ancestor;)ne_ctx_pop(_);return t}function ne_read_xiph_lace_value(_,e,r,t){var n=int_,i=[uint64_t];if(1!=(n=ne_read_uint(_,i,1)))return n;for(t[0]+=1,e[r+0]=i[0];255==i[0];){if(1!=(n=ne_read_uint(_,i,1)))return n;t[0]+=1,e[r+0]+=i[0]}return 1}function ne_read_xiph_lacing(_,e,r,t,n){for(var i=int_,a=0,o=0;--t;){if(1!=(i=ne_read_xiph_lace_value(_,n,a,r)))return i;o+=n[a],a+=1}return r[0]+o>e?-1:(n[a]=e-r[0]-o,1)}function ne_read_ebml_lacing(_,e,r,t,n){var i=int_,a=[uint64_t],o=uint64_t,s=[uint64_t],f=[int64_t],d=0;if(1!=(i=ne_read_vint(_,a,s)))return i;for(r[0]+=s[0],n[d]=a[0],o=n[d],d+=1,t-=1;--t;){if(1!=(i=ne_read_svint(_,f,s)))return i;r[0]+=s[0],n[d]=n[d-1]+f[0],o+=n[d],d+=1}return r[0]+o>e?-1:(n[d]=e-r[0]-o,1)}function ne_get_timecode_scale(_){var e=[uint64_t];return 0!=ne_get_uint(_.segment.info.timecode_scale,e)&&(e[0]=1e6),e[0]}function ne_find_track_entry(_,e){for(var r=0,t=_.segment.tracks.track_entry.head;t;){if(assert(t.id==ID_TRACK_ENTRY),e==r)return t.data;r+=1,t=t.next}return null}var frame_sizes_256=Arr(256,0);function ne_read_block(_,e,r,t){var n,i,a,o,s,f,d=int_,E=[int64_t],c={val:uint64_t},l={val:uint64_t},m=frame_sizes_256,A=[uint64_t],u=[uint64_t],p=[uint64_t],T=uint64_t,y=int_,b=[0];if(t[0]=null,r>LIMIT_BLOCK)return-1;if(1!=(d=ne_read_vint(_.io,c,l)))return d;if(0==c.val||c.val>_.track_count)return-1;if(b[0]+=l.val,1!=(d=ne_read_int(_.io,E,2)))return d;if(b[0]+=2,1!=(d=ne_read_uint(_.io,u,1)))return d;switch(b[0]+=1,p[0]=0,f=(u[0]&BLOCK_FLAGS_LACING)>>1){case LACING_NONE:p[0]=1;break;case LACING_XIPH:case LACING_FIXED:case LACING_EBML:if(1!=(d=ne_read_uint(_.io,p,1)))return d;b[0]+=1,p[0]+=1}if(p[0]>256)return-1;switch(f){case LACING_NONE:m[0]=r-b[0];break;case LACING_XIPH:if(1==p)return-1;if(1!=(d=ne_read_xiph_lacing(_.io,r,b,p,m)))return d;break;case LACING_FIXED:if((r-b[0])%p[0])return-1;for(y=0;y<p[0];++y)m[y]=(r-b[0])/p|0;break;case LACING_EBML:if(1==p[0])return-1;if(1!=(d=ne_read_ebml_lacing(_.io,r,b,p,m)))return d}for(T=b[0],y=0;y<p[0];++y)T+=m[y];if(T>r)return-1;if(!ne_find_track_entry(_,c.val-1))return-1;if(s=ne_get_timecode_scale(_),assert(_.segment.cluster.tail.id==ID_CLUSTER),0!=ne_get_uint(_.segment.cluster.tail.data.timecode,A))return-1;if((n=E[0]+A[0])<0)return-1;for((i=new nestegg_packet).track=c.val-1,i.timecode=n*s*1,o=null,y=0;y<p[0];++y){if(m[y]>LIMIT_FRAME)return nestegg_free_packet(i),-1;if((a=new frame).data=[],a.length=m[y],a.data={val:a.data},d=ne_io_read(_.io,a.data,m[y]),a.data=a.data.val,1!=d)return a.data=null,a=null,nestegg_free_packet(i),-1;o?o.next=a:i.frame=a,o=a}return t[0]=i,1}function ne_null_log_callback(_,e,r,t){}function ne_is_suspend_element(_){return _==ID_SIMPLE_BLOCK||_==ID_BLOCK?1:0}var ctx_=new nestegg;function nestegg_init(_,e,r){var t,n=[0],i=[0],a=[uint64_t],o=[char_],s=ctx_;if(!(e.read&&e.seek&&e.tell))return-1;if(s.io=e,s.alloc_pool=ne_pool_init(),1!=ne_peek_element(s,n,null))return nestegg_destroy(s),-1;if(n[0]!=ID_EBML)return nestegg_destroy(s),-1;if(ne_ctx_push(s,ne_top_level_elements,s),1!=ne_parse(s,null))return nestegg_destroy(s),-1;if(0!=ne_get_uint(s.ebml.ebml_read_version,i)&&(i=1),1!=i[0])return nestegg_destroy(s),-1;if(0!=ne_get_string(s.ebml.doctype,o)&&(o[0]="matroska"),0!=strcmp(o[0],"webm"))return nestegg_destroy(s),-1;if(0!=ne_get_uint(s.ebml.doctype_read_version,a)&&(a[0]=1),a[0]<1||a[0]>2)return nestegg_destroy(s),-1;if(!s.segment.tracks.track_entry.head)return nestegg_destroy(s),-1;for(t=s.segment.tracks.track_entry.head,s.track_count=0;t;)s.track_count+=1,t=t.next;return _[0]=s,0}function nestegg_destroy(_){}function nestegg_track_count(_,e){return e[0]=_.track_count,0}function nestegg_track_type(_,e){var r=[uint64_t],t=ne_find_track_entry(_,e);return t?0!=ne_get_uint(t.type,r)?-1:r[0]&TRACK_TYPE_VIDEO?NESTEGG_TRACK_VIDEO:r[0]&TRACK_TYPE_AUDIO?NESTEGG_TRACK_AUDIO:-1:-1}function nestegg_track_codec_id(_,e){var r=[char_],t=ne_find_track_entry(_,e);return t?0!=ne_get_string(t.codec_id,r)?-1:0==strcmp(r[0],TRACK_ID_VP8)?NESTEGG_CODEC_VP8:0==strcmp(r[0],TRACK_ID_VORBIS)?NESTEGG_CODEC_VORBIS:-1:-1}function nestegg_track_video_params(_,e,r){var t=[uint64_t],n=ne_find_track_entry(_,e);return n?nestegg_track_type(_,e)!=NESTEGG_TRACK_VIDEO||0!=ne_get_uint(n.video.pixel_width,t)?-1:(r.width=t[0],0!=ne_get_uint(n.video.pixel_height,t)?-1:(r.height=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_bottom,t),r.crop_bottom=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_top,t),r.crop_top=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_left,t),r.crop_left=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_right,t),r.crop_right=t[0],t[0]=r.width,ne_get_uint(n.video.display_width,t),r.display_width=t[0],t[0]=r.height,ne_get_uint(n.video.display_height,t),r.display_height=t[0],0)):-1}function nestegg_read_packet(_,e){var r=int_,t=[uint64_t],n=[uint64_t];for(e[0]=null;;){if(1!=(r=ne_peek_element(_,t,n)))return r;if(ne_is_suspend_element(t))return 1!=(r=ne_read_element(_,t,n))?r:r=ne_read_block(_,t,n[0],e);if(1!=(r=ne_parse(_,null)))return r}return 1}function nestegg_free_packet(_){for(var e;_.frame;)e=_.frame,_.frame=e.next,e.data="",e="";_=""}function nestegg_packet_track(_,e){return e[0]=_[0].track,0}function nestegg_packet_count(_,e){var r=_[0].frame;for(e[0]=0;r;)e[0]+=1,r=r.next;return 0}function nestegg_packet_data(_,e,r,t){var n=_[0].frame,i=0;for(r[0]=null,t[0]=0;n;){if(i==e)return r[0]=n.data,t[0]=n.length,0;i+=1,n=n.next}return-1}VPX_IMAGE_ABI_VERSION=1;var VPX_IMG_FMT_PLANAR=256,VPX_IMG_FMT_UV_FLIP=512,VPX_IMG_FMT_HAS_ALPHA=1024,VPX_IMG_FMT_NONE=0,VPX_IMG_FMT_RGB24=1,VPX_IMG_FMT_RGB32=2,VPX_IMG_FMT_RGB565=3,VPX_IMG_FMT_RGB555=4,VPX_IMG_FMT_UYVY=5,VPX_IMG_FMT_YUY2=6,VPX_IMG_FMT_YVYU=7,VPX_IMG_FMT_BGR24=8,VPX_IMG_FMT_RGB32_LE=9,VPX_IMG_FMT_ARGB=10,VPX_IMG_FMT_ARGB_LE=11,VPX_IMG_FMT_RGB565_LE=12,VPX_IMG_FMT_RGB555_LE=13,VPX_IMG_FMT_YV12=VPX_IMG_FMT_PLANAR|VPX_IMG_FMT_UV_FLIP|1,VPX_IMG_FMT_I420=2|VPX_IMG_FMT_PLANAR,VPX_IMG_FMT_VPXYV12=VPX_IMG_FMT_PLANAR|VPX_IMG_FMT_UV_FLIP|3,VPX_IMG_FMT_VPXI420=4|VPX_IMG_FMT_PLANAR,IMG_FMT_PLANAR=VPX_IMG_FMT_PLANAR,IMG_FMT_UV_FLIP=VPX_IMG_FMT_UV_FLIP,IMG_FMT_HAS_ALPHA=VPX_IMG_FMT_HAS_ALPHA,IMG_FMT_NONE=VPX_IMG_FMT_NONE,IMG_FMT_RGB24=VPX_IMG_FMT_RGB24,IMG_FMT_RGB32=VPX_IMG_FMT_RGB32,IMG_FMT_RGB565=VPX_IMG_FMT_RGB565,IMG_FMT_RGB555=VPX_IMG_FMT_RGB555,IMG_FMT_UYVY=VPX_IMG_FMT_UYVY,IMG_FMT_YUY2=VPX_IMG_FMT_YUY2,IMG_FMT_YVYU=VPX_IMG_FMT_YVYU,IMG_FMT_BGR24=VPX_IMG_FMT_BGR24,IMG_FMT_RGB32_LE=VPX_IMG_FMT_RGB32_LE,IMG_FMT_ARGB=VPX_IMG_FMT_ARGB,IMG_FMT_ARGB_LE=VPX_IMG_FMT_ARGB_LE,IMG_FMT_RGB565_LE=VPX_IMG_FMT_RGB565_LE,IMG_FMT_RGB555_LE=VPX_IMG_FMT_RGB555_LE,IMG_FMT_YV12=VPX_IMG_FMT_YV12,IMG_FMT_I420=VPX_IMG_FMT_I420,IMG_FMT_VPXYV12=VPX_IMG_FMT_VPXYV12,IMG_FMT_VPXI420=VPX_IMG_FMT_VPXI420;function img_alloc_helper(_,e,r,t,n,i){var a,o,s=int_,f=int_,d=int_,E=int_,c=int_;switch(n||(n=1),n&n-1&&alert("goto fail"),e){case VPX_IMG_FMT_RGB32:case VPX_IMG_FMT_RGB32_LE:case VPX_IMG_FMT_ARGB:case VPX_IMG_FMT_ARGB_LE:E=32;break;case VPX_IMG_FMT_RGB24:case VPX_IMG_FMT_BGR24:E=24;break;case VPX_IMG_FMT_RGB565:case VPX_IMG_FMT_RGB565_LE:case VPX_IMG_FMT_RGB555:case VPX_IMG_FMT_RGB555_LE:case VPX_IMG_FMT_UYVY:case VPX_IMG_FMT_YUY2:case VPX_IMG_FMT_YVYU:E=16;break;case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:E=12;break;default:E=16}switch(e){case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:f=1;break;default:f=0}switch(e){case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:d=1;break;default:d=0}return o=r+(c=(1<<f)-1)&~c,a=t+(c=(1<<d)-1)&~c,s=(s=e&VPX_IMG_FMT_PLANAR?o:E*o/8)+n-1&~(n-1),_||((_=new vpx_image_t)||alert("goto fail"),_.self_allocd=1),_.img_data=i,i||(_.img_data=malloc(e&VPX_IMG_FMT_PLANAR?a*o*E/8:a*s,0),_.img_data_owner=1),_.img_data||alert("goto fail"),_.fmt=_.fmt=e,_.w=_.w=o,_.h=_.h=a,_.x_chroma_shift=_.x_chroma_shift=f,_.y_chroma_shift=_.y_chroma_shift=d,_.bps=_.bps=E,_.stride[VPX_PLANE_Y]=_.stride[VPX_PLANE_ALPHA]=s,_.stride[VPX_PLANE_U]=_.stride[VPX_PLANE_V]=s>>f,vpx_img_set_rect(_,0,0,r,t)?(vpx_img_free(_),null):_}function vpx_img_alloc(_,e,r,t,n){return img_alloc_helper(_,e,r,t,n,null)}function vpx_img_set_rect(_,e,r,t,n){var i=char_,a=0;return e+t<=_.w&&r+n<=_.h?(_.d_w=_.d_w=t,_.d_h=_.d_h=n,_.fmt&VPX_IMG_FMT_PLANAR?(i=_.img_data,a=_.img_data_off,_.fmt&VPX_IMG_FMT_HAS_ALPHA&&(_.planes[VPX_PLANE_ALPHA]=i,_.planes_off[VPX_PLANE_ALPHA]=a+e+r*_.stride[VPX_PLANE_ALPHA],a+=_.h*_.stride[VPX_PLANE_ALPHA]),_.planes[VPX_PLANE_Y]=i,_.planes_off[VPX_PLANE_Y]=a+e+r*_.stride[VPX_PLANE_Y],a+=_.h*_.stride[VPX_PLANE_Y],_.fmt&VPX_IMG_FMT_UV_FLIP?(_.planes[VPX_PLANE_V]=i,_.planes_off[VPX_PLANE_V]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_V],a+=(_.h>>_.y_chroma_shift)*_.stride[VPX_PLANE_V],_.planes[VPX_PLANE_U]=i,_.planes_off[VPX_PLANE_U]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_U]):(_.planes[VPX_PLANE_U]=i,_.planes_off[VPX_PLANE_U]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_U],a+=(_.h>>_.y_chroma_shift)*_.stride[VPX_PLANE_U],_.planes[VPX_PLANE_V]=i,_.planes_off[VPX_PLANE_V]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_V])):(_.planes[VPX_PLANE_PACKED]=_.img_data,_.img_data_of,parseInt(e*_.bps/8+r*_.stride[VPX_PLANE_PACKED],10)),0):-1}function vpx_img_free(_){_&&(_.img_data&&_.img_data_owner&&(_.img_data=""),_.self_allocd&&(_=""))}var bool_decoder=function(){this.input=char_,this.input_off=0,this.input_len=size_t,this.range=int_,this.value=int_,this.bit_count=int_};function init_bool_decoder(_,e,r,t){t>=2?(_.value=e[r+0]<<8|e[r+1],_.input=e,_.input_off=r+2,_.input_len=t-2):(_.value=0,_.input=null,_.input_len=0),_.range=255,_.bit_count=0}function bool_get(_,e){var r=1+((_.range-1)*e>>8),t=r<<8,n=int_;for(_.value>=t?(n=1,_.range-=r,_.value-=t):(n=0,_.range=r);_.range<128;)_.value<<=1,_.range<<=1,8==++_.bit_count&&(_.bit_count=0,_.input_len&&(_.value|=_.input[_.input_off++],_.input_len--));return n}function bool_get_bit(_){return bool_get(_,128)}function bool_get_uint(_,e){var r=0,t=int_;for(t=e-1;t>=0;t--)r|=bool_get_bit(_)<<t;return r}function bool_get_int(_,e){var r=0,t=int_;for(t=e-1;t>=0;t--)r|=bool_get_bit(_)<<t;return bool_get_bit(_)?-r:r}function bool_maybe_get_int(_,e){return bool_get_bit(_)?bool_get_int(_,e):0}function bool_read_tree(_,e,r,t){var n=0;if(void 0!==t)for(;(n=e[n+bool_get(_,r[t+(n>>1)])])>0;);else for(;(n=e[n+bool_get(_,r[n>>1])])>0;);return-n}function BITS_MASK(_){return(1<<_)-1}function BITS_GET(_,e,r){return _>>e&BITS_MASK(r)}var vp8_frame_hdr=function(){this.is_keyframe=int_,this.is_experimental=int_,this.version=int_,this.is_shown=int_,this.part0_sz=int_,this.kf=new Object({w:int_,h:int_,scale_w:int_,scale_h:int_}),this.frame_size_updated=int_},MB_FEATURE_TREE_PROBS=3,MAX_MB_SEGMENTS=4,vp8_segment_hdr=function(){this.enabled=int_,this.update_data=int_,this.update_map=int_,this.abs_=int_,this.tree_probs=new Array(MB_FEATURE_TREE_PROBS),this.lf_level=new Array(MAX_MB_SEGMENTS),this.quant_idx=new Array(MAX_MB_SEGMENTS)},BLOCK_CONTEXTS=4,vp8_loopfilter_hdr=function(){this.use_simple=int_,this.level=int_,this.sharpness=int_,this.delta_enabled=int_,this.ref_delta=new Array(BLOCK_CONTEXTS),this.mode_delta=new Array(BLOCK_CONTEXTS)},MAX_PARTITIONS=8,vp8_token_hdr=function(){this.partitions=int_,this.partition_sz=new Array(MAX_PARTITIONS)},vp8_quant_hdr=function(){this.q_index=int_,this.delta_update=int_,this.y1_dc_delta_q=int_,this.y2_dc_delta_q=int_,this.y2_ac_delta_q=int_,this.uv_dc_delta_q=int_,this.uv_ac_delta_q=int_},vp8_reference_hdr=function(){this.refresh_last=int_,this.refresh_gf=int_,this.refresh_arf=int_,this.copy_gf=int_,this.copy_arf=int_,this.sign_bias=new Array(4),this.refresh_entropy=int_},BLOCK_TYPES=4,PREV_COEF_CONTEXTS=3,COEF_BANDS=8,ENTROPY_NODES=11,coeff_probs_table_t=function(){return ArrM(new Array(BLOCK_TYPES,COEF_BANDS,PREV_COEF_CONTEXTS,ENTROPY_NODES),char_)},MV_PROB_CNT=19,mv_component_probs_t=function(){return new Array(MV_PROB_CNT)},Arr_1056=Arr(1056,0),vp8_entropy_hdr=function(){this.coeff_probs=new coeff_probs_table_t,this.coeff_probs_=Arr(1056,0),this.mv_probs=Arr_new(2,mv_component_probs_t),this.coeff_skip_enabled=int_,this.coeff_skip_prob=char_,this.y_mode_probs=new Array(0,0,0,0),this.uv_mode_probs=new Array(0,0,0),this.prob_inter=char_,this.prob_last=char_,this.prob_gf=char_},CURRENT_FRAME=0,LAST_FRAME=1,GOLDEN_FRAME=2,ALTREF_FRAME=3,NUM_REF_FRAMES=4,filter_t=function(){return new Array(6)},mv=function(){this.d={x:int16_t,y:int16_t}},mb_base_info=function(){this.y_mode=char_,this.uv_mode=char_,this.segment_id=char_,this.ref_frame=char_,this.skip_coeff=char_,this.need_mc_border=char_,this.partitioning=null,this.mv=new mv,this.eob_mask=int_},mb_info=function(){this.base=new mb_base_info,this.splitt=new Object({mvs:Arr_new(16,mv),modes:new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)})},token_entropy_ctx_t=function(){return new Array(9)},token_decoder=function(){this.bool=new bool_decoder,this.left_token_entropy_ctx=new token_entropy_ctx_t,this.coeffs=short_},TOKEN_BLOCK_Y1=0,TOKEN_BLOCK_UV=1,TOKEN_BLOCK_Y2=2,TOKEN_BLOCK_TYPES=3,dequant_factors=function(){this.quant_idx=int_,this.factor=ArrM(new Array(TOKEN_BLOCK_TYPES,2),short_)},ref_cnt_img=function(){this.img=new vpx_image_t,this.ref_cnt=int_},vp8_decoder_ctx=function(){this.error=[],this.frame_cnt=int_,this.frame_hdr=new vp8_frame_hdr,this.segment_hdr=new vp8_segment_hdr,this.loopfilter_hdr=new vp8_loopfilter_hdr,this.token_hdr=new vp8_token_hdr,this.quant_hdr=new vp8_quant_hdr,this.reference_hdr=new vp8_reference_hdr,this.entropy_hdr=new vp8_entropy_hdr,this.saved_entropy=new vp8_entropy_hdr,this.saved_entropy_valid=int_,this.mb_rows=int_,this.mb_cols=int_,this.mb_info_storage=null,this.mb_info_storage_off=0,this.mb_info_storage_object=mb_info,this.mb_info_rows_storage=null,this.mb_info_rows_storage_off=0,this.mb_info_rows_storage_object=mb_info,this.mb_info_rows=null,this.mb_info_rows_off=0,this.above_token_entropy_ctx=null,this.above_token_entropy_ctx_object=token_entropy_ctx_t,this.tokens=Arr_new(MAX_PARTITIONS,token_decoder),this.dequant_factors=Arr_new(MAX_MB_SEGMENTS,dequant_factors),this.frame_strg=Arr_new(NUM_REF_FRAMES,ref_cnt_img),this.ref_frames=Arr_new(NUM_REF_FRAMES,ref_cnt_img),this.ref_frame_offsets=new Array(0,0,0,0),this.ref_frame_offsets_=new Array(0,0,0,0),this.subpixel_filters=new filter_t};function CLAMP_255(_){return _<0?0:_>255?255:_}function vp8_dixie_walsh(_,e,r,t){var n=int_,i=int_,a=int_,o=int_,s=int_,f=int_,d=int_,E=int_,c=int_,l=_,m=e,A=r,u=t;for(n=0;n<4;n++)i=l[m+0]+l[m+12],a=l[m+4]+l[m+8],o=l[m+4]-l[m+8],s=l[m+0]-l[m+12],A[u+0]=i+a,A[u+4]=o+s,A[u+8]=i-a,A[u+12]=s-o,m++,u++;for(l=r,m=t,A=r,u=t,n=0;n<4;n++)f=(i=l[m+0]+l[m+3])+(a=l[m+1]+l[m+2]),d=(o=l[m+1]-l[m+2])+(s=l[m+0]-l[m+3]),E=i-a,c=s-o,A[u+0]=f+3>>3,A[u+1]=d+3>>3,A[u+2]=E+3>>3,A[u+3]=c+3>>3,m+=4,u+=4}var cospi8sqrt2minus1=20091,sinpi8sqrt2=35468;function idct_columns(_,e,r,t){var n=int_,i=int_,a=int_,o=int_,s=int_,f=_,d=e,E=r,c=t;for(n=0;n<4;n++)i=f[d+0]+f[d+8],a=f[d+0]-f[d+8],o=(f[d+4]*sinpi8sqrt2>>16)-(f[d+12]+(f[d+12]*cospi8sqrt2minus1>>16)),s=f[d+4]+(f[d+4]*cospi8sqrt2minus1>>16)+(f[d+12]*sinpi8sqrt2>>16),E[c+0]=i+s,E[c+12]=i-s,E[c+4]=a+o,E[c+8]=a-o,d++,c++}var tmp_2=Arr(16,0);function vp8_dixie_idct_add(_,e,r,t,n,i,a){var o=int_,s=int_,f=int_,d=int_,E=int_;for(idct_columns(i,a,tmp_2,0),i=tmp_2,a=0,o=0;o<4;o++)s=i[a+0]+i[a+2],f=i[a+0]-i[a+2],d=(i[a+1]*sinpi8sqrt2>>16)-(i[a+3]+(i[a+3]*cospi8sqrt2minus1>>16)),E=i[a+1]+(i[a+1]*cospi8sqrt2minus1>>16)+(i[a+3]*sinpi8sqrt2>>16),_[e+0]=r[t+0]+(s+E+4>>3),_[e+3]=r[t+3]+(s-E+4>>3),_[e+1]=r[t+1]+(f+d+4>>3),_[e+2]=r[t+2]+(f-d+4>>3),a+=4,e+=n,t+=n}var k_coeff_entropy_update_probs=new Array(new Array(new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(176,246,255,255,255,255,255,255,255,255,255),new Array(223,241,252,255,255,255,255,255,255,255,255),new Array(249,253,253,255,255,255,255,255,255,255,255)),new Array(new Array(255,244,252,255,255,255,255,255,255,255,255),new Array(234,254,254,255,255,255,255,255,255,255,255),new Array(253,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,246,254,255,255,255,255,255,255,255,255),new Array(239,253,254,255,255,255,255,255,255,255,255),new Array(254,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,248,254,255,255,255,255,255,255,255,255),new Array(251,255,254,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(251,254,254,255,255,255,255,255,255,255,255),new Array(254,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,253,255,254,255,255,255,255,255,255),new Array(250,255,254,255,254,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(217,255,255,255,255,255,255,255,255,255,255),new Array(225,252,241,253,255,255,254,255,255,255,255),new Array(234,250,241,250,253,255,253,254,255,255,255)),new Array(new Array(255,254,255,255,255,255,255,255,255,255,255),new Array(223,254,254,255,255,255,255,255,255,255,255),new Array(238,253,254,254,255,255,255,255,255,255,255)),new Array(new Array(255,248,254,255,255,255,255,255,255,255,255),new Array(249,254,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,255,255,255,255,255,255,255,255,255),new Array(247,254,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(252,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,254,255,255,255,255,255,255,255,255),new Array(253,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,253,255,255,255,255,255,255,255,255),new Array(250,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(186,251,250,255,255,255,255,255,255,255,255),new Array(234,251,244,254,255,255,255,255,255,255,255),new Array(251,251,243,253,254,255,254,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(236,253,254,255,255,255,255,255,255,255,255),new Array(251,253,253,254,254,255,255,255,255,255,255)),new Array(new Array(255,254,254,255,255,255,255,255,255,255,255),new Array(254,254,254,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,255,255,255,255,255,255,255,255,255),new Array(254,254,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(248,255,255,255,255,255,255,255,255,255,255),new Array(250,254,252,254,255,255,255,255,255,255,255),new Array(248,254,249,253,255,255,255,255,255,255,255)),new Array(new Array(255,253,253,255,255,255,255,255,255,255,255),new Array(246,253,253,255,255,255,255,255,255,255,255),new Array(252,254,251,254,254,255,255,255,255,255,255)),new Array(new Array(255,254,252,255,255,255,255,255,255,255,255),new Array(248,254,253,255,255,255,255,255,255,255,255),new Array(253,255,254,254,255,255,255,255,255,255,255)),new Array(new Array(255,251,254,255,255,255,255,255,255,255,255),new Array(245,251,254,255,255,255,255,255,255,255,255),new Array(253,253,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,251,253,255,255,255,255,255,255,255,255),new Array(252,253,254,255,255,255,255,255,255,255,255),new Array(255,254,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,252,255,255,255,255,255,255,255,255,255),new Array(249,255,254,255,255,255,255,255,255,255,255),new Array(255,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,253,255,255,255,255,255,255,255,255),new Array(250,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)))),k_default_y_mode_probs=new Array(112,86,140,37),k_default_uv_mode_probs=new Array(162,101,204),k_default_coeff_probs=new Array(new Array(new Array(new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128)),new Array(new Array(253,136,254,255,228,219,128,128,128,128,128),new Array(189,129,242,255,227,213,255,219,128,128,128),new Array(106,126,227,252,214,209,255,255,128,128,128)),new Array(new Array(1,98,248,255,236,226,255,255,128,128,128),new Array(181,133,238,254,221,234,255,154,128,128,128),new Array(78,134,202,247,198,180,255,219,128,128,128)),new Array(new Array(1,185,249,255,243,255,128,128,128,128,128),new Array(184,150,247,255,236,224,128,128,128,128,128),new Array(77,110,216,255,236,230,128,128,128,128,128)),new Array(new Array(1,101,251,255,241,255,128,128,128,128,128),new Array(170,139,241,252,236,209,255,255,128,128,128),new Array(37,116,196,243,228,255,255,255,128,128,128)),new Array(new Array(1,204,254,255,245,255,128,128,128,128,128),new Array(207,160,250,255,238,128,128,128,128,128,128),new Array(102,103,231,255,211,171,128,128,128,128,128)),new Array(new Array(1,152,252,255,240,255,128,128,128,128,128),new Array(177,135,243,255,234,225,128,128,128,128,128),new Array(80,129,211,255,194,224,128,128,128,128,128)),new Array(new Array(1,1,255,128,128,128,128,128,128,128,128),new Array(246,1,255,128,128,128,128,128,128,128,128),new Array(255,128,128,128,128,128,128,128,128,128,128))),new Array(new Array(new Array(198,35,237,223,193,187,162,160,145,155,62),new Array(131,45,198,221,172,176,220,157,252,221,1),new Array(68,47,146,208,149,167,221,162,255,223,128)),new Array(new Array(1,149,241,255,221,224,255,255,128,128,128),new Array(184,141,234,253,222,220,255,199,128,128,128),new Array(81,99,181,242,176,190,249,202,255,255,128)),new Array(new Array(1,129,232,253,214,197,242,196,255,255,128),new Array(99,121,210,250,201,198,255,202,128,128,128),new Array(23,91,163,242,170,187,247,210,255,255,128)),new Array(new Array(1,200,246,255,234,255,128,128,128,128,128),new Array(109,178,241,255,231,245,255,255,128,128,128),new Array(44,130,201,253,205,192,255,255,128,128,128)),new Array(new Array(1,132,239,251,219,209,255,165,128,128,128),new Array(94,136,225,251,218,190,255,255,128,128,128),new Array(22,100,174,245,186,161,255,199,128,128,128)),new Array(new Array(1,182,249,255,232,235,128,128,128,128,128),new Array(124,143,241,255,227,234,128,128,128,128,128),new Array(35,77,181,251,193,211,255,205,128,128,128)),new Array(new Array(1,157,247,255,236,231,255,255,128,128,128),new Array(121,141,235,255,225,227,255,255,128,128,128),new Array(45,99,188,251,195,217,255,224,128,128,128)),new Array(new Array(1,1,251,255,213,255,128,128,128,128,128),new Array(203,1,248,255,255,128,128,128,128,128,128),new Array(137,1,177,255,224,255,128,128,128,128,128))),new Array(new Array(new Array(253,9,248,251,207,208,255,192,128,128,128),new Array(175,13,224,243,193,185,249,198,255,255,128),new Array(73,17,171,221,161,179,236,167,255,234,128)),new Array(new Array(1,95,247,253,212,183,255,255,128,128,128),new Array(239,90,244,250,211,209,255,255,128,128,128),new Array(155,77,195,248,188,195,255,255,128,128,128)),new Array(new Array(1,24,239,251,218,219,255,205,128,128,128),new Array(201,51,219,255,196,186,128,128,128,128,128),new Array(69,46,190,239,201,218,255,228,128,128,128)),new Array(new Array(1,191,251,255,255,128,128,128,128,128,128),new Array(223,165,249,255,213,255,128,128,128,128,128),new Array(141,124,248,255,255,128,128,128,128,128,128)),new Array(new Array(1,16,248,255,255,128,128,128,128,128,128),new Array(190,36,230,255,236,255,128,128,128,128,128),new Array(149,1,255,128,128,128,128,128,128,128,128)),new Array(new Array(1,226,255,128,128,128,128,128,128,128,128),new Array(247,192,255,128,128,128,128,128,128,128,128),new Array(240,128,255,128,128,128,128,128,128,128,128)),new Array(new Array(1,134,252,255,255,128,128,128,128,128,128),new Array(213,62,250,255,255,128,128,128,128,128,128),new Array(55,93,255,128,128,128,128,128,128,128,128)),new Array(new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128))),new Array(new Array(new Array(202,24,213,235,186,191,220,160,240,175,255),new Array(126,38,182,232,169,184,228,174,255,187,128),new Array(61,46,138,219,151,178,240,170,255,216,128)),new Array(new Array(1,112,230,250,199,191,247,159,255,255,128),new Array(166,109,228,252,211,215,255,174,128,128,128),new Array(39,77,162,232,172,180,245,178,255,255,128)),new Array(new Array(1,52,220,246,198,199,249,220,255,255,128),new Array(124,74,191,243,183,193,250,221,255,255,128),new Array(24,71,130,219,154,170,243,182,255,255,128)),new Array(new Array(1,182,225,249,219,240,255,224,128,128,128),new Array(149,150,226,252,216,205,255,171,128,128,128),new Array(28,108,170,242,183,194,254,223,255,255,128)),new Array(new Array(1,81,230,252,204,203,255,192,128,128,128),new Array(123,102,209,247,188,196,255,233,128,128,128),new Array(20,95,153,243,164,173,255,203,128,128,128)),new Array(new Array(1,222,248,255,216,213,128,128,128,128,128),new Array(168,175,246,252,235,205,255,255,128,128,128),new Array(47,116,215,255,211,212,255,255,128,128,128)),new Array(new Array(1,121,236,253,212,214,255,255,128,128,128),new Array(141,84,213,252,201,202,255,219,128,128,128),new Array(42,80,160,240,162,185,255,205,128,128,128)),new Array(new Array(1,1,255,128,128,128,128,128,128,128,128),new Array(244,1,255,128,128,128,128,128,128,128,128),new Array(238,1,255,128,128,128,128,128,128,128,128)))),k_mv_entropy_update_probs=new Array(new Array(237,246,253,253,254,254,254,254,254,254,254,254,254,254,250,250,252,254,254),new Array(231,243,245,253,254,254,254,254,254,254,254,254,254,254,251,251,254,254,254)),k_default_mv_probs=function(){return new Array(new Array(162,128,225,146,172,147,214,39,156,128,129,132,75,145,178,206,239,254,254),new Array(164,128,204,170,119,235,140,230,228,128,130,130,74,148,180,203,236,254,254))},dc_q_lookup=new Array(4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157),ac_q_lookup=new Array(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284),kf_y_mode_probs=new Array(145,156,163,128),kf_uv_mode_probs=new Array(142,114,183),kf_b_mode_probs=new Array(new Array(new Array(231,120,48,89,115,113,120,152,112),new Array(152,179,64,126,170,118,46,70,95),new Array(175,69,143,80,85,82,72,155,103),new Array(56,58,10,171,218,189,17,13,152),new Array(144,71,10,38,171,213,144,34,26),new Array(114,26,17,163,44,195,21,10,173),new Array(121,24,80,195,26,62,44,64,85),new Array(170,46,55,19,136,160,33,206,71),new Array(63,20,8,114,114,208,12,9,226),new Array(81,40,11,96,182,84,29,16,36)),new Array(new Array(134,183,89,137,98,101,106,165,148),new Array(72,187,100,130,157,111,32,75,80),new Array(66,102,167,99,74,62,40,234,128),new Array(41,53,9,178,241,141,26,8,107),new Array(104,79,12,27,217,255,87,17,7),new Array(74,43,26,146,73,166,49,23,157),new Array(65,38,105,160,51,52,31,115,128),new Array(87,68,71,44,114,51,15,186,23),new Array(47,41,14,110,182,183,21,17,194),new Array(66,45,25,102,197,189,23,18,22)),new Array(new Array(88,88,147,150,42,46,45,196,205),new Array(43,97,183,117,85,38,35,179,61),new Array(39,53,200,87,26,21,43,232,171),new Array(56,34,51,104,114,102,29,93,77),new Array(107,54,32,26,51,1,81,43,31),new Array(39,28,85,171,58,165,90,98,64),new Array(34,22,116,206,23,34,43,166,73),new Array(68,25,106,22,64,171,36,225,114),new Array(34,19,21,102,132,188,16,76,124),new Array(62,18,78,95,85,57,50,48,51)),new Array(new Array(193,101,35,159,215,111,89,46,111),new Array(60,148,31,172,219,228,21,18,111),new Array(112,113,77,85,179,255,38,120,114),new Array(40,42,1,196,245,209,10,25,109),new Array(100,80,8,43,154,1,51,26,71),new Array(88,43,29,140,166,213,37,43,154),new Array(61,63,30,155,67,45,68,1,209),new Array(142,78,78,16,255,128,34,197,171),new Array(41,40,5,102,211,183,4,1,221),new Array(51,50,17,168,209,192,23,25,82)),new Array(new Array(125,98,42,88,104,85,117,175,82),new Array(95,84,53,89,128,100,113,101,45),new Array(75,79,123,47,51,128,81,171,1),new Array(57,17,5,71,102,57,53,41,49),new Array(115,21,2,10,102,255,166,23,6),new Array(38,33,13,121,57,73,26,1,85),new Array(41,10,67,138,77,110,90,47,114),new Array(101,29,16,10,85,128,101,196,26),new Array(57,18,10,102,102,213,34,20,43),new Array(117,20,15,36,163,128,68,1,26)),new Array(new Array(138,31,36,171,27,166,38,44,229),new Array(67,87,58,169,82,115,26,59,179),new Array(63,59,90,180,59,166,93,73,154),new Array(40,40,21,116,143,209,34,39,175),new Array(57,46,22,24,128,1,54,17,37),new Array(47,15,16,183,34,223,49,45,183),new Array(46,17,33,183,6,98,15,32,183),new Array(65,32,73,115,28,128,23,128,205),new Array(40,3,9,115,51,192,18,6,223),new Array(87,37,9,115,59,77,64,21,47)),new Array(new Array(104,55,44,218,9,54,53,130,226),new Array(64,90,70,205,40,41,23,26,57),new Array(54,57,112,184,5,41,38,166,213),new Array(30,34,26,133,152,116,10,32,134),new Array(75,32,12,51,192,255,160,43,51),new Array(39,19,53,221,26,114,32,73,255),new Array(31,9,65,234,2,15,1,118,73),new Array(88,31,35,67,102,85,55,186,85),new Array(56,21,23,111,59,205,45,37,192),new Array(55,38,70,124,73,102,1,34,98)),new Array(new Array(102,61,71,37,34,53,31,243,192),new Array(69,60,71,38,73,119,28,222,37),new Array(68,45,128,34,1,47,11,245,171),new Array(62,17,19,70,146,85,55,62,70),new Array(75,15,9,9,64,255,184,119,16),new Array(37,43,37,154,100,163,85,160,1),new Array(63,9,92,136,28,64,32,201,85),new Array(86,6,28,5,64,255,25,248,1),new Array(56,8,17,132,137,255,55,116,128),new Array(58,15,20,82,135,57,26,121,40)),new Array(new Array(164,50,31,137,154,133,25,35,218),new Array(51,103,44,131,131,123,31,6,158),new Array(86,40,64,135,148,224,45,183,128),new Array(22,26,17,131,240,154,14,1,209),new Array(83,12,13,54,192,255,68,47,28),new Array(45,16,21,91,64,222,7,1,197),new Array(56,21,39,155,60,138,23,102,213),new Array(85,26,85,85,128,128,32,146,171),new Array(18,11,7,63,144,171,4,4,246),new Array(35,27,10,146,174,171,12,26,128)),new Array(new Array(190,80,35,99,180,80,126,54,45),new Array(85,126,47,87,176,51,41,20,32),new Array(101,75,128,139,118,146,116,128,85),new Array(56,41,15,176,236,85,37,9,62),new Array(146,36,19,30,171,255,97,27,20),new Array(71,30,17,119,118,255,17,18,138),new Array(101,38,60,138,55,70,43,26,142),new Array(138,45,61,62,219,1,81,188,64),new Array(32,41,20,117,151,142,20,21,163),new Array(112,19,12,61,195,128,48,4,24))),kf_y_mode_tree=new Array(-B_PRED,2,4,6,-DC_PRED,-V_PRED,-H_PRED,-TM_PRED),y_mode_tree=new Array(-DC_PRED,2,4,6,-V_PRED,-H_PRED,-TM_PRED,-B_PRED),uv_mode_tree=new Array(-DC_PRED,2,-V_PRED,4,-H_PRED,-TM_PRED),b_mode_tree=new Array(-B_DC_PRED,2,-B_TM_PRED,4,-B_VE_PRED,6,8,12,-B_HE_PRED,10,-B_RD_PRED,-B_VR_PRED,-B_LD_PRED,14,-B_VL_PRED,16,-B_HD_PRED,-B_HU_PRED),small_mv_tree=new Array(2,8,4,6,-0,-1,-2,-3,10,12,-4,-5,-6,-7),mv_ref_tree=new Array(-ZEROMV,2,-NEARESTMV,4,-NEARMV,6,-NEWMV,-SPLITMV),submv_ref_tree=new Array(-LEFT4X4,2,-ABOVE4X4,4,-ZERO4X4,-NEW4X4),split_mv_tree=new Array(-3,2,-2,4,-0,-1),default_b_mode_probs=new Array(120,90,79,133,87,85,80,111,151),mv_counts_to_probs=new Array(new Array(7,1,1,143),new Array(14,18,14,107),new Array(135,64,57,68),new Array(60,56,128,65),new Array(159,134,128,34),new Array(234,188,128,28)),split_mv_probs=new Array(110,111,150),submv_ref_probs2=new Array(new Array(147,136,18),new Array(106,145,1),new Array(179,121,1),new Array(223,1,34),new Array(208,1,1)),mv_partitions=new Array(new Array(0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1),new Array(0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1),new Array(0,0,1,1,0,0,1,1,2,2,3,3,2,2,3,3),new Array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)),mv_clamp_rect=function(){this.to_left=int_,this.to_right=int_,this.to_top=int_,this.to_bottom=int_};function clamp_mv(_,e){var r=new mv;return r.d.x=_.d.x<e.to_left?e.to_left:_.d.x,r.d.x=_.d.x>e.to_right?e.to_right:r.d.x,r.d.y=_.d.y<e.to_top?e.to_top:_.d.y,r.d.y=_.d.y>e.to_bottom?e.to_bottom:r.d.y,r}function read_segment_id(_,e){return bool_get(_,e.tree_probs[0])?2+bool_get(_,e.tree_probs[2]):bool_get(_,e.tree_probs[1])}function above_block_mode(_,e,r){if(r<4)switch(e.base.y_mode){case DC_PRED:return B_DC_PRED;case V_PRED:return B_VE_PRED;case H_PRED:return B_HE_PRED;case TM_PRED:return B_TM_PRED;case B_PRED:return e.splitt.mvs[r+12].d.x;default:assert(0)}return _.splitt.mvs[r-4].d.x}function left_block_mode(_,e,r){if(!(3&r))switch(e.base.y_mode){case DC_PRED:return B_DC_PRED;case V_PRED:return B_VE_PRED;case H_PRED:return B_HE_PRED;case TM_PRED:return B_TM_PRED;case B_PRED:return e.splitt.mvs[r+3].d.x;default:assert(0)}return _.splitt.mvs[r-1].d.x}function decode_kf_mb_mode(_,e,r,t,n,i,a){var o,s;if((o=bool_read_tree(a,kf_y_mode_tree,kf_y_mode_probs))==B_PRED){var f=int_;for(f=0;f<16;f++){var d,E=above_block_mode(_[e],n[i],f),c=left_block_mode(_[e],r[t],f);d=bool_read_tree(a,b_mode_tree,kf_b_mode_probs[E][c]),_[e].splitt.modes[f]=_[e].splitt.mvs[f].d.x=d,_[e].splitt.mvs[f].d.y=0}}s=bool_read_tree(a,uv_mode_tree,kf_uv_mode_probs),_[e].base.y_mode=o,_[e].base.uv_mode=s,_[e].base.mv.d.x=_[e].base.mv.d.y=0,_[e].base.ref_frame=0}function decode_intra_mb_mode(_,e,r){var t,n;if((t=bool_read_tree(r,y_mode_tree,e.y_mode_probs))==B_PRED){var i=int_;for(i=0;i<16;i++){var a;a=bool_read_tree(r,b_mode_tree,default_b_mode_probs),_.splitt.modes[i]=_.splitt.mvs[i].d.x=a,_.splitt.mvs[i].d.y=0}}n=bool_read_tree(r,uv_mode_tree,e.uv_mode_probs),_.base.y_mode=t,_.base.uv_mode=n,_.base.mv.d.x=_.base.mv.d.y=0,_.base.ref_frame=CURRENT_FRAME}function read_mv_component(_,e){var r=0;if(bool_get(_,e[0])){var t=0;for(t=0;t<3;t++)r+=bool_get(_,e[9+t])<<t;for(t=9;t>3;t--)r+=bool_get(_,e[9+t])<<t;65520&r&&!bool_get(_,e[12])||(r+=8)}else r=bool_read_tree(_,small_mv_tree,e,2);return r&&bool_get(_,e[1])&&(r=-r),r<<1}function above_block_mv(_,e,r){return r<4?e.base.y_mode==SPLITMV?e.splitt.mvs[r+12]:e.base.mv:_.splitt.mvs[r-4]}function left_block_mv(_,e,r){return 3&r?_.splitt.mvs[r-1]:e.base.y_mode==SPLITMV?e.splitt.mvs[r+3]:e.base.mv}function submv_ref(_,e,r){var t=!(e.d.x||e.d.y)+0,n=!(r.d.x||r.d.y)+0,i=(e.d.x==r.d.x&&e.d.y==r.d.y)+0,a=0;return i&&t?a=4:i?a=3:n?a=2:t&&(a=1),bool_read_tree(_,submv_ref_tree,submv_ref_probs2[a])}function read_mv(_,e,r){e.d.y=read_mv_component(_,r[0]),e.d.x=read_mv_component(_,r[1])}function mv_bias(_,e,r,t){e[_.base.ref_frame]^e[r]&&(t.d.x*=-1,t.d.y*=-1)}var CNT_BEST=0,CNT_ZEROZERO=0,CNT_NEAREST=1,CNT_NEAR=2,CNT_SPLITMV=3,this_mv_1=new mv,this_mv_2=new mv;function find_near_mvs(_,e,r,t,n,i,a,o){var s=t,f=n-1,d=a,E=0,c=o,l=0;d[0].d.x=d[1].d.x=d[2].d.x=0,d[0].d.y=d[1].d.y=d[2].d.y=0,o[0]=o[1]=o[2]=o[3]=0;var m,A=t[n],u=e[r],p=s[f];(A.base.ref_frame!=CURRENT_FRAME&&((A.base.mv.d.x||A.base.mv.d.y)&&(d[++E].d.x=A.base.mv.d.x,d[E].d.y=A.base.mv.d.y,mv_bias(A,i,_.base.ref_frame,d[E]),++l),c[l]+=2),u.base.ref_frame!=CURRENT_FRAME)&&(u.base.mv.d.x||u.base.mv.d.y?((m=this_mv_1).d.x=u.base.mv.d.x,m.d.y=u.base.mv.d.y,mv_bias(u,i,_.base.ref_frame,m),m.d.x==d[E].d.x&&m.d.y==d[E].d.y||(d[++E].d.x=m.d.x,d[E].d.y=m.d.y,++l),c[l]+=2):o[CNT_ZEROZERO]+=2);p.base.ref_frame!=CURRENT_FRAME&&(p.base.mv.d.x||p.base.mv.d.y?((m=this_mv_2).d.x=p.base.mv.d.x,m.d.y=p.base.mv.d.y,mv_bias(p,i,_.base.ref_frame,m),m.d.x==d[E].d.x&&m.d.y==d[E].d.y||(d[++E].d.x=m.d.x,d[E].d.y=m.d.y,++l),c[l]+=1):o[CNT_ZEROZERO]+=1);if(o[CNT_SPLITMV]&&d[E].d.x==a[CNT_NEAREST].d.x&&d[E].d.y==a[CNT_NEAREST].d.y&&(o[CNT_NEAREST]+=1),o[CNT_SPLITMV]=2*((A.base.y_mode==SPLITMV)+(u.base.y_mode==SPLITMV))+(p.base.y_mode==SPLITMV),o[CNT_NEAR]>o[CNT_NEAREST]){var T,y=int_;y=o[CNT_NEAREST],o[CNT_NEAREST]=o[CNT_NEAR],o[CNT_NEAR]=y,y=a[CNT_NEAREST].d.x,T=a[CNT_NEAREST].d.y,a[CNT_NEAREST].d.x=a[CNT_NEAR].d.x,a[CNT_NEAREST].d.y=a[CNT_NEAR].d.y,a[CNT_NEAR].d.x=y,a[CNT_NEAR].d.y=T}o[CNT_NEAREST]>=o[CNT_BEST]&&(a[CNT_BEST].d.x=a[CNT_NEAREST].d.x,a[CNT_BEST].d.y=a[CNT_NEAREST].d.y)}function decode_split_mv(_,e,r,t,n,i){var a,o,s=int_,f=int_,d=int_;for(o=bool_read_tree(i,split_mv_tree,split_mv_probs),a=mv_partitions[o],_.base.partitioning=o,s=0,d=0;d<65535;s++){var E,c,l=new mv;for(f=0;s!=a[f];f++);switch(submv_ref(i,E=left_block_mv(_,e,f),c=above_block_mv(_,r,f))){case LEFT4X4:l=E;break;case ABOVE4X4:l=c;break;case ZERO4X4:l.d.x=l.d.y=0;break;case NEW4X4:read_mv(i,l,t.mv_probs),l.d.x+=n.d.x,l.d.y+=n.d.y;break;default:assert(0)}for(;f<16;f++)s==a[f]&&(_.splitt.mvs[f].d.x=l.d.x,_.splitt.mvs[f].d.y=l.d.y,d|=1<<f)}}function need_mc_border(_,e,r,t,n,i){return e+=_.d.x>>3,r+=_.d.y>>3,e>>1<2||n-(e+t)>>1<3||r>>1<2||i-(r+t)>>1<3}var near_mvs_4=Arr_new(4,mv),mv_cnts_4=new Array(0,0,0,0),probs_4=new Array(0,0,0,0),chroma_mv_4=Arr_new(4,mv),clamped_best_mv_1=new mv;function decode_mvs(_,e,r,t,n,i,a,o,s){var f,d,E,c,l=_.entropy_hdr,m=near_mvs_4,A=clamped_best_mv_1,u=mv_cnts_4,p=probs_4,T=int_;switch(e[r].base.ref_frame=bool_get(s,l.prob_last)?2+bool_get(s,l.prob_gf):1,find_near_mvs(e[r],e,r-1,i,a,_.reference_hdr.sign_bias,m,u),p[0]=mv_counts_to_probs[u[0]][0],p[1]=mv_counts_to_probs[u[1]][1],p[2]=mv_counts_to_probs[u[2]][2],p[3]=mv_counts_to_probs[u[3]][3],(e=e[r]).base.y_mode=bool_read_tree(s,mv_ref_tree,p),e.base.uv_mode=e.base.y_mode,e.base.need_mc_border=0,f=-o.to_left-128>>3,d=-o.to_top-128>>3,E=16*_.mb_cols,c=16*_.mb_rows,e.base.y_mode){case NEARESTMV:e.base.mv=clamp_mv(m[1],o);break;case NEARMV:e.base.mv=clamp_mv(m[2],o);break;case ZEROMV:return void(e.base.mv.d.x=e.base.mv.d.y=0);case NEWMV:A=clamp_mv(m[0],o),read_mv(s,e.base.mv,l.mv_probs),e.base.mv.d.x+=A.d.x,e.base.mv.d.y+=A.d.y;break;case SPLITMV:var y=chroma_mv_4;for(A=clamp_mv(m[0],o),decode_split_mv(e,t[n],i[a],l,A,s),e.base.mv.d.x=e.splitt.mvs[15].d.x,e.base.mv.d.y=e.splitt.mvs[15].d.y,T=0;T<16;T++)if(y[(T>>1&1)+(T>>2&2)].d.x+=e.splitt.mvs[T].d.x,y[(T>>1&1)+(T>>2&2)].d.y+=e.splitt.mvs[T].d.y,need_mc_border(e.splitt.mvs[T],f+4*(3&T),d+(-4&T),4,E,c)){e.base.need_mc_border=1;break}for(T=0;T<4;T++)if(y[T].d.x+=4,y[T].d.y+=4,y[T].d.x>>=2,y[T].d.y>>=2,need_mc_border(y[T],f+8*(1&T),d+8*(T>>1),16,E,c)){e.base.need_mc_border=1;break}return;default:assert(0)}need_mc_border(e.base.mv,f,d,16,E,c)&&(e.base.need_mc_border=1)}var bounds_=new mv_clamp_rect;function vp8_dixie_modemv_process_row(_,e,r,t,n){var i,a,o=0,s=0,f=int_,d=bounds_;for(a=_.mb_info_rows[1+r],s=_.mb_info_rows_off[1+r]+t,i=_.mb_info_rows[1+r-1],o=_.mb_info_rows_off[1+r-1]+t,d.to_left=-(t+1<<7),d.to_right=_.mb_cols-t<<7,d.to_top=-(r+1<<7),d.to_bottom=_.mb_rows-r<<7,f=t;f<t+n;f++)_.segment_hdr.update_map&&(a[s].base.segment_id=read_segment_id(e,_.segment_hdr)),_.entropy_hdr.coeff_skip_enabled&&(a[s].base.skip_coeff=bool_get(e,_.entropy_hdr.coeff_skip_prob)),_.frame_hdr.is_keyframe?(_.segment_hdr.update_map||(a[s].base.segment_id=0),decode_kf_mb_mode(a,s,a,s-1,i,o,e)):(bool_get(e,_.entropy_hdr.prob_inter)?decode_mvs(_,a,s,a,s-1,i,o,d,e):decode_intra_mb_mode(a[s],_.entropy_hdr,e),d.to_left-=128,d.to_right-=128),s++,o++}function vp8_dixie_modemv_init(_){var e,r,t=int_,n=new mb_info,i=0;for(e=_.mb_cols+1,r=_.mb_rows+1,_.frame_hdr.frame_size_updated&&(_.mb_info_storage=null,_.mb_info_rows_storage=null),_.mb_info_storage||(_.mb_info_storage=Arr_new(e*r,_.mb_info_storage_object),_.mb_info_storage_off=0),_.mb_info_rows_storage||(_.mb_info_rows_storage=Arr_new(r,_.mb_info_rows_storage_object),_.mb_info_rows_storage_off=new Array(r)),n=_.mb_info_storage,i=_.mb_info_storage_off+1,t=0;t<r;t++)_.mb_info_rows_storage[t]=n,_.mb_info_rows_storage_off[t]=i,i+=e;_.mb_info_rows=_.mb_info_rows_storage,_.mb_info_rows_off=_.mb_info_rows_storage_off}var EOB_CONTEXT_NODE=0,ZERO_CONTEXT_NODE=1,ONE_CONTEXT_NODE=2,LOW_VAL_CONTEXT_NODE=3,TWO_CONTEXT_NODE=4,THREE_CONTEXT_NODE=5,HIGH_LOW_CONTEXT_NODE=6,CAT_ONE_CONTEXT_NODE=7,CAT_THREEFOUR_CONTEXT_NODE=8,CAT_THREE_CONTEXT_NODE=9,CAT_FIVE_CONTEXT_NODE=10,ZERO_TOKEN=0,ONE_TOKEN=1,TWO_TOKEN=2,THREE_TOKEN=3,FOUR_TOKEN=4,DCT_VAL_CATEGORY1=5,DCT_VAL_CATEGORY2=6,DCT_VAL_CATEGORY3=7,DCT_VAL_CATEGORY4=8,DCT_VAL_CATEGORY5=9,DCT_VAL_CATEGORY6=10,DCT_EOB_TOKEN=11,MAX_ENTROPY_TOKENS=12,left_context_index=new Array(0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,5,5,6,6,7,7,8),above_context_index=new Array(0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,4,5,4,5,6,7,6,7,8);function X(_){return _*PREV_COEF_CONTEXTS*ENTROPY_NODES}var bands_x=new Array(X(0),X(1),X(2),X(3),X(6),X(4),X(5),X(6),X(6),X(6),X(6),X(6),X(6),X(6),X(6),X(7)),extrabits=new Array({min_val:0,length:-1,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:1,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:2,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:3,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:4,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:5,length:0,probs:new Array(159,0,0,0,0,0,0,0,0,0,0,0)},{min_val:7,length:1,probs:new Array(145,165,0,0,0,0,0,0,0,0,0,0)},{min_val:11,length:2,probs:new Array(140,148,173,0,0,0,0,0,0,0,0,0)},{min_val:19,length:3,probs:new Array(135,140,155,176,0,0,0,0,0,0,0,0)},{min_val:35,length:4,probs:new Array(130,134,141,157,180,0,0,0,0,0,0,0)},{min_val:67,length:10,probs:new Array(129,130,133,140,153,177,196,230,243,254,254,0)},{min_val:0,length:-1,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)}),zigzag=new Array(0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15),BLOCK_LOOP=0,DO_WHILE=1,CHECK_0_=2,CAT_FIVE_CONTEXT_NODE_0_=3,CAT_THREEFOUR_CONTEXT_NODE_0_=4,CAT_THREE_CONTEXT_NODE_0_=5,HIGH_LOW_CONTEXT_NODE_0_=6,CAT_ONE_CONTEXT_NODE_0_=7,LOW_VAL_CONTEXT_NODE_0_=8,THREE_CONTEXT_NODE_0_=9,TWO_CONTEXT_NODE_0_=10,ONE_CONTEXT_NODE_0_=11,BLOCK_FINISHED=12,END=13;function decode_mb_tokens(_,e,r,t,n,i,a,o){function s(e){y=(bool_get_bit(_)?-e:e)*P[!!p+0]}function f(e,r){if(!bool_get(_,e))return g=r,1}function d(e,r){if(!bool_get(_,e))return D=R,p<15?(++p,D+=bands_x[p],g=r,1):(g=BLOCK_FINISHED,1)}function E(_){return s(_),D=R+2*ENTROPY_NODES,p<15?(w[I+zigzag[p]]=y,++p,g=DO_WHILE,1):(w[I+zigzag[15]]=y,g=BLOCK_FINISHED,1)}function c(e,r){b+=bool_get(_,extrabits[e].probs[r])<<r}var l,m=int_,A=int_,u=int_,p=int_,T=int_,y=int_,b=int_,v=int_,h=int_,w=short_,I=0,R=0,N=char_,D=0,P=short_;h=0,i!=B_PRED&&i!=SPLITMV?(m=24,A=24,u=1,w=t,I=n+384,P=o[TOKEN_BLOCK_Y2]):(m=0,A=16,u=3,w=t,I=n,P=o[TOKEN_BLOCK_Y1]),l=a,R=u*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES;var g=BLOCK_LOOP;do{if(g==BLOCK_LOOP&&(T=e[left_context_index[m]]+r[above_context_index[m]],p=!u+0,N=l,D=R,D+=T*ENTROPY_NODES,g=DO_WHILE),g==DO_WHILE){if(f(N[(D+=bands_x[p])+EOB_CONTEXT_NODE],BLOCK_FINISHED))continue;g=CHECK_0_}if(g==CHECK_0_){if(d(N[D+ZERO_CONTEXT_NODE],CHECK_0_))continue;if(f(N[D+ONE_CONTEXT_NODE],ONE_CONTEXT_NODE_0_))continue;if(f(N[D+LOW_VAL_CONTEXT_NODE],LOW_VAL_CONTEXT_NODE_0_))continue;if(f(N[D+HIGH_LOW_CONTEXT_NODE],HIGH_LOW_CONTEXT_NODE_0_))continue;if(f(N[D+CAT_THREEFOUR_CONTEXT_NODE],CAT_THREEFOUR_CONTEXT_NODE_0_))continue;if(f(N[D+CAT_FIVE_CONTEXT_NODE],CAT_FIVE_CONTEXT_NODE_0_))continue;b=extrabits[DCT_VAL_CATEGORY6].min_val,v=extrabits[DCT_VAL_CATEGORY6].length;do{c(DCT_VAL_CATEGORY6,v),v--}while(v>=0);if(E(b))continue}if(g!=CAT_FIVE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY5].min_val,c(DCT_VAL_CATEGORY5,4),c(DCT_VAL_CATEGORY5,3),c(DCT_VAL_CATEGORY5,2),c(DCT_VAL_CATEGORY5,1),c(DCT_VAL_CATEGORY5,0),!E(b))){if(g==CAT_THREEFOUR_CONTEXT_NODE_0_){if(f(N[D+CAT_THREE_CONTEXT_NODE],CAT_THREE_CONTEXT_NODE_0_))continue;if(b=extrabits[DCT_VAL_CATEGORY4].min_val,c(DCT_VAL_CATEGORY4,3),c(DCT_VAL_CATEGORY4,2),c(DCT_VAL_CATEGORY4,1),c(DCT_VAL_CATEGORY4,0),E(b))continue}if(g!=CAT_THREE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY3].min_val,c(DCT_VAL_CATEGORY3,2),c(DCT_VAL_CATEGORY3,1),c(DCT_VAL_CATEGORY3,0),!E(b))){if(g==HIGH_LOW_CONTEXT_NODE_0_){if(f(N[D+CAT_ONE_CONTEXT_NODE],CAT_ONE_CONTEXT_NODE_0_))continue;if(b=extrabits[DCT_VAL_CATEGORY2].min_val,c(DCT_VAL_CATEGORY2,1),c(DCT_VAL_CATEGORY2,0),E(b))continue}if(g!=CAT_ONE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY1].min_val,c(DCT_VAL_CATEGORY1,0),!E(b))){if(g==LOW_VAL_CONTEXT_NODE_0_){if(f(N[D+TWO_CONTEXT_NODE],TWO_CONTEXT_NODE_0_))continue;if(f(N[D+THREE_CONTEXT_NODE],THREE_CONTEXT_NODE_0_))continue;if(E(4))continue}if(!(g==THREE_CONTEXT_NODE_0_&&E(3)||g==TWO_CONTEXT_NODE_0_&&E(2))){if(g==ONE_CONTEXT_NODE_0_){if(s(1),D=R+ENTROPY_NODES,p<15){w[I+zigzag[p]]=y,++p,g=DO_WHILE;continue}w[I+zigzag[15]]=y,g=BLOCK_FINISHED}if(g==BLOCK_FINISHED){if(h=((h=(h|(p>1)+0<<m)>>>0)|(T=(p!=!u)+0)<<31)>>>0,e[left_context_index[m]]=r[above_context_index[m]]=T,I+=16,++m<A){g=BLOCK_LOOP;continue}if(25==m){m=0,A=16,R=(u=0)*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES,I=n,P=o[TOKEN_BLOCK_Y1],g=BLOCK_LOOP;continue}if(16==m){R=(u=2)*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES,A=24,P=o[TOKEN_BLOCK_UV],g=BLOCK_LOOP;continue}}g=END}}}}}while(g!=END);return h}function reset_row_context(_){memset(_,0,0,_.length)}function reset_above_context(_,e){var r=0;for(r=0;r<e;++r)memset(_[r],0,0,_[r].length)}function reset_mb_context(_,e,r){memset(_,0,0,8),memset(e,0,0,8),r!=B_PRED&&r!=SPLITMV&&(_[8]=0,e[8]=0)}function vp8_dixie_tokens_process_row(_,e,r,t,n){var i=_.tokens[e],a=i.coeffs,o=400*t,s=int_,f=_.above_token_entropy_ctx,d=+t,E=i.left_token_entropy_ctx,c=_.mb_info_rows[1+r],l=_.mb_info_rows_off[1+r]+t;for(0==r&&reset_above_context(f,n),0==t&&reset_row_context(E),s=t;s<t+n;s++){if(memset(a,o,0,400),c[l].base.skip_coeff)reset_mb_context(E,f[d],c[l].base.y_mode),c[l].base.eob_mask=0;else{var m,A;m=_.dequant_factors,A=+c[l].base.segment_id,c[l].base.eob_mask=decode_mb_tokens(i.bool,E,f[d],a,o,c[l].base.y_mode,_.entropy_hdr.coeff_probs_,m[A].factor)}d++,l++,o+=400}}function vp8_dixie_tokens_init(_){var e=_.token_hdr.partitions;if(_.frame_hdr.frame_size_updated){var r=int_,t=25*_.mb_cols*16;for(r=0;r<e;r++)_.tokens[r].coeffs=new Array(t),_.tokens[r].coeffs||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,null);_.above_token_entropy_ctx=Arr_new(_.mb_cols,_.above_token_entropy_ctx_object),_.above_token_entropy_ctx||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,null)}}function ABS(_){return _>=0?_:-_}function saturate_int8(_){return _<-128?-128:_>127?127:_}function saturate_uint8(_){return _<0?0:_>255?255:_}function high_edge_variance(_,e,r,t){var n=_[e-2*r],i=_[e-1*r],a=_[e+0*r],o=_[e+1*r];return ABS(n-i)>t||ABS(o-a)>t}function simple_threshold(_,e,r,t){var n=_[e-2*r],i=_[e-1*r],a=_[e+0*r],o=_[e+1*r];return 2*ABS(i-a)+(ABS(n-o)>>1)<=t}function normal_threshold(_,e,r,t,n){var i=_[e-4*r],a=_[e-3*r],o=_[e-2*r],s=_[e-1*r],f=_[e+0*r],d=_[e+1*r],E=_[e+2*r],c=_[e+3*r],l=n;return simple_threshold(_,e,r,2*t+l)&&ABS(i-a)<=l&&ABS(a-o)<=l&&ABS(o-s)<=l&&ABS(c-E)<=l&&ABS(E-d)<=l&&ABS(d-f)<=l}function filter_common(_,e,r,t){var n,i=_[e-2*r],a=_[e-1*r],o=_[e+0*r],s=_[e+1*r],f=int_;f=3*(o-a),t&&(f+=saturate_int8(i-s)),n=((f=saturate_int8(f))+4>127?127:f+4)>>3,a=saturate_uint8(a+((f+3>127?127:f+3)>>3)),o=saturate_uint8(o-n),t||(i=saturate_uint8(i+(f=n+1>>1)),s=saturate_uint8(s-f)),_[e-2*r]=i,_[e-1*r]=a,_[e+0*r]=o,_[e+1*r]=s}function filter_mb_edge(_,e,r){var t,n=_[e-3*r],i=_[e-2*r],a=_[e-1*r],o=_[e+0*r],s=_[e+1*r],f=_[e+2*r],d=int_;a=saturate_uint8(a+(d=27*(t=saturate_int8(saturate_int8(i-s)+3*(o-a)))+63>>7)),o=saturate_uint8(o-d),i=saturate_uint8(i+(d=18*t+63>>7)),s=saturate_uint8(s-d),n=saturate_uint8(n+(d=9*t+63>>7)),f=saturate_uint8(f-d),_[e-3*r]=n,_[e-2*r]=i,_[e-1*r]=a,_[e+0*r]=o,_[e+1*r]=s,_[e+2*r]=f}function filter_mb_v_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,1,t,n)&&(high_edge_variance(_,e,1,i)?filter_common(_,e,1,1):filter_mb_edge(_,e,1)),e+=r}function filter_subblock_v_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,1,t,n)&&filter_common(_,e,1,high_edge_variance(_,e,1,i)),e+=r}function filter_mb_h_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,r,t,n)&&(high_edge_variance(_,e,r,i)?filter_common(_,e,r,1):filter_mb_edge(_,e,r)),e+=1}function filter_subblock_h_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,r,t,n)&&filter_common(_,e,r,high_edge_variance(_,e,r,i)),e+=1}function filter_v_edge_simple(_,e,r,t){var n=int_;for(n=0;n<16;n++)simple_threshold(_,e,1,t)&&filter_common(_,e,1,1),e+=r}function filter_h_edge_simple(_,e,r,t){var n=int_;for(n=0;n<16;n++)simple_threshold(_,e,r,t)&&filter_common(_,e,r,1),e+=1}function calculate_filter_parameters(_,e,r,t,n){var i=int_,a=int_,o=int_;i=_.loopfilter_hdr.level,_.segment_hdr.enabled&&(_.segment_hdr.abs_?i=_.segment_hdr.lf_level[e.base.segment_id]:i+=_.segment_hdr.lf_level[e.base.segment_id]),_.loopfilter_hdr.delta_enabled&&(i+=_.loopfilter_hdr.ref_delta[e.base.ref_frame],e.base.ref_frame==CURRENT_FRAME?e.base.y_mode==B_PRED&&(i+=_.loopfilter_hdr.mode_delta[0]):e.base.y_mode==ZEROMV?i+=_.loopfilter_hdr.mode_delta[1]:e.base.y_mode==SPLITMV?i+=_.loopfilter_hdr.mode_delta[3]:i+=_.loopfilter_hdr.mode_delta[2]),i>63?i=63:i<0&&(i=0),a=i,_.loopfilter_hdr.sharpness&&(a>>=_.loopfilter_hdr.sharpness>4?2:1)>9-_.loopfilter_hdr.sharpness&&(a=9-_.loopfilter_hdr.sharpness),a<1&&(a=1),o=i>=15,i>=40&&o++,i>=20&&!_.frame_hdr.is_keyframe&&o++,r[0]=i,t[0]=a,n[0]=o}function filter_row_normal(_,e,r,t){var n,i,a,o,s,f,d=0,E=0,c=0,l=0,m=int_;for(o=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],s=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_U],n=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],d=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],i=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_U],E=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_U],a=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_V],c=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_V],d+=16*(o*e+r),E+=8*(s*e+r),c+=8*(s*e+r),f=_.mb_info_rows[1+e],l=_.mb_info_rows_off[1+e]+r,m=r;m<r+t;m++){var A=[int_],u=[int_],p=[int_];calculate_filter_parameters(_,f[l],A,u,p),A=A[0],u=u[0],p=p[0],A&&(m&&(filter_mb_v_edge(n,d,o,A+2,u,p,2),filter_mb_v_edge(i,E,s,A+2,u,p,1),filter_mb_v_edge(a,c,s,A+2,u,p,1)),(f[l].base.eob_mask||f[l].base.y_mode==SPLITMV||f[l].base.y_mode==B_PRED)&&(filter_subblock_v_edge(n,d+4,o,A,u,p,2),filter_subblock_v_edge(n,d+8,o,A,u,p,2),filter_subblock_v_edge(n,d+12,o,A,u,p,2),filter_subblock_v_edge(i,E+4,s,A,u,p,1),filter_subblock_v_edge(a,c+4,s,A,u,p,1)),e&&(filter_mb_h_edge(n,d,o,A+2,u,p,2),filter_mb_h_edge(i,E,s,A+2,u,p,1),filter_mb_h_edge(a,c,s,A+2,u,p,1)),(f[l].base.eob_mask||f[l].base.y_mode==SPLITMV||f[l].base.y_mode==B_PRED)&&(filter_subblock_h_edge(n,d+4*o,o,A,u,p,2),filter_subblock_h_edge(n,d+8*o,o,A,u,p,2),filter_subblock_h_edge(n,d+12*o,o,A,u,p,2),filter_subblock_h_edge(i,E+4*s,s,A,u,p,1),filter_subblock_h_edge(a,c+4*s,s,A,u,p,1))),d+=16,E+=8,c+=8,l++}}function filter_row_simple(_,e,r,t){var n,i,a,o=0,s=0,f=int_;for(i=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],n=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],o=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],o+=16*(i*e+r),a=_.mb_info_rows[1+e],s=_.mb_info_rows_off[1+e]+r,f=r;f<r+t;f++){var d=[int_],E=[int_],c=[int_];if(calculate_filter_parameters(_,a[s],d,E,c),d[0]){var l=(a[s].base.eob_mask||a[s].base.y_mode==SPLITMV||a[s].base.y_mode==B_PRED)+0,m=2*(d[0]+2)+E[0],A=2*d[0]+E[0];f&&filter_v_edge_simple(n,o,i,m),l&&(filter_v_edge_simple(n,o+4,i,A),filter_v_edge_simple(n,o+8,i,A),filter_v_edge_simple(n,o+12,i,A)),e&&filter_h_edge_simple(n,o,i,m),l&&(filter_h_edge_simple(n,o+4*i,i,A),filter_h_edge_simple(n,o+8*i,i,A),filter_h_edge_simple(n,o+12*i,i,A))}o+=16,s++}}function vp8_dixie_loopfilter_process_row(_,e,r,t){_.loopfilter_hdr.use_simple?filter_row_simple(_,e,r,t):filter_row_normal(_,e,r,t)}var BORDER_PIXELS=16,sixtap_filters=new Array(new Array(0,0,128,0,0,0),new Array(0,-6,123,12,-1,0),new Array(2,-11,108,36,-8,1),new Array(0,-9,93,50,-6,0),new Array(3,-16,77,77,-16,3),new Array(0,-6,50,93,-9,0),new Array(1,-8,36,108,-11,2),new Array(0,-1,12,123,-6,0)),bilinear_filters=new Array(new Array(0,0,128,0,0,0),new Array(0,0,112,16,0,0),new Array(0,0,96,32,0,0),new Array(0,0,80,48,0,0),new Array(0,0,64,64,0,0),new Array(0,0,48,80,0,0),new Array(0,0,32,96,0,0),new Array(0,0,16,112,0,0));function predict_h_nxn(_,e,r,t){var n=_,i=e-1,a=int_,o=int_;for(a=0;a<t;a++)for(o=0;o<t;o++)_[e+a*r+o]=n[i+a*r]}function predict_v_nxn(_,e,r,t){var n=_,i=e-r,a=int_,o=int_;for(a=0;a<t;a++)for(o=0;o<t;o++)_[e+a*r+o]=n[i+o]}function predict_tm_nxn(_,e,r,t){var n=_,i=e-1,a=_,o=e-r,s=a[o-1],f=int_,d=int_;for(d=0;d<t;d++){for(f=0;f<t;f++)_[e+f]=CLAMP_255(n[i]+a[o+f]-s);e+=r,i+=r}}function predict_dc_nxn(_,e,r,t){var n=_,i=e-1,a=_,o=e-r,s=int_,f=int_,d=0;for(s=0;s<t;s++)d+=n[i]+a[o+s],i+=r;switch(t){case 16:d=d+16>>5;break;case 8:d=d+8>>4;break;case 4:d=d+4>>3}for(s=0;s<t;s++)for(f=0;f<t;f++)_[e+s*r+f]=d}function predict_ve_4x4(_,e,r){var t=_,n=e-r,i=int_,a=int_;for(_[e+0]=t[n-1]+2*t[n+0]+t[n+1]+2>>2,_[e+1]=t[n+0]+2*t[n+1]+t[n+2]+2>>2,_[e+2]=t[n+1]+2*t[n+2]+t[n+3]+2>>2,_[e+3]=t[n+2]+2*t[n+3]+t[n+4]+2>>2,i=1;i<4;i++)for(a=0;a<4;a++)_[e+i*r+a]=_[e+a]}function predict_he_4x4(_,e,r){var t=_,n=e-1;_[e+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+0]+2>>2}function predict_ld_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-r;_[e+0]=s[f+0]+2*s[f+1]+s[f+2]+2>>2,_[e+1]=t=s[f+1]+2*s[f+2]+s[f+3]+2>>2,_[e+2]=n=s[f+2]+2*s[f+3]+s[f+4]+2>>2,_[e+3]=i=s[f+3]+2*s[f+4]+s[f+5]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i,_[e+3]=a=s[f+4]+2*s[f+5]+s[f+6]+2>>2,_[(e+=r)+0]=n,_[e+1]=i,_[e+2]=a,_[e+3]=o=s[f+5]+2*s[f+6]+s[f+7]+2>>2,_[(e+=r)+0]=i,_[e+1]=a,_[e+2]=o,_[e+3]=s[f+6]+2*s[f+7]+s[f+7]+2>>2}function predict_rd_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-1,d=_,E=e-r;_[e+0]=t=s[f+0]+2*d[E-1]+d[E+0]+2>>2,_[e+1]=n=d[E-1]+2*d[E+0]+d[E+1]+2>>2,_[e+2]=i=d[E+0]+2*d[E+1]+d[E+2]+2>>2,_[e+3]=d[E+1]+2*d[E+2]+d[E+3]+2>>2,_[(e+=r)+0]=a=s[f+r]+2*s[f+0]+d[E-1]+2>>2,_[e+1]=t,_[e+2]=n,_[e+3]=i,_[(e+=r)+0]=o=s[f+2*r]+2*s[f+r]+s[f+0]+2>>2,_[e+1]=a,_[e+2]=t,_[e+3]=n,_[(e+=r)+0]=s[f+3*r]+2*s[f+2*r]+s[f+r]+2>>2,_[e+1]=o,_[e+2]=a,_[e+3]=t}function predict_vr_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-1,E=_,c=e-r;_[e+0]=t=E[c-1]+E[c+0]+1>>1,_[e+1]=n=E[c+0]+E[c+1]+1>>1,_[e+2]=i=E[c+1]+E[c+2]+1>>1,_[e+3]=E[c+2]+E[c+3]+1>>1,_[(e+=r)+0]=a=f[d+0]+2*E[c-1]+E[c+0]+2>>2,_[e+1]=o=E[c-1]+2*E[c+0]+E[c+1]+2>>2,_[e+2]=s=E[c+0]+2*E[c+1]+E[c+2]+2>>2,_[e+3]=E[c+1]+2*E[c+2]+E[c+3]+2>>2,_[(e+=r)+0]=f[d+r]+2*f[d+0]+E[c-1]+2>>2,_[e+1]=t,_[e+2]=n,_[e+3]=i,_[(e+=r)+0]=f[d+2*r]+2*f[d+r]+f[d+0]+2>>2,_[e+1]=a,_[e+2]=o,_[e+3]=s}function predict_vl_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-r;_[e+0]=f[d+0]+f[d+1]+1>>1,_[e+1]=t=f[d+1]+f[d+2]+1>>1,_[e+2]=n=f[d+2]+f[d+3]+1>>1,_[e+3]=i=f[d+3]+f[d+4]+1>>1,_[(e+=r)+0]=f[d+0]+2*f[d+1]+f[d+2]+2>>2,_[e+1]=a=f[d+1]+2*f[d+2]+f[d+3]+2>>2,_[e+2]=o=f[d+2]+2*f[d+3]+f[d+4]+2>>2,_[e+3]=s=f[d+3]+2*f[d+4]+f[d+5]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i,_[e+3]=f[d+4]+2*f[d+5]+f[d+6]+2>>2,_[(e+=r)+0]=a,_[e+1]=o,_[e+2]=s,_[e+3]=f[d+5]+2*f[d+6]+f[d+7]+2>>2}function predict_hd_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-1,E=_,c=e-r;_[e+0]=t=f[d+0]+E[c-1]+1>>1,_[e+1]=n=f[d+0]+2*E[c-1]+E[c+0]+2>>2,_[e+2]=E[c-1]+2*E[c+0]+E[c+1]+2>>2,_[e+3]=E[c+0]+2*E[c+1]+E[c+2]+2>>2,_[(e+=r)+0]=i=f[d+r]+f[d+0]+1>>1,_[e+1]=a=f[d+r]+2*f[d+0]+E[c-1]+2>>2,_[e+2]=t,_[e+3]=n,_[(e+=r)+0]=o=f[d+2*r]+f[d+r]+1>>1,_[e+1]=s=f[d+2*r]+2*f[d+r]+f[d+0]+2>>2,_[e+2]=i,_[e+3]=a,_[(e+=r)+0]=f[d+3*r]+f[d+2*r]+1>>1,_[e+1]=f[d+3*r]+2*f[d+2*r]+f[d+r]+2>>2,_[e+2]=o,_[e+3]=s}function predict_hu_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-1;_[e+0]=s[f+0*r]+s[f+1*r]+1>>1,_[e+1]=s[f+0*r]+2*s[f+1*r]+s[f+2*r]+2>>2,_[e+2]=t=s[f+1*r]+s[f+2*r]+1>>1,_[e+3]=n=s[f+1*r]+2*s[f+2*r]+s[f+3*r]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i=s[f+2*r]+s[f+3*r]+1>>1,_[e+3]=a=s[f+2*r]+2*s[f+3*r]+s[f+3*r]+2>>2,_[(e+=r)+0]=i,_[e+1]=a,_[e+2]=o=s[f+3*r],_[e+3]=o,_[(e+=r)+0]=o,_[e+1]=o,_[e+2]=o,_[e+3]=o}function predict_h_16x16(_,e,r){predict_h_nxn(_,e,r,16)}function predict_v_16x16(_,e,r){predict_v_nxn(_,e,r,16)}function predict_tm_16x16(_,e,r){predict_tm_nxn(_,e,r,16)}function predict_h_8x8(_,e,r){predict_h_nxn(_,e,r,8)}function predict_v_8x8(_,e,r){predict_v_nxn(_,e,r,8)}function predict_tm_8x8(_,e,r){predict_tm_nxn(_,e,r,8)}function predict_tm_4x4(_,e,r){predict_tm_nxn(_,e,r,4)}var tmp_4=new Array(0,0,0,0);function copy_down(_,e,r){var t,n=_,i=e+16-r;for(t=0;t<4;++t)tmp_4[0+t]=n[i+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t]}function b_pred(_,e,r,t,n,i){var a=int_;for(copy_down(_,e,r),a=0;a<16;a++){var o=_,s=e+4*(3&a);switch(t.splitt.mvs[a].d.x){case B_DC_PRED:predict_dc_nxn(o,s,r,4);break;case B_TM_PRED:predict_tm_4x4(o,s,r);break;case B_VE_PRED:predict_ve_4x4(o,s,r);break;case B_HE_PRED:predict_he_4x4(o,s,r);break;case B_LD_PRED:predict_ld_4x4(o,s,r);break;case B_RD_PRED:predict_rd_4x4(o,s,r);break;case B_VR_PRED:predict_vr_4x4(o,s,r);break;case B_VL_PRED:predict_vl_4x4(o,s,r);break;case B_HD_PRED:predict_hd_4x4(o,s,r);break;case B_HU_PRED:predict_hu_4x4(o,s,r);break;default:assert(0)}vp8_dixie_idct_add(o,s,o,s,r,n,i),i+=16,3&~a||(e+=4*r)}}var y2_16=Arr(16,0);function fixup_dc_coeffs(_,e,r){var t=int_;for(vp8_dixie_walsh(e,r+384,y2_16,0),t=0;t<16;t++)e[r+16*t]=y2_16[t]}function predict_intra_luma(_,e,r,t,n,i){if(t.base.y_mode==B_PRED)b_pred(_,e,r,t,n,i);else{var a=int_;switch(t.base.y_mode){case DC_PRED:predict_dc_nxn(_,e,r,16);break;case V_PRED:predict_v_16x16(_,e,r);break;case H_PRED:predict_h_16x16(_,e,r);break;case TM_PRED:predict_tm_16x16(_,e,r);break;default:assert(0)}for(fixup_dc_coeffs(t,n,i),a=0;a<16;a++)vp8_dixie_idct_add(_,e,_,e,r,n,i),i+=16,e+=4,3&~a||(e+=4*r-16)}}function predict_intra_chroma(_,e,r,t,n,i,a,o){var s=int_;switch(i.base.uv_mode){case DC_PRED:predict_dc_nxn(_,e,n,8),predict_dc_nxn(r,t,n,8);break;case V_PRED:predict_v_8x8(_,e,n),predict_v_8x8(r,t,n);break;case H_PRED:predict_h_8x8(_,e,n),predict_h_8x8(r,t,n);break;case TM_PRED:predict_tm_8x8(_,e,n),predict_tm_8x8(r,t,n);break;default:assert(0)}for(o+=256,s=16;s<20;s++)vp8_dixie_idct_add(_,e,_,e,n,a,o),o+=16,e+=4,1&s&&(e+=4*n-8);for(s=20;s<24;s++)vp8_dixie_idct_add(r,t,r,t,n,a,o),o+=16,t+=4,1&s&&(t+=4*n-8)}function sixtap_horiz(_,e,r,t,n,i,a,o,s){var f=int_,d=int_,E=int_;for(f=0;f<o;f++){for(d=0;d<a;d++)E=t[n-2]*s[0]+t[n-1]*s[1]+t[n+0]*s[2]+t[n+1]*s[3]+t[n+2]*s[4]+t[n+3]*s[5]+64,E>>=7,_[e+d]=E,n++;n+=i-a,e+=r}}function sixtap_vert(_,e,r,t,n,i,a,o,s){var f=int_,d=int_,E=int_;for(f=0;f<o;f++){for(d=0;d<a;d++)E=t[n-2*i]*s[0]+t[n-1*i]*s[1]+t[n+0*i]*s[2]+t[n+1*i]*s[3]+t[n+2*i]*s[4]+t[n+3*i]*s[5]+64,E>>=7,_[e+d]=E,n++;n+=i-a,e+=r}}var temp_=new Array(336);function sixtap_2d(_,e,r,t,n,i,a,o,s,f,d){sixtap_horiz(temp_,0,16,t,n-2*i,i,a,o+5,d[s]),sixtap_vert(_,e,r,temp_,32,16,a,o,d[f])}var img_index=function(){this.y=char_,this.u=char_,this.v=char_,this.y_off=0,this.u_off=0,this.v_off=0,this.stride=int_,this.uv_stride=int_};function filter_block(_,e,r,t,n,i,a,o){var s,f;return a.d.x||a.d.y?(s=7&a.d.x,f=7&a.d.y,n+=(a.d.y>>3)*i+(a.d.x>>3),s|f&&(sixtap_2d(e,r,i,t,n,i,4,4,s,f,o),t=e,n=r),_[0]=n,t):(_[0]=n,t)}function recon_1_block(_,e,r,t,n,i,a,o,s,f,d){var E=[0];vp8_dixie_idct_add(_,e,filter_block(E,_,e,r,t,n,i,a),E[0],n,o,s+16*d)}function calculate_chroma_splitmv(_,e,r){var t=int_,n=new mv;return(t=_.splitt.mvs[e].d.x+_.splitt.mvs[e+1].d.x+_.splitt.mvs[e+4].d.x+_.splitt.mvs[e+5].d.x)<0?t-=4:t+=4,n.d.x=parseInt(t/8,10),(t=_.splitt.mvs[e].d.y+_.splitt.mvs[e+1].d.y+_.splitt.mvs[e+4].d.y+_.splitt.mvs[e+5].d.y)<0?t-=4:t+=4,n.d.y=parseInt(t/8,10),r&&(n.d.x&=-8,n.d.y&=-8),n}function build_mc_border(_,e,r,t,n,i,a,o,s,f,d){var E,c=char_;E=r,c=t-i-a*n,a>=d?c+=(d-1)*n:a>0&&(c+=a*n);do{var l,m=int_,A=0;(m=i<0?-i:0)>o&&(m=o),i+o>f&&(A=i+o-f),A>o&&(A=o),l=o-m-A,m&&memset(_,e,E[c+0],m),l&&memcpy(_,e+m,E,c+i+m,l),A&&memset(_,e+m+l,E[c+f-1],A),e+=n,++a<d&&a>0&&(c+=n)}while(--s)}function recon_1_edge_block(_,e,r,t,n,i,a,o,s,f,d,E,c,l,m,A,u){var p=u;c+=o.d.x>>3,l+=o.d.y>>3,(c<2||c+4-1+3>=m||l<2||l+4-1+3>=A)&&(build_mc_border(r,t,n,(i+=(o.d.x>>3)+(o.d.y>>3)*a)-2-2*a,a,c-2,l-2,9,9,m,A),n=r,i=t+2*a+2,i-=(o.d.x>>3)+(o.d.y>>3)*a);var T=[0];vp8_dixie_idct_add(_,e,filter_block(T,_,e,n,i,a,o,s),T[0],a,f,d+16*p)}var uvmv_1=new mv;function predict_inter_emulated_edge(_,e,r,t,n,i,a){var o,s,f,d=_.frame_strg[0].img.img_data,E=_.frame_strg[0].img.img_data_off,c=0,l=0,m=int_,A=int_,u=int_,p=int_,T=int_,y=Arr_new(4,mv),b=e.u,v=e.v,h=e.u_off,w=e.v_off,I=(3==_.frame_hdr.version)+0;if(u=16*i,p=16*a,m=16*_.mb_cols,A=16*_.mb_rows,s=e.y,l=e.y_off,f=_.ref_frame_offsets[n.base.ref_frame],o=_.ref_frame_offsets_[n.base.ref_frame],c=l+f,n.base.y_mode!=SPLITMV){var R=uvmv_1;R.d.x=n.base.mv.d.x,R.d.y=n.base.mv.d.y,R.d.x=R.d.x+1>>1,R.d.y=R.d.y+1>>1,I&&(R.d.x&=-8,R.d.y&=-8),y[0].d.x=R.d.x,y[0].d.y=R.d.y,y[1].d.x=R.d.x,y[1].d.y=R.d.y,y[2].d.x=R.d.x,y[2].d.y=R.d.y,y[3].d.x=R.d.x,y[3].d.y=R.d.y}else y[0]=calculate_chroma_splitmv(n,0,I),y[1]=calculate_chroma_splitmv(n,2,I),y[2]=calculate_chroma_splitmv(n,8,I),y[3]=calculate_chroma_splitmv(n,10,I);for(T=0;T<16;T++){var N;N=n.base.y_mode!=SPLITMV?n.base.mv:n.splitt.mvs[+T],recon_1_edge_block(s,l,d,E,o,c,e.stride,N,_.subpixel_filters,r,t,n,u,p,m,A,T),u+=4,l+=4,c+=4,3&~T||(u-=16,p+=4,l+=4*e.stride-16,c+=4*e.stride-16)}for(u=16*i,p=16*a,u>>=1,p>>=1,m>>=1,A>>=1,T=0;T<4;T++)recon_1_edge_block(b,h,d,E,o,h+f,e.uv_stride,y[T],_.subpixel_filters,r,t,n,u,p,m,A,T+16),recon_1_edge_block(v,w,d,E,o,w+f,e.uv_stride,y[T],_.subpixel_filters,r,t,n,u,p,m,A,T+20),h+=4,w+=4,u+=4,1&T&&(u-=8,p+=4,h+=4*e.uv_stride-8,w+=4*e.uv_stride-8)}var uvmv_2=new mv;function predict_inter(_,e,r,t,n){var i,a,o=e.y,s=e.y_off,f=e.u,d=e.u_off,E=e.v,c=e.v_off,l=Arr_new(4,mv),m=(3==_.frame_hdr.version)+0,A=int_;if(n.base.y_mode!=SPLITMV){var u=uvmv_2;u.d.x=n.base.mv.d.x,u.d.y=n.base.mv.d.y,u.d.x=u.d.x+1>>1,u.d.y=u.d.y+1>>1,m&&(u.d.x&=-8,u.d.y&=-8),l[0].d.x=l[1].d.x=l[2].d.x=l[3].d.x=u.d.x,l[0].d.y=l[1].d.y=l[2].d.y=l[3].d.y=u.d.y}else l[0]=calculate_chroma_splitmv(n,0,m),l[1]=calculate_chroma_splitmv(n,2,m),l[2]=calculate_chroma_splitmv(n,8,m),l[3]=calculate_chroma_splitmv(n,10,m);for(a=_.ref_frame_offsets[n.base.ref_frame],i=_.ref_frame_offsets_[n.base.ref_frame],A=0;A<16;A++){var p;p=n.base.y_mode!=SPLITMV?n.base.mv:n.splitt.mvs[+A],recon_1_block(o,s,i,s+a,e.stride,p,_.subpixel_filters,r,t,n,A),s+=4,3&~A||(s+=4*e.stride-16)}for(A=0;A<4;A++)recon_1_block(f,d,i,d+a,e.uv_stride,l[A],_.subpixel_filters,r,t,n,A+16),recon_1_block(E,c,i,c+a,e.uv_stride,l[A],_.subpixel_filters,r,t,n,A+20),d+=4,c+=4,1&A&&(d+=4*e.uv_stride-8,c+=4*e.uv_stride-8)}function vp8_dixie_release_ref_frame(_){_&&(assert(_.ref_cnt),_.ref_cnt--)}function vp8_dixie_ref_frame(_){return _.ref_cnt++,_}function vp8_dixie_find_free_ref_frame(_){var e=int_;for(e=0;e<NUM_REF_FRAMES;e++)if(0==_[e].ref_cnt)return _[e].ref_cnt=1,_[e];return assert(0),null}function fixup_left(_,e,r,t,n,i){var a=_,o=e-1,s=int_;if(i==DC_PRED&&n){var f=_,d=e-t;for(s=0;s<r;s++)a[o]=f[d+s],o+=t}else for(o-=t,s=-1;s<r;s++)a[o]=129,o+=t}function fixup_above(_,e,r,t,n,i){var a=_,o=e-t,s=int_;if(i==DC_PRED&&n){var f=_,d=e-1;for(s=0;s<r;s++)a[o+s]=f[d],d+=t}else memset(a,o-1,127,r+1);memset(a,o+r,127,4)}function vp8_dixie_predict_init(_){var e,r=int_;if(_.frame_hdr.frame_size_updated){for(r=0;r<NUM_REF_FRAMES;r++){var t=16*_.mb_cols+2*BORDER_PIXELS,n=16*_.mb_rows+2*BORDER_PIXELS;vpx_img_free(_.frame_strg[r].img),_.frame_strg[r].ref_cnt=0,_.ref_frames[r]=null,vpx_img_alloc(_.frame_strg[r].img,IMG_FMT_I420,t,n,16)||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,"Failed to allocate %dx%d framebuffer",t,n),vpx_img_set_rect(_.frame_strg[r].img,BORDER_PIXELS,BORDER_PIXELS,_.frame_hdr.kf.w,_.frame_hdr.kf.h)}_.frame_hdr.version?_.subpixel_filters=bilinear_filters:_.subpixel_filters=sixtap_filters}for(_.ref_frames[CURRENT_FRAME]&&vp8_dixie_release_ref_frame(_.ref_frames[CURRENT_FRAME]),_.ref_frames[CURRENT_FRAME]=vp8_dixie_find_free_ref_frame(_.frame_strg),e=_.ref_frames[CURRENT_FRAME].img.img_data,r=0;r<NUM_REF_FRAMES;r++){var i=_.ref_frames[r];_.ref_frame_offsets[r]=i?i.img.img_data_off-0:0,_.ref_frame_offsets_[r]=i?i.img.img_data:e}}var img_1=new img_index;function vp8_dixie_predict_process_row(_,e,r,t){var n,i,a=img_1,o=0,s=int_,f=0;for(a.stride=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],a.uv_stride=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_U],a.y=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],a.y_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],a.u=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_U],a.u_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_U],a.v=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_V],a.v_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_V],a.y_off+=16*(a.stride*e+r),a.u_off+=8*(a.uv_stride*e+r),a.v_off+=8*(a.uv_stride*e+r),n=_.mb_info_rows[1+e],o=_.mb_info_rows_off[1+e]+r,i=_.tokens[e&_.token_hdr.partitions-1].coeffs,f=400*r,0==r&&(fixup_left(a.y,a.y_off,16,a.stride,e,n[o].base.y_mode),fixup_left(a.u,a.u_off,8,a.uv_stride,e,n[o].base.uv_mode),fixup_left(a.v,a.v_off,8,a.uv_stride,e,n[o].base.uv_mode),0==e&&(a.y[a.y_off-a.stride-1]=127)),s=r;s<r+t;s++)0==e&&(fixup_above(a.y,a.y_off,16,a.stride,s,n[o].base.y_mode),fixup_above(a.u,a.u_off,8,a.uv_stride,s,n[o].base.uv_mode),fixup_above(a.v,a.v_off,8,a.uv_stride,s,n[o].base.uv_mode)),n[o].base.y_mode<=B_PRED?(predict_intra_luma(a.y,a.y_off,a.stride,n[o],i,f),predict_intra_chroma(a.u,a.u_off,a.v,a.v_off,a.uv_stride,n[o],i,f)):(n[o].base.y_mode!=SPLITMV&&fixup_dc_coeffs(n[o],i,f),n[o].base.need_mc_border?predict_inter_emulated_edge(_,a,i,f,n[o],s,e):predict_inter(_,a,i,f,n[o])),o++,a.y_off+=16,a.u_off+=8,a.v_off+=8,f+=400;if(s==_.mb_cols){var d=a.y,E=a.y_off+15*a.stride,c=a.y[a.y_off-1+15*a.stride];d[E]=d[E+1]=d[E+2]=d[E+3]=c}}var FRAME_HEADER_SZ=3,KEYFRAME_HEADER_SZ=7;function ARRAY_COPY(_,e){assert(_.length==e.length),memcpy(_,0,e,0,_.length)}function decode_entropy_header(_,e,r){var t=int_,n=int_,i=int_,a=int_,o=0;for(t=0;t<BLOCK_TYPES;t++)for(n=0;n<COEF_BANDS;n++)for(i=0;i<PREV_COEF_CONTEXTS;i++)for(a=0;a<ENTROPY_NODES;a++)bool_get(e,k_coeff_entropy_update_probs[t][n][i][a])&&(r.coeff_probs_[o]=r.coeff_probs[t][n][i][a]=bool_get_uint(e,8)),o++;if(r.coeff_skip_enabled=bool_get_bit(e),r.coeff_skip_enabled&&(r.coeff_skip_prob=bool_get_uint(e,8)),!_.frame_hdr.is_keyframe){if(r.prob_inter=bool_get_uint(e,8),r.prob_last=bool_get_uint(e,8),r.prob_gf=bool_get_uint(e,8),bool_get_bit(e))for(t=0;t<4;t++)r.y_mode_probs[t]=bool_get_uint(e,8);if(bool_get_bit(e))for(t=0;t<3;t++)r.uv_mode_probs[t]=bool_get_uint(e,8);for(t=0;t<2;t++)for(n=0;n<MV_PROB_CNT;n++)if(bool_get(e,k_mv_entropy_update_probs[t][n])){var s=bool_get_uint(e,7);r.mv_probs[t][n]=s?s<<1:1}}}function decode_reference_header(_,e,r){var t=_.frame_hdr.is_keyframe;r.refresh_gf=t?1:bool_get_bit(e),r.refresh_arf=t?1:bool_get_bit(e),r.copy_gf=t||r.refresh_gf?0:bool_get_uint(e,2),r.copy_arf=t||r.refresh_arf?0:bool_get_uint(e,2),r.sign_bias[GOLDEN_FRAME]=t?0:bool_get_bit(e),r.sign_bias[ALTREF_FRAME]=t?0:bool_get_bit(e),r.refresh_entropy=bool_get_bit(e),r.refresh_last=t?1:bool_get_bit(e)}function decode_quantizer_header(_,e,r){var t=int_,n=r.q_index;r.q_index=bool_get_uint(e,7),t=(n!=r.q_index)+0,t|=r.y1_dc_delta_q=bool_maybe_get_int(e,4),t|=r.y2_dc_delta_q=bool_maybe_get_int(e,4),t|=r.y2_ac_delta_q=bool_maybe_get_int(e,4),t|=r.uv_dc_delta_q=bool_maybe_get_int(e,4),t|=r.uv_ac_delta_q=bool_maybe_get_int(e,4),r.delta_update=t}function decode_and_init_token_partitions(_,e,r,t,n,i){var a=int_;for(i.partitions=1<<bool_get_uint(e,2),n<3*(i.partitions-1)&&vpx_internal_error(_.error,VPX_CODEC_CORRUPT_FRAME,"Truncated packet found parsing partition lengths."),n-=3*(i.partitions-1),a=0;a<i.partitions;a++)a<i.partitions-1?(i.partition_sz[a]=r[t+2]<<16|r[t+1]<<8|r[t+0],t+=3):i.partition_sz[a]=n,n<i.partition_sz[a]&&vpx_internal_error(_.error,VPX_CODEC_CORRUPT_FRAME,"Truncated partition %d",a),n-=i.partition_sz[a];for(a=0;a<_.token_hdr.partitions;a++)init_bool_decoder(_.tokens[a].bool,r,t,_.token_hdr.partition_sz[a]),t+=_.token_hdr.partition_sz[a]}function decode_loopfilter_header(_,e,r){if(_.frame_hdr.is_keyframe&&memset(r,0,1),r.use_simple=bool_get_bit(e),r.level=bool_get_uint(e,6),r.sharpness=bool_get_uint(e,3),r.delta_enabled=bool_get_bit(e),r.delta_enabled&&bool_get_bit(e)){var t=int_;for(t=0;t<BLOCK_CONTEXTS;t++)r.ref_delta[t]=bool_maybe_get_int(e,6);for(t=0;t<BLOCK_CONTEXTS;t++)r.mode_delta[t]=bool_maybe_get_int(e,6)}}function decode_segmentation_header(_,e,r){if(_.frame_hdr.is_keyframe&&memset(r,0,1),r.enabled=bool_get_bit(e),r.enabled){var t=int_;if(r.update_map=bool_get_bit(e),r.update_data=bool_get_bit(e),r.update_data){for(r.abs_=bool_get_bit(e),t=0;t<MAX_MB_SEGMENTS;t++)r.quant_idx[t]=bool_maybe_get_int(e,7);for(t=0;t<MAX_MB_SEGMENTS;t++)r.lf_level[t]=bool_maybe_get_int(e,6)}if(r.update_map)for(t=0;t<MB_FEATURE_TREE_PROBS;t++)r.tree_probs[t]=bool_get_bit(e)?bool_get_uint(e,8):255}else r.update_map=0,r.update_data=0}function clamp_q(_){return _<0?0:_>127?127:_}function dc_q(_){return dc_q_lookup[clamp_q(_)]}function ac_q(_){return ac_q_lookup[clamp_q(_)]}function dequant_init(_,e,r){var t=int_,n=int_,i=_,a=0;for(t=0;t<(e.enabled?MAX_MB_SEGMENTS:1);t++)n=r.q_index,e.enabled&&(n=e.abs_?e.quant_idx[t]:n+e.quant_idx[t]),(i[a].quant_idx!=n||r.delta_update)&&(i[a].factor[TOKEN_BLOCK_Y1][0]=dc_q(n+r.y1_dc_delta_q),i[a].factor[TOKEN_BLOCK_Y1][1]=ac_q(n),i[a].factor[TOKEN_BLOCK_UV][0]=dc_q(n+r.uv_dc_delta_q),i[a].factor[TOKEN_BLOCK_UV][1]=ac_q(n+r.uv_ac_delta_q),i[a].factor[TOKEN_BLOCK_Y2][0]=2*dc_q(n+r.y2_dc_delta_q),i[a].factor[TOKEN_BLOCK_Y2][1]=parseInt(155*ac_q(n+r.y2_ac_delta_q)/100),i[a].factor[TOKEN_BLOCK_Y2][1]<8&&(i[a].factor[TOKEN_BLOCK_Y2][1]=8),i[a].factor[TOKEN_BLOCK_UV][0]>132&&(i[a].factor[TOKEN_BLOCK_UV][0]=132),i[a].quant_idx=n),a++}var bool_1=new bool_decoder;function decode_frame(_,e,r,t){var n,i=bool_1,a=int_,o=int_,s=int_;if(_.saved_entropy_valid=0,(n=vp8_parse_frame_header(e,t,_.frame_hdr))&&vpx_internal_error(_.error,n,"Failed to parse frame header"),_.frame_hdr.is_experimental&&vpx_internal_error(_.error,VPX_CODEC_UNSUP_BITSTREAM,"Experimental bitstreams not supported."),r+=FRAME_HEADER_SZ,t-=FRAME_HEADER_SZ,_.frame_hdr.is_keyframe&&(r+=KEYFRAME_HEADER_SZ,t-=KEYFRAME_HEADER_SZ,_.mb_cols=parseInt((_.frame_hdr.kf.w+15)/16,10),_.mb_rows=parseInt((_.frame_hdr.kf.h+15)/16,10)),init_bool_decoder(i,e,r,_.frame_hdr.part0_sz),_.frame_hdr.is_keyframe&&bool_get_uint(i,2)&&vpx_internal_error(_.error,VPX_CODEC_UNSUP_BITSTREAM,"Reserved bits not supported."),decode_segmentation_header(_,i,_.segment_hdr),decode_loopfilter_header(_,i,_.loopfilter_hdr),decode_and_init_token_partitions(_,i,e,r+_.frame_hdr.part0_sz,t-_.frame_hdr.part0_sz,_.token_hdr),decode_quantizer_header(_,i,_.quant_hdr),decode_reference_header(_,i,_.reference_hdr),_.frame_hdr.is_keyframe){a=int_;var f=int_,d=int_,E=int_,c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)_.entropy_hdr.coeff_probs_[c]=_.entropy_hdr.coeff_probs[a][f][d][E]=k_default_coeff_probs[a][f][d][E],c++;_.entropy_hdr.mv_probs=new k_default_mv_probs,ARRAY_COPY(_.entropy_hdr.y_mode_probs,k_default_y_mode_probs),ARRAY_COPY(_.entropy_hdr.uv_mode_probs,k_default_uv_mode_probs)}if(!_.reference_hdr.refresh_entropy){var l=_.saved_entropy,m=_.entropy_hdr;c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)l.coeff_probs_[c]=l.coeff_probs[a][f][d][E]=m.coeff_probs[a][f][d][E],c++;for(l.coeff_skip_enabled=m.coeff_skip_enabled,l.coeff_skip_prob=m.coeff_skip_prob,a=0;a<2;++a)for(f=0;f<19;++f)l.mv_probs[a][f]=m.mv_probs[a][f];for(l.prob_gf=m.prob_gf,l.prob_inter=m.prob_inter,l.prob_last=m.prob_last,a=0;a<3;++a)l.uv_mode_probs[a]=m.uv_mode_probs[a];for(a=0;a<4;++a)l.y_mode_probs[a]=m.y_mode_probs[a];_.saved_entropy_valid=1}for(decode_entropy_header(_,i,_.entropy_hdr),vp8_dixie_modemv_init(_),vp8_dixie_tokens_init(_),vp8_dixie_predict_init(_),dequant_init(_.dequant_factors,_.segment_hdr,_.quant_hdr),o=0,s=0;o<_.mb_rows;o++)vp8_dixie_modemv_process_row(_,i,o,0,_.mb_cols),vp8_dixie_tokens_process_row(_,s,o,0,_.mb_cols),vp8_dixie_predict_process_row(_,o,0,_.mb_cols),_.loopfilter_hdr.level&&o&&vp8_dixie_loopfilter_process_row(_,o-1,0,_.mb_cols),++s==_.token_hdr.partitions&&(s=0);if(_.loopfilter_hdr.level&&vp8_dixie_loopfilter_process_row(_,o-1,0,_.mb_cols),_.frame_cnt++,!_.reference_hdr.refresh_entropy){l=_.entropy_hdr,m=_.saved_entropy,c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)l.coeff_probs_[c]=l.coeff_probs[a][f][d][E]=m.coeff_probs[a][f][d][E]=m.coeff_probs_[c],c++;for(l.coeff_skip_enabled=m.coeff_skip_enabled,l.coeff_skip_prob=m.coeff_skip_prob,a=0;a<2;++a)for(f=0;f<19;++f)l.mv_probs[a][f]=m.mv_probs[a][f];for(l.prob_gf=m.prob_gf,l.prob_inter=m.prob_inter,l.prob_last=m.prob_last,a=0;a<3;++a)l.uv_mode_probs[a]=m.uv_mode_probs[a];for(a=0;a<4;++a)l.y_mode_probs[a]=m.y_mode_probs[a];_.saved_entropy_valid=0}1==_.reference_hdr.copy_arf?(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[LAST_FRAME])):2==_.reference_hdr.copy_arf&&(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[GOLDEN_FRAME])),1==_.reference_hdr.copy_gf?(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[LAST_FRAME])):2==_.reference_hdr.copy_gf&&(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[ALTREF_FRAME])),_.reference_hdr.refresh_gf&&(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME])),_.reference_hdr.refresh_arf&&(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME])),_.reference_hdr.refresh_last&&(vp8_dixie_release_ref_frame(_.ref_frames[LAST_FRAME]),_.ref_frames[LAST_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME]))}function CHECK_FOR_UPDATE(_,e,r){var t=_;return r[0]|=t!=(_=e),_}function vp8_parse_frame_header(_,e,r){var t=long_;if(e<10)return VPX_CODEC_CORRUPT_FRAME;if(t=_[0]|_[1]<<8|_[2]<<16,r.is_keyframe=!BITS_GET(t,0,1),r.version=BITS_GET(t,1,2),r.is_experimental=BITS_GET(t,3,1),r.is_shown=BITS_GET(t,4,1),r.part0_sz=BITS_GET(t,5,19),e<=r.part0_sz+(r.is_keyframe?10:3))return VPX_CODEC_CORRUPT_FRAME;if(r.frame_size_updated=0,r.is_keyframe){var n=[0];if(157!=_[3]||1!=_[4]||42!=_[5])return VPX_CODEC_UNSUP_BITSTREAM;if(t=_[6]|_[7]<<8|_[8]<<16|_[9]<<24,r.kf.w=CHECK_FOR_UPDATE(r.kf.w,BITS_GET(t,0,14),n),r.kf.scale_w=CHECK_FOR_UPDATE(r.kf.scale_w,BITS_GET(t,14,2),n),r.kf.h=CHECK_FOR_UPDATE(r.kf.h,BITS_GET(t,16,14),n),r.kf.scale_h=CHECK_FOR_UPDATE(r.kf.scale_h,BITS_GET(t,30,2),n),r.frame_size_updated=n[0],!r.kf.w||!r.kf.h)return VPX_CODEC_UNSUP_BITSTREAM}return VPX_CODEC_OK}function vp8_dixie_decode_frame(_,e,r){var t=_;return _.error.error_code=VPX_CODEC_OK,_.error.has_detail=0,setjmp(_.error.jmp)||decode_frame(_,e,0,r),t.error.error_code}function vp8_dixie_decode_destroy(_){vp8_dixie_predict_destroy(_),vp8_dixie_tokens_destroy(_),vp8_dixie_modemv_destroy(_)}var vpx_codec_alg_priv=function(){decoder_ctx=new vp8_decoder_ctx,img=new vpx_image_t,img_avail=int_};function update_error_state(_,e){var r;return(r=e.error_code)&&(_.base.err_detail=e.has_detail?e.detail:null),r}function vp8_init(_){var e=VPX_CODEC_OK;if(!_.priv){var r=new vpx_codec_alg_priv_t;if(_.priv=r,!_.priv)return VPX_CODEC_MEM_ERROR;_.priv.sz=1,_.priv.iface=_.iface,_.priv.alg_priv=r,_.priv.init_flags=_.init_flags,_.config.dec&&(_.priv.alg_priv.cfg=_.config.dec,_.config.dec=_.priv.alg_priv.cfg)}return e}function vp8_destroy(_){return vp8_dixie_decode_destroy(_.decoder_ctx),_.base.alg_priv="",VPX_CODEC_OK}function vp8_peek_si(_,e,r){var t,n=new vp8_frame_hdr;return(t=vp8_parse_frame_header(_,e,n))||(r.is_kf=n.is_keyframe,r.is_kf?(r.w=n.kf.w,r.h=n.kf.h):(r.w=0,r.h=0)),t}function vp8_get_si(_,e){var r=int_;return r=(e.sz,1),memcpy(e,_.si,r),alert("todo"),e.sz=r,VPX_CODEC_OK}function vp8_decode(_,e,r,t,n){var i;return(i=vp8_dixie_decode_frame(_.decoder_ctx,e,r))&&update_error_state(_,_.decoder_ctx.error),_.img_avail=_.decoder_ctx.frame_hdr.is_shown,_.img=_.decoder_ctx.ref_frames[CURRENT_FRAME].img,i}function vp8_get_frame(_,e){var r=null;return _.img_avail&&(e[0]||(r=_.img,e[0]=r)),r}var ctf_maps=create_obj_vals_from_arrayChilds(vpx_codec_ctrl_fn_map_t,[[-1,null]]);function webmdata(_){main(_)}CODEC_INTERFACE("vpx_codec_vp8_dx",new Array('VP8 "Dixie" Decoder'+VERSION_STRING,VPX_CODEC_INTERNAL_ABI_VERSION,VPX_CODEC_CAP_DECODER,"vp8_init","vp8_destroy","ctf_maps",null,null,new Array("vp8_peek_si","vp8_get_si","vp8_decode","vp8_get_frame"))),window.webmdata=webmdata;var VP8_FOURCC=3690582,ifaces=new Array({name:char_,iface:0,fourcc:int_,fourcc_mask:int_});ifaces[0]={name:"vp8",iface:new vpx_codec_vp8_dx_algo,fourcc:VP8_FOURCC,fourcc_mask:16777215};var RAW_FILE=0,IVF_FILE=1,WEBM_FILE=2,IVF_FRAME_HDR_SZ=12,RAW_FRAME_HDR_SZ=4;function read_frame(_,e,r,t,n){new Array(IVF_FRAME_HDR_SZ);var i=size_t,a=_.infile;if(_.kind==WEBM_FILE){if(_.chunk>=_.chunks){var o=[int_];do{if(_.pkt&&nestegg_free_packet(_.pkt),nestegg_read_packet(_.nestegg_ctx,_.pkt)<=0||nestegg_packet_track(_.pkt,o))return 1}while(o!=_.video_track);if(nestegg_packet_count(_.pkt,_.chunks))return 1;_.chunk=0}return nestegg_packet_data(_.pkt,_.chunk,e,t)?1:(_.chunk++,0)}return t[0]=i,t?fread(e,1,t[0],a)!=t[0]?(fprintf(stderr,"Failed to read full frame\n"),1):0:1}var input_ctx=function(){this.kind=0,this.infile=0,this.nestegg_ctx=new nestegg,this.pkt=[null],this.chunk=int_,this.chunks=[int_],this.video_track=int_};function nestegg_read_cb(_,e,r){var t=r;return fread(_,1,e,t)<e&&feof(t)?0:1}function nestegg_seek_cb(_,e,r){switch(e){case NESTEGG_SEEK_SET:e=SEEK_SET;break;case NESTEGG_SEEK_CUR:e=SEEK_CUR;break;case NESTEGG_SEEK_END:e=SEEK_END}return fseek(r,_,e)?-1:0}function nestegg_tell_cb(_){return ftell(_)}function file_is_webm(_,e,r,t,n,i){var a=int_,o=[int_],s=-1,f={read:nestegg_read_cb,seek:nestegg_seek_cb,tell:nestegg_tell_cb,userdata:_.infile},d=new nestegg_video_params;for(_.nestegg_ctx=[_.nestegg_ctx],nestegg_init(_.nestegg_ctx,f,null)&&alert("goto fail"),_.nestegg_ctx=_.nestegg_ctx[0],nestegg_track_count(_.nestegg_ctx,o)&&alert("goto fail"),a=0;a<o&&(s=nestegg_track_type(_.nestegg_ctx,a))!=NESTEGG_TRACK_VIDEO;a++)s<0&&alert("goto fail");return nestegg_track_codec_id(_.nestegg_ctx,a)!=NESTEGG_CODEC_VP8&&(fprintf(stderr,"Not VP8 video, quitting.\n"),exit(1)),_.video_track=a,nestegg_track_video_params(_.nestegg_ctx,a,d)&&alert("goto fail"),n[0]=0,i[0]=0,e[0]=VP8_FOURCC,r[0]=d.width,t[0]=d.height,1}function main(_,e,r){var t=[null],n=[null],i=[0],a=[0],o={data:_,data_off:0},s=[int_],f=[int_],d=[int_],E=[int_],c=[int_],l=new input_ctx;if(l.infile=o,!file_is_webm(l,s,f,d,E,c))return alert("Unrecognized input file type.\n"),EXIT_FAILURE;l.kind=WEBM_FILE;var m=document.getElementById("timecode"),A=document.getElementById("render"),u=document.getElementById("frame"),p=new Date,T=0,y=new vp8_decoder_ctx;!function _(){!read_frame(l,t,n,i,a)&&setTimeout((function(){t=t[0],p=new Date,vp8_dixie_decode_frame(y,t,i),t=[t];var e=y.frame_hdr.is_shown,r=y.ref_frames[0].img;b=new Date,m.innerHTML=l.pkt[0].timecode+" ("+(l.pkt[0].timecode/1e9|0)+" sec)",e&&(A.innerHTML=b-p+"ms<br />FPS:"+(1e3/(b-p)).toFixed(2),r&&vpximg2canvas(r),T++,u.innerHTML=T),_()}),0)}();var b=new Date}/*!
6
+ * jQuery JavaScript Library v2.0.3
7
+ * http://jquery.com/
8
+ *
9
+ * Includes Sizzle.js
10
+ * http://sizzlejs.com/
11
+ *
12
+ * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
13
+ * Released under the MIT license
14
+ * http://jquery.org/license
15
+ *
16
+ * Date: 2013-07-03T13:30Z
17
+ */
18
+ !function(e,t){var n,r,i=typeof t,o=e.location,s=e.document,a=s.documentElement,u=e.jQuery,l=e.$,c={},f=[],p="2.0.3",d=f.concat,h=f.push,g=f.slice,m=f.indexOf,y=c.toString,v=c.hasOwnProperty,x=p.trim,b=function(e,t){return new b.fn.init(e,t,n)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,N=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^-ms-/,E=/-([\da-z])/gi,S=function(e,t){return t.toUpperCase()},j=function(){s.removeEventListener("DOMContentLoaded",j,!1),e.removeEventListener("load",j,!1),b.ready()};function D(e){var t=e.length,n=b.type(e);return!b.isWindow(e)&&(!(1!==e.nodeType||!t)||("array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)))}b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(!(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:C.exec(e))||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:s,!0)),N.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}return(o=s.getElementById(i[2]))&&o.parentNode&&(this.length=1,this[0]=o),this.context=s,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,(function(t,n){return e.call(t,n,t)})))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,s,a=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof a&&(c=a,a=arguments[1]||{},u=2),"object"==typeof a||b.isFunction(a)||(a={}),l===u&&(a=this,--u);u<l;u++)if(null!=(e=arguments[u]))for(n in e)r=a[n],a!==(i=e[n])&&(c&&i&&(b.isPlainObject(i)||(o=b.isArray(i)))?(o?(o=!1,s=r&&b.isArray(r)?r:[]):s=r&&b.isPlainObject(r)?r:{},a[n]=b.extend(c,s,i)):i!==t&&(a[n]=i));return a},b.extend({expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===b&&(e.$=l),t&&e.jQuery===b&&(e.jQuery=u),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){(!0===e?--b.readyWait:b.isReady)||(b.isReady=!0,!0!==e&&--b.readyWait>0||(r.resolveWith(s,[b]),b.fn.trigger&&b(s).trigger("ready").off("ready")))},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?String(e):"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){if("object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}return!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||s;var r=N.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:JSON.parse,parseXML:function(e){var n;if(!e||"string"!=typeof e)return null;try{n=(new DOMParser).parseFromString(e,"text/xml")}catch(e){n=t}return n&&!n.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+e),n},noop:function(){},globalEval:function(e){var t,n=eval;(e=b.trim(e))&&(1===e.indexOf("use strict")?((t=s.createElement("script")).text=e,s.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(k,"ms-").replace(E,S)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r=0,i=e.length,o=D(e);if(n){if(o)for(;r<i&&!1!==t.apply(e[r],n);r++);else for(r in e)if(!1===t.apply(e[r],n))break}else if(o)for(;r<i&&!1!==t.call(e[r],r,e[r]);r++);else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":x.call(e)},makeArray:function(e,t){var n=t||[];return null!=e&&(D(Object(e))?b.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:m.call(t,e,n)},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;o<r;o++)e[i++]=n[o];else for(;n[o]!==t;)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r=[],i=0,o=e.length;for(n=!!n;i<o;i++)n!==!!t(e[i],i)&&r.push(e[i]);return r},map:function(e,t,n){var r,i=0,o=e.length,s=[];if(D(e))for(;i<o;i++)null!=(r=t(e[i],i,n))&&(s[s.length]=r);else for(i in e)null!=(r=t(e[i],i,n))&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(r=e[n],n=e,e=r),b.isFunction(e)?(i=g.call(arguments,2),o=function(){return e.apply(n||this,i.concat(g.call(arguments)))},o.guid=e.guid=e.guid||b.guid++,o):t},access:function(e,n,r,i,o,s,a){var u=0,l=e.length,c=null==r;if("object"===b.type(r))for(u in o=!0,r)b.access(e,n,u,r[u],!0,s,a);else if(i!==t&&(o=!0,b.isFunction(i)||(a=!0),c&&(a?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;u<l;u++)n(e[u],r,a?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):s},now:Date.now,swap:function(e,t,n,r){var i,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];for(o in i=n.apply(e,r||[]),t)e.style[o]=s[o];return i}}),b.ready.promise=function(t){return r||(r=b.Deferred(),"complete"===s.readyState?setTimeout(b.ready):(s.addEventListener("DOMContentLoaded",j,!1),e.addEventListener("load",j,!1))),r.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),(function(e,t){c["[object "+t+"]"]=t.toLowerCase()})),n=b(s),
19
+ /*!
20
+ * Sizzle CSS Selector Engine v1.9.4-pre
21
+ * http://sizzlejs.com/
22
+ *
23
+ * Copyright 2013 jQuery Foundation, Inc. and other contributors
24
+ * Released under the MIT license
25
+ * http://jquery.org/license
26
+ *
27
+ * Date: 2013-06-03
28
+ */
29
+ function(e,t){var n,r,i,o,s,a,u,l,c,f,p,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T=0,C=0,N=se(),k=se(),E=se(),S=!1,j=function(e,t){return e===t?(S=!0,0):0},D=typeof t,A=1<<31,L={}.hasOwnProperty,q=[],H=q.pop,O=q.push,F=q.push,P=q.slice,R=q.indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(this[t]===e)return t;return-1},M="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",W="[\\x20\\t\\r\\n\\f]",$="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",B=$.replace("w","w#"),I="\\["+W+"*("+$+")"+W+"*(?:([*^$|!~]?=)"+W+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+B+")|)|)"+W+"*\\]",z=":("+$+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+I.replace(3,8)+")*)|.*)\\)|)",_=new RegExp("^"+W+"+|((?:^|[^\\\\])(?:\\\\.)*)"+W+"+$","g"),X=new RegExp("^"+W+"*,"+W+"*"),U=new RegExp("^"+W+"*([>+~]|"+W+")"+W+"*"),Y=new RegExp(W+"*[+~]"),V=new RegExp("="+W+"*([^\\]'\"]*)"+W+"*\\]","g"),G=new RegExp(z),J=new RegExp("^"+B+"$"),Q={ID:new RegExp("^#("+$+")"),CLASS:new RegExp("^\\.("+$+")"),TAG:new RegExp("^("+$.replace("w","w*")+")"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+z),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+W+"*(even|odd|(([+-]|)(\\d*)n|)"+W+"*(?:([+-]|)"+W+"*(\\d+)|))"+W+"*\\)|)","i"),bool:new RegExp("^(?:"+M+")$","i"),needsContext:new RegExp("^"+W+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+W+"*((?:-\\d)?\\d*)"+W+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/^(?:input|select|textarea|button)$/i,te=/^h\d$/i,ne=/'|\\/g,re=new RegExp("\\\\([\\da-f]{1,6}"+W+"?|("+W+")|.)","ig"),ie=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)};try{F.apply(q=P.call(w.childNodes),w.childNodes),q[w.childNodes.length].nodeType}catch(e){F={apply:q.length?function(e,t){O.apply(e,P.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function oe(e,t,n,i){var s,a,l,c,d,m,y,b,T,C;if((t?t.ownerDocument||t:w)!==p&&f(t),n=n||[],!e||"string"!=typeof e)return n;if(1!==(c=(t=t||p).nodeType)&&9!==c)return[];if(h&&!i){if(s=Z.exec(e))if(l=s[1]){if(9===c){if(!(a=t.getElementById(l))||!a.parentNode)return n;if(a.id===l)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(l))&&v(t,a)&&a.id===l)return n.push(a),n}else{if(s[2])return F.apply(n,t.getElementsByTagName(e)),n;if((l=s[3])&&r.getElementsByClassName&&t.getElementsByClassName)return F.apply(n,t.getElementsByClassName(l)),n}if(r.qsa&&(!g||!g.test(e))){if(b=y=x,T=t,C=9===c&&e,1===c&&"object"!==t.nodeName.toLowerCase()){for(m=ge(e),(y=t.getAttribute("id"))?b=y.replace(ne,"\\$&"):t.setAttribute("id",b),b="[id='"+b+"'] ",d=m.length;d--;)m[d]=b+me(m[d]);T=Y.test(e)&&t.parentNode||t,C=m.join(",")}if(C)try{return F.apply(n,T.querySelectorAll(C)),n}catch(e){}finally{y||t.removeAttribute("id")}}}return function(e,t,n,i){var s,a,l,c,f,p=ge(e);if(!i&&1===p.length){if((a=p[0]=p[0].slice(0)).length>2&&"ID"===(l=a[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[a[1].type]){if(!(t=(o.find.ID(l.matches[0].replace(re,ie),t)||[])[0]))return n;e=e.slice(a.shift().value.length)}for(s=Q.needsContext.test(e)?0:a.length;s--&&(l=a[s],!o.relative[c=l.type]);)if((f=o.find[c])&&(i=f(l.matches[0].replace(re,ie),Y.test(a[0].type)&&t.parentNode||t))){if(a.splice(s,1),!(e=i.length&&me(a)))return F.apply(n,i),n;break}}return u(e,p)(i,t,!h,n,Y.test(e)),n}(e.replace(_,"$1"),t,n,i)}function se(){var e=[];return function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}}function ae(e){return e[x]=!0,e}function ue(e){var t=p.createElement("div");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){for(var n=e.split("|"),r=e.length;r--;)o.attrHandle[n[r]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||A)-(~e.sourceIndex||A);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return ae((function(t){return t=+t,ae((function(n,r){for(var i,o=e([],n.length,t),s=o.length;s--;)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))}))}))}for(n in a=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},r=oe.support={},f=oe.setDocument=function(e){var t=e?e.ownerDocument||e:w,n=t.defaultView;return t!==p&&9===t.nodeType&&t.documentElement?(p=t,d=t.documentElement,h=!a(t),n&&n.attachEvent&&n!==n.top&&n.attachEvent("onbeforeunload",(function(){f()})),r.attributes=ue((function(e){return e.className="i",!e.getAttribute("className")})),r.getElementsByTagName=ue((function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length})),r.getElementsByClassName=ue((function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length})),r.getById=ue((function(e){return d.appendChild(e).id=x,!t.getElementsByName||!t.getElementsByName(x).length})),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==D&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(re,ie);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(re,ie);return function(e){var n=typeof e.getAttributeNode!==D&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!==D)return t.getElementsByTagName(e)}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,t){if(typeof t.getElementsByClassName!==D&&h)return t.getElementsByClassName(e)},m=[],g=[],(r.qsa=K.test(t.querySelectorAll))&&(ue((function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+W+"*(?:value|"+M+")"),e.querySelectorAll(":checked").length||g.push(":checked")})),ue((function(e){var n=t.createElement("input");n.setAttribute("type","hidden"),e.appendChild(n).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+W+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")}))),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ue((function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",z)})),g=g.length&&new RegExp(g.join("|")),m=m.length&&new RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},j=d.compareDocumentPosition?function(e,n){if(e===n)return S=!0,0;var i=n.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(n);return i?1&i||!r.sortDetached&&n.compareDocumentPosition(e)===i?e===t||v(w,e)?-1:n===t||v(w,n)?1:c?R.call(c,e)-R.call(c,n):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,n){var r,i=0,o=e.parentNode,s=n.parentNode,a=[e],u=[n];if(e===n)return S=!0,0;if(!o||!s)return e===t?-1:n===t?1:o?-1:s?1:c?R.call(c,e)-R.call(c,n):0;if(o===s)return ce(e,n);for(r=e;r=r.parentNode;)a.unshift(r);for(r=n;r=r.parentNode;)u.unshift(r);for(;a[i]===u[i];)i++;return i?ce(a[i],u[i]):a[i]===w?-1:u[i]===w?1:0},t):p},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&f(e),t=t.replace(V,"='$1']"),r.matchesSelector&&h&&(!m||!m.test(t))&&(!g||!g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){}return oe(t,p,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==p&&f(e),v(e,t)},oe.attr=function(e,n){(e.ownerDocument||e)!==p&&f(e);var i=o.attrHandle[n.toLowerCase()],s=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return s===t?r.attributes||!h?e.getAttribute(n):(s=e.getAttributeNode(n))&&s.specified?s.value:null:s},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(j),S){for(;t=e[o++];)t===e[o]&&(i=n.push(o));for(;i--;)e.splice(n[i],1)}return e},s=oe.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=oe.selectors={cacheLength:50,createPseudo:ae,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(re,ie),e[3]=(e[4]||e[5]||"").replace(re,ie),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&G.test(r)&&(n=ge(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(re,ie).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=new RegExp("(^|"+W+")"+e+"("+W+"|$)"))&&N(e,(function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==D&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==s?"nextSibling":"previousSibling",m=t.parentNode,y=a&&t.nodeName.toLowerCase(),v=!u&&!a;if(m){if(o){for(;g;){for(f=t;f=f[g];)if(a?f.nodeName.toLowerCase()===y:1===f.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[s?m.firstChild:m.lastChild],s&&v){for(d=(l=(c=m[x]||(m[x]={}))[e]||[])[0]===T&&l[1],p=l[0]===T&&l[2],f=d&&m.childNodes[d];f=++d&&f&&f[g]||(p=d=0)||h.pop();)if(1===f.nodeType&&++p&&f===t){c[e]=[T,d,p];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===T)p=l[1];else for(;(f=++d&&f&&f[g]||(p=d=0)||h.pop())&&((a?f.nodeName.toLowerCase()!==y:1!==f.nodeType)||!++p||(v&&((f[x]||(f[x]={}))[e]=[T,p]),f!==t)););return(p-=i)===r||p%r==0&&p/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?ae((function(e,n){for(var i,o=r(e,t),s=o.length;s--;)e[i=R.call(e,o[s])]=!(n[i]=o[s])})):function(e){return r(e,0,n)}):r}},pseudos:{not:ae((function(e){var t=[],n=[],r=u(e.replace(_,"$1"));return r[x]?ae((function(e,t,n,i){for(var o,s=r(e,null,i,[]),a=e.length;a--;)(o=s[a])&&(e[a]=!(t[a]=o))})):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}})),has:ae((function(e){return function(t){return oe(e,t).length>0}})),contains:ae((function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}})),lang:ae((function(e){return J.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(re,ie).toLowerCase(),function(t){var n;do{if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return!1===e.disabled},disabled:function(e){return!0===e.disabled},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return te.test(e.nodeName)},input:function(e){return ee.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:de((function(){return[0]})),last:de((function(e,t){return[t-1]})),eq:de((function(e,t,n){return[n<0?n+t:n]})),even:de((function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e})),odd:de((function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e})),lt:de((function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e})),gt:de((function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e}))}},o.pseudos.nth=o.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=fe(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=pe(n);function he(){}function ge(e,t){var n,r,i,s,a,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);for(a=e,u=[],l=o.preFilter;a;){for(s in n&&!(r=X.exec(a))||(r&&(a=a.slice(r[0].length)||a),u.push(i=[])),n=!1,(r=U.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace(_," ")}),a=a.slice(n.length)),o.filter)!(r=Q[s].exec(a))||l[s]&&!(r=l[s](r))||(n=r.shift(),i.push({value:n,type:s,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?oe.error(e):k(e,u).slice(0)}function me(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function ye(e,t,n){var r=t.dir,o=n&&"parentNode"===r,s=C++;return t.first?function(t,n,i){for(;t=t[r];)if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,a){var u,l,c,f=T+" "+s;if(a){for(;t=t[r];)if((1===t.nodeType||o)&&e(t,n,a))return!0}else for(;t=t[r];)if(1===t.nodeType||o)if((l=(c=t[x]||(t[x]={}))[r])&&l[0]===f){if(!0===(u=l[1])||u===i)return!0===u}else if((l=c[r]=[f])[1]=e(t,n,a)||i,!0===l[1])return!0}}function ve(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xe(e,t,n,r,i){for(var o,s=[],a=0,u=e.length,l=null!=t;a<u;a++)(o=e[a])&&(n&&!n(o,r,i)||(s.push(o),l&&t.push(a)));return s}function be(e,t,n,r,i,o){return r&&!r[x]&&(r=be(r)),i&&!i[x]&&(i=be(i,o)),ae((function(o,s,a,u){var l,c,f,p=[],d=[],h=s.length,g=o||function(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}(t||"*",a.nodeType?[a]:a,[]),m=!e||!o&&t?g:xe(g,p,e,a,u),y=n?i||(o?e:h||r)?[]:s:m;if(n&&n(m,y,a,u),r)for(l=xe(y,d),r(l,[],a,u),c=l.length;c--;)(f=l[c])&&(y[d[c]]=!(m[d[c]]=f));if(o){if(i||e){if(i){for(l=[],c=y.length;c--;)(f=y[c])&&l.push(m[c]=f);i(null,y=[],l,u)}for(c=y.length;c--;)(f=y[c])&&(l=i?R.call(o,f):p[c])>-1&&(o[l]=!(s[l]=f))}}else y=xe(y===s?y.splice(h,y.length):y),i?i(null,s,y,u):F.apply(s,y)}))}function we(e){for(var t,n,r,i=e.length,s=o.relative[e[0].type],a=s||o.relative[" "],u=s?1:0,c=ye((function(e){return e===t}),a,!0),f=ye((function(e){return R.call(t,e)>-1}),a,!0),p=[function(e,n,r){return!s&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r))}];u<i;u++)if(n=o.relative[e[u].type])p=[ye(ve(p),n)];else{if((n=o.filter[e[u].type].apply(null,e[u].matches))[x]){for(r=++u;r<i&&!o.relative[e[r].type];r++);return be(u>1&&ve(p),u>1&&me(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(_,"$1"),n,u<r&&we(e.slice(u,r)),r<i&&we(e=e.slice(r)),r<i&&me(e))}p.push(n)}return ve(p)}he.prototype=o.filters=o.pseudos,o.setFilters=new he,u=oe.compile=function(e,t){var n,r=[],s=[],a=E[e+" "];if(!a){for(t||(t=ge(e)),n=t.length;n--;)(a=we(t[n]))[x]?r.push(a):s.push(a);a=E(e,function(e,t){var n=0,r=t.length>0,s=e.length>0,a=function(a,u,c,f,d){var h,g,m,y=[],v=0,x="0",b=a&&[],w=null!=d,C=l,N=a||s&&o.find.TAG("*",d&&u.parentNode||u),k=T+=null==C?1:Math.random()||.1;for(w&&(l=u!==p&&u,i=n);null!=(h=N[x]);x++){if(s&&h){for(g=0;m=e[g++];)if(m(h,u,c)){f.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,a&&b.push(h))}if(v+=x,r&&x!==v){for(g=0;m=t[g++];)m(b,y,u,c);if(a){if(v>0)for(;x--;)b[x]||y[x]||(y[x]=H.call(f));y=xe(y)}F.apply(f,y),w&&!a&&y.length>0&&v+t.length>1&&oe.uniqueSort(f)}return w&&(T=k,l=C),b};return r?ae(a):a}(s,r))}return a},r.sortStable=x.split("").sort(j).join("")===x,r.detectDuplicates=S,f(),r.sortDetached=ue((function(e){return 1&e.compareDocumentPosition(p.createElement("div"))})),ue((function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")}))||le("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),r.attributes&&ue((function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||le("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),ue((function(e){return null==e.getAttribute("disabled")}))||le(M,(function(e,t,n){var r;if(!n)return(r=e.getAttributeNode(t))&&r.specified?r.value:!0===e[t]?t.toLowerCase():null})),b.find=oe,b.expr=oe.selectors,b.expr[":"]=b.expr.pseudos,b.unique=oe.uniqueSort,b.text=oe.getText,b.isXMLDoc=oe.isXML,b.contains=oe.contains}(e);var A,L,q,H,O,F,P={};b.Callbacks=function(e){e="string"==typeof e?P[e]||function(e){var t=P[e]={};return b.each(e.match(T)||[],(function(e,n){t[n]=!0})),t}(e):b.extend({},e);var n,r,i,o,s,a,u=[],l=!e.once&&[],c=function(t){for(n=e.memory&&t,r=!0,a=o||0,o=0,s=u.length,i=!0;u&&a<s;a++)if(!1===u[a].apply(t[0],t[1])&&e.stopOnFalse){n=!1;break}i=!1,u&&(l?l.length&&c(l.shift()):n?u=[]:f.disable())},f={add:function(){if(u){var t=u.length;!function t(n){b.each(n,(function(n,r){var i=b.type(r);"function"===i?e.unique&&f.has(r)||u.push(r):r&&r.length&&"string"!==i&&t(r)}))}(arguments),i?s=u.length:n&&(o=t,c(n))}return this},remove:function(){return u&&b.each(arguments,(function(e,t){for(var n;(n=b.inArray(t,u,n))>-1;)u.splice(n,1),i&&(n<=s&&s--,n<=a&&a--)})),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],s=0,this},disable:function(){return u=l=n=t,this},disabled:function(){return!u},lock:function(){return l=t,n||f.disable(),this},locked:function(){return!l},fireWith:function(e,t){return!u||r&&!l||(t=[e,(t=t||[]).slice?t.slice():t],i?l.push(t):c(t)),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!r}};return f},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred((function(n){b.each(t,(function(t,o){var s=o[0],a=b.isFunction(e[t])&&e[t];i[o[1]]((function(){var e=a&&a.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===r?n.promise():this,a?[e]:arguments)}))})),e=null})).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,(function(e,o){var s=o[2],a=o[3];r[o[1]]=s.add,a&&s.add((function(){n=a}),t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=s.fireWith})),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,i=0,o=g.call(arguments),s=o.length,a=1!==s||e&&b.isFunction(e.promise)?s:0,u=1===a?e:b.Deferred(),l=function(e,n,r){return function(i){n[e]=this,r[e]=arguments.length>1?g.call(arguments):i,r===t?u.notifyWith(n,r):--a||u.resolveWith(n,r)}};if(s>1)for(t=new Array(s),n=new Array(s),r=new Array(s);i<s;i++)o[i]&&b.isFunction(o[i].promise)?o[i].promise().done(l(i,r,o)).fail(u.reject).progress(l(i,n,t)):--a;return a||u.resolveWith(r,o),u.promise()}}),b.support=(A={},L=s.createElement("input"),q=s.createDocumentFragment(),H=s.createElement("div"),O=s.createElement("select"),F=O.appendChild(s.createElement("option")),L.type?(L.type="checkbox",A.checkOn=""!==L.value,A.optSelected=F.selected,A.reliableMarginRight=!0,A.boxSizingReliable=!0,A.pixelPosition=!1,L.checked=!0,A.noCloneChecked=L.cloneNode(!0).checked,O.disabled=!0,A.optDisabled=!F.disabled,(L=s.createElement("input")).value="t",L.type="radio",A.radioValue="t"===L.value,L.setAttribute("checked","t"),L.setAttribute("name","t"),q.appendChild(L),A.checkClone=q.cloneNode(!0).cloneNode(!0).lastChild.checked,A.focusinBubbles="onfocusin"in e,H.style.backgroundClip="content-box",H.cloneNode(!0).style.backgroundClip="",A.clearCloneStyle="content-box"===H.style.backgroundClip,b((function(){var t,n,r=s.getElementsByTagName("body")[0];r&&((t=s.createElement("div")).style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",r.appendChild(t).appendChild(H),H.innerHTML="",H.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",b.swap(r,null!=r.style.zoom?{zoom:1}:{},(function(){A.boxSizing=4===H.offsetWidth})),e.getComputedStyle&&(A.pixelPosition="1%"!==(e.getComputedStyle(H,null)||{}).top,A.boxSizingReliable="4px"===(e.getComputedStyle(H,null)||{width:"4px"}).width,(n=H.appendChild(s.createElement("div"))).style.cssText=H.style.cssText="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",n.style.marginRight=n.style.width="0",H.style.width="1px",A.reliableMarginRight=!parseFloat((e.getComputedStyle(n,null)||{}).marginRight)),r.removeChild(t))})),A):A);var R,M,W=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,$=/([A-Z])/g;function B(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=b.expando+Math.random()}function I(e,n,r){var i;if(r===t&&1===e.nodeType)if(i="data-"+n.replace($,"-$1").toLowerCase(),"string"==typeof(r=e.getAttribute(i))){try{r="true"===r||"false"!==r&&("null"===r?null:+r+""===r?+r:W.test(r)?JSON.parse(r):r)}catch(e){}R.set(e,n,r)}else r=t;return r}B.uid=1,B.accepts=function(e){return!e.nodeType||(1===e.nodeType||9===e.nodeType)},B.prototype={key:function(e){if(!B.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=B.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,b.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),o=this.cache[i];if("string"==typeof t)o[t]=n;else if(b.isEmptyObject(o))b.extend(this.cache[i],t);else for(r in t)o[r]=t[r];return o},get:function(e,n){var r=this.cache[this.key(e)];return n===t?r:r[n]},access:function(e,n,r){var i;return n===t||n&&"string"==typeof n&&r===t?(i=this.get(e,n))!==t?i:this.get(e,b.camelCase(n)):(this.set(e,n,r),r!==t?r:n)},remove:function(e,n){var r,i,o,s=this.key(e),a=this.cache[s];if(n===t)this.cache[s]={};else{b.isArray(n)?i=n.concat(n.map(b.camelCase)):(o=b.camelCase(n),i=n in a?[n,o]:(i=o)in a?[i]:i.match(T)||[]),r=i.length;for(;r--;)delete a[i[r]]}},hasData:function(e){return!b.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}},R=new B,M=new B,b.extend({acceptData:B.accepts,hasData:function(e){return R.hasData(e)||M.hasData(e)},data:function(e,t,n){return R.access(e,t,n)},removeData:function(e,t){R.remove(e,t)},_data:function(e,t,n){return M.access(e,t,n)},_removeData:function(e,t){M.remove(e,t)}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],s=0,a=null;if(e===t){if(this.length&&(a=R.get(o),1===o.nodeType&&!M.get(o,"hasDataAttrs"))){for(r=o.attributes;s<r.length;s++)0===(i=r[s].name).indexOf("data-")&&(i=b.camelCase(i.slice(5)),I(o,i,a[i]));M.set(o,"hasDataAttrs",!0)}return a}return"object"==typeof e?this.each((function(){R.set(this,e)})):b.access(this,(function(n){var r,i=b.camelCase(e);if(o&&n===t)return(r=R.get(o,e))!==t||(r=R.get(o,i))!==t||(r=I(o,i,t))!==t?r:void 0;this.each((function(){var r=R.get(this,i);R.set(this,i,n),-1!==e.indexOf("-")&&r!==t&&R.set(this,e,n)}))}),null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each((function(){R.remove(this,e)}))}}),b.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=M.get(e,t),n&&(!r||b.isArray(n)?r=M.access(e,t,b.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,(function(){b.dequeue(e,t)}),o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return M.get(e,n)||M.access(e,n,{empty:b.Callbacks("once memory").add((function(){M.remove(e,[t+"queue",n])}))})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),arguments.length<r?b.queue(this[0],e):n===t?this:this.each((function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)}))},dequeue:function(e){return this.each((function(){b.dequeue(this,e)}))},delay:function(e,t){return e=b.fx&&b.fx.speeds[e]||e,t=t||"fx",this.queue(t,(function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}}))},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),s=this,a=this.length,u=function(){--i||o.resolveWith(s,[s])};for("string"!=typeof e&&(n=e,e=t),e=e||"fx";a--;)(r=M.get(s[a],e+"queueHooks"))&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var z,_=/[\t\r\n\f]/g,X=/\r/g,U=/^(?:input|select|textarea|button)$/i;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each((function(){b.removeAttr(this,e)}))},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[b.propFix[e]||e]}))},addClass:function(e){var t,n,r,i,o,s=0,a=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each((function(t){b(this).addClass(e.call(this,t,this.className))}));if(u)for(t=(e||"").match(T)||[];s<a;s++)if(r=1===(n=this[s]).nodeType&&(n.className?(" "+n.className+" ").replace(_," "):" ")){for(o=0;i=t[o++];)r.indexOf(" "+i+" ")<0&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,s=0,a=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each((function(t){b(this).removeClass(e.call(this,t,this.className))}));if(u)for(t=(e||"").match(T)||[];s<a;s++)if(r=1===(n=this[s]).nodeType&&(n.className?(" "+n.className+" ").replace(_," "):"")){for(o=0;i=t[o++];)for(;r.indexOf(" "+i+" ")>=0;)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):b.isFunction(e)?this.each((function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)})):this.each((function(){if("string"===n)for(var t,r=0,o=b(this),s=e.match(T)||[];t=s[r++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else n!==i&&"boolean"!==n||(this.className&&M.set(this,"__className__",this.className),this.className=this.className||!1===e?"":M.get(this,"__className__")||"")}))},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;n<r;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(_," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];return arguments.length?(i=b.isFunction(e),this.each((function(r){var o;1===this.nodeType&&(null==(o=i?e.call(this,r,b(this).val()):e)?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,(function(e){return null==e?"":e+""}))),(n=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()])&&"set"in n&&n.set(this,o,"value")!==t||(this.value=o))}))):o?(n=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()])&&"get"in n&&(r=n.get(o,"value"))!==t?r:"string"==typeof(r=o.value)?r.replace(X,""):null==r?"":r:void 0}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||i<0,s=o?null:[],a=o?i+1:r.length,u=i<0?a:o?i:0;u<a;u++)if(((n=r[u]).selected||u===i)&&(b.support.optDisabled?!n.disabled:null===n.getAttribute("disabled"))&&(!n.parentNode.disabled||!b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;s.push(t)}return s},set:function(e,t){for(var n,r,i=e.options,o=b.makeArray(t),s=i.length;s--;)((r=i[s]).selected=b.inArray(b(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,s,a=e.nodeType;if(e&&3!==a&&8!==a&&2!==a)return typeof e.getAttribute===i?b.prop(e,n,r):(1===a&&b.isXMLDoc(e)||(n=n.toLowerCase(),o=b.attrHooks[n]||(b.expr.match.bool.test(n)?z:undefined)),r===t?o&&"get"in o&&null!==(s=o.get(e,n))?s:null==(s=b.find.attr(e,n))?t:s:null!==r?o&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):void b.removeAttr(e,n))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)for(;n=o[i++];)r=b.propFix[n]||n,b.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{for:"htmlFor",class:"className"},prop:function(e,n,r){var i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return(1!==s||!b.isXMLDoc(e))&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||U.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),z={set:function(e,t,n){return!1===t?b.removeAttr(e,n):e.setAttribute(n,n),n}},b.each(b.expr.match.bool.source.match(/\w+/g),(function(e,n){var r=b.expr.attrHandle[n]||b.find.attr;b.expr.attrHandle[n]=function(e,n,i){var o=b.expr.attrHandle[n],s=i?t:(b.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return b.expr.attrHandle[n]=o,s}})),b.support.optSelected||(b.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),b.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){b.propFix[this.toLowerCase()]=this})),b.each(["radio","checkbox"],(function(){b.valHooks[this]={set:function(e,t){if(b.isArray(t))return e.checked=b.inArray(b(e).val(),t)>=0}},b.support.checkOn||(b.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}));var Y=/^key/,V=/^(?:mouse|contextmenu)|click/,G=/^(?:focusinfocus|focusoutblur)$/,J=/^([^.]*)(?:\.(.+)|)$/;function Q(){return!0}function K(){return!1}function Z(){try{return s.activeElement}catch(e){}}b.event={global:{},add:function(e,n,r,o,s){var a,u,l,c,f,p,d,h,g,m,y,v=M.get(e);if(v){for(r.handler&&(r=(a=r).handler,s=a.selector),r.guid||(r.guid=b.guid++),(c=v.events)||(c=v.events={}),(u=v.handle)||(u=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(u.elem,arguments)},u.elem=e),f=(n=(n||"").match(T)||[""]).length;f--;)g=y=(l=J.exec(n[f])||[])[1],m=(l[2]||"").split(".").sort(),g&&(d=b.event.special[g]||{},g=(s?d.delegateType:d.bindType)||g,d=b.event.special[g]||{},p=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:s,needsContext:s&&b.expr.match.needsContext.test(s),namespace:m.join(".")},a),(h=c[g])||((h=c[g]=[]).delegateCount=0,d.setup&&!1!==d.setup.call(e,o,m,u)||e.addEventListener&&e.addEventListener(g,u,!1)),d.add&&(d.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?h.splice(h.delegateCount++,0,p):h.push(p),b.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,s,a,u,l,c,f,p,d,h,g,m=M.hasData(e)&&M.get(e);if(m&&(u=m.events)){for(l=(t=(t||"").match(T)||[""]).length;l--;)if(d=g=(a=J.exec(t[l])||[])[1],h=(a[2]||"").split(".").sort(),d){for(f=b.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],a=a[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=p.length;o--;)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));s&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,m.handle)||b.removeEvent(e,d,m.handle),delete u[d])}else for(d in u)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(u)&&(delete m.handle,M.remove(e,"events"))}},trigger:function(n,r,i,o){var a,u,l,c,f,p,d,h=[i||s],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=l=i=i||s,3!==i.nodeType&&8!==i.nodeType&&!G.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),f=g.indexOf(":")<0&&"on"+g,(n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n)).isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),d=b.event.special[g]||{},o||!d.trigger||!1!==d.trigger.apply(i,r))){if(!o&&!d.noBubble&&!b.isWindow(i)){for(c=d.delegateType||g,G.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),l=u;l===(i.ownerDocument||s)&&h.push(l.defaultView||l.parentWindow||e)}for(a=0;(u=h[a++])&&!n.isPropagationStopped();)n.type=a>1?c:d.bindType||g,(p=(M.get(u,"events")||{})[n.type]&&M.get(u,"handle"))&&p.apply(u,r),(p=f&&u[f])&&b.acceptData(u)&&p.apply&&!1===p.apply(u,r)&&n.preventDefault();return n.type=g,o||n.isDefaultPrevented()||d._default&&!1!==d._default.apply(h.pop(),r)||!b.acceptData(i)||f&&b.isFunction(i[g])&&!b.isWindow(i)&&((l=i[f])&&(i[f]=null),b.event.triggered=g,i[g](),b.event.triggered=t,l&&(i[f]=l)),n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,s,a,u=g.call(arguments),l=(M.get(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,e)){for(a=b.event.handlers.call(this,e,l),n=0;(o=a[n++])&&!e.isPropagationStopped();)for(e.currentTarget=o.elem,r=0;(s=o.handlers[r++])&&!e.isImmediatePropagationStopped();)e.namespace_re&&!e.namespace_re.test(s.namespace)||(e.handleObj=s,e.data=s.data,(i=((b.event.special[s.origType]||{}).handle||s.handler).apply(o.elem,u))!==t&&!1===(e.result=i)&&(e.preventDefault(),e.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,s,a=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!==this;l=l.parentNode||this)if(!0!==l.disabled||"click"!==e.type){for(i=[],r=0;r<u;r++)i[o=(s=n[r]).selector+" "]===t&&(i[o]=s.needsContext?b(o,this).index(l)>=0:b.find(o,this,null,[l]).length),i[o]&&i.push(s);i.length&&a.push({elem:l,handlers:i})}return u<n.length&&a.push({elem:this,handlers:n.slice(u)}),a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,a=n.button;return null==e.pageX&&null!=n.clientX&&(i=(r=e.target.ownerDocument||s).documentElement,o=r.body,e.pageX=n.clientX+(i&&i.scrollLeft||o&&o.scrollLeft||0)-(i&&i.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(i&&i.scrollTop||o&&o.scrollTop||0)-(i&&i.clientTop||o&&o.clientTop||0)),e.which||a===t||(e.which=1&a?1:2&a?3:4&a?2:0),e}},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,o=e,a=this.fixHooks[i];for(a||(this.fixHooks[i]=a=V.test(i)?this.mouseHooks:Y.test(i)?this.keyHooks:{}),r=a.props?this.props.concat(a.props):this.props,e=new b.Event(o),t=r.length;t--;)e[n=r[t]]=o[n];return e.target||(e.target=s),3===e.target.nodeType&&(e.target=e.target.parentNode),a.filter?a.filter(e,o):e},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Z()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Z()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&b.nodeName(this,"input"))return this.click(),!1},_default:function(e){return b.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},b.Event=function(e,t){if(!(this instanceof b.Event))return new b.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.getPreventDefault&&e.getPreventDefault()?Q:K):this.type=e,t&&b.extend(this,t),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0},b.Event.prototype={isDefaultPrevented:K,isPropagationStopped:K,isImmediatePropagationStopped:K,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Q,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Q,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Q,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},(function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=e.relatedTarget,i=e.handleObj;return r&&(r===this||b.contains(this,r))||(e.type=i.origType,n=i.handler.apply(this,arguments),e.type=t),n}}})),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},(function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0==n++&&s.addEventListener(e,r,!0)},teardown:function(){0==--n&&s.removeEventListener(e,r,!0)}}})),b.fn.extend({on:function(e,n,r,i,o){var s,a;if("object"==typeof e){for(a in"string"!=typeof n&&(r=r||n,n=t),e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),!1===i)i=K;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each((function(){b.event.add(this,e,i,r,n)}))},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return!1!==n&&"function"!=typeof n||(r=n,n=t),!1===r&&(r=K),this.each((function(){b.event.remove(this,e,r,n)}))},trigger:function(e,t){return this.each((function(){b.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return b.event.trigger(e,t,n,!0)}});var ee=/^.[^:#\[\.,]*$/,te=/^(?:parents|prev(?:Until|All))/,ne=b.expr.match.needsContext,re={children:!0,contents:!0,next:!0,prev:!0};function ie(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function oe(e,t,n){if(b.isFunction(t))return b.grep(e,(function(e,r){return!!t.call(e,r,e)!==n}));if(t.nodeType)return b.grep(e,(function(e){return e===t!==n}));if("string"==typeof t){if(ee.test(t))return b.filter(t,e,n);t=b.filter(t,e)}return b.grep(e,(function(e){return m.call(t,e)>=0!==n}))}b.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(b(e).filter((function(){for(t=0;t<i;t++)if(b.contains(r[t],this))return!0})));for(t=0;t<i;t++)b.find(e,r[t],n);return(n=this.pushStack(i>1?b.unique(n):n)).selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t=b(e,this),n=t.length;return this.filter((function(){for(var e=0;e<n;e++)if(b.contains(this,t[e]))return!0}))},not:function(e){return this.pushStack(oe(this,e||[],!0))},filter:function(e){return this.pushStack(oe(this,e||[],!1))},is:function(e){return!!oe(this,"string"==typeof e&&ne.test(e)?b(e):e||[],!1).length},closest:function(e,t){for(var n,r=0,i=this.length,o=[],s=ne.test(e)||"string"!=typeof e?b(e,t||this.context):0;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(s?s.index(n)>-1:1===n.nodeType&&b.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?m.call(b(e),this[0]):m.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return ie(e,"nextSibling")},prev:function(e){return ie(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return e.contentDocument||b.merge([],e.childNodes)}},(function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),this.length>1&&(re[e]||b.unique(i),te.test(e)&&i.reverse()),this.pushStack(i)}})),b.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?b.find.matchesSelector(r,e)?[r]:[]:b.find.matches(e,b.grep(t,(function(e){return 1===e.nodeType})))},dir:function(e,n,r){for(var i=[],o=r!==t;(e=e[n])&&9!==e.nodeType;)if(1===e.nodeType){if(o&&b(e).is(r))break;i.push(e)}return i},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});var se=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ae=/<([\w:]+)/,ue=/<|&#?\w+;/,le=/<(?:script|style|link)/i,ce=/^(?:checkbox|radio)$/i,fe=/checked\s*(?:[^=]|=\s*.checked.)/i,pe=/^$|\/(?:java|ecma)script/i,de=/^true\/(.*)/,he=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function me(e,t){return b.nodeName(e,"table")&&b.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ye(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function ve(e){var t=de.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function xe(e,t){for(var n=e.length,r=0;r<n;r++)M.set(e[r],"globalEval",!t||M.get(t[r],"globalEval"))}function be(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(M.hasData(e)&&(o=M.access(e),s=M.set(t,o),l=o.events))for(i in delete s.handle,s.events={},l)for(n=0,r=l[i].length;n<r;n++)b.event.add(t,i,l[i][n]);R.hasData(e)&&(a=R.access(e),u=b.extend({},a),R.set(t,u))}}function we(e,n){var r=e.getElementsByTagName?e.getElementsByTagName(n||"*"):e.querySelectorAll?e.querySelectorAll(n||"*"):[];return n===t||n&&b.nodeName(e,n)?b.merge([e],r):r}function Te(e,t){var n=t.nodeName.toLowerCase();"input"===n&&ce.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td,b.fn.extend({text:function(e){return b.access(this,(function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(e))}),null,e,arguments.length)},append:function(){return this.domManip(arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||me(this,e).appendChild(e)}))},prepend:function(){return this.domManip(arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=me(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return this.domManip(arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return this.domManip(arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},remove:function(e,t){for(var n,r=e?b.filter(e,this):this,i=0;null!=(n=r[i]);i++)t||1!==n.nodeType||b.cleanData(we(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&xe(we(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(b.cleanData(we(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return b.clone(this,e,t)}))},html:function(e){return b.access(this,(function(e){var n=this[0]||{},r=0,i=this.length;if(e===t&&1===n.nodeType)return n.innerHTML;if("string"==typeof e&&!le.test(e)&&!ge[(ae.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(se,"<$1></$2>");try{for(;r<i;r++)1===(n=this[r]||{}).nodeType&&(b.cleanData(we(n,!1)),n.innerHTML=e);n=0}catch(e){}}n&&this.empty().append(e)}),null,e,arguments.length)},replaceWith:function(){var e=b.map(this,(function(e){return[e.nextSibling,e.parentNode]})),t=0;return this.domManip(arguments,(function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),b(this).remove(),i.insertBefore(n,r))}),!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,s,a,u,l=0,c=this.length,f=this,p=c-1,h=e[0],g=b.isFunction(h);if(g||!(c<=1||"string"!=typeof h||b.support.checkClone)&&fe.test(h))return this.each((function(r){var i=f.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)}));if(c&&(i=(r=b.buildFragment(e,this[0].ownerDocument,!1,!n&&this)).firstChild,1===r.childNodes.length&&(r=i),i)){for(s=(o=b.map(we(r,"script"),ye)).length;l<c;l++)a=r,l!==p&&(a=b.clone(a,!0,!0),s&&b.merge(o,we(a,"script"))),t.call(this[l],a,l);if(s)for(u=o[o.length-1].ownerDocument,b.map(o,ve),l=0;l<s;l++)a=o[l],pe.test(a.type||"")&&!M.access(a,"globalEval")&&b.contains(u,a)&&(a.src?b._evalUrl(a.src):b.globalEval(a.textContent.replace(he,"")))}return this}}),b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},(function(e,t){b.fn[e]=function(e){for(var n,r=[],i=b(e),o=i.length-1,s=0;s<=o;s++)n=s===o?this:this.clone(!0),b(i[s])[t](n),h.apply(r,n.get());return this.pushStack(r)}})),b.extend({clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),u=b.contains(e.ownerDocument,e);if(!(b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(s=we(a),r=0,i=(o=we(e)).length;r<i;r++)Te(o[r],s[r]);if(t)if(n)for(o=o||we(e),s=s||we(a),r=0,i=o.length;r<i;r++)be(o[r],s[r]);else be(e,a);return(s=we(a,"script")).length>0&&xe(s,!u&&we(e,"script")),a},buildFragment:function(e,t,n,r){for(var i,o,s,a,u,l,c=0,f=e.length,p=t.createDocumentFragment(),d=[];c<f;c++)if((i=e[c])||0===i)if("object"===b.type(i))b.merge(d,i.nodeType?[i]:i);else if(ue.test(i)){for(o=o||p.appendChild(t.createElement("div")),s=(ae.exec(i)||["",""])[1].toLowerCase(),a=ge[s]||ge._default,o.innerHTML=a[1]+i.replace(se,"<$1></$2>")+a[2],l=a[0];l--;)o=o.lastChild;b.merge(d,o.childNodes),(o=p.firstChild).textContent=""}else d.push(t.createTextNode(i));for(p.textContent="",c=0;i=d[c++];)if((!r||-1===b.inArray(i,r))&&(u=b.contains(i.ownerDocument,i),o=we(p.appendChild(i),"script"),u&&xe(o),n))for(l=0;i=o[l++];)pe.test(i.type||"")&&n.push(i);return p},cleanData:function(e){for(var n,r,i,o,s,a,u=b.event.special,l=0;(r=e[l])!==t;l++){if(B.accepts(r)&&(s=r[M.expando])&&(n=M.cache[s])){if((i=Object.keys(n.events||{})).length)for(a=0;(o=i[a])!==t;a++)u[o]?b.event.remove(r,o):b.removeEvent(r,o,n.handle);M.cache[s]&&delete M.cache[s]}delete R.cache[r[R.expando]]}},_evalUrl:function(e){return b.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})}}),b.fn.extend({wrapAll:function(e){var t;return b.isFunction(e)?this.each((function(t){b(this).wrapAll(e.call(this,t))})):(this[0]&&(t=b(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this)},wrapInner:function(e){return b.isFunction(e)?this.each((function(t){b(this).wrapInner(e.call(this,t))})):this.each((function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=b.isFunction(e);return this.each((function(n){b(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(){return this.parent().each((function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)})).end()}});var Ce,Ne,ke=/^(none|table(?!-c[ea]).+)/,Ee=/^margin/,Se=new RegExp("^("+w+")(.*)$","i"),je=new RegExp("^("+w+")(?!px)[a-z%]+$","i"),De=new RegExp("^([+-])=("+w+")","i"),Ae={BODY:"block"},Le={position:"absolute",visibility:"hidden",display:"block"},qe={letterSpacing:0,fontWeight:400},He=["Top","Right","Bottom","Left"],Oe=["Webkit","O","Moz","ms"];function Fe(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Oe.length;i--;)if((t=Oe[i]+n)in e)return t;return r}function Pe(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function Re(t){return e.getComputedStyle(t,null)}function Me(e,t){for(var n,r,i,o=[],s=0,a=e.length;s<a;s++)(r=e[s]).style&&(o[s]=M.get(r,"olddisplay"),n=r.style.display,t?(o[s]||"none"!==n||(r.style.display=""),""===r.style.display&&Pe(r)&&(o[s]=M.access(r,"olddisplay",Ie(r.nodeName)))):o[s]||(i=Pe(r),(n&&"none"!==n||!i)&&M.set(r,"olddisplay",i?n:b.css(r,"display"))));for(s=0;s<a;s++)(r=e[s]).style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[s]||"":"none"));return e}function We(e,t,n){var r=Se.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function $e(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;o<4;o+=2)"margin"===n&&(s+=b.css(e,n+He[o],!0,i)),r?("content"===n&&(s-=b.css(e,"padding"+He[o],!0,i)),"margin"!==n&&(s-=b.css(e,"border"+He[o]+"Width",!0,i))):(s+=b.css(e,"padding"+He[o],!0,i),"padding"!==n&&(s+=b.css(e,"border"+He[o]+"Width",!0,i)));return s}function Be(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Re(e),s=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(i<=0||null==i){if(((i=Ce(e,t,o))<0||null==i)&&(i=e.style[t]),je.test(i))return i;r=s&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+$e(e,t,n||(s?"border":"content"),r,o)+"px"}function Ie(e){var t=s,n=Ae[e];return n||("none"!==(n=ze(e,t))&&n||((t=((Ne=(Ne||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement))[0].contentWindow||Ne[0].contentDocument).document).write("<!doctype html><html><body>"),t.close(),n=ze(e,t),Ne.detach()),Ae[e]=n),n}function ze(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.fn.extend({css:function(e,n){return b.access(this,(function(e,n,r){var i,o,s={},a=0;if(b.isArray(n)){for(i=Re(e),o=n.length;a<o;a++)s[n[a]]=b.css(e,n[a],!1,i);return s}return r!==t?b.style(e,n,r):b.css(e,n)}),e,n,arguments.length>1)},show:function(){return Me(this,!0)},hide:function(){return Me(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each((function(){Pe(this)?b(this).show():b(this).hide()}))}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ce(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:"cssFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,s,a,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=Fe(l,u)),a=b.cssHooks[n]||b.cssHooks[u],r===t)return a&&"get"in a&&(o=a.get(e,!1,i))!==t?o:l[n];"string"===(s=typeof r)&&(o=De.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),s="number"),null==r||"number"===s&&isNaN(r)||("number"!==s||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),a&&"set"in a&&(r=a.set(e,r,i))===t||(l[n]=r))}},css:function(e,n,r,i){var o,s,a,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=Fe(e.style,u)),(a=b.cssHooks[n]||b.cssHooks[u])&&"get"in a&&(o=a.get(e,!0,r)),o===t&&(o=Ce(e,n,i)),"normal"===o&&n in qe&&(o=qe[n]),""===r||r?(s=parseFloat(o),!0===r||b.isNumeric(s)?s||0:o):o}}),Ce=function(e,n,r){var i,o,s,a=r||Re(e),u=a?a.getPropertyValue(n)||a[n]:t,l=e.style;return a&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),je.test(u)&&Ee.test(n)&&(i=l.width,o=l.minWidth,s=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=a.width,l.width=i,l.minWidth=o,l.maxWidth=s)),u},b.each(["height","width"],(function(e,t){b.cssHooks[t]={get:function(e,n,r){if(n)return 0===e.offsetWidth&&ke.test(b.css(e,"display"))?b.swap(e,Le,(function(){return Be(e,t,r)})):Be(e,t,r)},set:function(e,n,r){var i=r&&Re(e);return We(0,n,r?$e(e,t,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}})),b((function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,t){if(t)return b.swap(e,{display:"inline-block"},Ce,[e,"marginRight"])}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],(function(e,t){b.cssHooks[t]={get:function(e,n){if(n)return n=Ce(e,t),je.test(n)?b(e).position()[t]+"px":n}}}))})),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},(function(e,t){b.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+He[r]+t]=o[r]||o[r-2]||o[0];return i}},Ee.test(e)||(b.cssHooks[e+t].set=We)}));var _e=/%20/g,Xe=/\[\]$/,Ue=/\r?\n/g,Ye=/^(?:submit|button|image|reset|file)$/i,Ve=/^(?:input|select|textarea|keygen)/i;function Ge(e,t,n,r){var i;if(b.isArray(t))b.each(t,(function(t,i){n||Xe.test(e)?r(e,i):Ge(e+"["+("object"==typeof i?t:"")+"]",i,n,r)}));else if(n||"object"!==b.type(t))r(e,t);else for(i in t)Ge(e+"["+i+"]",t[i],n,r)}b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&Ve.test(this.nodeName)&&!Ye.test(e)&&(this.checked||!ce.test(e))})).map((function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,(function(e){return{name:t.name,value:e.replace(Ue,"\r\n")}})):{name:t.name,value:n.replace(Ue,"\r\n")}})).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,(function(){o(this.name,this.value)}));else for(r in e)Ge(r,e[r],n,o);return i.join("&").replace(_e,"+")},b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),(function(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}})),b.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var Je,Qe,Ke=b.now(),Ze=/\?/,et=/#.*$/,tt=/([?&])_=[^&]*/,nt=/^(.*?):[ \t]*([^\r\n]*)$/gm,rt=/^(?:GET|HEAD)$/,it=/^\/\//,ot=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,st=b.fn.load,at={},ut={},lt="*/".concat("*");try{Qe=o.href}catch(e){(Qe=s.createElement("a")).href="",Qe=Qe.href}function ct(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(b.isFunction(n))for(;r=o[i++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function ft(e,t,n,r){var i={},o=e===ut;function s(a){var u;return i[a]=!0,b.each(e[a]||[],(function(e,a){var l=a(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),s(l),!1)})),u}return s(t.dataTypes[0])||!i["*"]&&s("*")}function pt(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((o[r]?e:i||(i={}))[r]=n[r]);return i&&b.extend(!0,e,i),e}Je=ot.exec(Qe.toLowerCase())||[],b.fn.load=function(e,n,r){if("string"!=typeof e&&st)return st.apply(this,arguments);var i,o,s,a=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(o="POST"),a.length>0&&b.ajax({url:e,type:o,dataType:"html",data:n}).done((function(e){s=arguments,a.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)})).complete(r&&function(e,t){a.each(r,s||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],(function(e,t){b.fn[t]=function(e){return this.on(t,e)}})),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Qe,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Je[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":lt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?pt(pt(e,b.ajaxSettings),t):pt(b.ajaxSettings,e)},ajaxPrefilter:ct(at),ajaxTransport:ct(ut),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,s,a,u,l,c,f=b.ajaxSetup({},n),p=f.context||f,d=f.context&&(p.nodeType||p.jquery)?b(p):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=f.statusCode||{},y={},v={},x=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!s)for(s={};t=nt.exec(o);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?o:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(x<2)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return r&&r.abort(t),N(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,f.url=((e||f.url||Qe)+"").replace(et,"").replace(it,Je[1]+"//"),f.type=n.method||n.type||f.method||f.type,f.dataTypes=b.trim(f.dataType||"*").toLowerCase().match(T)||[""],null==f.crossDomain&&(u=ot.exec(f.url.toLowerCase()),f.crossDomain=!(!u||u[1]===Je[1]&&u[2]===Je[2]&&(u[3]||("http:"===u[1]?"80":"443"))===(Je[3]||("http:"===Je[1]?"80":"443")))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=b.param(f.data,f.traditional)),ft(at,f,n,C),2===x)return C;for(c in(l=f.global)&&0==b.active++&&b.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!rt.test(f.type),i=f.url,f.hasContent||(f.data&&(i=f.url+=(Ze.test(i)?"&":"?")+f.data,delete f.data),!1===f.cache&&(f.url=tt.test(i)?i.replace(tt,"$1_="+Ke++):i+(Ze.test(i)?"&":"?")+"_="+Ke++)),f.ifModified&&(b.lastModified[i]&&C.setRequestHeader("If-Modified-Since",b.lastModified[i]),b.etag[i]&&C.setRequestHeader("If-None-Match",b.etag[i])),(f.data&&f.hasContent&&!1!==f.contentType||n.contentType)&&C.setRequestHeader("Content-Type",f.contentType),C.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+lt+"; q=0.01":""):f.accepts["*"]),f.headers)C.setRequestHeader(c,f.headers[c]);if(f.beforeSend&&(!1===f.beforeSend.call(p,C,f)||2===x))return C.abort();for(c in w="abort",{success:1,error:1,complete:1})C[c](f[c]);if(r=ft(ut,f,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,f]),f.async&&f.timeout>0&&(a=setTimeout((function(){C.abort("timeout")}),f.timeout));try{x=1,r.send(y,N)}catch(e){if(!(x<2))throw e;N(-1,e)}}else N(-1,"No Transport");function N(e,n,s,u){var c,y,v,w,T,N=n;2!==x&&(x=2,a&&clearTimeout(a),r=t,o=u||"",C.readyState=e>0?4:0,c=e>=200&&e<300||304===e,s&&(w=function(e,n,r){var i,o,s,a,u=e.contents,l=e.dataTypes;for(;"*"===l[0];)l.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("Content-Type"));if(i)for(o in u)if(u[o]&&u[o].test(i)){l.unshift(o);break}if(l[0]in r)s=l[0];else{for(o in r){if(!l[0]||e.converters[o+" "+l[0]]){s=o;break}a||(a=o)}s=s||a}if(s)return s!==l[0]&&l.unshift(s),r[s]}(f,C,s)),w=function(e,t,n,r){var i,o,s,a,u,l={},c=e.dataTypes.slice();if(c[1])for(s in e.converters)l[s.toLowerCase()]=e.converters[s];o=c.shift();for(;o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(s=l[u+" "+o]||l["* "+o]))for(i in l)if((a=i.split(" "))[1]===o&&(s=l[u+" "+a[0]]||l["* "+a[0]])){!0===s?s=l[i]:!0!==l[i]&&(o=a[0],c.unshift(a[1]));break}if(!0!==s)if(s&&e.throws)t=s(t);else try{t=s(t)}catch(e){return{state:"parsererror",error:s?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(f,w,C,c),c?(f.ifModified&&((T=C.getResponseHeader("Last-Modified"))&&(b.lastModified[i]=T),(T=C.getResponseHeader("etag"))&&(b.etag[i]=T)),204===e||"HEAD"===f.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,c=!(v=w.error))):(v=N,!e&&N||(N="error",e<0&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(p,[y,N,C]):h.rejectWith(p,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,f,c?y:v]),g.fireWith(p,[C,N]),l&&(d.trigger("ajaxComplete",[C,f]),--b.active||b.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return b.get(e,t,n,"json")},getScript:function(e,n){return b.get(e,t,n,"script")}}),b.each(["get","post"],(function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}})),b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",(function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),b.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain)return{send:function(r,i){t=b("<script>").prop({async:!0,charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),s.head.appendChild(t[0])},abort:function(){n&&n()}}}));var dt=[],ht=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=dt.pop()||b.expando+"_"+Ke++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",(function(n,r,i){var o,s,a,u=!1!==n.jsonp&&(ht.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&ht.test(n.data)&&"data");if(u||"jsonp"===n.dataTypes[0])return o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(ht,"$1"+o):!1!==n.jsonp&&(n.url+=(Ze.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return a||b.error(o+" was not called"),a[0]},n.dataTypes[0]="json",s=e[o],e[o]=function(){a=arguments},i.always((function(){e[o]=s,n[o]&&(n.jsonpCallback=r.jsonpCallback,dt.push(o)),a&&b.isFunction(s)&&s(a[0]),a=s=t})),"script"})),b.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var gt=b.ajaxSettings.xhr(),mt={0:200,1223:204},yt=0,vt={};e.ActiveXObject&&b(e).on("unload",(function(){for(var e in vt)vt[e]();vt=t})),b.support.cors=!!gt&&"withCredentials"in gt,b.support.ajax=gt=!!gt,b.ajaxTransport((function(e){var n;if(b.support.cors||gt&&!e.crossDomain)return{send:function(r,i){var o,s,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)a[o]=e.xhrFields[o];for(o in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)a.setRequestHeader(o,r[o]);n=function(e){return function(){n&&(delete vt[s],n=a.onload=a.onerror=null,"abort"===e?a.abort():"error"===e?i(a.status||404,a.statusText):i(mt[a.status]||a.status,a.statusText,"string"==typeof a.responseText?{text:a.responseText}:t,a.getAllResponseHeaders()))}},a.onload=n(),a.onerror=n("error"),n=vt[s=yt++]=n("abort"),a.send(e.hasContent&&e.data||null)},abort:function(){n&&n()}}}));var xt,bt,wt=/^(?:toggle|show|hide)$/,Tt=new RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Ct=/queueHooks$/,Nt=[function(e,n,r){var i,o,s,a,u,l,c=this,f={},p=e.style,d=e.nodeType&&Pe(e),h=M.get(e,"fxshow");r.queue||(null==(u=b._queueHooks(e,"fx")).unqueued&&(u.unqueued=0,l=u.empty.fire,u.empty.fire=function(){u.unqueued||l()}),u.unqueued++,c.always((function(){c.always((function(){u.unqueued--,b.queue(e,"fx").length||u.empty.fire()}))})));1===e.nodeType&&("height"in n||"width"in n)&&(r.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(p.display="inline-block"));r.overflow&&(p.overflow="hidden",c.always((function(){p.overflow=r.overflow[0],p.overflowX=r.overflow[1],p.overflowY=r.overflow[2]})));for(i in n)if(o=n[i],wt.exec(o)){if(delete n[i],s=s||"toggle"===o,o===(d?"hide":"show")){if("show"!==o||!h||h[i]===t)continue;d=!0}f[i]=h&&h[i]||b.style(e,i)}if(!b.isEmptyObject(f))for(i in h?"hidden"in h&&(d=h.hidden):h=M.access(e,"fxshow",{}),s&&(h.hidden=!d),d?b(e).show():c.done((function(){b(e).hide()})),c.done((function(){var t;for(t in M.remove(e,"fxshow"),f)b.style(e,t,f[t])})),f)a=St(d?h[i]:0,i,c),i in h||(h[i]=a.start,d&&(a.end=a.start,a.start="width"===i||"height"===i?1:0))}],kt={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Tt.exec(t),o=i&&i[3]||(b.cssNumber[e]?"":"px"),s=(b.cssNumber[e]||"px"!==o&&+r)&&Tt.exec(b.css(n.elem,e)),a=1,u=20;if(s&&s[3]!==o){o=o||s[3],i=i||[],s=+r||1;do{s/=a=a||".5",b.style(n.elem,e,s+o)}while(a!==(a=n.cur()/r)&&1!==a&&--u)}return i&&(s=n.start=+s||+r||0,n.unit=o,n.end=i[1]?s+(i[1]+1)*i[2]:+i[2]),n}]};function Et(){return setTimeout((function(){xt=t})),xt=b.now()}function St(e,t,n){for(var r,i=(kt[t]||[]).concat(kt["*"]),o=0,s=i.length;o<s;o++)if(r=i[o].call(n,t,e))return r}function jt(e,t,n){var r,i,o=0,s=Nt.length,a=b.Deferred().always((function(){delete u.elem})),u=function(){if(i)return!1;for(var t=xt||Et(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,s=l.tweens.length;o<s;o++)l.tweens[o].run(r);return a.notifyWith(e,[l,r,n]),r<1&&s?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:xt||Et(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,s;for(n in e)if(i=t[r=b.camelCase(n)],o=e[n],b.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(s=b.cssHooks[r])&&"expand"in s)for(n in o=s.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);o<s;o++)if(r=Nt[o].call(l,e,c,l.opts))return r;return b.map(c,St,l),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function Dt(e,t,n,r,i){return new Dt.prototype.init(e,t,n,r,i)}function At(e,t){var n,r={height:e},i=0;for(t=t?1:0;i<4;i+=2-t)r["margin"+(n=He[i])]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function Lt(e){return b.isWindow(e)?e:9===e.nodeType&&e.defaultView}b.Animation=b.extend(jt,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,i=e.length;r<i;r++)n=e[r],kt[n]=kt[n]||[],kt[n].unshift(t)},prefilter:function(e,t){t?Nt.unshift(e):Nt.push(e)}}),b.Tween=Dt,Dt.prototype={constructor:Dt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=Dt.propHooks[this.prop];return e&&e.get?e.get(this):Dt.propHooks._default.get(this)},run:function(e){var t,n=Dt.propHooks[this.prop];return this.options.duration?this.pos=t=b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Dt.propHooks._default.set(this),this}},Dt.prototype.init.prototype=Dt.prototype,Dt.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""))&&"auto"!==t?t:0:e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Dt.propHooks.scrollTop=Dt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],(function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(At(t,!0),e,r,i)}})),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Pe).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),s=function(){var t=jt(this,b.extend({},e),o);(i||M.get(this,"finish"))&&t.stop(!0)};return s.finish=s,i||!1===o.queue?this.each(s):this.queue(o.queue,s)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&!1!==e&&this.queue(e||"fx",[]),this.each((function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,s=M.get(this);if(n)s[n]&&s[n].stop&&i(s[n]);else for(n in s)s[n]&&s[n].stop&&Ct.test(n)&&i(s[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));!t&&r||b.dequeue(this,e)}))},finish:function(e){return!1!==e&&(e=e||"fx"),this.each((function(){var t,n=M.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,s=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<s;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish}))}}),b.each({slideDown:At("show"),slideUp:At("hide"),slideToggle:At("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},(function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}})),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=Dt.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(xt=b.now();r<n.length;r++)(e=n[r])()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),xt=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){bt||(bt=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(bt),bt=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,(function(t){return e===t.elem})).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each((function(t){b.offset.setOffset(this,e,t)}));var n,r,o=this[0],s={top:0,left:0},a=o&&o.ownerDocument;return a?(n=a.documentElement,b.contains(n,o)?(typeof o.getBoundingClientRect!==i&&(s=o.getBoundingClientRect()),r=Lt(a),{top:s.top+r.pageYOffset-n.clientTop,left:s.left+r.pageXOffset-n.clientLeft}):s):void 0},b.offset={setOffset:function(e,t,n){var r,i,o,s,a,u,l=b.css(e,"position"),c=b(e),f={};"static"===l&&(e.style.position="relative"),a=c.offset(),o=b.css(e,"top"),u=b.css(e,"left"),("absolute"===l||"fixed"===l)&&(o+u).indexOf("auto")>-1?(s=(r=c.position()).top,i=r.left):(s=parseFloat(o)||0,i=parseFloat(u)||0),b.isFunction(t)&&(t=t.call(e,n,a)),null!=t.top&&(f.top=t.top-a.top+s),null!=t.left&&(f.left=t.left-a.left+i),"using"in t?t.using.call(e,f):c.css(f)}},b.fn.extend({position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===b.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(r=e.offset()),r.top+=b.css(e[0],"borderTopWidth",!0),r.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-b.css(n,"marginTop",!0),left:t.left-r.left-b.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map((function(){for(var e=this.offsetParent||a;e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position");)e=e.offsetParent;return e||a}))}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(n,r){var i="pageYOffset"===r;b.fn[n]=function(o){return b.access(this,(function(n,o,s){var a=Lt(n);if(s===t)return a?a[r]:n[o];a?a.scrollTo(i?e.pageXOffset:s,i?s:e.pageYOffset):n[o]=s}),n,o,arguments.length,null)}})),b.each({Height:"height",Width:"width"},(function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},(function(r,i){b.fn[i]=function(i,o){var s=arguments.length&&(r||"boolean"!=typeof i),a=r||(!0===i||!0===o?"margin":"border");return b.access(this,(function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,a):b.style(n,r,i,a)}),n,s?i:t,s,null)}}))})),b.fn.size=function(){return this.length},b.fn.andSelf=b.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=b:"function"==typeof define&&define.amd&&define("jquery",[],(function(){return b})),"object"==typeof e&&"object"==typeof e.document&&(e.jQuery=e.$=b)}(window);"undefined"!=typeof module&&module.exports&&(jQuery=$={isArray:function(e){return"[object Array]"===Object.prototype.toString.apply(e)},isPlainObject:function(e){var t;if(!e||"object"!==jQuery.type(e)||e.nodeType||jQuery.isWindow(e))return!1;if(e.constructor&&!core_hasOwn.call(e,"constructor")&&!core_hasOwn.call(e.constructor.prototype,"isPrototypeOf"))return!1;for(t in e);return void 0===t||core_hasOwn.call(e,t)},extend:function(){var e,t,n,i,s,o,r=arguments[0]||{},a=1,l=arguments.length,c=!1;for("boolean"==typeof r&&(c=r,r=arguments[1]||{},a=2),l===a&&(r=this,--a);a<l;a++)if(null!=(e=arguments[a]))for(t in e)n=r[t],r!==(i=e[t])&&(c&&i&&(this.isPlainObject(i)||(s=this.isArray(i)))?(s?(s=!1,o=n&&this.isArray(n)?n:[]):o=n&&this.isPlainObject(n)?n:{},r[t]=this.extend(c,o,i)):void 0!==i&&(r[t]=i));return r}}),$.extend({spcExtend:function(e){var t=function(e){void 0!==this.init&&this.init(e||{})};t.prototype.superInit=e.init;var n=[];n.push(t.prototype);for(var i=arguments.length,s=0;s<i;s++)n.push(arguments[s]);return $.extend.apply($,n),t}}),$.extend(String.prototype,{lpad:function(e,t){for(var n=this;n.length<t;)n=e+n;return n},rpad:function(e,t){for(var n=this;n.length<t;)n+=e;return n}}),wdi={},wdi.DomainObject={},wdi.RawMessage=$.spcExtend(wdi.DomainObject,{status:null,data:null,init:function(e){this.status=e.status,this.data=e.data}}),wdi.RawSpiceMessage=$.spcExtend(wdi.DomainObject,{header:null,body:null,channel:null,set:function(e,t,n){this.header=e,this.body=t,this.channel=n}}),wdi.SpiceMessage=$.spcExtend(wdi.DomainObject,{messageType:null,args:null,channel:null,init:function(e){this.channel=e.channel,this.messageType=e.messageType,this.args=e.args}}),wdi.EventObject=$.spcExtend(wdi.DomainObject,{events:null,init:function(){this.eyeEvents={}},getListenersLength:function(e){return null==this.eyeEvents[e]&&(this.eyeEvents[e]=[]),this.eyeEvents[e].length},addListener:function(e,t,n){n=n||this,null==this.eyeEvents[e]&&(this.eyeEvents[e]=[]),this.eyeEvents[e].push({fn:t,scope:n})},removeEvent:function(e){this.eyeEvents[e]=void 0},clearEvents:function(){this.eyeEvents={}},fire:function(e,t){var n=this.eyeEvents[e];if(n)for(var i=n.length;i--;)n[i].fn.call(n[i].scope,t)}}),wdi.CHANNEL_STATUS={disconnected:-1,idle:0,establishing:1,established:2},wdi.Debug={debug:!0,log:function(e){this.debug&&console.log.apply(console,Array.prototype.slice.call(arguments))},warn:function(e){console.warn.apply(console,Array.prototype.slice.call(arguments))},info:function(e){this.debug&&console.info.apply(console,Array.prototype.slice.call(arguments))},error:function(e){console.error.apply(console,Array.prototype.slice.call(arguments))}},wdi.Utils={generateWebSocketUrl:function(e,t,n,i,s,o,r,a){return url=i&&s?CONSOLE.wsUrl:e+"://"+t+":"+n+"/websockify/destInfoToken/"+r+"/type/"+o,url}},wdi.postMessageW3CCompilant="undefined"!=typeof window&&window.bowser&&!(window.bowser.msie&&window.bowser.version>=10),wdi.Exception=$.spcExtend(wdi.DomainObject,{errorCode:null,message:null,init:function(e){this.message=e.message||"",this.errorCode=e.errorCode||0}});try{new ImageData(1,1)}catch(e){"undefined"!=typeof window&&(window.ImageData=function(e,t,n){var i=document.createElement("canvas").getContext("2d").createImageData(t,n);return i.data.set(e),i})}wdi.bppMask=[],wdi.bppMask[1]=[128,64,32,16,8,4,2,1],wdi.bppMask[4]=[240,15],wdi.bppMask[8]=[255],wdi.SeamlessIntegration=!0,wdi.Debug.debug=!1,wdi.exceptionHandling=!0,wdi.IntegrationBenchmarkEnabled=!1,wdi.useWorkers=!0,wdi.logOperations=!1;window.Modernizr=function(e,t,n){function r(e){f.cssText=e}function o(e,t){return typeof e===t}var i,a,c={},l=t.documentElement,s="modernizr",u=t.createElement(s),f=u.style,d=" -webkit- -moz- -o- -ms- ".split(" "),p="Webkit Moz O ms",h=p.split(" "),m=p.toLowerCase().split(" "),y={},v=[],g=v.slice,b=function(e,n,r,o){var i,a,c,u=t.createElement("div"),f=t.body,d=f||t.createElement("body");if(parseInt(r,10))for(;r--;)(c=t.createElement("div")).id=o?o[r]:s+(r+1),u.appendChild(c);return i=["&#173;",'<style id="s',s,'">',e,"</style>"].join(""),u.id=s,(f?u:d).innerHTML+=i,d.appendChild(u),f||(d.style.background="",l.appendChild(d)),a=n(u,e),f?u.parentNode.removeChild(u):d.parentNode.removeChild(d),!!a},E={}.hasOwnProperty;for(var C in a=o(E,"undefined")||o(E.call,"undefined")?function(e,t){return t in e&&o(e.constructor.prototype[t],"undefined")}:function(e,t){return E.call(e,t)},Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if("function"!=typeof t)throw new TypeError;var n=g.call(arguments,1),r=function(){if(this instanceof r){var o=function(){};o.prototype=t.prototype;var i=new o,a=t.apply(i,n.concat(g.call(arguments)));return Object(a)===a?a:i}return t.apply(e,n.concat(g.call(arguments)))};return r}),y.canvas=function(){var e=t.createElement("canvas");return!!e.getContext&&!!e.getContext("2d")},y.webgl=function(){return!!e.WebGLRenderingContext},y.touch=function(){var n;return"ontouchstart"in e||e.DocumentTouch&&t instanceof DocumentTouch?n=!0:b(["@media (",d.join("touch-enabled),("),s,")","{#modernizr{top:9px;position:absolute}}"].join(""),(function(e){n=9===e.offsetTop})),n},y.websockets=function(){return"WebSocket"in e||"MozWebSocket"in e},y)a(y,C)&&(i=C.toLowerCase(),c[i]=y[C](),v.push((c[i]?"":"no-")+i));return c.addTest=function(e,t){if("object"==typeof e)for(var r in e)a(e,r)&&c.addTest(r,e[r]);else{if(e=e.toLowerCase(),c[e]!==n)return c;t="function"==typeof t?t():t,l.className+=" "+(t?"":"no-")+e,c[e]=t}return c},r(""),u=null,function(e,t){function n(){var e=h.elements;return"string"==typeof e?e.split(" "):e}function r(e){var t=p[e[f]];return t||(t={},d++,e[f]=d,p[d]=t),t}function o(e,n,o){return n||(n=t),c?n.createElement(e):(o||(o=r(n)),(i=o.cache[e]?o.cache[e].cloneNode():u.test(e)?(o.cache[e]=o.createElem(e)).cloneNode():o.createElem(e)).canHaveChildren&&!s.test(e)?o.frag.appendChild(i):i);var i}function i(e){e||(e=t);var i=r(e);return h.shivCSS&&!a&&!i.hasCSS&&(i.hasCSS=!!function(e,t){var n=e.createElement("p"),r=e.getElementsByTagName("head")[0]||e.documentElement;return n.innerHTML="x<style>"+t+"</style>",r.insertBefore(n.lastChild,r.firstChild)}(e,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),c||function(e,t){t.cache||(t.cache={},t.createElem=e.createElement,t.createFrag=e.createDocumentFragment,t.frag=t.createFrag()),e.createElement=function(n){return h.shivMethods?o(n,e,t):t.createElem(n)},e.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+n().join().replace(/\w+/g,(function(e){return t.createElem(e),t.frag.createElement(e),'c("'+e+'")'}))+");return n}")(h,t.frag)}(e,i),e}var a,c,l=e.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,u=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,f="_html5shiv",d=0,p={};!function(){try{var e=t.createElement("a");e.innerHTML="<xyz></xyz>",a="hidden"in e,c=1==e.childNodes.length||function(){t.createElement("a");var e=t.createDocumentFragment();return void 0===e.cloneNode||void 0===e.createDocumentFragment||void 0===e.createElement}()}catch(e){a=!0,c=!0}}();var h={elements:l.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:!1!==l.shivCSS,supportsUnknownElements:c,shivMethods:!1!==l.shivMethods,type:"default",shivDocument:i,createElement:o,createDocumentFragment:function(e,o){if(e||(e=t),c)return e.createDocumentFragment();for(var i=(o=o||r(e)).frag.cloneNode(),a=0,l=n(),s=l.length;a<s;a++)i.createElement(l[a]);return i}};e.html5=h,i(t)}(this,t),c._version="2.6.0",c._prefixes=d,c._domPrefixes=m,c._cssomPrefixes=h,c.testStyles=b,l.className=l.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+" js "+v.join(" "),c}(this,this.document),function(e,t){function n(e){return"[object Function]"==m.call(e)}function r(e){return"string"==typeof e}function o(){}function i(e){return!e||"loaded"==e||"complete"==e||"uninitialized"==e}function a(){var e=y.shift();v=1,e?e.t?p((function(){("c"==e.t?f.injectCss:f.injectJs)(e.s,0,e.a,e.x,e.e,1)}),0):(e(),a()):v=0}function c(e,n,r,o,c,l,s){function u(t){if(!m&&i(d.readyState)&&(C.r=m=1,!v&&a(),d.onload=d.onreadystatechange=null,t))for(var r in"img"!=e&&p((function(){E.removeChild(d)}),50),x[n])x[n].hasOwnProperty(r)&&x[n][r].onload()}s=s||f.errorTimeout;var d={},m=0,g=0,C={t:r,s:n,e:c,a:l,x:s};1===x[n]&&(g=1,x[n]=[],d=t.createElement(e)),"object"==e?d.data=n:(d.src=n,d.type=e),d.width=d.height="0",d.onerror=d.onload=d.onreadystatechange=function(){u.call(this,g)},y.splice(o,0,C),"img"!=e&&(g||2===x[n]?(E.insertBefore(d,b?null:h),p(u,s)):x[n].push(d))}function l(e,t,n,o,i){return v=0,t=t||"j",r(e)?c("c"==t?w:C,e,t,this.i++,n,o,i):(y.splice(this.i++,0,e),1==y.length&&a()),this}function s(){var e=f;return e.loader={load:l,i:0},e}var u,f,d=t.documentElement,p=e.setTimeout,h=t.getElementsByTagName("script")[0],m={}.toString,y=[],v=0,g="MozAppearance"in d.style,b=g&&!!t.createRange().compareNode,E=b?d:h.parentNode,C=(d=e.opera&&"[object Opera]"==m.call(e.opera),d=!!t.attachEvent&&!d,g?"object":d?"script":"img"),w=d?"script":C,S=Array.isArray||function(e){return"[object Array]"==m.call(e)},j=[],x={},k={timeout:function(e,t){return t.length&&(e.timeout=t[0]),e}};f=function(e){function t(e,t,r,o,i){var c=function(e){e=e.split("!");var t,n,r,o=j.length,i=e.pop(),a=e.length;for(i={url:i,origUrl:i,prefixes:e},n=0;n<a;n++)r=e[n].split("="),(t=k[r.shift()])&&(i=t(i,r));for(n=0;n<o;n++)i=j[n](i);return i}(e),l=c.autoCallback;c.url.split(".").pop().split("?").shift(),c.bypass||(t&&(t=n(t)?t:t[e]||t[o]||t[e.split("/").pop().split("?")[0]]||a),c.instead?c.instead(e,t,r,o,i):(x[c.url]?c.noexec=!0:x[c.url]=1,r.load(c.url,c.forceCSS||!c.forceJS&&"css"==c.url.split(".").pop().split("?").shift()?"c":undefined,c.noexec,c.attrs,c.timeout),(n(t)||n(l))&&r.load((function(){s(),t&&t(c.origUrl,i,o),l&&l(c.origUrl,i,o),x[c.url]=2}))))}function i(e,i){function a(e,o){if(e){if(r(e))o||(f=function(){var e=[].slice.call(arguments);d.apply(this,e),p()}),t(e,f,i,0,s);else if(Object(e)===e)for(l in c=function(){var t,n=0;for(t in e)e.hasOwnProperty(t)&&n++;return n}(),e)e.hasOwnProperty(l)&&(!o&&! --c&&(n(f)?f=function(){var e=[].slice.call(arguments);d.apply(this,e),p()}:f[l]=function(e){return function(){var t=[].slice.call(arguments);e&&e.apply(this,t),p()}}(d[l])),t(e[l],f,i,l,s))}else!o&&p()}var c,l,s=!!e.test,u=e.load||e.both,f=e.callback||o,d=f,p=e.complete||o;a(s?e.yep:e.nope,!!u),u&&a(u)}var c,l,u=this.yepnope.loader;if(r(e))t(e,0,u,0);else if(S(e))for(c=0;c<e.length;c++)r(l=e[c])?t(l,0,u,0):S(l)?f(l):Object(l)===l&&i(l,u);else Object(e)===e&&i(e,u)},f.addPrefix=function(e,t){k[e]=t},f.addFilter=function(e){j.push(e)},f.errorTimeout=1e4,null==t.readyState&&t.addEventListener&&(t.readyState="loading",t.addEventListener("DOMContentLoaded",u=function(){t.removeEventListener("DOMContentLoaded",u,0),t.readyState="complete"},0)),e.yepnope=s(),e.yepnope.executeStack=a,e.yepnope.injectJs=function(e,n,r,c,l,s){var u,d,m=t.createElement("script");c=c||f.errorTimeout;for(d in m.src=e,r)m.setAttribute(d,r[d]);n=s?a:n||o,m.onreadystatechange=m.onload=function(){!u&&i(m.readyState)&&(u=1,n(),m.onload=m.onreadystatechange=null)},p((function(){u||(u=1,n(1))}),c),l?m.onload():h.parentNode.insertBefore(m,h)},e.yepnope.injectCss=function(e,n,r,i,c,l){var s;i=t.createElement("link"),n=l?a:n||o;for(s in i.href=e,i.rel="stylesheet",i.type="text/css",r)i.setAttribute(s,r[s]);c||(h.parentNode.insertBefore(i,h),p(n,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))},Modernizr.addTest("websocketsbinary",(function(){var e,t="https:"==location.protocol?"wss":"ws";if("WebSocket"in window){if(e="binaryType"in WebSocket.prototype)return e;try{return!!new WebSocket(t+"://.").binaryType}catch(e){}}return!1}));/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
30
+ * Licensed under the MIT License (LICENSE.txt).
31
+ *
32
+ * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
33
+ * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
34
+ * Thanks to: Seamus Leahy for adding deltaX and deltaY
35
+ *
36
+ * Version: 3.0.6
37
+ *
38
+ * Requires: 1.2.2+
39
+ */
40
+ !function(e){var t=["DOMMouseScroll","mousewheel"];if(e.event.fixHooks)for(var n=t.length;n;)e.event.fixHooks[t[--n]]=e.event.mouseHooks;function i(t){var n=t||window.event,i=[].slice.call(arguments,1),l=0,s=0,o=0;return(t=e.event.fix(n)).type="mousewheel",n.wheelDelta&&(l=n.wheelDelta/120),n.detail&&(l=-n.detail/3),o=l,void 0!==n.axis&&n.axis===n.HORIZONTAL_AXIS&&(o=0,s=-1*l),void 0!==n.wheelDeltaY&&(o=n.wheelDeltaY/120),void 0!==n.wheelDeltaX&&(s=-1*n.wheelDeltaX/120),i.unshift(t,l,s,o),(e.event.dispatch||e.event.handle).apply(this,i)}e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var e=t.length;e;)this.addEventListener(t[--e],i,!1);else this.onmousewheel=i},teardown:function(){if(this.removeEventListener)for(var e=t.length;e;)this.removeEventListener(t[--e],i,!1);else this.onmousewheel=null}},e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}(jQuery);/*! jquery-visibility v1.0.11 | MIT license | http://mths.be/visibility */
41
+ !function(e,i){"function"==typeof define&&define.amd?define(["jquery"],(function(t){return i(e,t)})):"object"==typeof exports?module.exports=i(e,require("jquery")):i(e,jQuery)}(this,(function(e,i,t){"use strict";function o(){"hidden"!==n&&(r.hidden=f.pageVisibility?r[n]:t)}for(var n,u,r=e.document,s=["webkit","o","ms","moz",""],f=i.support||{},c=("onfocusin"in r&&"hasFocus"in r?"focusin focusout":"focus blur");(u=s.pop())!==t;)if(n=(u?u+"H":"h")+"idden",f.pageVisibility=r[n]!==t,f.pageVisibility){c=u+"visibilitychange";break}o(),i(/blur$/.test(c)?e:r).on(c,(function(e){var u=e.type,s=e.originalEvent;if(s){var f=s.toElement;(!/^focus./.test(u)||f===t&&s.fromElement===t&&s.relatedTarget===t)&&i(r).triggerHandler(n&&r[n]||/^(?:blur|focusout)$/.test(u)?"hide":"show"),o()}}))}));/**
42
+ * @license
43
+ * lodash 4.0.0 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
44
+ * Build: `lodash -o ./dist/lodash.js`
45
+ */
46
+ (function(){function n(n,t){return n.set(t[0],t[1]),n}function t(n,t){return n.add(t),n}function r(n,t,r){switch(r?r.length:0){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function e(n,t){for(var r=-1,e=n.length;++r<e&&!1!==t(n[r],r,n););return n}function u(n,t){for(var r=-1,e=n.length;++r<e;)if(!t(n[r],r,n))return!1;return!0}function o(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;){var i=n[r];t(i,r,n)&&(o[++u]=i)}return o}function i(n,t){return!!n.length&&-1<g(n,t,0)}function f(n,t,r){for(var e=-1,u=n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function c(n,t){for(var r=-1,e=n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,o=n.length;for(e&&o&&(r=n[++u]);++u<o;)r=t(r,n[u],u,n);return r}function s(n,t,r,e){var u=n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}function p(n,t,r){for(var e=-1,u=n.length;++e<u;){var o=n[e],i=t(o);if(null!=i&&(f===M?i==i:r(i,f)))var f=i,c=o}return c}function _(n,t,r,e){var u;return r(n,(function(n,r,o){return t(n,r,o)?(u=e?r:n,!1):void 0})),u}function v(n,t,r){for(var e=n.length,u=r?e:-1;r?u--:++u<e;)if(t(n[u],u,n))return u;return-1}function g(n,t,r){if(t!=t)return S(n,r);--r;for(var e=n.length;++r<e;)if(n[r]===t)return r;return-1}function d(n,t,r,e,u){return u(n,(function(n,u,o){r=e?(e=!1,n):t(r,n,u,o)})),r}function y(n,t){for(var r,e=-1,u=n.length;++e<u;){var o=t(n[e]);o!==M&&(r=r===M?o:r+o)}return r}function b(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function x(n,t){return c(t,(function(t){return[t,n[t]]}))}function j(n){return function(t){return n(t)}}function m(n,t){return c(t,(function(t){return n[t]}))}function w(n,t){for(var r=-1,e=n.length;++r<e&&-1<g(t,n[r],0););return r}function A(n,t){for(var r=n.length;r--&&-1<g(t,n[r],0););return r}function O(n){return n&&n.Object===Object?n:null}function E(n,t){if(n!==t){var r=null===n,e=n===M,u=n==n,o=null===t,i=t===M,f=t==t;if(n>t&&!o||!u||r&&!i&&f||e&&f)return 1;if(t>n&&!r||!f||o&&!e&&u||i&&u)return-1}return 0}function k(n){return Sn[n]}function I(n){return Wn[n]}function R(n){return"\\"+zn[n]}function S(n,t,r){var e=n.length;for(t+=r?0:-1;r?t--:++t<e;){var u=n[t];if(u!=u)return t}return-1}function W(n){var t=!1;if(null!=n&&"function"!=typeof n.toString)try{t=!!(n+"")}catch(n){}return t}function C(n,t){return(n="number"==typeof n||vn.test(n)?+n:-1)>-1&&0==n%1&&(null==t?9007199254740991:t)>n}function U(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function z(n){var t=-1,r=Array(n.size);return n.forEach((function(n,e){r[++t]=[e,n]})),r}function B(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;)n[r]===t&&(n[r]="__lodash_placeholder__",o[++u]=r);return o}function L(n){var t=-1,r=Array(n.size);return n.forEach((function(n){r[++t]=n})),r}function $(n){if(!n||!wn.test(n))return n.length;for(var t=mn.lastIndex=0;mn.test(n);)t++;return t}function F(n){return Cn[n]}var M,N=1/0,Z=NaN,D=/\b__p\+='';/g,q=/\b(__p\+=)''\+/g,P=/(__e\(.*?\)|\b__t\))\+'';/g,T=/&(?:amp|lt|gt|quot|#39|#96);/g,K=/[&<>"'`]/g,G=RegExp(T.source),V=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,nn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,tn=/[\\^$.*+?()[\]{}|]/g,rn=RegExp(tn.source),en=/^\s+|\s+$/g,un=/^\s+/,on=/\s+$/,fn=/\\(\\)?/g,cn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,an=/\w*$/,ln=/^0x/i,sn=/^[-+]0x[0-9a-f]+$/i,hn=/^0b[01]+$/i,pn=/^\[object .+?Constructor\]$/,_n=/^0o[0-7]+$/i,vn=/^(?:0|[1-9]\d*)$/,gn=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,dn=/($^)/,yn=/['\n\r\u2028\u2029\\]/g,bn="[\\ufe0e\\ufe0f]?(?:\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:\\ud83c[\\udffb-\\udfff])?)*",xn="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+bn,jn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23]","g"),mn=RegExp("(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe23]?|[\\u0300-\\u036f\\ufe20-\\ufe23]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])"+bn,"g"),wn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe23\\ufe0e\\ufe0f]"),An=/[a-zA-Z0-9]+/g,On=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+|\\d+(?:(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+)?",xn].join("|"),"g"),En=/[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,kn="Array Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Reflect RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),In={};In["[object Float32Array]"]=In["[object Float64Array]"]=In["[object Int8Array]"]=In["[object Int16Array]"]=In["[object Int32Array]"]=In["[object Uint8Array]"]=In["[object Uint8ClampedArray]"]=In["[object Uint16Array]"]=In["[object Uint32Array]"]=!0,In["[object Arguments]"]=In["[object Array]"]=In["[object ArrayBuffer]"]=In["[object Boolean]"]=In["[object Date]"]=In["[object Error]"]=In["[object Function]"]=In["[object Map]"]=In["[object Number]"]=In["[object Object]"]=In["[object RegExp]"]=In["[object Set]"]=In["[object String]"]=In["[object WeakMap]"]=!1;var Rn={};Rn["[object Arguments]"]=Rn["[object Array]"]=Rn["[object ArrayBuffer]"]=Rn["[object Boolean]"]=Rn["[object Date]"]=Rn["[object Float32Array]"]=Rn["[object Float64Array]"]=Rn["[object Int8Array]"]=Rn["[object Int16Array]"]=Rn["[object Int32Array]"]=Rn["[object Map]"]=Rn["[object Number]"]=Rn["[object Object]"]=Rn["[object RegExp]"]=Rn["[object Set]"]=Rn["[object String]"]=Rn["[object Symbol]"]=Rn["[object Uint8Array]"]=Rn["[object Uint8ClampedArray]"]=Rn["[object Uint16Array]"]=Rn["[object Uint32Array]"]=!0,Rn["[object Error]"]=Rn["[object Function]"]=Rn["[object WeakMap]"]=!1;var Sn={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},Wn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"},Cn={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&#96;":"`"},Un={function:!0,object:!0},zn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Bn=parseFloat,Ln=parseInt,$n=Un[typeof exports]&&exports&&!exports.nodeType?exports:null,Fn=Un[typeof module]&&module&&!module.nodeType?module:null,Mn=O(Un[typeof self]&&self),Nn=O(Un[typeof window]&&window),Zn=Fn&&Fn.exports===$n?$n:null,Dn=O(Un[typeof this]&&this),qn=O($n&&Fn&&"object"==typeof global&&global)||Nn!==(Dn&&Dn.window)&&Nn||Mn||Dn||Function("return this")(),Pn=function O(vn){function bn(n){if(ee(n)&&!xo(n)&&!(n instanceof Wn)){if(n instanceof Sn)return n;if(Pe.call(n,"__wrapped__"))return kr(n)}return new Sn(n)}function xn(){}function Sn(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=M}function Wn(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Cn(){}function Un(n){var t=-1,r=n?n.length:0;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function zn(n){var t=-1,r=n?n.length:0;for(this.__data__=new Un;++t<r;)this.push(n[t])}function $n(n,t){var r=n.__data__;return br(t)?(r=r.__data__,"__lodash_hash_undefined__"===("string"==typeof t?r.string:r.hash)[t]):r.has(t)}function Fn(n){var t=-1,r=n?n.length:0;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Mn(n,t){var r=Zn(n,t);return!(0>r)&&(r==n.length-1?n.pop():iu.call(n,r,1),!0)}function Nn(n,t){var r=Zn(n,t);return 0>r?M:n[r][1]}function Zn(n,t){for(var r=n.length;r--;)if(Gr(n[r][0],t))return r;return-1}function Dn(n,t,r){var e=Zn(n,t);0>e?n.push([t,r]):n[e][1]=r}function Tn(n,t,r,e){return n===M||Gr(n,De[r])&&!Pe.call(e,r)?t:n}function Kn(n,t,r){(r!==M&&!Gr(n[t],r)||"number"==typeof t&&r===M&&!(t in n))&&(n[t]=r)}function Gn(n,t,r){var e=n[t];(!Gr(e,r)||Gr(e,De[t])&&!Pe.call(n,t)||r===M&&!(t in n))&&(n[t]=r)}function Vn(n,t){return n&&Zt(t,je(t),n)}function Jn(n,t){for(var r=-1,e=null==n,u=t.length,o=Array(u);++r<u;)o[r]=e?M:ye(n,t[r]);return o}function Yn(n,t,r){return n==n&&(r!==M&&(n=n>r?r:n),t!==M&&(n=t>n?t:n)),n}function Hn(n,t,r,u,o,i){var f;if(r&&(f=o?r(n,u,o,i):r(n)),f!==M)return f;if(!re(n))return n;if(u=xo(n)){if(f=function(n){var t=n.length,r=n.constructor(t);return t&&"string"==typeof n[0]&&Pe.call(n,"index")&&(r.index=n.index,r.input=n.input),r}(n),!t)return Nt(n,f)}else{var c=pr(n),a="[object Function]"==c||"[object GeneratorFunction]"==c;if("[object Object]"!=c&&"[object Arguments]"!=c&&(!a||o))return Rn[c]?vr(n,c,t):o?n:{};if(W(n))return o?n:{};if(f=function(n){return n=n.constructor,Iu(Xr(n)?n.prototype:M)}(a?{}:n),!t)return qt(n,Vn(f,n))}return i||(i=new Fn),(o=i.get(n))?o:(i.set(n,f),(u?e:et)(n,(function(e,u){Gn(f,u,Hn(e,t,r,u,n,i))})),u?f:qt(n,f))}function Qn(n,t,r){if("function"!=typeof n)throw new Ne("Expected a function");return ou((function(){n.apply(M,r)}),t)}function Xn(n,t,r,e){var u=-1,o=i,a=!0,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,j(r))),e?(o=f,a=!1):t.length>=200&&(o=$n,a=!1,t=new zn(t));n:for(;++u<l;){var p=n[u],_=r?r(p):p;if(a&&_==_){for(var v=h;v--;)if(t[v]===_)continue n;s.push(p)}else o(t,_,e)||s.push(p)}return s}function nt(n,t){var r=!0;return Ru(n,(function(n,e,u){return r=!!t(n,e,u)})),r}function tt(n,t){var r=[];return Ru(n,(function(n,e,u){t(n,e,u)&&r.push(n)})),r}function rt(n,t,r,e){e||(e=[]);for(var u=-1,o=n.length;++u<o;){var i=n[u];Hr(i)&&(r||xo(i)||Jr(i))?t?rt(i,t,r,e):a(e,i):r||(e[e.length]=i)}return e}function et(n,t){return n&&Wu(n,t,je)}function ut(n,t){return n&&Cu(n,t,je)}function ot(n,t){return o(t,(function(t){return Xr(n[t])}))}function it(n,t){for(var r=0,e=(t=yr(t,n)?[t+""]:Ct(t)).length;null!=n&&e>r;)n=n[t[r++]];return r&&r==e?n:M}function ft(n,t){return Pe.call(n,t)||"object"==typeof n&&t in n&&null===tu(n)}function ct(n,t){return t in Object(n)}function at(n,t,r){for(var e=r?f:i,u=n.length,o=u,a=Array(u),l=[];o--;){var s=n[o];o&&t&&(s=c(s,j(t))),a[o]=r||!t&&120>s.length?M:new zn(o&&s)}var h=-1,p=(s=n[0]).length,_=a[0];n:for(;++h<p;){var v=s[h],g=t?t(v):v;if(_?!$n(_,g):!e(l,g,r)){for(o=u;--o;){var d=a[o];if(d?!$n(d,g):!e(n[o],g,r))continue n}_&&_.push(g),l.push(v)}}return l}function lt(n,t,e){return yr(t,n)||(n=wr(n,t=Ct(t)),t=Wr(t)),null==(t=null==n?n:n[t])?M:r(t,n,e)}function st(n,t,r,e,u){if(n===t)n=!0;else if(null==n||null==t||!re(n)&&!ee(t))n=n!=n&&t!=t;else n:{var o=xo(n),i=xo(t),f="[object Array]",c="[object Array]";o||("[object Arguments]"==(f=pr(n))?f="[object Object]":"[object Object]"!=f&&(o=le(n))),i||("[object Arguments]"==(c=pr(t))?c="[object Object]":"[object Object]"!=c&&le(t));var a="[object Object]"==f&&!W(n);i="[object Object]"==c&&!W(t);if(!(c=f==c)||o||a){if(!(2&e)&&(f=a&&Pe.call(n,"__wrapped__"),i=i&&Pe.call(t,"__wrapped__"),f||i)){n=st(f?n.value():n,i?t.value():t,r,e,u);break n}c?(u||(u=new Fn),n=(o?fr:cr)(n,t,st,r,e,u)):n=!1}else n=function(n,t,r,e,u,o){switch(r){case"[object ArrayBuffer]":if(n.byteLength!=t.byteLength||!e(new Qe(n),new Qe(t)))break;return!0;case"[object Boolean]":case"[object Date]":return+n==+t;case"[object Error]":return n.name==t.name&&n.message==t.message;case"[object Number]":return n!=+n?t!=+t:n==+t;case"[object RegExp]":case"[object String]":return n==t+"";case"[object Map]":var i=z;case"[object Set]":return i||(i=L),(2&o||n.size==t.size)&&e(i(n),i(t),u,1|o);case"[object Symbol]":return!!Ye&&Ou.call(n)==Ou.call(t)}return!1}(n,t,f,st,r,e)}return n}function ht(n,t,r,e){var u=r.length,o=u,i=!e;if(null==n)return!o;for(n=Object(n);u--;){var f=r[u];if(i&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return!1}for(;++u<o;){var c=(f=r[u])[0],a=n[c],l=f[1];if(i&&f[2]){if(a===M&&!(c in n))return!1}else if(f=new Fn,(c=e?e(a,l,c,n,t,f):M)===M?!st(l,a,e,3,f):!c)return!1}return!0}function pt(n){var t=typeof n;return"function"==t?n:null==n?Re:"object"==t?xo(n)?dt(n[0],n[1]):gt(n):ze(n)}function _t(n){n=null==n?n:Object(n);var t,r=[];for(t in n)r.push(t);return r}function vt(n,t){var r=-1,e=Yr(n)?Array(n.length):[];return Ru(n,(function(n,u,o){e[++r]=t(n,u,o)})),e}function gt(n){var t=sr(n);if(1==t.length&&t[0][2]){var r=t[0][0],e=t[0][1];return function(n){return null!=n&&(n[r]===e&&(e!==M||r in Object(n)))}}return function(r){return r===n||ht(r,n,t)}}function dt(n,t){return function(r){var e=ye(r,n);return e===M&&e===t?xe(r,n):st(t,e,M,3)}}function yt(n,t,r,u){if(n!==t){var o=xo(t)||le(t)?M:me(t);e(o||t,(function(e,i){if(o&&(e=t[i=e]),re(e)){u||(u=new Fn);var f=i,c=u,a=n[f],l=t[f];if(s=c.get(l)||c.get(a))Kn(n,f,s);else{var s,h=(s=r?r(a,l,f+"",n,t,c):M)===M;h&&(s=l,xo(l)||le(l)?s=xo(a)?a:Hr(a)?Nt(a):Hn(l):ie(l)||Jr(l)?s=Jr(a)?ge(a):re(a)?a:Hn(l):h=Xr(l)),c.set(l,s),h&&yt(s,l,r,c),Kn(n,f,s)}}else(f=r?r(n[i],e,i+"",n,t,u):M)===M&&(f=e),Kn(n,i,f)}))}}function bt(n,t,r){var e=-1,u=lr();return t=c(t.length?t:Array(1),(function(n){return u(n)})),n=vt(n,(function(n){return{a:c(t,(function(t){return t(n)})),b:++e,c:n}})),function(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].c;return n}(n,(function(n,t){var e;n:{e=-1;for(var u=n.a,o=t.a,i=u.length,f=r.length;++e<i;){var c=E(u[e],o[e]);if(c){e=f>e?c*("desc"==r[e]?-1:1):c;break n}}e=n.b-t.b}return e}))}function xt(n,t){return n=Object(n),l(t,(function(t,r){return r in n&&(t[r]=n[r]),t}),{})}function jt(n,t){var r={};return function(n,t){null==n||Wu(n,t,me)}(n,(function(n,e){t(n)&&(r[e]=n)})),r}function mt(n){return function(t){return null==t?M:t[n]}}function wt(n,t,r){var e=-1,u=t.length,o=n;for(r&&(o=c(n,(function(n){return r(n)})));++e<u;){var i=0,f=t[e];for(f=r?r(f):f;-1<(i=g(o,f,i));)o!==n&&iu.call(o,i,1),iu.call(n,i,1)}return n}function At(n,t){for(var r=n?t.length:0,e=r-1;r--;){var u=t[r];if(e==r||u!=o){var o=u;if(C(u))iu.call(n,u,1);else if(yr(u,n))delete n[u];else{var i=wr(n,u=Ct(u));null!=i&&delete i[Wr(u)]}}}}function Ot(n,t){return n+cu(vu()*(t-n+1))}function Et(n,t,r,e){for(var u=-1,o=(t=yr(t,n)?[t+""]:Ct(t)).length,i=o-1,f=n;null!=f&&++u<o;){var c=t[u];if(re(f)){var a=r;if(u!=i){var l=f[c];(a=e?e(l,c,f):M)===M&&(a=null==l?C(t[u+1])?[]:{}:l)}Gn(f,c,a)}f=f[c]}return n}function kt(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),0>(r=r>u?u:r)&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++e<u;)r[e]=n[e+t];return r}function It(n,t){var r;return Ru(n,(function(n,e,u){return!(r=t(n,e,u))})),!!r}function Rt(n,t,r){var e=0,u=n?n.length:e;if("number"==typeof t&&t==t&&2147483647>=u){for(;u>e;){var o=e+u>>>1,i=n[o];(r?t>=i:t>i)&&null!==i?e=o+1:u=o}return u}return St(n,t,Re,r)}function St(n,t,r,e){t=r(t);for(var u=0,o=n?n.length:0,i=t!=t,f=null===t,c=t===M;o>u;){var a=cu((u+o)/2),l=r(n[a]),s=l!==M,h=l==l;(i?h||e:f?h&&s&&(e||null!=l):c?h&&(e||s):null!=l&&(e?t>=l:t>l))?u=a+1:o=a}return pu(o,4294967294)}function Wt(n,t){for(var r=0,e=n.length,u=n[0],o=t?t(u):u,i=o,f=0,c=[u];++r<e;)u=n[r],Gr(o=t?t(u):u,i)||(i=o,c[++f]=u);return c}function Ct(n){return xo(n)?n:Ar(n)}function Ut(n,t,r){var e=-1,u=i,o=n.length,c=!0,a=[],l=a;if(r)c=!1,u=f;else if(o<200)l=t?[]:a;else{if(u=t?null:zu(n))return L(u);c=!1,u=$n,l=new zn}n:for(;++e<o;){var s=n[e],h=t?t(s):s;if(c&&h==h){for(var p=l.length;p--;)if(l[p]===h)continue n;t&&l.push(h),a.push(s)}else u(l,h,r)||(l!==a&&l.push(h),a.push(s))}return a}function zt(n,t,r,e){for(var u=n.length,o=e?u:-1;(e?o--:++o<u)&&t(n[o],o,n););return r?kt(n,e?0:o,e?o+1:u):kt(n,e?o+1:0,e?u:o)}function Bt(n,t){var r=n;return r instanceof Wn&&(r=r.value()),l(t,(function(n,t){return t.func.apply(t.thisArg,a([n],t.args))}),r)}function Lt(n,t,r){for(var e=-1,u=n.length;++e<u;)var o=o?a(Xn(o,n[e],t,r),Xn(n[e],o,t,r)):n[e];return o&&o.length?Ut(o,t,r):[]}function $t(n){var t=new n.constructor(n.byteLength);return new Qe(t).set(new Qe(n)),t}function Ft(n,t,r){for(var e=r.length,u=-1,o=hu(n.length-e,0),i=-1,f=t.length,c=Array(f+o);++i<f;)c[i]=t[i];for(;++u<e;)c[r[u]]=n[u];for(;o--;)c[i++]=n[u++];return c}function Mt(n,t,r){for(var e=-1,u=r.length,o=-1,i=hu(n.length-u,0),f=-1,c=t.length,a=Array(i+c);++o<i;)a[o]=n[o];for(i=o;++f<c;)a[i+f]=t[f];for(;++e<u;)a[i+r[e]]=n[o++];return a}function Nt(n,t){var r=-1,e=n.length;for(t||(t=Array(e));++r<e;)t[r]=n[r];return t}function Zt(n,t,r){return Dt(n,t,r)}function Dt(n,t,r,e){r||(r={});for(var u=-1,o=t.length;++u<o;){var i=t[u];Gn(r,i,e?e(r[i],n[i],i,r,n):n[i])}return r}function qt(n,t){return Zt(n,$u(n),t)}function Pt(n,t){return function(r,e){var u=t?t():{};if(e=lr(e),xo(r))for(var o=-1,i=r.length;++o<i;){var f=r[o];n(u,f,e(f),r)}else Ru(r,(function(t,r,o){n(u,t,e(t),o)}));return u}}function Tt(n){return Kr((function(t,r){var e=-1,u=r.length,o=u>1?r[u-1]:M,i=u>2?r[2]:M;o="function"==typeof o?(u--,o):M;for(i&&dr(r[0],r[1],i)&&(o=3>u?M:o,u=1),t=Object(t);++e<u;)(i=r[e])&&n(t,i,o);return t}))}function Kt(n,t){return function(r,e){if(null==r)return r;if(!Yr(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++o<u)&&!1!==e(i[o],o,i););return r}}function Gt(n){return function(t,r,e){for(var u=-1,o=Object(t),i=(e=e(t)).length;i--;){var f=e[n?i:++u];if(!1===r(o[f],f,o))break}return t}}function Vt(n){return function(t){t=de(t);var r=wn.test(t)?t.match(mn):M,e=r?r[0]:t.charAt(0);return t=r?r.slice(1).join(""):t.slice(1),e[n]()+t}}function Jt(n){return function(t){return l(Ie(Ee(t)),n,"")}}function Yt(n){return function(){switch((t=arguments).length){case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var t,r=Iu(n.prototype);return re(t=n.apply(r,t))?t:r}}function Ht(n,t,e){var u=Yt(n);return function o(){for(var i=arguments.length,f=i,c=Array(i),a=this&&this!==qn&&this instanceof o?u:n,l=o.placeholder;f--;)c[f]=arguments[f];return i-=(f=3>i&&c[0]!==l&&c[i-1]!==l?[]:B(c,l)).length,e>i?ur(n,t,Xt,l,M,c,f,M,M,e-i):r(a,this,c)}}function Qt(n){return Kr((function(t){var r=(t=rt(t)).length,e=r,u=Sn.prototype.thru;for(n&&t.reverse();e--;){if("function"!=typeof(i=t[e]))throw new Ne("Expected a function");if(u&&!o&&"wrapper"==ar(i))var o=new Sn([],!0)}for(e=o?e:r;++e<r;){var i,f="wrapper"==(u=ar(i=t[e]))?Bu(i):M;o=f&&xr(f[0])&&424==f[1]&&!f[4].length&&1==f[9]?o[ar(f[0])].apply(o,f[3]):1==i.length&&xr(i)?o[u]():o.thru(i)}return function(){var n=(u=arguments)[0];if(o&&1==u.length&&xo(n)&&n.length>=200)return o.plant(n).value();for(var e=0,u=r?t[e].apply(this,u):n;++e<r;)u=t[e].call(this,u);return u}}))}function Xt(n,t,r,e,u,o,i,f,c,a){var l=128&t,s=1&t,h=2&t,p=8&t,_=16&t,v=512&t,g=h?M:Yt(n);return function d(){for(var y=x=arguments.length,b=Array(x);y--;)b[y]=arguments[y];if(e&&(b=Ft(b,e,u)),o&&(b=Mt(b,o,i)),p||_){var x=x-(j=B(b,y=d.placeholder)).length;if(a>x)return ur(n,t,Xt,y,r,b,j,f,c,a-x)}if(x=s?r:this,y=h?x[n]:n,f)for(var j=b.length,m=pu(f.length,j),w=Nt(b);m--;){var A=f[m];b[m]=C(A,j)?w[A]:M}else v&&b.length>1&&b.reverse();return l&&b.length>c&&(b.length=c),this&&this!==qn&&this instanceof d&&(y=g||Yt(y)),y.apply(x,b)}}function nr(n){return Kr((function(t){return t=c(rt(t),lr()),Kr((function(e){var u=this;return n(t,(function(n){return r(n,u,e)}))}))}))}function tr(n,t,r){return t=pe(t),n=$(n),t&&t>n?(n=ke(r=r===M?" ":r+"",fu((t-=n)/$(r))),wn.test(r)?n.match(mn).slice(0,t).join(""):n.slice(0,t)):""}function rr(n,t,e,u){var o=1&t,i=Yt(n);return function t(){for(var f=-1,c=arguments.length,a=-1,l=u.length,s=Array(l+c),h=this&&this!==qn&&this instanceof t?i:n;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++f];return r(h,o?e:this,s)}}function er(n){return function(t,r,e){e&&"number"!=typeof e&&dr(t,r,e)&&(r=e=M),t=(t=ve(t))==t?t:0,r===M?(r=t,t=0):r=ve(r)||0,e=e===M?r>t?1:-1:ve(e)||0;var u=-1;r=hu(fu((r-t)/(e||1)),0);for(var o=Array(r);r--;)o[n?r:++u]=t,t+=e;return o}}function ur(n,t,r,e,u,o,i,f,c,a){var l=8&t;return f=f?Nt(f):M,4&(t=(t|(l?32:64))&~(l?64:32))||(t&=-4),t=[n,t,u,l?o:M,l?i:M,o=l?M:o,i=l?M:i,f,c,a],r=r.apply(M,t),xr(n)&&Fu(r,t),r.placeholder=e,r}function or(n){var t=Fe[n];return function(n,r){if(n=ve(n),r=pe(r)){var e=(de(n)+"e").split("e");return+((e=(de(e=t(e[0]+"e"+(+e[1]+r)))+"e").split("e"))[0]+"e"+(+e[1]-r))}return t(n)}}function ir(n,t,r,e,u,o,i,f){var c=2&t;if(!c&&"function"!=typeof n)throw new Ne("Expected a function");var a=e?e.length:0;if(a||(t&=-97,e=u=M),i=i===M?i:hu(pe(i),0),f=f===M?f:pe(f),a-=u?u.length:0,64&t){var l=e,s=u;e=u=M}var h=c?M:Bu(n);return o=[n,t,r,e,u,l,s,o,i,f],h&&(t=(r=o[1])|(n=h[1]),e=128==n&&8==r||128==n&&256==r&&h[8]>=o[7].length||384==n&&h[8]>=h[7].length&&8==r,131>t||e)&&(1&n&&(o[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=o[3],o[3]=e?Ft(e,r,h[4]):Nt(r),o[4]=e?B(o[3],"__lodash_placeholder__"):Nt(h[4])),(r=h[5])&&(e=o[5],o[5]=e?Mt(e,r,h[6]):Nt(r),o[6]=e?B(o[5],"__lodash_placeholder__"):Nt(h[6])),(r=h[7])&&(o[7]=Nt(r)),128&n&&(o[8]=null==o[8]?h[8]:pu(o[8],h[8])),null==o[9]&&(o[9]=h[9]),o[0]=h[0],o[1]=t),n=o[0],t=o[1],r=o[2],e=o[3],u=o[4],!(f=o[9]=null==o[9]?c?0:n.length:hu(o[9]-a,0))&&24&t&&(t&=-25),(h?Uu:Fu)(t&&1!=t?8==t||16==t?Ht(n,t,f):32!=t&&33!=t||u.length?Xt.apply(M,o):rr(n,t,r,e):function(n,t,r){var e=1&t,u=Yt(n);return function t(){return(this&&this!==qn&&this instanceof t?u:n).apply(e?r:this,arguments)}}(n,t,r),o)}function fr(n,t,r,e,u,o){var i=-1,f=2&u,c=1&u,a=n.length,l=t.length;if(!(a==l||f&&l>a))return!1;if(l=o.get(n))return l==t;for(l=!0,o.set(n,t);++i<a;){var s=n[i],p=t[i];if(e)var _=f?e(p,s,i,t,n,o):e(s,p,i,n,t,o);if(_!==M){if(_)continue;l=!1;break}if(c){if(!h(t,(function(n){return s===n||r(s,n,e,u,o)}))){l=!1;break}}else if(s!==p&&!r(s,p,e,u,o)){l=!1;break}}return o.delete(n),l}function cr(n,t,r,e,u,o){var i=2&u,f=1&u,c=je(n),a=c.length,l=je(t);if(a!=l.length&&!i)return!1;for(var s=a;s--;){var h=c[s];if(!(i?h in t:ft(t,h))||!f&&h!=l[s])return!1}if(h=o.get(n))return h==t;for(f=!0,o.set(n,t),l=i;++s<a;){var p=n[h=c[s]],_=t[h];if(e)var v=i?e(_,p,h,t,n,o):e(p,_,h,n,t,o);if(v===M?p!==_&&!r(p,_,e,u,o):!v){f=!1;break}l||(l="constructor"==h)}return f&&!l&&((r=n.constructor)!=(e=t.constructor)&&"constructor"in n&&"constructor"in t&&!("function"==typeof r&&r instanceof r&&"function"==typeof e&&e instanceof e)&&(f=!1)),o.delete(n),f}function ar(n){for(var t=n.name+"",r=ku[t],e=r?r.length:0;e--;){var u=r[e],o=u.func;if(null==o||o==n)return u.name}return t}function lr(){var n=(n=bn.iteratee||Se)===Se?pt:n;return arguments.length?n(arguments[0],arguments[1]):n}function sr(n){for(var t=(n=we(n)).length;t--;){var r=n[t][1];n[t][2]=r==r&&!re(r)}return n}function hr(n,t){var r=null==n?M:n[t];return ue(r)?r:M}function pr(n){return Ge.call(n)}function _r(n,t,r){if(null==n)return!1;var e=r(n,t);return e||yr(t)||null!=(n=wr(n,t=Ct(t)))&&(e=r(n,t=Wr(t))),e||te(n&&n.length)&&C(t,n.length)&&(xo(n)||ce(n)||Jr(n))}function vr(r,e,u){var o=r.constructor;switch(e){case"[object ArrayBuffer]":return $t(r);case"[object Boolean]":case"[object Date]":return new o(+r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return e=r.buffer,new r.constructor(u?$t(e):e,r.byteOffset,r.length);case"[object Map]":return u=r.constructor,l(z(r),n,new u);case"[object Number]":case"[object String]":return new o(r);case"[object RegExp]":return(u=new r.constructor(r.source,an.exec(r))).lastIndex=r.lastIndex,u;case"[object Set]":return u=r.constructor,l(L(r),t,new u);case"[object Symbol]":return Ye?Object(Ou.call(r)):{}}}function gr(n){var t=n?n.length:M;return te(t)&&(xo(n)||ce(n)||Jr(n))?b(t,String):null}function dr(n,t,r){if(!re(r))return!1;var e=typeof t;return!!("number"==e?Yr(r)&&C(t,r.length):"string"==e&&t in r)&&Gr(r[t],n)}function yr(n,t){return"number"==typeof n||!xo(n)&&(X.test(n)||!Q.test(n)||null!=t&&n in Object(t))}function br(n){var t=typeof n;return"number"==t||"boolean"==t||"string"==t&&"__proto__"!==n||null==n}function xr(n){var t=ar(n),r=bn[t];return"function"==typeof r&&t in Wn.prototype&&(n===r||!!(t=Bu(r))&&n===t[0])}function jr(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||De)}function mr(n,t,r,e,u,o){return re(n)&&re(t)&&(o.set(t,n),yt(n,t,mr,o)),n===M?Hn(t):n}function wr(n,t){return 1==t.length?n:ye(n,kt(t,0,-1))}function Ar(n){var t=[];return de(n).replace(nn,(function(n,r,e,u){t.push(e?u.replace(fn,"$1"):r||n)})),t}function Or(n){return Hr(n)?n:[]}function Er(n){return"function"==typeof n?n:Re}function kr(n){if(n instanceof Wn)return n.clone();var t=new Sn(n.__wrapped__,n.__chain__);return t.__actions__=Nt(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function Ir(n,t,r){var e=n?n.length:0;return e?kt(n,0>(t=r||t===M?1:pe(t))?0:t,e):[]}function Rr(n,t,r){var e=n?n.length:0;return e?kt(n,0,0>(t=e-(t=r||t===M?1:pe(t)))?0:t):[]}function Sr(n){return n?n[0]:M}function Wr(n){var t=n?n.length:0;return t?n[t-1]:M}function Cr(n,t){return n&&n.length&&t&&t.length?wt(n,t):n}function Ur(n){return n?gu.call(n):n}function zr(n){if(!n||!n.length)return[];var t=0;return n=o(n,(function(n){return Hr(n)?(t=hu(n.length,t),!0):void 0})),b(t,(function(t){return c(n,mt(t))}))}function Br(n,t){if(!n||!n.length)return[];var e=zr(n);return null==t?e:c(e,(function(n){return r(t,M,n)}))}function Lr(n){return(n=bn(n)).__chain__=!0,n}function $r(n,t){return t(n)}function Fr(n,t){return"function"==typeof t&&xo(n)?e(n,t):Ru(n,Er(t))}function Mr(n,t){var r;if("function"==typeof t&&xo(n)){for(r=n.length;r--&&!1!==t(n[r],r,n););r=n}else r=Su(n,Er(t));return r}function Nr(n,t){var r=-1,e=he(n),u=(o=e.length)-1;for(t=Yn(pe(t),0,o);++r<t;){var o,i=e[o=Ot(r,u)];e[o]=e[r],e[r]=i}return e.length=t,e}function Zr(n){if(null==n)return 0;if(Yr(n)){var t=n.length;return t&&ce(n)?$(n):t}return je(n).length}function Dr(n,t,r){return t=r?M:t,t=n&&null==t?n.length:t,ir(n,128,M,M,M,M,t)}function qr(n,t){var r;if("function"!=typeof t)throw new Ne("Expected a function");return n=pe(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=M),r}}function Pr(n,t,r){function e(){p&&Xe(p),a&&Xe(a),v=0,c=a=h=p=_=M}function u(t,r){r&&Xe(r),a=p=_=M,t&&(v=lo(),l=n.apply(h,c),p||a||(c=h=M))}function o(){var n=t-(lo()-s);0>=n||n>t?u(_,a):p=ou(o,n)}function i(){u(y,p)}function f(){if(c=arguments,s=lo(),h=this,_=y&&(p||!g),!1===d)var r=g&&!p;else{a||g||(v=s);var e=d-(s-v),u=0>=e||e>d;u?(a&&(a=Xe(a)),v=s,l=n.apply(h,c)):a||(a=ou(i,e))}return u&&p?p=Xe(p):p||t===d||(p=ou(o,t)),r&&(u=!0,l=n.apply(h,c)),!u||p||a||(c=h=M),l}var c,a,l,s,h,p,_,v=0,g=!1,d=!1,y=!0;if("function"!=typeof n)throw new Ne("Expected a function");return t=ve(t)||0,re(r)&&(g=!!r.leading,d="maxWait"in r&&hu(ve(r.maxWait)||0,t),y="trailing"in r?!!r.trailing:y),f.cancel=e,f.flush=function(){return(p&&_||a&&y)&&(l=n.apply(h,c)),e(),l},f}function Tr(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],o=r.cache;return o.has(u)?o.get(u):(e=n.apply(this,e),r.cache=o.set(u,e),e)}if("function"!=typeof n||t&&"function"!=typeof t)throw new Ne("Expected a function");return r.cache=new Tr.Cache,r}function Kr(n,t){if("function"!=typeof n)throw new Ne("Expected a function");return t=hu(t===M?n.length-1:pe(t),0),function(){for(var e=arguments,u=-1,o=hu(e.length-t,0),i=Array(o);++u<o;)i[u]=e[t+u];switch(t){case 0:return n.call(this,i);case 1:return n.call(this,e[0],i);case 2:return n.call(this,e[0],e[1],i)}for(o=Array(t+1),u=-1;++u<t;)o[u]=e[u];return o[t]=i,r(n,this,o)}}function Gr(n,t){return n===t||n!=n&&t!=t}function Vr(n,t){return n>t}function Jr(n){return Hr(n)&&Pe.call(n,"callee")&&(!uu.call(n,"callee")||"[object Arguments]"==Ge.call(n))}function Yr(n){return null!=n&&!("function"==typeof n&&Xr(n))&&te(Lu(n))}function Hr(n){return ee(n)&&Yr(n)}function Qr(n){return ee(n)&&"string"==typeof n.message&&"[object Error]"==Ge.call(n)}function Xr(n){return"[object Function]"==(n=re(n)?Ge.call(n):"")||"[object GeneratorFunction]"==n}function ne(n){return"number"==typeof n&&n==pe(n)}function te(n){return"number"==typeof n&&n>-1&&0==n%1&&9007199254740991>=n}function re(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function ee(n){return!!n&&"object"==typeof n}function ue(n){return null!=n&&(Xr(n)?Je.test(qe.call(n)):ee(n)&&(W(n)?Je:pn).test(n))}function oe(n){return"number"==typeof n||ee(n)&&"[object Number]"==Ge.call(n)}function ie(n){if(!ee(n)||"[object Object]"!=Ge.call(n)||W(n))return!1;var t=De;return"function"==typeof n.constructor&&(t=tu(n)),null===t||"function"==typeof(n=t.constructor)&&n instanceof n&&qe.call(n)==Ke}function fe(n){return re(n)&&"[object RegExp]"==Ge.call(n)}function ce(n){return"string"==typeof n||!xo(n)&&ee(n)&&"[object String]"==Ge.call(n)}function ae(n){return"symbol"==typeof n||ee(n)&&"[object Symbol]"==Ge.call(n)}function le(n){return ee(n)&&te(n.length)&&!!In[Ge.call(n)]}function se(n,t){return t>n}function he(n){if(!n)return[];if(Yr(n))return ce(n)?n.match(mn):Nt(n);if(eu&&n[eu])return U(n[eu]());var t=pr(n);return("[object Map]"==t?z:"[object Set]"==t?L:Ae)(n)}function pe(n){if(!n)return 0===n?n:0;if((n=ve(n))===N||n===-N)return 17976931348623157e292*(0>n?-1:1);var t=n%1;return n==n?t?n-t:n:0}function _e(n){return n?Yn(pe(n),0,4294967295):0}function ve(n){if(re(n)&&(n=re(n=Xr(n.valueOf)?n.valueOf():n)?n+"":n),"string"!=typeof n)return 0===n?n:+n;n=n.replace(en,"");var t=hn.test(n);return t||_n.test(n)?Ln(n.slice(2),t?2:8):sn.test(n)?Z:+n}function ge(n){return Zt(n,me(n))}function de(n){if("string"==typeof n)return n;if(null==n)return"";if(ae(n))return Ye?Eu.call(n):"";var t=n+"";return"0"==t&&1/n==-N?"-0":t}function ye(n,t,r){return(n=null==n?M:it(n,t))===M?r:n}function be(n,t){return _r(n,t,ft)}function xe(n,t){return _r(n,t,ct)}function je(n){var t=jr(n);if(!t&&!Yr(n))return su(Object(n));var r,e,u=!!(e=gr(n)),o=(e=e||[]).length;for(r in n)!ft(n,r)||u&&("length"==r||C(r,o))||t&&"constructor"==r||e.push(r);return e}function me(n){for(var t,r=-1,e=jr(n),u=_t(n),o=u.length,i=!!(t=gr(n)),f=(t=t||[]).length;++r<o;){var c=u[r];i&&("length"==c||C(c,f))||"constructor"==c&&(e||!Pe.call(n,c))||t.push(c)}return t}function we(n){return x(n,je(n))}function Ae(n){return n?m(n,je(n)):[]}function Oe(n){return $o(de(n).toLowerCase())}function Ee(n){return(n=de(n))&&n.replace(gn,k).replace(jn,"")}function ke(n,t){n=de(n),t=pe(t);var r="";if(!n||1>t||t>9007199254740991)return r;do{t%2&&(r+=n),t=cu(t/2),n+=n}while(t);return r}function Ie(n,t,r){return n=de(n),(t=r?M:t)===M&&(t=En.test(n)?On:An),n.match(t)||[]}function Re(n){return n}function Se(n){return ee(n)&&!xo(n)?We(n):pt(n)}function We(n){return gt(Hn(n,!0))}function Ce(n,t,r){var u=je(t),o=ot(t,u);null!=r||re(t)&&(o.length||!u.length)||(r=t,t=n,n=this,o=ot(t,je(t)));var i=!re(r)||!("chain"in r)||r.chain,f=Xr(n);return e(o,(function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(i||t){var r=n(this.__wrapped__);return(r.__actions__=Nt(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})})),n}function Ue(){}function ze(n){return yr(n)?mt(n):function(n){return function(t){return it(t,n)}}(n)}function Be(n){return n&&n.length?y(n,Re):M}var Le=(vn=vn?Pn.defaults({},vn,Pn.pick(qn,kn)):qn).Date,$e=vn.Error,Fe=vn.Math,Me=vn.RegExp,Ne=vn.TypeError,Ze=vn.Array.prototype,De=vn.Object.prototype,qe=vn.Function.prototype.toString,Pe=De.hasOwnProperty,Te=0,Ke=qe.call(Object),Ge=De.toString,Ve=qn._,Je=Me("^"+qe.call(Pe).replace(tn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ye=vn.Symbol,He=vn.f,Qe=vn.Uint8Array,Xe=vn.clearTimeout,nu=He?He.g:M,tu=Object.getPrototypeOf,ru=Object.getOwnPropertySymbols,eu="symbol"==typeof(eu=Ye&&Ye.iterator)?eu:M,uu=De.propertyIsEnumerable,ou=vn.setTimeout,iu=Ze.splice,fu=Fe.ceil,cu=Fe.floor,au=vn.isFinite,lu=Ze.join,su=Object.keys,hu=Fe.max,pu=Fe.min,_u=vn.parseInt,vu=Fe.random,gu=Ze.reverse,du=hr(vn,"Map"),yu=hr(vn,"Set"),bu=hr(vn,"WeakMap"),xu=hr(Object,"create"),ju=bu&&new bu,mu=du?qe.call(du):"",wu=yu?qe.call(yu):"",Au=Ye?Ye.prototype:M,Ou=Ye?Au.valueOf:M,Eu=Ye?Au.toString:M,ku={};bn.templateSettings={escape:J,evaluate:Y,interpolate:H,variable:"",imports:{_:bn}};var Iu=function(){function n(){}return function(t){if(re(t)){n.prototype=t;var r=new n;n.prototype=M}return r||{}}}(),Ru=Kt(et),Su=Kt(ut,!0),Wu=Gt(),Cu=Gt(!0);nu&&!uu.call({valueOf:1},"valueOf")&&(_t=function(n){return U(nu(n))});var Uu=ju?function(n,t){return ju.set(n,t),n}:Re,zu=yu&&2===new yu([1,2]).size?function(n){return new yu(n)}:Ue,Bu=ju?function(n){return ju.get(n)}:Ue,Lu=mt("length"),$u=ru||function(){return[]};(du&&"[object Map]"!=pr(new du)||yu&&"[object Set]"!=pr(new yu))&&(pr=function(n){var t=Ge.call(n);if(n="function"==typeof(n="[object Object]"==t?n.constructor:null)?qe.call(n):""){if(n==mu)return"[object Map]";if(n==wu)return"[object Set]"}return t});var Fu=function(){var n=0,t=0;return function(r,e){var u=lo(),o=16-(u-t);if(t=u,o>0){if(150<=++n)return r}else n=0;return Uu(r,e)}}(),Mu=Kr((function(n,t){t=rt(t);for(var r=xo(n)?n:[Object(n)],e=t,u=-1,o=r.length,i=-1,f=e.length,c=Array(o+f);++u<o;)c[u]=r[u];for(;++i<f;)c[u++]=e[i];return c})),Nu=Kr((function(n,t){return Hr(n)?Xn(n,rt(t,!1,!0)):[]})),Zu=Kr((function(n,t){var r=Wr(t);return Hr(r)&&(r=M),Hr(n)?Xn(n,rt(t,!1,!0),lr(r)):[]})),Du=Kr((function(n,t){var r=Wr(t);return Hr(r)&&(r=M),Hr(n)?Xn(n,rt(t,!1,!0),M,r):[]})),qu=Kr((function(n){var t=c(n,Or);return t.length&&t[0]===n[0]?at(t):[]})),Pu=Kr((function(n){var t=Wr(n),r=c(n,Or);return t===Wr(r)?t=M:r.pop(),r.length&&r[0]===n[0]?at(r,lr(t)):[]})),Tu=Kr((function(n){var t=Wr(n),r=c(n,Or);return t===Wr(r)?t=M:r.pop(),r.length&&r[0]===n[0]?at(r,M,t):[]})),Ku=Kr(Cr),Gu=Kr((function(n,t){var r=Jn(n,t=c(rt(t),String));return At(n,t.sort(E)),r})),Vu=Kr((function(n){return Ut(rt(n,!1,!0))})),Ju=Kr((function(n){var t=Wr(n);return Hr(t)&&(t=M),Ut(rt(n,!1,!0),lr(t))})),Yu=Kr((function(n){var t=Wr(n);return Hr(t)&&(t=M),Ut(rt(n,!1,!0),M,t)})),Hu=Kr((function(n,t){return Hr(n)?Xn(n,t):[]})),Qu=Kr((function(n){return Lt(o(n,Hr))})),Xu=Kr((function(n){var t=Wr(n);return Hr(t)&&(t=M),Lt(o(n,Hr),lr(t))})),no=Kr((function(n){var t=Wr(n);return Hr(t)&&(t=M),Lt(o(n,Hr),M,t)})),to=Kr(zr),ro=Kr((function(n){var t="function"==typeof(t=(t=n.length)>1?n[t-1]:M)?(n.pop(),t):M;return Br(n,t)})),eo=Kr((function(n){function t(t){return Jn(t,n)}var r=(n=rt(n)).length,e=r?n[0]:0,u=this.__wrapped__;return 1>=r&&!this.__actions__.length&&u instanceof Wn&&C(e)?((u=u.slice(e,+e+(r?1:0))).__actions__.push({func:$r,args:[t],thisArg:M}),new Sn(u,this.__chain__).thru((function(n){return r&&!n.length&&n.push(M),n}))):this.thru(t)})),uo=Pt((function(n,t,r){Pe.call(n,r)?++n[r]:n[r]=1})),oo=Pt((function(n,t,r){Pe.call(n,r)?n[r].push(t):n[r]=[t]})),io=Kr((function(n,t,e){var u=-1,o="function"==typeof t,i=yr(t),f=Yr(n)?Array(n.length):[];return Ru(n,(function(n){var c=o?t:i&&null!=n?n[t]:M;f[++u]=c?r(c,n,e):lt(n,t,e)})),f})),fo=Pt((function(n,t,r){n[r]=t})),co=Pt((function(n,t,r){n[r?0:1].push(t)}),(function(){return[[],[]]})),ao=Kr((function(n,t){if(null==n)return[];var r=t.length;return r>1&&dr(n,t[0],t[1])?t=[]:r>2&&dr(t[0],t[1],t[2])&&(t.length=1),bt(n,rt(t),[])})),lo=Le.now,so=Kr((function(n,t,r){var e=1;if(r.length){var u=B(r,so.placeholder);e=32|e}return ir(n,e,t,r,u)})),ho=Kr((function(n,t,r){var e=3;if(r.length){var u=B(r,ho.placeholder);e=32|e}return ir(t,e,n,r,u)})),po=Kr((function(n,t){return Qn(n,1,t)})),_o=Kr((function(n,t,r){return Qn(n,ve(t)||0,r)})),vo=Kr((function(n,t){var e=(t=c(rt(t),lr())).length;return Kr((function(u){for(var o=-1,i=pu(u.length,e);++o<i;)u[o]=t[o].call(this,u[o]);return r(n,this,u)}))})),go=Kr((function(n,t){var r=B(t,go.placeholder);return ir(n,32,M,t,r)})),yo=Kr((function(n,t){var r=B(t,yo.placeholder);return ir(n,64,M,t,r)})),bo=Kr((function(n,t){return ir(n,256,M,M,M,rt(t))})),xo=Array.isArray,jo=Tt((function(n,t){Zt(t,je(t),n)})),mo=Tt((function(n,t){Zt(t,me(t),n)})),wo=Tt((function(n,t,r){Dt(t,me(t),n,r)})),Ao=Tt((function(n,t,r){Dt(t,je(t),n,r)})),Oo=Kr((function(n,t){return Jn(n,rt(t))})),Eo=Kr((function(n){return n.push(M,Tn),r(wo,M,n)})),ko=Kr((function(n){return n.push(M,mr),r(So,M,n)})),Io=Kr(lt),Ro=Tt((function(n,t){yt(n,t)})),So=Tt((function(n,t,r){yt(n,t,r)})),Wo=Kr((function(n,t){return null==n?{}:(t=c(rt(t),String),xt(n,Xn(me(n),t)))})),Co=Kr((function(n,t){return null==n?{}:xt(n,rt(t))})),Uo=Jt((function(n,t,r){return t=t.toLowerCase(),n+(r?Oe(t):t)})),zo=Jt((function(n,t,r){return n+(r?"-":"")+t.toLowerCase()})),Bo=Jt((function(n,t,r){return n+(r?" ":"")+t.toLowerCase()})),Lo=Vt("toLowerCase"),$o=Vt("toUpperCase"),Fo=Jt((function(n,t,r){return n+(r?"_":"")+t.toLowerCase()})),Mo=Jt((function(n,t,r){return n+(r?" ":"")+Oe(t)})),No=Jt((function(n,t,r){return n+(r?" ":"")+t.toUpperCase()})),Zo=Kr((function(n,t){try{return r(n,M,t)}catch(n){return Qr(n)?n:new $e(n)}})),Do=Kr((function(n,t){return e(rt(t),(function(t){n[t]=so(n[t],n)})),n})),qo=Qt(),Po=Qt(!0),To=Kr((function(n,t){return function(r){return lt(r,n,t)}})),Ko=Kr((function(n,t){return function(r){return lt(n,r,t)}})),Go=nr(c),Vo=nr(u),Jo=nr(h),Yo=er(),Ho=er(!0),Qo=or("ceil"),Xo=or("floor"),ni=or("round");return bn.prototype=xn.prototype,Sn.prototype=Iu(xn.prototype),Sn.prototype.constructor=Sn,Wn.prototype=Iu(xn.prototype),Wn.prototype.constructor=Wn,Cn.prototype=xu?xu(null):De,Un.prototype.clear=function(){this.__data__={hash:new Cn,map:du?new du:[],string:new Cn}},Un.prototype.delete=function(n){var t=this.__data__;return br(n)?(t="string"==typeof n?t.string:t.hash,n=(xu?t[n]!==M:Pe.call(t,n))&&delete t[n]):n=du?t.map.delete(n):Mn(t.map,n),n},Un.prototype.get=function(n){var t=this.__data__;return br(n)?(t="string"==typeof n?t.string:t.hash,xu?n="__lodash_hash_undefined__"===(n=t[n])?M:n:n=Pe.call(t,n)?t[n]:M):n=du?t.map.get(n):Nn(t.map,n),n},Un.prototype.has=function(n){var t=this.__data__;return br(n)?(t="string"==typeof n?t.string:t.hash,n=xu?t[n]!==M:Pe.call(t,n)):n=du?t.map.has(n):-1<Zn(t.map,n),n},Un.prototype.set=function(n,t){var r=this.__data__;return br(n)?("string"==typeof n?r.string:r.hash)[n]=xu&&t===M?"__lodash_hash_undefined__":t:du?r.map.set(n,t):Dn(r.map,n,t),this},zn.prototype.push=function(n){var t=this.__data__;br(n)?(t=t.__data__,("string"==typeof n?t.string:t.hash)[n]="__lodash_hash_undefined__"):t.set(n,"__lodash_hash_undefined__")},Fn.prototype.clear=function(){this.__data__={array:[],map:null}},Fn.prototype.delete=function(n){var t=this.__data__,r=t.array;return r?Mn(r,n):t.map.delete(n)},Fn.prototype.get=function(n){var t=this.__data__,r=t.array;return r?Nn(r,n):t.map.get(n)},Fn.prototype.has=function(n){var t=this.__data__,r=t.array;return r?-1<Zn(r,n):t.map.has(n)},Fn.prototype.set=function(n,t){var r=this.__data__,e=r.array;return e&&(199>e.length?Dn(e,n,t):(r.array=null,r.map=new Un(e))),(r=r.map)&&r.set(n,t),this},Tr.Cache=Un,bn.after=function(n,t){if("function"!=typeof t)throw new Ne("Expected a function");return n=pe(n),function(){return 1>--n?t.apply(this,arguments):void 0}},bn.ary=Dr,bn.assign=jo,bn.assignIn=mo,bn.assignInWith=wo,bn.assignWith=Ao,bn.at=Oo,bn.before=qr,bn.bind=so,bn.bindAll=Do,bn.bindKey=ho,bn.chain=Lr,bn.chunk=function(n,t){t=hu(pe(t),0);var r=n?n.length:0;if(!r||1>t)return[];for(var e=0,u=-1,o=Array(fu(r/t));r>e;)o[++u]=kt(n,e,e+=t);return o},bn.compact=function(n){for(var t=-1,r=n?n.length:0,e=-1,u=[];++t<r;){var o=n[t];o&&(u[++e]=o)}return u},bn.concat=Mu,bn.cond=function(n){var t=n?n.length:0,e=lr();return n=t?c(n,(function(n){if("function"!=typeof n[1])throw new Ne("Expected a function");return[e(n[0]),n[1]]})):[],Kr((function(e){for(var u=-1;++u<t;){var o=n[u];if(r(o[0],this,e))return r(o[1],this,e)}}))},bn.conforms=function(n){return function(n){var t=je(n),r=t.length;return function(e){if(null==e)return!r;for(var u=r;u--;){var o=t[u],i=n[o],f=e[o];if(f===M&&!(o in Object(e))||!i(f))return!1}return!0}}(Hn(n,!0))},bn.constant=function(n){return function(){return n}},bn.countBy=uo,bn.create=function(n,t){var r=Iu(n);return t?Vn(r,t):r},bn.curry=function n(t,r,e){return(t=ir(t,8,M,M,M,M,M,r=e?M:r)).placeholder=n.placeholder,t},bn.curryRight=function n(t,r,e){return(t=ir(t,16,M,M,M,M,M,r=e?M:r)).placeholder=n.placeholder,t},bn.debounce=Pr,bn.defaults=Eo,bn.defaultsDeep=ko,bn.defer=po,bn.delay=_o,bn.difference=Nu,bn.differenceBy=Zu,bn.differenceWith=Du,bn.drop=Ir,bn.dropRight=Rr,bn.dropRightWhile=function(n,t){return n&&n.length?zt(n,lr(t,3),!0,!0):[]},bn.dropWhile=function(n,t){return n&&n.length?zt(n,lr(t,3),!0):[]},bn.fill=function(n,t,r,e){var u=n?n.length:0;if(!u)return[];for(r&&"number"!=typeof r&&dr(n,t,r)&&(r=0,e=u),u=n.length,0>(r=pe(r))&&(r=-r>u?0:u+r),0>(e=e===M||e>u?u:pe(e))&&(e+=u),e=r>e?0:_e(e);e>r;)n[r++]=t;return n},bn.filter=function(n,t){return(xo(n)?o:tt)(n,lr(t,3))},bn.flatMap=function(n,t){return n&&n.length?rt(c(n,lr(t,3))):[]},bn.flatten=function(n){return n&&n.length?rt(n):[]},bn.flattenDeep=function(n){return n&&n.length?rt(n,!0):[]},bn.flip=function(n){return ir(n,512)},bn.flow=qo,bn.flowRight=Po,bn.fromPairs=function(n){for(var t=-1,r=n?n.length:0,e={};++t<r;){var u=n[t];Et(e,u[0],u[1])}return e},bn.functions=function(n){return null==n?[]:ot(n,je(n))},bn.functionsIn=function(n){return null==n?[]:ot(n,me(n))},bn.groupBy=oo,bn.initial=function(n){return Rr(n,1)},bn.intersection=qu,bn.intersectionBy=Pu,bn.intersectionWith=Tu,bn.invert=function(n,t,r){return l(je(n),(function(e,u){var o=n[u];return t&&!r?Pe.call(e,o)?e[o].push(u):e[o]=[u]:e[o]=u,e}),{})},bn.invokeMap=io,bn.iteratee=Se,bn.keyBy=fo,bn.keys=je,bn.keysIn=me,bn.map=function(n,t){return(xo(n)?c:vt)(n,lr(t,3))},bn.mapKeys=function(n,t){var r={};return t=lr(t,3),et(n,(function(n,e,u){r[t(n,e,u)]=n})),r},bn.mapValues=function(n,t){var r={};return t=lr(t,3),et(n,(function(n,e,u){r[e]=t(n,e,u)})),r},bn.matches=We,bn.matchesProperty=function(n,t){return dt(n,Hn(t,!0))},bn.memoize=Tr,bn.merge=Ro,bn.mergeWith=So,bn.method=To,bn.methodOf=Ko,bn.mixin=Ce,bn.negate=function(n){if("function"!=typeof n)throw new Ne("Expected a function");return function(){return!n.apply(this,arguments)}},bn.nthArg=function(n){return n=pe(n),function(){return arguments[n]}},bn.omit=Wo,bn.omitBy=function(n,t){return t=lr(t),jt(n,(function(n){return!t(n)}))},bn.once=function(n){return qr(2,n)},bn.orderBy=function(n,t,r,e){return null==n?[]:(xo(t)||(t=null==t?[]:[t]),xo(r=e?M:r)||(r=null==r?[]:[r]),bt(n,t,r))},bn.over=Go,bn.overArgs=vo,bn.overEvery=Vo,bn.overSome=Jo,bn.partial=go,bn.partialRight=yo,bn.partition=co,bn.pick=Co,bn.pickBy=function(n,t){return null==n?{}:jt(n,lr(t))},bn.property=ze,bn.propertyOf=function(n){return function(t){return null==n?M:it(n,t)}},bn.pull=Ku,bn.pullAll=Cr,bn.pullAllBy=function(n,t,r){return n&&n.length&&t&&t.length?wt(n,t,lr(r)):n},bn.pullAt=Gu,bn.range=Yo,bn.rangeRight=Ho,bn.rearg=bo,bn.reject=function(n,t){var r=xo(n)?o:tt;return t=lr(t,3),r(n,(function(n,r,e){return!t(n,r,e)}))},bn.remove=function(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],o=n.length;for(t=lr(t,3);++e<o;){var i=n[e];t(i,e,n)&&(r.push(i),u.push(e))}return At(n,u),r},bn.rest=Kr,bn.reverse=Ur,bn.sampleSize=Nr,bn.set=function(n,t,r){return null==n?n:Et(n,t,r)},bn.setWith=function(n,t,r,e){return e="function"==typeof e?e:M,null==n?n:Et(n,t,r,e)},bn.shuffle=function(n){return Nr(n,4294967295)},bn.slice=function(n,t,r){var e=n?n.length:0;return e?(r&&"number"!=typeof r&&dr(n,t,r)?(t=0,r=e):(t=null==t?0:pe(t),r=r===M?e:pe(r)),kt(n,t,r)):[]},bn.sortBy=ao,bn.sortedUniq=function(n){return n&&n.length?Wt(n):[]},bn.sortedUniqBy=function(n,t){return n&&n.length?Wt(n,lr(t)):[]},bn.split=function(n,t,r){return de(n).split(t,r)},bn.spread=function(n){if("function"!=typeof n)throw new Ne("Expected a function");return function(t){return r(n,this,t)}},bn.tail=function(n){return Ir(n,1)},bn.take=function(n,t,r){return n&&n.length?kt(n,0,0>(t=r||t===M?1:pe(t))?0:t):[]},bn.takeRight=function(n,t,r){var e=n?n.length:0;return e?kt(n,0>(t=e-(t=r||t===M?1:pe(t)))?0:t,e):[]},bn.takeRightWhile=function(n,t){return n&&n.length?zt(n,lr(t,3),!1,!0):[]},bn.takeWhile=function(n,t){return n&&n.length?zt(n,lr(t,3)):[]},bn.tap=function(n,t){return t(n),n},bn.throttle=function(n,t,r){var e=!0,u=!0;if("function"!=typeof n)throw new Ne("Expected a function");return re(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),Pr(n,t,{leading:e,maxWait:t,trailing:u})},bn.thru=$r,bn.toArray=he,bn.toPairs=we,bn.toPairsIn=function(n){return x(n,me(n))},bn.toPath=function(n){return xo(n)?c(n,String):Ar(n)},bn.toPlainObject=ge,bn.transform=function(n,t,r){var u=xo(n)||le(n);if(t=lr(t,4),null==r)if(u||re(n)){var o=n.constructor;r=u?xo(n)?new o:[]:Iu(Xr(o)?o.prototype:M)}else r={};return(u?e:et)(n,(function(n,e,u){return t(r,n,e,u)})),r},bn.unary=function(n){return Dr(n,1)},bn.union=Vu,bn.unionBy=Ju,bn.unionWith=Yu,bn.uniq=function(n){return n&&n.length?Ut(n):[]},bn.uniqBy=function(n,t){return n&&n.length?Ut(n,lr(t)):[]},bn.uniqWith=function(n,t){return n&&n.length?Ut(n,M,t):[]},bn.unset=function(n,t){var r,e;null==n?r=!0:(r=wr(r=n,e=yr(e=t,r)?[e+""]:Ct(e)),e=Wr(e),r=null==r||!be(r,e)||delete r[e]);return r},bn.unzip=zr,bn.unzipWith=Br,bn.values=Ae,bn.valuesIn=function(n){return null==n?m(n,me(n)):[]},bn.without=Hu,bn.words=Ie,bn.wrap=function(n,t){return go(t=null==t?Re:t,n)},bn.xor=Qu,bn.xorBy=Xu,bn.xorWith=no,bn.zip=to,bn.zipObject=function(n,t){for(var r=-1,e=n?n.length:0,u=t?t.length:0,o={};++r<e;)Et(o,n[r],u>r?t[r]:M);return o},bn.zipWith=ro,bn.each=Fr,bn.eachRight=Mr,bn.extend=mo,bn.extendWith=wo,Ce(bn,bn),bn.add=function(n,t){var r;return n!==M&&(r=n),t!==M&&(r=r===M?t:r+t),r},bn.attempt=Zo,bn.camelCase=Uo,bn.capitalize=Oe,bn.ceil=Qo,bn.clamp=function(n,t,r){return r===M&&(r=t,t=M),r!==M&&(r=(r=ve(r))==r?r:0),t!==M&&(t=(t=ve(t))==t?t:0),Yn(ve(n),t,r)},bn.clone=function(n){return Hn(n)},bn.cloneDeep=function(n){return Hn(n,!0)},bn.cloneDeepWith=function(n,t){return Hn(n,!0,t)},bn.cloneWith=function(n,t){return Hn(n,!1,t)},bn.deburr=Ee,bn.endsWith=function(n,t,r){t="string"==typeof t?t:t+"";var e=(n=de(n)).length;return r=r===M?e:Yn(pe(r),0,e),(r-=t.length)>=0&&n.indexOf(t,r)==r},bn.eq=Gr,bn.escape=function(n){return(n=de(n))&&V.test(n)?n.replace(K,I):n},bn.escapeRegExp=function(n){return(n=de(n))&&rn.test(n)?n.replace(tn,"\\$&"):n},bn.every=function(n,t,r){var e=xo(n)?u:nt;return r&&dr(n,t,r)&&(t=M),e(n,lr(t,3))},bn.find=function(n,t){if(t=lr(t,3),xo(n)){var r=v(n,t);return r>-1?n[r]:M}return _(n,t,Ru)},bn.findIndex=function(n,t){return n&&n.length?v(n,lr(t,3)):-1},bn.findKey=function(n,t){return _(n,lr(t,3),et,!0)},bn.findLast=function(n,t){if(t=lr(t,3),xo(n)){var r=v(n,t,!0);return r>-1?n[r]:M}return _(n,t,Su)},bn.findLastIndex=function(n,t){return n&&n.length?v(n,lr(t,3),!0):-1},bn.findLastKey=function(n,t){return _(n,lr(t,3),ut,!0)},bn.floor=Xo,bn.forEach=Fr,bn.forEachRight=Mr,bn.forIn=function(n,t){return null==n?n:Wu(n,Er(t),me)},bn.forInRight=function(n,t){return null==n?n:Cu(n,Er(t),me)},bn.forOwn=function(n,t){return n&&et(n,Er(t))},bn.forOwnRight=function(n,t){return n&&ut(n,Er(t))},bn.get=ye,bn.gt=Vr,bn.gte=function(n,t){return n>=t},bn.has=be,bn.hasIn=xe,bn.head=Sr,bn.identity=Re,bn.includes=function(n,t,r,e){return n=Yr(n)?n:Ae(n),r=r&&!e?pe(r):0,e=n.length,0>r&&(r=hu(e+r,0)),ce(n)?e>=r&&-1<n.indexOf(t,r):!!e&&-1<g(n,t,r)},bn.indexOf=function(n,t,r){var e=n?n.length:0;return e?(0>(r=pe(r))&&(r=hu(e+r,0)),g(n,t,r)):-1},bn.inRange=function(n,t,r){return t=ve(t)||0,r===M?(r=t,t=0):r=ve(r)||0,(n=ve(n))>=pu(t,r)&&n<hu(t,r)},bn.invoke=Io,bn.isArguments=Jr,bn.isArray=xo,bn.isArrayLike=Yr,bn.isArrayLikeObject=Hr,bn.isBoolean=function(n){return!0===n||!1===n||ee(n)&&"[object Boolean]"==Ge.call(n)},bn.isDate=function(n){return ee(n)&&"[object Date]"==Ge.call(n)},bn.isElement=function(n){return!!n&&1===n.nodeType&&ee(n)&&!ie(n)},bn.isEmpty=function(n){return!ee(n)||Xr(n.splice)?!Zr(n):!je(n).length},bn.isEqual=function(n,t){return st(n,t)},bn.isEqualWith=function(n,t,r){var e=(r="function"==typeof r?r:M)?r(n,t):M;return e===M?st(n,t,r):!!e},bn.isError=Qr,bn.isFinite=function(n){return"number"==typeof n&&au(n)},bn.isFunction=Xr,bn.isInteger=ne,bn.isLength=te,bn.isMatch=function(n,t){return n===t||ht(n,t,sr(t))},bn.isMatchWith=function(n,t,r){return r="function"==typeof r?r:M,ht(n,t,sr(t),r)},bn.isNaN=function(n){return oe(n)&&n!=+n},bn.isNative=ue,bn.isNil=function(n){return null==n},bn.isNull=function(n){return null===n},bn.isNumber=oe,bn.isObject=re,bn.isObjectLike=ee,bn.isPlainObject=ie,bn.isRegExp=fe,bn.isSafeInteger=function(n){return ne(n)&&n>=-9007199254740991&&9007199254740991>=n},bn.isString=ce,bn.isSymbol=ae,bn.isTypedArray=le,bn.isUndefined=function(n){return n===M},bn.join=function(n,t){return n?lu.call(n,t):""},bn.kebabCase=zo,bn.last=Wr,bn.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(r!==M&&(u=(0>(u=pe(r))?hu(e+u,0):pu(u,e-1))+1),t!=t)return S(n,u,!0);for(;u--;)if(n[u]===t)return u;return-1},bn.lowerCase=Bo,bn.lowerFirst=Lo,bn.lt=se,bn.lte=function(n,t){return t>=n},bn.max=function(n){return n&&n.length?p(n,Re,Vr):M},bn.maxBy=function(n,t){return n&&n.length?p(n,lr(t),Vr):M},bn.mean=function(n){return Be(n)/(n?n.length:0)},bn.min=function(n){return n&&n.length?p(n,Re,se):M},bn.minBy=function(n,t){return n&&n.length?p(n,lr(t),se):M},bn.noConflict=function(){return qn._=Ve,this},bn.noop=Ue,bn.now=lo,bn.pad=function(n,t,r){n=de(n),t=pe(t);var e=$(n);return t&&t>e?(t=cu(e=(t-e)/2),e=fu(e),tr("",t,r)+n+tr("",e,r)):n},bn.padEnd=function(n,t,r){return(n=de(n))+tr(n,t,r)},bn.padStart=function(n,t,r){return tr(n=de(n),t,r)+n},bn.parseInt=function(n,t,r){return r||null==t?t=0:t&&(t=+t),n=de(n).replace(en,""),_u(n,t||(ln.test(n)?16:10))},bn.random=function(n,t,r){if(r&&"boolean"!=typeof r&&dr(n,t,r)&&(t=r=M),r===M&&("boolean"==typeof t?(r=t,t=M):"boolean"==typeof n&&(r=n,n=M)),n===M&&t===M?(n=0,t=1):(n=ve(n)||0,t===M?(t=n,n=0):t=ve(t)||0),n>t){var e=n;n=t,t=e}return r||n%1||t%1?(r=vu(),pu(n+r*(t-n+Bn("1e-"+((r+"").length-1))),t)):Ot(n,t)},bn.reduce=function(n,t,r){var e=xo(n)?l:d,u=3>arguments.length;return e(n,lr(t,4),r,u,Ru)},bn.reduceRight=function(n,t,r){var e=xo(n)?s:d,u=3>arguments.length;return e(n,lr(t,4),r,u,Su)},bn.repeat=ke,bn.replace=function(){var n=arguments,t=de(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},bn.result=function(n,t,r){if(yr(t,n))e=null==n?M:n[t];else{var e=ye(n,t=Ct(t));n=wr(n,t)}return e===M&&(e=r),Xr(e)?e.call(n):e},bn.round=ni,bn.runInContext=O,bn.sample=function(n){var t=(n=Yr(n)?n:Ae(n)).length;return t>0?n[Ot(0,t-1)]:M},bn.size=Zr,bn.snakeCase=Fo,bn.some=function(n,t,r){var e=xo(n)?h:It;return r&&dr(n,t,r)&&(t=M),e(n,lr(t,3))},bn.sortedIndex=function(n,t){return Rt(n,t)},bn.sortedIndexBy=function(n,t,r){return St(n,t,lr(r))},bn.sortedIndexOf=function(n,t){var r=n?n.length:0;if(r){var e=Rt(n,t);if(r>e&&Gr(n[e],t))return e}return-1},bn.sortedLastIndex=function(n,t){return Rt(n,t,!0)},bn.sortedLastIndexBy=function(n,t,r){return St(n,t,lr(r),!0)},bn.sortedLastIndexOf=function(n,t){if(n&&n.length){var r=Rt(n,t,!0)-1;if(Gr(n[r],t))return r}return-1},bn.startCase=Mo,bn.startsWith=function(n,t,r){return n=de(n),r=Yn(pe(r),0,n.length),n.lastIndexOf(t,r)==r},bn.subtract=function(n,t){var r;return n!==M&&(r=n),t!==M&&(r=r===M?t:r-t),r},bn.sum=Be,bn.sumBy=function(n,t){return n&&n.length?y(n,lr(t)):M},bn.template=function(n,t,r){var e=bn.templateSettings;r&&dr(n,t,r)&&(t=M),n=de(n),t=wo({},t,e,Tn);var u,o,i=je(r=wo({},t.imports,e.imports,Tn)),f=m(r,i),c=0;r=t.interpolate||dn;var a="__p+='";r=Me((t.escape||dn).source+"|"+r.source+"|"+(r===H?cn:dn).source+"|"+(t.evaluate||dn).source+"|$","g");var l="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,(function(t,r,e,i,f,l){return e||(e=i),a+=n.slice(c,l).replace(yn,R),r&&(u=!0,a+="'+__e("+r+")+'"),f&&(o=!0,a+="';"+f+";\n__p+='"),e&&(a+="'+((__t=("+e+"))==null?'':__t)+'"),c=l+t.length,t})),a+="';",(t=t.variable)||(a="with(obj){"+a+"}"),a=(o?a.replace(D,""):a).replace(q,"$1").replace(P,"$1;"),a="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",(t=Zo((function(){return Function(i,l+"return "+a).apply(M,f)}))).source=a,Qr(t))throw t;return t},bn.times=function(n,t){if(1>(n=pe(n))||n>9007199254740991)return[];var r=4294967295,e=pu(n,4294967295);for(n-=4294967295,e=b(e,t=Er(t));++r<n;)t(r);return e},bn.toInteger=pe,bn.toLength=_e,bn.toLower=function(n){return de(n).toLowerCase()},bn.toNumber=ve,bn.toSafeInteger=function(n){return Yn(pe(n),-9007199254740991,9007199254740991)},bn.toString=de,bn.toUpper=function(n){return de(n).toUpperCase()},bn.trim=function(n,t,r){return(n=de(n))?r||t===M?n.replace(en,""):(t+="")?(n=n.match(mn),t=t.match(mn),n.slice(w(n,t),A(n,t)+1).join("")):n:n},bn.trimEnd=function(n,t,r){return(n=de(n))?r||t===M?n.replace(on,""):(t+="")?(n=n.match(mn)).slice(0,A(n,t.match(mn))+1).join(""):n:n},bn.trimStart=function(n,t,r){return(n=de(n))?r||t===M?n.replace(un,""):(t+="")?(n=n.match(mn)).slice(w(n,t.match(mn))).join(""):n:n},bn.truncate=function(n,t){var r=30,e="...";if(re(t)){var u="separator"in t?t.separator:u;r="length"in t?pe(t.length):r,e="omission"in t?de(t.omission):e}var o=(n=de(n)).length;if(wn.test(n)){var i=n.match(mn);o=i.length}if(r>=o)return n;if(1>(o=r-$(e)))return e;if(r=i?i.slice(0,o).join(""):n.slice(0,o),u===M)return r+e;if(i&&(o+=r.length-o),fe(u)){if(n.slice(o).search(u)){var f=r;for(u.global||(u=Me(u.source,de(an.exec(u))+"g")),u.lastIndex=0;i=u.exec(f);)var c=i.index;r=r.slice(0,c===M?o:c)}}else n.indexOf(u,o)!=o&&((u=r.lastIndexOf(u))>-1&&(r=r.slice(0,u)));return r+e},bn.unescape=function(n){return(n=de(n))&&G.test(n)?n.replace(T,F):n},bn.uniqueId=function(n){var t=++Te;return de(n)+t},bn.upperCase=No,bn.upperFirst=$o,bn.first=Sr,Ce(bn,function(){var n={};return et(bn,(function(t,r){Pe.call(bn.prototype,r)||(n[r]=t)})),n}(),{chain:!1}),bn.VERSION="4.0.0",e("bind bindKey curry curryRight partial partialRight".split(" "),(function(n){bn[n].placeholder=bn})),e(["drop","take"],(function(n,t){Wn.prototype[n]=function(r){var e=this.__filtered__;if(e&&!t)return new Wn(this);r=r===M?1:hu(pe(r),0);var u=this.clone();return e?u.__takeCount__=pu(r,u.__takeCount__):u.__views__.push({size:pu(r,4294967295),type:n+(0>u.__dir__?"Right":"")}),u},Wn.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}})),e(["filter","map","takeWhile"],(function(n,t){var r=t+1,e=1==r||3==r;Wn.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:lr(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}})),e(["head","last"],(function(n,t){var r="take"+(t?"Right":"");Wn.prototype[n]=function(){return this[r](1).value()[0]}})),e(["initial","tail"],(function(n,t){var r="drop"+(t?"":"Right");Wn.prototype[n]=function(){return this.__filtered__?new Wn(this):this[r](1)}})),Wn.prototype.compact=function(){return this.filter(Re)},Wn.prototype.find=function(n){return this.filter(n).head()},Wn.prototype.findLast=function(n){return this.reverse().find(n)},Wn.prototype.invokeMap=Kr((function(n,t){return"function"==typeof n?new Wn(this):this.map((function(r){return lt(r,n,t)}))})),Wn.prototype.reject=function(n){return n=lr(n,3),this.filter((function(t){return!n(t)}))},Wn.prototype.slice=function(n,t){n=pe(n);var r=this;return r.__filtered__&&(n>0||0>t)?new Wn(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==M&&(r=0>(t=pe(t))?r.dropRight(-t):r.take(t-n)),r)},Wn.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Wn.prototype.toArray=function(){return this.take(4294967295)},et(Wn.prototype,(function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=bn[e?"take"+("last"==t?"Right":""):t],o=e||/^find/.test(t);u&&(bn.prototype[t]=function(){function t(n){return n=u.apply(bn,a([n],f)),e&&h?n[0]:n}var i=this.__wrapped__,f=e?[1]:arguments,c=i instanceof Wn,l=f[0],s=c||xo(i);s&&r&&"function"==typeof l&&1!=l.length&&(c=s=!1);var h=this.__chain__,p=!!this.__actions__.length;l=o&&!h,c=c&&!p;return!o&&s?(i=c?i:new Wn(this),(i=n.apply(i,f)).__actions__.push({func:$r,args:[t],thisArg:M}),new Sn(i,h)):l&&c?n.apply(this,f):(i=this.thru(t),l?e?i.value()[0]:i.value():i)})})),e("pop push shift sort splice unshift".split(" "),(function(n){var t=Ze[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);bn.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r]((function(r){return t.apply(r,n)}))}})),et(Wn.prototype,(function(n,t){var r=bn[t];if(r){var e=r.name+"";(ku[e]||(ku[e]=[])).push({name:t,func:r})}})),ku[Xt(M,2).name]=[{name:"wrapper",func:M}],Wn.prototype.clone=function(){var n=new Wn(this.__wrapped__);return n.__actions__=Nt(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Nt(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Nt(this.__views__),n},Wn.prototype.reverse=function(){if(this.__filtered__){var n=new Wn(this);n.__dir__=-1,n.__filtered__=!0}else(n=this.clone()).__dir__*=-1;return n},Wn.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=xo(t),u=0>r,o=e?t.length:0;n=o;for(var i=this.__views__,f=0,c=-1,a=i.length;++c<a;){var l=i[c],s=l.size;switch(l.type){case"drop":f+=s;break;case"dropRight":n-=s;break;case"take":n=pu(n,f+s);break;case"takeRight":f=hu(f,n-s)}}if(i=(n={start:f,end:n}).start,n=(f=n.end)-i,u=u?f:i-1,f=(i=this.__iteratees__).length,c=0,a=pu(n,this.__takeCount__),!e||200>o||o==n&&a==n)return Bt(t,this.__actions__);e=[];n:for(;n--&&a>c;){for(o=-1,l=t[u+=r];++o<f;){s=(h=i[o]).type;var h=(0,h.iteratee)(l);if(2==s)l=h;else if(!h){if(1==s)continue n;break n}}e[c++]=l}return e},bn.prototype.at=eo,bn.prototype.chain=function(){return Lr(this)},bn.prototype.commit=function(){return new Sn(this.value(),this.__chain__)},bn.prototype.flatMap=function(n){return this.map(n).flatten()},bn.prototype.next=function(){this.__values__===M&&(this.__values__=he(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?M:this.__values__[this.__index__++]}},bn.prototype.plant=function(n){for(var t,r=this;r instanceof xn;){var e=kr(r);e.__index__=0,e.__values__=M,t?u.__wrapped__=e:t=e;var u=e;r=r.__wrapped__}return u.__wrapped__=n,t},bn.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Wn?(this.__actions__.length&&(n=new Wn(this)),(n=n.reverse()).__actions__.push({func:$r,args:[Ur],thisArg:M}),new Sn(n,this.__chain__)):this.thru(Ur)},bn.prototype.toJSON=bn.prototype.valueOf=bn.prototype.value=function(){return Bt(this.__wrapped__,this.__actions__)},eu&&(bn.prototype[eu]=function(){return this}),bn}();(Nn||Mn||{})._=Pn,"function"==typeof define&&"object"==typeof define.amd&&define.amd?define((function(){return Pn})):$n&&Fn?(Zn&&((Fn.exports=Pn)._=Pn),$n._=Pn):qn._=Pn}).call(this);/**
47
+ * jGestures: a jQuery plugin for gesture events
48
+ * Copyright 2010, Neue Digitale / Razorfish GmbH
49
+
50
+ * Licensed under the Apache License, Version 2.0 (the "License");
51
+ * you may not use this file except in compliance with the License.
52
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
53
+ * Unless required by applicable law or agreed to in writing, software
54
+ * distributed under the License is distributed on an "AS IS" BASIS,
55
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
56
+ * See the License for the specific language governing permissions and
57
+ * limitations under the License.
58
+ *
59
+ * This is still a beta version, bugfixes and improvements appreciated.
60
+ * @copyright Neue Digitale / Razorfish GmbH
61
+ * @author martin.krause@neue-digitale.de
62
+ * @version 0.87
63
+ *
64
+ * @requires
65
+ * jQuery JavaScript Library v1.4.2 - http://jquery.com/
66
+ * Copyright 2010, John Resig
67
+ * Dual licensed under the MIT or GPL Version 2 licenses.
68
+ * http://jquery.org/license
69
+ */
70
70
  !function(e){function t(e){e.startMove=e.startMove?e.startMove:{startX:null,startY:null,timestamp:null};var t=(new Date).getTime();if(e.touches){var s=[{lastX:e.deltaX,lastY:e.deltaY,moved:null,startX:e.screenX-e.startMove.screenX,startY:e.screenY-e.startMove.screenY}],r={vector:e.vector,orientation:window.orientation||null,lastX:s[0].lastX>0?1:s[0].lastX<0?-1:0,lastY:s[0].lastY>0?1:s[0].lastY<0?-1:0,startX:s[0].startX>0?1:s[0].startX<0?-1:0,startY:s[0].startY>0?1:s[0].startY<0?-1:0};s[0].moved=Math.sqrt(Math.pow(Math.abs(s[0].startX),2)+Math.pow(Math.abs(s[0].startY),2))}return{type:e.type||null,originalEvent:e.event||null,delta:s||null,direction:r||{orientation:window.orientation||null,vector:e.vector||null},duration:e.startMove.timestamp?t-e.timestamp:null,rotation:e.rotation||null,scale:e.scale||null,description:e.description||[e.type,":",e.touches,":",0!=s[0].lastX?s[0].lastX>0?"right":"left":"steady",":",0!=s[0].lastY?s[0].lastY>0?"down":"up":"steady"].join("")}}function s(t){e(window).triggerHandler("orientationchange",{direction:{orientation:window.orientation},description:["orientationchange:",["landscape:clockwise:","portrait:default:","landscape:counterclockwise:","portrait:upsidedown:"][window.orientation/90+1],window.orientation].join("")})}function r(t){var s=jQuery(t.currentTarget);s.triggerHandler(e.jGestures.events.touchstart,t),e.hasGestures?(t.currentTarget.addEventListener("touchmove",a,!1),t.currentTarget.addEventListener("touchend",o,!1)):(s.bind("mousemove",a),s.bind("mouseup",o));var r=s.data("ojQueryGestures"),n=t.touches?t.touches[0]:t,c={};c.oLastSwipemove={screenX:n.screenX,screenY:n.screenY,timestamp:(new Date).getTime()},c.oStartTouch={screenX:n.screenX,screenY:n.screenY,timestamp:(new Date).getTime()},s.data("ojQueryGestures",e.extend(!0,r,c))}function a(s){var r=jQuery(s.currentTarget),a=r.data("ojQueryGestures"),o=!!s.touches,n=o?s.changedTouches[0].screenX:s.screenX,c=o?s.changedTouches[0].screenY:s.screenY,i=a.oLastSwipemove,u=n-i.screenX,h=c-i.screenY;if(a.oLastSwipemove){var p=t({type:"swipemove",touches:o?s.touches.length:"1",screenY:c,screenX:n,deltaY:h,deltaX:u,startMove:i,event:s,timestamp:i.timestamp});r.triggerHandler(p.type,p)}var d={},l=s.touches?s.touches[0]:s;d.oLastSwipemove={screenX:l.screenX,screenY:l.screenY,timestamp:(new Date).getTime()},r.data("ojQueryGestures",e.extend(!0,a,d))}function o(s){var r=jQuery(s.currentTarget),n=!!s.changedTouches,c=n?s.changedTouches.length:"1",i=n?s.changedTouches[0].screenX:s.screenX,u=n?s.changedTouches[0].screenY:s.screenY;r.triggerHandler(e.jGestures.events.touchendStart,s),e.hasGestures?(s.currentTarget.removeEventListener("touchmove",a,!1),s.currentTarget.removeEventListener("touchend",o,!1)):(r.unbind("mousemove",a),r.unbind("mouseup",o));var h,p=r.data("ojQueryGestures"),d=Math.abs(p.oStartTouch.screenX-i)>e.jGestures.defaults.thresholdMove||Math.abs(p.oStartTouch.screenY-u)>e.jGestures.defaults.thresholdMove,l=Math.abs(p.oStartTouch.screenX-i)>e.jGestures.defaults.thresholdSwipe||Math.abs(p.oStartTouch.screenY-u)>e.jGestures.defaults.thresholdSwipe;for(h in p){var w=p.oStartTouch,g=(i=n?s.changedTouches[0].screenX:s.screenX,u=n?s.changedTouches[0].screenY:s.screenY,i-w.screenX),v=t({type:"swipe",touches:c,screenY:u,screenX:i,deltaY:u-w.screenY,deltaX:g,startMove:w,event:s,timestamp:w.timestamp}),j=["zero","one","two","three","four"],m=!1;switch(h){case"swipeone":if(!1===n&&1==c&&!1===d)break;(!1===n||1==c&&!0===d&&!0===l)&&(m=!0,v.type=["swipe",j[c]].join(""),r.triggerHandler(v.type,v));break;case"swipetwo":n&&2==c&&!0===d&&!0===l&&(m=!0,v.type=["swipe",j[c]].join(""),r.triggerHandler(v.type,v));break;case"swipethree":n&&3==c&&!0===d&&!0===l&&(m=!0,v.type=["swipe",j[c]].join(""),r.triggerHandler(v.type,v));break;case"swipefour":n&&4==c&&!0===d&&!0===l&&(m=!0,v.type=["swipe",j[c]].join(""),r.triggerHandler(v.type,v));break;case"swipeup":case"swiperightup":case"swiperight":case"swiperightdown":case"swipedown":case"swipeleftdown":case"swipeleft":case"swipeleftup":n&&!0===d&&!0===l&&(m=!0,v.type=["swipe",0!=v.delta[0].lastX?v.delta[0].lastX>0?"right":"left":"",0!=v.delta[0].lastY?v.delta[0].lastY>0?"down":"up":""].join(""),r.triggerHandler(v.type,v));break;case"tapone":case"taptwo":case"tapthree":case"tapfour":!0!==d&&!0!==m&&j[c]==h.slice(3)&&(v.description=["tap",j[c]].join(""),v.type=["tap",j[c]].join(""),r.triggerHandler(v.type,v))}var G={};r.data("ojQueryGestures",e.extend(!0,p,G)),r.data("ojQueryGestures",e.extend(!0,p,G))}r.triggerHandler(e.jGestures.events.touchendProcessed,s)}function n(t){var s=jQuery(t.currentTarget);s.triggerHandler(e.jGestures.events.gesturestart,t);var r=s.data("ojQueryGestures"),a={};a.oStartTouch={timestamp:(new Date).getTime()},s.data("ojQueryGestures",e.extend(!0,r,a))}function c(s){var r,a,o,n,c=jQuery(s.currentTarget),i=c.data("ojQueryGestures");for(n in i)switch(n){case"pinch":((r=s.scale)<1&&r%1<1-e.jGestures.defaults.thresholdPinchclose||r>1&&r%1>e.jGestures.defaults.thresholdPinchopen)&&(a=r<1?-1:1,o=t({type:"pinch",scale:r,touches:null,startMove:i.oStartTouch,event:s,timestamp:i.oStartTouch.timestamp,vector:a,description:["pinch:",a,":",r<1?"close":"open"].join("")}),c.triggerHandler(o.type,o));break;case"rotate":((r=s.rotation)<1&&-1*r>e.jGestures.defaults.thresholdRotateccw||r>1&&r>e.jGestures.defaults.thresholdRotatecw)&&(a=r<1?-1:1,o=t({type:"rotate",rotation:r,touches:null,startMove:i.oStartTouch,event:s,timestamp:i.oStartTouch.timestamp,vector:a,description:["rotate:",a,":",r<1?"counterclockwise":"clockwise"].join("")}),c.triggerHandler(o.type,o))}}function i(s){var r,a=jQuery(s.currentTarget);a.triggerHandler(e.jGestures.events.gestureendStart,s);var o,n=a.data("ojQueryGestures");for(o in n)switch(o){case"pinchclose":(r=s.scale)<1&&r%1<1-e.jGestures.defaults.thresholdPinchclose&&a.triggerHandler("pinchclose",t({type:"pinchclose",scale:r,vector:-1,touches:null,startMove:n.oStartTouch,event:s,timestamp:n.oStartTouch.timestamp,description:"pinch:-1:close"}));break;case"pinchopen":(r=s.scale)>1&&r%1>e.jGestures.defaults.thresholdPinchopen&&a.triggerHandler("pinchopen",t({type:"pinchopen",scale:r,vector:1,touches:null,startMove:n.oStartTouch,event:s,timestamp:n.oStartTouch.timestamp,description:"pinch:+1:open"}));break;case"rotatecw":(r=s.rotation)>1&&r>e.jGestures.defaults.thresholdRotatecw&&a.triggerHandler("rotatecw",t({type:"rotatecw",rotation:r,vector:1,touches:null,startMove:n.oStartTouch,event:s,timestamp:n.oStartTouch.timestamp,description:"rotate:+1:clockwise"}));break;case"rotateccw":(r=s.rotation)<1&&-1*r>e.jGestures.defaults.thresholdRotateccw&&a.triggerHandler("rotateccw",t({type:"rotateccw",rotation:r,vector:-1,touches:null,startMove:n.oStartTouch,event:s,timestamp:n.oStartTouch.timestamp,description:"rotate:-1:counterclockwise"}))}a.triggerHandler(e.jGestures.events.gestureendProcessed,s)}e.jGestures={},e.jGestures.defaults={},e.jGestures.defaults.thresholdPinchopen=.05,e.jGestures.defaults.thresholdPinchmove=.05,e.jGestures.defaults.thresholdPinch=.05,e.jGestures.defaults.thresholdPinchclose=.05,e.jGestures.defaults.thresholdRotatecw=5,e.jGestures.defaults.thresholdRotateccw=5,e.jGestures.defaults.thresholdMove=20,e.jGestures.defaults.thresholdSwipe=100,e.jGestures.data={},e.jGestures.data.capableDevicesInUserAgentString=["iPad","iPhone","iPod","Mobile Safari"],e.jGestures.data.hasGestures=function(){var t;for(t=0;t<e.jGestures.data.capableDevicesInUserAgentString.length;t++)if(-1!==navigator.userAgent.indexOf(e.jGestures.data.capableDevicesInUserAgentString[t]))return!0;return!1}(),e.hasGestures=e.jGestures.data.hasGestures,e.jGestures.events={touchstart:"jGestures.touchstart",touchendStart:"jGestures.touchend;start",touchendProcessed:"jGestures.touchend;processed",gesturestart:"jGestures.gesturestart",gestureendStart:"jGestures.gestureend;start",gestureendProcessed:"jGestures.gestureend;processed"},jQuery.each({orientationchange_orientationchange01:"orientationchange",gestureend_pinchopen01:"pinchopen",gestureend_pinchclose01:"pinchclose",gestureend_rotatecw01:"rotatecw",gestureend_rotateccw01:"rotateccw",gesturechange_pinch01:"pinch",gesturechange_rotate01:"rotate",touchstart_swipe13:"swipemove",touchstart_swipe01:"swipeone",touchstart_swipe02:"swipetwo",touchstart_swipe03:"swipethree",touchstart_swipe04:"swipefour",touchstart_swipe05:"swipeup",touchstart_swipe06:"swiperightup",touchstart_swipe07:"swiperight",touchstart_swipe08:"swiperightdown",touchstart_swipe09:"swipedown",touchstart_swipe10:"swipeleftdown",touchstart_swipe11:"swipeleft",touchstart_swipe12:"swipeleftup",touchstart_tap01:"tapone",touchstart_tap02:"taptwo",touchstart_tap03:"tapthree",touchstart_tap04:"tapfour"},(function(t,u){jQuery.event.special[u]={setup:function(){var a=t.split("_"),o=a[0],u=a[1].slice(0,a[1].length-2),h=jQuery(this);if(!h.data("ojQueryGestures")||!h.data("ojQueryGestures")[o]){var p=h.data("ojQueryGestures")||{},d={};if(d[o]=!0,e.extend(!0,p,d),h.data("ojQueryGestures",p),e.hasGestures)switch(u){case"orientationchange":h.get(0).addEventListener("orientationchange",s,!1);break;case"tap":case"swipe":case"swipeup":case"swiperightup":case"swiperight":case"swiperightdown":case"swipedown":case"swipeleftdown":case"swipeleft":h.get(0).addEventListener("touchstart",r,!1);break;case"pinchopen":case"pinchclose":case"rotatecw":case"rotateccw":h.get(0).addEventListener("gesturestart",n,!1),h.get(0).addEventListener("gestureend",i,!1);break;case"pinch":case"rotate":h.get(0).addEventListener("gesturestart",n,!1),h.get(0).addEventListener("gesturechange",c,!1)}else switch(u){case"tap":case"swipe":h.bind("mousedown",r)}}return!1},add:function(e){return jQuery(this).data("ojQueryGestures")[e.type]={originalType:e.type},!1},remove:function(e){var t=jQuery(this),s=t.data("ojQueryGestures");return s[e.type]=!1,t.data("ojQueryGestures",s),!1},teardown:function(){var u=t.split("_"),h=u[0],p=u[1].slice(0,u[1].length-2),d=jQuery(this);if(!d.data("ojQueryGestures")||!d.data("ojQueryGestures")[h]){var l=d.data("ojQueryGestures")||{},w={};if(w[h]=!1,e.extend(!0,l,w),d.data("ojQueryGestures",l),e.hasGestures)switch(p){case"orientationchange":d.get(0).removeEventListener("orientationchange",s,!1);break;case"tap":case"swipe":case"swipeup":case"swiperightup":case"swiperight":case"swiperightdown":case"swipedown":case"swipeleftdown":case"swipeleft":case"swipeleftup":d.get(0).removeEventListener("touchstart",r,!1),d.get(0).removeEventListener("touchmove",a,!1),d.get(0).removeEventListener("touchend",o,!1);break;case"pinchopen":case"pinchclose":case"rotatecw":case"rotateccw":d.get(0).removeEventListener("gesturestart",n,!1),d.get(0).removeEventListener("gestureend",i,!1);break;case"pinch":case"rotate":d.get(0).removeEventListener("gesturestart",n,!1),d.get(0).removeEventListener("gesturechange",c,!1)}else switch(p){case"tap":case"swipe":d.unbind("mousedown",r),d.unbind("mousemove",a),d.unbind("mouseup",o)}}return!1}}}))}(jQuery);var Pixastic=function(){function t(t,a,e){var r=new Array;null==a&&(a=document),null==e&&(e="*");var n=a.getElementsByTagName(e),s=n.length,o=new RegExp("(^|\\s)"+t+"(\\s|$)");for(i=0,j=0;i<s;i++)o.test(n[i].className)&&(r[j]=n[i],j++);return r}function a(t,a){if(Pixastic.debug){try{switch(a){case"warn":console.warn("Pixastic:",t);break;case"error":console.error("Pixastic:",t);break;default:console.log("Pixastic:",t)}}catch(t){}1}}"undefined"!=typeof pixastic_parseonload&&pixastic_parseonload&&function(t){var a=!1,e=function(){a||(a=!0,t())};document.write('<script defer src="//:" id="__onload_ie_pixastic__"><\/script>');var i=document.getElementById("__onload_ie_pixastic__");i.onreadystatechange=function(){"complete"==i.readyState&&(i.parentNode.removeChild(i),e())},document.addEventListener&&document.addEventListener("DOMContentLoaded",e,!1),function(t,a,e){t.addEventListener?t.addEventListener(a,e,!1):t.attachEvent&&t.attachEvent("on"+a,e)}(window,"load",e)}((function(){for(var a=t("pixastic",null,"img"),e=t("pixastic",null,"canvas"),i=a.concat(e),r=0;r<i.length;r++)!function(){for(var t=i[r],a=[],e=t.className.split(" "),n=0;n<e.length;n++){var s=e[n];if("pixastic-"==s.substring(0,9)){var o=s.substring(9);""!=o&&a.push(o)}}if(a.length)if("img"==t.tagName.toLowerCase()){var c=new Image;if(c.src=t.src,c.complete)for(var h=0;h<a.length;h++){var l=Pixastic.applyAction(t,t,a[h],null);l&&(t=l)}else c.onload=function(){for(var e=0;e<a.length;e++){var i=Pixastic.applyAction(t,t,a[e],null);i&&(t=i)}}}else setTimeout((function(){for(var e=0;e<a.length;e++){var i=Pixastic.applyAction(t,t,a[e],null);i&&(t=i)}}),1)}()}));var e=function(){var t=document.createElement("canvas"),a=!1;try{a=!("function"!=typeof t.getContext||!t.getContext("2d"))}catch(t){}return function(){return a}}(),r=function(){var t,a=document.createElement("canvas"),e=!1;try{"function"==typeof a.getContext&&(t=a.getContext("2d"))&&(e="function"==typeof t.getImageData)}catch(t){}return function(){return e}}(),n=function(){var t=!1,a=document.createElement("canvas");if(e()&&r()){a.width=a.height=1;var i=a.getContext("2d");i.fillStyle="rgb(255,0,0)",i.fillRect(0,0,1,1);var n=document.createElement("canvas");n.width=n.height=1;var s=n.getContext("2d");s.fillStyle="rgb(0,0,255)",s.fillRect(0,0,1,1),i.globalAlpha=.5,i.drawImage(n,0,0);var o=i.getImageData(0,0,1,1).data;t=255!=o[2]}return function(){return t}}();return{parseOnLoad:!1,debug:!1,applyAction:function(t,e,i,r){r=r||{};var n,s,o="canvas"==t.tagName.toLowerCase();if(o&&Pixastic.Client.isIE())return Pixastic.debug&&a("Tried to process a canvas element but browser is IE."),!1;var c=!1;Pixastic.Client.hasCanvas()&&(c=!!r.resultCanvas,s=(n=r.resultCanvas||document.createElement("canvas")).getContext("2d"));var h=t.offsetWidth,l=t.offsetHeight;if(o&&(h=t.width,l=t.height),0==h||0==l){if(null!=t.parentNode)return void(Pixastic.debug&&a("Image has 0 width and/or height."));var p=t.style.position,g=t.style.left;t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),h=t.offsetWidth,l=t.offsetHeight,document.body.removeChild(t),t.style.position=p,t.style.left=g}if(i.indexOf("(")>-1){var v=i;i=v.substr(0,v.indexOf("("));var d=v.match(/\((.*?)\)/);if(d[1]){d=d[1].split(";");for(var u=0;u<d.length;u++)if(thisArg=d[u].split("="),2==thisArg.length)if("rect"==thisArg[0]){var f=thisArg[1].split(",");r[thisArg[0]]={left:parseInt(f[0],10)||0,top:parseInt(f[1],10)||0,width:parseInt(f[2],10)||0,height:parseInt(f[3],10)||0}}else r[thisArg[0]]=thisArg[1]}}r.rect?(r.rect.left=Math.round(r.rect.left),r.rect.top=Math.round(r.rect.top),r.rect.width=Math.round(r.rect.width),r.rect.height=Math.round(r.rect.height)):r.rect={left:0,top:0,width:h,height:l};var m=!1;if(Pixastic.Actions[i]&&"function"==typeof Pixastic.Actions[i].process&&(m=!0),!m)return Pixastic.debug&&a('Invalid action "'+i+'". Maybe file not included?'),!1;if(!Pixastic.Actions[i].checkSupport())return Pixastic.debug&&a('Action "'+i+'" not supported by this browser.'),!1;Pixastic.Client.hasCanvas()?(n!==t&&(n.width=h,n.height=l),c||(n.style.width=h+"px",n.style.height=l+"px"),s.drawImage(e,0,0,h,l),t.__pixastic_org_image?(n.__pixastic_org_image=t.__pixastic_org_image,n.__pixastic_org_width=t.__pixastic_org_width,n.__pixastic_org_height=t.__pixastic_org_height):(n.__pixastic_org_image=t,n.__pixastic_org_width=h,n.__pixastic_org_height=l)):Pixastic.Client.isIE()&&void 0===t.__pixastic_org_style&&(t.__pixastic_org_style=t.style.cssText);var x={image:t,canvas:n,width:h,height:l,useData:!0,options:r};return!!Pixastic.Actions[i].process(x)&&(Pixastic.Client.hasCanvas()?(x.useData&&Pixastic.Client.hasCanvasImageData()&&(n.getContext("2d").putImageData(x.canvasData,r.rect.left,r.rect.top),n.getContext("2d").fillRect(0,0,0,0)),r.leaveDOM||(n.title=t.title,n.imgsrc=t.imgsrc,o||(n.alt=t.alt),o||(n.imgsrc=t.src),n.className=t.className,n.style.cssText=t.style.cssText,n.name=t.name,n.tabIndex=t.tabIndex,n.id=t.id,t.parentNode&&t.parentNode.replaceChild&&t.parentNode.replaceChild(n,t)),r.resultCanvas=n,n):t)},prepareData:function(t,a){var e=t.canvas.getContext("2d"),i=t.options.rect,r=e.getImageData(i.left,i.top,i.width,i.height),n=r.data;return a||(t.canvasData=r),n},process:function(t,a,e,i){if("img"==t.tagName.toLowerCase()){var r=new Image;if(r.src=t.src,r.complete){var n=Pixastic.applyAction(t,r,a,e);return i&&i(n),n}r.onload=function(){var n=Pixastic.applyAction(t,r,a,e);i&&i(n)}}if("canvas"==t.tagName.toLowerCase()){n=Pixastic.applyAction(t,t,a,e);return i&&i(n),n}},revert:function(t){if(Pixastic.Client.hasCanvas()){if("canvas"==t.tagName.toLowerCase()&&t.__pixastic_org_image)return t.width=t.__pixastic_org_width,t.height=t.__pixastic_org_height,t.getContext("2d").drawImage(t.__pixastic_org_image,0,0),t.parentNode&&t.parentNode.replaceChild&&t.parentNode.replaceChild(t.__pixastic_org_image,t),t}else Pixastic.Client.isIE()&&void 0!==t.__pixastic_org_style&&(t.style.cssText=t.__pixastic_org_style)},Client:{hasCanvas:e,hasCanvasImageData:r,hasGlobalAlpha:n,isIE:function(){return!!document.all&&!!window.attachEvent&&!window.opera}},Actions:{}}}();"undefined"!=typeof jQuery&&jQuery&&jQuery.fn&&(jQuery.fn.pixastic=function(t,a){var e=[];return this.each((function(){if("img"!=this.tagName.toLowerCase()||this.complete){var i=Pixastic.process(this,t,a);i&&e.push(i)}})),e.length>0?jQuery(e):this}),Pixastic.Actions.blend={process:function(t){var a=parseFloat(t.options.amount),e=(t.options.mode||"normal").toLowerCase(),i=t.options.image;if(a=Math.max(0,Math.min(1,a)),!i)return!1;if(Pixastic.Client.hasCanvasImageData()){var r=t.options.rect,n=Pixastic.prepareData(t),s=r.width,o=r.height;t.useData=!1;var c=document.createElement("canvas");c.width=t.canvas.width,c.height=t.canvas.height;var h=c.getContext("2d");h.drawImage(i,0,0);var l,p,g,v,d,u,f,m,x,C,w,P,I,D,M={canvas:c,options:t.options},b=Pixastic.prepareData(M),y=M.canvasData,_=4*(S=s*o),k=!1;switch(e){case"normal":break;case"multiply":for(;S--;)b[_-=4]=n[_]*b[_]/255,b[l=_+1]=n[l]*b[l]/255,b[p=_+2]=n[p]*b[p]/255;k=!0;break;case"lighten":for(;S--;)(g=n[_-=4])>b[_]&&(b[_]=g),(v=n[l=_+1])>b[l]&&(b[l]=v),(d=n[p=_+2])>b[p]&&(b[p]=d);k=!0;break;case"darken":for(;S--;)(g=n[_-=4])<b[_]&&(b[_]=g),(v=n[l=_+1])<b[l]&&(b[l]=v),(d=n[p=_+2])<b[p]&&(b[p]=d);k=!0;break;case"darkercolor":for(;S--;).3*(g=n[_-=4])+.59*(v=n[l=_+1])+.11*(d=n[p=_+2])<=.3*b[_]+.59*b[l]+.11*b[p]&&(b[_]=g,b[l]=v,b[p]=d);k=!0;break;case"lightercolor":for(;S--;).3*(g=n[_-=4])+.59*(v=n[l=_+1])+.11*(d=n[p=_+2])>.3*b[_]+.59*b[l]+.11*b[p]&&(b[_]=g,b[l]=v,b[p]=d);k=!0;break;case"lineardodge":for(;S--;)(x=n[_-=4]+b[_])>255?b[_]=255:b[_]=x,(C=n[l=_+1]+b[l])>255?b[l]=255:b[l]=C,(w=n[p=_+2]+b[p])>255?b[p]=255:b[p]=w;k=!0;break;case"linearburn":for(;S--;)(x=n[_-=4]+b[_])<255?b[_]=0:b[_]=x-255,(C=n[l=_+1]+b[l])<255?b[l]=0:b[l]=C-255,(w=n[p=_+2]+b[p])<255?b[p]=0:b[p]=w-255;k=!0;break;case"difference":for(;S--;)(x=n[_-=4]-b[_])<0?b[_]=-x:b[_]=x,(C=n[l=_+1]-b[l])<0?b[l]=-C:b[l]=C,(w=n[p=_+2]-b[p])<0?b[p]=-w:b[p]=w;k=!0;break;case"screen":for(;S--;)b[_-=4]=255-((255-b[_])*(255-n[_])>>8),b[l=_+1]=255-((255-b[l])*(255-n[l])>>8),b[p=_+2]=255-((255-b[p])*(255-n[p])>>8);k=!0;break;case"exclusion":for(var A=2/255;S--;)b[_-=4]=(g=n[_])-(g*A-1)*b[_],b[l=_+1]=(v=n[l])-(v*A-1)*b[l],b[p=_+2]=(d=n[p])-(d*A-1)*b[p];k=!0;break;case"overlay":for(A=2/255;S--;)(g=n[_-=4])<128?b[_]=b[_]*g*A:b[_]=255-(255-b[_])*(255-g)*A,(v=n[l=_+1])<128?b[l]=b[l]*v*A:b[l]=255-(255-b[l])*(255-v)*A,(d=n[p=_+2])<128?b[p]=b[p]*d*A:b[p]=255-(255-b[p])*(255-d)*A;k=!0;break;case"softlight":for(A=2/255;S--;)(g=n[_-=4])<128?b[_]=(64+(b[_]>>1))*g*A:b[_]=255-(191-(b[_]>>1))*(255-g)*A,(v=n[l=_+1])<128?b[l]=(64+(b[l]>>1))*v*A:b[l]=255-(191-(b[l]>>1))*(255-v)*A,(d=n[p=_+2])<128?b[p]=(64+(b[p]>>1))*d*A:b[p]=255-(191-(b[p]>>1))*(255-d)*A;k=!0;break;case"hardlight":for(A=2/255;S--;)(u=b[_-=4])<128?b[_]=n[_]*u*A:b[_]=255-(255-n[_])*(255-u)*A,(f=b[l=_+1])<128?b[l]=n[l]*f*A:b[l]=255-(255-n[l])*(255-f)*A,(m=b[p=_+2])<128?b[p]=n[p]*m*A:b[p]=255-(255-n[p])*(255-m)*A;k=!0;break;case"colordodge":for(;S--;)(x=(n[_-=4]<<8)/(255-(u=b[_])))>255||255==u?b[_]=255:b[_]=x,(C=(n[l=_+1]<<8)/(255-(f=b[l])))>255||255==f?b[l]=255:b[l]=C,(w=(n[p=_+2]<<8)/(255-(m=b[p])))>255||255==m?b[p]=255:b[p]=w;k=!0;break;case"colorburn":for(;S--;)(x=255-(255-n[_-=4]<<8)/b[_])<0||0==b[_]?b[_]=0:b[_]=x,(C=255-(255-n[l=_+1]<<8)/b[l])<0||0==b[l]?b[l]=0:b[l]=C,(w=255-(255-n[p=_+2]<<8)/b[p])<0||0==b[p]?b[p]=0:b[p]=w;k=!0;break;case"linearlight":for(;S--;)(x=2*(u=b[_-=4])+n[_]-256)<0||u<128&&x<0?b[_]=0:b[_]=x>255?255:x,(C=2*(f=b[l=_+1])+n[l]-256)<0||f<128&&C<0?b[l]=0:b[l]=C>255?255:C,(w=2*(m=b[p=_+2])+n[p]-256)<0||m<128&&w<0?b[p]=0:b[p]=w>255?255:w;k=!0;break;case"vividlight":for(;S--;)(u=b[_-=4])<128?u?(x=255-(255-n[_]<<8)/(2*u))<0?b[_]=0:b[_]=x:b[_]=0:(x=P=2*u-256)<255?(x=(n[_]<<8)/(255-P))>255?b[_]=255:b[_]=x:b[_]=x<0?0:x,(f=b[l=_+1])<128?f?(C=255-(255-n[l]<<8)/(2*f))<0?b[l]=0:b[l]=C:b[l]=0:(C=I=2*f-256)<255?(C=(n[l]<<8)/(255-I))>255?b[l]=255:b[l]=C:b[l]=C<0?0:C,(m=b[p=_+2])<128?m?(w=255-(255-n[p]<<8)/(2*m))<0?b[p]=0:b[p]=w:b[p]=0:(w=D=2*m-256)<255?(w=(n[p]<<8)/(255-D))>255?b[p]=255:b[p]=w:b[p]=w<0?0:w;k=!0;break;case"pinlight":for(;S--;)(u=b[_-=4])<128?(g=n[_])<(P=2*u)?b[_]=g:b[_]=P:(g=n[_])>(P=2*u-256)?b[_]=g:b[_]=P,(f=b[l=_+1])<128?(v=n[l])<(I=2*f)?b[l]=v:b[l]=I:(v=n[l])>(I=2*f-256)?b[l]=v:b[l]=I,(u=b[p=_+2])<128?(g=n[p])<(P=2*u)?b[p]=g:b[p]=P:(g=n[p])>(P=2*u-256)?b[p]=g:b[p]=P;k=!0;break;case"hardmix":for(;S--;)(u=b[_-=4])<128?255-(255-n[_]<<8)/(2*u)<128||0==u?b[_]=0:b[_]=255:(P=2*u-256)<255&&(n[_]<<8)/(255-P)<128?b[_]=0:b[_]=255,(f=b[l=_+1])<128?255-(255-n[l]<<8)/(2*f)<128||0==f?b[l]=0:b[l]=255:(I=2*f-256)<255&&(n[l]<<8)/(255-I)<128?b[l]=0:b[l]=255,(m=b[p=_+2])<128?255-(255-n[p]<<8)/(2*m)<128||0==m?b[p]=0:b[p]=255:(D=2*m-256)<255&&(n[p]<<8)/(255-D)<128?b[p]=0:b[p]=255;k=!0}if(k&&h.putImageData(y,0,0),1==a||Pixastic.Client.hasGlobalAlpha()){var E=t.canvas.getContext("2d");E.save(),E.globalAlpha=a,E.drawImage(c,0,0,r.width,r.height,r.left,r.top,r.width,r.height),E.globalAlpha=1,E.restore()}else{for(var S=s*o,F=a,L=1-a;S--;){var N=n[_=4*S]*L+b[_]*F|0,R=n[_+1]*L+b[_+1]*F|0,T=n[_+2]*L+b[_+2]*F|0;n[_]=N,n[_+1]=R,n[_+2]=T}t.useData=!0}return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.blur={process:function(t){if(void 0===t.options.fixMargin&&(t.options.fixMargin=!0),Pixastic.Client.hasCanvasImageData()){for(var a=Pixastic.prepareData(t),e=Pixastic.prepareData(t,!0),i=[[0,1,0],[1,2,1],[0,1,0]],r=0,n=0;n<3;n++)for(var s=0;s<3;s++)r+=i[n][s];r=1/(2*r);var o=t.options.rect,c=o.width,h=o.height,l=4*c,p=h;do{var g=(p-1)*l,v=(1==p?0:p-2)*c*4,d=(p==h?p-1:p)*c*4,u=c;do{var f=g+(4*u-4),m=v+4*(1==u?0:u-2),x=d+4*(u==c?u-1:u);a[f]=(2*(e[m]+e[f-4]+e[f+4]+e[x])+4*e[f])*r,a[f+1]=(2*(e[m+1]+e[f-3]+e[f+5]+e[x+1])+4*e[f+1])*r,a[f+2]=(2*(e[m+2]+e[f-2]+e[f+6]+e[x+2])+4*e[f+2])*r}while(--u)}while(--p);return!0}if(Pixastic.Client.isIE())return t.image.style.filter+=" progid:DXImageTransform.Microsoft.Blur(pixelradius=1.5)",t.options.fixMargin&&(t.image.style.marginLeft=(parseInt(t.image.style.marginLeft,10)||0)-2+"px",t.image.style.marginTop=(parseInt(t.image.style.marginTop,10)||0)-2+"px"),!0},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()||Pixastic.Client.isIE()}},Pixastic.Actions.blurfast={process:function(t){var a=parseFloat(t.options.amount)||0,e=!(!t.options.clear||"false"==t.options.clear);if(a=Math.max(0,Math.min(5,a)),Pixastic.Client.hasCanvas()){var i=t.options.rect,r=t.canvas.getContext("2d");r.save(),r.beginPath(),r.rect(i.left,i.top,i.width,i.height),r.clip();var n=Math.round(t.width/2),s=Math.round(t.height/2),o=document.createElement("canvas");o.width=n,o.height=s;e=!1;for(var c=Math.round(20*a),h=o.getContext("2d"),l=0;l<c;l++){var p=Math.max(1,Math.round(n-l)),g=Math.max(1,Math.round(s-l));h.clearRect(0,0,n,s),h.drawImage(t.canvas,0,0,t.width,t.height,0,0,p,g),e&&r.clearRect(i.left,i.top,i.width,i.height),r.drawImage(o,0,0,p,g,0,0,t.width,t.height)}return r.restore(),t.useData=!1,!0}if(Pixastic.Client.isIE()){var v=10*a;return t.image.style.filter+=" progid:DXImageTransform.Microsoft.Blur(pixelradius="+v+")",t.options.fixMargin,t.image.style.marginLeft=(parseInt(t.image.style.marginLeft,10)||0)-Math.round(v)+"px",t.image.style.marginTop=(parseInt(t.image.style.marginTop,10)||0)-Math.round(v)+"px",!0}},checkSupport:function(){return Pixastic.Client.hasCanvas()||Pixastic.Client.isIE()}},Pixastic.Actions.brightness={process:function(t){var a=parseInt(t.options.brightness,10)||0,e=parseFloat(t.options.contrast)||0,i=!(!t.options.legacy||"false"==t.options.legacy);if(i)a=Math.min(150,Math.max(-150,a));else var r=1+Math.min(150,Math.max(-150,a))/150;if(e=Math.max(0,e+1),Pixastic.Client.hasCanvasImageData()){var n,s,o,c,h,l,p,g=Pixastic.prepareData(t),v=t.options.rect,d=v.width*v.height,u=4*d;for(1!=e?i?(o=e,c=(a-128)*e+128):(o=r*e,c=128*-e+128):i?(o=1,c=a):(o=r,c=0);d--;)(h=g[u-=4]*o+c)>255?g[u]=255:g[u]=h<0?0:h,(l=g[n=u+1]*o+c)>255?g[n]=255:g[n]=l<0?0:l,(p=g[s=u+2]*o+c)>255?g[s]=255:g[s]=p<0?0:p;return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.coloradjust={process:function(t){var a=parseFloat(t.options.red)||0,e=parseFloat(t.options.green)||0,i=parseFloat(t.options.blue)||0;if(a=Math.round(255*a),e=Math.round(255*e),i=Math.round(255*i),Pixastic.Client.hasCanvasImageData()){for(var r,n,s,o,c,h=Pixastic.prepareData(t),l=t.options.rect,p=l.width*l.height,g=4*p;p--;)g-=4,a&&((s=h[g]+a)<0?h[g]=0:h[g]=s>255?255:s),e&&((o=h[r=g+1]+e)<0?h[r]=0:h[r]=o>255?255:o),i&&((c=h[n=g+2]+i)<0?h[n]=0:h[n]=c>255?255:c);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.colorhistogram={array256:function(t){arr=[];for(var a=0;a<256;a++)arr[a]=t;return arr},process:function(t){"object"!=typeof t.options.returnValue&&(t.options.returnValue={rvals:[],gvals:[],bvals:[]});var a=!!t.options.paint,e=t.options.returnValue;if("array"!=typeof e.values&&(e.rvals=[],e.gvals=[],e.bvals=[]),Pixastic.Client.hasCanvasImageData()){var i=Pixastic.prepareData(t);t.useData=!1;for(var r=this.array256(0),n=this.array256(0),s=this.array256(0),o=t.options.rect,c=o.width*o.height,h=4*c;c--;)r[i[h-=4]]++,n[i[h+1]]++,s[i[h+2]]++;if(e.rvals=r,e.gvals=n,e.bvals=s,a)for(var l=t.canvas.getContext("2d"),p=[r,n,s],g=0;g<3;g++){for(var v=(g+1)*t.height/3,d=0,u=0;u<256;u++)p[g][u]>d&&(d=p[g][u]);var f=t.height/3/d,m=t.width/256;0==g?l.fillStyle="rgba(255,0,0,0.5)":1==g?l.fillStyle="rgba(0,255,0,0.5)":2==g&&(l.fillStyle="rgba(0,0,255,0.5)");for(u=0;u<256;u++)l.fillRect(u*m,t.height-f*p[g][u]-t.height+v,m,p[g][u]*f)}return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.crop={process:function(t){if(Pixastic.Client.hasCanvas()){var a=t.options.rect,e=a.width,i=a.height,r=a.top,n=a.left;void 0!==t.options.left&&(n=parseInt(t.options.left,10)),void 0!==t.options.top&&(r=parseInt(t.options.top,10)),void 0!==t.options.height&&(e=parseInt(t.options.width,10)),void 0!==t.options.height&&(i=parseInt(t.options.height,10)),n<0&&(n=0),n>t.width-1&&(n=t.width-1),r<0&&(r=0),r>t.height-1&&(r=t.height-1),e<1&&(e=1),n+e>t.width&&(e=t.width-n),i<1&&(i=1),r+i>t.height&&(i=t.height-r);var s=document.createElement("canvas");return s.width=t.width,s.height=t.height,s.getContext("2d").drawImage(t.canvas,0,0),t.canvas.width=e,t.canvas.height=i,t.canvas.getContext("2d").clearRect(0,0,e,i),t.canvas.getContext("2d").drawImage(s,n,r,e,i,0,0,e,i),t.useData=!1,!0}},checkSupport:function(){return Pixastic.Client.hasCanvas()}},Pixastic.Actions.desaturate={process:function(t){var a=!(!t.options.average||"false"==t.options.average);if(Pixastic.Client.hasCanvasImageData()){var e,i,r=Pixastic.prepareData(t),n=t.options.rect,s=n.width*n.height,o=4*s;if(a)for(;s--;)r[o-=4]=r[e=o+1]=r[i=o+2]=(r[o]+r[e]+r[i])/3;else for(;s--;)r[o-=4]=r[e=o+1]=r[i=o+2]=.3*r[o]+.59*r[e]+.11*r[i];return!0}if(Pixastic.Client.isIE())return t.image.style.filter+=" gray",!0},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()||Pixastic.Client.isIE()}},Pixastic.Actions.edges={process:function(t){var a=!(!t.options.mono||"false"==t.options.mono),e=!(!t.options.invert||"false"==t.options.invert);if(Pixastic.Client.hasCanvasImageData()){var i=Pixastic.prepareData(t),r=Pixastic.prepareData(t,!0),n=-1/8;weight=-8;var s=t.options.rect,o=s.width,c=s.height,h=4*o,l=c;do{var p=(l-1)*h,g=(1==l?0:l-2)*o*4,v=(l==c?l-1:l)*o*4,d=o;do{var u=p+(4*d-4),f=g+4*(1==d?0:d-2),m=v+4*(d==o?d-1:d),x=((r[f-4]+r[f]+r[f+4]+r[u-4]+r[u+4]+r[m-4]+r[m]+r[m+4])*n+r[u])*weight,C=((r[f-3]+r[f+1]+r[f+5]+r[u-3]+r[u+5]+r[m-3]+r[m+1]+r[m+5])*n+r[u+1])*weight,w=((r[f-2]+r[f+2]+r[f+6]+r[u-2]+r[u+6]+r[m-2]+r[m+2]+r[m+6])*n+r[u+2])*weight;if(a){var P=.3*x+.59*C+.11*w||0;e&&(P=255-P),P<0&&(P=0),P>255&&(P=255),x=C=w=P}else e&&(x=255-x,C=255-C,w=255-w),x<0&&(x=0),C<0&&(C=0),w<0&&(w=0),x>255&&(x=255),C>255&&(C=255),w>255&&(w=255);i[u]=x,i[u+1]=C,i[u+2]=w}while(--d)}while(--l);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.edges2={process:function(t){if(Pixastic.Client.hasCanvasImageData()){for(var a=Pixastic.prepareData(t),e=Pixastic.prepareData(t,!0),i=t.options.rect,r=i.width,n=4*r,s=n+4,o=i.height-1,c=r-1,h=1;h<o;++h){for(var l=s-4,p=l-n,g=l+n,v=-e[p]-e[l]-e[g],d=-e[++p]-e[++l]-e[++g],u=-e[++p]-e[++l]-e[++g],f=e[p+=2],m=e[++p],x=e[++p],C=e[l+=2],w=e[++l],P=e[++l],I=e[g+=2],D=e[++g],M=e[++g],b=-f-C-I,y=-m-w-D,_=-x-P-M,k=1;k<c;++k){g=(l=s+4)+n;var A=127+v-f- -8*C-I,E=127+d-m- -8*w-D,S=127+u-x- -8*P-M;v=b,d=y,u=_,f=e[p=l-n],m=e[++p],x=e[++p],C=e[l],w=e[++l],P=e[++l],(A+=b=-f-C-(I=e[g]))>255&&(A=255),(E+=y=-m-w-(D=e[++g]))>255&&(E=255),(S+=_=-x-P-(M=e[++g]))>255&&(S=255),A<0&&(A=0),E<0&&(E=0),S<0&&(S=0),a[s]=A,a[++s]=E,a[++s]=S,s+=2}s+=8}return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.emboss={process:function(t){var a=parseFloat(t.options.strength)||1,e=void 0!==t.options.greyLevel?parseInt(t.options.greyLevel):180,i=t.options.direction||"topleft",r=!(!t.options.blend||"false"==t.options.blend),n=0,s=0;switch(i){case"topleft":n=-1,s=-1;break;case"top":n=-1,s=0;break;case"topright":n=-1,s=1;break;case"right":n=0,s=1;break;case"bottomright":n=1,s=1;break;case"bottom":n=1,s=0;break;case"bottomleft":n=1,s=-1;break;case"left":n=0,s=-1}if(Pixastic.Client.hasCanvasImageData()){var o=Pixastic.prepareData(t),c=Pixastic.prepareData(t,!0),h=(t.options.invertAlpha,t.options.rect),l=h.width,p=h.height,g=4*l,v=p;do{var d=(v-1)*g,u=n;v+u<1&&(u=0),v+u>p&&(u=0);var f=(v-1+u)*l*4,m=l;do{var x=d+4*(m-1),C=s;m+C<1&&(C=0),m+C>l&&(C=0);var w=f+4*(m-1+C),P=c[x]-c[w],I=c[x+1]-c[w+1],D=c[x+2]-c[w+2],M=P,b=M>0?M:-M;if((I>0?I:-I)>b&&(M=I),(D>0?D:-D)>b&&(M=D),M*=a,r){var y=o[x]+M,_=o[x+1]+M,k=o[x+2]+M;o[x]=y>255?255:y<0?0:y,o[x+1]=_>255?255:_<0?0:_,o[x+2]=k>255?255:k<0?0:k}else{var A=e-M;A<0?A=0:A>255&&(A=255),o[x]=o[x+1]=o[x+2]=A}}while(--m)}while(--v);return!0}if(Pixastic.Client.isIE())return t.image.style.filter+=" progid:DXImageTransform.Microsoft.emboss()",!0},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()||Pixastic.Client.isIE()}},Pixastic.Actions.flip={process:function(t){var a=t.options.rect,e=document.createElement("canvas");e.width=a.width,e.height=a.height,e.getContext("2d").drawImage(t.image,a.left,a.top,a.width,a.height,0,0,a.width,a.height);var i=t.canvas.getContext("2d");return i.clearRect(a.left,a.top,a.width,a.height),"horizontal"==t.options.axis?(i.scale(-1,1),i.drawImage(e,-a.left-a.width,a.top,a.width,a.height)):(i.scale(1,-1),i.drawImage(e,a.left,-a.top-a.height,a.width,a.height)),t.useData=!1,!0},checkSupport:function(){return Pixastic.Client.hasCanvas()}},Pixastic.Actions.fliph={process:function(t){if(Pixastic.Client.hasCanvas()){var a=t.options.rect,e=document.createElement("canvas");e.width=a.width,e.height=a.height,e.getContext("2d").drawImage(t.image,a.left,a.top,a.width,a.height,0,0,a.width,a.height);var i=t.canvas.getContext("2d");return i.clearRect(a.left,a.top,a.width,a.height),i.scale(-1,1),i.drawImage(e,-a.left-a.width,a.top,a.width,a.height),t.useData=!1,!0}if(Pixastic.Client.isIE())return t.image.style.filter+=" fliph",!0},checkSupport:function(){return Pixastic.Client.hasCanvas()||Pixastic.Client.isIE()}},Pixastic.Actions.flipv={process:function(t){if(Pixastic.Client.hasCanvas()){var a=t.options.rect,e=document.createElement("canvas");e.width=a.width,e.height=a.height,e.getContext("2d").drawImage(t.image,a.left,a.top,a.width,a.height,0,0,a.width,a.height);var i=t.canvas.getContext("2d");return i.clearRect(a.left,a.top,a.width,a.height),i.scale(1,-1),i.drawImage(e,a.left,-a.top-a.height,a.width,a.height),t.useData=!1,!0}if(Pixastic.Client.isIE())return t.image.style.filter+=" flipv",!0},checkSupport:function(){return Pixastic.Client.hasCanvas()||Pixastic.Client.isIE()}},Pixastic.Actions.glow={process:function(t){var a=parseFloat(t.options.amount)||0,e=parseFloat(t.options.radius)||0;if(a=Math.min(1,Math.max(0,a)),e=Math.min(5,Math.max(0,e)),Pixastic.Client.hasCanvasImageData()){var i=t.options.rect,r=document.createElement("canvas");r.width=t.width,r.height=t.height;var n=r.getContext("2d");n.drawImage(t.canvas,0,0);var s=Math.round(t.width/2),o=Math.round(t.height/2),c=document.createElement("canvas");c.width=s,c.height=o;for(var h=Math.round(20*e),l=c.getContext("2d"),p=0;p<h;p++){var g=Math.max(1,Math.round(s-p)),v=Math.max(1,Math.round(o-p));l.clearRect(0,0,s,o),l.drawImage(r,0,0,t.width,t.height,0,0,g,v),n.clearRect(0,0,t.width,t.height),n.drawImage(c,0,0,g,v,0,0,t.width,t.height)}for(var d=Pixastic.prepareData(t),u=Pixastic.prepareData({canvas:r,options:t.options}),f=i.width*i.height,m=4*f,x=m+1,C=m+2;f--;)(d[m-=4]+=a*u[m])>255&&(d[m]=255),(d[x-=4]+=a*u[x])>255&&(d[x]=255),(d[C-=4]+=a*u[C])>255&&(d[C]=255);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.histogram={process:function(t){var a=!(!t.options.average||"false"==t.options.average),e=!(!t.options.paint||"false"==t.options.paint),i=t.options.color||"rgba(255,255,255,0.5)",r=[];"object"!=typeof t.options.returnValue&&(t.options.returnValue={values:[]});var n=t.options.returnValue;if("array"!=typeof n.values&&(n.values=[]),r=n.values,Pixastic.Client.hasCanvasImageData()){var s=Pixastic.prepareData(t);t.useData=!1;for(var o=0;o<256;o++)r[o]=0;var c=t.options.rect,h=c.width*c.height,l=4*h,p=Math.round;if(a)for(;h--;)r[p((s[l-=4]+s[l+1]+s[l+2])/3)]++;else for(;h--;)r[p(.3*s[l-=4]+.59*s[l+1]+.11*s[l+2])]++;if(e){var g=0;for(o=0;o<256;o++)r[o]>g&&(g=r[o]);var v=t.height/g,d=t.width/256,u=t.canvas.getContext("2d");u.fillStyle=i;for(o=0;o<256;o++)u.fillRect(o*d,t.height-v*r[o],d,r[o]*v)}return n.values=r,!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.hsl={process:function(t){var a=parseInt(t.options.hue,10)||0,e=(parseInt(t.options.saturation,10)||0)/100,i=(parseInt(t.options.lightness,10)||0)/100;if(e<0)var r=1+e;else r=1+2*e;var n=6*(a=a%360/360),s=255*i,o=1+i,c=1-i;if(Pixastic.Client.hasCanvasImageData()){for(var h=Pixastic.prepareData(t),l=t.options.rect,p=l.width*l.height,g=4*p,v=g+1,d=g+2;p--;){var u=h[g-=4],f=h[v=g+1],m=h[d=g+2];if(0!=a||0!=e){var x=u;f>x&&(x=f),m>x&&(x=m);var C=u;f<C&&(C=f),m<C&&(C=m);var w=x-C,P=(C+x)/510;if(P>0&&w>0){if(P<=.5){(D=w/(x+C)*r)>1&&(D=1);var I=P*(1+D)}else{var D;(D=w/(510-x-C)*r)>1&&(D=1);I=P+D-P*D}if(u==x)if(f==C)var M=5+(x-m)/w+n;else M=1-(x-f)/w+n;else if(f==x)if(m==C)M=1+(x-u)/w+n;else M=3-(x-m)/w+n;else if(u==C)M=3+(x-f)/w+n;else M=5-(x-u)/w+n;M<0&&(M+=6),M>=6&&(M-=6);var b=P+P-I,y=M|0;0==y?(u=255*I,f=255*(b+(I-b)*(M-y)),m=255*b):1==y?(u=255*(I-(I-b)*(M-y)),f=255*I,m=255*b):2==y?(u=255*b,f=255*I,m=255*(b+(I-b)*(M-y))):3==y?(u=255*b,f=255*(I-(I-b)*(M-y)),m=255*I):4==y?(u=255*(b+(I-b)*(M-y)),f=255*b,m=255*I):5==y&&(u=255*I,f=255*b,m=255*(I-(I-b)*(M-y)))}}i<0?(u*=o,f*=o,m*=o):i>0&&(u=u*c+s,f=f*c+s,m=m*c+s),h[g]=u<0?0:u>255?255:u,h[v]=f<0?0:f>255?255:f,h[d]=m<0?0:m>255?255:m}return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.invert={process:function(t){if(Pixastic.Client.hasCanvasImageData()){for(var a=Pixastic.prepareData(t),e=!!t.options.invertAlpha,i=t.options.rect,r=i.width*i.height,n=4*r,s=n+1,o=n+2,c=n+3;r--;)a[n-=4]=255-a[n],a[s-=4]=255-a[s],a[o-=4]=255-a[o],e&&(a[c-=4]=255-a[c]);return!0}if(Pixastic.Client.isIE())return t.image.style.filter+=" invert",!0},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()||Pixastic.Client.isIE()}},Pixastic.Actions.laplace={process:function(t){var a=!(!t.options.invert||"false"==t.options.invert),e=parseFloat(t.options.edgeStrength)||0,i=parseInt(t.options.greyLevel)||0;if(e=-e,Pixastic.Client.hasCanvasImageData()){var r=Pixastic.prepareData(t),n=Pixastic.prepareData(t,!0),s=1/8,o=t.options.rect,c=o.width,h=o.height,l=4*c,p=h;do{var g=(p-1)*l,v=(1==p?0:p-2)*c*4,d=(p==h?p-1:p)*c*4,u=c;do{var f=g+(4*u-4),m=v+4*(1==u?0:u-2),x=d+4*(u==c?u-1:u),C=((-n[m-4]-n[m]-n[m+4]-n[f-4]-n[f+4]-n[x-4]-n[x]-n[x+4]+8*n[f])*s+(-n[m-3]-n[m+1]-n[m+5]-n[f-3]-n[f+5]-n[x-3]-n[x+1]-n[x+5]+8*n[f+1])*s+(-n[m-2]-n[m+2]-n[m+6]-n[f-2]-n[f+6]-n[x-2]-n[x+2]-n[x+6]+8*n[f+2])*s)/3+i;0!=e&&(C>127?C+=(C+1-128)*e:C<127&&(C-=(C+1)*e)),a&&(C=255-C),C<0&&(C=0),C>255&&(C=255),r[f]=r[f+1]=r[f+2]=C}while(--u)}while(--p);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.lighten={process:function(t){var a=parseFloat(t.options.amount)||0;if(a=Math.max(-1,Math.min(1,a)),Pixastic.Client.hasCanvasImageData()){for(var e=Pixastic.prepareData(t),i=t.options.rect,r=i.width*i.height,n=4*r,s=n+1,o=n+2,c=a+1;r--;)(e[n-=4]=e[n]*c)>255&&(e[n]=255),(e[s-=4]=e[s]*c)>255&&(e[s]=255),(e[o-=4]=e[o]*c)>255&&(e[o]=255);return!0}if(Pixastic.Client.isIE()){var h=t.image;return a<0?(h.style.filter+=" light()",h.filters[h.filters.length-1].addAmbient(255,255,255,100*-a)):a>0&&(h.style.filter+=" light()",h.filters[h.filters.length-1].addAmbient(255,255,255,100),h.filters[h.filters.length-1].addAmbient(255,255,255,100*a)),!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()||Pixastic.Client.isIE()}},Pixastic.Actions.mosaic={process:function(t){var a=Math.max(1,parseInt(t.options.blockSize,10));if(Pixastic.Client.hasCanvasImageData()){var e=t.options.rect,i=e.width,r=e.height,n=r,s=t.canvas.getContext("2d"),o=document.createElement("canvas");o.width=o.height=1;var c=o.getContext("2d"),h=document.createElement("canvas");h.width=i,h.height=r,h.getContext("2d").drawImage(t.canvas,e.left,e.top,i,r,0,0,i,r);for(n=0;n<r;n+=a)for(var l=0;l<i;l+=a){var p=a,g=a;p+l>i&&(p=i-l),g+n>r&&(g=r-n),c.drawImage(h,l,n,p,g,0,0,1,1);var v=c.getImageData(0,0,1,1).data;s.fillStyle="rgb("+v[0]+","+v[1]+","+v[2]+")",s.fillRect(e.left+l,e.top+n,a,a)}return t.useData=!1,!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.noise={process:function(t){var a=0,e=0,i=!1;void 0!==t.options.amount&&(a=parseFloat(t.options.amount)||0),void 0!==t.options.strength&&(e=parseFloat(t.options.strength)||0),void 0!==t.options.mono&&(i=!(!t.options.mono||"false"==t.options.mono)),a=Math.max(0,Math.min(1,a));var r=128*(e=Math.max(0,Math.min(1,e))),n=r/2;if(Pixastic.Client.hasCanvasImageData()){var s=Pixastic.prepareData(t),o=t.options.rect,c=o.width,h=4*c,l=o.height,p=Math.random;do{var g=(l-1)*h,v=c;do{var d=g+4*(v-1);if(p()<a){if(i)var u=-n+p()*r,f=s[d]+u,m=s[d+1]+u,x=s[d+2]+u;else f=s[d]-n+p()*r,m=s[d+1]-n+p()*r,x=s[d+2]-n+p()*r;f<0&&(f=0),m<0&&(m=0),x<0&&(x=0),f>255&&(f=255),m>255&&(m=255),x>255&&(x=255),s[d]=f,s[d+1]=m,s[d+2]=x}}while(--v)}while(--l);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.posterize={process:function(t){var a=256;if(void 0!==t.options.levels&&(a=parseInt(t.options.levels,10)||1),Pixastic.Client.hasCanvasImageData()){var e=Pixastic.prepareData(t),i=256/(a=Math.max(2,Math.min(256,a))),r=256/(a-1),n=t.options.rect,s=n.width,o=4*s,c=n.height;do{var h=(c-1)*o,l=s;do{var p=h+4*(l-1),g=r*(e[p]/i|0),v=r*(e[p+1]/i|0),d=r*(e[p+2]/i|0);g>255&&(g=255),v>255&&(v=255),d>255&&(d=255),e[p]=g,e[p+1]=v,e[p+2]=d}while(--l)}while(--c);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.pointillize={process:function(t){var a=Math.max(1,parseInt(t.options.radius,10)),e=Math.min(5,Math.max(0,parseFloat(t.options.density)||0)),i=Math.max(0,parseFloat(t.options.noise)||0),r=!(!t.options.transparent||"false"==t.options.transparent);if(Pixastic.Client.hasCanvasImageData()){var n=t.options.rect,s=n.width,o=n.height,c=o,h=t.canvas.getContext("2d"),l=t.canvas.width,p=t.canvas.height,g=document.createElement("canvas");g.width=g.height=1;var v=g.getContext("2d"),d=document.createElement("canvas");d.width=s,d.height=o,d.getContext("2d").drawImage(t.canvas,n.left,n.top,s,o,0,0,s,o);var u=2*a;r&&h.clearRect(n.left,n.top,n.width,n.height);var f=a*i,m=1/e;for(c=0;c<o+a;c+=u*m)for(var x=0;x<s+a;x+=u*m){rndX=i?x+(2*Math.random()-1)*f|0:x,rndY=i?c+(2*Math.random()-1)*f|0:c;var C=rndX-a,w=rndY-a;C<0&&(C=0),w<0&&(w=0);var P=rndX+n.left,I=rndY+n.top;P<0&&(P=0),P>l&&(P=l),I<0&&(I=0),I>p&&(I=p);var D=u,M=u;D+C>s&&(D=s-C),M+w>o&&(M=o-w),D<1&&(D=1),M<1&&(M=1),v.drawImage(d,C,w,D,M,0,0,1,1);var b=v.getImageData(0,0,1,1).data;h.fillStyle="rgb("+b[0]+","+b[1]+","+b[2]+")",h.beginPath(),h.arc(P,I,a,0,2*Math.PI,!0),h.closePath(),h.fill()}return t.useData=!1,!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.removenoise={process:function(t){if(Pixastic.Client.hasCanvasImageData()){var a=Pixastic.prepareData(t),e=t.options.rect,i=e.width,r=e.height,n=4*i,s=r;do{var o=(s-1)*n,c=(1==s?0:s-2)*i*4,h=(s==r?s-1:s)*i*4,l=i;do{var p,g,v,d,u,f,m=o+(4*l-4),x=c+4*(1==l?0:l-2),C=h+4*(l==i?l-1:l);p=g=a[x];var w=a[m-4],P=a[m+4],I=a[C];w<p&&(p=w),P<p&&(p=P),I<p&&(p=I),w>g&&(g=w),P>g&&(g=P),I>g&&(g=I),v=d=a[x+1];var D=a[m-3],M=a[m+5],b=a[C+1];D<v&&(v=D),M<v&&(v=M),b<v&&(v=b),D>d&&(d=D),M>d&&(d=M),b>d&&(d=b),u=f=a[x+2];var y=a[m-2],_=a[m+6],k=a[C+2];y<u&&(u=y),_<u&&(u=_),k<u&&(u=k),y>f&&(f=y),_>f&&(f=_),k>f&&(f=k),a[m]>g?a[m]=g:a[m]<p&&(a[m]=p),a[m+1]>d?a[m+1]=d:a[m+1]<v&&(a[m+1]=v),a[m+2]>f?a[m+2]=f:a[m+2]<u&&(a[m+2]=u)}while(--l)}while(--s);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.resize={process:function(t){if(Pixastic.Client.hasCanvas()){var a=parseInt(t.options.width,10),e=parseInt(t.options.height,10),i=t.canvas;a<1&&(a=1),a<2&&(a=2);var r=document.createElement("canvas");return r.width=a,r.height=e,r.getContext("2d").drawImage(i,0,0,a,e),i.width=a,i.height=e,i.getContext("2d").drawImage(r,0,0),t.useData=!1,!0}},checkSupport:function(){return Pixastic.Client.hasCanvas()}},Pixastic.Actions.rotate={process:function(t){if(Pixastic.Client.hasCanvas()){var a=t.canvas,e=t.width,i=t.height,r=document.createElement("canvas");r.width=e,r.height=i,r.getContext("2d").drawImage(a,0,0,e,i);var n=-parseFloat(t.options.angle)*Math.PI/180,s=n;s>.5*Math.PI&&(s=Math.PI-s),s<.5*-Math.PI&&(s=-Math.PI-s);var o=Math.sqrt(e*e+i*i),c=Math.abs(s)-Math.abs(Math.atan2(i,e)),h=Math.abs(s)+Math.abs(Math.atan2(i,e)),l=Math.abs(Math.cos(c)*o),p=Math.abs(Math.sin(h)*o);a.width=l,a.height=p;var g=a.getContext("2d");return g.translate(l/2,p/2),g.rotate(n),g.drawImage(r,-e/2,-i/2),t.useData=!1,!0}},checkSupport:function(){return Pixastic.Client.hasCanvas()}},Pixastic.Actions.sepia={process:function(t){var a=parseInt(t.options.mode,10)||0;if(a<0&&(a=0),a>1&&(a=1),Pixastic.Client.hasCanvasImageData()){var e=Pixastic.prepareData(t),i=t.options.rect,r=i.width,n=4*r,s=i.height;do{var o=(s-1)*n,c=r;do{var h=o+4*(c-1);if(a)var l=.299*e[h]+.587*e[h+1]+.114*e[h+2],p=l+39,g=l+14,v=l-36;else{var d=e[h],u=e[h+1],f=e[h+2];p=.393*d+.769*u+.189*f,g=.349*d+.686*u+.168*f,v=.272*d+.534*u+.131*f}p<0&&(p=0),p>255&&(p=255),g<0&&(g=0),g>255&&(g=255),v<0&&(v=0),v>255&&(v=255),e[h]=p,e[h+1]=g,e[h+2]=v}while(--c)}while(--s);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.sharpen={process:function(t){var a=0;if(void 0!==t.options.amount&&(a=parseFloat(t.options.amount)||0),a<0&&(a=0),a>1&&(a=1),Pixastic.Client.hasCanvasImageData()){for(var e=Pixastic.prepareData(t),i=Pixastic.prepareData(t,!0),r=15,n=1+3*a,s=[[0,-n,0],[-n,r,-n],[0,-n,0]],o=0,c=0;c<3;c++)for(var h=0;h<3;h++)o+=s[c][h];o=1/o;var l=t.options.rect,p=l.width,g=l.height;r*=o,n*=o;var v=4*p,d=g;do{var u=(d-1)*v,f=(1==d?0:d-2)*v,m=(d==g?d-1:d)*v,x=p;do{var C=u+(4*x-4),w=f+4*(1==x?0:x-2),P=m+4*(x==p?x-1:x),I=(-i[w]-i[C-4]-i[C+4]-i[P])*n+i[C]*r,D=(-i[w+1]-i[C-3]-i[C+5]-i[P+1])*n+i[C+1]*r,M=(-i[w+2]-i[C-2]-i[C+6]-i[P+2])*n+i[C+2]*r;I<0&&(I=0),D<0&&(D=0),M<0&&(M=0),I>255&&(I=255),D>255&&(D=255),M>255&&(M=255),e[C]=I,e[C+1]=D,e[C+2]=M}while(--x)}while(--d);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.solarize={process:function(t){!t.options.average||t.options.average;if(Pixastic.Client.hasCanvasImageData()){var a=Pixastic.prepareData(t),e=t.options.rect,i=e.width,r=4*i,n=e.height;do{var s=(n-1)*r,o=i;do{var c=s+4*(o-1),h=a[c],l=a[c+1],p=a[c+2];h>127&&(h=255-h),l>127&&(l=255-l),p>127&&(p=255-p),a[c]=h,a[c+1]=l,a[c+2]=p}while(--o)}while(--n);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.unsharpmask={process:function(t){var a=parseFloat(t.options.amount)||0,e=parseFloat(t.options.radius)||0,i=parseFloat(t.options.threshold)||0;a=Math.min(500,Math.max(0,a))/2,e=Math.min(5,Math.max(0,e))/10,i=Math.min(255,Math.max(0,i));var r=- --i;if(a*=.016,a++,Pixastic.Client.hasCanvasImageData()){var n=t.options.rect,s=document.createElement("canvas");s.width=t.width,s.height=t.height;var o=s.getContext("2d");o.drawImage(t.canvas,0,0);var c=Math.round(t.width/2),h=Math.round(t.height/2),l=document.createElement("canvas");l.width=c,l.height=h;for(var p=Math.round(20*e),g=l.getContext("2d"),v=0;v<p;v++){var d=Math.max(1,Math.round(c-v)),u=Math.max(1,Math.round(h-v));g.clearRect(0,0,c,h),g.drawImage(s,0,0,t.width,t.height,0,0,d,u),o.clearRect(0,0,t.width,t.height),o.drawImage(l,0,0,d,u,0,0,t.width,t.height)}var f=Pixastic.prepareData(t),m=Pixastic.prepareData({canvas:s,options:t.options}),x=n.width,C=4*x,w=n.height;do{var P=(w-1)*C,I=x;do{var D=P+(4*I-4),M=f[D]-m[D];if(M>i||M<r){var b=m[D];b=a*M+b,f[D]=b>255?255:b<0?0:b}var y=f[D+1]-m[D+1];if(y>i||y<r){var _=m[D+1];_=a*y+_,f[D+1]=_>255?255:_<0?0:_}var k=f[D+2]-m[D+2];if(k>i||k<r){var A=m[D+2];A=a*k+A,f[D+2]=A>255?255:A<0?0:A}}while(--I)}while(--w);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}};var Base64={toBase64Table:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",base64Pad:"=",encode:function(r){"use strict";var e,t="",a=Base64.toBase64Table.split(""),o=Base64.base64Pad,n=r.length;for(e=0;e<n-2;e+=3)t+=a[r[e]>>2],t+=a[((3&r[e])<<4)+(r[e+1]>>4)],t+=a[((15&r[e+1])<<2)+(r[e+2]>>6)],t+=a[63&r[e+2]];return n%3&&(t+=a[r[e=n-n%3]>>2],n%3==2?(t+=a[((3&r[e])<<4)+(r[e+1]>>4)],t+=a[(15&r[e+1])<<2],t+=o):(t+=a[(3&r[e])<<4],t+=o+o)),t},toBinaryTable:[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,0,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1],decode:function(r,e){"use strict";e=void 0!==e?e:0;var t,a,o,n,c,h,d=Base64.toBinaryTable,i=Base64.base64Pad,f=0,C=0,s=r.indexOf("=")-e;for(s<0&&(s=r.length-e),a=3*(s>>2)+Math.floor(s%4/1.5),t=new Array(a),o=0,n=e;n<r.length;n++)c=d[127&r.charCodeAt(n)],h=r.charAt(n)===i,-1!==c?(C=C<<6|c,(f+=6)>=8&&(f-=8,h||(t[o++]=C>>f&255),C&=(1<<f)-1)):console.error("Illegal character code "+r.charCodeAt(n)+" at position "+n);if(f)throw{name:"Base64-Error",message:"Corrupted base64 string"};return t},_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encodeStr:function(r){var e,t,a,o,n,c,h,d="",i=0;for(r=Base64._utf8_encode(r);i<r.length;)o=(e=r.charCodeAt(i++))>>2,n=(3&e)<<4|(t=r.charCodeAt(i++))>>4,c=(15&t)<<2|(a=r.charCodeAt(i++))>>6,h=63&a,isNaN(t)?c=h=64:isNaN(a)&&(h=64),d=d+this._keyStr.charAt(o)+this._keyStr.charAt(n)+this._keyStr.charAt(c)+this._keyStr.charAt(h);return d},decodeStr:function(r){var e,t,a,o,n,c,h="",d=0;for(r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");d<r.length;)e=this._keyStr.indexOf(r.charAt(d++))<<2|(o=this._keyStr.indexOf(r.charAt(d++)))>>4,t=(15&o)<<4|(n=this._keyStr.indexOf(r.charAt(d++)))>>2,a=(3&n)<<6|(c=this._keyStr.indexOf(r.charAt(d++))),h+=String.fromCharCode(e),64!=n&&(h+=String.fromCharCode(t)),64!=c&&(h+=String.fromCharCode(a));return h=Base64._utf8_decode(h)},_utf8_encode:function(r){r=r.replace(/\r\n/g,"\n");for(var e="",t=0;t<r.length;t++){var a=r.charCodeAt(t);a<128?e+=String.fromCharCode(a):a>127&&a<2048?(e+=String.fromCharCode(a>>6|192),e+=String.fromCharCode(63&a|128)):(e+=String.fromCharCode(a>>12|224),e+=String.fromCharCode(a>>6&63|128),e+=String.fromCharCode(63&a|128))}return e},_utf8_decode:function(r){for(var e="",t=0,a=c1=c2=0;t<r.length;)(a=r.charCodeAt(t))<128?(e+=String.fromCharCode(a),t++):a>191&&a<224?(c2=r.charCodeAt(t+1),e+=String.fromCharCode((31&a)<<6|63&c2),t+=2):(c2=r.charCodeAt(t+1),c3=r.charCodeAt(t+2),e+=String.fromCharCode((15&a)<<12|(63&c2)<<6|63&c3),t+=3);return e}};function BigInteger(e,t){if(!(this instanceof BigInteger))return e instanceof BigInteger?e:void 0===e?BigInteger.ZERO:BigInteger.parse(e);for(e=e||[];e.length&&!e[e.length-1];)--e.length;this._d=e,this._s=e.length?t||1:0}Array.prototype.map||(Array.prototype.map=function(e){var t=this.length>>>0;if("function"!=typeof e)throw new TypeError;for(var r=new Array(t),n=arguments[1],i=0;i<t;i++)i in this&&(r[i]=e.call(n,this[i],i,this));return r}),BigInteger.base=1e7,BigInteger.base_log10=7,BigInteger.init=function(){BigInteger.ZERO=new BigInteger([],0),BigInteger.ONE=new BigInteger([1],1),BigInteger.M_ONE=new BigInteger(BigInteger.ONE._d,-1),BigInteger._0=BigInteger.ZERO,BigInteger._1=BigInteger.ONE,BigInteger.small=[BigInteger.ZERO,BigInteger.ONE,new BigInteger([2],1),new BigInteger([3],1),new BigInteger([4],1),new BigInteger([5],1),new BigInteger([6],1),new BigInteger([7],1),new BigInteger([8],1),new BigInteger([9],1),new BigInteger([10],1),new BigInteger([11],1),new BigInteger([12],1),new BigInteger([13],1),new BigInteger([14],1),new BigInteger([15],1),new BigInteger([16],1),new BigInteger([17],1),new BigInteger([18],1),new BigInteger([19],1),new BigInteger([20],1),new BigInteger([21],1),new BigInteger([22],1),new BigInteger([23],1),new BigInteger([24],1),new BigInteger([25],1),new BigInteger([26],1),new BigInteger([27],1),new BigInteger([28],1),new BigInteger([29],1),new BigInteger([30],1),new BigInteger([31],1),new BigInteger([32],1),new BigInteger([33],1),new BigInteger([34],1),new BigInteger([35],1),new BigInteger([36],1)]},BigInteger.init(),BigInteger.digits="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),BigInteger.prototype.toString=function(e){if((e=+e||10)<2||e>36)throw new Error("illegal radix "+e+".");if(0===this._s)return"0";if(10===e){var t=this._s<0?"-":"";t+=this._d[this._d.length-1].toString();for(var r=this._d.length-2;r>=0;r--){for(var n=this._d[r].toString();n.length<BigInteger.base_log10;)n="0"+n;t+=n}return t}var i=BigInteger.digits;e=BigInteger.small[e];for(var g,s=this._s,o=this.abs(),a=[];0!==o._s;){var I=o.divRem(e);o=I[0],g=I[1],a.push(i[g.valueOf()])}return(s<0?"-":"")+a.reverse().join("")},BigInteger.radixRegex=[/^$/,/^$/,/^[01]*$/,/^[012]*$/,/^[0-3]*$/,/^[0-4]*$/,/^[0-5]*$/,/^[0-6]*$/,/^[0-7]*$/,/^[0-8]*$/,/^[0-9]*$/,/^[0-9aA]*$/,/^[0-9abAB]*$/,/^[0-9abcABC]*$/,/^[0-9a-dA-D]*$/,/^[0-9a-eA-E]*$/,/^[0-9a-fA-F]*$/,/^[0-9a-gA-G]*$/,/^[0-9a-hA-H]*$/,/^[0-9a-iA-I]*$/,/^[0-9a-jA-J]*$/,/^[0-9a-kA-K]*$/,/^[0-9a-lA-L]*$/,/^[0-9a-mA-M]*$/,/^[0-9a-nA-N]*$/,/^[0-9a-oA-O]*$/,/^[0-9a-pA-P]*$/,/^[0-9a-qA-Q]*$/,/^[0-9a-rA-R]*$/,/^[0-9a-sA-S]*$/,/^[0-9a-tA-T]*$/,/^[0-9a-uA-U]*$/,/^[0-9a-vA-V]*$/,/^[0-9a-wA-W]*$/,/^[0-9a-xA-X]*$/,/^[0-9a-yA-Y]*$/,/^[0-9a-zA-Z]*$/],BigInteger.parse=function(e,t){e=e.toString(),void 0!==t&&10!=+t||(e=e.replace(/\s*[*xX]\s*10\s*(\^|\*\*)\s*/,"e").replace(/^([+\-])?(\d+)\.?(\d*)[eE]([+\-]?\d+)$/,(function(e,t,r,n,i){var g=(i=+i)<0,s=r.length+i;e=(g?r:n).length,i=(i=Math.abs(i))>=e?i-e+g:0;var o=new Array(i+1).join("0"),a=r+n;return(t||"")+(g?a=o+a:a+=o).substr(0,s+=g?o.length:0)+(s<a.length?"."+a.substr(s):"")})));var r=/^([+\-]?)(0[xXcCbB])?([0-9A-Za-z]*)(?:\.\d*)?$/.exec(e);if(r){var n=r[1]||"+",i=r[2]||"",g=r[3]||"";if(void 0===t)t="0x"===i||"0X"===i?16:"0c"===i||"0C"===i?8:"0b"===i||"0B"===i?2:10;else if(t<2||t>36)throw new Error("Illegal radix "+t+".");if(t=+t,!BigInteger.radixRegex[t].test(g))throw new Error("Bad digit for radix "+t);if(0===(g=g.replace(/^0+/,"").split("")).length)return BigInteger.ZERO;if(n="-"===n?-1:1,10==t){for(var s=[];g.length>=BigInteger.base_log10;)s.push(parseInt(g.splice(-BigInteger.base_log10).join(""),10));return s.push(parseInt(g.join(""),10)),new BigInteger(s,n)}if(t===BigInteger.base)return new BigInteger(g.map(Number).reverse(),n);s=BigInteger.ZERO;t=BigInteger.small[t];for(var o=BigInteger.small,a=0;a<g.length;a++)s=s.multiply(t).add(o[parseInt(g[a],36)]);return new BigInteger(s._d,n)}throw new Error("Invalid BigInteger format: "+e)},BigInteger.prototype.add=function(e){if(0===this._s)return BigInteger(e);if(0===(e=BigInteger(e))._s)return this;if(this._s!==e._s)return e=e.negate(),this.subtract(e);for(var t,r=this._d,n=e._d,i=r.length,g=n.length,s=new Array(Math.max(i,g)+1),o=Math.min(i,g),a=0,I=0;I<o;I++)t=r[I]+n[I]+a,s[I]=t%BigInteger.base,a=t/BigInteger.base|0;for(g>i&&(r=n,i=g),I=o;a&&I<i;I++)t=r[I]+a,s[I]=t%BigInteger.base,a=t/BigInteger.base|0;for(a&&(s[I]=a);I<i;I++)s[I]=r[I];return new BigInteger(s,this._s)},BigInteger.prototype.negate=function(){return new BigInteger(this._d,-this._s)},BigInteger.prototype.abs=function(){return this._s<0?this.negate():this},BigInteger.prototype.subtract=function(e){if(0===this._s)return BigInteger(e).negate();if(0===(e=BigInteger(e))._s)return this;if(this._s!==e._s)return e=e.negate(),this.add(e);var t,r=this;this._s<0&&(t=r,r=new BigInteger(e._d,1),e=new BigInteger(t._d,1));var n=r.compareAbs(e);if(0===n)return BigInteger.ZERO;n<0&&(t=e,e=r,r=t);var i,g,s=r._d,o=e._d,a=s.length,I=o.length,B=new Array(a),h=0;for(i=0;i<I;i++)(g=s[i]-h-o[i])<0?(g+=BigInteger.base,h=1):h=0,B[i]=g;for(i=I;i<a;i++){if(!((g=s[i]-h)<0)){B[i++]=g;break}g+=BigInteger.base,B[i]=g}for(;i<a;i++)B[i]=s[i];return new BigInteger(B,n)},function(){function e(e,t){for(var r=e._d,n=r.slice(),i=0;;){var g=(r[i]||0)+1;if(n[i]=g%BigInteger.base,g<=BigInteger.base-1)break;++i}return new BigInteger(n,t)}function t(e,t){for(var r=e._d,n=r.slice(),i=0;;){var g=(r[i]||0)-1;if(!(g<0)){n[i]=g;break}n[i]=g+BigInteger.base,++i}return new BigInteger(n,t)}BigInteger.prototype.next=function(){switch(this._s){case 0:return BigInteger.ONE;case-1:return t(this,-1);default:return e(this,1)}},BigInteger.prototype.prev=function(){switch(this._s){case 0:return BigInteger.M_ONE;case-1:return e(this,-1);default:return t(this,1)}}}(),BigInteger.prototype.compareAbs=function(e){if(this===e)return 0;if(!(e instanceof BigInteger)){if(!isFinite(e))return isNaN(e)?e:-1;e=BigInteger(e)}if(0===this._s)return 0!==e._s?-1:0;if(0===e._s)return 1;var t=this._d.length,r=e._d.length;if(t<r)return-1;if(t>r)return 1;for(var n=this._d,i=e._d,g=t-1;g>=0;g--)if(n[g]!==i[g])return n[g]<i[g]?-1:1;return 0},BigInteger.prototype.compare=function(e){return this===e?0:(e=BigInteger(e),0===this._s?-e._s:this._s===e._s?this.compareAbs(e)*this._s:this._s)},BigInteger.prototype.isUnit=function(){return this===BigInteger.ONE||this===BigInteger.M_ONE||1===this._d.length&&1===this._d[0]},BigInteger.prototype.multiply=function(e){if(0===this._s)return BigInteger.ZERO;if(0===(e=BigInteger(e))._s)return BigInteger.ZERO;if(this.isUnit())return this._s<0?e.negate():e;if(e.isUnit())return e._s<0?this.negate():this;if(this===e)return this.square();var t,r=this._d.length>=e._d.length,n=(r?this:e)._d,i=(r?e:this)._d,g=n.length,s=i.length,o=g+s,a=new Array(o);for(t=0;t<o;t++)a[t]=0;for(t=0;t<s;t++){for(var I,B=0,h=i[t],u=g+t,f=t;f<u;f++)B=(I=a[f]+h*n[f-t]+B)/BigInteger.base|0,a[f]=I%BigInteger.base|0;B&&(B=(I=a[f]+B)/BigInteger.base|0,a[f]=I%BigInteger.base)}return new BigInteger(a,this._s*e._s)},BigInteger.prototype.multiplySingleDigit=function(e){if(0===e||0===this._s)return BigInteger.ZERO;if(1===e)return this;var t;if(1===this._d.length)return(t=this._d[0]*e)>=BigInteger.base?new BigInteger([t%BigInteger.base|0,t/BigInteger.base|0],1):new BigInteger([t],1);if(2===e)return this.add(this);if(this.isUnit())return new BigInteger([e],1);for(var r=this._d,n=r.length,i=n+1,g=new Array(i),s=0;s<i;s++)g[s]=0;for(var o=0,a=0;a<n;a++)o=(t=e*r[a]+o)/BigInteger.base|0,g[a]=t%BigInteger.base|0;return o&&(o=(t=o)/BigInteger.base|0,g[a]=t%BigInteger.base),new BigInteger(g,1)},BigInteger.prototype.square=function(){if(0===this._s)return BigInteger.ZERO;if(this.isUnit())return BigInteger.ONE;var e,t,r,n,i=this._d,g=i.length,s=new Array(g+g+1);for(n=0;n<g;n++)r=2*n,t=(e=i[n]*i[n])/BigInteger.base|0,s[r]=e%BigInteger.base,s[r+1]=t;for(n=0;n<g;n++){t=0,r=2*n+1;for(var o=n+1;o<g;o++,r++)t=(e=i[o]*i[n]*2+s[r]+t)/BigInteger.base|0,s[r]=e%BigInteger.base;var a=t+s[r=g+n];t=a/BigInteger.base|0,s[r]=a%BigInteger.base,s[r+1]+=t}return new BigInteger(s,1)},BigInteger.prototype.quotient=function(e){return this.divRem(e)[0]},BigInteger.prototype.divide=BigInteger.prototype.quotient,BigInteger.prototype.remainder=function(e){return this.divRem(e)[1]},BigInteger.prototype.divRem=function(e){if(0===(e=BigInteger(e))._s)throw new Error("Divide by zero");if(0===this._s)return[BigInteger.ZERO,BigInteger.ZERO];if(1===e._d.length)return this.divRemSmall(e._s*e._d[0]);switch(this.compareAbs(e)){case 0:return[this._s===e._s?BigInteger.ONE:BigInteger.M_ONE,BigInteger.ZERO];case-1:return[BigInteger.ZERO,this]}var t,r=this._s*e._s,n=e.abs(),i=this._d.slice(),g=(e._d.length,i.length,[]),s=new BigInteger([],1);for(s._s=1;i.length;)if(s._d.unshift(i.pop()),(s=new BigInteger(s._d,1)).compareAbs(e)<0)g.push(0);else{if(0===s._s)t=0;else{var o=s._d.length,a=n._d.length,I=s._d[o-1]*BigInteger.base+s._d[o-2],B=n._d[a-1]*BigInteger.base+n._d[a-2];s._d.length>n._d.length&&(I=(I+1)*BigInteger.base),t=Math.ceil(I/B)}do{var h=n.multiplySingleDigit(t);if(h.compareAbs(s)<=0)break;t--}while(t);if(g.push(t),t){var u=s.subtract(h);s._d=u._d.slice()}}return[new BigInteger(g.reverse(),r),new BigInteger(s._d,this._s)]},BigInteger.prototype.divRemSmall=function(e){var t;if(0===(e=+e))throw new Error("Divide by zero");var r=e<0?-1:1,n=this._s*r;if((e=Math.abs(e))<1||e>=BigInteger.base)throw new Error("Argument out of range");if(0===this._s)return[BigInteger.ZERO,BigInteger.ZERO];if(1===e||-1===e)return[1===n?this.abs():new BigInteger(this._d,n),BigInteger.ZERO];if(1===this._d.length){var i=new BigInteger([this._d[0]/e|0],1);return t=new BigInteger([this._d[0]%e|0],1),n<0&&(i=i.negate()),this._s<0&&(t=t.negate()),[i,t]}for(var g,s=this._d.slice(),o=new Array(s.length),a=0,I=0,B=0;s.length;){if((a=a*BigInteger.base+s[s.length-1])<e)o[B++]=0,s.pop(),I=BigInteger.base*I+a;else I=a-e*(g=0===a?0:a/e|0),o[B++]=g,g?(s.pop(),a=I):s.pop()}return t=new BigInteger([I],1),this._s<0&&(t=t.negate()),[new BigInteger(o.reverse(),n),t]},BigInteger.prototype.isEven=function(){var e=this._d;return 0===this._s||0===e.length||e[0]%2==0},BigInteger.prototype.isOdd=function(){return!this.isEven()},BigInteger.prototype.sign=function(){return this._s},BigInteger.prototype.isPositive=function(){return this._s>0},BigInteger.prototype.isNegative=function(){return this._s<0},BigInteger.prototype.isZero=function(){return 0===this._s},BigInteger.prototype.exp10=function(e){if(0===(e=+e))return this;if(Math.abs(e)>Number(BigInteger.MAX_EXP))throw new Error("exponent too large in BigInteger.exp10");if(e>0){for(var t=new BigInteger(this._d.slice(),this._s);e>=BigInteger.base_log10;e-=BigInteger.base_log10)t._d.unshift(0);return 0==e?t:(t._s=1,t=t.multiplySingleDigit(Math.pow(10,e)),this._s<0?t.negate():t)}if(-e>=this._d.length*BigInteger.base_log10)return BigInteger.ZERO;t=new BigInteger(this._d.slice(),this._s);for(e=-e;e>=BigInteger.base_log10;e-=BigInteger.base_log10)t._d.shift();return 0==e?t:t.divRemSmall(Math.pow(10,e))[0]},BigInteger.prototype.pow=function(e){if(this.isUnit())return this._s>0||BigInteger(e).isOdd()?this:this.negate();if(0===(e=BigInteger(e))._s)return BigInteger.ONE;if(e._s<0){if(0===this._s)throw new Error("Divide by zero");return BigInteger.ZERO}if(0===this._s)return BigInteger.ZERO;if(e.isUnit())return this;if(e.compareAbs(BigInteger.MAX_EXP)>0)throw new Error("exponent too large in BigInteger.pow");for(var t=this,r=BigInteger.ONE,n=BigInteger.small[2];e.isPositive();){if(e.isOdd()&&(r=r.multiply(t),e.isUnit()))return r;t=t.square(),e=e.quotient(n)}return r},BigInteger.prototype.modPow=function(e,t){for(var r=BigInteger.ONE,n=this;e.isPositive();)e.isOdd()&&(r=r.multiply(n).remainder(t)),(e=e.quotient(BigInteger.small[2])).isPositive()&&(n=n.square().remainder(t));return r},BigInteger.prototype.log=function(){switch(this._s){case 0:return-1/0;case-1:return NaN}var e=this._d.length;if(e*BigInteger.base_log10<30)return Math.log(this.valueOf());var t=Math.ceil(30/BigInteger.base_log10),r=this._d.slice(e-t);return Math.log(new BigInteger(r,1).valueOf())+(e-t)*Math.log(BigInteger.base)},BigInteger.prototype.valueOf=function(){return parseInt(this.toString(),10)},BigInteger.prototype.toJSValue=function(){return parseInt(this.toString(),10)},BigInteger.MAX_EXP=BigInteger(2147483647),function(){function e(e){return function(t){return e.call(BigInteger(t))}}function t(e){return function(t,r){return e.call(BigInteger(t),BigInteger(r))}}function r(e){return function(t,r,n){return e.call(BigInteger(t),BigInteger(r),BigInteger(n))}}!function(){var n,i,g="toJSValue,isEven,isOdd,sign,isZero,isNegative,abs,isUnit,square,negate,isPositive,toString,next,prev,log".split(","),s="compare,remainder,divRem,subtract,add,quotient,divide,multiply,pow,compareAbs".split(","),o=["modPow"];for(n=0;n<g.length;n++)BigInteger[i=g[n]]=e(BigInteger.prototype[i]);for(n=0;n<s.length;n++)BigInteger[i=s[n]]=t(BigInteger.prototype[i]);for(n=0;n<o.length;n++)BigInteger[i=o[n]]=r(BigInteger.prototype[i]);BigInteger.exp10=function(e,t){return BigInteger(e).exp10(t)}}()}(),"undefined"!=typeof exports&&(exports.BigInteger=BigInteger);var VirtualJoystick=function(t){t=t||{},this._container=t.container||document.body,this._stickEl=t.stickElement||this._buildJoystickStick(),this._baseEl=t.baseElement||this._buildJoystickBase(),this._mouseLeft=t.mouseLeft||this._buildJoystickButton(),this._mouseSupport="mouseSupport"in t&&t.mouseSupport,this._range=t.range||60,this._timer=null,this._callback="callback"in t&&t.callback,this._callbackcontext="callbackcontext"in t?t.callbackcontext:this,this._callbackButton="callbackbutton"in t&&t.callbackbutton,this._referenceItem=t.referenceItem,this._container.style.position="relative",this._container.appendChild(this._baseEl),this._container.appendChild(this._mouseLeft),this._baseEl.style.position="absolute",this._baseEl.style.display="block",this._mouseLeft.style.position="absolute",this._mouseLeft.style.display="block";var e=$(this._referenceItem),s=e.height()-e.offset().top-130;this._baseEl.style.top=s+"px",this._baseEl.style.left="20px",this._container.appendChild(this._stickEl),this._stickEl.style.position="absolute",this._stickEl.style.display="none",this._mouseLeft.style.top=s+20+"px",this._mouseLeft.style.right="20px",this._pressed=!1,this._baseX=0,this._baseY=0,this._stickX=0,this._stickY=0,__bind=function(t,e){return function(){return t.apply(e,arguments)}},this._$onTouchStart=__bind(this._onTouchStart,this),this._$onTouchEnd=__bind(this._onTouchEnd,this),this._$onTouchMove=__bind(this._onTouchMove,this),this._$onTouchStartButton=__bind(this._onTouchStartButton,this),this._$onTouchEndButton=__bind(this._onTouchEndButton,this),this._baseEl.addEventListener("touchstart",this._$onTouchStart,!1),this._mouseLeft.addEventListener("touchstart",this._$onTouchStartButton,!1),this._mouseLeft.addEventListener("touchend",this._$onTouchEndButton,!1),this._container.addEventListener("touchend",this._$onTouchEnd,!1),this._container.addEventListener("touchmove",this._$onTouchMove,!1),this._mouseSupport&&(this._$onMouseDown=__bind(this._onMouseDown,this),this._$onMouseUp=__bind(this._onMouseUp,this),this._$onMouseMove=__bind(this._onMouseMove,this),this._$onMouseDownButton=__bind(this._onMouseDownButton,this),this._$onMouseUpButton=__bind(this._onMouseUpButton,this),this._baseEl.addEventListener("mousedown",this._$onMouseDown,!1),this._container.addEventListener("mouseup",this._$onMouseUp,!1),this._mouseLeft.addEventListener("mousedown",this._$onTouchStartButton,!1),this._mouseLeft.addEventListener("mouseup",this._$onTouchEndButton,!1),this._container.addEventListener("mousemove",this._$onMouseMove,!1))};VirtualJoystick.prototype.destroy=function(){this._container.removeChild(this._baseEl),this._container.removeChild(this._stickEl),this._mouseLeft.removeEventListener("touchstart",this._$onTouchStartButton,!1),this._mouseLeft.removeEventListener("touchend",this._$onTouchEndButton,!1),this._container.removeChild(this._mouseLeft),this._container.removeEventListener("touchstart",this._$onTouchStart,!1),this._container.removeEventListener("touchend",this._$onTouchEnd,!1),this._container.removeEventListener("touchmove",this._$onTouchMove,!1),this._mouseSupport&&(this._container.removeEventListener("mouseup",this._$onMouseUp,!1),this._container.removeEventListener("mousedown",this._$onMouseDown,!1),this._container.removeEventListener("mousemove",this._$onMouseMove,!1))},VirtualJoystick.touchScreenAvailable=function(){return"createTouch"in document},VirtualJoystick.prototype.deltaX=function(){return this._stickX-this._baseX},VirtualJoystick.prototype.deltaY=function(){return this._stickY-this._baseY},VirtualJoystick.prototype.up=function(){if(!1===this._pressed)return!1;var t=this.deltaX(),e=this.deltaY();return!(e>=0)&&!(Math.abs(e)<this._range&&Math.abs(e)<Math.abs(t))},VirtualJoystick.prototype.down=function(){if(!1===this._pressed)return!1;var t=this.deltaX(),e=this.deltaY();return!(e<=0)&&!(Math.abs(e)<this._range&&Math.abs(e)<Math.abs(t))},VirtualJoystick.prototype.right=function(){if(!1===this._pressed)return!1;var t=this.deltaX(),e=this.deltaY();return!(t<=0)&&!(Math.abs(t)<this._range&&Math.abs(e)>Math.abs(t))},VirtualJoystick.prototype.left=function(){if(!1===this._pressed)return!1;var t=this.deltaX(),e=this.deltaY();return!(t>=0)&&!(Math.abs(t)<this._range&&Math.abs(e)>Math.abs(t))},VirtualJoystick.prototype._onUp=function(){this._pressed=!1,this._stickEl.style.display="none",this._baseX=this._baseY=0,this._stickX=this._stickY=0,this._eraseInterval()},VirtualJoystick.prototype._onDown=function(t,e){this._pressed=!0,this._stickX=t,this._stickY=e,this._stickEl.style.display="",this._stickEl.style.left=this._stickX-this._stickEl.width/2+"px",this._stickEl.style.top=this._stickY-this._stickEl.height/2+"px",this._startInterval()},VirtualJoystick.prototype._onMove=function(t,e){!0===this._pressed&&(this._stickX=t,this._stickY=e,this._stickEl.style.left=t-this._stickEl.width/2+"px",this._stickEl.style.top=e-this._stickEl.height/2+"px",this._startInterval())},VirtualJoystick.prototype._startInterval=function(t,e){this._eraseInterval();var s=$(this._baseEl).offset().left+$(this._baseEl).width()/2,i=$(this._stickEl).offset().left+$(this._stickEl).width()/2;this.offsetX=parseInt((i-s)/5);var o=$(this._baseEl).offset().top+$(this._baseEl).height()/2,n=$(this._stickEl).offset().top+$(this._stickEl).height()/2;this.offsetY=parseInt((n-o)/5),this.offsetX>15&&(this.offsetX=15),this.offsetY>15&&(this.offsetY=15);var h=this;this._timer=setInterval((function(){h._callback&&h._callback.call(h._callbackcontext,[h.offsetX,h.offsetY])}),10)},VirtualJoystick.prototype._eraseInterval=function(){this._timer&&(clearTimeout(this._timer),this._timer=null)},VirtualJoystick.prototype._onMouseUp=function(t){return this._onUp()},VirtualJoystick.prototype._onMouseDown=function(t){var e=t.pageX,s=t.pageY;return this._onDown(e,s)},VirtualJoystick.prototype._onMouseMove=function(t){var e=t.pageX,s=t.pageY;return this._onMove(e,s)},VirtualJoystick.prototype._onTouchStart=function(t){if(1==t.touches.length){t.preventDefault();var e=t.touches[0].pageX,s=t.touches[0].pageY;return this._onDown(e,s)}},VirtualJoystick.prototype._onTouchEnd=function(t){return t.preventDefault(),this._onUp()},VirtualJoystick.prototype._onTouchMove=function(t){if(!t.touches||1==t.touches.length){t.preventDefault();var e=t.touches[0].pageX,s=t.touches[0].pageY;return this._onMove(e,s)}},VirtualJoystick.prototype._onTouchStartButton=function(t){t.touches&&1!=t.touches.length||(t.preventDefault(),this._callbackButton.call(this._callbackcontext,["down"]))},VirtualJoystick.prototype._onTouchEndButton=function(t){t.preventDefault(),this._callbackButton.call(this._callbackcontext,["up"])},VirtualJoystick.prototype._buildJoystickBase=function(){var t=document.createElement("canvas");t.style.zIndex=2,t.width=126,t.height=126;var e=t.getContext("2d");return e.beginPath(),e.strokeStyle="cyan",e.lineWidth=6,e.arc(t.width/2,t.width/2,40,0,2*Math.PI,!0),e.stroke(),e.beginPath(),e.strokeStyle="cyan",e.lineWidth=2,e.arc(t.width/2,t.width/2,60,0,2*Math.PI,!0),e.stroke(),t},VirtualJoystick.prototype._buildJoystickStick=function(){var t=document.createElement("canvas");t.style.zIndex=2,t.width=86,t.height=86;var e=t.getContext("2d");return e.beginPath(),e.strokeStyle="cyan",e.lineWidth=6,e.arc(t.width/2,t.width/2,40,0,2*Math.PI,!0),e.stroke(),t},VirtualJoystick.prototype._buildJoystickButton=function(){var t=document.createElement("canvas");t.style.zIndex=2,t.width=86,t.height=86;var e=t.getContext("2d");return e.beginPath(),e.strokeStyle="green",e.lineWidth=6,e.arc(t.width/2,t.width/2,40,0,2*Math.PI,!0),e.stroke(),t};var prettyPrint=function(){var e={el:function(t,n){var o,r=document.createElement(t);if((n=e.merge({},n))&&n.style){n.style;e.applyCSS(r,n.style),delete n.style}for(o in n)n.hasOwnProperty(o)&&(r[o]=n[o]);return r},applyCSS:function(e,t){for(var n in t)if(t.hasOwnProperty(n))try{e.style[n]=t[n]}catch(e){}},txt:function(e){return document.createTextNode(e)},row:function(t,n,o){o=o||"td";var r,a=e.count(t,null)+1,d=e.el("tr"),i={style:e.getStyles(o,n),colSpan:a,onmouseover:function(){var t=this.parentNode.childNodes;e.forEach(t,(function(t){"td"===t.nodeName.toLowerCase()&&e.applyCSS(t,e.getStyles("td_hover",n))}))},onmouseout:function(){var t=this.parentNode.childNodes;e.forEach(t,(function(t){"td"===t.nodeName.toLowerCase()&&e.applyCSS(t,e.getStyles("td",n))}))}};return e.forEach(t,(function(t){null!==t&&(r=e.el(o,i),t.nodeType?r.appendChild(t):r.innerHTML=e.shorten(t.toString()),d.appendChild(r))})),d},hRow:function(t,n){return e.row(t,n,"th")},table:function(t,n){t=t||[];var o={thead:{style:e.getStyles("thead",n)},tbody:{style:e.getStyles("tbody",n)},table:{style:e.getStyles("table",n)}},r=e.el("table",o.table),a=e.el("thead",o.thead),d=e.el("tbody",o.tbody);return t.length&&(r.appendChild(a),a.appendChild(e.hRow(t,n))),r.appendChild(d),{node:r,tbody:d,thead:a,appendChild:function(e){this.tbody.appendChild(e)},addRow:function(t,o,r){return this.appendChild(e.row.call(e,t,o||n,r)),this}}},shorten:function(e){return(e=e.replace(/^\s\s*|\s\s*$|\n/g,"")).length>40?e.substring(0,39)+"...":e},htmlentities:function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},merge:function(t,n){for(var o in"object"!=typeof t&&(t={}),n)if(n.hasOwnProperty(o)){var r=n[o];if("object"==typeof r){t[o]=e.merge(t[o],r);continue}t[o]=r}for(var a=2,d=arguments.length;a<d;a++)e.merge(t,arguments[a]);return t},count:function(e,t){for(var n=0,o=0,r=e.length;o<r;o++)e[o]===t&&n++;return n},thead:function(e){return e.getElementsByTagName("thead")[0]},forEach:function(e,t,n){n||(n=t);for(var o=e.length,r=-1;++r<o&&!1!==n(e[r],r,e););return!0},type:function(e){try{if(null===e)return"null";if(void 0===e)return"undefined";var t=Object.prototype.toString.call(e).match(/\s(.+?)\]/)[1].toLowerCase();return e.nodeType?1===e.nodeType?"domelement":"domnode":/^(string|number|array|regexp|function|date|boolean)$/.test(t)?t:"object"==typeof e?e.jquery&&"string"==typeof e.jquery?"jquery":"object":e===window||e===document?"object":"default"}catch(e){return"default"}},within:function(e){return{is:function(t){for(var n in e)if(e[n]===t)return n;return""}}},common:{circRef:function(n,o,r){return e.expander("[POINTS BACK TO <strong>"+o+"</strong>]","Click to show this item anyway",(function(){this.parentNode.appendChild(t(n,{maxDepth:1}))}))},depthReached:function(n,o){return e.expander("[DEPTH REACHED]","Click to show this item anyway",(function(){try{this.parentNode.appendChild(t(n,{maxDepth:1}))}catch(t){this.parentNode.appendChild(e.table(["ERROR OCCURED DURING OBJECT RETRIEVAL"],"error").addRow([t.message]).node)}}))}},getStyles:function(n,o){return o=t.settings.styles[o]||{},e.merge({},t.settings.styles.default[n],o[n])},expander:function(t,n,o){return e.el("a",{innerHTML:e.shorten(t)+' <b style="visibility:hidden;">[+]</b>',title:n,onmouseover:function(){this.getElementsByTagName("b")[0].style.visibility="visible"},onmouseout:function(){this.getElementsByTagName("b")[0].style.visibility="hidden"},onclick:function(){return this.style.display="none",o.call(this),!1},style:{cursor:"pointer"}})},stringify:function(t){var n,o=e.type(t),r=!0;if("array"===o)return n="[",e.forEach(t,(function(t,o){n+=(0===o?"":", ")+e.stringify(t)})),n+"]";if("object"==typeof t){for(var a in n="{",t)t.hasOwnProperty(a)&&(n+=(r?"":", ")+a+":"+e.stringify(t[a]),r=!1);return n+"}"}return"regexp"===o?"/"+t.source+"/":"string"===o?'"'+t.replace(/"/g,'\\"')+'"':t.toString()},headerGradient:function(){var e=document.createElement("canvas");if(!e.getContext)return"";var t=e.getContext("2d");e.height=30,e.width=1;var n=t.createLinearGradient(0,0,0,30);return n.addColorStop(0,"rgba(0,0,0,0)"),n.addColorStop(1,"rgba(0,0,0,0.25)"),t.fillStyle=n,t.fillRect(0,0,1,30),"url("+(e.toDataURL&&e.toDataURL()||"")+")"}()},t=function(n,o){o=o||{};var r=e.merge({},t.config,o),a=e.el("div"),d=(t.config,{}),i=!1;t.settings=r;var l={string:function(t){return e.txt('"'+e.shorten(t.replace(/"/g,'\\"'))+'"')},number:function(t){return e.txt(t)},regexp:function(t){var n=e.table(["RegExp",null],"regexp"),o=e.table(),a=e.expander("/"+t.source+"/","Click to show more",(function(){this.parentNode.appendChild(n.node)}));return o.addRow(["g",t.global]).addRow(["i",t.ignoreCase]).addRow(["m",t.multiline]),n.addRow(["source","/"+t.source+"/"]).addRow(["flags",o.node]).addRow(["lastIndex",t.lastIndex]),r.expanded?n.node:a},domelement:function(t,n){var o=e.table(["DOMElement",null],"domelement"),a=t.nodeName||"";return o.addRow(["tag","&lt;"+a.toLowerCase()+"&gt;"]),e.forEach(["id","className","innerHTML","src","href"],(function(n){t[n]&&o.addRow([n,e.htmlentities(t[n])])})),r.expanded?o.node:e.expander("DOMElement ("+a.toLowerCase()+")","Click to show more",(function(){this.parentNode.appendChild(o.node)}))},domnode:function(t){var n=e.table(["DOMNode",null],"domelement"),o=e.htmlentities((t.data||"UNDEFINED").replace(/\n/g,"\\n"));return n.addRow(["nodeType",t.nodeType+" ("+t.nodeName+")"]).addRow(["data",o]),r.expanded?n.node:e.expander("DOMNode","Click to show more",(function(){this.parentNode.appendChild(n.node)}))},jquery:function(e,t,n){return l.array(e,t,n,!0)},object:function(t,n,o){var a=e.within(d).is(t);if(a)return e.common.circRef(t,a,r);if(d[o||"TOP"]=t,n===r.maxDepth)return e.common.depthReached(t,r);var c=e.table(["Object",null],"object"),u=!0;for(var s in t)if(!t.hasOwnProperty||t.hasOwnProperty(s)){var p=t[s],h=e.type(p);u=!1;try{c.addRow([s,l[h](p,n+1,s)],h)}catch(e){window.console&&window.console.log&&console.log(e.message)}}u?c.addRow(["<small>[empty]</small>"]):c.thead.appendChild(e.hRow(["key","value"],"colHeader"));var f=r.expanded||i?c.node:e.expander(e.stringify(t),"Click to show more",(function(){this.parentNode.appendChild(c.node)}));return i=!0,f},array:function(t,n,o,a){var i=e.within(d).is(t);if(i)return e.common.circRef(t,i);if(d[o||"TOP"]=t,n===r.maxDepth)return e.common.depthReached(t);var c=a?"jQuery":"Array",u=e.table([c+"("+t.length+")",null],a?"jquery":c.toLowerCase()),s=!0,p=0;return a&&u.addRow(["selector",t.selector]),e.forEach(t,(function(o,a){if(r.maxArray>=0&&++p>r.maxArray)return u.addRow([a+".."+(t.length-1),l[e.type(o)]("...",n+1,a)]),!1;s=!1,u.addRow([a,l[e.type(o)](o,n+1,a)])})),a||(s?u.addRow(["<small>[empty]</small>"]):u.thead.appendChild(e.hRow(["index","value"],"colHeader"))),r.expanded?u.node:e.expander(e.stringify(t),"Click to show more",(function(){this.parentNode.appendChild(u.node)}))},function:function(t,n,o){var a=e.within(d).is(t);if(a)return e.common.circRef(t,a);d[o||"TOP"]=t;var i=e.table(["Function",null],"function"),l=(e.table(["Arguments"]),t.toString().match(/\((.+?)\)/)),c=t.toString().match(/\(.*?\)\s+?\{?([\S\s]+)/)[1].replace(/\}?$/,"");return i.addRow(["arguments",l?l[1].replace(/[^\w_,\s]/g,""):"<small>[none/native]</small>"]).addRow(["body",c]),r.expanded?i.node:e.expander("function(){...}","Click to see more about this function.",(function(){this.parentNode.appendChild(i.node)}))},date:function(t){var n=e.table(["Date",null],"date"),o=t.toString().split(/\s/);return n.addRow(["Time",o[4]]).addRow(["Date",o.slice(0,4).join("-")]),r.expanded?n.node:e.expander("Date (timestamp): "+ +t,"Click to see a little more info about this date",(function(){this.parentNode.appendChild(n.node)}))},boolean:function(t){return e.txt(t.toString().toUpperCase())},undefined:function(){return e.txt("UNDEFINED")},null:function(){return e.txt("NULL")},default:function(){return e.txt("prettyPrint: TypeNotFound Error")}};return a.appendChild(l[r.forceObject?"object":e.type(n)](n,0)),a};return t.config={expanded:!0,forceObject:!1,maxDepth:3,maxArray:-1,styles:{array:{th:{backgroundColor:"#6DBD2A",color:"white"}},function:{th:{backgroundColor:"#D82525"}},regexp:{th:{backgroundColor:"#E2F3FB",color:"#000"}},object:{th:{backgroundColor:"#1F96CF"}},jquery:{th:{backgroundColor:"#FBF315"}},error:{th:{backgroundColor:"red",color:"yellow"}},domelement:{th:{backgroundColor:"#F3801E"}},date:{th:{backgroundColor:"#A725D8"}},colHeader:{th:{backgroundColor:"#EEE",color:"#000",textTransform:"uppercase"}},default:{table:{borderCollapse:"collapse",width:"100%"},td:{padding:"5px",fontSize:"12px",backgroundColor:"#FFF",color:"#222",border:"1px solid #000",verticalAlign:"top",fontFamily:'"Consolas","Lucida Console",Courier,mono',whiteSpace:"nowrap"},td_hover:{},th:{padding:"5px",fontSize:"12px",backgroundColor:"#222",color:"#EEE",textAlign:"left",border:"1px solid #000",verticalAlign:"top",fontFamily:'"Consolas","Lucida Console",Courier,mono',backgroundImage:e.headerGradient,backgroundRepeat:"repeat-x"}}}},t}();var dbits,canary=0xdeadbeefcafe,j_lm=15715070==(16777215&canary);function encryptionBigInteger(t,i,n){null!=t&&("number"==typeof t?this.fromNumber(t,i,n):null==i&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,i))}function nbi(){return new encryptionBigInteger(null)}function am1(t,i,n,r,o,e){for(;--e>=0;){var s=i*this[t++]+n[r]+o;o=Math.floor(s/67108864),n[r++]=67108863&s}return o}function am2(t,i,n,r,o,e){for(var s=32767&i,h=i>>15;--e>=0;){var p=32767&this[t],c=this[t++]>>15,a=h*p+c*s;o=((p=s*p+((32767&a)<<15)+n[r]+(1073741823&o))>>>30)+(a>>>15)+h*c+(o>>>30),n[r++]=1073741823&p}return o}function am3(t,i,n,r,o,e){for(var s=16383&i,h=i>>14;--e>=0;){var p=16383&this[t],c=this[t++]>>14,a=h*p+c*s;o=((p=s*p+((16383&a)<<14)+n[r]+o)>>28)+(a>>14)+h*c,n[r++]=268435455&p}return o}j_lm&&"Microsoft Internet Explorer"==navigator.appName?(encryptionBigInteger.prototype.am=am2,dbits=30):j_lm&&"Netscape"!=navigator.appName?(encryptionBigInteger.prototype.am=am1,dbits=26):(encryptionBigInteger.prototype.am=am3,dbits=28),encryptionBigInteger.prototype.DB=dbits,encryptionBigInteger.prototype.DM=(1<<dbits)-1,encryptionBigInteger.prototype.DV=1<<dbits;var BI_FP=52;encryptionBigInteger.prototype.FV=Math.pow(2,BI_FP),encryptionBigInteger.prototype.F1=BI_FP-dbits,encryptionBigInteger.prototype.F2=2*dbits-BI_FP;var rr,vv,BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=new Array;for(rr="0".charCodeAt(0),vv=0;vv<=9;++vv)BI_RC[rr++]=vv;for(rr="a".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;for(rr="A".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;function int2char(t){return BI_RM.charAt(t)}function intAt(t,i){var n=BI_RC[t.charCodeAt(i)];return null==n?-1:n}function bnpCopyTo(t){for(var i=this.t-1;i>=0;--i)t[i]=this[i];t.t=this.t,t.s=this.s}function bnpFromInt(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+DV:this.t=0}function nbv(t){var i=nbi();return i.fromInt(t),i}function bnpFromString(t,i){var n;if(16==i)n=4;else if(8==i)n=3;else if(256==i)n=8;else if(2==i)n=1;else if(32==i)n=5;else{if(4!=i)return void this.fromRadix(t,i);n=2}this.t=0,this.s=0;for(var r=t.length,o=!1,e=0;--r>=0;){var s=8==n?255&t[r]:intAt(t,r);s<0?"-"==t.charAt(r)&&(o=!0):(o=!1,0==e?this[this.t++]=s:e+n>this.DB?(this[this.t-1]|=(s&(1<<this.DB-e)-1)<<e,this[this.t++]=s>>this.DB-e):this[this.t-1]|=s<<e,(e+=n)>=this.DB&&(e-=this.DB))}8==n&&128&t[0]&&(this.s=-1,e>0&&(this[this.t-1]|=(1<<this.DB-e)-1<<e)),this.clamp(),o&&encryptionBigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}function bnToString(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var n,r=(1<<i)-1,o=!1,e="",s=this.t,h=this.DB-s*this.DB%i;if(s-- >0)for(h<this.DB&&(n=this[s]>>h)>0&&(o=!0,e=int2char(n));s>=0;)h<i?(n=(this[s]&(1<<h)-1)<<i-h,n|=this[--s]>>(h+=this.DB-i)):(n=this[s]>>(h-=i)&r,h<=0&&(h+=this.DB,--s)),n>0&&(o=!0),o&&(e+=int2char(n));return o?e:"0"}function bnNegate(){var t=nbi();return encryptionBigInteger.ZERO.subTo(this,t),t}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(t){var i=this.s-t.s;if(0!=i)return i;var n=this.t;if(0!=(i=n-t.t))return this.s<0?-i:i;for(;--n>=0;)if(0!=(i=this[n]-t[n]))return i;return 0}function nbits(t){var i,n=1;return 0!=(i=t>>>16)&&(t=i,n+=16),0!=(i=t>>8)&&(t=i,n+=8),0!=(i=t>>4)&&(t=i,n+=4),0!=(i=t>>2)&&(t=i,n+=2),0!=(i=t>>1)&&(t=i,n+=1),n}function bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(t,i){var n;for(n=this.t-1;n>=0;--n)i[n+t]=this[n];for(n=t-1;n>=0;--n)i[n]=0;i.t=this.t+t,i.s=this.s}function bnpDRShiftTo(t,i){for(var n=t;n<this.t;++n)i[n-t]=this[n];i.t=Math.max(this.t-t,0),i.s=this.s}function bnpLShiftTo(t,i){var n,r=t%this.DB,o=this.DB-r,e=(1<<o)-1,s=Math.floor(t/this.DB),h=this.s<<r&this.DM;for(n=this.t-1;n>=0;--n)i[n+s+1]=this[n]>>o|h,h=(this[n]&e)<<r;for(n=s-1;n>=0;--n)i[n]=0;i[s]=h,i.t=this.t+s+1,i.s=this.s,i.clamp()}function bnpRShiftTo(t,i){i.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)i.t=0;else{var r=t%this.DB,o=this.DB-r,e=(1<<r)-1;i[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)i[s-n-1]|=(this[s]&e)<<o,i[s-n]=this[s]>>r;r>0&&(i[this.t-n-1]|=(this.s&e)<<o),i.t=this.t-n,i.clamp()}}function bnpSubTo(t,i){for(var n=0,r=0,o=Math.min(t.t,this.t);n<o;)r+=this[n]-t[n],i[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;n<this.t;)r+=this[n],i[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r-=t[n],i[n++]=r&this.DM,r>>=this.DB;r-=t.s}i.s=r<0?-1:0,r<-1?i[n++]=this.DV+r:r>0&&(i[n++]=r),i.t=n,i.clamp()}function bnpMultiplyTo(t,i){var n=this.abs(),r=t.abs(),o=n.t;for(i.t=o+r.t;--o>=0;)i[o]=0;for(o=0;o<r.t;++o)i[o+n.t]=n.am(0,r[o],i,o,0,n.t);i.s=0,i.clamp(),this.s!=t.s&&encryptionBigInteger.ZERO.subTo(i,i)}function bnpSquareTo(t){for(var i=this.abs(),n=t.t=2*i.t;--n>=0;)t[n]=0;for(n=0;n<i.t-1;++n){var r=i.am(n,i[n],t,2*n,0,1);(t[n+i.t]+=i.am(n+1,2*i[n],t,2*n+1,r,i.t-n-1))>=i.DV&&(t[n+i.t]-=i.DV,t[n+i.t+1]=1)}t.t>0&&(t[t.t-1]+=i.am(n,i[n],t,2*n,0,1)),t.s=0,t.clamp()}function bnpDivRemTo(t,i,n){var r=t.abs();if(!(r.t<=0)){var o=this.abs();if(o.t<r.t)return null!=i&&i.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=nbi());var e=nbi(),s=this.s,h=t.s,p=this.DB-nbits(r[r.t-1]);p>0?(r.lShiftTo(p,e),o.lShiftTo(p,n)):(r.copyTo(e),o.copyTo(n));var c=e.t,a=e[c-1];if(0!=a){var f=a*(1<<this.F1)+(c>1?e[c-2]>>this.F2:0),u=this.FV/f,g=(1<<this.F1)/f,m=1<<this.F2,y=n.t,v=y-c,b=null==i?nbi():i;for(e.dlShiftTo(v,b),n.compareTo(b)>=0&&(n[n.t++]=1,n.subTo(b,n)),encryptionBigInteger.ONE.dlShiftTo(c,b),b.subTo(e,e);e.t<c;)e[e.t++]=0;for(;--v>=0;){var l=n[--y]==a?this.DM:Math.floor(n[y]*u+(n[y-1]+m)*g);if((n[y]+=e.am(0,l,n,v,0,c))<l)for(e.dlShiftTo(v,b),n.subTo(b,n);n[y]<--l;)n.subTo(b,n)}null!=i&&(n.drShiftTo(c,i),s!=h&&encryptionBigInteger.ZERO.subTo(i,i)),n.t=c,n.clamp(),p>0&&n.rShiftTo(p,n),s<0&&encryptionBigInteger.ZERO.subTo(n,n)}}}function bnMod(t){var i=nbi();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(encryptionBigInteger.ZERO)>0&&t.subTo(i,i),i}function Classic(t){this.m=t}function cConvert(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function cRevert(t){return t}function cReduce(t){t.divRemTo(this.m,null,t)}function cMulTo(t,i,n){t.multiplyTo(i,n),this.reduce(n)}function cSqrTo(t,i){t.squareTo(i),this.reduce(i)}function bnpInvDigit(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var i=3&t;return(i=(i=(i=(i=i*(2-(15&t)*i)&15)*(2-(255&t)*i)&255)*(2-((65535&t)*i&65535))&65535)*(2-t*i%this.DV)%this.DV)>0?this.DV-i:-i}function Montgomery(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function montConvert(t){var i=nbi();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(encryptionBigInteger.ZERO)>0&&this.m.subTo(i,i),i}function montRevert(t){var i=nbi();return t.copyTo(i),this.reduce(i),i}function montReduce(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var i=0;i<this.m.t;++i){var n=32767&t[i],r=n*this.mpl+((n*this.mph+(t[i]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[n=i+this.m.t]+=this.m.am(0,r,t,i,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function montSqrTo(t,i){t.squareTo(i),this.reduce(i)}function montMulTo(t,i,n){t.multiplyTo(i,n),this.reduce(n)}function bnpIsEven(){return 0==(this.t>0?1&this[0]:this.s)}function bnpExp(t,i){if(t>4294967295||t<1)return encryptionBigInteger.ONE;var n=nbi(),r=nbi(),o=i.convert(this),e=nbits(t)-1;for(o.copyTo(n);--e>=0;)if(i.sqrTo(n,r),(t&1<<e)>0)i.mulTo(r,o,n);else{var s=n;n=r,r=s}return i.revert(n)}function bnModPowInt(t,i){var n;return n=t<256||i.isEven()?new Classic(i):new Montgomery(i),this.exp(t,n)}Classic.prototype.convert=cConvert,Classic.prototype.revert=cRevert,Classic.prototype.reduce=cReduce,Classic.prototype.mulTo=cMulTo,Classic.prototype.sqrTo=cSqrTo,Montgomery.prototype.convert=montConvert,Montgomery.prototype.revert=montRevert,Montgomery.prototype.reduce=montReduce,Montgomery.prototype.mulTo=montMulTo,Montgomery.prototype.sqrTo=montSqrTo,encryptionBigInteger.prototype.copyTo=bnpCopyTo,encryptionBigInteger.prototype.fromInt=bnpFromInt,encryptionBigInteger.prototype.fromString=bnpFromString,encryptionBigInteger.prototype.clamp=bnpClamp,encryptionBigInteger.prototype.dlShiftTo=bnpDLShiftTo,encryptionBigInteger.prototype.drShiftTo=bnpDRShiftTo,encryptionBigInteger.prototype.lShiftTo=bnpLShiftTo,encryptionBigInteger.prototype.rShiftTo=bnpRShiftTo,encryptionBigInteger.prototype.subTo=bnpSubTo,encryptionBigInteger.prototype.multiplyTo=bnpMultiplyTo,encryptionBigInteger.prototype.squareTo=bnpSquareTo,encryptionBigInteger.prototype.divRemTo=bnpDivRemTo,encryptionBigInteger.prototype.invDigit=bnpInvDigit,encryptionBigInteger.prototype.isEven=bnpIsEven,encryptionBigInteger.prototype.exp=bnpExp,encryptionBigInteger.prototype.toString=bnToString,encryptionBigInteger.prototype.negate=bnNegate,encryptionBigInteger.prototype.abs=bnAbs,encryptionBigInteger.prototype.compareTo=bnCompareTo,encryptionBigInteger.prototype.bitLength=bnBitLength,encryptionBigInteger.prototype.mod=bnMod,encryptionBigInteger.prototype.modPowInt=bnModPowInt,encryptionBigInteger.ZERO=nbv(0),encryptionBigInteger.ONE=nbv(1);function bnClone(){var t=nbi();return this.copyTo(t),t}function bnIntValue(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function bnByteValue(){return 0==this.t?this.s:this[0]<<24>>24}function bnShortValue(){return 0==this.t?this.s:this[0]<<16>>16}function bnpChunkSize(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function bnSigNum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function bnpToRadix(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var i=this.chunkSize(t),n=Math.pow(t,i),r=nbv(n),e=nbi(),o=nbi(),s="";for(this.divRemTo(r,e,o);e.signum()>0;)s=(n+o.intValue()).toString(t).substr(1)+s,e.divRemTo(r,e,o);return o.intValue().toString(t)+s}function bnpFromRadix(t,i){this.fromInt(0),null==i&&(i=10);for(var n=this.chunkSize(i),r=Math.pow(i,n),e=!1,o=0,s=0,p=0;p<t.length;++p){var h=intAt(t,p);h<0?"-"==t.charAt(p)&&0==this.signum()&&(e=!0):(s=i*s+h,++o>=n&&(this.dMultiply(r),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(i,o)),this.dAddOffset(s,0)),e&&encryptionBigInteger.ZERO.subTo(this,this)}function bnpFromNumber(t,i,n){if("number"==typeof i)if(t<2)this.fromInt(1);else for(this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(encryptionBigInteger.ONE.shiftLeft(t-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(encryptionBigInteger.ONE.shiftLeft(t-1),this);else{var r=new Array,e=7&t;r.length=1+(t>>3),i.nextBytes(r),e>0?r[0]&=(1<<e)-1:r[0]=0,this.fromString(r,256)}}function bnToByteArray(){var t=this.t,i=new Array;i[0]=this.s;var n,r=this.DB-t*this.DB%8,e=0;if(t-- >0)for(r<this.DB&&(n=this[t]>>r)!=(this.s&this.DM)>>r&&(i[e++]=n|this.s<<this.DB-r);t>=0;)r<8?(n=(this[t]&(1<<r)-1)<<8-r,n|=this[--t]>>(r+=this.DB-8)):(n=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),128&n&&(n|=-256),0==e&&(128&this.s)!=(128&n)&&++e,(e>0||n!=this.s)&&(i[e++]=n);return i}function bnEquals(t){return 0==this.compareTo(t)}function bnMin(t){return this.compareTo(t)<0?this:t}function bnMax(t){return this.compareTo(t)>0?this:t}function bnpBitwiseTo(t,i,n){var r,e,o=Math.min(t.t,this.t);for(r=0;r<o;++r)n[r]=i(this[r],t[r]);if(t.t<this.t){for(e=t.s&this.DM,r=o;r<this.t;++r)n[r]=i(this[r],e);n.t=this.t}else{for(e=this.s&this.DM,r=o;r<t.t;++r)n[r]=i(e,t[r]);n.t=t.t}n.s=i(this.s,t.s),n.clamp()}function op_and(t,i){return t&i}function bnAnd(t){var i=nbi();return this.bitwiseTo(t,op_and,i),i}function op_or(t,i){return t|i}function bnOr(t){var i=nbi();return this.bitwiseTo(t,op_or,i),i}function op_xor(t,i){return t^i}function bnXor(t){var i=nbi();return this.bitwiseTo(t,op_xor,i),i}function op_andnot(t,i){return t&~i}function bnAndNot(t){var i=nbi();return this.bitwiseTo(t,op_andnot,i),i}function bnNot(){for(var t=nbi(),i=0;i<this.t;++i)t[i]=this.DM&~this[i];return t.t=this.t,t.s=~this.s,t}function bnShiftLeft(t){var i=nbi();return t<0?this.rShiftTo(-t,i):this.lShiftTo(t,i),i}function bnShiftRight(t){var i=nbi();return t<0?this.lShiftTo(-t,i):this.rShiftTo(t,i),i}function lbit(t){if(0==t)return-1;var i=0;return 65535&t||(t>>=16,i+=16),255&t||(t>>=8,i+=8),15&t||(t>>=4,i+=4),3&t||(t>>=2,i+=2),1&t||++i,i}function bnGetLowestSetBit(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+lbit(this[t]);return this.s<0?this.t*this.DB:-1}function cbit(t){for(var i=0;0!=t;)t&=t-1,++i;return i}function bnBitCount(){for(var t=0,i=this.s&this.DM,n=0;n<this.t;++n)t+=cbit(this[n]^i);return t}function bnTestBit(t){var i=Math.floor(t/this.DB);return i>=this.t?0!=this.s:!!(this[i]&1<<t%this.DB)}function bnpChangeBit(t,i){var n=encryptionBigInteger.ONE.shiftLeft(t);return this.bitwiseTo(n,i,n),n}function bnSetBit(t){return this.changeBit(t,op_or)}function bnClearBit(t){return this.changeBit(t,op_andnot)}function bnFlipBit(t){return this.changeBit(t,op_xor)}function bnpAddTo(t,i){for(var n=0,r=0,e=Math.min(t.t,this.t);n<e;)r+=this[n]+t[n],i[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;n<this.t;)r+=this[n],i[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r+=t[n],i[n++]=r&this.DM,r>>=this.DB;r+=t.s}i.s=r<0?-1:0,r>0?i[n++]=r:r<-1&&(i[n++]=this.DV+r),i.t=n,i.clamp()}function bnAdd(t){var i=nbi();return this.addTo(t,i),i}function bnSubtract(t){var i=nbi();return this.subTo(t,i),i}function bnMultiply(t){var i=nbi();return this.multiplyTo(t,i),i}function bnSquare(){var t=nbi();return this.squareTo(t),t}function bnDivide(t){var i=nbi();return this.divRemTo(t,i,null),i}function bnRemainder(t){var i=nbi();return this.divRemTo(t,null,i),i}function bnDivideAndRemainder(t){var i=nbi(),n=nbi();return this.divRemTo(t,i,n),new Array(i,n)}function bnpDMultiply(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function bnpDAddOffset(t,i){if(0!=t){for(;this.t<=i;)this[this.t++]=0;for(this[i]+=t;this[i]>=this.DV;)this[i]-=this.DV,++i>=this.t&&(this[this.t++]=0),++this[i]}}function NullExp(){}function nNop(t){return t}function nMulTo(t,i,n){t.multiplyTo(i,n)}function nSqrTo(t,i){t.squareTo(i)}function bnPow(t){return this.exp(t,new NullExp)}function bnpMultiplyLowerTo(t,i,n){var r,e=Math.min(this.t+t.t,i);for(n.s=0,n.t=e;e>0;)n[--e]=0;for(r=n.t-this.t;e<r;++e)n[e+this.t]=this.am(0,t[e],n,e,0,this.t);for(r=Math.min(t.t,i);e<r;++e)this.am(0,t[e],n,e,0,i-e);n.clamp()}function bnpMultiplyUpperTo(t,i,n){--i;var r=n.t=this.t+t.t-i;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(i-this.t,0);r<t.t;++r)n[this.t+r-i]=this.am(i-r,t[r],n,0,0,this.t+r-i);n.clamp(),n.drShiftTo(1,n)}function Barrett(t){this.r2=nbi(),this.q3=nbi(),encryptionBigInteger.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function barrettConvert(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var i=nbi();return t.copyTo(i),this.reduce(i),i}function barrettRevert(t){return t}function barrettReduce(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function barrettSqrTo(t,i){t.squareTo(i),this.reduce(i)}function barrettMulTo(t,i,n){t.multiplyTo(i,n),this.reduce(n)}function bnModPow(t,i){var n,r,e=t.bitLength(),o=nbv(1);if(e<=0)return o;n=e<18?1:e<48?3:e<144?4:e<768?5:6,r=e<8?new Classic(i):i.isEven()?new Barrett(i):new Montgomery(i);var s=new Array,p=3,h=n-1,u=(1<<n)-1;if(s[1]=r.convert(this),n>1){var f=nbi();for(r.sqrTo(s[1],f);p<=u;)s[p]=nbi(),r.mulTo(f,s[p-2],s[p]),p+=2}var a,b,c=t.t-1,g=!0,l=nbi();for(e=nbits(t[c])-1;c>=0;){for(e>=h?a=t[c]>>e-h&u:(a=(t[c]&(1<<e+1)-1)<<h-e,c>0&&(a|=t[c-1]>>this.DB+e-h)),p=n;!(1&a);)a>>=1,--p;if((e-=p)<0&&(e+=this.DB,--c),g)s[a].copyTo(o),g=!1;else{for(;p>1;)r.sqrTo(o,l),r.sqrTo(l,o),p-=2;p>0?r.sqrTo(o,l):(b=o,o=l,l=b),r.mulTo(l,s[a],o)}for(;c>=0&&!(t[c]&1<<e);)r.sqrTo(o,l),b=o,o=l,l=b,--e<0&&(e=this.DB-1,--c)}return r.revert(o)}function bnGCD(t){var i=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(i.compareTo(n)<0){var r=i;i=n,n=r}var e=i.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return i;for(e<o&&(o=e),o>0&&(i.rShiftTo(o,i),n.rShiftTo(o,n));i.signum()>0;)(e=i.getLowestSetBit())>0&&i.rShiftTo(e,i),(e=n.getLowestSetBit())>0&&n.rShiftTo(e,n),i.compareTo(n)>=0?(i.subTo(n,i),i.rShiftTo(1,i)):(n.subTo(i,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function bnpModInt(t){if(t<=0)return 0;var i=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(0==i)n=this[0]%t;else for(var r=this.t-1;r>=0;--r)n=(i*n+this[r])%t;return n}function bnModInverse(t){var i=t.isEven();if(this.isEven()&&i||0==t.signum())return encryptionBigInteger.ZERO;for(var n=t.clone(),r=this.clone(),e=nbv(1),o=nbv(0),s=nbv(0),p=nbv(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),i?(e.isEven()&&o.isEven()||(e.addTo(this,e),o.subTo(t,o)),e.rShiftTo(1,e)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;r.isEven();)r.rShiftTo(1,r),i?(s.isEven()&&p.isEven()||(s.addTo(this,s),p.subTo(t,p)),s.rShiftTo(1,s)):p.isEven()||p.subTo(t,p),p.rShiftTo(1,p);n.compareTo(r)>=0?(n.subTo(r,n),i&&e.subTo(s,e),o.subTo(p,o)):(r.subTo(n,r),i&&s.subTo(e,s),p.subTo(o,p))}return 0!=r.compareTo(encryptionBigInteger.ONE)?encryptionBigInteger.ZERO:p.compareTo(t)>=0?p.subtract(t):p.signum()<0?(p.addTo(t,p),p.signum()<0?p.add(t):p):p}NullExp.prototype.convert=nNop,NullExp.prototype.revert=nNop,NullExp.prototype.mulTo=nMulTo,NullExp.prototype.sqrTo=nSqrTo,Barrett.prototype.convert=barrettConvert,Barrett.prototype.revert=barrettRevert,Barrett.prototype.reduce=barrettReduce,Barrett.prototype.mulTo=barrettMulTo,Barrett.prototype.sqrTo=barrettSqrTo;var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],lplim=(1<<26)/lowprimes[lowprimes.length-1];function bnIsProbablePrime(t){var i,n=this.abs();if(1==n.t&&n[0]<=lowprimes[lowprimes.length-1]){for(i=0;i<lowprimes.length;++i)if(n[0]==lowprimes[i])return!0;return!1}if(n.isEven())return!1;for(i=1;i<lowprimes.length;){for(var r=lowprimes[i],e=i+1;e<lowprimes.length&&r<lplim;)r*=lowprimes[e++];for(r=n.modInt(r);i<e;)if(r%lowprimes[i++]==0)return!1}return n.millerRabin(t)}function bnpMillerRabin(t){var i=this.subtract(encryptionBigInteger.ONE),n=i.getLowestSetBit();if(n<=0)return!1;var r=i.shiftRight(n);(t=t+1>>1)>lowprimes.length&&(t=lowprimes.length);for(var e=nbi(),o=0;o<t;++o){e.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);var s=e.modPow(r,this);if(0!=s.compareTo(encryptionBigInteger.ONE)&&0!=s.compareTo(i)){for(var p=1;p++<n&&0!=s.compareTo(i);)if(0==(s=s.modPowInt(2,this)).compareTo(encryptionBigInteger.ONE))return!1;if(0!=s.compareTo(i))return!1}}return!0}encryptionBigInteger.prototype.chunkSize=bnpChunkSize,encryptionBigInteger.prototype.toRadix=bnpToRadix,encryptionBigInteger.prototype.fromRadix=bnpFromRadix,encryptionBigInteger.prototype.fromNumber=bnpFromNumber,encryptionBigInteger.prototype.bitwiseTo=bnpBitwiseTo,encryptionBigInteger.prototype.changeBit=bnpChangeBit,encryptionBigInteger.prototype.addTo=bnpAddTo,encryptionBigInteger.prototype.dMultiply=bnpDMultiply,encryptionBigInteger.prototype.dAddOffset=bnpDAddOffset,encryptionBigInteger.prototype.multiplyLowerTo=bnpMultiplyLowerTo,encryptionBigInteger.prototype.multiplyUpperTo=bnpMultiplyUpperTo,encryptionBigInteger.prototype.modInt=bnpModInt,encryptionBigInteger.prototype.millerRabin=bnpMillerRabin,encryptionBigInteger.prototype.clone=bnClone,encryptionBigInteger.prototype.intValue=bnIntValue,encryptionBigInteger.prototype.byteValue=bnByteValue,encryptionBigInteger.prototype.shortValue=bnShortValue,encryptionBigInteger.prototype.signum=bnSigNum,encryptionBigInteger.prototype.toByteArray=bnToByteArray,encryptionBigInteger.prototype.equals=bnEquals,encryptionBigInteger.prototype.min=bnMin,encryptionBigInteger.prototype.max=bnMax,encryptionBigInteger.prototype.and=bnAnd,encryptionBigInteger.prototype.or=bnOr,encryptionBigInteger.prototype.xor=bnXor,encryptionBigInteger.prototype.andNot=bnAndNot,encryptionBigInteger.prototype.not=bnNot,encryptionBigInteger.prototype.shiftLeft=bnShiftLeft,encryptionBigInteger.prototype.shiftRight=bnShiftRight,encryptionBigInteger.prototype.getLowestSetBit=bnGetLowestSetBit,encryptionBigInteger.prototype.bitCount=bnBitCount,encryptionBigInteger.prototype.testBit=bnTestBit,encryptionBigInteger.prototype.setBit=bnSetBit,encryptionBigInteger.prototype.clearBit=bnClearBit,encryptionBigInteger.prototype.flipBit=bnFlipBit,encryptionBigInteger.prototype.add=bnAdd,encryptionBigInteger.prototype.subtract=bnSubtract,encryptionBigInteger.prototype.multiply=bnMultiply,encryptionBigInteger.prototype.divide=bnDivide,encryptionBigInteger.prototype.remainder=bnRemainder,encryptionBigInteger.prototype.divideAndRemainder=bnDivideAndRemainder,encryptionBigInteger.prototype.modPow=bnModPow,encryptionBigInteger.prototype.modInverse=bnModInverse,encryptionBigInteger.prototype.pow=bnPow,encryptionBigInteger.prototype.gcd=bnGCD,encryptionBigInteger.prototype.isProbablePrime=bnIsProbablePrime,encryptionBigInteger.prototype.square=bnSquare;function Arcfour(){this.i=0,this.j=0,this.S=new Array}function ARC4init(i){var t,s,h;for(t=0;t<256;++t)this.S[t]=t;for(s=0,t=0;t<256;++t)s=s+this.S[t]+i[t%i.length]&255,h=this.S[t],this.S[t]=this.S[s],this.S[s]=h;this.i=0,this.j=0}function ARC4next(){var i;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,i=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=i,this.S[i+this.S[this.i]&255]}function prng_newstate(){return new Arcfour}Arcfour.prototype.init=ARC4init,Arcfour.prototype.next=ARC4next;var rng_psize=256;var rng_state,rng_pool,rng_pptr;function rng_seed_int(r){rng_pool[rng_pptr++]^=255&r,rng_pool[rng_pptr++]^=r>>8&255,rng_pool[rng_pptr++]^=r>>16&255,rng_pool[rng_pptr++]^=r>>24&255,rng_pptr>=rng_psize&&(rng_pptr-=rng_psize)}function rng_seed_time(){rng_seed_int((new Date).getTime())}if(null==rng_pool){var t;if(rng_pool=new Array,rng_pptr=0,"Netscape"==navigator.appName&&navigator.appVersion<"5"&&window.crypto){var z=window.crypto.random(32);for(t=0;t<z.length;++t)rng_pool[rng_pptr++]=255&z.charCodeAt(t)}for(;rng_pptr<rng_psize;)t=Math.floor(65536*Math.random()),rng_pool[rng_pptr++]=t>>>8,rng_pool[rng_pptr++]=255&t;rng_pptr=0,rng_seed_time()}function rng_get_byte(){if(null==rng_state){for(rng_seed_time(),(rng_state=prng_newstate()).init(rng_pool),rng_pptr=0;rng_pptr<rng_pool.length;++rng_pptr)rng_pool[rng_pptr]=0;rng_pptr=0}return rng_state.next()}function rng_get_bytes(r){var n;for(n=0;n<r.length;++n)r[n]=rng_get_byte()}function SecureRandom(){}SecureRandom.prototype.nextBytes=rng_get_bytes;function sha1Hash(r){for(var t=[1518500249,1859775393,2400959708,3395469782],o=(r+=String.fromCharCode(128)).length/4+2,e=Math.ceil(o/16),a=new Array(e),n=0;n<e;n++){a[n]=new Array(16);for(var h=0;h<16;h++)a[n][h]=r.charCodeAt(64*n+4*h)<<24|r.charCodeAt(64*n+4*h+1)<<16|r.charCodeAt(64*n+4*h+2)<<8|r.charCodeAt(64*n+4*h+3)}a[e-1][14]=8*(r.length-1)/Math.pow(2,32),a[e-1][14]=Math.floor(a[e-1][14]),a[e-1][15]=8*(r.length-1)&4294967295;var c,u,i,s,S,A=1732584193,H=4023233417,l=2562383102,v=271733878,x=3285377520,C=new Array(80);for(n=0;n<e;n++){for(var d=0;d<16;d++)C[d]=a[n][d];for(d=16;d<80;d++)C[d]=ROTL(C[d-3]^C[d-8]^C[d-14]^C[d-16],1);c=A,u=H,i=l,s=v,S=x;for(d=0;d<80;d++){var g=Math.floor(d/20),w=ROTL(c,5)+f(g,u,i,s)+S+t[g]+C[d]&4294967295;S=s,s=i,i=ROTL(u,30),u=c,c=w}A=A+c&4294967295,H=H+u&4294967295,l=l+i&4294967295,v=v+s&4294967295,x=x+S&4294967295}return A.toHexStr()+H.toHexStr()+l.toHexStr()+v.toHexStr()+x.toHexStr()}function f(r,t,o,e){switch(r){case 0:return t&o^~t&e;case 1:case 3:return t^o^e;case 2:return t&o^t&e^o&e}}function ROTL(r,t){return r<<t|r>>>32-t}Number.prototype.toHexStr=function(){for(var r="",t=7;t>=0;t--)r+=(this>>>4*t&15).toString(16);return r};function pack(r){for(var t="",n=0;n<r.length;n+=2)t+=String.fromCharCode(parseInt(r.substring(n,n+2),16));return t}function char2hex(r){for(var t="",n=0;n<r.length;n+=1){switch(temp=r[n].toString(16),temp.length){case 1:temp="0"+temp;break;case 0:temp="00"}t+=temp}return t}function xor(r,t){length=Math.min(r.length,t.length),temp="";for(var n=0;n<length;n++)temp+=String.fromCharCode(r.charCodeAt(n)^t.charCodeAt(n));length=Math.max(r.length,t.length)-length;for(n=0;n<length;n++)temp+="\0";return temp}function mgf1(r,n){t="",hLen=20,count=Math.ceil(n/hLen);for(var e=0;e<count;e++)c=String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e),t+=pack(sha1Hash(r+c));return t.substring(0,n)}function rsa_oaep_encrypt(r,t,n){for(var e="Ú9£î^kK\r2U¿ï•`¯Ø\t",o=128-r.length-40-2,a=0;a<o;a++)e+="\0";var g=e+""+r,h="";for(a=0;a<24;a+=4)o=new Array(4),rng.nextBytes(o),h+=String.fromCharCode(o[0],o[1],o[2],o[3]);var i=xor(g,mgf1(h=h.substring(4-h.length%4),107)),f="\0"+xor(h,mgf1(i,20))+i;for(m=new Array,a=0;a<f.length;a++)m[a]=f.charCodeAt(a);return m=new encryptionBigInteger(m,256),c=m.modPowInt(n,t),c=c.toString(16),1&c.length&&(c="0"+c),c}function RSA_public_encrypt(r,t){for(var n=new Uint8Array(t),e=new Array(129),o=0;o<129;o++)e[o]=n[28+o];var a=new encryptionBigInteger(e),g=new encryptionBigInteger("010001",16);return rsa_oaep_encrypt(r+String.fromCharCode(0),a,g)}rng=new SecureRandom;var SWCanvas=function(t){this.arr=new ArrayBuffer(t.width*t.height*4),this.arr32=new Uint32Array(this.arr),this.arr8=new Uint8ClampedArray(this.arr),this.canvas=t,this.width=this.canvas.width,this.height=this.canvas.height};SWCanvas.prototype.putImageData=function(t,a,r){for(var i,h,e=t.data.buffer,s=t.width,n=t.height,o=this.width;n--;)i=(r+n)*o+a,h=new Uint32Array(e,s*n*4,s),this.arr32.set(h,i)},SWCanvas.prototype.getImageData=function(t,a,r,i){for(var h,e=new Uint32Array(r*i),s=this.arr32,n=i,o=this.width;n--;){h=(a+n)*o+t;var f=s.subarray(h,h+r);e.set(f,r*n)}return new ImageData(new Uint8ClampedArray(e.buffer),r,i)},SWCanvas.prototype.fillRect=function(t,a,r,i,h,e,s){for(var n,o=new Uint32Array(e),f=4278190080|t|a<<8|r<<16,v=this.width,w=e;w--;)o[w]=f;for(;s--;)n=(h+s)*v+i,this.arr32.set(o,n)},SWCanvas.prototype.flushBack=function(){var t=this.canvas.getContext("2d").getImageData(0,0,this.width,this.height).data;this.arr8.set(t)},SWCanvas.prototype.flush=function(){var t=new ImageData(this.arr8,this.width,this.height);this.canvas.getContext("2d").putImageData(t,0,0)};!function(e,i){"undefined"!=typeof module&&module.exports?module.exports.browser=i():this.bowser=i()}(0,(function(){var e=!0;function i(i){function o(e){var o=i.match(e);return o&&o.length>1&&o[1]||""}var s,r=o(/(ipod|iphone|ipad)/i).toLowerCase(),n=!/like android/i.test(i)&&/android/i.test(i),a=o(/version\/(\d+(\.\d+)?)/i),t=/tablet/i.test(i),d=!t&&/[^-]mobi/i.test(i);/opera|opr/i.test(i)?s={name:"Opera",opera:e,version:a||o(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i)}:/windows phone/i.test(i)?s={name:"Windows Phone",windowsphone:e,msie:e,version:o(/iemobile\/(\d+(\.\d+)?)/i)}:/msie|trident/i.test(i)?s={name:"Internet Explorer",msie:e,version:o(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:/chrome|crios|crmo/i.test(i)?s={name:"Chrome",chrome:e,version:o(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:r?(s={name:"iphone"==r?"iPhone":"ipad"==r?"iPad":"iPod"},a&&(s.version=a)):/sailfish/i.test(i)?s={name:"Sailfish",sailfish:e,version:o(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(i)?s={name:"SeaMonkey",seamonkey:e,version:o(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel/i.test(i)?(s={name:"Firefox",firefox:e,version:o(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(i)&&(s.firefoxos=e)):/silk/i.test(i)?s={name:"Amazon Silk",silk:e,version:o(/silk\/(\d+(\.\d+)?)/i)}:n?s={name:"Android",version:a}:/phantom/i.test(i)?s={name:"PhantomJS",phantom:e,version:o(/phantomjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(i)||/rim\stablet/i.test(i)?s={name:"BlackBerry",blackberry:e,version:a||o(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:/(web|hpw)os/i.test(i)?(s={name:"WebOS",webos:e,version:a||o(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(i)&&(s.touchpad=e)):s=/bada/i.test(i)?{name:"Bada",bada:e,version:o(/dolfin\/(\d+(\.\d+)?)/i)}:/tizen/i.test(i)?{name:"Tizen",tizen:e,version:o(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||a}:/safari/i.test(i)?{name:"Safari",safari:e,version:a}:{},/(apple)?webkit/i.test(i)?(s.name=s.name||"Webkit",s.webkit=e,!s.version&&a&&(s.version=a)):!s.opera&&/gecko\//i.test(i)&&(s.name=s.name||"Gecko",s.gecko=e,s.version=s.version||o(/gecko\/(\d+(\.\d+)?)/i)),n||s.silk?s.android=e:r&&(s[r]=e,s.ios=e);var m="";r?m=(m=o(/os (\d+([_\s]\d+)*) like mac os x/i)).replace(/[_\s]/g,"."):n?m=o(/android[ \/-](\d+(\.\d+)*)/i):s.windowsphone?m=o(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):s.webos?m=o(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):s.blackberry?m=o(/rim\stablet\sos\s(\d+(\.\d+)*)/i):s.bada?m=o(/bada\/(\d+(\.\d+)*)/i):s.tizen&&(m=o(/tizen[\/\s](\d+(\.\d+)*)/i)),m&&(s.osversion=m);var v=m.split(".")[0];return t||"ipad"==r||n&&(3==v||4==v&&!d)||s.silk?s.tablet=e:(d||"iphone"==r||"ipod"==r||n||s.blackberry||s.webos||s.bada)&&(s.mobile=e),s.msie&&s.version>=9||s.chrome&&s.version>=20||s.firefox&&s.version>=10||s.safari&&s.version>=5||s.opera&&s.version>=10||s.ios&&s.osversion&&s.osversion.split(".")[0]>=6?s.a=e:s.msie&&s.version<9||s.chrome&&s.version<20||s.firefox&&s.version<10||s.safari&&s.version<5||s.opera&&s.version<10||s.ios&&s.osversion&&s.osversion.split(".")[0]<6?s.c=e:s.x=e,s}var o=i("undefined"!=typeof navigator?navigator.userAgent:"");return o._detect=i,window.bowser||(window.bowser=o),o}));wdi.Flipper={flip:function(e){return this._handMadeFlip(e)},_handMadeFlip:function(e){var t=document.createElement("canvas");t.width=e.width,t.height=e.height;var a=t.getContext("2d");return a.save(),a.scale(1,-1),a.drawImage(e,0,-e.height),a.restore(),t}};wdi.CollisionDetector={thereIsBoxCollision:function(t,o){return!(t.bottom<o.top)&&(!(t.top>o.bottom)&&(!(t.right<o.left)&&t.left<o.right))}};wdi.GlobalPool={pools:{},retained:null,init:function(){this.retained={};var e=this;this.pools.ViewQueue=new wdi.GenericObjectPool([function(){return new wdi.ViewQueue},function(e,n){e.poolIndex=n,e.setData([])}]),this.pools.RawSpiceMessage=new wdi.GenericObjectPool([function(){return new wdi.RawSpiceMessage},function(e,n){e.poolIndex=n,e.set(null,null,null)}]),this.retained.Image=[],this.pools.Image=new wdi.GenericObjectPool([function(){return new Image},function(n,i){n.poolIndex=i,n.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",n.onload=null,n.keepAlive=!1,e.retained.Image[i]=n}]),this.retained.Canvas=[],this.pools.Canvas=new wdi.GenericObjectPool([function(){return e.createCanvas()},function(n,i){n.keepAlive=!1,n.poolIndex=i,e.retained.Canvas[i]=n}])},dispose:function(){var e=this;Object.keys(this.retained).forEach((function(n){e.cleanPool(n),e.retained[n].length=0})),Object.keys(this.pools).forEach((function(n){e.pools[n].dispose()})),this.pools={},this.retained=null},createCanvas:function(){return $("<canvas/>")[0]},create:function(e){return this.pools[e].create()},discard:function(e,n){return this.retained.hasOwnProperty(e)&&delete this.retained[e][n.poolIndex],this.pools[e].discard(n.poolIndex)},cleanPool:function(e){if(this.retained.hasOwnProperty(e)){var n=this.pools[e];for(var i in this.retained[e])n.discard(this.retained[e][i].poolIndex)&&delete this.retained[e][i]}else wdi.Debug.error("GlobalPool: cleanPool called with invalid objectType: ",e)}};wdi.GenericObjectPool=$.spcExtend(wdi.EventObject.prototype,{expandFactor:.2,expandMinUnits:16,elems:null,freeElems:null,allocator:null,resetor:null,init:function(e){var t=e[0],s=e[1];this.allocator=t,this.resetor=s,this.elems=[this.allocator()],this.freeElems=[0]},dispose:function(){this.elems=null,this.freeElems=null,this.allocator=null,this.resetor=null},create:function(){this.freeElems.length||this.expand();var e=this.freeElems.pop(),t=this.elems[e];return this.resetor(t,e),t},length:function(){return this.elems.length-this.freeElems.length},expand:function(){var e=this.elems.length,t=Math.ceil(this.elems.length*this.expandFactor);t<this.expandMinUnits&&(t=this.expandMinUnits),this.elems.length=this.elems.length+t;for(var s=e;s<this.elems.length;s++)this.elems[s]=this.allocator(),this.freeElems.push(s)},discard:function(e){if(this.freeElems.indexOf(e)>=0)throw"GeneircObjectPool: Double-free for element index: "+e;return!this.elems[e].keepAlive&&(this.freeElems.push(e),!0)},get:function(e){return this.elems[e]}});wdi.AsyncConsumer=$.spcExtend(wdi.EventObject.prototype,{worker:null,task:null,packetWorkerIdentifier:null,imageProperties:null,disposed:!1,init:function(e){this.superInit(),this.worker=e.AsyncWorker||new wdi.AsyncWorker({script:wdi.spiceClientPath+"/spice-console-minify/WorkerProcess.min.js"}),this.packetWorkerIdentifier=e.packetWorkerIdentifier||new wdi.PacketWorkerIdentifier},consume:function(e){this.task=e;var t,i,r,s,a,n,o,p=e.message,d=this.packetWorkerIdentifier.shouldUseWorker(p);if(d==wdi.PacketWorkerIdentifier.processingType.DECOMPRESS&&(t=this.packetWorkerIdentifier.getImageProperties(p),this.imageProperties=t,t&&t.descriptor.type!=wdi.SpiceImageType.SPICE_IMAGE_TYPE_LZ_RGB&&t.descriptor.type!=wdi.SpiceImageType.SPICE_IMAGE_TYPE_QUIC?d=0:t||(d=0)),0!==d)if(d==wdi.PacketWorkerIdentifier.processingType.DECOMPRESS){if(i=t.data,r=t.descriptor,s=t.opaque,a=t.brush,r.type===wdi.SpiceImageType.SPICE_IMAGE_TYPE_LZ_RGB){var h=null;if(a)h=wdi.LZSS.demarshall_rgb(i);else{var k=i.subarray(0,32).toJSArray();i=i.subarray(32),h=wdi.LZSS.demarshall_rgb(k)}n=new ArrayBuffer(i.length+16),(o=new Uint8Array(n))[0]=1,o[1]=s,o[2]=h.type,o[3]=h.top_down;for(var w=h.width*h.height*4,c=0;c<4;c++)o[4+c]=255&w,w>>=8;(l=new DataView(n)).setUint32(8,h.width),l.setUint32(12,h.height),o.set(i,16),this.worker.run(n,this._workerCompleted,{type:"lz",top_down:h.top_down,opaque:s},this)}else if(r.type===wdi.SpiceImageType.SPICE_IMAGE_TYPE_QUIC){var l,g=new ArrayBuffer(i.length+4);(l=new Uint8Array(g)).set(i,4),l[1]=s?1:0,l[0]=0,this.worker.run(g,this._workerCompleted,{type:"quic"},this)}}else d==wdi.PacketWorkerIdentifier.processingType.PROCESSVIDEO&&(i=this.packetWorkerIdentifier.getVideoData(p),n=new ArrayBuffer(i.length+4),(o=new Uint8Array(n))[0]=2,o[1]=0,o[2]=0,o[3]=0,o.set(i,4),this.worker.run(n,(function(e,t){p.args.data=e,this.taskDone()}),null,this));else this.taskDone()},_workerCompleted:function(e,t){if(e){var i=this.imageProperties.descriptor,r=new Uint8ClampedArray(e),s=new ImageData(r,i.width,i.height),a=s;if("lz"===t.type){var n=t.top_down,o=t.opaque;n||o||(a=wdi.graphics.getImageFromData(s,!0),a=wdi.RasterOperation.flip(a))}i.originalType=i.type,i.type=wdi.SpiceImageType.SPICE_IMAGE_TYPE_CANVAS,this.task.message.messageType===wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_FILL?(this.task.message.args.brush.pattern.imageData=a,this.task.message.args.brush.pattern.image.type=wdi.SpiceImageType.SPICE_IMAGE_TYPE_CANVAS):this.task.message.args.image.data=a,this.taskDone()}else this.taskDone()},taskDone:function(){this.task.state=1,this.fire("done",this)},dispose:function(){this.disposed||(this.disposed=!0,this.worker.dispose(),this.worker=null,this.task=null,this.packetWorkerIdentifier=null,this.imageProperties=null)}});wdi.AsyncWorker=$.spcExtend(wdi.EventObject.prototype,{worker:null,fn:null,scope:null,params:null,callback:null,init:function(s){this.superInit(),this.worker=new Worker(s.script);var t=this;this.callback=function(s){t.fn.call(t.scope,s.data,t.params)},this.worker.addEventListener("message",this.callback)},run:function(s,t,e,i){this.fn=t,this.scope=i,this.params=e,wdi.postMessageW3CCompilant?this.worker.postMessage(s,[s]):this.worker.postMessage(s)},dispose:function(){this.worker.removeEventListener("message",this.callback),this.worker.terminate(),this.worker=null,this.fn=null,this.scope=null,this.params=null,this.callback=null}});wdi.PacketWorkerIdentifier=$.spcExtend(wdi.EventObject.prototype,{init:function(e){},dispose:function(){},shouldUseWorker:function(e){switch(e.messageType){case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_COPY:return wdi.PacketWorkerIdentifier.processingType.DECOMPRESS;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_FILL:if(e.args.brush.type===wdi.SpiceBrushType.SPICE_BRUSH_TYPE_PATTERN)return wdi.PacketWorkerIdentifier.processingType.DECOMPRESS;break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND:case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_BLEND:case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_TRANSPARENT:return wdi.PacketWorkerIdentifier.processingType.DECOMPRESS}return 0},getImageProperties:function(e){var r={data:null,descriptor:null,opaque:!0,brush:null};switch(e.messageType){case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_COPY:r.descriptor=e.args.image.imageDescriptor,r.data=e.args.image.data;break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_FILL:if(r.brush=e.args.brush,r.brush.type!==wdi.SpiceBrushType.SPICE_BRUSH_TYPE_PATTERN)return!1;r.descriptor=r.brush.pattern.image,r.data=r.brush.pattern.imageData;break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND:case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_BLEND:case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_TRANSPARENT:r.data=e.args.image.data,r.descriptor=e.args.image.imageDescriptor,r.opaque=!1;break;default:return wdi.Debug.log("PacketWorkerIdentifier: Unknown Packet in getImageProperties"),!1}return r},getVideoData:function(e){return e.messageType!==wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DATA?(wdi.Debug.log("PacketWOrkerIdentifier: Invalid packet in getVideoData"),!1):e.args.data}}),wdi.PacketWorkerIdentifier.processingType={},wdi.PacketWorkerIdentifier.processingType.DECOMPRESS=1,wdi.PacketWorkerIdentifier.processingType.PROCESSVIDEO=2;wdi.SpiceObject={properties:{},bytesToString:function(t){const e=new Uint8Array(t);return new TextDecoder("utf-8").decode(e)},bytesToURI:function(t){var e=new Blob([t],{type:"image/jpeg"});return URL.createObjectURL(e)},bytesToStringBE:function(t,e){for(var i="",s=e||t.length;s>=0;s--)i+=String.fromCharCode(t[s]);return i},bytesToInt8:function(t){return t.shift()},bytesToInt8NoAllocate:function(t){var e=t.getByte(0);return t.eatBytes(1),e},bytesToInt16:function(t){var e=t.shift();return t.shift()*Math.pow(16,2)+e},bytesToInt16BE:function(t){var e=t.shift(),i=t.shift();return e*Math.pow(16,2)+i},bytesToInt32:function(t){var e=wdi.SpiceObject.bytesToInt16(t);return wdi.SpiceObject.bytesToInt16(t)*Math.pow(16,4)+e},bytesToInt16NoAllocate:function(t){var e=t.getByte(0),i=t.getByte(1);return t.eatBytes(2),i*Math.pow(16,2)+e},bytesToInt32NoAllocate:function(t){var e=wdi.SpiceObject.bytesToInt16NoAllocate(t);return wdi.SpiceObject.bytesToInt16NoAllocate(t)*Math.pow(16,4)+e},bytesToInt32BE:function(t){var e=wdi.SpiceObject.bytesToInt16BE(t),i=wdi.SpiceObject.bytesToInt16BE(t);return e*Math.pow(16,4)+i},bytesToInt64:function(t){var e=wdi.SpiceObject.bytesToInt32(t).toString(2).lpad("0",32),i=wdi.SpiceObject.bytesToInt32(t).toString(2).lpad("0",32);return BigInteger.parse(i+e,2)},bytesToInt64NoAllocate:function(t){var e=wdi.SpiceObject.bytesToInt32NoAllocate(t).toString(2).lpad("0",32),i=wdi.SpiceObject.bytesToInt32NoAllocate(t).toString(2).lpad("0",32);return BigInteger.parse(i+e,2)},bytesToInt64BE:function(t){var e=wdi.SpiceObject.bytesToInt32BE(t).toString(2).lpad("0",32),i=wdi.SpiceObject.bytesToInt32BE(t).toString(2).lpad("0",32);return BigInteger.parse(e+i,2)},bytesToArray:function(t,e,i,s){var n=t.length,o=i||n,h=s||"LE",a=[],r=null;switch(e){case 8:r=wdi.SpiceObject.bytesToInt8;break;case 16:r="LE"==h?wdi.SpiceObject.bytesToInt16:wdi.SpiceObject.bytesToInt16BE;break;case 32:r="LE"==h?wdi.SpiceObject.bytesToInt32:wdi.SpiceObject.bytesToInt32BE;break;case 64:r="LE"==h?wdi.SpiceObject.bytesToInt64:wdi.SpiceObject.bytesToInt64BE;break;default:throw new Exception("Not supported number of bits",1)}for(var c=0;c<o;c++)a=a.concat(r(t));return a},int32ToDouble:function(t){return(15&t)/15+wdi.SpiceObject.unsignedToSigned(t>>4)},unsignedToSigned:function(t,e){var i=Math.pow(2,e)-1;return t&Math.pow(2,e-1)&&(t=-1*(i-t)),t},arrayToBytes:function(t,e,i){var s=t.length,n=i||s,o=null,h=[];switch(e){case 8:o=wdi.SpiceObject.numberTo8;break;case 16:o=wdi.SpiceObject.numberTo16;break;case 32:o=wdi.SpiceObject.numberTo32;break;case 64:o=wdi.SpiceObject.numberTo64;break;default:throw new Exception("Not supported number of bits",1)}for(var a=0;a<n;a++)a<=s?h=h.concat(o(t[a])):h.push(0);return h},stringToBytes:function(t){for(var e=[],i=0;i<t.length;i++){var s=t.charCodeAt(i);s<128?e.push(s):s<2048?e.push(192|s>>6,128|63&s):s<55296||s>=57344?e.push(224|s>>12,128|s>>6&63,128|63&s):(i++,s=65536+((1023&s)<<10|1023&t.charCodeAt(i)),e.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|63&s))}return e},arrayBufferToBytes:function(t){return new Uint8Array(t).toJSArray()},stringHexToBytes:function(t){for(var e=t.length,i=[],s=0;s<e;s+=2)i.push(parseInt(t[s]+t[s+1],16));return i},stringBinaryToBytes:function(t,e){t=t.lpad("0",e);for(var i=[],s=e;s>=8;s-=8)i=i.concat(parseInt(t.substr(s-8,8),2));return i},stringToBytesPadding:function(t,e){for(var i=[],s=t.length,n=0;n<e;n++)e>s-1?i.push(0):i.push(t.charCodeAt(n));return i},numberTo64:function(t){var e=this.numberTo32((0x10000000000000000&t)>>32);return this.numberTo32(4294967295&t).concat(e)},numberTo32:function(t){for(var e=new Array(3),i=0;i<4;i++)e[i]=255&t,t>>=8;return e},numberTo16:function(t){for(var e=new Array(1),i=0;i<2;i++)e[i]=255&t,t>>=8;return e},numberTo8:function(t){return[255&t]},getMessageProperties:function(){return this.properties},getMessageProperty:function(t,e){return this.properties.hasOwnProperty(t)?this.properties[t]:e}},wdi.SpiceDataHeader=$.spcExtend(wdi.SpiceObject,{objectSize:6,init:function(t){t&&this.setContent(t)},setContent:function(t){this.type=t.type,this.size=t.size},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo16(this.type),this.numberTo32(this.size)),this.rawData},demarshall:function(t){return this.type=this.bytesToInt16NoAllocate(t),this.size=this.bytesToInt32NoAllocate(t),this}}),wdi.SpiceCompatibility=$.spcExtend(wdi.SpiceObject,{init:function(t){t&&this.setContent(t)},setContent:function(t){this.channel_type=t.channel_type,this.caps=t.caps},marshall:function(){return this.rawData=[],this.rawData=[this.numberTo8(this.channel_type),...this.caps.map((t=>this.numberTo32(t)))],this.rawData},demarshall:function(t){}}),wdi.SpiceLinkAuthMechanism=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.auth_mechanism=t.auth_mechanism},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.auth_mechanism)),this.rawData},demarshall:function(t){if(this.expectedSize=arguments[1]||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.auth_mechanism=this.bytesToInt32NoAllocate(t),"customDemarshall"in this&&this.customDemarshall(t),this}}),wdi.SpiceLinkReply=$.spcExtend(wdi.SpiceObject,{objectSize:178,init:function(t){t&&this.setContent(t)},setContent:function(t){this.error=t.error,this.pub_key=t.pub_key,this.num_common_caps=t.num_common_caps,this.num_channel_caps=t.num_channel_caps,this.caps_offset=t.caps_offset},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.error),this.arrayToBytes(this.pub_key,8),this.numberTo32(this.num_common_caps),this.numberTo32(this.num_channel_caps),this.numberTo32(this.caps_offset)),this.rawData},demarshall:function(t){if(this.expectedSize=arguments[1]||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.error=this.bytesToInt32NoAllocate(t),this.pub_key=this.bytesToArray(t.shift(this.expectedSize),8),this.num_common_caps=this.bytesToInt32NoAllocate(t),this.num_channel_caps=this.bytesToInt32NoAllocate(t),this.caps_offset=this.bytesToInt32NoAllocate(t),"customDemarshall"in this&&this.customDemarshall(t),this}}),wdi.SpiceLinkEncryptedTicket=$.spcExtend(wdi.SpiceObject,{objectSize:128,init:function(t){t&&this.setContent(t)},setContent:function(t){this.encrypted_data=t.encrypted_data},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.stringToBytes(this.encrypted_data,8)),this.rawData},demarshall:function(t){if(this.expectedSize=arguments[1]||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.encrypted_data=this.bytesToArray(t.shift(this.expectedSize),8),"customDemarshall"in this&&this.customDemarshall(t),this}}),wdi.SpiceLinkMess=$.spcExtend(wdi.SpiceObject,{objectSize:18,init:function(t){t&&this.setContent(t)},setContent:function(t){this.connection_id=t.connection_id,this.channel_type=t.channel_type,this.channel_id=t.channel_id,this.num_common_caps=t.num_common_caps,this.num_channel_caps=t.num_channel_caps,this.caps_offset=t.caps_offset,this.common_caps=t.common_caps,this.channel_caps=t.channel_caps},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.connection_id),this.numberTo8(this.channel_type),this.numberTo8(this.channel_id),this.numberTo32(this.num_common_caps),this.numberTo32(this.num_channel_caps),this.numberTo32(this.caps_offset)),this.num_common_caps>0&&(this.rawData=this.rawData.concat(this.numberTo32(this.common_caps))),this.num_channel_caps>0&&(this.rawData=this.rawData.concat(this.numberTo32(this.channel_caps))),this.rawData},demarshall:function(t){if(this.expectedSize=arguments[1]||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.connection_id=this.bytesToInt32NoAllocate(t),this.channel_type=this.bytesToInt8NoAllocate(t),this.channel_id=this.bytesToInt8NoAllocate(t),this.num_common_caps=this.bytesToInt32NoAllocate(t),this.num_channel_caps=this.bytesToInt32NoAllocate(t),this.caps_offset=this.bytesToInt32NoAllocate(t),"customDemarshall"in this&&this.customDemarshall(t),this}}),wdi.SpiceLinkHeader=$.spcExtend(wdi.SpiceObject,{objectSize:16,init:function(t){t&&this.setContent(t)},setContent:function(t){this.magic=t.magic,this.major_version=t.major_version,this.minor_version=t.minor_version,this.size=t.size},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.magic),this.numberTo32(this.major_version),this.numberTo32(this.minor_version),this.numberTo32(this.size)),this.rawData},demarshall:function(t){if(this.expectedSize=arguments[1]||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.magic=this.bytesToInt32NoAllocate(t),this.major_version=this.bytesToInt32NoAllocate(t),this.minor_version=this.bytesToInt32NoAllocate(t),this.size=this.bytesToInt32NoAllocate(t),"customDemarshall"in this&&this.customDemarshall(t),this}}),wdi.RedMigrateData=$.spcExtend(wdi.SpiceObject,{objectSize:0,init:function(t){t&&this.setContent(t)},setContent:function(t){this.vector=t.vector},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.arrayToBytes(this.vector,8)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.vector=this.bytesToArray(t.shift(this.expectedSize),8),this}}),wdi.RedMainInit=$.spcExtend(wdi.SpiceObject,{objectSize:32,init:function(t){t&&this.setContent(t)},setContent:function(t){this.session_id=t.session_id,this.display_channels_hint=t.display_channels_hint,this.supported_mouse_modes=t.supported_mouse_modes,this.current_mouse_mode=t.current_mouse_mode,this.agent_connected=t.agent_connected,this.agent_tokens=t.agent_tokens,this.multi_media_time=t.multi_media_time,this.ram_hint=t.ram_hint},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.session_id),this.numberTo32(this.display_channels_hint),this.numberTo32(this.supported_mouse_modes),this.numberTo32(this.current_mouse_mode),this.numberTo32(this.agent_connected),this.numberTo32(this.agent_tokens),this.numberTo32(this.multi_media_time),this.numberTo32(this.ram_hint)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.session_id=this.bytesToInt32NoAllocate(t),this.display_channels_hint=this.bytesToInt32NoAllocate(t),this.supported_mouse_modes=this.bytesToInt32NoAllocate(t),this.current_mouse_mode=this.bytesToInt32NoAllocate(t),this.agent_connected=this.bytesToInt32NoAllocate(t),this.agent_tokens=this.bytesToInt32NoAllocate(t),this.multi_media_time=this.bytesToInt32NoAllocate(t),this.ram_hint=this.bytesToInt32NoAllocate(t),this}}),wdi.SpiceMsgMainAgentConnected=$.spcExtend(wdi.SpiceObject,{objectSize:0,init:function(t){t&&this.setContent(t)},setContent:function(t){},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this}}),wdi.SpiceChannelsList=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.num_of_channels=t.num_of_channels,this.channels=t.channels},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.num_of_channels),this.arrayToBytes(this.channels,16)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.num_of_channels=this.bytesToInt32NoAllocate(t),this.channels=this.bytesToArray(t.shift(this.expectedSize),16),this}}),wdi.RedSetAck=$.spcExtend(wdi.SpiceObject,{objectSize:8,init:function(t){t&&this.setContent(t)},setContent:function(t){this.generation=t.generation,this.window=t.window},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.generation),this.numberTo32(this.window)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.generation=this.bytesToInt32NoAllocate(t),this.window=this.bytesToInt32NoAllocate(t),this}}),wdi.RedPing=$.spcExtend(wdi.SpiceObject,{objectSize:12,init:function(t){t&&this.setContent(t)},setContent:function(t){this.id=t.id,this.time=t.time},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.id),this.numberTo64(this.time)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.id=this.bytesToInt32NoAllocate(t),this.time=this.bytesToInt64NoAllocate(t),this.expectedSize>12&&t.shift(this.expectedSize-12),this}}),wdi.RedMigrate=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.flags=t.flags},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.flags)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.flags=this.bytesToInt32NoAllocate(t),this}}),wdi.RedWaitForChannel=$.spcExtend(wdi.SpiceObject,{objectSize:10,init:function(t){t&&this.setContent(t)},setContent:function(t){this.type=t.type,this.id=t.id,this.serial=t.serial},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo8(this.type),this.numberTo8(this.id),this.numberTo64(this.serial)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.type=this.bytesToInt8NoAllocate(t),this.id=this.bytesToInt8NoAllocate(t),this.serial=this.bytesToInt64NoAllocate(t),this}}),wdi.RedWaitForChannels=$.spcExtend(wdi.SpiceObject,{objectSize:1,init:function(t){t&&this.setContent(t)},setContent:function(t){this.wait_count=t.wait_count,this.wait_list=t.wait_list},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo8(this.wait_count),this.arrayToBytes(this.wait_list,8)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.wait_count=this.bytesToInt8NoAllocate(t),this.wait_list=this.bytesToArray(t.shift(this.expectedSize),8),this}}),wdi.RedDisconnect=$.spcExtend(wdi.SpiceObject,{objectSize:12,init:function(t){t&&this.setContent(t)},setContent:function(t){this.time_stamp=t.time_stamp,this.reason=t.reason},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo64(this.time_stamp),this.numberTo32(this.reason)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.time_stamp=this.bytesToInt64NoAllocate(t),this.reason=this.bytesToInt32NoAllocate(t),this}}),wdi.RedMigrationBegin=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.port=t.port,this.sport=t.sport,this.host_name=t.host_name},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo16(this.port),this.numberTo16(this.sport),this.arrayToBytes(this.host_name,8)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.port=this.bytesToInt16NoAllocate(t),this.sport=this.bytesToInt16NoAllocate(t),this.host_name=this.bytesToArray(t.shift(this.expectedSize),8),this}}),wdi.RedNotify=$.spcExtend(wdi.SpiceObject,{objectSize:25,init:function(t){t&&this.setContent(t)},setContent:function(t){this.time_stamp=t.time_stamp,this.severity=t.severity,this.visibility=t.visibility,this.what=t.what,this.message_len=t.message_len,this.message=t.message,this.zero=t.zero},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo64(this.time_stamp),this.numberTo32(this.severity),this.numberTo32(this.visibility),this.numberTo32(this.what),this.numberTo32(this.message_len),this.arrayToBytes(this.message,8),this.numberTo8(this.zero)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.time_stamp=this.bytesToInt64NoAllocate(t),this.severity=this.bytesToInt32NoAllocate(t),this.visibility=this.bytesToInt32NoAllocate(t),this.what=this.bytesToInt32NoAllocate(t),this.message_len=this.bytesToInt32NoAllocate(t),this.message=this.bytesToString(t.shift(this.message_len)),this.zero=this.bytesToInt8NoAllocate(t),this}}),wdi.RedMode=$.spcExtend(wdi.SpiceObject,{objectSize:12,init:function(t){t&&this.setContent(t)},setContent:function(t){this.width=t.width,this.height=t.height,this.depth=t.depth},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.width),this.numberTo32(this.height),this.numberTo32(this.depth)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.width=this.bytesToInt32NoAllocate(t),this.height=this.bytesToInt32NoAllocate(t),this.depth=this.bytesToInt32NoAllocate(t),this}}),wdi.SpiceCDisplayInit=$.spcExtend(wdi.SpiceObject,{objectSize:14,init:function(t){t&&this.setContent(t)},setContent:function(t){this.pixmap_cache_id=t.pixmap_cache_id,this.pixmap_cache_size=t.pixmap_cache_size,this.glz_dictionary_id=t.glz_dictionary_id,this.glz_dictionary_window_size=t.glz_dictionary_window_size},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo8(this.pixmap_cache_id),this.numberTo8(0),this.numberTo8(127),this.numberTo8(0),this.numberTo8(0),this.numberTo8(0),this.numberTo8(0),this.numberTo8(0),this.numberTo8(0),this.numberTo8(this.glz_dictionary_id),this.numberTo32(this.glz_dictionary_window_size)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.pixmap_cache_id=this.bytesToInt8NoAllocate(t),this.pixmap_cache_size=this.bytesToInt64NoAllocate(t),this.glz_dictionary_id=this.bytesToInt8NoAllocate(t),this.glz_dictionary_window_size=this.bytesToInt32NoAllocate(t),this}}),wdi.SpiceSurfaceDestroy=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.surface_id=t.surface_id},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.surface_id)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.surface_id=this.bytesToInt32NoAllocate(t),this}}),wdi.SpiceSurface=$.spcExtend(wdi.SpiceObject,{objectSize:20,init:function(t){t&&this.setContent(t)},setContent:function(t){this.surface_id=t.surface_id,this.width=t.width,this.height=t.height,this.format=t.format,this.flags=t.flags},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.surface_id),this.numberTo32(this.width),this.numberTo32(this.height),this.numberTo32(this.format),this.numberTo32(this.flags)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.surface_id=this.bytesToInt32NoAllocate(t),this.width=this.bytesToInt32NoAllocate(t),this.height=this.bytesToInt32NoAllocate(t),this.format=this.bytesToInt32NoAllocate(t),this.flags=this.bytesToInt32NoAllocate(t),this}}),wdi.SpicePath=$.spcExtend(wdi.SpiceObject,{objectSize:4,marshall:function(){},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});var i=this.num_segments=this.bytesToInt32NoAllocate(t);this.segments=[];for(var s=0;s<i;s++)this.segments[s]=(new wdi.SpicePathSeg).demarshall(t);return this}}),wdi.SpicePathSeg=$.spcExtend(wdi.SpiceObject,{objectSize:8,marshall:function(){},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});this.flags=this.bytesToInt8NoAllocate(t);var i=this.count=this.bytesToInt32NoAllocate(t);this.points=[];for(var s=0;s<i;s++)this.points[s]=(new wdi.SpicePointFix).demarshall(t);return this}}),wdi.SpicePoint=$.spcExtend(wdi.SpiceObject,{objectSize:8,init:function(t){t&&this.setContent(t)},setContent:function(t){this.x=t.x,this.y=t.y},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.x),this.numberTo32(this.y)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.x=this.unsignedToSigned(this.bytesToInt32(t.shift(4)),32),this.y=this.unsignedToSigned(this.bytesToInt32(t.shift(4)),32),this}}),wdi.SpicePoint16=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.x=t.x,this.y=t.y},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo16(this.x),this.numberTo16(this.y)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.x=this.bytesToInt16NoAllocate(t),this.y=this.bytesToInt16NoAllocate(t),this}}),wdi.SpicePointFix=$.spcExtend(wdi.SpiceObject,{objectSize:8,init:function(t){t&&this.setContent(t)},setContent:function(t){this.x=t.hasOwnProperty("x")?t.x:0,this.y=t.hasOwnProperty("y")?t.y:0},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.x),this.numberTo32(this.y)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.x=this.int32ToDouble(this.bytesToInt32(t.shift(4)),32),this.y=this.int32ToDouble(this.bytesToInt32(t.shift(4)),32),this}}),wdi.SpiceRect=$.spcExtend(wdi.SpiceObject,{objectSize:16,init:function(t){t&&this.setContent(t)},setContent:function(t){this.top=t.top,this.left=t.left,this.bottom=t.bottom,this.right=t.right},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.top),this.numberTo32(this.left),this.numberTo32(this.bottom),this.numberTo32(this.right)),this.rawData},demarshall:function(t,e){return this.top=this.bytesToInt32NoAllocate(t),this.left=this.bytesToInt32NoAllocate(t),this.bottom=this.bytesToInt32NoAllocate(t),this.right=this.bytesToInt32NoAllocate(t),this}}),wdi.SpiceClipRects=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.num_rects=t.num_rects},marshall:function(){this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.num_rects));for(var t=0;t<this.num_rects;t++)this.rawData=this.rawData.concat(this.rects[t].marshall());return this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});if(this.num_rects=this.bytesToInt32NoAllocate(t),this.num_rects>0){this.rects=[];for(var i=0;i<this.num_rects;i++)this.rects[i]=(new wdi.SpiceRect).demarshall(t)}return this}}),wdi.SpiceClip=$.spcExtend(wdi.SpiceObject,{objectSize:1,init:function(t){t&&this.setContent(t)},setContent:function(t){this.type=t.type},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo8(this.type)),this.type==wdi.SpiceClipType.SPICE_CLIP_TYPE_RECTS&&(this.rawData=this.rawData.concat(this.rects.marshall())),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.type=this.bytesToInt8NoAllocate(t),this.type==wdi.SpiceClipType.SPICE_CLIP_TYPE_RECTS&&(this.rects=(new wdi.SpiceClipRects).demarshall(t)),this}}),wdi.SpiceDisplayBase=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.surface_id=t.surface_id},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.surface_id),this.box.marshall(),this.clip.marshall()),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.surface_id=this.bytesToInt32NoAllocate(t),this.box=(new wdi.SpiceRect).demarshall(t),this.clip=(new wdi.SpiceClip).demarshall(t),this}}),wdi.SpiceQMask=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){},marshall:function(){var t=[];return t=t.concat(this.numberTo8(this.flags),this.pos.marshall(),this.numberTo32(this.offset)),this.offset&&(t=t.concat(this.image.marshall())),t},demarshall:function(t,e){t.eatBytes(13)}}),wdi.SpiceImageDescriptor=$.spcExtend(wdi.SpiceObject,{objectSize:18,init:function(t){t&&this.setContent(t)},setContent:function(t){},marshall:function(){var t=[];return t=t.concat(this.numberTo64(this.id),this.numberTo8(this.type),this.numberTo8(this.flags),this.numberTo32(this.width),this.numberTo32(this.height))},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});var i=this.bytesToInt32NoAllocate(t);return this.id=i.toString(16)+this.bytesToInt32NoAllocate(t).toString(16),this.type=this.bytesToInt8NoAllocate(t),this.flags=this.bytesToInt8NoAllocate(t),this.width=this.bytesToInt32NoAllocate(t),this.height=this.bytesToInt32NoAllocate(t),this.offset=t.getPosition(),this}}),wdi.SpiceImage=$.spcExtend(wdi.SpiceObject,{objectSize:1,init:function(t){t&&this.setContent(t)},setContent:function(t){},marshall:function(){var t=[];return t=t.concat(this.imageDescriptor.marshall(),this.data)},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.imageDescriptor=(new wdi.SpiceImageDescriptor).demarshall(t),this.data=t.getRawData(),this}}),wdi.SpiceDrawCopy=$.spcExtend(wdi.SpiceObject,{objectSize:4,properties:{overWriteScreenArea:!0},init:function(t){t&&this.setContent(t)},setContent:function(t){this.offset=t.offset},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.base.marshall(),this.numberTo32(this.offset),this.src_area.marshall(),this.numberTo16(this.rop_descriptor),this.numberTo8(this.scale_mode),this.mask.marshall(),this.image.marshall()),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});if(this.base=(new wdi.SpiceDisplayBase).demarshall(t),this.offset=this.bytesToInt32NoAllocate(t),this.src_area=(new wdi.SpiceRect).demarshall(t),this.rop_descriptor=this.bytesToInt16NoAllocate(t),this.scale_mode=this.bytesToInt8NoAllocate(t),this.mask=(new wdi.SpiceQMask).demarshall(t),t.getPosition()==this.offset)this.image=(new wdi.SpiceImage).demarshall(t);else{var i=new wdi.ViewQueue;i.setData(t.getDataOffset(this.offset)),this.image=(new wdi.SpiceImage).demarshall(i)}return this}}),wdi.drawBlend=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.base=t.base,this.alpha_flags=t.alpha_flags,this.alpha=t.alpha,this.offset=t.offset,this.src_area=t.src_area},marshall:function(){var t=[];return t=t.concat(this.base.marshall(),this.numberTo32(this.offset),this.src_area.marshall(),this.numberTo16(this.rop_descriptor),this.numberTo8(this.flags),this.mask.marshall(),this.image.marshall())},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.base=(new wdi.SpiceDisplayBase).demarshall(t),this.offset=this.bytesToInt32NoAllocate(t),this.src_area=(new wdi.SpiceRect).demarshall(t),this.rop_descriptor=this.bytesToInt16NoAllocate(t),this.flags=this.bytesToInt8NoAllocate(t),this.mask=(new wdi.SpiceQMask).demarshall(t),this.image=(new wdi.SpiceImage).demarshall(t),this}}),wdi.drawAlphaBlend=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.base=t.base,this.alpha_flags=t.alpha_flags,this.alpha=t.alpha,this.offset=t.offset,this.src_area=t.src_area},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.base=(new wdi.SpiceDisplayBase).demarshall(t),this.alpha_flags=this.bytesToInt8NoAllocate(t),this.alpha=this.bytesToInt8NoAllocate(t),this.offset=this.bytesToInt32NoAllocate(t),this.src_area=(new wdi.SpiceRect).demarshall(t),this.image=(new wdi.SpiceImage).demarshall(t),this}}),wdi.drawTransparent=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.base=(new wdi.SpiceDisplayBase).demarshall(t),this.offset=this.bytesToInt32NoAllocate(t),this.src_area=(new wdi.SpiceRect).demarshall(t),this.transparent_color=(new wdi.SpiceColor).demarshall(t),this.transparent_true_color=(new wdi.SpiceColor).demarshall(t),this.image=(new wdi.SpiceImage).demarshall(t),this}}),wdi.SpiceCopyBits=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.offset=t.offset},marshall:function(){var t=[];return t=t.concat(this.base.marshall(),this.src_position.marshall())},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.base=(new wdi.SpiceDisplayBase).demarshall(t),this.src_position=(new wdi.SpicePoint).demarshall(t),this}}),wdi.SpiceImageLZRGB=$.spcExtend(wdi.SpiceObject,{objectSize:32,init:function(t){t&&this.setContent(t)},setContent:function(t){},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.length=this.bytesToInt32BE(t.shift(4)),this.magic=this.bytesToStringBE(t.shift(4)),this.version=this.bytesToInt32BE(t.shift(4)),this.type=this.bytesToInt32BE(t.shift(4)),this.width=this.bytesToInt32BE(t.shift(4)),this.height=this.bytesToInt32BE(t.shift(4)),this.stride=this.bytesToInt32BE(t.shift(4)),this.top_down=this.bytesToInt32BE(t.shift(4)),this.data=t.shift(this.length),this}}),wdi.SpiceMouseModeRequest=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.request_mode=t.request_mode},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.request_mode)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.request_mode=this.bytesToInt32NoAllocate(t),this}}),wdi.SpiceMouseMode=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.supported_modes=t.supported_modes,this.current_mode=t.current_mode},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.supported_modes),this.numberTo32(this.current_mode)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,!(t.getLength()<this.expectedSize))return this.supported_modes=this.bytesToInt16NoAllocate(t),this.current_mode=this.bytesToInt16NoAllocate(t),this}}),wdi.RedcMousePress=$.spcExtend(wdi.SpiceObject,{objectSize:3,init:function(t){t&&this.setContent(t)},setContent:function(t){this.button_id=t.button_id,this.buttons_state=t.buttons_state},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo8(this.button_id),this.numberTo16(this.buttons_state)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.button_id=this.bytesToInt8NoAllocate(t),this.buttons_state=this.bytesToInt16NoAllocate(t),this}}),wdi.RedcMousePosition=$.spcExtend(wdi.SpiceObject,{objectSize:11,init:function(t){t&&this.setContent(t)},setContent:function(t){this.x=t.x,this.y=t.y,this.buttons_state=t.buttons_state,this.display_id=t.display_id},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.x),this.numberTo32(this.y),this.numberTo16(this.buttons_state),this.numberTo8(this.display_id)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.x=this.bytesToInt32NoAllocate(t),this.y=this.bytesToInt32NoAllocate(t),this.buttons_state=this.bytesToInt16NoAllocate(t),this.display_id=this.bytesToInt8NoAllocate(t),this}}),wdi.RedcMouseMotion=$.spcExtend(wdi.SpiceObject,{objectSize:10,init:function(t){t&&this.setContent(t)},setContent:function(t){this.x=t.x,this.y=t.y,this.buttons_state=t.buttons_state},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.x),this.numberTo32(this.y),this.numberTo16(this.buttons_state)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.x=this.bytesToInt32NoAllocate(t),this.y=this.bytesToInt32NoAllocate(t),this.buttons_state=this.bytesToInt16NoAllocate(t),this}}),wdi.SpiceBrush=$.spcExtend(wdi.SpiceObject,{objectSize:8,init:function(t){t&&this.setContent(t)},setContent:function(t){this.type=t.type,this.color=t.color},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.type=this.bytesToInt8NoAllocate(t),this.type==wdi.SpiceBrushType.SPICE_BRUSH_TYPE_PATTERN?this.pattern=(new wdi.SpicePattern).demarshall(t):this.type==wdi.SpiceBrushType.SPICE_BRUSH_TYPE_SOLID&&(this.color=(new wdi.SpiceColor).demarshall(t)),this}}),wdi.SpiceColor=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){},marshall:function(){return[this.r,this.g,this.b]},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});this.data=16777215&this.bytesToInt32(t.shift(4)),this.r=this.data>>16,this.g=this.data>>8&255,this.b=255&this.data,this.html_color="rgb("+this.r+", "+this.g+", "+this.b+")";var i=this.r.toString(16),s=this.g.toString(16),n=this.b.toString(16);return i.length<2&&(i="0"+i),s.length<2&&(s="0"+s),n.length<2&&(n="0"+n),this.simple_html_color="#"+i+s+n,this}}),wdi.RgbaColor=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.data=4294967295&this.bytesToInt32(t.shift(4)),this.a=this.data>>>24,this.r=this.data>>>16&255,this.g=this.data>>>8&255,this.b=255&this.data,this.html_color="rgb("+this.r+", "+this.g+", "+this.b+")",this}}),wdi.SpicePattern=$.spcExtend(wdi.SpiceObject,{objectSize:12,init:function(t){t&&this.setContent(t)},setContent:function(t){},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});this.offset=this.bytesToInt32NoAllocate(t),this.point=(new wdi.SpicePoint).demarshall(t);var i=new wdi.ViewQueue;return i.setData(t.getDataOffset(this.offset)),this.image=(new wdi.SpiceImage).demarshall(i),this}}),wdi.SpiceDrawFill=$.spcExtend(wdi.SpiceObject,{objectSize:4,properties:{overWriteScreenArea:!0},init:function(t){t&&this.setContent(t)},setContent:function(t){this.offset=t.offset},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.offset)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.base=(new wdi.SpiceDisplayBase).demarshall(t),this.brush=(new wdi.SpiceBrush).demarshall(t),this.rop_descriptor=this.bytesToInt16NoAllocate(t),this.mask=(new wdi.SpiceQMask).demarshall(t),this.brush.type==wdi.SpiceBrushType.SPICE_BRUSH_TYPE_PATTERN&&(this.brush.pattern.image=(new wdi.SpiceImageDescriptor).demarshall(t),this.brush.pattern.imageData=t.getData()),this}}),wdi.SpiceDrawRop3=$.spcExtend(wdi.SpiceObject,{objectSize:4,marshall:function(){var t=[];return t=t.concat(this.base.marshall(),this.numberTo32(this.offset),this.src_area.marshall(),this.brush.marshall(),this.numberTo8(this.rop_descriptor),this.numberTo8(this.scale_mode),this.mask.marshall(),this.src_image.marshall()),this.brush.type==wdi.SpiceBrushType.SPICE_BRUSH_TYPE_PATTERN&&(t=t.concat(this.brush.pattern.image.marshall(),this.brush.pattern.imageData)),t},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.base=(new wdi.SpiceDisplayBase).demarshall(t),this.offset=this.bytesToInt32NoAllocate(t),this.src_area=(new wdi.SpiceRect).demarshall(t),this.brush=(new wdi.SpiceBrush).demarshall(t),this.rop_descriptor=this.bytesToInt8NoAllocate(t),this.scale_mode=this.bytesToInt8NoAllocate(t),this.mask=(new wdi.SpiceQMask).demarshall(t),this.src_image=(new wdi.SpiceImage).demarshall(t),this.brush.type==wdi.SpiceBrushType.SPICE_BRUSH_TYPE_PATTERN&&(this.brush.pattern.image=(new wdi.SpiceImageDescriptor).demarshall(t),this.brush.pattern.imageData=t.getData()),this}}),wdi.SpiceDrawBlackness=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.offset=t.offset},marshall:function(){var t=[];return t=t.concat(this.base.marshall(),this.mask.marshall())},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.base=(new wdi.SpiceDisplayBase).demarshall(t),this.mask=(new wdi.SpiceQMask).demarshall(t),this}}),wdi.SpiceDrawWhiteness=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.offset=t.offset},marshall:function(){var t=[];return t=t.concat(this.base.marshall(),this.mask.marshall())},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.base=(new wdi.SpiceDisplayBase).demarshall(t),this.mask=(new wdi.SpiceQMask).demarshall(t),this}}),wdi.SpiceScanCode=$.spcExtend(wdi.SpiceObject,{objectSize:1,init:function(t){t&&this.setContent(t)},setContent:function(t){this.code=t||0,this.zero=0},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.arrayToBytes(this.code,8),this.numberTo8(this.zero)),this.rawData},demarshall:function(t,e){return this},getCode:function(){return this.code}}),wdi.RedCursorInit=$.spcExtend(wdi.SpiceObject,{objectSize:9,marshall:function(){},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.position=(new wdi.SpicePoint16).demarshall(t),this.trail_length=this.bytesToInt16NoAllocate(t),this.trail_frequency=this.bytesToInt16NoAllocate(t),this.visible=this.bytesToInt8NoAllocate(t),this.cursor=(new wdi.RedCursor).demarshall(t),this}}),wdi.RedCursor=$.spcExtend(wdi.SpiceObject,{objectSize:2,marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo16(this.flags)),1&this.flags||(this.rawData=this.rawData.concat(this.header.marshall(),this.data)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.flags=this.bytesToInt16NoAllocate(t),this.header=null,this.data=null,1&this.flags||(this.header=(new wdi.RedCursorHeader).demarshall(t),this.data=t.getData()),this}}),wdi.RedCursorHeader=$.spcExtend(wdi.SpiceObject,{objectSize:17,marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo64(this.unique),this.numberTo8(this.type),this.numberTo16(this.width),this.numberTo16(this.height),this.numberTo16(this.hot_spot_x),this.numberTo16(this.hot_spot_y)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.unique=this.bytesToInt64NoAllocate(t),this.type=this.bytesToInt8NoAllocate(t),this.width=this.bytesToInt16NoAllocate(t),this.height=this.bytesToInt16NoAllocate(t),this.hot_spot_x=this.bytesToInt16NoAllocate(t),this.hot_spot_y=this.bytesToInt16NoAllocate(t),this}}),wdi.RedCursorSet=$.spcExtend(wdi.SpiceObject,{objectSize:5,marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.position.marshall(),this.numberTo8(this.visible),this.cursor.marshall()),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.position=(new wdi.SpicePoint16).demarshall(t),this.visible=this.bytesToInt8NoAllocate(t),this.cursor=(new wdi.RedCursor).demarshall(t),this}}),wdi.RedCursorMove=$.spcExtend(wdi.SpiceObject,{objectSize:4,marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.position.marshall()),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.position=(new wdi.SpicePoint16).demarshall(t),this}}),wdi.RedCursorHide=$.spcExtend(wdi.SpiceObject,{objectSize:5,marshall:function(){},demarshall:function(){return this}}),wdi.RasterGlyph=$.spcExtend(wdi.SpiceObject,{objectSize:20,marshall:function(){},demarshall:function(t,e,i){for(var s=1==e?1:2*e,n=[],o=0;o<i;o++)n[o]={},n[o].render_pos=(new wdi.SpicePoint).demarshall(t),n[o].glyph_origin=(new wdi.SpicePoint).demarshall(t),n[o].width=this.bytesToInt16NoAllocate(t),n[o].height=this.bytesToInt16NoAllocate(t),n[o].data=t.shift(n[o].height*Math.ceil(n[o].width*s/8));return n}}),wdi.GlyphString=$.spcExtend(wdi.SpiceObject,{objectSize:3,marshall:function(){},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.len=this.bytesToInt16NoAllocate(t),this.flags=this.bytesToInt8NoAllocate(t),this.raster_glyph=(new wdi.RasterGlyph).demarshall(t,this.flags,this.len),this}}),wdi.SpiceDrawText=$.spcExtend(wdi.SpiceObject,{objectSize:8,init:function(t){t&&this.setContent(t)},setContent:function(t){},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.base=(new wdi.SpiceDisplayBase).demarshall(t),this.offset=this.bytesToInt32NoAllocate(t),this.back_area=(new wdi.SpiceRect).demarshall(t),this.fore_brush=(new wdi.SpiceBrush).demarshall(t),this.back_brush=(new wdi.SpiceBrush).demarshall(t),this.fore_mode=this.bytesToInt16NoAllocate(t),this.back_mode=this.bytesToInt16NoAllocate(t),this.glyph_string=(new wdi.GlyphString).demarshall(t),this}}),wdi.SpiceLineAttr=$.spcExtend(wdi.SpiceObject,{objectSize:8,marshall:function(){},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.flags=this.bytesToInt8NoAllocate(t),this.flags&&(this.style_nseg=this.bytesToInt8NoAllocate(t),this.style=this.int32ToDouble(this.bytesToInt32(t.shift(4)))),this}}),wdi.SpiceStroke=$.spcExtend(wdi.SpiceObject,{objectSize:8,init:function(t){t&&this.setContent(t)},setContent:function(t){},marshall:function(){},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.base=(new wdi.SpiceDisplayBase).demarshall(t),this.offset=this.bytesToInt32NoAllocate(t),this.attr=(new wdi.SpiceLineAttr).demarshall(t),this.brush=(new wdi.SpiceBrush).demarshall(t),this.fore_mode=this.bytesToInt16NoAllocate(t),this.back_mode=this.bytesToInt16NoAllocate(t),this.path=(new wdi.SpicePath).demarshall(t),this}}),wdi.SpiceDrawInvers=$.spcExtend(wdi.SpiceObject,{objectSize:8,init:function(t){t&&this.setContent(t)},setContent:function(t){},marshall:function(){var t=[];return t=t.concat(this.base.marshall(),this.mask.marshall())},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.base=(new wdi.SpiceDisplayBase).demarshall(t),this.mask=(new wdi.SpiceQMask).demarshall(t),this}}),wdi.SpiceStreamCreate=$.spcExtend(wdi.SpiceObject,{objectSize:8,init:function(t){t&&this.setContent(t)},setContent:function(t){},marshall:function(){var t=[];return t.concat(this.numberTo32(this.surface_id),this.numberTo32(this.id),this.numberTo8(this.flags),this.numberTo8(this.codec),this.numberTo64(this.stamp),this.numberTo32(this.stream_width),this.numberTo32(this.stream_height),this.numberTo32(this.src_width),this.numberTo32(this.src_height),this.rect.marshall(),this.clip.marshall()),t},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.surface_id=this.bytesToInt32NoAllocate(t),this.id=this.bytesToInt32NoAllocate(t),this.flags=this.bytesToInt8NoAllocate(t),this.codec=this.bytesToInt8NoAllocate(t),this.stamp=this.bytesToInt64NoAllocate(t),this.stream_width=this.bytesToInt32NoAllocate(t),this.stream_height=this.bytesToInt32NoAllocate(t),this.src_width=this.bytesToInt32NoAllocate(t),this.src_height=this.bytesToInt32NoAllocate(t),this.rect=(new wdi.SpiceRect).demarshall(t),this.clip=(new wdi.SpiceClip).demarshall(t),this}}),wdi.SpiceStreamDestroy=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){},marshall:function(){var t=[];return t=t.concat(this.numberTo32(this.surface_id),this.numberTo32(this.id))},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.surface_id=this.bytesToInt32NoAllocate(t),this.id=this.bytesToInt32NoAllocate(t),this}}),wdi.SpiceStreamData=$.spcExtend(wdi.SpiceObject,{objectSize:8,init:function(t){t&&this.setContent(t)},setContent:function(t){},marshall:function(){var t=[];return t=t.concat(this.numberTo32(this.id),this.numberTo32(this.multi_media_type),this.numberTo32(this.data_size),this.data)},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.id=this.bytesToInt32NoAllocate(t),this.multi_media_type=this.bytesToInt32NoAllocate(t),this.data_size=this.bytesToInt32NoAllocate(t),this.data=t.getRawData(),this}}),wdi.SpiceStreamClip=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){},marshall:function(){var t=[];return t=t.concat(this.numberTo32(this.id),this.clip.marshall())},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.id=this.bytesToInt32NoAllocate(t),this.clip=(new wdi.SpiceClip).demarshall(t),this}}),wdi.SpiceStreamDataSized=$.spcExtend(wdi.SpiceObject,{objectSize:12,init:function(t){t&&this.setContent(t)},setContent:function(t){},marshall:function(){var t=[];return t=t.concat(this.numberTo32(this.id),this.numberTo32(this.width),this.numberTo32(this.height))},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.id=this.bytesToInt32NoAllocate(t),this.width=this.bytesToInt32NoAllocate(t),this.height=this.bytesToInt32NoAllocate(t),this}}),wdi.SpiceStreamActiveReport=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){},marshall:function(){},demarshall:function(t,e){}}),wdi.SpiceModifierData=$.spcExtend(wdi.SpiceObject,{objectSize:8,init:function(t){t&&this.setContent(t)},setContent:function(t){},setModifierData:function(t){6===t?(wdi.Keymap.capsLock=!0,wdi.Keymap.numLock=!0):4===t?(wdi.Keymap.capsLock=!0,wdi.Keymap.numLock=!1):2===t?(wdi.Keymap.capsLock=!1,wdi.Keymap.numLock=!0):0===t&&(wdi.Keymap.capsLock=!1,wdi.Keymap.numLock=!1)},marshall:function(){var t=[];return t=t.concat(this.numberTo16(this.data))},demarshall:function(t,e){return this.expectedSize=e||this.objectSize,this.data=this.bytesToInt16NoAllocate(t),this}}),wdi.SpiceResourceList=$.spcExtend(wdi.SpiceObject,{objectSize:2,init:function(t){t&&this.setContent(t)},setContent:function(t){},marshall:function(){for(var t=[],e=0;e<this.num_items;e++)t=t.concat(this.numberTo8(this.items[e].type),this.numberTo64(this.items[e].id));return t},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});this.num_items=this.bytesToInt16NoAllocate(t),this.items=[];for(var i=0;i<this.num_items;i++)this.items[i]={type:this.bytesToInt8(t.shift(1)),id:this.bytesToInt64(t.shift(8))};return this}}),wdi.SpiceMsgMainAgentTokens=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.num_tokens=t.num_tokens},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.num_tokens)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.num_tokens=this.bytesToInt32NoAllocate(t),this}}),wdi.SpiceMsgMainAgentDisconnected=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.error=t.error},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.error)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.error=this.bytesToInt32NoAllocate(t),this}}),wdi.SpiceMsgMainAgentData=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.agentMessage=t.agentMessage},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.agentMessage.marshall()),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.agentMessage=(new wdi.VDAgentMessage).demarshall(t),this}}),wdi.VDIChunkHeader=$.spcExtend(wdi.SpiceObject,{objectSize:8,init:function(t){t&&this.setContent(t)},setContent:function(t){this.port=t.port,this.size=t.size,this.packet=t.packet},marshall:function(){this.rawData=[];var t=this.packet.marshall();return this.rawData=this.rawData.concat(this.numberTo32(this.port),this.numberTo32(t.length),t),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this}}),wdi.VDAgentMessage=$.spcExtend(wdi.SpiceObject,{objectSize:20,init:function(t){t&&this.setContent(t)},setContent:function(t){this.protocol=t.protocol,this.type=t.type,this.opaque=t.opaque,this.size=t.size,this.data=t.data},marshall:function(){this.rawData=[];var t=this.data.marshall();return this.rawData=this.rawData.concat(this.numberTo32(this.protocol),this.numberTo32(this.type),this.numberTo64(this.opaque),this.numberTo32(t.length),t),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});if(this.protocol=this.bytesToInt32NoAllocate(t),this.type=this.bytesToInt32NoAllocate(t),this.opaque=this.bytesToInt64NoAllocate(t),this.size=this.bytesToInt32NoAllocate(t),this.type==wdi.AgentMessageTypes.VD_AGENT_GET_WINDOWS_LIST){var i=this.bytesToString(t.shift(t.length));this.window_list="change"==i?i:jQuery.parseJSON(i)}else this.type==wdi.AgentMessageTypes.VD_AGENT_ANNOUNCE_CAPABILITIES?this.caps=(new wdi.VDAgentAnnounceCapabilities).demarshall(t):this.type==wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD_GRAB?0==t.getLength()?this.clipboardType=wdi.ClipBoardTypes.VD_AGENT_CLIPBOARD_NONE:this.clipboardType=this.bytesToInt32NoAllocate(t):this.type==wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD_REQUEST?this.clipboardType=this.bytesToInt32NoAllocate(t):this.type==wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD&&(this.clipboardType=this.bytesToInt32NoAllocate(t),this.clipboardData=this.bytesToString(t.shift(t.length)));return this}}),wdi.VDAgentHwndWindow=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.hwnd=t.hwnd},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.hwnd)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this}}),wdi.VDAgentMoveWindow=$.spcExtend(wdi.SpiceObject,{objectSize:12,init:function(t){t&&this.setContent(t)},setContent:function(t){this.hwnd=t.hwnd,this.x=t.x,this.y=t.y},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.hwnd),this.numberTo32(this.x),this.numberTo32(this.y)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this}}),wdi.VDAgentResizeWindow=$.spcExtend(wdi.SpiceObject,{objectSize:12,init:function(t){t&&this.setContent(t)},setContent:function(t){this.hwnd=t.hwnd,this.width=t.width,this.height=t.height},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.hwnd),this.numberTo32(this.width),this.numberTo32(this.height)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this}}),wdi.VDAgentMonitorsConfig=$.spcExtend(wdi.SpiceObject,{objectSize:8,init:function(t){t&&this.setContent(t)},setContent:function(t){this.num_of_monitors=t.num_of_monitors,this.flags=t.flags,this.data=t.data},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.num_of_monitors),this.numberTo32(this.flags),this.data.marshall()),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this}}),wdi.VDAgentMonConfig=$.spcExtend(wdi.SpiceObject,{objectSize:20,init:function(t){t&&this.setContent(t)},setContent:function(t){this.height=t.height,this.width=t.width,this.depth=t.depth,this.x=t.x,this.y=t.y},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.height),this.numberTo32(this.width),this.numberTo32(this.depth),this.numberTo32(this.x),this.numberTo32(this.y)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this}}),wdi.VDAgentAnnounceCapabilities=$.spcExtend(wdi.SpiceObject,{objectSize:8,init:function(t){t&&this.setContent(t)},setContent:function(t){this.request=t.request,this.caps=t.caps},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.request),this.numberTo32(this.caps)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.request=this.bytesToInt32NoAllocate(t),this.caps=this.bytesToInt32NoAllocate(t),this}}),wdi.VDAgentExecuteCommand=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.size=t.size,this.data=t.data},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.size),this.stringToBytes(this.data)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this}}),wdi.VDAgentClipboardRequest=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.type=t.type},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.type)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.type=this.bytesToInt32NoAllocate(t),this}}),wdi.VDAgentClipboardGrab=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.types=t.types},marshall:function(){return this.rawData=[],this.rawData=this.rawData.concat(this.numberTo32(this.types)),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.types=this.bytesToInt32NoAllocate(t),this}}),wdi.VDAgentClipboard=$.spcExtend(wdi.SpiceObject,{objectSize:6,init:function(t){t&&this.setContent(t)},setContent:function(t){this.type=t.type,this.data=t.data},marshall:function(){var t;return this.rawData=[],t=this.type===wdi.ClipBoardTypes.VD_AGENT_CLIPBOARD_UTF8_TEXT?this.stringToBytes(this.data):this.arrayBufferToBytes(this.data),this.rawData=this.rawData.concat(this.numberTo32(this.type),t),this.rawData},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.type=this.bytesToInt32NoAllocate(t),this.data=t.getData(),this}}),wdi.PlaybackMode=$.spcExtend(wdi.SpiceObject,{objectSize:6,init:function(t){t&&this.setContent(t)},setContent:function(t){this.multimedia_time=t.multimedia_time,this.audio_data_mode=t.audio_data_mode,this.data=t.data},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.multimedia_time=this.bytesToInt32NoAllocate(t),this.audio_data_mode=this.bytesToInt16NoAllocate(t),this.data=t.getData(),this}}),wdi.PlaybackStart=$.spcExtend(wdi.SpiceObject,{objectSize:14,init:function(t){t&&this.setContent(t)},setContent:function(t){this.channels=t.channels,this.format=t.format,this.frequency=t.frequency,this.time=t.time},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.channels=this.bytesToInt32NoAllocate(t),this.format=this.bytesToInt16NoAllocate(t),this.frequency=this.bytesToInt32NoAllocate(t),this.time=this.bytesToInt32NoAllocate(t),this}}),wdi.PlaybackData=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.multimedia_time=t.multimedia_time,this.data=t.data},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.multimedia_time=this.bytesToInt32NoAllocate(t),this.data=t.getData(),this}}),wdi.MainMultiMediaTime=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.multimedia_time=t.multimedia_time},marshall:function(){},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.multimedia_time=this.bytesToInt32NoAllocate(t),this}}),wdi.PlaybackStop=$.spcExtend(wdi.SpiceObject,{objectSize:0,demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this}}),wdi.MainMChannelsList=$.spcExtend(wdi.SpiceObject,{objectSize:4,init:function(t){t&&this.setContent(t)},setContent:function(t){this.num_of_channels=t.num_of_channels},marshall:function(){},demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});this.num_of_channels=this.bytesToInt32NoAllocate(t),this.channels=[];for(var i=null,s=0;s<this.num_of_channels;s++)i=this.bytesToInt8NoAllocate(t),this.bytesToInt8NoAllocate(t),this.channels.push(i);return this}}),wdi.SpiceDisplayInvalidAllPalettes=$.spcExtend(wdi.SpiceObject,{objectSize:0,demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this}}),wdi.SpiceDisplayMark=$.spcExtend(wdi.SpiceObject,{objectSize:0,demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this}}),wdi.SpiceDisplayReset=$.spcExtend(wdi.SpiceObject,{objectSize:0,demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this}}),wdi.CodecConfig=$.spcExtend(wdi.SpiceObject,{objectSize:4,demarshall:function(t,e){if(this.expectedSize=e||this.objectSize,t.getLength()<this.expectedSize)throw new wdi.Exception({message:"Not enough queue to read",errorCode:3});return this.encodePoint=this.bytesToInt8NoAllocate(t),this.encodeDevice=this.bytesToInt8NoAllocate(t),this.codec=this.bytesToInt8NoAllocate(t),this.pixelFormat=this.bytesToInt8NoAllocate(t),this}});wdi.SpicePubkeyType={SPICE_PUBKEY_TYPE_INVALID:0,SPICE_PUBKEY_TYPE_RSA:1,SPICE_PUBKEY_TYPE_RSA2:2,SPICE_PUBKEY_TYPE_DSA:3,SPICE_PUBKEY_TYPE_DSA1:4,SPICE_PUBKEY_TYPE_DSA2:5,SPICE_PUBKEY_TYPE_DSA3:6,SPICE_PUBKEY_TYPE_DSA4:7,SPICE_PUBKEY_TYPE_DH:8,SPICE_PUBKEY_TYPE_EC:9,SPICE_PUBKEY_TYPE_ENUM_END:10},wdi.SpiceWarnCode={SPICE_WARN_GENERAL:0,SPICE_WARN_CODE_ENUM_END:1},wdi.SpiceLineFlags={SPICE_LINE_FLAGS_START_WITH_GAP:4,SPICE_LINE_FLAGS_STYLED:8,SPICE_LINE_FLAGS_MASK:12},wdi.SpiceNotifyVisibility={SPICE_NOTIFY_VISIBILITY_LOW:0,SPICE_NOTIFY_VISIBILITY_MEDIUM:1,SPICE_NOTIFY_VISIBILITY_HIGH:2,SPICE_NOTIFY_VISIBILITY_ENUM_END:3},wdi.SpiceVars={SPICE_MSGC_ACK_SYNC:1,SPICE_MSGC_ACK:2,SPICE_MSGC_PONG:3,SPICE_MSGC_MIGRATE_FLUSH_MARK:4,SPICE_MSGC_MIGRATE_DATA:5,SPICE_MSGC_DISCONNECTING:6,SPICE_MSGC_DISPLAY_PREFERRED_VIDEO_CODEC_TYPE:105,SPICE_MSGC_DISPLAY_INIT:101,SPICE_MSGC_END_DISPLAY:102,SPICE_CHANNEL_MAIN:1,SPICE_CHANNEL_DISPLAY:2,SPICE_CHANNEL_INPUTS:3,SPICE_CHANNEL_CURSOR:4,SPICE_CHANNEL_PLAYBACK:5,SPICE_CHANNEL_RECORD:6,SPICE_CHANNEL_TUNNEL:7,SPICE_CHANNEL_SMARTCARD:8,SPICE_CHANNEL_USBREDIR:9,SPICE_END_CHANNEL:10,SPICE_MSG_MIGRATE:1,SPICE_MSG_MIGRATE_DATA:2,SPICE_MSG_SET_ACK:3,SPICE_MSG_PING:4,SPICE_MSG_WAIT_FOR_CHANNELS:5,SPICE_MSG_DISCONNECTING:6,SPICE_MSG_NOTIFY:7,SPICE_MSG_LIST:8,SPICE_MSGC_MAIN_CLIENT_INFO:101,SPICE_MSGC_MAIN_MIGRATE_CONNECTED:102,SPICE_MSGC_MAIN_MIGRATE_CONNECT_ERROR:103,SPICE_MSGC_MAIN_ATTACH_CHANNELS:104,SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST:105,SPICE_MSGC_MAIN_AGENT_START:106,SPICE_MSGC_MAIN_AGENT_DATA:107,SPICE_MSGC_MAIN_AGENT_TOKEN:108,SPICE_MSGC_MAIN_MIGRATE_END:109,SPICE_MSGC_END_MAIN:110,SPICE_MSG_DISPLAY_MODE:101,SPICE_MSG_DISPLAY_MARK:102,SPICE_MSG_DISPLAY_RESET:103,SPICE_MSG_DISPLAY_COPY_BITS:104,SPICE_MSG_DISPLAY_INVAL_LIST:105,SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS:106,SPICE_MSG_DISPLAY_INVAL_PALETTE:107,SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES:108,SPICE_MSG_DISPLAY_STREAM_CREATE:122,SPICE_MSG_DISPLAY_STREAM_DATA:123,SPICE_MSG_DISPLAY_STREAM_CLIP:124,SPICE_MSG_DISPLAY_STREAM_DESTROY:125,SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL:126,SPICE_MSG_DISPLAY_CURRENT_VIDEO_ENCODE_SETUP_RESPONSE:131,SPICE_MSG_DISPLAY_STREAM_DATA_SIZED:316,SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT:319,SPICE_MSG_DISPLAY_DRAW_FILL:302,SPICE_MSG_DISPLAY_DRAW_OPAQUE:303,SPICE_MSG_DISPLAY_DRAW_COPY:304,SPICE_MSG_DISPLAY_DRAW_BLEND:305,SPICE_MSG_DISPLAY_DRAW_BLACKNESS:306,SPICE_MSG_DISPLAY_DRAW_WHITENESS:307,SPICE_MSG_DISPLAY_DRAW_INVERS:308,SPICE_MSG_DISPLAY_DRAW_ROP3:309,SPICE_MSG_DISPLAY_DRAW_STROKE:310,SPICE_MSG_DISPLAY_DRAW_TEXT:311,SPICE_MSG_DISPLAY_DRAW_TRANSPARENT:312,SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND:313,SPICE_MSG_DISPLAY_SURFACE_CREATE:314,SPICE_MSG_DISPLAY_SURFACE_DESTROY:315,SPICE_MSG_END_DISPLAY:316,SPICE_MSG_INPUTS_INIT:101,SPICE_MSG_INPUTS_KEY_MODIFIERS:102,SPICE_MSG_INPUTS_MOUSE_MOTION_ACK:111,SPICE_MSG_END_INPUTS:112,SPICE_MSGC_INPUTS_KEY_DOWN:101,SPICE_MSGC_INPUTS_KEY_UP:102,SPICE_MSGC_INPUTS_KEY_MODIFIERS:103,SPICE_MSGC_INPUTS_MOUSE_MOTION:111,SPICE_MSGC_INPUTS_MOUSE_POSITION:112,SPICE_MSGC_INPUTS_MOUSE_PRESS:113,SPICE_MSGC_INPUTS_MOUSE_RELEASE:114,SPICE_MSGC_END_INPUTS:115,SPICE_MSG_CURSOR_INIT:101,SPICE_MSG_CURSOR_RESET:102,SPICE_MSG_CURSOR_SET:103,SPICE_MSG_CURSOR_MOVE:104,SPICE_MSG_CURSOR_HIDE:105,SPICE_MSG_CURSOR_TRAIL:106,SPICE_MSG_CURSOR_INVAL_ONE:107,SPICE_MSG_CURSOR_INVAL_ALL:108,SPICE_MSG_END_CURSOR:109,SPICE_MSG_RECORD_START:101,SPICE_MSG_RECORD_STOP:102,SPICE_MSG_RECORD_VOLUME:103,SPICE_MSG_RECORD_MUTE:104,SPICE_MSG_END_RECORD:105,SPICE_MSGC_SMARTCARD_DATA:101,SPICE_MSGC_END_SMARTCARD:102,SPICE_MSGC_SPICEVMC_DATA:101,SPICE_MSGC_END_SPICEVMC:102,SPICE_MSG_MAIN_MIGRATE_BEGIN:101,SPICE_MSG_MAIN_MIGRATE_CANCEL:102,SPICE_MSG_MAIN_INIT:103,SPICE_MSG_MAIN_CHANNELS_LIST:104,SPICE_MSG_MAIN_MOUSE_MODE:105,SPICE_MSG_MAIN_MULTI_MEDIA_TIME:106,SPICE_MSG_MAIN_AGENT_CONNECTED:107,SPICE_MSG_MAIN_AGENT_DISCONNECTED:108,SPICE_MSG_MAIN_AGENT_DATA:109,SPICE_MSG_MAIN_AGENT_TOKEN:110,SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST:111,SPICE_MSG_MAIN_MIGRATE_END:112,SPICE_MSG_END_MAIN:113,SPICE_MSG_PLAYBACK_DATA:101,SPICE_MSG_PLAYBACK_MODE:102,SPICE_MSG_PLAYBACK_START:103,SPICE_MSG_PLAYBACK_STOP:104,SPICE_MSG_PLAYBACK_VOLUME:105,SPICE_MSG_PLAYBACK_MUTE:106,SPICE_MSG_END_PLAYBACK:107,SPICE_MSGC_RECORD_DATA:101,SPICE_MSGC_RECORD_MODE:102,SPICE_MSGC_RECORD_START_MARK:103,SPICE_MSGC_END_RECORD:104,SPICE_MSG_TUNNEL_INIT:101,SPICE_MSG_TUNNEL_SERVICE_IP_MAP:102,SPICE_MSG_TUNNEL_SOCKET_OPEN:103,SPICE_MSG_TUNNEL_SOCKET_FIN:104,SPICE_MSG_TUNNEL_SOCKET_CLOSE:105,SPICE_MSG_TUNNEL_SOCKET_DATA:106,SPICE_MSG_TUNNEL_SOCKET_CLOSED_ACK:107,SPICE_MSG_TUNNEL_SOCKET_TOKEN:108,SPICE_MSG_END_TUNNEL:109,SPICE_MSGC_TUNNEL_SERVICE_ADD:101,SPICE_MSGC_TUNNEL_SERVICE_REMOVE:102,SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK:103,SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK:104,SPICE_MSGC_TUNNEL_SOCKET_FIN:105,SPICE_MSGC_TUNNEL_SOCKET_CLOSED:106,SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK:107,SPICE_MSGC_TUNNEL_SOCKET_DATA:108,SPICE_MSGC_TUNNEL_SOCKET_TOKEN:109,SPICE_MSGC_END_TUNNEL:110,SPICE_MSG_SMARTCARD_DATA:101,SPICE_MSG_END_SMARTCARD:102,SPICE_MSG_SPICEVMC_DATA:101,SPICE_MSG_END_SPICEVMC:102,SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION:0,SPICE_COMMON_CAP_AUTH_SPICE:1,SPICE_COMMON_CAP_AUTH_SASL:2,SPICE_COMMON_CAP_MINI_HEADER:3,SPICE_PLAYBACK_CAP_CELT_0_5_1:0,SPICE_PLAYBACK_CAP_VOLUME:1,SPICE_RECORD_CAP_CELT_0_5_1:0,SPICE_RECORD_CAP_VOLUME:1,SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE:0},wdi.SpiceTunnelServiceType={SPICE_TUNNEL_SERVICE_TYPE_INVALID:0,SPICE_TUNNEL_SERVICE_TYPE_GENERIC:1,SPICE_TUNNEL_SERVICE_TYPE_IPP:2,SPICE_TUNNEL_SERVICE_TYPE_ENUM_END:3},wdi.SpiceJpegAlphaFlags={SPICE_JPEG_ALPHA_FLAGS_TOP_DOWN:1,SPICE_JPEG_ALPHA_FLAGS_MASK:1},wdi.SpiceMaskFlags={SPICE_MASK_FLAGS_INVERS:1,SPICE_MASK_FLAGS_MASK:1},wdi.SpiceCursorType={SPICE_CURSOR_TYPE_ALPHA:0,SPICE_CURSOR_TYPE_MONO:1,SPICE_CURSOR_TYPE_COLOR4:2,SPICE_CURSOR_TYPE_COLOR8:3,SPICE_CURSOR_TYPE_COLOR16:4,SPICE_CURSOR_TYPE_COLOR24:5,SPICE_CURSOR_TYPE_COLOR32:6,SPICE_CURSOR_TYPE_ENUM_END:7,SPICE_CURSOR_TYPE_URL:8},wdi.SpiceImageFlags={SPICE_IMAGE_FLAGS_CACHE_ME:1,SPICE_IMAGE_FLAGS_HIGH_BITS_SET:2,SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME:4,SPICE_IMAGE_FLAGS_MASK:7},wdi.SpiceAudioDataMode={SPICE_AUDIO_DATA_MODE_INVALID:0,SPICE_AUDIO_DATA_MODE_RAW:1,SPICE_AUDIO_DATA_MODE_CELT_0_5_1:2,SPICE_AUDIO_DATA_MODE_ENUM_END:3},wdi.SpiceAudioFmt={SPICE_AUDIO_FMT_INVALID:0,SPICE_AUDIO_FMT_S16:1,SPICE_AUDIO_FMT_ENUM_END:2},wdi.SpiceBitmapFmt={SPICE_BITMAP_FMT_INVALID:0,SPICE_BITMAP_FMT_1BIT_LE:1,SPICE_BITMAP_FMT_1BIT_BE:2,SPICE_BITMAP_FMT_4BIT_LE:3,SPICE_BITMAP_FMT_4BIT_BE:4,SPICE_BITMAP_FMT_8BIT:5,SPICE_BITMAP_FMT_16BIT:6,SPICE_BITMAP_FMT_24BIT:7,SPICE_BITMAP_FMT_32BIT:8,SPICE_BITMAP_FMT_RGBA:9,SPICE_BITMAP_FMT_ENUM_END:10},wdi.SpiceStreamFlags={SPICE_STREAM_FLAGS_TOP_DOWN:1,SPICE_STREAM_FLAGS_MASK:1},wdi.SpiceTunnelIpType={SPICE_TUNNEL_IP_TYPE_INVALID:0,SPICE_TUNNEL_IP_TYPE_IPv4:1,SPICE_TUNNEL_IP_TYPE_ENUM_END:2},wdi.SpiceBitmapFlags={SPICE_BITMAP_FLAGS_PAL_CACHE_ME:1,SPICE_BITMAP_FLAGS_PAL_FROM_CACHE:2,SPICE_BITMAP_FLAGS_TOP_DOWN:4,SPICE_BITMAP_FLAGS_MASK:7},wdi.SpiceStringFlags={SPICE_STRING_FLAGS_RASTER_A1:1,SPICE_STRING_FLAGS_RASTER_A4:2,SPICE_STRING_FLAGS_RASTER_A8:4,SPICE_STRING_FLAGS_RASTER_TOP_DOWN:8,SPICE_STRING_FLAGS_MASK:15},wdi.SpiceSurfaceFmt={SPICE_SURFACE_FMT_INVALID:0,SPICE_SURFACE_FMT_1_A:1,SPICE_SURFACE_FMT_8_A:8,SPICE_SURFACE_FMT_16_555:16,SPICE_SURFACE_FMT_32_xRGB:32,SPICE_SURFACE_FMT_16_565:80,SPICE_SURFACE_FMT_32_ARGB:96,SPICE_SURFACE_FMT_ENUM_END:97},wdi.SpiceCursorFlags={SPICE_CURSOR_FLAGS_NONE:1,SPICE_CURSOR_FLAGS_CACHE_ME:2,SPICE_CURSOR_FLAGS_FROM_CACHE:4,SPICE_CURSOR_FLAGS_MASK:7},wdi.SpiceLinkErr={SPICE_LINK_ERR_OK:0,SPICE_LINK_ERR_ERROR:1,SPICE_LINK_ERR_INVALID_MAGIC:2,SPICE_LINK_ERR_INVALID_DATA:3,SPICE_LINK_ERR_VERSION_MISMATCH:4,SPICE_LINK_ERR_NEED_SECURED:5,SPICE_LINK_ERR_NEED_UNSECURED:6,SPICE_LINK_ERR_PERMISSION_DENIED:7,SPICE_LINK_ERR_BAD_CONNECTION_ID:8,SPICE_LINK_ERR_CHANNEL_NOT_AVAILABLE:9,SPICE_LINK_ERR_ENUM_END:10},wdi.SpiceNotifySeverity={SPICE_NOTIFY_SEVERITY_INFO:0,SPICE_NOTIFY_SEVERITY_WARN:1,SPICE_NOTIFY_SEVERITY_ERROR:2,SPICE_NOTIFY_SEVERITY_ENUM_END:3},wdi.SpiceBrushType={SPICE_BRUSH_TYPE_NONE:0,SPICE_BRUSH_TYPE_SOLID:1,SPICE_BRUSH_TYPE_PATTERN:2,SPICE_BRUSH_TYPE_ENUM_END:3},wdi.SpiceAlphaFlags={SPICE_ALPHA_FLAGS_DEST_HAS_ALPHA:1,SPICE_ALPHA_FLAGS_SRC_SURFACE_HAS_ALPHA:2,SPICE_ALPHA_FLAGS_MASK:3},wdi.SpiceSurfaceFlags={SPICE_SURFACE_FLAGS_PRIMARY:1,SPICE_SURFACE_FLAGS_MASK:1},wdi.QuicImageType={QUIC_IMAGE_TYPE_INVALID:0,QUIC_IMAGE_TYPE_GRAY:1,QUIC_IMAGE_TYPE_RGB16:2,QUIC_IMAGE_TYPE_RGB24:3,QUIC_IMAGE_TYPE_RGB32:4,QUIC_IMAGE_TYPE_RGBA:5},wdi.SpiceImageType={SPICE_IMAGE_TYPE_BITMAP:0,SPICE_IMAGE_TYPE_QUIC:1,SPICE_IMAGE_TYPE_RESERVED:2,SPICE_IMAGE_TYPE_LZ_PLT:100,SPICE_IMAGE_TYPE_LZ_RGB:101,SPICE_IMAGE_TYPE_GLZ_RGB:102,SPICE_IMAGE_TYPE_FROM_CACHE:103,SPICE_IMAGE_TYPE_SURFACE:104,SPICE_IMAGE_TYPE_JPEG:105,SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS:106,SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB:107,SPICE_IMAGE_TYPE_JPEG_ALPHA:108,SPICE_IMAGE_TYPE_CANVAS:109,SPICE_IMAGE_TYPE_PNG:110,SPICE_IMAGE_TYPE_ENUM_END:111},wdi.SpiceImageScaleMode={SPICE_IMAGE_SCALE_MODE_INTERPOLATE:0,SPICE_IMAGE_SCALE_MODE_NEAREST:1,SPICE_IMAGE_SCALE_MODE_ENUM_END:2},wdi.SpiceResourceType={SPICE_RES_TYPE_INVALID:0,SPICE_RES_TYPE_PIXMAP:1,SPICE_RESOURCE_TYPE_ENUM_END:2},wdi.SpicePathFlags={SPICE_PATH_BEGIN:1,SPICE_PATH_END:2,SPICE_PATH_CLOSE:8,SPICE_PATH_BEZIER:16,SPICE_PATH_FLAGS_MASK:27},wdi.SpiceVideoCodecType={SPICE_VIDEO_CODEC_TYPE_MJPEG:1,SPICE_VIDEO_CODEC_TYPE_VP8:2,SPICE_VIDEO_CODEC_TYPE_H264:3,SPICE_VIDEO_CODEC_TYPE_VP9:4,SPICE_VIDEO_CODEC_TYPE_H265:5,SPICE_VIDEO_CODEC_TYPE_ENUM_END:2},wdi.SpiceVideoCodecValue={1:"",2:"vp8",3:"avc1.64001f",4:"vp09.00.31.08",5:"hvc1.1.6.L93.90"},wdi.SpiceRopd={SPICE_ROPD_INVERS_SRC:1,SPICE_ROPD_INVERS_BRUSH:2,SPICE_ROPD_INVERS_DEST:4,SPICE_ROPD_OP_PUT:8,SPICE_ROPD_OP_OR:16,SPICE_ROPD_OP_AND:32,SPICE_ROPD_OP_XOR:64,SPICE_ROPD_OP_BLACKNESS:128,SPICE_ROPD_OP_WHITENESS:256,SPICE_ROPD_OP_INVERS:512,SPICE_ROPD_INVERS_RES:1024,SPICE_ROPD_MASK:2047},wdi.SpiceMigrateFlags={SPICE_MIGRATE_NEED_FLUSH:1,SPICE_MIGRATE_NEED_DATA_TRANSFER:2,SPICE_MIGRATE_FLAGS_MASK:3},wdi.SpiceKeyboardModifierFlags={SPICE_KEYBOARD_MODIFIER_FLAGS_SCROLL_LOCK:1,SPICE_KEYBOARD_MODIFIER_FLAGS_NUM_LOCK:2,SPICE_KEYBOARD_MODIFIER_FLAGS_CAPS_LOCK:4,SPICE_KEYBOARD_MODIFIER_FLAGS_MASK:7},wdi.SpiceInfoCode={SPICE_INFO_GENERAL:0,SPICE_INFO_CODE_ENUM_END:1},wdi.SpiceMouseButton={SPICE_MOUSE_BUTTON_INVALID:0,SPICE_MOUSE_BUTTON_LEFT:1,SPICE_MOUSE_BUTTON_MIDDLE:2,SPICE_MOUSE_BUTTON_RIGHT:3,SPICE_MOUSE_BUTTON_UP:4,SPICE_MOUSE_BUTTON_DOWN:5,SPICE_MOUSE_BUTTON_ENUM_END:6},wdi.SpiceClipType={SPICE_CLIP_TYPE_NONE:0,SPICE_CLIP_TYPE_RECTS:1,SPICE_CLIP_TYPE_ENUM_END:2},wdi.SpiceMouseButtonMask={SPICE_MOUSE_BUTTON_MASK_LEFT:1,SPICE_MOUSE_BUTTON_MASK_MIDDLE:2,SPICE_MOUSE_BUTTON_MASK_RIGHT:4,SPICE_MOUSE_BUTTON_MASK_MASK:7},wdi.SpiceMouseModeTypes={SPICE_MOUSE_MODE_SERVER:1,SPICE_MOUSE_MODE_CLIENT:2,SPICE_MOUSE_MODE_MASK:3},wdi.SpiceDisplayCaps={SPICE_DISPLAY_CAP_SIZED_STREAM:0,SPICE_DISPLAY_CAP_MONITORS_CONFIG:1,SPICE_DISPLAY_CAP_COMPOSITE:2,SPICE_DISPLAY_CAP_A8_SURFACE:3,SPICE_DISPLAY_CAP_STREAM_REPORT:4,SPICE_DISPLAY_CAP_LZ4_COMPRESSION:5,SPICE_DISPLAY_CAP_PREF_COMPRESSION:6,SPICE_DISPLAY_CAP_GL_SCANOUT:7,SPICE_DISPLAY_CAP_MULTI_CODEC:8,SPICE_DISPLAY_CAP_CODEC_MJPEG:9,SPICE_DISPLAY_CAP_CODEC_VP8:10,SPICE_DISPLAY_CAP_CODEC_H264:11,SPICE_DISPLAY_CAP_PREF_VIDEO_CODEC_TYPE:12,SPICE_DISPLAY_CAP_CODEC_VP9:13,SPICE_DISPLAY_CAP_CODEC_H265:14},wdi.AgentCaps={VD_AGENT_CAP_MOUSE_STATE:0,VD_AGENT_CAP_MONITORS_CONFIG:1,VD_AGENT_CAP_REPLY:2,VD_AGENT_CAP_CLIPBOARD:3,VD_AGENT_CAP_DISPLAY_CONFIG:4,VD_AGENT_CAP_CLIPBOARD_BY_DEMAND:5,VD_AGENT_CAP_CLIPBOARD_SELECTION:6},wdi.AgentMessageTypes={VD_AGENT_MOUSE_STATE:1,VD_AGENT_MONITORS_CONFIG:2,VD_AGENT_REPLY:3,VD_AGENT_CLIPBOARD:4,VD_AGENT_DISPLAY_CONFIG:5,VD_AGENT_ANNOUNCE_CAPABILITIES:6,VD_AGENT_CLIPBOARD_GRAB:7,VD_AGENT_CLIPBOARD_REQUEST:8,VD_AGENT_CLIPBOARD_RELEASE:9,VD_AGENT_GET_WINDOWS_LIST:10,VD_AGENT_CLOSE_WINDOW:11,VD_AGENT_MOVE_WINDOW:12,VD_AGENT_RESIZE_WINDOW:13,VD_AGENT_MINIMIZE_WINDOW:14,VD_AGENT_RESTORE_WINDOW:15,VD_AGENT_MAXIMIZE_WINDOW:16,VD_AGENT_FOCUS_WINDOW:17,VD_AGENT_EXECUTE_COMMAND:18},wdi.ClipBoardTypes={VD_AGENT_CLIPBOARD_NONE:0,VD_AGENT_CLIPBOARD_UTF8_TEXT:1,VD_AGENT_CLIPBOARD_IMAGE_PNG:2,VD_AGENT_CLIPBOARD_IMAGE_BMP:3,VD_AGENT_CLIPBOARD_IMAGE_TIFF:4,VD_AGENT_CLIPBOARD_IMAGE_JPG:5};wdi.GraphicDebug=$.spcExtend(wdi.DomainObject,{debugMode:null,spiceGraphicMessageTypes:[],cloneSpiceMessage:null,clientGui:null,tmpCanvas:null,tmpContext:null,originalCanvas:null,spiceMessageData:null,endCanvas:null,currentOperation:null,init:function(e){this.debugMode=e.debugMode,this.debugMode?(this._generateArray(),this._showDebug()):this._hideDebug()},_generateArray:function(){var e=this;$.each(wdi.SpiceVars,(function(a,t){-1!=a.search("SPICE_MSG_DISPLAY_")&&(e.spiceGraphicMessageTypes[t]=a)}))},_showDebug:function(){$("#canvasSpace").show(),$("#graphicDebug").show()},_hideDebug:function(){$("#canvasSpace").hide(),$("#graphicDebug").hide()},printDebugMessageOnFilter:function(e,a){if(e.channel===wdi.SpiceVars.SPICE_CHANNEL_DISPLAY&&this.debugMode&&$("#logActive").prop("checked")){var t=null;if(this.clientGui=a,this.cloneSpiceMessage=$.extend(!0,{},e),this.cloneSpiceMessage.args.base&&null!==this.cloneSpiceMessage.args.base.surface_id){t=this.cloneSpiceMessage.args.base.surface_id;var i=wdi.graphics.getBoxFromSrcArea(this.cloneSpiceMessage.args.base.box),s=$("<div/>").append(prettyPrint(this.cloneSpiceMessage)).hide();this.originalCanvas=this._copyCanvasFromSurfaceId(t),this.spiceMessageData=e.args.originalData,this.currentOperation=this.spiceGraphicMessageTypes[this.cloneSpiceMessage.messageType],$("#debugInfo").append($("<br/>")).append($("<hr/>")).append(this._copyAndHighlightCanvas(t,i)).append($("<br/>")).append($("<div/>").append(this.currentOperation+" (Click to hide/show)").css("cursor","pointer").css("color","blue").css("text-decoration","underline").click((function(){s.toggle()}))).append(s),this.cloneSpiceMessage.args.hasOwnProperty("image")&&this._printImage(s)}}},_printImage:function(e){wdi.graphics.getImageFromSpice(this.cloneSpiceMessage.args.image.imageDescriptor,this.cloneSpiceMessage.args.image.data,this.clientGui,(function(a){a&&e.append($("<div/>").css("font-size","12px").append("Image inside spiceMessage:").append($("<br/>")).css("border","1px solid black").append(a))}),this)},handleStreamInfo:function(){if(wdi.Stream.streams){$("#debug-stream").text("");for(let e in wdi.Stream.streams){const a=wdi.Stream.streams[e];a&&$("#debug-stream").append(`<p style="color: rgb(100, 255, 100)">Codec: ${a.codec} | Stream ID: ${a.id}</p>`)}}},printDebugMessageOnNotifyEnd:function(e,a){if(this.clientGui=a,e.channel===wdi.SpiceVars.SPICE_CHANNEL_DISPLAY&&this.debugMode&&$("#logActive").prop("checked")){var t=null;if(e.args.base&&null!==e.args.base.surface_id){var i=this;t=e.args.base.surface_id;var s=wdi.graphics.getBoxFromSrcArea(e.args.base.box),n=this._copyCanvasFromSurfaceId(t);$("#debugInfo").append($("<br/>")).append($("<div/>").append($("<button>Create test</button>").css("cursor","pointer").click((r=this.spiceMessageData,c=this.originalCanvas,o=n,p=this.currentOperation,function(){i.createImageTest(r,c,o,p)}))).append($("<button>Create replay window</button>").css("cursor","pointer").click(function(e,a,t,s){return function(){i.createReplay(e,a,t,s)}}(this.spiceMessageData,this.originalCanvas,n,this.currentOperation)))).append($("<br/>")).append(this._copyAndHighlightCanvas(t,s))}}var r,c,o,p},createImageTest:function(e,a,t,i){var s=prompt("Name of the test",i),n={origin:a.toDataURL("image/png"),expected:t.toDataURL("image/png"),object:e,name:s},r=JSON.stringify(n),c=s.replace(/\s/g,"_");$.post("graphictestgenerator.php","data="+r+"&name="+c).done((function(e,a,t){alert("Test created")})).fail((function(e,a,t){alert("Test creation failed.\n\nGot response: "+e.status+" "+e.statusText+"\n\n"+e.responseText)}))},createReplay:function(e,a){var t={origin:a.toDataURL("image/png"),object:e,width:a.width,height:a.height},i=JSON.stringify(t);$.post("graphictestgenerator.php","data="+i+"&replay=true").done((function(e,a,t){window.open("replay.html","replay")})).fail((function(e,a,t){alert("Replay failed.\n\nGot response: "+e.status+" "+e.statusText+"\n\n"+e.responseText)}))},_copyCanvasFromSurfaceId:function(e){var a=this.clientGui.getContext(e);this.tmpCanvas=a.canvas;var t=document.createElement("canvas");return t.width=this.tmpCanvas.width,t.height=this.tmpCanvas.height,t.getContext("2d").drawImage(this.tmpCanvas,0,0),t},_copyAndHighlightCanvas:function(e,a){var t=this._copyCanvasFromSurfaceId(e);return context=t.getContext("2d"),context.fillStyle="rgba(255,0,0,0.3)",context.fillRect(a.x,a.y,a.width,a.height),t}});wdi.LZSS={LZ_IMAGE_TYPE_INVALID:0,LZ_IMAGE_TYPE_PLT1_LE:1,LZ_IMAGE_TYPE_PLT1_BE:2,LZ_IMAGE_TYPE_PLT4_LE:3,LZ_IMAGE_TYPE_PLT4_BE:4,LZ_IMAGE_TYPE_PLT8:5,LZ_IMAGE_TYPE_RGB16:6,LZ_IMAGE_TYPE_RGB24:7,LZ_IMAGE_TYPE_RGB32:8,LZ_IMAGE_TYPE_RGBA:9,LZ_IMAGE_TYPE_XXXA:10,LZPALETTE_FLAG_PAL_CACHE_ME:1,LZPALETTE_FLAG_PAL_FROM_CACHE:2,LZPALETTE_FLAG_TOP_DOWN:4,PLT_PIXELS_PER_BYTE:[0,8,8,2,2,1],PLT1_MASK:[1,2,4,8,16,32,64,128],copy_pixel:function(e,i,_){_[e+0]=i.r,_[e+1]=i.g,_[e+2]=i.b},lz_rgb32_decompress_rgb:function(e){var i,_=0,t=0,s=new Uint8Array(e),p=(s[_++],s[_++]),E=s[_++],c=s[++_+1]*Math.pow(16,2)+s[_],o=s[(_+=2)+1]*Math.pow(16,2)+s[_];_+=2;var T,r,l=o*Math.pow(16,4)+c,L=new ArrayBuffer(l),P=new Uint8Array(L),a=new Uint32Array(L),h=l/4;for(i=s[_++];t<h;i=s[_++])if(A=t,l=i>>5,I=(31&i)<<8,i>31){if(6===--l)do{l+=b=s[_++]}while(255===b);if(I+=b=s[_++],255===b&&I-b==7936&&(I=s[_++]<<8,I+=s[_++],I+=8191),l+=1,(A-=I+=1)===t-1)for(r=4*(f=A);l;--l)a[t]=255<<24|P[r+2]<<16|P[r+1]<<8|P[r],t++;else for(;l;--l)T=4*A,a[t]=255<<24|P[T+2]<<16|P[T+1]<<8|P[T],t++,A++}else for(i++,a[t]=255<<24|s[_]<<16|s[_+1]<<8|s[_+2],_+=3,t++,--i;i;i--)a[t]=255<<24|s[_]<<16|s[_+1]<<8|s[_+2],_+=3,t++;if(E===this.LZ_IMAGE_TYPE_RGBA&&!p)for(t=0,i=null,_--,i=s[_++];t<h;i=s[_++]){var A=t,I=(l=i>>5,(31&i)<<8),n=4*t;if(i>=32){var b;if(6===--l)do{l+=b=s[_++]}while(255===b);if(I+=b=s[_++],255===b&&I-b==7936&&(I=s[_++]<<8,I+=s[_++],I+=8191),l+=3,(A-=I+=1)===t-1)for(var f=A;l;--l)P[(n=4*t)+3]=P[4*f+3],t++;else for(;l;--l)P[(n=4*t)+3]=P[4*A+3],t++,A++}else for(i++,P[n+3]=s[_++],t++,--i;i;i--)P[(n=4*t)+3]=s[_++],t++}return L},lz_rgb32_decompress:function(e,i,_,t,s,p,E){var c,o=i,T=0,r=_.length/4,l=t===this.LZ_IMAGE_TYPE_RGBA;for(c=e[o++];T<r;c=e[o++]){var L=T,P=c>>5,a=(31&c)<<8,h=4*T;if(c>=32){var A;if(6===--P)do{P+=A=e[o++]}while(255===A);if(a+=A=e[o++],255===A&&a-A==7936&&(a=e[o++]<<8,a+=e[o++],a+=8191),P+=1,(l||p)&&(P+=2),a+=1,t===this.LZ_IMAGE_TYPE_PLT4_LE||t===this.LZ_IMAGE_TYPE_PLT4_BE?(a*=2,P*=2):t!==this.LZ_IMAGE_TYPE_PLT1_BE&&t!==this.LZ_IMAGE_TYPE_PLT1_LE||(a*=8,P*=8),(L-=a)===T-1)for(var I=L;P;--P){if(h=4*T,l)_[h+3]=E?255:_[4*I+3];else for(var n=0;n<4;n++)_[h+n]=_[4*I+n];T++}else for(;P;--P){if(h=4*T,l)_[h+3]=E?255:_[4*L+3];else for(n=0;n<4;n++)_[h+n]=_[4*L+n];T++,L++}}else{if(c++,l)E?(_[h+3]=255,o++):_[h+3]=e[o++];else if(p){if(t===this.LZ_IMAGE_TYPE_PLT1_LE){var b=e[o++],f=p[1],d=p[0];for(n=0;n<8;n++)b&this.PLT1_MASK[n]?this.copy_pixel(h,f,_):this.copy_pixel(h,d,_),s&&(_[h+3]=255),n<7&&T++,h=4*T}else if(t===this.LZ_IMAGE_TYPE_PLT1_BE)for(b=e[o++],f=p[1],d=p[0],n=7;n>=0;n--)b&this.PLT1_MASK[n]?this.copy_pixel(h,f,_):this.copy_pixel(h,d,_),s&&(_[h+3]=255),n>0&&T++,h=4*T;else if(t===this.LZ_IMAGE_TYPE_PLT4_LE){var w=p[15&(b=e[o++])];this.copy_pixel(h,w,_),s&&(_[h+3]=255),h=4*++T;w=p[b>>>4&15];this.copy_pixel(h,w,_),s&&(_[h+3]=255)}else if(t===this.LZ_IMAGE_TYPE_PLT4_BE){var y=15&(b=e[o++]);w=p[b>>>4&15];this.copy_pixel(h,w,_),s&&(_[h+3]=255),h=4*++T;w=p[y];this.copy_pixel(h,w,_),s&&(_[h+3]=255)}else if(t===this.LZ_IMAGE_TYPE_PLT8){w=p[e[o++]];this.copy_pixel(h,w,_),s&&(_[h+3]=255)}}else _[h+0]=e[o+2],_[h+1]=e[o+1],_[h+2]=e[o+0],s&&(_[h+3]=255),o+=3;for(T++,--c;c;c--){if(h=4*T,l)_[h+3]=E?255:e[o++];else if(p){if(t===this.LZ_IMAGE_TYPE_PLT1_LE)for(b=e[o++],f=p[1],d=p[0],n=0;n<8;n++)b&this.PLT1_MASK[n]?this.copy_pixel(h,f,_):this.copy_pixel(h,d,_),s&&(_[h+3]=255),n<7&&T++,h=4*T;else if(t===this.LZ_IMAGE_TYPE_PLT1_BE)for(b=e[o++],f=p[1],d=p[0],n=7;n>=0;n--)b&this.PLT1_MASK[n]?this.copy_pixel(h,f,_):this.copy_pixel(h,d,_),s&&(_[h+3]=255),n>0&&T++,h=4*T;else if(t===this.LZ_IMAGE_TYPE_PLT4_LE){w=p[15&(b=e[o++])];this.copy_pixel(h,w,_),s&&(_[h+3]=255),h=4*++T;w=p[b>>>4&15];this.copy_pixel(h,w,_),s&&(_[h+3]=255)}else if(t===this.LZ_IMAGE_TYPE_PLT4_BE){w=p[(b=e[o++])>>>4&15];this.copy_pixel(h,w,_),s&&(_[h+3]=255),h=4*++T;w=p[15&b];this.copy_pixel(h,w,_),s&&(_[h+3]=255)}else if(t===this.LZ_IMAGE_TYPE_PLT8){w=p[e[o++]];this.copy_pixel(h,w,_),s&&(_[h+3]=255)}}else _[h+0]=e[o+2],_[h+1]=e[o+1],_[h+2]=e[o+0],s&&(_[h+3]=255),o+=3;T++}}}return o-1},convert_spice_lz_to_web:function(e,i,_,t){var s=_.type;if(i=i.toJSArray(),s===wdi.SpiceImageType.SPICE_IMAGE_TYPE_LZ_PLT){var p=wdi.SpiceObject.bytesToInt8(i.splice(0,1));if(p===this.LZPALETTE_FLAG_PAL_FROM_CACHE){var E=i.splice(0,12),c=(wdi.SpiceObject.bytesToInt32(E.splice(0,4)),wdi.SpiceObject.bytesToInt64(E.splice(0,8)));E=i;wdi.SpiceObject.bytesToStringBE(E.splice(0,4)),wdi.SpiceObject.bytesToInt32BE(E.splice(0,4));var o=wdi.SpiceObject.bytesToInt32BE(E.splice(0,4)),T=wdi.SpiceObject.bytesToInt32BE(E.splice(0,4)),r=wdi.SpiceObject.bytesToInt32BE(E.splice(0,4)),l=wdi.SpiceObject.bytesToInt32BE(E.splice(0,4)),L=wdi.SpiceObject.bytesToInt32BE(E.splice(0,4))}else if(p===this.LZPALETTE_FLAG_PAL_CACHE_ME){for(var P=_.offset+1,a=(E=i.splice(0,36),wdi.SpiceObject.bytesToInt32(E.splice(0,4)),wdi.SpiceObject.bytesToInt32(E.splice(0,4))-P-36),h=(wdi.SpiceObject.bytesToStringBE(E.splice(0,4)),wdi.SpiceObject.bytesToInt32BE(E.splice(0,4)),o=wdi.SpiceObject.bytesToInt32BE(E.splice(0,4)),T=wdi.SpiceObject.bytesToInt32BE(E.splice(0,4)),r=wdi.SpiceObject.bytesToInt32BE(E.splice(0,4)),l=wdi.SpiceObject.bytesToInt32BE(E.splice(0,4)),L=wdi.SpiceObject.bytesToInt32BE(E.splice(0,4)),c=wdi.SpiceObject.bytesToInt64(i.splice(a,8)),wdi.SpiceObject.bytesToInt16(i.splice(a,2))),A=[],I=0;I<h;I++){var n=new wdi.Queue;n.setData(i.splice(a,4)),A.push((new wdi.SpiceColor).demarshall(n))}wdi.ImageCache.addPalette(c,A)}else wdi.Debug.error("Unimplemented lz palette top down");A=wdi.ImageCache.getPalette(c)}if(o!==this.LZ_IMAGE_TYPE_RGB32&&o!==this.LZ_IMAGE_TYPE_RGBA&&o!==this.LZ_IMAGE_TYPE_RGB24&&o!==this.LZ_IMAGE_TYPE_PLT8&&o!==this.LZ_IMAGE_TYPE_PLT1_LE&&o!==this.LZ_IMAGE_TYPE_PLT1_BE&&o!==this.LZ_IMAGE_TYPE_PLT4_LE&&o!==this.LZ_IMAGE_TYPE_PLT4_BE)return!1;if(A){var b=e.createImageData(l*this.PLT_PIXELS_PER_BYTE[o],r);this.lz_rgb32_decompress(i,0,b.data,o,o!==this.LZ_IMAGE_TYPE_RGBA,A);var f=wdi.graphics.getNewTmpCanvas(T,r);f.getContext("2d").putImageData(b,0,0,0,0,T,r),b=f}else{var d=new ArrayBuffer(i.length+8),w=new Uint8Array(d);w[0]=1,w[1]=t,w[2]=o,w[3]=0;var y=b.data.length;for(I=0;I<4;I++)w[4+I]=255&y,y>>=8;w.set(i,8);var G=new Uint8ClampedArray(this.lz_rgb32_decompress_rgb(d));b=new ImageData(G,T,r),b=wdi.graphics.getImageFromData(b)}return L||(b=wdi.RasterOperation.flip(b)),b},demarshall_rgb:function(e){var i=e.splice(0,32);return{length:wdi.SpiceObject.bytesToInt32(i.splice(0,4)),magic:wdi.SpiceObject.bytesToStringBE(i.splice(0,4)),version:wdi.SpiceObject.bytesToInt32BE(i.splice(0,4)),type:wdi.SpiceObject.bytesToInt32BE(i.splice(0,4)),width:wdi.SpiceObject.bytesToInt32BE(i.splice(0,4)),height:wdi.SpiceObject.bytesToInt32BE(i.splice(0,4)),stride:wdi.SpiceObject.bytesToInt32BE(i.splice(0,4)),top_down:wdi.SpiceObject.bytesToInt32BE(i.splice(0,4))}},lz_rgb32_plt1_be_decompress:function(e,i,_){var t,s,p,E,c,o,T,r,l,L,P=0,a=0,h=i.length/4,A=this.LZ_IMAGE_TYPE_PLT1_BE,I=this.PLT_PIXELS_PER_BYTE[A];for(t=e[P++];a<h;t=e[P++])if(s=a,p=t>>5,E=(31&t)<<8,t>31){if(7===p)do{p+=c=e[P++]}while(255===c);if(8191===(E+=e[P++])&&(E+=e[P++]<<8+e[P++]),p=(p+2)*I,(s-=(E+1)*I)===a-1)for(o=4*s;0!=p--;)op_4=4*a,i[op_4]=i[o],i[op_4+1]=i[o+1],i[op_4+2]=i[o+2],i[op_4+3]=i[o+3],a++;else for(;0!=p--;)op_4=4*a,o=4*s,i[op_4]=i[o],i[op_4+1]=i[o+1],i[op_4+2]=i[o+2],i[op_4+3]=i[o+3],a++,s++}else for(;-1!=t--;)for(op_4=4*a,T=e[P++],r=_[1],l=_[0],L=7;L>=0;L--)op_4=4*a,T&this.PLT1_MASK[L]?(i[op_4+0]=r.r,i[op_4+1]=r.g,i[op_4+2]=r.b):(i[op_4+0]=l.r,i[op_4+1]=l.g,i[op_4+2]=l.b),i[op_4+3]=255,a++}};function intToByteArray(t){let e=new Uint8Array(1);return e[0]=255&t,e}wdi.BMP2=$.spcExtend(wdi.SpiceObject,{objectSize:0,mapper:[0,1,1,4,4,8,16,24,32,32],init:function(t){var e,i,a,s,h=this.bytesToInt8(t),r=this.bytesToInt8(t),n=this.bytesToInt32(t),p=this.bytesToInt32(t),l=this.bytesToInt32(t),o=this.mapper[h],g=0;if(o<=8&&o>0){var m=[];if(1&r){this.bytesToInt32(t);e=t.length;var f,d=4*Math.pow(2,o)+8+2;for(e-=d,s=t.splice(e,d),a=this.bytesToInt64(s),g=this.bytesToInt16(s),i=0;i<4*g;i+=4)(f=new wdi.Queue).setData(s.slice(i,i+4)),m.push((new wdi.SpiceColor).demarshall(f));wdi.ImageCache.addPalette(a,m)}else{var I;for(a=this.bytesToInt64(t),e=t.length,s=[],g=(m=wdi.ImageCache.getPalette(a)).length,i=0;i<g;i++)(I=m[i].marshall()).push(0),s=s.concat(I)}}else this.bytesToInt32(t);this.setContent({imageSize:e,width:n,height:p,bpp:o,imageData:t,paletteSize:4*g,palette:m,stride:l,flags:r,type:h})},setContent:function(t){this.imageSize=t.imageSize,this.width=t.width,this.height=t.height,this.bpp=t.bpp,this.imageData=t.imageData,this.palette=t.palette,this.offset=t.paletteSize+54,this.size=this.offset+this.imageSize,this.stride=t.stride,this.flags=t.flags,this.type=9},marshall:function(t){var e,i,a,s,h,r,n=this.type,p=this.palette,l=this.width,o=this.height,g=this.stride,m=this.imageData,f=this.flags,d=m.length,I=8*g/this.bpp,w=new ArrayBuffer(4*I*o),T=new Uint8ClampedArray(w),c=new Uint32Array(w);m[1];if(p){if(s=0,n===wdi.SpiceBitmapFmt.SPICE_BITMAP_FMT_1BIT_BE){var b=(h=p[1]).r<<24|h.g<<16|h.b<<8|255,y=(h=p[0]).r<<24|h.g<<16|h.b<<8|255,B=[1,2,4,8,16,32,64,128];for(a=0;a<d;a++)for(e=m[a],i=7;i>=0;i--)c[s++]=e&B[i]?b:y}else if(n===wdi.SpiceBitmapFmt.SPICE_BITMAP_FMT_4BIT_BE)for(a=0;a<d;a++)h=p[(e=m[a])>>>4],c[s++]=h.r<<24|h.g<<16|h.b<<8|255,h=p[15&e],c[s++]=h.r<<24|h.g<<16|h.b<<8|255}else{if(n===wdi.SpiceBitmapFmt.SPICE_BITMAP_FMT_32BIT||n===wdi.SpiceBitmapFmt.SPICE_BITMAP_FMT_RGBA)for(a=0;a<d;a+=4){let t,e,i;t=m[a],e=m[a+1],i=m[a+2],m[a]=i,m[a+1]=e,m[a+2]=t,m[a+3]=255}else if(n===wdi.SpiceBitmapFmt.SPICE_BITMAP_FMT_24BIT)for(a=0;a<d;a+=3)r=m[a],m[a]=m[a+2],m[a+2]=r;T=new Uint8ClampedArray(m)}var S=new ImageData(T,I,o),_=wdi.graphics.getNewTmpCanvas(l,o);return _.getContext("2d").putImageData(S,0,0,0,0,l,o),S=_,!4&f&&(S=wdi.RasterOperation.flip(S)),S}});"use strict";var rfc2083_crc_table=Array(256),rfc2083_crc_table_computed=0;function rfc2083_make_crc_table(){var t,e,i;for(e=0;e<256;e++){for(t=e,i=0;i<8;i++)1&t?t=(3988292384^t>>>1)>>>0&4294967295:t>>>=1;rfc2083_crc_table[e]=t}rfc2083_crc_table_computed=1}function rfc2083_update_crc(t,e,i,r){var n,s=t;for(rfc2083_crc_table_computed||rfc2083_make_crc_table(),n=0;n<r;n++)s=rfc2083_crc_table[255&(s^e[i+n])]^s>>>8;return s}function rfc2083_crc(t,e,i){return 4294967295^rfc2083_update_crc(4294967295,t,e,i)}function crc32(t,e,i){return rfc2083_crc(new Uint8Array(t),e,i)}function PngIHDR(t,e){this.width=t,this.height=e,this.depth=8,this.type=6,this.compression=0,this.filter=0,this.interlace=0}function adler(){this.s1=1,this.s2=0}function PngIDAT(t,e,i){if(i.byteLength>65535)throw new Error("Cannot handle more than 64K");this.data=i,this.width=t,this.height=e}function PngIEND(){}function create_rgba_png(t,e,i){var r,n=new PngIHDR(t,e),s=new PngIDAT(t,e,i),c=new PngIEND,h=new ArrayBuffer(n.buffer_size()+s.buffer_size()+c.buffer_size()),f=n.to_buffer(h);f=s.to_buffer(h,f),f=c.to_buffer(h,f);var a=new Uint8Array(h),o="";for(r=0;r<f;r++)o+="%",a[r]<16&&(o+="0"),o+=a[r].toString(16);return"%89PNG%0D%0A%1A%0A"+o}PngIHDR.prototype={to_buffer:function(t,e){var i=e=e||0,r=new SpiceDataView(t);return r.setUint32(e,this.buffer_size()-12),e+=4,r.setUint8(e,"I".charCodeAt(0)),e++,r.setUint8(e,"H".charCodeAt(0)),e++,r.setUint8(e,"D".charCodeAt(0)),e++,r.setUint8(e,"R".charCodeAt(0)),e++,r.setUint32(e,this.width),e+=4,r.setUint32(e,this.height),e+=4,r.setUint8(e,this.depth),e++,r.setUint8(e,this.type),e++,r.setUint8(e,this.compression),e++,r.setUint8(e,this.filter),e++,r.setUint8(e,this.interlace),e++,r.setUint32(e,crc32(t,i+4,this.buffer_size()-8)),e+=4},buffer_size:function(){return 25}},adler.prototype.update=function(t){this.s1+=t,this.s1%=65521,this.s2+=this.s1,this.s2%=65521},PngIDAT.prototype={to_buffer:function(t,e){var i,r,n,s=e=e||0,c=new SpiceDataView(t),h=new adler;c.setUint32(e,this.buffer_size()-12),e+=4,c.setUint8(e,"I".charCodeAt(0)),e++,c.setUint8(e,"D".charCodeAt(0)),e++,c.setUint8(e,"A".charCodeAt(0)),e++,c.setUint8(e,"T".charCodeAt(0)),e++,c.setUint8(e,120),e++,c.setUint8(e,1),e++,c.setUint8(e,128),e++,c.setUint16(e,this.data.byteLength+this.height),e+=2,c.setUint16(e,~(this.data.byteLength+this.height)),e+=2;var f=new Uint8Array(this.data);for(n=0,r=0;r<this.height;r++)for(c.setUint8(e,0),e++,h.update(0),i=0;i<this.width&&n<this.data.byteLength;i++)h.update(f[n]),c.setUint8(e,f[n++]),e++,h.update(f[n]),c.setUint8(e,f[n++]),e++,h.update(f[n]),c.setUint8(e,f[n++]),e++,h.update(f[n]),c.setUint8(e,f[n++]),e++;return c.setUint16(e,h.s2),e+=2,c.setUint16(e,h.s1),e+=2,c.setUint32(e,crc32(t,s+4,this.buffer_size()-8)),e+=4},buffer_size:function(){return 12+this.data.byteLength+this.height+4+2+1+2+2}},PngIEND.prototype={to_buffer:function(t,e){var i=e=e||0,r=new SpiceDataView(t);return r.setUint32(e,this.buffer_size()-12),e+=4,r.setUint8(e,"I".charCodeAt(0)),e++,r.setUint8(e,"E".charCodeAt(0)),e++,r.setUint8(e,"N".charCodeAt(0)),e++,r.setUint8(e,"D".charCodeAt(0)),e++,r.setUint32(e,crc32(t,i+4,this.buffer_size()-8)),e+=4},buffer_size:function(){return 12}};wdi.RunQueue=$.spcExtend(wdi.DomainObject,{tasks:null,isRunning:!1,init:function(){this.tasks=[]},getTasksLength:function(){return this.tasks.length},add:function(n,s,i,t){return this.tasks.push({fn:n,scope:s,fnFinish:i,params:t}),this},clear:function(){return wdi.Debug.log("runqueue clear"),this.tasks=[],this},_process:function(){wdi.ExecutionControl.sync=!0;var n,s=this;this.isRunning=!0;var i=this.tasks.shift();if(i){n={end:function(){i.fnFinish&&i.fnFinish.call(i.scope),s._process()}};try{i.fn.call(i.scope,n,i.params)}catch(s){wdi.Debug.error(s.message),n.end()}return this}this.isRunning=!1},process:function(){this.isRunning||this._process()}}),wdi.ExecutionControl={currentProxy:null,sync:!0,runQ:new wdi.RunQueue};"undefined"==typeof CanvasPixelArray||CanvasPixelArray.prototype.set||(CanvasPixelArray.prototype.set=function(n){for(var t=n.length,r=0;r<t;r++)this[r]=n[r]}),wdi.graphics={tmpCanvas:document.createElement("canvas"),imageLoader:new Image,dispose:function(){wdi.Debug.log("Disposing graphics"),$(this.tmpCanvas).remove(),$(this.imageLoader).remove(),this.tmpCanvas=document.createElement("canvas"),this.imageLoader=new Image,wdi.GlobalPool.dispose(),wdi.ImageCache.dispose(),wdi.ImageUncompressor.dispose(),wdi.RasterOperation.dispose()},getRect:function(n,t){if(0===n.x&&0===n.y&&n.width===t.width&&n.height===t.height)return t;var r=this.getImageFromData(t),e=wdi.graphics.getNewTmpCanvas(n.width,n.height);return e.getContext("2d").drawImage(r,n.x,n.y,n.width,n.height,0,0,n.width,n.height),e},argbToImageData:function(n,t,r){for(var e=n.length,u=wdi.graphics.getTmpCanvas(t,r).getContext("2d").createImageData(t,r),i=0;i<e;i+=4)u.data[i]=n[i],u.data[i+1]=n[i+1],u.data[i+2]=n[i+2],u.data[i+3]=n[i+3];return u},align:function(n,t){return n+(t-1)&~(t-1)},monoMask:[1,2,4,8,16,32,64,128],monoToImageData:function(n,t,r){this.align(t,8);for(var e=n.length,u=e/2,i=wdi.graphics.getTmpCanvas(t,r).getContext("2d").createImageData(t,r),o=[],c=[],a=0;a<e;a++){var f=n[a],d=8;if(a>=u)for(;d--;){var g=f&this.monoMask[d]&&!0;o.push(g)}else if(a<u)for(;d--;){g=f&this.monoMask[d]&&!0;c.push(g)}}var s=0;for(u=c.length,a=0;a<u;a++)s=4*a,o[a]||c[a]?!o[a]&&c[a]?(i.data[s]=255,i.data[s+1]=255,i.data[s+2]=255,i.data[s+3]=0):o[a]&&!c[a]?(i.data[s]=255,i.data[s+1]=255,i.data[s+2]=255,i.data[s+3]=255):o[a]&&c[a]&&(i.data[s]=0,i.data[s+1]=0,i.data[s+2]=0,i.data[s+3]=255):(i.data[s]=0,i.data[s+1]=0,i.data[s+2]=0,i.data[s+3]=255);return i},drawJpeg:function(n,t,r,e){return this.drawBrowserImage(n,t,r,e,"jpeg",!1)},drawBrowserImage:function(n,t,r,e,u,i){var o,c,a=wdi.GlobalPool.create("Image");a.onload=function(){URL.revokeObjectURL(c);try{if(n.flags&wdi.SpiceImageFlags.SPICE_IMAGE_FLAGS_CACHE_ME){var t=wdi.graphics.getTmpCanvas(this.width,this.height);t.getContext("2d").drawImage(this,0,0),wdi.ImageCache.addImage(n,t)}r.call(e,this)}catch(n){wdi.Debug.error(n.message)}finally{wdi.ExecutionControl.currentProxy.end()}},a.onerror=function(){URL.revokeObjectURL(c),wdi.Debug.error("failed to load JPEG image"),wdi.ExecutionControl.currentProxy.end()},i?(o=t,a.src=o):(c=wdi.SpiceObject.bytesToURI(t),a.src=c)},getImageFromSpice:function(n,t,r,e,u,i){var o,c,a,f,d=null;switch(i?(c=i.opaque,a=i.brush,f=i.raw):(c=!1,f=!1,a=!1),n.type){case wdi.SpiceImageType.SPICE_IMAGE_TYPE_LZ_RGB:d=this.processLz(n,t,a,c,r);break;case wdi.SpiceImageType.SPICE_IMAGE_TYPE_LZ_PLT:wdi.Debug.log("lz plt decode"),d=wdi.LZSS.convert_spice_lz_to_web(r.getContext(0),t,n,c);break;case wdi.SpiceImageType.SPICE_IMAGE_TYPE_QUIC:d=this.processQuic(n,t,a,c,r);break;case wdi.SpiceImageType.SPICE_IMAGE_TYPE_JPEG:return wdi.Debug.log("JPEG decode"),wdi.ExecutionControl.sync=!1,void this.drawJpeg(n,t.subarray(4),e,u);case wdi.SpiceImageType.SPICE_IMAGE_TYPE_JPEG_ALPHA:wdi.Debug.log("JPEG Alpha decode"),wdi.ExecutionControl.sync=!1;var g=t.subarray(9);return void this.drawJpeg(n,g,e,u);case wdi.SpiceImageType.SPICE_IMAGE_TYPE_BITMAP:wdi.Debug.log("BMP"),t.toJSArray&&(t=t.toJSArray()),d=new wdi.BMP2(t).marshall(r.getContext(0));break;case wdi.SpiceImageType.SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS:case wdi.SpiceImageType.SPICE_IMAGE_TYPE_FROM_CACHE:return wdi.ExecutionControl.sync=!1,void wdi.ImageCache.getImageFrom(n,(function(n){e.call(u,n),wdi.ExecutionControl.currentProxy.end()}));case wdi.SpiceImageType.SPICE_IMAGE_TYPE_SURFACE:var s=wdi.SpiceObject.bytesToInt32(t.toJSArray());d=r.getContext(s).canvas;break;case wdi.SpiceImageType.SPICE_IMAGE_TYPE_CANVAS:d=t;break;case wdi.SpiceImageType.SPICE_IMAGE_TYPE_PNG:return wdi.ExecutionControl.sync=!1,t=wdi.SpiceObject.bytesToString(t.toJSArray()),void this.drawBrowserImage(n,t,e,u,"png",!0);default:return wdi.Debug.log("Unknown image type: "+n.type),void wdi.ExecutionControl.currentProxy.end()}o=null,n.flags&wdi.SpiceImageFlags.SPICE_IMAGE_FLAGS_CACHE_ME&&wdi.ImageCache.addImage(n,d),o=d.getContext||f?d:this.getImageFromData(d),n.flags&wdi.SpiceImageFlags.SPICE_IMAGE_FLAGS_CACHE_ME&&wdi.ImageCache.addImage(n,o),wdi.ExecutionControl.sync&&e.call(u,o)},processUncompress:function(n,t,r,e,u,i){wdi.ImageUncompressor.getSyncInstance().process(n,t,r,e,u,i,this)},processQuic:function(n,t,r,e,u){var i;return this.processUncompress(n,t,r,e,u,(function(t){var r=new Uint8ClampedArray(t);i=new ImageData(r,n.width,n.height)})),i},processLz:function(n,t,r,e,u){var i;return this.processUncompress(n,t,r,e,u,(function(u){var o=wdi.ImageUncompressor.getSyncInstance().extractLzHeader(t,r),c=new Uint8ClampedArray(u);i=new ImageData(c,n.width,n.height),o.header.top_down||e||(i=this.imageFlip(i))})),i},imageFlip:function(n){return wdi.RasterOperation.flip(this.getImageFromData(n))},getImageFromData:function(n,t){return n.getContext||n instanceof Image?n:((r=t?$("<canvas/>").attr({width:n.width,height:n.height})[0]:this.getNewTmpCanvas(n.width,n.height)).getContext("2d").putImageData(n,0,0),r);var r},getDataFromImage:function(n){return n.getContext("2d").getImageData(0,0,n.width,n.height)},getBoxFromSrcArea:function(n){return{width:n.right-n.left,height:n.bottom-n.top,x:n.left,y:n.top}},setBrush:function(n,t,r,e,u){var i,o,c;if(r.type===wdi.SpiceBrushType.SPICE_BRUSH_TYPE_PATTERN)o=r.pattern.image,this.getImageFromSpice(o,r.pattern.imageData,n,(function(n){if(i=t.createPattern(n,"repeat"),u===wdi.SpiceRopd.SPICE_ROPD_OP_PUT)t.fillStyle=i,t.fillRect(e.x,e.y,e.width,e.height);else{var r=wdi.graphics.getTmpCanvas(e.width,e.height),o=r.getContext("2d");o.fillStyle=i,o.fillRect(0,0,e.width,e.height);var a=wdi.graphics.getRect(e,t.canvas);c=wdi.RasterOperation.process(u,r,a),t.drawImage(c,e.x,e.y,e.width,e.height)}}),this,{opaque:!0});else if(r.type===wdi.SpiceBrushType.SPICE_BRUSH_TYPE_SOLID)if(u===wdi.SpiceRopd.SPICE_ROPD_OP_PUT)t.fillStyle!=r.color.simple_html_color&&(t.fillStyle=r.color.simple_html_color),t.fillRect(e.x,e.y,e.width,e.height);else{var a=wdi.graphics.getTmpCanvas(e.width,e.height),f=a.getContext("2d");f.fillStyle=r.color.html_color,f.fillRect(0,0,e.width,e.height);var d=wdi.graphics.getRect(e,t.canvas);c=wdi.RasterOperation.process(u,a,d),t.drawImage(c,e.x,e.y,e.width,e.height)}},imageIsEntireColor:function(n,t,r,e,u){var i,o=0;do{i=u[o]===n&&u[o+1]===t&&u[o+2]===r,o+=4}while(o!=e&&i);return i},drawBackText:function(n,t,r){var e=r.back_brush,u=r.back_mode,i=wdi.graphics.getBoxFromSrcArea(r.base.box);this.setBrush(n,t,e,i,u)},drawString:function(n,t,r,e,u,i){var o,c,a,f,d,g,s,h,p,w,l,m,I,C,_,E,S,y,v,P,T,x,A,b=e.color,D=t.len,G=t.raster_glyph;for(h=1===r?255:4===r?17:1,l=0;l<D;l++){for(o=(y=G[l]).render_pos,c=y.glyph_origin,a=y.width,f=y.height,d=y.data,g=f,m=new ArrayBuffer(a*f*4),I=new Uint8ClampedArray(m),C=new Uint32Array(m),p=0,w=0;g--;){for(E=_=Math.ceil(a*r/8),S=[];E--;)S.push(d.pop());for(;_--;)for(v=S.pop(),P=8,T=0;P;)x=wdi.bppMask[r][T]&v,1===r&&x?x=1:4===r&&x&&x>15&&(x>>=4),x&&(C[w*a+p]=h*x<<24|b.b<<16|b.g<<8|b.r),P-=r,p++,T++;w++,p=0}A={x:o.x+c.x,y:o.y+c.y-1,width:a,height:f},s=new ImageData(I,a,f);var R=wdi.graphics.getImageFromData(s);i.drawClip(R,A,n),wdi.GlobalPool.discard("Canvas",R)}},getImgDataPosition:function(n,t,r){return 4*(t*r+n)},getTmpCanvas:function(n,t){var r=this.tmpCanvas;return r.width=n,r.height=t,r},getNewTmpCanvas:function(n,t){var r=wdi.GlobalPool.create("Canvas");return r.width=n,r.height=t,r}},wdi.Rop3={1:function(n,t,r){return~(n|t|r)},2:function(n,t,r){return~(n|t)&r},4:function(n,t,r){return~(n|r)&t},6:function(n,t,r){return~(t^~r|n)},7:function(n,t,r){return~(t&r|n)},8:function(n,t,r){return~n&r&t},9:function(n,t,r){return~(t^r|n)},11:function(n,t,r){return~(~r&t|n)},13:function(n,t,r){return~(~t&r|n)},14:function(n,t,r){return~(~(t|r)|n)},16:function(n,t,r){return~(t|r)&n},18:function(n,t,r){return~(n^~r|t)},19:function(n,t,r){return~(n&r|t)},20:function(n,t,r){return~(n^~t|r)},21:function(n,t,r){return~(n&t|r)},22:function(n,t,r){return~(n&t)&r^t^n},23:function(n,t,r){return(t^r)&(t^n)^~t},24:function(n,t,r){return(t^n)&(n^r)},25:function(n,t,r){return~(n&t)&r^~t},26:function(n,t,r){return(n&t|r)^n},27:function(n,t,r){return(n^t)&r^~t},28:function(n,t,r){return(n&r|t)^n},29:function(n,t,r){return(n^r)&t^~r},30:function(n,t,r){return(r|t)^n},31:function(n,t,r){return~((t|r)&n)},32:function(n,t,r){return~t&n&r},33:function(n,t,r){return~(n^r|t)},35:function(n,t,r){return~(~r&n|t)},36:function(n,t,r){return(t^n)&(r^t)},37:function(n,t,r){return~(t&n)&r^~n},38:function(n,t,r){return(t&n|r)^t},39:function(n,t,r){return(t^~n|r)^t},40:function(n,t,r){return(n^t)&r},41:function(n,t,r){return(t&n|r)^t^~n},42:function(n,t,r){return~(t&n)&r},43:function(n,t,r){return(n^r)&(t^n)^~t},44:function(n,t,r){return(t|r)&n^t},45:function(n,t,r){return(~r|t)^n},46:function(n,t,r){return(n^r|t)^n},47:function(n,t,r){return~((~r|t)&n)},49:function(n,t,r){return~(~n&r|t)},50:function(n,t,r){return(t|n|r)^t},52:function(n,t,r){return(t&r|n)^t},53:function(n,t,r){return(t^~r|n)^t},54:function(n,t,r){return(n|r)^t},55:function(n,t,r){return~((n|r)&t)},56:function(n,t,r){return(n|r)&t^n},57:function(n,t,r){return(~r|n)^t},58:function(n,t,r){return(t^r|n)^t},59:function(n,t,r){return~((~r|n)&t)},61:function(n,t,r){return(~(t|r)|n)^t},62:function(n,t,r){return(~t&r|n)^t},64:function(n,t,r){return~r&t&n},65:function(n,t,r){return~(t^n|r)},66:function(n,t,r){return(t^r)&(n^r)},67:function(n,t,r){return~(t&r)&n^~t},69:function(n,t,r){return~(~t&n|r)},70:function(n,t,r){return(r&n|t)^r},71:function(n,t,r){return(n^r)&t^~n},72:function(n,t,r){return(n^r)&t},73:function(n,t,r){return(r&n|t)^r^~n},74:function(n,t,r){return(r|t)&n^r},75:function(n,t,r){return(~t|r)^n},76:function(n,t,r){return~(n&r)&t},77:function(n,t,r){return(t^r|t^n)^~t},78:function(n,t,r){return(n^t|r)^n},79:function(n,t,r){return~((~t|r)&n)},81:function(n,t,r){return~(~n&t|r)},82:function(n,t,r){return(r&t|n)^r},83:function(n,t,r){return(t^r)&n^~t},84:function(n,t,r){return~(~(t|n)|r)},86:function(n,t,r){return(t|n)^r},87:function(n,t,r){return~((t|n)&r)},88:function(n,t,r){return(n|t)&r^n},89:function(n,t,r){return(~t|n)^r},91:function(n,t,r){return(~(r|t)|n)^r},92:function(n,t,r){return(r^t|n)^r},93:function(n,t,r){return~((~t|n)&r)},94:function(n,t,r){return(~r&t|n)^r},96:function(n,t,r){return(t^r)&n},97:function(n,t,r){return(t&r|n)^t^~r},98:function(n,t,r){return(r|n)&t^r},99:function(n,t,r){return(~n|r)^t},100:function(n,t,r){return(t|n)&r^t},101:function(n,t,r){return(~n|t)^r},103:function(n,t,r){return(~(t|n)|r)^t},104:function(n,t,r){return(~(t|r)|n)^t^~r},105:function(n,t,r){return t^r^~n},106:function(n,t,r){return t&n^r},107:function(n,t,r){return(t|n)&r^t^~n},108:function(n,t,r){return n&r^t},109:function(n,t,r){return(r|n)&t^r^~n},110:function(n,t,r){return(~t|n)&r^t},111:function(n,t,r){return~((t^~r)&n)},112:function(n,t,r){return~(t&r)&n},113:function(n,t,r){return(r^n)&(t^r)^~t},114:function(n,t,r){return(t^n|r)^t},115:function(n,t,r){return~((~n|r)&t)},116:function(n,t,r){return(r^n|t)^r},117:function(n,t,r){return~((~n|t)&r)},118:function(n,t,r){return(~t&n|r)^t},120:function(n,t,r){return t&r^n},121:function(n,t,r){return(t|r)&n^t^~r},122:function(n,t,r){return(~r|t)&n^r},123:function(n,t,r){return~((n^~r)&t)},124:function(n,t,r){return(~t|r)&n^t},125:function(n,t,r){return~((t^~n)&r)},126:function(n,t,r){return t^r|n^t},127:function(n,t,r){return~(t&n&r)},128:function(n,t,r){return t&n&r},129:function(n,t,r){return~(t^r|n^t)},130:function(n,t,r){return(t^~n)&r},131:function(n,t,r){return(~t|r)&n^~t},132:function(n,t,r){return(n^~r)&t},133:function(n,t,r){return(~n|t)&r^~n},134:function(n,t,r){return(t|r)&n^t^r},135:function(n,t,r){return t&r^~n},137:function(n,t,r){return(~t&n|r)^~t},138:function(n,t,r){return(~n|t)&r},139:function(n,t,r){return(r^n|t)^~r},140:function(n,t,r){return(~n|r)&t},141:function(n,t,r){return(t^n|r)^~t},142:function(n,t,r){return(r^n)&(r^t)^t},143:function(n,t,r){return~(~(t&r)&n)},144:function(n,t,r){return(t^~r)&n},145:function(n,t,r){return(~t|n)&r^~t},146:function(n,t,r){return(n|r)&t^n^r},147:function(n,t,r){return r&n^~t},148:function(n,t,r){return(t|n)&r^t^n},149:function(n,t,r){return t&n^~r},150:function(n,t,r){return t^n^r},151:function(n,t,r){return(~(t|n)|r)^t^n},152:function(n,t,r){return(~(t|n)|r)^~t},154:function(n,t,r){return~t&n^r},155:function(n,t,r){return(t|n)&r^~t},156:function(n,t,r){return~r&n^t},157:function(n,t,r){return(r|n)&t^~r},158:function(n,t,r){return(t&r|n)^t^r},159:function(n,t,r){return~((t^r)&n)},161:function(n,t,r){return(~n&t|r)^~n},162:function(n,t,r){return(~t|n)&r},163:function(n,t,r){return(r^t|n)^~r},164:function(n,t,r){return(~(n|t)|r)^~n},166:function(n,t,r){return~n&t^r},167:function(n,t,r){return(n|t)&r^~n},168:function(n,t,r){return(t|n)&r},169:function(n,t,r){return(t|n)^~r},171:function(n,t,r){return~(t|n)|r},172:function(n,t,r){return(t^r)&n^t},173:function(n,t,r){return(r&t|n)^~r},174:function(n,t,r){return~n&t|r},176:function(n,t,r){return(~t|r)&n},177:function(n,t,r){return(n^t|r)^~n},178:function(n,t,r){return(t^r|n^t)^t},179:function(n,t,r){return~(~(n&r)&t)},180:function(n,t,r){return~r&t^n},181:function(n,t,r){return(r|t)&n^~r},182:function(n,t,r){return(n&r|t)^n^r},183:function(n,t,r){return~((n^r)&t)},184:function(n,t,r){return(r^n)&t^n},185:function(n,t,r){return(r&n|t)^~r},186:function(n,t,r){return~t&n|r},188:function(n,t,r){return~(t&r)&n^t},189:function(n,t,r){return~((r^n)&(r^t))},190:function(n,t,r){return t^n|r},191:function(n,t,r){return~(t&n)|r},193:function(n,t,r){return(~t&r|n)^~t},194:function(n,t,r){return(~(t|r)|n)^~t},196:function(n,t,r){return(~r|n)&t},197:function(n,t,r){return(t^r|n)^~t},198:function(n,t,r){return~n&r^t},199:function(n,t,r){return(n|r)&t^~n},200:function(n,t,r){return(n|r)&t},201:function(n,t,r){return(r|n)^~t},202:function(n,t,r){return(r^t)&n^r},203:function(n,t,r){return(t&r|n)^~t},205:function(n,t,r){return~(n|r)|t},206:function(n,t,r){return~n&r|t},208:function(n,t,r){return(~r|t)&n},209:function(n,t,r){return(n^r|t)^~n},210:function(n,t,r){return~t&r^n},211:function(n,t,r){return(t|r)&n^~t},212:function(n,t,r){return(r^n)&(n^t)^t},213:function(n,t,r){return~(~(t&n)&r)},214:function(n,t,r){return(t&n|r)^t^n},215:function(n,t,r){return~((t^n)&r)},216:function(n,t,r){return(n^t)&r^n},217:function(n,t,r){return(t&n|r)^~t},218:function(n,t,r){return~(r&t)&n^r},219:function(n,t,r){return~((t^r)&(n^t))},220:function(n,t,r){return~r&n|t},222:function(n,t,r){return n^r|t},223:function(n,t,r){return~(n&r)|t},224:function(n,t,r){return(t|r)&n},225:function(n,t,r){return(t|r)^~n},226:function(n,t,r){return(r^n)&t^r},227:function(n,t,r){return(n&r|t)^~n},228:function(n,t,r){return(t^n)&r^t},229:function(n,t,r){return(n&t|r)^~n},230:function(n,t,r){return~(t&n)&r^t},231:function(n,t,r){return~((r^n)&(n^t))},232:function(n,t,r){return(t^r)&(n^t)^t},233:function(n,t,r){return~(t&r)&n^t^~r},234:function(n,t,r){return t&n|r},235:function(n,t,r){return t^~n|r},236:function(n,t,r){return n&r|t},237:function(n,t,r){return n^~r|t},239:function(n,t,r){return~n|r|t},241:function(n,t,r){return~(t|r)|n},242:function(n,t,r){return~t&r|n},244:function(n,t,r){return~r&t|n},246:function(n,t,r){return t^r|n},247:function(n,t,r){return~(t&r)|n},248:function(n,t,r){return t&r|n},249:function(n,t,r){return t^~r|n},251:function(n,t,r){return~t|n|r},253:function(n,t,r){return~r|t|n},254:function(n,t,r){return t|n|r}};Uint8Array.prototype.toJSArray=function(){if(1==this.length)return[this[0]];for(var t=this.length,i=new Array(t),s=0;s<t;s++)i[s]=this[s];return i},wdi.FixedQueue=$.spcExtend(wdi.DomainObject,{q:null,size:10485760,grow:10485760,woffset:0,roffset:0,init:function(t){this.q=new Uint8Array(this.size)},setData:function(t){this.woffset=t.length,this.roffset=0,this.q.set(t)},shift:function(t){if(this.roffset+t>this.woffset)throw"Not enough queue to read";var i=this.q.subarray(this.roffset,this.roffset+t);return this.roffset=this.roffset+t,this.woffset==this.roffset&&(this.woffset=0,this.roffset=0),i},push:function(t){if(this.woffset+t.byteLength>this.size){var i=this.q;this.size+=this.grow,this.q=new Uint8Array(this.size),this.q.set(i)}this.q.set(t,this.woffset),this.woffset+=t.byteLength},getLength:function(){return this.woffset-this.roffset}}),wdi.Queue=$.spcExtend(wdi.DomainObject,{q:null,raw:!1,init:function(t){t.raw&&(this.raw=t.raw),this.q=new Uint8Array(0)},getData:function(){return this.toJSArray(this.q)},setData:function(t){this.q=new Uint8Array(t.length),this.q.set(t)},shift:function(){var t=arguments[0]||this.getLength();if(t===this.q.length){var i=this.q;this.q=new Uint8Array(0)}else{i=this.q.subarray(0,t);this.q=this.q.subarray(t)}return this.toJSArray(i)},peek:function(t,i){var s=null;return s=0!=t||i?this.q.subarray(t,i):this.q,this.toJSArray(s)},push:function(t){if("string"==typeof t){var i=t.length;(e=new Uint8Array(this.q.length+i)).set(this.q);for(var s=0;s<i;s++)e[s+this.q.length]=t[s];this.q=e}else{var e;if(0===this.getLength())this.q=new Uint8Array(t.length),this.q.set(t);else(e=new Uint8Array(t.length+this.q.length)).set(this.q),e.set(t,this.q.length),this.q=e}},getLength:function(){return this.q.length},toJSArray:function(t){return this.raw?t:t.toJSArray()}}),wdi.ViewQueue=$.spcExtend(wdi.DomainObject,{q:null,at:null,init:function(){this.q=new Uint8Array,this.at=0},getData:function(){return this.toJSArray(this.q.subarray(this.at))},getDataOffset:function(t){return this.toJSArray(this.q.subarray(t))},getRawData:function(){return this.q.subarray(this.at)},getRawDataOffset:function(t){return this.q.subarray(t)},setData:function(t){this.q=new Uint8Array(t.length),this.q.set(t),this.at=0},shift:function(t){var i=t||this.getLength();i>this.getLength()&&(i=this.getLength());var s=this.q.subarray(0+this.at,i+this.at);return this.at+=i,this.toJSArray(s)},eatBytes:function(t){this.at+=t},getByte:function(t){return this.q[t+this.at]},peek:function(t,i){var s=null;return 0!=t||i?(i&&(i+=this.at),s=this.q.subarray(t+this.at,i)):s=this.q,this.toJSArray(s)},push:function(t){if("string"==typeof t){var i=t.length;(e=new Uint8Array(this.q.length+i)).set(this.q);for(var s=0;s<i;s++)e[s+this.q.length]=t[s];this.q=e}else{var e;if(0===this.getLength())this.q=new Uint8Array(t.length),this.q.set(t);else(e=new Uint8Array(t.length+this.q.length)).set(this.q),e.set(t,this.q.length),this.q=e}},getLength:function(){return this.q.length-this.at},getPosition:function(){return this.at},toJSArray:function(t){return 1==t.length?[t[0]]:t.toJSArray()}});var syncInstance,asyncInstance;wdi.ImageUncompressor=$.spcExtend(wdi.EventObject.prototype,{init:function(e){this.syncAsyncHandler=e.syncAsyncHandler||new wdi.SyncAsyncHandler({isAsync:e.isAsync})},lzHeaderSize:32,extractLzHeader:function(e,n){var s,c;return n?c=wdi.LZSS.demarshall_rgb(e):("[object Array]"===Object.prototype.toString.call(e)?(s=e.slice(0,this.lzHeaderSize),e=e.slice(this.lzHeaderSize)):(s=e.subarray(0,this.lzHeaderSize).toJSArray(),e=e.subarray(this.lzHeaderSize)),c=wdi.LZSS.demarshall_rgb(s)),{header:c,imageData:e}},processLz:function(e,n,s,c,a,r){var t,i,d,y;e=(t=this.extractLzHeader(e,n)).imageData,y=t.header.width*t.header.height*4,d=new ArrayBuffer(e.length+16),(i=new Uint8Array(d))[0]=1,i[1]=s,i[2]=t.header.type,i[3]=t.header.top_down;for(var o=0;o<4;o++)i[4+o]=255&y,y>>=8;var h=new DataView(d);h.setUint32(8,t.header.width),h.setUint32(12,t.header.height),i.set(e,16),this.syncAsyncHandler.dispatch(d,a,r)},processQuic:function(e,n,s,c,a){wdi.Debug.log("Quic decode"),buffer=new ArrayBuffer(e.length+4),view=new Uint8Array(buffer),view.set(e,4),view[3]=n?1:0,view[0]=0,this.syncAsyncHandler.dispatch(buffer,c,a)},process:function(e,n,s,c,a,r,t){switch(e.type){case wdi.SpiceImageType.SPICE_IMAGE_TYPE_QUIC:this.processQuic(n,c,a,r,t);break;case wdi.SpiceImageType.SPICE_IMAGE_TYPE_LZ_RGB:this.processLz(n,s,c,a,r,t)}},dispose:function(){this.syncAsyncHandler.dispose()}}),wdi.ImageUncompressor.dispose=function(){syncInstance&&syncInstance.dispose(),asyncInstance&&asyncInstance.dispose()},wdi.ImageUncompressor.getSyncInstance=function(){return syncInstance||(syncInstance=new wdi.ImageUncompressor({isAsync:!1})),syncInstance},wdi.ImageUncompressor.getAsyncInstance=function(){return asyncInstance||(asyncInstance=new wdi.ImageUncompressor({isAsync:!0})),asyncInstance};wdi.SyncAsyncHandler=$.spcExtend(wdi.EventObject.prototype,{init:function(s){this.isAsync=!!s.isAsync,this.isAsync&&(this.asyncWorker=s.asyncWorker||new wdi.AsyncWorker({script:wdi.spiceClientPath+"/spice-console-minify/WorkerProcess.min.js"}))},isAsync:null,dispatch:function(s,i,n){if(this.isAsync)this.asyncWorker.run(s,i,n);else{var c=window.workerDispatch(s,this.isAsync);i.call(n,c)}},dispose:function(){this.isAsync&&this.asyncWorker.dispose()}});wdi.IntegrationBenchmark={benchmarking:!1,startTime:0,timeoutInterval:3e3,timeOutId:void 0,busConnection:void 0,setEndTime:function(){var t=this;this.timeOutId=setTimeout((function(){t.timeOutId=void 0,t.benchmarking=!1;var e=(new Date).getTime()-t.startTime-t.timeoutInterval;t.onEndBenchmarkCallback(e);var i={type:wdi.BUS_TYPES.killApplicationDoNotUseInProductionEver,application:"EXCEL.EXE"};t.busConnection.send(i)}),this.timeoutInterval)},setStartTime:function(){void 0!==this.timeOutId&&clearTimeout(this.timeOutId)},launchApp:function(t,e){this.busConnection=t,wdi.IntegrationBenchmark.benchmarking=!0,wdi.IntegrationBenchmark.setStartTime(),this.onEndBenchmarkCallback=e,this.startTime=(new Date).getTime();var i={type:wdi.BUS_TYPES.launchApplication,file:"c:\\Users\\eyeos\\Desktop\\test.xlsx"};this.busConnection.send(i)}};wdi.StuckKeysHandler=$.spcExtend(wdi.EventObject.prototype,{ctrlTimeoutId:null,altTimeoutId:null,shiftTimeoutId:null,shiftKeyPressed:!1,ctrlKeyPressed:!1,altKeyPressed:!1,dispose:function(){wdi.Debug.log("Disposing StuckKeysHandler"),clearTimeout(this.ctrlTimeoutId),clearTimeout(this.altTimeoutId),clearTimeout(this.shiftTimeoutId),this.ctrlTimeoutId=null,this.altTimeoutId=null,this.shiftTimeoutId=null,this.shiftKeyPressed=!1,this.ctrlKeyPressed=!1,this.altKeyPressed=!1},handleStuckKeys:function(e){if(e)switch(e.keyCode){case 16:this._handleKey("shiftTimeoutId",e.type,16);break;case 17:this._handleKey("ctrlTimeoutId",e.type,17);break;case 18:this._handleKey("altTimeoutId",e.type,18)}},releaseAllKeys:function(){var e;for(e=0;e<300;e++)this.releaseKeyPressed(e)},_handleKey:function(e,s,t){"keydown"===s?this[e]=this._configureTimeout(t):"keyup"===s&&clearTimeout(this[e])},_configureTimeout:function(e){var s=this;return setTimeout((function(){s.releaseKeyPressed(e)}),wdi.StuckKeysHandler.defaultTimeout)},releaseKeyPressed:function(e){var s=window.jQuery.Event("keyup");s.which=e,s.keyCode=e,s.charCode=0,s.generated=!0,this.fire("inputStuck",["keyup",[s]])},checkSpecialKey:function(e,s){switch(s){case 16:this.shiftKeyPressed="keydown"===e;break;case 17:this.ctrlKeyPressed="keydown"===e;break;case 18:this.altKeyPressed="keydown"===e}},releaseSpecialKeysPressed:function(){this.shiftKeyPressed&&(this.releaseKeyPressed(16),this.shiftKeyPressed=!1),this.ctrlKeyPressed&&(this.releaseKeyPressed(17),this.ctrlKeyPressed=!1),this.altKeyPressed&&(this.releaseKeyPressed(18),this.altKeyPressed=!1)}}),wdi.StuckKeysHandler.defaultTimeout=2e3;wdi.TimeLapseDetector=$.spcExtend(wdi.EventObject.prototype,{lastTime:null,init:function(t){this.superInit()},dispose:function(){this.lastTime=null},startTimer:function(){var t=this;this.lastTime=Date.now(),window.setInterval((function(){var e=Date.now(),i=e-t.lastTime;i>=t.constructor.maxIntervalAllowed&&t.fire("timeLapseDetected",i),t.lastTime=e}),wdi.TimeLapseDetector.defaultInterval)},getLastTime:function(){return this.lastTime},setLastTime:function(t){return this.lastTime=t,this}}),wdi.TimeLapseDetector.defaultInterval=5e3,wdi.TimeLapseDetector.maxIntervalAllowed=3*wdi.TimeLapseDetector.defaultInterval;wdi.DisplayRouter=$.spcExtend(wdi.EventObject.prototype,{init:function(i){this.time=Date.now(),this.clientGui=i.clientGui,this.rasterEngine=i.rasterEngine||new wdi.RasterEngine({clientGui:this.clientGui}),i.routeList?this.routeList=i.routeList:this._initRoutes()},dispose:function(){this.rasterEngine.dispose(),this.clientGui=null,this.rasterEngine=null,this.routeList=null},_initRoutes:function(){wdi.Debug.log("displayRouter",this.time),this.routeList={},this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_SURFACE_CREATE]=this.rasterEngine.drawCanvas,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_SURFACE_DESTROY]=this.rasterEngine.removeCanvas,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_COPY]=this.rasterEngine.drawImage,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_FILL]=this.rasterEngine.drawFill,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND]=this.rasterEngine.drawAlphaBlend,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_WHITENESS]=this.rasterEngine.drawWhiteness,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_BLACKNESS]=this.rasterEngine.drawBlackness,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_TRANSPARENT]=this.rasterEngine.drawTransparent,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_COPY_BITS]=this.rasterEngine.drawCopyBits,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_TEXT]=this.rasterEngine.drawText,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_STROKE]=this.rasterEngine.drawStroke,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_ROP3]=this.rasterEngine.drawRop3,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_INVERS]=this.rasterEngine.drawInvers,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_CREATE]=this.rasterEngine.handleStreamCreate,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DESTROY]=this.rasterEngine.handleStreamDestroy,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DATA]=this.rasterEngine.handleStreamData,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_CLIP]=this.rasterEngine.handleStreamClip,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DATA_SIZED]=this.rasterEngine.handleStreamDataSized,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT]=this.rasterEngine.handleStreamActiveReport,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_BLEND]=this.rasterEngine.drawBlend,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_INVAL_LIST]=this.rasterEngine.invalList,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES]=this.rasterEngine.invalPalettes,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_MARK]=!1,this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_RESET]=this.rasterEngine.handleReset},processPacket:function(i){if(i){var t=this.routeList[i.messageType];t&&t.call(this.rasterEngine,i)}else wdi.Debug.log("DisplayProcess processPacket: Skipping empty message...")}});const _SOI=new Uint8Array([255,216]),_EOI=new Uint8Array([255,217]);wdi.RasterEngine=$.spcExtend(wdi.EventObject.prototype,{chunks:[],size:0,jpegInst:null,init:function(e){this.time=Date.now(),this.clientGui=e.clientGui,this.codecH264=wdi.CodecH264,this.codecVp8=wdi.CodecVp8,this.codecH265=wdi.CodecH265},dispose:function(){this.clientGui=null},drawCanvas:function(e){return wdi.Debug.log("rasterEngine",this.time),this.clientGui.drawCanvas(e)},removeCanvas:function(e){return this.clientGui.removeCanvas(e)},invalList:function(e){var t=e.args.items,i=null;for(var a in t)i=t[a],wdi.ImageCache.delImage(i.id)},handleStreamCreate:function(e){var t=e.args;switch(t.computedBox=wdi.graphics.getBoxFromSrcArea(t.rect),wdi.Stream.addStream(e.args.id,t),console.log("%chandleStreamCreate","color:rgb(100,255,100)"),t.codec){case wdi.SpiceVideoCodecType.SPICE_VIDEO_CODEC_TYPE_H264:this.handleH264StreamCreate(t.id);break;case wdi.SpiceVideoCodecType.SPICE_VIDEO_CODEC_TYPE_VP8:this.handleVp8StreamCreate(t.id);break;case wdi.SpiceVideoCodecType.SPICE_VIDEO_CODEC_TYPE_VP9:break;case wdi.SpiceVideoCodecType.SPICE_VIDEO_CODEC_TYPE_H265:this.handleH265StreamCreate(t.id)}wdi.graphicDebug&&wdi.graphicDebug.handleStreamInfo()},handleVp8StreamCreate:function(e){this.codecVp8.create(e)},handleH265StreamCreate:async function(e){const t=wdi.Stream.getStream(e),i=this.clientGui.getContext(t.surface_id),a=t.computedBox;this.codecH265.create(e,i,a)},handleH264StreamCreate:function(e){this.codecH264.create(e)},handleStreamData:function(e){switch(wdi.Stream.getStream(e.args.id).codec){case wdi.SpiceVideoCodecType.SPICE_VIDEO_CODEC_TYPE_MJPEG:this.handleMjpegStream(e);break;case wdi.SpiceVideoCodecType.SPICE_VIDEO_CODEC_TYPE_H264:this.handleH264Stream(e);break;case wdi.SpiceVideoCodecType.SPICE_VIDEO_CODEC_TYPE_VP8:this.handleVp8Stream(e);break;case wdi.SpiceVideoCodecType.SPICE_VIDEO_CODEC_TYPE_VP9:break;case wdi.SpiceVideoCodecType.SPICE_VIDEO_CODEC_TYPE_H265:this.handleH265Stream(e);break;default:this.handleMjpegStream(e)}},handleStreamClip:function(e){wdi.Stream.clip(e.args.id,e.args.clip),wdi.Stream.startTransition(e.args.id),console.log("%chandleStreamClip","color:rgb(100,100,255)")},handleStreamDataSized:function(e){},handleStreamActiveReport:function(e){},handleStreamDestroy:function(e){wdi.Stream.deleteStream(e.args.surface_id),this.codecH264.destroy(e.args.surface_id),this.codecVp8.destroy(),this.codecH265.destroy(),wdi.graphicDebug&&wdi.graphicDebug.handleStreamInfo(),console.log("%chandleStreamDestroy","color:rgb(255,100,100)")},indexOfBytes:function(e,t,i=0){for(let a=i;a<=e.length-t.length;a++){let i=!0;for(let r=0;r<t.length;r++)if(e[a+r]!==t[r]){i=!1;break}if(i)return a}return-1},concatenateChunks:function(e,t){const i=new Uint8Array(t);let a=0;for(const t of e)i.set(t,a),a+=t.length;return i},pushWholeMjpegFrame:function(e){const t=e.length;let i=0;for(;;)if(this.size){const a=this.indexOfBytes(e,_EOI);if(-1===a){this.chunks.push(e),size+=t;break}{i=a+_EOI.length;const r=e.slice(0,i);if(this.chunks.push(r),this.size+=r.length,this.jpegInst=this.concatenateChunks(chunks,size),this.chunks=[],size=0,i===t)break}}else{const a=this.indexOfBytes(e,_SOI,i);if(-1===a)break;i=a+500;const r=this.indexOfBytes(e,_EOI,i);if(-1===r){const t=e.slice(a);this.chunks=[t],this.size=t.length;break}if(i=r+_EOI.length,this.jpegInst=e.slice(a,i),i===t)break}},handleMjpegStream:function(e){const t=e.args.data,i=wdi.Stream.getStream(e.args.id),a=this.clientGui.getContext(i.surface_id),r=i.computedBox;if(this.pushWholeMjpegFrame(new Uint8Array(t)),this.jpegInst){const e=new Blob([this.jpegInst],{type:"image/jpeg"});createImageBitmap(e).then((e=>{if(i.flags&wdi.SpiceStreamFlags.SPICE_STREAM_FLAGS_TOP_DOWN)a.drawImage(e,r.x,r.y,r.width,r.height);else{const t=r.x+e.width/2,i=r.y+e.height/2;a.save(),a.translate(t,i),a.rotate(Math.PI),a.scale(-1,1),a.drawImage(e,r.x-t,r.y-i,r.width,r.height),a.restore()}})).catch(console.error),this.jpegInst=null}},handleH264Stream:function(e){var t=e.args.data,i=wdi.Stream.getStream(e.args.id);if(this.codecH264.isReady[i.id]){var a=this.clientGui.getContext(i.surface_id);wdi.ExecutionControl.sync=!0,wdi.Stream.endTransition(e.args.id),this.codecH264.loadedVideo[i.id]=()=>{var e=i.computedBox;if(!i.flags&wdi.SpiceStreamFlags.SPICE_STREAM_FLAGS_TOP_DOWN){var t=e.x+this.codecH264.video[i.id].width/2,r=e.y+this.codecH264.video[i.id].height/2;a.save(),a.translate(t,r),a.rotate(Math.PI),a.scale(-1,1),a.drawImage(this.codecH264.video[i.id],e.x-t,e.y-r,e.width,e.height),a.restore()}else{if(!this.codecH264.video[i.id]||!this.codecH264.loadedVideo[i.id])return;if(i.transiting)return void requestAnimationFrame(this.codecH264.loadedVideo[i.id]);a.drawImage(this.codecH264.video[i.id],e.x,e.y,e.width,e.height),requestAnimationFrame(this.codecH264.loadedVideo[i.id])}},this.codecH264.feed(i.id,t)}else this.codecH264.addQueue(i.id,t)},handleH265Stream:function(e){const t=e.args.data,i=wdi.Stream.getStream(e.args.id),a=i.computedBox;this.codecH265.isReady[i.id]?(this.codecH265.configed[i.id]||this.codecH265.setConfig(i.id,a),this.codecH265.decode(i.id,t)):this.codecH265.addQueue(i.id,t)},handleVp8Stream:function(e){var t=e.args.data,i=wdi.Stream.getStream(e.args.id),a=this.clientGui.getContext(i.surface_id),r=i.computedBox;this.codecVp8.feed(i.id,t,a,r)},drawRop3:function(e){var t=wdi.graphics.getBoxFromSrcArea(e.args.base.box),i=this.clientGui.getContext(e.args.base.surface_id),a=i.getImageData(t.x,t.y,t.width,t.height),r=this.clientGui,s=e.args.brush,d=e.args.rop_descriptor,g=wdi.graphics.getBoxFromSrcArea(e.args.src_area);wdi.graphics.getImageFromSpice(e.args.src_image.imageDescriptor,e.args.src_image.data,this.clientGui,(function(e){if(e){var c=e.getContext("2d").getImageData(g.x,g.y,g.width,g.height),h=c.data,o=wdi.graphics.getNewTmpCanvas(t.width,t.height),n=o.getContext("2d"),l={width:t.width,height:t.height,x:0,y:0};wdi.graphics.setBrush(r,n,s,l,wdi.SpiceRopd.SPICE_ROPD_OP_PUT);var w=n.getImageData(0,0,t.width,t.height),p=w.data,m=a.data,u=(n=(o=wdi.graphics.getNewTmpCanvas(t.width,t.height)).getContext("2d")).createImageData(t.width,t.height),f=u.data;c.width!=w.width||c.width!=a.width||c.height!=w.height||(c.height,a.height);for(var S=m.length,C=wdi.Rop3[d],_=0;_<S;_+=4)f[_]=255&C(p[_],h[_],m[_]),f[_+1]=255&C(p[_+1],h[_+1],m[_+1]),f[_+2]=255&C(p[_+2],h[_+2],m[_+2]),f[_+3]=255;n.putImageData(u,0,0),this.drawClip(o,t,i)}else wdi.Debug.log("Unable to get image!")}),this)},drawInvers:function(e){var t=e.args.base,i=wdi.graphics.getBoxFromSrcArea(t.box),a=t.surface_id,r=this.clientGui.getContext(a),s=wdi.graphics.getRect(i,r.canvas),d=wdi.RasterOperation.process(wdi.SpiceRopd.SPICE_ROPD_OP_INVERS,null,s);r.drawImage(d,i.x,i.y,i.width,i.height)},drawStroke:function(e){var t,i,a,r,s=e.args,d=this.clientGui.getContext(e.args.base.surface_id),g=s.brush.color.html_color,c=s.path.num_segments;s.attr.flags&wdi.SpiceLineFlags.SPICE_LINE_FLAGS_STYLED&&wdi.Debug.log("SPICE_LINE_FLAGS_STYLED");for(var h=0;h<c;h++){if((r=s.path.segments[h]).flags&wdi.SpicePathFlags.SPICE_PATH_BEGIN&&(d.beginPath(),d.moveTo(r.points[0].x,r.points[0].y),d.strokeStyle=g,d.lineWidth=1),r.flags&wdi.SpicePathFlags.SPICE_PATH_BEZIER){if((t=r.points.length)%3==0)for(a=0;a<t;a+=3)d.bezierCurveTo(r.points[a].x,r.points[a].y,r.points[a+1].x,r.points[a+1].y,r.points[a+2].x,r.points[a+2].y)}else for(t=r.points.length,a=0;a<t;a++)0==a&&(i=r.points[a]),d.lineTo(r.points[a].x+.5,r.points[a].y+.5);r.flags&wdi.SpicePathFlags.SPICE_PATH_END&&(r.flags&wdi.SpicePathFlags.SPICE_PATH_CLOSE&&d.lineTo(i.x+.5,i.y+.5),d.stroke(),d.closePath())}},drawImage:function(e){var t=e.args,i=t.base,a=i.surface_id,r=t.rop_descriptor,s=(t.scale_mode,wdi.graphics.getBoxFromSrcArea(t.src_area)),d=wdi.graphics.getBoxFromSrcArea(i.box);window.vdiLoadTest&&void 0===window.firstImage&&(window.firstImage=!0),wdi.graphics.getImageFromSpice(t.image.imageDescriptor,t.image.data,this.clientGui,(function(e){if(e){var t;if(window.firstImage)t=e.getContext?e.getContext("2d").getImageData(0,0,e.width,e.height).data.buffer.slice(0):e.data.buffer.slice(0),window.firstImageData=t,window.firstImage=!1;var i=!1;if(s.width!==d.width&&s.height!==d.height){i=!0,e=wdi.graphics.getRect(s,e),e=wdi.graphics.getImageFromData(e);var g=wdi.graphics.getNewTmpCanvas(d.width,d.height);g.getContext("2d").drawImage(e,0,0,s.width,s.height,0,0,d.width,d.height),e=g}if(r!==wdi.SpiceRopd.SPICE_ROPD_OP_PUT){i||(e=wdi.graphics.getRect(s,e));var c=wdi.graphics.getRect(d,this.clientGui.getCanvas(a));e=wdi.RasterOperation.process(r,e,c)}var h=this.clientGui.getContext(a);e instanceof ImageData?i?h.putImageData(e,d.x,d.y,0,0,d.width,d.height):h.putImageData(e,d.x,d.y,s.x,s.y,s.width,s.height):i?h.drawImage(e,d.x,d.y,d.width,d.height):h.drawImage(e,s.x,s.y,s.width,s.height,d.x,d.y,d.width,d.height)}else wdi.Debug.log("Unable to get image!")}),this,{opaque:!0,brush:t.brush,raw:!1})},drawClip:function(e,t,i){i.drawImage(e,t.x,t.y,t.width,t.height)},drawFill:function(e){var t=e.args,i=this.clientGui.getContext(t.base.surface_id),a=wdi.graphics.getBoxFromSrcArea(t.base.box),r=t.brush,s=t.rop_descriptor;wdi.graphics.setBrush(this.clientGui,i,r,a,s)},drawCopyBits:function(e){var t=e.args.base,i=t.surface_id,a=e.args.src_position,r=this.clientGui.getContext(i),s=t.box,d=s.right-s.left,g=s.bottom-s.top;r.drawImage(r.canvas,a.x,a.y,d,g,t.box.left,t.box.top,d,g)},drawBlend:function(e){var t=e.args.image.imageDescriptor,i=e.args.base,a=e.args.image.data,r=e.args.base.surface_id,s=e.args.rop_descriptor;e.args.flags;wdi.graphics.getImageFromSpice(t,a,this.clientGui,(function(t){if(t){var a=wdi.graphics.getBoxFromSrcArea(e.args.src_area);t=wdi.graphics.getRect(a,t);var d=wdi.graphics.getBoxFromSrcArea(i.box),g=wdi.graphics.getRect(d,this.clientGui.getCanvas(r)),c=wdi.RasterOperation.process(s,t,g);this.clientGui.getCanvas(r).getContext("2d").drawImage(c,d.x,d.y,d.width,d.height)}else wdi.Debug.log("There is no image on Blend")}),this)},drawAlphaBlend:function(e){var t=e.args.image.imageDescriptor,i=e.args.base,a=e.args.image.data,r=e.args.base.surface_id,s=e.args.alpha_flags,d=e.args.alpha;wdi.graphics.getImageFromSpice(t,a,this.clientGui,(function(t){t||wdi.Debug.log("There is no image on drawAlphaBlend");var a=wdi.graphics.getBoxFromSrcArea(e.args.src_area);t=wdi.graphics.getRect(a,t);var g=wdi.graphics.getBoxFromSrcArea(i.box),c=wdi.graphics.getRect(g,this.clientGui.getCanvas(r));if(a.width!==g.width&&a.height!==g.height){var h=wdi.graphics.getNewTmpCanvas(g.width,g.height);h.getContext("2d").drawImage(t,0,0,a.width,a.height,0,0,g.width,g.height),t=h}for(var o,n,l,w,p,m,u,f=wdi.graphics.getDataFromImage(t).data,S=wdi.graphics.getDataFromImage(c).data,C=f.length-1,_=wdi.graphics.getNewTmpCanvas(g.width,g.height),x=_.getContext("2d").createImageData(g.width,g.height),I=x.data,b=0;b<C;b+=4)o=f[b],l=f[b+1],p=f[b+2],u=s||255===d?f[b+3]:d,n=S[b],w=S[b+1],m=S[b+2],u>30&&255===d?(I[b]=n*(255-u)/255+o&255,I[b+1]=w*(255-u)/255+l&255,I[b+2]=m*(255-u)/255+p&255):(I[b]=(o*u+n*(255-u))/255&255,I[b+1]=(l*u+w*(255-u))/255&255,I[b+2]=(p*u+m*(255-u))/255&255),I[b+3]=255;_.getContext("2d").putImageData(x,0,0),this.drawClip(_,g,this.clientGui.getContext(r))}),this)},drawWhiteness:function(e){var t=e.args.base,i=this.clientGui.getContext(t.surface_id),a=wdi.graphics.getBoxFromSrcArea(t.box);i.fillStyle="white",i.fillRect(a.x,a.y,a.width,a.height)},drawBlackness:function(e){var t=e.args.base,i=this.clientGui.getContext(t.surface_id),a=wdi.graphics.getBoxFromSrcArea(t.box);i.fillStyle="black",i.fillRect(a.x,a.y,a.width,a.height)},drawTransparent:function(e){var t=e.args.base,i=t.surface_id,a=wdi.graphics.getBoxFromSrcArea(e.args.src_area),r=wdi.graphics.getBoxFromSrcArea(t.box),s=this.clientGui.getContext(i).getImageData(r.x,r.y,r.width,r.height);wdi.graphics.getImageFromSpice(e.args.image.imageDescriptor,e.args.image.data,this.clientGui,(function(t){if(t){t=wdi.graphics.getRect(a,t);for(var d=wdi.graphics.getDataFromImage(t).data,g=s.data,c=d.length-1,h=this.clientGui.getContext(i).createImageData(r.width,r.height),o=e.args.transparent_true_color;c>0;)h.data[c]=255,d[c-1]===o.b&&d[c-2]===o.g&&d[c-3]===o.r?(h.data[c-1]=g[c-1],h.data[c-2]=g[c-2],h.data[c-3]=g[c-3]):(h.data[c-1]=d[c-1],h.data[c-2]=d[c-2],h.data[c-3]=d[c-3]),c-=4;var n=wdi.graphics.getImageFromData(h);this.drawClip(n,r,this.clientGui.getContext(i))}else wdi.Debug.log("Unable to get image!")}),this)},drawText:function(e){var t=this.clientGui.getContext(e.args.base.surface_id),i=(e.args.base.box,e.args.base.clip),a=e.args,r=a.glyph_string,s=1===r.flags?1:2*r.flags;0!==a.back_mode&&wdi.graphics.drawBackText(this.clientGui,t,a),wdi.graphics.drawString(t,r,s,a.fore_brush,i.type,this)},invalPalettes:function(e){wdi.ImageCache.clearPalettes()},handleReset:function(e){}});wdi.DataLogger={testStartTime:0,testStopTime:0,networkStart:0,networkTotalTime:0,data:{},routeList:{},imageTypes:{},startTimes:[],init:function(){this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_SURFACE_CREATE]="drawCanvas",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_SURFACE_DESTROY]="removeCanvas",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_COPY]="drawImage",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_FILL]="drawFill",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND]="drawAlphaBlend",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_WHITENESS]="drawWhiteness",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_BLACKNESS]="drawBlackness",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_TRANSPARENT]="drawTransparent",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_COPY_BITS]="drawCopyBits",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_TEXT]="drawText",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_STROKE]="drawStroke",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_ROP3]="drawRop3",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_INVERS]="drawInvers",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_CREATE]="handleStreamCreate",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DESTROY]="handleStreamDestroy",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DATA]="handleStreamData",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_CLIP]="handleStreamClip",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DATA_SIZED]="handleStreamDataSized",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT]="handleStreamActiveReport",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_BLEND]="drawBlend",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_INVAL_LIST]="invalList",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES]="invalPalettes",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_MARK]="displayMark",this.routeList[wdi.SpiceVars.SPICE_MSG_DISPLAY_RESET]="displayReset",this.imageTypes[wdi.SpiceImageType.SPICE_IMAGE_TYPE_BITMAP]="bitmap",this.imageTypes[wdi.SpiceImageType.SPICE_IMAGE_TYPE_QUIC]="quic",this.imageTypes[wdi.SpiceImageType.SPICE_IMAGE_TYPE_RESERVED]="reserved",this.imageTypes[wdi.SpiceImageType.SPICE_IMAGE_TYPE_PNG]="png",this.imageTypes[wdi.SpiceImageType.SPICE_IMAGE_TYPE_LZ_PLT]="lz_plt",this.imageTypes[wdi.SpiceImageType.SPICE_IMAGE_TYPE_LZ_RGB]="lz_rgb",this.imageTypes[wdi.SpiceImageType.SPICE_IMAGE_TYPE_GLZ_RGB]="glz_rgb",this.imageTypes[wdi.SpiceImageType.SPICE_IMAGE_TYPE_FROM_CACHE]="cache",this.imageTypes[wdi.SpiceImageType.SPICE_IMAGE_TYPE_SURFACE]="surface",this.imageTypes[wdi.SpiceImageType.SPICE_IMAGE_TYPE_JPEG]="jpeg",this.imageTypes[wdi.SpiceImageType.SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS]="cache_lossless",this.imageTypes[wdi.SpiceImageType.SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB]="zlib_glz_rgb",this.imageTypes[wdi.SpiceImageType.SPICE_IMAGE_TYPE_JPEG_ALPHA]="jpeg_alpha",this.imageTypes[wdi.SpiceImageType.SPICE_IMAGE_TYPE_CANVAS]="canvas"},setStartTime:function(t){this.startTimes.push(t)},getSpiceMessageType:function(t,e,i){var s=this.routeList[t.messageType];return"drawImage"===s&&(s+="_"+this.imageTypes[t.args.image.imageDescriptor.type]),(e||"")+s+(i||"")},setNetworkTimeStart:function(t){this.networkStart=this.networkStart||t||Date.now()},logNetworkTime:function(){this.networkStart&&(this.networkTotalTime+=Date.now()-this.networkStart,this.networkStart=0)},startTestSession:function(){this.clear(),wdi.logOperations=!0,this.testStartTime=Date.now()},stopTestSession:function(){this.testStopTime=Date.now(),wdi.logOperations=!1},log:function(t,e,i,s,a,S){var _,r=Date.now();_=i||this.getSpiceMessageType(t,a,S),this.data.hasOwnProperty(_)||(this.data[_]=[]),s&&(e=this.startTimes.shift()),this.data[_].push({start:e,end:r})},clear:function(){this.data={},this.testStartTime=0,this.testStopTime=0,this.networkTotalTime=0,this.networkStart=0},getData:function(){return this.data},getStats:function(){var t,e=this.networkTotalTime,i=0,s=e,a=this.testStopTime-this.testStartTime,S=this.data,_={},r="";for(var E in this.data)if(this.data.hasOwnProperty(E)){i+=(t=S[E]).length,_[E]=0;for(var T=0;T<t.length;T++)_[E]+=t[T].end-t[T].start;s+=_[E]}r+="Total operations by number:\n";for(var E in S)S.hasOwnProperty(E)&&(r+=E+": "+~~(S[E].length/i*100)+"% ("+S[E].length+")\n");for(E in r+="Total numOperations: "+i+"\n",r+="---------------------------------\n",r+="\n",r+="Total Operations by time:\n",_)_.hasOwnProperty(E)&&(r+=E+": "+~~(_[E]/a*100)+"% ("+_[E]+"ms)\n");var I=a-s;return r+="Idle: "+~~(I/a*100)+"% ("+I+"ms)\n",r+="Network: "+~~(e/a*100)+"% ("+e+"ms)\n","BEGIN OF PERFORMANCE STATS\n"+(r+="Total time: "+a+"ms \n")+"\nEND OF PERFORMANCE STATS\n"}},wdi.DataLogger.init();wdi.socketStatus={idle:0,prepared:1,connected:2,disconnected:3,failed:4},wdi.Socket=$.spcExtend(wdi.EventObject.prototype,{websocket:null,status:wdi.socketStatus.idle,binary:!1,connect:function(t){var e=this,s="base64";Modernizr.websocketsbinary&&(s="binary",this.binary=!0),this.websocket=new WebSocket(t,s),wdi.Debug.log("Socket: using protocol: "+s),this.binary&&(this.websocket.binaryType="arraybuffer"),this.status=wdi.socketStatus.prepared,this.websocket.onopen=function(){e.status=wdi.socketStatus.connected,e.fire("open")},this.websocket.onmessage=function(t){e.fire("message",t.data)},this.websocket.onclose=function(t){e.status=wdi.socketStatus.disconnected,console.warn("Spice Web Client: ",t.code,t.reason),e.disconnect(),e.fire("close",t)},this.websocket.onerror=function(t){e.status=wdi.socketStatus.failed,e.fire("error",t)}},setOnMessageCallback:function(t){this.websocket.onmessage=t},send:function(t){try{this.websocket.send(this.encode_message(t))}catch(t){this.status=wdi.socketStatus.failed,this.fire("error",t)}},disconnect:function(){this.websocket&&(this.websocket.onopen=function(){},this.websocket.onmessage=function(){},this.websocket.onclose=function(){},this.websocket.onerror=function(){},this.websocket.close(),this.status=wdi.socketStatus.idle,this.binary=!1,this.websocket=null)},setStatus:function(t){this.status=t,this.fire("status",t)},getStatus:function(){return this.status},encode_message:function(t){if(!this.binary)return Base64.encode(t);var e=t.length,s=new ArrayBuffer(e),n=new Uint8Array(s);return n.set(t),n}});wdi.ClusterNodeChooser=$.spcExtend(wdi.EventObject.prototype,{init:function(t){},setNodeList:function(t){this._nodeList=this._shuffle(t),this._nodeListLength=this._nodeList.length,this._currentIndex=0},getAnother:function(){return this._nodeList[this._currentIndex++%this._nodeListLength]},_shuffle:function(t){for(var e,n,i=t.length;i>0;)n=Math.floor(Math.random()*i),e=t[--i],t[i]=t[n],t[n]=e;return t}});wdi.SocketQueue=$.spcExtend(wdi.EventObject.prototype,{rQ:null,sQ:null,socket:null,init:function(t){this.superInit(),this.socket=t.socket||new wdi.Socket,this.rQ=t.rQ||new wdi.FixedQueue,this.sQ=t.sQ||new wdi.Queue,this.setup()},setup:function(){this.socket.addListener("open",(function(){this.fire("open")}),this),this.socket.addListener("message",(function(t){this.rQ.push(new Uint8Array(t)),this.fire("message")}),this),this.socket.addListener("close",(function(t){this.fire("close",t)}),this),this.socket.addListener("error",(function(t){this.fire("error",t)}),this)},getStatus:function(){return this.socket.getStatus()},connect:function(t){this.socket.connect(t)},disconnect:function(){wdi.Debug.log("socket Queue disconnect"),this.socket&&(this.socket.clearEvents(),this.socket.disconnect()),this.rQ=null,this.sQ=null,this.socket=null},send:function(t,s){if(void 0===s)var e=!0;else e=s;this.sQ&&0===this.sQ.getLength()&&e?this.socket.send(t):this.sQ&&(this.sQ.push(t),e&&this.flush())},flush:function(){var t=this.sQ.shift();this.socket.send(t)}});wdi.PacketController=$.spcExtend(wdi.EventObject.prototype,{sizeDefiner:null,packetExtractor:null,init:function(t){this.superInit(),this.sizeDefiner=t.sizeDefiner,this.packetExtractor=t.packetExtractor},dispose:function(){wdi.Debug.log("PacketTroller dispose"),this.clearEvents(),this.packetExtractor.dispose(),this.packetExtractor=null,this.sizeDefiner=null},getNextPacket:function(t){var e=this;wdi.logOperations&&wdi.DataLogger.setNetworkTimeStart();var i=this.sizeDefiner.getSize(t);this.packetExtractor.getBytes(i,(function(t){var i=this.sizeDefiner.getStatus();this.execute(new wdi.RawMessage({status:i,data:t})),e.getNextPacket(t)}),this)},execute:function(t){try{this.fire("chunkComplete",t)}catch(t){console.error("PacketTroller: ",t)}}});wdi.PacketExtractor=$.spcExtend(wdi.EventObject.prototype,{socketQ:null,numBytes:null,callback:null,scope:null,init:function(t){this.superInit(),this.socketQ=t.socketQ,this.setListener()},dispose:function(){this.clearEvents(),this.socketQ.disconnect(),this.socketQ=null,this.numBytes=null,this.callback=null,this.scope=null},setListener:function(){this.socketQ.addListener("message",(function(){wdi.logOperations&&wdi.DataLogger.setNetworkTimeStart(),this.getBytes(this.numBytes,this.callback,this.scope)}),this)},getBytes:function(t,s,e){var i,n=this.socketQ.rQ.getLength();(this.numBytes=t,this.callback=s,this.scope=e,null!==t&&n>=t)?(i=t?this.socketQ.rQ.shift(t):new Uint8Array(0),this.numBytes=null,this.callback=null,this.scope=null,s.call(e,i)):wdi.logOperations&&wdi.DataLogger.logNetworkTime()}});wdi.PacketReassembler=$.spcExtend(wdi.EventObject.prototype,{packetController:null,currentHeader:null,statusToString:null,sizeDefinerConstant:null,init:function(t){this.superInit(),this.packetController=t.packetController,this.sizeDefinerConstant=wdi.SizeDefiner.prototype,this.statusToString=[],this.statusToString[this.sizeDefinerConstant.STATUS_REPLY_BODY]="reply",this.statusToString[this.sizeDefinerConstant.STATUS_ERROR_CODE]="errorCode",this.statusToString[this.sizeDefinerConstant.STATUS_BODY]="spicePacket",this.setListeners()},dispose:function(){wdi.Debug.log("packetReassembler dispose"),this.clearEvents(),this.packetController.dispose(),this.packetController=null,this.currentHeader=null,this.statusToString=null,this.sizeDefinerConstant=null},start:function(){this.packetController.getNextPacket()},setListeners:function(){this.packetController.addListener("chunkComplete",(function(t){var e=t,s=e.status;switch(s){case this.sizeDefinerConstant.STATUS_HEADER:case this.sizeDefinerConstant.STATUS_REPLY:this.currentHeader=e;break;case this.sizeDefinerConstant.STATUS_REPLY_BODY:case this.sizeDefinerConstant.STATUS_BODY:var i=new Uint8Array(e.data.length+this.currentHeader.data.length);i.set(this.currentHeader.data),i.set(e.data,this.currentHeader.data.length),e.data=i,e.status=this.statusToString[s],this.fire("packetComplete",e);break;default:e.status=this.statusToString[s],this.fire("packetComplete",e)}}),this)}});wdi.ReassemblerFactory={getPacketReassembler:function(e){var t=this.getPacketExtractor(e),r=this.getSizeDefiner(),n=this.getPacketController(t,r);return new wdi.PacketReassembler({packetController:n})},getPacketExtractor:function(e){return new wdi.PacketExtractor({socketQ:e})},getSizeDefiner:function(){return new wdi.SizeDefiner},getPacketController:function(e,t){return new wdi.PacketController({packetExtractor:e,sizeDefiner:t})}};wdi.SizeDefiner=$.spcExtend(wdi.DomainObject,{ERROR_CODE_SIZE:4,status:null,STATUS_READY:0,STATUS_REPLY:1,STATUS_REPLY_BODY:2,STATUS_ERROR_CODE:3,STATUS_MESSAGE:4,STATUS_HEADER:5,STATUS_BODY:6,isHeader:!1,init:function(t){this.status=this.STATUS_READY},getSize:function(t){return this.STATUS_READY===this.status?(this.status++,wdi.SpiceLinkHeader.prototype.objectSize):this.STATUS_REPLY===this.status?(this.status++,this.getReplyBodySize(t)):this.STATUS_REPLY_BODY===this.status?(this.status++,this.ERROR_CODE_SIZE):this.STATUS_ERROR_CODE===this.status?(this.status++,this.isHeader=!0,6):this.isHeader?(this.isHeader=!1,this.getBodySizeFromArrayHeader(t)):(this.isHeader=!0,6)},getReplyBodySize:function(t){var e=wdi.GlobalPool.create("ViewQueue");e.setData(t);var i=(new wdi.SpiceLinkHeader).demarshall(e);return wdi.GlobalPool.discard("ViewQueue",e),i.size},getBodySizeFromArrayHeader:function(t){var e=wdi.GlobalPool.create("ViewQueue");e.setData(t);var i=(new wdi.SpiceDataHeader).demarshall(e);return wdi.GlobalPool.discard("ViewQueue",e),i.size},getStatus:function(){return this.status===this.STATUS_MESSAGE&&this.isHeader?this.STATUS_HEADER:this.status!==this.STATUS_MESSAGE||this.isHeader?this.status:this.STATUS_BODY}});wdi.PacketLinkFactory={extract:function(e,i){switch(e.type){case wdi.SpiceVars.SPICE_MSG_SET_ACK:return(new wdi.RedSetAck).demarshall(i);case wdi.SpiceVars.SPICE_MSG_PING:return(new wdi.RedPing).demarshall(i,e.size);case wdi.SpiceVars.SPICE_MSG_MIGRATE:return(new wdi.RedMigrate).demarshall(i);case wdi.SpiceVars.SPICE_MSG_MIGRATE_DATA:return(new wdi.RedMigrateData).demarshall(i,e.size);case wdi.SpiceVars.SPICE_MSG_WAIT_FOR_CHANNELS:return(new wdi.RedWaitForChannels).demarshall(i);case wdi.SpiceVars.SPICE_MSG_DISCONNECTING:return(new wdi.RedDisconnect).demarshall(i);case wdi.SpiceVars.SPICE_MSG_NOTIFY:return(new wdi.RedNotify).demarshall(i);case wdi.SpiceVars.SPICE_MSG_MAIN_MOUSE_MODE:return(new wdi.SpiceMouseMode).demarshall(i)}}},wdi.PacketLinkProcess={process:function(e,i,a){switch(e.type){case wdi.SpiceVars.SPICE_MSG_SET_ACK:var r=wdi.SpiceObject.numberTo32(i.generation);a.setAckWindow(i.window),a.sendObject(r,wdi.SpiceVars.SPICE_MSGC_ACK_SYNC);break;case wdi.SpiceVars.SPICE_MSG_PING:r=new wdi.RedPing({id:i.id,time:i.time}).marshall();a.sendObject(r,wdi.SpiceVars.SPICE_MSGC_PONG);break;case wdi.SpiceVars.SPICE_MSG_MAIN_MOUSE_MODE:a.fire("mouseMode",i.current_mode);break;case wdi.SpiceVars.SPICE_MSG_NOTIFY:a.fire("notify")}}};wdi.SpiceChannel=$.spcExtend(wdi.EventObject.prototype,{counter:0,ackWindow:0,connectionId:0,socketQ:null,packetReassembler:null,channel:1,codec:wdi.SpiceVideoCodecType.SPICE_VIDEO_CODEC_TYPE_MJPEG,proxy:null,token:null,init:function(e){this.superInit(),this.socketQ=e.socketQ||new wdi.SocketQueue,this.packetReassembler=e.packetReassembler||wdi.ReassemblerFactory.getPacketReassembler(this.socketQ),this.setListeners(),this.ackWindow=0},fireHandshakeTimeoutError:function(){var e=new Error("Handshake timeout");e.code=4200,wdi.Debug.error("Handshake timeout reached, raising error"),this.fire("error",e)},setListeners:function(){var e,i=this;this.packetReassembler.addListener("packetComplete",(function(t){var s=t;if("spicePacket"===s.status){wdi.Debug.log("packetComplete spicePacket"),wdi.logOperations&&(wdi.DataLogger.logNetworkTime(),e=Date.now());var a=this.getRawSpiceMessage(s.data);a&&(wdi.logOperations&&a.channel===wdi.SpiceVars.SPICE_CHANNEL_DISPLAY&&wdi.DataLogger.setStartTime(e),this.fire("message",a))}else if("reply"===s.status){wdi.Debug.log("packetComplete reply");var n=this.getRedLinkReplyBytes(s.data);this.send(n)}else if("errorCode"===s.status){wdi.Debug.log("packetComplete errorCode"),(n=this.getErrorCodeBytes(s.data))&&(this.send(n),this.channel,wdi.SpiceVars.SPICE_CHANNEL_DISPLAY),this.fire("channelConnected")}else i.fireHandshakeTimeoutError()}),this),this.socketQ.addListener("open",(function(){var e=this.getRedLinkMessBytes();this.send(e),this.proxy&&this.proxy.end()}),this),this.socketQ.addListener("close",(function(e){1===this.channel&&this.fire("error",e),this.socketQ.disconnect()}),this),this.socketQ.addListener("error",(function(e){this.fire("error",e),this.socketQ.disconnect()}),this)},changeCodec:function(e){this.sendObject([...wdi.SpiceObject.numberTo16(2),...wdi.SpiceObject.numberTo16(e),...wdi.SpiceObject.numberTo16(3)],wdi.SpiceVars.SPICE_MSGC_DISPLAY_PREFERRED_VIDEO_CODEC_TYPE),wdi.currentCodec=e;const{$console:i}=useNuxtApp();i.changeCodec(e),console.log(`codec changed: ${e}`)},connect:function(e,i,t,s){var a=wdi.Utils.generateWebSocketUrl(e.protocol,e.host,e.port,e.vmHost,e.vmPort,"spice",e.vmInfoToken,e.vmid);this.channel=i,this.connectionId=t||0,this.socketQ.connect(a),this.proxy=s,this.token=e.token,this.packetReassembler.start()},disconnect:function(){wdi.Debug.log("spicechannel disconnect"),this.counter=0,this.ackWindow=0,this.connectionId=0,this.socketQ.disconnect(),this.socketQ=null,this.packetReassembler.dispose(),this.packetReassembler=null,this.channel=1,this.proxy=null,this.token=null},send:function(e,i){this.socketQ.send(e,i)},sendObject:function(e,i,t){for(var s=0;s<e.length;s+=2048){var a=e.slice(s,s+2048),n=new wdi.SpiceDataHeader({type:i,size:a.length}).marshall();n=n.concat(a),this.send(n,t)}},arrayOfNumberToUint32:function(e){let i=0;for(let t of e)i|=1<<t;return i},setAckWindow:function(e){this.ackWindow=e,this.counter=0},getRawSpiceMessage:function(e){var i=wdi.GlobalPool.create("ViewQueue"),t=wdi.GlobalPool.create("ViewQueue"),s=new Uint8Array(e,0,wdi.SpiceDataHeader.prototype.objectSize);i.setData(s);var a=(new wdi.SpiceDataHeader).demarshall(i);wdi.GlobalPool.discard("ViewQueue",i);var n=e.subarray(wdi.SpiceDataHeader.prototype.objectSize);if(t.setData(n),this.counter++,this.ackWindow&&this.counter===this.ackWindow){this.counter=0;var c=new wdi.SpiceDataHeader({type:wdi.SpiceVars.SPICE_MSGC_ACK,size:0}).marshall();this.send(c)}var r=wdi.PacketLinkFactory.extract(a,t)||!1;if(r)return wdi.PacketLinkProcess.process(a,r,this),wdi.GlobalPool.discard("ViewQueue",t),!1;var o=wdi.GlobalPool.create("RawSpiceMessage");return o.set(a,t,this.channel),o},getRedLinkReplyBytes:function(e){if(this.token){var i=new wdi.ViewQueue;i.setData(e),i.eatBytes(wdi.SpiceLinkHeader.prototype.objectSize);var t=(new wdi.SpiceLinkReply).demarshall(i);const s=window.password||this.token;return wdi.SpiceObject.stringHexToBytes(RSA_public_encrypt(s,t.pub_key))}return wdi.SpiceObject.stringToBytesPadding("",128)},getRedLinkMessBytes:function(){var e=new wdi.SpiceLinkHeader({magic:1363428690,major_version:2,minor_version:2,size:26}).marshall(),i=new wdi.SpiceLinkMess({connection_id:this.connectionId,channel_type:this.channel,caps_offset:18,num_common_caps:1,num_channel_caps:1,common_caps:1<<wdi.SpiceVars.SPICE_COMMON_CAP_MINI_HEADER,channel_caps:this.arrayOfNumberToUint32([wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_SIZED_STREAM,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_STREAM_REPORT,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_MONITORS_CONFIG,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_MULTI_CODEC,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_PREF_VIDEO_CODEC_TYPE,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_MJPEG,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_VP8,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_H264,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_VP9,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_H265,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_LZ4_COMPRESSION,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_PREF_COMPRESSION])}).marshall();return e.concat(i)},getErrorCodeBytes:function(e){var i=wdi.GlobalPool.create("ViewQueue");i.setData(e);var t=wdi.SpiceObject.bytesToInt32NoAllocate(i);wdi.GlobalPool.discard("ViewQueue",i);let s=this.channel===wdi.SpiceVars.SPICE_CHANNEL_DISPLAY?"display":"main";switch(this.channel){case wdi.SpiceVars.SPICE_CHANNEL_MAIN:s="main";break;case wdi.SpiceVars.SPICE_CHANNEL_DISPLAY:s="display";break;case wdi.SpiceVars.SPICE_CHANNEL_INPUTS:s="inputs";break;case wdi.SpiceVars.SPICE_CHANNEL_CURSOR:s="cursor";break;case wdi.SpiceVars.SPICE_CHANNEL_PLAYBACK:s="playback";break;case wdi.SpiceVars.SPICE_CHANNEL_RECORD:s="record";break;case wdi.SpiceVars.SPICE_CHANNEL_TUNNEL:s="tunnel";break;case wdi.SpiceVars.SPICE_CHANNEL_SMARTCARD:s="smartcard";break;case wdi.SpiceVars.SPICE_CHANNEL_USBREDIR:s="usbredir"}if(7===t?console.log(`%c error code: 7; channel: ${s} (${this.channel})`,"color: red"):t>0&&console.log("getErrorCodeBytes",`error code: ${t}`,`channel: ${s} (${this.channel})`),0===t){if(this.channel===wdi.SpiceVars.SPICE_CHANNEL_DISPLAY){var a=new wdi.SpiceDataHeader({type:wdi.SpiceVars.SPICE_MSGC_DISPLAY_INIT,size:14}).marshall(),n=new wdi.SpiceCDisplayInit({pixmap_cache_id:1,pixmap_cache_size:1,glz_dictionary_id:0,glz_dictionary_window_size:0}).marshall();return a.concat(n)}if(this.channel==wdi.SpiceVars.SPICE_CHANNEL_MAIN)return new wdi.SpiceDataHeader({type:wdi.SpiceVars.SPICE_MSGC_MAIN_ATTACH_CHANNELS,size:0}).marshall()}else{if(7!==t)throw new wdi.Exception({message:"Server refused client",errorCode:2});if(this.channel===wdi.SpiceVars.SPICE_CHANNEL_MAIN){const e=location.pathname.match(/id=(.+)/)[1];let i=window.sessionStorage.getItem(`password-${e}`);window.passwordInit&&(i=""),window.password=i||window.prompt("Enter the password"),window.password&&window.sessionStorage.setItem(`password-${e}`,window.password),window.passwordInit=!0}}}});wdi.BusConnection=$.spcExtend(wdi.EventObject.prototype,{ws:null,subscriptions:[],_busUser:null,_busPass:null,queue:"",binary:!1,init:function(s){this.superInit(),this.ws=s.websocket||new wdi.WebSocketWrapper,this.clusterNodeChooser=s.clusterNodeChooser||new wdi.ClusterNodeChooser,this.binary=s.binary||!1},connect:function(s){s.useBus?(this._vdiBusToken=s.vdiBusToken,s.busHostList||(wdi.Debug.warn("Deprecated: using old busHost & busPort params"),s.busHostList=[{host:s.busHost,port:s.busPort}]),this.clusterNodeChooser.setNodeList(s.busHostList),Modernizr.websocketsbinary&&(this.binary=!0),this._busUser=s.busUser,this._busPass=s.busPass,this._websockifyProtocol=s.protocol,this._websockifyHost=s.host,this._websockifyPort=s.port,this.subscriptions=s.busSubscriptions,this._connectToNextHost()):wdi.Debug.warn("Not using the bus")},_connectToNextHost:function(){var s=this.clusterNodeChooser.getAnother(),t=wdi.Utils.generateWebSocketUrl(this._websockifyProtocol,this._websockifyHost,this._websockifyPort,s.host,s.port,"raw",this._vdiBusToken),e="base64";this.binary&&(e="binary"),this.ws.connect(t,e),wdi.Debug.log("BusConnection: using protocol: "+e),this.binary&&this.ws.setBinaryType("arraybuffer"),this.setListeners()},disconnect:function(){this.ws.close(),this.queue="",this.subscriptions=[]},setListeners:function(){var s=this;this.ws.onOpen((function(t){s._send("CONNECT\nlogin:"+s._busUser+"\npasscode:"+s._busPass+"\n\n\0")})),this.ws.onMessage((function(t){var e,n;s.binary?(e=String.fromCharCode.apply(null,new Uint8Array(t.data)),e=decodeURIComponent(escape(e))):e=Base64.decodeStr(t.data);var i=e.split("\0");if(1==i.length)s.queue+=i[0];else{for(var o=0;o<i.length-1;o++)e=s.queue+i[o],n=s.parseMessage(e),s.fire("busMessage",n),s.queue="";s.queue=i[i.length-1]}})),this.ws.onClose((function(t){wdi.Debug.log("BusConnection CLOSED! connecting again in 1 second"),s.fire("error",t)})),this.ws.onError((function(s){wdi.Debug.error("BusConnection ERROR:",s)}))},parseMessage:function(s){try{var t=s.split("\n\n"),e=t[0].trim(),n=t[1].replace(/\x00/,"").trim();n=0!=n.length?JSON.parse(n):null;var i=(t=e.split("\n")).shift();e="{";for(var o=t.length,r=0;r<o;r++){var u=t[r].split(":")[0];e+='"'+u+'":"'+t[r].replace(u+":","")+'"',r!=o-1&&(e+=",")}return e+="}",{verb:i,header:JSON.parse(e),body:n}}catch(s){return wdi.Debug.error("Error parsing Bus Info: ",s),{verb:"ERROR"}}},setSubscriptions:function(){for(var s=this.subscriptions.length,t=0;t<s;t++)this.subscribe(this.subscriptions[t])},send:function(s){var t=this.subscriptions[0];this._send("SEND\ndestination:"+t+"\ncontent-type:text/plain\n\n"+JSON.stringify(s)+"\0")},subscribe:function(s){this._send("SUBSCRIBE\ndestination:"+s+"\n\n\0")},_send:function(s){this.binary?this.ws.send(s):this.ws.send(Base64.encodeStr(s))}});wdi.WebSocketWrapper=$.spcExtend({},{ws:{},onopen:null,onmessage:null,onclose:null,onerror:null,init:function(){},connect:function(n,o){this.ws=new WebSocket(n,o)},onOpen:function(n){this.ws.onopen=n},onMessage:function(n){this.ws.onmessage=n},onClose:function(n){this.ws.onclose=n},onError:function(n){this.ws.onerror=n},setBinaryType:function(n){this.ws.binaryType=n},close:function(){this.ws&&this.ws.close&&(this.ws.close(),this.ws.onopen=function(){},this.ws.onmessage=function(){},this.ws.onclose=function(){},this.ws.onerror=function(){},this.onopen=function(){},this.onmessage=function(){},this.onclose=function(){},this.onerror=function(){})},send:function(n){this.ws.send(n)}});wdi.ConnectionControl=$.spcExtend(wdi.EventObject.prototype,{socket:null,pendingTimeToConnectionLost:null,previousTimeOut:null,init:function(t){this.superInit(),this.socket=t.socket||new wdi.Socket},connect:function(t){var n=wdi.Utils.generateWebSocketUrl(t.protocol,t.host,t.port,null,null,"raw",t.heartbeatToken);this.socket.connect(n),this.pendingTimeToConnectionLost=t.heartbeatTimeout,wdi.Debug.log("ConnectionControl: connected"),this.setListeners()},disconnect:function(){wdi.Debug.log("Connection Control disconnect"),this.previousTimeOut&&clearTimeout(this.previousTimeOut),this.socket.disconnect(),this.socket=null,this.pendingTimeToConnectionLost=null,this.previousTimeOut=null},setListeners:function(){var t=this;this.socket.setOnMessageCallback((function(n){wdi.Debug.log("ConectionControl: beat"),clearTimeout(t.previousTimeOut),t.previousTimeOut=setTimeout((function(){wdi.Debug.log("ConnectionControl: firing connectionLost event"),t.fire("connectionLost",n)}),t.pendingTimeToConnectionLost)}))}});wdi.CheckActivity=$.spcExtend(wdi.EventObject.prototype,{init:function(t){this.superInit(),this.milliseconds=t||6e5,this.eventHandlers={keydown:this.resetActivity.bind(this),mousemove:this.resetActivity.bind(this),click:this.resetActivity.bind(this)},this.activityTimeout=this.createTimeout(),$(document).on(this.eventHandlers)},resetActivity:function(t){clearTimeout(this.activityTimeout),this.activityTimeout=this.createTimeout()},createTimeout:function(){var t=this;return setTimeout((function(){t.fire("activityLost")}),this.milliseconds)},dispose:function(){$(document).off(this.eventHandlers),clearTimeout(this.activityTimeout)}});wdi.Agent=$.spcExtend(wdi.EventObject.prototype,{clientTokens:null,serverTokens:10,app:null,clipboardEnabled:!0,windows:null,clipboard:null,DELAY_BETWEEN_GRAB_AND_CTRLV:30,init:function(e){this.superInit(),this.app=e.app,this.clipboard=new wdi.Clipboard},dispose:function(){this.clientTokens=null,this.serverTokens=10,this.app=null,this.clipboardContent=null,this.clipboardEnabled=!0,this.windows=null},sendInitMessage:function(){var e=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_MAIN_AGENT_START,channel:wdi.SpiceVars.SPICE_CHANNEL_MAIN,args:new wdi.SpiceMsgMainAgentTokens({num_tokens:this.serverTokens})});this.app.spiceConnection.send(e);var n=1<<wdi.AgentCaps.VD_AGENT_CAP_MONITORS_CONFIG;this.clipboardEnabled&&(n|=1<<wdi.AgentCaps.VD_AGENT_CAP_CLIPBOARD_BY_DEMAND);var s={type:wdi.AgentMessageTypes.VD_AGENT_ANNOUNCE_CAPABILITIES,opaque:0,data:new wdi.VDAgentAnnounceCapabilities({request:0,caps:n})};this.sendAgentPacket(s)},setResolution:function(e,n){e<800&&(e=800),n<600&&(n=600);var s={type:wdi.AgentMessageTypes.VD_AGENT_MONITORS_CONFIG,opaque:0,data:new wdi.VDAgentMonitorsConfig({num_of_monitors:1,flags:0,data:new wdi.VDAgentMonConfig({width:e,height:n,depth:32,x:0,y:0})})};this.sendAgentPacket(s)},setClientTokens:function(e){this.clientTokens=e},sendAgentPacket:function(e){this.clientTokens--;var n=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_MAIN_AGENT_DATA,channel:wdi.SpiceVars.SPICE_CHANNEL_MAIN,args:new wdi.VDAgentMessage({protocol:1,type:e.type,opaque:e.opaque,data:e.data})});this.app.spiceConnection.send(n)},sendServerTokens:function(){var e=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_MAIN_AGENT_TOKEN,channel:wdi.SpiceVars.SPICE_CHANNEL_MAIN,args:new wdi.SpiceMsgMainAgentTokens({num_tokens:10})});this.app.spiceConnection.send(e),this.serverTokens=10},onAgentData:function(e){if(this.serverTokens--,0==this.serverTokens&&this.sendServerTokens(),e.type==wdi.AgentMessageTypes.VD_AGENT_ANNOUNCE_CAPABILITIES);else if(e.type==wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD_GRAB){var n=this.clipboard.createRequest(e.clipboardType);this.sendAgentPacket(n)}else if(e.type==wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD)this.fire("clipBoardData",e.clipboardData);else if(e.type==wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD_REQUEST){n=this.clipboard.createContent();this.sendAgentPacket(n)}else e.type==wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD_RELEASE||e.type==wdi.AgentMessageTypes.VD_AGENT_REPLY||(e.type==wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_TOKEN?this.clientTokens+=e.args.num_tokens:console.warn("unknown message received by agent",e))},setClipboard:function(e){this.clipboard.setContent(e);var n=this.clipboard.createGrab();this.sendAgentPacket(n)},disableClipboard:function(){this.clipboardEnabled=!1}});wdi.CodecH264={video:{},jmuxer:{},loadedVideo:{},queues:{},isReady:{},create:function(e){if(this.video[e])return;const t=document.createElement("video");t.id=`video${e}`,t.setAttribute("autoplay",""),this.video[e]=t,this.jmuxer[e]=new JMuxer({node:t,mode:"video",flushingTime:0,fps:60,onReady:()=>{this.isReady[e]=!0}})},addQueue:function(e,t){this.queues[e]||(this.queues[e]=[]),this.queues[e].push(t)},resetQueues:function(e){this.queues[e]=[]},feed:function(e,t){this._addListener(e),this.queues[e]?.length&&(this.queues[e].forEach((t=>{this.jmuxer[e].feed({video:t})})),this.resetQueues(e)),this.jmuxer[e].feed({video:t})},destroy:function(e){this._removeListener(e),this.video[e]?.remove(),this.video={},this.jmuxer={},this.loadedVideo={}},_addListener:function(e){this.video[e]?.removeEventListener("loadedmetadata",this.loadedVideo[e]),this.video[e].addEventListener("loadedmetadata",this.loadedVideo[e])},_removeListener:function(e){this.video[e]?.removeEventListener("loadedmetadata",this.loadedVideo[e])}},wdi.CodecVp8={decoders:{},create:function(e){this.decoders[e]=new vp8_decoder_ctx},destroy:function(){this.decoders={}},feed:function(e,t,i,d){const s=vp8_dixie_decode_frame(this.decoders[e],t,t.length);VPX_CODEC_OK===s&&this._I420toRGBA(this.decoders[e].ref_frames[0].img,i,d)},_I420toRGBA:function(e,t,i){const d=e.w,s=e.d_h,o=e.d_w;let n,r,u,a=t.createImageData(o,s),h=a.data;for(let t=0;t<s;t++)for(let i=0;i<o;i++){const a=e.planes[0][e.planes_off[0]+0+i+d*t],c=e.planes[1][e.planes_off[1]+0+(i>>1)+(d>>1)*(t>>1)],f=e.planes[2][e.planes_off[2]+0+(i>>1)+(d>>1)*(t>>1)];n=Math.round(a+1.13983*(f-128)),r=Math.round(a-.39465*(c-128)-.5806*(f-128)),u=Math.round(a+2.03211*(c-128));const m=4*((s-1-t)*o+i);h[m]=n,h[m+1]=r,h[m+2]=u,h[m+3]=255}t.putImageData(a,i.x,i.y)}},wdi.CodecH265={queue:{},configed:{},isReady:{},decoders:{},pendingFrames:{},underflow:{},baseTime:{},create:async function(e,t,i){const d={output:this._handleFrame.bind(this,e,t,i),error:e=>{console.log(e)}},s={codec:wdi.SpiceVideoCodecValue[wdi.currentCodec],codedWidth:640,codedHeight:480},{supported:o}=await VideoDecoder.isConfigSupported(s);o?(this.decoders[e]=new VideoDecoder(d),this.decoders[e].configure(s),this.isReady[e]=!0):(window.alert("H.265 codec is not supported in this browser. Please try a different codec or use another browser."),console.log("not supported"))},destroy:function(){this.queue={},this.configed={},this.isReady={},this.decoders={},this.pendingFrames={},this.underflow={},this.baseTime={}},addQueue:function(e,t){this.queues[e]||(this.queues[e]=[]),this.queues[e].push(t)},resetQueues:function(e){this.queues[e]=[]},setConfig:function(e,t){const i={codec:wdi.SpiceVideoCodecValue[wdi.currentCodec],codedWidth:t.width,codedHeight:t.height};this.decoders[e].configure(i),this.configed[e]=!0},decode:function(e,t){this.queue[e]?.length&&(this.queue[e].forEach((t=>{const i=new EncodedVideoChunk({type:"key",data:t,timestamp:performance.now()});this.decoders[e].decode(i)})),this.resetQueues(e));const i=new EncodedVideoChunk({type:"key",data:t,timestamp:performance.now()});this.decoders[e].decode(i)},_handleFrame:function(e,t,i,d){this.pendingFrames[e]||(this.pendingFrames[e]=[]),this.pendingFrames[e].push(d),void 0===this.underflow[e]&&(this.underflow[e]=!0),this.underflow[e]&&setTimeout(this._renderFrame.bind(this,e,t,i),0)},_renderFrame:async function(e,t,i){if(this.underflow[e]=0===this.pendingFrames[e].length,this.underflow[e])return;const d=this.pendingFrames[e].shift(),s=this._calculateTimeUntilNextFrame(d.timestamp,e);await new Promise((e=>{setTimeout(e,s)})),t.drawImage(d,i.x,i.y,i.width,i.height),d.close(),setTimeout(this._renderFrame.bind(this,e,t,i),0)},_calculateTimeUntilNextFrame:function(e,t){this.baseTime[t]||(this.baseTime[t]=performance.now());const i=performance.now()-this.baseTime[t];return Math.max(0,e/1e3-i)}};wdi.Clipboard=$.spcExtend(wdi.EventObject.prototype,{_blob:null,_type:null,getSpiceType:function(e){switch(e){case"text/plain":return wdi.ClipBoardTypes.VD_AGENT_CLIPBOARD_UTF8_TEXT;case"image/png":return wdi.ClipBoardTypes.VD_AGENT_CLIPBOARD_IMAGE_PNG;default:throw new Error("Unsupported mime type "+e)}},getMimeType:function(e){switch(e){case wdi.ClipBoardTypes.VD_AGENT_CLIPBOARD_UTF8_TEXT:return"text/plain";case wdi.ClipBoardTypes.VD_AGENT_CLIPBOARD_IMAGE_PNG:return"image/png";default:throw new Error("Unsupported spice type "+e)}},createGrab:function(){return{type:wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD_GRAB,opaque:0,data:new wdi.VDAgentClipboardGrab({types:[this.getSpiceType(this._type)]})}},createRequest:function(e){return{type:wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD_REQUEST,opaque:0,data:new wdi.VDAgentClipboardRequest({type:e})}},createContent:function(){return{type:wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD,opaque:0,data:new wdi.VDAgentClipboard({type:this.getSpiceType(this._type),data:this._blob})}},setContent:function(e){this._type=e.type,this._blob=e.blob},getContent:function(){return{blob:this._blob,type:this._type}}});wdi.ClipboardDataParser=$.spcExtend(wdi.EventObject.prototype,{fileReader:null,init:function(e){this.fileReader=e.FileReader||FileReader},parse:function(e,t){var n=this,r=["image/png","text/plain"];function i(e,t){switch(e.kind){case"string":return function(e,t){var n=e.type;e.getAsString((function(e){return t({type:n,blob:e})}))}(e,t);case"file":return function(e,t){var r=e.type,i=e.getAsFile(),a=new n.fileReader;a.addEventListener("loadend",(function(){return t({type:r,blob:a.result})})),a.readAsArrayBuffer(i)}(e,t)}}var a=e.items;if(a)for(var l=0;l<r.length;l++)for(var f=r[l],s=0;s<a.length;s++){var o=a[s];if(o.type==f)return i(o,t)}else if(e.getData){f="text/plain";e.types.contains(f)&&t({type:f,blob:e.getData(f)})}}});wdi.LocalClipboard=$.spcExtend(wdi.EventObject.prototype,{init:function(o){this.clipboardContainer=$('<div style="position:absolute;top:-10000000px;"><textarea id="remoteClipboard" style="position:absolute;top:-10000000px;font-size: 20px;color:black;z-index: 100" rows="4" cols="50"></textarea></div>'),$("#vmw").prepend(this.clipboardContainer),this.clientGui=o.clientGui,this.eventHandlers={keydown:this.triggerCopyToClipboard.bind(this)},$(document).on(this.eventHandlers),this.delayCopyEvents={mousedown:this.copyToClipboard.bind(this),mouseup:this.copyToClipboard.bind(this),keydown:this.copyToClipboard.bind(this),keyup:this.copyToClipboard.bind(this)},$(document).on(this.delayCopyEvents)},updateClipboardBuffer:function(o){$("#remoteClipboard").val(o)},triggerCopyToClipboard:function(o){(function(o){var e=o.ctrlKey;return-1!=navigator.appVersion.indexOf("Mac")&&(e=o.metaKey),67===o.keyCode&&e})(o)&&(this.clipboardCopyDelay=Date.now()+1e3,o.preventDefault(),this.copyToClipboard(o))},copyToClipboard:function(o){if(this.clipboardCopyDelay&&!(this.clipboardCopyDelay<Date.now())){!function(o){$("#remoteClipboard").focus();try{var e=document.execCommand("copy");$("#remoteClipboard").blur(),$("#inputmanager").focus(),console.log("Result executeCommand",o.type,"-----",e)}catch(o){console.error(o)}}(o)}},dispose:function(){this.clipboardContainer.remove(),$(document).off(this.eventHandlers),$(document).off(this.delayCopyEvents)}});wdi.SpiceConnection=$.spcExtend(wdi.EventObject.prototype,{channels:null,connectionId:null,connectionInfo:null,runQ:null,token:null,connectionControl:null,init:function(n){this.superInit(),this.channels={},this.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN]=n.mainChannel||new wdi.SpiceChannel,this.channels[wdi.SpiceVars.SPICE_CHANNEL_DISPLAY]=n.displayChannel||new wdi.SpiceChannel,this.channels[wdi.SpiceVars.SPICE_CHANNEL_INPUTS]=n.inputsChannel||new wdi.SpiceChannel,this.channels[wdi.SpiceVars.SPICE_CHANNEL_CURSOR]=n.cursorChannel||new wdi.SpiceChannel,this.channels[wdi.SpiceVars.SPICE_CHANNEL_PLAYBACK]=n.playbackChannel||new wdi.SpiceChannel,this.runQ=n.runQ||new wdi.RunQueue,this.connectionControl=n.connectionControl||new wdi.ConnectionControl,this.setup()},connect:function(n){this.connectionInfo=n,n.connectionControl&&this.connectionControl.connect(n),this.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN].connect(this.connectionInfo,wdi.SpiceVars.SPICE_CHANNEL_MAIN)},disconnect:function(){for(var n in wdi.Debug.log("spiceConnection disconnect"),this.runQ.clear(),this.clearEvents(),this.channels)this.channels[n].disconnect(),this.channels[n].clearEvents(),this.channels[n]=null,delete this.channels[n];this.connectionControl.disconnect(),this.runQ=null,this.token=null,this.channels=null,this.connectionId=null,this.connectionInfo=null,this.connectionControl=null},send:function(n){var e=n.args.marshall();this.channels[n.channel]?this.channels[n.channel].sendObject(e,n.messageType):console.error("channel not available",n.channel)},setup:function(){this.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN].addListener("connectionId",this.onConnectionId,this),this.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN].addListener("channelListAvailable",this.onChannelList,this),this.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN].addListener("mouseMode",this.onMouseMode,this),this.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN].addListener("initAgent",this.onInitAgent,this),this.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN].addListener("notify",this.onNotify,this),this.connectionControl.addListener("connectionLost",this.onDisconnect,this),this._setConnectedListeners();var n=null;for(var e in n=wdi.exceptionHandling?this.onChannelMessageExceptionHandled:this.processChannelMessage,this.channels)this.channels.hasOwnProperty(e)&&(this.channels[e].addListener("message",n,this),this.channels[e].addListener("status",this.onStatus,this),this.channels[e].addListener("error",this.onDisconnect,this))},_setConnectedListeners:function(){this._setConnectedListener(wdi.SpiceVars.SPICE_CHANNEL_MAIN),this._setConnectedListener(wdi.SpiceVars.SPICE_CHANNEL_DISPLAY),this._setConnectedListener(wdi.SpiceVars.SPICE_CHANNEL_INPUTS),this._setConnectedListener(wdi.SpiceVars.SPICE_CHANNEL_CURSOR),this._setConnectedListener(wdi.SpiceVars.SPICE_CHANNEL_PLAYBACK)},_setConnectedListener:function(n){this.channels[n].addListener("channelConnected",(function(){this.fire("channelConnected",n)}),this)},onDisconnect:function(n){this.fire("error",n)},onConnectionId:function(n){this.connectionId=n},onChannelList:function(n){this.connectChannels(n)},connectChannels:function(n){for(var e in this.channels)(e=parseInt(e,10))!=wdi.SpiceVars.SPICE_CHANNEL_MAIN&&-1!=n.indexOf(e)&&this.runQ.add((function(n,e){this.channels[e].connect(this.connectionInfo,e,this.connectionId,n)}),this,!1,e);this.runQ.process()},onInitAgent:function(n){var e=n;this.fire("initAgent",e)},onMouseMode:function(n){var e=n;this.fire("mouseMode",e)},onNotify:function(n){this.fire("notify")},onStatus:function(n){},onChannelMessageExceptionHandled:function(n){try{return this.processChannelMessage(n)}catch(n){wdi.Debug.error("SpiceConnection: Packet decodification error",n)}},processChannelMessage:function(n){var e=wdi.PacketFactory.extract(n);wdi.GlobalPool.discard("ViewQueue",n.body),wdi.GlobalPool.discard("RawSpiceMessage",n),e?this.fire("message",e):(wdi.Debug.log("Unknown packet "+n.channel+" "+n.header.type),wdi.Debug.log(n))}});wdi.SPICE_INPUT_MOTION_ACK_BUNCH=8,wdi.ClientGui=$.spcExtend(wdi.EventObject.prototype,{width:null,height:null,canvas:null,ack_wait:0,mouse_mode:0,mouse_status:0,eventLayer:null,counter:0,mainCanvas:0,firstTime:!0,clientOffsetX:0,clientOffsetY:0,magnifier:null,magnifierBackground:null,firstMove:!0,isMagnified:!0,isMouseDown:!1,soundStarted:!1,canvasMarginY:0,canvasMarginX:0,stuckKeysHandler:null,isKeyboardEnabled:!1,subCanvas:{},inputManager:null,clipboardEnabled:!0,layer:null,freezeClass:"freeze",app:{},init:function(e){this.time=Date.now(),this.canvas={},this.contexts={},this.superInit(),this.magnifier=window.$("<canvas/>").attr({width:150,height:150}).css({position:"absolute",left:"0px",top:"0px"}),this.stuckKeysHandler=e.stuckKeysHandler||new wdi.StuckKeysHandler,this.settings=e.settings||{},this.stuckKeysHandler.addListener("inputStuck",this._sendInput.bind(this),this),this.magnifierBackground=window.$("<img/>"),this.magnifierBackground.attr("src","/spice-console/resources/magnifier.png"),this.initSound(),this.inputManager=e.inputManager||new wdi.InputManager({stuckKeysHandler:this.stuckKeysHandler,window:$(window)}),this.inputManager.setCurrentWindow(window),this.clipBoardDataParser=e.clipBoardDataParser||new wdi.ClipboardDataParser({}),this.localClipboard=e.localClipboard||new wdi.LocalClipboard({clientGui:this}),this.app=e.app;var t=this;this.eventHandlers={hide:function(){t.stuckKeysHandler.releaseAllKeys()}},window.$(document).on(this.eventHandlers)},dispose:function(){wdi.Debug.log("Disposing ClientGui"),$(document).off(this.eventHandlers),this.unbindDOM(),this.removeAllCanvases(),this.inputManager.dispose(),this.stuckKeysHandler.dispose(),this.localClipboard.dispose(),this.width=null,this.height=null,this.canvas=null,this.ack_wait=0,this.mouse_mode=0,this.mouse_status=0,this.eventLayer=null,this.counter=0,this.mainCanvas=0,this.firstTime=!0,this.clientOffsetX=0,this.clientOffsetY=0,this.magnifier=null,this.magnifierBackground=null,this.firstMove=!0,this.isMagnified=!0,this.isMouseDown=!1,this.soundStarted=!1,this.canvasMarginY=0,this.canvasMarginX=0,this.stuckKeysHandler=null,this.subCanvas={},this.inputManager=null,this.clipboardEnabled=!0,this.layer=null,clearInterval(self.rightClickTimer),clearInterval(self.mouseDownTimer)},removeAllCanvases:function(){var e=this;Object.keys(this.canvas).forEach((function(t){$(e.canvas[t]).remove(),delete e.canvas[t],delete e.contexts[t]})),$(this.eventLayer).remove(),this.eventLayer=null},unbindDOM:function(){if(this.eventLayer){["touchstart","touchmove","touchend","mouseup","mousedown","mousemove","contextmenu","mousewheel"].forEach((function(e){$(this.eventLayer).unbind(e)}))}},freeze:function(){if(this.canvas[0]){var e=new Image,t=this.canvas[0],n=$(t);$(e).attr("style",n.attr("style")),$(e).attr("class",this.freezeClass),e.src=t.toDataURL("image/png"),n.parent().append($(e))}},cancelFreeze:function(){$("."+this.freezeClass).remove()},setLayer:function(e){this.layer=e},disableClipboard:function(){this.clipboardEnabled=!1},_sendInput:function(e){var t=e,n=t[0],i=t[1];this.fire("input",[n,i])},releaseAllKeys:function(){this.stuckKeysHandler.releaseAllKeys()},getContext:function(e){return this.contexts[e]},getCanvas:function(e){return this.canvas[e]},checkFeatures:function(){return!(!Modernizr.canvas||!Modernizr.websockets)||(alert("Your Browser is not compatible with WDI. Visit ... for a list of compatible browsers"),!1)},deleteSubCanvas:function(e){var t=this.subCanvas[e.hwnd];return this.subCanvas[e.hwnd]=null,t},moveSubCanvas:function(e){var t=this.subCanvas[e.hwnd];return t.info=e,this._fillSubCanvasFromWindow(e),t},resizeSubCanvas:function(e){var t=this.subCanvas[e.hwnd];return $([t.canvas,t.eventLayer]).attr({width:e.width,height:e.height}),t.info=e,this._fillSubCanvasFromWindow(e),t},_fillSubCanvasFromWindow:function(e){var t=parseInt(e.top,10),n=parseInt(e.left,10),i=parseInt(e.width,10),a=parseInt(e.height,10);this.fillSubCanvas({top:t,left:n,right:n+i,bottom:t+a})},createNewSubCanvas:function(e){var t=this.createEventLayer(e.hwnd+"_event",e.width,e.height);return this.subCanvas[e.hwnd]={canvas:$("<canvas/>").attr({width:e.width,height:e.height}).css({display:e.iconic?"none":"block"})[0],eventLayer:t,info:e,position:0},this.canvas[this.mainCanvas]&&this._fillSubCanvasFromWindow(e),[this.subCanvas[e.hwnd]]},fillSubCanvas:function(e){var t=this.canvas[this.mainCanvas],n=null;for(var i in this.subCanvas)if(null!=this.subCanvas[i]&&void 0!==this.subCanvas[i]&&this.subCanvas.hasOwnProperty(i))if(n=this.subCanvas[i].info,null!=e||null!=e){var a=parseInt(n.top,10),s=parseInt(n.left,10),o={top:a,left:s,right:s+parseInt(n.width,10),bottom:a+parseInt(n.height,10)};wdi.CollisionDetector.thereIsBoxCollision(o,e)&&this._doDrawSubCanvas(t,this.subCanvas[i],n)}else this._doDrawSubCanvas(t,this.subCanvas[i],n)},_doDrawSubCanvas:function(e,t,n){if(null!=this.canvas[this.mainCanvas]&&null!=this.canvas[this.mainCanvas]){var i=null;if(0===n.iconic){i=t.canvas.getContext("2d");var a=0,s=0,o=+n.width,r=+n.height,u=+n.left,l=+n.top;u<0&&(o+=u,a=-u,u=0),l<0&&(r+=l,s=-l,l=0);try{o=Math.max(1,Math.floor(o)),r=Math.max(1,Math.floor(r)),o>e.width&&(o=e.width),r>e.height&&(r=e.height),i.drawImage(e,u,l,o,r,a,s,o,r)}catch(e){wdi.Debug.error(e)}}}},removeCanvas:function(e){var t=e.args;t.surface_id===this.mainCanvas&&($(this.eventLayer).remove(),this.eventLayer=null),this.canvas[t.surface_id].keepAlive=!1,delete this.canvas[t.surface_id],delete this.contexts[t.surface_id]},drawCanvas:function(e){wdi.Debug.log("clientgui time: ",this.time);var t=e.args,n=wdi.GlobalPool.create("Canvas");if(n.keepAlive=!0,n.id="canvas_"+t.surface_id,n.width=t.width*this.pixelRatio,n.height=t.height*this.pixelRatio,n.style.position="absolute",n.style.top=this.canvasMarginY+"px",n.style.left=this.canvasMarginX+"px",n.style.width=t.width+"px",n.style.height=t.height+"px",this.canvas[t.surface_id]=n,this.contexts[t.surface_id]=n.getContext("2d"),t.flags&&!wdi.SeamlessIntegration){this.mainCanvas=t.surface_id,this.eventLayer=this.createEventLayer("eventLayer",t.width,t.height);var i=$(this.eventLayer).css({position:"absolute",top:this.canvasMarginY+"px",left:this.canvasMarginX+"px"})[0];this.layer?(this.layer.appendChild(n),this.layer.appendChild(i)):(document.body.appendChild(n),document.body.appendChild(i)),!this.isKeyboardEnabled&&this.enableKeyboard()}if(this.firstTime&&this.clipboardEnabled){var a=this,s=this.settings.PASTES_PER_SECOND||5,o=_.throttle((function(e){a.fire("paste",e)}),1e3/s);$(document).bind("paste",(function(e){a.clipBoardDataParser.parse(e.originalEvent.clipboardData,o)})),$(document).bind("copy",(function(e){a.app.sendShortcut(wdi.keyShortcutsHandled.CTRLC)})),this.firstTime=!1}t.flags&&this.fire("resolution",[this.canvas[t.surface_id].width,this.canvas[t.surface_id].height])},disableKeyboard:function(){var e=window.$(window.document);e.unbind("keydown",this.handleKey),e.unbind("keyup",this.handleKey),e.unbind("keypress",this.handleKey),this.inputManager.disable()},enableKeyboard:function(){var e=this,t=window.$(window.document);t.keydown([e],this.handleKey),t.keypress([e],this.handleKey),t.keyup([e],this.handleKey),this.inputManager.enable(),!this.isKeyboardEnabled&&(this.isKeyboardEnabled=!0)},setCanvasMargin:function(e){this.canvasMarginX=e.x,this.canvasMarginY=e.y},createEventLayer:function(e,t,n){var i=this,a=$("<canvas/>").css({cursor:"default",position:"absolute"}).attr({id:e,width:t,height:n});window.bowser.firefox&&a.attr("contentEditable",!0),a.bind("touchstart",(function(e){e.preventDefault();var t=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],n=t.pageX,a=t.pageY;i.generateEvent.call(i,"mousemove",[n+i.clientOffsetX,a+i.clientOffsetY,i.mouse_status]),1===e.originalEvent.touches.length?(i.enabledTouchMove=!0,i.launchRightClick.call(i,n,a)):2===e.originalEvent.touches.length?(i.touchX=n,i.touchY=a,i.enabledTouchMove=!1):3===e.originalEvent.touches.length&&(i.touchY3=a,i.enabledTouchMove=!1)})),a.bind("touchmove",(function(e){var t=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],n=t.pageX,a=t.pageY;if(1===e.originalEvent.touches.length&&i.enabledTouchMove){i.isMagnified=!0,clearInterval(i.rightClickTimer),i.isMouseDown||(clearInterval(i.mouseDownTimer),i.launchMouseDown()),i.generateEvent.call(i,"mousemove",[n+i.clientOffsetX,a+i.clientOffsetY-80,i.mouse_status]);var s=$(this).offset(),o=n-s.left,r=a-s.top;i.firstMove&&($("body").append(i.magnifier),i.firstMove=!1);var u=o-75,l=r-160;i.magnifier.css({left:u,top:l});var h=i.magnifier[0].getContext("2d");h.clearRect(0,0,150,150),h.save(),h.beginPath(),h.arc(75,75,75,0,2*Math.PI,!1),h.clip(),h.drawImage(i.getCanvas(0),o-50,r-50-80,100,100,0,0,150,150),h.drawImage(i.magnifierBackground[0],0,0),h.restore()}else if(2===e.originalEvent.touches.length){var c=i.touchY-a;if(Math.abs(c)>10){var d=c>0?4:3;i.touchX=n,i.touchY=a,i.generateEvent.call(i,"mousedown",d),i.generateEvent.call(i,"mouseup",d)}}else if(3===e.originalEvent.touches.length){(c=i.touchY3-a)>100&&document.getElementById("hiddeninput").select()}e.preventDefault()})),a.bind("touchend",(function(e){if(i.enabledTouchMove){var t=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0];t.pageX,t.pageY;i.isMouseDown||i.generateEvent.call(i,"mousedown",0),i.isMouseDown=!1,i.generateEvent.call(i,"mouseup",0);$(this).offset();i.enabledTouchMove=!1,i.firstMove=!0,i.isMagnified&&i.magnifier.remove(),i.isMagnified=!1}clearInterval(i.rightClickTimer),clearInterval(i.mouseDownTimer)})),a.mouseup((function(e){var t=e.button;i.generateEvent.call(i,"mouseup",t),i.mouse_status=0,e.preventDefault()})),a.mousedown((function(e){var t=e.button;i.generateEvent.call(i,"mousedown",t),i.mouse_status=1,e.preventDefault()})),a.mousemove((function(e){if(i.mouse_mode!==wdi.SpiceMouseModeTypes.SPICE_MOUSE_MODE_SERVER||!e.bubbles){var t=e.pageX,n=e.pageY;i.generateEvent.call(i,"mousemove",[(t+i.clientOffsetX-i.eventLayer.offsetLeft)*i.pixelRatio,(n+i.clientOffsetY-i.eventLayer.offsetTop)*i.pixelRatio,i.mouse_status]),e.preventDefault()}})),a.bind("contextmenu",(function(e){return e.preventDefault(),!1}));var s=_.throttle((function(e,t){var n=t>0?3:4;return i.generateEvent.call(i,"mousedown",n),i.generateEvent.call(i,"mouseup",n),!1}),60);return a.bind("mousewheel",s),this.fire("eventLayerCreated",a[0]),wdi.VirtualMouse.setEventLayer(a[0],0,0,t,n,1),a[0]},launchRightClick:function(e,t){var n=this;this.rightClickTimer=setTimeout((function(){n.generateEvent.call(n,"mousedown",2),n.generateEvent.call(n,"mouseup",2),n.enabledTouchMove=!1}),400)},launchMouseDown:function(e,t){var n=this;this.mouseDownTimer=setTimeout((function(){n.isMouseDown=!0,n.generateEvent.call(n,"mousedown",0)}),1500)},showError:function(e){wdi.Debug.warn(e),$("<div/>",{id:"error"}).html(e).css({"background-color":"#ff4141"}).appendTo("body"),setTimeout("$('#error').remove()",2e3)},generateEvent:function(e,t){if("mousemove"===e||"joystick"===e)this.ack_wait<wdi.SPICE_INPUT_MOTION_ACK_BUNCH&&(this.ack_wait++,this.fire("input",[e,t]));else{if(e.indexOf("key")>-1){if(this.stuckKeysHandler.checkSpecialKey(e,t[0].keyCode),!this.shouldGenerateKeyEvents(t[0].keyCode))return;var n="keypress"===e?this.inputManager.getValue():"";"keypress"===e&&$("#inputmanager").val(""),n&&(t=this.inputManager.manageChar(n,t))}this.fire("input",[e,t])}},shouldGenerateKeyEvents:function(e){return!this.inputManager.isSpecialKey(e)},motion_ack:function(){this.ack_wait=0},setMouseMode:function(e){this.mouse_mode=e},handleKey:function(e){e.data[0].generateEvent.call(e.data[0],e.type,[e]),wdi.Keymap.isInKeymap(e.keyCode)&&"keypress"!==e.type&&e.preventDefault()},setClientOffset:function(e,t){this.clientOffsetX=e,this.clientOffsetY=t},setClipBoardData:function(e){navigator.clipboard.writeText(e)},setToLocalClipboard:function(e){this.localClipboard.updateClipboardBuffer(e.value)},getStuckKeysHandler:function(){return this.stuckKeysHandler},initSound:function(){var e=this;if(Modernizr.touch){var t=$("<button>Start</button>",{id:"startAudio"}).css({padding:"10px 25px",fontSize:"25px",fontFamily:"Verdana",cursor:"pointer",margin:"0 auto"}).click((function(){e.soundStarted=!0,e.fire("startAudio"),$("#soundButtonContainer").remove()})),n=$('<div id="messageContainer"><p>Click to start using your virtual session:</p></div>').css({color:"white",textAlign:"center",fontSize:"25px",fontFamily:"Verdana",marginTop:"75px"}),i=$("<div></div>",{id:"soundButtonContainer"});t.appendTo(n),n.appendTo(i),i.appendTo("body"),i.css({position:"absolute",zIndex:999999999,top:0,left:0,width:"100%",height:document.height,backgroundColor:"black"})}else this.soundStarted=!0,window.setTimeout((function(){e.fire("startAudio")}),100)}});wdi.PacketProcess=$.spcExtend(wdi.DomainObject,{processors:{},init:function(s){this.processors[wdi.SpiceVars.SPICE_CHANNEL_MAIN]=s.mainProcess||new wdi.MainProcess({app:s.app}),this.processors[wdi.SpiceVars.SPICE_CHANNEL_DISPLAY]=s.displayProcess||new wdi.DisplayPreProcess({clientGui:s.clientGui,disableMessageBuffering:s.disableMessageBuffering}),this.processors[wdi.SpiceVars.SPICE_CHANNEL_INPUTS]=s.inputsProcess||new wdi.InputProcess({clientGui:s.clientGui,spiceConnection:s.spiceConnection}),this.processors[wdi.SpiceVars.SPICE_CHANNEL_CURSOR]=s.cursorProcess||new wdi.CursorProcess,this.processors[wdi.SpiceVars.SPICE_CHANNEL_PLAYBACK]=s.playbackProcess||new wdi.PlaybackProcess({app:s.app})},process:function(s){return wdi.exceptionHandling?this.processExceptionHandled(s):this.processPacket(s)},processExceptionHandled:function(s){try{return this.processPacket(s)}catch(s){wdi.Debug.error("PacketProcess: Error processing packet",s)}},processPacket:function(s){if(!s||!this.processors[s.channel])throw"Invalid channel or null message";this.processors[s.channel].process(s)},dispose:function(){wdi.Debug.log("Disposing PacketProcess all processors"),this.processors[wdi.SpiceVars.SPICE_CHANNEL_MAIN].dispose(),this.processors[wdi.SpiceVars.SPICE_CHANNEL_DISPLAY].dispose(),this.processors[wdi.SpiceVars.SPICE_CHANNEL_INPUTS].dispose(),this.processors[wdi.SpiceVars.SPICE_CHANNEL_CURSOR].dispose(),this.processors[wdi.SpiceVars.SPICE_CHANNEL_PLAYBACK].dispose(),this.processors={}}});wdi.PacketFilter={restoreContext:!1,start:null,dispose:function(){wdi.Debug.log("Disposing PacketFilter"),this.restoreContext=!1,this.start=null},filter:function(e,t,i,a){if(wdi.logOperations&&(this.start=Date.now()),wdi.graphicDebug&&wdi.graphicDebug.debugMode&&wdi.graphicDebug.printDebugMessageOnFilter(e,a),wdi.IntegrationBenchmark&&wdi.IntegrationBenchmark.benchmarking){var r=new Date;wdi.IntegrationBenchmark.setStartTime(r.getTime())}if(e.args.base&&e.args.base.clip.type===wdi.SpiceClipType.SPICE_CLIP_TYPE_RECTS){var n=a.getContext(e.args.base.surface_id);n.save(),n.beginPath();for(var s=e.args.base.clip.rects.rects,o=s.length;o--;){var g=wdi.graphics.getBoxFromSrcArea(s[o]);n.rect(g.x,g.y,g.width,g.height)}n.clip(),this.restoreContext=e.args.base.surface_id}t.call(i,e)},notifyEnd:function(e,t){!1!==this.restoreContext&&(t.getContext(this.restoreContext).restore(),this.restoreContext=!1);if(wdi.SeamlessIntegration){var i=null;e.args.base&&e.args.base.box&&(i=e.args.base.box),t.fillSubCanvas(i)}if(wdi.graphicDebug&&wdi.graphicDebug.debugMode&&wdi.graphicDebug.printDebugMessageOnNotifyEnd(e,t),wdi.IntegrationBenchmark&&wdi.IntegrationBenchmark.benchmarking){var a=new Date;wdi.IntegrationBenchmark.setEndTime(a.getTime())}wdi.GlobalPool.cleanPool("Canvas"),wdi.GlobalPool.cleanPool("Image"),wdi.logOperations&&wdi.DataLogger.log(e,this.start)}};wdi.PacketFactory={dispose:function(){wdi.Debug.log("Disposing PacketFactory")},extract:function(e){var a=null;switch(e.channel){case wdi.SpiceVars.SPICE_CHANNEL_DISPLAY:if(wdi.graphicDebug&&wdi.graphicDebug.debugMode)var S=JSON.stringify(e);switch(e.header.type){case wdi.SpiceVars.SPICE_MSG_DISPLAY_MODE:break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_MARK:a=(new wdi.SpiceDisplayMark).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_RESET:a=(new wdi.SpiceDisplayReset).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_COPY_BITS:a=(new wdi.SpiceCopyBits).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_INVAL_LIST:a=(new wdi.SpiceResourceList).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS:case wdi.SpiceVars.SPICE_MSG_DISPLAY_INVAL_PALETTE:break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES:a=(new wdi.SpiceDisplayInvalidAllPalettes).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_CREATE:a=(new wdi.SpiceStreamCreate).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DATA:a=(new wdi.SpiceStreamData).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_CLIP:a=(new wdi.SpiceStreamClip).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DATA_SIZED:a=(new wdi.SpiceStreamDataSized).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT:a=(new wdi.SpiceStreamActiveReport).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DESTROY:a=(new wdi.SpiceStreamDestroy).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL:break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_CURRENT_VIDEO_ENCODE_SETUP_RESPONSE:const S=(new wdi.CodecConfig).demarshall(e.body);(new wdi.SpiceChannel).changeCodec(S.codec);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_FILL:a=(new wdi.SpiceDrawFill).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_OPAQUE:break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_COPY:a=(new wdi.SpiceDrawCopy).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_BLEND:a=(new wdi.drawBlend).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_BLACKNESS:a=(new wdi.SpiceDrawBlackness).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_WHITENESS:a=(new wdi.SpiceDrawWhiteness).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_INVERS:a=(new wdi.SpiceDrawInvers).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_ROP3:a=(new wdi.SpiceDrawRop3).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_STROKE:a=(new wdi.SpiceStroke).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_TEXT:a=(new wdi.SpiceDrawText).demarshall(e.body,e.header.size);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_TRANSPARENT:a=(new wdi.drawTransparent).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND:a=(new wdi.drawAlphaBlend).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_SURFACE_CREATE:a=(new wdi.SpiceSurface).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_SURFACE_DESTROY:a=(new wdi.SpiceSurfaceDestroy).demarshall(e.body)}break;case wdi.SpiceVars.SPICE_CHANNEL_INPUTS:switch(e.header.type){case wdi.SpiceVars.SPICE_MSG_INPUTS_MOUSE_MOTION_ACK:a=new Object;break;case wdi.SpiceVars.SPICE_MSG_INPUTS_INIT:const S=new wdi.SpiceModifierData,i=S.demarshall(e.body);S.setModifierData(i.data);break;case wdi.SpiceVars.SPICE_MSG_INPUTS_KEY_MODIFIERS:const d=new wdi.SpiceModifierData,r=d.demarshall(e.body);d.setModifierData(r.data)}break;case wdi.SpiceVars.SPICE_CHANNEL_MAIN:switch(e.header.type){case wdi.SpiceVars.SPICE_MSG_MAIN_INIT:a=(new wdi.RedMainInit).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_DATA:a=(new wdi.VDAgentMessage).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_DISCONNECTED:a=(new wdi.SpiceMsgMainAgentDisconnected).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_CONNECTED:a=(new wdi.SpiceMsgMainAgentConnected).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_MAIN_MULTI_MEDIA_TIME:a=(new wdi.MainMultiMediaTime).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_MAIN_CHANNELS_LIST:a=(new wdi.MainMChannelsList).demarshall(e.body)}break;case wdi.SpiceVars.SPICE_CHANNEL_CURSOR:switch(e.header.type){case wdi.SpiceVars.SPICE_MSG_CURSOR_INIT:a=(new wdi.RedCursorInit).demarshall(e.body,e.header.size);break;case wdi.SpiceVars.SPICE_MSG_CURSOR_SET:a=(new wdi.RedCursorSet).demarshall(e.body,e.header.size);break;case wdi.SpiceVars.SPICE_MSG_CURSOR_MOVE:a=(new wdi.RedCursorMove).demarshall(e.body,e.header.size);break;case wdi.SpiceVars.SPICE_MSG_CURSOR_HIDE:a=(new wdi.RedCursorHide).demarshall(e.body,e.header.size)}break;case wdi.SpiceVars.SPICE_CHANNEL_PLAYBACK:switch(e.header.type){case wdi.SpiceVars.SPICE_MSG_PLAYBACK_MODE:a=(new wdi.PlaybackMode).demarshall(e.body,e.header.size);break;case wdi.SpiceVars.SPICE_MSG_PLAYBACK_START:a=(new wdi.PlaybackStart).demarshall(e.body,e.header.size);break;case wdi.SpiceVars.SPICE_MSG_PLAYBACK_STOP:a=(new wdi.PlaybackStop).demarshall(e.body,e.header.size);break;case wdi.SpiceVars.SPICE_MSG_PLAYBACK_DATA:a=(new wdi.PlaybackData).demarshall(e.body,e.header.size)}}return a?(wdi.graphicDebug&&wdi.graphicDebug.debugMode&&S&&(a.originalData=S),new wdi.SpiceMessage({messageType:e.header.type,channel:e.channel,args:a})):(wdi.Debug.log(e.header.type,e.header.channel),!1)}};Application=$.spcExtend(wdi.DomainObject,{spiceConnection:null,clientGui:null,agent:null,externalCallback:null,keyboardEnabled:!0,packetProcess:null,inputProcess:null,multimediaTime:null,lastMultimediaTime:null,busConnection:null,busProcess:null,timeLapseDetector:null,connectionInfo:null,reconnecting:null,checkActivity:null,configs:null,init:function(e){this.disposed=!1,e?this.configs=e:e=this.configs||{},wdi.spiceClientPath=e.spiceClientPath||"",wdi.Debug.log("application init"),wdi.GlobalPool.init(),this.spiceConnection=e.spiceConnection||new wdi.SpiceConnection,this.clientGui=e.clientGui||new wdi.ClientGui({app:this}),this.agent=e.agent||new wdi.Agent({app:this}),this.inputProcess=e.inputProcess||new wdi.InputProcess({clientGui:this.clientGui,spiceConnection:this.spiceConnection}),this.packetProcess=e.packetProcess,this.busConnection=e.busConnection||new wdi.BusConnection,this.busProcess=e.busProcess||new wdi.BusProcess({clientGui:this.clientGui,busConnection:this.busConnection}),this.timeLapseDetector=e.timeLapseDetector||new wdi.TimeLapseDetector,this.checkActivity=e.checkActivity,this.setup(),e.supportHighDPI?(this.clientGui.pixelRatio=window.devicePixelRatio,this.pixelRatio=window.devicePixelRatio):(this.clientGui.pixelRatio=1,this.pixelRatio=1)},run:function(e){if(this.runParams=e,e.hasOwnProperty("seamlessDesktopIntegration")&&(wdi.SeamlessIntegration=e.seamlessDesktopIntegration),!this.packetProcess){var t=!1;!1===e.useWorkers&&(t=new wdi.DisplayProcess({clientGui:this.clientGui,disableMessageBuffering:e.disableMessageBuffering})),this.packetProcess=new wdi.PacketProcess({app:this,clientGui:this.clientGui,agent:this.agent,spiceConnection:this.spiceConnection,inputsProcess:this.inputProcess,displayProcess:t,disableMessageBuffering:e.disableMessageBuffering})}if(this.checkActivity||(this.checkActivity=new wdi.CheckActivity(e.checkActivityInterval),this.checkActivity.addListener("activityLost",this.onActivityLost,this)),window.vdiLoadTest?this.spiceConnection.addListener("message",this.onMessage,this):this.spiceConnection.addListener("message",this.packetProcess.process,this.packetProcess),this.busConnection.connect(e),this.timeLapseDetector.startTimer(),e.canvasMargin&&this.clientGui.setCanvasMargin(e.canvasMargin),e.disableClipboard&&(this.agent.disableClipboard(),this.clientGui.disableClipboard(),this.enableCtrlC(),this.enableCtrlV()),e.layer&&this.clientGui.setLayer(e.layer),this.clientGui.checkFeatures()){wdi.SeamlessIntegration&&this.disableKeyboard(),wdi.Keymap.loadKeyMap(e.layout,this.clientGui.getStuckKeysHandler()),this.setExternalCallback(e.callback,e.context);try{this.connect({host:e.host,port:e.port,protocol:e.protocol,vmHost:e.vmHost,vmPort:e.vmPort,vmid:e.vmid,vmInfoToken:e.vmInfoToken,busHost:e.busHost,token:e.token,connectionControl:e.connectionControl,heartbeatToken:e.heartbeatToken,heartbeatTimeout:e.heartbeatTimeout})}catch(e){this.executeExternalCallback("error",1)}this.clientGui.setClientOffset(e.clientOffset.x,e.clientOffset.y)}e.hasOwnProperty("externalClipboardHandling")&&(this.externalClipoardHandling=e.externalClipboardHandling)},end:function(){},setup:function(){this.spiceConnection.addListener("mouseMode",this.onMouseMode,this),this.spiceConnection.addListener("initAgent",this.onInitAgent,this),this.spiceConnection.addListener("error",this.onDisconnect,this),this.spiceConnection.addListener("channelConnected",this.onChannelConnected,this),this.clientGui.addListener("input",this.onClientInput,this),this.clientGui.addListener("resolution",this.onResolution,this),this.clientGui.addListener("paste",this.onPaste,this),this.clientGui.addListener("startAudio",this.onStartAudio,this),this.clientGui.addListener("eventLayerCreated",this.onEventLayerCreated,this),this.busProcess.addListener("windowCreated",this.onWindowCreated,this),this.busProcess.addListener("windowClosed",this.onWindowClosed,this),this.busProcess.addListener("windowMoved",this.onWindowMoved,this),this.busProcess.addListener("windowResized",this.onWindowResized,this),this.busProcess.addListener("windowFocused",this.onWindowFocused,this),this.busProcess.addListener("windowMinimized",this.onWindowMinimized,this),this.busProcess.addListener("windowRestored",this.onWindowRestored,this),this.busProcess.addListener("windowMaximized",this.onWindowMaximized,this),this.busProcess.addListener("busConnected",this.onBusConnected,this),this.busProcess.addListener("menuResponse",this.onMenuResponse,this),this.busProcess.addListener("networkDriveResponse",this.onNetworkDriveResponse,this),this.busProcess.addListener("wrongPathError",this.onWrongPathError,this),this.busProcess.addListener("applicationLaunchedSuccessfully",this.onApplicationLaunchedSuccessfully,this),this.busProcess.addListener("selectedText",this.onRemoteSelectedText,this),this.busProcess.addListener("copiedText",this.onRemoteCopiedText,this),this.agent.addListener("clipBoardData",this.onClipBoardData,this),this.busConnection.addListener("busMessage",this.onBusMessage,this),this.busConnection.addListener("error",this.onDisconnect,this),this.timeLapseDetector.addListener("timeLapseDetected",this.onTimeLapseDetected,this),this.busProcess.addListener("defaultTypeEvent",this.onDefaultTypeEvent,this)},onChannelConnected:function(e){e===wdi.SpiceVars.SPICE_CHANNEL_INPUTS&&this.clientGui.releaseAllKeys()},onDefaultTypeEvent:function(e){this.executeExternalCallback(e.event,e)},onNetworkDriveResponse:function(e){this.executeExternalCallback("networkDriveResponse",e)},onDisconnect:function(e){var t=e;this.executeExternalCallback("error",t)},onResolution:function(e){this.executeExternalCallback("resolution",e)},onClipBoardData:function(e){this.externalClipoardHandling?this.executeExternalCallback("clipboardEvent",e):this.clientGui.setClipBoardData(e)},onRemoteCopiedText:function(e){this.clientGui.setToLocalClipboard(e)},onRemoteSelectedText:function(e){this.clientGui.setToLocalClipboard(e)},onWindowMinimized:function(e){var t=e;e=this.clientGui.resizeSubCanvas(t);this.executeExternalCallback("windowMinimized",e)},onWindowFocused:function(e){this.executeExternalCallback("windowFocused",e)},onWindowRestored:function(e){var t=e;e=this.clientGui.resizeSubCanvas(t);this.executeExternalCallback("windowRestored",e)},onWindowMaximized:function(e){var t=e;e=this.clientGui.resizeSubCanvas(t);this.executeExternalCallback("windowMaximized",e)},onWindowResized:function(e){var t=e;e=this.clientGui.resizeSubCanvas(t);this.executeExternalCallback("windowResized",e)},onWindowMoved:function(e){var t=e;e=this.clientGui.moveSubCanvas(t);this.executeExternalCallback("windowMoved",e)},onWindowClosed:function(e){var t=e;e=this.clientGui.deleteSubCanvas(t);this.executeExternalCallback("windowClosed",e)},onWindowCreated:function(e){var t=e;e=this.clientGui.createNewSubCanvas(t);this.executeExternalCallback("windowCreated",e)},onMenuResponse:function(e){var t=e;this.executeExternalCallback("menuResponse",t)},onClientInput:function(e){var t=e,i=t[0],n=t[1][0];this.inputProcess.isKeyboardShortcut(i,n)?this._sendCtrlKey(n.keyCode):this.inputProcess.send(t,i)},onMessage:function(e){var t=e;this.packetProcess.process(t);var i=this;window.checkResultsTimer&&clearTimeout(window.checkResultsTimer),window.checkResultsTimer=window.setTimeout((function(){i.executeExternalCallback("checkResults"),window.vdiLoadTest=!1}),5e3)},onBusConnected:function(e){wdi.SeamlessIntegration&&this.busProcess.requestWindowList()},onBusMessage:function(e){var t=e;this.busProcess.process(t)},onInitAgent:function(e){this.agent.setClientTokens(e),this.agent.sendInitMessage(this),this.reconnecting=!1,this.executeExternalCallback("ready",e)},onMouseMode:function(e){this.clientGui.setMouseMode(e)},onPaste:function(e){this.agent.setClipboard(e)},onStartAudio:function(){this.packetProcess.processors[wdi.SpiceVars.SPICE_CHANNEL_PLAYBACK].startAudio()},onEventLayerCreated:function(e){this.executeExternalCallback("eventLayerCreated",e)},onTimeLapseDetected:function(e){var t=e;this.executeExternalCallback("timeLapseDetected",t)},connect:function(e){wdi.Debug.log("application connect"),this.connectionInfo=e;try{this.spiceConnection.connect(e)}catch(e){wdi.Debug.error("application connect error",e),this.clientGui.showError(e.message)}},reconnect:function(e){this.reconnecting=!0,e.freeze&&this.freeze(),this.dispose(),this.init(),this.run(this.runParams)},freeze:function(){this.clientGui.freeze()},cancelFreeze:function(){this.clientGui.cancelFreeze()},setReconnecting:function(e){this.reconnecting=e},getReconnecting:function(){return this.reconnecting},setExternalCallback:function(e,t){this.externalCallback=[e,t]},executeExternalCallback:function(e,t){this.externalCallback[0].call(this.externalCallback[1],e,t)},sendCommand:function(e,t){switch(e){case"close":this.busProcess.closeWindow(t.hwnd);break;case"move":this.busProcess.moveWindow(t.hwnd,t.x,t.y);break;case"minimize":this.busProcess.minimizeWindow(t.hwnd);break;case"maximize":this.busProcess.maximizeWindow(t.hwnd);break;case"restore":this.busProcess.restoreWindow(t.hwnd);break;case"focus":this.busProcess.focusWindow(t.hwnd);break;case"resize":this.busProcess.resizeWindow(t.hwnd,t.width,t.height);break;case"run":this.busProcess.executeCommand(t.cmd);break;case"setResolution":this.agent.setResolution(t.width,t.height);break;case"getMenu":this.busProcess.getMenu();break;case"reMountNetworkDrive":this.busProcess.reMountNetworkDrive(t.host,t.username,t.password);break;case"refreshFileSystem":this.busProcess.refreshFileSystem();break;default:this.busProcess.sendGenericMessage(e,t)}},enableKeyboard:function(){this.clientGui.enableKeyboard()},disableKeyboard:function(){this.clientGui.disableKeyboard()},enableCtrlC:function(){wdi.KeymapES.setCtrlKey(67,46),wdi.KeymapUS.setCtrlKey(67,46)},enableCtrlV:function(){wdi.KeymapES.setCtrlKey(86,47),wdi.KeymapUS.setCtrlKey(86,47)},disconnect:function(){this.busConnection.disconnect(),this.spiceConnection.disconnect()},setMultimediaTime:function(e){this.multimediaTime=e,this.lastMultimediaTime=Date.now()},sendShortcut:function(e){e===wdi.keyShortcutsHandled.CTRLV?this._sendCtrlKey(86):e===wdi.keyShortcutsHandled.CTRLC&&this._sendCtrlKey(67)},sendCtrlAltDelete:function(){this._sendCtrlKey(18,46)},_sendCtrlKey:function(e,t){this.inputProcess.send(["keydown",[{generated:!0,type:"keydown",keyCode:17,charCode:0}]],"keydown"),this.inputProcess.send(["keydown",[{generated:!0,type:"keydown",keyCode:e,charCode:0}]],"keydown"),t&&this.inputProcess.send(["keydown",[{generated:!0,type:"keydown",keyCode:t,charCode:0}]],"keydown"),this.inputProcess.send(["keyup",[{generated:!0,type:"keyup",keyCode:e,charCode:0}]],"keyup"),t&&this.inputProcess.send(["keyup",[{generated:!0,type:"keyup",keyCode:t,charCode:0}]],"keyup"),this.inputProcess.send(["keyup",[{generated:!0,type:"keyup",keyCode:17,charCode:0}]],"keyup")},dispose:function(){this.disposed=!0,wdi.Debug.log("application dispose"),wdi.ExecutionControl.runQ.clear(),wdi.ExecutionControl.currentProxy=null,wdi.ExecutionControl.sync=!0,this.disableKeyboard(),this.disconnect(),this.packetProcess.dispose(),this.clientGui.dispose(),this.busProcess.clearEvents(),this.busProcess.dispose(),this.busConnection.clearEvents(),this.agent.clearEvents(),this.agent.dispose(),this.timeLapseDetector.clearEvents(),this.timeLapseDetector.dispose(),this.checkActivity.dispose()},onWrongPathError:function(e){this.executeExternalCallback("wrongPathError",e)},onApplicationLaunchedSuccessfully:function(e){this.executeExternalCallback("applicationLaunchedSuccessfully",e)},getKeyboardHandler:function(){return this.clientGui.handleKey},getClientGui:function(){return this.clientGui},setCurrentWindow:function(e){this.clientGui.inputManager.setCurrentWindow(e)},onActivityLost:function(e){this.executeExternalCallback("activityLost",e)},resetActivity:function(){this.checkActivity.resetActivity()},toSpiceResolution:function(e){return{width:e.width*this.pixelRatio,height:e.height*this.pixelRatio,scaleFactor:this.pixelRatio}}}),window.Application=Application,Application.prototype.run=Application.prototype.run,Application.prototype.sendCommand=Application.prototype.sendCommand,Application.prototype.enableKeyboard=Application.prototype.enableKeyboard,Application.prototype.disableKeyboard=Application.prototype.disableKeyboard,Application.prototype.dispose=Application.prototype.dispose,Application.prototype.getKeyboardHandler=Application.prototype.getKeyboardHandler,Application.prototype.getClientGui=Application.prototype.getClientGui,Application.prototype.setCurrentWindow=Application.prototype.setCurrentWindow,Application.prototype.reconnect=Application.prototype.reconnect,Application.prototype.freeze=Application.prototype.freeze,Application.prototype.cancelFreeze=Application.prototype.cancelFreeze,Application.prototype.setReconnecting=Application.prototype.setReconnecting,Application.prototype.getReconnecting=Application.prototype.getReconnecting;wdi.VirtualMouse={eventLayers:[],mouseData:null,visible:null,lastLayer:null,cursor:null,cursorHotspot:{x:0,y:0},hotspot:{x:0,y:0},lastMousePosition:{x:0,y:0,width:0,height:0},dispose:function(){wdi.Debug.log("Disposing VirtualMouse"),this.eventLayers=[],this.mouseData=null,this.visible=null,this.lastLayer=null,this.hotspot={x:0,y:0},this.lastMousePosition={x:0,y:0,width:0,height:0}},initCursor:function(){const t=this.eventLayers[0];this.cursor=document.createElement("div"),this.cursor.style.position="fixed",this.cursor.style.width="32px",this.cursor.style.height="32px",this.cursor.style.pointerEvents="none",this.cursor.style.zIndex="2147483647",this.cursor.style.backgroundImage=t.layer.style.cursor.match(/url\(.+\)/)?.[0]||"",this.cursor.style.backgroundRepeat="no-repeat",document.body.appendChild(this.cursor);const{left:s,top:e}=document.getElementById("eventLayer").style;this.cursorHotspot.x=parseInt(s),this.cursorHotspot.y=parseInt(e)},updateCursor:function(t,s){this.cursor&&(this.cursor.style.left=this.cursorHotspot.x+t+"px",this.cursor.style.top=this.cursorHotspot.y+s+"px")},removeCursor:function(){this.cursor.remove()},setHotspot:function(t,s){this.hotspot.x=t,this.hotspot.y=s},setEventLayer:function(t,s,e,r,o,i){this.eventLayers.push({layer:t,left:s,top:e,right:s+r,bottom:e+o,position:i})},removeEventLayer:function(t){for(var s=this.eventLayers.length,e=0;e<s;e++)this.eventLayers[e].layer.id===t.id&&(this.eventLayers[t.id]=void 0)},getEventLayer:function(t,s){for(var e=this.eventLayers.length,r=null,o=0;o<e;o++)if(t>=(r=this.eventLayers[o]).left&&t<=r.right&&s>=r.top&&s<=r.bottom)return r.layer},setMouse:function(t,s,e){for(var r=this.eventLayers.length,o=0;o<r;o++)this.eventLayers[o].layer.style.cursor="url("+t+") "+s+" "+e+", default";this.cursor&&(this.cursor.style.backgroundImage='url("'+t+'")')},hideMouse:function(){for(var t=this.eventLayers.length,s=0;s<t;s++)this.eventLayers[s].layer.style.cursor="none"}};wdi.ImageCache={images:{},cursor:{},palettes:{},dispose:function(){wdi.Debug.log("Disposing ImageCache"),this.images={},this.cursor={},this.palettes={}},getImageFrom:function(t,e){var i=wdi.GlobalPool.create("Canvas"),a=this.images[t.id.toString()];i.width=a.width,i.height=a.height,i.getContext("2d").putImageData(a,0,0),e(i)},isImageInCache:function(t){return t.id.toString()in this.images},delImage:function(t){delete this.images[t.toString()]},addImage:function(t,e){e.getContext?this.images[t.id.toString()]=e.getContext("2d").getImageData(0,0,2e3,e.height):this.images[t.id.toString()]=e},getCursorFrom:function(t){return this.cursor[t.header.unique.toString()]},addCursor:function(t,e){this.cursor[t.header.unique.toString()]=e},getPalette:function(t){return this.palettes[t.toString()]},addPalette:function(t,e){this.palettes[t.toString()]=e},clearPalettes:function(){this.palettes={}}};wdi.RasterOperation={dispose:function(){wdi.Debug.log("Disposing RasterOperation")},process:function(i,t,e){var a=null;return i&wdi.SpiceRopd.SPICE_ROPD_INVERS_SRC||i&wdi.SpiceRopd.SPICE_ROPD_INVERS_BRUSH?t=this.invert(t):i&wdi.SpiceRopd.SPICE_ROPD_INVERS_DEST&&(e=this.invert(e)),i&wdi.SpiceRopd.SPICE_ROPD_OP_PUT?t:(i&wdi.SpiceRopd.SPICE_ROPD_OP_OR?a=this.boolOp(t,e,"or"):i&wdi.SpiceRopd.SPICE_ROPD_OP_AND?a=this.boolOp(t,e,"and"):i&wdi.SpiceRopd.SPICE_ROPD_OP_XOR?a=this.boolOp(t,e,"xor"):i&wdi.SpiceRopd.SPICE_ROPD_OP_BLACKNESS?a=this.lightness(e,"b"):i&wdi.SpiceRopd.SPICE_ROPD_OP_WHITENESS?a=this.lightness(e):i&wdi.SpiceRopd.SPICE_ROPD_OP_INVERS&&(a=this.invert(e)),i&wdi.SpiceRopd.SPICE_ROPD_INVERS_RES?this.invert(a):a)},flip:function(i){return i=wdi.Flipper.flip(i)},invert:function(i){return i=$(i).pixastic("invert")[0]},lightness:function(i,t){t="b"===t?-100:100;return i=$(i).pixastic("hsl",{hue:30,saturation:20,lightness:t})[0]},boolOp:function(i,t,e){var a=wdi.graphics.getDataFromImage(i).data,o=wdi.graphics.getDataFromImage(t).data,p=a.length-1,d=wdi.graphics.getNewTmpCanvas(i.width,i.height),r=d.getContext("2d"),n=r.createImageData(i.width,i.height),s=n.data;if("or"===e)for(;p>0;)n.data[p]=255,s[p-1]=a[p-1]|o[p-1],s[p-2]=a[p-2]|o[p-2],s[p-3]=a[p-3]|o[p-3],p-=4;else if("and"===e)for(;p>0;)n.data[p]=255,s[p-1]=a[p-1]&o[p-1],s[p-2]=a[p-2]&o[p-2],s[p-3]=a[p-3]&o[p-3],p-=4;else if("xor"===e)for(;p>0;)n.data[p]=255,s[p-1]=a[p-1]^o[p-1],s[p-2]=a[p-2]^o[p-2],s[p-3]=a[p-3]^o[p-3],p-=4;return r.putImageData(n,0,0),d}};wdi.Stream={streams:{},dispose:function(){wdi.Debug.log("Disposing Stream"),this.streams={}},addStream:function(s,t){this.streams[s]=t},deleteStream:function(s){this.streams[s]=void 0},getStream:function(s){return this.streams[s]},clip:function(s,t){this.streams[s].clip=t},startTransition:function(s){this.streams[s].transiting=!0},endTransition:function(s){this.streams[s].transiting=!1},setReady:function(s){this.streams[s].ready=!0},addQueue:function(s,t){this.streams[s].queues||(this.streams[s].queues=[]),this.streams[s].queues.push(t)},resetQueues:function(s){this.streams[s].queues=[]}};wdi.InputManager=$.spcExtend(wdi.EventObject.prototype,{checkFocus:!1,input:null,window:null,stuckKeysHandler:null,init:function(t){this.time=Date.now(),wdi.Debug.log("inputmanager init: ",this.time),this.superInit(),this.input=t.input,this.window=t.window,this.stuckKeysHandler=t.stuckKeysHandler,this.$=t.jQuery||$,t.disableInput||(this.inputElement=this.$('<div style="position:absolute"><input type="text" id="inputmanager" autocomplete="off" value="_" style="opacity: 0; color: transparent"/></div>')),this.currentWindow=null,this.getClientSO(),this.tildeMarks=["´","`","^","¨"],this.lastChar=null,this.tildeReplacements={a:{0:"á",1:"à",2:"â",3:"ä"},e:{0:"é",1:"è",2:"ê",3:"ë"},i:{0:"í",1:"ì",2:"î",3:"ï"},o:{0:"ó",1:"ò",2:"ô",3:"ö"},u:{0:"ú",1:"ù",2:"û",3:"ü"},A:{0:"Á",1:"À",2:"Â",3:"Ä"},E:{0:"É",1:"È",2:"Ê",3:"Ë"},I:{0:"Í",1:"Ì",2:"Î",3:"Ï"},O:{0:"Ó",1:"Ò",2:"Ô",3:"Ö"},U:{0:"Ú",1:"Ù",2:"Û",3:"Ü"}}},getClientSO:function(){var t=window.navigator.platform.toLowerCase();t.indexOf("mac")>-1?this.clientSO="mac":t.indexOf("linux")?this.clientSO="linux":this.clientSO="windows"},setCurrentWindow:function(t){t=this.$(t),this.currentWindow&&(this.inputElement.remove(),this.currentWindow.unbind("blur")),this.$(t[0].document.getElementById("vmw")).prepend(this.inputElement),this.input=this.$(t[0].document.getElementById("inputmanager")),this.addListeners(t),this.currentWindow=t},dispose:function(){this.disposed=!0,this.inputElement.remove(),this.currentWindow.unbind("blur"),this.currentWindow.unbind("input"),this.inputElement=null,this.checkFocus=!1,this.input=null,this.window=null,this.stuckKeysHandler=null},addListeners:function(t){this._onBlur(t),this._onInput()},_onBlur:function(t){var i=this;t.on("blur",(function(t){i.checkFocus&&i.input.focus(),i.stuckKeysHandler.releaseSpecialKeysPressed()}))},_onInput:function(){var t=this;this.input.on("input",(function(i){t.input.val().length>1&&t.reset()}))},enable:function(){wdi.Debug.log("enable!!!!!!!!!! ",this.time),this.checkFocus=!0,this.input.select()},disable:function(){this.checkFocus=!1,this.input&&this.input.blur()},reset:function(){this.input.val("")},getValue:function(){var t=this.input.val();if(t&&this.reset(),"mac"===this.clientSO){if(this.tildeMarks.indexOf(this.lastChar)>-1&&this.tildeReplacements.hasOwnProperty(t))switch(this.lastChar){case this.tildeMarks[0]:t=this.tildeReplacements[t][0];break;case this.tildeMarks[1]:t=this.tildeReplacements[t][1];break;case this.tildeMarks[2]:t=this.tildeReplacements[t][2];break;case this.tildeMarks[3]:t=this.tildeReplacements[t][3]}t&&this.tildeMarks.indexOf(t)>-1?t!=this.lastChar?(this.lastChar=t,t=""):t===this.lastChar&&(this.lastChar=""):this.lastChar=t||this.lastChar}return t},manageChar:function(t,i){var e=[Object.create(i[0])];return e[0].type="inputmanager",e[0].charCode=t.charCodeAt(0),e},isSpecialKey:function(t){return-1!==[17].indexOf(t)}});wdi.BUS_TYPES={file:0,print:1,launchApplication:2,windowManagement:3,menu:5,networkDriveManagement:6,clipboard:9,generic:99,killApplicationDoNotUseInProductionEver:34423423},wdi.BusProcess=$.spcExtend(wdi.EventObject.prototype,{busConnection:null,clientGui:null,init:function(e){this.superInit(),this.clientGui=e.clientGui,this.busConnection=e.busConnection},dispose:function(){this.clientGui=null,this.busConnection=null},process:function(e){switch(e.verb){case"CONNECTED":this.busConnection.setSubscriptions(),this.fire("busConnected");break;case"MESSAGE":this.parseMessage(e.body);break;case"ERROR":console.error("Bus error");break;default:wdi.Debug.warn("Not implemented Stomp Verb: "+e.verb)}},parseMessage:function(e){switch(parseInt(e.type)){case wdi.BUS_TYPES.launchApplication:this.parseLaunchApplicationMessage(e);break;case wdi.BUS_TYPES.killApplicationDoNotUseInProductionEver:break;case wdi.BUS_TYPES.windowManagement:this.parseWindowManagementMessage(e);break;case wdi.BUS_TYPES.menu:this.handleMenuMessage(e);break;case wdi.BUS_TYPES.networkDriveManagement:this._handleNetworkDriveMessage(e);break;case wdi.BUS_TYPES.clipboard:this.handleClipboardMessage(e);break;default:this.fire("defaultTypeEvent",e)}},_handleNetworkDriveMessage:function(e){"reMountNetworkDrive"!=e.event&&this.fire("networkDriveResponse",e)},getMenu:function(){this.busConnection.send({type:wdi.BUS_TYPES.menu,value:!1,event:"request"})},handleMenuMessage:function(e){"response"==e.event&&this.fire("menuResponse",e)},handleClipboardMessage:function(e){"selectedText"!==e.event&&"copiedText"!==e.event||this.fire(e.event,e)},parseWindowManagementMessage:function(e){switch(e.event){case"windowList":case"windowCreated":case"windowClosed":case"windowMoved":case"windowResized":case"windowFocused":case"windowMinimized":case"windowRestored":case"windowMaximized":this.fire(e.event,e.value);break;default:wdi.Debug.info("Event '"+e.event+"' not implemented.")}},closeWindow:function(e){this.busConnection.send(this._constructWindowManagementMessage({event:"closeWindow",hwnd:e}))},moveWindow:function(e,n,t){this.busConnection.send(this._constructWindowManagementMessage({event:"moveWindow",hwnd:e,left:n,top:t}))},minimizeWindow:function(e){this.busConnection.send(this._constructWindowManagementMessage({event:"minimizeWindow",hwnd:e}))},maximizeWindow:function(e){this.busConnection.send(this._constructWindowManagementMessage({event:"maximizeWindow",hwnd:e}))},restoreWindow:function(e){this.busConnection.send(this._constructWindowManagementMessage({event:"restoreWindow",hwnd:e}))},focusWindow:function(e){this.busConnection.send(this._constructWindowManagementMessage({event:"focusWindow",hwnd:e}))},resizeWindow:function(e,n,t){this.busConnection.send(this._constructWindowManagementMessage({event:"resizeWindow",hwnd:e,width:n,height:t}))},requestWindowList:function(){this.busConnection.send(this._constructWindowManagementMessage({event:"getWindowList"}))},executeCommand:function(e){this.busConnection.send({type:wdi.BUS_TYPES.launchApplication,application:e})},refreshFileSystem:function(e){this.busConnection.send({type:wdi.BUS_TYPES.file,event:"refreshFileSystem",value:{}})},_constructGenericMessage:function(e,n){return{type:wdi.BUS_TYPES.generic,event:e,value:n||{}}},_constructWindowManagementMessage:function(e){if(void 0===e.event)throw new Error("You should pass an 'event' attribute in the object");var n={type:wdi.BUS_TYPES.windowManagement,event:e.event,value:{}};for(var t in e)"event"!=t&&e.hasOwnProperty(t)&&(n.value[t]=e[t]);return n},reMountNetworkDrive:function(e,n,t){this.busConnection.send({type:wdi.BUS_TYPES.networkDriveManagement,event:"reMountNetworkDrive",host:e,username:n,password:t})},parseLaunchApplicationMessage:function(e){switch(e.event){case"applicationLauncherWrongAppPathError":this.fire("wrongPathError",e);break;case"applicationLaunchedSuccessfully":this.fire("applicationLaunchedSuccessfully",e);break;default:wdi.Debug.info("Event '"+e.event+"' not implemented.")}},sendGenericMessage:function(e,n){this.busConnection.send(this._constructGenericMessage(e,n))}});wdi.DisplayProcess=$.spcExtend(wdi.EventObject.prototype,{runQ:null,packetFilter:null,init:function(i){this.runQ=i.runQ||wdi.ExecutionControl.runQ,this.packetFilter=i.packetFilter||wdi.PacketFilter,this.clientGui=i.clientGui,this.displayRouter=i.displayRouter||new wdi.DisplayRouter({clientGui:this.clientGui}),this.started=!1,this.waitingMessages=[],this.packetWorkerIdentifier=i.packetWorkerIdentifier||new wdi.PacketWorkerIdentifier,this.disableMessageBuffering=i.disableMessageBuffering},dispose:function(){wdi.Debug.log("Disposing DisplayProcess"),clearInterval(this.timer),this.timer=null,this.runQ=null,this.packetFilter.dispose(),this.packetFilter=null,this.clientGui=null,this.displayRouter.dispose(),this.displayRouter=null,this.packetWorkerIdentifier.dispose(),this.packetWorkerIdentifier=null,this.started=!1,this.waitingMessages=[]},process:function(i){if(this.disableMessageBuffering)this._process(i);else{var e=this;this.waitingMessages.push(i),this.started||(this.timer=setInterval((function(){e.flush()}),50),this.started=!0)}},flush:function(){if(0!==this.waitingMessages.length){var i,e=0;this.removeRedundantDraws();for(var t=this.waitingMessages.length;e<t;)i=this.waitingMessages[e],this._process(i),e++;this.waitingMessages=[]}},removeRedundantDraws:function(){if(!(this.waitingMessages.length<2)){for(var i,e,t,s,r,n,a,o,l,c,h=this.waitingMessages.length,u={},p=[],d=!1;h--;)if(r=(e=(i=this.waitingMessages[h]).args).base,s=e.rop_descriptor,d=!1,r){if(r.surface_id,a=r.box,n=r.surface_id,t=this.packetWorkerIdentifier.getImageProperties(i),u[n]||(u[n]=[]),(!t||t&&!(t.descriptor.flags&wdi.SpiceImageFlags.SPICE_IMAGE_FLAGS_CACHE_ME))&&0===n)for(l=0;l<u[n].length;l++)if((o=u[n][l]).bottom>=a.bottom&&o.top<=a.top&&o.left<=a.left&&o.right>=a.right){d=!0,p.push(h);break}if(!d&&i.messageType===wdi.SpiceVars.SPICE_MSG_DISPLAY_COPY_BITS)break;!d&&e.getMessageProperty("overWriteScreenArea",!1)&&0==r.clip.type&&s==wdi.SpiceRopd.SPICE_ROPD_OP_PUT&&u[n].push(r.box)}for(c=0;c<p.length;c++)this.waitingMessages.splice(p[c],1)}},_process:function(i){wdi.logOperations&&wdi.DataLogger.log(i,0,null,!0,"","_decode"),this.runQ.add((function(e){this.packetFilter.filter(i,(function(i){wdi.ExecutionControl.currentProxy=e,this.displayRouter.processPacket(i),this.postProcess()}),this,this.clientGui),wdi.ExecutionControl.sync&&e.end()}),this,(function(){this.processEnd(i,this.clientGui)})),this.runQ.process()},processEnd:function(i,e){this.packetFilter.notifyEnd(i,e)},postProcess:function(){}});wdi.DisplayPreProcess=$.spcExtend(wdi.EventObject.prototype,{displayProcess:null,queued:[],inProcess:[],idleConsumers:[],consumers:[],init:function(s){this.idleConsumers=[],this.superInit(),this.displayProcess=s.displayProcess||new wdi.DisplayProcess({clientGui:s.clientGui,disableMessageBuffering:s.disableMessageBuffering}),this.clientGui=s.clientGui,null!=s.numConsumers&&null!=s.numConsumers||(s.numConsumers=4);for(var e=s.numConsumers,i=0;i<e;i++){var n=new wdi.AsyncConsumer;this.consumers.push(n),this.idleConsumers.push(n),n.addListener("done",this.onConsumerDone,this)}},onConsumerDone:function(s){for(var e=this.inProcess[0],i=null;e&&1===e.state;){i=this.inProcess.shift();try{this.displayProcess.process(i.message)}catch(s){wdi.Debug.error("DisplayPreProcess error: ",s)}e=this.inProcess[0]}this.idleConsumers.push(s),this.queued.length>0&&this.executeConsumer()},process:function(s){this.addTask(s),this.executeConsumer()},addTask:function(s){this.queued.push({message:s,clientGui:this.clientGui})},getNextTask:function(){for(var s=this.queued.shift();void 0===s&&0!=this.queued.length;)s=this.queued.shift();return void 0!==s&&(s.state=0,this.inProcess.push(s),s)},executeConsumer:function(){if(this.idleConsumers.length>0){wdi.Debug.log("DisplayPreProcess: available workers: "+this.idleConsumers.length),wdi.Debug.log("DisplaypreProcess: pending tasks: "+this.queued.length);var s=this.idleConsumers.shift(),e=this.getNextTask();e&&s.consume(e)}},dispose:function(){wdi.Debug.log("displaypreprocess dispose ################ idleConsumers: ",this.idleConsumers.length),this.clearEvents(),this.clientGui=null,this.queued=[],this.inProcess=[],this.idleConsumers=[],this.displayProcess.dispose(),this.displayProcess=null,this.consumers.forEach((function(s){s.clearEvents(),s.dispose()})),this.consumers=[]}});wdi.InputProcess=$.spcExtend(wdi.EventObject.prototype,{clientGui:null,spiceConnection:null,capsLockPressed:!1,numLockPressed:!1,shiftPressed:!1,mouseLastX:-1,mouseLastY:-1,init:function(e){this.superInit(),this.clientGui=e.clientGui,this.spiceConnection=e.spiceConnection},dispose:function(){this.clearEvents(),this.clientGui=null,this.spiceConnection=null},process:function(e){if(e.messageType===wdi.SpiceVars.SPICE_MSG_INPUTS_MOUSE_MOTION_ACK)this.clientGui.motion_ack()},send:function(e,s){var i,n,t;const{$mouse:c}=useNuxtApp();if("mousemove"==s){if(c.mode.value===wdi.SpiceMouseModeTypes.SPICE_MOUSE_MODE_CLIENT)i=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_POSITION,channel:wdi.SpiceVars.SPICE_CHANNEL_INPUTS,args:new wdi.RedcMousePosition({x:e[1][0]+wdi.VirtualMouse.hotspot.x,y:e[1][1]+wdi.VirtualMouse.hotspot.y,buttons_state:e[1][2],display_id:0})});else if(c.mode.value===wdi.SpiceMouseModeTypes.SPICE_MOUSE_MODE_SERVER){const s=-1!==this.mouseLastX?e[1][0]-this.mouseLastX:0,n=-1!==this.mouseLastY?e[1][1]-this.mouseLastY:0;i=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_MOTION,channel:wdi.SpiceVars.SPICE_CHANNEL_INPUTS,args:new wdi.RedcMouseMotion({x:s,y:n,buttons_state:0})}),this.mouseLastX=e[1][0],this.mouseLastY=e[1][1]}this.spiceConnection.send(i)}else if("mousedown"==s)i=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_PRESS,channel:wdi.SpiceVars.SPICE_CHANNEL_INPUTS,args:new wdi.RedcMousePress({button_id:e[1]+1,buttons_state:1<<e[1]})}),this.spiceConnection.send(i);else if("mouseup"==s)i=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_RELEASE,channel:wdi.SpiceVars.SPICE_CHANNEL_INPUTS,args:new wdi.RedcMousePress({button_id:e[1]+1,buttons_state:0})}),this.spiceConnection.send(i);else if("keydown"==s||"keypress"==s){n=wdi.Keymap.getScanCodes(e[1][0]);const c=e[1][0].originalEvent;if("keydown"==s&&20!==e[1][0].keyCode&&(!wdi.Keymap.isVirtualKeyboard&&c&&c.getModifierState&&wdi.Keymap.capsLock!==c.getModifierState("CapsLock")||wdi.Keymap.isVirtualKeyboard&&wdi.Keymap.isVirtualCapsLockOn!==wdi.Keymap.capsLock)){const e=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_DOWN,channel:wdi.SpiceVars.SPICE_CHANNEL_INPUTS,args:new wdi.SpiceScanCode([58,0,0])});this.capsLockPressed=!0,this.spiceConnection.send(e)}if("keydown"==s&&c&&c.getModifierState&&144!==e[1][0].keyCode&&wdi.Keymap.numLock!==c.getModifierState("NumLock")){const e=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_DOWN,channel:wdi.SpiceVars.SPICE_CHANNEL_INPUTS,args:new wdi.SpiceScanCode([69,0,0])});this.numLockPressed=!0,this.spiceConnection.send(e)}for(t=0;t<n.length;t++)i=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_DOWN,channel:wdi.SpiceVars.SPICE_CHANNEL_INPUTS,args:new wdi.SpiceScanCode(n[t])}),n[0]&&42===n[0][0]&&(this.shiftPressed=!0),this.spiceConnection.send(i)}else if("keyup"==s){if((n=wdi.Keymap.getScanCodes(e[1][0]))&&n[0]&&199===n[0][0]&&0===n[0][1]&&0===n[0][2]&&(n=[[224,199,0,0]]),this.capsLockPressed){const e=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_UP,channel:wdi.SpiceVars.SPICE_CHANNEL_INPUTS,args:new wdi.SpiceScanCode([186,0,0])});this.spiceConnection.send(e),this.capsLockPressed=!1}if(this.numLockPressed){const e=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_UP,channel:wdi.SpiceVars.SPICE_CHANNEL_INPUTS,args:new wdi.SpiceScanCode([197,0,0])});this.spiceConnection.send(e),this.numLockPressed=!1}for(n[0]&&142===n[0][0]&&(this.shiftPressed=!1),t=0;t<n.length;t++)i=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_UP,channel:wdi.SpiceVars.SPICE_CHANNEL_INPUTS,args:new wdi.SpiceScanCode(n[t])}),this.spiceConnection.send(i);this.clientGui.inputManager.input.val("_")}else"joystick"==s&&(i=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_MOTION,channel:wdi.SpiceVars.SPICE_CHANNEL_INPUTS,args:new wdi.RedcMouseMotion({x:e[1][0],y:e[1][1],buttons_state:0})}),this.spiceConnection.send(i))},isKeyboardShortcut:function(e,s){if("keydown"===e){var i=s.keyCode;return wdi.Keymap.controlPressed(i,e,s),wdi.Keymap.handledByCtrlKeyCode(e,i,!0)}}});wdi.CursorProcess=$.spcExtend(wdi.EventObject.prototype,{imageData:null,process:function(r){switch(r.messageType){case wdi.SpiceVars.SPICE_MSG_CURSOR_INIT:case wdi.SpiceVars.SPICE_MSG_CURSOR_SET:var e=this.extractCursor(r);e&&(wdi.VirtualMouse.setHotspot(0,0),wdi.VirtualMouse.setMouse(e.data,e.header.hot_spot_x,e.header.hot_spot_y));break;case wdi.SpiceVars.SPICE_MSG_CURSOR_MOVE:var a=r.args.position;wdi.VirtualMouse.updateCursor(a.x,a.y);case wdi.SpiceVars.SPICE_MSG_CURSOR_HIDE:}},dispose:function(){this.clearEvents(),this.imageData=null},_toUrl:function(r){var e=$("<canvas/>").attr({width:r.width,height:r.height})[0];return e.getContext("2d").putImageData(r,0,0),e.toDataURL("image/png")},extractCursor:function(r){var e=r.args.cursor.flags,a=r.args.position,s=r.args.visible;if(1&e)return null;var i=null;if(e&wdi.SpiceCursorFlags.SPICE_CURSOR_FLAGS_FROM_CACHE)i=wdi.ImageCache.getCursorFrom(r.args.cursor);else switch(r.args.cursor.header.type){case wdi.SpiceCursorType.SPICE_CURSOR_TYPE_ALPHA:i=this._toUrl(wdi.graphics.argbToImageData(r.args.cursor.data,r.args.cursor.header.width,r.args.cursor.header.height));break;case wdi.SpiceCursorType.SPICE_CURSOR_TYPE_MONO:i=this._toUrl(wdi.graphics.monoToImageData(r.args.cursor.data,r.args.cursor.header.width,r.args.cursor.header.height));break;case 8:i=wdi.SpiceObject.bytesToString(r.args.cursor.data);case wdi.SpiceCursorType.SPICE_CURSOR_TYPE_COLOR4:case wdi.SpiceCursorType.SPICE_CURSOR_TYPE_COLOR8:case wdi.SpiceCursorType.SPICE_CURSOR_TYPE_COLOR16:case wdi.SpiceCursorType.SPICE_CURSOR_TYPE_COLOR24:case wdi.SpiceCursorType.SPICE_CURSOR_TYPE_COLOR32:case wdi.SpiceCursorType.SPICE_CURSOR_TYPE_ENUM_END:}return i?(e&wdi.SpiceCursorFlags.SPICE_CURSOR_FLAGS_CACHE_ME&&wdi.ImageCache.addCursor(r.args.cursor,i),{data:i,position:a,visible:s,header:r.args.cursor.header}):null}});wdi.PlaybackProcess=$.spcExtend(wdi.EventObject.prototype,{_lastApp:null,started:!1,minBuffSize:32768,frequency:null,channels:null,audioContext:null,startTime:null,hasAudioSupport:!0,typedBuffer:null,position:null,init:function(t){this.app=t.app,this.audioContext=this.getAudioContext(),this.audioContext?this.hasAudioSupport=!0:(this.hasAudioSupport=!1,wdi.Debug.warn("The client browser does not support Web Audio API")),this.startTime=0,this.typedBuffer=new ArrayBuffer(34688),this.position=0},dispose:function(){this.clearEvents(),this._lastApp=null,this.started=!1,this.frequency=null,this.channels=null,this.audioContext=null,this.startTime=null,this.hasAudioSupport=!0,this.typedBuffer=null,this.position=null},getAudioContext:function(){try{return new AudioContext}catch(t){}try{return new webkitAudioContext}catch(t){}return!1},process:function(t){if(this.hasAudioSupport)switch(t.messageType){case wdi.SpiceVars.SPICE_MSG_PLAYBACK_MODE:break;case wdi.SpiceVars.SPICE_MSG_PLAYBACK_START:var e=t.args;this.channels=e.channels,this.frequency=e.frequency;break;case wdi.SpiceVars.SPICE_MSG_PLAYBACK_STOP:this.startTime=0;e=t.args;this.flush();break;case wdi.SpiceVars.SPICE_MSG_PLAYBACK_DATA:e=t.args;var i=t.args.multimedia_time;new Uint8Array(this.typedBuffer).set(e.data,this.position),this.position+=e.data.length,this._lastApp=this.app,this.position>=this.minBuffSize&&this.flush(i)}},flush:function(t){this.position>0&&(this.started&&this.playSound(this.typedBuffer,t),this.position=0,this.typedBuffer=new ArrayBuffer(34688))},playSound:function(t,e){if(2==this.channels)return this.playSoundStereo(t,e);for(var i=new Int16Array(t),s=new Array(this.channels),n=0;n<this.channels;n++)s[n]=new Float32Array(i.length/2);var a=0;for(n=0;n<i.length;){for(var r=0;r<this.channels;r++)s[r][a]=i[n++]/32768;a++}var h=this.audioContext.createBufferSource(),o=this.audioContext.createBuffer(this.channels,a,this.frequency);for(n=0;n<this.channels;n++)o.getChannelData(n).set(s[n]);this._play(h,o,e)},playSoundStereo:function(t,e){for(var i=new Int16Array(t),s=new Float32Array(i.length/2),n=new Float32Array(i.length/2),a=0,r=this.audioContext,h=i.length,o=0;o<h;)s[a]=i[o++]/32768,n[a]=i[o++]/32768,a++;var u=r.createBufferSource(),l=r.createBuffer(2,a,this.frequency);l.getChannelData(0).set(s),l.getChannelData(1).set(n),this._play(u,l,e)},_play:function(t,e,i){var s=0;i&&((s=i-(Date.now()-this.app.lastMultimediaTime+this.app.multimediaTime))<0&&(s=0));t.buffer=e,t.connect(this.audioContext.destination),t.start(this.startTime+s),this.startTime+=e.duration},startAudio:function(){this.started=!0,this.flush()}});wdi.MainProcess=$.spcExtend(wdi.EventObject.prototype,{init:function(e){this.superInit(),this.app=e.app,this.spiceConnection=e.app.spiceConnection,this.agent=e.app.agent,this.currentMouseMode=wdi.SpiceMouseModeTypes.SPICE_MOUSE_MODE_CLIENT},dispose:function(){this.clearEvents(),this.app=null,this.spiceConnection=null,this.agent=null},process:function(e){var t=this.spiceConnection.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN];switch(e.messageType){case wdi.SpiceVars.SPICE_MSG_MAIN_INIT:t.connectionId=e.args.session_id,t.fire("connectionId",t.connectionId),1==e.args.agent_connected&&t.fire("initAgent",e.args.agent_tokens),1==e.args.current_mouse_mode&&t.fire("mouseMode",e.args.current_mouse_mode),this.changeMouseMode();break;case wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_DATA:var n=e.args;this.agent.onAgentData(n);break;case wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_CONNECTED:t.fire("initAgent",e.args.agent_tokens),this.changeMouseMode();break;case wdi.SpiceVars.SPICE_MSG_MAIN_MULTI_MEDIA_TIME:this.app.multimediaTime=e.args.multimedia_time;break;case wdi.SpiceVars.SPICE_MSG_MAIN_CHANNELS_LIST:t.fire("channelListAvailable",e.args.channels)}},changeMouseMode:function(e=wdi.SpiceMouseModeTypes.SPICE_MOUSE_MODE_CLIENT){var t=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST,channel:wdi.SpiceVars.SPICE_CHANNEL_MAIN,args:new wdi.SpiceMouseModeRequest({request_mode:e})});this.spiceConnection.send(t),this.currentMouseMode=e;const{$mouse:n}=useNuxtApp();if(n.changeMode(e),e===wdi.SpiceMouseModeTypes.SPICE_MOUSE_MODE_SERVER){wdi.VirtualMouse.initCursor();const u=document.getElementById("eventLayer");u.requestPointerLock?.();u.getBoundingClientRect();let d=0,r=0;function s(e,t={}){const n=new MouseEvent(e,{bubbles:!1,cancelable:!0,view:window,clientX:d,clientY:r,button:t.button??0,buttons:t.buttons??0,ctrlKey:t.ctrlKey??!1,shiftKey:t.shiftKey??!1,altKey:t.altKey??!1,metaKey:t.metaKey??!1,isLocked:!0});u.dispatchEvent(n)}function i(e){if(!e.isTrusted)return;const t=e.movementX||0,n=e.movementY||0;d+=t,r+=n,s("mousemove",{buttons:e.buttons,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey})}function o(e){e.isTrusted&&s("mousedown",{button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey})}function c(e){e.isTrusted&&s("mouseup",{button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey})}function a(e){e.isTrusted&&function(e){const t=new WheelEvent("wheel",{bubbles:!1,cancelable:!0,clientX:d,clientY:r,deltaX:e.deltaX,deltaY:e.deltaY,deltaZ:e.deltaZ,deltaMode:e.deltaMode});u.dispatchEvent(t)}(e)}if(!this._pointerLockInitialized){this._pointerLockInitialized=!0;const l=()=>{document.pointerLockElement===u?(document.addEventListener("mousemove",i),document.addEventListener("mousedown",o),document.addEventListener("mouseup",c),document.addEventListener("wheel",a,{passive:!1})):(document.removeEventListener("mousemove",i),document.removeEventListener("mousedown",o),document.removeEventListener("mouseup",c),document.removeEventListener("wheel",a,{passive:!1}),this.changeMouseMode(wdi.SpiceMouseModeTypes.SPICE_MOUSE_MODE_CLIENT),wdi.VirtualMouse.removeCursor())};document.addEventListener("pointerlockchange",l)}d=u.width/2,r=u.height/2}}});wdi.KeyEvent={isCtrlPressed:function(e){if(!e)throw new Error("isCtrlPressed: No event provided.");var r=e.ctrlKey;return-1!=navigator.platform.indexOf("Mac")&&(r=e.metaKey),r}};wdi.KeymapES=function(){var e={Backquote:[[5,0,0,0],[133,0,0,0]],Digit1:[[2,0,0,0],[130,0,0,0]],Digit2:[[3,0,0,0],[131,0,0,0]],Digit3:[[4,0,0,0],[132,0,0,0]],Digit4:[[5,0,0,0],[133,0,0,0]],Digit5:[[6,0,0,0],[134,0,0,0]],Digit6:[[7,0,0,0],[135,0,0,0]],Digit7:[[8,0,0,0],[136,0,0,0]],Digit8:[[9,0,0,0],[137,0,0,0]],Digit9:[[10,0,0,0],[138,0,0,0]],Digit0:[[11,0,0,0],[139,0,0,0]],Minus:[[53,0,0,0],[181,0,0,0]],Equal:[[11,0,0,0],[139,0,0,0]],KeyQ:[[16,0,0,0],[144,0,0,0]],KeyW:[[17,0,0,0],[145,0,0,0]],KeyE:[[18,0,0,0],[146,0,0,0]],KeyR:[[19,0,0,0],[147,0,0,0]],KeyT:[[20,0,0,0],[148,0,0,0]],KeyY:[[21,0,0,0],[149,0,0,0]],KeyU:[[22,0,0,0],[150,0,0,0]],KeyI:[[23,0,0,0],[151,0,0,0]],KeyO:[[24,0,0,0],[152,0,0,0]],KeyP:[[25,0,0,0],[153,0,0,0]],BracketLeft:[[26,0,0,0],[154,0,0,0]],BracketRight:[[27,0,0,0],[155,0,0,0]],Backslash:[[41,0,0,0],[169,0,0,0]],KeyA:[[30,0,0,0],[158,0,0,0]],KeyS:[[31,0,0,0],[159,0,0,0]],KeyD:[[32,0,0,0],[160,0,0,0]],KeyF:[[33,0,0,0],[161,0,0,0]],KeyG:[[34,0,0,0],[162,0,0,0]],KeyH:[[35,0,0,0],[163,0,0,0]],KeyJ:[[36,0,0,0],[164,0,0,0]],KeyK:[[37,0,0,0],[165,0,0,0]],KeyL:[[38,0,0,0],[166,0,0,0]],Semicolon:[[51,0,0,0],[179,0,0,0]],Quote:[[12,0,0,0],[140,0,0,0]],KeyZ:[[44,0,0,0],[172,0,0,0]],KeyX:[[45,0,0,0],[173,0,0,0]],KeyC:[[46,0,0,0],[174,0,0,0]],KeyV:[[47,0,0,0],[175,0,0,0]],KeyB:[[48,0,0,0],[176,0,0,0]],KeyN:[[49,0,0,0],[177,0,0,0]],KeyM:[[50,0,0,0],[178,0,0,0]],Comma:[[51,0,0,0],[179,0,0,0]],Period:[[52,0,0,0],[180,0,0,0]],Slash:[[53,0,0,0],[181,0,0,0]],Numpad0:[[11,0,0,0],[139,0,0,0]],Numpad1:[[2,0,0,0],[130,0,0,0]],Numpad2:[[3,0,0,0],[131,0,0,0]],Numpad3:[[4,0,0,0],[132,0,0,0]],Numpad4:[[5,0,0,0],[133,0,0,0]],Numpad5:[[6,0,0,0],[134,0,0,0]],Numpad6:[[7,0,0,0],[135,0,0,0]],Numpad7:[[8,0,0,0],[136,0,0,0]],Numpad8:[[9,0,0,0],[137,0,0,0]],Numpad9:[[10,0,0,0],[138,0,0,0]],NumpadDivide:[[53,0,0,0],[181,0,0,0]],NumpadMultiply:[[55,0,0,0],[183,0,0,0]],NumpadSubtract:[[74,0,0,0],[202,0,0,0]],NumpadAdd:[[78,0,0,0],[206,0,0,0]],NumpadDecimal:[[52,0,0,0],[180,0,0,0]]},t=[];t[27]=1,t[9]=15,t[20]=58,t[16]=42,t[91]=29,t[17]=29,t[32]=57,t[8]=14,t[13]=28,t[18]=56,t[92]=92,t[93]=93,t[38]=72,t[37]=75,t[40]=80,t[39]=77,t[45]=82,t[46]=83,t[36]=71,t[35]=79,t[33]=73,t[34]=81,t[144]=69,t[145]=70,t[112]=59,t[113]=60,t[114]=61,t[115]=62,t[116]=63,t[117]=64,t[118]=65,t[119]=66,t[120]=67,t[121]=68,t[122]=87,t[123]=88;var i=[];i[81]=16,i[87]=17,i[69]=18,i[82]=19,i[84]=20,i[89]=21,i[85]=22,i[73]=23,i[79]=24,i[80]=25,i[65]=30,i[83]=31,i[68]=32,i[70]=33,i[71]=34,i[72]=35,i[74]=36,i[75]=37,i[76]=38,i[90]=44,i[88]=45,i[67]=46,i[86]=47,i[66]=48,i[78]=49,i[77]=50;var a=[];a[9]=15;var u=[];return u[81]=16,u[87]=17,u[69]=18,u[82]=19,u[84]=20,u[89]=21,u[85]=22,u[73]=23,u[79]=24,u[80]=25,u[65]=30,u[83]=31,u[68]=32,u[70]=33,u[71]=34,u[72]=35,u[74]=36,u[75]=37,u[76]=38,u[90]=44,u[88]=45,u[86]=47,u[67]=46,u[66]=48,u[78]=49,u[77]=50,{getKeymap:function(){return t},getCtrlKeymap:function(){return i},getCtrlForbiddenKeymap:function(){return a},getReservedCtrlKeymap:function(){return u},getCharmap:function(){return e},setCtrlKey:function(e,t){i[e]=t}}}();wdi.scanCodeObjProvider=$.spcExtend(wdi.EventObject.prototype,{init:function(t){this.charObj=t},getPrefix:function(){return this.prefix},getSufix:function(){return this.suffix},setPrefix:function(t){},setSuffix:function(t){},getScanCode:function(){var t=[],i=this.charObj.main;return t=t.concat(i)}});wdi.ScanCodeObjModifier=$.spcExtend(wdi.EventObject.prototype,{SHIFTDOWN:[42,0,0,0],SHIFTUP:[170,0,0,0],init:function(n){this.scanCodeObjProvider=new wdi.scanCodeObjProvider(n),this.prefix=[],this.suffix=[]},removeShift:function(){return this.getScanCode()},containsShiftDown:function(){return!1},addShiftUp:function(){},addShiftDown:function(){},getScanCode:function(){return this.scanCodeObjProvider.getScanCode()},_removeKeyFromPart:function(n,t){return t.filter((function(t){return!_.isEqual(t,n)}))}});wdi.KeymapObjES=function(){var i={Backquote:{prefix:[],main:[[41,0,0,0],[169,0,0,0]],suffix:[]},Digit1:{prefix:[],main:[[2,0,0,0],[130,0,0,0]],suffix:[]},Digit2:{prefix:[],main:[[3,0,0,0],[131,0,0,0]],suffix:[]},Digit3:{prefix:[],main:[[4,0,0,0],[132,0,0,0]],suffix:[]},Digit4:{prefix:[],main:[[5,0,0,0],[133,0,0,0]],suffix:[]},Digit5:{prefix:[],main:[[6,0,0,0],[134,0,0,0]],suffix:[]},Digit6:{prefix:[],main:[[7,0,0,0],[135,0,0,0]],suffix:[]},Digit7:{prefix:[],main:[[8,0,0,0],[136,0,0,0]],suffix:[]},Digit8:{prefix:[],main:[[9,0,0,0],[137,0,0,0]],suffix:[]},Digit9:{prefix:[],main:[[10,0,0,0],[138,0,0,0]],suffix:[]},Digit0:{prefix:[],main:[[11,0,0,0],[139,0,0,0]],suffix:[]},Minus:{prefix:[],main:[[12,0,0,0],[140,0,0,0]],suffix:[]},Equal:{prefix:[],main:[[13,0,0,0],[141,0,0,0]],suffix:[]},KeyQ:{prefix:[],main:[[16,0,0,0],[144,0,0,0]],suffix:[]},KeyW:{prefix:[],main:[[17,0,0,0],[145,0,0,0]],suffix:[]},KeyE:{prefix:[],main:[[18,0,0,0],[146,0,0,0]],suffix:[]},KeyR:{prefix:[],main:[[19,0,0,0],[147,0,0,0]],suffix:[]},KeyT:{prefix:[],main:[[20,0,0,0],[148,0,0,0]],suffix:[]},KeyY:{prefix:[],main:[[21,0,0,0],[149,0,0,0]],suffix:[]},KeyU:{prefix:[],main:[[22,0,0,0],[150,0,0,0]],suffix:[]},KeyI:{prefix:[],main:[[23,0,0,0],[151,0,0,0]],suffix:[]},KeyO:{prefix:[],main:[[24,0,0,0],[152,0,0,0]],suffix:[]},KeyP:{prefix:[],main:[[25,0,0,0],[153,0,0,0]],suffix:[]},BracketLeft:{prefix:[],main:[[26,0,0,0],[154,0,0,0]],suffix:[]},BracketRight:{prefix:[],main:[[27,0,0,0],[155,0,0,0]],suffix:[]},Backslash:{prefix:[],main:[[43,0,0,0],[171,0,0,0]],suffix:[]},KeyA:{prefix:[],main:[[30,0,0,0],[158,0,0,0]],suffix:[]},KeyS:{prefix:[],main:[[31,0,0,0],[159,0,0,0]],suffix:[]},KeyD:{prefix:[],main:[[32,0,0,0],[160,0,0,0]],suffix:[]},KeyF:{prefix:[],main:[[33,0,0,0],[161,0,0,0]],suffix:[]},KeyG:{prefix:[],main:[[34,0,0,0],[162,0,0,0]],suffix:[]},KeyH:{prefix:[],main:[[35,0,0,0],[163,0,0,0]],suffix:[]},KeyJ:{prefix:[],main:[[36,0,0,0],[164,0,0,0]],suffix:[]},KeyK:{prefix:[],main:[[37,0,0,0],[165,0,0,0]],suffix:[]},KeyL:{prefix:[],main:[[38,0,0,0],[166,0,0,0]],suffix:[]},Semicolon:{prefix:[],main:[[39,0,0,0],[167,0,0,0]],suffix:[]},Quote:{prefix:[],main:[[40,0,0,0],[168,0,0,0]],suffix:[]},KeyZ:{prefix:[],main:[[44,0,0,0],[172,0,0,0]],suffix:[]},KeyX:{prefix:[],main:[[45,0,0,0],[173,0,0,0]],suffix:[]},KeyC:{prefix:[],main:[[46,0,0,0],[174,0,0,0]],suffix:[]},KeyV:{prefix:[],main:[[47,0,0,0],[175,0,0,0]],suffix:[]},KeyB:{prefix:[],main:[[48,0,0,0],[176,0,0,0]],suffix:[]},KeyN:{prefix:[],main:[[49,0,0,0],[177,0,0,0]],suffix:[]},KeyM:{prefix:[],main:[[50,0,0,0],[178,0,0,0]],suffix:[]},Comma:{prefix:[],main:[[51,0,0,0],[179,0,0,0]],suffix:[]},Period:{prefix:[],main:[[52,0,0,0],[180,0,0,0]],suffix:[]},Slash:{prefix:[],main:[[53,0,0,0],[181,0,0,0]],suffix:[]},Numpad0:{prefix:[],main:[[11,0,0,0],[139,0,0,0]],suffix:[]},Numpad1:{prefix:[],main:[[2,0,0,0],[130,0,0,0]],suffix:[]},Numpad2:{prefix:[],main:[[3,0,0,0],[131,0,0,0]],suffix:[]},Numpad3:{prefix:[],main:[[4,0,0,0],[132,0,0,0]],suffix:[]},Numpad4:{prefix:[],main:[[5,0,0,0],[133,0,0,0]],suffix:[]},Numpad5:{prefix:[],main:[[6,0,0,0],[134,0,0,0]],suffix:[]},Numpad6:{prefix:[],main:[[7,0,0,0],[135,0,0,0]],suffix:[]},Numpad7:{prefix:[],main:[[8,0,0,0],[136,0,0,0]],suffix:[]},Numpad8:{prefix:[],main:[[9,0,0,0],[137,0,0,0]],suffix:[]},Numpad9:{prefix:[],main:[[10,0,0,0],[138,0,0,0]],suffix:[]},NumpadDivide:{prefix:[],main:[[224,53,0,0],[0,0,0,0]],suffix:[]},NumpadMultiply:{prefix:[],main:[[55,0,0,0],[183,0,0,0]],suffix:[]},NumpadSubtract:{prefix:[],main:[[74,0,0,0],[202,0,0,0]],suffix:[]},NumpadAdd:{prefix:[],main:[[78,0,0,0],[206,0,0,0]],suffix:[]},NumpadDecimal:{prefix:[],main:[[83,0,0,0],[211,0,0,0]],suffix:[]}};return{getScanCode:function(i){return new wdi.scanCodeObjProvider(this.getCharmap()[i]).getScanCode()},getCharmap:function(){return i}}}();wdi.KeymapUS=function(){var e=[];e.Backquote=[[5,0,0,0],[133,0,0,0]],e.Digit1=[[2,0,0,0],[130,0,0,0]],e.Digit2=[[3,0,0,0],[131,0,0,0]],e.Digit3=[[4,0,0,0],[132,0,0,0]],e.Digit4=[[5,0,0,0],[133,0,0,0]],e.Digit5=[[6,0,0,0],[134,0,0,0]],e.Digit6=[[7,0,0,0],[135,0,0,0]],e.Digit7=[[8,0,0,0],[136,0,0,0]],e.Digit8=[[9,0,0,0],[137,0,0,0]],e.Digit9=[[10,0,0,0],[138,0,0,0]],e.Digit0=[[11,0,0,0],[139,0,0,0]],e.Minus=[[53,0,0,0],[181,0,0,0]],e.Equal=[[11,0,0,0],[139,0,0,0]],e.KeyQ=[[16,0,0,0],[144,0,0,0]],e.KeyW=[[17,0,0,0],[145,0,0,0]],e.KeyE=[[18,0,0,0],[146,0,0,0]],e.KeyR=[[19,0,0,0],[147,0,0,0]],e.KeyT=[[20,0,0,0],[148,0,0,0]],e.KeyY=[[21,0,0,0],[149,0,0,0]],e.KeyU=[[22,0,0,0],[150,0,0,0]],e.KeyI=[[23,0,0,0],[151,0,0,0]],e.KeyO=[[24,0,0,0],[152,0,0,0]],e.KeyP=[[25,0,0,0],[153,0,0,0]],e.BracketLeft=[[26,0,0,0],[154,0,0,0]],e.BracketRight=[[27,0,0,0],[155,0,0,0]],e.Backslash=[[41,0,0,0],[169,0,0,0]],e.KeyA=[[30,0,0,0],[158,0,0,0]],e.KeyS=[[31,0,0,0],[159,0,0,0]],e.KeyD=[[32,0,0,0],[160,0,0,0]],e.KeyF=[[33,0,0,0],[161,0,0,0]],e.KeyG=[[34,0,0,0],[162,0,0,0]],e.KeyH=[[35,0,0,0],[163,0,0,0]],e.KeyJ=[[36,0,0,0],[164,0,0,0]],e.KeyK=[[37,0,0,0],[165,0,0,0]],e.KeyL=[[38,0,0,0],[166,0,0,0]],e.Semicolon=[[51,0,0,0],[179,0,0,0]],e.Quote=[[12,0,0,0],[140,0,0,0]],e.KeyZ=[[44,0,0,0],[172,0,0,0]],e.KeyX=[[45,0,0,0],[173,0,0,0]],e.KeyC=[[46,0,0,0],[174,0,0,0]],e.KeyV=[[47,0,0,0],[175,0,0,0]],e.KeyB=[[48,0,0,0],[176,0,0,0]],e.KeyN=[[49,0,0,0],[177,0,0,0]],e.KeyM=[[50,0,0,0],[178,0,0,0]],e.Comma=[[51,0,0,0],[179,0,0,0]],e.Period=[[52,0,0,0],[180,0,0,0]],e.Slash=[[53,0,0,0],[181,0,0,0]],e.Numpad0=[[11,0,0,0],[139,0,0,0]],e.Numpad1=[[2,0,0,0],[130,0,0,0]],e.Numpad2=[[3,0,0,0],[131,0,0,0]],e.Numpad3=[[4,0,0,0],[132,0,0,0]],e.Numpad4=[[5,0,0,0],[133,0,0,0]],e.Numpad5=[[6,0,0,0],[134,0,0,0]],e.Numpad6=[[7,0,0,0],[135,0,0,0]],e.Numpad7=[[8,0,0,0],[136,0,0,0]],e.Numpad8=[[9,0,0,0],[137,0,0,0]],e.Numpad9=[[10,0,0,0],[138,0,0,0]],e.NumpadDivide=[[53,0,0,0],[181,0,0,0]],e.NumpadMultiply=[[55,0,0,0],[183,0,0,0]],e.NumpadSubtract=[[74,0,0,0],[202,0,0,0]],e.NumpadAdd=[[78,0,0,0],[206,0,0,0]],e.NumpadDecimal=[[52,0,0,0],[180,0,0,0]];var t=[];t[27]=1,t[9]=15,t[20]=58,t[16]=42,t[91]=29,t[17]=29,t[32]=57,t[8]=14,t[13]=28,t[18]=56,t[92]=92,t[93]=93,t[38]=72,t[37]=75,t[40]=80,t[39]=77,t[45]=82,t[46]=83,t[36]=71,t[35]=79,t[33]=73,t[34]=81,t[144]=69,t[145]=70,t[112]=59,t[113]=60,t[114]=61,t[115]=62,t[116]=63,t[117]=64,t[118]=65,t[119]=66,t[120]=67,t[121]=68,t[122]=87,t[123]=88;var a=[];a[65]=30,a[81]=16,a[87]=17,a[69]=18,a[82]=19,a[84]=20,a[89]=21,a[85]=22,a[73]=23,a[79]=24,a[80]=25,a[65]=30,a[83]=31,a[68]=32,a[70]=33,a[71]=34,a[72]=35,a[74]=36,a[75]=37,a[76]=38,a[90]=44,a[88]=45,a[67]=46,a[86]=47,a[66]=48,a[78]=49,a[77]=50;var i=[];i[9]=15;var u=[];return u[81]=16,u[87]=17,u[69]=18,u[82]=19,u[84]=20,u[89]=21,u[85]=22,u[73]=23,u[79]=24,u[80]=25,u[65]=30,u[83]=31,u[68]=32,u[70]=33,u[71]=34,u[72]=35,u[74]=36,u[75]=37,u[76]=38,u[88]=45,u[90]=44,u[86]=47,u[67]=46,u[66]=48,u[78]=49,u[77]=50,{getKeymap:function(){return t},getCtrlKeymap:function(){return a},getCtrlForbiddenKeymap:function(){return i},getReservedCtrlKeymap:function(){return u},getCharmap:function(){return e},setCtrlKey:function(e,t){a[e]=t}}}();wdi.keyShortcutsHandled={CTRLV:0,CTRLC:1},wdi.Keymap={keymap:{},ctrlKeymap:{},ctrlForbiddenKeymap:{},charmap:{},ctrlPressed:!1,capsLock:!1,numLock:!1,isVirtualKeyboard:!1,isVirtualCapsLockOn:!1,twoBytesScanCodes:[91,219,92,220,29,157,93,221,82,210,83,211,75,203,71,201,79,207,72,200,80,208,73,201,81,209,77,205,28,156],loadKeyMap:function(e,t){try{this.keymap=wdi["Keymap"+e.toUpperCase()].getKeymap(),this.ctrlKeymap=wdi["Keymap"+e.toUpperCase()].getCtrlKeymap(),this.ctrlForbiddenKeymap=wdi["Keymap"+e.toUpperCase()].getCtrlForbiddenKeymap(),this.reservedCtrlKeymap=wdi["Keymap"+e.toUpperCase()].getReservedCtrlKeymap(),this.charmap=wdi["KeymapObj"+e.toUpperCase()].getCharmap(),this.stuckKeysHandler=t}catch(e){this.keymap=wdi.KeymapES.getKeymap(),this.ctrlKeymap=wdi.KeymapES.getCtrlKeymap(),this.ctrlForbiddenKeymap=wdi.KeymapES.getCtrlForbiddenKeymap(),this.reservedCtrlKeymap=wdi.KeymapES.getReservedCtrlKeymap(),this.charmap=wdi.KeymapObjES.getCharmap(),this.stuckKeysHandler=t}},isInKeymap:function(e){return void 0!==this.keymap[e]},getScanCodes:function(e){return e.hasScanCode?e.scanCode:this.isForbiddenCombination(e)?[]:this.isGeneratedShortcut(e.type,e.keyCode,e.generated)?this.getScanCodeFromKeyCode(e.keyCode,e.type,this.ctrlKeymap,this.reservedCtrlKeymap):this.handledByCharmap(e.type)&&e.originalEvent?this.getScanCodesFromCharCode(e.originalEvent.code):this.handledByNormalKeyCode(e.type,e.keyCode)?this.getScanCodeFromKeyCode(e.keyCode,e.type,this.keymap):[]},getScanCodeFromKeyCode:function(e,t,r,i){this.controlPressed(e,t);var a=null;if(void 0===(a=e in r?r[e]:i[e]))return[];if(a<256){if("keydown"==t)return[this.makeKeymap(a)];if("keyup"==t)return[this.makeKeymap(128|a)]}else{if("keydown"==t)return[this.makeKeymap(224|a-256<<8)];if("keyup"==t)return[this.makeKeymap(32992|a-256<<8)]}return a},isForbiddenCombination:function(e){var t=e.keyCode,r=(e.type,this.ctrlForbiddenKeymap);return!!(wdi.KeyEvent.isCtrlPressed(e)&&r[t]&&r[t])},controlPressed:function(e,t,r){if(17===e&&(this.ctrlPressed="keydown"===t),!r)return!1;17!==e&&91!==e&&("keydown"===t?wdi.KeyEvent.isCtrlPressed(r)&&(this.ctrlPressed=!0):"keyup"===t&&(wdi.KeyEvent.isCtrlPressed(r)||(this.ctrlPressed=!1)))},handledByCtrlKeyCode:function(e,t,r){if(("keydown"===e||"keyup"===e||"keypress"===e)&&this.ctrlPressed){if("keypress"===e)return!0;if(this.ctrlKeymap[t])return!0;if(r&&this.reservedCtrlKeymap[t])return!0}return!1},isGeneratedShortcut:function(e,t,r){if(("keydown"===e||"keyup"===e||"keypress"===e)&&this.ctrlPressed){if("keypress"===e)return!0;if(this.ctrlKeymap[t])return!0;if(r&&this.reservedCtrlKeymap[t])return!0}return!1},handledByNormalKeyCode:function(e,t){return!("keydown"!==e&&"keyup"!==e||!this.keymap[t])},handledByCharmap:function(e){return"inputmanager"===e},getScanCodesFromCharCode:function(e){var t=this.charmap[e];return new wdi.ScanCodeObjModifier(t).getScanCode()},makeKeymap:function(e){return-1!=$.inArray(e,this.twoBytesScanCodes)?[224,e,0,0]:[e,0,0]}};const getURLParameter=e=>{const t=new RegExp(`${e}=([^&]+)`).exec(window.location.pathname);return t&&t[1]};let vmHost=window.location.hostname;"localhost"===vmHost&&(vmHost="10.10.101.107");const vmId=getURLParameter("id"),vmPort=window.config.public.PORT;window.app=new Application({supportHighDPI:!1});let vmWidth=-1,vmHeight=-1;window.addEventListener("resize",(()=>{-1!==vmWidth&&-1!==vmHeight&&setVmPosition(vmWidth,vmHeight)}));const setVmPosition=(e,t)=>{vmWidth=e,vmHeight=t;const o=Math.max((window.innerWidth-e)/2,0),n=Math.max((window.innerHeight-t)/2,0);document.getElementById("canvas_0").style.left=o+"px",document.getElementById("eventLayer").style.left=o+"px",document.getElementById("canvas_0").style.top=n+"px",document.getElementById("eventLayer").style.top=n+"px"};function start(){wdi.graphicDebug=new wdi.GraphicDebug({debugMode:!1});let e,t,o=!1;$(window).resize((function(){app.sendCommand("setResolution",app.toSpiceResolution({width:$(window).width(),height:$(window).height()}))}));const n={callback:function(n,i){if("windowClosed"===n)$(i.canvas).remove(),$(i.eventLayer).remove();else if("windowMoved"===n)$(i.canvas).css({top:i.info.top+"px",left:i.info.left+"px"}),$(i.eventLayer).css({top:i.info.top+"px",left:i.info.left+"px"});else if("init"===n||"windowCreated"===n){let e=null,t=null,o=null;const n=$("body");for(let s in i){e=i[s];const a=2*e.position;t=$(e.canvas).css({zIndex:1e4-a-1,position:"absolute",top:e.info.top+"px",left:e.info.left+"px"}),o=$(e.eventLayer).css({top:e.info.top+"px",left:e.info.left+"px",zIndex:1e4-a}),n.append(t),n.append(o)}}else if("ready"===n){app.setReconnecting(!1),t?.clearTimeout&&(t(),t=!1);const e=$(window).width(),o=$(window).height();app.sendCommand("setResolution",app.toSpiceResolution({width:e,height:o})),wdi.IntegrationBenchmarkEnabled&&($("#integrationBenchmark").css({display:"inline"}),$("#launchWordButton").prop("disabled",!1))}else if("resolution"===n){const{0:e,1:t}=i;setVmPosition(e,t)}else if("windowResized"===n){const{0:e}=i,t=(window.innerWidth-e)/2;t>=0&&(document.getElementById("canvas_0").style.left=t+"px",document.getElementById("eventLayer").style.left=t+"px")}else"windowMinimized"===n?($(i.canvas).css({display:"none"}),$(i.eventLayer).css({display:"none"})):"windowMaximized"===n?($(i.canvas).css({top:i.info.top+"px",left:i.info.left+"px"}),$(i.eventLayer).css({top:i.info.top+"px",left:i.info.left+"px"})):"windowRestored"===n?($(i.canvas).css({display:"block"}),$(i.eventLayer).css({display:"block"}),$(i.canvas).css({top:i.info.top+"px",left:i.info.left+"px"}),$(i.eventLayer).css({top:i.info.top+"px",left:i.info.left+"px"})):"windowFocused"===n||("timeLapseDetected"===n?wdi.Debug.log("Detected time lapse of ",i,"seconds"):"error"===n&&(app.getReconnecting()||(e||(e=setTimeout((function(){console.log("cancelFreeze"),app.cancelFreeze()}),1e4)),t||(t=setTimeout((function(){console.log("cancel reconnection"),o=!0}),6e4))),setTimeout((function(){o||(console.log("Trying reconnect ",Date.now()),app.reconnect({freeze:!0}))}),1e3)))},context:this,host:vmHost,port:vmPort,protocol:"wss",token:"password",vmHost:vmHost,vmPort:vmPort,vmid:vmId,useBus:!1,busHost:"localhost",busPort:61613,busSubscriptions:["/topic/00000000-0000-0000-0000-000000000000"],busUser:"00000000-0000-0000-0000-000000000000",busPass:"potato",layout:"es",useWorkers:!0,seamlessDesktopIntegration:!1,connectionControl:!1,heartbeatToken:"heartbeat",heartbeatTimeout:4e3,externalClipboardHandling:!1,disableClipboard:!1,layer:document.getElementById("vmw"),disableMessageBuffering:!0,clientOffset:{x:0,y:0}};app.run(n)}$(document).ready(start);