PageRenderTime 122ms CodeModel.GetById 23ms app.highlight 62ms RepoModel.GetById 1ms app.codeStats 1ms

/Frameworks/Debug/Foundation/objj.platform/Foundation.sj

http://github.com/jfahrenkrug/MapKit-HelloWorld
Unknown | 7398 lines | 7348 code | 50 blank | 0 comment | 0 complexity | 7e7ccd4c4b044b8ba53940fea92d2cb5 MD5 | raw file
   1@STATIC;1.0;p;13;CPArray+KVO.ji;9;CPArray.jc;15620;
   2{
   3var the_class = objj_getClass("CPObject")
   4if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPObject\""));
   5var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("mutableArrayValueForKey:"), function $CPObject__mutableArrayValueForKey_(self, _cmd, aKey)
   6{ with(self)
   7{
   8 return objj_msgSend(objj_msgSend(_CPKVCArray, "alloc"), "initWithKey:forProxyObject:", aKey, self);
   9}
  10}), new objj_method(sel_getUid("mutableArrayValueForKeyPath:"), function $CPObject__mutableArrayValueForKeyPath_(self, _cmd, aKeyPath)
  11{ with(self)
  12{
  13    var dotIndex = aKeyPath.indexOf(".");
  14    if (dotIndex < 0)
  15        return objj_msgSend(self, "mutableArrayValueForKey:", aKeyPath);
  16    var firstPart = aKeyPath.substring(0, dotIndex),
  17        lastPart = aKeyPath.substring(dotIndex+1);
  18    return objj_msgSend(objj_msgSend(self, "valueForKeyPath:", firstPart), "valueForKeyPath:", lastPart);
  19}
  20})]);
  21}
  22{var the_class = objj_allocateClassPair(CPArray, "_CPKVCArray"),
  23meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_proxyObject"), new objj_ivar("_key"), new objj_ivar("_insertSEL"), new objj_ivar("_insert"), new objj_ivar("_removeSEL"), new objj_ivar("_remove"), new objj_ivar("_replaceSEL"), new objj_ivar("_replace"), new objj_ivar("_insertManySEL"), new objj_ivar("_insertMany"), new objj_ivar("_removeManySEL"), new objj_ivar("_removeMany"), new objj_ivar("_replaceManySEL"), new objj_ivar("_replaceMany"), new objj_ivar("_objectAtIndexSEL"), new objj_ivar("_objectAtIndex"), new objj_ivar("_countSEL"), new objj_ivar("_count"), new objj_ivar("_accessSEL"), new objj_ivar("_access"), new objj_ivar("_setSEL"), new objj_ivar("_set")]);
  24objj_registerClassPair(the_class);
  25objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  26class_addMethods(the_class, [new objj_method(sel_getUid("initWithKey:forProxyObject:"), function $_CPKVCArray__initWithKey_forProxyObject_(self, _cmd, aKey, anObject)
  27{ with(self)
  28{
  29    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPArray") }, "init");
  30    _key = aKey;
  31    _proxyObject = anObject;
  32    var capitalizedKey = _key.charAt(0).toUpperCase() + _key.substring(1);
  33    _insertSEL = sel_getName("insertObject:in"+capitalizedKey+"AtIndex:");
  34    if (objj_msgSend(_proxyObject, "respondsToSelector:", _insertSEL))
  35        _insert = objj_msgSend(_proxyObject, "methodForSelector:", _insertSEL);
  36    _removeSEL = sel_getName("removeObjectFrom"+capitalizedKey+"AtIndex:");
  37    if (objj_msgSend(_proxyObject, "respondsToSelector:", _removeSEL))
  38        _remove = objj_msgSend(_proxyObject, "methodForSelector:", _removeSEL);
  39    _replaceSEL = sel_getName("replaceObjectFrom"+capitalizedKey+"AtIndex:withObject:");
  40    if (objj_msgSend(_proxyObject, "respondsToSelector:", _replaceSEL))
  41        _replace = objj_msgSend(_proxyObject, "methodForSelector:", _replaceSEL);
  42    _insertManySEL = sel_getName("insertObjects:in"+capitalizedKey+"AtIndexes:");
  43    if (objj_msgSend(_proxyObject, "respondsToSelector:", _insertManySEL))
  44        _insert = objj_msgSend(_proxyObject, "methodForSelector:", _insertManySEL);
  45    _removeManySEL = sel_getName("removeObjectsFrom"+capitalizedKey+"AtIndexes:");
  46    if (objj_msgSend(_proxyObject, "respondsToSelector:", _removeManySEL))
  47        _remove = objj_msgSend(_proxyObject, "methodForSelector:", _removeManySEL);
  48    _replaceManySEL = sel_getName("replaceObjectsFrom"+capitalizedKey+"AtIndexes:withObjects:");
  49    if (objj_msgSend(_proxyObject, "respondsToSelector:", _replaceManySEL))
  50        _replace = objj_msgSend(_proxyObject, "methodForSelector:", _replaceManySEL);
  51    _objectAtIndexSEL = sel_getName("objectIn"+capitalizedKey+"AtIndex:");
  52    if (objj_msgSend(_proxyObject, "respondsToSelector:", _objectAtIndexSEL))
  53        _objectAtIndex = objj_msgSend(_proxyObject, "methodForSelector:", _objectAtIndexSEL);
  54    _countSEL = sel_getName("countOf"+capitalizedKey);
  55    if (objj_msgSend(_proxyObject, "respondsToSelector:", _countSEL))
  56        _count = objj_msgSend(_proxyObject, "methodForSelector:", _countSEL);
  57    _accessSEL = sel_getName(_key);
  58    if (objj_msgSend(_proxyObject, "respondsToSelector:", _accessSEL))
  59        _access = objj_msgSend(_proxyObject, "methodForSelector:", _accessSEL);
  60    _setSEL = sel_getName("set"+capitalizedKey+":");
  61    if (objj_msgSend(_proxyObject, "respondsToSelector:", _setSEL))
  62        _set = objj_msgSend(_proxyObject, "methodForSelector:", _setSEL);
  63    return self;
  64}
  65}), new objj_method(sel_getUid("copy"), function $_CPKVCArray__copy(self, _cmd)
  66{ with(self)
  67{
  68    var theCopy = [],
  69        count = objj_msgSend(self, "count");
  70    for (var i=0; i<count; i++)
  71        objj_msgSend(theCopy, "addObject:", objj_msgSend(self, "objectAtIndex:", i));
  72    return theCopy;
  73}
  74}), new objj_method(sel_getUid("_representedObject"), function $_CPKVCArray___representedObject(self, _cmd)
  75{ with(self)
  76{
  77    if (_access)
  78        return _access(_proxyObject, _accessSEL);
  79    return objj_msgSend(_proxyObject, "valueForKey:", _key);
  80}
  81}), new objj_method(sel_getUid("_setRepresentedObject:"), function $_CPKVCArray___setRepresentedObject_(self, _cmd, anObject)
  82{ with(self)
  83{
  84    if (_set)
  85        return _set(_proxyObject, _setSEL, anObject);
  86    objj_msgSend(_proxyObject, "setValue:forKey:", anObject, _key);
  87}
  88}), new objj_method(sel_getUid("count"), function $_CPKVCArray__count(self, _cmd)
  89{ with(self)
  90{
  91    if (_count)
  92        return _count(_proxyObject, _countSEL);
  93    return objj_msgSend(objj_msgSend(self, "_representedObject"), "count");
  94}
  95}), new objj_method(sel_getUid("objectAtIndex:"), function $_CPKVCArray__objectAtIndex_(self, _cmd, anIndex)
  96{ with(self)
  97{
  98    if(_objectAtIndex)
  99        return _objectAtIndex(_proxyObject, _objectAtIndexSEL, anIndex);
 100    return objj_msgSend(objj_msgSend(self, "_representedObject"), "objectAtIndex:", anIndex);
 101}
 102}), new objj_method(sel_getUid("addObject:"), function $_CPKVCArray__addObject_(self, _cmd, anObject)
 103{ with(self)
 104{
 105    if (_insert)
 106        return _insert(_proxyObject, _insertSEL, anObject, objj_msgSend(self, "count"));
 107    var target = objj_msgSend(objj_msgSend(self, "_representedObject"), "copy");
 108    objj_msgSend(target, "addObject:", anObject);
 109    objj_msgSend(self, "_setRepresentedObject:", target);
 110}
 111}), new objj_method(sel_getUid("insertObject:atIndex:"), function $_CPKVCArray__insertObject_atIndex_(self, _cmd, anObject, anIndex)
 112{ with(self)
 113{
 114    if (_insert)
 115        return _insert(_proxyObject, _insertSEL, anObject, anIndex);
 116    var target = objj_msgSend(objj_msgSend(self, "_representedObject"), "copy");
 117    objj_msgSend(target, "insertObject:atIndex:", anObject, anIndex);
 118    objj_msgSend(self, "_setRepresentedObject:", target);
 119}
 120}), new objj_method(sel_getUid("removeLastObject"), function $_CPKVCArray__removeLastObject(self, _cmd)
 121{ with(self)
 122{
 123    if(_remove)
 124        return _remove(_proxyObject, _removeSEL, objj_msgSend(self, "count")-1);
 125    var target = objj_msgSend(objj_msgSend(self, "_representedObject"), "copy");
 126    objj_msgSend(target, "removeLastObject");
 127    objj_msgSend(self, "_setRepresentedObject:", target);
 128}
 129}), new objj_method(sel_getUid("removeObjectAtIndex:"), function $_CPKVCArray__removeObjectAtIndex_(self, _cmd, anIndex)
 130{ with(self)
 131{
 132    if(_remove)
 133        return _remove(_proxyObject, _removeSEL, anIndex);
 134    var target = objj_msgSend(objj_msgSend(self, "_representedObject"), "copy");
 135    objj_msgSend(target, "removeObjectAtIndex:", anIndex);
 136    objj_msgSend(self, "_setRepresentedObject:", target);
 137}
 138}), new objj_method(sel_getUid("replaceObjectAtIndex:withObject:"), function $_CPKVCArray__replaceObjectAtIndex_withObject_(self, _cmd, anIndex, anObject)
 139{ with(self)
 140{
 141    if(_replace)
 142        return _replace(_proxyObject, _replaceSEL, anIndex, anObject);
 143    var target = objj_msgSend(objj_msgSend(self, "_representedObject"), "copy");
 144    objj_msgSend(target, "replaceObjectAtIndex:withObject:", anIndex, anObject);
 145    objj_msgSend(self, "_setRepresentedObject:", target);
 146}
 147}), new objj_method(sel_getUid("objectsAtIndexes:"), function $_CPKVCArray__objectsAtIndexes_(self, _cmd, indexes)
 148{ with(self)
 149{
 150    var index = objj_msgSend(indexes, "firstIndex"),
 151        objects = [];
 152    while(index != CPNotFound)
 153    {
 154        objj_msgSend(objects, "addObject:", objj_msgSend(self, "objectAtIndex:", index));
 155        index = objj_msgSend(indexes, "indexGreaterThanIndex:", index);
 156    }
 157    return objects;
 158}
 159})]);
 160class_addMethods(meta_class, [new objj_method(sel_getUid("alloc"), function $_CPKVCArray__alloc(self, _cmd)
 161{ with(self)
 162{
 163    var a = [];
 164    a.isa = self;
 165    var ivars = class_copyIvarList(self),
 166        count = ivars.length;
 167    while (count--)
 168        a[ivar_getName(ivars[count])] = nil;
 169    return a;
 170}
 171})]);
 172}
 173{
 174var the_class = objj_getClass("CPArray")
 175if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPArray\""));
 176var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("valueForKey:"), function $CPArray__valueForKey_(self, _cmd, aKey)
 177{ with(self)
 178{
 179    if (aKey.indexOf("@") === 0)
 180    {
 181        if (aKey.indexOf(".") !== -1)
 182            objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "called valueForKey: on an array with a complex key ("+aKey+"). use valueForKeyPath:");
 183        if (aKey == "@count")
 184            return length;
 185        return nil;
 186    }
 187    else
 188    {
 189        var newArray = [],
 190            enumerator = objj_msgSend(self, "objectEnumerator"),
 191            object;
 192        while ((object = objj_msgSend(enumerator, "nextObject")) !== nil)
 193        {
 194            var value = objj_msgSend(object, "valueForKey:", aKey);
 195            if (value === nil || value === undefined)
 196                value = objj_msgSend(CPNull, "null");
 197            newArray.push(value);
 198        }
 199        return newArray;
 200    }
 201}
 202}), new objj_method(sel_getUid("valueForKeyPath:"), function $CPArray__valueForKeyPath_(self, _cmd, aKeyPath)
 203{ with(self)
 204{
 205    if (aKeyPath.indexOf("@") === 0)
 206    {
 207        var dotIndex = aKeyPath.indexOf("."),
 208            operator = aKeyPath.substring(1, dotIndex),
 209            parameter = aKeyPath.substring(dotIndex+1);
 210        if (kvoOperators[operator])
 211            return kvoOperators[operator](self, _cmd, parameter);
 212        return nil;
 213    }
 214    else
 215    {
 216        var newArray = [],
 217            enumerator = objj_msgSend(self, "objectEnumerator"),
 218            object;
 219        while ((object = objj_msgSend(enumerator, "nextObject")) !== nil)
 220        {
 221            var value = objj_msgSend(object, "valueForKeyPath:", aKeyPath);
 222            if (value === nil || value === undefined)
 223                value = objj_msgSend(CPNull, "null");
 224            newArray.push(value);
 225        }
 226        return newArray;
 227    }
 228}
 229}), new objj_method(sel_getUid("setValue:forKey:"), function $CPArray__setValue_forKey_(self, _cmd, aValue, aKey)
 230{ with(self)
 231{
 232    var enumerator = objj_msgSend(self, "objectEnumerator"),
 233        object;
 234    while (object = objj_msgSend(enumerator, "nextObject"))
 235        objj_msgSend(object, "setValue:forKey:", aValue, aKey);
 236}
 237}), new objj_method(sel_getUid("setValue:forKeyPath:"), function $CPArray__setValue_forKeyPath_(self, _cmd, aValue, aKeyPath)
 238{ with(self)
 239{
 240    var enumerator = objj_msgSend(self, "objectEnumerator"),
 241        object;
 242    while (object = objj_msgSend(enumerator, "nextObject"))
 243        objj_msgSend(object, "setValue:forKeyPath:", aValue, aKeyPath);
 244}
 245})]);
 246}
 247var kvoOperators = [];
 248kvoOperators["avg"] = avgOperator= function(self, _cmd, param)
 249{
 250    var objects = objj_msgSend(self, "valueForKeyPath:", param),
 251        length = objj_msgSend(objects, "count"),
 252        index = length;
 253        average = 0.0;
 254    if (!length)
 255        return 0;
 256    while(index--)
 257        average += objj_msgSend(objects[index], "doubleValue");
 258    return average / length;
 259}
 260kvoOperators["max"] = maxOperator= function(self, _cmd, param)
 261{
 262    var objects = objj_msgSend(self, "valueForKeyPath:", param),
 263        index = objj_msgSend(objects, "count") - 1,
 264        max = objj_msgSend(objects, "lastObject");
 265    while (index--)
 266    {
 267        var item = objects[index];
 268        if (objj_msgSend(max, "compare:", item) < 0)
 269            max = item;
 270    }
 271    return max;
 272}
 273kvoOperators["min"] = minOperator= function(self, _cmd, param)
 274{
 275    var objects = objj_msgSend(self, "valueForKeyPath:", param),
 276        index = objj_msgSend(objects, "count") - 1,
 277        min = objj_msgSend(objects, "lastObject");
 278    while (index--)
 279    {
 280        var item = objects[index];
 281        if (objj_msgSend(min, "compare:", item) > 0)
 282            min = item;
 283    }
 284    return min;
 285}
 286kvoOperators["count"] = countOperator= function(self, _cmd, param)
 287{
 288    return objj_msgSend(self, "count");
 289}
 290kvoOperators["sum"] = sumOperator= function(self, _cmd, param)
 291{
 292    var objects = objj_msgSend(self, "valueForKeyPath:", param),
 293        index = objj_msgSend(objects, "count"),
 294        sum = 0.0;
 295    while(index--)
 296        sum += objj_msgSend(objects[index], "doubleValue");
 297    return sum;
 298}
 299{
 300var the_class = objj_getClass("CPArray")
 301if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPArray\""));
 302var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("addObserver:toObjectsAtIndexes:forKeyPath:options:context:"), function $CPArray__addObserver_toObjectsAtIndexes_forKeyPath_options_context_(self, _cmd, anObserver, indexes, aKeyPath, options, context)
 303{ with(self)
 304{
 305    var index = objj_msgSend(indexes, "firstIndex");
 306    while (index >= 0)
 307    {
 308        objj_msgSend(self[index], "addObserver:forKeyPath:options:context:", anObserver, aKeyPath, options, context);
 309        index = objj_msgSend(indexes, "indexGreaterThanIndex:", index);
 310    }
 311}
 312}), new objj_method(sel_getUid("removeObserver:fromObjectsAtIndexes:forKeyPath:"), function $CPArray__removeObserver_fromObjectsAtIndexes_forKeyPath_(self, _cmd, anObserver, indexes, aKeyPath)
 313{ with(self)
 314{
 315    var index = objj_msgSend(indexes, "firstIndex");
 316    while (index >= 0)
 317    {
 318        objj_msgSend(self[index], "removeObserver:forKeyPath:", anObserver, aKeyPath);
 319        index = objj_msgSend(indexes, "indexGreaterThanIndex:", index);
 320    }
 321}
 322}), new objj_method(sel_getUid("addObserver:forKeyPath:options:context:"), function $CPArray__addObserver_forKeyPath_options_context_(self, _cmd, observer, aKeyPath, options, context)
 323{ with(self)
 324{
 325    if (objj_msgSend(isa, "instanceMethodForSelector:", _cmd) === objj_msgSend(CPArray, "instanceMethodForSelector:", _cmd))
 326        objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "Unsupported method on CPArray");
 327    else
 328        objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPArray").super_class }, "addObserver:forKeyPath:options:context:", observer, aKeyPath, options, context);
 329}
 330}), new objj_method(sel_getUid("removeObserver:forKeyPath:"), function $CPArray__removeObserver_forKeyPath_(self, _cmd, observer, aKeyPath)
 331{ with(self)
 332{
 333    if (objj_msgSend(isa, "instanceMethodForSelector:", _cmd) === objj_msgSend(CPArray, "instanceMethodForSelector:", _cmd))
 334        objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "Unsupported method on CPArray");
 335    else
 336        objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPArray").super_class }, "removeObserver:forKeyPath:", observer, aKeyPath);
 337}
 338})]);
 339}
 340
 341p;9;CPArray.ji;10;CPObject.ji;9;CPRange.ji;14;CPEnumerator.ji;18;CPSortDescriptor.ji;13;CPException.jc;25556;
 342{var the_class = objj_allocateClassPair(CPEnumerator, "_CPArrayEnumerator"),
 343meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_array"), new objj_ivar("_index")]);
 344objj_registerClassPair(the_class);
 345objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
 346class_addMethods(the_class, [new objj_method(sel_getUid("initWithArray:"), function $_CPArrayEnumerator__initWithArray_(self, _cmd, anArray)
 347{ with(self)
 348{
 349    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPEnumerator") }, "init");
 350    if (self)
 351    {
 352        _array = anArray;
 353        _index = -1;
 354    }
 355    return self;
 356}
 357}), new objj_method(sel_getUid("nextObject"), function $_CPArrayEnumerator__nextObject(self, _cmd)
 358{ with(self)
 359{
 360    if (++_index >= objj_msgSend(_array, "count"))
 361        return nil;
 362    return objj_msgSend(_array, "objectAtIndex:", _index);
 363}
 364})]);
 365}
 366{var the_class = objj_allocateClassPair(CPEnumerator, "_CPReverseArrayEnumerator"),
 367meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_array"), new objj_ivar("_index")]);
 368objj_registerClassPair(the_class);
 369objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
 370class_addMethods(the_class, [new objj_method(sel_getUid("initWithArray:"), function $_CPReverseArrayEnumerator__initWithArray_(self, _cmd, anArray)
 371{ with(self)
 372{
 373    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPEnumerator") }, "init");
 374    if (self)
 375    {
 376        _array = anArray;
 377        _index = objj_msgSend(_array, "count");
 378    }
 379    return self;
 380}
 381}), new objj_method(sel_getUid("nextObject"), function $_CPReverseArrayEnumerator__nextObject(self, _cmd)
 382{ with(self)
 383{
 384    if (--_index < 0)
 385        return nil;
 386    return objj_msgSend(_array, "objectAtIndex:", _index);
 387}
 388})]);
 389}
 390{var the_class = objj_allocateClassPair(CPObject, "CPArray"),
 391meta_class = the_class.isa;objj_registerClassPair(the_class);
 392objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
 393class_addMethods(the_class, [new objj_method(sel_getUid("init"), function $CPArray__init(self, _cmd)
 394{ with(self)
 395{
 396    return self;
 397}
 398}), new objj_method(sel_getUid("initWithArray:"), function $CPArray__initWithArray_(self, _cmd, anArray)
 399{ with(self)
 400{
 401    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
 402    if (self)
 403        objj_msgSend(self, "setArray:", anArray);
 404    return self;
 405}
 406}), new objj_method(sel_getUid("initWithArray:copyItems:"), function $CPArray__initWithArray_copyItems_(self, _cmd, anArray, copyItems)
 407{ with(self)
 408{
 409    if (!copyItems)
 410        return objj_msgSend(self, "initWithArray:", anArray);
 411    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
 412    if (self)
 413    {
 414        var index = 0,
 415            count = objj_msgSend(anArray, "count");
 416        for(; index < count; ++i)
 417        {
 418            if (anArray[i].isa)
 419                self[i] = objj_msgSend(anArray, "copy");
 420            else
 421                self[i] = anArray;
 422        }
 423    }
 424    return self;
 425}
 426}), new objj_method(sel_getUid("initWithObjects:"), function $CPArray__initWithObjects_(self, _cmd, anArray)
 427{ with(self)
 428{
 429    var i = 2,
 430        argument;
 431    for(; i < arguments.length && (argument = arguments[i]) != nil; ++i)
 432        push(argument);
 433    return self;
 434}
 435}), new objj_method(sel_getUid("initWithObjects:count:"), function $CPArray__initWithObjects_count_(self, _cmd, objects, aCount)
 436{ with(self)
 437{
 438    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
 439    if (self)
 440    {
 441        var index = 0;
 442        for(; index < aCount; ++index)
 443            push(objects[index]);
 444    }
 445    return self;
 446}
 447}), new objj_method(sel_getUid("hash"), function $CPArray__hash(self, _cmd)
 448{ with(self)
 449{
 450    if (self.__address == nil)
 451        self.__address = _objj_generateObjectHash();
 452    return self.__address;
 453}
 454}), new objj_method(sel_getUid("containsObject:"), function $CPArray__containsObject_(self, _cmd, anObject)
 455{ with(self)
 456{
 457    return objj_msgSend(self, "indexOfObject:", anObject) != CPNotFound;
 458}
 459}), new objj_method(sel_getUid("count"), function $CPArray__count(self, _cmd)
 460{ with(self)
 461{
 462    return length;
 463}
 464}), new objj_method(sel_getUid("indexOfObject:"), function $CPArray__indexOfObject_(self, _cmd, anObject)
 465{ with(self)
 466{
 467    if (anObject === nil)
 468        return CPNotFound;
 469    var i = 0,
 470        count = length;
 471    if (anObject.isa)
 472    {
 473        for(; i < count; ++i)
 474            if(objj_msgSend(self[i], "isEqual:", anObject))
 475                return i;
 476    }
 477    else if (self.indexOf)
 478        return indexOf(anObject);
 479    else
 480        for(; i < count; ++i)
 481            if(self[i] == anObject)
 482                return i;
 483    return CPNotFound;
 484}
 485}), new objj_method(sel_getUid("indexOfObject:inRange:"), function $CPArray__indexOfObject_inRange_(self, _cmd, anObject, aRange)
 486{ with(self)
 487{
 488    if (anObject === nil)
 489        return CPNotFound;
 490    var i = aRange.location,
 491        count = MIN(CPMaxRange(aRange), length);
 492    if (anObject.isa)
 493    {
 494        for(; i < count; ++i)
 495            if(objj_msgSend(self[i], "isEqual:", anObject))
 496                return i;
 497    }
 498    else
 499        for(; i < count; ++i)
 500            if(self[i] == anObject)
 501                return i;
 502    return CPNotFound;
 503}
 504}), new objj_method(sel_getUid("indexOfObjectIdenticalTo:"), function $CPArray__indexOfObjectIdenticalTo_(self, _cmd, anObject)
 505{ with(self)
 506{
 507    if (anObject === nil)
 508        return CPNotFound;
 509    if (self.indexOf)
 510        return indexOf(anObject);
 511    else
 512    {
 513        var index = 0,
 514            count = length;
 515        for(; index < count; ++index)
 516            if(self[index] == anObject)
 517                return index;
 518    }
 519    return CPNotFound;
 520}
 521}), new objj_method(sel_getUid("indexOfObjectIdenticalTo:inRange:"), function $CPArray__indexOfObjectIdenticalTo_inRange_(self, _cmd, anObject, aRange)
 522{ with(self)
 523{
 524    if (anObject === nil)
 525        return CPNotFound;
 526    if (self.indexOf)
 527    {
 528        var index = indexOf(anObject, aRange.location);
 529        if (CPLocationInRange(index, aRange))
 530            return index;
 531    }
 532    else
 533    {
 534        var index = aRange.location,
 535            count = MIN(CPMaxRange(aRange), length);
 536        for(; index < count; ++index)
 537            if(self[index] == anObject)
 538                return index;
 539    }
 540    return CPNotFound;
 541}
 542}), new objj_method(sel_getUid("indexOfObject:sortedBySelector:"), function $CPArray__indexOfObject_sortedBySelector_(self, _cmd, anObject, aSelector)
 543{ with(self)
 544{
 545    return objj_msgSend(self, "indexOfObject:sortedByFunction:", anObject,  function(lhs, rhs) { objj_msgSend(lhs, aSelector, rhs); });
 546}
 547}), new objj_method(sel_getUid("indexOfObject:sortedByFunction:"), function $CPArray__indexOfObject_sortedByFunction_(self, _cmd, anObject, aFunction)
 548{ with(self)
 549{
 550    return objj_msgSend(self, "indexOfObject:sortedByFunction:context:", anObject, aFunction, nil);
 551}
 552}), new objj_method(sel_getUid("indexOfObject:sortedByFunction:context:"), function $CPArray__indexOfObject_sortedByFunction_context_(self, _cmd, anObject, aFunction, aContext)
 553{ with(self)
 554{
 555    if (!aFunction || anObject === undefined)
 556        return CPNotFound;
 557    var mid, c, first = 0, last = length - 1;
 558    while (first <= last)
 559    {
 560        mid = FLOOR((first + last) / 2);
 561          c = aFunction(anObject, self[mid], aContext);
 562        if (c > 0)
 563            first = mid + 1;
 564        else if (c < 0)
 565            last = mid - 1;
 566        else
 567        {
 568            while (mid < length - 1 && aFunction(anObject, self[mid+1], aContext) == CPOrderedSame)
 569                mid++;
 570            return mid;
 571        }
 572    }
 573    return CPNotFound;
 574}
 575}), new objj_method(sel_getUid("indexOfObject:sortedByDescriptors:"), function $CPArray__indexOfObject_sortedByDescriptors_(self, _cmd, anObject, descriptors)
 576{ with(self)
 577{
 578    objj_msgSend(self, "indexOfObject:sortedByFunction:", anObject, function(lhs, rhs)
 579    {
 580        var i = 0,
 581            count = objj_msgSend(descriptors, "count"),
 582            result = CPOrderedSame;
 583        while (i < count)
 584            if((result = objj_msgSend(descriptors[i++], "compareObject:withObject:", lhs, rhs)) != CPOrderedSame)
 585                return result;
 586        return result;
 587    });
 588}
 589}), new objj_method(sel_getUid("lastObject"), function $CPArray__lastObject(self, _cmd)
 590{ with(self)
 591{
 592    var count = objj_msgSend(self, "count");
 593    if (!count) return nil;
 594    return self[count - 1];
 595}
 596}), new objj_method(sel_getUid("objectAtIndex:"), function $CPArray__objectAtIndex_(self, _cmd, anIndex)
 597{ with(self)
 598{
 599    return self[anIndex];
 600}
 601}), new objj_method(sel_getUid("objectsAtIndexes:"), function $CPArray__objectsAtIndexes_(self, _cmd, indexes)
 602{ with(self)
 603{
 604    var index = objj_msgSend(indexes, "firstIndex"),
 605        objects = [];
 606    while(index != CPNotFound)
 607    {
 608        objj_msgSend(objects, "addObject:", self[index]);
 609        index = objj_msgSend(indexes, "indexGreaterThanIndex:", index);
 610    }
 611    return objects;
 612}
 613}), new objj_method(sel_getUid("objectEnumerator"), function $CPArray__objectEnumerator(self, _cmd)
 614{ with(self)
 615{
 616    return objj_msgSend(objj_msgSend(_CPArrayEnumerator, "alloc"), "initWithArray:", self);
 617}
 618}), new objj_method(sel_getUid("reverseObjectEnumerator"), function $CPArray__reverseObjectEnumerator(self, _cmd)
 619{ with(self)
 620{
 621    return objj_msgSend(objj_msgSend(_CPReverseArrayEnumerator, "alloc"), "initWithArray:", self);
 622}
 623}), new objj_method(sel_getUid("makeObjectsPerformSelector:"), function $CPArray__makeObjectsPerformSelector_(self, _cmd, aSelector)
 624{ with(self)
 625{
 626    if (!aSelector)
 627        objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "makeObjectsPerformSelector: 'aSelector' can't be nil");
 628    var index = 0,
 629        count = length;
 630    for(; index < count; ++index)
 631        objj_msgSend(self[index], aSelector);
 632}
 633}), new objj_method(sel_getUid("makeObjectsPerformSelector:withObject:"), function $CPArray__makeObjectsPerformSelector_withObject_(self, _cmd, aSelector, anObject)
 634{ with(self)
 635{
 636    if (!aSelector)
 637        objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "makeObjectsPerformSelector:withObject 'aSelector' can't be nil");
 638    var index = 0,
 639        count = length;
 640    for(; index < count; ++index)
 641        objj_msgSend(self[index], aSelector, anObject);
 642}
 643}), new objj_method(sel_getUid("firstObjectCommonWithArray:"), function $CPArray__firstObjectCommonWithArray_(self, _cmd, anArray)
 644{ with(self)
 645{
 646    if (!objj_msgSend(anArray, "count") || !objj_msgSend(self, "count"))
 647        return nil;
 648    var i = 0,
 649        count = objj_msgSend(self, "count");
 650    for(; i < count; ++i)
 651        if(objj_msgSend(anArray, "containsObject:", self[i]))
 652            return self[i];
 653    return nil;
 654}
 655}), new objj_method(sel_getUid("isEqualToArray:"), function $CPArray__isEqualToArray_(self, _cmd, anArray)
 656{ with(self)
 657{
 658    if (self === anArray)
 659        return YES;
 660    if(length != anArray.length)
 661        return NO;
 662    var index = 0,
 663        count = objj_msgSend(self, "count");
 664    for(; index < count; ++index)
 665    {
 666        var lhs = self[index],
 667            rhs = anArray[index];
 668        if (lhs !== rhs && (!lhs.isa || !rhs.isa || !objj_msgSend(lhs, "isEqual:", rhs)))
 669            return NO;
 670    }
 671    return YES;
 672}
 673}), new objj_method(sel_getUid("isEqual:"), function $CPArray__isEqual_(self, _cmd, anObject)
 674{ with(self)
 675{
 676    if (self === anObject)
 677        return YES;
 678    if(!objj_msgSend(anObject, "isKindOfClass:", objj_msgSend(CPArray, "class")))
 679        return NO;
 680    return objj_msgSend(self, "isEqualToArray:", anObject);
 681}
 682}), new objj_method(sel_getUid("arrayByAddingObject:"), function $CPArray__arrayByAddingObject_(self, _cmd, anObject)
 683{ with(self)
 684{
 685    if (anObject === nil || anObject === undefined)
 686        objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "arrayByAddingObject: object can't be nil");
 687    var array = objj_msgSend(self, "copy");
 688    array.push(anObject);
 689    return array;
 690}
 691}), new objj_method(sel_getUid("arrayByAddingObjectsFromArray:"), function $CPArray__arrayByAddingObjectsFromArray_(self, _cmd, anArray)
 692{ with(self)
 693{
 694    return slice(0).concat(anArray);
 695}
 696}), new objj_method(sel_getUid("subarrayWithRange:"), function $CPArray__subarrayWithRange_(self, _cmd, aRange)
 697{ with(self)
 698{
 699    if (aRange.location < 0 || CPMaxRange(aRange) > length)
 700        objj_msgSend(CPException, "raise:reason:", CPRangeException, "subarrayWithRange: aRange out of bounds");
 701    return slice(aRange.location, CPMaxRange(aRange));
 702}
 703}), new objj_method(sel_getUid("sortedArrayUsingDescriptors:"), function $CPArray__sortedArrayUsingDescriptors_(self, _cmd, descriptors)
 704{ with(self)
 705{
 706    var sorted = objj_msgSend(self, "copy");
 707    objj_msgSend(sorted, "sortUsingDescriptors:", descriptors);
 708    return sorted;
 709}
 710}), new objj_method(sel_getUid("sortedArrayUsingFunction:"), function $CPArray__sortedArrayUsingFunction_(self, _cmd, aFunction)
 711{ with(self)
 712{
 713    return objj_msgSend(self, "sortedArrayUsingFunction:context:", aFunction, nil);
 714}
 715}), new objj_method(sel_getUid("sortedArrayUsingFunction:context:"), function $CPArray__sortedArrayUsingFunction_context_(self, _cmd, aFunction, aContext)
 716{ with(self)
 717{
 718    var sorted = objj_msgSend(self, "copy");
 719    objj_msgSend(sorted, "sortUsingFunction:context:", aFunction, aContext);
 720    return sorted;
 721}
 722}), new objj_method(sel_getUid("sortedArrayUsingSelector:"), function $CPArray__sortedArrayUsingSelector_(self, _cmd, aSelector)
 723{ with(self)
 724{
 725    var sorted = objj_msgSend(self, "copy")
 726    objj_msgSend(sorted, "sortUsingSelector:", aSelector);
 727    return sorted;
 728}
 729}), new objj_method(sel_getUid("componentsJoinedByString:"), function $CPArray__componentsJoinedByString_(self, _cmd, aString)
 730{ with(self)
 731{
 732    return join(aString);
 733}
 734}), new objj_method(sel_getUid("description"), function $CPArray__description(self, _cmd)
 735{ with(self)
 736{
 737    var i = 0,
 738        count = objj_msgSend(self, "count"),
 739        description = '(';
 740    for(; i < count; ++i)
 741    {
 742        if (self[i].isa) description += objj_msgSend(self[i], "description");
 743        else description += self[i];
 744        if (i != count - 1) description += ", ";
 745    }
 746    return description + ')';
 747}
 748}), new objj_method(sel_getUid("pathsMatchingExtensions:"), function $CPArray__pathsMatchingExtensions_(self, _cmd, filterTypes)
 749{ with(self)
 750{
 751    var index = 0,
 752        count = objj_msgSend(self, "count"),
 753        array = [];
 754    for(; index < count; ++index)
 755        if (self[index].isa && objj_msgSend(self[index], "isKindOfClass:", objj_msgSend(CPString, "class")) && objj_msgSend(filterTypes, "containsObject:", objj_msgSend(self[index], "pathExtension")))
 756            array.push(self[index]);
 757    return array;
 758}
 759}), new objj_method(sel_getUid("setValue:forKey:"), function $CPArray__setValue_forKey_(self, _cmd, aValue, aKey)
 760{ with(self)
 761{
 762    var i = 0,
 763        count = objj_msgSend(self, "count");
 764    for(; i < count; ++i)
 765        objj_msgSend(self[i], "setValue:forKey:", aValue, aKey);
 766}
 767}), new objj_method(sel_getUid("valueForKey:"), function $CPArray__valueForKey_(self, _cmd, aKey)
 768{ with(self)
 769{
 770    var i = 0,
 771        count = objj_msgSend(self, "count"),
 772        array = [];
 773    for(; i < count; ++i)
 774        array.push(objj_msgSend(self[i], "valueForKey:", aKey));
 775    return array;
 776}
 777}), new objj_method(sel_getUid("copy"), function $CPArray__copy(self, _cmd)
 778{ with(self)
 779{
 780    return slice(0);
 781}
 782})]);
 783class_addMethods(meta_class, [new objj_method(sel_getUid("alloc"), function $CPArray__alloc(self, _cmd)
 784{ with(self)
 785{
 786    return [];
 787}
 788}), new objj_method(sel_getUid("array"), function $CPArray__array(self, _cmd)
 789{ with(self)
 790{
 791    return objj_msgSend(objj_msgSend(self, "alloc"), "init");
 792}
 793}), new objj_method(sel_getUid("arrayWithArray:"), function $CPArray__arrayWithArray_(self, _cmd, anArray)
 794{ with(self)
 795{
 796    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithArray:", anArray);
 797}
 798}), new objj_method(sel_getUid("arrayWithObject:"), function $CPArray__arrayWithObject_(self, _cmd, anObject)
 799{ with(self)
 800{
 801    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithObjects:", anObject);
 802}
 803}), new objj_method(sel_getUid("arrayWithObjects:"), function $CPArray__arrayWithObjects_(self, _cmd, anObject)
 804{ with(self)
 805{
 806    var i = 2,
 807        array = objj_msgSend(objj_msgSend(self, "alloc"), "init"),
 808        argument;
 809    for(; i < arguments.length && (argument = arguments[i]) != nil; ++i)
 810        array.push(argument);
 811    return array;
 812}
 813}), new objj_method(sel_getUid("arrayWithObjects:count:"), function $CPArray__arrayWithObjects_count_(self, _cmd, objects, aCount)
 814{ with(self)
 815{
 816    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithObjects:count:", objects, aCount);
 817}
 818})]);
 819}
 820{
 821var the_class = objj_getClass("CPArray")
 822if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPArray\""));
 823var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("initWithCapacity:"), function $CPArray__initWithCapacity_(self, _cmd, aCapacity)
 824{ with(self)
 825{
 826    return self;
 827}
 828}), new objj_method(sel_getUid("addObject:"), function $CPArray__addObject_(self, _cmd, anObject)
 829{ with(self)
 830{
 831    push(anObject);
 832}
 833}), new objj_method(sel_getUid("addObjectsFromArray:"), function $CPArray__addObjectsFromArray_(self, _cmd, anArray)
 834{ with(self)
 835{
 836    splice.apply(self, [length, 0].concat(anArray));
 837}
 838}), new objj_method(sel_getUid("insertObject:atIndex:"), function $CPArray__insertObject_atIndex_(self, _cmd, anObject, anIndex)
 839{ with(self)
 840{
 841    splice(anIndex, 0, anObject);
 842}
 843}), new objj_method(sel_getUid("insertObjects:atIndexes:"), function $CPArray__insertObjects_atIndexes_(self, _cmd, objects, indexes)
 844{ with(self)
 845{
 846    var indexesCount = objj_msgSend(indexes, "count"),
 847        objectsCount = objj_msgSend(objects, "count");
 848    if(indexesCount !== objectsCount)
 849        objj_msgSend(CPException, "raise:reason:", CPRangeException, "the counts of the passed-in array (" + objectsCount + ") and index set (" + indexesCount + ") must be identical.");
 850    var lastIndex = objj_msgSend(indexes, "lastIndex");
 851    if(lastIndex >= objj_msgSend(self, "count") + indexesCount)
 852        objj_msgSend(CPException, "raise:reason:", CPRangeException, "the last index (" + lastIndex + ") must be less than the sum of the original count (" + objj_msgSend(self, "count") + ") and the insertion count (" + indexesCount + ").");
 853    var index = 0,
 854        currentIndex = objj_msgSend(indexes, "firstIndex");
 855    for (; index < objectsCount; ++index, currentIndex = objj_msgSend(indexes, "indexGreaterThanIndex:", currentIndex))
 856        objj_msgSend(self, "insertObject:atIndex:", objects[index], currentIndex);
 857}
 858}), new objj_method(sel_getUid("replaceObjectAtIndex:withObject:"), function $CPArray__replaceObjectAtIndex_withObject_(self, _cmd, anIndex, anObject)
 859{ with(self)
 860{
 861    self[anIndex] = anObject;
 862}
 863}), new objj_method(sel_getUid("replaceObjectsAtIndexes:withObjects:"), function $CPArray__replaceObjectsAtIndexes_withObjects_(self, _cmd, anIndexSet, objects)
 864{ with(self)
 865{
 866    var i = 0,
 867        index = objj_msgSend(anIndexSet, "firstIndex");
 868    while(index != CPNotFound)
 869    {
 870        objj_msgSend(self, "replaceObjectAtIndex:withObject:", index, objects[i++]);
 871        index = objj_msgSend(anIndexSet, "indexGreaterThanIndex:", index);
 872    }
 873}
 874}), new objj_method(sel_getUid("replaceObjectsInRange:withObjectsFromArray:range:"), function $CPArray__replaceObjectsInRange_withObjectsFromArray_range_(self, _cmd, aRange, anArray, otherRange)
 875{ with(self)
 876{
 877    if (!otherRange.location && otherRange.length == objj_msgSend(anArray, "count"))
 878        objj_msgSend(self, "replaceObjectsInRange:withObjectsFromArray:", aRange, anArray);
 879    else
 880        splice.apply(self, [aRange.location, aRange.length].concat(objj_msgSend(anArray, "subarrayWithRange:", otherRange)));
 881}
 882}), new objj_method(sel_getUid("replaceObjectsInRange:withObjectsFromArray:"), function $CPArray__replaceObjectsInRange_withObjectsFromArray_(self, _cmd, aRange, anArray)
 883{ with(self)
 884{
 885    splice.apply(self, [aRange.location, aRange.length].concat(anArray));
 886}
 887}), new objj_method(sel_getUid("setArray:"), function $CPArray__setArray_(self, _cmd, anArray)
 888{ with(self)
 889{
 890    if(self == anArray) return;
 891    splice.apply(self, [0, length].concat(anArray));
 892}
 893}), new objj_method(sel_getUid("removeAllObjects"), function $CPArray__removeAllObjects(self, _cmd)
 894{ with(self)
 895{
 896    splice(0, length);
 897}
 898}), new objj_method(sel_getUid("removeLastObject"), function $CPArray__removeLastObject(self, _cmd)
 899{ with(self)
 900{
 901    pop();
 902}
 903}), new objj_method(sel_getUid("removeObject:"), function $CPArray__removeObject_(self, _cmd, anObject)
 904{ with(self)
 905{
 906    objj_msgSend(self, "removeObject:inRange:", anObject, CPMakeRange(0, length));
 907}
 908}), new objj_method(sel_getUid("removeObject:inRange:"), function $CPArray__removeObject_inRange_(self, _cmd, anObject, aRange)
 909{ with(self)
 910{
 911    var index;
 912    while ((index = objj_msgSend(self, "indexOfObject:inRange:", anObject, aRange)) != CPNotFound)
 913    {
 914        objj_msgSend(self, "removeObjectAtIndex:", index);
 915        aRange = CPIntersectionRange(CPMakeRange(index, length - index), aRange);
 916    }
 917}
 918}), new objj_method(sel_getUid("removeObjectAtIndex:"), function $CPArray__removeObjectAtIndex_(self, _cmd, anIndex)
 919{ with(self)
 920{
 921    splice(anIndex, 1);
 922}
 923}), new objj_method(sel_getUid("removeObjectsAtIndexes:"), function $CPArray__removeObjectsAtIndexes_(self, _cmd, anIndexSet)
 924{ with(self)
 925{
 926    var index = objj_msgSend(anIndexSet, "lastIndex");
 927    while (index != CPNotFound)
 928    {
 929        objj_msgSend(self, "removeObjectAtIndex:", index);
 930        index = objj_msgSend(anIndexSet, "indexLessThanIndex:", index);
 931    }
 932}
 933}), new objj_method(sel_getUid("removeObjectIdenticalTo:"), function $CPArray__removeObjectIdenticalTo_(self, _cmd, anObject)
 934{ with(self)
 935{
 936    objj_msgSend(self, "removeObjectIdenticalTo:inRange:", anObject, CPMakeRange(0, length));
 937}
 938}), new objj_method(sel_getUid("removeObjectIdenticalTo:inRange:"), function $CPArray__removeObjectIdenticalTo_inRange_(self, _cmd, anObject, aRange)
 939{ with(self)
 940{
 941    var index;
 942    while ((index = objj_msgSend(self, "indexOfObjectIdenticalTo:inRange:", anObject, aRange)) != CPNotFound)
 943    {
 944        objj_msgSend(self, "removeObjectAtIndex:", index);
 945        aRange = CPIntersectionRange(CPMakeRange(index, length - index), aRange);
 946    }
 947}
 948}), new objj_method(sel_getUid("removeObjectsInArray:"), function $CPArray__removeObjectsInArray_(self, _cmd, anArray)
 949{ with(self)
 950{
 951    var index = 0,
 952        count = objj_msgSend(anArray, "count");
 953    for (; index < count; ++index)
 954        objj_msgSend(self, "removeObject:", anArray[index]);
 955}
 956}), new objj_method(sel_getUid("removeObjectsInRange:"), function $CPArray__removeObjectsInRange_(self, _cmd, aRange)
 957{ with(self)
 958{
 959    splice(aRange.location, aRange.length);
 960}
 961}), new objj_method(sel_getUid("exchangeObjectAtIndex:withObjectAtIndex:"), function $CPArray__exchangeObjectAtIndex_withObjectAtIndex_(self, _cmd, anIndex, otherIndex)
 962{ with(self)
 963{
 964    var temporary = self[anIndex];
 965    self[anIndex] = self[otherIndex];
 966    self[otherIndex] = temporary;
 967}
 968}), new objj_method(sel_getUid("sortUsingDescriptors:"), function $CPArray__sortUsingDescriptors_(self, _cmd, descriptors)
 969{ with(self)
 970{
 971    sort(function(lhs, rhs)
 972    {
 973        var i = 0,
 974            count = objj_msgSend(descriptors, "count"),
 975            result = CPOrderedSame;
 976        while(i < count)
 977            if((result = objj_msgSend(descriptors[i++], "compareObject:withObject:", lhs, rhs)) != CPOrderedSame)
 978                return result;
 979        return result;
 980    });
 981}
 982}), new objj_method(sel_getUid("sortUsingFunction:context:"), function $CPArray__sortUsingFunction_context_(self, _cmd, aFunction, aContext)
 983{ with(self)
 984{
 985    sort(function(lhs, rhs) { return aFunction(lhs, rhs, aContext); });
 986}
 987}), new objj_method(sel_getUid("sortUsingSelector:"), function $CPArray__sortUsingSelector_(self, _cmd, aSelector)
 988{ with(self)
 989{
 990    sort(function(lhs, rhs) { return objj_msgSend(lhs, aSelector, rhs); });
 991}
 992})]);
 993class_addMethods(meta_class, [new objj_method(sel_getUid("arrayWithCapacity:"), function $CPArray__arrayWithCapacity_(self, _cmd, aCapacity)
 994{ with(self)
 995{
 996    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithCapacity:", aCapacity);
 997}
 998})]);
 999}
1000{
1001var the_class = objj_getClass("CPArray")
1002if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPArray\""));
1003var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $CPArray__initWithCoder_(self, _cmd, aCoder)
1004{ with(self)
1005{
1006    return objj_msgSend(aCoder, "decodeObjectForKey:", "CP.objects");
1007}
1008}), new objj_method(sel_getUid("encodeWithCoder:"), function $CPArray__encodeWithCoder_(self, _cmd, aCoder)
1009{ with(self)
1010{
1011    objj_msgSend(aCoder, "_encodeArrayOfObjects:forKey:", self, "CP.objects");
1012}
1013})]);
1014}
1015{var the_class = objj_allocateClassPair(CPArray, "CPMutableArray"),
1016meta_class = the_class.isa;objj_registerClassPair(the_class);
1017objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
1018}
1019Array.prototype.isa = CPArray;
1020objj_msgSend(CPArray, "initialize");
1021
1022p;20;CPAttributedString.ji;10;CPObject.ji;10;CPString.ji;14;CPDictionary.ji;9;CPRange.jc;19869;
1023{var the_class = objj_allocateClassPair(CPObject, "CPAttributedString"),
1024meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_string"), new objj_ivar("_rangeEntries")]);
1025objj_registerClassPair(the_class);
1026objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
1027class_addMethods(the_class, [new objj_method(sel_getUid("initWithString:"), function $CPAttributedString__initWithString_(self, _cmd, aString)
1028{ with(self)
1029{
1030    return objj_msgSend(self, "initWithString:attributes:", aString, nil);
1031}
1032}), new objj_method(sel_getUid("initWithAttributedString:"), function $CPAttributedString__initWithAttributedString_(self, _cmd, aString)
1033{ with(self)
1034{
1035    var string = objj_msgSend(self, "initWithString:attributes:", "", nil);
1036    objj_msgSend(string, "setAttributedString:", aString);
1037    return string;
1038}
1039}), new objj_method(sel_getUid("initWithString:attributes:"), function $CPAttributedString__initWithString_attributes_(self, _cmd, aString, attributes)
1040{ with(self)
1041{
1042    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
1043    if (!attributes)
1044        attributes = objj_msgSend(CPDictionary, "dictionary");
1045    _string = ""+aString;
1046    _rangeEntries = [makeRangeEntry(CPMakeRange(0, _string.length), attributes)];
1047    return self;
1048}
1049}), new objj_method(sel_getUid("string"), function $CPAttributedString__string(self, _cmd)
1050{ with(self)
1051{
1052    return _string;
1053}
1054}), new objj_method(sel_getUid("mutableString"), function $CPAttributedString__mutableString(self, _cmd)
1055{ with(self)
1056{
1057    return objj_msgSend(self, "string");
1058}
1059}), new objj_method(sel_getUid("length"), function $CPAttributedString__length(self, _cmd)
1060{ with(self)
1061{
1062    return _string.length;
1063}
1064}), new objj_method(sel_getUid("_indexOfEntryWithIndex:"), function $CPAttributedString___indexOfEntryWithIndex_(self, _cmd, anIndex)
1065{ with(self)
1066{
1067    if (anIndex < 0 || anIndex > _string.length || anIndex === undefined)
1068        return CPNotFound;
1069    var sortFunction = function(index, entry)
1070    {
1071        if (CPLocationInRange(index, entry.range))
1072            return CPOrderedSame;
1073        else if (CPMaxRange(entry.range) <= index)
1074            return CPOrderedDescending;
1075        else
1076            return CPOrderedAscending;
1077    }
1078    return objj_msgSend(_rangeEntries, "indexOfObject:sortedByFunction:", anIndex, sortFunction);
1079}
1080}), new objj_method(sel_getUid("attributesAtIndex:effectiveRange:"), function $CPAttributedString__attributesAtIndex_effectiveRange_(self, _cmd, anIndex, aRange)
1081{ with(self)
1082{
1083    var entryIndex = objj_msgSend(self, "_indexOfEntryWithIndex:", anIndex);
1084    if (entryIndex == CPNotFound)
1085        return nil;
1086    var matchingRange = _rangeEntries[entryIndex];
1087    if (aRange)
1088    {
1089        aRange.location = matchingRange.range.location;
1090        aRange.length = matchingRange.range.length;
1091    }
1092    return matchingRange.attributes;
1093}
1094}), new objj_method(sel_getUid("attributesAtIndex:longestEffectiveRange:inRange:"), function $CPAttributedString__attributesAtIndex_longestEffectiveRange_inRange_(self, _cmd, anIndex, aRange, rangeLimit)
1095{ with(self)
1096{
1097    var startingEntryIndex = objj_msgSend(self, "_indexOfEntryWithIndex:", anIndex);
1098    if (startingEntryIndex == CPNotFound)
1099        return nil;
1100    if (!aRange)
1101        return _rangeEntries[startingEntryIndex].attributes;
1102    if (CPRangeInRange(_rangeEntries[startingEntryIndex].range, rangeLimit))
1103    {
1104        aRange.location = rangeLimit.location;
1105        aRange.length = rangeLimit.length;
1106        return _rangeEntries[startingEntryIndex].attributes;
1107    }
1108    var nextRangeIndex = startingEntryIndex - 1,
1109        currentEntry = _rangeEntries[startingEntryIndex],
1110        comparisonDict = currentEntry.attributes;
1111    while (nextRangeIndex >= 0)
1112    {
1113        var nextEntry = _rangeEntries[nextRangeIndex];
1114        if (CPMaxRange(nextEntry.range) > rangeLimit.location && objj_msgSend(nextEntry.attributes, "isEqualToDictionary:", comparisonDict))
1115        {
1116            currentEntry = nextEntry;
1117            nextRangeIndex--;
1118        }
1119        else
1120            break;
1121    }
1122    aRange.location = MAX(currentEntry.range.location, rangeLimit.location);
1123    currentEntry = _rangeEntries[startingEntryIndex];
1124    nextRangeIndex = startingEntryIndex + 1;
1125    while (nextRangeIndex < _rangeEntries.length)
1126    {
1127        var nextEntry = _rangeEntries[nextRangeIndex];
1128        if (nextEntry.range.location < CPMaxRange(rangeLimit) && objj_msgSend(nextEntry.attributes, "isEqualToDictionary:", comparisonDict))
1129        {
1130            currentEntry = nextEntry;
1131            nextRangeIndex++;
1132        }
1133        else
1134            break;
1135    }
1136    aRange.length = MIN(CPMaxRange(currentEntry.range), CPMaxRange(rangeLimit)) - aRange.location;
1137    return comparisonDict;
1138}
1139}), new objj_method(sel_getUid("attribute:atIndex:effectiveRange:"), function $CPAttributedString__attribute_atIndex_effectiveRange_(self, _cmd, attribute, index, aRange)
1140{ with(self)
1141{
1142    if (!attribute)
1143    {
1144        if (aRange)
1145        {
1146            aRange.location = 0;
1147            aRange.length = _string.length;
1148        }
1149        return nil;
1150    }
1151    return objj_msgSend(objj_msgSend(self, "attributesAtIndex:effectiveRange:", index, aRange), "valueForKey:", attribute);
1152}
1153}), new objj_method(sel_getUid("attribute:atIndex:longestEffectiveRange:inRange:"), function $CPAttributedString__attribute_atIndex_longestEffectiveRange_inRange_(self, _cmd, attribute, anIndex, aRange, rangeLimit)
1154{ with(self)
1155{
1156    var startingEntryIndex = objj_msgSend(self, "_indexOfEntryWithIndex:", anIndex);
1157    if (startingEntryIndex == CPNotFound || !attribute)
1158        return nil;
1159    if (!aRange)
1160        return objj_msgSend(_rangeEntries[startingEntryIndex].attributes, "objectForKey:", attribute);
1161    if (CPRangeInRange(_rangeEntries[startingEntryIndex].range, rangeLimit))
1162    {
1163        aRange.location = rangeLimit.location;
1164        aRange.length = rangeLimit.length;
1165        return objj_msgSend(_rangeEntries[startingEntryIndex].attributes, "objectForKey:", attribute);
1166    }
1167    var nextRangeIndex = startingEntryIndex - 1,
1168        currentEntry = _rangeEntries[startingEntryIndex],
1169        comparisonAttribute = objj_msgSend(currentEntry.attributes, "objectForKey:", attribute);
1170    while (nextRangeIndex >= 0)
1171    {
1172        var nextEntry = _rangeEntries[nextRangeIndex];
1173        if (CPMaxRange(nextEntry.range) > rangeLimit.location && isEqual(comparisonAttribute, objj_msgSend(nextEntry.attributes, "objectForKey:", attribute)))
1174        {
1175            currentEntry = nextEntry;
1176            nextRangeIndex--;
1177        }
1178        else
1179            break;
1180    }
1181    aRange.location = MAX(currentEntry.range.location, rangeLimit.location);
1182    currentEntry = _rangeEntries[startingEntryIndex];
1183    nextRangeIndex = startingEntryIndex + 1;
1184    while (nextRangeIndex < _rangeEntries.length)
1185    {
1186        var nextEntry = _rangeEntries[nextRangeIndex];
1187        if (nextEntry.range.location < CPMaxRange(rangeLimit) && isEqual(comparisonAttribute, objj_msgSend(nextEntry.attributes, "objectForKey:", attribute)))
1188        {
1189            currentEntry = nextEntry;
1190            nextRangeIndex++;
1191        }
1192        else
1193            break;
1194    }
1195    aRange.length = MIN(CPMaxRange(currentEntry.range), CPMaxRange(rangeLimit)) - aRange.location;
1196    return comparisonAttribute;
1197}
1198}), new objj_method(sel_getUid("isEqualToAttributedString:"), function $CPAttributedString__isEqualToAttributedString_(self, _cmd, aString)
1199{ with(self)
1200{
1201 if(!aString)
1202  return NO;
1203 if(_string != objj_msgSend(aString, "string"))
1204  return NO;
1205    var myRange = CPMakeRange(),
1206        comparisonRange = CPMakeRange(),
1207        myAttributes = objj_msgSend(self, "attributesAtIndex:effectiveRange:", 0, myRange),
1208        comparisonAttributes = objj_msgSend(aString, "attributesAtIndex:effectiveRange:", 0, comparisonRange),
1209        length = _string.length;
1210    while (CPMaxRange(CPUnionRange(myRange, comparisonRange)) < length)
1211    {
1212        if (CPIntersectionRange(myRange, comparisonRange).length > 0 && !objj_msgSend(myAttributes, "isEqualToDictionary:", comparisonAttributes))
1213            return NO;
1214        if (CPMaxRange(myRange) < CPMaxRange(comparisonRange))
1215            myAttributes = objj_msgSend(self, "attributesAtIndex:effectiveRange:", CPMaxRange(myRange), myRange);
1216        else
1217            comparisonAttributes = objj_msgSend(aString, "attributesAtIndex:effectiveRange:", CPMaxRange(comparisonRange), comparisonRange);
1218    }
1219    return YES;
1220}
1221}), new objj_method(sel_getUid("isEqual:"), function $CPAttributedString__isEqual_(self, _cmd, anObject)
1222{ with(self)
1223{
1224 if (anObject == self)
1225  return YES;
1226 if (objj_msgSend(anObject, "isKindOfClass:", objj_msgSend(self, "class")))
1227  return objj_msgSend(self, "isEqualToAttributedString:", anObject);
1228 return NO;
1229}
1230}), new objj_method(sel_getUid("attributedSubstringFromRange:"), function $CPAttributedString__attributedSubstringFromRange_(self, _cmd, aRange)
1231{ with(self)
1232{
1233    if (!aRange || CPMaxRange(aRange) > _string.length || aRange.location < 0)
1234        objj_msgSend(CPException, "raise:reason:", CPRangeException, "tried to get attributedSubstring for an invalid range: "+(aRange?CPStringFromRange(aRange):"nil"));
1235    var newString = objj_msgSend(objj_msgSend(CPAttributedString, "alloc"), "initWithString:", _string.substring(aRange.location, CPMaxRange(aRange))),
1236        entryIndex = objj_msgSend(self, "_indexOfEntryWithIndex:", aRange.location),
1237        currentRangeEntry = _rangeEntries[entryIndex],
1238        lastIndex = CPMaxRange(aRange);
1239    newString._rangeEntries = [];
1240    while (currentRangeEntry && CPMaxRange(currentRangeEntry.range) < lastIndex)
1241    {
1242        var newEntry = copyRangeEntry(currentRangeEntry);
1243        newEntry.range.location -= aRange.location;
1244        if (newEntry.range.location < 0)
1245        {
1246            newEntry.range.length += newEntry.range.location;
1247            newEntry.range.location = 0;
1248        }
1249        newString._rangeEntries.push(newEntry);
1250        currentRangeEntry = _rangeEntries[++entryIndex];
1251    }
1252    if (currentRangeEntry)
1253    {
1254        var newRangeEntry = copyRangeEntry(currentRangeEntry);
1255        newRangeEntry.range.length = CPMaxRange(aRange) - newRangeEntry.range.location;
1256        newRangeEntry.range.location -= aRange.location;
1257        if (newRangeEntry.range.location < 0)
1258        {
1259            newRangeEntry.range.length += newRangeEntry.range.location;
1260            newRangeEntry.range.location = 0;
1261        }
1262        newString._rangeEntries.push(newRangeEntry);
1263    }
1264    return newString;
1265}
1266}), new objj_method(sel_getUid("replaceCharactersInRange:withString:"), function $CPAttributedString__replaceCharactersInRange_withString_(self, _cmd, aRange, aString)
1267{ with(self)
1268{
1269    objj_msgSend(self, "beginEditing");
1270    if (!aString)
1271        aString = "";
1272    var startingIndex = objj_msgSend(self, "_indexOfEntryWithIndex:", aRange.location),
1273        startingRangeEntry = _rangeEntries[startingIndex],
1274        endingIndex = objj_msgSend(self, "_indexOfEntryWithIndex:", MAX(CPMaxRange(aRange)-1, 0)),
1275        endingRangeEntry = _rangeEntries[endingIndex],
1276        additionalLength = aString.length - aRange.length;
1277    _string = _string.substring(0, aRange.location) + aString + _string.substring(CPMaxRange(aRange));
1278    if (startingIndex == endingIndex)
1279        startingRangeEntry.range.length += additionalLength;
1280    else
1281    {
1282        endingRangeEntry.range.length = CPMaxRange(endingRangeEntry.range) - CPMaxRange(aRange);
1283        endingRangeEntry.range.location = CPMaxRange(aRange);
1284        startingRangeEntry.range.length = CPMaxRange(aRange) - startingRangeEntry.range.location;
1285        _rangeEntries.splice(startingIndex, endingIndex - startingIndex);
1286    }
1287    endingIndex = startingIndex + 1;
1288    while(endingIndex < _rangeEntries.length)
1289        _rangeEntries[endingIndex++].range.location+=additionalLength;
1290    objj_msgSend(self, "endEditing");
1291}
1292}), new objj_method(sel_getUid("deleteCharactersInRange:"), function $CPAttributedString__deleteCharactersInRange_(self, _cmd, aRange)
1293{ with(self)
1294{
1295    objj_msgSend(self, "replaceCharactersInRange:withString:", aRange, nil);
1296}
1297}), new objj_method(sel_getUid("setAttributes:range:"), function $CPAttributedString__setAttributes_range_(self, _cmd, aDictionary, aRange)
1298{ with(self)
1299{
1300    objj_msgSend(self, "beginEditing");
1301    var startingEntryIndex = objj_msgSend(self, "_indexOfRangeEntryForIndex:splitOnMaxIndex:", aRange.location, YES),
1302        endingEntryIndex = objj_msgSend(self, "_indexOfRangeEntryForIndex:splitOnMaxIndex:", CPMaxRange(aRange), YES),
1303        current = startingEntryIndex;
1304    if (endingEntryIndex == CPNotFound)
1305        endingEntryIndex = _rangeEntries.length;
1306    while (current < endingEntryIndex)
1307        _rangeEntries[current++].attributes = objj_msgSend(aDictionary, "copy");
1308    objj_msgSend(self, "_coalesceRangeEntriesFromIndex:toIndex:", startingEntryIndex, endingEntryIndex);
1309    objj_msgSend(self, "endEditing");
1310}
1311}), new objj_method(sel_getUid("addAttributes:range:"), function $CPAttributedString__addAttributes_range_(self, _cmd, aDictionary, aRange)
1312{ with(self)
1313{
1314    objj_msgSend(self, "beginEditing");
1315    var startingEntryIndex = objj_msgSend(self, "_indexOfRangeEntryForIndex:splitOnMaxIndex:", aRange.location, YES),
1316        endingEntryIndex = objj_msgSend(self, "_indexOfRangeEntryForIndex:splitOnMaxIndex:", CPMaxRange(aRange), YES),
1317        current = startingEntryIndex;
1318    if (endingEntryIndex == CPNotFound)
1319        endingEntryIndex = _rangeEntries.length;
1320    while (current < endingEntryIndex)
1321    {
1322        var keys = objj_msgSend(aDictionary, "allKeys"),
1323            count = objj_msgSend(keys, "count");
1324        while (count--)
1325            objj_msgSend(_rangeEntries[current].attributes, "setObject:forKey:", objj_msgSend(aDictionary, "objectForKey:", keys[count]), keys[count]);
1326        current++;
1327    }
1328    objj_msgSend(self, "_coalesceRangeEntriesFromIndex:toIndex:", startingEntryIndex, endingEntryIndex);
1329    objj_msgSend(self, "endEditing");
1330}
1331}), new objj_method(sel_getUid("addAttribute:value:range:"), function $CPAttributedString__addAttribute_value_range_(self, _cmd, anAttribute, aValue, aRange)
1332{ with(self)
1333{
1334    objj_msgSend(self, "addAttributes:range:", objj_msgSend(CPDictionary, "dictionaryWithObject:forKey:", aValue, anAttribute), aRange);
1335}
1336}), new objj_method(sel_getUid("removeAttribute:range:"), function $CPAttributedString__removeAttribute_range_(self, _cmd, anAttribute, aRange)
1337{ with(self)
1338{
1339    objj_msgSend(self, "addAttribute:value:range:", anAttribute, nil, aRange);
1340}
1341}), new objj_method(sel_getUid("appendAttributedString:"), function $CPAttributedString__appendAttributedString_(self, _cmd, aString)
1342{ with(self)
1343{
1344    objj_msgSend(self, "insertAttributedString:atIndex:", aString, _string.length);
1345}
1346}), new objj_method(sel_getUid("insertAttributedString:atIndex:"), function $CPAttributedString__insertAttributedString_atIndex_(self, _cmd, aString, anIndex)
1347{ with(self)
1348{
1349    objj_msgSend(self, "beginEditing");
1350    if (anIndex < 0 || anIndex > objj_msgSend(self, "length"))
1351        objj_msgSend(CPException, "raise:reason:", CPRangeException, "tried to insert attributed string at an invalid index: "+anIndex);
1352    var entryIndexOfNextEntry = objj_msgSend(self, "_indexOfRangeEntryForIndex:splitOnMaxIndex:", anIndex, YES),
1353        otherRangeEntries = aString._rangeEntries,
1354        length = objj_msgSend(aString, "length");
1355    if (entryIndexOfNextEntry == CPNotFound)
1356        entryIndexOfNextEntry = _rangeEntries.length;
1357    _string = _string.substring(0, anIndex) + aString._string + _string.substring(anIndex);
1358    var current = entryIndexOfNextEntry;
1359    while (current < _rangeEntries.length)
1360        _rangeEntries[current++].range.location += length;
1361    var newRangeEntryCount = otherRangeEntries.length,
1362        index = 0;
1363    while (index < newRangeEntryCount)
1364    {
1365        var entryCopy = copyRangeEntry(otherRangeEntries[index++]);
1366        entryCopy.range.location += anIndex;
1367        _rangeEntries.splice(entryIndexOfNextEntry-1+index, 0, entryCopy);
1368    }
1369    objj_msgSend(self, "endEditing");
1370}
1371}), new objj_method(sel_getUid("replaceCharactersInRange:withAttributedString:"), function $CPAttributedString__replaceCharactersInRange_withAttributedString_(self, _cmd, aRange, aString)
1372{ with(self)
1373{
1374    objj_msgSend(self, "beginEditing");
1375    objj_msgSend(self, "deleteCharactersInRange:", aRange);
1376    objj_msgSend(self, "insertAttributedString:atIndex:", aString, aRange.location);
1377    objj_msgSend(self, "endEditing");
1378}
1379}), new objj_method(sel_getUid("setAttributedString:"), function $CPAttributedString__setAttributedString_(self, _cmd, aString)
1380{ with(self)
1381{
1382    objj_msgSend(self, "beginEditing");
1383    _string = aString._string;
1384    _rangeEntries = [];
1385    for (var i=0, count = aString._rangeEntries.length; i<count; i++)
1386        _rangeEntries.push(copyRangeEntry(aString._rangeEntries[i]));
1387    objj_msgSend(self, "endEditing");
1388}
1389}), new objj_method(sel_getUid("_indexOfRangeEntryForIndex:splitOnMaxIndex:"), function $CPAttributedString___indexOfRangeEntryForIndex_splitOnMaxIndex_(self, _cmd, characterIndex, split)
1390{ with(self)
1391{
1392    var index = objj_msgSend(self, "_indexOfEntryWithIndex:", characterIndex);
1393    if (index < 0)
1394        return index;
1395    var rangeEntry = _rangeEntries[index];
1396    if (rangeEntry.range.location == characterIndex || (CPMaxRange(rangeEntry.range) - 1 == characterIndex && !split))
1397        return index;
1398    var newEntries = splitRangeEntryAtIndex(rangeEntry, characterIndex);
1399    _rangeEntries.splice(index, 1, newEntries[0], newEntries[1]);
1400    index++;
1401    return index;
1402}
1403}), new objj_method(sel_getUid("_coalesceRangeEntriesFromIndex:toIndex:"), function $CPAttributedString___coalesceRangeEntriesFromIndex_toIndex_(self, _cmd, start, end)
1404{ with(self)
1405{
1406    var current = start;
1407    if (end >= _rangeEntries.length)
1408        end = _rangeEntries.length -1;
1409    while (current < end)
1410    {
1411        var a = _rangeEntries[current],
1412            b = _rangeEntries[current+1];
1413        if (objj_msgSend(a.attributes, "isEqualToDictionary:", b.attributes))
1414        {
1415            a.range.length = CPMaxRange(b.range) - a.range.location;
1416            _rangeEntries.splice(current+1, 1);
1417            end--;
1418        }
1419        else
1420            current++;
1421    }
1422}
1423}), new objj_method(sel_getUid("beginEditing"), function $CPAttributedString__beginEditing(self, _cmd)
1424{ with(self)
1425{
1426}
1427}), new objj_method(sel_getUid("endEditing"), function $CPAttributedString__endEditing(self, _cmd)
1428{ with(self)
1429{
1430}
1431})]);
1432}
1433{var the_class = objj_allocateClassPair(CPAttributedString, "CPMutableAttributedString"),
1434meta_class = the_class.isa;objj_registerClassPair(the_class);
1435objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
1436}
1437var isEqual = isEqual= function(a, b)
1438{
1439    if (a == b)
1440        return YES;
1441    if (objj_msgSend(a, "respondsToSelector:", sel_getUid("isEqual:")) && objj_msgSend(a, "isEqual:", b))
1442        return YES;
1443    return NO;
1444}
1445var makeRangeEntry = makeRangeEntry= function( aRange, attributes)
1446{
1447    return {range:aRange, attributes:objj_msgSend(attributes, "copy")};
1448}
1449var copyRangeEntry = copyRangeEntry= function( aRangeEntry)
1450{
1451    return makeRangeEntry(CPCopyRange(aRangeEntry.range), objj_msgSend(aRangeEntry.attributes, "copy"));
1452}
1453var splitRangeEntry = splitRangeEntryAtIndex= function( aRangeEntry, anIndex)
1454{
1455    var newRangeEntry = copyRangeEntry(aRangeEntry),
1456        cachedIndex = CPMaxRange(aRangeEntry.range);
1457    aRangeEntry.range.length = anIndex - aRangeEntry.range.location;
1458    newRangeEntry.range.location = anIndex;
1459    newRangeEntry.range.length = cachedIndex - anIndex;
1460    newRangeEntry.attributes = objj_msgSend(newRangeEntry.attributes, "copy");
1461    return [aRangeEntry, newRangeEntry];
1462}
1463
1464p;10;CPBundle.ji;10;CPObject.ji;14;CPDictionary.ji;14;CPURLRequest.jc;5166;
1465{var the_class = objj_allocateClassPair(CPObject, "CPBundle"),
1466meta_class = the_class.isa;objj_registerClassPair(the_class);
1467objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
1468class_addMethods(the_class, [new objj_method(sel_getUid("initWithPath:"), function $CPBundle__initWithPath_(self, _cmd, aPath)
1469{ with(self)
1470{
1471    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
1472    if (self)
1473    {
1474        path = aPath;
1475        objj_setBundleForPath(path, self);
1476    }
1477    return self;
1478}
1479}), new objj_method(sel_getUid("classNamed:"), function $CPBundle__classNamed_(self, _cmd, aString)
1480{ with(self)
1481{
1482}
1483}), new objj_method(sel_getUid("bundlePath"), function $CPBundle__bundlePath(self, _cmd)
1484{ with(self)
1485{
1486    return objj_msgSend(path, "stringByDeletingLastPathComponent");
1487}
1488}), new objj_method(sel_getUid("resourcePath"), function $CPBundle__resourcePath(self, _cmd)
1489{ with(self)
1490{
1491    var resourcePath = objj_msgSend(self, "bundlePath");
1492    if (resourcePath.length)
1493        resourcePath += '/';
1494    return resourcePath + "Resources";
1495}
1496}), new objj_method(sel_getUid("principalClass"), function $CPBundle__principalClass(self, _cmd)
1497{ with(self)
1498{
1499    var className = objj_msgSend(self, "objectForInfoDictionaryKey:", "CPPrincipalClass");
1500    return className ? CPClassFromString(className) : Nil;
1501}
1502}), new objj_method(sel_getUid("pathForResource:"), function $CPBundle__pathForResource_(self, _cmd, aFilename)
1503{ with(self)
1504{
1505    return objj_msgSend(self, "resourcePath") + '/' + aFilename;
1506}
1507}), new objj_method(sel_getUid("infoDictionary"), function $CPBundle__infoDictionary(self, _cmd)
1508{ with(self)
1509{
1510    return info;
1511}
1512}), new objj_method(sel_getUid("objectForInfoDictionaryKey:"), function $CPBundle__objectForInfoDictionaryKey_(self, _cmd, aKey)
1513{ with(self)
1514{
1515    return objj_msgSend(info, "objectForKey:", aKey);
1516}
1517}), new objj_method(sel_getUid("loadWithDelegate:"), function $CPBundle__loadWithDelegate_(self, _cmd, aDelegate)
1518{ with(self)
1519{
1520    self._delegate = aDelegate;
1521    self._infoConnection = objj_msgSend(CPURLConnection, "connectionWithRequest:delegate:", objj_msgSend(CPURLRequest, "requestWithURL:", objj_msgSend(self, "bundlePath") + "/Info.plist"), self);
1522}
1523}), new objj_method(sel_getUid("connection:didReceiveData:"), function $CPBundle__connection_didReceiveData_(self, _cmd, aConnection, data)
1524{ with(self)
1525{
1526    if (aConnection === self._infoConnection)
1527    {
1528        info = CPPropertyListCreateFromData(objj_msgSend(CPData, "dataWithString:", data));
1529        var platform = '/',
1530            platforms = objj_msgSend(self, "objectForInfoDictionaryKey:", "CPBundlePlatforms");
1531        if (platforms)
1532        {
1533            platform = objj_msgSend(platforms, "firstObjectCommonWithArray:", OBJJ_PLATFORMS);
1534            platform = platform ? '/' + platform + ".platform/" : '/';
1535        }
1536        objj_msgSend(CPURLConnection, "connectionWithRequest:delegate:", objj_msgSend(CPURLRequest, "requestWithURL:", objj_msgSend(self, "bundlePath") + platform + objj_msgSend(self, "objectForInfoDictionaryKey:", "CPBundleExecutable")), self);
1537    }
1538    else
1539    {
1540        objj_decompile(objj_msgSend(data, "string"), self);
1541        var context = new objj_context();
1542        if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("bundleDidFinishLoading:")))
1543            context.didCompleteCallback = function() { objj_msgSend(_delegate, "bundleDidFinishLoading:", self); };
1544        var files = objj_msgSend(self, "objectForInfoDictionaryKey:", "CPBundleReplacedFiles"),
1545            count = files.length,
1546            bundlePath = objj_msgSend(self, "bundlePath");
1547        while (count--)
1548        {
1549            var fileName = files[count];
1550            if (fileName.indexOf(".j") === fileName.length - 2)
1551                context.pushFragment(fragment_create_file(bundlePath + '/' + fileName, new objj_bundle(""), YES, NULL));
1552        }
1553        if (context.fragments.length)
1554            context.evaluate();
1555        else
1556            objj_msgSend(_delegate, "bundleDidFinishLoading:", self);
1557    }
1558}
1559}), new objj_method(sel_getUid("connection:didFailWithError:"), function $CPBundle__connection_didFailWithError_(self, _cmd, aConnection, anError)
1560{ with(self)
1561{
1562    alert("Couldnot find bundle:" + anError)
1563}
1564}), new objj_method(sel_getUid("connectionDidFinishLoading:"), function $CPBundle__connectionDidFinishLoading_(self, _cmd, aConnection)
1565{ with(self)
1566{
1567}
1568})]);
1569class_addMethods(meta_class, [new objj_method(sel_getUid("alloc"), function $CPBundle__alloc(self, _cmd)
1570{ with(self)
1571{
1572    return new objj_bundle;
1573}
1574}), new objj_method(sel_getUid("bundleWithPath:"), function $CPBundle__bundleWithPath_(self, _cmd, aPath)
1575{ with(self)
1576{
1577    return objj_getBundleWithPath(aPath);
1578}
1579}), new objj_method(sel_getUid("bundleForClass:"), function $CPBundle__bundleForClass_(self, _cmd, aClass)
1580{ with(self)
1581{
1582    return objj_bundleForClass(aClass);
1583}
1584}), new objj_method(sel_getUid("mainBundle"), function $CPBundle__mainBundle(self, _cmd)
1585{ with(self)
1586{
1587    return objj_msgSend(CPBundle, "bundleWithPath:", "Info.plist");
1588}
1589})]);
1590}
1591objj_bundle.prototype.isa = CPBundle;
1592
1593p;9;CPCoder.ji;10;CPObject.ji;13;CPException.jc;2598;
1594{var the_class = objj_allocateClassPair(CPObject, "CPCoder"),
1595meta_class = the_class.isa;objj_registerClassPair(the_class);
1596objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
1597class_addMethods(the_class, [new objj_method(sel_getUid("allowsKeyedCoding"), function $CPCoder__allowsKeyedCoding(self, _cmd)
1598{ with(self)
1599{
1600   return NO;
1601}
1602}), new objj_method(sel_getUid("encodeValueOfObjCType:at:"), function $CPCoder__encodeValueOfObjCType_at_(self, _cmd, aType, anObject)
1603{ with(self)
1604{
1605   CPInvalidAbstractInvocation();
1606}
1607}), new objj_method(sel_getUid("encodeDataObject:"), function $CPCoder__encodeDataObject_(self, _cmd, aData)
1608{ with(self)
1609{
1610   CPInvalidAbstractInvocation();
1611}
1612}), new objj_method(sel_getUid("encodeObject:"), function $CPCoder__encodeObject_(self, _cmd, anObject)
1613{ with(self)
1614{
1615}
1616}), new objj_method(sel_getUid("encodePoint:"), function $CPCoder__encodePoint_(self, _cmd, aPoint)
1617{ with(self)
1618{
1619    objj_msgSend(self, "encodeNumber:", aPoint.x);
1620    objj_msgSend(self, "encodeNumber:", aPoint.y);
1621}
1622}), new objj_method(sel_getUid("encodeRect:"), function $CPCoder__encodeRect_(self, _cmd, aRect)
1623{ with(self)
1624{
1625    objj_msgSend(self, "encodePoint:", aRect.origin);
1626    objj_msgSend(self, "encodeSize:", aRect.size);
1627}
1628}), new objj_method(sel_getUid("encodeSize:"), function $CPCoder__encodeSize_(self, _cmd, aSize)
1629{ with(self)
1630{
1631    objj_msgSend(self, "encodeNumber:", aSize.width);
1632    objj_msgSend(self, "encodeNumber:", aSize.height);
1633}
1634}), new objj_method(sel_getUid("encodePropertyList:"), function $CPCoder__encodePropertyList_(self, _cmd, aPropertyList)
1635{ with(self)
1636{
1637}
1638}), new objj_method(sel_getUid("encodeRootObject:"), function $CPCoder__encodeRootObject_(self, _cmd, anObject)
1639{ with(self)
1640{
1641   objj_msgSend(self, "encodeObject:", anObject);
1642}
1643}), new objj_method(sel_getUid("encodeBycopyObject:"), function $CPCoder__encodeBycopyObject_(self, _cmd, anObject)
1644{ with(self)
1645{
1646   objj_msgSend(self, "encodeObject:", object);
1647}
1648}), new objj_method(sel_getUid("encodeConditionalObject:"), function $CPCoder__encodeConditionalObject_(self, _cmd, anObject)
1649{ with(self)
1650{
1651   objj_msgSend(self, "encodeObject:", object);
1652}
1653})]);
1654}
1655{
1656var the_class = objj_getClass("CPObject")
1657if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPObject\""));
1658var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("awakeAfterUsingCoder:"), function $CPObject__awakeAfterUsingCoder_(self, _cmd, aDecoder)
1659{ with(self)
1660{
1661    return self;
1662}
1663})]);
1664}
1665
1666p;14;CPCountedSet.ji;7;CPSet.jc;1792;
1667
1668
1669
1670
1671{var the_class = objj_allocateClassPair(CPMutableSet, "CPCountedSet"),
1672meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_counts")]);
1673objj_registerClassPair(the_class);
1674objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
1675class_addMethods(the_class, [new objj_method(sel_getUid("addObject:"), function $CPCountedSet__addObject_(self, _cmd, anObject)
1676{ with(self)
1677{
1678    if (!_counts)
1679        _counts = {};
1680
1681    objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPMutableSet") }, "addObject:", anObject);
1682
1683    var hash = objj_msgSend(anObject, "hash");
1684
1685    if (_counts[hash] === undefined)
1686        _counts[hash] = 1;
1687    else
1688        ++_counts[hash];
1689}
1690}), new objj_method(sel_getUid("removeObject:"), function $CPCountedSet__removeObject_(self, _cmd, anObject)
1691{ with(self)
1692{
1693    if (!_counts)
1694        return;
1695
1696    var hash = objj_msgSend(anObject, "hash");
1697
1698    if (_counts[hash] === undefined)
1699        return;
1700
1701    else
1702    {
1703        --_counts[hash];
1704
1705        if (_counts[hash] === 0)
1706        {
1707            delete _counts[hash];
1708            objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPMutableSet") }, "removeObject:", anObject);
1709        }
1710    }
1711}
1712}), new objj_method(sel_getUid("removeAllObjects"), function $CPCountedSet__removeAllObjects(self, _cmd)
1713{ with(self)
1714{
1715    objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPMutableSet") }, "removeAllObjects");
1716    _counts = {};
1717}
1718}), new objj_method(sel_getUid("countForObject:"), function $CPCountedSet__countForObject_(self, _cmd, anObject)
1719{ with(self)
1720{
1721    if (!_counts)
1722        _counts = {};
1723
1724    var hash = objj_msgSend(anObject, "hash");
1725
1726    if (_counts[hash] === undefined)
1727        return 0;
1728
1729    return _counts[hash];
1730}
1731})]);
1732}
1733
1734p;8;CPData.ji;10;CPObject.ji;10;CPString.jc;2933;
1735{var the_class = objj_allocateClassPair(CPObject, "CPData"),
1736meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_plistObject")]);
1737objj_registerClassPair(the_class);
1738objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
1739class_addMethods(the_class, [new objj_method(sel_getUid("initWithString:"), function $CPData__initWithString_(self, _cmd, aString)
1740{ with(self)
1741{
1742    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
1743    if (self)
1744        string = aString;
1745    return self;
1746}
1747}), new objj_method(sel_getUid("initWithPlistObject:"), function $CPData__initWithPlistObject_(self, _cmd, aPlistObject)
1748{ with(self)
1749{
1750    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
1751    if (self)
1752        _plistObject = aPlistObject;
1753    return self;
1754}
1755}), new objj_method(sel_getUid("length"), function $CPData__length(self, _cmd)
1756{ with(self)
1757{
1758    return objj_msgSend(objj_msgSend(self, "string"), "length");
1759}
1760}), new objj_method(sel_getUid("description"), function $CPData__description(self, _cmd)
1761{ with(self)
1762{
1763    return string;
1764}
1765}), new objj_method(sel_getUid("string"), function $CPData__string(self, _cmd)
1766{ with(self)
1767{
1768    if (!string && _plistObject)
1769        string = objj_msgSend(objj_msgSend(CPPropertyListSerialization, "dataFromPropertyList:format:errorDescription:", _plistObject, CPPropertyList280NorthFormat_v1_0, NULL), "string");
1770    return string;
1771}
1772}), new objj_method(sel_getUid("setString:"), function $CPData__setString_(self, _cmd, aString)
1773{ with(self)
1774{
1775    string = aString;
1776    _plistObject = nil;
1777}
1778}), new objj_method(sel_getUid("plistObject"), function $CPData__plistObject(self, _cmd)
1779{ with(self)
1780{
1781    if (string && !_plistObject)
1782        _plistObject = objj_msgSend(CPPropertyListSerialization, "propertyListFromData:format:errorDescription:", self, 0, NULL);
1783    return _plistObject;
1784}
1785}), new objj_method(sel_getUid("setPlistObject:"), function $CPData__setPlistObject_(self, _cmd, aPlistObject)
1786{ with(self)
1787{
1788    string = nil;
1789    _plistObject = aPlistObject;
1790}
1791})]);
1792class_addMethods(meta_class, [new objj_method(sel_getUid("alloc"), function $CPData__alloc(self, _cmd)
1793{ with(self)
1794{
1795    return new objj_data();
1796}
1797}), new objj_method(sel_getUid("data"), function $CPData__data(self, _cmd)
1798{ with(self)
1799{
1800    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithPlistObject:", nil);
1801}
1802}), new objj_method(sel_getUid("dataWithString:"), function $CPData__dataWithString_(self, _cmd, aString)
1803{ with(self)
1804{
1805    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithString:", aString);
1806}
1807}), new objj_method(sel_getUid("dataWithPlistObject:"), function $CPData__dataWithPlistObject_(self, _cmd, aPlistObject)
1808{ with(self)
1809{
1810    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithPlistObject:", aPlistObject);
1811}
1812})]);
1813}
1814objj_data.prototype.isa = CPData;
1815
1816p;8;CPDate.ji;10;CPObject.ji;10;CPString.jc;4765;
1817var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
1818{var the_class = objj_allocateClassPair(CPObject, "CPDate"),
1819meta_class = the_class.isa;objj_registerClassPair(the_class);
1820objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
1821class_addMethods(the_class, [new objj_method(sel_getUid("initWithTimeIntervalSinceNow:"), function $CPDate__initWithTimeIntervalSinceNow_(self, _cmd, seconds)
1822{ with(self)
1823{
1824    self = new Date((new Date()).getTime() + seconds * 1000);
1825    return self;
1826}
1827}), new objj_method(sel_getUid("initWithTimeIntervalSince1970:"), function $CPDate__initWithTimeIntervalSince1970_(self, _cmd, seconds)
1828{ with(self)
1829{
1830    self = new Date(seconds * 1000);
1831    return self;
1832}
1833}), new objj_method(sel_getUid("initWithTimeIntervalSinceReferenceDate:"), function $CPDate__initWithTimeIntervalSinceReferenceDate_(self, _cmd, seconds)
1834{ with(self)
1835{
1836    self = objj_msgSend(self, "initWithTimeInterval:sinceDate:", seconds, CPDateReferenceDate);
1837    return self;
1838}
1839}), new objj_method(sel_getUid("initWithTimeInterval:sinceDate:"), function $CPDate__initWithTimeInterval_sinceDate_(self, _cmd, seconds, refDate)
1840{ with(self)
1841{
1842    self = new Date(refDate.getTime() + seconds * 1000);
1843    return self;
1844}
1845}), new objj_method(sel_getUid("initWithString:"), function $CPDate__initWithString_(self, _cmd, description)
1846{ with(self)
1847{
1848    self = new Date(description);
1849    return self;
1850}
1851}), new objj_method(sel_getUid("timeIntervalSinceDate:"), function $CPDate__timeIntervalSinceDate_(self, _cmd, anotherDate)
1852{ with(self)
1853{
1854    return (self.getTime() - anotherDate.getTime()) / 1000.0;
1855}
1856}), new objj_method(sel_getUid("timeIntervalSinceNow"), function $CPDate__timeIntervalSinceNow(self, _cmd)
1857{ with(self)
1858{
1859    return objj_msgSend(self, "timeIntervalSinceDate:", objj_msgSend(CPDate, "date"));
1860}
1861}), new objj_method(sel_getUid("timeIntervalSince1970"), function $CPDate__timeIntervalSince1970(self, _cmd)
1862{ with(self)
1863{
1864    return self.getTime() / 1000.0;
1865}
1866}), new objj_method(sel_getUid("timeIntervalSinceReferenceDate"), function $CPDate__timeIntervalSinceReferenceDate(self, _cmd)
1867{ with(self)
1868{
1869    return (self.getTime() - CPDateReferenceDate.getTime()) / 1000.0;
1870}
1871}), new objj_method(sel_getUid("isEqualToDate:"), function $CPDate__isEqualToDate_(self, _cmd, anotherDate)
1872{ with(self)
1873{
1874    return !(self < anotherDate || self > anotherDate);
1875}
1876}), new objj_method(sel_getUid("compare:"), function $CPDate__compare_(self, _cmd, anotherDate)
1877{ with(self)
1878{
1879    return (self > anotherDate) ? CPOrderedDescending : ((self < anotherDate) ? CPOrderedAscending : CPOrderedSame);
1880}
1881}), new objj_method(sel_getUid("earlierDate:"), function $CPDate__earlierDate_(self, _cmd, anotherDate)
1882{ with(self)
1883{
1884    return (self < anotherDate) ? self : anotherDate;
1885}
1886}), new objj_method(sel_getUid("laterDate:"), function $CPDate__laterDate_(self, _cmd, anotherDate)
1887{ with(self)
1888{
1889    return (self > anotherDate) ? self : anotherDate;
1890}
1891}), new objj_method(sel_getUid("description"), function $CPDate__description(self, _cmd)
1892{ with(self)
1893{
1894    return self.toString();
1895}
1896})]);
1897class_addMethods(meta_class, [new objj_method(sel_getUid("alloc"), function $CPDate__alloc(self, _cmd)
1898{ with(self)
1899{
1900    return new Date;
1901}
1902}), new objj_method(sel_getUid("date"), function $CPDate__date(self, _cmd)
1903{ with(self)
1904{
1905    return objj_msgSend(objj_msgSend(self, "alloc"), "init");
1906}
1907}), new objj_method(sel_getUid("dateWithTimeIntervalSinceNow:"), function $CPDate__dateWithTimeIntervalSinceNow_(self, _cmd, seconds)
1908{ with(self)
1909{
1910    return objj_msgSend(objj_msgSend(CPDate, "alloc"), "initWithTimeIntervalSinceNow:", seconds);
1911}
1912}), new objj_method(sel_getUid("dateWithTimeIntervalSince1970:"), function $CPDate__dateWithTimeIntervalSince1970_(self, _cmd, seconds)
1913{ with(self)
1914{
1915    return objj_msgSend(objj_msgSend(CPDate, "alloc"), "initWithTimeIntervalSince1970:", seconds);
1916}
1917}), new objj_method(sel_getUid("dateWithTimeIntervalSinceReferenceDate:"), function $CPDate__dateWithTimeIntervalSinceReferenceDate_(self, _cmd, seconds)
1918{ with(self)
1919{
1920    return objj_msgSend(objj_msgSend(CPDate, "alloc"), "initWithTimeIntervalSinceReferenceDate:", seconds);
1921}
1922}), new objj_method(sel_getUid("distantPast"), function $CPDate__distantPast(self, _cmd)
1923{ with(self)
1924{
1925    return new Date(-10000,1,1,0,0,0,0);
1926}
1927}), new objj_method(sel_getUid("distantFuture"), function $CPDate__distantFuture(self, _cmd)
1928{ with(self)
1929{
1930    return new Date(10000,1,1,0,0,0,0);
1931}
1932}), new objj_method(sel_getUid("timeIntervalSinceReferenceDate"), function $CPDate__timeIntervalSinceReferenceDate(self, _cmd)
1933{ with(self)
1934{
1935    return objj_msgSend(objj_msgSend(CPDate, "date"), "timeIntervalSinceReferenceDate");
1936}
1937})]);
1938}
1939Date.prototype.isa = CPDate;
1940
1941p;14;CPDictionary.ji;10;CPObject.ji;14;CPEnumerator.ji;13;CPException.jc;10057;
1942{var the_class = objj_allocateClassPair(CPEnumerator, "_CPDictionaryValueEnumerator"),
1943meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_keyEnumerator"), new objj_ivar("_dictionary")]);
1944objj_registerClassPair(the_class);
1945objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
1946class_addMethods(the_class, [new objj_method(sel_getUid("initWithDictionary:"), function $_CPDictionaryValueEnumerator__initWithDictionary_(self, _cmd, aDictionary)
1947{ with(self)
1948{
1949    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPEnumerator") }, "init");
1950    if (self)
1951    {
1952        _keyEnumerator = objj_msgSend(aDictionary, "keyEnumerator");
1953        _dictionary = aDictionary;
1954    }
1955    return self;
1956}
1957}), new objj_method(sel_getUid("nextObject"), function $_CPDictionaryValueEnumerator__nextObject(self, _cmd)
1958{ with(self)
1959{
1960    var key = objj_msgSend(_keyEnumerator, "nextObject");
1961    if (!key)
1962        return nil;
1963    return objj_msgSend(_dictionary, "objectForKey:", key);
1964}
1965})]);
1966}
1967{var the_class = objj_allocateClassPair(CPObject, "CPDictionary"),
1968meta_class = the_class.isa;objj_registerClassPair(the_class);
1969objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
1970class_addMethods(the_class, [new objj_method(sel_getUid("initWithDictionary:"), function $CPDictionary__initWithDictionary_(self, _cmd, aDictionary)
1971{ with(self)
1972{
1973    var key = "",
1974        dictionary = objj_msgSend(objj_msgSend(CPDictionary, "alloc"), "init");
1975    for (key in aDictionary._buckets)
1976        objj_msgSend(dictionary, "setObject:forKey:", objj_msgSend(aDictionary, "objectForKey:", key), key);
1977    return dictionary;
1978}
1979}), new objj_method(sel_getUid("initWithObjects:forKeys:"), function $CPDictionary__initWithObjects_forKeys_(self, _cmd, objects, keyArray)
1980{ with(self)
1981{
1982    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
1983    if (objj_msgSend(objects, "count") != objj_msgSend(keyArray, "count"))
1984        objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "Counts are different.("+objj_msgSend(objects, "count")+"!="+objj_msgSend(keyArray, "count")+")");
1985    if (self)
1986    {
1987        var i = objj_msgSend(keyArray, "count");
1988        while (i--)
1989            objj_msgSend(self, "setObject:forKey:", objects[i], keyArray[i]);
1990    }
1991    return self;
1992}
1993}), new objj_method(sel_getUid("initWithObjectsAndKeys:"), function $CPDictionary__initWithObjectsAndKeys_(self, _cmd, firstObject)
1994{ with(self)
1995{
1996    var argCount = arguments.length;
1997    if (argCount % 2 !== 0)
1998        objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "Key-value count is mismatched. (" + argCount + " arguments passed)");
1999    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
2000    if (self)
2001    {
2002        var index = 2;
2003        for(; index < argCount; index += 2)
2004        {
2005            var value = arguments[index];
2006            if (value === nil)
2007                break;
2008            objj_msgSend(self, "setObject:forKey:", value, arguments[index + 1]);
2009        }
2010    }
2011    return self;
2012}
2013}), new objj_method(sel_getUid("copy"), function $CPDictionary__copy(self, _cmd)
2014{ with(self)
2015{
2016    return objj_msgSend(CPDictionary, "dictionaryWithDictionary:", self);
2017}
2018}), new objj_method(sel_getUid("count"), function $CPDictionary__count(self, _cmd)
2019{ with(self)
2020{
2021    return count;
2022}
2023}), new objj_method(sel_getUid("allKeys"), function $CPDictionary__allKeys(self, _cmd)
2024{ with(self)
2025{
2026    return _keys;
2027}
2028}), new objj_method(sel_getUid("allValues"), function $CPDictionary__allValues(self, _cmd)
2029{ with(self)
2030{
2031    var index = _keys.length,
2032        values = [];
2033    while (index--)
2034        values.push(dictionary_getValue(self, [_keys[index]]));
2035    return values;
2036}
2037}), new objj_method(sel_getUid("keyEnumerator"), function $CPDictionary__keyEnumerator(self, _cmd)
2038{ with(self)
2039{
2040    return objj_msgSend(_keys, "objectEnumerator");
2041}
2042}), new objj_method(sel_getUid("objectEnumerator"), function $CPDictionary__objectEnumerator(self, _cmd)
2043{ with(self)
2044{
2045    return objj_msgSend(objj_msgSend(_CPDictionaryValueEnumerator, "alloc"), "initWithDictionary:", self);
2046}
2047}), new objj_method(sel_getUid("isEqualToDictionary:"), function $CPDictionary__isEqualToDictionary_(self, _cmd, aDictionary)
2048{ with(self)
2049{
2050    if (count !== objj_msgSend(aDictionary, "count"))
2051        return NO;
2052    var index = count;
2053    while (index--)
2054    {
2055        var currentKey = _keys[index],
2056            lhsObject = _buckets[currentKey],
2057            rhsObject = aDictionary._buckets[currentKey];
2058        if (lhsObject === rhsObject)
2059            continue;
2060        if (lhsObject.isa && rhsObject.isa && objj_msgSend(lhsObject, "respondsToSelector:", sel_getUid("isEqual:")) && objj_msgSend(lhsObject, "isEqual:", rhsObject))
2061            continue;
2062        return NO;
2063    }
2064    return YES;
2065}
2066}), new objj_method(sel_getUid("objectForKey:"), function $CPDictionary__objectForKey_(self, _cmd, aKey)
2067{ with(self)
2068{
2069    var object = _buckets[aKey];
2070    return (object === undefined) ? nil : object;
2071}
2072}), new objj_method(sel_getUid("removeAllObjects"), function $CPDictionary__removeAllObjects(self, _cmd)
2073{ with(self)
2074{
2075    _keys = [];
2076    count = 0;
2077    _buckets = {};
2078}
2079}), new objj_method(sel_getUid("removeObjectForKey:"), function $CPDictionary__removeObjectForKey_(self, _cmd, aKey)
2080{ with(self)
2081{
2082    dictionary_removeValue(self, aKey);
2083}
2084}), new objj_method(sel_getUid("removeObjectsForKeys:"), function $CPDictionary__removeObjectsForKeys_(self, _cmd, allKeys)
2085{ with(self)
2086{
2087    var index = allKeys.length;
2088    while (index--)
2089        dictionary_removeValue(self, allKeys[index]);
2090}
2091}), new objj_method(sel_getUid("setObject:forKey:"), function $CPDictionary__setObject_forKey_(self, _cmd, anObject, aKey)
2092{ with(self)
2093{
2094    dictionary_setValue(self, aKey, anObject);
2095}
2096}), new objj_method(sel_getUid("addEntriesFromDictionary:"), function $CPDictionary__addEntriesFromDictionary_(self, _cmd, aDictionary)
2097{ with(self)
2098{
2099    if (!aDictionary)
2100        return;
2101    var keys = objj_msgSend(aDictionary, "allKeys"),
2102        index = objj_msgSend(keys, "count");
2103    while (index--)
2104    {
2105        var key = keys[index];
2106        objj_msgSend(self, "setObject:forKey:", objj_msgSend(aDictionary, "objectForKey:", key), key);
2107    }
2108}
2109}), new objj_method(sel_getUid("description"), function $CPDictionary__description(self, _cmd)
2110{ with(self)
2111{
2112    var description = "CPDictionary {\n";
2113    var i = _keys.length;
2114    while (i--)
2115    {
2116        description += _keys[i] + ":";
2117        var object = _buckets[_keys[i]];
2118        if (object && object.isa)
2119            description += objj_msgSend(object, "description");
2120        else
2121            description += object;
2122        description += "\n";
2123    }
2124    description += "}";
2125    return description;
2126}
2127})]);
2128class_addMethods(meta_class, [new objj_method(sel_getUid("alloc"), function $CPDictionary__alloc(self, _cmd)
2129{ with(self)
2130{
2131    return new objj_dictionary();
2132}
2133}), new objj_method(sel_getUid("dictionary"), function $CPDictionary__dictionary(self, _cmd)
2134{ with(self)
2135{
2136    return objj_msgSend(objj_msgSend(self, "alloc"), "init");
2137}
2138}), new objj_method(sel_getUid("dictionaryWithDictionary:"), function $CPDictionary__dictionaryWithDictionary_(self, _cmd, aDictionary)
2139{ with(self)
2140{
2141    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithDictionary:", aDictionary);
2142}
2143}), new objj_method(sel_getUid("dictionaryWithObject:forKey:"), function $CPDictionary__dictionaryWithObject_forKey_(self, _cmd, anObject, aKey)
2144{ with(self)
2145{
2146    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithObjects:forKeys:", [anObject], [aKey]);
2147}
2148}), new objj_method(sel_getUid("dictionaryWithObjects:forKeys:"), function $CPDictionary__dictionaryWithObjects_forKeys_(self, _cmd, objects, keys)
2149{ with(self)
2150{
2151    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithObjects:forKeys:", objects, keys);
2152}
2153}), new objj_method(sel_getUid("dictionaryWithJSObject:"), function $CPDictionary__dictionaryWithJSObject_(self, _cmd, object)
2154{ with(self)
2155{
2156    return objj_msgSend(self, "dictionaryWithJSObject:recursively:", object, NO);
2157}
2158}), new objj_method(sel_getUid("dictionaryWithJSObject:recursively:"), function $CPDictionary__dictionaryWithJSObject_recursively_(self, _cmd, object, recursively)
2159{ with(self)
2160{
2161    var dictionary = objj_msgSend(objj_msgSend(self, "alloc"), "init");
2162    for (var key in object)
2163    {
2164        var value = object[key];
2165        if (recursively && value.constructor === Object)
2166            value = objj_msgSend(CPDictionary, "dictionaryWithJSObject:recursively:", value, YES);
2167        objj_msgSend(dictionary, "setObject:forKey:", value, key);
2168    }
2169    return dictionary;
2170}
2171}), new objj_method(sel_getUid("dictionaryWithObjectsAndKeys:"), function $CPDictionary__dictionaryWithObjectsAndKeys_(self, _cmd, firstObject)
2172{ with(self)
2173{
2174    arguments[0] = objj_msgSend(self, "alloc");
2175    arguments[1] = sel_getUid("initWithObjectsAndKeys:");
2176    return objj_msgSend.apply(this, arguments);
2177}
2178})]);
2179}
2180{
2181var the_class = objj_getClass("CPDictionary")
2182if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPDictionary\""));
2183var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $CPDictionary__initWithCoder_(self, _cmd, aCoder)
2184{ with(self)
2185{
2186    return objj_msgSend(aCoder, "_decodeDictionaryOfObjectsForKey:", "CP.objects");
2187}
2188}), new objj_method(sel_getUid("encodeWithCoder:"), function $CPDictionary__encodeWithCoder_(self, _cmd, aCoder)
2189{ with(self)
2190{
2191    objj_msgSend(aCoder, "_encodeDictionaryOfObjects:forKey:", self, "CP.objects");
2192}
2193})]);
2194}
2195{var the_class = objj_allocateClassPair(CPDictionary, "CPMutableDictionary"),
2196meta_class = the_class.isa;objj_registerClassPair(the_class);
2197objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
2198}
2199objj_dictionary.prototype.isa = CPDictionary;
2200
2201p;14;CPEnumerator.ji;10;CPObject.jc;500;
2202{var the_class = objj_allocateClassPair(CPObject, "CPEnumerator"),
2203meta_class = the_class.isa;objj_registerClassPair(the_class);
2204objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
2205class_addMethods(the_class, [new objj_method(sel_getUid("nextObject"), function $CPEnumerator__nextObject(self, _cmd)
2206{ with(self)
2207{
2208    return nil;
2209}
2210}), new objj_method(sel_getUid("allObjects"), function $CPEnumerator__allObjects(self, _cmd)
2211{ with(self)
2212{
2213    return [];
2214}
2215})]);
2216}
2217
2218p;13;CPException.ji;9;CPCoder.ji;10;CPObject.ji;10;CPString.jc;4340;
2219CPInvalidArgumentException = "CPInvalidArgumentException";
2220CPUnsupportedMethodException = "CPUnsupportedMethodException";
2221CPRangeException = "CPRangeException";
2222CPInternalInconsistencyException = "CPInternalInconsistencyException";
2223{var the_class = objj_allocateClassPair(CPObject, "CPException"),
2224meta_class = the_class.isa;objj_registerClassPair(the_class);
2225objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
2226class_addMethods(the_class, [new objj_method(sel_getUid("initWithName:reason:userInfo:"), function $CPException__initWithName_reason_userInfo_(self, _cmd, aName, aReason, aUserInfo)
2227{ with(self)
2228{
2229    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
2230    if (self)
2231    {
2232        name = aName;
2233        reason = aReason;
2234        userInfo = aUserInfo;
2235    }
2236    return self;
2237}
2238}), new objj_method(sel_getUid("name"), function $CPException__name(self, _cmd)
2239{ with(self)
2240{
2241    return name;
2242}
2243}), new objj_method(sel_getUid("reason"), function $CPException__reason(self, _cmd)
2244{ with(self)
2245{
2246    return reason;
2247}
2248}), new objj_method(sel_getUid("userInfo"), function $CPException__userInfo(self, _cmd)
2249{ with(self)
2250{
2251    return userInfo;
2252}
2253}), new objj_method(sel_getUid("description"), function $CPException__description(self, _cmd)
2254{ with(self)
2255{
2256    return reason;
2257}
2258}), new objj_method(sel_getUid("raise"), function $CPException__raise(self, _cmd)
2259{ with(self)
2260{
2261    objj_exception_throw(self);
2262}
2263})]);
2264class_addMethods(meta_class, [new objj_method(sel_getUid("alloc"), function $CPException__alloc(self, _cmd)
2265{ with(self)
2266{
2267    return new objj_exception();
2268}
2269}), new objj_method(sel_getUid("raise:reason:"), function $CPException__raise_reason_(self, _cmd, aName, aReason)
2270{ with(self)
2271{
2272    objj_msgSend(objj_msgSend(self, "exceptionWithName:reason:userInfo:", aName, aReason, nil), "raise");
2273}
2274}), new objj_method(sel_getUid("exceptionWithName:reason:userInfo:"), function $CPException__exceptionWithName_reason_userInfo_(self, _cmd, aName, aReason, aUserInfo)
2275{ with(self)
2276{
2277    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithName:reason:userInfo:", aName, aReason, aUserInfo);
2278}
2279})]);
2280}
2281{
2282var the_class = objj_getClass("CPException")
2283if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPException\""));
2284var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("copy"), function $CPException__copy(self, _cmd)
2285{ with(self)
2286{
2287    return objj_msgSend(objj_msgSend(self, "class"), "exceptionWithName:reason:userInfo:", name, reason, userInfo);
2288}
2289})]);
2290}
2291var CPExceptionNameKey = "CPExceptionNameKey",
2292    CPExceptionReasonKey = "CPExceptionReasonKey",
2293    CPExceptionUserInfoKey = "CPExceptionUserInfoKey";
2294{
2295var the_class = objj_getClass("CPException")
2296if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPException\""));
2297var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $CPException__initWithCoder_(self, _cmd, aCoder)
2298{ with(self)
2299{
2300    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
2301    if (self)
2302    {
2303        name = objj_msgSend(aCoder, "decodeObjectForKey:", CPExceptionNameKey);
2304        reason = objj_msgSend(aCoder, "decodeObjectForKey:", CPExceptionReasonKey);
2305        userInfo = objj_msgSend(aCoder, "decodeObjectForKey:", CPExceptionUserInfoKey);
2306    }
2307    return self;
2308}
2309}), new objj_method(sel_getUid("encodeWithCoder:"), function $CPException__encodeWithCoder_(self, _cmd, aCoder)
2310{ with(self)
2311{
2312    objj_msgSend(aCoder, "encodeObject:forKey:", name, CPExceptionNameKey);
2313    objj_msgSend(aCoder, "encodeObject:forKey:", reason, CPExceptionReasonKey);
2314    objj_msgSend(aCoder, "encodeObject:forKey:", userInfo, CPExceptionUserInfoKey);
2315}
2316})]);
2317}
2318objj_exception.prototype.isa = CPException;
2319objj_msgSend(CPException, "initialize");
2320_CPRaiseInvalidAbstractInvocation= function(anObject, aSelector)
2321{
2322    objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "*** -" + sel_getName(aSelector) + " cannot be sent to an abstract object of class " + objj_msgSend(anObject, "className") + ": Create a concrete instance!");
2323}
2324
2325p;12;CPIndexSet.ji;9;CPRange.ji;10;CPObject.jc;18435;
2326{var the_class = objj_allocateClassPair(CPObject, "CPIndexSet"),
2327meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_count"), new objj_ivar("_cachedRangeIndex"), new objj_ivar("_ranges")]);
2328objj_registerClassPair(the_class);
2329objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
2330class_addMethods(the_class, [new objj_method(sel_getUid("init"), function $CPIndexSet__init(self, _cmd)
2331{ with(self)
2332{
2333    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
2334    if (self)
2335    {
2336        _count = 0;
2337        _ranges = [];
2338        _cachedRangeIndex = 0;
2339    }
2340    return self;
2341}
2342}), new objj_method(sel_getUid("initWithIndex:"), function $CPIndexSet__initWithIndex_(self, _cmd, anIndex)
2343{ with(self)
2344{
2345    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
2346    if (self)
2347    {
2348        _count = 1;
2349        _ranges = objj_msgSend(CPArray, "arrayWithObject:", CPMakeRange(anIndex, 1));
2350        _cachedRangeIndex = 0;
2351    }
2352    return self;
2353}
2354}), new objj_method(sel_getUid("initWithIndexesInRange:"), function $CPIndexSet__initWithIndexesInRange_(self, _cmd, aRange)
2355{ with(self)
2356{
2357    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
2358    if (self)
2359    {
2360        _count = aRange.length;
2361        _ranges = objj_msgSend(CPArray, "arrayWithObject:", aRange);
2362        _cachedRangeIndex = 0;
2363    }
2364    return self;
2365}
2366}), new objj_method(sel_getUid("initWithIndexSet:"), function $CPIndexSet__initWithIndexSet_(self, _cmd, anIndexSet)
2367{ with(self)
2368{
2369    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
2370    if (self)
2371    {
2372        _count = objj_msgSend(anIndexSet, "count");
2373        _ranges = [];
2374        _cachedRangeIndex = 0;
2375        var index = 0,
2376            count = anIndexSet._ranges.length;
2377        for (; index < count; ++index)
2378            _ranges.push(CPCopyRange(anIndexSet._ranges[index]));
2379    }
2380    return self;
2381}
2382}), new objj_method(sel_getUid("isEqualToIndexSet:"), function $CPIndexSet__isEqualToIndexSet_(self, _cmd, anIndexSet)
2383{ with(self)
2384{
2385 if (self == anIndexSet)
2386    return YES;
2387    var i = 0,
2388        count = _ranges.length;
2389        otherRanges = anIndexSet._ranges;
2390 if (count != otherRanges.length || _count != objj_msgSend(anIndexSet, "count"))
2391    return NO;
2392 for (; i < count; ++i)
2393  if (!CPEqualRanges(_ranges[i], otherRanges[i]))
2394   return NO;
2395 return YES;
2396}
2397}), new objj_method(sel_getUid("containsIndex:"), function $CPIndexSet__containsIndex_(self, _cmd, anIndex)
2398{ with(self)
2399{
2400    return objj_msgSend(self, "containsIndexesInRange:", CPMakeRange(anIndex, 1));
2401}
2402}), new objj_method(sel_getUid("containsIndexesInRange:"), function $CPIndexSet__containsIndexesInRange_(self, _cmd, aRange)
2403{ with(self)
2404{
2405    if(!_count)
2406        return NO;
2407    var i = SOERangeIndex(self, aRange.location),
2408     lower = aRange.location,
2409     upper = CPMaxRange(aRange),
2410     count = _ranges.length;
2411    for(;i < count && _ranges[i].location < upper; ++i)
2412     if (_ranges[i].location <= lower && CPMaxRange(_ranges[i]) >= upper)
2413     {
2414            _cachedRangeIndex = i;
2415            return YES;
2416        }
2417    _cachedRangeIndex = i;
2418    return NO;
2419}
2420}), new objj_method(sel_getUid("containsIndexes:"), function $CPIndexSet__containsIndexes_(self, _cmd, anIndexSet)
2421{ with(self)
2422{
2423    if(!objj_msgSend(anIndexSet, "count"))
2424        return YES;
2425    if(!_count)
2426        return NO;
2427    var i = 0,
2428        count = _ranges.length;
2429    for(; i < count; ++i)
2430        if (!objj_msgSend(anIndexSet, "containsIndexesInRange:", _ranges[i]))
2431            return NO;
2432    return YES;
2433}
2434}), new objj_method(sel_getUid("intersectsIndexesInRange:"), function $CPIndexSet__intersectsIndexesInRange_(self, _cmd, aRange)
2435{ with(self)
2436{
2437    if(!_count)
2438        return NO;
2439    var i = SOERangeIndex(self, aRange.location),
2440        count = _ranges.length,
2441        upper = CPMaxRange(aRange);
2442    for (; i < count && _ranges[i].location < upper; ++i)
2443        if(CPIntersectionRange(aRange, _ranges[i]).length)
2444            return YES;
2445    return NO;
2446}
2447}), new objj_method(sel_getUid("count"), function $CPIndexSet__count(self, _cmd)
2448{ with(self)
2449{
2450    return _count;
2451}
2452}), new objj_method(sel_getUid("firstIndex"), function $CPIndexSet__firstIndex(self, _cmd)
2453{ with(self)
2454{
2455    return _count ? _ranges[0].location : CPNotFound;
2456}
2457}), new objj_method(sel_getUid("lastIndex"), function $CPIndexSet__lastIndex(self, _cmd)
2458{ with(self)
2459{
2460    return _count ? CPMaxRange(_ranges[_ranges.length - 1]) - 1 : CPNotFound;
2461}
2462}), new objj_method(sel_getUid("indexGreaterThanIndex:"), function $CPIndexSet__indexGreaterThanIndex_(self, _cmd, anIndex)
2463{ with(self)
2464{
2465    if(!_count)
2466        return CPNotFound;
2467    var i = SOERangeIndex(self, anIndex++),
2468        count = _ranges.length;
2469    for(; i < count && anIndex >= CPMaxRange(_ranges[i]); ++i) ;
2470    if (i == count)
2471        return CPNotFound;
2472    _cachedRangeIndex = i;
2473    if (anIndex < _ranges[i].location)
2474        return _ranges[i].location;
2475    return anIndex;
2476}
2477}), new objj_method(sel_getUid("indexLessThanIndex:"), function $CPIndexSet__indexLessThanIndex_(self, _cmd, anIndex)
2478{ with(self)
2479{
2480    if (!_count)
2481        return CPNotFound;
2482    var i = GOERangeIndex(self, anIndex--);
2483    for (; i >= 0 && anIndex < _ranges[i].location; --i) ;
2484    if(i < 0)
2485        return CPNotFound;
2486    _cachedRangeIndex = i;
2487   if (CPLocationInRange(anIndex, _ranges[i]))
2488        return anIndex;
2489    if (CPMaxRange(_ranges[i]) - 1 < anIndex)
2490        return CPMaxRange(_ranges[i]) - 1;
2491    return CPNotFound;
2492}
2493}), new objj_method(sel_getUid("indexGreaterThanOrEqualToIndex:"), function $CPIndexSet__indexGreaterThanOrEqualToIndex_(self, _cmd, anIndex)
2494{ with(self)
2495{
2496 return objj_msgSend(self, "indexGreaterThanIndex:", anIndex - 1);
2497}
2498}), new objj_method(sel_getUid("indexLessThanOrEqualToIndex:"), function $CPIndexSet__indexLessThanOrEqualToIndex_(self, _cmd, anIndex)
2499{ with(self)
2500{
2501 return objj_msgSend(self, "indexLessThanIndex:", anIndex + 1);
2502}
2503}), new objj_method(sel_getUid("getIndexes:maxCount:inIndexRange:"), function $CPIndexSet__getIndexes_maxCount_inIndexRange_(self, _cmd, anArray, aMaxCount, aRangePointer)
2504{ with(self)
2505{
2506    if (!_count || aMaxCount <= 0 || aRangePointer && !aRangePointer.length)
2507        return 0;
2508    var i = SOERangeIndex(self, aRangePointer? aRangePointer.location : 0),
2509        total = 0,
2510        count = _ranges.length;
2511    for (; i < count; ++i)
2512    {
2513        var intersection = aRangePointer ? CPIntersectionRange(_ranges[i], aRangePointer) : _ranges[i],
2514            index = intersection.location,
2515            maximum = CPMaxRange(intersection);
2516        for (; index < maximum; ++index)
2517        {
2518            anArray[total++] = index;
2519            if (total == aMaxCount)
2520            {
2521                if (aRangePointer)
2522                {
2523                    var upper = CPMaxRange(aRangePointer);
2524                    aRangePointer.location = index + 1;
2525                    aRangePointer.length = upper - index - 1;
2526                }
2527                return aMaxCount;
2528            }
2529        }
2530    }
2531    if (aRangePointer)
2532    {
2533        aRangePointer.location = CPNotFound;
2534        aRangePointer.length = 0;
2535    }
2536    return total;
2537}
2538}), new objj_method(sel_getUid("description"), function $CPIndexSet__description(self, _cmd)
2539{ with(self)
2540{
2541    var desc = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "description") + " ";
2542 if (_count)
2543 {
2544  desc += "[number of indexes: " + _count + " (in " + _ranges.length + " ranges), indexes: (";
2545  for (i = 0; i < _ranges.length; i++)
2546  {
2547   desc += _ranges[i].location;
2548   if (_ranges[i].length > 1) desc += "-" + (CPMaxRange(_ranges[i])-1) + ":"+_ranges[i].length+":";
2549   if (i+1 < _ranges.length) desc += " ";
2550  }
2551  desc += ")]";
2552 }
2553 else
2554  desc += "(no indexes)";
2555 return desc;
2556}
2557})]);
2558class_addMethods(meta_class, [new objj_method(sel_getUid("indexSet"), function $CPIndexSet__indexSet(self, _cmd)
2559{ with(self)
2560{
2561 return objj_msgSend(objj_msgSend(self, "alloc"), "init");
2562}
2563}), new objj_method(sel_getUid("indexSetWithIndex:"), function $CPIndexSet__indexSetWithIndex_(self, _cmd, anIndex)
2564{ with(self)
2565{
2566 return objj_msgSend(objj_msgSend(self, "alloc"), "initWithIndex:", anIndex);
2567}
2568}), new objj_method(sel_getUid("indexSetWithIndexesInRange:"), function $CPIndexSet__indexSetWithIndexesInRange_(self, _cmd, aRange)
2569{ with(self)
2570{
2571 return objj_msgSend(objj_msgSend(self, "alloc"), "initWithIndexesInRange:", aRange);
2572}
2573})]);
2574}
2575{
2576var the_class = objj_getClass("CPIndexSet")
2577if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPIndexSet\""));
2578var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("addIndex:"), function $CPIndexSet__addIndex_(self, _cmd, anIndex)
2579{ with(self)
2580{
2581    objj_msgSend(self, "addIndexesInRange:", CPMakeRange(anIndex, 1));
2582}
2583}), new objj_method(sel_getUid("addIndexes:"), function $CPIndexSet__addIndexes_(self, _cmd, anIndexSet)
2584{ with(self)
2585{
2586    var i = 0,
2587        ranges = anIndexSet._ranges,
2588        count = ranges.length;
2589    for(; i < count; ++i)
2590        objj_msgSend(self, "addIndexesInRange:", ranges[i]);
2591}
2592}), new objj_method(sel_getUid("addIndexesInRange:"), function $CPIndexSet__addIndexesInRange_(self, _cmd, aRange)
2593{ with(self)
2594{
2595    if (_ranges.length == 0)
2596    {
2597        _count = aRange.length;
2598        return objj_msgSend(_ranges, "addObject:", CPCopyRange(aRange));
2599    }
2600    var i = SOERangeIndex(self, aRange.location),
2601        count = _ranges.length,
2602        padded = CPMakeRange(aRange.location - 1, aRange.length + 2),
2603        maximum = CPMaxRange(aRange);
2604    if (count && CPMaxRange(_ranges[count - 1]) < aRange.location)
2605        objj_msgSend(_ranges, "addObject:", CPCopyRange(aRange));
2606    else
2607        for (; i < count; ++i)
2608        {
2609            if (maximum < _ranges[i].location)
2610            {
2611                _count += aRange.length;
2612                if (i < _cachedRangeIndex) ++_cachedRangeIndex;
2613                return objj_msgSend(_ranges, "insertObject:atIndex:", CPCopyRange(aRange), i);
2614            }
2615            if (CPIntersectionRange(_ranges[i], padded).length)
2616            {
2617                var union = CPUnionRange(_ranges[i], aRange);
2618                if (union.length == _ranges[i].length)
2619                    return;
2620                 ++union.length;
2621                var j = i;
2622                for(; j < count; ++j)
2623                    if(CPIntersectionRange(union, _ranges[j]).length)
2624                        _count -= _ranges[j].length;
2625                    else
2626                        break;
2627                --union.length;
2628                _ranges[i] = union;
2629                if (j - i - 1 > 0)
2630                {
2631                    var remove = CPMakeRange(i + 1, j - i - 1);
2632                    _ranges[i] = CPUnionRange(_ranges[i], _ranges[j - 1]);
2633                    objj_msgSend(_ranges, "removeObjectsInRange:", remove);
2634                    if (_cachedRangeIndex >= CPMaxRange(remove)) _cachedRangedIndex -= remove.length;
2635                    else if (CPLocationInRange(_cachedRangeIndex, remove)) _cachedRangeIndex = i;
2636                }
2637                _count += _ranges[i].length;
2638                return;
2639            }
2640        }
2641    _count += aRange.length;
2642}
2643}), new objj_method(sel_getUid("removeIndex:"), function $CPIndexSet__removeIndex_(self, _cmd, anIndex)
2644{ with(self)
2645{
2646    objj_msgSend(self, "removeIndexesInRange:", CPMakeRange(anIndex, 1));
2647}
2648}), new objj_method(sel_getUid("removeIndexes:"), function $CPIndexSet__removeIndexes_(self, _cmd, anIndexSet)
2649{ with(self)
2650{
2651    var i = 0,
2652        ranges = anIndexSet._ranges,
2653        count = ranges.length;
2654    for(; i < count; ++i)
2655        objj_msgSend(self, "removeIndexesInRange:", ranges[i]);
2656}
2657}), new objj_method(sel_getUid("removeAllIndexes"), function $CPIndexSet__removeAllIndexes(self, _cmd)
2658{ with(self)
2659{
2660    _ranges = [];
2661 _count = 0;
2662    _cachedRangeIndex = 0;
2663}
2664}), new objj_method(sel_getUid("removeIndexesInRange:"), function $CPIndexSet__removeIndexesInRange_(self, _cmd, aRange)
2665{ with(self)
2666{
2667    var i = SOERangeIndex(self, aRange.location),
2668        count = _ranges.length,
2669        maximum = CPMaxRange(aRange),
2670        removal = CPMakeRange(CPNotFound, 0);
2671    for (; i < count; ++i)
2672    {
2673        var range = _ranges[i];
2674        if (maximum < range.location)
2675            break;
2676        var intersection = CPIntersectionRange(range, aRange);
2677        if (!intersection.length)
2678            continue;
2679        else if (intersection.length == range.length)
2680        {
2681            if (removal.location == CPNotFound)
2682                removal = CPMakeRange(i, 1);
2683            else
2684                ++removal.length;
2685        }
2686        else if (intersection.location > range.location && CPMaxRange(intersection) < CPMaxRange(range))
2687        {
2688            var insert = CPMakeRange(CPMaxRange(intersection), CPMaxRange(range) - CPMaxRange(intersection));
2689            range.length = intersection.location - range.location;
2690            _count -= intersection.length;
2691            return objj_msgSend(_ranges, "insertObject:atIndex:", insert, i + 1);
2692        }
2693        else
2694        {
2695            range.length -= intersection.length;
2696            if (intersection.location <= range.location)
2697                range.location += intersection.length;
2698        }
2699        _count -= intersection.length;
2700    }
2701    if (removal.length)
2702        objj_msgSend(_ranges, "removeObjectsInRange:", removal);
2703}
2704}), new objj_method(sel_getUid("shiftIndexesStartingAtIndex:by:"), function $CPIndexSet__shiftIndexesStartingAtIndex_by_(self, _cmd, anIndex, aDelta)
2705{ with(self)
2706{
2707 if (!_count || aDelta == 0)
2708    return;
2709    var i = _ranges.length - 1,
2710        shifted = CPMakeRange(CPNotFound, 0);
2711    for(; i >= 0; --i)
2712    {
2713        var range = _ranges[i],
2714            maximum = CPMaxRange(range);
2715        if (anIndex > maximum)
2716            break;
2717        if (anIndex > range.location && anIndex < maximum)
2718        {
2719            shifted = CPMakeRange(anIndex + aDelta, maximum - anIndex);
2720            range.length = anIndex - range.location;
2721            if (aDelta > 0)
2722                objj_msgSend(_ranges, "insertObject:atIndex:", shifted, i + 1);
2723            else if (shifted.location < 0)
2724            {
2725                shifted.length = CPMaxRange(shifted);
2726                shifted.location = 0;
2727            }
2728            break;
2729        }
2730        if ((range.location += aDelta) < 0)
2731        {
2732            range.length = CPMaxRange(range);
2733            range.location = 0;
2734        }
2735    }
2736    if (aDelta < 0)
2737    {
2738        var j = i + 1,
2739            count = _ranges.length,
2740            shifts = [];
2741        for (; j < count; ++j)
2742            objj_msgSend(shifts, "addObject:", _ranges[j]);
2743        if ((j = i + 1) < count)
2744        {
2745            objj_msgSend(_ranges, "removeObjectsInRange:", CPMakeRange(j, count - j));
2746            for (j = 0, count = shifts.length; j < count; ++j)
2747                objj_msgSend(self, "addIndexesInRange:", shifts[j]);
2748        }
2749        if (shifted.location != CPNotFound)
2750            objj_msgSend(self, "addIndexesInRange:", shifted);
2751    }
2752}
2753})]);
2754}
2755var CPIndexSetCountKey = "CPIndexSetCountKey",
2756    CPIndexSetCachedRangeIndexKey = "CPIndexSetCachedRangeIndexKey",
2757    CPIndexSetRangeStringsKey = "CPIndexSetRangeStringsKey";
2758{
2759var the_class = objj_getClass("CPIndexSet")
2760if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPIndexSet\""));
2761var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $CPIndexSet__initWithCoder_(self, _cmd, aCoder)
2762{ with(self)
2763{
2764    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
2765    if (self)
2766    {
2767        _count = objj_msgSend(aCoder, "decodeIntForKey:", CPIndexSetCountKey);
2768        _cachedRangeIndex = objj_msgSend(aCoder, "decodeIntForKey:", CPIndexSetCachedRangeIndexKey);
2769        _ranges = [];
2770        var rangeStrings = objj_msgSend(aCoder, "decodeObjectForKey:", CPIndexSetRangeStringsKey),
2771            index = 0,
2772            count = rangeStrings.length;
2773        for (; index < count; ++index)
2774            _ranges.push(CPRangeFromString(rangeStrings[index]));
2775    }
2776    return self;
2777}
2778}), new objj_method(sel_getUid("encodeWithCoder:"), function $CPIndexSet__encodeWithCoder_(self, _cmd, aCoder)
2779{ with(self)
2780{
2781    objj_msgSend(aCoder, "encodeInt:forKey:", _count, CPIndexSetCountKey);
2782    objj_msgSend(aCoder, "encodeInt:forKey:", _cachedRangeIndex, CPIndexSetCachedRangeIndexKey);
2783    var index = 0,
2784        count = _ranges.length,
2785        rangeStrings = [];
2786    for (; index < count; ++index)
2787        rangeStrings[index] = CPStringFromRange(_ranges[index]);
2788    objj_msgSend(aCoder, "encodeObject:forKey:", rangeStrings, CPIndexSetRangeStringsKey);
2789}
2790})]);
2791}
2792{
2793var the_class = objj_getClass("CPIndexSet")
2794if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPIndexSet\""));
2795var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("copy"), function $CPIndexSet__copy(self, _cmd)
2796{ with(self)
2797{
2798    return objj_msgSend(objj_msgSend(objj_msgSend(self, "class"), "alloc"), "initWithIndexSet:", self);
2799}
2800}), new objj_method(sel_getUid("mutableCopy"), function $CPIndexSet__mutableCopy(self, _cmd)
2801{ with(self)
2802{
2803    return objj_msgSend(objj_msgSend(objj_msgSend(self, "class"), "alloc"), "initWithIndexSet:", self);
2804}
2805})]);
2806}
2807{var the_class = objj_allocateClassPair(CPIndexSet, "CPMutableIndexSet"),
2808meta_class = the_class.isa;objj_registerClassPair(the_class);
2809objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
2810}
2811var SOERangeIndex = function(anIndexSet, anIndex)
2812{
2813    var ranges = anIndexSet._ranges,
2814        cachedRangeIndex = 0;
2815    if(cachedRangeIndex < ranges.length && anIndex >= ranges[cachedRangeIndex].location)
2816        return cachedRangeIndex;
2817    return 0;
2818}
2819var GOERangeIndex = function(anIndexSet, anIndex)
2820{
2821    var ranges = anIndexSet._ranges,
2822        cachedRangeIndex = anIndexSet._ranges.length;
2823    if(cachedRangeIndex < ranges.length && anIndex <= ranges[cachedRangeIndex].location)
2824        return cachedRangeIndex;
2825    return ranges.length - 1;
2826}
2827
2828p;14;CPInvocation.ji;10;CPObject.ji;13;CPException.jc;3770;
2829{var the_class = objj_allocateClassPair(CPObject, "CPInvocation"),
2830meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_returnValue"), new objj_ivar("_arguments"), new objj_ivar("_methodSignature")]);
2831objj_registerClassPair(the_class);
2832objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
2833class_addMethods(the_class, [new objj_method(sel_getUid("initWithMethodSignature:"), function $CPInvocation__initWithMethodSignature_(self, _cmd, aMethodSignature)
2834{ with(self)
2835{
2836    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
2837    if (self)
2838    {
2839        _arguments = [];
2840        _methodSignature = aMethodSignature;
2841    }
2842    return self;
2843}
2844}), new objj_method(sel_getUid("setSelector:"), function $CPInvocation__setSelector_(self, _cmd, aSelector)
2845{ with(self)
2846{
2847    _arguments[1] = aSelector;
2848}
2849}), new objj_method(sel_getUid("selector"), function $CPInvocation__selector(self, _cmd)
2850{ with(self)
2851{
2852    return _arguments[1];
2853}
2854}), new objj_method(sel_getUid("setTarget:"), function $CPInvocation__setTarget_(self, _cmd, aTarget)
2855{ with(self)
2856{
2857    _arguments[0] = aTarget;
2858}
2859}), new objj_method(sel_getUid("target"), function $CPInvocation__target(self, _cmd)
2860{ with(self)
2861{
2862    return _arguments[0];
2863}
2864}), new objj_method(sel_getUid("setArgument:atIndex:"), function $CPInvocation__setArgument_atIndex_(self, _cmd, anArgument, anIndex)
2865{ with(self)
2866{
2867    _arguments[anIndex] = anArgument;
2868}
2869}), new objj_method(sel_getUid("argumentAtIndex:"), function $CPInvocation__argumentAtIndex_(self, _cmd, anIndex)
2870{ with(self)
2871{
2872    return _arguments[anIndex];
2873}
2874}), new objj_method(sel_getUid("setReturnValue:"), function $CPInvocation__setReturnValue_(self, _cmd, aReturnValue)
2875{ with(self)
2876{
2877    _returnValue = aReturnValue;
2878}
2879}), new objj_method(sel_getUid("returnValue"), function $CPInvocation__returnValue(self, _cmd)
2880{ with(self)
2881{
2882    return _returnValue;
2883}
2884}), new objj_method(sel_getUid("invoke"), function $CPInvocation__invoke(self, _cmd)
2885{ with(self)
2886{
2887    _returnValue = objj_msgSend.apply(objj_msgSend, _arguments);
2888}
2889}), new objj_method(sel_getUid("invokeWithTarget:"), function $CPInvocation__invokeWithTarget_(self, _cmd, aTarget)
2890{ with(self)
2891{
2892    _arguments[0] = aTarget;
2893    _returnValue = objj_msgSend.apply(objj_msgSend, _arguments);
2894}
2895})]);
2896class_addMethods(meta_class, [new objj_method(sel_getUid("invocationWithMethodSignature:"), function $CPInvocation__invocationWithMethodSignature_(self, _cmd, aMethodSignature)
2897{ with(self)
2898{
2899    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithMethodSignature:", aMethodSignature);
2900}
2901})]);
2902}
2903var CPInvocationArguments = "CPInvocationArguments",
2904    CPInvocationReturnValue = "CPInvocationReturnValue";
2905{
2906var the_class = objj_getClass("CPInvocation")
2907if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPInvocation\""));
2908var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $CPInvocation__initWithCoder_(self, _cmd, aCoder)
2909{ with(self)
2910{
2911    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
2912    if (self)
2913    {
2914        _returnValue = objj_msgSend(aCoder, "decodeObjectForKey:", CPInvocationReturnValue);
2915        _arguments = objj_msgSend(aCoder, "decodeObjectForKey:", CPInvocationArguments);
2916    }
2917    return self;
2918}
2919}), new objj_method(sel_getUid("encodeWithCoder:"), function $CPInvocation__encodeWithCoder_(self, _cmd, aCoder)
2920{ with(self)
2921{
2922    objj_msgSend(aCoder, "encodeObject:forKey:", _returnValue, CPInvocationReturnValue);
2923    objj_msgSend(aCoder, "encodeObject:forKey:", _arguments, CPInvocationArguments);
2924}
2925})]);
2926}
2927
2928p;19;CPJSONPConnection.jI;21;Foundation/CPObject.jc;3725;
2929CPJSONPConnectionCallbacks = {};
2930{var the_class = objj_allocateClassPair(CPObject, "CPJSONPConnection"),
2931meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_request"), new objj_ivar("_delegate"), new objj_ivar("_callbackParameter"), new objj_ivar("_scriptTag")]);
2932objj_registerClassPair(the_class);
2933objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
2934class_addMethods(the_class, [new objj_method(sel_getUid("initWithRequest:callback:delegate:"), function $CPJSONPConnection__initWithRequest_callback_delegate_(self, _cmd, aRequest, aString, aDelegate)
2935{ with(self)
2936{
2937    return objj_msgSend(self, "initWithRequest:callback:delegate:startImmediately:", aRequest, aString, aDelegate,  NO);
2938}
2939}), new objj_method(sel_getUid("initWithRequest:callback:delegate:startImmediately:"), function $CPJSONPConnection__initWithRequest_callback_delegate_startImmediately_(self, _cmd, aRequest, aString, aDelegate, shouldStartImmediately)
2940{ with(self)
2941{
2942    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
2943    _request = aRequest;
2944    _delegate = aDelegate;
2945    _callbackParameter = aString;
2946    CPJSONPConnectionCallbacks["callback"+objj_msgSend(self, "hash")] = function(data)
2947    {
2948        objj_msgSend(_delegate, "connection:didReceiveData:", self, data);
2949        objj_msgSend(self, "removeScriptTag");
2950        objj_msgSend(objj_msgSend(CPRunLoop, "currentRunLoop"), "limitDateForMode:", CPDefaultRunLoopMode);
2951    };
2952    if(shouldStartImmediately)
2953        objj_msgSend(self, "start");
2954    return self;
2955}
2956}), new objj_method(sel_getUid("start"), function $CPJSONPConnection__start(self, _cmd)
2957{ with(self)
2958{
2959    try
2960    {
2961        var head = document.getElementsByTagName("head").item(0);
2962        var source = objj_msgSend(_request, "URL");
2963        source += (source.indexOf('?') < 0) ? "?" : "&";
2964        source += _callbackParameter+"=CPJSONPConnectionCallbacks.callback"+objj_msgSend(self, "hash");
2965        _scriptTag = document.createElement("script");
2966        _scriptTag.setAttribute("type", "text/javascript");
2967        _scriptTag.setAttribute("charset", "utf-8");
2968        _scriptTag.setAttribute("src", source);
2969        head.appendChild(_scriptTag);
2970    }
2971    catch (exception)
2972    {
2973        objj_msgSend(_delegate, "connection:didFailWithError:",  self,  exception);
2974        objj_msgSend(self, "removeScriptTag");
2975    }
2976}
2977}), new objj_method(sel_getUid("removeScriptTag"), function $CPJSONPConnection__removeScriptTag(self, _cmd)
2978{ with(self)
2979{
2980    var head = document.getElementsByTagName("head").item(0);
2981    if(_scriptTag.parentNode == head)
2982        head.removeChild(_scriptTag);
2983    CPJSONPConnectionCallbacks["callback"+objj_msgSend(self, "hash")] = nil;
2984    delete CPJSONPConnectionCallbacks["callback"+objj_msgSend(self, "hash")];
2985}
2986}), new objj_method(sel_getUid("cancel"), function $CPJSONPConnection__cancel(self, _cmd)
2987{ with(self)
2988{
2989    objj_msgSend(self, "removeScriptTag");
2990}
2991})]);
2992class_addMethods(meta_class, [new objj_method(sel_getUid("sendRequest:callback:delegate:"), function $CPJSONPConnection__sendRequest_callback_delegate_(self, _cmd, aRequest, callbackParameter, aDelegate)
2993{ with(self)
2994{
2995    return objj_msgSend(self, "connectionWithRequest:callback:delegate:", aRequest, callbackParameter, aDelegate);
2996}
2997}), new objj_method(sel_getUid("connectionWithRequest:callback:delegate:"), function $CPJSONPConnection__connectionWithRequest_callback_delegate_(self, _cmd, aRequest, callbackParameter, aDelegate)
2998{ with(self)
2999{
3000    return objj_msgSend(objj_msgSend(objj_msgSend(self, "class"), "alloc"), "initWithRequest:callback:delegate:startImmediately:", aRequest, callbackParameter, aDelegate, YES);;
3001}
3002})]);
3003}
3004
3005p;17;CPKeyedArchiver.ji;8;CPData.ji;9;CPCoder.ji;9;CPArray.ji;10;CPString.ji;10;CPNumber.ji;14;CPDictionary.ji;9;CPValue.jc;16071;
3006var CPArchiverReplacementClassNames = nil;
3007var _CPKeyedArchiverDidEncodeObjectSelector = 1,
3008    _CPKeyedArchiverWillEncodeObjectSelector = 2,
3009    _CPKeyedArchiverWillReplaceObjectWithObjectSelector = 4,
3010    _CPKeyedArchiverDidFinishSelector = 8,
3011    _CPKeyedArchiverWillFinishSelector = 16;
3012var _CPKeyedArchiverNullString = "$null",
3013    _CPKeyedArchiverNullReference = nil,
3014    _CPKeyedArchiverUIDKey = "CP$UID",
3015    _CPKeyedArchiverTopKey = "$top",
3016    _CPKeyedArchiverObjectsKey = "$objects",
3017    _CPKeyedArchiverArchiverKey = "$archiver",
3018    _CPKeyedArchiverVersionKey = "$version",
3019    _CPKeyedArchiverClassNameKey = "$classname",
3020    _CPKeyedArchiverClassesKey = "$classes",
3021    _CPKeyedArchiverClassKey = "$class";
3022var _CPKeyedArchiverStringClass = Nil,
3023    _CPKeyedArchiverNumberClass = Nil;
3024{var the_class = objj_allocateClassPair(CPValue, "_CPKeyedArchiverValue"),
3025meta_class = the_class.isa;objj_registerClassPair(the_class);
3026objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
3027}
3028{var the_class = objj_allocateClassPair(CPCoder, "CPKeyedArchiver"),
3029meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_delegate"), new objj_ivar("_delegateSelectors"), new objj_ivar("_data"), new objj_ivar("_objects"), new objj_ivar("_UIDs"), new objj_ivar("_conditionalUIDs"), new objj_ivar("_replacementObjects"), new objj_ivar("_replacementClassNames"), new objj_ivar("_plistObject"), new objj_ivar("_plistObjects"), new objj_ivar("_outputFormat")]);
3030objj_registerClassPair(the_class);
3031objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
3032class_addMethods(the_class, [new objj_method(sel_getUid("initForWritingWithMutableData:"), function $CPKeyedArchiver__initForWritingWithMutableData_(self, _cmd, data)
3033{ with(self)
3034{
3035    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPCoder") }, "init");
3036    if (self)
3037    {
3038        _data = data;
3039        _objects = [];
3040        _UIDs = objj_msgSend(CPDictionary, "dictionary");
3041        _conditionalUIDs = objj_msgSend(CPDictionary, "dictionary");
3042        _replacementObjects = objj_msgSend(CPDictionary, "dictionary");
3043        _data = data;
3044        _plistObject = objj_msgSend(CPDictionary, "dictionary");
3045        _plistObjects = objj_msgSend(CPArray, "arrayWithObject:", _CPKeyedArchiverNullString);
3046    }
3047    return self;
3048}
3049}), new objj_method(sel_getUid("finishEncoding"), function $CPKeyedArchiver__finishEncoding(self, _cmd)
3050{ with(self)
3051{
3052    if (_delegate && _delegateSelectors & _CPKeyedArchiverWillFinishSelector)
3053        objj_msgSend(_delegate, "archiverWillFinish:", self);
3054    var i = 0,
3055        topObject = _plistObject,
3056        classes = [];
3057    for (; i < _objects.length; ++i)
3058    {
3059        var object = _objects[i],
3060            theClass = objj_msgSend(object, "classForKeyedArchiver");
3061        _plistObject = _plistObjects[objj_msgSend(_UIDs, "objectForKey:", objj_msgSend(object, "hash"))];
3062        objj_msgSend(object, "encodeWithCoder:", self);
3063        if (_delegate && _delegateSelectors & _CPKeyedArchiverDidEncodeObjectSelector)
3064            objj_msgSend(_delegate, "archiver:didEncodeObject:", self, object);
3065    }
3066    _plistObject = objj_msgSend(CPDictionary, "dictionary");
3067    objj_msgSend(_plistObject, "setObject:forKey:", topObject, _CPKeyedArchiverTopKey);
3068    objj_msgSend(_plistObject, "setObject:forKey:", _plistObjects, _CPKeyedArchiverObjectsKey);
3069    objj_msgSend(_plistObject, "setObject:forKey:", objj_msgSend(self, "className"), _CPKeyedArchiverArchiverKey);
3070    objj_msgSend(_plistObject, "setObject:forKey:", "100000", _CPKeyedArchiverVersionKey);
3071    objj_msgSend(_data, "setPlistObject:", _plistObject);
3072    if (_delegate && _delegateSelectors & _CPKeyedArchiverDidFinishSelector)
3073        objj_msgSend(_delegate, "archiverDidFinish:", self);
3074}
3075}), new objj_method(sel_getUid("outputFormat"), function $CPKeyedArchiver__outputFormat(self, _cmd)
3076{ with(self)
3077{
3078    return _outputFormat;
3079}
3080}), new objj_method(sel_getUid("setOutputFormat:"), function $CPKeyedArchiver__setOutputFormat_(self, _cmd, aPropertyListFormat)
3081{ with(self)
3082{
3083    _outputFormat = aPropertyListFormat;
3084}
3085}), new objj_method(sel_getUid("encodeBool:forKey:"), function $CPKeyedArchiver__encodeBool_forKey_(self, _cmd, aBOOL, aKey)
3086{ with(self)
3087{
3088    objj_msgSend(_plistObject, "setObject:forKey:", _CPKeyedArchiverEncodeObject(self, aBOOL, NO), aKey);
3089}
3090}), new objj_method(sel_getUid("encodeDouble:forKey:"), function $CPKeyedArchiver__encodeDouble_forKey_(self, _cmd, aDouble, aKey)
3091{ with(self)
3092{
3093    objj_msgSend(_plistObject, "setObject:forKey:", _CPKeyedArchiverEncodeObject(self, aDouble, NO), aKey);
3094}
3095}), new objj_method(sel_getUid("encodeFloat:forKey:"), function $CPKeyedArchiver__encodeFloat_forKey_(self, _cmd, aFloat, aKey)
3096{ with(self)
3097{
3098    objj_msgSend(_plistObject, "setObject:forKey:", _CPKeyedArchiverEncodeObject(self, aFloat, NO), aKey);
3099}
3100}), new objj_method(sel_getUid("encodeInt:forKey:"), function $CPKeyedArchiver__encodeInt_forKey_(self, _cmd, anInt, aKey)
3101{ with(self)
3102{
3103    objj_msgSend(_plistObject, "setObject:forKey:", _CPKeyedArchiverEncodeObject(self, anInt, NO), aKey);
3104}
3105}), new objj_method(sel_getUid("setDelegate:"), function $CPKeyedArchiver__setDelegate_(self, _cmd, aDelegate)
3106{ with(self)
3107{
3108    _delegate = aDelegate;
3109    if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("archiver:didEncodeObject:")))
3110        _delegateSelectors |= _CPKeyedArchiverDidEncodeObjectSelector;
3111    if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("archiver:willEncodeObject:")))
3112        _delegateSelectors |= _CPKeyedArchiverWillEncodeObjectSelector;
3113    if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("archiver:willReplaceObject:withObject:")))
3114        _delegateSelectors |= _CPKeyedArchiverWillReplaceObjectWithObjectSelector;
3115    if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("archiver:didFinishEncoding:")))
3116        _delegateSelectors |= _CPKeyedArchiverDidFinishEncodingSelector;
3117    if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("archiver:willFinishEncoding:")))
3118        _delegateSelectors |= _CPKeyedArchiverWillFinishEncodingSelector;
3119}
3120}), new objj_method(sel_getUid("delegate"), function $CPKeyedArchiver__delegate(self, _cmd)
3121{ with(self)
3122{
3123    return _delegate;
3124}
3125}), new objj_method(sel_getUid("encodePoint:forKey:"), function $CPKeyedArchiver__encodePoint_forKey_(self, _cmd, aPoint, aKey)
3126{ with(self)
3127{
3128    objj_msgSend(_plistObject, "setObject:forKey:", _CPKeyedArchiverEncodeObject(self, CPStringFromPoint(aPoint), NO), aKey);
3129}
3130}), new objj_method(sel_getUid("encodeRect:forKey:"), function $CPKeyedArchiver__encodeRect_forKey_(self, _cmd, aRect, aKey)
3131{ with(self)
3132{
3133    objj_msgSend(_plistObject, "setObject:forKey:", _CPKeyedArchiverEncodeObject(self, CPStringFromRect(aRect), NO), aKey);
3134}
3135}), new objj_method(sel_getUid("encodeSize:forKey:"), function $CPKeyedArchiver__encodeSize_forKey_(self, _cmd, aSize, aKey)
3136{ with(self)
3137{
3138    objj_msgSend(_plistObject, "setObject:forKey:", _CPKeyedArchiverEncodeObject(self, CPStringFromSize(aSize), NO), aKey);
3139}
3140}), new objj_method(sel_getUid("encodeConditionalObject:forKey:"), function $CPKeyedArchiver__encodeConditionalObject_forKey_(self, _cmd, anObject, aKey)
3141{ with(self)
3142{
3143    objj_msgSend(_plistObject, "setObject:forKey:", _CPKeyedArchiverEncodeObject(self, anObject, YES), aKey);
3144}
3145}), new objj_method(sel_getUid("encodeNumber:forKey:"), function $CPKeyedArchiver__encodeNumber_forKey_(self, _cmd, aNumber, aKey)
3146{ with(self)
3147{
3148    objj_msgSend(_plistObject, "setObject:forKey:", _CPKeyedArchiverEncodeObject(self, aNumber, NO), aKey);
3149}
3150}), new objj_method(sel_getUid("encodeObject:forKey:"), function $CPKeyedArchiver__encodeObject_forKey_(self, _cmd, anObject, aKey)
3151{ with(self)
3152{
3153    objj_msgSend(_plistObject, "setObject:forKey:", _CPKeyedArchiverEncodeObject(self, anObject, NO), aKey);
3154}
3155}), new objj_method(sel_getUid("_encodeArrayOfObjects:forKey:"), function $CPKeyedArchiver___encodeArrayOfObjects_forKey_(self, _cmd, objects, aKey)
3156{ with(self)
3157{
3158    var i = 0,
3159        count = objects.length,
3160        references = objj_msgSend(CPArray, "arrayWithCapacity:", count);
3161    for (; i < count; ++i)
3162        objj_msgSend(references, "addObject:", _CPKeyedArchiverEncodeObject(self, objects[i], NO));
3163    objj_msgSend(_plistObject, "setObject:forKey:", references, aKey);
3164}
3165}), new objj_method(sel_getUid("_encodeDictionaryOfObjects:forKey:"), function $CPKeyedArchiver___encodeDictionaryOfObjects_forKey_(self, _cmd, aDictionary, aKey)
3166{ with(self)
3167{
3168    var key,
3169        keys = objj_msgSend(aDictionary, "keyEnumerator"),
3170        references = objj_msgSend(CPDictionary, "dictionary");
3171    while (key = objj_msgSend(keys, "nextObject"))
3172        objj_msgSend(references, "setObject:forKey:", _CPKeyedArchiverEncodeObject(self, objj_msgSend(aDictionary, "objectForKey:", key), NO), key);
3173    objj_msgSend(_plistObject, "setObject:forKey:", references, aKey);
3174}
3175}), new objj_method(sel_getUid("setClassName:forClass:"), function $CPKeyedArchiver__setClassName_forClass_(self, _cmd, aClassName, aClass)
3176{ with(self)
3177{
3178    if (!_replacementClassNames)
3179        _replacementClassNames = objj_msgSend(CPDictionary, "dictionary");
3180    objj_msgSend(_replacementClassNames, "setObject:forKey:", aClassName, CPStringFromClass(aClass));
3181}
3182}), new objj_method(sel_getUid("classNameForClass:"), function $CPKeyedArchiver__classNameForClass_(self, _cmd, aClass)
3183{ with(self)
3184{
3185    if (!_replacementClassNames)
3186        return aClass.name;
3187    var className = objj_msgSend(_replacementClassNames, "objectForKey:", CPStringFromClass(aClassName));
3188    return className ? className : aClass.name;
3189}
3190})]);
3191class_addMethods(meta_class, [new objj_method(sel_getUid("initialize"), function $CPKeyedArchiver__initialize(self, _cmd)
3192{ with(self)
3193{
3194    if (self != objj_msgSend(CPKeyedArchiver, "class"))
3195        return;
3196    _CPKeyedArchiverStringClass = objj_msgSend(CPString, "class");
3197    _CPKeyedArchiverNumberClass = objj_msgSend(CPNumber, "class");
3198    _CPKeyedArchiverNullReference = objj_msgSend(CPDictionary, "dictionaryWithObject:forKey:", 0, _CPKeyedArchiverUIDKey);
3199}
3200}), new objj_method(sel_getUid("allowsKeyedCoding"), function $CPKeyedArchiver__allowsKeyedCoding(self, _cmd)
3201{ with(self)
3202{
3203    return YES;
3204}
3205}), new objj_method(sel_getUid("archivedDataWithRootObject:"), function $CPKeyedArchiver__archivedDataWithRootObject_(self, _cmd, anObject)
3206{ with(self)
3207{
3208    var data = objj_msgSend(CPData, "dataWithPlistObject:", nil),
3209        archiver = objj_msgSend(objj_msgSend(self, "alloc"), "initForWritingWithMutableData:", data);
3210    objj_msgSend(archiver, "encodeObject:forKey:", anObject, "root");
3211    objj_msgSend(archiver, "finishEncoding");
3212    return data;
3213}
3214}), new objj_method(sel_getUid("setClassName:forClass:"), function $CPKeyedArchiver__setClassName_forClass_(self, _cmd, aClassName, aClass)
3215{ with(self)
3216{
3217    if (!CPArchiverReplacementClassNames)
3218        CPArchiverReplacementClassNames = objj_msgSend(CPDictionary, "dictionary");
3219    objj_msgSend(CPArchiverReplacementClassNames, "setObject:forKey:", aClassName, CPStringFromClass(aClass));
3220}
3221}), new objj_method(sel_getUid("classNameForClass:"), function $CPKeyedArchiver__classNameForClass_(self, _cmd, aClass)
3222{ with(self)
3223{
3224    if (!CPArchiverReplacementClassNames)
3225        return aClass.name;
3226    var className = objj_msgSend(CPArchiverReplacementClassNames, "objectForKey:", CPStringFromClass(aClassName));
3227    return className ? className : aClass.name;
3228}
3229})]);
3230}
3231var _CPKeyedArchiverEncodeObject = function(self, anObject, isConditional)
3232{
3233    if (anObject !== nil && !anObject.isa)
3234        anObject = objj_msgSend(_CPKeyedArchiverValue, "valueWithJSObject:", anObject);
3235    var hash = objj_msgSend(anObject, "hash"),
3236        object = objj_msgSend(self._replacementObjects, "objectForKey:", hash);
3237    if (object === nil)
3238    {
3239        object = objj_msgSend(anObject, "replacementObjectForKeyedArchiver:", self);
3240        if (self._delegate)
3241        {
3242            if (object !== anObject && self._delegateSelectors & _CPKeyedArchiverWillReplaceObjectWithObjectSelector)
3243                objj_msgSend(self._delegate, "archiver:willReplaceObject:withObject:", self, anObject, object);
3244            if (self._delegateSelectors & _CPKeyedArchiverWillEncodeObjectSelector)
3245            {
3246                anObject = objj_msgSend(self._delegate, "archiver:willEncodeObject:", self, object);
3247                if (anObject !== object && self._delegateSelectors & _CPKeyedArchiverWillReplaceObjectWithObjectSelector)
3248                    objj_msgSend(self._delegate, "archiver:willReplaceObject:withObject:", self, object, anObject);
3249                object = anObject;
3250            }
3251        }
3252        objj_msgSend(self._replacementObjects, "setObject:forKey:", object, hash);
3253    }
3254    if (object === nil)
3255        return _CPKeyedArchiverNullReference;
3256    var UID = objj_msgSend(self._UIDs, "objectForKey:", hash = objj_msgSend(object, "hash"));
3257    if (UID === nil)
3258    {
3259        if (isConditional)
3260        {
3261            if ((UID = objj_msgSend(self._conditionalUIDs, "objectForKey:", hash)) === nil)
3262            {
3263                objj_msgSend(self._conditionalUIDs, "setObject:forKey:", UID = objj_msgSend(self._plistObjects, "count"), hash);
3264                objj_msgSend(self._plistObjects, "addObject:", _CPKeyedArchiverNullString);
3265            }
3266        }
3267        else
3268        {
3269            var theClass = objj_msgSend(object, "classForKeyedArchiver"),
3270                plistObject = nil;
3271            if ((theClass === _CPKeyedArchiverStringClass) || (theClass === _CPKeyedArchiverNumberClass))
3272                plistObject = object;
3273            else
3274            {
3275                plistObject = objj_msgSend(CPDictionary, "dictionary");
3276                objj_msgSend(self._objects, "addObject:", object);
3277                var className = objj_msgSend(self, "classNameForClass:", theClass);
3278                if (!className)
3279                    className = objj_msgSend(objj_msgSend(self, "class"), "classNameForClass:", theClass);
3280                if (!className)
3281                    className = theClass.name;
3282                else
3283                    theClass = window[className];
3284                var classUID = objj_msgSend(self._UIDs, "objectForKey:", className);
3285                if (!classUID)
3286                {
3287                    var plistClass = objj_msgSend(CPDictionary, "dictionary"),
3288                        hierarchy = [];
3289                    objj_msgSend(plistClass, "setObject:forKey:", className, _CPKeyedArchiverClassNameKey);
3290                    do
3291                    {
3292                        objj_msgSend(hierarchy, "addObject:", CPStringFromClass(theClass));
3293                    } while (theClass = objj_msgSend(theClass, "superclass"));
3294                    objj_msgSend(plistClass, "setObject:forKey:", hierarchy, _CPKeyedArchiverClassesKey);
3295                    classUID = objj_msgSend(self._plistObjects, "count");
3296                    objj_msgSend(self._plistObjects, "addObject:", plistClass);
3297                    objj_msgSend(self._UIDs, "setObject:forKey:", classUID, className);
3298                }
3299                objj_msgSend(plistObject, "setObject:forKey:", objj_msgSend(CPDictionary, "dictionaryWithObject:forKey:", classUID, _CPKeyedArchiverUIDKey), _CPKeyedArchiverClassKey);
3300            }
3301            UID = objj_msgSend(self._conditionalUIDs, "objectForKey:", hash);
3302            if (UID !== nil)
3303            {
3304                objj_msgSend(self._UIDs, "setObject:forKey:", UID, hash);
3305                objj_msgSend(self._plistObjects, "replaceObjectAtIndex:withObject:", UID, plistObject);
3306            }
3307            else
3308            {
3309                objj_msgSend(self._UIDs, "setObject:forKey:", UID = objj_msgSend(self._plistObjects, "count"), hash);
3310                objj_msgSend(self._plistObjects, "addObject:", plistObject);
3311            }
3312        }
3313    }
3314    return objj_msgSend(CPDictionary, "dictionaryWithObject:forKey:", UID, _CPKeyedArchiverUIDKey);
3315}
3316
3317p;19;CPKeyedUnarchiver.ji;8;CPNull.ji;9;CPCoder.jc;13014;
3318var _CPKeyedUnarchiverCannotDecodeObjectOfClassNameOriginalClassesSelector = 1,
3319    _CPKeyedUnarchiverDidDecodeObjectSelector = 1 << 1,
3320    _CPKeyedUnarchiverWillReplaceObjectWithObjectSelector = 1 << 2,
3321    _CPKeyedUnarchiverWillFinishSelector = 1 << 3,
3322    _CPKeyedUnarchiverDidFinishSelector = 1 << 4;
3323var _CPKeyedArchiverNullString = "$null"
3324    _CPKeyedArchiverUIDKey = "CP$UID",
3325    _CPKeyedArchiverTopKey = "$top",
3326    _CPKeyedArchiverObjectsKey = "$objects",
3327    _CPKeyedArchiverArchiverKey = "$archiver",
3328    _CPKeyedArchiverVersionKey = "$version",
3329    _CPKeyedArchiverClassNameKey = "$classname",
3330    _CPKeyedArchiverClassesKey = "$classes",
3331    _CPKeyedArchiverClassKey = "$class";
3332var _CPKeyedUnarchiverArrayClass = Nil,
3333    _CPKeyedUnarchiverStringClass = Nil,
3334    _CPKeyedUnarchiverDictionaryClass = Nil,
3335    _CPKeyedUnarchiverNumberClass = Nil,
3336    _CPKeyedUnarchiverDataClass = Nil,
3337    _CPKeyedUnarchiverArchiverValueClass = Nil;
3338{var the_class = objj_allocateClassPair(CPCoder, "CPKeyedUnarchiver"),
3339meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_delegate"), new objj_ivar("_delegateSelectors"), new objj_ivar("_data"), new objj_ivar("_replacementClasses"), new objj_ivar("_objects"), new objj_ivar("_archive"), new objj_ivar("_plistObject"), new objj_ivar("_plistObjects")]);
3340objj_registerClassPair(the_class);
3341objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
3342class_addMethods(the_class, [new objj_method(sel_getUid("initForReadingWithData:"), function $CPKeyedUnarchiver__initForReadingWithData_(self, _cmd, data)
3343{ with(self)
3344{
3345    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPCoder") }, "init");
3346    if (self)
3347    {
3348        _archive = objj_msgSend(data, "plistObject");
3349        _objects = objj_msgSend(CPArray, "arrayWithObject:", objj_msgSend(CPNull, "null"));
3350        _plistObject = objj_msgSend(_archive, "objectForKey:", _CPKeyedArchiverTopKey);
3351        _plistObjects = objj_msgSend(_archive, "objectForKey:", _CPKeyedArchiverObjectsKey);
3352        _replacementClasses = objj_msgSend(CPDictionary, "dictionary");
3353    }
3354    return self;
3355}
3356}), new objj_method(sel_getUid("containsValueForKey:"), function $CPKeyedUnarchiver__containsValueForKey_(self, _cmd, aKey)
3357{ with(self)
3358{
3359    return objj_msgSend(_plistObject, "objectForKey:", aKey) != nil;
3360}
3361}), new objj_method(sel_getUid("_decodeDictionaryOfObjectsForKey:"), function $CPKeyedUnarchiver___decodeDictionaryOfObjectsForKey_(self, _cmd, aKey)
3362{ with(self)
3363{
3364    var object = objj_msgSend(_plistObject, "objectForKey:", aKey);
3365    if (objj_msgSend(object, "isKindOfClass:", _CPKeyedUnarchiverDictionaryClass))
3366    {
3367        var key,
3368            keys = objj_msgSend(object, "keyEnumerator"),
3369            dictionary = objj_msgSend(CPDictionary, "dictionary");
3370        while (key = objj_msgSend(keys, "nextObject"))
3371            objj_msgSend(dictionary, "setObject:forKey:", _CPKeyedUnarchiverDecodeObjectAtIndex(self, objj_msgSend(objj_msgSend(object, "objectForKey:", key), "objectForKey:", _CPKeyedArchiverUIDKey)), key);
3372        return dictionary;
3373    }
3374    return nil;
3375}
3376}), new objj_method(sel_getUid("decodeBoolForKey:"), function $CPKeyedUnarchiver__decodeBoolForKey_(self, _cmd, aKey)
3377{ with(self)
3378{
3379    return objj_msgSend(self, "decodeObjectForKey:", aKey);
3380}
3381}), new objj_method(sel_getUid("decodeFloatForKey:"), function $CPKeyedUnarchiver__decodeFloatForKey_(self, _cmd, aKey)
3382{ with(self)
3383{
3384    return objj_msgSend(self, "decodeObjectForKey:", aKey);
3385}
3386}), new objj_method(sel_getUid("decodeDoubleForKey:"), function $CPKeyedUnarchiver__decodeDoubleForKey_(self, _cmd, aKey)
3387{ with(self)
3388{
3389    return objj_msgSend(self, "decodeObjectForKey:", aKey);
3390}
3391}), new objj_method(sel_getUid("decodeIntForKey:"), function $CPKeyedUnarchiver__decodeIntForKey_(self, _cmd, aKey)
3392{ with(self)
3393{
3394    return objj_msgSend(self, "decodeObjectForKey:", aKey);
3395}
3396}), new objj_method(sel_getUid("decodePointForKey:"), function $CPKeyedUnarchiver__decodePointForKey_(self, _cmd, aKey)
3397{ with(self)
3398{
3399    var object = objj_msgSend(self, "decodeObjectForKey:", aKey);
3400    if(object)
3401        return CPPointFromString(object);
3402    else
3403        return CPPointMake(0.0, 0.0);
3404}
3405}), new objj_method(sel_getUid("decodeRectForKey:"), function $CPKeyedUnarchiver__decodeRectForKey_(self, _cmd, aKey)
3406{ with(self)
3407{
3408    var object = objj_msgSend(self, "decodeObjectForKey:", aKey);
3409    if(object)
3410        return CPRectFromString(object);
3411    else
3412        return CPRectMakeZero();
3413}
3414}), new objj_method(sel_getUid("decodeSizeForKey:"), function $CPKeyedUnarchiver__decodeSizeForKey_(self, _cmd, aKey)
3415{ with(self)
3416{
3417    var object = objj_msgSend(self, "decodeObjectForKey:", aKey);
3418    if(object)
3419        return CPSizeFromString(object);
3420    else
3421        return CPSizeMake(0.0, 0.0);
3422}
3423}), new objj_method(sel_getUid("decodeObjectForKey:"), function $CPKeyedUnarchiver__decodeObjectForKey_(self, _cmd, aKey)
3424{ with(self)
3425{
3426    var object = objj_msgSend(_plistObject, "objectForKey:", aKey);
3427    if (objj_msgSend(object, "isKindOfClass:", _CPKeyedUnarchiverDictionaryClass))
3428        return _CPKeyedUnarchiverDecodeObjectAtIndex(self, objj_msgSend(object, "objectForKey:", _CPKeyedArchiverUIDKey));
3429    else if (objj_msgSend(object, "isKindOfClass:", _CPKeyedUnarchiverNumberClass) || objj_msgSend(object, "isKindOfClass:", _CPKeyedUnarchiverDataClass))
3430        return object;
3431    else if (objj_msgSend(object, "isKindOfClass:", _CPKeyedUnarchiverArrayClass))
3432    {
3433        var index = 0,
3434            count = object.length,
3435            array = [];
3436        for (; index < count; ++index)
3437            array[index] = _CPKeyedUnarchiverDecodeObjectAtIndex(self, objj_msgSend(object[index], "objectForKey:", _CPKeyedArchiverUIDKey));
3438        return array;
3439    }
3440    return nil;
3441}
3442}), new objj_method(sel_getUid("decodeBytesForKey:"), function $CPKeyedUnarchiver__decodeBytesForKey_(self, _cmd, aKey)
3443{ with(self)
3444{
3445    var data = objj_msgSend(self, "decodeObjectForKey:", aKey);
3446    if (objj_msgSend(data, "isKindOfClass:", objj_msgSend(CPData, "class")))
3447        return data.bytes;
3448    return nil;
3449}
3450}), new objj_method(sel_getUid("finishDecoding"), function $CPKeyedUnarchiver__finishDecoding(self, _cmd)
3451{ with(self)
3452{
3453    if (_delegateSelectors & _CPKeyedUnarchiverWillFinishSelector)
3454        objj_msgSend(_delegate, "unarchiverWillFinish:", self);
3455    if (_delegateSelectors & _CPKeyedUnarchiverDidFinishSelector)
3456        objj_msgSend(_delegate, "unarchiverDidFinish:", self);
3457}
3458}), new objj_method(sel_getUid("delegate"), function $CPKeyedUnarchiver__delegate(self, _cmd)
3459{ with(self)
3460{
3461    return _delegate;
3462}
3463}), new objj_method(sel_getUid("setDelegate:"), function $CPKeyedUnarchiver__setDelegate_(self, _cmd, aDelegate)
3464{ with(self)
3465{
3466    _delegate = aDelegate;
3467    if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("unarchiver:cannotDecodeObjectOfClassName:originalClasses:")))
3468        _delegateSelectors |= _CPKeyedUnarchiverCannotDecodeObjectOfClassNameOriginalClassesSelector;
3469    if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("unarchiver:didDecodeObject:")))
3470        _delegateSelectors |= _CPKeyedUnarchiverDidDecodeObjectSelector;
3471    if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("unarchiver:willReplaceObject:withObject:")))
3472        _delegateSelectors |= _CPKeyedUnarchiverWillReplaceObjectWithObjectSelector;
3473    if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("unarchiverWillFinish:")))
3474        _delegateSelectors |= _CPKeyedUnarchiverWilFinishSelector;
3475    if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("unarchiverDidFinish:")))
3476        _delegateSelectors |= _CPKeyedUnarchiverDidFinishSelector;
3477}
3478}), new objj_method(sel_getUid("setClass:forClassName:"), function $CPKeyedUnarchiver__setClass_forClassName_(self, _cmd, aClass, aClassName)
3479{ with(self)
3480{
3481    objj_msgSend(_replacementClasses, "setObject:forKey:", aClass, aClassName);
3482}
3483}), new objj_method(sel_getUid("classForClassName:"), function $CPKeyedUnarchiver__classForClassName_(self, _cmd, aClassName)
3484{ with(self)
3485{
3486    return objj_msgSend(_replacementClasses, "objectForKey:", aClassName);
3487}
3488}), new objj_method(sel_getUid("allowsKeyedCoding"), function $CPKeyedUnarchiver__allowsKeyedCoding(self, _cmd)
3489{ with(self)
3490{
3491    return YES;
3492}
3493})]);
3494class_addMethods(meta_class, [new objj_method(sel_getUid("initialize"), function $CPKeyedUnarchiver__initialize(self, _cmd)
3495{ with(self)
3496{
3497    if (self !== objj_msgSend(CPKeyedUnarchiver, "class"))
3498        return;
3499    _CPKeyedUnarchiverArrayClass = objj_msgSend(CPArray, "class");
3500    _CPKeyedUnarchiverStringClass = objj_msgSend(CPString, "class");
3501    _CPKeyedUnarchiverDictionaryClass = objj_msgSend(CPDictionary, "class");
3502    _CPKeyedUnarchiverNumberClass = objj_msgSend(CPNumber, "class");
3503    _CPKeyedUnarchiverDataClass = objj_msgSend(CPData, "class");
3504    _CPKeyedUnarchiverArchiverValueClass = objj_msgSend(_CPKeyedArchiverValue, "class");
3505}
3506}), new objj_method(sel_getUid("unarchiveObjectWithData:"), function $CPKeyedUnarchiver__unarchiveObjectWithData_(self, _cmd, data)
3507{ with(self)
3508{
3509    var unarchiver = objj_msgSend(objj_msgSend(self, "alloc"), "initForReadingWithData:", data),
3510        object = objj_msgSend(unarchiver, "decodeObjectForKey:", "root");
3511    objj_msgSend(unarchiver, "finishDecoding");
3512    return object;
3513}
3514}), new objj_method(sel_getUid("unarchiveObjectWithFile:"), function $CPKeyedUnarchiver__unarchiveObjectWithFile_(self, _cmd, aFilePath)
3515{ with(self)
3516{
3517}
3518}), new objj_method(sel_getUid("unarchiveObjectWithFile:asynchronously:"), function $CPKeyedUnarchiver__unarchiveObjectWithFile_asynchronously_(self, _cmd, aFilePath, aFlag)
3519{ with(self)
3520{
3521}
3522})]);
3523}
3524var _CPKeyedUnarchiverDecodeObjectAtIndex = function(self, anIndex)
3525{
3526    var object = self._objects[anIndex];
3527    if (object)
3528        if (object == self._objects[0])
3529            return nil;
3530        else
3531            return object;
3532    var object,
3533        plistObject = self._plistObjects[anIndex];
3534    if (objj_msgSend(plistObject, "isKindOfClass:", _CPKeyedUnarchiverDictionaryClass))
3535    {
3536        var plistClass = self._plistObjects[objj_msgSend(objj_msgSend(plistObject, "objectForKey:", _CPKeyedArchiverClassKey), "objectForKey:", _CPKeyedArchiverUIDKey)],
3537            className = objj_msgSend(plistClass, "objectForKey:", _CPKeyedArchiverClassNameKey),
3538            classes = objj_msgSend(plistClass, "objectForKey:", _CPKeyedArchiverClassesKey),
3539            theClass = objj_msgSend(self, "classForClassName:", className);
3540        if (!theClass)
3541            theClass = CPClassFromString(className);
3542        object = objj_msgSend(theClass, "alloc");
3543        self._objects[anIndex] = object;
3544        var savedPlistObject = self._plistObject;
3545        self._plistObject = plistObject;
3546        var string = className;
3547        var processedObject = objj_msgSend(object, "initWithCoder:", self);
3548        self._plistObject = savedPlistObject;
3549        if (processedObject != object)
3550        {
3551            if (self._delegateSelectors & _CPKeyedUnarchiverWillReplaceObjectWithObjectSelector)
3552                objj_msgSend(self._delegate, "unarchiver:willReplaceObject:withObject:", self, object, processedObject);
3553            object = processedObject;
3554            self._objects[anIndex] = processedObject;
3555        }
3556        processedObject = objj_msgSend(object, "awakeAfterUsingCoder:", self);
3557        if (processedObject != object)
3558        {
3559            if (self._delegateSelectors & _CPKeyedUnarchiverWillReplaceObjectWithObjectSelector)
3560                objj_msgSend(self._delegate, "unarchiver:willReplaceObject:withObject:", self, object, processedObject);
3561            object = processedObject;
3562            self._objects[anIndex] = processedObject;
3563        }
3564        if (self._delegate)
3565        {
3566            if (self._delegateSelectors & _CPKeyedUnarchiverDidDecodeObjectSelector)
3567                processedObject = objj_msgSend(self._delegate, "unarchiver:didDecodeObject:", self, object);
3568            if (processedObject != object)
3569            {
3570                if (self._delegateSelectors & _CPKeyedUnarchiverWillReplaceObjectWithObjectSelector)
3571                    objj_msgSend(self._delegate, "unarchiver:willReplaceObject:withObject:", self, object, processedObject);
3572                object = processedObject;
3573                self._objects[anIndex] = processedObject;
3574            }
3575        }
3576    }
3577    else
3578    {
3579        self._objects[anIndex] = object = plistObject;
3580        if (objj_msgSend(object, "class") == _CPKeyedUnarchiverStringClass)
3581        {
3582            if (object == _CPKeyedArchiverNullString)
3583            {
3584                self._objects[anIndex] = self._objects[0];
3585                return nil;
3586            }
3587            else
3588                self._objects[anIndex] = object = plistObject;
3589        }
3590    }
3591    if (objj_msgSend(object, "isMemberOfClass:", _CPKeyedUnarchiverArchiverValueClass))
3592        object = objj_msgSend(object, "JSObject");
3593    return object;
3594}
3595
3596p;18;CPKeyValueCoding.ji;9;CPArray.ji;10;CPObject.ji;14;CPDictionary.jc;8588;
3597var CPObjectAccessorsForClass = nil,
3598    CPObjectModifiersForClass = nil;
3599CPUndefinedKeyException = "CPUndefinedKeyException";
3600CPTargetObjectUserInfoKey = "CPTargetObjectUserInfoKey";
3601CPUnknownUserInfoKey = "CPUnknownUserInfoKey";
3602{
3603var the_class = objj_getClass("CPObject")
3604if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPObject\""));
3605var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("_ivarForKey:"), function $CPObject___ivarForKey_(self, _cmd, aKey)
3606{ with(self)
3607{
3608    var ivar = '_' + aKey;
3609    if (typeof self[ivar] != "undefined")
3610        return ivar;
3611    var isKey = "is" + aKey.charAt(0).toUpperCase() + aKey.substr(1);
3612    ivar = '_' + isKey;
3613    if (typeof self[ivar] != "undefined")
3614        return ivar;
3615    ivar = aKey;
3616    if (typeof self[ivar] != "undefined")
3617        return ivar;
3618    ivar = isKey;
3619    if (typeof self[ivar] != "undefined")
3620        return ivar;
3621    return nil;
3622}
3623}), new objj_method(sel_getUid("valueForKey:"), function $CPObject__valueForKey_(self, _cmd, aKey)
3624{ with(self)
3625{
3626    var theClass = objj_msgSend(self, "class"),
3627        selector = objj_msgSend(theClass, "_accessorForKey:", aKey);
3628    if (selector)
3629        return objj_msgSend(self, selector);
3630    if(objj_msgSend(theClass, "accessInstanceVariablesDirectly"))
3631    {
3632        var ivar = objj_msgSend(self, "_ivarForKey:", aKey);
3633        if (ivar)
3634            return self[ivar];
3635    }
3636    return objj_msgSend(self, "valueForUndefinedKey:", aKey);
3637}
3638}), new objj_method(sel_getUid("valueForKeyPath:"), function $CPObject__valueForKeyPath_(self, _cmd, aKeyPath)
3639{ with(self)
3640{
3641    var keys = aKeyPath.split("."),
3642        index = 0,
3643        count = keys.length,
3644        value = self;
3645    for(; index < count; ++index)
3646        value = objj_msgSend(value, "valueForKey:", keys[index]);
3647    return value;
3648}
3649}), new objj_method(sel_getUid("dictionaryWithValuesForKeys:"), function $CPObject__dictionaryWithValuesForKeys_(self, _cmd, keys)
3650{ with(self)
3651{
3652    var index = 0,
3653        count = keys.length,
3654        dictionary = objj_msgSend(CPDictionary, "dictionary");
3655    for (; index < count; ++index)
3656    {
3657        var key = keys[index],
3658            value = objj_msgSend(self, "valueForKey:", key);
3659        if (value === nil)
3660            objj_msgSend(dictionary, "setObject:forKey:", objj_msgSend(CPNull, "null"), key);
3661        else
3662            objj_msgSend(dictionary, "setObject:forKey:", value, key);
3663    }
3664    return dictionary;
3665}
3666}), new objj_method(sel_getUid("valueForUndefinedKey:"), function $CPObject__valueForUndefinedKey_(self, _cmd, aKey)
3667{ with(self)
3668{
3669    objj_msgSend(objj_msgSend(CPException, "exceptionWithName:reason:userInfo:", CPUndefinedKeyException, objj_msgSend(self, "description") + " is not key value coding-compliant for the key " + aKey, objj_msgSend(CPDictionary, "dictionaryWithObjects:forKeys:", [self, aKey], [CPTargetObjectUserInfoKey, CPUnknownUserInfoKey])), "raise");
3670}
3671}), new objj_method(sel_getUid("setValue:forKeyPath:"), function $CPObject__setValue_forKeyPath_(self, _cmd, aValue, aKeyPath)
3672{ with(self)
3673{
3674    if (!aKeyPath) aKeyPath = "self";
3675    var i = 0,
3676        keys = aKeyPath.split("."),
3677        count = keys.length - 1,
3678        owner = self;
3679    for(; i < count; ++i)
3680        owner = objj_msgSend(owner, "valueForKey:", keys[i]);
3681    objj_msgSend(owner, "setValue:forKey:", aValue, keys[i]);
3682}
3683}), new objj_method(sel_getUid("setValue:forKey:"), function $CPObject__setValue_forKey_(self, _cmd, aValue, aKey)
3684{ with(self)
3685{
3686    var theClass = objj_msgSend(self, "class"),
3687        selector = objj_msgSend(theClass, "_modifierForKey:", aKey);
3688    if (selector)
3689        return objj_msgSend(self, selector, aValue);
3690    if(objj_msgSend(theClass, "accessInstanceVariablesDirectly"))
3691    {
3692        var ivar = objj_msgSend(self, "_ivarForKey:", aKey);
3693        if (ivar)
3694        {
3695            objj_msgSend(self, "willChangeValueForKey:", aKey);
3696            self[ivar] = aValue;
3697            objj_msgSend(self, "didChangeValueForKey:", aKey);
3698        }
3699        return;
3700    }
3701    objj_msgSend(self, "setValue:forUndefinedKey:", aValue, aKey);
3702}
3703}), new objj_method(sel_getUid("setValue:forUndefinedKey:"), function $CPObject__setValue_forUndefinedKey_(self, _cmd, aValue, aKey)
3704{ with(self)
3705{
3706    objj_msgSend(objj_msgSend(CPException, "exceptionWithName:reason:userInfo:", CPUndefinedKeyException, objj_msgSend(self, "description") + " is not key value coding-compliant for the key " + aKey, objj_msgSend(CPDictionary, "dictionaryWithObjects:forKeys:", [self, aKey], [CPTargetObjectUserInfoKey, CPUnknownUserInfoKey])), "raise");
3707}
3708})]);
3709class_addMethods(meta_class, [new objj_method(sel_getUid("accessInstanceVariablesDirectly"), function $CPObject__accessInstanceVariablesDirectly(self, _cmd)
3710{ with(self)
3711{
3712    return YES;
3713}
3714}), new objj_method(sel_getUid("_accessorForKey:"), function $CPObject___accessorForKey_(self, _cmd, aKey)
3715{ with(self)
3716{
3717    if (!CPObjectAccessorsForClass)
3718        CPObjectAccessorsForClass = objj_msgSend(CPDictionary, "dictionary");
3719    var hash = objj_msgSend(isa, "hash"),
3720        selector = nil,
3721        accessors = objj_msgSend(CPObjectAccessorsForClass, "objectForKey:", hash);
3722    if (accessors)
3723    {
3724        selector = objj_msgSend(accessors, "objectForKey:", aKey);
3725        if (selector)
3726            return selector === objj_msgSend(CPNull, "null") ? nil : selector;
3727    }
3728    else
3729    {
3730        accessors = objj_msgSend(CPDictionary, "dictionary");
3731        objj_msgSend(CPObjectAccessorsForClass, "setObject:forKey:", accessors, hash);
3732    }
3733    var capitalizedKey = aKey.charAt(0).toUpperCase() + aKey.substr(1);
3734    if (objj_msgSend(self, "instancesRespondToSelector:", selector = CPSelectorFromString("get" + capitalizedKey)) ||
3735        objj_msgSend(self, "instancesRespondToSelector:", selector = CPSelectorFromString(aKey)) ||
3736        objj_msgSend(self, "instancesRespondToSelector:", selector = CPSelectorFromString("is" + capitalizedKey)) ||
3737        objj_msgSend(self, "instancesRespondToSelector:", selector = CPSelectorFromString("_get" + capitalizedKey)) ||
3738        objj_msgSend(self, "instancesRespondToSelector:", selector = CPSelectorFromString("_" + aKey)) ||
3739        objj_msgSend(self, "instancesRespondToSelector:", selector = CPSelectorFromString("_is" + capitalizedKey)))
3740    {
3741        objj_msgSend(accessors, "setObject:forKey:", selector, aKey);
3742        return selector;
3743    }
3744    objj_msgSend(accessors, "setObject:forKey:", objj_msgSend(CPNull, "null"), aKey);
3745    return nil;
3746}
3747}), new objj_method(sel_getUid("_modifierForKey:"), function $CPObject___modifierForKey_(self, _cmd, aKey)
3748{ with(self)
3749{
3750    if (!CPObjectModifiersForClass)
3751        CPObjectModifiersForClass = objj_msgSend(CPDictionary, "dictionary");
3752    var hash = objj_msgSend(isa, "hash"),
3753        selector = nil,
3754        modifiers = objj_msgSend(CPObjectModifiersForClass, "objectForKey:", hash);
3755    if (modifiers)
3756    {
3757        selector = objj_msgSend(modifiers, "objectForKey:", aKey);
3758        if (selector)
3759            return selector === objj_msgSend(CPNull, "null") ? nil : selector;
3760    }
3761    else
3762    {
3763        modifiers = objj_msgSend(CPDictionary, "dictionary");
3764        objj_msgSend(CPObjectModifiersForClass, "setObject:forKey:", modifiers, hash);
3765    }
3766    if (selector)
3767        return selector === objj_msgSend(CPNull, "null") ? nil : selector;
3768    var capitalizedKey = aKey.charAt(0).toUpperCase() + aKey.substr(1) + ':';
3769    if (objj_msgSend(self, "instancesRespondToSelector:", selector = CPSelectorFromString("set" + capitalizedKey)) ||
3770        objj_msgSend(self, "instancesRespondToSelector:", selector = CPSelectorFromString("_set" + capitalizedKey)))
3771    {
3772        objj_msgSend(modifiers, "setObject:forKey:", selector, aKey);
3773        return selector;
3774    }
3775    objj_msgSend(modifiers, "setObject:forKey:", objj_msgSend(CPNull, "null"), aKey);
3776    return nil;
3777}
3778})]);
3779}
3780{
3781var the_class = objj_getClass("CPDictionary")
3782if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPDictionary\""));
3783var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("valueForKey:"), function $CPDictionary__valueForKey_(self, _cmd, aKey)
3784{ with(self)
3785{
3786 return objj_msgSend(self, "objectForKey:", aKey);
3787}
3788}), new objj_method(sel_getUid("setValue:forKey:"), function $CPDictionary__setValue_forKey_(self, _cmd, aValue, aKey)
3789{ with(self)
3790{
3791    objj_msgSend(self, "setObject:forKey:", aValue, aKey);
3792}
3793})]);
3794}
3795i;13;CPArray+KVO.jp;21;CPKeyValueObserving.ji;9;CPArray.ji;14;CPDictionary.ji;13;CPException.ji;10;CPObject.ji;7;CPSet.jc;21303;
3796{
3797var the_class = objj_getClass("CPObject")
3798if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPObject\""));
3799var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("willChangeValueForKey:"), function $CPObject__willChangeValueForKey_(self, _cmd, aKey)
3800{ with(self)
3801{
3802}
3803}), new objj_method(sel_getUid("didChangeValueForKey:"), function $CPObject__didChangeValueForKey_(self, _cmd, aKey)
3804{ with(self)
3805{
3806}
3807}), new objj_method(sel_getUid("willChange:valuesAtIndexes:forKey:"), function $CPObject__willChange_valuesAtIndexes_forKey_(self, _cmd, change, indexes, key)
3808{ with(self)
3809{
3810}
3811}), new objj_method(sel_getUid("didChange:valuesAtIndexes:forKey:"), function $CPObject__didChange_valuesAtIndexes_forKey_(self, _cmd, change, indexes, key)
3812{ with(self)
3813{
3814}
3815}), new objj_method(sel_getUid("addObserver:forKeyPath:options:context:"), function $CPObject__addObserver_forKeyPath_options_context_(self, _cmd, anObserver, aPath, options, aContext)
3816{ with(self)
3817{
3818    if (!anObserver || !aPath)
3819        return;
3820    objj_msgSend(objj_msgSend(_CPKVOProxy, "proxyForObject:", self), "_addObserver:forKeyPath:options:context:", anObserver, aPath, options, aContext);
3821}
3822}), new objj_method(sel_getUid("removeObserver:forKeyPath:"), function $CPObject__removeObserver_forKeyPath_(self, _cmd, anObserver, aPath)
3823{ with(self)
3824{
3825    if (!anObserver || !aPath)
3826        return;
3827    objj_msgSend(objj_msgSend(KVOProxyMap, "objectForKey:", objj_msgSend(self, "hash")), "_removeObserver:forKeyPath:", anObserver, aPath);
3828}
3829})]);
3830class_addMethods(meta_class, [new objj_method(sel_getUid("automaticallyNotifiesObserversForKey:"), function $CPObject__automaticallyNotifiesObserversForKey_(self, _cmd, aKey)
3831{ with(self)
3832{
3833    return YES;
3834}
3835}), new objj_method(sel_getUid("keyPathsForValuesAffectingValueForKey:"), function $CPObject__keyPathsForValuesAffectingValueForKey_(self, _cmd, aKey)
3836{ with(self)
3837{
3838    var capitalizedKey = aKey.charAt(0).toUpperCase()+aKey.substring(1);
3839        selector = "keyPathsForValuesAffectingValueFor"+capitalizedKey;
3840    if (objj_msgSend(objj_msgSend(self, "class"), "respondsToSelector:", selector))
3841        return objj_msgSend(objj_msgSend(self, "class"), selector);
3842    return objj_msgSend(CPSet, "set");
3843}
3844})]);
3845}
3846CPKeyValueObservingOptionNew = 1 << 0;
3847CPKeyValueObservingOptionOld = 1 << 1;
3848CPKeyValueObservingOptionInitial = 1 << 2;
3849CPKeyValueObservingOptionPrior = 1 << 3;
3850CPKeyValueChangeKindKey = "CPKeyValueChangeKindKey";
3851CPKeyValueChangeNewKey = "CPKeyValueChangeNewKey";
3852CPKeyValueChangeOldKey = "CPKeyValueChangeOldKey";
3853CPKeyValueChangeIndexesKey = "CPKeyValueChangeIndexesKey";
3854CPKeyValueChangeNotificationIsPriorKey = "CPKeyValueChangeNotificationIsPriorKey";
3855CPKeyValueChangeSetting = 1;
3856CPKeyValueChangeInsertion = 2;
3857CPKeyValueChangeRemoval = 3;
3858CPKeyValueChangeReplacement = 4;
3859var kvoNewAndOld = CPKeyValueObservingOptionNew|CPKeyValueObservingOptionOld;
3860var KVOProxyMap = objj_msgSend(CPDictionary, "dictionary"),
3861    DependentKeysMap = objj_msgSend(CPDictionary, "dictionary");
3862{var the_class = objj_allocateClassPair(CPObject, "_CPKVOProxy"),
3863meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_targetObject"), new objj_ivar("_nativeClass"), new objj_ivar("_changesForKey"), new objj_ivar("_observersForKey"), new objj_ivar("_replacedKeys")]);
3864objj_registerClassPair(the_class);
3865objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
3866class_addMethods(the_class, [new objj_method(sel_getUid("initWithTarget:"), function $_CPKVOProxy__initWithTarget_(self, _cmd, aTarget)
3867{ with(self)
3868{
3869    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
3870    _targetObject = aTarget;
3871    _nativeClass = objj_msgSend(aTarget, "class");
3872    _observersForKey = objj_msgSend(CPDictionary, "dictionary");
3873    _changesForKey = objj_msgSend(CPDictionary, "dictionary");
3874    _replacedKeys = objj_msgSend(CPSet, "set");
3875    return self;
3876}
3877}), new objj_method(sel_getUid("_replaceClass"), function $_CPKVOProxy___replaceClass(self, _cmd)
3878{ with(self)
3879{
3880    var currentClass = _nativeClass,
3881        kvoClassName = "$KVO_"+class_getName(_nativeClass),
3882        existingKVOClass = objj_lookUpClass(kvoClassName);
3883    if (existingKVOClass)
3884    {
3885        _targetObject.isa = existingKVOClass;
3886        return;
3887    }
3888    var kvoClass = objj_allocateClassPair(currentClass, kvoClassName);
3889    objj_registerClassPair(kvoClass);
3890    _class_initialize(kvoClass);
3891    var methodList = _CPKVOModelSubclass.method_list,
3892        count = methodList.length;
3893    for (var i=0; i<count; i++)
3894    {
3895        var method = methodList[i];
3896        class_addMethod(kvoClass, method_getName(method), method_getImplementation(method), "");
3897    }
3898    _targetObject.isa = kvoClass;
3899}
3900}), new objj_method(sel_getUid("_replaceSetterForKey:"), function $_CPKVOProxy___replaceSetterForKey_(self, _cmd, aKey)
3901{ with(self)
3902{
3903    if (objj_msgSend(_replacedKeys, "containsObject:", aKey) || !objj_msgSend(_nativeClass, "automaticallyNotifiesObserversForKey:", aKey))
3904        return;
3905    var currentClass = _nativeClass,
3906        capitalizedKey = aKey.charAt(0).toUpperCase() + aKey.substring(1),
3907        found = false,
3908        replacementMethods = [
3909            "set"+capitalizedKey+":", _kvoMethodForMethod,
3910            "_set"+capitalizedKey+":", _kvoMethodForMethod,
3911            "insertObject:in"+capitalizedKey+"AtIndex:", _kvoInsertMethodForMethod,
3912            "replaceObjectIn"+capitalizedKey+"AtIndex:withObject:", _kvoReplaceMethodForMethod,
3913            "removeObjectFrom"+capitalizedKey+"AtIndex:", _kvoRemoveMethodForMethod
3914        ];
3915    for (var i=0, count=replacementMethods.length; i<count; i+=2)
3916    {
3917        var theSelector = sel_getName(replacementMethods[i]),
3918            theReplacementMethod = replacementMethods[i+1];
3919        if (objj_msgSend(_nativeClass, "instancesRespondToSelector:", theSelector))
3920        {
3921            var theMethod = class_getInstanceMethod(_nativeClass, theSelector);
3922            class_addMethod(_targetObject.isa, theSelector, theReplacementMethod(aKey, theMethod), "");
3923            found = true;
3924        }
3925    }
3926    if (found)
3927        return;
3928    var composedOfKeys = objj_msgSend(objj_msgSend(_nativeClass, "keyPathsForValuesAffectingValueForKey:", aKey), "allObjects");
3929    if (!composedOfKeys)
3930        return;
3931    var dependentKeysForClass = objj_msgSend(DependentKeysMap, "objectForKey:", objj_msgSend(_nativeClass, "hash"));
3932    if (!dependentKeysForClass)
3933    {
3934        dependentKeysForClass = objj_msgSend(CPDictionary, "new");
3935        objj_msgSend(DependentKeysMap, "setObject:forKey:", dependentKeysForClass, objj_msgSend(_nativeClass, "hash"));
3936    }
3937    for (var i=0, count=composedOfKeys.length; i<count; i++)
3938    {
3939        var componentKey = composedOfKeys[i],
3940            keysComposedOfKey = objj_msgSend(dependentKeysForClass, "objectForKey:", componentKey);
3941        if (!keysComposedOfKey)
3942        {
3943            keysComposedOfKey = objj_msgSend(CPSet, "new");
3944            objj_msgSend(dependentKeysForClass, "setObject:forKey:", keysComposedOfKey, componentKey);
3945        }
3946        objj_msgSend(keysComposedOfKey, "addObject:", aKey);
3947        objj_msgSend(self, "_replaceSetterForKey:", componentKey);
3948    }
3949}
3950}), new objj_method(sel_getUid("_addObserver:forKeyPath:options:context:"), function $_CPKVOProxy___addObserver_forKeyPath_options_context_(self, _cmd, anObserver, aPath, options, aContext)
3951{ with(self)
3952{
3953    if (!anObserver)
3954        return;
3955    var forwarder = nil;
3956    if (aPath.indexOf('.') != CPNotFound)
3957        forwarder = objj_msgSend(objj_msgSend(_CPKVOForwardingObserver, "alloc"), "initWithKeyPath:object:observer:options:context:", aPath, _targetObject, anObserver, options, aContext);
3958    else
3959        objj_msgSend(self, "_replaceSetterForKey:", aPath);
3960    var observers = objj_msgSend(_observersForKey, "objectForKey:", aPath);
3961    if (!observers)
3962    {
3963        observers = objj_msgSend(CPDictionary, "dictionary");
3964        objj_msgSend(_observersForKey, "setObject:forKey:", observers, aPath);
3965    }
3966    objj_msgSend(observers, "setObject:forKey:", _CPKVOInfoMake(anObserver, options, aContext, forwarder), objj_msgSend(anObserver, "hash"));
3967    if (options & CPKeyValueObservingOptionInitial)
3968    {
3969        var newValue = objj_msgSend(_targetObject, "valueForKeyPath:", aPath);
3970        if (newValue === nil || newValue === undefined)
3971            newValue = objj_msgSend(CPNull, "null");
3972        var changes = objj_msgSend(CPDictionary, "dictionaryWithObject:forKey:", newValue, CPKeyValueChangeNewKey);
3973        objj_msgSend(anObserver, "observeValueForKeyPath:ofObject:change:context:", aPath, self, changes, aContext);
3974    }
3975}
3976}), new objj_method(sel_getUid("_removeObserver:forKeyPath:"), function $_CPKVOProxy___removeObserver_forKeyPath_(self, _cmd, anObserver, aPath)
3977{ with(self)
3978{
3979    var observers = objj_msgSend(_observersForKey, "objectForKey:", aPath);
3980    if (aPath.indexOf('.') != CPNotFound)
3981    {
3982        var forwarder = objj_msgSend(observers, "objectForKey:", objj_msgSend(anObserver, "hash")).forwarder;
3983        objj_msgSend(forwarder, "finalize");
3984    }
3985    objj_msgSend(observers, "removeObjectForKey:", objj_msgSend(anObserver, "hash"));
3986    if (!objj_msgSend(observers, "count"))
3987        objj_msgSend(_observersForKey, "removeObjectForKey:", aPath);
3988    if (!objj_msgSend(_observersForKey, "count"))
3989    {
3990        _targetObject.isa = _nativeClass;
3991        objj_msgSend(KVOProxyMap, "removeObjectForKey:", objj_msgSend(_targetObject, "hash"));
3992    }
3993}
3994}), new objj_method(sel_getUid("_sendNotificationsForKey:changeOptions:isBefore:"), function $_CPKVOProxy___sendNotificationsForKey_changeOptions_isBefore_(self, _cmd, aKey, changeOptions, isBefore)
3995{ with(self)
3996{
3997    var changes = objj_msgSend(_changesForKey, "objectForKey:", aKey);
3998    if (isBefore)
3999    {
4000        changes = changeOptions;
4001        var indexes = objj_msgSend(changes, "objectForKey:", CPKeyValueChangeIndexesKey);
4002        if (indexes)
4003        {
4004            var type = objj_msgSend(changes, "objectForKey:", CPKeyValueChangeKindKey);
4005            if (type == CPKeyValueChangeReplacement || type == CPKeyValueChangeRemoval)
4006            {
4007                var oldValues = objj_msgSend(objj_msgSend(_targetObject, "mutableArrayValueForKeyPath:", aKey), "objectsAtIndexes:", indexes);
4008                objj_msgSend(changes, "setValue:forKey:", oldValues, CPKeyValueChangeOldKey);
4009            }
4010        }
4011        else
4012        {
4013            var oldValue = objj_msgSend(_targetObject, "valueForKey:", aKey);
4014            if (oldValue === nil || oldValue === undefined)
4015                oldValue = objj_msgSend(CPNull, "null");
4016            objj_msgSend(changes, "setObject:forKey:", oldValue, CPKeyValueChangeOldKey);
4017        }
4018        objj_msgSend(changes, "setObject:forKey:", 1, CPKeyValueChangeNotificationIsPriorKey);
4019        objj_msgSend(_changesForKey, "setObject:forKey:", changes, aKey);
4020    }
4021    else
4022    {
4023        objj_msgSend(changes, "removeObjectForKey:", CPKeyValueChangeNotificationIsPriorKey);
4024        var indexes = objj_msgSend(changes, "objectForKey:", CPKeyValueChangeIndexesKey);
4025        if (indexes)
4026        {
4027            var type = objj_msgSend(changes, "objectForKey:", CPKeyValueChangeKindKey);
4028            if (type == CPKeyValueChangeReplacement || type == CPKeyValueChangeInsertion)
4029            {
4030                var oldValues = objj_msgSend(objj_msgSend(_targetObject, "mutableArrayValueForKeyPath:", aKey), "objectsAtIndexes:", indexes);
4031                objj_msgSend(changes, "setValue:forKey:", oldValues, CPKeyValueChangeNewKey);
4032            }
4033        }
4034        else
4035        {
4036            var newValue = objj_msgSend(_targetObject, "valueForKey:", aKey);
4037            if (newValue === nil || newValue === undefined)
4038                newValue = objj_msgSend(CPNull, "null");
4039            objj_msgSend(changes, "setObject:forKey:", newValue, CPKeyValueChangeNewKey);
4040        }
4041    }
4042    var observers = objj_msgSend(objj_msgSend(_observersForKey, "objectForKey:", aKey), "allValues"),
4043        count = objj_msgSend(observers, "count");
4044    while (count--)
4045    {
4046        var observerInfo = observers[count];
4047        if (isBefore && (observerInfo.options & CPKeyValueObservingOptionPrior))
4048            objj_msgSend(observerInfo.observer, "observeValueForKeyPath:ofObject:change:context:", aKey, _targetObject, changes, observerInfo.context);
4049        else if (!isBefore)
4050            objj_msgSend(observerInfo.observer, "observeValueForKeyPath:ofObject:change:context:", aKey, _targetObject, changes, observerInfo.context);
4051    }
4052    var keysComposedOfKey = objj_msgSend(objj_msgSend(objj_msgSend(DependentKeysMap, "objectForKey:", objj_msgSend(_nativeClass, "hash")), "objectForKey:", aKey), "allObjects");
4053    if (!keysComposedOfKey)
4054        return;
4055    for (var i=0, count=keysComposedOfKey.length; i<count; i++)
4056        objj_msgSend(self, "_sendNotificationsForKey:changeOptions:isBefore:", keysComposedOfKey[i], changeOptions, isBefore);
4057}
4058})]);
4059class_addMethods(meta_class, [new objj_method(sel_getUid("proxyForObject:"), function $_CPKVOProxy__proxyForObject_(self, _cmd, anObject)
4060{ with(self)
4061{
4062    var proxy = objj_msgSend(KVOProxyMap, "objectForKey:", objj_msgSend(anObject, "hash"));
4063    if (proxy)
4064        return proxy;
4065    proxy = objj_msgSend(objj_msgSend(self, "alloc"), "initWithTarget:", anObject);
4066    objj_msgSend(proxy, "_replaceClass");
4067    objj_msgSend(KVOProxyMap, "setObject:forKey:", proxy, objj_msgSend(anObject, "hash"));
4068    return proxy;
4069}
4070})]);
4071}
4072{var the_class = objj_allocateClassPair(Nil, "_CPKVOModelSubclass"),
4073meta_class = the_class.isa;objj_registerClassPair(the_class);
4074objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
4075class_addMethods(the_class, [new objj_method(sel_getUid("willChangeValueForKey:"), function $_CPKVOModelSubclass__willChangeValueForKey_(self, _cmd, aKey)
4076{ with(self)
4077{
4078    if (!aKey)
4079        return;
4080    var changeOptions = objj_msgSend(CPDictionary, "dictionaryWithObject:forKey:", CPKeyValueChangeSetting, CPKeyValueChangeKindKey);
4081    objj_msgSend(objj_msgSend(_CPKVOProxy, "proxyForObject:", self), "_sendNotificationsForKey:changeOptions:isBefore:", aKey, changeOptions, YES);
4082}
4083}), new objj_method(sel_getUid("didChangeValueForKey:"), function $_CPKVOModelSubclass__didChangeValueForKey_(self, _cmd, aKey)
4084{ with(self)
4085{
4086    if (!aKey)
4087        return;
4088    objj_msgSend(objj_msgSend(_CPKVOProxy, "proxyForObject:", self), "_sendNotificationsForKey:changeOptions:isBefore:", aKey, nil, NO);
4089}
4090}), new objj_method(sel_getUid("willChange:valuesAtIndexes:forKey:"), function $_CPKVOModelSubclass__willChange_valuesAtIndexes_forKey_(self, _cmd, change, indexes, aKey)
4091{ with(self)
4092{
4093    if (!aKey)
4094        return;
4095    var changeOptions = objj_msgSend(CPDictionary, "dictionaryWithObjects:forKeys:", [change, indexes], [CPKeyValueChangeKindKey, CPKeyValueChangeIndexesKey]);
4096    objj_msgSend(objj_msgSend(_CPKVOProxy, "proxyForObject:", self), "_sendNotificationsForKey:changeOptions:isBefore:", aKey, changeOptions, YES);
4097}
4098}), new objj_method(sel_getUid("didChange:valuesAtIndexes:forKey:"), function $_CPKVOModelSubclass__didChange_valuesAtIndexes_forKey_(self, _cmd, change, indexes, aKey)
4099{ with(self)
4100{
4101    if (!aKey)
4102        return;
4103    objj_msgSend(objj_msgSend(_CPKVOProxy, "proxyForObject:", self), "_sendNotificationsForKey:changeOptions:isBefore:", aKey, nil, NO);
4104}
4105}), new objj_method(sel_getUid("class"), function $_CPKVOModelSubclass__class(self, _cmd)
4106{ with(self)
4107{
4108    return objj_msgSend(KVOProxyMap, "objectForKey:", objj_msgSend(self, "hash"))._nativeClass;
4109}
4110}), new objj_method(sel_getUid("superclass"), function $_CPKVOModelSubclass__superclass(self, _cmd)
4111{ with(self)
4112{
4113    return objj_msgSend(objj_msgSend(self, "class"), "superclass");
4114}
4115}), new objj_method(sel_getUid("isKindOfClass:"), function $_CPKVOModelSubclass__isKindOfClass_(self, _cmd, aClass)
4116{ with(self)
4117{
4118    return objj_msgSend(objj_msgSend(self, "class"), "isSubclassOfClass:", aClass);
4119}
4120}), new objj_method(sel_getUid("isMemberOfClass:"), function $_CPKVOModelSubclass__isMemberOfClass_(self, _cmd, aClass)
4121{ with(self)
4122{
4123    return objj_msgSend(self, "class") == aClass;
4124}
4125}), new objj_method(sel_getUid("className"), function $_CPKVOModelSubclass__className(self, _cmd)
4126{ with(self)
4127{
4128    return objj_msgSend(self, "class").name;
4129}
4130})]);
4131}
4132{var the_class = objj_allocateClassPair(CPObject, "_CPKVOForwardingObserver"),
4133meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_object"), new objj_ivar("_observer"), new objj_ivar("_context"), new objj_ivar("_firstPart"), new objj_ivar("_secondPart"), new objj_ivar("_value")]);
4134objj_registerClassPair(the_class);
4135objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
4136class_addMethods(the_class, [new objj_method(sel_getUid("initWithKeyPath:object:observer:options:context:"), function $_CPKVOForwardingObserver__initWithKeyPath_object_observer_options_context_(self, _cmd, aKeyPath, anObject, anObserver, options, aContext)
4137{ with(self)
4138{
4139    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
4140    _context = aContext;
4141    _observer = anObserver;
4142    _object = anObject;
4143    var dotIndex = aKeyPath.indexOf('.');
4144    if (dotIndex == CPNotFound)
4145        objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "Created _CPKVOForwardingObserver without compound key path: "+aKeyPath);
4146    _firstPart = aKeyPath.substring(0, dotIndex);
4147    _secondPart = aKeyPath.substring(dotIndex+1);
4148    objj_msgSend(_object, "addObserver:forKeyPath:options:context:", self, _firstPart, kvoNewAndOld, nil);
4149    _value = objj_msgSend(_object, "valueForKey:", _firstPart);
4150    if (_value)
4151        objj_msgSend(_value, "addObserver:forKeyPath:options:context:", self, _secondPart, kvoNewAndOld, nil);
4152    return self;
4153}
4154}), new objj_method(sel_getUid("observeValueForKeyPath:ofObject:change:context:"), function $_CPKVOForwardingObserver__observeValueForKeyPath_ofObject_change_context_(self, _cmd, aKeyPath, anObject, changes, aContext)
4155{ with(self)
4156{
4157    if (anObject == _object)
4158    {
4159        objj_msgSend(_observer, "observeValueForKeyPath:ofObject:change:context:", _firstPart, _object, changes, _context);
4160        if (_value)
4161            objj_msgSend(_value, "removeObserver:forKeyPath:", self, _secondPart);
4162        _value = objj_msgSend(_object, "valueForKey:", _firstPart);
4163        if (_value)
4164            objj_msgSend(_value, "addObserver:forKeyPath:options:context:", self, _secondPart, kvoNewAndOld, nil);
4165    }
4166    else
4167    {
4168        objj_msgSend(_observer, "observeValueForKeyPath:ofObject:change:context:", _firstPart+"."+aKeyPath, _object, changes, _context);
4169    }
4170}
4171}), new objj_method(sel_getUid("finalize"), function $_CPKVOForwardingObserver__finalize(self, _cmd)
4172{ with(self)
4173{
4174    if (_value)
4175        objj_msgSend(_value, "removeObserver:forKeyPath:", self, _secondPart);
4176    objj_msgSend(_object, "removeObserver:forKeyPath:", self, _firstPart);
4177    _object = nil;
4178    _observer = nil;
4179    _context = nil;
4180    _value = nil;
4181}
4182})]);
4183}
4184var _CPKVOInfoMake = _CPKVOInfoMake= function(anObserver, theOptions, aContext, aForwarder)
4185{
4186    return {
4187        observer: anObserver,
4188        options: theOptions,
4189        context: aContext,
4190        forwarder: aForwarder
4191    };
4192}
4193var _kvoMethodForMethod = _kvoMethodForMethod= function(theKey, theMethod)
4194{
4195    return function(self, _cmd, object)
4196    {
4197        objj_msgSend(self, "willChangeValueForKey:", theKey);
4198        theMethod.method_imp(self, _cmd, object);
4199        objj_msgSend(self, "didChangeValueForKey:", theKey);
4200    }
4201}
4202var _kvoInsertMethodForMethod = _kvoInsertMethodForMethod= function(theKey, theMethod)
4203{
4204    return function(self, _cmd, object, index)
4205    {
4206        objj_msgSend(self, "willChange:valuesAtIndexes:forKey:", CPKeyValueChangeInsertion, objj_msgSend(CPIndexSet, "indexSetWithIndex:", index), theKey);
4207        theMethod.method_imp(self, _cmd, object, index);
4208        objj_msgSend(self, "didChange:valuesAtIndexes:forKey:", CPKeyValueChangeInsertion, objj_msgSend(CPIndexSet, "indexSetWithIndex:", index), theKey)
4209    }
4210}
4211var _kvoReplaceMethodForMethod = _kvoReplaceMethodForMethod= function(theKey, theMethod)
4212{
4213    return function(self, _cmd, index, object)
4214    {
4215        objj_msgSend(self, "willChange:valuesAtIndexes:forKey:", CPKeyValueChangeReplacement, objj_msgSend(CPIndexSet, "indexSetWithIndex:", index), theKey);
4216        theMethod.method_imp(self, _cmd, index, object);
4217        objj_msgSend(self, "didChange:valuesAtIndexes:forKey:", CPKeyValueChangeReplacement, objj_msgSend(CPIndexSet, "indexSetWithIndex:", index), theKey)
4218    }
4219}
4220var _kvoRemoveMethodForMethod = _kvoRemoveMethodForMethod= function(theKey, theMethod)
4221{
4222    return function(self, _cmd, index)
4223    {
4224        objj_msgSend(self, "willChange:valuesAtIndexes:forKey:", CPKeyValueChangeRemoval, objj_msgSend(CPIndexSet, "indexSetWithIndex:", index), theKey);
4225        theMethod.method_imp(self, _cmd, index);
4226        objj_msgSend(self, "didChange:valuesAtIndexes:forKey:", CPKeyValueChangeRemoval, objj_msgSend(CPIndexSet, "indexSetWithIndex:", index), theKey)
4227    }
4228}
4229i;13;CPArray+KVO.jp;7;CPLog.jc;10117;window.CPLogDisable = false;
4230var CPLogDefaultTitle = "Cappuccino";
4231var CPLogLevels = ["fatal", "error", "warn", "info", "debug", "trace"];
4232var CPLogDefaultLevel = CPLogLevels[0];
4233var _CPLogLevelsInverted = {};
4234for (var i = 0; i < CPLogLevels.length; i++)
4235    _CPLogLevelsInverted[CPLogLevels[i]] = i;
4236var _CPLogRegistrations = {};
4237var _CPFormatLogMessage = function(aString, aLevel, aTitle)
4238{
4239    var now = new Date();
4240    aLevel = ( aLevel == null ? '' : ' [' + aLevel + ']' );
4241    if (typeof sprintf == "function")
4242        return sprintf("%4d-%02d-%02d %02d:%02d:%02d.%03d %s%s: %s",
4243            now.getFullYear(), now.getMonth(), now.getDate(),
4244            now.getHours(), now.getMinutes(), now.getSeconds(), now.getMilliseconds(),
4245            aTitle, aLevel, aString);
4246    else
4247        return now + " " + aTitle + aLevel + ": " + aString;
4248}
4249CPLogRegister= function(aProvider, aMaxLevel)
4250{
4251    CPLogRegisterRange(aProvider, CPLogLevels[0], aMaxLevel || CPLogLevels[CPLogLevels.length-1]);
4252}
4253CPLogRegisterRange= function(aProvider, aMinLevel, aMaxLevel)
4254{
4255    var min = _CPLogLevelsInverted[aMinLevel];
4256    var max = _CPLogLevelsInverted[aMaxLevel];
4257    if (min != undefined && max != undefined)
4258        for (var i = 0; i <= max; i++)
4259            CPLogRegisterSingle(aProvider, CPLogLevels[i]);
4260}
4261CPLogRegisterSingle= function(aProvider, aLevel)
4262{
4263    if (_CPLogRegistrations[aLevel] == undefined)
4264        _CPLogRegistrations[aLevel] = [aProvider];
4265    else
4266        _CPLogRegistrations[aLevel].push(aProvider);
4267}
4268_CPLogDispatch= function(parameters, aLevel, aTitle)
4269{
4270    if (aTitle == undefined)
4271        aTitle = CPLogDefaultTitle;
4272    if (aLevel == undefined)
4273        aLevel = CPLogDefaultLevel;
4274    var message = (typeof parameters[0] == "string" && parameters.length > 1) ? sprintf.apply(null, parameters) : String(parameters[0]);
4275    if (_CPLogRegistrations[aLevel])
4276        for (var i = 0; i < _CPLogRegistrations[aLevel].length; i++)
4277             _CPLogRegistrations[aLevel][i](message, aLevel, aTitle);
4278}
4279CPLog= function() { _CPLogDispatch(arguments); }
4280for (var i = 0; i < CPLogLevels.length; i++)
4281    CPLog[CPLogLevels[i]] = (function(level) { return function() { _CPLogDispatch(arguments, level); }; })(CPLogLevels[i]);
4282ANSI_ESC = String.fromCharCode(0x1B);
4283ANSI_CSI = ANSI_ESC + '[';
4284ANSI_TEXT_PROP = 'm';
4285ANSI_RESET = '0';
4286ANSI_BOLD = '1';
4287ANSI_FAINT = '2';
4288ANSI_NORMAL = '22';
4289ANSI_ITALIC = '3';
4290ANSI_UNDER = '4';
4291ANSI_UNDER_DBL = '21';
4292ANSI_UNDER_OFF = '24';
4293ANSI_BLINK = '5';
4294ANSI_BLINK_FAST = '6';
4295ANSI_BLINK_OFF = '25';
4296ANSI_REVERSE = '7';
4297ANSI_POSITIVE = '27';
4298ANSI_CONCEAL = '8';
4299ANSI_REVEAL = '28';
4300ANSI_FG = '3';
4301ANSI_BG = '4';
4302ANSI_FG_INTENSE = '9';
4303ANSI_BG_INTENSE = '10';
4304ANSI_BLACK = '0';
4305ANSI_RED = '1';
4306ANSI_GREEN = '2';
4307ANSI_YELLOW = '3';
4308ANSI_BLUE = '4';
4309ANSI_MAGENTA = '5';
4310ANSI_CYAN = '6';
4311ANSI_WHITE = '7';
4312var colorCodeMap = {
4313    "black" : ANSI_BLACK,
4314    "red" : ANSI_RED,
4315    "green" : ANSI_GREEN,
4316    "yellow" : ANSI_YELLOW,
4317    "blue" : ANSI_BLUE,
4318    "magenta" : ANSI_MAGENTA,
4319    "cyan" : ANSI_CYAN,
4320    "white" : ANSI_WHITE
4321}
4322ANSIControlCode = function(code, parameters)
4323{
4324    if (parameters == undefined)
4325        parameters = "";
4326    else if (typeof(parameters) == 'object' && (parameters instanceof Array))
4327        parameters = parameters.join(';');
4328    return ANSI_CSI + String(parameters) + String(code);
4329}
4330ANSITextApplyProperties = function(string, properties)
4331{
4332    return ANSIControlCode(ANSI_TEXT_PROP, properties) + String(string) + ANSIControlCode(ANSI_TEXT_PROP);
4333}
4334ANSITextColorize = function(string, color)
4335{
4336    if (colorCodeMap[color] == undefined)
4337        return string;
4338    return ANSITextApplyProperties(string, ANSI_FG + colorCodeMap[color]);
4339}
4340var levelColorMap = {
4341    "fatal": "red",
4342    "error": "red",
4343    "warn" : "yellow",
4344    "info" : "green",
4345    "debug": "cyan",
4346    "trace": "blue"
4347}
4348CPLogPrint= function(aString, aLevel, aTitle)
4349{
4350    if (typeof print != "undefined")
4351    {
4352        if (aLevel == "fatal" || aLevel == "error" || aLevel == "warn")
4353            var message = ANSITextColorize(_CPFormatLogMessage(aString, aLevel, aTitle), levelColorMap[aLevel]);
4354        else
4355            var message = _CPFormatLogMessage(aString, ANSITextColorize(aLevel, levelColorMap[aLevel]), aTitle);
4356        print(message);
4357    }
4358}
4359CPLogAlert= function(aString, aLevel, aTitle)
4360{
4361    if (typeof alert != "undefined" && !window.CPLogDisable)
4362    {
4363        var message = _CPFormatLogMessage(aString, aLevel, aTitle);
4364        window.CPLogDisable = !confirm(message + "\n\n(Click cancel to stop log alerts)");
4365    }
4366}
4367CPLogConsole= function(aString, aLevel, aTitle)
4368{
4369    if (typeof console != "undefined")
4370    {
4371        var message = _CPFormatLogMessage(aString, aLevel, aTitle);
4372        var logger = {
4373            "fatal": "error",
4374            "error": "error",
4375            "warn": "warn",
4376            "info": "info",
4377            "debug": "debug",
4378            "trace": "debug"
4379        }[aLevel];
4380        if (logger && console[logger])
4381            console[logger](message);
4382        else if (console.log)
4383            console.log(message);
4384    }
4385}
4386var CPLogWindow = null;
4387CPLogPopup = function(aString, aLevel, aTitle)
4388{
4389    try {
4390        if (window.CPLogDisable || window.open == undefined)
4391            return;
4392        if (!CPLogWindow || !CPLogWindow.document)
4393        {
4394            CPLogWindow = window.open("", "_blank", "width=600,height=400,status=no,resizable=yes,scrollbars=yes");
4395            if (!CPLogWindow) {
4396                window.CPLogDisable = !confirm(aString + "\n\n(Disable pop-up blocking for CPLog window; Click cancel to stop log alerts)");
4397                return;
4398            }
4399            _CPLogInitPopup(CPLogWindow);
4400        }
4401        var logDiv = CPLogWindow.document.createElement("div");
4402        logDiv.setAttribute("class", aLevel || "fatal");
4403        var message = _CPFormatLogMessage(aString, null, aTitle);
4404        logDiv.appendChild(CPLogWindow.document.createTextNode(message));
4405        CPLogWindow.log.appendChild(logDiv);
4406        if (CPLogWindow.focusEnabled.checked)
4407            CPLogWindow.focus();
4408        if (CPLogWindow.blockEnabled.checked)
4409            CPLogWindow.blockEnabled.checked = CPLogWindow.confirm(message+"\nContinue blocking?");
4410        if (CPLogWindow.scrollEnabled.checked)
4411            CPLogWindow.scrollToBottom();
4412    } catch(e) {
4413    }
4414}
4415var _CPLogInitPopup = function(logWindow)
4416{
4417    var doc = logWindow.document;
4418    doc.writeln("<html><head><title></title></head><body></body></html>");
4419    doc.title = CPLogDefaultTitle + " Run Log";
4420    var head = doc.getElementsByTagName("head")[0];
4421    var body = doc.getElementsByTagName("body")[0];
4422    var base = window.location.protocol + "//" + window.location.host + window.location.pathname;
4423    base = base.substring(0,base.lastIndexOf("/")+1);
4424    var link = doc.createElement("link");
4425    link.setAttribute("type", "text/css");
4426    link.setAttribute("rel", "stylesheet");
4427    link.setAttribute("href", base+"Frameworks/Foundation/Resources/log.css");
4428    link.setAttribute("media", "screen");
4429    head.appendChild(link);
4430    var div = doc.createElement("div");
4431    div.setAttribute("id", "header");
4432    body.appendChild(div);
4433    var ul = doc.createElement("ul");
4434    ul.setAttribute("id", "enablers");
4435    div.appendChild(ul);
4436    for (var i = 0; i < CPLogLevels.length; i++) {
4437        var li = doc.createElement("li");
4438        li.setAttribute("id", "en"+CPLogLevels[i]);
4439        li.setAttribute("class", CPLogLevels[i]);
4440        li.setAttribute("onclick", "toggle(this);");
4441        li.setAttribute("enabled", "yes");
4442        li.appendChild(doc.createTextNode(CPLogLevels[i]));
4443        ul.appendChild(li);
4444    }
4445    var ul = doc.createElement("ul");
4446    ul.setAttribute("id", "options");
4447    div.appendChild(ul);
4448    var options = {"focus":["Focus",false], "block":["Block",false], "wrap":["Wrap",false], "scroll":["Scroll",true], "close":["Close",true]};
4449    for (o in options) {
4450        var li = doc.createElement("li");
4451        ul.appendChild(li);
4452        logWindow[o+"Enabled"] = doc.createElement("input");
4453        logWindow[o+"Enabled"].setAttribute("id", o);
4454        logWindow[o+"Enabled"].setAttribute("type", "checkbox");
4455        if (options[o][1])
4456            logWindow[o+"Enabled"].setAttribute("checked", "checked");
4457        li.appendChild(logWindow[o+"Enabled"]);
4458        var label = doc.createElement("label");
4459        label.setAttribute("for", o);
4460        label.appendChild(doc.createTextNode(options[o][0]));
4461        li.appendChild(label);
4462    }
4463    logWindow.log = doc.createElement("div");
4464    logWindow.log.setAttribute("class", "enerror endebug enwarn eninfo enfatal entrace");
4465    body.appendChild(logWindow.log);
4466    logWindow.toggle = function(elem) {
4467        var enabled = (elem.getAttribute("enabled") == "yes") ? "no" : "yes";
4468        elem.setAttribute("enabled", enabled);
4469        if (enabled == "yes")
4470            logWindow.log.className += " " + elem.id
4471        else
4472            logWindow.log.className = logWindow.log.className.replace(new RegExp("[\\s]*"+elem.id, "g"), "");
4473    }
4474    logWindow.scrollToBottom = function() {
4475        logWindow.scrollTo(0, body.offsetHeight);
4476    }
4477    logWindow.wrapEnabled.addEventListener("click", function() {
4478        logWindow.log.setAttribute("wrap", logWindow.wrapEnabled.checked ? "yes" : "no");
4479    }, false);
4480    logWindow.addEventListener("keydown", function(e) {
4481        var e = e || logWindow.event;
4482        if (e.keyCode == 75 && (e.ctrlKey || e.metaKey)) {
4483            while (logWindow.log.firstChild) {
4484                logWindow.log.removeChild(logWindow.log.firstChild);
4485            }
4486            e.preventDefault();
4487        }
4488    }, "false");
4489    window.addEventListener("unload", function() {
4490        if (logWindow && logWindow.closeEnabled && logWindow.closeEnabled.checked) {
4491            window.CPLogDisable = true;
4492            logWindow.close();
4493        }
4494    }, false);
4495    logWindow.addEventListener("unload", function() {
4496        if (!window.CPLogDisable) {
4497            window.CPLogDisable = !confirm("Click cancel to stop logging");
4498        }
4499    }, false);
4500}
4501
4502p;16;CPNotification.ji;10;CPObject.ji;13;CPException.jc;2045;
4503{var the_class = objj_allocateClassPair(CPObject, "CPNotification"),
4504meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_name"), new objj_ivar("_object"), new objj_ivar("_userInfo")]);
4505objj_registerClassPair(the_class);
4506objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
4507class_addMethods(the_class, [new objj_method(sel_getUid("init"), function $CPNotification__init(self, _cmd)
4508{ with(self)
4509{
4510    objj_msgSend(CPException, "raise:reason:", CPUnsupportedMethodException, "CPNotification's init method should not be used");
4511}
4512}), new objj_method(sel_getUid("initWithName:object:userInfo:"), function $CPNotification__initWithName_object_userInfo_(self, _cmd, aNotificationName, anObject, aUserInfo)
4513{ with(self)
4514{
4515    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
4516    if (self)
4517    {
4518        _name = aNotificationName;
4519        _object = anObject;
4520        _userInfo = aUserInfo;
4521    }
4522    return self;
4523}
4524}), new objj_method(sel_getUid("name"), function $CPNotification__name(self, _cmd)
4525{ with(self)
4526{
4527    return _name;
4528}
4529}), new objj_method(sel_getUid("object"), function $CPNotification__object(self, _cmd)
4530{ with(self)
4531{
4532    return _object;
4533}
4534}), new objj_method(sel_getUid("userInfo"), function $CPNotification__userInfo(self, _cmd)
4535{ with(self)
4536{
4537    return _userInfo;
4538}
4539})]);
4540class_addMethods(meta_class, [new objj_method(sel_getUid("notificationWithName:object:userInfo:"), function $CPNotification__notificationWithName_object_userInfo_(self, _cmd, aNotificationName, anObject, aUserInfo)
4541{ with(self)
4542{
4543    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithName:object:userInfo:", aNotificationName, anObject, aUserInfo);
4544}
4545}), new objj_method(sel_getUid("notificationWithName:object:"), function $CPNotification__notificationWithName_object_(self, _cmd, aNotificationName, anObject)
4546{ with(self)
4547{
4548    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithName:object:userInfo:", aNotificationName, anObject, nil);
4549}
4550})]);
4551}
4552
4553p;22;CPNotificationCenter.ji;9;CPArray.ji;14;CPDictionary.ji;16;CPNotification.ji;13;CPException.jc;10027;
4554var CPNotificationDefaultCenter = nil;
4555{var the_class = objj_allocateClassPair(CPObject, "CPNotificationCenter"),
4556meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_namedRegistries"), new objj_ivar("_unnamedRegistry")]);
4557objj_registerClassPair(the_class);
4558objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
4559class_addMethods(the_class, [new objj_method(sel_getUid("init"), function $CPNotificationCenter__init(self, _cmd)
4560{ with(self)
4561{
4562    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
4563    if (self)
4564    {
4565        _namedRegistries = objj_msgSend(CPDictionary, "dictionary");
4566        _unnamedRegistry = objj_msgSend(objj_msgSend(_CPNotificationRegistry, "alloc"), "init");
4567    }
4568   return self;
4569}
4570}), new objj_method(sel_getUid("addObserver:selector:name:object:"), function $CPNotificationCenter__addObserver_selector_name_object_(self, _cmd, anObserver, aSelector, aNotificationName, anObject)
4571{ with(self)
4572{
4573    var registry,
4574        observer = objj_msgSend(objj_msgSend(_CPNotificationObserver, "alloc"), "initWithObserver:selector:", anObserver, aSelector);
4575    if (aNotificationName == nil)
4576        registry = _unnamedRegistry;
4577    else if (!(registry = objj_msgSend(_namedRegistries, "objectForKey:", aNotificationName)))
4578    {
4579        registry = objj_msgSend(objj_msgSend(_CPNotificationRegistry, "alloc"), "init");
4580        objj_msgSend(_namedRegistries, "setObject:forKey:", registry, aNotificationName);
4581    }
4582    objj_msgSend(registry, "addObserver:object:", observer, anObject);
4583}
4584}), new objj_method(sel_getUid("removeObserver:"), function $CPNotificationCenter__removeObserver_(self, _cmd, anObserver)
4585{ with(self)
4586{
4587    var name = nil,
4588        names = objj_msgSend(_namedRegistries, "keyEnumerator");
4589    while (name = objj_msgSend(names, "nextObject"))
4590        objj_msgSend(objj_msgSend(_namedRegistries, "objectForKey:", name), "removeObserver:object:", anObserver, nil);
4591    objj_msgSend(_unnamedRegistry, "removeObserver:object:", anObserver, nil);
4592}
4593}), new objj_method(sel_getUid("removeObserver:name:object:"), function $CPNotificationCenter__removeObserver_name_object_(self, _cmd, anObserver, aNotificationName, anObject)
4594{ with(self)
4595{
4596    if (aNotificationName == nil)
4597    {
4598        var name = nil,
4599            names = objj_msgSend(_namedRegistries, "keyEnumerator");
4600        while (name = objj_msgSend(names, "nextObject"))
4601            objj_msgSend(objj_msgSend(_namedRegistries, "objectForKey:", name), "removeObserver:object:", anObserver, anObject);
4602        objj_msgSend(_unnamedRegistry, "removeObserver:object:", anObserver, anObject);
4603    }
4604    else
4605        objj_msgSend(objj_msgSend(_namedRegistries, "objectForKey:", aNotificationName), "removeObserver:object:", anObserver, anObject);
4606}
4607}), new objj_method(sel_getUid("postNotification:"), function $CPNotificationCenter__postNotification_(self, _cmd, aNotification)
4608{ with(self)
4609{
4610    if (!aNotification)
4611        objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "postNotification: does not except 'nil' notifications");
4612    _CPNotificationCenterPostNotification(self, aNotification);
4613}
4614}), new objj_method(sel_getUid("postNotificationName:object:userInfo:"), function $CPNotificationCenter__postNotificationName_object_userInfo_(self, _cmd, aNotificationName, anObject, aUserInfo)
4615{ with(self)
4616{
4617   _CPNotificationCenterPostNotification(self, objj_msgSend(objj_msgSend(CPNotification, "alloc"), "initWithName:object:userInfo:", aNotificationName, anObject, aUserInfo));
4618}
4619}), new objj_method(sel_getUid("postNotificationName:object:"), function $CPNotificationCenter__postNotificationName_object_(self, _cmd, aNotificationName, anObject)
4620{ with(self)
4621{
4622   _CPNotificationCenterPostNotification(self, objj_msgSend(objj_msgSend(CPNotification, "alloc"), "initWithName:object:userInfo:", aNotificationName, anObject, nil));
4623}
4624})]);
4625class_addMethods(meta_class, [new objj_method(sel_getUid("defaultCenter"), function $CPNotificationCenter__defaultCenter(self, _cmd)
4626{ with(self)
4627{
4628    if (!CPNotificationDefaultCenter)
4629        CPNotificationDefaultCenter = objj_msgSend(objj_msgSend(CPNotificationCenter, "alloc"), "init");
4630    return CPNotificationDefaultCenter;
4631}
4632})]);
4633}
4634var _CPNotificationCenterPostNotification = function( self, aNotification)
4635{
4636    objj_msgSend(self._unnamedRegistry, "postNotification:", aNotification);
4637    objj_msgSend(objj_msgSend(self._namedRegistries, "objectForKey:", objj_msgSend(aNotification, "name")), "postNotification:", aNotification);
4638}
4639{var the_class = objj_allocateClassPair(CPObject, "_CPNotificationRegistry"),
4640meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_objectObservers"), new objj_ivar("_observerRemoval"), new objj_ivar("_postingObservers")]);
4641objj_registerClassPair(the_class);
4642objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
4643class_addMethods(the_class, [new objj_method(sel_getUid("init"), function $_CPNotificationRegistry__init(self, _cmd)
4644{ with(self)
4645{
4646    if (self)
4647        _objectObservers = objj_msgSend(CPDictionary, "dictionary");
4648   return self;
4649}
4650}), new objj_method(sel_getUid("addObserver:object:"), function $_CPNotificationRegistry__addObserver_object_(self, _cmd, anObserver, anObject)
4651{ with(self)
4652{
4653    if (!anObject)
4654        anObject = objj_msgSend(CPNull, "null");
4655    var observers = objj_msgSend(_objectObservers, "objectForKey:", objj_msgSend(anObject, "hash"));
4656    if (!observers)
4657    {
4658        observers = [];
4659        objj_msgSend(_objectObservers, "setObject:forKey:", observers, objj_msgSend(anObject, "hash"));
4660    }
4661    if (observers == _postingObservers)
4662        _postingObservers = objj_msgSend(observers, "copy");
4663    observers.push(anObserver);
4664}
4665}), new objj_method(sel_getUid("removeObserver:object:"), function $_CPNotificationRegistry__removeObserver_object_(self, _cmd, anObserver, anObject)
4666{ with(self)
4667{
4668    var removedKeys = [];
4669    if (anObject == nil)
4670    {
4671        var key = nil,
4672            keys = objj_msgSend(_objectObservers, "keyEnumerator");
4673        while (key = objj_msgSend(keys, "nextObject"))
4674        {
4675            var observers = objj_msgSend(_objectObservers, "objectForKey:", key),
4676                count = observers ? observers.length : 0;
4677            while (count--)
4678                if (objj_msgSend(observers[count], "observer") == anObserver)
4679                {
4680                    _observerRemoval = YES;
4681                    if (observers == _postingObservers)
4682                        _postingObservers = objj_msgSend(observers, "copy");
4683                    observers.splice(count, 1);
4684                }
4685            if (!observers || observers.length == 0)
4686                removedKeys.push(key);
4687        }
4688    }
4689    else
4690    {
4691        var key = objj_msgSend(anObject, "hash"),
4692            observers = objj_msgSend(_objectObservers, "objectForKey:", key);
4693            count = observers ? observers.length : 0;
4694        while (count--)
4695            if (objj_msgSend(observers[count], "observer") == anObserver)
4696            {
4697                _observerRemoval = YES;
4698                if (observers == _postingObservers)
4699                    _postingObservers = objj_msgSend(observers, "copy");
4700                observers.splice(count, 1)
4701            }
4702        if (!observers || observers.length == 0)
4703            removedKeys.push(key);
4704    }
4705    var count = removedKeys.length;
4706    while (count--)
4707        objj_msgSend(_objectObservers, "removeObjectForKey:", removedKeys[count]);
4708}
4709}), new objj_method(sel_getUid("postNotification:"), function $_CPNotificationRegistry__postNotification_(self, _cmd, aNotification)
4710{ with(self)
4711{
4712    var object = objj_msgSend(aNotification, "object");
4713    if (object != nil && (_postingObservers = objj_msgSend(_objectObservers, "objectForKey:", objj_msgSend(object, "hash"))))
4714    {
4715        var observers = _postingObservers,
4716            count = observers.length;
4717        _observerRemoval = NO;
4718        while (count--)
4719        {
4720            var observer = _postingObservers[count];
4721            if (!_observerRemoval || objj_msgSend(observers, "indexOfObjectIdenticalTo:", observer) != CPNotFound)
4722                objj_msgSend(observer, "postNotification:", aNotification);
4723        }
4724    }
4725    _postingObservers = objj_msgSend(_objectObservers, "objectForKey:", objj_msgSend(objj_msgSend(CPNull, "null"), "hash"));
4726    if (!_postingObservers)
4727        return;
4728    var observers = _postingObservers,
4729        count = observers.length;
4730    _observerRemoval = NO;
4731    while (count--)
4732    {
4733        var observer = _postingObservers[count];
4734        if (!_observerRemoval || objj_msgSend(observers, "indexOfObjectIdenticalTo:", observer) != CPNotFound)
4735            objj_msgSend(observer, "postNotification:", aNotification);
4736    }
4737    _postingObservers = nil;
4738}
4739}), new objj_method(sel_getUid("count"), function $_CPNotificationRegistry__count(self, _cmd)
4740{ with(self)
4741{
4742    return objj_msgSend(_objectObservers, "count");
4743}
4744})]);
4745}
4746{var the_class = objj_allocateClassPair(CPObject, "_CPNotificationObserver"),
4747meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_observer"), new objj_ivar("_selector")]);
4748objj_registerClassPair(the_class);
4749objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
4750class_addMethods(the_class, [new objj_method(sel_getUid("initWithObserver:selector:"), function $_CPNotificationObserver__initWithObserver_selector_(self, _cmd, anObserver, aSelector)
4751{ with(self)
4752{
4753    if (self)
4754    {
4755        _observer = anObserver;
4756        _selector = aSelector;
4757    }
4758   return self;
4759}
4760}), new objj_method(sel_getUid("observer"), function $_CPNotificationObserver__observer(self, _cmd)
4761{ with(self)
4762{
4763    return _observer;
4764}
4765}), new objj_method(sel_getUid("postNotification:"), function $_CPNotificationObserver__postNotification_(self, _cmd, aNotification)
4766{ with(self)
4767{
4768    objj_msgSend(_observer, "performSelector:withObject:", _selector, aNotification);
4769}
4770})]);
4771}
4772
4773p;8;CPNull.ji;10;CPObject.jc;500;
4774var CPNullSharedNull = nil;
4775{var the_class = objj_allocateClassPair(CPObject, "CPNull"),
4776meta_class = the_class.isa;objj_registerClassPair(the_class);
4777objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
4778class_addMethods(meta_class, [new objj_method(sel_getUid("null"), function $CPNull__null(self, _cmd)
4779{ with(self)
4780{
4781    if (!CPNullSharedNull)
4782        CPNullSharedNull = objj_msgSend(objj_msgSend(CPNull, "alloc"), "init");
4783    return CPNullSharedNull;
4784}
4785})]);
4786}
4787
4788p;10;CPNumber.ji;10;CPObject.ji;15;CPObjJRuntime.jc;8499;
4789var __placeholder = new Number(),
4790    _CPNumberHashes = { };
4791{var the_class = objj_allocateClassPair(CPObject, "CPNumber"),
4792meta_class = the_class.isa;objj_registerClassPair(the_class);
4793objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
4794class_addMethods(the_class, [new objj_method(sel_getUid("initWithBool:"), function $CPNumber__initWithBool_(self, _cmd, aBoolean)
4795{ with(self)
4796{
4797    return aBoolean;
4798}
4799}), new objj_method(sel_getUid("initWithChar:"), function $CPNumber__initWithChar_(self, _cmd, aChar)
4800{ with(self)
4801{
4802    if (aChar.charCodeAt)
4803        return aChar.charCodeAt(0);
4804    return aChar;
4805}
4806}), new objj_method(sel_getUid("initWithDouble:"), function $CPNumber__initWithDouble_(self, _cmd, aDouble)
4807{ with(self)
4808{
4809    return aDouble;
4810}
4811}), new objj_method(sel_getUid("initWithFloat:"), function $CPNumber__initWithFloat_(self, _cmd, aFloat)
4812{ with(self)
4813{
4814    return aFloat;
4815}
4816}), new objj_method(sel_getUid("initWithInt:"), function $CPNumber__initWithInt_(self, _cmd, anInt)
4817{ with(self)
4818{
4819    return anInt;
4820}
4821}), new objj_method(sel_getUid("initWithLong:"), function $CPNumber__initWithLong_(self, _cmd, aLong)
4822{ with(self)
4823{
4824    return aLong;
4825}
4826}), new objj_method(sel_getUid("initWithLongLong:"), function $CPNumber__initWithLongLong_(self, _cmd, aLongLong)
4827{ with(self)
4828{
4829    return aLongLong;
4830}
4831}), new objj_method(sel_getUid("initWithShort:"), function $CPNumber__initWithShort_(self, _cmd, aShort)
4832{ with(self)
4833{
4834    return aShort;
4835}
4836}), new objj_method(sel_getUid("initWithUnsignedChar:"), function $CPNumber__initWithUnsignedChar_(self, _cmd, aChar)
4837{ with(self)
4838{
4839    if (aChar.charCodeAt)
4840        return aChar.charCodeAt(0);
4841    return aChar;
4842}
4843}), new objj_method(sel_getUid("initWithUnsignedInt:"), function $CPNumber__initWithUnsignedInt_(self, _cmd, anUnsignedInt)
4844{ with(self)
4845{
4846    return anUnsignedInt;
4847}
4848}), new objj_method(sel_getUid("initWithUnsignedLong:"), function $CPNumber__initWithUnsignedLong_(self, _cmd, anUnsignedLong)
4849{ with(self)
4850{
4851    return anUnsignedLong;
4852}
4853}), new objj_method(sel_getUid("initWithUnsignedShort:"), function $CPNumber__initWithUnsignedShort_(self, _cmd, anUnsignedShort)
4854{ with(self)
4855{
4856    return anUnsignedShort;
4857}
4858}), new objj_method(sel_getUid("hash"), function $CPNumber__hash(self, _cmd)
4859{ with(self)
4860{
4861    if (!_CPNumberHashes[self])
4862        _CPNumberHashes[self] = _objj_generateObjectHash();
4863    return _CPNumberHashes[self];
4864}
4865}), new objj_method(sel_getUid("boolValue"), function $CPNumber__boolValue(self, _cmd)
4866{ with(self)
4867{
4868    return self ? true : false;
4869}
4870}), new objj_method(sel_getUid("charValue"), function $CPNumber__charValue(self, _cmd)
4871{ with(self)
4872{
4873    return String.fromCharCode(self);
4874}
4875}), new objj_method(sel_getUid("decimalValue"), function $CPNumber__decimalValue(self, _cmd)
4876{ with(self)
4877{
4878    objj_throw_exception("decimalValue: NOT YET IMPLEMENTED");
4879}
4880}), new objj_method(sel_getUid("descriptionWithLocale:"), function $CPNumber__descriptionWithLocale_(self, _cmd, aDictionary)
4881{ with(self)
4882{
4883    if (!aDictionary) return toString();
4884    objj_throw_exception("descriptionWithLocale: NOT YET IMPLEMENTED");
4885}
4886}), new objj_method(sel_getUid("description"), function $CPNumber__description(self, _cmd)
4887{ with(self)
4888{
4889    return objj_msgSend(self, "descriptionWithLocale:", nil);
4890}
4891}), new objj_method(sel_getUid("doubleValue"), function $CPNumber__doubleValue(self, _cmd)
4892{ with(self)
4893{
4894    if (typeof self == "boolean") return self ? 1 : 0;
4895    return self;
4896}
4897}), new objj_method(sel_getUid("floatValue"), function $CPNumber__floatValue(self, _cmd)
4898{ with(self)
4899{
4900    if (typeof self == "boolean") return self ? 1 : 0;
4901    return self;
4902}
4903}), new objj_method(sel_getUid("intValue"), function $CPNumber__intValue(self, _cmd)
4904{ with(self)
4905{
4906    if (typeof self == "boolean") return self ? 1 : 0;
4907    return self;
4908}
4909}), new objj_method(sel_getUid("longLongValue"), function $CPNumber__longLongValue(self, _cmd)
4910{ with(self)
4911{
4912    if (typeof self == "boolean") return self ? 1 : 0;
4913    return self;
4914}
4915}), new objj_method(sel_getUid("longValue"), function $CPNumber__longValue(self, _cmd)
4916{ with(self)
4917{
4918    if (typeof self == "boolean") return self ? 1 : 0;
4919    return self;
4920}
4921}), new objj_method(sel_getUid("shortValue"), function $CPNumber__shortValue(self, _cmd)
4922{ with(self)
4923{
4924    if (typeof self == "boolean") return self ? 1 : 0;
4925    return self;
4926}
4927}), new objj_method(sel_getUid("stringValue"), function $CPNumber__stringValue(self, _cmd)
4928{ with(self)
4929{
4930    return toString();
4931}
4932}), new objj_method(sel_getUid("unsignedCharValue"), function $CPNumber__unsignedCharValue(self, _cmd)
4933{ with(self)
4934{
4935    return String.fromCharCode(self);
4936}
4937}), new objj_method(sel_getUid("unsignedIntValue"), function $CPNumber__unsignedIntValue(self, _cmd)
4938{ with(self)
4939{
4940    if (typeof self == "boolean") return self ? 1 : 0;
4941    return self;
4942}
4943}), new objj_method(sel_getUid("unsignedLongValue"), function $CPNumber__unsignedLongValue(self, _cmd)
4944{ with(self)
4945{
4946    if (typeof self == "boolean") return self ? 1 : 0;
4947    return self;
4948}
4949}), new objj_method(sel_getUid("unsignedShortValue"), function $CPNumber__unsignedShortValue(self, _cmd)
4950{ with(self)
4951{
4952    if (typeof self == "boolean") return self ? 1 : 0;
4953    return self;
4954}
4955}), new objj_method(sel_getUid("compare:"), function $CPNumber__compare_(self, _cmd, aNumber)
4956{ with(self)
4957{
4958    if (self > aNumber) return CPOrderedDescending;
4959    else if (self < aNumber) return CPOrderedAscending;
4960    return CPOrderedSame;
4961}
4962}), new objj_method(sel_getUid("isEqualToNumber:"), function $CPNumber__isEqualToNumber_(self, _cmd, aNumber)
4963{ with(self)
4964{
4965    return self == aNumber;
4966}
4967})]);
4968class_addMethods(meta_class, [new objj_method(sel_getUid("alloc"), function $CPNumber__alloc(self, _cmd)
4969{ with(self)
4970{
4971    return __placeholder;
4972}
4973}), new objj_method(sel_getUid("numberWithBool:"), function $CPNumber__numberWithBool_(self, _cmd, aBoolean)
4974{ with(self)
4975{
4976    return aBoolean;
4977}
4978}), new objj_method(sel_getUid("numberWithChar:"), function $CPNumber__numberWithChar_(self, _cmd, aChar)
4979{ with(self)
4980{
4981    if (aChar.charCodeAt)
4982        return aChar.charCodeAt(0);
4983    return aChar;
4984}
4985}), new objj_method(sel_getUid("numberWithDouble:"), function $CPNumber__numberWithDouble_(self, _cmd, aDouble)
4986{ with(self)
4987{
4988    return aDouble;
4989}
4990}), new objj_method(sel_getUid("numberWithFloat:"), function $CPNumber__numberWithFloat_(self, _cmd, aFloat)
4991{ with(self)
4992{
4993    return aFloat;
4994}
4995}), new objj_method(sel_getUid("numberWithInt:"), function $CPNumber__numberWithInt_(self, _cmd, anInt)
4996{ with(self)
4997{
4998    return anInt;
4999}
5000}), new objj_method(sel_getUid("numberWithLong:"), function $CPNumber__numberWithLong_(self, _cmd, aLong)
5001{ with(self)
5002{
5003    return aLong;
5004}
5005}), new objj_method(sel_getUid("numberWithLongLong:"), function $CPNumber__numberWithLongLong_(self, _cmd, aLongLong)
5006{ with(self)
5007{
5008    return aLongLong;
5009}
5010}), new objj_method(sel_getUid("numberWithShort:"), function $CPNumber__numberWithShort_(self, _cmd, aShort)
5011{ with(self)
5012{
5013    return aShort;
5014}
5015}), new objj_method(sel_getUid("numberWithUnsignedChar:"), function $CPNumber__numberWithUnsignedChar_(self, _cmd, aChar)
5016{ with(self)
5017{
5018    if (aChar.charCodeAt)
5019        return aChar.charCodeAt(0);
5020    return aChar;
5021}
5022}), new objj_method(sel_getUid("numberWithUnsignedInt:"), function $CPNumber__numberWithUnsignedInt_(self, _cmd, anUnsignedInt)
5023{ with(self)
5024{
5025    return anUnsignedInt;
5026}
5027}), new objj_method(sel_getUid("numberWithUnsignedLong:"), function $CPNumber__numberWithUnsignedLong_(self, _cmd, anUnsignedLong)
5028{ with(self)
5029{
5030    return anUnsignedLong;
5031}
5032}), new objj_method(sel_getUid("numberWithUnsignedShort:"), function $CPNumber__numberWithUnsignedShort_(self, _cmd, anUnsignedShort)
5033{ with(self)
5034{
5035    return anUnsignedShort;
5036}
5037})]);
5038}
5039{
5040var the_class = objj_getClass("CPNumber")
5041if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPNumber\""));
5042var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $CPNumber__initWithCoder_(self, _cmd, aCoder)
5043{ with(self)
5044{
5045    return objj_msgSend(aCoder, "decodeNumber");
5046}
5047}), new objj_method(sel_getUid("encodeWithCoder:"), function $CPNumber__encodeWithCoder_(self, _cmd, aCoder)
5048{ with(self)
5049{
5050    objj_msgSend(aCoder, "encodeNumber:forKey:", self, "self");
5051}
5052})]);
5053}
5054Number.prototype.isa = CPNumber;
5055Boolean.prototype.isa = CPNumber;
5056objj_msgSend(CPNumber, "initialize");
5057
5058p;10;CPObject.jc;8745;{var the_class = objj_allocateClassPair(Nil, "CPObject"),
5059meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("isa")]);
5060objj_registerClassPair(the_class);
5061objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
5062class_addMethods(the_class, [new objj_method(sel_getUid("init"), function $CPObject__init(self, _cmd)
5063{ with(self)
5064{
5065    return self;
5066}
5067}), new objj_method(sel_getUid("copy"), function $CPObject__copy(self, _cmd)
5068{ with(self)
5069{
5070    return self;
5071}
5072}), new objj_method(sel_getUid("mutableCopy"), function $CPObject__mutableCopy(self, _cmd)
5073{ with(self)
5074{
5075    return objj_msgSend(self, "copy");
5076}
5077}), new objj_method(sel_getUid("dealloc"), function $CPObject__dealloc(self, _cmd)
5078{ with(self)
5079{
5080}
5081}), new objj_method(sel_getUid("class"), function $CPObject__class(self, _cmd)
5082{ with(self)
5083{
5084    return isa;
5085}
5086}), new objj_method(sel_getUid("isKindOfClass:"), function $CPObject__isKindOfClass_(self, _cmd, aClass)
5087{ with(self)
5088{
5089    return objj_msgSend(isa, "isSubclassOfClass:", aClass);
5090}
5091}), new objj_method(sel_getUid("isMemberOfClass:"), function $CPObject__isMemberOfClass_(self, _cmd, aClass)
5092{ with(self)
5093{
5094    return self.isa === aClass;
5095}
5096}), new objj_method(sel_getUid("isProxy"), function $CPObject__isProxy(self, _cmd)
5097{ with(self)
5098{
5099    return NO;
5100}
5101}), new objj_method(sel_getUid("respondsToSelector:"), function $CPObject__respondsToSelector_(self, _cmd, aSelector)
5102{ with(self)
5103{
5104    return !!class_getInstanceMethod(isa, aSelector);
5105}
5106}), new objj_method(sel_getUid("methodForSelector:"), function $CPObject__methodForSelector_(self, _cmd, aSelector)
5107{ with(self)
5108{
5109    return class_getMethodImplementation(isa, aSelector);
5110}
5111}), new objj_method(sel_getUid("methodSignatureForSelector:"), function $CPObject__methodSignatureForSelector_(self, _cmd, aSelector)
5112{ with(self)
5113{
5114    return nil;
5115}
5116}), new objj_method(sel_getUid("description"), function $CPObject__description(self, _cmd)
5117{ with(self)
5118{
5119    return "<" + isa.name + " 0x" + objj_msgSend(CPString, "stringWithHash:", objj_msgSend(self, "hash")) + ">";
5120}
5121}), new objj_method(sel_getUid("performSelector:"), function $CPObject__performSelector_(self, _cmd, aSelector)
5122{ with(self)
5123{
5124    return objj_msgSend(self, aSelector);
5125}
5126}), new objj_method(sel_getUid("performSelector:withObject:"), function $CPObject__performSelector_withObject_(self, _cmd, aSelector, anObject)
5127{ with(self)
5128{
5129    return objj_msgSend(self, aSelector, anObject);
5130}
5131}), new objj_method(sel_getUid("performSelector:withObject:withObject:"), function $CPObject__performSelector_withObject_withObject_(self, _cmd, aSelector, anObject, anotherObject)
5132{ with(self)
5133{
5134    return objj_msgSend(self, aSelector, anObject, anotherObject);
5135}
5136}), new objj_method(sel_getUid("forwardInvocation:"), function $CPObject__forwardInvocation_(self, _cmd, anInvocation)
5137{ with(self)
5138{
5139    objj_msgSend(self, "doesNotRecognizeSelector:", objj_msgSend(anInvocation, "selector"));
5140}
5141}), new objj_method(sel_getUid("forward::"), function $CPObject__forward__(self, _cmd, aSelector, args)
5142{ with(self)
5143{
5144    var signature = objj_msgSend(self, "methodSignatureForSelector:", aSelector);
5145    if (signature)
5146    {
5147        invocation = objj_msgSend(CPInvocation, "invocationWithMethodSignature:", signature);
5148        objj_msgSend(invocation, "setTarget:", self);
5149        objj_msgSend(invocation, "setSelector:", aSelector);
5150        var index = 2,
5151            count = args.length;
5152        for (; index < count; ++index)
5153            objj_msgSend(invocation, "setArgument:atIndex:", args[index], index);
5154        objj_msgSend(self, "forwardInvocation:", invocation);
5155        return objj_msgSend(invocation, "returnValue");
5156    }
5157    objj_msgSend(self, "doesNotRecognizeSelector:", aSelector);
5158}
5159}), new objj_method(sel_getUid("doesNotRecognizeSelector:"), function $CPObject__doesNotRecognizeSelector_(self, _cmd, aSelector)
5160{ with(self)
5161{
5162    objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, 
5163        (class_isMetaClass(isa) ? "+" : "-") + " [" + objj_msgSend(self, "className") + " " + aSelector + "] unrecognized selector sent to " +
5164        (class_isMetaClass(isa) ? "class" : "instance") + " 0x" + objj_msgSend(CPString, "stringWithHash:", objj_msgSend(self, "hash")));
5165}
5166}), new objj_method(sel_getUid("awakeAfterUsingCoder:"), function $CPObject__awakeAfterUsingCoder_(self, _cmd, aCoder)
5167{ with(self)
5168{
5169    return self;
5170}
5171}), new objj_method(sel_getUid("classForKeyedArchiver"), function $CPObject__classForKeyedArchiver(self, _cmd)
5172{ with(self)
5173{
5174    return objj_msgSend(self, "classForCoder");
5175}
5176}), new objj_method(sel_getUid("classForCoder"), function $CPObject__classForCoder(self, _cmd)
5177{ with(self)
5178{
5179    return objj_msgSend(self, "class");
5180}
5181}), new objj_method(sel_getUid("replacementObjectForArchiver:"), function $CPObject__replacementObjectForArchiver_(self, _cmd, anArchiver)
5182{ with(self)
5183{
5184    return objj_msgSend(self, "replacementObjectForCoder:", anArchiver);
5185}
5186}), new objj_method(sel_getUid("replacementObjectForKeyedArchiver:"), function $CPObject__replacementObjectForKeyedArchiver_(self, _cmd, anArchiver)
5187{ with(self)
5188{
5189    return objj_msgSend(self, "replacementObjectForCoder:", anArchiver);
5190}
5191}), new objj_method(sel_getUid("replacementObjectForCoder:"), function $CPObject__replacementObjectForCoder_(self, _cmd, aCoder)
5192{ with(self)
5193{
5194    return self;
5195}
5196}), new objj_method(sel_getUid("className"), function $CPObject__className(self, _cmd)
5197{ with(self)
5198{
5199    return isa.name;
5200}
5201}), new objj_method(sel_getUid("autorelease"), function $CPObject__autorelease(self, _cmd)
5202{ with(self)
5203{
5204    return self;
5205}
5206}), new objj_method(sel_getUid("hash"), function $CPObject__hash(self, _cmd)
5207{ with(self)
5208{
5209    return __address;
5210}
5211}), new objj_method(sel_getUid("isEqual:"), function $CPObject__isEqual_(self, _cmd, anObject)
5212{ with(self)
5213{
5214    return self === anObject || objj_msgSend(self, "hash") === objj_msgSend(anObject, "hash");
5215}
5216}), new objj_method(sel_getUid("retain"), function $CPObject__retain(self, _cmd)
5217{ with(self)
5218{
5219    return self;
5220}
5221}), new objj_method(sel_getUid("release"), function $CPObject__release(self, _cmd)
5222{ with(self)
5223{
5224}
5225}), new objj_method(sel_getUid("self"), function $CPObject__self(self, _cmd)
5226{ with(self)
5227{
5228    return self;
5229}
5230}), new objj_method(sel_getUid("superclass"), function $CPObject__superclass(self, _cmd)
5231{ with(self)
5232{
5233    return isa.super_class;
5234}
5235})]);
5236class_addMethods(meta_class, [new objj_method(sel_getUid("load"), function $CPObject__load(self, _cmd)
5237{ with(self)
5238{
5239}
5240}), new objj_method(sel_getUid("initialize"), function $CPObject__initialize(self, _cmd)
5241{ with(self)
5242{
5243}
5244}), new objj_method(sel_getUid("new"), function $CPObject__new(self, _cmd)
5245{ with(self)
5246{
5247    return objj_msgSend(objj_msgSend(self, "alloc"), "init");
5248}
5249}), new objj_method(sel_getUid("alloc"), function $CPObject__alloc(self, _cmd)
5250{ with(self)
5251{
5252    return class_createInstance(self);
5253}
5254}), new objj_method(sel_getUid("class"), function $CPObject__class(self, _cmd)
5255{ with(self)
5256{
5257    return self;
5258}
5259}), new objj_method(sel_getUid("superclass"), function $CPObject__superclass(self, _cmd)
5260{ with(self)
5261{
5262    return super_class;
5263}
5264}), new objj_method(sel_getUid("isSubclassOfClass:"), function $CPObject__isSubclassOfClass_(self, _cmd, aClass)
5265{ with(self)
5266{
5267    var theClass = self;
5268    for(; theClass; theClass = theClass.super_class)
5269        if(theClass === aClass)
5270            return YES;
5271    return NO;
5272}
5273}), new objj_method(sel_getUid("isKindOfClass:"), function $CPObject__isKindOfClass_(self, _cmd, aClass)
5274{ with(self)
5275{
5276    return objj_msgSend(self, "isSubclassOfClass:", aClass);
5277}
5278}), new objj_method(sel_getUid("isMemberOfClass:"), function $CPObject__isMemberOfClass_(self, _cmd, aClass)
5279{ with(self)
5280{
5281    return self === aClass;
5282}
5283}), new objj_method(sel_getUid("instancesRespondToSelector:"), function $CPObject__instancesRespondToSelector_(self, _cmd, aSelector)
5284{ with(self)
5285{
5286    return !!class_getInstanceMethod(self, aSelector);
5287}
5288}), new objj_method(sel_getUid("instanceMethodForSelector:"), function $CPObject__instanceMethodForSelector_(self, _cmd, aSelector)
5289{ with(self)
5290{
5291    return class_getMethodImplementation(self, aSelector);
5292}
5293}), new objj_method(sel_getUid("setVersion:"), function $CPObject__setVersion_(self, _cmd, aVersion)
5294{ with(self)
5295{
5296    version = aVersion;
5297    return self;
5298}
5299}), new objj_method(sel_getUid("version"), function $CPObject__version(self, _cmd)
5300{ with(self)
5301{
5302    return version;
5303}
5304})]);
5305}
5306objj_object.prototype.toString = function()
5307{
5308    if (this.isa && class_getInstanceMethod(this.isa, "description") != NULL)
5309        return objj_msgSend(this, "description")
5310    else
5311        return String(this) + " (-description not implemented)";
5312}
5313
5314p;15;CPObjJRuntime.ji;7;CPLog.jc;467;
5315CPStringFromSelector= function(aSelector)
5316{
5317    return sel_getName(aSelector);
5318}
5319CPSelectorFromString= function(aSelectorName)
5320{
5321    return sel_registerName(aSelectorName);
5322}
5323CPClassFromString= function(aClassName)
5324{
5325    return objj_getClass(aClassName);
5326}
5327CPStringFromClass= function(aClass)
5328{
5329    return class_getName(aClass);
5330}
5331CPOrderedAscending = -1;
5332CPOrderedSame = 0;
5333CPOrderedDescending = 1;
5334CPNotFound = -1;
5335MIN = Math.min;
5336MAX = Math.max;
5337ABS = Math.abs;
5338
5339p;29;CPPropertyListSerialization.ji;10;CPObject.jc;1089;
5340CPPropertyListOpenStepFormat = kCFPropertyListOpenStepFormat;
5341CPPropertyListXMLFormat_v1_0 = kCFPropertyListXMLFormat_v1_0;
5342CPPropertyListBinaryFormat_v1_0 = kCFPropertyListBinaryFormat_v1_0;
5343CPPropertyList280NorthFormat_v1_0 = kCFPropertyList280NorthFormat_v1_0;
5344{var the_class = objj_allocateClassPair(CPObject, "CPPropertyListSerialization"),
5345meta_class = the_class.isa;objj_registerClassPair(the_class);
5346objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
5347class_addMethods(meta_class, [new objj_method(sel_getUid("dataFromPropertyList:format:errorDescription:"), function $CPPropertyListSerialization__dataFromPropertyList_format_errorDescription_(self, _cmd, aPlist, aFormat, anErrorString)
5348{ with(self)
5349{
5350    return CPPropertyListCreateData(aPlist, aFormat);
5351}
5352}), new objj_method(sel_getUid("propertyListFromData:format:errorDescription:"), function $CPPropertyListSerialization__propertyListFromData_format_errorDescription_(self, _cmd, data, aFormat, errorString)
5353{ with(self)
5354{
5355    return CPPropertyListCreateFromData(data, aFormat);
5356}
5357})]);
5358}
5359
5360p;9;CPRange.jc;1714;CPMakeRange= function(location, length)
5361{
5362    return { location: location, length: length };
5363}
5364CPCopyRange= function(aRange)
5365{
5366    return { location: aRange.location, length: aRange.length };
5367}
5368CPMakeRangeCopy= function(aRange)
5369{
5370    return { location:aRange.location, length:aRange.length };
5371}
5372CPEmptyRange= function(aRange)
5373{
5374    return aRange.length === 0;
5375}
5376CPMaxRange= function(aRange)
5377{
5378    return aRange.location + aRange.length;
5379}
5380CPEqualRanges= function(lhsRange, rhsRange)
5381{
5382    return ((lhsRange.location === rhsRange.location) && (lhsRange.length === rhsRange.length));
5383}
5384CPLocationInRange= function(aLocation, aRange)
5385{
5386    return (aLocation >= aRange.location) && (aLocation < CPMaxRange(aRange));
5387}
5388CPUnionRange= function(lhsRange, rhsRange)
5389{
5390    var location = MIN(lhsRange.location, rhsRange.location);
5391    return CPMakeRange(location, MAX(CPMaxRange(lhsRange), CPMaxRange(rhsRange)) - location);
5392}
5393CPIntersectionRange= function(lhsRange, rhsRange)
5394{
5395    if(CPMaxRange(lhsRange) < rhsRange.location || CPMaxRange(rhsRange) < lhsRange.location)
5396        return CPMakeRange(0, 0);
5397    var location = MAX(lhsRange.location, rhsRange.location);
5398    return CPMakeRange(location, MIN(CPMaxRange(lhsRange), CPMaxRange(rhsRange)) - location);
5399}
5400CPRangeInRange= function(lhsRange, rhsRange)
5401{
5402    return (lhsRange.location <= rhsRange.location && CPMaxRange(lhsRange) >= CPMaxRange(rhsRange));
5403}
5404CPStringFromRange= function(aRange)
5405{
5406    return "{" + aRange.location + ", " + aRange.length + "}";
5407}
5408CPRangeFromString= function(aString)
5409{
5410    var comma = aString.indexOf(',');
5411    return { location:parseInt(aString.substr(1, comma - 1)), length:parseInt(aString.substring(comma + 1, aString.length)) };
5412}
5413
5414p;11;CPRunLoop.ji;10;CPObject.ji;9;CPArray.ji;10;CPString.jc;9636;
5415CPDefaultRunLoopMode = "CPDefaultRunLoopMode";
5416_CPRunLoopPerformCompare= function(lhs, rhs)
5417{
5418    return objj_msgSend(rhs, "order") - objj_msgSend(lhs, "order");
5419}
5420var _CPRunLoopPerformPool = [],
5421    _CPRunLoopPerformPoolCapacity = 5;
5422{var the_class = objj_allocateClassPair(CPObject, "_CPRunLoopPerform"),
5423meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_target"), new objj_ivar("_selector"), new objj_ivar("_argument"), new objj_ivar("_order"), new objj_ivar("_runLoopModes"), new objj_ivar("_isValid")]);
5424objj_registerClassPair(the_class);
5425objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
5426class_addMethods(the_class, [new objj_method(sel_getUid("initWithSelector:target:argument:order:modes:"), function $_CPRunLoopPerform__initWithSelector_target_argument_order_modes_(self, _cmd, aSelector, aTarget, anArgument, anOrder, modes)
5427{ with(self)
5428{
5429    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
5430    if (self)
5431    {
5432        _selector = aSelector;
5433        _target = aTarget;
5434        _argument = anArgument;
5435        _order = anOrder;
5436        _runLoopModes = modes;
5437        _isValid = YES;
5438    }
5439    return self;
5440}
5441}), new objj_method(sel_getUid("selector"), function $_CPRunLoopPerform__selector(self, _cmd)
5442{ with(self)
5443{
5444    return _selector;
5445}
5446}), new objj_method(sel_getUid("target"), function $_CPRunLoopPerform__target(self, _cmd)
5447{ with(self)
5448{
5449    return _target;
5450}
5451}), new objj_method(sel_getUid("argument"), function $_CPRunLoopPerform__argument(self, _cmd)
5452{ with(self)
5453{
5454    return _argument;
5455}
5456}), new objj_method(sel_getUid("order"), function $_CPRunLoopPerform__order(self, _cmd)
5457{ with(self)
5458{
5459    return _order;
5460}
5461}), new objj_method(sel_getUid("fireInMode:"), function $_CPRunLoopPerform__fireInMode_(self, _cmd, aRunLoopMode)
5462{ with(self)
5463{
5464    if (!_isValid)
5465        return YES;
5466    if (objj_msgSend(_runLoopModes, "containsObject:", aRunLoopMode))
5467    {
5468        objj_msgSend(_target, "performSelector:withObject:", _selector, _argument);
5469        return YES;
5470    }
5471    return NO;
5472}
5473}), new objj_method(sel_getUid("invalidate"), function $_CPRunLoopPerform__invalidate(self, _cmd)
5474{ with(self)
5475{
5476    _isValid = NO;
5477}
5478})]);
5479class_addMethods(meta_class, [new objj_method(sel_getUid("_poolPerform:"), function $_CPRunLoopPerform___poolPerform_(self, _cmd, aPerform)
5480{ with(self)
5481{
5482    if (!aPerform || _CPRunLoopPerformPool.length >= _CPRunLoopPerformPoolCapacity)
5483        return;
5484    _CPRunLoopPerformPool.push(aPerform);
5485}
5486}), new objj_method(sel_getUid("performWithSelector:target:argument:order:modes:"), function $_CPRunLoopPerform__performWithSelector_target_argument_order_modes_(self, _cmd, aSelector, aTarget, anArgument, anOrder, modes)
5487{ with(self)
5488{
5489    if (_CPRunLoopPerformPool.length)
5490    {
5491        var perform = _CPRunLoopPerformPool.pop();
5492        perform._target = aTarget;
5493        perform._selector = aSelector;
5494        perform._argument = anArgument;
5495        perform._order = anOrder;
5496        perform._runLoopModes = modes;
5497        perform._isValid = YES;
5498        return perform;
5499    }
5500    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithSelector:target:argument:order:modes:", aSelector, aTarget, anArgument, anOrder, modes);
5501}
5502})]);
5503}
5504var CPRunLoopLastNativeRunLoop = 0;
5505{var the_class = objj_allocateClassPair(CPObject, "CPRunLoop"),
5506meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_runLoopLock"), new objj_ivar("_timersForModes"), new objj_ivar("_nativeTimersForModes"), new objj_ivar("_nextTimerFireDatesForModes"), new objj_ivar("_didAddTimer"), new objj_ivar("_effectiveDate"), new objj_ivar("_orderedPerforms")]);
5507objj_registerClassPair(the_class);
5508objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
5509class_addMethods(the_class, [new objj_method(sel_getUid("init"), function $CPRunLoop__init(self, _cmd)
5510{ with(self)
5511{
5512    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
5513    if (self)
5514    {
5515        _orderedPerforms = [];
5516        _timersForModes = {};
5517        _nativeTimersForModes = {};
5518        _nextTimerFireDatesForModes = {};
5519    }
5520    return self;
5521}
5522}), new objj_method(sel_getUid("performSelector:target:argument:order:modes:"), function $CPRunLoop__performSelector_target_argument_order_modes_(self, _cmd, aSelector, aTarget, anArgument, anOrder, modes)
5523{ with(self)
5524{
5525    var perform = objj_msgSend(_CPRunLoopPerform, "performWithSelector:target:argument:order:modes:", aSelector, aTarget, anArgument, anOrder, modes),
5526        count = _orderedPerforms.length;
5527    while (count--)
5528        if (anOrder < objj_msgSend(_orderedPerforms[count], "order"))
5529            break;
5530    _orderedPerforms.splice(count + 1, 0, perform);
5531}
5532}), new objj_method(sel_getUid("cancelPerformSelector:target:argument:"), function $CPRunLoop__cancelPerformSelector_target_argument_(self, _cmd, aSelector, aTarget, anArgument)
5533{ with(self)
5534{
5535    var count = _orderedPerforms.length;
5536    while (count--)
5537    {
5538        var perform = _orderedPerforms[count];
5539        if (objj_msgSend(perform, "selector") === aSelector && objj_msgSend(perform, "target") == aTarget && objj_msgSend(perform, "argument") == anArgument)
5540            objj_msgSend(_orderedPerforms[count], "invalidate");
5541    }
5542}
5543}), new objj_method(sel_getUid("performSelectors"), function $CPRunLoop__performSelectors(self, _cmd)
5544{ with(self)
5545{
5546    objj_msgSend(self, "limitDateForMode:", CPDefaultRunLoopMode);
5547}
5548}), new objj_method(sel_getUid("addTimer:forMode:"), function $CPRunLoop__addTimer_forMode_(self, _cmd, aTimer, aMode)
5549{ with(self)
5550{
5551    if (_timersForModes[aMode])
5552        _timersForModes[aMode].push(aTimer);
5553    else
5554        _timersForModes[aMode] = [aTimer];
5555    _didAddTimer = YES;
5556    if (!aTimer._lastNativeRunLoopsForModes)
5557        aTimer._lastNativeRunLoopsForModes = {};
5558    aTimer._lastNativeRunLoopsForModes[aMode] = CPRunLoopLastNativeRunLoop;
5559}
5560}), new objj_method(sel_getUid("limitDateForMode:"), function $CPRunLoop__limitDateForMode_(self, _cmd, aMode)
5561{ with(self)
5562{
5563    if (_runLoopLock)
5564        return;
5565    _runLoopLock = YES;
5566    var now = _effectiveDate ? objj_msgSend(_effectiveDate, "laterDate:", objj_msgSend(CPDate, "date")) : objj_msgSend(CPDate, "date"),
5567        nextFireDate = nil,
5568        nextTimerFireDate = _nextTimerFireDatesForModes[aMode];
5569    if (_didAddTimer || nextTimerFireDate && nextTimerFireDate <= now)
5570    {
5571        _didAddTimer = NO;
5572        if (_nativeTimersForModes[aMode] !== nil)
5573        {
5574            window.clearNativeTimeout(_nativeTimersForModes[aMode]);
5575            _nativeTimersForModes[aMode] = nil;
5576        }
5577        var timers = _timersForModes[aMode],
5578            index = timers.length;
5579        _timersForModes[aMode] = nil;
5580        while (index--)
5581        {
5582            var timer = timers[index];
5583            if (timer._lastNativeRunLoopsForModes[aMode] < CPRunLoopLastNativeRunLoop && timer._isValid && timer._fireDate <= now)
5584                objj_msgSend(timer, "fire");
5585            if (timer._isValid)
5586                nextFireDate = (nextFireDate === nil) ? timer._fireDate : objj_msgSend(nextFireDate, "earlierDate:", timer._fireDate);
5587            else
5588            {
5589                timer._lastNativeRunLoopsForModes[aMode] = 0;
5590                timers.splice(index, 1);
5591            }
5592        }
5593        var newTimers = _timersForModes[aMode];
5594        if (newTimers && newTimers.length)
5595        {
5596            index = newTimers.length;
5597            while (index--)
5598            {
5599                var timer = newTimers[index];
5600                if (objj_msgSend(timer, "isValid"))
5601                    nextFireDate = (nextFireDate === nil) ? timer._fireDate : objj_msgSend(nextFireDate, "earlierDate:", timer._fireDate);
5602                else
5603                    newTimers.splice(index, 1);
5604            }
5605            _timersForModes[aMode] = newTimers.concat(timers);
5606        }
5607        else
5608            _timersForModes[aMode] = timers;
5609        _nextTimerFireDatesForModes[aMode] = nextFireDate;
5610        if (_nextTimerFireDatesForModes[aMode] !== nil)
5611            _nativeTimersForModes[aMode] = window.setNativeTimeout(function() { _effectiveDate = nextFireDate; _nativeTimersForModes[aMode] = nil; ++CPRunLoopLastNativeRunLoop; objj_msgSend(self, "limitDateForMode:", aMode); _effectiveDate = nil; }, MAX(0, objj_msgSend(nextFireDate, "timeIntervalSinceNow") * 1000));
5612    }
5613    var performs = _orderedPerforms,
5614        index = performs.length;
5615    _orderedPerforms = [];
5616    while (index--)
5617    {
5618        var perform = performs[index];
5619        if (objj_msgSend(perform, "fireInMode:", CPDefaultRunLoopMode))
5620        {
5621            objj_msgSend(_CPRunLoopPerform, "_poolPerform:", perform);
5622            performs.splice(index, 1);
5623        }
5624    }
5625    if (_orderedPerforms.length)
5626    {
5627        _orderedPerforms = _orderedPerforms.concat(performs);
5628        _orderedPerforms.sort(_CPRunLoopPerformCompare);
5629    }
5630    else
5631        _orderedPerforms = performs;
5632    _runLoopLock = NO;
5633    return nextFireDate;
5634}
5635})]);
5636class_addMethods(meta_class, [new objj_method(sel_getUid("initialize"), function $CPRunLoop__initialize(self, _cmd)
5637{ with(self)
5638{
5639    if (self != objj_msgSend(CPRunLoop, "class"))
5640        return;
5641    CPMainRunLoop = objj_msgSend(objj_msgSend(CPRunLoop, "alloc"), "init");
5642}
5643}), new objj_method(sel_getUid("currentRunLoop"), function $CPRunLoop__currentRunLoop(self, _cmd)
5644{ with(self)
5645{
5646    return CPMainRunLoop;
5647}
5648}), new objj_method(sel_getUid("mainRunLoop"), function $CPRunLoop__mainRunLoop(self, _cmd)
5649{ with(self)
5650{
5651    return CPMainRunLoop;
5652}
5653})]);
5654}
5655
5656p;7;CPSet.ji;10;CPObject.ji;9;CPArray.ji;10;CPNumber.ji;14;CPEnumerator.jc;10411;
5657{var the_class = objj_allocateClassPair(CPObject, "CPSet"),
5658meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_contents"), new objj_ivar("_count")]);
5659objj_registerClassPair(the_class);
5660objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
5661class_addMethods(the_class, [new objj_method(sel_getUid("init"), function $CPSet__init(self, _cmd)
5662{ with(self)
5663{
5664    if (self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init"))
5665    {
5666        _count = 0;
5667        _contents = {};
5668    }
5669    return self;
5670}
5671}), new objj_method(sel_getUid("initWithArray:"), function $CPSet__initWithArray_(self, _cmd, anArray)
5672{ with(self)
5673{
5674    if (self = objj_msgSend(self, "init"))
5675    {
5676        var count = anArray.length;
5677        while (count--)
5678            objj_msgSend(self, "addObject:", anArray[count]);
5679    }
5680    return self;
5681}
5682}), new objj_method(sel_getUid("initWithObjects:count:"), function $CPSet__initWithObjects_count_(self, _cmd, objects, count)
5683{ with(self)
5684{
5685    return objj_msgSend(self, "initWithArray:", objects.splice(0, count));
5686}
5687}), new objj_method(sel_getUid("initWithObjects:"), function $CPSet__initWithObjects_(self, _cmd, anObject)
5688{ with(self)
5689{
5690    if (self = objj_msgSend(self, "init"))
5691    {
5692  var argLength = arguments.length,
5693   i = 2;
5694        for(; i < argLength && (argument = arguments[i]) != nil; ++i)
5695            objj_msgSend(self, "addObject:", argument);
5696    }
5697    return self;
5698}
5699}), new objj_method(sel_getUid("initWithSet:"), function $CPSet__initWithSet_(self, _cmd, aSet)
5700{ with(self)
5701{
5702    return objj_msgSend(self, "initWithSet:copyItems:", aSet, NO);
5703}
5704}), new objj_method(sel_getUid("initWithSet:copyItems:"), function $CPSet__initWithSet_copyItems_(self, _cmd, aSet, shouldCopyItems)
5705{ with(self)
5706{
5707    self = objj_msgSend(self, "init");
5708    if (!aSet)
5709        return self;
5710    var contents = aSet._contents;
5711    for (var property in contents)
5712    {
5713        if (contents.hasOwnProperty(property))
5714        {
5715            if (shouldCopyItems)
5716                objj_msgSend(self, "addObject:", objj_msgSend(contents[property], "copy"));
5717            else
5718                objj_msgSend(self, "addObject:", contents[property]);
5719        }
5720    }
5721    return self;
5722}
5723}), new objj_method(sel_getUid("allObjects"), function $CPSet__allObjects(self, _cmd)
5724{ with(self)
5725{
5726    var array = [];
5727    for (var property in _contents)
5728    {
5729        if (_contents.hasOwnProperty(property))
5730            array.push(_contents[property]);
5731    }
5732    return array;
5733}
5734}), new objj_method(sel_getUid("anyObject"), function $CPSet__anyObject(self, _cmd)
5735{ with(self)
5736{
5737    for (var property in _contents)
5738    {
5739        if (_contents.hasOwnProperty(property))
5740            return _contents[property];
5741    }
5742    return nil;
5743}
5744}), new objj_method(sel_getUid("containsObject:"), function $CPSet__containsObject_(self, _cmd, anObject)
5745{ with(self)
5746{
5747    if (_contents[objj_msgSend(anObject, "hash")] && objj_msgSend(_contents[objj_msgSend(anObject, "hash")], "isEqual:", anObject))
5748        return YES;
5749    return NO;
5750}
5751}), new objj_method(sel_getUid("count"), function $CPSet__count(self, _cmd)
5752{ with(self)
5753{
5754    return _count;
5755}
5756}), new objj_method(sel_getUid("intersectsSet:"), function $CPSet__intersectsSet_(self, _cmd, set)
5757{ with(self)
5758{
5759    var items = objj_msgSend(set, "allObjects");
5760    for (var i = items.length; i > 0; i--)
5761    {
5762        if (objj_msgSend(self, "containsObject:", items[i]))
5763            return YES;
5764    }
5765    return NO;
5766}
5767}), new objj_method(sel_getUid("isEqualToSet:"), function $CPSet__isEqualToSet_(self, _cmd, set)
5768{ with(self)
5769{
5770    return self === set || (objj_msgSend(self, "count") === objj_msgSend(set, "count") && objj_msgSend(set, "isSubsetOfSet:", self));
5771}
5772}), new objj_method(sel_getUid("isSubsetOfSet:"), function $CPSet__isSubsetOfSet_(self, _cmd, set)
5773{ with(self)
5774{
5775    var items = objj_msgSend(self, "allObjects");
5776    for (var i = 0; i < items.length; i++)
5777    {
5778        if (!objj_msgSend(set, "containsObject:", items[i]))
5779            return NO;
5780    }
5781    return YES;
5782}
5783}), new objj_method(sel_getUid("makeObjectsPerformSelector:"), function $CPSet__makeObjectsPerformSelector_(self, _cmd, aSelector)
5784{ with(self)
5785{
5786    objj_msgSend(self, "makeObjectsPerformSelector:withObject:", aSelector, nil);
5787}
5788}), new objj_method(sel_getUid("makeObjectsPerformSelector:withObject:"), function $CPSet__makeObjectsPerformSelector_withObject_(self, _cmd, aSelector, argument)
5789{ with(self)
5790{
5791    var items = objj_msgSend(self, "allObjects");
5792    for (var i = 0; i < items.length; i++)
5793    {
5794        objj_msgSend(items[i], "performSelector:withObject:", aSelector, argument);
5795    }
5796}
5797}), new objj_method(sel_getUid("member:"), function $CPSet__member_(self, _cmd, object)
5798{ with(self)
5799{
5800    if (objj_msgSend(self, "containsObject:", object))
5801        return object;
5802    return nil;
5803}
5804}), new objj_method(sel_getUid("objectEnumerator"), function $CPSet__objectEnumerator(self, _cmd)
5805{ with(self)
5806{
5807    return objj_msgSend(objj_msgSend(self, "allObjects"), "objectEnumerator");
5808}
5809}), new objj_method(sel_getUid("initWithCapacity:"), function $CPSet__initWithCapacity_(self, _cmd, numItems)
5810{ with(self)
5811{
5812    self = objj_msgSend(self, "init");
5813    return self;
5814}
5815}), new objj_method(sel_getUid("setSet:"), function $CPSet__setSet_(self, _cmd, set)
5816{ with(self)
5817{
5818    objj_msgSend(self, "removeAllObjects");
5819    objj_msgSend(self, "addObjectsFromArray:", objj_msgSend(set, "allObjects"));
5820}
5821}), new objj_method(sel_getUid("addObject:"), function $CPSet__addObject_(self, _cmd, anObject)
5822{ with(self)
5823{
5824    _contents[objj_msgSend(anObject, "hash")] = anObject;
5825    _count++;
5826}
5827}), new objj_method(sel_getUid("addObjectsFromArray:"), function $CPSet__addObjectsFromArray_(self, _cmd, array)
5828{ with(self)
5829{
5830    for (var i = 0, count = array.length; i < count; i++)
5831    {
5832        objj_msgSend(self, "addObject:", array[i]);
5833    }
5834}
5835}), new objj_method(sel_getUid("removeObject:"), function $CPSet__removeObject_(self, _cmd, anObject)
5836{ with(self)
5837{
5838    if (objj_msgSend(self, "containsObject:", anObject))
5839    {
5840        delete _contents[objj_msgSend(anObject, "hash")];
5841        _count--;
5842    }
5843}
5844}), new objj_method(sel_getUid("removeAllObjects"), function $CPSet__removeAllObjects(self, _cmd)
5845{ with(self)
5846{
5847    _contents = {};
5848    _count = 0;
5849}
5850}), new objj_method(sel_getUid("intersectSet:"), function $CPSet__intersectSet_(self, _cmd, set)
5851{ with(self)
5852{
5853    var items = objj_msgSend(self, "allObjects");
5854    for (var i = 0, count = items.length; i < count; i++)
5855    {
5856        if (!objj_msgSend(set, "containsObject:", items[i]))
5857            objj_msgSend(self, "removeObject:", items[i]);
5858    }
5859}
5860}), new objj_method(sel_getUid("minusSet:"), function $CPSet__minusSet_(self, _cmd, set)
5861{ with(self)
5862{
5863    var items = objj_msgSend(set, "allObjects");
5864    for (var i = 0; i < items.length; i++)
5865    {
5866        if (objj_msgSend(self, "containsObject:", items[i]))
5867            objj_msgSend(self, "removeObject:", items[i]);
5868    }
5869}
5870}), new objj_method(sel_getUid("unionSet:"), function $CPSet__unionSet_(self, _cmd, set)
5871{ with(self)
5872{
5873    var items = objj_msgSend(set, "allObjects");
5874    for (var i = 0, count = items.length; i < count; i++)
5875    {
5876        objj_msgSend(self, "addObject:", items[i]);
5877    }
5878}
5879})]);
5880class_addMethods(meta_class, [new objj_method(sel_getUid("set"), function $CPSet__set(self, _cmd)
5881{ with(self)
5882{
5883    return objj_msgSend(objj_msgSend(self, "alloc"), "init");
5884}
5885}), new objj_method(sel_getUid("setWithArray:"), function $CPSet__setWithArray_(self, _cmd, array)
5886{ with(self)
5887{
5888    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithArray:", array);
5889}
5890}), new objj_method(sel_getUid("setWithObject:"), function $CPSet__setWithObject_(self, _cmd, anObject)
5891{ with(self)
5892{
5893    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithArray:", [anObject]);
5894}
5895}), new objj_method(sel_getUid("setWithObjects:count:"), function $CPSet__setWithObjects_count_(self, _cmd, objects, count)
5896{ with(self)
5897{
5898    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithObjects:count:", objects, count);
5899}
5900}), new objj_method(sel_getUid("setWithObjects:"), function $CPSet__setWithObjects_(self, _cmd, anObject)
5901{ with(self)
5902{
5903    var set = objj_msgSend(objj_msgSend(self, "alloc"), "init"),
5904        argLength = arguments.length,
5905        i = 2;
5906    for(; i < argLength && ((argument = arguments[i]) !== nil); ++i)
5907        objj_msgSend(set, "addObject:", argument);
5908    return set;
5909}
5910}), new objj_method(sel_getUid("setWithSet:"), function $CPSet__setWithSet_(self, _cmd, set)
5911{ with(self)
5912{
5913    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithSet:", set);
5914}
5915}), new objj_method(sel_getUid("setWithCapacity:"), function $CPSet__setWithCapacity_(self, _cmd, numItems)
5916{ with(self)
5917{
5918    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithCapacity:", numItems);
5919}
5920})]);
5921}
5922{
5923var the_class = objj_getClass("CPSet")
5924if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPSet\""));
5925var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("copy"), function $CPSet__copy(self, _cmd)
5926{ with(self)
5927{
5928    return objj_msgSend(objj_msgSend(CPSet, "alloc"), "initWithSet:", self);
5929}
5930}), new objj_method(sel_getUid("mutableCopy"), function $CPSet__mutableCopy(self, _cmd)
5931{ with(self)
5932{
5933    return objj_msgSend(self, "copy");
5934}
5935})]);
5936}
5937var CPSetObjectsKey = "CPSetObjectsKey";
5938{
5939var the_class = objj_getClass("CPSet")
5940if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPSet\""));
5941var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $CPSet__initWithCoder_(self, _cmd, aCoder)
5942{ with(self)
5943{
5944    return objj_msgSend(self, "initWithArray:", objj_msgSend(aCoder, "decodeObjectForKey:", CPSetObjectsKey));
5945}
5946}), new objj_method(sel_getUid("encodeWithCoder:"), function $CPSet__encodeWithCoder_(self, _cmd, aCoder)
5947{ with(self)
5948{
5949    objj_msgSend(aCoder, "encodeObject:forKey:", objj_msgSend(self, "allObjects"), CPSetObjectsKey);
5950}
5951})]);
5952}
5953{var the_class = objj_allocateClassPair(CPSet, "CPMutableSet"),
5954meta_class = the_class.isa;objj_registerClassPair(the_class);
5955objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
5956}
5957
5958p;18;CPSortDescriptor.ji;10;CPObject.ji;15;CPObjJRuntime.jc;2123;
5959CPOrderedAscending = -1;
5960CPOrderedSame = 0;
5961CPOrderedDescending = 1;
5962{var the_class = objj_allocateClassPair(CPObject, "CPSortDescriptor"),
5963meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_key"), new objj_ivar("_selector"), new objj_ivar("_ascending")]);
5964objj_registerClassPair(the_class);
5965objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
5966class_addMethods(the_class, [new objj_method(sel_getUid("initWithKey:ascending:"), function $CPSortDescriptor__initWithKey_ascending_(self, _cmd, aKey, isAscending)
5967{ with(self)
5968{
5969    return objj_msgSend(self, "initWithKey:ascending:selector:", aKey, isAscending, sel_getUid("compare:"));
5970}
5971}), new objj_method(sel_getUid("initWithKey:ascending:selector:"), function $CPSortDescriptor__initWithKey_ascending_selector_(self, _cmd, aKey, isAscending, aSelector)
5972{ with(self)
5973{
5974    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
5975    if (self)
5976    {
5977        _key = aKey;
5978        _ascending = isAscending;
5979        _selector = aSelector;
5980    }
5981    return self;
5982}
5983}), new objj_method(sel_getUid("ascending"), function $CPSortDescriptor__ascending(self, _cmd)
5984{ with(self)
5985{
5986    return _ascending;
5987}
5988}), new objj_method(sel_getUid("key"), function $CPSortDescriptor__key(self, _cmd)
5989{ with(self)
5990{
5991    return _key;
5992}
5993}), new objj_method(sel_getUid("selector"), function $CPSortDescriptor__selector(self, _cmd)
5994{ with(self)
5995{
5996    return _selector;
5997}
5998}), new objj_method(sel_getUid("compareObject:withObject:"), function $CPSortDescriptor__compareObject_withObject_(self, _cmd, lhsObject, rhsObject)
5999{ with(self)
6000{
6001    return (_ascending ? 1 : -1) * objj_msgSend(objj_msgSend(lhsObject, "valueForKey:", _key), "performSelector:withObject:", _selector, objj_msgSend(rhsObject, "valueForKey:", _key));
6002}
6003}), new objj_method(sel_getUid("reversedSortDescriptor"), function $CPSortDescriptor__reversedSortDescriptor(self, _cmd)
6004{ with(self)
6005{
6006    return objj_msgSend(objj_msgSend(objj_msgSend(self, "class"), "alloc"), "initWithKey:ascending:selector:", _key, !_ascending, _selector);
6007}
6008})]);
6009}
6010
6011p;10;CPString.ji;10;CPObject.ji;13;CPException.ji;18;CPSortDescriptor.ji;9;CPValue.jc;12759;
6012CPCaseInsensitiveSearch = 1;
6013CPLiteralSearch = 2;
6014CPBackwardsSearch = 4;
6015CPAnchoredSearch = 8;
6016CPNumericSearch = 64;
6017var CPStringHashes = new objj_dictionary();
6018{var the_class = objj_allocateClassPair(CPObject, "CPString"),
6019meta_class = the_class.isa;objj_registerClassPair(the_class);
6020objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
6021class_addMethods(the_class, [new objj_method(sel_getUid("initWithString:"), function $CPString__initWithString_(self, _cmd, aString)
6022{ with(self)
6023{
6024    return String(aString);
6025}
6026}), new objj_method(sel_getUid("initWithFormat:"), function $CPString__initWithFormat_(self, _cmd, format)
6027{ with(self)
6028{
6029    if (!format)
6030        objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "initWithFormat: the format can't be 'nil'");
6031    self = sprintf.apply(this, Array.prototype.slice.call(arguments, 2));
6032    return self;
6033}
6034}), new objj_method(sel_getUid("description"), function $CPString__description(self, _cmd)
6035{ with(self)
6036{
6037    return self;
6038}
6039}), new objj_method(sel_getUid("length"), function $CPString__length(self, _cmd)
6040{ with(self)
6041{
6042    return length;
6043}
6044}), new objj_method(sel_getUid("characterAtIndex:"), function $CPString__characterAtIndex_(self, _cmd, anIndex)
6045{ with(self)
6046{
6047    return charAt(anIndex);
6048}
6049}), new objj_method(sel_getUid("stringByAppendingFormat:"), function $CPString__stringByAppendingFormat_(self, _cmd, format)
6050{ with(self)
6051{
6052    if (!format)
6053        objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "initWithFormat: the format can't be 'nil'");
6054    return self + sprintf.apply(this, Array.prototype.slice.call(arguments, 2));
6055}
6056}), new objj_method(sel_getUid("stringByAppendingString:"), function $CPString__stringByAppendingString_(self, _cmd, aString)
6057{ with(self)
6058{
6059    return self + aString;
6060}
6061}), new objj_method(sel_getUid("stringByPaddingToLength:withString:startingAtIndex:"), function $CPString__stringByPaddingToLength_withString_startingAtIndex_(self, _cmd, aLength, aString, anIndex)
6062{ with(self)
6063{
6064    if (length == aLength)
6065        return self;
6066    if (aLength < length)
6067        return substr(0, aLength);
6068    var string = self,
6069        substring = aString.substring(anIndex),
6070        difference = aLength - length;
6071    while ((difference -= substring.length) >= 0)
6072        string += substring;
6073    if (-difference < substring.length)
6074        string += substring.substring(0, -difference);
6075    return string;
6076}
6077}), new objj_method(sel_getUid("componentsSeparatedByString:"), function $CPString__componentsSeparatedByString_(self, _cmd, aString)
6078{ with(self)
6079{
6080    return split(aString);
6081}
6082}), new objj_method(sel_getUid("substringFromIndex:"), function $CPString__substringFromIndex_(self, _cmd, anIndex)
6083{ with(self)
6084{
6085    return substr(anIndex);
6086}
6087}), new objj_method(sel_getUid("substringWithRange:"), function $CPString__substringWithRange_(self, _cmd, aRange)
6088{ with(self)
6089{
6090    return substr(aRange.location, aRange.length);
6091}
6092}), new objj_method(sel_getUid("substringToIndex:"), function $CPString__substringToIndex_(self, _cmd, anIndex)
6093{ with(self)
6094{
6095    return substring(0, anIndex);
6096}
6097}), new objj_method(sel_getUid("rangeOfString:"), function $CPString__rangeOfString_(self, _cmd, aString)
6098{ with(self)
6099{
6100   return objj_msgSend(self, "rangeOfString:options:", aString, 0);
6101}
6102}), new objj_method(sel_getUid("rangeOfString:options:"), function $CPString__rangeOfString_options_(self, _cmd, aString, aMask)
6103{ with(self)
6104{
6105    return objj_msgSend(self, "rangeOfString:options:range:", aString, aMask, nil);
6106}
6107}), new objj_method(sel_getUid("rangeOfString:options:range:"), function $CPString__rangeOfString_options_range_(self, _cmd, aString, aMask, aRange)
6108{ with(self)
6109{
6110    var string = (aRange == nil) ? self : objj_msgSend(self, "substringWithRange:", aRange),
6111        location = CPNotFound;
6112    if (aMask & CPCaseInsensitiveSearch)
6113    {
6114        string = string.toLowerCase();
6115        aString = aString.toLowerCase();
6116    }
6117    if (aMask & CPBackwardsSearch)
6118        location = string.lastIndexOf(aString, aMask & CPAnchoredSearch ? length - aString.length : 0);
6119    else if (aMask & CPAnchoredSearch)
6120        location = string.substr(0, aString.length).indexOf(aString) != CPNotFound ? 0 : CPNotFound;
6121    else
6122        location = string.indexOf(aString);
6123    return CPMakeRange(location, location == CPNotFound ? 0 : aString.length);
6124}
6125}), new objj_method(sel_getUid("stringByReplacingOccurrencesOfString:withString:"), function $CPString__stringByReplacingOccurrencesOfString_withString_(self, _cmd, target, replacement)
6126{ with(self)
6127{
6128    return self.replace(new RegExp(target, "g"), replacement);
6129}
6130}), new objj_method(sel_getUid("stringByReplacingOccurrencesOfString:withString:options:range:"), function $CPString__stringByReplacingOccurrencesOfString_withString_options_range_(self, _cmd, target, replacement, options, searchRange)
6131{ with(self)
6132{
6133    var start = substring(0, searchRange.location),
6134        stringSegmentToSearch = substr(searchRange.location, searchRange.length),
6135        end = substring(searchRange.location + searchRange.length, self.length),
6136        regExp;
6137    if (options & CPCaseInsensitiveSearch)
6138        regExp = new RegExp(target, "gi");
6139    else
6140        regExp = new RegExp(target, "g");
6141    return start + '' + stringSegmentToSearch.replace(regExp, replacement) + '' + end;
6142}
6143}), new objj_method(sel_getUid("stringByReplacingCharactersInRange:withString:"), function $CPString__stringByReplacingCharactersInRange_withString_(self, _cmd, range, replacement)
6144{ with(self)
6145{
6146 return '' + substring(0, range.location) + replacement + substring(range.location + range.length, self.length);
6147}
6148}), new objj_method(sel_getUid("compare:"), function $CPString__compare_(self, _cmd, aString)
6149{ with(self)
6150{
6151    return objj_msgSend(self, "compare:options:", aString, nil);
6152}
6153}), new objj_method(sel_getUid("caseInsensitiveCompare:"), function $CPString__caseInsensitiveCompare_(self, _cmd, aString)
6154{ with(self)
6155{
6156    return objj_msgSend(self, "compare:options:", aString, CPCaseInsensitiveSearch);
6157}
6158}), new objj_method(sel_getUid("compare:options:"), function $CPString__compare_options_(self, _cmd, aString, aMask)
6159{ with(self)
6160{
6161    var lhs = self,
6162        rhs = aString;
6163    if (aMask & CPCaseInsensitiveSearch)
6164    {
6165        lhs = lhs.toLowerCase();
6166        rhs = rhs.toLowerCase();
6167    }
6168    if (lhs < rhs)
6169        return CPOrderedAscending;
6170    else if (lhs > rhs)
6171        return CPOrderedDescending;
6172    return CPOrderedSame;
6173}
6174}), new objj_method(sel_getUid("compare:options:range:"), function $CPString__compare_options_range_(self, _cmd, aString, aMask, range)
6175{ with(self)
6176{
6177    var lhs = objj_msgSend(self, "substringWithRange:", range),
6178        rhs = aString;
6179    return objj_msgSend(lhs, "compare:options:", rhs, aMask);
6180}
6181}), new objj_method(sel_getUid("hasPrefix:"), function $CPString__hasPrefix_(self, _cmd, aString)
6182{ with(self)
6183{
6184    return aString && aString != "" && indexOf(aString) == 0;
6185}
6186}), new objj_method(sel_getUid("hasSuffix:"), function $CPString__hasSuffix_(self, _cmd, aString)
6187{ with(self)
6188{
6189    return aString && aString != "" && lastIndexOf(aString) == (length - aString.length);
6190}
6191}), new objj_method(sel_getUid("isEqualToString:"), function $CPString__isEqualToString_(self, _cmd, aString)
6192{ with(self)
6193{
6194    return self == aString;
6195}
6196}), new objj_method(sel_getUid("hash"), function $CPString__hash(self, _cmd)
6197{ with(self)
6198{
6199    var hash = dictionary_getValue(CPStringHashes, self);
6200    if (!hash)
6201    {
6202        hash = _objj_generateObjectHash();
6203        dictionary_setValue(CPStringHashes, self, hash);
6204    }
6205    return hash;
6206}
6207}), new objj_method(sel_getUid("capitalizedString"), function $CPString__capitalizedString(self, _cmd)
6208{ with(self)
6209{
6210    var parts = self.split(/\b/g);
6211    for (var i = 0; i < parts.length; i++)
6212    {
6213        if (i == 0 || (/\s$/).test(parts[i-1]))
6214            parts[i] = parts[i].substring(0, 1).toUpperCase() + parts[i].substring(1).toLowerCase();
6215        else
6216            parts[i] = parts[i].toLowerCase();
6217    }
6218    return parts.join("");
6219}
6220}), new objj_method(sel_getUid("lowercaseString"), function $CPString__lowercaseString(self, _cmd)
6221{ with(self)
6222{
6223    return toLowerCase();
6224}
6225}), new objj_method(sel_getUid("uppercaseString"), function $CPString__uppercaseString(self, _cmd)
6226{ with(self)
6227{
6228    return toUpperCase();
6229}
6230}), new objj_method(sel_getUid("doubleValue"), function $CPString__doubleValue(self, _cmd)
6231{ with(self)
6232{
6233    return parseFloat(self, 10);
6234}
6235}), new objj_method(sel_getUid("boolValue"), function $CPString__boolValue(self, _cmd)
6236{ with(self)
6237{
6238    var replaceRegExp = new RegExp("^\\s*[\\+,\\-]*0*");
6239    return RegExp("^[Y,y,t,T,1-9]").test(self.replace(replaceRegExp, ''));
6240}
6241}), new objj_method(sel_getUid("floatValue"), function $CPString__floatValue(self, _cmd)
6242{ with(self)
6243{
6244    return parseFloat(self, 10);
6245}
6246}), new objj_method(sel_getUid("intValue"), function $CPString__intValue(self, _cmd)
6247{ with(self)
6248{
6249    return parseInt(self, 10);
6250}
6251}), new objj_method(sel_getUid("pathComponents"), function $CPString__pathComponents(self, _cmd)
6252{ with(self)
6253{
6254    var result = split('/');
6255    if (result[0] === "")
6256        result[0] = "/";
6257    if (result[result.length - 1] === "")
6258        result.pop();
6259    return result;
6260}
6261}), new objj_method(sel_getUid("pathExtension"), function $CPString__pathExtension(self, _cmd)
6262{ with(self)
6263{
6264    return substr(lastIndexOf('.') + 1);
6265}
6266}), new objj_method(sel_getUid("lastPathComponent"), function $CPString__lastPathComponent(self, _cmd)
6267{ with(self)
6268{
6269    var components = objj_msgSend(self, "pathComponents");
6270    return components[components.length -1];
6271}
6272}), new objj_method(sel_getUid("stringByDeletingLastPathComponent"), function $CPString__stringByDeletingLastPathComponent(self, _cmd)
6273{ with(self)
6274{
6275    var path = self,
6276        start = length - 1;
6277    while (path.charAt(start) === '/')
6278        start--;
6279    path = path.substr(0, path.lastIndexOf('/', start));
6280    if (path === "" && charAt(0) === '/')
6281        return '/';
6282    return path;
6283}
6284}), new objj_method(sel_getUid("stringByStandardizingPath"), function $CPString__stringByStandardizingPath(self, _cmd)
6285{ with(self)
6286{
6287    return objj_standardize_path(self);
6288}
6289}), new objj_method(sel_getUid("copy"), function $CPString__copy(self, _cmd)
6290{ with(self)
6291{
6292    return new String(self);
6293}
6294})]);
6295class_addMethods(meta_class, [new objj_method(sel_getUid("alloc"), function $CPString__alloc(self, _cmd)
6296{ with(self)
6297{
6298    return new String;
6299}
6300}), new objj_method(sel_getUid("string"), function $CPString__string(self, _cmd)
6301{ with(self)
6302{
6303    return objj_msgSend(objj_msgSend(self, "alloc"), "init");
6304}
6305}), new objj_method(sel_getUid("stringWithHash:"), function $CPString__stringWithHash_(self, _cmd, aHash)
6306{ with(self)
6307{
6308    var hashString = parseInt(aHash, 10).toString(16);
6309    return "000000".substring(0, MAX(6-hashString.length, 0)) + hashString;
6310}
6311}), new objj_method(sel_getUid("stringWithString:"), function $CPString__stringWithString_(self, _cmd, aString)
6312{ with(self)
6313{
6314    if (!aString)
6315        objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "stringWithString: the string can't be 'nil'");
6316    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithString:", aString);
6317}
6318}), new objj_method(sel_getUid("stringWithFormat:"), function $CPString__stringWithFormat_(self, _cmd, format)
6319{ with(self)
6320{
6321    if (!format)
6322        objj_msgSend(CPException, "raise:reason:", CPInvalidArgumentException, "initWithFormat: the format can't be 'nil'");
6323    return sprintf.apply(this, Array.prototype.slice.call(arguments, 2));
6324}
6325})]);
6326}
6327{
6328var the_class = objj_getClass("CPString")
6329if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPString\""));
6330var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("objectFromJSON"), function $CPString__objectFromJSON(self, _cmd)
6331{ with(self)
6332{
6333    return CPJSObjectCreateWithJSON(self);
6334}
6335})]);
6336class_addMethods(meta_class, [new objj_method(sel_getUid("JSONFromObject:"), function $CPString__JSONFromObject_(self, _cmd, anObject)
6337{ with(self)
6338{
6339    return CPJSObjectCreateJSON(anObject);
6340}
6341})]);
6342}
6343{
6344var the_class = objj_getClass("CPString")
6345if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPString\""));
6346var meta_class = the_class.isa;class_addMethods(meta_class, [new objj_method(sel_getUid("UUID"), function $CPString__UUID(self, _cmd)
6347{ with(self)
6348{
6349    var g = "";
6350    for(var i = 0; i < 32; i++)
6351        g += FLOOR(RAND() * 0xF).toString(0xF);
6352    return g;
6353}
6354})]);
6355}
6356String.prototype.isa = CPString;
6357
6358p;9;CPTimer.ji;10;CPObject.ji;14;CPInvocation.ji;8;CPDate.ji;11;CPRunLoop.jc;7723;
6359{var the_class = objj_allocateClassPair(CPObject, "CPTimer"),
6360meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_timeInterval"), new objj_ivar("_invocation"), new objj_ivar("_callback"), new objj_ivar("_repeats"), new objj_ivar("_isValid"), new objj_ivar("_fireDate"), new objj_ivar("_userInfo")]);
6361objj_registerClassPair(the_class);
6362objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
6363class_addMethods(the_class, [new objj_method(sel_getUid("initWithFireDate:interval:invocation:repeats:"), function $CPTimer__initWithFireDate_interval_invocation_repeats_(self, _cmd, aDate, seconds, anInvocation, shouldRepeat)
6364{ with(self)
6365{
6366    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
6367    if (self)
6368    {
6369        _timeInterval = seconds;
6370        _invocation = anInvocation;
6371        _repeats = shouldRepeat;
6372        _isValid = YES;
6373        _fireDate = aDate;
6374    }
6375    return self;
6376}
6377}), new objj_method(sel_getUid("initWithFireDate:interval:target:selector:userInfo:repeats:"), function $CPTimer__initWithFireDate_interval_target_selector_userInfo_repeats_(self, _cmd, aDate, seconds, aTarget, aSelector, userInfo, shouldRepeat)
6378{ with(self)
6379{
6380    var invocation = objj_msgSend(CPInvocation, "invocationWithMethodSignature:", 1);
6381    objj_msgSend(invocation, "setTarget:", aTarget);
6382    objj_msgSend(invocation, "setSelector:", aSelector);
6383    objj_msgSend(invocation, "setArgument:atIndex:", self, 2);
6384    self = objj_msgSend(self, "initWithFireDate:interval:invocation:repeats:", aDate, seconds, invocation, shouldRepeat);
6385    if (self)
6386        _userInfo = userInfo;
6387    return self;
6388}
6389}), new objj_method(sel_getUid("initWithFireDate:interval:callback:repeats:"), function $CPTimer__initWithFireDate_interval_callback_repeats_(self, _cmd, aDate, seconds, aFunction, shouldRepeat)
6390{ with(self)
6391{
6392    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
6393    if (self)
6394    {
6395        _timeInterval = seconds;
6396        _callback = aFunction;
6397        _repeats = shouldRepeat;
6398        _isValid = YES;
6399        _fireDate = aDate;
6400    }
6401    return self;
6402}
6403}), new objj_method(sel_getUid("timeInterval"), function $CPTimer__timeInterval(self, _cmd)
6404{ with(self)
6405{
6406   return _timeInterval;
6407}
6408}), new objj_method(sel_getUid("fireDate"), function $CPTimer__fireDate(self, _cmd)
6409{ with(self)
6410{
6411   return _fireDate;
6412}
6413}), new objj_method(sel_getUid("setFireDate:"), function $CPTimer__setFireDate_(self, _cmd, aDate)
6414{ with(self)
6415{
6416    _fireDate = aDate;
6417}
6418}), new objj_method(sel_getUid("fire"), function $CPTimer__fire(self, _cmd)
6419{ with(self)
6420{
6421    if (!_isValid)
6422        return;
6423    if (_callback)
6424        _callback();
6425    else
6426        objj_msgSend(_invocation, "invoke");
6427    if (!_isValid)
6428        return;
6429    if (_repeats)
6430        _fireDate = objj_msgSend(CPDate, "dateWithTimeIntervalSinceNow:", _timeInterval);
6431    else
6432        objj_msgSend(self, "invalidate");
6433}
6434}), new objj_method(sel_getUid("isValid"), function $CPTimer__isValid(self, _cmd)
6435{ with(self)
6436{
6437   return _isValid;
6438}
6439}), new objj_method(sel_getUid("invalidate"), function $CPTimer__invalidate(self, _cmd)
6440{ with(self)
6441{
6442   _isValid = NO;
6443   _userInfo = nil;
6444   _invocation = nil;
6445   _callback = nil;
6446}
6447}), new objj_method(sel_getUid("userInfo"), function $CPTimer__userInfo(self, _cmd)
6448{ with(self)
6449{
6450   return _userInfo;
6451}
6452})]);
6453class_addMethods(meta_class, [new objj_method(sel_getUid("scheduledTimerWithTimeInterval:invocation:repeats:"), function $CPTimer__scheduledTimerWithTimeInterval_invocation_repeats_(self, _cmd, seconds, anInvocation, shouldRepeat)
6454{ with(self)
6455{
6456    var timer = objj_msgSend(objj_msgSend(self, "alloc"), "initWithFireDate:interval:invocation:repeats:", objj_msgSend(CPDate, "dateWithTimeIntervalSinceNow:", seconds), seconds, anInvocation, shouldRepeat);
6457    objj_msgSend(objj_msgSend(CPRunLoop, "currentRunLoop"), "addTimer:forMode:", timer, CPDefaultRunLoopMode);
6458    return timer;
6459}
6460}), new objj_method(sel_getUid("scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:"), function $CPTimer__scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_(self, _cmd, seconds, aTarget, aSelector, userInfo, shouldRepeat)
6461{ with(self)
6462{
6463    var timer = objj_msgSend(objj_msgSend(self, "alloc"), "initWithFireDate:interval:target:selector:userInfo:repeats:", objj_msgSend(CPDate, "dateWithTimeIntervalSinceNow:", seconds), seconds, aTarget, aSelector, userInfo, shouldRepeat)
6464    objj_msgSend(objj_msgSend(CPRunLoop, "currentRunLoop"), "addTimer:forMode:", timer, CPDefaultRunLoopMode);
6465    return timer;
6466}
6467}), new objj_method(sel_getUid("scheduledTimerWithTimeInterval:callback:repeats:"), function $CPTimer__scheduledTimerWithTimeInterval_callback_repeats_(self, _cmd, seconds, aFunction, shouldRepeat)
6468{ with(self)
6469{
6470    var timer = objj_msgSend(objj_msgSend(self, "alloc"), "initWithFireDate:interval:callback:repeats:", objj_msgSend(CPDate, "dateWithTimeIntervalSinceNow:", seconds), seconds, aFunction, shouldRepeat);
6471    objj_msgSend(objj_msgSend(CPRunLoop, "currentRunLoop"), "addTimer:forMode:", timer, CPDefaultRunLoopMode);
6472    return timer;
6473}
6474}), new objj_method(sel_getUid("timerWithTimeInterval:invocation:repeats:"), function $CPTimer__timerWithTimeInterval_invocation_repeats_(self, _cmd, seconds, anInvocation, shouldRepeat)
6475{ with(self)
6476{
6477    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithFireDate:interval:invocation:repeats:", nil, seconds, anInvocation, shouldRepeat);
6478}
6479}), new objj_method(sel_getUid("timerWithTimeInterval:target:selector:userInfo:repeats:"), function $CPTimer__timerWithTimeInterval_target_selector_userInfo_repeats_(self, _cmd, seconds, aTarget, aSelector, userInfo, shouldRepeat)
6480{ with(self)
6481{
6482    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithFireDate:interval:target:selector:userInfo:repeats:", nil, seconds, aTarget, aSelector, userInfo, shouldRepeat);
6483}
6484}), new objj_method(sel_getUid("timerWithTimeInterval:callback:repeats:"), function $CPTimer__timerWithTimeInterval_callback_repeats_(self, _cmd, seconds, aFunction, shouldRepeat)
6485{ with(self)
6486{
6487    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithFireDate:interval:callback:repeats:", nil, seconds, aFunction, shouldRepeat);
6488}
6489})]);
6490}
6491var CPTimersTimeoutID = 1000,
6492    CPTimersForTimeoutIDs = {};
6493var _CPTimerBridgeTimer = function(codeOrFunction, aDelay, shouldRepeat, functionArgs)
6494{
6495    var timeoutID = CPTimersTimeoutID++,
6496        theFunction = nil;
6497    if (typeof codeOrFunction === "string")
6498        theFunction = function() { new Function(codeOrFunction)(); if (!shouldRepeat) CPTimersForTimeoutIDs[timeoutID] = nil; }
6499    else
6500    {
6501        if (!functionArgs)
6502            functionArgs = [];
6503        theFunction = function() { codeOrFunction.apply(window, functionArgs); if (!shouldRepeat) CPTimersForTimeoutIDs[timeoutID] = nil; }
6504    }
6505    CPTimersForTimeoutIDs[timeoutID] = objj_msgSend(CPTimer, "scheduledTimerWithTimeInterval:callback:repeats:", aDelay / 1000, theFunction, shouldRepeat);
6506    return timeoutID;
6507}
6508window.setTimeout = function(codeOrFunction, aDelay)
6509{
6510    return _CPTimerBridgeTimer(codeOrFunction, aDelay, NO, Array.prototype.slice.apply(arguments, [2]));
6511}
6512window.clearTimeout = function(aTimeoutID)
6513{
6514    var timer = CPTimersForTimeoutIDs[aTimeoutID];
6515    if (timer)
6516        objj_msgSend(timer, "invalidate");
6517    CPTimersForTimeoutIDs[aTimeoutID] = nil;
6518}
6519window.setInterval = function(codeOrFunction, aDelay, functionArgs)
6520{
6521    return _CPTimerBridgeTimer(codeOrFunction, aDelay, YES, Array.prototype.slice.apply(arguments, [2]));
6522}
6523window.clearInterval = function(aTimeoutID)
6524{
6525    window.clearTimeout(aTimeoutID);
6526}
6527
6528p;15;CPUndoManager.ji;10;CPObject.ji;14;CPInvocation.jc;18634;
6529var CPUndoManagerNormal = 0,
6530    CPUndoManagerUndoing = 1,
6531    CPUndoManagerRedoing = 2;
6532CPUndoManagerCheckpointNotification = "CPUndoManagerCheckpointNotification";
6533CPUndoManagerDidOpenUndoGroupNotification = "CPUndoManagerDidOpenUndoGroupNotification";
6534CPUndoManagerDidRedoChangeNotification = "CPUndoManagerDidRedoChangeNotification";
6535CPUndoManagerDidUndoChangeNotification = "CPUndoManagerDidUndoChangeNotification";
6536CPUndoManagerWillCloseUndoGroupNotification = "CPUndoManagerWillCloseUndoGroupNotification";
6537CPUndoManagerWillRedoChangeNotification = "CPUndoManagerWillRedoChangeNotification";
6538CPUndoManagerWillUndoChangeNotification = "CPUndoManagerWillUndoChangeNotification";
6539CPUndoCloseGroupingRunLoopOrdering = 350000;
6540var _CPUndoGroupingPool = [],
6541    _CPUndoGroupingPoolCapacity = 5;
6542{var the_class = objj_allocateClassPair(CPObject, "_CPUndoGrouping"),
6543meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_parent"), new objj_ivar("_invocations")]);
6544objj_registerClassPair(the_class);
6545objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
6546class_addMethods(the_class, [new objj_method(sel_getUid("initWithParent:"), function $_CPUndoGrouping__initWithParent_(self, _cmd, anUndoGrouping)
6547{ with(self)
6548{
6549    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
6550    if (self)
6551    {
6552        _parent = anUndoGrouping;
6553        _invocations = [];
6554    }
6555    return self;
6556}
6557}), new objj_method(sel_getUid("parent"), function $_CPUndoGrouping__parent(self, _cmd)
6558{ with(self)
6559{
6560    return _parent;
6561}
6562}), new objj_method(sel_getUid("addInvocation:"), function $_CPUndoGrouping__addInvocation_(self, _cmd, anInvocation)
6563{ with(self)
6564{
6565    _invocations.push(anInvocation);
6566}
6567}), new objj_method(sel_getUid("addInvocationsFromArray:"), function $_CPUndoGrouping__addInvocationsFromArray_(self, _cmd, invocations)
6568{ with(self)
6569{
6570    objj_msgSend(_invocations, "addObjectsFromArray:", invocations);
6571}
6572}), new objj_method(sel_getUid("removeInvocationsWithTarget:"), function $_CPUndoGrouping__removeInvocationsWithTarget_(self, _cmd, aTarget)
6573{ with(self)
6574{
6575    var index = _invocations.length;
6576    while (index--)
6577        if (objj_msgSend(_invocations[index], "target") == aTarget)
6578            _invocations.splice(index, 1);
6579}
6580}), new objj_method(sel_getUid("invocations"), function $_CPUndoGrouping__invocations(self, _cmd)
6581{ with(self)
6582{
6583    return _invocations;
6584}
6585}), new objj_method(sel_getUid("invoke"), function $_CPUndoGrouping__invoke(self, _cmd)
6586{ with(self)
6587{
6588    var index = _invocations.length;
6589    while (index--)
6590        objj_msgSend(_invocations[index], "invoke");
6591}
6592})]);
6593class_addMethods(meta_class, [new objj_method(sel_getUid("_poolUndoGrouping:"), function $_CPUndoGrouping___poolUndoGrouping_(self, _cmd, anUndoGrouping)
6594{ with(self)
6595{
6596    if (!anUndoGrouping || _CPUndoGroupingPool.length >= _CPUndoGroupingPoolCapacity)
6597        return;
6598    _CPUndoGroupingPool.push(anUndoGrouping);
6599}
6600}), new objj_method(sel_getUid("undoGroupingWithParent:"), function $_CPUndoGrouping__undoGroupingWithParent_(self, _cmd, anUndoGrouping)
6601{ with(self)
6602{
6603    if (_CPUndoGroupingPool.length)
6604    {
6605        var grouping = _CPUndoGroupingPool.pop();
6606        grouping._parent = anUndoGrouping;
6607        if (grouping._invocations.length)
6608            grouping._invocations = [];
6609        return grouping;
6610    }
6611    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithParent:", anUndoGrouping);
6612}
6613})]);
6614}
6615var _CPUndoGroupingParentKey = "_CPUndoGroupingParentKey",
6616    _CPUndoGroupingInvocationsKey = "_CPUndoGroupingInvocationsKey";
6617{
6618var the_class = objj_getClass("_CPUndoGrouping")
6619if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"_CPUndoGrouping\""));
6620var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $_CPUndoGrouping__initWithCoder_(self, _cmd, aCoder)
6621{ with(self)
6622{
6623    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
6624    if (self)
6625    {
6626        _parent = objj_msgSend(aCoder, "decodeObjectForKey:", _CPUndoGroupingParentKey);
6627        _invocations = objj_msgSend(aCoder, "decodeObjectForKey:", _CPUndoGroupingInvocationsKey);
6628    }
6629    return self;
6630}
6631}), new objj_method(sel_getUid("encodeWithCoder:"), function $_CPUndoGrouping__encodeWithCoder_(self, _cmd, aCoder)
6632{ with(self)
6633{
6634    objj_msgSend(aCoder, "encodeObject:forKey:", _parent, _CPUndoGroupingParentKey);
6635    objj_msgSend(aCoder, "encodeObject:forKey:", _invocations, _CPUndoGroupingInvocationsKey);
6636}
6637})]);
6638}
6639{var the_class = objj_allocateClassPair(CPObject, "CPUndoManager"),
6640meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_redoStack"), new objj_ivar("_undoStack"), new objj_ivar("_groupsByEvent"), new objj_ivar("_disableCount"), new objj_ivar("_levelsOfUndo"), new objj_ivar("_currentGrouping"), new objj_ivar("_state"), new objj_ivar("_actionName"), new objj_ivar("_preparedTarget"), new objj_ivar("_runLoopModes"), new objj_ivar("_registeredWithRunLoop")]);
6641objj_registerClassPair(the_class);
6642objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
6643class_addMethods(the_class, [new objj_method(sel_getUid("init"), function $CPUndoManager__init(self, _cmd)
6644{ with(self)
6645{
6646    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
6647    if (self)
6648    {
6649        _redoStack = [];
6650        _undoStack = [];
6651        _state = CPUndoManagerNormal;
6652        objj_msgSend(self, "setRunLoopModes:", [CPDefaultRunLoopMode]);
6653        objj_msgSend(self, "setGroupsByEvent:", YES);
6654        _performRegistered = NO;
6655    }
6656    return self;
6657}
6658}), new objj_method(sel_getUid("registerUndoWithTarget:selector:object:"), function $CPUndoManager__registerUndoWithTarget_selector_object_(self, _cmd, aTarget, aSelector, anObject)
6659{ with(self)
6660{
6661    if (!_currentGrouping)
6662        objj_msgSend(CPException, "raise:reason:", CPInternalInconsistencyException, "No undo group is currently open");
6663    if (_disableCount > 0)
6664        return;
6665    var invocation = objj_msgSend(CPInvocation, "invocationWithMethodSignature:", nil);
6666    objj_msgSend(invocation, "setTarget:", aTarget);
6667    objj_msgSend(invocation, "setSelector:", aSelector);
6668    objj_msgSend(invocation, "setArgument:atIndex:", anObject, 2);
6669    objj_msgSend(_currentGrouping, "addInvocation:", invocation);
6670    if (_state == CPUndoManagerNormal)
6671        objj_msgSend(_redoStack, "removeAllObjects");
6672}
6673}), new objj_method(sel_getUid("prepareWithInvocationTarget:"), function $CPUndoManager__prepareWithInvocationTarget_(self, _cmd, aTarget)
6674{ with(self)
6675{
6676    _preparedTarget = aTarget;
6677    return self;
6678}
6679}), new objj_method(sel_getUid("methodSignatureForSelector:"), function $CPUndoManager__methodSignatureForSelector_(self, _cmd, aSelector)
6680{ with(self)
6681{
6682    if (objj_msgSend(_preparedTarget, "respondsToSelector:", aSelector))
6683        return 1;
6684    return nil;
6685}
6686}), new objj_method(sel_getUid("forwardInvocation:"), function $CPUndoManager__forwardInvocation_(self, _cmd, anInvocation)
6687{ with(self)
6688{
6689    if (_disableCount > 0)
6690        return;
6691    objj_msgSend(anInvocation, "setTarget:", _preparedTarget);
6692    objj_msgSend(_currentGrouping, "addInvocation:", anInvocation);
6693    if (_state == CPUndoManagerNormal)
6694        objj_msgSend(_redoStack, "removeAllObjects");
6695    _preparedTarget = nil;
6696}
6697}), new objj_method(sel_getUid("canRedo"), function $CPUndoManager__canRedo(self, _cmd)
6698{ with(self)
6699{
6700    return _redoStack.length > 0;
6701}
6702}), new objj_method(sel_getUid("canUndo"), function $CPUndoManager__canUndo(self, _cmd)
6703{ with(self)
6704{
6705    if (_undoStack.length > 0)
6706        return YES;
6707    return objj_msgSend(_currentGrouping, "actions").length > 0;
6708}
6709}), new objj_method(sel_getUid("undo"), function $CPUndoManager__undo(self, _cmd)
6710{ with(self)
6711{
6712    if (objj_msgSend(self, "groupingLevel") == 1)
6713        objj_msgSend(self, "endUndoGrouping");
6714    objj_msgSend(self, "undoNestedGroup");
6715}
6716}), new objj_method(sel_getUid("undoNestedGroup"), function $CPUndoManager__undoNestedGroup(self, _cmd)
6717{ with(self)
6718{
6719    if (_undoStack.length == 0)
6720        return;
6721    var defaultCenter = objj_msgSend(CPNotificationCenter, "defaultCenter");
6722    objj_msgSend(defaultCenter, "postNotificationName:object:", CPUndoManagerWillUndoChangeNotification, self);
6723    var undoGrouping = _undoStack.pop();
6724    _state = CPUndoManagerUndoing;
6725    objj_msgSend(self, "beginUndoGrouping");
6726    objj_msgSend(undoGrouping, "invoke");
6727    objj_msgSend(self, "endUndoGrouping");
6728    objj_msgSend(_CPUndoGrouping, "_poolUndoGrouping:", undoGrouping);
6729    _state = CPUndoManagerNormal;
6730    objj_msgSend(defaultCenter, "postNotificationName:object:", CPUndoManagerDidUndoChangeNotification, self);
6731}
6732}), new objj_method(sel_getUid("redo"), function $CPUndoManager__redo(self, _cmd)
6733{ with(self)
6734{
6735    if (_redoStack.length == 0)
6736        return;
6737    var defaultCenter = objj_msgSend(CPNotificationCenter, "defaultCenter");
6738    objj_msgSend(defaultCenter, "postNotificationName:object:", CPUndoManagerWillRedoChangeNotification, self);
6739    var oldUndoGrouping = _currentGrouping,
6740        undoGrouping = _redoStack.pop();
6741    _currentGrouping = nil;
6742    _state = CPUndoManagerRedoing;
6743    objj_msgSend(self, "beginUndoGrouping");
6744    objj_msgSend(undoGrouping, "invoke");
6745    objj_msgSend(self, "endUndoGrouping");
6746    objj_msgSend(_CPUndoGrouping, "_poolUndoGrouping:", undoGrouping);
6747    _currentGrouping = oldUndoGrouping;
6748    _state = CPUndoManagerNormal;
6749    objj_msgSend(defaultCenter, "postNotificationName:object:", CPUndoManagerDidRedoChangeNotification, self);
6750}
6751}), new objj_method(sel_getUid("beginUndoGrouping"), function $CPUndoManager__beginUndoGrouping(self, _cmd)
6752{ with(self)
6753{
6754    _currentGrouping = objj_msgSend(_CPUndoGrouping, "undoGroupingWithParent:", _currentGrouping);
6755}
6756}), new objj_method(sel_getUid("endUndoGrouping"), function $CPUndoManager__endUndoGrouping(self, _cmd)
6757{ with(self)
6758{
6759    if (!_currentGrouping)
6760        objj_msgSend(CPException, "raise:reason:", CPInternalInconsistencyException, "endUndoGrouping. No undo group is currently open.");
6761    var parent = objj_msgSend(_currentGrouping, "parent");
6762    if (!parent && objj_msgSend(_currentGrouping, "invocations").length > 0)
6763    {
6764        objj_msgSend(objj_msgSend(CPNotificationCenter, "defaultCenter"), "postNotificationName:object:", CPUndoManagerWillCloseUndoGroupNotification, self);
6765        var stack = _state == CPUndoManagerUndoing ? _redoStack : _undoStack;
6766        stack.push(_currentGrouping);
6767        if (_levelsOfUndo > 0 && stack.length > _levelsOfUndo)
6768            stack.splice(0, 1);
6769    }
6770    else
6771    {
6772        objj_msgSend(parent, "addInvocationsFromArray:", objj_msgSend(_currentGrouping, "invocations"));
6773        objj_msgSend(_CPUndoGrouping, "_poolUndoGrouping:", _currentGrouping);
6774    }
6775    _currentGrouping = parent;
6776}
6777}), new objj_method(sel_getUid("enableUndoRegistration"), function $CPUndoManager__enableUndoRegistration(self, _cmd)
6778{ with(self)
6779{
6780    if (_disableCount <= 0)
6781        objj_msgSend(CPException, "raise:reason:", CPInternalInconsistencyException, "enableUndoRegistration. There are no disable messages in effect right now.");
6782    _disableCount--;
6783}
6784}), new objj_method(sel_getUid("groupsByEvent"), function $CPUndoManager__groupsByEvent(self, _cmd)
6785{ with(self)
6786{
6787    return _groupsByEvent;
6788}
6789}), new objj_method(sel_getUid("setGroupsByEvent:"), function $CPUndoManager__setGroupsByEvent_(self, _cmd, aFlag)
6790{ with(self)
6791{
6792    if (_groupsByEvent == aFlag)
6793        return;
6794    _groupsByEvent = aFlag;
6795    if (_groupsByEvent)
6796    {
6797        objj_msgSend(self, "_registerWithRunLoop");
6798        if (!_currentGrouping)
6799            objj_msgSend(self, "beginUndoGrouping");
6800    }
6801    else
6802        objj_msgSend(self, "_unregisterWithRunLoop");
6803}
6804}), new objj_method(sel_getUid("groupingLevel"), function $CPUndoManager__groupingLevel(self, _cmd)
6805{ with(self)
6806{
6807    var grouping = _currentGrouping,
6808        level = _currentGrouping != nil;
6809    while (grouping = objj_msgSend(grouping, "parent"))
6810        ++level;
6811    return level;
6812}
6813}), new objj_method(sel_getUid("disableUndoRegistration"), function $CPUndoManager__disableUndoRegistration(self, _cmd)
6814{ with(self)
6815{
6816    ++_disableCount;
6817}
6818}), new objj_method(sel_getUid("isUndoRegistrationEnabled"), function $CPUndoManager__isUndoRegistrationEnabled(self, _cmd)
6819{ with(self)
6820{
6821    return _disableCount == 0;
6822}
6823}), new objj_method(sel_getUid("isUndoing"), function $CPUndoManager__isUndoing(self, _cmd)
6824{ with(self)
6825{
6826    return _state == CPUndoManagerUndoing;
6827}
6828}), new objj_method(sel_getUid("isRedoing"), function $CPUndoManager__isRedoing(self, _cmd)
6829{ with(self)
6830{
6831    return _state == CPUndoManagerRedoing;
6832}
6833}), new objj_method(sel_getUid("removeAllActions"), function $CPUndoManager__removeAllActions(self, _cmd)
6834{ with(self)
6835{
6836    _redoStack = [];
6837    _undoStack = [];
6838    _disableCount = 0;
6839}
6840}), new objj_method(sel_getUid("removeAllActionsWithTarget:"), function $CPUndoManager__removeAllActionsWithTarget_(self, _cmd, aTarget)
6841{ with(self)
6842{
6843    objj_msgSend(_currentGrouping, "removeInvocationsWithTarget:", aTarget);
6844    var index = _redoStack.length;
6845    while (index--)
6846    {
6847        var grouping = _redoStack[index];
6848        objj_msgSend(grouping, "removeInvocationsWithTarget:", aTarget);
6849        if (!objj_msgSend(grouping, "invocations").length)
6850            _redoStack.splice(index, 1);
6851    }
6852    index = _undoStack.length;
6853    while (index--)
6854    {
6855        var grouping = _undoStack[index];
6856        objj_msgSend(grouping, "removeInvocationsWithTarget:", aTarget);
6857        if (!objj_msgSend(grouping, "invocations").length)
6858            _undoStack.splice(index, 1);
6859    }
6860}
6861}), new objj_method(sel_getUid("setActionName:"), function $CPUndoManager__setActionName_(self, _cmd, anActionName)
6862{ with(self)
6863{
6864    _actionName = anActionName;
6865}
6866}), new objj_method(sel_getUid("redoActionName"), function $CPUndoManager__redoActionName(self, _cmd)
6867{ with(self)
6868{
6869    return objj_msgSend(self, "canRedo") ? _actionName : nil;
6870}
6871}), new objj_method(sel_getUid("undoActionName"), function $CPUndoManager__undoActionName(self, _cmd)
6872{ with(self)
6873{
6874    return objj_msgSend(self, "canUndo") ? _actionName : nil;
6875}
6876}), new objj_method(sel_getUid("runLoopModes"), function $CPUndoManager__runLoopModes(self, _cmd)
6877{ with(self)
6878{
6879    return _runLoopModes;
6880}
6881}), new objj_method(sel_getUid("setRunLoopModes:"), function $CPUndoManager__setRunLoopModes_(self, _cmd, modes)
6882{ with(self)
6883{
6884    _runLoopModes = modes;
6885    objj_msgSend(self, "_unregisterWithRunLoop");
6886    if (_groupsByEvent)
6887        objj_msgSend(self, "_registerWithRunLoop");
6888}
6889}), new objj_method(sel_getUid("beginUndoGroupingForEvent"), function $CPUndoManager__beginUndoGroupingForEvent(self, _cmd)
6890{ with(self)
6891{
6892    if (!_groupsByEvent)
6893        return;
6894    if (_currentGrouping != nil)
6895        objj_msgSend(self, "endUndoGrouping");
6896    objj_msgSend(self, "beginUndoGrouping");
6897    objj_msgSend(objj_msgSend(CPRunLoop, "currentRunLoop"), "performSelector:target:argument:order:modes:", sel_getUid("beginUndoGroupingForEvent"), self, nil, CPUndoCloseGroupingRunLoopOrdering, _runLoopModes);
6898}
6899}), new objj_method(sel_getUid("_registerWithRunLoop"), function $CPUndoManager___registerWithRunLoop(self, _cmd)
6900{ with(self)
6901{
6902    if (_registeredWithRunLoop)
6903        return;
6904    _registeredWithRunLoop = YES;
6905    objj_msgSend(objj_msgSend(CPRunLoop, "currentRunLoop"), "performSelector:target:argument:order:modes:", sel_getUid("beginUndoGroupingForEvent"), self, nil, CPUndoCloseGroupingRunLoopOrdering, _runLoopModes);
6906}
6907}), new objj_method(sel_getUid("_unregisterWithRunLoop"), function $CPUndoManager___unregisterWithRunLoop(self, _cmd)
6908{ with(self)
6909{
6910    if (!_registeredWithRunLoop)
6911        return;
6912    _registeredWithRunLoop = NO;
6913    objj_msgSend(objj_msgSend(CPRunLoop, "currentRunLoop"), "cancelPerformSelector:target:argument:", sel_getUid("beginUndoGroupingForEvent"), self, nil);
6914}
6915})]);
6916}
6917var CPUndoManagerRedoStackKey = "CPUndoManagerRedoStackKey",
6918    CPUndoManagerUndoStackKey = "CPUndoManagerUndoStackKey";
6919    CPUndoManagerLevelsOfUndoKey = "CPUndoManagerLevelsOfUndoKey";
6920    CPUndoManagerActionNameKey = "CPUndoManagerActionNameKey";
6921    CPUndoManagerCurrentGroupingKey = "CPUndoManagerCurrentGroupingKey";
6922    CPUndoManagerRunLoopModesKey = "CPUndoManagerRunLoopModesKey";
6923    CPUndoManagerGroupsByEventKey = "CPUndoManagerGroupsByEventKey";
6924{
6925var the_class = objj_getClass("CPUndoManager")
6926if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPUndoManager\""));
6927var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $CPUndoManager__initWithCoder_(self, _cmd, aCoder)
6928{ with(self)
6929{
6930    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
6931    if (self)
6932    {
6933        _redoStack = objj_msgSend(aCoder, "decodeObjectForKey:", CPUndoManagerRedoStackKey);
6934        _undoStack = objj_msgSend(aCoder, "decodeObjectForKey:", CPUndoManagerUndoStackKey);
6935        _levelsOfUndo = objj_msgSend(aCoder, "decodeObjectForKey:", CPUndoManagerLevelsOfUndoKey);
6936        _actionName = objj_msgSend(aCoder, "decodeObjectForKey:", CPUndoManagerActionNameKey);
6937        _currentGrouping = objj_msgSend(aCoder, "decodeObjectForKey:", CPUndoManagerCurrentGroupingKey);
6938        _state = CPUndoManagerNormal;
6939        objj_msgSend(self, "setRunLoopModes:", objj_msgSend(aCoder, "decodeObjectForKey:", CPUndoManagerRunLoopModesKey));
6940        objj_msgSend(self, "setGroupsByEvent:", objj_msgSend(aCoder, "decodeBoolForKey:", CPUndoManagerGroupsByEventKey));
6941    }
6942    return self;
6943}
6944}), new objj_method(sel_getUid("encodeWithCoder:"), function $CPUndoManager__encodeWithCoder_(self, _cmd, aCoder)
6945{ with(self)
6946{
6947    objj_msgSend(aCoder, "encodeObject:forKey:", _redoStack, CPUndoManagerRedoStackKey);
6948    objj_msgSend(aCoder, "encodeObject:forKey:", _undoStack, CPUndoManagerUndoStackKey);
6949    objj_msgSend(aCoder, "encodeInt:forKey:", _levelsOfUndo, CPUndoManagerLevelsOfUndoKey);
6950    objj_msgSend(aCoder, "encodeObject:forKey:", _actionName, CPUndoManagerActionNameKey);
6951    objj_msgSend(aCoder, "encodeObject:forKey:", _currentGrouping, CPUndoManagerCurrentGroupingKey);
6952    objj_msgSend(aCoder, "encodeObject:forKey:", _runLoopModes, CPUndoManagerRunLoopModesKey);
6953    objj_msgSend(aCoder, "encodeBool:forKey:", _groupsByEvent, CPUndoManagerGroupsByEventKey);
6954}
6955})]);
6956}
6957
6958p;17;CPURLConnection.ji;10;CPObject.ji;11;CPRunLoop.ji;14;CPURLRequest.ji;15;CPURLResponse.jc;6650;
6959var XMLHTTPRequestUninitialized = 0,
6960    XMLHTTPRequestLoading = 1,
6961    XMLHTTPRequestLoaded = 2,
6962    XMLHTTPRequestInteractive = 3,
6963    XMLHTTPRequestComplete = 4;
6964var CPURLConnectionDelegate = nil;
6965{var the_class = objj_allocateClassPair(CPObject, "CPURLConnection"),
6966meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_request"), new objj_ivar("_delegate"), new objj_ivar("_isCanceled"), new objj_ivar("_isLocalFileConnection"), new objj_ivar("_XMLHTTPRequest")]);
6967objj_registerClassPair(the_class);
6968objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
6969class_addMethods(the_class, [new objj_method(sel_getUid("initWithRequest:delegate:startImmediately:"), function $CPURLConnection__initWithRequest_delegate_startImmediately_(self, _cmd, aRequest, aDelegate, shouldStartImmediately)
6970{ with(self)
6971{
6972    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
6973    if (self)
6974    {
6975        _request = aRequest;
6976        _delegate = aDelegate;
6977        _isCanceled = NO;
6978        var path = objj_msgSend(_request, "URL");
6979        _isLocalFileConnection = path.indexOf("file:") === 0 ||
6980                                    ((path.indexOf("http:") !== 0 || path.indexOf("https:") !== 0) &&
6981                                    window.location &&
6982                                    (window.location.protocol === "file:" || window.location.protocol === "app:"));
6983        _XMLHTTPRequest = objj_request_xmlhttp();
6984        if (shouldStartImmediately)
6985            objj_msgSend(self, "start");
6986    }
6987    return self;
6988}
6989}), new objj_method(sel_getUid("initWithRequest:delegate:"), function $CPURLConnection__initWithRequest_delegate_(self, _cmd, aRequest, aDelegate)
6990{ with(self)
6991{
6992    return objj_msgSend(self, "initWithRequest:delegate:startImmediately:", aRequest, aDelegate, YES);
6993}
6994}), new objj_method(sel_getUid("delegate"), function $CPURLConnection__delegate(self, _cmd)
6995{ with(self)
6996{
6997    return _delegate;
6998}
6999}), new objj_method(sel_getUid("start"), function $CPURLConnection__start(self, _cmd)
7000{ with(self)
7001{
7002    _isCanceled = NO;
7003    try
7004    {
7005        _XMLHTTPRequest.open(objj_msgSend(_request, "HTTPMethod"), objj_msgSend(_request, "URL"), YES);
7006        _XMLHTTPRequest.onreadystatechange = function() { objj_msgSend(self, "_readyStateDidChange"); }
7007        var fields = objj_msgSend(_request, "allHTTPHeaderFields"),
7008            key = nil,
7009            keys = objj_msgSend(fields, "keyEnumerator");
7010        while (key = objj_msgSend(keys, "nextObject"))
7011            _XMLHTTPRequest.setRequestHeader(key, objj_msgSend(fields, "objectForKey:", key));
7012        _XMLHTTPRequest.send(objj_msgSend(_request, "HTTPBody"));
7013    }
7014    catch (anException)
7015    {
7016        if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("connection:didFailWithError:")))
7017            objj_msgSend(_delegate, "connection:didFailWithError:", self, anException);
7018    }
7019}
7020}), new objj_method(sel_getUid("cancel"), function $CPURLConnection__cancel(self, _cmd)
7021{ with(self)
7022{
7023    _isCanceled = YES;
7024    try
7025    {
7026        _XMLHTTPRequest.abort();
7027    }
7028    catch (anException)
7029    {
7030    }
7031}
7032}), new objj_method(sel_getUid("isLocalFileConnection"), function $CPURLConnection__isLocalFileConnection(self, _cmd)
7033{ with(self)
7034{
7035    return _isLocalFileConnection;
7036}
7037}), new objj_method(sel_getUid("_readyStateDidChange"), function $CPURLConnection___readyStateDidChange(self, _cmd)
7038{ with(self)
7039{
7040    if (_XMLHTTPRequest.readyState == XMLHTTPRequestComplete)
7041    {
7042        var statusCode = _XMLHTTPRequest.status,
7043            URL = objj_msgSend(_request, "URL");
7044        if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("connection:didReceiveResponse:")))
7045        {
7046            if (_isLocalFileConnection)
7047                objj_msgSend(_delegate, "connection:didReceiveResponse:", self, objj_msgSend(objj_msgSend(CPURLResponse, "alloc"), "initWithURL:", URL));
7048            else
7049            {
7050                var response = objj_msgSend(objj_msgSend(CPHTTPURLResponse, "alloc"), "initWithURL:", URL);
7051                objj_msgSend(response, "_setStatusCode:", statusCode);
7052                objj_msgSend(_delegate, "connection:didReceiveResponse:", self, response);
7053            }
7054        }
7055        if (!_isCanceled)
7056        {
7057            if (statusCode == 401 && objj_msgSend(CPURLConnectionDelegate, "respondsToSelector:", sel_getUid("connectionDidReceiveAuthenticationChallenge:")))
7058                objj_msgSend(CPURLConnectionDelegate, "connectionDidReceiveAuthenticationChallenge:", self);
7059            else
7060            {
7061                if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("connection:didReceiveData:")))
7062                    objj_msgSend(_delegate, "connection:didReceiveData:", self, _XMLHTTPRequest.responseText);
7063                if (objj_msgSend(_delegate, "respondsToSelector:", sel_getUid("connectionDidFinishLoading:")))
7064                    objj_msgSend(_delegate, "connectionDidFinishLoading:", self);
7065            }
7066        }
7067    }
7068    objj_msgSend(objj_msgSend(CPRunLoop, "currentRunLoop"), "limitDateForMode:", CPDefaultRunLoopMode);
7069}
7070}), new objj_method(sel_getUid("_XMLHTTPRequest"), function $CPURLConnection___XMLHTTPRequest(self, _cmd)
7071{ with(self)
7072{
7073    return _XMLHTTPRequest;
7074}
7075})]);
7076class_addMethods(meta_class, [new objj_method(sel_getUid("setClassDelegate:"), function $CPURLConnection__setClassDelegate_(self, _cmd, delegate)
7077{ with(self)
7078{
7079    CPURLConnectionDelegate = delegate;
7080}
7081}), new objj_method(sel_getUid("sendSynchronousRequest:returningResponse:error:"), function $CPURLConnection__sendSynchronousRequest_returningResponse_error_(self, _cmd, aRequest, aURLResponse, anError)
7082{ with(self)
7083{
7084    try
7085    {
7086        var request = objj_request_xmlhttp();
7087        request.open(objj_msgSend(aRequest, "HTTPMethod"), objj_msgSend(aRequest, "URL"), NO);
7088        var fields = objj_msgSend(aRequest, "allHTTPHeaderFields"),
7089            key = nil,
7090            keys = objj_msgSend(fields, "keyEnumerator");
7091        while (key = objj_msgSend(keys, "nextObject"))
7092            request.setRequestHeader(key, objj_msgSend(fields, "objectForKey:", key));
7093        request.send(objj_msgSend(aRequest, "HTTPBody"));
7094        return objj_msgSend(CPData, "dataWithString:", request.responseText);
7095    }
7096    catch (anException)
7097    {
7098    }
7099    return nil;
7100}
7101}), new objj_method(sel_getUid("connectionWithRequest:delegate:"), function $CPURLConnection__connectionWithRequest_delegate_(self, _cmd, aRequest, aDelegate)
7102{ with(self)
7103{
7104    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithRequest:delegate:", aRequest, aDelegate);
7105}
7106})]);
7107}
7108
7109p;14;CPURLRequest.ji;10;CPObject.jc;2769;
7110{var the_class = objj_allocateClassPair(CPObject, "CPURLRequest"),
7111meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_URL"), new objj_ivar("_HTTPBody"), new objj_ivar("_HTTPMethod"), new objj_ivar("_HTTPHeaderFields")]);
7112objj_registerClassPair(the_class);
7113objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
7114class_addMethods(the_class, [new objj_method(sel_getUid("initWithURL:"), function $CPURLRequest__initWithURL_(self, _cmd, aURL)
7115{ with(self)
7116{
7117    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
7118    if (self)
7119    {
7120        _URL = aURL;
7121        _HTTPBody = "";
7122        _HTTPMethod = "GET";
7123        _HTTPHeaderFields = objj_msgSend(CPDictionary, "dictionary");
7124        objj_msgSend(self, "setValue:forHTTPHeaderField:", "Thu, 1 Jan 1970 00:00:00 GMT", "If-Modified-Since");
7125        objj_msgSend(self, "setValue:forHTTPHeaderField:", "no-cache", "Cache-Control");
7126        objj_msgSend(self, "setValue:forHTTPHeaderField:", "XMLHttpRequest", "X-Requested-With");
7127    }
7128    return self;
7129}
7130}), new objj_method(sel_getUid("URL"), function $CPURLRequest__URL(self, _cmd)
7131{ with(self)
7132{
7133    return _URL;
7134}
7135}), new objj_method(sel_getUid("setURL:"), function $CPURLRequest__setURL_(self, _cmd, aURL)
7136{ with(self)
7137{
7138    _URL = aURL;
7139}
7140}), new objj_method(sel_getUid("setHTTPBody:"), function $CPURLRequest__setHTTPBody_(self, _cmd, anHTTPBody)
7141{ with(self)
7142{
7143    _HTTPBody = anHTTPBody;
7144}
7145}), new objj_method(sel_getUid("HTTPBody"), function $CPURLRequest__HTTPBody(self, _cmd)
7146{ with(self)
7147{
7148    return _HTTPBody;
7149}
7150}), new objj_method(sel_getUid("setHTTPMethod:"), function $CPURLRequest__setHTTPMethod_(self, _cmd, anHTTPMethod)
7151{ with(self)
7152{
7153    _HTTPMethod = anHTTPMethod;
7154}
7155}), new objj_method(sel_getUid("HTTPMethod"), function $CPURLRequest__HTTPMethod(self, _cmd)
7156{ with(self)
7157{
7158    return _HTTPMethod;
7159}
7160}), new objj_method(sel_getUid("allHTTPHeaderFields"), function $CPURLRequest__allHTTPHeaderFields(self, _cmd)
7161{ with(self)
7162{
7163    return _HTTPHeaderFields;
7164}
7165}), new objj_method(sel_getUid("valueForHTTPHeaderField:"), function $CPURLRequest__valueForHTTPHeaderField_(self, _cmd, aField)
7166{ with(self)
7167{
7168    return objj_msgSend(_HTTPHeaderFields, "objectForKey:", aField);
7169}
7170}), new objj_method(sel_getUid("setValue:forHTTPHeaderField:"), function $CPURLRequest__setValue_forHTTPHeaderField_(self, _cmd, aValue, aField)
7171{ with(self)
7172{
7173    objj_msgSend(_HTTPHeaderFields, "setObject:forKey:", aValue, aField);
7174}
7175})]);
7176class_addMethods(meta_class, [new objj_method(sel_getUid("requestWithURL:"), function $CPURLRequest__requestWithURL_(self, _cmd, aURL)
7177{ with(self)
7178{
7179    return objj_msgSend(objj_msgSend(CPURLRequest, "alloc"), "initWithURL:", aURL);
7180}
7181})]);
7182}
7183
7184p;15;CPURLResponse.ji;10;CPObject.jc;1309;
7185{var the_class = objj_allocateClassPair(CPObject, "CPURLResponse"),
7186meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_URL")]);
7187objj_registerClassPair(the_class);
7188objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
7189class_addMethods(the_class, [new objj_method(sel_getUid("initWithURL:"), function $CPURLResponse__initWithURL_(self, _cmd, aURL)
7190{ with(self)
7191{
7192    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
7193    if (self)
7194        _URL = aURL;
7195    return self;
7196}
7197}), new objj_method(sel_getUid("URL"), function $CPURLResponse__URL(self, _cmd)
7198{ with(self)
7199{
7200    return _URL;
7201}
7202})]);
7203}
7204{var the_class = objj_allocateClassPair(CPURLResponse, "CPHTTPURLResponse"),
7205meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_statusCode")]);
7206objj_registerClassPair(the_class);
7207objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
7208class_addMethods(the_class, [new objj_method(sel_getUid("_setStatusCode:"), function $CPHTTPURLResponse___setStatusCode_(self, _cmd, aStatusCode)
7209{ with(self)
7210{
7211    _statusCode = aStatusCode;
7212}
7213}), new objj_method(sel_getUid("statusCode"), function $CPHTTPURLResponse__statusCode(self, _cmd)
7214{ with(self)
7215{
7216    return _statusCode;
7217}
7218})]);
7219}
7220
7221p;22;CPUserSessionManager.jI;21;Foundation/CPObject.jI;21;Foundation/CPString.jc;2478;
7222CPUserSessionUndeterminedStatus = 0;
7223CPUserSessionLoggedInStatus = 1;
7224CPUserSessionLoggedOutStatus = 2;
7225CPUserSessionManagerStatusDidChangeNotification = "CPUserSessionManagerStatusDidChangeNotification";
7226CPUserSessionManagerUserIdentifierDidChangeNotification = "CPUserSessionManagerUserIdentifierDidChangeNotification";
7227var CPDefaultUserSessionManager = nil;
7228{var the_class = objj_allocateClassPair(CPObject, "CPUserSessionManager"),
7229meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_status"), new objj_ivar("_userIdentifier")]);
7230objj_registerClassPair(the_class);
7231objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
7232class_addMethods(the_class, [new objj_method(sel_getUid("init"), function $CPUserSessionManager__init(self, _cmd)
7233{ with(self)
7234{
7235    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
7236    if (self)
7237        _status = CPUserSessionUndeterminedStatus;
7238    return self;
7239}
7240}), new objj_method(sel_getUid("status"), function $CPUserSessionManager__status(self, _cmd)
7241{ with(self)
7242{
7243    return _status;
7244}
7245}), new objj_method(sel_getUid("setStatus:"), function $CPUserSessionManager__setStatus_(self, _cmd, aStatus)
7246{ with(self)
7247{
7248    if (_status == aStatus)
7249        return;
7250    _status = aStatus;
7251    objj_msgSend(objj_msgSend(CPNotificationCenter, "defaultCenter"), "postNotificationName:object:", CPUserSessionManagerStatusDidChangeNotification, self);
7252    if (_status != CPUserSessionLoggedInStatus)
7253        objj_msgSend(self, "setUserIdentifier:", nil);
7254}
7255}), new objj_method(sel_getUid("userIdentifier"), function $CPUserSessionManager__userIdentifier(self, _cmd)
7256{ with(self)
7257{
7258    return _userIdentifier;
7259}
7260}), new objj_method(sel_getUid("setUserIdentifier:"), function $CPUserSessionManager__setUserIdentifier_(self, _cmd, anIdentifier)
7261{ with(self)
7262{
7263    if (_userIdentifier == anIdentifier)
7264        return;
7265    _userIdentifier = anIdentifier;
7266    objj_msgSend(objj_msgSend(CPNotificationCenter, "defaultCenter"), "postNotificationName:object:", CPUserSessionManagerUserIdentifierDidChangeNotification, self);
7267}
7268})]);
7269class_addMethods(meta_class, [new objj_method(sel_getUid("defaultManager"), function $CPUserSessionManager__defaultManager(self, _cmd)
7270{ with(self)
7271{
7272    if (!CPDefaultUserSessionManager)
7273        CPDefaultUserSessionManager = objj_msgSend(objj_msgSend(CPUserSessionManager, "alloc"), "init");
7274    return CPDefaultUserSessionManager;
7275}
7276})]);
7277}
7278
7279p;9;CPValue.ji;10;CPObject.ji;9;CPCoder.jc;5030;
7280{var the_class = objj_allocateClassPair(CPObject, "CPValue"),
7281meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_JSObject")]);
7282objj_registerClassPair(the_class);
7283objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
7284class_addMethods(the_class, [new objj_method(sel_getUid("initWithJSObject:"), function $CPValue__initWithJSObject_(self, _cmd, aJSObject)
7285{ with(self)
7286{
7287    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
7288    if (self)
7289        _JSObject = aJSObject;
7290    return self;
7291}
7292}), new objj_method(sel_getUid("JSObject"), function $CPValue__JSObject(self, _cmd)
7293{ with(self)
7294{
7295    return _JSObject;
7296}
7297})]);
7298class_addMethods(meta_class, [new objj_method(sel_getUid("valueWithJSObject:"), function $CPValue__valueWithJSObject_(self, _cmd, aJSObject)
7299{ with(self)
7300{
7301    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithJSObject:", aJSObject);
7302}
7303})]);
7304}
7305var CPValueValueKey = "CPValueValueKey";
7306{
7307var the_class = objj_getClass("CPValue")
7308if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPValue\""));
7309var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $CPValue__initWithCoder_(self, _cmd, aCoder)
7310{ with(self)
7311{
7312    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
7313    if (self)
7314        _JSObject = CPJSObjectCreateWithJSON(objj_msgSend(aCoder, "decodeObjectForKey:", CPValueValueKey));
7315    return self;
7316}
7317}), new objj_method(sel_getUid("encodeWithCoder:"), function $CPValue__encodeWithCoder_(self, _cmd, aCoder)
7318{ with(self)
7319{
7320    objj_msgSend(aCoder, "encodeObject:forKey:", CPJSObjectCreateJSON(_JSObject), CPValueValueKey);
7321}
7322})]);
7323}
7324var _JSONCharacterEncodings = {};
7325_JSONCharacterEncodings['\b'] = "\\b";
7326_JSONCharacterEncodings['\t'] = "\\t";
7327_JSONCharacterEncodings['\n'] = "\\n";
7328_JSONCharacterEncodings['\f'] = "\\f";
7329_JSONCharacterEncodings['\r'] = "\\r";
7330_JSONCharacterEncodings['"'] = "\\\"";
7331_JSONCharacterEncodings['\\'] = "\\\\";
7332var _JSONEncodedCharacters = new RegExp("[\\\"\\\\\\x00-\\x1f\\x7f-\\x9f]", 'g');
7333CPJSObjectCreateJSON= function(aJSObject)
7334{
7335    var type = typeof aJSObject,
7336        valueOf = aJSObject ? aJSObject.valueOf() : null,
7337        typeValueOf = typeof valueOf;
7338    if (type != typeValueOf)
7339    {
7340        type = typeValueOf;
7341        aJSObject = valueOf;
7342    }
7343    switch (type)
7344    {
7345        case "string":
7346                        if (!_JSONEncodedCharacters.test(aJSObject))
7347                            return '"' + aJSObject + '"';
7348                        return '"' + aJSObject.replace(_JSONEncodedCharacters, _CPJSObjectEncodeCharacter) + '"';
7349        case "number":
7350                        return isFinite(aJSObject) ? String(aJSObject) : "null";
7351        case "boolean":
7352        case "null": return String(aJSObject);
7353        case "object":
7354                        if (!aJSObject)
7355                            return "null";
7356                        if (typeof aJSObject.toJSON === "function")
7357                            return CPJSObjectCreateJSON(aJSObject.toJSON());
7358                        var array = [];
7359                        if (aJSObject.slice)
7360                        {
7361                            var index = 0,
7362                                count = aJSObject.length;
7363                            for (; index < count; ++index)
7364                                array.push(CPJSObjectCreateJSON(aJSObject[index]) || "null");
7365                            return '[' + array.join(',') + ']';
7366                        }
7367                        var key = NULL;
7368                        for (key in aJSObject)
7369                        {
7370                            if (!(typeof key === "string"))
7371                                continue;
7372                            var value = CPJSObjectCreateJSON(aJSObject[key]);
7373                            if (value)
7374                                array.push(CPJSObjectCreateJSON(key) + ':' + value);
7375                        }
7376                        return '{' + array.join(',') + '}';
7377    }
7378}
7379var _CPJSObjectEncodeCharacter = function(aCharacter)
7380{
7381    var encoding = _JSONCharacterEncodings[aCharacter];
7382    if (encoding)
7383        return encoding;
7384    encoding = aCharacter.charCodeAt(0);
7385    return '\\u00' + FLOOR(encoding / 16).toString(16) + (encoding % 16).toString(16);
7386}
7387var _JSONBackslashCharacters = new RegExp("\\\\.", 'g'),
7388    _JSONSimpleValueTokens = new RegExp("\"[^\"\\\\\\n\\r]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?", 'g'),
7389    _JSONValidOpenBrackets = new RegExp("(?:^|:|,)(?:\\s*\\[)+", 'g'),
7390    _JSONValidExpression = new RegExp("^[\\],:{}\\s]*$");
7391CPJSObjectCreateWithJSON= function(aString)
7392{
7393    if (_JSONValidExpression.test(aString.replace(_JSONBackslashCharacters, '@').replace(_JSONSimpleValueTokens, ']').replace(_JSONValidOpenBrackets, '')))
7394        return eval('(' + aString + ')');
7395    return nil;
7396}
7397
7398p;12;Foundation.ji;9;CPArray.ji;10;CPBundle.ji;9;CPCoder.ji;8;CPData.ji;8;CPDate.ji;14;CPDictionary.ji;14;CPEnumerator.ji;13;CPException.ji;12;CPIndexSet.ji;14;CPInvocation.ji;19;CPJSONPConnection.ji;17;CPKeyedArchiver.ji;19;CPKeyedUnarchiver.ji;18;CPKeyValueCoding.ji;21;CPKeyValueObserving.ji;7;CPLog.ji;16;CPNotification.ji;22;CPNotificationCenter.ji;8;CPNull.ji;10;CPNumber.ji;10;CPObject.ji;15;CPObjJRuntime.ji;29;CPPropertyListSerialization.ji;9;CPRange.ji;11;CPRunLoop.ji;7;CPSet.ji;18;CPSortDescriptor.ji;10;CPString.ji;9;CPTimer.ji;15;CPUndoManager.ji;17;CPURLConnection.ji;14;CPURLRequest.ji;15;CPURLResponse.ji;22;CPUserSessionManager.ji;9;CPValue.j