local M,d="\076\105\098\083\116\117\098",2 local l=_G[M]if not l or l.minor<d then l=l or{libs={};minors={}}_G[M]=l l.minor=d function l.NewLibrary(l,M,d)assert(type(M)=="\115\116\114\105\110\103","\066\097\100 \097\114\103\117\109\101\110\116 \035\050 \116\111 \096\078\101\119\076\105\098\114\097\114\121\' \040\115\116\114\105\110\103 \101\120\112\101\099\116\101\100\041")d=assert(tonumber(strmatch(d,"\037\100\043")),"\077\105\110\111\114 \118\101\114\115\105\111\110 \109\117\115\116 \101\105\116\104\101\114 \098\101 \097 \110\117\109\098\101\114 \111\114 \099\111\110\116\097\105\110 \097 \110\117\109\098\101\114\046")local U=l.minors[M]if U and U>=d then return nil end l.minors[M],l.libs[M]=d,l.libs[M]or{}return l.libs[M],U end function l.GetLibrary(l,M,d)if not l.libs[M]and not d then error(("\067\097\110\110\111\116 \102\105\110\100 \097 \108\105\098\114\097\114\121 \105\110\115\116\097\110\099\101 \111\102 \037\113\046"):format(tostring(M)),2)end return l.libs[M],l.minors[M]end function l.IterateLibraries(M)return pairs(M.libs)end setmetatable(l,{__call=l.GetLibrary})end
-- LibStub is a simple versioning stub meant for use in Libraries.  http://www.wowace.com/wiki/LibStub for more info
-- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2  -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
local LibStub = _G[LIBSTUB_MAJOR]

if not LibStub or LibStub.minor < LIBSTUB_MINOR then
	LibStub = LibStub or {libs = {}, minors = {} }
	_G[LIBSTUB_MAJOR] = LibStub
	LibStub.minor = LIBSTUB_MINOR
	
	function LibStub:NewLibrary(major, minor)
		assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
		minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
		
		local oldminor = self.minors[major]
		if oldminor and oldminor >= minor then return nil end
		self.minors[major], self.libs[major] = minor, self.libs[major] or {}
		return self.libs[major], oldminor
	end
	
	function LibStub:GetLibrary(major, silent)
		if not self.libs[major] and not silent then
			error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
		end
		return self.libs[major], self.minors[major]
	end
	
	function LibStub:IterateLibraries() return pairs(self.libs) end
	setmetatable(LibStub, { __call = LibStub.GetLibrary })
end
