 extension AnyImage {
     
     public init(imageRep: ImageRep, option: MappedBufferOption = .default) {
-        self = imageRep.base.image(option: option)
+        self = imageRep.image(option: option)
     }
     
     public init(data: Data, option: MappedBufferOption = .default) throws {
-        self = try ImageRep(data: data).base.image(option: option)
+        self = try ImageRep(data: data).image(option: option)
     }
 }
 

    }
    
    public func page(_ index: Int) -> ImageRep {
        return ImageRep(base: base.page(index))
    }
}



public struct ImageRep {
    
    private let base: ImageRepBase
    
    private let cache = Cache()
    
    private init(base: ImageRepBase) {
        self.base = base
    }
}

extension ImageRep {
    
    @usableFromInline
    class Cache {
        
        let lck = SDLock()
        
        var images: [MappedBufferOption: AnyImage]
        var pages: [Int: ImageRep]
        
        @usableFromInline
        init() {
            self.images = [:]
            self.pages = [:]
        }
    }
}

