@STATIC1.0;p;8;AppKit.ji;12;CPGeometry.ji;13;CPResponder.ji;9;CPImage.ji;9;CPColor.ji;11;CPControl.ji;13;CPTextField.ji;10;CPButton.ji;10;CPBorder.ji;8;CPView.ji;13;CPImageView.ji;10;CPSlider.ji;14;CPScrollView.ji;13;CPTableView.ji;15;CPOutlineView.ji;10;CPWindow.ji;12;CPDocument.ji;22;CPDocumentController.ji;15;CPApplication.ji;17;CPCompatibility.ji;14;CPPasteboard.jp;13;CAAnimation.jI;21;Foundation/CPObject.jI;21;Foundation/CPString.ji;23;CAMediaTimingFunction.jc;5566;


{var the_class = objj_allocateClassPair(CPObject, "CAAnimation"),
meta_class = _class_getMeta(the_class);the_class.ivars.splice(the_class.ivars.length, 0, new objj_ivar("_isRemovedOnCompletion"));
objj_registerClassPair(the_class);
objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
var class_methods = [];
class_methods[0] = new objj_method(sel_registerName("animation"), function(self, _cmd)
{ with(self)
{
    return objj_msgSend(objj_msgSend(self, "alloc"), "init");
}
});
var instance_methods = [];
instance_methods[0] = new objj_method(sel_registerName("init"), function(self, _cmd)
{ with(self)
{
    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");

    if (self)
        _isRemovedOnCompletion = YES;

    return self;
}
});
instance_methods[1] = new objj_method(sel_registerName("shouldArchiveValueForKey:"), function(self, _cmd, aKey)
{ with(self)
{
    return YES;
}
});
class_methods[1] = new objj_method(sel_registerName("defaultValueForKey:"), function(self, _cmd, aKey)
{ with(self)
{
    return nil;
}
});
instance_methods[2] = new objj_method(sel_registerName("setRemovedOnCompletion:"), function(self, _cmd, isRemovedOnCompletion)
{ with(self)
{
    _isRemovedOnCompletion = isRemovedOnCompletion;
}
});
instance_methods[3] = new objj_method(sel_registerName("removedOnCompletion"), function(self, _cmd)
{ with(self)
{
    return _isRemovedOnCompletion;
}
});
instance_methods[4] = new objj_method(sel_registerName("isRemovedOnCompletion"), function(self, _cmd)
{ with(self)
{
    return _isRemovedOnCompletion;
}
});
instance_methods[5] = new objj_method(sel_registerName("timingFunction"), function(self, _cmd)
{ with(self)
{

    return nil;
}
});
instance_methods[6] = new objj_method(sel_registerName("setDelegate:"), function(self, _cmd, aDelegate)
{ with(self)
{
    _delegate = aDelegate;
}
});
instance_methods[7] = new objj_method(sel_registerName("delegate"), function(self, _cmd)
{ with(self)
{
    return _delegate;
}
});
instance_methods[8] = new objj_method(sel_registerName("runActionForKey:object:arguments:"), function(self, _cmd, aKey, anObject, arguments)
{ with(self)
{
    objj_msgSend(anObject, "addAnimation:forKey:", self, aKey);
}
});
class_addMethods(the_class, instance_methods);
class_addMethods(meta_class, class_methods);
}

{var the_class = objj_allocateClassPair(CAAnimation, "CAPropertyAnimation"),
meta_class = _class_getMeta(the_class);the_class.ivars.splice(the_class.ivars.length, 0, new objj_ivar("_keyPath"), new objj_ivar("_isCumulative"), new objj_ivar("_isAdditive"));
objj_registerClassPair(the_class);
objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
var class_methods = [];
class_methods[0] = new objj_method(sel_registerName("animationWithKeyPath:"), function(self, _cmd, aKeyPath)
{ with(self)
{
    var animation = objj_msgSend(self, "animation");

    objj_msgSend(animation, "setKeypath:", aKeyPath);

    return animation;
}
});
var instance_methods = [];
instance_methods[0] = new objj_method(sel_registerName("setKeyPath:"), function(self, _cmd, aKeyPath)
{ with(self)
{
    _keyPath = aKeyPath;
}
});
instance_methods[1] = new objj_method(sel_registerName("keyPath"), function(self, _cmd)
{ with(self)
{
    return _keyPath;
}
});
instance_methods[2] = new objj_method(sel_registerName("setCumulative:"), function(self, _cmd, isCumulative)
{ with(self)
{
    _isCumulative = isCumulative;
}
});
instance_methods[3] = new objj_method(sel_registerName("cumulative"), function(self, _cmd)
{ with(self)
{
    return _isCumulative;
}
});
instance_methods[4] = new objj_method(sel_registerName("isCumulative"), function(self, _cmd)
{ with(self)
{
    return _isCumulative;
}
});
instance_methods[5] = new objj_method(sel_registerName("setAdditive:"), function(self, _cmd, isAdditive)
{ with(self)
{
    _isAdditive = isAdditive;
}
});
instance_methods[6] = new objj_method(sel_registerName("additive"), function(self, _cmd)
{ with(self)
{
    return _isAdditive;
}
});
instance_methods[7] = new objj_method(sel_registerName("isAdditive"), function(self, _cmd)
{ with(self)
{
    return _isAdditive;
}
});
class_addMethods(the_class, instance_methods);
class_addMethods(meta_class, class_methods);
}

{var the_class = objj_allocateClassPair(CAPropertyAnimation, "CABasicAnimation"),
meta_class = _class_getMeta(the_class);the_class.ivars.splice(the_class.ivars.length, 0, new objj_ivar("_fromValue"), new objj_ivar("_toValue"), new objj_ivar("_byValue"));
objj_registerClassPair(the_class);
objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
var instance_methods = [];
instance_methods[0] = new objj_method(sel_registerName("setFromValue:"), function(self, _cmd, aValue)
{ with(self)
{
    _fromValue = aValue;
}
});
instance_methods[1] = new objj_method(sel_registerName("fromValue"), function(self, _cmd)
{ with(self)
{
    return _fromValue;
}
});
instance_methods[2] = new objj_method(sel_registerName("setToValue:"), function(self, _cmd, aValue)
{ with(self)
{
    _toValue = aValue;
}
});
instance_methods[3] = new objj_method(sel_registerName("toValue"), function(self, _cmd)
{ with(self)
{
    return _toValue;
}
});
instance_methods[4] = new objj_method(sel_registerName("setByValue:"), function(self, _cmd, aValue)
{ with(self)
{
    _byValue = aValue;
}
});
instance_methods[5] = new objj_method(sel_registerName("byValue"), function(self, _cmd)
{ with(self)
{
    return _byValue;
}
});
class_addMethods(the_class, instance_methods);
}

p;16;CABackingStore.ji;12;CGGeometry.jc;856;



CABackingStoreGetContext= function(aBackingStore)
{
    return aBackingStore.context;
}

if (CPFeatureIsCompatible(CPHTMLCanvasFeature))
{

CABackingStoreCreate = function()
{
    var DOMElement = document.createElement("canvas");

    DOMElement.style.position = "absolute";


    return { context:DOMElement.getContext("2d"), buffer:DOMElement, _image:DOMElement };
}

CABackingStoreSetSize = function(aBackingStore, aSize)
{
    var buffer = aBackingStore.buffer;

    buffer.width = aSize.width;
    buffer.height = aSize.height;
    buffer.style.width = aSize.width + "px";;
    buffer.style.height = aSize.height + "px";;
}
}
else
{

CABackingStoreCreate = function()
{
    var context = CGBitmapGraphicsContextCreate();

    context.buffer = "";

    return { context:context };
}

CABackingStoreSetSize = function(aBackingStore, aSize)
{
}

}

p;14;CAFlashLayer.ji;9;CALayer.ji;14;CPFlashMovie.jc;1189;


{var the_class = objj_allocateClassPair(CALayer, "CAFlashLayer"),
meta_class = _class_getMeta(the_class);the_class.ivars.splice(the_class.ivars.length, 0, new objj_ivar("_flashMovie"));
objj_registerClassPair(the_class);
objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
var instance_methods = [];
instance_methods[0] = new objj_method(sel_registerName("setFlashMovie:"), function(self, _cmd, aFlashMovie)
{ with(self)
{
    if (_flashMovie == aFlashMovie)
        return;

    _flashMovie = aFlashMovie;

    _DOMElement.innerHTML = "<object width = \"100%\" height = \"100%\"><param name = \"movie\" value = \"" +
                            aFlashMovie._fileName +
                            "\"></param><param name = \"wmode\" value = \"transparent\"></param><embed src = \"" +
                            aFlashMovie._fileName + "\" type = \"application/x-shockwave-flash\" wmode = \"transparent\" width = \"100%\" height = \"100%\"></embed></object>";
}
});
instance_methods[1] = new objj_method(sel_registerName("flashMovie"), function(self, _cmd)
{ with(self)
{
    return _flashMovie;
}
});
class_addMethods(the_class, instance_methods);
}

p;9;CALayer.jI;21;Foundation/CPObject.jI;23;AppKit/CABackingStore.jI;18;AppKit/CGContext.jI;19;AppKit/CGGeometry.ji;12;CGGeometry.jc;36705;
CGAffineTransformMake= function(a, b, c, d, tx, ty) { return { a:a, b:b, c:c, d:d, tx:tx, ty:ty }; }
CGAffineTransformMakeIdentity= function() { return { a:1.0, b:0.0, c:0.0, d:1.0, tx:0.0, ty:0.0 }; }
CGAffineTransformMakeCopy= function(anAffineTransform) { return { a:anAffineTransform.a, b:anAffineTransform.b, c:anAffineTransform.c, d:anAffineTransform.d, tx:anAffineTransform.tx, ty:anAffineTransform.ty }; }

CGAffineTransformMakeScale= function(sx, sy) { return { a:sx, b:0.0, c:0.0, d:sy, tx:0.0, ty:0.0 }; }
CGAffineTransformMakeTranslation= function(tx, ty) { return { a:1.0, b:0.0, c:0.0, d:1.0, tx:tx, ty:ty }; }
CGAffineTransformTranslate= function(aTransform, tx, ty) { return { a:aTransform.a, b:aTransform.b, c:aTransform.c, d:aTransform.d, tx:aTransform.tx + aTransform.a * tx + aTransform.c * ty, ty:aTransform.ty + aTransform.b * tx + aTransform.d * ty }; }
CGAffineTransformScale= function(aTransform, sx, sy) { return { a:aTransform.a * sx, b:aTransform.b * sx, c:aTransform.c * sy, d:aTransform.d * sy, tx:aTransform.tx, ty:aTransform.ty }; }

CGAffineTransformConcat= function(lhs, rhs) { return { a:lhs.a * rhs.a + lhs.b * rhs.c, b:lhs.a * rhs.b + lhs.b * rhs.d, c:lhs.c * rhs.a + lhs.d * rhs.c, d:lhs.c * rhs.b + lhs.d * rhs.d, tx:lhs.tx * rhs.a + lhs.ty * rhs.c + rhs.tx, ty:lhs.tx * rhs.b + lhs.ty * rhs.d + rhs.ty }; }
CGPointApplyAffineTransform= function(aPoint, aTransform) { return { x:aPoint.x * aTransform.a + aPoint.y * aTransform.c + aTransform.tx, y:aPoint.x * aTransform.b + aPoint.y * aTransform.d + aTransform.ty }; }
CGSizeApplyAffineTransform= function(aSize, aTransform) { return { width:aSize.width * aTransform.a + aSize.height * aTransform.c, height:aSize.width * aTransform.b + aSize.height * aTransform.d }; }

CGAffineTransformIsIdentity= function(aTransform) { return (aTransform.a == 1 && aTransform.b == 0 && aTransform.c == 0 && aTransform.d == 1 && aTransform.tx == 0 && aTransform.ty == 0); }
CGAffineTransformEqualToTransform= function(lhs, rhs) { return (lhs.a == rhs.a && lhs.b == rhs.b && lhs.c == rhs.c && lhs.d == rhs.d && lhs.tx == rhs.tx && lhs.ty == rhs.ty); }

CGStringCreateWithCGAffineTransform= function(aTransform) { return (" [[ " + aTransform.a + ", " + aTransform.b + ", 0 ], [ " + aTransform.c + ", " + aTransform.d + ", 0 ], [ " + aTransform.tx + ", " + aTransform.ty + ", 1]]"); }


CGAffineTransformCreateCopy= function(aTransform)
{
    return { a:aTransform.a, b:aTransform.b, c:aTransform.c, d:aTransform.d, tx:aTransform.tx, ty:aTransform.ty };
}

CGAffineTransformMakeRotation= function(anAngle)
{
    var sin = SIN(anAngle),
        cos = COS(anAngle);

    return { a:cos, b:sin, c:-sin, d:cos, tx:0.0, ty:0.0 };
}

CGAffineTransformRotate= function(aTransform, anAngle)
{
    var sin = SIN(anAngle),
        cos = COS(anAngle);

    return {
            a:aTransform.a * cos + aTransform.c * sin,
            b:aTransform.b * cos + aTransform.d * sin,
            c:aTransform.c * cos - aTransform.a * sin,
            d:aTransform.d * cos - aTransform.b * sin,
            tx:aTransform.tx,
            ty:aTransform.ty
        };
}

CGAffineTransformInvert= function(aTransform)
{
    var determinant = 1 / (aTransform.a * aTransform.d - aTransform.b * aTransform.c);

    return {
        a:determinant * aTransform.d,
        b:-determinant * aTransform.b,
        c:-determinant * aTransform.c,
        d:determinant * aTransform.a,
        tx:determinant * (aTransform.c * aTransform.ty - aTransform.d * aTransform.tx),
        ty:determinant * (aTransform.b * aTransform.tx - aTransform.a * aTransform.ty)
    };
}

CGRectApplyAffineTransform= function(aRect, anAffineTransform)
{
    var top = (aRect.origin.y),
        left = (aRect.origin.x),
        right = (aRect.origin.x + aRect.size.width),
        bottom = (aRect.origin.y + aRect.size.height),
        topLeft = CGPointApplyAffineTransform({ x:left, y:top }, anAffineTransform),
        topRight = CGPointApplyAffineTransform({ x:right, y:top }, anAffineTransform),
        bottomLeft = CGPointApplyAffineTransform({ x:left, y:bottom }, anAffineTransform),
        bottomRight = CGPointApplyAffineTransform({ x:right, y:bottom }, anAffineTransform),
        minX = MIN(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x),
        maxX = MAX(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x),
        minY = MIN(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y),
        maxY = MAX(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y);

    return { origin: { x:minX, y:minY }, size: { width:(maxX - minX), height:(maxY - minY) } };
}

CPStringFromCGAffineTransform= function(anAffineTransform)
{
    return '{' + anAffineTransform.a + ", " + anAffineTransform.b + ", " + anAffineTransform.c + ", " + anAffineTransform.d + ", " + anAffineTransform.tx + ", " + anAffineTransform.ty + '}';
}
var CALayerGeometryBoundsMask = 1,
    CALayerGeometryPositionMask = 2,
    CALayerGeometryAnchorPointMask = 4,
    CALayerGeometryAffineTransformMask = 8,
    CALayerGeometryParentSublayerTransformMask = 16;
var USE_BUFFER = NO;
var CALayerFrameOriginUpdateMask = 1,
    CALayerFrameSizeUpdateMask = 2,
    CALayerZPositionUpdateMask = 4,
    CALayerDisplayUpdateMask = 8,
    CALayerCompositeUpdateMask = 16,
    CALayerDOMUpdateMask = CALayerZPositionUpdateMask | CALayerFrameOriginUpdateMask | CALayerFrameSizeUpdateMask;
var CALayerRegisteredRunLoopUpdates = nil;
{var the_class = objj_allocateClassPair(CPObject, "CALayer"),
meta_class = _class_getMeta(the_class);the_class.ivars.splice(the_class.ivars.length, 0, new objj_ivar("_frame"), new objj_ivar("_bounds"), new objj_ivar("_position"), new objj_ivar("_zPosition"), new objj_ivar("_anchorPoint"), new objj_ivar("_affineTransform"), new objj_ivar("_sublayerTransform"), new objj_ivar("_sublayerTransformForSublayers"), new objj_ivar("_backingStoreFrame"), new objj_ivar("_standardBackingStoreFrame"), new objj_ivar("_hasSublayerTransform"), new objj_ivar("_hasCustomBackingStoreFrame"), new objj_ivar("_opacity"), new objj_ivar("_isHidden"), new objj_ivar("_backgroundColor"), new objj_ivar("_superlayer"), new objj_ivar("_sublayers"), new objj_ivar("_runLoopUpdateMask"), new objj_ivar("_needsDisplayOnBoundsChange"), new objj_ivar("_delegate"), new objj_ivar("_delegateRespondsToDisplayLayerSelector"), new objj_ivar("_delegateRespondsToDrawLayerInContextSelector"), new objj_ivar("_DOMElement"), new objj_ivar("_DOMContentsElement"), new objj_ivar("_contents"), new objj_ivar("_context"), new objj_ivar("_owningView"), new objj_ivar("_transformToLayer"), new objj_ivar("_transformFromLayer"));
objj_registerClassPair(the_class);
objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
var class_methods = [];
class_methods[0] = new objj_method(sel_registerName("layer"), function(self, _cmd)
{ with(self)
{
    return objj_msgSend(objj_msgSend(objj_msgSend(self, "class"), "alloc"), "init");
}
});
var instance_methods = [];
instance_methods[0] = new objj_method(sel_registerName("init"), function(self, _cmd)
{ with(self)
{
    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
    if (self)
    {
        _frame = CGRectMakeZero();
        _backingStoreFrame = CGRectMakeZero();
        _standardBackingStoreFrame = CGRectMakeZero();
        _bounds = CGRectMakeZero();
        _position = CGPointMakeZero();
        _zPosition = 0.0;
        _anchorPoint = CGPointMake(0.5, 0.5);
        _affineTransform = CGAffineTransformMakeIdentity();
        _sublayerTransform = CGAffineTransformMakeIdentity();
        _transformToLayer = CGAffineTransformMakeIdentity();
        _transformFromLayer = CGAffineTransformMakeIdentity();
        _opacity = 1.0;
        _isHidden = NO;
        _masksToBounds = NO;
        _sublayers = [];
        _DOMElement = document.createElement("div");
        _DOMElement.style.overflow = "visible";
        _DOMElement.style.position = "absolute";
        _DOMElement.style.visibility = "visible";
        _DOMElement.style.top = "0px";
        _DOMElement.style.left = "0px";
        _DOMElement.style.zIndex = 0;
        _DOMElement.style.width = "0px";
        _DOMElement.style.height = "0px";
    }
    return self;
}
});
instance_methods[1] = new objj_method(sel_registerName("setBounds:"), function(self, _cmd, aBounds)
{ with(self)
{
    if (CGRectEqualToRect(_bounds, aBounds))
        return;
    var oldOrigin = _bounds.origin;
    _bounds = { origin: { x:aBounds.origin.x, y:aBounds.origin.y }, size: { width:aBounds.size.width, height:aBounds.size.height } };
    if (_hasSublayerTransform)
        _CALayerUpdateSublayerTransformForSublayers(self);
    _CALayerRecalculateGeometry(self, CALayerGeometryBoundsMask);
}
});
instance_methods[2] = new objj_method(sel_registerName("bounds"), function(self, _cmd)
{ with(self)
{
    return _bounds;
}
});
instance_methods[3] = new objj_method(sel_registerName("setPosition:"), function(self, _cmd, aPosition)
{ with(self)
{
    if (CGPointEqualToPoint(_position, aPosition))
        return;
    _position = { x:aPosition.x, y:aPosition.y };
    _CALayerRecalculateGeometry(self, CALayerGeometryPositionMask);
}
});
instance_methods[4] = new objj_method(sel_registerName("position"), function(self, _cmd)
{ with(self)
{
    return _position;
}
});
instance_methods[5] = new objj_method(sel_registerName("setZPosition:"), function(self, _cmd, aZPosition)
{ with(self)
{
    if (_zPosition == aZPosition)
        return;
    _zPosition = aZPosition;
    objj_msgSend(self, "registerRunLoopUpdateWithMask:", CALayerZPositionUpdateMask);
}
});
instance_methods[6] = new objj_method(sel_registerName("setAnchorPoint:"), function(self, _cmd, anAnchorPoint)
{ with(self)
{
    anAnchorPoint = { x:anAnchorPoint.x, y:anAnchorPoint.y };
    anAnchorPoint.x = MIN(1.0, MAX(0.0, anAnchorPoint.x));
    anAnchorPoint.y = MIN(1.0, MAX(0.0, anAnchorPoint.y));
    if (CGPointEqualToPoint(_anchorPoint, anAnchorPoint))
        return;
    _anchorPoint = anAnchorPoint;
    if (_hasSublayerTransform)
        _CALayerUpdateSublayerTransformForSublayers(self);
    if (_owningView)
        _position = CGPointMake((_bounds.size.width) * _anchorPoint.x, (_bounds.size.height) * _anchorPoint.y);
    _CALayerRecalculateGeometry(self, CALayerGeometryAnchorPointMask);
}
});
instance_methods[7] = new objj_method(sel_registerName("anchorPoint"), function(self, _cmd)
{ with(self)
{
    return _anchorPoint;
}
});
instance_methods[8] = new objj_method(sel_registerName("setAffineTransform:"), function(self, _cmd, anAffineTransform)
{ with(self)
{
    if (CGAffineTransformEqualToTransform(_affineTransform, anAffineTransform))
        return;
    _affineTransform = { a:anAffineTransform.a, b:anAffineTransform.b, c:anAffineTransform.c, d:anAffineTransform.d, tx:anAffineTransform.tx, ty:anAffineTransform.ty };
    _CALayerRecalculateGeometry(self, CALayerGeometryAffineTransformMask);
}
});
instance_methods[9] = new objj_method(sel_registerName("affineTransform"), function(self, _cmd)
{ with(self)
{
    return _affineTransform;
}
});
instance_methods[10] = new objj_method(sel_registerName("setSublayerTransform:"), function(self, _cmd, anAffineTransform)
{ with(self)
{
    if (CGAffineTransformEqualToTransform(_sublayerTransform, anAffineTransform))
        return;
    var hadSublayerTransform = _hasSublayerTransform;
    _sublayerTransform = { a:anAffineTransform.a, b:anAffineTransform.b, c:anAffineTransform.c, d:anAffineTransform.d, tx:anAffineTransform.tx, ty:anAffineTransform.ty };
    _hasSublayerTransform = !(_sublayerTransform.a == 1 && _sublayerTransform.b == 0 && _sublayerTransform.c == 0 && _sublayerTransform.d == 1 && _sublayerTransform.tx == 0 && _sublayerTransform.ty == 0);
    if (_hasSublayerTransform)
    {
        _CALayerUpdateSublayerTransformForSublayers(self);
        var index = _sublayers.length;


        while (index--)
            _CALayerRecalculateGeometry(_sublayers[index], CALayerGeometryParentSublayerTransformMask);
    }
}
});
instance_methods[11] = new objj_method(sel_registerName("sublayerTransform"), function(self, _cmd)
{ with(self)
{
    return _sublayerTransform;
}
});
instance_methods[12] = new objj_method(sel_registerName("transformToLayer"), function(self, _cmd)
{ with(self)
{
    return _transformToLayer;
}
});
instance_methods[13] = new objj_method(sel_registerName("setFrame:"), function(self, _cmd, aFrame)
{ with(self)
{
    alert("FIXME IMPLEMENT");
}
});
instance_methods[14] = new objj_method(sel_registerName("frame"), function(self, _cmd)
{ with(self)
{
    if (!_frame)
        _frame = objj_msgSend(self, "convertRect:toLayer:", _bounds, _superlayer);

    return _frame;
}
});
instance_methods[15] = new objj_method(sel_registerName("backingStoreFrame"), function(self, _cmd)
{ with(self)
{
    return _backingStoreFrame;
}
});
instance_methods[16] = new objj_method(sel_registerName("setBackingStoreFrame:"), function(self, _cmd, aFrame)
{ with(self)
{
    _hasCustomBackingStoreFrame = (aFrame != nil);

    if (aFrame == nil)
        aFrame = CGRectMakeCopy(_standardBackingStoreFrame);
    else
    {
        if (_superlayer)
        {
            aFrame = objj_msgSend(_superlayer, "convertRect:toLayer:", aFrame, nil);

            var bounds = objj_msgSend(_superlayer, "bounds"),
                frame = objj_msgSend(_superlayer, "convertRect:toLayer:", bounds, nil);

            aFrame.origin.x -= (frame.origin.x);
            aFrame.origin.y -= (frame.origin.y);
        }
        else
            aFrame = CGRectMakeCopy(aFrame);
    }

    if (!CGPointEqualToPoint(_backingStoreFrame.origin, aFrame.origin))
        objj_msgSend(self, "registerRunLoopUpdateWithMask:", CALayerFrameOriginUpdateMask);

    if (!CGSizeEqualToSize(_backingStoreFrame.size, aFrame.size))
        objj_msgSend(self, "registerRunLoopUpdateWithMask:", CALayerFrameSizeUpdateMask);

    _backingStoreFrame = aFrame;
}
});
instance_methods[17] = new objj_method(sel_registerName("contents"), function(self, _cmd)
{ with(self)
{
    return _contents;
}
});
instance_methods[18] = new objj_method(sel_registerName("setContents:"), function(self, _cmd, contents)
{ with(self)
{
    if (_contents == contents)
        return;

    _contents = contents;

    objj_msgSend(self, "composite");
}
});
instance_methods[19] = new objj_method(sel_registerName("composite"), function(self, _cmd)
{ with(self)
{
    if (USE_BUFFER && !_contents || !_context)
        return;

    CGContextClearRect(_context, { origin: { x:0.0, y:0.0 }, size: { width:(_backingStoreFrame.size.width), height:(_backingStoreFrame.size.height) } });


    var transform = _transformFromLayer;

    if (_superlayer)
    {
        var superlayerTransform = _CALayerGetTransform(_superlayer, nil),
            superlayerOrigin = CGPointApplyAffineTransform(_superlayer._bounds.origin, superlayerTransform);

        transform = CGAffineTransformConcat(transform, superlayerTransform);

        transform.tx -= superlayerOrigin.x;
        transform.ty -= superlayerOrigin.y;
    }

    transform.tx -= (_backingStoreFrame.origin.x);
    transform.ty -= (_backingStoreFrame.origin.y);

    CGContextSaveGState(_context);
    CGContextConcatCTM(_context, transform);
    if (USE_BUFFER)
    {

        _context.drawImage(_contents.buffer, (_bounds.origin.x), (_bounds.origin.y));
    }
    else
        objj_msgSend(self, "drawInContext:", _context);
    CGContextRestoreGState(_context);
}
});
instance_methods[20] = new objj_method(sel_registerName("display"), function(self, _cmd)
{ with(self)
{
    if (!_context)
    {
        _context = CGBitmapGraphicsContextCreate();

        _DOMContentsElement = _context.DOMElement;

        _DOMContentsElement.style.zIndex = -100;

        _DOMContentsElement.style.overflow = "hidden";
        _DOMContentsElement.style.position = "absolute";
        _DOMContentsElement.style.visibility = "visible";

        _DOMContentsElement.width = ROUND((_backingStoreFrame.size.width));
        _DOMContentsElement.height = ROUND((_backingStoreFrame.size.height));

        _DOMContentsElement.style.top = "0px";
        _DOMContentsElement.style.left = "0px";
        _DOMContentsElement.style.width = ROUND((_backingStoreFrame.size.width)) + "px";
        _DOMContentsElement.style.height = ROUND((_backingStoreFrame.size.height)) + "px";

        _DOMElement.appendChild(_DOMContentsElement);
    }

    if (USE_BUFFER)
    {
        if (_delegateRespondsToDisplayLayerSelector)
            return objj_msgSend(self, "displayInLayer:", self);

        if ((_backingStoreFrame.size.width) == 0.0 || (_backingStoreFrame.size.height) == 0.0)
            return;

        if (!_contents)
            _contents = CABackingStoreCreate();

        CABackingStoreSetSize(_contents, _bounds.size);

        objj_msgSend(self, "drawInContext:", CABackingStoreGetContext(_contents));
    }

    objj_msgSend(self, "composite");
}
});
instance_methods[21] = new objj_method(sel_registerName("drawInContext:"), function(self, _cmd, aContext)
{ with(self)
{ if (!window.loop || window.nodisplay) {objj_debug_print_backtrace(); alert("BAD!" + objj_msgSend(self, "description"));}
    if (_backgroundColor)
    {
        CGContextSetFillColor(aContext, _backgroundColor);
        CGContextFillRect(aContext, _bounds);
    }

    if (_delegateRespondsToDrawLayerInContextSelector)
        objj_msgSend(_delegate, "drawLayer:inContext:", self, aContext);
}
});
instance_methods[22] = new objj_method(sel_registerName("opacity"), function(self, _cmd)
{ with(self)
{
    return _opacity;
}
});
instance_methods[23] = new objj_method(sel_registerName("setOpacity:"), function(self, _cmd, anOpacity)
{ with(self)
{
    if (_opacity == anOpacity)
        return;

    _opacity = anOpacity;

    _DOMElement.style.opacity = anOpacity;
    _DOMElement.style.filter = "alpha(opacity=" + anOpacity * 100 + ")";
}
});
instance_methods[24] = new objj_method(sel_registerName("setHidden:"), function(self, _cmd, isHidden)
{ with(self)
{
    _isHidden = isHidden;
    _DOMElement.style.display = isHidden ? "none" : "block";
}
});
instance_methods[25] = new objj_method(sel_registerName("hidden"), function(self, _cmd)
{ with(self)
{
    return _isHidden;
}
});
instance_methods[26] = new objj_method(sel_registerName("isHidden"), function(self, _cmd)
{ with(self)
{
    return _isHidden;
}
});
instance_methods[27] = new objj_method(sel_registerName("setMasksToBounds:"), function(self, _cmd, masksToBounds)
{ with(self)
{
    if (_masksToBounds == masksToBounds)
        return;

    _masksToBounds = masksToBounds;
    _DOMElement.style.overflow = _masksToBounds ? "hidden" : "visible";
}
});
instance_methods[28] = new objj_method(sel_registerName("setBackgroundColor:"), function(self, _cmd, aColor)
{ with(self)
{
    _backgroundColor = aColor;

    objj_msgSend(self, "setNeedsDisplay");
}
});
instance_methods[29] = new objj_method(sel_registerName("backgroundColor"), function(self, _cmd)
{ with(self)
{
    return _backgroundColor;
}
});
instance_methods[30] = new objj_method(sel_registerName("sublayers"), function(self, _cmd)
{ with(self)
{
    return _sublayers;
}
});
instance_methods[31] = new objj_method(sel_registerName("superlayer"), function(self, _cmd)
{ with(self)
{
    return _superlayer;
}
});
instance_methods[32] = new objj_method(sel_registerName("addSublayer:"), function(self, _cmd, aLayer)
{ with(self)
{
    objj_msgSend(self, "insertSublayer:atIndex:", aLayer, _sublayers.length);
    return;
    if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex) _DOMContentsElement.style.zIndex -= 100.0;;

    objj_msgSend(_sublayers, "addObject:", aLayer);
    _DOMElement.appendChild(aLayer._DOMElement);
}
});
instance_methods[33] = new objj_method(sel_registerName("removeFromSuperlayer"), function(self, _cmd)
{ with(self)
{
    if (_owningView)
        objj_msgSend(_owningView, "setLayer:", nil);

    if (!_superlayer)
        return;

    _superlayer._DOMElement.removeChild(_DOMElement);
    objj_msgSend(_superlayer._sublayers, "removeObject:", self);

    _superlayer = nil;
}
});
instance_methods[34] = new objj_method(sel_registerName("insertSublayer:atIndex:"), function(self, _cmd, aLayer, anIndex)
{ with(self)
{
    if (!aLayer)
        return;

    var superlayer = objj_msgSend(aLayer, "superlayer");

    if (superlayer == self)
    {
        var index = objj_msgSend(_sublayers, "indexOfObjectIdenticalTo:", aLayer);

        if (index == anIndex)
            return;

        objj_msgSend(_sublayers, "removeObjectAtIndex:", index);

        if (index < anIndex)
            --anIndex;
    }
    else if (superlayer != nil)
        objj_msgSend(aLayer, "removeFromSuperlayer");

    if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex) _DOMContentsElement.style.zIndex -= 100.0;;

    objj_msgSend(_sublayers, "insertObject:atIndex:", aLayer, anIndex);

    if (anIndex >= _sublayers.length - 1)
        _DOMElement.appendChild(aLayer._DOMElement);
    else
        _DOMElement.insertBefore(aLayer._DOMElement, _sublayers[anIndex+1]._DOMElement);

    aLayer._superlayer = self;

    if (self != superlayer)
        _CALayerRecalculateGeometry(aLayer, 0xFFFFFFF);
}
});
instance_methods[35] = new objj_method(sel_registerName("insertSublayer:below:"), function(self, _cmd, aLayer, aSublayer)
{ with(self)
{
    var index = aSublayer ? objj_msgSend(_sublayers, "indexOfObjectIdenticalTo:", aSublayer) : 0;

    objj_msgSend(self, "insertSublayer:atIndex:", aLayer, index==CPNotFound?_sublayers.length:index);
}
});
instance_methods[36] = new objj_method(sel_registerName("insertSublayer:after:"), function(self, _cmd, aLayer, aSublayer)
{ with(self)
{
    var index = aSublayer ? objj_msgSend(_sublayers, "indexOfObjectIdenticalTo:", aSublayer) : _sublayers.length;

    objj_msgSend(_sublayers, "insertObject:atIndex:", aLayer, index==CPNotFound?_sublayers.length:index+1);
}
});
instance_methods[37] = new objj_method(sel_registerName("replaceSublayer:with:"), function(self, _cmd, aSublayer, aLayer)
{ with(self)
{
    if (aSublayer == aLayer)
        return;


    if (aSublayer._superlayer != self)
    {
        alert("EXCEPTION");
        return;
    }

    if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex) _DOMContentsElement.style.zIndex -= 100.0;;

    objj_msgSend(_sublayers, "replaceObjectAtIndex:withObject:", objj_msgSend(_sublayers, "indexOfObjectIdenticalTo:", aSublayer), aLayer);
    _DOMElement.replaceChild(aSublayer._DOMElement, aLayer._DOMElement);
}
});
class_methods[1] = new objj_method(sel_registerName("runLoopUpdateLayers"), function(self, _cmd)
{ with(self)
{if (window.oops) {alert(window.latest); objj_debug_print_backtrace();}
    window.loop = true;
    for (hash in CALayerRegisteredRunLoopUpdates)
    {
        var layer = CALayerRegisteredRunLoopUpdates[hash],
            mask = layer._runLoopUpdateMask;

        if (mask & CALayerDOMUpdateMask)
            _CALayerUpdateDOM(layer, mask);

        if (mask & CALayerDisplayUpdateMask)
            objj_msgSend(layer, "display");

        else if (mask & CALayerFrameSizeUpdateMask || mask & CALayerCompositeUpdateMask)
            objj_msgSend(layer, "composite");

        layer._runLoopUpdateMask = 0;
    }
    window.loop= false;
    CALayerRegisteredRunLoopUpdates = nil;
}
});
instance_methods[38] = new objj_method(sel_registerName("registerRunLoopUpdateWithMask:"), function(self, _cmd, anUpdateMask)
{ with(self)
{
    if (CALayerRegisteredRunLoopUpdates == nil)
    {
        CALayerRegisteredRunLoopUpdates = {};

        objj_msgSend(objj_msgSend(CPRunLoop, "currentRunLoop"), "performSelector:target:argument:order:modes:", sel_registerName("runLoopUpdateLayers"), CALayer, nil, 0, [CPDefaultRunLoopMode]);
    }

    _runLoopUpdateMask |= anUpdateMask;
    CALayerRegisteredRunLoopUpdates[objj_msgSend(self, "hash")] = self;
}
});
instance_methods[39] = new objj_method(sel_registerName("setNeedsComposite"), function(self, _cmd)
{ with(self)
{
    objj_msgSend(self, "registerRunLoopUpdateWithMask:", CALayerCompositeUpdateMask);
}
});
instance_methods[40] = new objj_method(sel_registerName("setNeedsDisplay"), function(self, _cmd)
{ with(self)
{
    objj_msgSend(self, "registerRunLoopUpdateWithMask:", CALayerDisplayUpdateMask);
}
});
instance_methods[41] = new objj_method(sel_registerName("setNeedsDisplayOnBoundsChange:"), function(self, _cmd, needsDisplayOnBoundsChange)
{ with(self)
{
    _needsDisplayOnBoundsChange = needsDisplayOnBoundsChange;
}
});
instance_methods[42] = new objj_method(sel_registerName("needsDisplayOnBoundsChange"), function(self, _cmd)
{ with(self)
{
    return _needsDisplayOnBoundsChange;
}
});
instance_methods[43] = new objj_method(sel_registerName("setNeedsDisplayInRect:"), function(self, _cmd, aRect)
{ with(self)
{
    _dirtyRect = aRect;
    objj_msgSend(self, "display");
}
});
instance_methods[44] = new objj_method(sel_registerName("convertPoint:fromLayer:"), function(self, _cmd, aPoint, aLayer)
{ with(self)
{
    return CGPointApplyAffineTransform(aPoint, _CALayerGetTransform(aLayer, self));
}
});
instance_methods[45] = new objj_method(sel_registerName("convertPoint:toLayer:"), function(self, _cmd, aPoint, aLayer)
{ with(self)
{
    return CGPointApplyAffineTransform(aPoint, _CALayerGetTransform(self, aLayer));
}
});
instance_methods[46] = new objj_method(sel_registerName("convertRect:fromLayer:"), function(self, _cmd, aRect, aLayer)
{ with(self)
{
    return CGRectApplyAffineTransform(aRect, _CALayerGetTransform(aLayer, self));
}
});
instance_methods[47] = new objj_method(sel_registerName("convertRect:toLayer:"), function(self, _cmd, aRect, aLayer)
{ with(self)
{
    return CGRectApplyAffineTransform(aRect, _CALayerGetTransform(self, aLayer));
}
});
instance_methods[48] = new objj_method(sel_registerName("containsPoint:"), function(self, _cmd, aPoint)
{ with(self)
{
    return (aPoint.x >= (_bounds.origin.x) && aPoint.y >= (_bounds.origin.y) && aPoint.x < (_bounds.origin.x + _bounds.size.width) && aPoint.y < (_bounds.origin.y + _bounds.size.height));
}
});
instance_methods[49] = new objj_method(sel_registerName("hitTest:"), function(self, _cmd, aPoint)
{ with(self)
{
    if (_isHidden)
        return nil;

    var point = CGPointApplyAffineTransform(aPoint, _transformToLayer);


    if (!(point.x >= (_bounds.origin.x) && point.y >= (_bounds.origin.y) && point.x < (_bounds.origin.x + _bounds.size.width) && point.y < (_bounds.origin.y + _bounds.size.height)))
        return nil;

    var layer = nil,
        index = _sublayers.length;


    while (index--)
        if (layer = objj_msgSend(_sublayers[index], "hitTest:", point))
            return layer;

    return self;
}
});
instance_methods[50] = new objj_method(sel_registerName("setDelegate:"), function(self, _cmd, aDelegate)
{ with(self)
{
    if (_delegate == aDelegate)
        return;

    _delegate = aDelegate;

    _delegateRespondsToDisplayLayerSelector = objj_msgSend(_delegate, "respondsToSelector:", sel_registerName("displayLayer:"));
    _delegateRespondsToDrawLayerInContextSelector = objj_msgSend(_delegate, "respondsToSelector:", sel_registerName("drawLayer:inContext:"));

    if (_delegateRespondsToDisplayLayerSelector || _delegateRespondsToDrawLayerInContextSelector)
        objj_msgSend(self, "setNeedsDisplay");
}
});
instance_methods[51] = new objj_method(sel_registerName("delegate"), function(self, _cmd)
{ with(self)
{
    return _delegate;
}
});
instance_methods[52] = new objj_method(sel_registerName("_setOwningView:"), function(self, _cmd, anOwningView)
{ with(self)
{
    _owningView = anOwningView;

    if (_owningView)
    {
        _owningView = anOwningView;

        _bounds.size = CGSizeMakeCopy(objj_msgSend(_owningView, "bounds").size);
        _position = CGPointMake((_bounds.size.width) * _anchorPoint.x, (_bounds.size.height) * _anchorPoint.y);
    }

    _CALayerRecalculateGeometry(self, CALayerGeometryPositionMask | CALayerGeometryBoundsMask);
}
});
instance_methods[53] = new objj_method(sel_registerName("_owningViewBoundsChanged"), function(self, _cmd)
{ with(self)
{
    _bounds.size = CGSizeMakeCopy(objj_msgSend(_owningView, "bounds").size);
    _position = CGPointMake((_bounds.size.width) * _anchorPoint.x, (_bounds.size.height) * _anchorPoint.y);

    _CALayerRecalculateGeometry(self, CALayerGeometryPositionMask | CALayerGeometryBoundsMask);
}
});
instance_methods[54] = new objj_method(sel_registerName("_update"), function(self, _cmd)
{ with(self)
{
    window.loop = true;

    var mask = _runLoopUpdateMask;

    if (mask & CALayerDOMUpdateMask)
        _CALayerUpdateDOM(self, mask);

    if (mask & CALayerDisplayUpdateMask)
        objj_msgSend(self, "display");

    else if (mask & CALayerFrameSizeUpdateMask || mask & CALayerCompositeUpdateMask)
        objj_msgSend(self, "composite");

    _runLoopUpdateMask = 0;

    window.loop = false;
}
});
class_addMethods(the_class, instance_methods);
class_addMethods(meta_class, class_methods);
}

_CALayerUpdateSublayerTransformForSublayers= function(aLayer)
{
    var bounds = aLayer._bounds,
        anchorPoint = aLayer._anchorPoint,
        translateX = (bounds.size.width) * anchorPoint.x,
        translateY = (bounds.size.height) * anchorPoint.y;

    aLayer._sublayerTransformForSublayers = CGAffineTransformConcat(
        CGAffineTransformMakeTranslation(-translateX, -translateY),
        CGAffineTransformConcat(aLayer._sublayerTransform,
        CGAffineTransformMakeTranslation(translateX, translateY)));
}

_CALayerUpdateDOM= function(aLayer, aMask)
{
    var DOMElementStyle = aLayer._DOMElement.style;

    if (aMask & CALayerZPositionUpdateMask)
        DOMElementStyle.zIndex = aLayer._zPosition;

    var frame = aLayer._backingStoreFrame;

    if (aMask & CALayerFrameOriginUpdateMask)
    {
        DOMElementStyle.top = ROUND((frame.origin.y)) + "px";
        DOMElementStyle.left = ROUND((frame.origin.x)) + "px";
    }

    if (aMask & CALayerFrameSizeUpdateMask)
    {
        var width = MAX(0.0, ROUND((frame.size.width))),
            height = MAX(0.0, ROUND((frame.size.height))),
            DOMContentsElement = aLayer._DOMContentsElement;

        DOMElementStyle.width = width + "px";
        DOMElementStyle.height = height + "px";

        if (DOMContentsElement)
        {
            DOMContentsElement.width = width;
            DOMContentsElement.height = height;
            DOMContentsElement.style.width = width + "px";
            DOMContentsElement.style.height = height + "px";
        }
    }
}

_CALayerRecalculateGeometry= function(aLayer, aGeometryChange)
{
    var bounds = aLayer._bounds,
        superlayer = aLayer._superlayer,
        width = (bounds.size.width),
        height = (bounds.size.height),
        position = aLayer._position,
        anchorPoint = aLayer._anchorPoint,
        affineTransform = aLayer._affineTransform,
        backingStoreFrameSize = { width:aLayer._backingStoreFrame.width, height:aLayer._backingStoreFrame.height },
        hasCustomBackingStoreFrame = aLayer._hasCustomBackingStoreFrame;


    aLayer._transformFromLayer = CGAffineTransformConcat(
        CGAffineTransformMakeTranslation(-width * anchorPoint.x - (aLayer._bounds.origin.x), -height * anchorPoint.y - (aLayer._bounds.origin.y)),
        CGAffineTransformConcat(affineTransform,
        CGAffineTransformMakeTranslation(position.x, position.y)));

    if (superlayer && superlayer._hasSublayerTransform)
    {

        var tx = aLayer._transformFromLayer.tx * superlayer._sublayerTransformForSublayers.a + aLayer._transformFromLayer.ty * superlayer._sublayerTransformForSublayers.c + superlayer._sublayerTransformForSublayers.tx;aLayer._transformFromLayer.ty = aLayer._transformFromLayer.tx * superlayer._sublayerTransformForSublayers.b + aLayer._transformFromLayer.ty * superlayer._sublayerTransformForSublayers.d + superlayer._sublayerTransformForSublayers.ty;aLayer._transformFromLayer.tx = tx;var a = aLayer._transformFromLayer.a * superlayer._sublayerTransformForSublayers.a + aLayer._transformFromLayer.b * superlayer._sublayerTransformForSublayers.c, b = aLayer._transformFromLayer.a * superlayer._sublayerTransformForSublayers.b + aLayer._transformFromLayer.b * superlayer._sublayerTransformForSublayers.d, c = aLayer._transformFromLayer.c * superlayer._sublayerTransformForSublayers.a + aLayer._transformFromLayer.d * superlayer._sublayerTransformForSublayers.c;aLayer._transformFromLayer.d = aLayer._transformFromLayer.c * superlayer._sublayerTransformForSublayers.b + aLayer._transformFromLayer.d * superlayer._sublayerTransformForSublayers.d;aLayer._transformFromLayer.a = a;aLayer._transformFromLayer.b = b;aLayer._transformFromLayer.c = c;;
    }

    aLayer._transformToLayer = CGAffineTransformInvert(aLayer._transformFromLayer);




    aLayer._frame = nil;
    aLayer._standardBackingStoreFrame = objj_msgSend(aLayer, "convertRect:toLayer:", bounds, nil);

    if (superlayer)
    {
        var bounds = objj_msgSend(superlayer, "bounds"),
            frame = objj_msgSend(superlayer, "convertRect:toLayer:", bounds, nil);

        aLayer._standardBackingStoreFrame.origin.x -= (frame.origin.x);
        aLayer._standardBackingStoreFrame.origin.y -= (frame.origin.y);
    }

    aLayer._standardBackingStoreFrame = CGRectIntegral(aLayer._standardBackingStoreFrame);


    if (!hasCustomBackingStoreFrame)
    {
        var backingStoreFrame = CGRectMakeCopy(aLayer._standardBackingStoreFrame);



        if (ROUND((backingStoreFrame.origin.x)) != ROUND((aLayer._backingStoreFrame.origin.x)) ||
            ROUND((backingStoreFrame.origin.y)) != ROUND((aLayer._backingStoreFrame.origin.y)))
            objj_msgSend(aLayer, "registerRunLoopUpdateWithMask:", CALayerFrameOriginUpdateMask);


        if (aGeometryChange != CALayerGeometryPositionMask &&
            (ROUND((backingStoreFrame.size.width)) != ROUND((aLayer._backingStoreFrame.size.width)) ||
            ROUND((backingStoreFrame.size.height)) != ROUND((aLayer._backingStoreFrame.size.height))))
            objj_msgSend(aLayer, "registerRunLoopUpdateWithMask:", CALayerFrameSizeUpdateMask);

        aLayer._backingStoreFrame = backingStoreFrame;
    }

    if (aGeometryChange & CALayerGeometryBoundsMask && aLayer._needsDisplayOnBoundsChange)
        objj_msgSend(aLayer, "setNeedsDisplay");




    else if (hasCustomBackingStoreFrame || (aGeometryChange & ~(CALayerGeometryPositionMask | CALayerGeometryAnchorPointMask)))
        objj_msgSend(aLayer, "setNeedsComposite");

    var sublayers = aLayer._sublayers,
        index = 0,
        count = sublayers.length;

    for (; index < count; ++index)
        _CALayerRecalculateGeometry(sublayers[index], aGeometryChange);
}

_CALayerGetTransform= function(fromLayer, toLayer)
{
    var transform = CGAffineTransformMakeIdentity();

    if (fromLayer)
    {
        var layer = fromLayer;



        while (layer && layer != toLayer)
        {
            var transformFromLayer = layer._transformFromLayer;


            var tx = transform.tx * transformFromLayer.a + transform.ty * transformFromLayer.c + transformFromLayer.tx;transform.ty = transform.tx * transformFromLayer.b + transform.ty * transformFromLayer.d + transformFromLayer.ty;transform.tx = tx;var a = transform.a * transformFromLayer.a + transform.b * transformFromLayer.c, b = transform.a * transformFromLayer.b + transform.b * transformFromLayer.d, c = transform.c * transformFromLayer.a + transform.d * transformFromLayer.c;transform.d = transform.c * transformFromLayer.b + transform.d * transformFromLayer.d;transform.a = a;transform.b = b;transform.c = c;;

            layer = layer._superlayer;
        }


        if (layer == toLayer)
            return transform;
    }

    var layers = [],
        layer = toLayer;

    while (layer)
    {
        layers.push(layer);
        layer = layer._superlayer;
    }

    var index = layers.length;

    while (index--)
    {
        var transformToLayer = layers[index]._transformToLayer;

        var tx = transform.tx * transformToLayer.a + transform.ty * transformToLayer.c + transformToLayer.tx;transform.ty = transform.tx * transformToLayer.b + transform.ty * transformToLayer.d + transformToLayer.ty;transform.tx = tx;var a = transform.a * transformToLayer.a + transform.b * transformToLayer.c, b = transform.a * transformToLayer.b + transform.b * transformToLayer.d, c = transform.c * transformToLayer.a + transform.d * transformToLayer.c;transform.d = transform.c * transformToLayer.b + transform.d * transformToLayer.d;transform.a = a;transform.b = b;transform.c = c;;
    }

    return transform;
}

p;23;CAMediaTimingFunction.jI;21;Foundation/CPObject.jI;25;Foundation/CPDictionary.jI;21;Foundation/CPString.jc;3077;


kCAMediaTimingFunctionLinear = "kCAMediaTimingFunctionLinear";
kCAMediaTimingFunctionEaseIn = "kCAMediaTimingFunctionEaseIn";
kCAMediaTimingFunctionEaseOut = "kCAMediaTimingFunctionEaseOut";
kCAMediaTimingFunctionEaseInEaseOut = "kCAMediaTimingFunctionEaseInEaseOut";

var CAMediaNamedTimingFunctions = nil;

{var the_class = objj_allocateClassPair(CPObject, "CAMediaTimingFunction"),
meta_class = _class_getMeta(the_class);the_class.ivars.splice(the_class.ivars.length, 0, new objj_ivar("_c1x"), new objj_ivar("_c1y"), new objj_ivar("_c2x"), new objj_ivar("_c2y"));
objj_registerClassPair(the_class);
objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
var class_methods = [];
class_methods[0] = new objj_method(sel_registerName("functionWithName:"), function(self, _cmd, aName)
{ with(self)
{
    if (!CAMediaNamedTimingFunctions)
    {
        CAMediaNamedTimingFunctions = objj_msgSend(CPDictionary, "dictionary");

        objj_msgSend(CAMediaNamedTimingFunctions, "setObject:forKey:", objj_msgSend(CAMediaTimingFunction, "functionWithControlPoints::::", 0.0, 0.0, 1.0, 1.0), kCAMediaTimingFunctionLinear);
        objj_msgSend(CAMediaNamedTimingFunctions, "setObject:forKey:", objj_msgSend(CAMediaTimingFunction, "functionWithControlPoints::::", 0.42, 0.0, 1.0, 1.0), kCAMediaTimingFunctionEaseIn);
        objj_msgSend(CAMediaNamedTimingFunctions, "setObject:forKey:", objj_msgSend(CAMediaTimingFunction, "functionWithControlPoints::::", 0.0, 0.0, 0.58, 1.0), kCAMediaTimingFunctionEaseOut);
        objj_msgSend(CAMediaNamedTimingFunctions, "setObject:forKey:", objj_msgSend(CAMediaTimingFunction, "functionWithControlPoints::::", 0.42, 0.0, 0.58, 1.0), kCAMediaTimingFunctionEaseInEaseOut);
    }

    return objj_msgSend(CAMediaNamedTimingFunctions, "objectForKey:", aName);
}
});
class_methods[1] = new objj_method(sel_registerName("functionWithControlPoints::::"), function(self, _cmd, c1x, c1y, c2x, c2y)
{ with(self)
{
    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithControlPoints::::", c1x, c1y, c2x, c2y);
}
});
var instance_methods = [];
instance_methods[0] = new objj_method(sel_registerName("initWithControlPoints::::"), function(self, _cmd, c1x, c1y, c2x, c2y)
{ with(self)
{
    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");

    if (self)
    {
        _c1x = c1x;
        _c1y = c1y;
        _c2x = c2x;
        _c2y = c2y;
    }

    return self;
}
});
instance_methods[1] = new objj_method(sel_registerName("getControlPointAtIndex:values:"), function(self, _cmd, anIndex, reference)
{ with(self)
{
    if (anIndex == 0)
    {
        reference[0] = 0;
        reference[1] = 0;
    }
    else if (anIndex == 1)
    {
        reference[0] = _c1x;
        reference[1] = _c1y;
    }
    else if (anIndex == 2)
    {
        reference[0] = _c2x;
        reference[1] = _c2y;
    }
    else
    {
        reference[0] = 1.0;
        reference[0] = 1.0;
    }
}
});
class_addMethods(the_class, instance_methods);
class_addMethods(meta_class, class_methods);
}

p;19;CGAffineTransform.ji;12;CGGeometry.jc;4830;
CGAffineTransformMake= function(a, b, c, d, tx, ty) { return { a:a, b:b, c:c, d:d, tx:tx, ty:ty }; }
CGAffineTransformMakeIdentity= function() { return { a:1.0, b:0.0, c:0.0, d:1.0, tx:0.0, ty:0.0 }; }
CGAffineTransformMakeCopy= function(anAffineTransform) { return { a:anAffineTransform.a, b:anAffineTransform.b, c:anAffineTransform.c, d:anAffineTransform.d, tx:anAffineTransform.tx, ty:anAffineTransform.ty }; }
CGAffineTransformMakeScale= function(sx, sy) { return { a:sx, b:0.0, c:0.0, d:sy, tx:0.0, ty:0.0 }; }
CGAffineTransformMakeTranslation= function(tx, ty) { return { a:1.0, b:0.0, c:0.0, d:1.0, tx:tx, ty:ty }; }
CGAffineTransformTranslate= function(aTransform, tx, ty) { return { a:aTransform.a, b:aTransform.b, c:aTransform.c, d:aTransform.d, tx:aTransform.tx + aTransform.a * tx + aTransform.c * ty, ty:aTransform.ty + aTransform.b * tx + aTransform.d * ty }; }
CGAffineTransformScale= function(aTransform, sx, sy) { return { a:aTransform.a * sx, b:aTransform.b * sx, c:aTransform.c * sy, d:aTransform.d * sy, tx:aTransform.tx, ty:aTransform.ty }; }
CGAffineTransformConcat= function(lhs, rhs) { return { a:lhs.a * rhs.a + lhs.b * rhs.c, b:lhs.a * rhs.b + lhs.b * rhs.d, c:lhs.c * rhs.a + lhs.d * rhs.c, d:lhs.c * rhs.b + lhs.d * rhs.d, tx:lhs.tx * rhs.a + lhs.ty * rhs.c + rhs.tx, ty:lhs.tx * rhs.b + lhs.ty * rhs.d + rhs.ty }; }
CGPointApplyAffineTransform= function(aPoint, aTransform) { return { x:aPoint.x * aTransform.a + aPoint.y * aTransform.c + aTransform.tx, y:aPoint.x * aTransform.b + aPoint.y * aTransform.d + aTransform.ty }; }
CGSizeApplyAffineTransform= function(aSize, aTransform) { return { width:aSize.width * aTransform.a + aSize.height * aTransform.c, height:aSize.width * aTransform.b + aSize.height * aTransform.d }; }
CGAffineTransformIsIdentity= function(aTransform) { return (aTransform.a == 1 && aTransform.b == 0 && aTransform.c == 0 && aTransform.d == 1 && aTransform.tx == 0 && aTransform.ty == 0); }
CGAffineTransformEqualToTransform= function(lhs, rhs) { return (lhs.a == rhs.a && lhs.b == rhs.b && lhs.c == rhs.c && lhs.d == rhs.d && lhs.tx == rhs.tx && lhs.ty == rhs.ty); }
CGStringCreateWithCGAffineTransform= function(aTransform) { return (" [[ " + aTransform.a + ", " + aTransform.b + ", 0 ], [ " + aTransform.c + ", " + aTransform.d + ", 0 ], [ " + aTransform.tx + ", " + aTransform.ty + ", 1]]"); }
CGAffineTransformCreateCopy= function(aTransform)
{
    return { a:aTransform.a, b:aTransform.b, c:aTransform.c, d:aTransform.d, tx:aTransform.tx, ty:aTransform.ty };
}
CGAffineTransformMakeRotation= function(anAngle)
{
    var sin = SIN(anAngle),
        cos = COS(anAngle);
    return { a:cos, b:sin, c:-sin, d:cos, tx:0.0, ty:0.0 };
}
CGAffineTransformRotate= function(aTransform, anAngle)
{
    var sin = SIN(anAngle),
        cos = COS(anAngle);
    return {
            a:aTransform.a * cos + aTransform.c * sin,
            b:aTransform.b * cos + aTransform.d * sin,
            c:aTransform.c * cos - aTransform.a * sin,
            d:aTransform.d * cos - aTransform.b * sin,
            tx:aTransform.tx,
            ty:aTransform.ty
        };
}
CGAffineTransformInvert= function(aTransform)
{
    var determinant = 1 / (aTransform.a * aTransform.d - aTransform.b * aTransform.c);
    return {
        a:determinant * aTransform.d,
        b:-determinant * aTransform.b,
        c:-determinant * aTransform.c,
        d:determinant * aTransform.a,
        tx:determinant * (aTransform.c * aTransform.ty - aTransform.d * aTransform.tx),
        ty:determinant * (aTransform.b * aTransform.tx - aTransform.a * aTransform.ty)
    };
}
CGRectApplyAffineTransform= function(aRect, anAffineTransform)
{
    var top = (aRect.origin.y),
        left = (aRect.origin.x),
        right = (aRect.origin.x + aRect.size.width),
        bottom = (aRect.origin.y + aRect.size.height),
        topLeft = CGPointApplyAffineTransform({ x:left, y:top }, anAffineTransform),
        topRight = CGPointApplyAffineTransform({ x:right, y:top }, anAffineTransform),
        bottomLeft = CGPointApplyAffineTransform({ x:left, y:bottom }, anAffineTransform),
        bottomRight = CGPointApplyAffineTransform({ x:right, y:bottom }, anAffineTransform),
        minX = MIN(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x),
        maxX = MAX(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x),
        minY = MIN(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y),
        maxY = MAX(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y);
    return { origin: { x:minX, y:minY }, size: { width:(maxX - minX), height:(maxY - minY) } };
}
CPStringFromCGAffineTransform= function(anAffineTransform)
{
    return '{' + anAffineTransform.a + ", " + anAffineTransform.b + ", " + anAffineTransform.c + ", " + anAffineTransform.d + ", " + anAffineTransform.tx + ", " + anAffineTransform.ty + '}';
}

p;9;CGColor.ji;14;CGColorSpace.jc;3055;


var CFTypeGlobalCount = 0;

CFHashCode= function(aCFObject)
{
    if (!aCFObject.hash)
        aCFObject.hash = ++CFTypeGlobalCount;

    return aCFObject;
}

kCGColorWhite = "kCGColorWhite";
kCGColorBlack = "kCGColorBlack";
kCGColorClear = "kCGColorClear";

var _CGColorMap = { };

CGColorGetConstantColor= function(aColorName)
{
    alert("FIX ME");
}

CGColorRetain= function(aColor)
{
    return aColor;
}

CGColorRelease= function()
{
}

CGColorCreate= function(aColorSpace, components)
{
    if (!aColorSpace || !components)
        return NULL;

    var components = components.slice();

    CGColorSpaceStandardizeComponents(aColorSpace, components);

    var UID = CFHashCode(aColorSpace) + components.join("");

    if (_CGColorMap[UID])
        return _CGColorMap[UID];

    return _CGColorMap[UID] = { colorspace:aColorSpace, pattern:NULL, components:components };
}

CGColorCreateCopy= function(aColor)
{

    return aColor;
}

CGColorCreateGenericGray= function(gray, alpha)
{
    return CGColorCreate(0, [gray,alpha]);
}

CGColorCreateGenericRGB= function(red, green, blue, alpha)
{
    return CGColorCreate(0, [red,green,blue,alpha]);
}

CGColorCreateGenericCMYK= function(cyan, magenta, yellow, black, alpha)
{
    return CGColorCreate(0, [cyan,magenta,yellow,black,alpha]);
}

CGColorCreateCopyWithAlpha= function(aColor, anAlpha)
{
    var components = aColor.components;

    if (!aColor || anAlpha == components[components.length-1])
     return aColor;

    if (aColor.pattern)
        var copy = CGColorCreateWithPattern(aColor.colorspace, aColor.pattern, components);
    else
        var copy = CGColorCreate(aColor.colorspace, components);

    copy.components[components.length-1] = anAlpha;

    return copy;
}

CGColorCreateWithPattern= function(aColorSpace, aPattern, components)
{
    if (!aColorSpace || !aPattern || !components)
        return NULL;

    return { colorspace:aColorSpace, pattern:aPattern, components:components.slice() };
}

CGColorEqualToColor= function(lhs, rhs)
{
    if (lhs == rhs)
        return true;

    if (!lhs || !rhs)
        return false;

    var lhsComponents = lhs.components,
        rhsComponents = rhs.components,
        lhsComponentCount = lhsComponents.length;

    if (lhsComponentCount != rhsComponents.length)
        return false;

    while (lhsComponentCount--)
        if (lhsComponents[lhsComponentCount] != rhsComponents[lhsComponentCount])
            return false;

    if (lhs.pattern != rhs.pattern)
        return false;

    if (CGColorSpaceEqualToColorSpace(lhs.colorspace, rhs.colorspace))
        return false;

    return true;
}

CGColorGetAlpha= function(aColor)
{
    var components = aColor.components;

    return components[components.length-1];
}

CGColorGetColorSpace= function(aColor)
{
    return aColor.colorspace;
}

CGColorGetComponents= function(aColor)
{
    return aColor.components;
}

CGColorGetNumberOfComponents= function(aColor)
{
    return aColor.components.length;
}

CGColorGetPattern= function(aColor)
{
    return aColor.pattern;
}

p;14;CGColorSpace.jc;4713;



kCGColorSpaceModelUnknown = -1;
kCGColorSpaceModelMonochrome = 0;
kCGColorSpaceModelRGB = 1;
kCGColorSpaceModelCMYK = 2;
kCGColorSpaceModelLab = 3;
kCGColorSpaceModelDeviceN = 4;
kCGColorSpaceModelIndexed = 5;
kCGColorSpaceModelPattern = 6;

kCGColorSpaceGenericGray = "CGColorSpaceGenericGray";
kCGColorSpaceGenericRGB = "CGColorSpaceGenericRGB";
kCGColorSpaceGenericCMYK = "CGColorSpaceGenericCMYK";
kCGColorSpaceGenericRGBLinear = "CGColorSpaceGenericRGBLinear";
kCGColorSpaceGenericRGBHDR = "CGColorSpaceGenericRGBHDR";
kCGColorSpaceAdobeRGB1998 = "CGColorSpaceAdobeRGB1998";
kCGColorSpaceSRGB = "CGColorSpaceSRGB";

var _CGNamedColorSpaces = {};




CGColorSpaceCreateCalibratedGray= function(aWhitePoint, aBlackPoint, gamma)
{
    return { model:kCGColorSpaceModelMonochrome, count:1, base:NULL };
}

CGColorSpaceCreateCalibratedRGB= function(aWhitePoint, aBlackPoint, gamma)
{
    return { model:kCGColorSpaceModelRGB, count:1, base:NULL };
}

CGColorSpaceCreateICCBased= function(aComponentCount, range, profile, alternate)
{

    return NULL;
}

CGColorSpaceCreateLab= function(aWhitePoint, aBlackPoint, aRange)
{

    return NULL;
}

CGColorSpaceCreateDeviceCMYK= function()
{
    return CGColorSpaceCreateWithName(kCGColorSpaceGenericCMYK);
}

CGColorSpaceCreateDeviceGray= function()
{
    return CGColorSpaceCreateWithName(kCGColorSpaceGenericGray);
}

CGColorSpaceCreateDeviceRGB= function()
{
    return CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
}

CGColorSpaceCreateWithPlatformColorSpace= function()
{

    return NULL;
}

CGColorSpaceCreateIndexed= function(aBaseColorSpace, lastIndex, colorTable)
{

    return NULL;
}

CGColorSpaceCreatePattern= function(aBaseColorSpace)
{
    if (aBaseColorSpace)
        return { model:kCGColorSpaceModelPattern, count:aBaseColorSpace.count, base:aBaseColorSpace };

    return { model:kCGColorSpaceModelPattern, count:0, base:NULL };
}

CGColorSpaceCreateWithName= function(aName)
{
    var colorSpace = _CGNamedColorSpaces[aName];

    if (colorSpace)
        return colorSpace;

    switch (aName)
    {
        case kCGColorSpaceGenericGray: return _CGNamedColorSpaces[aName] = { model:kCGColorSpaceModelMonochrome, count:1, base:NULL };
        case kCGColorSpaceGenericRGB: return _CGNamedColorSpaces[aName] = { model:kCGColorSpaceModelRGB, count:3, base:NULL };
        case kCGColorSpaceGenericCMYK: return _CGNamedColorSpaces[aName] = { model:kCGColorSpaceModelCMYK, count:4, base:NULL };
        case kCGColorSpaceGenericRGBLinear: return _CGNamedColorSpaces[aName] = { model:kCGColorSpaceModelRGB, count:3, base:NULL };
        case kCGColorSpaceGenericRGBHDR: return _CGNamedColorSpaces[aName] = { model:kCGColorSpaceModelRGB, count:3, base:NULL };
        case kCGColorSpaceAdobeRGB1998: return _CGNamedColorSpaces[aName] = { model:kCGColorSpaceModelRGB, count:3, base:NULL };
        case kCGColorSpaceSRGB: return _CGNamedColorSpaces[aName] = { model:kCGColorSpaceModelRGB, count:3, base:NULL };
    }

    return NULL;
}



CGColorSpaceCopyICCProfile= function(aColorSpace)
{
    return NULL;
}

CGColorSpaceGetNumberOfComponents= function(aColorSpace)
{
    return aColorSpace.count;
}

CGColorSpaceGetTypeID= function(aColorSpace)
{
}

CGColorSpaceGetModel= function(aColorSpace)
{
    return aColorSpace.model;
}

CGColorSpaceGetBaseColorSpace= function(aColorSpace)
{
}

CGColorSpaceGetColorTableCount= function(aColorSpace)
{
}

CGColorSpaceGetColorTable= function(aColorSpace)
{
}



CGColorSpaceRelease= function(aColorSpace)
{
}

CGColorSpaceRetain= function(aColorSpace)
{
    return aColorSpace;
}
CGColorSpaceStandardizeComponents= function(aColorSpace, components)
{
    var count = aColorSpace.count;
    { if (count > components.length) { components[count] = 1; return; } var component = components[count]; if (component < 0) components[count] = 0; else if (component > 1) components[count] = 1; else components[count] = ROUND(component * 1000) / 1000; };
    if (aColorSpace.base)
        aColorSpace = aColorSpace.base;
    switch (aColorSpace.model)
    {
        case kCGColorSpaceModelMonochrome:
        case kCGColorSpaceModelRGB:
        case kCGColorSpaceModelCMYK:
        case kCGColorSpaceModelDeviceN: while (count--)
                                                { if (count > components.length) { components[count] = 1; return; } var component = components[count]; if (component < 0) components[count] = 0; else if (component > 1) components[count] = 1; else components[count] = ROUND(component * 255) / 255; };
                                            break;
        case kCGColorSpaceModelIndexed:
        case kCGColorSpaceModelLab:
        case kCGColorSpaceModelPattern: break;
    }
}

p;11;CGContext.ji;12;CGGeometry.ji;19;CGAffineTransform.ji;8;CGPath.jc;30758;

kCGLineCapButt = 0;
kCGLineCapRound = 1;
kCGLineCapSquare = 2;

kCGLineJoinMiter = 0;
kCGLineJoinRound = 1;
kCGLineJoinBevel = 2;

kCGPathFill = 0;
kCGPathEOFill = 1;
kCGPathStroke = 2;
kCGPathFillStroke = 3;
kCGPathEOFillStroke = 4;

kCGBlendModeNormal = 0;
kCGBlendModeMultiply = 1;
kCGBlendModeScreen = 2;
kCGBlendModeOverlay = 3;
kCGBlendModeDarken = 4;
kCGBlendModeLighten = 5;
kCGBlendModeColorDodge = 6;
kCGBlendModeColorBurn = 7;
kCGBlendModeSoftLight = 8;
kCGBlendModeHardLight = 9;
kCGBlendModeDifference = 10;
kCGBlendModeExclusion = 11;
kCGBlendModeHue = 12;
kCGBlendModeSaturation = 13;
kCGBlendModeColor = 14;
kCGBlendModeLuminosity = 15;
kCGBlendModeClear = 16;
kCGBlendModeCopy = 17;
kCGBlendModeSourceIn = 18;
kCGBlendModeSourceOut = 19;
kCGBlendModeSourceAtop = 20;
kCGBlendModeDestinationOver = 21;
kCGBlendModeDestinationIn = 22;
kCGBlendModeDestinationOut = 23;
kCGBlendModeDestinationAtop = 24;
kCGBlendModeXOR = 25;
kCGBlendModePlusDarker = 26;
kCGBlendModePlusLighter = 27;

CGContextRelease= function()
{
}

CGContextRetain= function(aContext)
{
    return aContext;
}

if (!CPFeatureIsCompatible(CPHTMLCanvasFeature))
{

CGGStateCreate= function()
{
    return { strokeStyle:"#000", fillStyle:"#ccc", lineWidth:1.0, lineJoin:kCGLineJoinMiter, lineCap:kCGLineCapButt, miterLimit:10.0, globalAlpha:1.0,
        blendMode:kCGBlendModeNormal,
        shadowOffset:{ width:0.0, height:0.0 }, shadowBlur:0.0, shadowColor:NULL, CTM:{ a:1.0, b:0.0, c:0.0, d:1.0, tx:0.0, ty:0.0 } };
}

CGGStateCreateCopy= function(aGState)
{
    return { strokeStyle:aGState.strokeStyle, fillStyle:aGState.fillStyle, lineWidth:aGState.lineWidth,
        lineJoin:aGState.lineJoin, lineCap:aGState.lineCap, miterLimit:aGState.miterLimit, globalAlpha:aGState.globalAlpha,
        blendMode:aGState.blendMode,
        shadowOffset:aGState.shadowOffset, shadowBlur:aGState.shadowBlur, shadowColor:aGState.shadowColor, CTM:{ a:aGState.CTM.a, b:aGState.CTM.b, c:aGState.CTM.c, d:aGState.CTM.d, tx:aGState.CTM.tx, ty:aGState.CTM.ty } };
}

CGBitmapGraphicsContextCreate= function()
{
    return { DOMElement:document.createElement("div"), path:NULL, gState:CGGStateCreate(), gStateStack:[] };
}

CGContextSaveGState= function(aContext)
{
    aContext.gStateStack.push(CGGStateCreateCopy(aContext.gState));
}

CGContextRestoreGState= function(aContext)
{
    aContext.gState = aContext.gStateStack.pop();
}

CGContextSetLineCap= function(aContext, aLineCap)
{
    aContext.gState.lineCap = aLineCap;
}

CGContextSetLineJoin= function(aContext, aLineJoin)
{
    aContext.gState.lineJoin = aLineJoin;
}

CGContextSetLineWidth= function(aContext, aLineWidth)
{
    aContext.gState.lineWidth = aLineWidth;
}

CGContextSetMiterLimit= function(aContext, aMiterLimit)
{
    aContext.gState.miterLimit = aMiterLimit;
}

CGContextSetBlendMode= function(aContext, aBlendMode)
{
    aContext.gState.blendMode = aBlendMode;
}

CGContextAddArc= function(aContext, x, y, radius, startAngle, endAngle, clockwise)
{
    CGPathAddArc(aContext.path, aContext.gState.CTM, x, y, radius, startAngle, endAngle, clockwise);
}

CGContextAddArcToPoint= function(aContext, x1, y1, x2, y2, radius)
{
    CGPathAddArcToPoint(aContext.path, aContext.gState.CTM, x1, y1, x2, y2, radius);
}

CGContextAddCurveToPoint= function(aContext, cp1x, cp1y, cp2x, cp2y, x, y)
{
    CGPathAddCurveToPoint(aContext.path, cp1x, cp1y, cp2x, cp2y, x, y);
}

CGContextAddLines= function(aContext, points, count)
{
    CGPathAddLines(aContext.path, aContext.gState.CTM, points, count);
}

CGContextAddLineToPoint= function(aContext, x, y)
{
    CGPathAddLineToPoint(aContext.path, aContext.gState.CTM, x, y);
}

CGContextAddPath= function(aContext, aPath)
{
    if (!aContext || CGPathIsEmpty(aPath))
        return;

    if (!aContext.path)
        aContext.path = CGPathCreateMutable();

    CGPathAddPath(aContext.path, aContext.gState.CTM, aPath);
}

CGContextAddQuadCurveToPoint= function(aContext, cpx, cpy, x, y)
{
    CGPathAddQuadCurveToPoint(aContext.path, aContext.gState.CTM, cpx, cpy, x, y);
}

CGContextAddRect= function(aContext, aRect)
{
    CGPathAddRect(aContext.path, aContext.gState.CTM, aRect);
}

CGContextAddRects= function(aContext, rects, count)
{
    CGPathAddRects(aContext.path, aContext.gState.CTM, rects, count);
}

CGContextBeginPath= function(aContext)
{

    aContext.path = CGPathCreateMutable();
}

CGContextClosePath= function(aContext)
{
    CGPathCloseSubpath(aContext.path);
}

CGContextMoveToPoint= function(aContext, x, y)
{
    if (!aContext.path)
        aContext.path = CGPathCreateMutable();

    CGPathMoveToPoint(aContext.path, aContext.gState.CTM, x, y);
}

CGContextFillRect= function(aContext, aRect)
{
    CGContextFillRects(aContext, [aRect], 1);
}

CGContextFillRects= function(aContext, rects, count)
{
    if (arguments["count"] == NULL)
        var count = rects.length;

    CGContextBeginPath(aContext);
    CGContextAddRects(aContext, rects, count);
    CGContextClosePath(aContext);

    CGContextDrawPath(aContext, kCGPathFill);
}

CGContextStrokeRect= function(aContext, aRect)
{
    CGContextBeginPath(aContext);
    CGContextAddRect(aContext, aRect);
    CGContextClosePath(aContext);

    CGContextDrawPath(aContext, kCGPathStroke);
}

CGContextStrokeRectWithWidth= function(aContext, aRect, aWidth)
{
    CGContextSaveGState(aContext);

    CGContextSetLineWidth(aContext, aWidth);
    CGContextStrokeRect(aContext, aRect);

    CGContextRestoreGState(aContext);
}

CGContextConcatCTM= function(aContext, aTransform)
{
    var CTM = aContext.gState.CTM;

    var tx = CTM.tx * aTransform.a + CTM.ty * aTransform.c + aTransform.tx;CTM.ty = CTM.tx * aTransform.b + CTM.ty * aTransform.d + aTransform.ty;CTM.tx = tx;var a = CTM.a * aTransform.a + CTM.b * aTransform.c, b = CTM.a * aTransform.b + CTM.b * aTransform.d, c = CTM.c * aTransform.a + CTM.d * aTransform.c;CTM.d = CTM.c * aTransform.b + CTM.d * aTransform.d;CTM.a = a;CTM.b = b;CTM.c = c;;
}

CGContextGetCTM= function(aContext)
{
    return aContext.gState.CTM;
}

CGContextRotateCTM= function(aContext, anAngle)
{
    var gState = aContext.gState;

    gState.CTM = CGAffineTransformRotate(gState.CTM, anAngle);
}

CGContextScaleCTM= function(aContext, sx, sy)
{
    var gState = aContext.gState;

    gState.CTM = { a:gState.CTM.a * sx, b:gState.CTM.b * sx, c:gState.CTM.c * sy, d:gState.CTM.d * sy, tx:gState.CTM.tx, ty:gState.CTM.ty };
}

CGContextTranslateCTM= function(aContext, tx, ty)
{
    var gState = aContext.gState;

    gState.CTM = { a:gState.CTM.a, b:gState.CTM.b, c:gState.CTM.c, d:gState.CTM.d, tx:gState.CTM.tx + gState.CTM.a * tx + gState.CTM.c * ty, ty:gState.CTM.ty + gState.CTM.b * tx + gState.CTM.d * ty };
}

CGContextSetShadow= function(aContext, aSize, aBlur)
{
    var gState = aContext.gState;

    gState.shadowOffset = { width:aSize.width, height:aSize.height };
    gState.shadowBlur = aBlur;
    gState.shadowColor = objj_msgSend(CPColor, "shadowColor");
}

CGContextSetShadowWithColor= function(aContext, aSize, aBlur, aColor)
{
    var gState = aContext.gState;

    gState.shadowOffset = { width:aSize.width, height:aSize.height };
    gState.shadowBlur = aBlur;
    gState.shadowColor = aColor;
}

}



CGContextEOFillPath= function(aContext, aMode)
{
    CGContextDrawPath(aContext, kCGPathEOFill);
}

CGContextFillPath= function(aContext)
{
    CGContextDrawPath(aContext, kCGPathFill);
}

var KAPPA = 4.0 * ((SQRT2 - 1.0) / 3.0);

CGContextAddEllipseInRect= function(aContext, aRect)
{
 CGContextBeginPath(aContext);

 if ((aRect.size.width) == (aRect.size.height))
     CGContextAddArc(aContext, (aRect.origin.x + (aRect.size.width) / 2.0), (aRect.origin.y + (aRect.size.height) / 2.0), (aRect.size.width) / 2.0, 0.0, 2 * PI, YES);
 else
 {
     var axis = { width:(aRect.size.width) / 2.0, height:(aRect.size.height) / 2.0 },
         center = { x:(aRect.origin.x) + axis.width, y:(aRect.origin.y) + axis.height };

     CGContextMoveToPoint(aContext, center.x, center.y - axis.height);

     CGContextAddCurveToPoint(aContext, center.x + (KAPPA * axis.width), center.y - axis.height, center.x + axis.width, center.y - (KAPPA * axis.height), center.x + axis.width, center.y);
     CGContextAddCurveToPoint(aContext, center.x + axis.width, center.y + (KAPPA * axis.height), center.x + (KAPPA * axis.width), center.y + axis.height, center.x, center.y + axis.height);
     CGContextAddCurveToPoint(aContext, center.x - (KAPPA * axis.width), center.y + axis.height, center.x - axis.width, center.y + (KAPPA * axis.height), center.x - axis.width, center.y);
     CGContextAddCurveToPoint(aContext, center.x - axis.width, center.y - (KAPPA * axis.height), center.x - (KAPPA * axis.width), center.y - axis.height, center.x, center.y - axis.height);
 }

 CGContextClosePath(aContext);
}


CGContextFillEllipseInRect= function(aContext, aRect)
{
    CGContextAddEllipseInRect(aContext, aRect);
    CGContextFillPath(aContext);
}

CGContextStrokeEllipseInRect= function(aContext, aRect)
{
    CGContextAddEllipseInRect(aContext, aRect);
    CGContextStrokePath(aContext);
}

CGContextStrokePath= function(aContext)
{
    CGContextDrawPath(aContext, kCGPathStroke);
}

CGContextStrokeLineSegments= function(aContext, points, count)
{
    var i = 0;

    if (arguments["count"] == NULL)
        var count = points.length;

    CGContextBeginPath(aContext);

    for (; i < count; i += 2)
    {
        CGContextMoveToPoint(aContext, points[i].x, points[i].y);
        CGContextAddLineToPoint(aContext, points[i+1].x, points[i+1].y);
    }

    CGContextStrokePath(aContext);
}



CGContextSetFillColor= function(aContext, aColor)
{
    if (aColor)
        aContext.gState.fillStyle = objj_msgSend(aColor, "cssString");
}

CGContextSetStrokeColor= function(aContext, aColor)
{
    if (aColor)
        aContext.gState.strokeStyle = objj_msgSend(aColor, "cssString");
}

CGContextFillRoundedRectangleInRect= function(aContext, aRect, aRadius, ne, se, sw, nw)
{
    var xMin = (aRect.origin.x),
        xMax = (aRect.origin.x + aRect.size.width),
        yMin = (aRect.origin.y),
        yMax = (aRect.origin.y + aRect.size.height);

    CGContextBeginPath(aContext);
    CGContextMoveToPoint(aContext, xMin + aRadius, yMin);

 if (ne)
 {
  CGContextAddLineToPoint(aContext, xMax - aRadius, yMin);
  CGContextAddCurveToPoint(aContext, xMax - aRadius, yMin, xMax, yMin, xMax, yMin + aRadius);
 }
 else
  CGContextAddLineToPoint(aContext, xMax, yMin);

 if (se)
 {
  CGContextAddLineToPoint(aContext, xMax, yMax - aRadius);
  CGContextAddCurveToPoint(aContext, xMax, yMax - aRadius, xMax, yMax, xMax - aRadius, yMax);
 }
 else
  CGContextAddLineToPoint(aContext, xMax, yMax);

 if (sw)
 {
  CGContextAddLineToPoint(aContext, xMin + aRadius, yMax);
  CGContextAddCurveToPoint(aContext, xMin + aRadius, yMax, xMin, yMax, xMin, yMax - aRadius);
 }
 else
  CGContextAddLineToPoint(aContext, xMin, yMax);

 if (nw)
 {
  CGContextAddLineToPoint(aContext, xMin, yMin + aRadius);
  CGContextAddCurveToPoint(aContext, xMin, yMin + aRadius, xMin, yMin, xMin + aRadius, yMin);
 } else
  CGContextAddLineToPoint(aContext, xMin, yMin);

 CGContextClosePath(aContext);

    CGContextFillPath(aContext);
}

if (CPFeatureIsCompatible(CPHTMLCanvasFeature))
{
var CANVAS_LINECAP_TABLE = ["butt","round","square"],
    CANVAS_LINEJOIN_TABLE = ["miter","round","bevel"],
    CANVAS_COMPOSITE_TABLE = ["source-over","source-over","source-over","source-over","darker","lighter","source-over","source-over","source-over","source-over","source-over","source-over","source-over","source-over","source-over","source-over","source-over","copy","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","xor","source-over","source-over"];
CGContextSaveGState= function(aContext)
{
    aContext.save();
}
CGContextRestoreGState= function(aContext)
{
    aContext.restore();
}
CGContextSetLineCap= function(aContext, aLineCap)
{
    aContext.lineCap = CANVAS_LINECAP_TABLE[aLineCap];
}
CGContextSetLineJoin= function(aContext, aLineJoin)
{
    aContext.lineJoin = CANVAS_LINEJOIN_TABLE[aLineJoin];
}
CGContextSetLineWidth= function(aContext, aLineWidth)
{
    aContext.lineWidth = aLineWidth;
}
CGContextSetMiterLimit= function(aContext, aMiterLimit)
{
    aContext.miterLimit = aMiterLimit;
}
CGContextSetBlendMode= function(aContext, aBlendMode)
{
    aContext.globalCompositeOperation = CANVAS_COMPOSITE_TABLE[aBlendMode];
}
CGContextAddArc= function(aContext, x, y, radius, startAngle, endAngle, clockwise)
{
    aContext.arc(x, y, radius, startAngle, endAngle, !clockwise);
}
CGContextAddArcToPoint= function(aContext, x1, y1, x2, y2, radius)
{
    aContext.arcTo(x1, y1, x2, y2, radius);
}
CGContextAddCurveToPoint= function(aContext, cp1x, cp1y, cp2x, cp2y, x, y)
{
    aContext.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
}
CGContextAddLineToPoint= function(aContext, x, y)
{
    aContext.lineTo(x, y);
}
CGContextAddPath= function(aContext, aPath)
{
    if (!aContext || CGPathIsEmpty(aPath))
        return;
    var elements = aPath.elements,
        i = 0,
        count = aPath.count;
    for (; i < count; ++i)
    {
        var element = elements[i],
            type = element.type;
        switch (type)
        {
            case kCGPathElementMoveToPoint: aContext.moveTo(element.x, element.y);
                                                    break;
            case kCGPathElementAddLineToPoint: _CGContextLineToPoint(aContext, element.x, element.y);
                                                    break;
            case kCGPathElementAddQuadCurveToPoint: _CGContextAddQuadCurveToPoint(aContext, element.cpx, element.cpy, element.x, element.y);
                                                    break;
            case kCGPathElementAddCurveToPoint: aContext.bezierCurveTo(element.cp1x, element.cp1y, element.cp2x, element.cp2y, element.x, element.y);
                                                    break;
            case kCGPathElementCloseSubpath: aContext.closePath();
                                                    break;
            case kCGPathElementAddArc: aContext.arc(element.x, element.y, element.radius, element.startAngle, element.endAngle, element.clockwise);
                                                    break;
            case kCGPathElementAddArcTo:
                                                    break;
        }
    }
}
CGContextAddRect= function(aContext, aRect)
{
    aContext.rect((aRect.origin.x), (aRect.origin.y), (aRect.size.width), (aRect.size.height));
}
CGContextAddRects= function(aContext, rects, count)
{
    var i = 0;
    if (arguments["count"] == NULL)
        var count = rects.length;
    for (; i < count; ++i)
    {
        var rect = rects[i];
        aContext.rect((rect.origin.x), (rect.origin.y), (rect.size.width), (rect.size.height));
    }
}
CGContextBeginPath= function(aContext)
{
    aContext.beginPath();
}
CGContextClosePath= function(aContext)
{
    aContext.closePath();
}
CGContextMoveToPoint= function(aContext, x, y)
{
    aContext.moveTo(x, y);
}
CGContextClearRect= function(aContext, aRect)
{
    aContext.clearRect((aRect.origin.x), (aRect.origin.y), (aRect.size.width), (aRect.size.height));
}
CGContextDrawPath= function(aContext, aMode)
{
    if (aMode == kCGPathFill || aMode == kCGPathFillStroke)
        aContext.fill();
    else if (aMode == kCGPathEOFill || aMode == kCGPathEOFillStroke)
        alert("not implemented!!!");
    if (aMode == kCGPathStroke || aMode == kCGPathFillStroke || aMode == kCGPathEOFillStroke)
        aContext.stroke();
}
CGContextFillRect= function(aContext, aRect)
{
    aContext.fillRect((aRect.origin.x), (aRect.origin.y), (aRect.size.width), (aRect.size.height));
}
CGContextFillRects= function(aContext, rects, count)
{
    var i = 0;
    if (arguments["count"] == NULL)
        var count = rects.length;
    for (; i < count; ++i)
    {
        var rect = rects[i];
        aContext.fillRect((rect.origin.x), (rect.origin.y), (rect.size.width), (rect.size.height));
    }
}
CGContextStrokeRect= function(aContext, aRect)
{
    aContext.strokeRect((aRect.origin.x), (aRect.origin.y), (aRect.size.width), (aRect.size.height));
}
CGContextClip= function(aContext)
{
    aContext.clip();
}
CGContextClipToRect= function(aContext, aRect)
{
    aContext.beginPath();
    aContext.rect((aRect.origin.x), (aRect.origin.y), (aRect.size.width), (aRect.size.height));
    aContext.closePath();
    aContext.clip();
}
CGContextClipToRects= function(aContext, rects, count)
{
    if (arguments["count"] == NULL)
        var count = rects.length;
    aContext.beginPath();
    CGContextAddRects(aContext, rects, count);
    aContext.clip();
}
CGContextSetAlpha= function(aContext, anAlpha)
{
    aContext.globalAlpha = anAlpha;
}
CGContextSetFillColor= function(aContext, aColor)
{
    aContext.fillStyle = objj_msgSend(aColor, "cssString");
}
CGContextSetStrokeColor= function(aContext, aColor)
{
    aContext.strokeStyle = objj_msgSend(aColor, "cssString");
}
CGContextSetShadow= function(aContext, aSize, aBlur)
{
    aContext.shadowOffsetX = aSize.width;
    aContext.shadowOffsetY = aSize.height;
    aContext.shadowBlur = aBlur;
}
CGContextSetShadowWithColor= function(aContext, aSize, aBlur, aColor)
{
    aContext.shadowOffsetX = aSize.width;
    aContext.shadowOffsetY = aSize.height;
    aContext.shadowBlur = aBlur;
    aContext.shadowColor = objj_msgSend(aColor, "cssString");
}
CGContextRotateCTM= function(aContext, anAngle)
{
    aContext.rotate(anAngle);
}
CGContextScaleCTM= function(aContext, sx, sy)
{
    aContext.scale(sx, sy);
}
CGContextTranslateCTM= function(aContext, tx, ty)
{
    aContext.translate(tx, ty);
}
eigen= function(anAffineTransform)
{
    alert("IMPLEMENT ME!");
}
CGContextConcatCTM= function(aContext, anAffineTransform)
{
    var a = anAffineTransform.a,
        b = anAffineTransform.b,
        c = anAffineTransform.c,
        d = anAffineTransform.d,
        tx = anAffineTransform.tx,
        ty = anAffineTransform.ty,
        sx = 1.0,
        sy = 1.0,
        a1 = 0.0,
        a2 = 0.0;
    if (b == 0.0 && c == 0.0)
    {
        sx = a;
        sy = d;
    }
    else if (a * b == -c * d)
    {
        var sign = (a * d < 0.0 || b * c > 0.0) ? -1.0 : 1.0, a2 = (ATAN2(b, d) + ATAN2(-sign * c, sign * a)) / 2.0, cos = COS(a2), sin = SIN(a2); if (cos == 0) { sx = -c / sin; sy = b / sin; } else if (sin == 0) { sx = a / cos; sy = d / cos; } else { abs_cos = ABS(cos); abs_sin = ABS(sin); sx = (abs_cos * a / cos + abs_sin * -c / sin) / (abs_cos + abs_sin); sy = (abs_cos * d / cos + abs_sin * b / sin) / (abs_cos + abs_sin); }
    }
    else if (a * c == -b * d)
    {
        var sign = (a * d < 0.0 || b * c > 0.0) ? -1.0 : 1.0; a1 = (Math.atan2(sign * b, sign * a) + Math.atan2(-c, d)) / 2.0, cos = COS(a1), sin = SIN(a1); if (cos == 0) { sx = b / sin; sy = -c / sin; } else if (sin == 0) { sx = a / cos; sy = d / cos; } else { abs_cos = ABS(cos); abs_sin = ABS(sin); sx = (abs_cos * a / cos + abs_sin * b / sin) / (abs_cos + abs_sin); sy = (abs_cos * d / cos + abs_sin * -c / sin) / (abs_cos + abs_sin); }
    }
    else
    {
        var transpose = CGAffineTransformMake(a, c, b, d, 0.0, 0.0),
            u = eigen(CGAffineTransformConcat(anAffineTransform, transpose)),
            v = eigen(CGAffineTransformConcat(transpose, anAffineTransform)),
            U = CGAffineTransformMake(u.vector_1.x, u.vector_2.x, u.vector_1.y, u.vector_2.y, 0.0, 0.0),
            VT = CGAffineTransformMake(v.vector_1.x, v.vector_1.y, v.vector_2.x, v.vector_2.y, 0.0, 0.0),
            S = CGAffineTransformConcat(CGAffineTransformConcat(CGAffineTransformInvert(U), anAffineTransform), CGAffineTransformInvert(VT));
        a = VT.a;
        b = VT.b;
        c = VT.c;
        d = VT.d;
        var sign = (a * d < 0.0 || b * c > 0.0) ? -1.0 : 1.0, a2 = (ATAN2(b, d) + ATAN2(-sign * c, sign * a)) / 2.0, cos = COS(a2), sin = SIN(a2); if (cos == 0) { sx = -c / sin; sy = b / sin; } else if (sin == 0) { sx = a / cos; sy = d / cos; } else { abs_cos = ABS(cos); abs_sin = ABS(sin); sx = (abs_cos * a / cos + abs_sin * -c / sin) / (abs_cos + abs_sin); sy = (abs_cos * d / cos + abs_sin * b / sin) / (abs_cos + abs_sin); }
        S.a *= sx;
        S.d *= sy;
        a = U.a;
        b = U.b;
        c = U.c;
        d = U.d;
        var sign = (a * d < 0.0 || b * c > 0.0) ? -1.0 : 1.0; a1 = (Math.atan2(sign * b, sign * a) + Math.atan2(-c, d)) / 2.0, cos = COS(a1), sin = SIN(a1); if (cos == 0) { sx = b / sin; sy = -c / sin; } else if (sin == 0) { sx = a / cos; sy = d / cos; } else { abs_cos = ABS(cos); abs_sin = ABS(sin); sx = (abs_cos * a / cos + abs_sin * b / sin) / (abs_cos + abs_sin); sy = (abs_cos * d / cos + abs_sin * -c / sin) / (abs_cos + abs_sin); }
        sx = S.a * sx;
        sy = S.d * sy;
    }
    if (tx != 0 || ty != 0)
        CGContextTranslateCTM(aContext, tx, ty);
    if (a1 != 0.0)
        CGContextRotateCTM(aContext, a1);
    if (sx != 1.0 || sy != 1.0)
        CGContextScaleCTM(aContext, sx, sy);
    if (a2 != 0.0)
        CGContextRotateCTM(aContext, a2);
}
CGContextDrawImage= function(aContext, aRect, anImage)
{
    aContext.drawImage(anImage._image, (aRect.origin.x), (aRect.origin.y), (aRect.size.width), (aRect.size.height));
}
to_string= function(aColor)
{
    return "rgba(" + ROUND(aColor.components[0] * 255) + ", " + ROUND(aColor.components[1] * 255) + ", " + ROUND(255 * aColor.components[2]) + ", " + aColor.components[3] + ")";
}
CGContextDrawLinearGradient= function(aContext, aGradient, aStartPoint, anEndPoint, options)
{
    var colors = aGradient.colors,
        count = colors.length,
        linearGradient = aContext.createLinearGradient(aStartPoint.x, aStartPoint.y, anEndPoint.x, anEndPoint.y);
    while (count--)
        linearGradient.addColorStop(aGradient.locations[count], to_string(colors[count]));
    aContext.fillStyle = linearGradient;
    aContext.fill();
}
CGBitmapGraphicsContextCreate= function()
{
    var DOMElement = document.createElement("canvas"),
        context = DOMElement.getContext("2d");
    context.DOMElement = DOMElement;
    return context;
}
}
else if (CPFeatureIsCompatible(CPVMLFeature))
{
var VML_TRUTH_TABLE = ["f","t"],
    VML_LINECAP_TABLE = ["flat","round","square"],
    VML_LINEJOIN_TABLE = ["miter","round","bevel"],
    VML_ELEMENT_TABLE = [" m "," l ","qb"," c "," x ",[" at "," wa "]];
var _CGBitmapGraphicsContextCreate = CGBitmapGraphicsContextCreate;
CGBitmapGraphicsContextCreate= function()
{
    document.namespaces.add("cg_vml_", "urn:schemas-microsoft-com:vml");
    document.createStyleSheet().cssText = "cg_vml_\\:*{behavior:url(#default#VML)}";
    CGBitmapGraphicsContextCreate = _CGBitmapGraphicsContextCreate;
    return _CGBitmapGraphicsContextCreate();
}
CGContextClearRect= function(aContext, aRect)
{
    if (aContext.buffer != nil)
        aContext.buffer = "";
    else
        aContext.DOMElement.innerHTML = "";
    aContext.path = NULL;
}
var W = 10.0,
    H = 10.0,
    Z = 10.0,
    Z_2 = Z / 2.0;
CGContextDrawImage= function(aContext, aRect, anImage)
{
    var string = "";
    if (anImage.buffer != nil)
        string = anImage.buffer;
    else
    {
        var ctm = aContext.gState.CTM,
            origin = CGPointApplyAffineTransform(aRect.origin, ctm),
            similarity = ctm.a == ctm.d && ctm.b == -ctm.c,
            vml = ["<cg_vml_:group coordsize=\"1,1\" coordorigin=\"0,0\" style=\"width:1;height:1;position:absolute"];
        {
            var transformedRect = CGRectApplyAffineTransform(aRect, ctm);
            vml.push( ";padding:0 ", ROUND((transformedRect.origin.x + transformedRect.size.width)), "px ", ROUND((transformedRect.origin.y + transformedRect.size.height)),
                        "px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",
                        "M11='", ctm.a, "',M12='", ctm.c, "',M21='", ctm.b, "',M22='", ctm.d, "',",
                        "Dx='", ROUND(origin.x), "', Dy='", ROUND(origin.y), "', sizingmethod='clip');");
        }
        vml.push( "\"><cg_vml_:image src=\"", anImage._image.src,
                    "\" style=\"width:", (aRect.size.width), "px;height:", (aRect.size.height),
                    "px;\"/></g_vml_:group>");
        string = vml.join("");
    }
    if (aContext.buffer != nil)
        aContext.buffer += string;
    else
        aContext.DOMElement.insertAdjacentHTML("BeforeEnd", string);
}
CGContextDrawPath= function(aContext, aMode)
{
    if (!aContext || CGPathIsEmpty(aContext.path))
        return;
var opacity = 1.0;
    var elements = aContext.path.elements,
        i = 0,
        count = aContext.path.count,
        gState = aContext.gState,
        fill = (aMode == kCGPathFill || aMode == kCGPathFillStroke) ? 1 : 0,
        stroke = (aMode == kCGPathStroke || aMode == kCGPathFillStroke) ? 1 : 0,
        vml = ["<cg_vml_:shape"," fillcolor=\"",gState.fillStyle,"\" filled=\"",VML_TRUTH_TABLE[fill],"\" style=\"position:absolute;width:",W,";height:",H,";\" coordorigin=\"0 0\" coordsize=\"",Z*W," ",Z*H,"\" stroked=\"",VML_TRUTH_TABLE[stroke],"\" strokeweight=\"",gState.lineWidth,"\" strokecolor=\"",gState.strokeStyle,"\" path=\""];
    for (; i < count; ++i)
    {
        var element = elements[i],
            type = element.type;
        switch(type)
        {
            case kCGPathElementMoveToPoint:
            case kCGPathElementAddLineToPoint: vml.push(VML_ELEMENT_TABLE[type], (ROUND(Z * (element.x) - Z_2)), ',', (ROUND(Z * (element.y) - Z_2)));
                                                    break;
            case kCGPathElementAddQuadCurveToPoint: vml.push(VML_ELEMENT_TABLE[type],
                                                        (ROUND(Z * (element.cpx) - Z_2)), ',', (ROUND(Z * (element.cpy) - Z_2)), ',',
                                                        (ROUND(Z * (element.x) - Z_2)), ',', (ROUND(Z * (element.y) - Z_2)));
                                                    break;
            case kCGPathElementAddCurveToPoint: vml.push(VML_ELEMENT_TABLE[type],
                                                        (ROUND(Z * (element.cp1x) - Z_2)), ',', (ROUND(Z * (element.cp1y) - Z_2)), ',',
                                                        (ROUND(Z * (element.cp2x) - Z_2)), ',', (ROUND(Z * (element.cp2y) - Z_2)), ',',
                                                        (ROUND(Z * (element.x) - Z_2)), ',', (ROUND(Z * (element.y) - Z_2)));
                                                    break;
            case kCGPathElementCloseSubpath: vml.push(VML_ELEMENT_TABLE[type]);
                                                    break;
            case kCGPathElementAddArc: var x = element.x,
                                                        y = element.y,
                                                        radius = element.radius,
                                                        clockwise = element.clockwise ? 1 : 0,
                                                        endAngle = element.endAngle,
                                                        startAngle = element.startAngle,
                                                        start = { x:x + radius * COS(startAngle), y:y + radius * SIN(startAngle) };
                                                    if (startAngle == endAngle && !clockwise)
                                                    {
                                                        vml.push(VML_ELEMENT_TABLE[kCGPathElementMoveToPoint], (ROUND(Z * (start.x) - Z_2)), ',', (ROUND(Z * (start.y) - Z_2)));
                                                        continue;
                                                    }
                                                    var end = { x:x + radius * COS(endAngle), y:y + radius * SIN(endAngle) };
                                                    if (clockwise && startAngle != endAngle && (start.x == end.x && start.y == end.y))
                                                        if (start.x >= x)
                                                        {
                                                            if (start.y < y)
                                                                start.x += 0.125;
                                                            else
                                                                start.y += 0.125;
                                                        }
                                                        else
                                                        {
                                                            if (end.y <= y)
                                                                end.x += 0.125;
                                                            else
                                                                end.y += 0.125;
                                                        }
                                                    vml.push(VML_ELEMENT_TABLE[type][clockwise],
                                                        (ROUND(Z * (x - radius) - Z_2)), ',', (ROUND(Z * (y - radius) - Z_2)), " ",
                                                        (ROUND(Z * (x + radius) - Z_2)), ',', (ROUND(Z * (y + radius) - Z_2)), " ",
                                                        (ROUND(Z * (start.x) - Z_2)), ',', (ROUND(Z * (start.y) - Z_2)), " ",
                                                        (ROUND(Z * (end.x) - Z_2)), ',', (ROUND(Z * (end.y) - Z_2)));
                                                    break;
            case kCGPathElementAddArcTo: break;
        }
    }
    vml.push("\">");
    if (fill)
        vml.push("<cg_vml_:fill color=\"", gState.fillStyle, "\" opacity=\"", opacity, "\" />");
    if (stroke)
        vml.push( "<cg_vml_:stroke opacity=\"", opacity,
                    "\" joinstyle=\"", VML_LINEJOIN_TABLE[gState.lineJoin],
                    "\" miterlimit=\"", gState.miterLimit,
                    "\" endcap=\"", VML_LINECAP_TABLE[gState.lineCap],
                    "\" weight=\"", gState.lineWidth, "",
                    "px\" color=\"", gState.strokeStyle,"\" />");
    var shadowColor = gState.shadowColor;
    if (shadowColor)
    {
        var shadowOffset = gState.shadowOffset;
        vml.push("<cg_vml_:shadow on=\"t\" offset=\"",
            shadowOffset.width, "pt ", shadowOffset.height, "pt\" opacity=\"", objj_msgSend(shadowColor, "alphaComponent"), "\" color=black />");
    }
    vml.push("</cg_vml_:shape>");
    aContext.path = NULL;
    if (aContext.buffer != nil)
        aContext.buffer += vml.join("");
    else
        aContext.DOMElement.insertAdjacentHTML("BeforeEnd", vml.join(""));
}
}

p;12;CGGeometry.jc;6535;





CGPointMake= function(x, y) { return { x:x, y:y }; }
CGPointMakeZero= function() { return { x:0.0, y:0.0 }; }
CGPointMakeCopy= function(aPoint) { return { x:aPoint.x, y:aPoint.y }; }
CGPointCreateCopy= function(aPoint) { return { x:aPoint.x, y:aPoint.y }; }

CGPointEqualToPoint= function(lhsPoint, rhsPoint) { return (lhsPoint.x == rhsPoint.x && lhsPoint.y == rhsPoint.y); }
CGStringFromPoint= function(aPoint) { return ("{" + aPoint.x + ", " + aPoint.y + "}"); }

CGSizeMake= function(width, height) { return { width:width, height:height }; }
CGSizeMakeZero= function() { return { width:0.0, height:0.0 }; }
CGSizeMakeCopy= function(aSize) { return { width:aSize.width, height:aSize.height }; }
CGSizeCreateCopy= function(aSize) { return { width:aSize.width, height:aSize.height }; }

CGSizeEqualToSize= function(lhsSize, rhsSize) { return (lhsSize.width == rhsSize.width && lhsSize.height == rhsSize.height); }
CGStringFromSize= function(aSize) { return ("{" + aSize.width + ", " + aSize.height + "}"); }

CGRectMake= function(x, y, width, height) { return { origin: { x:x, y:y }, size: { width:width, height:height } }; }
CGRectMakeZero= function() { return { origin: { x:0.0, y:0.0 }, size: { width:0.0, height:0.0 } }; }
CGRectMakeCopy= function(aRect) { return { origin: { x:aRect.origin.x, y:aRect.origin.y }, size: { width:aRect.size.width, height:aRect.size.height } }; }
CGRectCreateCopy= function(aRect) { return { origin: { x:aRect.origin.x, y:aRect.origin.y }, size: { width:aRect.size.width, height:aRect.size.height } }; }

CGRectEqualToRect= function(lhsRect, rhsRect) { return ((lhsRect.origin.x == rhsRect.origin.x && lhsRect.origin.y == rhsRect.origin.y) && (lhsRect.size.width == rhsRect.size.width && lhsRect.size.height == rhsRect.size.height)); }
CGStringFromRect= function(aRect) { return ("{" + ("{" + aRect.origin.x + ", " + aRect.origin.y + "}") + ", " + ("{" + aRect.size.width + ", " + aRect.size.height + "}") + "}"); }

CGRectOffset= function(aRect, dX, dY) { return { origin: { x:aRect.origin.x + dX, y:aRect.origin.y + dY }, size: { width:aRect.size.width, height:aRect.size.height } }; }
CGRectInset= function(aRect, dX, dY) { return { origin: { x:aRect.origin.x + dX, y:aRect.origin.y + dY }, size: { width:aRect.size.width - 2 * dX, height:aRect.size.height - 2 * dY } }; }

CGRectGetHeight= function(aRect) { return (aRect.size.height); }
CGRectGetMaxX= function(aRect) { return (aRect.origin.x + aRect.size.width); }
CGRectGetMaxY= function(aRect) { return (aRect.origin.y + aRect.size.height); }
CGRectGetMidX= function(aRect) { return (aRect.origin.x + (aRect.size.width) / 2.0); }
CGRectGetMidY= function(aRect) { return (aRect.origin.y + (aRect.size.height) / 2.0); }
CGRectGetMinX= function(aRect) { return (aRect.origin.x); }
CGRectGetMinY= function(aRect) { return (aRect.origin.y); }
CGRectGetWidth= function(aRect) { return (aRect.size.width); }

CGRectIsEmpty= function(aRect) { return (aRect.size.width <= 0.0 || aRect.size.height <= 0.0); }
CGRectIsNull= function(aRect) { return (aRect.size.width <= 0.0 || aRect.size.height <= 0.0); }

CGRectContainsPoint= function(aRect, aPoint) { return (aPoint.x >= (aRect.origin.x) && aPoint.y >= (aRect.origin.y) && aPoint.x < (aRect.origin.x + aRect.size.width) && aPoint.y < (aRect.origin.y + aRect.size.height)); }

CGRectContainsRect= function(lhsRect, rhsRect)
{
    var union = CGRectUnion(lhsRect, rhsRect);

    return ((union.origin.x == lhsRect.origin.x && union.origin.y == lhsRect.origin.y) && (union.size.width == lhsRect.size.width && union.size.height == lhsRect.size.height));
}

CGRectIntersectsRect= function(lhsRect, rhsRect)
{
    var intersection = CGRectIntersection(lhsRect, rhsRect);

    return !(intersection.size.width <= 0.0 || intersection.size.height <= 0.0);
}

CGRectIntegral= function(aRect)
{
    aRect = CGRectStandardize(aRect);


    var x = FLOOR((aRect.origin.x)),
        y = FLOOR((aRect.origin.y));

    aRect.size.width = CEIL((aRect.origin.x + aRect.size.width)) - x;
    aRect.size.height = CEIL((aRect.origin.y + aRect.size.height)) - y;

    aRect.origin.x = x;
    aRect.origin.y = y;

    return aRect;
}

CGRectIntersection= function(lhsRect, rhsRect)
{
    var intersection = { origin: { x:MAX((lhsRect.origin.x), (rhsRect.origin.x)), y:MAX((lhsRect.origin.y), (rhsRect.origin.y)) }, size: { width:0, height:0 } };




    intersection.size.width = MIN((lhsRect.origin.x + lhsRect.size.width), (rhsRect.origin.x + rhsRect.size.width)) - (intersection.origin.x);
    intersection.size.height = MIN((lhsRect.origin.y + lhsRect.size.height), (rhsRect.origin.y + rhsRect.size.height)) - (intersection.origin.y);

    return (intersection.size.width <= 0.0 || intersection.size.height <= 0.0) ? { origin: { x:0.0, y:0.0 }, size: { width:0.0, height:0.0 } } : intersection;
}

CGRectStandardize= function(aRect)
{
    var width = (aRect.size.width),
        height = (aRect.size.height),
        standardized = { origin: { x:aRect.origin.x, y:aRect.origin.y }, size: { width:aRect.size.width, height:aRect.size.height } };

    if (width < 0.0)
    {
        standardized.origin.x += width;
        standardized.size.width = -width;
    }

    if (height < 0.0)
    {
        standardized.origin.y += height;
        standardized.size.height = -height;
    }

    return standardized;
}

CGRectUnion= function(lhsRect, rhsRect)
{
    var minX = MIN((lhsRect.origin.x), (rhsRect.origin.x)),
        minY = MIN((lhsRect.origin.y), (rhsRect.origin.y)),
        maxX = MAX((lhsRect.origin.x + lhsRect.size.width), (rhsRect.origin.x + rhsRect.size.width)),
        maxY = MAX((lhsRect.origin.y + lhsRect.size.height), (rhsRect.origin.y + rhsRect.size.height));

    return { origin: { x:minX, y:minY }, size: { width:maxX - minX, height:maxY - minY } };
}

CGPointFromString= function(aString)
{
    var comma = aString.indexOf(',');

    return { x:parseInt(aString.substr(1, comma - 1)), y:parseInt(aString.substring(comma + 1, aString.length)) };
}

CGSizeFromString= function(aString)
{
    var comma = aString.indexOf(',');

    return { width:parseInt(aString.substr(1, comma - 1)), height:parseInt(aString.substring(comma + 1, aString.length)) };
}

CGRectFromString= function(aString)
{
    var comma = aString.indexOf(',', aString.indexOf(',') + 1);

    return { origin:CGPointFromString(aString.substr(1, comma - 1)), size:CGSizeFromString(aString.substring(comma + 2, aString.length)) };
}

CGPointFromEvent= function(anEvent)
{
    return { x:anEvent.clientX, y:anEvent.clientY };
}

p;12;CGGradient.ji;9;CGColor.ji;14;CGColorSpace.jc;758;

kCGGradientDrawsBeforeStartLocation = 1 << 0;
kCGGradientDrawsAfterEndLocation = 1 << 1;

CGGradientCreateWithColorComponents= function(aColorSpace, components, locations, count)
{
    if (arguments["count"] == NULL)
        var count = locations.length;

    var colors = [];

    while (count--)
    {
        var offset = count * 4;
        colors[count] = CGColorCreate(aColorSpace, components.slice(offset, offset + 4));
    }

    return CGGradientCreateWithColors(aColorSpace, colors, locations);
}

CGGradientCreateWithColors= function(aColorSpace, colors, locations)
{
    return { colorspace:aColorSpace, colors:colors, locations:locations };
}

CGGradientRelease= function()
{
}

CGGradientRetain= function(aGradient)
{
    return aGradient;
}

p;8;CGPath.ji;12;CGGeometry.ji;19;CGAffineTransform.jc;8149;

kCGPathElementMoveToPoint = 0;
kCGPathElementAddLineToPoint = 1;
kCGPathElementAddQuadCurveToPoint = 2;
kCGPathElementAddCurveToPoint = 3;
kCGPathElementCloseSubpath = 4;

kCGPathElementAddArc = 5;
kCGPathElementAddArcToPoint = 6;

CGPathCreateMutable= function()
{
    return { count:0, start:NULL, current:NULL, elements:[] };
}

CGPathCreateMutableCopy= function(aPath)
{
    var path = CGPathCreateMutable();

    CGPathAddPath(path, aPath);

    return path;
}

CGPathCreateCopy= function(aPath)
{
    return CGPathCreateMutableCopy(aPath);
}

CGPathRelease= function(aPath)
{
}

CGPathRetain= function(aPath)
{
    return aPath;
}

CGPathAddArc= function(aPath, aTransform, x, y, aRadius, aStartAngle, anEndAngle, isClockwise)
{
    if (aTransform && !(aTransform.a == 1 && aTransform.b == 0 && aTransform.c == 0 && aTransform.d == 1 && aTransform.tx == 0 && aTransform.ty == 0))
    {
        var center = { x:x, y:y },
            end = { x:COS(anEndAngle), y:SIN(anEndAngle) },
            start = { x:COS(aStartAngle), y:SIN(aStartAngle) };

        end = { x:end.x * aTransform.a + end.y * aTransform.c + aTransform.tx, y:end.x * aTransform.b + end.y * aTransform.d + aTransform.ty };
        start = { x:start.x * aTransform.a + start.y * aTransform.c + aTransform.tx, y:start.x * aTransform.b + start.y * aTransform.d + aTransform.ty };
        center = { x:center.x * aTransform.a + center.y * aTransform.c + aTransform.tx, y:center.x * aTransform.b + center.y * aTransform.d + aTransform.ty };

        x = center.x;
        y = center.y;

        var oldEndAngle = anEndAngle,
            oldStartAngle = aStartAngle;

        anEndAngle = ATAN2(end.y - aTransform.ty, end.x - aTransform.tx);
        aStartAngle = ATAN2(start.y - aTransform.ty, start.x - aTransform.tx);




        if (anEndAngle == aStartAngle && oldEndAngle != oldStartAngle)
            if (oldStartAngle > oldEndAngle)
                anEndAngle = anEndAngle - PI2;
            else
                aStartAngle = aStartAngle - PI2;

        aRadius = { width:aRadius, height:0 };
        aRadius = { width:aRadius.width * aTransform.a + aRadius.height * aTransform.c, height:aRadius.width * aTransform.b + aRadius.height * aTransform.d };
        aRadius = SQRT(aRadius.width * aRadius.width + aRadius.height * aRadius.height);
    }

    aPath.current = { x:x + aRadius * COS(anEndAngle), y:y + aRadius * SIN(anEndAngle) };
    aPath.elements[aPath.count++] = { type:kCGPathElementAddArc, x:x, y:y, radius:aRadius, startAngle:aStartAngle, endAngle:anEndAngle };
}

CGPathAddArcToPoint= function(aPath, aTransform, x1, y1, x2, y2, aRadius)
{

}

CGPathAddCurveToPoint= function(aPath, aTransform, cp1x, cp1y, cp2x, cp2y, x, y)
{
    var cp1 = { x:cp1x, y:cp1y },
        cp2 = { x:cp2x, y:cp2y },
        end = { x:x, y:y };

    if (aTransform)
    {
        cp1 = { x:cp1.x * aTransform.a + cp1.y * aTransform.c + aTransform.tx, y:cp1.x * aTransform.b + cp1.y * aTransform.d + aTransform.ty };
        cp2 = { x:cp2.x * aTransform.a + cp2.y * aTransform.c + aTransform.tx, y:cp2.x * aTransform.b + cp2.y * aTransform.d + aTransform.ty };
        end = { x:end.x * aTransform.a + end.y * aTransform.c + aTransform.tx, y:end.x * aTransform.b + end.y * aTransform.d + aTransform.ty };
    }

   aPath.current = end;
   aPath.elements[aPath.count++] = { type:kCGPathElementAddCurveToPoint, cp1x:cp1.x, cp1y:cp1.y, cp2x:cp2.x, cp2y:cp2.y, x:end.x, y:end.y };
}

CGPathAddLines= function(aPath, aTransform, points, count)
{
    var i = 1;

    if (arguments["count"] == NULL)
        var count = points.length;

    if (!aPath || count < 2)
        return;

    CGPathMoveToPoint(aPath, aTransform, points[0].x, points[0].y);

    for (; i < count; ++i)
        CGPathAddLineToPoint(aPath, aTransform, points[i].x, points[i].y);
}

CGPathAddLineToPoint= function(aPath, aTransform, x, y)
{
    var point = { x:x, y:y };

    if (aTransform != NULL)
        point = { x:point.x * aTransform.a + point.y * aTransform.c + aTransform.tx, y:point.x * aTransform.b + point.y * aTransform.d + aTransform.ty };

    aPath.elements[aPath.count++] = { type: kCGPathElementAddLineToPoint, x:point.x, y:point.y };
    aPath.current = point;
}

CGPathAddPath= function(aPath, aTransform, anotherPath)
{
    var i = 0,
        count = anotherPath.count;

    for (; i < count; ++i)
    {
        var element = anotherPath[i];

        aPath.elements[aPath.count++] = { type:element.type, points:element.point.slice() };

        if (element.type == kCGPathElementAddArc || element.type == kCGPathElementAddArcToPoint)
            aPath.elements[aPath.count-1].radius = element.radius;
    }

    aPath.current = anotherPath.current;
}

CGPathAddQuadCurveToPoint= function(aPath, aTransform, cpx, cpy, x, y)
{
    var cp = { x:cpx, y:cpy },
        end = { x:x, y:y };

    if (aTransform)
    {
        cp = { x:control.x * aTransform.a + control.y * aTransform.c + aTransform.tx, y:control.x * aTransform.b + control.y * aTransform.d + aTransform.ty };
        end = { x:end.x * aTransform.a + end.y * aTransform.c + aTransform.tx, y:end.x * aTransform.b + end.y * aTransform.d + aTransform.ty };
    }

    aPath.elements[aPath.count++] = { type:kCGPathElementAddQuadCurveToPoint, cpx:cp.x, cpy:cp.y, x:end.x, y:end.y }
    aPath.current = end;
}

CGPathAddRect= function(aPath, aTransform, aRect)
{
    CGPathAddRects(aPath, aTransform, [aRect], 1);
}

CGPathAddRects= function(aPath, aTransform, rects, count)
{
    var i = 0;

    if (arguments["count"] == NULL)
        var count = rects.length;

    for (; i < count; ++i)
    {
        var rect = rects[i];

        CGPathMoveToPoint(aPath, aTransform, (rect.origin.x), (rect.origin.y));
        CGPathAddLineToPoint(aPath, aTransform, (rect.origin.x + rect.size.width), (rect.origin.y));
        CGPathAddLineToPoint(aPath, aTransform, (rect.origin.x + rect.size.width), (rect.origin.y + rect.size.height));
        CGPathAddLineToPoint(aPath, aTransform, (rect.origin.x), (rect.origin.y + rect.size.height));

        CGPathCloseSubpath(aPath);
    }
}

CGPathMoveToPoint= function(aPath, aTransform, x, y)
{
    var point = { x:x, y:y },
        count = aPath.count;

    if (aTransform != NULL)
        point = { x:point.x * aTransform.a + point.y * aTransform.c + aTransform.tx, y:point.x * aTransform.b + point.y * aTransform.d + aTransform.ty };

    aPath.start = point;
    aPath.current = point;

    var previous = aPath.elements[count-1];

    if (count != 0 && previous.type == kCGPathElementMoveToPoint)
    {
        previous.x = point.x;
        previous.y = point.y;
    }
    else
        aPath.elements[aPath.count++] = { type:kCGPathElementMoveToPoint, x:point.x, y:point.y };
}

CGPathCloseSubpath= function(aPath)
{
    var count = aPath.count;


    if (count == 0 || aPath.elements[count-1].type == kCGPathElementCloseSubpath)
        return;

    aPath.elements[aPath.count++] = { type:kCGPathElementCloseSubpath, points:[aPath.start] };
}

CGPathEqualToPath= function(aPath, anotherPath)
{
    if (aPath == anotherPath)
        return YES;

    if (aPath.count != anotherPath.count || !(aPath.start.x == anotherPath.start.x && aPath.start.y == anotherPath.start.y) || !(aPath.current.x == anotherPath.current.x && aPath.current.y == anotherPath.current.y))
        return NO;

    var i = 0,
        count = aPath.count;

    for (; i < count; ++i)
    {
        var element = aPath[i],
            anotherElement = anotherPath[i];

        if (element.type != anotherElement.type)
            return NO;

        if ((element.type == kCGPathElementAddArc || element.type == kCGPathElementAddArcToPoint) &&
            element.radius != anotherElement.radius)
            return NO;

        var j = element.points.length;

        while (j--)
            if (!(element.points[j].x == anotherElement.points[j].x && element.points[j].y == anotherElement.points[j].y))
                return NO;
    }

    return YES;
}

CGPathGetCurrentPoint= function(aPath)
{
    return { x:aPath.current.x, y:aPath.current.y };
}

CGPathIsEmpty= function(aPath)
{
    return !aPath || aPath.count == 0;
}

p;13;CPAnimation.jI;21;Foundation/CPObject.ji;23;CAMediaTimingFunction.jc;5122;


CPAnimationEaseInOut = 0,
CPAnimationEaseIn = 1,
CPAnimationEaseOut = 2,
CPAnimationLinear = 3;

ACTUAL_FRAME_RATE = 0;

{var the_class = objj_allocateClassPair(CPObject, "CPAnimation"),
meta_class = _class_getMeta(the_class);the_class.ivars.splice(the_class.ivars.length, 0, new objj_ivar("_startTime"), new objj_ivar("_duration"), new objj_ivar("_animationCurve"), new objj_ivar("_timingFunction"), new objj_ivar("_frameRate"), new objj_ivar("_progress"), new objj_ivar("_delegate"), new objj_ivar("_timer"));
objj_registerClassPair(the_class);
objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
var instance_methods = [];
instance_methods[0] = new objj_method(sel_registerName("initWithDuration:animationCurve:"), function(self, _cmd, aDuration, anAnimationCurve)
{ with(self)
{
    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");

    if (self)
    {
        _duration = aDuration;
        _animationCurve = anAnimationCurve;
        _frameRate = 60.0;
    }

    return self;
}
});
instance_methods[1] = new objj_method(sel_registerName("setAnimationCurve:"), function(self, _cmd, anAnimationCurve)
{ with(self)
{
    _animationCurve = anAnimationCurve;

    var timingFunctionName = kCAMediaTimingFunctionLinear;

    switch (_animationCurve)
    {
        case CPAnimationEaseInOut: timingFunctionName = kCAMediaTimingFunctionEaseInEaseOut;
                                    break;

        case CPAnimationEaseIn: timingFunctionName = kCAMediaTimingFunctionEaseIn;
                                    break;

        case CPAnimationEaseOut: timingFunctionName = kCAMediaTimingFunctionEaseOut;
                                    break;
    }

    _timingFunction = objj_msgSend(CAMediaTimingFunction, "functionWithName:", timingFunctionName);
}
});
instance_methods[2] = new objj_method(sel_registerName("animationCurve"), function(self, _cmd)
{ with(self)
{
    return _animationCurve;
}
});
instance_methods[3] = new objj_method(sel_registerName("setDuration:"), function(self, _cmd, aDuration)
{ with(self)
{
    _duration = aDuration;
}
});
instance_methods[4] = new objj_method(sel_registerName("duration"), function(self, _cmd)
{ with(self)
{
    return _duration;
}
});
instance_methods[5] = new objj_method(sel_registerName("setFramesPerSecond:"), function(self, _cmd, framesPerSecond)
{ with(self)
{
    _frameRate = framesPerSecond;
}
});
instance_methods[6] = new objj_method(sel_registerName("frameRate"), function(self, _cmd)
{ with(self)
{
    return _frameRate;
}
});
instance_methods[7] = new objj_method(sel_registerName("delegate"), function(self, _cmd)
{ with(self)
{
    return _delegate;
}
});
instance_methods[8] = new objj_method(sel_registerName("setDelegate:"), function(self, _cmd, aDelegate)
{ with(self)
{
    _delegate = aDelegate;
}
});
instance_methods[9] = new objj_method(sel_registerName("startAnimation"), function(self, _cmd)
{ with(self)
{

    if (_timer || _delegate && !objj_msgSend(_delegate, "animationShouldStart:", self))
        return;

    _progress = 0.0;
    ACTUAL_FRAME_RATE = 0;
    _startTime = new Date();

    _timer = window.setInterval(function() {
        objj_msgSend(self, "animationTimerDidFire:", _timer);
        objj_msgSend(objj_msgSend(CPRunLoop, "currentRunLoop"), "performSelectors");
    }, 1);
}
});
instance_methods[10] = new objj_method(sel_registerName("animationTimerDidFire:"), function(self, _cmd, aTimer)
{ with(self)
{
    var elapsed = new Date() - _startTime,
        progress = MIN(1.0, 1.0 - (_duration - elapsed / 1000.0) / _duration);
++ACTUAL_FRAME_RATE;
    objj_msgSend(self, "setCurrentProgress:", progress);

    if (progress == 1.0)
    {
        window.clearTimeout(_timer);
        _timer = nil;

        if (objj_msgSend(_delegate, "respondsToSelector:", sel_registerName("animationDidEnd:")))
            objj_msgSend(_delegate, "animationDidEnd:", self);
    }

}
});
instance_methods[11] = new objj_method(sel_registerName("stopAnimation"), function(self, _cmd)
{ with(self)
{
    if (!_timer)
        return;

    window.clearTimeout(_timer);
    _timer = nil;

    objj_msgSend(_delegate, "animationDidStop:", self);
}
});
instance_methods[12] = new objj_method(sel_registerName("isAnimating"), function(self, _cmd)
{ with(self)
{
    return _timer;
}
});
instance_methods[13] = new objj_method(sel_registerName("setCurrentProgress:"), function(self, _cmd, aProgress)
{ with(self)
{
    _progress = aProgress;
}
});
instance_methods[14] = new objj_method(sel_registerName("currentProgress"), function(self, _cmd)
{ with(self)
{
    return _progress;
}
});
instance_methods[15] = new objj_method(sel_registerName("currentValue"), function(self, _cmd)
{ with(self)
{
    if (objj_msgSend(_delegate, "respondsToSelector:", sel_registerName("animation:valueForProgress:")))
        return objj_msgSend(_delegate, "animation:valueForProgress:", self, _progress);

    if (_animationCurve == CPAnimationLinear)
        return _progress;

    alert("IMPLEMENT ANIMATION CURVES!!!");
}
});
class_addMethods(the_class, instance_methods);
}

p;15;CPApplication.jI;21;Foundation/CPBundle.ji;17;CPCompatibility.ji;9;CPEvent.ji;8;CPMenu.ji;13;CPResponder.ji;22;CPDocumentController.jc;15086;

CPApp = nil;

CPApplicationWillFinishLaunchingNotification = "CPApplicationWillFinishLaunchingNotification";
CPApplicationDidFinishLaunchingNotification = "CPApplicationDidFinishLaunchingNotification";

CPRunStoppedResponse = -1000;
CPRunAbortedResponse = -1001;
CPRunContinuesResponse = -1002;

{var the_class = objj_allocateClassPair(CPResponder, "CPApplication"),
meta_class = _class_getMeta(the_class);the_class.ivars.splice(the_class.ivars.length, 0, new objj_ivar("_eventListeners"), new objj_ivar("_currentEvent"), new objj_ivar("_windows"), new objj_ivar("_keyWindow"), new objj_ivar("_mainWindow"), new objj_ivar("_mainMenu"), new objj_ivar("_currentSession"), new objj_ivar("_delegate"), new objj_ivar("_namedArgs"), new objj_ivar("_args"));
objj_registerClassPair(the_class);
objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
var class_methods = [];
class_methods[0] = new objj_method(sel_registerName("sharedApplication"), function(self, _cmd)
{ with(self)
{
    if (!CPApp)
        CPApp = objj_msgSend(objj_msgSend(CPApplication, "alloc"), "init");

    return CPApp;
}
});
var instance_methods = [];
instance_methods[0] = new objj_method(sel_registerName("init"), function(self, _cmd)
{ with(self)
{
    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPResponder") }, "init");

    if (self)
    {
        _eventListeners = [];

        _windows = [];

        objj_msgSend(_windows, "addObject:", nil);


        _mainMenu = objj_msgSend(objj_msgSend(CPMenu, "alloc"), "initWithTitle:", "MainMenu");

        var undoMenuItem = objj_msgSend(objj_msgSend(CPMenuItem, "alloc"), "initWithTitle:action:keyEquivalent:", "Undo", sel_registerName("undo:"), CPUndoKeyEquivalent),
            redoMenuItem = objj_msgSend(objj_msgSend(CPMenuItem, "alloc"), "initWithTitle:action:keyEquivalent:", "Redo", sel_registerName("redo:"), CPRedoKeyEquivalent);

        objj_msgSend(undoMenuItem, "setKeyEquivalentModifierMask:", CPUndoKeyEquivalentModifierMask);
        objj_msgSend(redoMenuItem, "setKeyEquivalentModifierMask:", CPRedoKeyEquivalentModifierMask);

        objj_msgSend(_mainMenu, "addItem:", undoMenuItem);
        objj_msgSend(_mainMenu, "addItem:", redoMenuItem);

        objj_msgSend(_mainMenu, "addItem:", objj_msgSend(CPMenuItem, "separatorItem"));

        objj_msgSend(_mainMenu, "addItem:", objj_msgSend(objj_msgSend(CPMenuItem, "alloc"), "initWithTitle:action:keyEquivalent:", "New", sel_registerName("newDocument:"), "N")),
        objj_msgSend(_mainMenu, "addItem:", objj_msgSend(objj_msgSend(CPMenuItem, "alloc"), "initWithTitle:action:keyEquivalent:", "Open", sel_registerName("openDocument:"), "O")),
        objj_msgSend(_mainMenu, "addItem:", objj_msgSend(objj_msgSend(CPMenuItem, "alloc"), "initWithTitle:action:keyEquivalent:", "Save", sel_registerName("saveDocument:"), "S"));

        objj_msgSend(_mainMenu, "addItem:", objj_msgSend(objj_msgSend(CPMenuItem, "alloc"), "initWithTitle:action:keyEquivalent:", "Cut", sel_registerName("cut:"), "X")),
        objj_msgSend(_mainMenu, "addItem:", objj_msgSend(objj_msgSend(CPMenuItem, "alloc"), "initWithTitle:action:keyEquivalent:", "Copy", sel_registerName("copy:"), "C")),
        objj_msgSend(_mainMenu, "addItem:", objj_msgSend(objj_msgSend(CPMenuItem, "alloc"), "initWithTitle:action:keyEquivalent:", "Paste", sel_registerName("paste:"), "V"));
    }

    return self;
}
});
instance_methods[1] = new objj_method(sel_registerName("setDelegate:"), function(self, _cmd, aDelegate)
{ with(self)
{
    if (_delegate == aDelegate)
        return;

    var defaultCenter = objj_msgSend(CPNotificationCenter, "defaultCenter");

    if (_delegate)
    {
        objj_msgSend(defaultCenter, "removeObesrver:name:object:", _delegate, CPApplicationWillFinishLaunchingNotification, self);

        objj_msgSend(defaultCenter, "removeObesrver:name:object:", _delegate, CPApplicationDidFinishLaunchingNotification, self);
    }

    _delegate = aDelegate;

    if (objj_msgSend(_delegate, "respondsToSelector:", sel_registerName("applicationWillFinishLaunching:")))
        objj_msgSend(defaultCenter, "addObserver:selector:name:object:", _delegate, sel_registerName("applicationWillFinishLaunching:"), CPApplicationWillFinishLaunchingNotification, self);

    if (objj_msgSend(_delegate, "respondsToSelector:", sel_registerName("applicationDidFinishLaunching:")))
        objj_msgSend(defaultCenter, "addObserver:selector:name:object:", _delegate, sel_registerName("applicationDidFinishLaunching:"), CPApplicationDidFinishLaunchingNotification, self);
}
});
instance_methods[2] = new objj_method(sel_registerName("delegate"), function(self, _cmd)
{ with(self)
{
    return _delegate;
}
});
instance_methods[3] = new objj_method(sel_registerName("finishLaunching"), function(self, _cmd)
{ with(self)
{
    var defaultCenter = objj_msgSend(CPNotificationCenter, "defaultCenter");

    objj_msgSend(defaultCenter, "postNotificationName:object:", CPApplicationWillFinishLaunchingNotification, self);


    if (YES)
    {
        objj_msgSend(self, "setDelegate:", objj_msgSend(CPDocumentController, "sharedDocumentController"));

        objj_msgSend(_delegate, "newDocument:", self);
    }

    objj_msgSend(defaultCenter, "postNotificationName:object:", CPApplicationDidFinishLaunchingNotification, self);

    objj_msgSend(objj_msgSend(CPRunLoop, "currentRunLoop"), "performSelectors");
}
});
instance_methods[4] = new objj_method(sel_registerName("run"), function(self, _cmd)
{ with(self)
{
    objj_msgSend(self, "finishLaunching");
}
});
instance_methods[5] = new objj_method(sel_registerName("runModalForWindow:"), function(self, _cmd, aWindow)
{ with(self)
{
    objj_msgSend(self, "runModalSession:", objj_msgSend(self, "beginModalSessionForWindow:", aWindow));
}
});
instance_methods[6] = new objj_method(sel_registerName("stopModalWithCode:"), function(self, _cmd, aCode)
{ with(self)
{
    if (!_currentSession)
    {
        return;

    }

    _currentSession._state = aCode;
    _currentSession = _currentSession._previous;

    if (aCode == CPRunAbortedResponse)
        objj_msgSend(self, "_removeRunModalLoop");
}
});
instance_methods[7] = new objj_method(sel_registerName("_removeRunModalLoop"), function(self, _cmd)
{ with(self)
{
    var count = _eventListeners.length;

    while (count--)
        if (_eventListeners[count]._callback == _CPRunModalLoop)
        {
            _eventListeners.splice(count, 1);

            return;
        }
}
});
instance_methods[8] = new objj_method(sel_registerName("stopModal"), function(self, _cmd)
{ with(self)
{
    objj_msgSend(self, "stopModalWithCode:", CPRunStoppedResponse)
}
});
instance_methods[9] = new objj_method(sel_registerName("abortModal"), function(self, _cmd)
{ with(self)
{
    objj_msgSend(self, "stopModalWithCode:", CPRunAbortedResponse);
}
});
instance_methods[10] = new objj_method(sel_registerName("beginModalSessionForWindow:"), function(self, _cmd, aWindow)
{ with(self)
{
    return _CPModalSessionMake(aWindow, 0);
}
});
instance_methods[11] = new objj_method(sel_registerName("runModalSession:"), function(self, _cmd, aModalSession)
{ with(self)
{
    aModalSession._previous = _currentSession;
    _currentSession = aModalSession;

    var theWindow = aModalSession._window;

    objj_msgSend(theWindow, "center");
    objj_msgSend(theWindow, "makeKeyAndOrderFront:", self);



    objj_msgSend(CPApp, "setCallback:forNextEventMatchingMask:untilDate:inMode:dequeue:", _CPRunModalLoop, CPAnyEventMask, nil, 0, NO);
}
});
instance_methods[12] = new objj_method(sel_registerName("modalWindow"), function(self, _cmd)
{ with(self)
{
    if (!_currentSession)
        return nil;

    return _currentSession._window;
}
});
instance_methods[13] = new objj_method(sel_registerName("_handleKeyEquivalent:"), function(self, _cmd, anEvent)
{ with(self)
{
    if (objj_msgSend(_mainMenu, "performKeyEquivalent:", anEvent))
        return YES;

    return NO;
}
});
instance_methods[14] = new objj_method(sel_registerName("sendEvent:"), function(self, _cmd, anEvent)
{ with(self)
{

    if (objj_msgSend(anEvent, "type") == CPKeyDown &&
        objj_msgSend(anEvent, "modifierFlags") & (CPCommandKeyMask | CPControlKeyMask) &&
        objj_msgSend(objj_msgSend(anEvent, "characters"), "length") > 0 &&
        objj_msgSend(self, "_handleKeyEquivalent:", anEvent))
        return;

    if (_eventListeners.length)
    {
        if (_eventListeners[_eventListeners.length-1]._mask & (1 << objj_msgSend(anEvent, "type")))
            _eventListeners.pop()._callback(anEvent);

        return;
    }

    objj_msgSend(objj_msgSend(anEvent, "window"), "sendEvent:", anEvent);
}
});
instance_methods[15] = new objj_method(sel_registerName("doCommandBySelector:"), function(self, _cmd, aSelector)
{ with(self)
{
    if (objj_msgSend(_delegate, "respondsToSelector:", aSelector))
        objj_msgSend(_delegate, "performSelector:", aSelector);
    else
        objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPResponder") }, "doCommandBySelector:", aSelector);
}
});
instance_methods[16] = new objj_method(sel_registerName("keyWindow"), function(self, _cmd)
{ with(self)
{
    return _keyWindow;
}
});
instance_methods[17] = new objj_method(sel_registerName("mainWindow"), function(self, _cmd)
{ with(self)
{
    return _mainWindow;
}
});
instance_methods[18] = new objj_method(sel_registerName("windowWithWindowNumber:"), function(self, _cmd, aWindowNumber)
{ with(self)
{
    return _windows[aWindowNumber];
}
});
instance_methods[19] = new objj_method(sel_registerName("windows"), function(self, _cmd)
{ with(self)
{
    return _windows;
}
});
instance_methods[20] = new objj_method(sel_registerName("mainMenu"), function(self, _cmd)
{ with(self)
{
    return _mainMenu;
}
});
instance_methods[21] = new objj_method(sel_registerName("setMainMenu:"), function(self, _cmd, aMenu)
{ with(self)
{
    _mainMenu = aMenu;
}
});
instance_methods[22] = new objj_method(sel_registerName("tryToPerform:with:"), function(self, _cmd, anAction, anObject)
{ with(self)
{
    if (!anAction)
        return NO;

    if (objj_msgSend(self, "tryToPerform:with:", anAction, anObject))
        return YES;

    if(objj_msgSend(_delegate, "respondsToSelector:", aSelector))
    {
        objj_msgSend(_delegate, "performSelector:withObject:", aSelector, anObject);

        return YES;
    }

    return NO;
}
});
instance_methods[23] = new objj_method(sel_registerName("sendAction:to:from:"), function(self, _cmd, anAction, aTarget, aSender)
{ with(self)
{
    var target = objj_msgSend(self, "targetForAction:to:from:", anAction, aTarget, aSender);

    if (!target)
        return NO;

    objj_msgSend(target, "performSelector:withObject:", anAction, aSender);

    return YES;
}
});
instance_methods[24] = new objj_method(sel_registerName("targetForAction:to:from:"), function(self, _cmd, anAction, aTarget, aSender)
{ with(self)
{
    if (!anAction)
        return nil;

    if (aTarget)
        return aTarget;

    return objj_msgSend(self, "targetForAction:", anAction);
}
});
instance_methods[25] = new objj_method(sel_registerName("targetForAction:"), function(self, _cmd, anAction)
{ with(self)
{
    if (!anAction)
        return nil;

    var theWindow = objj_msgSend(self, "keyWindow"),
        responder = objj_msgSend(theWindow, "firstResponder");

    while (responder)
    {
        if (objj_msgSend(responder, "respondsToSelector:", anAction))
            return responder;

        responder = objj_msgSend(responder, "nextResponder");
    }

    var delegate = objj_msgSend(theWindow, "delegate");

    if (objj_msgSend(delegate, "respondsToSelector:", anAction))
        return delegate;

    theWindow = objj_msgSend(self, "mainWindow");

    if (theWindow != objj_msgSend(self, "keyWindow"))
    {
        responder = objj_msgSend(theWindow, "firstResponder");

        while (responder)
        {
            if (objj_msgSend(responder, "respondsToSelector:", anAction))
                return responder;

            responder = objj_msgSend(responder, "nextResponder");
        }

        delegate = objj_msgSend(theWindow, "delegate");

        if (objj_msgSend(delegate, "respondsToSelector:", anAction))
            return delegate;
    }

    if (objj_msgSend(self, "respondsToSelector:", anAction))
        return self;

    if (objj_msgSend(_delegate, "respondsToSelector:", anAction))
        return _delegate;

    return nil;
}
});
instance_methods[26] = new objj_method(sel_registerName("setCallback:forNextEventMatchingMask:untilDate:inMode:dequeue:"), function(self, _cmd, aCallback, aMask, anExpiration, aMode, shouldDequeue)
{ with(self)
{
    _eventListeners.push(_CPEventListenerMake(aMask, aCallback));

    if (_eventListeners.length == 3) objj_debug_print_backtrace();
}
});
instance_methods[27] = new objj_method(sel_registerName("setTarget:selector:forNextEventMatchingMask:untilDate:inMode:dequeue:"), function(self, _cmd, aTarget, aSelector, aMask, anExpiration, aMode, shouldDequeue)
{ with(self)
{
    _eventListeners.push(_CPEventListenerMake(aMask, function (anEvent) { objj_msgSend(aTarget, aSelector, anEvent); }));
}
});
instance_methods[28] = new objj_method(sel_registerName("beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:"), function(self, _cmd, aSheet, aWindow, aModalDelegate, aDidEndSelector, aContextInfo)
{ with(self)
{
    objj_msgSend(aWindow, "_attachSheet:modalDelegate:didEndSelector:contextInfo:", aSheet, aModalDelegate, aDidEndSelector, aContextInfo);
}
});
instance_methods[29] = new objj_method(sel_registerName("arguments"), function(self, _cmd)
{ with(self)
{
    return _args;
}
});
instance_methods[30] = new objj_method(sel_registerName("namedArguments"), function(self, _cmd)
{ with(self)
{
    return _namedArgs;
}
});
class_addMethods(the_class, instance_methods);
class_addMethods(meta_class, class_methods);
}

var _CPModalSessionMake = function(aWindow, aStopCode)
{
    return { _window:aWindow, _state:CPRunContinuesResponse , _previous:nil };
}

var _CPEventListenerMake = function(anEventMask, aCallback)
{
    return { _mask:anEventMask, _callback:aCallback };
}

var _CPRunModalLoop = function(anEvent)
{
    objj_msgSend(CPApp, "setCallback:forNextEventMatchingMask:untilDate:inMode:dequeue:", _CPRunModalLoop, CPAnyEventMask, nil, 0, NO);


    var theWindow = objj_msgSend(anEvent, "window"),
        modalSession = CPApp._currentSession;

    if (theWindow == modalSession._window)
        objj_msgSend(theWindow, "sendEvent:", anEvent);



    if (modalSession._state != CPRunContinuesResponse)
        objj_msgSend(CPApp, "_removeRunModalLoop");
}

CPApplicationMain= function(args, namedArgs)
{
    var mainBundle = objj_msgSend(CPBundle, "mainBundle"),
        principalClass = objj_msgSend(mainBundle, "principalClass");

    if (!principalClass)
        principalClass = objj_msgSend(CPApplication, "class");

    objj_msgSend(principalClass, "sharedApplication");




    CPApp._args = args;
    CPApp._namedArgs = namedArgs;

    objj_msgSend(CPApp, "run");
}

p;10;CPBorder.jc;3513;


CPBorderNoneStyle = 0;
CPBorderSolidStyle = 1;
CPBorderDashedStyle = 2;

var CPBorderStyleMap = nil;

{var the_class = objj_allocateClassPair(CPObject, "CPBorder"),
meta_class = _class_getMeta(the_class);the_class.ivars.splice(the_class.ivars.length, 0, new objj_ivar("_color"), new objj_ivar("_thickness"), new objj_ivar("_style"), new objj_ivar("_cssString"));
objj_registerClassPair(the_class);
objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
var class_methods = [];
class_methods[0] = new objj_method(sel_registerName("initialize"), function(self, _cmd)
{ with(self)
{
    if (self == objj_msgSend(CPBorder, "class"))
    {
        CPBorderStyleMap = objj_msgSend(CPArray, "array");

        CPBorderStyleMap[CPBorderNoneStyle] = "none";
        CPBorderStyleMap[CPBorderSolidStyle] = "solid";
        CPBorderStyleMap[CPBorderDashedStyle] = "dashed";
    }
}
});
class_methods[1] = new objj_method(sel_registerName("emptyBorder"), function(self, _cmd)
{ with(self)
{
    return objj_msgSend(self, "borderWithColor:thickness:style:", nil, 0.0, CPBorderNoneStyle);
}
});
class_methods[2] = new objj_method(sel_registerName("borderWithColor:thickness:style:"), function(self, _cmd, aColor, aThickness, aStyle)
{ with(self)
{
    return objj_msgSend(objj_msgSend(self, "alloc"), "initWithColor:thickness:style:", aColor, aThickness, aStyle);
}
});
var instance_methods = [];
instance_methods[0] = new objj_method(sel_registerName("initWithColor:thickness:style:"), function(self, _cmd, aColor, aThickness, aStyle)
{ with(self)
{
    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");

    if (self)
    {
        _color = aColor;
        _thickness = aThickness;
        _style = aStyle;

        if (_style == CPBorderNoneStyle)
            _cssString = "none";
        else
            _cssString = _thickness + "px " + CPBorderStyleMap[_style] + " " + objj_msgSend(_color, "cssString");
    }

    return self;
}
});
instance_methods[1] = new objj_method(sel_registerName("color"), function(self, _cmd)
{ with(self)
{
    return _color;
}
});
instance_methods[2] = new objj_method(sel_registerName("thickness"), function(self, _cmd)
{ with(self)
{
    return _thickness;
}
});
instance_methods[3] = new objj_method(sel_registerName("cssString"), function(self, _cmd)
{ with(self)
{
    return _cssString;
}
});
class_addMethods(the_class, instance_methods);
class_addMethods(meta_class, class_methods);
}

{
var the_class = objj_getClass("CPBorder")
if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPBorder\""));
var meta_class = _class_getMeta(the_class);var instance_methods = [];
instance_methods[0] = new objj_method(sel_registerName("initWithCoder:"), function(self, _cmd, aCoder)
{ with(self)
{
    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");

    if (self)
    {
        _color = objj_msgSend(aCoder, "decodeObject");
        _thickness = objj_msgSend(aCoder, "decodeNumber");
        _style = objj_msgSend(aCoder, "decodeNumber");
    }

    return self;
}
});
instance_methods[1] = new objj_method(sel_registerName("encodeWithCoder:"), function