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