Ext.define('Ext.data.amf.Encoder',{alias:'data.amf.Encoder',config:{format:3},bytes:[],constructor:function(a){this.initConfig(a);this.clear()},clear:function(){this.bytes=[]},applyFormat:function(a){var b={0:{writeUndefined:this.write0Undefined,writeNull:this.write0Null,writeBoolean:this.write0Boolean,writeNumber:this.write0Number,writeString:this.write0String,writeXml:this.write0Xml,writeDate:this.write0Date,writeArray:this.write0Array,writeGenericObject:this.write0GenericObject},3:{writeUndefined:this.write3Undefined,writeNull:this.write3Null,writeBoolean:this.write3Boolean,writeNumber:this.write3Number,writeString:this.write3String,writeXml:this.write3Xml,writeDate:this.write3Date,writeArray:this.write3Array,writeGenericObject:this.write3GenericObject}}[a];if(b){Ext.apply(this,b);return a}else {return}},writeObject:function(a){var b=typeof (a);if(b==="undefined"){this.writeUndefined()}else if(a===null){this.writeNull()}else if(Ext.isBoolean(a)){this.writeBoolean(a)}else if(Ext.isString(a)){this.writeString(a)}else if(b==="number"||a instanceof Number){this.writeNumber(a)}else if(b==="object"){if(a instanceof Date){this.writeDate(a)}else if(Ext.isArray(a)){this.writeArray(a)}else if(this.isXmlDocument(a)){this.writeXml(a)}else {this.writeGenericObject(a)}}else {}},write3Undefined:function(){this.writeByte(0)},write0Undefined:function(){this.writeByte(6)},write3Null:function(){this.writeByte(1)},write0Null:function(){this.writeByte(5)},write3Boolean:function(a){if(a){this.writeByte(3)}else {this.writeByte(2)}},write0Boolean:function(a){this.writeByte(1);if(a){this.writeByte(1)}else {this.writeByte(0)}},encode29Int:function(e){var b=[],a=e,d,c;if(a===0){return [0]}if(a>2097151){d=a&255;b.unshift(d);a=a>>8}while(a>0){d=a&127;b.unshift(d);a=a>>7}for(c=0;c=d&&a<=c){a=a&c;b=this.encode29Int(a);b.unshift(4);this.writeBytes(b)}else {b=this.encodeDouble(a);b.unshift(5);this.writeBytes(b)}},write0Number:function(a){var b;if(a instanceof Number){a=a.valueOf()}b=this.encodeDouble(a);b.unshift(0);this.writeBytes(b)},encodeUtf8Char:function(a){var c=[],d,e,f,b;if(a<=127){c.push(a)}else {if(a<=2047){e=2}else if(a<=65535){e=3}else {e=4}b=128;for(f=1;f>6;b=(b>>1)|128}d=a|b;c.unshift(d)}return c},encodeUtf8String:function(d){var b=[],c,a;for(a=0;a>8}return c},write0String:function(d){var a,c,b;if(d===""){this.writeByte(2);this.writeBytes([0,0])}else {a=this.encodeUtf8String(d);if(a.length<=65535){b=2;c=this.encodeXInt(a.length,2)}else {b=12;c=this.encodeXInt(a.length,4)}this.writeByte(b);this.writeBytes(c);this.writeBytes(a)}},write3XmlWithType:function(e,c){var b,a,d;b=this.convertXmlToString(e);if(b===""){this.writeByte(c);this.writeByte(1)}else {a=this.encodeUtf8String(b);d=this.encode3Utf8StringLen(a);this.writeByte(c);this.writeBytes(d);this.writeBytes(a)}},write3XmlDocument:function(a){this.write3XmlWithType(a,7)},write3Xml:function(a){this.write3XmlWithType(a,11)},write0Xml:function(d){var c,a,b;c=this.convertXmlToString(d);this.writeByte(15);a=this.encodeUtf8String(c);b=this.encodeXInt(a.length,4);this.writeBytes(b);this.writeBytes(a)},write3Date:function(a){this.writeByte(8);this.writeBytes(this.encode29Int(1));this.writeBytes(this.encodeDouble(new Number(a)))},write0Date:function(a){this.writeByte(11);this.writeBytes(this.encodeDouble(new Number(a)));this.writeBytes([0,0])},write3Array:function(b){var a;this.writeByte(9);a=b.length;a=a<<1;a=a|1;this.writeBytes(this.encode29Int(a));this.writeByte(1);Ext.each(b,function(a){this.writeObject(a)},this)},write0ObjectProperty:function(a,d){var b,c;if(!(a instanceof String)&&(typeof (a)!=="string")){a=a+""}b=this.encodeUtf8String(a);c=this.encodeXInt(b.length,2);this.writeBytes(c);this.writeBytes(b);this.writeObject(d)},write0Array:function(c){var a,b;this.writeByte(8);b=0;for(a in c){b++}this.writeBytes(this.encodeXInt(b,4));for(a in c){Ext.Array.push(this.write0ObjectProperty(a,c[a]))}this.writeBytes([0,0,9])},write0StrictArray:function(a){var b;this.writeByte(10);b=a.length;this.writeBytes(this.encodeXInt(b,4));Ext.each(a,function(b){this.writeObject(b)},this)},write3ByteArray:function(b){var a;this.writeByte(12);a=b.length;a=a<<1;a=a|1;this.writeBytes(this.encode29Int(a));this.writeBytes(b)},write3GenericObject:function(d){var a,e,b,c;this.writeByte(10);c=11;this.writeByte(c);this.writeByte(1);for(a in d){e=new String(a).valueOf();b=(this.encodeUtf8String(a));this.writeBytes(this.encode3Utf8StringLen(a));this.writeBytes(b);this.writeObject(d[a])}this.writeByte(1)},write0GenericObject:function(b){var c,d,a;c=!!b.$flexType;d=c?16:3;this.writeByte(d);if(c){this.write0ShortUtf8String(b.$flexType)}for(a in b){if(a!=="$flexType"){Ext.Array.push(this.write0ObjectProperty(a,b[a]))}}this.writeBytes([0,0,9])},writeByte:function(a){Ext.Array.push(this.bytes,a)},writeBytes:function(a){var b;Ext.Array.push(this.bytes,a)},convertXmlToString:function(b){var a;if(window.XMLSerializer){a=new window.XMLSerializer().serializeToString(b)}else {a=b.xml}return a},isXmlDocument:function(a){if(window.DOMParser){if(Ext.isDefined(a.doctype)){return !0}}if(Ext.isString(a.xml)){return !0}return !1},encodeDouble:function(a){var l=11,h=52,i=(1<<(l-1))-1,k,d,e,j,f,b,g,c=[],n=[127,240,0,0,0,0,0,0],m=[255,240,0,0,0,0,0,0],o=[255,248,0,0,0,0,0,0];if(isNaN(a)){c=o}else if(a===Infinity){c=n}else if(a===-Infinity){c=m}else {if(a===0){d=0;e=0;k=(1/a===-Infinity)?1:0}else {k=a<0;a=Math.abs(a);if(a>=Math.pow(2,1-i)){j=Math.min(Math.floor(Math.log(a)/Math.LN2),i);d=j+i;e=Math.round(a*Math.pow(2,h-j)-Math.pow(2,h))}else {d=0;e=Math.round(a/Math.pow(2,1-i-h))}}b=[];for(f=h;f;f-=1){b.push(e%2?1:0);e=Math.floor(e/2)}for(f=l;f;f-=1){b.push(d%2?1:0);d=Math.floor(d/2)}b.push(k?1:0);b.reverse();g=b.join('');c=[];while(g.length){c.push(parseInt(g.substring(0,8),2));g=g.substring(8)}}return c},write0ShortUtf8String:function(c){var a=this.encodeUtf8String(c),b;b=this.encodeXInt(a.length,2);this.writeBytes(b);this.writeBytes(a)},writeAmfPacket:function(c,b){var a;this.writeBytes([0,0]);this.writeBytes(this.encodeXInt(c.length,2));for(a in c){this.writeAmfHeader(c[a].name,c[a].mustUnderstand,c[a].value)}this.writeBytes(this.encodeXInt(b.length,2));for(a in b){this.writeAmfMessage(b[a].targetUri,b[a].responseUri,b[a].body)}},writeAmfHeader:function(c,b,d){var a;this.write0ShortUtf8String(c);a=b?1:0;this.writeByte(a);this.writeBytes(this.encodeXInt(-1,4));this.writeObject(d)},writeAmfMessage:function(b,a,c){this.write0ShortUtf8String(b);this.write0ShortUtf8String(a);this.writeBytes(this.encodeXInt(-1,4));this.write0StrictArray(c)}});Ext.define('Ext.data.amf.Packet',function(){var f=Math.pow(2,-52),g=Math.pow(2,8),a=0,c,d,b,e;return {typeMap:{0:{0:'readDouble',1:'readBoolean',2:'readAmf0String',3:'readAmf0Object',5:'readNull',6:'readUndefined',7:'readReference',8:'readEcmaArray',10:'readStrictArray',11:'readAmf0Date',12:'readLongString',13:'readUnsupported',15:'readAmf0Xml',16:'readTypedObject'},3:{0:'readUndefined',1:'readNull',2:'readFalse',3:'readTrue',4:'readUInt29',5:'readDouble',6:'readAmf3String',7:'readAmf3Xml',8:'readAmf3Date',9:'readAmf3Array',10:'readAmf3Object',11:'readAmf3Xml',12:'readByteArray'}},decode:function(i){var f=this,k=f.headers=[],j=f.messages=[],h,g;a=0;c=f.bytes=i;d=f.strings=[];b=f.objects=[];e=f.traits=[];f.version=f.readUInt(2);for(h=f.readUInt(2);h--;){k.push({name:f.readAmf0String(),mustUnderstand:f.readBoolean(),byteLength:f.readUInt(4),value:f.readValue()});d=f.strings=[];b=f.objects=[];e=f.traits=[]}for(g=f.readUInt(2);g--;){j.push({targetURI:f.readAmf0String(),responseURI:f.readAmf0String(),byteLength:f.readUInt(4),body:f.readValue()});d=f.strings=[];b=f.objects=[];e=f.traits=[]}a=0;c=d=b=e=f.bytes=f.strings=f.objects=f.traits=null;return f},decodeValue:function(g){var f=this;c=f.bytes=g;a=0;f.version=3;d=f.strings=[];b=f.objects=[];e=f.traits=[];return f.readValue()},parseXml:function(b){var a;if(window.DOMParser){a=(new DOMParser()).parseFromString(b,"text/xml")}else {a=new ActiveXObject("Microsoft.XMLDOM");a.loadXML(b)}return a},readAmf0Date:function(){var b=new Date(this.readDouble());a+=2;return b},readAmf0Object:function(d){var f=this,e;d=d||{};b.push(d);while((e=f.readAmf0String())||c[a]!==9){d[e]=f.readValue()}a++;return d},readAmf0String:function(){return this.readUtf8(this.readUInt(2))},readAmf0Xml:function(){return this.parseXml(this.readLongString())},readAmf3Array:function(){var d=this,f=d.readUInt29(),g,e,a,c;if(f&1){g=(f>>1);e=d.readAmf3String();if(e){a={};b.push(a);do{a[e]=d.readValue()}while((e=d.readAmf3String()));for(c=0;c>1]}return a},readAmf3Date:function(){var d=this,c=d.readUInt29(),a;if(c&1){a=new Date(d.readDouble());b.push(a)}else {a=b[c>>1]}return a},readAmf3Object:function(){var h=this,d=h.readUInt29(),i=[],m,j,c,k,g,a,n,l,f;if(d&1){m=(d&7);if(m===3){c=h.readAmf3String();k=!!(d&8);j=(d>>4);for(f=0;f>2];c=g.className;k=g.dynamic;i=g.members;j=i.length}else if(m===7){}if(c){l=Ext.ClassManager.getByAlias('amf.'+c);a=l?new l():{$className:c}}else {a={}}b.push(a);for(f=0;f>1]}return a},readAmf3String:function(){var c=this,b=c.readUInt29(),a;if(b&1){a=c.readUtf8(b>>1);if(a){d.push(a)}return a}else {return d[b>>1]}},readAmf3Xml:function(){var d=this,c=d.readUInt29(),a;if(c&1){a=d.parseXml(d.readUtf8(c>>1));b.push(a)}else {a=b[c>>1]}return a},readBoolean:function(){return !!c[a++]},readByteArray:function(){var e=this.readUInt29(),d,f;if(e&1){f=a+(e>>1);d=Array.prototype.slice.call(c,a,f);b.push(d);a=f}else {d=b[e>>1]}return d},readDouble:function(){var e=c[a++],h=c[a++],i=(e>>7)?-1:1,d=(((e&127)<<4)|(h>>4)),b=(h&15),j=d?1:0,k=6;while(k--){b=(b*g)+c[a++]}if(!d){if(!b){return 0}d=1}if(d===2047){return b?NaN:(Infinity*i)}return i*Math.pow(2,d-1023)*(j+f*b)},readEcmaArray:function(){a+=4;return this.readAmf0Object()},readFalse:function(){return !1},readLongString:function(){return this.readUtf8(this.readUInt(4))},readNull:function(){return null},readReference:function(){return b[this.readUInt(2)]},readStrictArray:function(){var c=this,d=c.readUInt(4),a=[];b.push(a);while(d--){a.push(c.readValue())}return a},readTrue:Ext.returnTrue,readTypedObject:function(){var e=this,a=e.readAmf0String(),b,c,d;b=Ext.ClassManager.getByAlias('amf.'+a);c=b?new b():{$className:a};d=e.readAmf0Object(c);if((!b)&&this.converters[a]){d=this.converters[a](c)}return d},readUInt:function(e){var d=1,b;b=c[a++];for(;d127){if(b>239){d=4;b=(b&7)}else if(b>223){d=3;b=(b&15)}else {d=2;b=(b&31)}while(--d){b=((b<<6)|(c[a++]&63))}}f.push(b);if(++i===k){e.push(f=[]);i=0;h++}}for(;g"},writeNull:function(){this.write(this.encodeNull())},encodeBoolean:function(b){var a;if(b){a=""}else {a=""}return a},writeBoolean:function(a){this.write(this.encodeBoolean(a))},encodeString:function(b){var a;if(b===""){a=""}else {a=""+b+""}return a},writeString:function(a){this.write(this.encodeString(a))},encodeInt:function(a){return ""+a.toString()+""},writeInt:function(a){this.write(this.encodeInt(a))},encodeDouble:function(a){return ""+a.toString()+""},writeDouble:function(a){this.write(this.encodeDouble(a))},encodeNumber:function(a){var c=536870911,b=-268435455;if(a instanceof Number){a=a.valueOf()}if(a%1===0&&a>=b&&a<=c){return this.encodeInt(a)}else {return this.encodeDouble(a)}},writeNumber:function(a){this.write(this.encodeNumber(a))},encodeDate:function(a){return ""+(new Number(a)).toString()+""},writeDate:function(a){this.write(this.encodeDate(a))},encodeEcmaElement:function(b,a){var c=''+this.encodeObject(a)+'';return c},encodeArray:function(f){var b=[],d,e=[],a,c;for(a in f){if(Ext.isNumeric(a)&&(a%1===0)){b[a]=this.encodeObject(f[a])}else {e.push(this.encodeEcmaElement(a,f[a]))}}d=b.length;for(a=0;a0){c+=' ecma="true"'}c+='>';for(a=0;a';return c},writeArray:function(a){this.write(this.encodeArray(a))},encodeXml:function(b){var a=this.convertXmlToString(b);return ""},writeXml:function(a){this.write(this.encodeXml(a))},encodeGenericObject:function(e){var d=[],f=[],c=null,b,a;for(b in e){if(b==="$flexType"){c=e[b]}else {d.push(this.encodeString(new String(b)));f.push(this.encodeObject(e[b]))}}if(c){a=''}else {a=""}if(d.length>0){a+="";a+=d.join("");a+=""}else {a+=""}a+=f.join("");a+="";return a},writeGenericObject:function(a){this.write(this.encodeGenericObject(a))},encodeByteArray:function(c){var a,b,d;if(c.length>0){a="";for(b=0;b"}else {a=""}return a},writeByteArray:function(a){this.write(this.encodeByteArray(a))},encodeObject:function(a){var b=typeof (a);if(b==="undefined"){return this.encodeUndefined()}else if(a===null){return this.encodeNull()}else if(Ext.isBoolean(a)){return this.encodeBoolean(a)}else if(Ext.isString(a)){return this.encodeString(a)}else if(b==="number"||a instanceof Number){return this.encodeNumber(a)}else if(b==="object"){if(a instanceof Date){return this.encodeDate(a)}else if(Ext.isArray(a)){return this.encodeArray(a)}else if(this.isXmlDocument(a)){return this.encodeXml(a)}else {return this.encodeGenericObject(a)}}else {}return null},writeObject:function(a){this.write(this.encodeObject(a))},encodeAmfxRemotingPacket:function(a){var b=''+a.encodeMessage()+'';return b},writeAmfxRemotingPacket:function(a){this.write(this.encodeAmfxRemotingPacket(a))},convertXmlToString:function(b){var a;if(window.XMLSerializer){a=new window.XMLSerializer().serializeToString(b)}else {a=b.xml}return a},isXmlDocument:function(a){if(window.DOMParser){if(Ext.isDefined(a.doctype)){return !0}}if(Ext.isString(a.xml)){return !0}return !1},write:function(a){this.body+=a}});Ext.define('Ext.direct.AmfRemotingProvider',{alias:'direct.amfremotingprovider',extend:'Ext.direct.Provider',requires:['Ext.util.MixedCollection','Ext.util.DelayedTask','Ext.direct.Transaction','Ext.direct.RemotingMethod','Ext.data.amf.XmlEncoder','Ext.data.amf.XmlDecoder','Ext.data.amf.Encoder','Ext.data.amf.Packet','Ext.data.amf.RemotingMessage','Ext.direct.ExceptionEvent'],binary:!1,maxRetries:1,timeout:undefined,constructor:function(b){var a=this;a.callParent(arguments);a.namespace=(Ext.isString(a.namespace))?Ext.ns(a.namespace):a.namespace||window;a.transactions=new Ext.util.MixedCollection();a.callBuffer=[]},initAPI:function(){var d=this.actions,g=this.namespace,a,b,e,c,h,f;for(a in d){if(d.hasOwnProperty(a)){b=g[a];if(!b){b=g[a]={}}e=d[a];for(c=0,h=e.length;c0){this.sendRequest(b===1?a[0]:a);this.callBuffer=[]}},configureFormRequest:function(b,c,e,a,d){},sendFormRequest:function(a){},createEvents:function(d){var a=null,e=[],f,c=0,b;try{if(this.binary){b=new Ext.data.amf.Packet();a=b.decode(d.responseBytes)}else {b=new Ext.data.amf.XmlDecoder();a=b.readAmfxMessage(d.responseText)}}catch(g){f=new Ext.direct.ExceptionEvent({data:g,xhr:d,code:Ext.direct.Manager.exceptions.PARSE,message:'Error parsing AMF response: \n\n '+a});return [f]}if(this.binary){for(c=0;c