} // namespace boost

#endif // BOOST_LEXICAL_CAST_TRY_LEXICAL_CONVERT_HPP

//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2006-2014. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/move for documentation.
//
//////////////////////////////////////////////////////////////////////////////

#ifndef BOOST_MOVE_MAKE_UNIQUE_HPP_INCLUDED
#define BOOST_MOVE_MAKE_UNIQUE_HPP_INCLUDED

#include <boost/move/detail/config_begin.hpp>
#include <boost/move/detail/workaround.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/move/unique_ptr.hpp>
#include <cstddef>   //for std::size_t
#include <boost/move/detail/unique_ptr_meta_utils.hpp>

//!\file
//! Defines "make_unique" functions, which are factories to create instances
//! of unique_ptr depending on the passed arguments.
//!
//! This header can be a bit heavyweight in C++03 compilers due to the use of the
//! preprocessor library, that's why it's a a separate header from <tt>unique_ptr.hpp</tt>

#if !defined(BOOST_MOVE_DOXYGEN_INVOKED)

namespace std {   //no namespace versioning in clang+libc++

struct nothrow_t;

}  //namespace std {

namespace boost{
namespace move_upmu {

//Compile time switch between
//single element, unknown bound array
//and known bound array
template<class T>
struct unique_ptr_if
{
   typedef ::boost::movelib::unique_ptr<T> t_is_not_array;
};

template<class T>
struct unique_ptr_if<T[]>
{
   typedef ::boost::movelib::unique_ptr<T[]> t_is_array_of_unknown_bound;
};

template<class T, std::size_t N>
struct unique_ptr_if<T[N]>
{
   typedef void t_is_array_of_known_bound;
};

static std::nothrow_t *pnothrow;

}  //namespace move_upmu {
}  //namespace boost{

#endif   //!defined(BOOST_MOVE_DOXYGEN_INVOKED)

namespace boost{
namespace movelib {

#if defined(BOOST_MOVE_DOXYGEN_INVOKED) || !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)

//! Remarks: This function shall not participate in overload resolution unless T is not an array.
//!
//! Returns: <tt>unique_ptr<T>(new T(std::forward<Args>(args)...))</tt>.
template<class T, class... Args>
inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
   typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array)
      make_unique(BOOST_FWD_REF(Args)... args)
{  return unique_ptr<T>(new T(::boost::forward<Args>(args)...));  }

//! Remarks: This function shall not participate in overload resolution unless T is not an array.
//!
//! Returns: <tt>unique_ptr<T>(new T(std::nothrow)(std::forward<Args>(args)...))</tt>.
template<class T, class... Args>
inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
   typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array)
      make_unique_nothrow(BOOST_FWD_REF(Args)... args)
{  r


apAtEnd
	add r4, r0, #0x0
	mov r1, #0x0
	mov r2, #0xc
	bl MI_CpuFill8
	strh r6, [r4, #0x4]
	strh r7, [r4, #0x6]
	str r5, [r4, #0x0]
	mov r0, #0x0
	strb r0, [r4, #0x9]
	ldr r0, [sp, #0x0]
	ldr r1, _02055064 ; =sub_02054FE4
	ldr r0, [r0, #0x10]
	add r2, r4, #0x0
	bl TaskManager_Call
	pop {r3-r7, pc}
	.balign 4
_02055064: .word sub_02054FE4


ase 395165:
		return "GrabShortcutWithKeyContext", "QWidget::grabShortcut", "int QWidget::grabShortcut(QKeySequence const&,Qt::ShortcutContext)"
	case 395166:
		return "GraphicsEffect", "QWidget::graphicsEffect", "QGraphicsEffect* QWidget::graphicsEffect()"
	case 395167:
		return "GraphicsProxyWidget", "QWidget::graphicsProxyWidget", "QGraphicsProxyWidget* QWidget::graphicsProxyWidget()"
	case 395168:
		return "HasFocus", "QWidget::hasFocus", "bool QWidget::hasFocus()"
	case 395169:
		return "HasMouseTracking", "QWidget::hasMouseTracking", "bool QWidget::hasMouseTracking()"
	case 395170:
		return "Height", "QWidget::height", "int QWidget::height()"
	case 395171:
		return "HeightForWidth", "QWidget::heightForWidth", "int QWidget::heightForWidth(int)"
	case 395172:
		return "HeightMM", "QPaintDevice::heightMM", "int QPaintDevice::heightMM()"
	case 395173:
		return "Hide", "QWidget::hide", "void QWidget::hide()"
	case 395174:
		return "HideEvent", "QWidget::hideEvent", "void QWidget::hideEvent(QHideEvent*)"
	case 395175:
		return "InputMethodEvent", "QWidget::inputMethodEvent", "void QWidget::inputMethodEvent(QInputMethodEvent*)"
	case 395176:
		return "InputMethodHints", "QWidget::inputMethodHints", "QFlags<Qt::InputMethodHint> QWidget::inputMethodHints()"
	case 395177:
		return "InputMethodQuery", "QWidget::inputMethodQuery", "QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery)"
	case 395178:
		return "InsertAction", "QWidget::insertAction", "void QWidget::insertAction(QAction*,QAction*)"
	case 395179:
		return "InsertActions", "QWidget::insertActions", "void QWidget::insertActions(QAction*,QList<QAction*>)"
	case 395180:
		return "IsActiveWindow", "QWidget::isActiveWindow", "bool QWidget::isActiveWindow()"
	case 395181:
		return "IsAncestorOf", "QWidget::isAncestorOf", "bool QWidget::isAncestorOf(QWidget const*)"
	case 395182:
		return "IsEnabled", "QWidget::isEnabled", "bool QWidget::isEnabled()"
	case 395183:
		return "IsEnabledTo", "QWidget::isEnabledTo", "bool QWidget::isEnabledTo(QWidget*)"
	case 395184:
		return "IsEnabledToTLW", "QWidget::isEnabledToTLW", "bool QWidget::isEnabledToTLW()"
	case 395185:
		return "IsFullScreen", "QWidget::isFullScreen", "bool QWidget::isFullScreen()"
	case 395186:
		return "IsHidden", "QWidget::isHidden", "bool QWidget::isHidden()"
	case 395187:
		return "IsLeftToRight", "QWidget::isLeftToRight", "bool QWidget::isLeftToRight()"
	case 395188:
		return "IsMaximized", "QWidget::isMaximized", "bool QWidget::isMaximized()"
	case 395189:
		return "IsMinimized", "QWidget::isMinimized", "bool QWidget::isMinimized()"
	case 395190:
		return "IsModal", "QWidget::isModal", "bool QWidget::isModal()"
	case 395191:
		return "IsRightToLeft", "QWidget::isRightToLeft", "bool QWidget::isRightToLeft()"
	case 395192:
		return "IsTopLevel", "QWidget::isTopLevel", "bool QWidget::isTopLevel()"
	case 395193:
		return "IsVisible", "QWidget::isVisible", "bool QWidget::isVisible()"
	case 395194:
		return "IsVisibleTo", "QWidget::isVisibleTo", "bool QWidget::isVisibleTo(Q


types.Keys.Cast<ICacheAssembler>().ToArray(),
				                 null,
				                 sessionImpl,
				                 null)
			                 .Concat(
				                 new[]
				                 {
					                 LazyPropertyInitializer.UnfetchedProperty,
					                 BackrefPropertyAccessor.Unknown
				                 })
			                 .ToArray();
		}

		private AnyType.ObjectTypeCacheEntry CreateObjectTypeCacheEntry()
		{
			return new AnyType.ObjectTypeCacheEntry
			{
				Id = 100,
				EntityName = "Test"
			};
		}

		private void CheckCacheEntry(CacheEntry original, CacheEntry copy)
		{
			Assert.That(copy.Version, Is.EqualTo(original.Version));
			Assert.That(copy.Version, Is.TypeOf(original.Version.GetType()));
			Assert.That(copy.Subclass, Is.EqualTo(original.Subclass));
			for (var i = 0; i < copy.DisassembledState.Length; i++)
			{
				Assert.That(copy.DisassembledState[i], Is.TypeOf(original.DisassembledState[i].GetType()));
				if (original.DisassembledState[i] is AnyType.ObjectTypeCacheEntry originalAnyType)
				{
					var copyAnyType = (AnyType.ObjectTypeCacheEntry) copy.DisassembledState[i];
					CheckObjectTypeCacheEntry(originalAnyType, copyAnyType);
				}
				else
				{
					Assert.That(copy.DisassembledState[i], Is.EqualTo(original.DisassembledState[i]));
				}
			}
		}

		private void CheckCachedItem(CachedItem original, CachedItem copy)
		{
			Assert.That(copy.Version, Is.EqualTo(original.Version));
			Assert.That(copy.Version, Is.TypeOf(original.Version.GetType()));
			Assert.That(copy.Value, Is.TypeOf(original.Value.GetType()));
			switch (original.Value)
			{
				case CacheEntry cacheEntry:
					CheckCacheEntry(cacheEntry, (CacheEntry) copy.Value);
					break;
				case CollectionCacheEntry colleectionCacheEntry:
					CheckCollectionCacheEntry(colleectionCacheEntry, (CollectionCacheEntry) copy.Value);
					break;
				default:
					Assert.That(copy.Value, Is.EqualTo(original.Value));
					break;
			}
			Assert.That(copy.FreshTimestamp, Is.EqualTo(original.FreshTimestamp));
		}

		private void CheckCollectionCacheEntry(CollectionCacheEntry original, CollectionCacheEntry copy)
		{
			Assert.That(copy.State, Is.TypeOf(original.State.GetType()));

			var originalArray = original.State;
			var copyArray = copy.State;

			for (var i = 0; i < copyArray.Length; i++)
			{
				Assert.That(copyArray[i], Is.TypeOf(originalArray[i].GetType()));
				if (originalArray[i] is AnyType.ObjectTypeCacheEntry originalAnyType)
				{
					var copyAnyType = (AnyType.ObjectTypeCacheEntry) copyArray[i];
					CheckObjectTypeCacheEntry(originalAnyType, copyAnyType);
				}
				else
				{
					Assert.That(copyArray[i], Is.EqualTo(originalArra


22, .L642
	ldrb	w23, [x21, 14]
	uxtb	w1, w0
	mov	w0, w23
	bl	VC1_Vfmw_DecPQUANT
	str	w0, [x19, 104]
	cmp	w22, 8
	bls	.L654
	strb	wzr, [x19, 7]
.L636:
	cmp	w23, 1
	beq	.L655
	strb	wzr, [x19, 8]
.L638:
	ldrb	w0, [x21, 7]
	cmp	w0, 1
	beq	.L656
	strb	wzr, [x19, 9]
.L640:
	mov	w1, 1
	mov	x0, x20
	bl	BsGet
	cmp	w0, wzr
	mov	w1, 3
	mov	w3, 0
	csinc	w0, w1, wzr, eq
	mov	x2, x21
	strb	w0, [x19, 11]
	mov	x1, x24
	mov	x0, x20
	bl	BPD_Drv
	cmp	w0, 1
	beq	.L642
	mov	w1, 2
	mov	x0, x20
	bl	BsGet
	strb	w0, [x19, 15]
	mov	w1, 2
	mov	x0, x20
	bl	BsGet
	strb	w0, [x19, 16]
	ldrb	w1, [x21, 8]
	cbnz	w1, .L657
.L643:
	ldrb	w1, [x21, 9]
	cmp	w1, 1
	beq	.L658
.L645:
	mov	x0, x20
	bl	VC1_DecTransacfrm
	strb	w0, [x19, 19]
	mov	w1, 1
	mov	x0, x20
	bl	BsGet
	strb	w0, [x19, 21]
	mov	w1, 1
	mov	w0, w1
	ldp	x19, x20, [sp, 16]
	ldp	x21, x22, [sp, 32]
	ldp	x23, x24, [sp, 48]
	ldp	x29, x30, [sp], 64
	ret
	.p2align 3
.L642:
	mov	w1, 0
	mov	w0, w1
	ldp	x19, x20, [sp, 16]
	ldp	x21, x22, [sp, 32]
	ldp	x23, x24, [sp, 48]
	ldp	x29, x30, [sp], 64
	ret
	.p2align 3
.L654:
	mov	w1, 1
	mov	x0, x20
	bl	BsGet
	strb	w0, [x19, 7]
	ldrb	w23, [x21, 14]
	b	.L636
	.p2align 3
.L657:
	ldrb	w2, [x19, 104]
	add	x3, x21, 272
	mov	x0, x20
	bl	VC1_VopDQuant
	b	.L643
	.p2align 3
.L656:
	mov	x0, x20
	bl	VC1_DecMvrange
	strb	w0, [x19, 9]
	b	.L640
	.p2align 3
.L655:
	mov	w1, w23
	mov	x0, x20
	bl	BsGet
	strb	w0, [x19, 8]
	b	.L638
	.p2align 3
.L658:
	mov	x0, x20
	bl	BsGet
	uxtb	w0, w0
	cmp	w0, 1
	strb	w0, [x19, 17]
	bne	.L645


.3668 13.0915 18 13.3779 18 13.7683V19.2313C18 19.6217 18.3668 19.9081 18.7455 19.8134L20.4851 19.3785C21.3754 19.1559 22 18.356 22 17.4382Z" fill="currentColor" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    -webkit-mask-image: url('data:image/svg+xml;charset=utf-8,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 12L12 17" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 21.01L12.01 20.9989" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M4 13.5V13C4 8.02944 7.58172 4 12 4C16.4183 4 20 8.02944 20 13V13.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M2 17.4382V15.5614C2 14.6436 2.62459 13.8437 3.51493 13.6211L4 13.4998L5.25448 13.1862C5.63317 13.0915 6 13.3779 6 13.7683V19.2313C6 19.6217 5.63317 19.9081 5.25448 19.8134L3.51493 19.3785C2.62459 19.1559 2 18.356 2 17.4382Z" fill="currentColor" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M22 17.4382V15.5614C22 14.6436 21.3754 13.8437 20.4851 13.6211L20 13.4998L18.7455 13.1862C18.3668 13.0915 18 13.3779 18 13.7683V19.2313C18 19.6217 18.3668 19.9081 18.7455 19.8134L20.4851 19.3785C21.3754 19.1559 22 18.356 22 17.4382Z" fill="currentColor" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}
.iconoir-headset-solid::before {
    mask-image: url('data:image/svg+xml;charset=utf-8,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 13.5V13C4 8.02944 7.58172 4 12 4C16.4183 4 20 8.02944 20 13V13.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M2 17.4382V15.5614C2 14.6436 2.62459 13.8437 3.51493 13.6211L4 13.4998L5.25448 13.1862C5.63317 13.0915 6 13.3779 6 13.7683V19.2313C6 19.6217 5.63317 19.9081 5.25448 19.8134L3.51493 19.3785C2.62459 19.1559 2 18.356 2 17.4382Z" fill="currentColor" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M22 17.4382V15.5614C22 14.6436 21.3754 13.8437 20.4851 13.6211


44EE9DA309A1BF848308DE4DDFC070CAE6D95EE8_StaticFields, ___NearNegativeZero_12)); }
	inline Decimal_t44EE9DA309A1BF848308DE4DDFC070CAE6D95EE8  get_NearNegativeZero_12() const { return ___NearNegativeZero_12; }
	inline Decimal_t44EE9DA309A1BF848308DE4DDFC070CAE6D95EE8 * get_address_of_NearNegativeZero_12() { return &___NearNegativeZero_12; }
	inline void set_NearNegativeZero_12(Decimal_t44EE9DA309A1BF848308DE4DDFC070CAE6D95EE8  value)
	{
		___NearNegativeZero_12 = value;
	}

	inline static int32_t get_offset_of_NearPositiveZero_13() { return static_cast<int32_t>(offsetof(Decimal_t44EE9DA309A1BF848308DE4DDFC070CAE6D95EE8_StaticFields, ___NearPositiveZero_13)); }
	inline Decimal_t44EE9DA309A1BF848308DE4DDFC070CAE6D95EE8  get_NearPositiveZero_13() const { return ___NearPositiveZero_13; }
	inline Decimal_t44EE9DA309A1BF848308DE4DDFC070CAE6D95EE8 * get_address_of_NearPositiveZero_13() { return &___NearPositiveZero_13; }
	inline void set_NearPositiveZero_13(Decimal_t44EE9DA309A1BF848308DE4DDFC070CAE6D95EE8  value)
	{
		___NearPositiveZero_13 = value;
	}
};

// System.Diagnostics.Tracing.SessionMask
struct SessionMask_tB8958F498570ACD71F69E13A7334D3ECD6837BDE
{
public:
	// System.UInt32 System.Diagnostics.Tracing.SessionMask::m_mask
	uint32_t ___m_mask_0;

public:
	inline static int32_t get_offset_of_m_mask_0() { return static_cast<int32_t>(offsetof(SessionMask_tB8958F498570ACD71F69E13A7334D3ECD6837BDE, ___m_mask_0)); }
	inline uint32_t get_m_mask_0() const { return ___m_mask_0; }
	inline uint32_t* get_address_of_m_mask_0() { return &___m_mask_0; }
	inline void set_m_mask_0(uint32_t value)
	{
		___m_mask_0 = value;
	}
};

// System.Double
struct Double_t358B8F23BDC52A5DD700E727E204F9F7CDE12409
{
public:
	// System.Double System.Double::m_value
	double ___m_value_0;

public:
	inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Double_t358B8F23BDC52A5DD700E727E204F9F7CDE12409, ___m_value_0)); }
	inline double get_m_value_0() const { return ___m_value_0; }
	inline double* get_address_of_m_value_0() { return &___m_value_0; }
	inline void set_m_value_0(double value)
	{
		___m_value_0 = value;
	}
};

struct Double_t358B8F23BDC52A5DD700E727E204F9F7CDE12409_StaticFields
{
public:
	// System.Double System.Double::NegativeZero
	double ___NegativeZero_7;

public


细节也不同，通 过观察12的平衡因⼦不同，这⾥我们要分三个场景讨论。

• 场景1：h >= 1时，新增结点插⼊在e⼦树，e⼦树⾼度从h-1变为h并不断更新12->15->10平衡因 ⼦，引发旋转，其中12的平衡因⼦为-1，旋转后10和12平衡因⼦为0，15平衡因⼦为1。

• 场景2：h >= 1时，新增结点插⼊在f⼦树，f⼦树⾼度从h-1变为h并不断更新12->15->10平衡因⼦， 引发旋转，其中12的平衡因⼦为1，旋转后15和12平衡因⼦为0，10平衡因⼦为-1。

• 场景3：h == 0时，a/b/c都是空树，b⾃⼰就是⼀个新增结点，不断更新15->10平衡因⼦，引发旋 转，其中12的平衡因⼦为0，旋转后10和12和15平衡因⼦均为0。

void RotateRL(Node* parent)
{
	Node* subR = parent->_right;
	Node* subRL = subR->_left;

	int bf = subRL->_bf;

	RotateR(subR);
	RotateL(parent);

	if (bf == 0)
	{
		subR->_bf = 0;
		subRL->_bf = 0;
		parent->_bf = 0;
	}
	else if (bf == -1)
	{
		subR->_bf = 1;
		subRL->_bf = 0;
		parent->_bf = 0;
	}
	else if (bf == 1)
	{
		subR->_bf = 0;
		subRL->_bf = 0;
		parent->_bf = -1;
	}
	else
		assert(false);
}

 本期博客到这里就结束了，如果有什么错误，欢迎指出，如果对你有帮助，请点个赞，谢谢！

 <p style="text-align:cen


ount, npc_templateid, locx, locy, locz, heading, respawn_delay FROM vanhalter_spawnlist Where npc_templateid = ? ORDER BY id");
			statement.setInt(1, 32038);
			final ResultSet rset = statement.executeQuery();

			L2Spawn spawnDat;
			L2NpcTemplate template1;

			while (rset.next())
			{
				template1 = NpcTable.getInstance().getTemplate(rset.getInt("npc_templateid"));
				if (template1 != null)
				{
					spawnDat = new L2Spawn(template1);
					spawnDat.setAmount(rset.getInt("count"));
					spawnDat.setLocx(rset.getInt("locx"));
					spawnDat.setLocy(rset.getInt("locy"));
					spawnDat.setLocz(rset.getInt("locz"));
					spawnDat.setHeading(rset.getInt("heading"));
					spawnDat.setRespawnDelay(rset.getInt("respawn_delay"));
					SpawnTable.getInstance().addNewSpawn(spawnDat, false);
					ritualOfferingSpawn = spawnDat;
				}
				else
				{
					LOGGER.warn("VanHalterManager.loadRitualOffering: Data missing in NPC table for ID: " + rset.getInt("npc_templateid") + ".");
				}
			}

			DatabaseUtils.close(rset);
			DatabaseUtils.close(statement);
			if (Config.DEBUG)
			{
				LOGGER.info("VanHalterManager.loadRitualOffering: Loaded Ritual Offering spawn locations.");
			}
		}
		catch (final Exception e)
		{
			// Problem with initializing spawn, go to next one
			if (Config.ENABLE_ALL_EXCEPTIONS)
			{
				e.printStackTrace();
			}

			LOGGER.warn("VanHalterManager.loadRitualOffering: Spawn could not be initialized: " + e);
		}
		finally
		{
			CloseUtil.close(con);
		}
	}

	protected void spawnRitualOffering()
	{
		ritualOffering = ritualOfferingSpawn.doSpawn();
		// ritualOffering.setIsImmobilized(true);
		ritualOffering.setIsInvul(true);
		ritualOffering.setIsParalyzed(true);
	}

	protected void deleteRitualOffering()
	{
		// ritualOffering.setIsImmobilized(false);
		ritualOffering.setIsInvul(false);
		ritualOffering.setIsParalyzed(false);
		ritualOffering.getSpawn().stopRespawn();
		ritualOffering.deleteMe();
	}

	// Load Ritual Sacrifice.
	protected void loadRitualSacrifice()
	{
		ritualSacrificeSpawn = null;

		Connection con = null;

		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			final PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay FROM vanhalter_spawnlist Where npc_templateid = ? ORDER BY id");
			statement.setInt(1, 22195);
			final ResultSet rset = statement.executeQuery();

			L2Spawn spawnDat;
			L2NpcTemplate template1;

			while (rset.next())
			{
				template1 = NpcTable.getInstance().getTemplate(rset.getInt("npc_templateid"));
				if (template1 != null)
				{
					spawnDat = new L2Spawn(template1);
					spawnDat.setAmount(rset.getInt("count"));
					spawnDat.setLocx(rset.getInt("locx"));
					spawnDat.setLocy(rset.getInt("l


            { "tig", "tigri\u0161ki" },
            { "Takr", "takri pismo" },
            { "DZ", "Al\u017eir" },
            { "pag", "pangasinan" },
            { "type.d0.hwidth", "Uski" },
            { "pal", "pahlavi" },
            { "EA", "Ceuta i Melilla" },
            { "chb", "\u010dib\u010da" },
            { "pam", "pampanga" },
            { "EC", "Ekvador" },
            { "pap", "papiamento" },
            { "ada", "adangme" },
            { "EE", "Estonija" },
            { "tiv", "tiv" },
            { "EG", "Egipat" },
            { "EH", "Zapadna Sahara" },
            { "chg", "\u010dagatajski" },
            { "pau", "palauanski" },
            { "chk", "chuukese" },
            { "chn", "chinook \u017eargon" },
            { "chm", "marijski" },
            { "chp", "chipewyan" },
            { "cho", "choctaw" },
            { "chr", "\u010derokijski" },
            { "ER", "Eritreja" },
            { "ES", "\u0160panjolska" },
            { "ET", "Etiopija" },
            { "EU", "Europska unija" },
            { "elx", "elamitski" },
            { "type.ca.gregorian", "gregorijanski kalendar" },
            { "EZ", "eurozona" },
            { "chy", "\u010dejenski" },
            { "type.nu.gujr", "gud\u017earatske znamenke" },
            { "Inds", "indijsko pismo" },
            { "ady", "adigejski" },
            { "FI", "Finska" },
            { "FJ", "Fid\u017ei" },
            { "FK", "Falklandski otoci" },
            { "FM", "Mikronezija" },
            { "key.va", "Varijanta zemlje/jezika" },
            { "FO", "Farski otoci" },
            { "Taml", "tamilsko pismo" },
            { "FR", "Francuska" },
            { "Kpel", "kpelle pismo" },
            { "tkl", "tokelaunski" },
            { "grb", "grebo" },
            { "root", "korijenski" },
            { "type.ca.indian", "indijski nacionalni kalendar" },
            { "grc", "starogr\u010dki" },
            { "GA", "Gabon" },
            { "vot", "votski" },
            { "GB", "Ujedinjeno Kraljevstvo" },
            { "pcm", "nigerijski pid\u017ein" },
            { "GD", "Grenada" },
            { "GE", "Gruzija" },
            { "GF", "Francuska Gijana" },
            { "GG", "Guernsey" },
            { "GH", "Gana" },
            { "Tale", "tai le pismo" },
            { "GI", "Gibraltar" },
            { "afh", "afrihili" },
            { "GL", "Grenland" },
            { "enm", "srednjoengleski" },
            { "GM", "Gambija" },
            { "GN", "Gvineja" },
            { "GP", "Guadalupe" },
            { "GQ", "Ekvatorska Gvineja" },
            { "GR", "Gr\u010dka" },
            {


class SaveOptions(object,IDisposable):
 """
 This class contains options available for saving a document to disk.

 SaveOptions()
 """
 def Dispose(self):
  """ Dispose(self: SaveOptions) """
  pass
 def ReleaseUnmanagedResources(self,*args):
  """ ReleaseUnmanagedResources(self: SaveOptions,disposing: bool) """
  pass
 def __enter__(self,*args):
  """ __enter__(self: IDisposable) -> object """
  pass
 def __exit__(self,*args):
  """ __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
  pass
 def __init__(self,*args):
  """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
  pass
 def __repr__(self,*args):
  """ __repr__(self: object) -> str """
  pass
 Compact=property(lambda self: object(),lambda self,v: None,lambda self: None)
 """Default is false: let the OS eliminate as much or as little dead data as it wants to.

   True: force the OS to eliminate all dead data from the file on disk.

Get: Compact(self: SaveOptions) -> bool

Set: Compact(self: SaveOptions)=value

"""

 IsValidObject=property(lambda self: object(),lambda self,v: None,lambda self: None)
 """Specifies whether the .NET object represents a valid Revit entity.

Get: IsValidObject(self: SaveOptions) -> bool

"""

 PreviewViewId=property(lambda self: object(),lambda self,v: None,lambda self: None)
 """The view id that will be used to generate the preview; this id is not saved to the document's permanent settings.

Get: PreviewViewId(self: SaveOptions) -> ElementId

Set: PreviewViewId(self: SaveOptions)=value

"""


() {
        val deeplinkUriTemplate = DeepLinkUri.parse("http{scheme_suffix}://www.example.{url_domain_suffix}/path1/path2")
        assertNull(deeplinkUriTemplate)
    }

    @Test
    fun testParseDeepLinkUriTemplate() {
        val deeplinkUriTemplate = DeepLinkUri.parseTemplate("http{scheme_suffix}://www.example.{url_domain_suffix}/path1/path2")
        assertNotNull(deeplinkUriTemplate)
        assertEquals("http{scheme_suffix}", deeplinkUriTemplate.scheme())
        assertEquals("www.example.{url_domain_suffix}", deeplinkUriTemplate.host())
        assertEquals(listOf("path1", "path2"), deeplinkUriTemplate.pathSegments())
    }

    @Test
    fun testParseDeepLinkUriTemplateWithVeryLongHost() {
        val host =
            "www.example.{url_domain_suffix(just|a|lot|of|values|in|here|that|make|the|url|very|long|longer|than|264|characters|to|be|creating|some|problems|with|ID|decode)}"
        val deeplinkUriTemplate = DeepLinkUri.parseTemplate("http{scheme_suffix}://$host/path1/path2")
        assertNotNull(deeplinkUriTemplate)
        assertEquals("http{scheme_suffix}", deeplinkUriTemplate.scheme())
        assertEquals(host, deeplinkUriTemplate.host())
        assertEquals(listOf("path1", "path2"), deeplinkUriTemplate.pathSegments())
    }

    @Test
    fun testParseDeepLinkUriTemplateWithOnlyPlaceholderAsHostAndScheme() {
        val deeplinkUriTemplate = DeepLinkUri.parseTemplate("{scheme}://{host}/path1/path2")
        assertNotNull(deeplinkUriTemplate)
        assertEquals("{scheme}", deeplinkUriTemplate.scheme())
        assertEquals("{host}", deeplinkUriTemplate.host())
        assertEquals(listOf("path1", "path2"), deeplinkUriTemplate.pathSegments())
    }

    @Test
    fun testParseDeepLinkUriTemplateWithOnlyPlaceholderAsHostAndSchemeWithInvalidSchemeCharInPlaceholder() {
        val deeplinkUriTemplate = DeepLinkUri.parseTemplate("{scheme_test}://{host}/path1/path2")
        assertNotNull(deeplinkUriTemplate)
        assertEquals("{scheme_test}", deeplinkUriTemplate.scheme())
        assertEquals("{host}", deeplinkUriTemplate.host())
        assertEquals(listOf("path1", "path2"), deeplinkUriTemplate.pathSegments())
    }
}
package com.airbnb.deeplinkdispatch

import android.content.Intent
import androidx.core.app.TaskStackBuilder
import com.airbnb.deeplinkdispatch.handler.DeepLinkHandler

data class DeepLinkResult(
    /**
     * @return whether or not the dispatch was a success.
     */
    val isSuccessful: Boolean,
    val uriString: String? = null,
    val error: String = "",
    val errorThrowable: Throwable? = null,
    val deepLinkMatchResult: DeepLinkMatchResult? = null,
    val methodResult: DeepLinkMethodResult = DeepLinkMethodResult(null, null),
    val parameters: Map<String, String> = emptyMap(),
    val deepLinkHandlerResult: DeepLinkHandlerResult<Any>? = null,
) {
    /**
     * This exists so that calls from Kotlin code [error()] are maintained across major version 4.
     * This will be removed in DLD 5.x.x
     */
    fun error(): String? = error

    override fun toString(): String {
        return (
            "DeepLinkResult{" +
                "successful=" + isSuccessful +
                ", uriString=" + uriString +
                ", error='" + error + '\''.toString() +
                '}'.toString()
            )
    }
}

/**
 * Can be used to return from any deeplink annotated method. Whatever entry is null will be used.
 * If both are not null we will use the taskStackBuilder.
 */
data class DeepLinkMethodResult(
    val intent: Intent? = null,
    val taskSta


 strokeWidth,
  }) {
    return _BatteryFullPainter(
      color: color,
      animationValue: animationValue,
      strokeWidth: strokeWidth,
    );
  }
}

class _BatteryFullPainter extends CustomPainter {
  final Color color;
  final double animationValue;
  final double strokeWidth;

  _BatteryFullPainter({
    required this.color,
    required this.animationValue,
    required this.strokeWidth,
  });

  @override
  void paint(Canvas canvas, Size size) {
    final paint = Paint()
      ..color = color
      ..strokeWidth = strokeWidth
      ..strokeCap = StrokeCap.round
      ..strokeJoin = StrokeJoin.round
      ..style = PaintingStyle.stroke;

    final scale = size.width / 24.0;

    // Phases
    // 0.0: static
    // 0.0-0.1: fade out
    // 0.1-0.45: case
    // 0.45-0.6: terminal
    // 0.6-0.75: bar1
    // 0.75-0.9: bar2
    // 0.9-1.0: bar3

    if (animationValue == 0.0) {
      _drawComplete(canvas, scale, paint);
      return;
    }

    if (animationValue > 0.0 && animationValue <= 0.1) {
      final p = animationValue / 0.1;
      final fadePaint = Paint()
        ..color = color.withValues(alpha: 1.0 - p)
        ..strokeWidth = strokeWidth
        ..strokeCap = StrokeCap.round
        ..strokeJoin = StrokeJoin.round
        ..style = PaintingStyle.stroke;
      _drawComplete(canvas, scale, fadePaint);
      return;
    }

    final t = (animationValue - 0.1) / 0.9;

    // Case
    if (t >= 0.0) {
      final caseProgress = (t / 0.35).clamp(0.0, 1.0);
      _drawCaseAnimated(canvas, scale, paint, caseProgress);
    }

    // Terminal
    if (t >= 0.35) {
      final termProgress = ((t - 0.35) / 0.15).clamp(0.0, 1.0);
      _drawTerminalAnimated(canvas, scale, paint, termProgress);
    }

    // Bars
    if (t >= 0.5) {
      final p1 = ((t - 0.5) / 0.15).clamp(0.0, 1.0);
      _drawBar(canvas, scale, paint, x: 6, progress: p1);
    }
    if (t >= 0.65) {
      final p2 = ((t - 0.65) / 0.15).clamp(0.0, 1.0);
      _drawBar(canvas, scale, paint, x: 10, progress: p2);
    }
    if (t >= 0.8) {
      final p3 = ((t - 0.8) / 0.2).clamp(0.0, 1.0);
      _drawBar(canvas, scale, paint, x: 14, progress: p3);
    }
  }

  void _drawComplete(Canvas canvas, double scale, Paint paint) {
    // Solid rounded rectangle frame (no cutouts), like SVG rect
    final rect = RRect.fromRectAndRadius(
      Rect.fromLTWH(2 * scale, 6 * scale, 16 * scale, 12 * scale),
      Radius.circular(2 * scale),
    );
    canvas.drawRRect(rect, paint);

    // Terminal
    canvas.drawLine(
      Offset(22 * scale, 14 * scale),
      Offset(22 * scale, 10 * scale),
      paint,
    );
    // Bars
    canvas.drawLine(
        Offset(6 * scale, 10 * scale), Offset(6 * scale, 14 * scale), paint);
    canvas.drawLine(
        Offset(10 * scale, 10 * scale), Offset(10 * scale, 14 * scale), paint);
    canvas.drawLine(
        Offset(14 * scale, 10 * scale), Offset(14 * scale, 14 * scale), paint);
  }

  void _drawCaseAnimated(
      Canvas canvas, double scale, Paint paint, double progress) {
    final center = Offset(10 * scale, 12 * scale);
    canvas.save();
    canvas.translate(center.dx, center.dy);
    canvas.scale(progress);
    fina


, REALM);
        try {
            new LoginContext("Refreshable", handler).login();
            throw new RuntimeException("Expected exception not thrown");
        } catch (LoginException le) {
            System.out.println("Expected login failure: " + le);
        }

        // reset properties
        System.out.println("Reset java.security.krb5.kdc");
        System.clearProperty("java.security.krb5.kdc");
        System.out.println("Reset java.security.krb5.realm");
        System.clearProperty("java.security.krb5.realm");

        // login with not-refreshable config
        try {
            new LoginContext("NotRefreshable", handler).login();
            throw new RuntimeException("Expected exception not thrown");
        } catch (LoginException le) {
            System.out.println("Expected login failure: " + le);
        }

        // login with refreshable config
        new LoginContext("Refreshable", handler).login();

        System.out.println("Test passed");
    }

}
/*
 * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

package java.rmi;

/**
 * A StubNotFoundException is thrown if a valid stub class
 * could not be found for a remote object when it is exported.
 * A StubNotFoundException may also be
 * thrown when an activatable object is registered via the
 * java.rmi.activation.Activatable.register method.
 *
 * @author  Roger Riggs
 * @since   JDK1.1
 * @see     java.rmi.server.UnicastRemoteObject
 * @see     java.rmi.activation.Activatable
 */
public class StubNotFoundException extends RemoteException {

    /* indicate compatibility with JDK 1.1.x version of class */
    private static final long serialVersionUID = -7088199405468872373L;

    /**
     * Constructs a StubNotFoundException with the specified
     * detail message.
     *
     * @param s the detail message
     * @since JDK1.1
     */
    public StubNotFoundException(String s) {
        super(s);
    }

    /**
     * Constructs a StubNotFoundException with the specified
     * detail message and nested exception.
     *
     * @param s the detail message
     * @param ex the nested exception
     * @since JDK1.1
     */
    public StubNotFoundException(String s, Exception ex) {
        super(s, ex);
    }
}
/*
 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code


local PLUGIN = PLUGIN

SWEP.Base = "exp_tacrp_base"
SWEP.Spawnable = true

AddCSLuaFile()

-- names and stuff
SWEP.PrintName = "Ingram MAC-10"
SWEP.AbbrevName = "MAC-10"
SWEP.Category = "Tactical RP" -- "Tactical RP (Extras)"

SWEP.SubCatTier = "4Consumer"
SWEP.SubCatType = "2Machine Pistol"

SWEP.Description = "A bullet hose best used for point blank spray-and-pray."

SWEP.Trivia_Caliber = "9x19mm"
SWEP.Trivia_Manufacturer = "Military Armament Corporation"
SWEP.Trivia_Year = "1970"

SWEP.Faction = PLUGIN.FACTION_MILITIA
SWEP.Credits = [[
Model/Texture: Enron
Sound: Vunsunta,  Erick F
Animations: Tactical Intervention]]

SWEP.ViewModel = "models/weapons/tacint_extras/v_mac10.mdl"
SWEP.WorldModel = "models/weapons/tacint_extras/w_mac10.mdl"

SWEP.Slot = 1

SWEP.BalanceStats = {
	[PLUGIN.BALANCE_SBOX] = {
		Damage_Max = 20,
		Damage_Min = 5,
		ClipSize = 40,

		RecoilKick = 4,
	},
	[PLUGIN.BALANCE_TTT] = {
		Damage_Max = 10,
		Damage_Min = 4,
		Range_Min = 100,
		Range_Max = 1400,
		RPM = 900,

		Spread = 0.014,
		HipFireSpreadPenalty = 0.01,
		RecoilSpreadPenalty = 0.0035,
		RecoilMaximum = 18,
		RecoilDissipationRate = 30,
		RecoilResetTime = 0.15,
		RecoilFirstShotMult = 2,

		BodyDamageMultipliers = {
			[HITGROUP_HEAD] = 2,
			[HITGROUP_CHEST] = 1,
			[HITGROUP_STOMACH] = 1,
			[HITGROUP_LEFTARM] = 0.9,
			[HITGROUP_RIGHTARM] = 0.9,
			[HITGROUP_LEFTLEG] = 0.75,
			[HITGROUP_RIGHTLEG] = 0.75,
			[HITGROUP_GEAR] = 0.9
		},
	},
	[PLUGIN.BALANCE_PVE] = {
		Damage_Max = 5,
		Damage_Min = 2,

		RecoilKick = 2,
		RecoilMaximum = 18,
	},
	[PLUGIN.BALANCE_OLDSCHOOL] = {
		RecoilSpreadPenalty = 0.004,
		RecoilMaximum = 25
	}
}

-- "ballistics"

SWEP.Damage_Max = 18
SWEP.Damage_Min = 5
SWEP.Range_Min = 300
SWEP.Range_Max = 1500
SWEP.Penetration = 3
SWEP.ArmorPenetration = 0.45
SWEP.ArmorBonus = 0.25

SWEP.MuzzleVelocity = 10000

SWEP.BodyDamageMultipliers = {
	[HITGROUP_HEAD] = 1.5,
	[HITGROUP_CHEST] = 1,
	[HITGROUP_STOMACH] = 1,
	[HITGROUP_LEFTARM] = 1,
	[HITGROUP_RIGHTARM] = 1,
	[HITGROUP_LEFTLEG] = 0.75,
	[HITGROUP_RIGHTLEG] = 0.75,
	[HITGROUP_GEAR] = 0.9
}

-- misc. shooting

SWEP.Firemode = 2


NameRequestDto dto);
}
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.oszero.deliver.business.admin.constant.messageparam;

/**
 * @author oszero
 * @version 1.0.0
 */
public interface DingMessageParam {
    // 工作通知
    String WORK_NOTICE_TEXT_PARAM = """
            {
              "userIdType": "userid_list 或者 dept_id_list 或者 to_all_user",
              "msg": {
                "text": {
                  "content": "月会通知"
                }
              }
            }
            """;
    String WORK_NOTICE_IMAGE_PARAM = """
            {
              "userIdType": "userid_list 或者 dept_id_list 或者 to_all_user",
              "msg": {
                "image": {
                  "media_id": "@lADOADmaWMzazQKA"
                }
              }
            }
            """;
    String WORK_NOTICE_VOICE_PARAM = """
            {
              "userIdType": "userid_list 或者 dept_id_list 或者 to_all_user",
              "msg": {
                "voice": {
                  "media_id": "@lADOADmaWMzazQKA",
                  "duration": "10"
                }
              }
            }
            """;
    String WORK_NOTICE_FILE_PARAM = """
            {
              "userIdType": "userid_list 或者 dept_id_list 或者 to_all_user",
              "msg": {
                "file": {
                  "media_id": "MEDIA_ID"
                }
              }
            }
            """;
    String WORK_NOTICE_LINK_PARAM = """
            {
              "userIdType": "userid_list 或者 dept_id_list 或者 to_all_user",
              "msg": {
                "link": {
                  "messageUrl": "http://s.dingtalk.com/market/dingtalk/error_code.php",
                  "picUrl":"@lALOACZwe2Rk",
                  "title": "测试",
                  "text": "测试"
                }
              }
            }
            """;
    String WORK_NOTICE_OA_PARAM = """
            {
              "userIdType": "userid_list 或者 dept_id_list 或者 to_all_user",
              "msg": {
                "oa": {
                  "message_url": "http://dingtalk.com",
                  "head": {
                    "bgcolor": "FFBBBBBB",
                    "text": "头部标题"
                  },
                  "body": {
                    "title": "正文标题",
                    "form": [
                      {
                        "key": "姓名:",
                        "value": "张三"
                      },
                      {
                        "key": "年龄:",
                        "value": "20"
                      },
                      {
                        "key": "身高:",
                        "value": "1.8米"
                      },


�其在电力数据集上表现极好 |

### 2.3.3 CSDI

Conditional Score-based Diffusion Models for Probabilistic Time Series Imputation (2021)

#### 📌 与 TimeGrad / ScoreGrad 的不同点？

| 项目               | TimeGrad / ScoreGrad          | CSDI                                   |
| ------------------ | ----------------------------- | -------------------------------------- |
| 任务               | 预测未来时间点                | 补全任意缺失值（预测过去、现在或未来） |
| 条件信息编码       | 用 RNN 或其他模型编码历史信息 | 用 Transformer 编码条件位置            |
| 是否按时间顺序生成 | 是（autoregressive）          | 否，可以并行补全多个位置               |
| 特点               | 适合 forecasting              | 适合 imputation（带 mask）             |

### 2.3.4 DSPD & CSPD

DSPD & CSPD: Modeling Temporal Data as Continuous Functions with Process Diffusion (2022)

#### ❓问题 1：

**“TimeGrad 和 DSPD 除了噪声改动外，是否其他方面是相似的？”**

#### ✅ 表面上的相似性：

- **RNN 提取历史条件 z**：两者都使用 RNN 编码历史序列，作为预测未来序列的条件向量。
- **预测目标一致**：都用于多步时间序列预测任务。
- **架构均基于 DDPM 思路（反向预测）**：通过多个反向扩散步骤来逐步构建未来时间点的预测。
- **使用重参数化技术预测噪声 ε**。
- **优化目标函数形式一致**（如 Equation 48 所示）。

#### ❗本质性差异：

1. **噪声建模方式根本不同**：
   - **TimeGrad** 采用 *独立同分布（i.i.d）* 噪声（通常是标准正态分布）。
   - **DSPD** 采用 *时间相关的高斯过程噪声*，即 $\epsilon(\cdot) \sim \mathcal{GP}$，并假设噪声在不同时间步间有结构性相关性。
   - 这导致模型生成序列时具有更平滑、连贯的行为。
2. **多步联合预测 vs 单步递归预测**：
   - **TimeGrad** 主要是单步预测再递归多步。
   - **DSPD** 在架构上进行了改进，可以一次性预测多个时间点（见第一张图第二段：“...predict multiple values at the same time...”）。
3. **输入建模维度变化**：
   - DSPD 使用 2D 卷积（替代 RNN 的堆叠结构）处理时间序列，以提升并行性。
   - TimeGrad 使用标准 RNN 结构逐步编码序列。

> ✅ **结论**：虽然 TimeGrad 和 DSPD 在目标和部分架构上相似，但 DSPD 通过改变噪声建模方式 + 并行多步预测机制，对原始架构进行了关键性的提升。它不是一个简单“加上 GP”的 TimeGrad，而是一个从噪声建模到计算效率都做了全面优化的系统。

#### ❓问题


components.support.ktx.android.net

import android.content.ContentResolver
import android.database.Cursor
import android.webkit.MimeTypeMap
import androidx.core.net.toUri
import androidx.test.ext.junit.runners.AndroidJUnit4
import mozilla.components.support.test.mock
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers.anyInt
import org.mockito.Mockito.any
import org.mockito.Mockito.doReturn
import org.robolectric.Shadows

@RunWith(AndroidJUnit4::class)
class UriTest {

    @Test
    fun hostWithoutCommonPrefixes() {
        assertEquals(
            "mozilla.org",
            "https://www.mozilla.org".toUri().hostWithoutCommonPrefixes,
        )

        assertEquals(
            "twitter.com",
            "https://mobile.twitter.com/home".toUri().hostWithoutCommonPrefixes,
        )

        assertNull("".toUri().hostWithoutCommonPrefixes)

        assertEquals(
            "",
            "http://".toUri().hostWithoutCommonPrefixes,
        )

        assertEquals(
            "facebook.com",
            "https://m.facebook.com/".toUri().hostWithoutCommonPrefixes,
        )

        assertEquals(
            "github.com",
            "https://github.com/mozilla-mobile/android-components".toUri().hostWithoutCommonPrefixes,
        )
    }

    @Test
    fun testIsHttpOrHttps() {
        // No value
        assertFalse("".toUri().isHttpOrHttps)

        // Garbage
        assertFalse("lksdjflasuf".toUri().isHttpOrHttps)

        // URLs with http/https
        assertTrue("https://www.google.com".toUri().isHttpOrHttps)
        assertTrue("http://www.facebook.com".toUri().isHttpOrHttps)
        assertTrue("https://mozilla.org/en-US/firefox/products/".toUri().isHttpOrHttps)

        // IP addresses
        assertTrue("https://192.168.0.1".toUri().isHttpOrHttps)
        assertTrue("http://63.245.215.20/en-US/firefox/products".toUri().isHttpOrHttps)

        // Other protocols
        assertFalse("ftp://people.mozilla.org".toUri().isHttpOrHttps)
        assertFalse("javascript:window.google.com".toUri().isHttpOrHttps)
        assertFalse("tel://1234567890".toUri().isHttpOrHttps)

        // No scheme
        assertFalse("google.com".toUri().isHttpOrHttps)
        assertFalse("git@github.com:mozilla/gecko-dev.git".toUri().isHttpOrHttps)
    }

    @Test
    fun testIsInScope() {
        val url = "https://mozilla.github.io/my-app/".toUri()
        val prefix = "https://mozilla.github.io/prefix-of/resource.html".toUri()
        assertFalse(url.isInScope(emptyList()))
        assertTrue(url.isInScope(listOf("https://mozilla.github.io/my-app/".toUri())))
        assertFalse(url.isInScope(listOf("https://firefox.com/out-of-scope/".toUri())))
        assertFalse(url.isInScope(listOf("https://mozilla.github.io/my-app-almost-in-scope".toUri())))
        assertTrue(prefix.isInScope(listOf("https://mozilla.github.io/prefix".toUri())))
        assertTrue(prefix.isInScope(listOf("https://mozilla.github.io/prefix-of/".toUri())))
    }

    @Test
    fun testSameSchemeAndHostAs() {
        // Host mismatch.
        assertFalse("https:/


0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.koin.mp

import org.koin.core.context.KoinContext
import org.koin.core.logger.Level
import org.koin.core.logger.Logger
import kotlin.reflect.KClass
import kotlin.uuid.ExperimentalUuidApi
import kotlin.uuid.Uuid

expect object KoinPlatformTools {
    fun getStackTrace(e: Exception): String
    fun getClassName(kClass: KClass<*>): String
    fun getClassFullNameOrNull(kClass: KClass<*>): String?
    fun defaultLazyMode(): LazyThreadSafetyMode
    fun defaultLogger(level: Level = Level.INFO): Logger
    fun defaultContext(): KoinContext
    fun <R> synchronized(lock: Lockable, block: () -> R): R
    fun <K, V> safeHashMap(): MutableMap<K, V>
    fun <K> safeSet(): MutableSet<K> // safe only in JVM for now
}

fun KoinPlatformTools.getKClassDefaultName(kClass: KClass<*>) : String = "KClass@${kClass.hashCode()}"
@OptIn(ExperimentalUuidApi::class)
expect fun KoinPlatformTools.generateId() : String

/*
 * Copyright 2017-Present the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.koin.dsl

import org.koin.core.definition.Callbacks
import org.koin.core.definition.KoinDefinition
import org.koin.core.definition.OnCloseCallback
import org.koin.core.definition.indexKey
import org.koin.core.module.OptionDslMarker
import kotlin.reflect.KClass

/**
 * BeanDefinition DSL specific functions
 *
 * @author Arnaud Giuliani
 */

/**
 * Add a compatible type to match for definition
 * @param clazz
 */
@OptionDslMarker
infix fun <S : Any> KoinDefinition<out S>.bind(clazz: KClass<S>): KoinDefinition<out S> {
    factory.beanDefinition.secondaryTypes = factory.beanDefinition.secondaryTypes + clazz
    val mapping = indexKey(clazz, factory.beanDefinition.qualifier, factory.beanDefinition.scopeQualifier)
    module.saveMapping(mapping, factory)
    return this
}

/**
 * Add a compatible type to match for definition
 *
 * Type-safety may be checked by "checkModules" from "koin-test" module.
 */
@OptionDslMarker
inline fun <reified S : Any> KoinDefinition<out S>.bind(): KoinDefinition<out S> {
    bind(clazz = S::class)
    return this
}

/**
 * Add compatible types to match for definition
 *
 * Type-safety may be checked by "checkModules" from "koin-test" module.
 *
 * @param classes
 */
@OptionDslMarker
infix fun KoinDefinition<*>.binds(classes: Array<KClass<*>>): KoinDefinition<*> {
    factory.beanDefinition.secondaryTypes += classes
    classes.forEach { clazz -


ValidLinks = getNumberValidLinks(legend);
            if (nbValidLinks < links.length) {
                dispose(legend.getIdentifier());
                updateLinks(legend, nbValidLinks);
            }

            if (nbValidLinks > 0) {
                Texture legendSprite = getTexture(colorMap, legend);
                return legendSprite.getDataProvider().getTextureSize();
            }
        }

        return null;
    }

    /**
     * Draws the given Legend.
     * @param legend the Legend to draw.
     * @throws SciRendererException if the draw fail.
     */
    public void draw(Legend legend) throws SciRendererException {
        /* The coordinates of the legend box's lower-left corner */
        double[] legendCorner = new double[] {0.25, 0.75, Z_FRONT};

        DrawingTools drawingTools = visitor.getDrawingTools();
        ColorMap colorMap = visitor.getColorMap();
        Canvas canvas = visitor.getCanvas();

        Integer[] links = legend.getLinks();

        /*
         * Determine whether any links have become invalid,
         * force the sprite's update and update the Legend's
         * links property as needed.
         */
        int nbValidLinks = getNumberValidLinks(legend);

        if (nbValidLinks < links.length) {
            dispose(legend.getIdentifier());
            updateLinks(legend, nbValidLinks);
        }

        links = legend.getLinks();

        /*
         * Set the projection and modelview transformations so that coordinates
         * are specified in the {0,+1,0,+1,0,+1} space.
         */
        TransformationStack modelViewStack = drawingTools.getTransformationManager().getModelViewStack();
        TransformationStack projectionStack = drawingTools.getTransformationManager().getProjectionStack();

        Transformation identity = TransformationFactory.getIdentity();
        modelViewStack.push(identity);

        Transformation orthoProj = TransformationFactory.getOrthographic(0.0, 1.0, 0.0, 1.0, -1.0, 0.0);
        projectionStack.push(orthoProj);

        /* First, compute the legend box's position and dimensions from the Axes' parameters and the text sprite's dimensions */

        Integer parentAxesID = legend.getParentAxes();
        Axes parentAxes = (Axes) GraphicController.getController().getObjectFromId(parentAxesID);

        Double[] axesBounds = parentAxes.getAxesBounds();
        Double[] margins = parentAxes.getMargins();

        int xAxisLocation = parentAxes.getXAxisLocation();
        int yAxisLocation = parentAxes.getYAxisLocation();

        int canvasWidth = canvas.getWidth();
        int canvasHeight = canvas.getHeight();

        if (canvasWidth == 0) {
            canvasWidth = 1;
        }

        if (canvasHeight == 0) {
            canvasHeight = 1;
        }

        Texture legendSprite = null;
        double normSpriteWidth = 0;
        double normSpriteHeight = 0;

        if (nbValidLinks > 0) {
            legendSprite = getTexture(colorMap, legend);
            Dimension textureSize = legendSprite.getDataProvider().getTextureSize();
            normSpriteWidth = textureSize.getWidth() / (double) canvasWidth;
            normSpriteHeight = textureSize.getHeight() / (double) canvasHeight;
        }

        double lineWidth;

        /* The legend box's width and height */
        double[] legendDims = new double[2];

        double[] axesPos = new double[2];
        double[] axesDims = new double[2];

        line


age = e => {
            if (e.data.rowsDone !== undefined) processedRows[t] = e.data.rowsDone;
            if (e.data.done) {
                const { A, B, startY, endY } = e.data;
                for (let y = startY; y < endY; y++) {
                    let rowIdx = y * w * 4, partRowIdx = (y - startY) * w * 4;
                    resultA.set(A.slice(partRowIdx, partRowIdx + w * 4), rowIdx);
                    resultB.set(B.slice(partRowIdx, partRowIdx + w * 4), rowIdx);
                }
                processedRows[t] = endY - startY;
                workersDone++;
                if (workersDone === threads) {
                    console.log("w:", w, "h:", h);
                    console.log("resultA.length:", resultA.length, "expected:", w * h * 4);
                    console.log("resultB.length:", resultB.length, "expected:", w * h * 4);

                    progressBar.value = 100;

                    const formatExt = format === "jpeg" ? "jpg" : format;
                    const checkbox = document.getElementById('mergeSideBySide');

                    if (checkbox.checked) {
                        // 拼接为单图导出
                        let mergedWidth = w * 2;
                        let mergedHeight = h;
                        let mergedPixels = new Uint8ClampedArray(mergedWidth * mergedHeight * 4);

                        // 把 resultA 拷贝到左边
                        for (let y = 0; y < h; y++) {
                            for (let x = 0; x < w; x++) {
                                const srcIdx = (y * w + x) * 4;
                                const dstIdx = (y * mergedWidth + x) * 4;
                                mergedPixels[dstIdx]     = resultA[srcIdx];
                                mergedPixels[dstIdx + 1] = resultA[srcIdx + 1];
                                mergedPixels[dstIdx + 2] = resultA[srcIdx + 2];
                                mergedPixels[dstIdx + 3] = resultA[srcIdx + 3];
                            }
                        }

                        // 把 resultB 拷贝到右边
                        for (let y = 0; y < h; y++) {
                            for (let x = 0; x < w; x++) {
                                const srcIdx = (y * w + x) * 4;
                                const dstIdx = (y * mergedWidth + (x + w)) * 4;
                                mergedPixels[dstIdx]     = resultB[srcIdx];
                                mergedPixels[dstIdx + 1] = resultB[srcIdx + 1];
                                mergedPixels[dstIdx + 2] = resultB[srcIdx + 2];
                                mergedPixels[dstIdx + 3] = resultB[srcIdx + 3];
                            }
                        }

                        // 使用已有 saveImage 函数导出
                        saveImage(mergedPixels, mergedWidth, mergedHeight, baseName + "_diff." + formatExt, format);

                        setProcessingState('startBtn', false, "开始加密");
                        alert(`生成成功：\n${baseName}_diff.${formatExt}\n\n要还原原图，请在 Photoshop 等程序中将图片左右分割为两个相等的图层（不完全相等也能还原，只是边上会是乱码），将在上面那张设置为“差值（Difference）”模式，移动至完全重叠或能清晰看到原图。`);
                    } else {
                        // 分别导出 A 和 B
                        saveImage(resultA, w, h, baseName +


PartNo,
             localLogFilePtr.p->fileNo,
             localGcpPtr.p->gcpId);
  }
  for (Ti = 0; Ti < clogPartFileSize; Ti++) {
    jam();
    if (localGcpPtr.p->gcpSyncReady[Ti] == ZFALSE) {
      jam();
      return;
    }//if
  }//for

#ifdef GCP_TIMER_HACK
  NdbTick_getMicroTimer(&globalData.gcp_timer_save[1]);
#endif

  GCPSaveConf * const saveConf = (GCPSaveConf *)&signal->theData[0];
  saveConf->dihPtr = localGcpPtr.p->gcpUserptr;
  saveConf->nodeId = getOwnNodeId();
  saveConf->gci    = localGcpPtr.p->gcpId;
  sendSignal(localGcpPtr.p->gcpBlockref, GSN_GCP_SAVECONF, signal,
	     GCPSaveConf::SignalLength, JBA);
  ccurrentGcprec = RNIL;
}//Dblqh::execFSSYNCCONF()

/* ######################################################################### */
/* #######                            FILE HANDLING MODULE           ####### */
/*                                                                           */
/* ######################################################################### */
/*       THIS MODULE HANDLES RESPONSE MESSAGES FROM THE FILE SYSTEM          */
/* ######################################################################### */
/* ######################################################################### */
/*       SIGNAL RECEPTION MODULE                                             */
/*       THIS MODULE IS A SUB-MODULE OF THE FILE SYSTEM HANDLING.            */
/*                                                                           */
/*  THIS MODULE CHECKS THE STATE AND JUMPS TO THE PROPER PART OF THE FILE    */
/*  HANDLING MODULE.                                                         */
/* ######################################################################### */
/* *************** */
/*  FSCLOSECONF  > */
/* *************** */
void Dblqh::execFSCLOSECONF(Signal* signal)
{
  jamEntry();
  logFilePtr.i = signal->theData[0];
  ptrCheckGuard(logFilePtr, clogFileFileSize, logFileRecord);
  logFilePtr.p->fileRef = RNIL;

  if (DEBUG_REDO)
  {
    logPartPtr.i = logFilePtr.p->logPartRec;
    ptrCheckGuard(logPartPtr, clogPartFileSize, logPartRecord);
    ndbout_c("part: %u file: %u CLOSE CONF",
             logPartPtr.p->logPartNo,
             logFilePtr.p->fileNo);
  }

  switch (logFilePtr.p->logFileStatus) {
  case LogFileRecord::CLOSE_SR_READ_INVALIDATE_PAGES:
    jam();
    logFilePtr.p->logFileStatus = LogFileRecord::CLOSED;

    logPartPtr.i = logFilePtr.p->logPartRec;
    ptrCheckGuard(logPartPtr, clogPartFileSize, logPartRecord);

    readFileInInvalidate(signal, 2);
    return;

  case LogFileRecord::CLOSE_SR_READ_INVALIDATE_SEARCH_FILES:
    jam();
    logFilePtr.p->logFileStatus = LogFileRecord::CLOSED;

    logPartPtr.i = logFilePtr.p->logPartRec;
    ptrCheckGuard(logPartPtr, clogPartFileSize, logPartRecord);

    readFileInInvalidate(signal, 4);
    return;
  case LogFileRecord::CLOSE_SR_READ_INVALIDATE_SEARCH_LAST_FILE:
    logFilePtr.p->logFileStatus = LogFileRecord::CLOSED;

    logPartPtr.i = logFilePtr.p->logPartRec;
    ptrCheckGuard(logPartPtr, clogPartFileSize, logPa


proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package

// BlockIdFlag indicates which BlockID the signature is for
type BlockIDFlag int32

const (
	BlockIDFlagUnknown BlockIDFlag = 0
	BlockIDFlagAbsent  BlockIDFlag = 1
	BlockIDFlagCommit  BlockIDFlag = 2
	BlockIDFlagNil     BlockIDFlag = 3
)

var BlockIDFlag_name = map[int32]string{
	0: "BLOCK_ID_FLAG_UNKNOWN",
	1: "BLOCK_ID_FLAG_ABSENT",
	2: "BLOCK_ID_FLAG_COMMIT",
	3: "BLOCK_ID_FLAG_NIL",
}

var BlockIDFlag_value = map[string]int32{
	"BLOCK_ID_FLAG_UNKNOWN": 0,
	"BLOCK_ID_FLAG_ABSENT":  1,
	"BLOCK_ID_FLAG_COMMIT":  2,
	"BLOCK_ID_FLAG_NIL":     3,
}

func (x BlockIDFlag) String() string {
	return proto.EnumName(BlockIDFlag_name, int32(x))
}

func (BlockIDFlag) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_4e92274df03d3088, []int{0}
}

type ValidatorSet struct {
	Validators       []*Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty"`
	Proposer         *Validator   `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty"`
	TotalVotingPower int64        `protobuf:"varint,3,opt,name=total_voting_power,json=totalVotingPower,proto3" json:"total_voting_power,omitempty"`
}

func (m *ValidatorSet) Reset()         { *m = ValidatorSet{} }
func (m *ValidatorSet) String() string { return proto.CompactTextString(m) }
func (*ValidatorSet) ProtoMessage()    {}
func (*ValidatorSet) Descriptor() ([]byte, []int) {
	return fileDescriptor_4e92274df03d3088, []int{0}
}
func (m *ValidatorSet) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *ValidatorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_ValidatorSet.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (m *ValidatorSet) XXX_Merge(src proto.Message) {
	xxx_messageInfo_ValidatorSet.Merge(m, src)
}
func (m *ValidatorSet) XXX_Size() int {
	return m.Size()
}
func (m *ValidatorSet) XXX_DiscardUnknown() {
	xxx_messageInfo_ValidatorSet.DiscardUnknown(m)
}

var xxx_messageInfo_ValidatorSet proto.InternalMessageInfo

func (m *ValidatorSet) GetValidators() []*Validator {
	if m != nil {
		return m.Validators
	}
	return nil
}

func (m *ValidatorSet) GetProposer() *Validator {
	if m != nil {
		return m.Proposer
	}
	return nil
}

func (m *ValidatorSet) GetTotalVotingPower() int64 {
	if m != nil {
		return m.TotalVotingPower
	}
	return 0
}

type Validator struct {
	Address          []byte           `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	PubKey           crypto.PublicKey `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key"`
	VotingPower      int64            `protobuf:"varint,3,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"`
	ProposerPriority int64            `protobuf:"varint,4,opt,name=proposer_priority,


/*
 *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

/*
 * This header file includes the VAD API calls. Specific function calls are given below.
 */

#ifndef WEBRTC_COMMON_AUDIO_VAD_INCLUDE_WEBRTC_VAD_H_  // NOLINT
#define WEBRTC_COMMON_AUDIO_VAD_INCLUDE_WEBRTC_VAD_H_

#include "webrtc/typedefs.h"

typedef struct WebRtcVadInst VadInst;

#ifdef __cplusplus
extern "C" {
#endif

// Creates an instance to the VAD structure.
//
// - handle [o] : Pointer to the VAD instance that should be created.
//
// returns      : 0 - (OK), -1 - (Error)
int WebRtcVad_Create(VadInst** handle);

// Frees the dynamic memory of a specified VAD instance.
//
// - handle [i] : Pointer to VAD instance that should be freed.
//
// returns      : 0 - (OK), -1 - (NULL pointer in)
int WebRtcVad_Free(VadInst* handle);

// Initializes a VAD instance.
//
// - handle [i/o] : Instance that should be initialized.
//
// returns        : 0 - (OK),
//                 -1 - (NULL pointer or Default mode could not be set).
int WebRtcVad_Init(VadInst* handle);

// Sets the VAD operating mode. A more aggressive (higher mode) VAD is more
// restrictive in reporting speech. Put in other words the probability of being
// speech when the VAD returns 1 is increased with increasing mode. As a
// consequence also the missed detection rate goes up.
//
// - handle [i/o] : VAD instance.
// - mode   [i]   : Aggressiveness mode (0, 1, 2, or 3).
//
// returns        : 0 - (OK),
//                 -1 - (NULL pointer, mode could not be set or the VAD instance
//                       has not been initialized).
int WebRtcVad_set_mode(VadInst* handle, int mode);

// Calculates a VAD decision for the |audio_frame|. For valid sampling rates
// frame lengths, see the description of WebRtcVad_ValidRatesAndFrameLengths().
//
// - handle       [i/o] : VAD Instance. Needs to be initialized by
//                        WebRtcVad_Init() before call.
// - fs           [i]   : Sampling frequency (Hz): 8000, 16000, or 32000, 48000
// - audio_frame  [i]   : Audio frame buffer.
// - frame_length [i]   : Length of audio frame buffer in number of samples.
//
// returns              : 1 - (Active Voice),
//                        0 - (Non-active Voice),
//                       -1 - (Error)
int WebRtcVad_Process(VadInst* handle, int fs, int16_t* audio_frame,
                      int frame_length);

// Checks for valid combinations of |rate| and |frame_length|. We support 10,
// 20 and 30 ms frames and the rates 8000, 16000 and 32000 Hz.
//
// - rate         [i] : Sampling frequency (Hz).
// - frame_length [i] : Speech frame buffer length in number of samples.
//
// returns            : 0 - (valid combination), -1 - (invalid combination)
int WebRtcVad_ValidRateAndFrameLength(int rate, int frame_length);

#ifdef __cplusplus
}
#endif

#endif  // WEBRTC_COMMON_AUDIO_VAD_INCLUDE_WEBRTC_VAD_H_  // NOLINT


ands ?: CommandHandler("/")
        if (!Vars.headless) Config.serverCommands = CommandHandler("")

        bootstrap()
        Core.app.addListener(object : ApplicationListener {
            override fun pause() {
                if (Vars.headless)
                    exit()
            }

            override fun exit() = runBlocking {
                ScriptManager.disableAll()
            }
        })
    }

    override fun displayInfo(foundMain: Boolean) {
        Log.info("&y===========================")
        Log.info("&lm&fb     ScriptAgent &b${Config.version}")
        Log.info("&b           By &cWayZer    ")
        Log.info("&b插件官网: https://git.io/SA4Mindustry")
        Log.info("&bQQ交流群: 1033116078")
        val all = ScriptRegistry.allScripts { true }
        Log.info(
            "&b共找到${all.size}脚本,加载成功${all.count { it.scriptState.loaded }},启用成功${all.count { it.scriptState.enabled }},出错${all.count { it.failReason != null }}"
        )
        if (!foundMain)
            Log.warn("&c未找到启动脚本(${Config.mainScript}),请下载安装脚本包,以发挥本插件功能")
        Log.info("&y===========================")
    }
}package coreMindustry

import mindustry.core.ContentLoader
import mindustry.ctype.Content
import mindustry.ctype.MappableContent
import java.lang.reflect.Modifier
import kotlin.reflect.KMutableProperty0

val bakMap = mutableMapOf<KMutableProperty0<*>, Any?>()

/**Should invoke in [Dispatchers.game] */
fun <T : Content, R : T> newContent(origin: T, block: (origin: T) -> R): R {
    val bak = content
    content = object : ContentLoader() {
        override fun transformName(name: String?) = bak?.transformName(name) ?: name
        override fun handleContent(content: Content?) = Unit
        override fun handleMappableContent(content: MappableContent?) = Unit
    }
    return try {
        block(origin).also { new ->
            origin::class.java.fields.forEach {
                if (!it.declaringClass.isInstance(new)) return@forEach
                if (Modifier.isPublic(it.modifiers) && !Modifier.isFinal(it.modifiers)) {
                    it.set(new, it.get(origin))
                }
            }
        }
    } finally {
        content = bak
    }
}

fun <T> registerMapRule(field: KMutableProperty0<T>, checkRef: Boolean = true, valueFactory: (T) -> T) {
    synchronized(bakMap) {
        @Suppress("UNCHECKED_CAST")
        val old = (bakMap[field] as T?) ?: field.get()
        val new = valueFactory(old)
        if (field !in bakMap && checkRef && new is Any && new === old)
            error("valueFactory can't return the same instance for $field")
        field.set(new)
        bakMap[field] = old
    }
}

listen<EventType.ResetEvent> {
    synchronized(bakMap) {
        bakMap.forEach { (field, bakValue) ->
            @Suppress("UNCHECKED_CAST")
            (field as KMutableProperty0<Any?>).set(bakValue)
        }
        bakMap.clear()
    }
}@file:Import("io.javalin:javalin:6.7.0", mavenDepends = true)
@file:Import("org.slf4j:slf4j-simple:2.0.16", mavenDepends = true)
@file:Import("javalin.lib.*", defaultImport = true)
@file:Depends("coreLi


char)0x240a); // XK_lf --> SYMBOL FOR LINE FEED
        keysym2UCSHash.put( (long)0x9e8, (char)0x2424); // XK_nl --> SYMBOL FOR NEWLINE
        keysym2UCSHash.put( (long)0x9e9, (char)0x240b); // XK_vt --> SYMBOL FOR VERTICAL TABULATION
        keysym2UCSHash.put( (long)0x9ea, (char)0x2518); // XK_lowrightcorner --> BOX DRAWINGS LIGHT UP AND LEFT
        keysym2UCSHash.put( (long)0x9eb, (char)0x2510); // XK_uprightcorner --> BOX DRAWINGS LIGHT DOWN AND LEFT
        keysym2UCSHash.put( (long)0x9ec, (char)0x250c); // XK_upleftcorner --> BOX DRAWINGS LIGHT DOWN AND RIGHT
        keysym2UCSHash.put( (long)0x9ed, (char)0x2514); // XK_lowleftcorner --> BOX DRAWINGS LIGHT UP AND RIGHT
        keysym2UCSHash.put( (long)0x9ee, (char)0x253c); // XK_crossinglines --> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
        keysym2UCSHash.put( (long)0x9ef, (char)0x23ba); // XK_horizlinescan1 --> HORIZONTAL SCAN LINE-1
        keysym2UCSHash.put( (long)0x9f0, (char)0x23bb); // XK_horizlinescan3 --> HORIZONTAL SCAN LINE-3
        keysym2UCSHash.put( (long)0x9f1, (char)0x2500); // XK_horizlinescan5 --> BOX DRAWINGS LIGHT HORIZONTAL
        keysym2UCSHash.put( (long)0x9f2, (char)0x23bc); // XK_horizlinescan7 --> HORIZONTAL SCAN LINE-7
        keysym2UCSHash.put( (long)0x9f3, (char)0x23bd); // XK_horizlinescan9 --> HORIZONTAL SCAN LINE-9
        keysym2UCSHash.put( (long)0x9f4, (char)0x251c); // XK_leftt --> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
        keysym2UCSHash.put( (long)0x9f5, (char)0x2524); // XK_rightt --> BOX DRAWINGS LIGHT VERTICAL AND LEFT
        keysym2UCSHash.put( (long)0x9f6, (char)0x2534); // XK_bott --> BOX DRAWINGS LIGHT UP AND HORIZONTAL
        keysym2UCSHash.put( (long)0x9f7, (char)0x242c); // XK_topt -->
        keysym2UCSHash.put( (long)0x9f8, (char)0x2502); // XK_vertbar --> BOX DRAWINGS LIGHT VERTICAL
        keysym2UCSHash.put( (long)0xaa1, (char)0x2003); // XK_emspace --> EM SPACE
        keysym2UCSHash.put( (long)0xaa2, (char)0x2002); // XK_enspace --> EN SPACE
        keysym2UCSHash.put( (long)0xaa3, (char)0x2004); // XK_em3space --> THREE-PER-EM SPACE
        keysym2UCSHash.put( (long)0xaa4, (char)0x2005); // XK_em4space --> FOUR-PER-EM SPACE
        keysym2UCSHash.put( (long)0xaa5, (char)0x2007); // XK_digitspace --> FIGURE SPACE
        keysym2UCSHas


 [OIDC 1.0](http://openid.net/connect) for how this is used in the whole
// authentication flow.
//
// Examples:
//
// Spec for a JWT that is issued by `https://example.com`, with the audience claims must be either
// `bookstore_android.apps.example.com` or `bookstore_web.apps.example.com`.
// The token should be presented at the `Authorization` header (default). The JSON Web Key Set (JWKS)
// will be discovered following OpenID Connect protocol.
//
// ```yaml
// issuer: https://example.com
// audiences:
//   - bookstore_android.apps.example.com
//     bookstore_web.apps.example.com
//
// ```
//
// This example specifies a token in a non-default location (`x-goog-iap-jwt-assertion` header). It also
// defines the URI to fetch JWKS explicitly.
//
// ```yaml
// issuer: https://example.com
// jwksUri: https://example.com/.secret/jwks.json
// fromHeaders:
// - "x-goog-iap-jwt-assertion"
// ```
//
// This example shows how to configure custom claims to be treated as space-delimited strings.
// This is useful when JWT tokens contain custom claims with multiple space-separated values
// that should be available for individual matching in authorization policies.
//
// ```yaml
// issuer: https://example.com
// spaceDelimitedClaims:
// - "custom_scope"
// - "provider.login.scope"
// - "roles"
// ```
//
// With this configuration, a JWT containing `"custom_scope": "read write admin"` will allow
// authorization policies to match against individual values like "read", "write", or "admin".
// +kubebuilder:validation:XValidation:message="only one of jwks or jwksUri can be set",rule="oneof(self.jwksUri, self.jwks_uri, self.jwks)"
type JWTRule = v1beta1.JWTRule

// This message specifies a header location to extract JWT token.
type JWTHeader = v1beta1.JWTHeader

// This message specifies the detail for copying claim to header.
type ClaimToHeader = v1beta1.ClaimToHeader
// Copyright Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             (unknown)
// source: security/v1alpha1/ca.proto

// Keep this package for backward compatibility.

package v1alpha1

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

const (
	IstioCertificateService_CreateCertificate_FullMethodName = "/istio.v1.auth.IstioCertificateService/CreateCertificate"
)

// IstioCertificateServiceClient is the client API for IstioCertificateService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Service for managing certificates issued by the CA.
type IstioCertificateServiceClient interface {
	// Using pro


 struct tinfl_decompressor_tag
 {
     mz_uint32 m_state, m_num_bits, m_zhdr0, m_zhdr1, m_z_adler32, m_final, m_type, m_check_adler32, m_dist, m_counter, m_num_extra, m_table_sizes[TINFL_MAX_HUFF_TABLES];
     tinfl_bit_buf_t m_bit_buf;
     size_t m_dist_from_out_buf_start;
     tinfl_huff_table m_tables[TINFL_MAX_HUFF_TABLES];
     mz_uint8 m_raw_header[4], m_len_codes[TINFL_MAX_HUFF_SYMBOLS_0 + TINFL_MAX_HUFF_SYMBOLS_1 + 137];
 };

 #ifdef __cplusplus
 }
 #endif

 #pragma once

 /* ------------------- ZIP archive reading/writing */

 #ifndef MINIZ_NO_ARCHIVE_APIS

 #ifdef __cplusplus
 extern "C" {
 #endif

 enum
 {
     /* Note: These enums can be reduced as needed to save memory or stack space - they are pretty conservative. */
     MZ_ZIP_MAX_IO_BUF_SIZE = 64 * 1024,
     MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE = 512,
     MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE = 512
 };

 typedef struct
 {
     /* Central directory file index. */
     mz_uint32 m_file_index;

     /* Byte offset of this entry in the archive's central directory. Note we currently only support up to UINT_MAX or less bytes in the central dir. */
     mz_uint64 m_central_dir_ofs;

     /* These fields are copied directly from the zip's central dir. */
     mz_uint16 m_version_made_by;
     mz_uint16 m_version_needed;
     mz_uint16 m_bit_flag;
     mz_uint16 m_method;

 #ifndef MINIZ_NO_TIME
     MZ_TIME_T m_time;
 #endif

     /* CRC-32 of uncompressed data. */
     mz_uint32 m_crc32;

     /* File's compressed size. */
     mz_uint64 m_comp_size;

     /* File's uncompressed size. Note, I've seen some old archives where directory entries had 512 bytes for their uncompressed sizes, but when you try to unpack them you actually get 0 bytes. */
     mz_uint64 m_uncomp_size;

     /* Zip internal and external file attributes. */
     mz_uint16 m_internal_attr;
     mz_uint32 m_external_attr;

     /* Entry's local header file offset in bytes. */
     mz_uint64 m_local_header_ofs;

     /* Size of comment in bytes. */
     mz_uint32 m_comment_size;

     /* MZ_TRUE if the entry appears to be a directory. */
     mz_bool m_is_directory;

     /* MZ_TRUE if the entry uses encryption/strong encryption (which miniz_zip doesn't support) */
     mz_bool m_is_encrypted;

     /* MZ_TRUE if the file is not encrypted, a patch file, and if it uses a compression method we support. */
     mz_bool m_is_supported;

     /* Filename. If string ends in '/' it's a subdirectory entry. */
     /* Guaranteed to be zero terminated, may be truncated to fit. */
     char m_filename[MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE];

     /* Comment field. */
     /* Guaranteed to be zero terminated, may be truncated to fit. */
     char m_comment[MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE];

 } mz_zip_archive_file_stat;

 typedef size_t (*mz_file_read_func)(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n);
 typedef size_t (*mz_file_write_func)(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n);
 typedef mz_bool (*mz_file


class Question:
    def __init__(self, prompt, answer):
        self.prompt = prompt
        self.answer = answer


"""
atlasbot/utils.py
=================

Thin convenience layer around the `MarketData` singleton
– blocks until the feed is ready
– exposes helpers for price, ATR and volatility
"""

from __future__ import annotations

import logging
import os
from typing import List

from atlasbot.config import SYMBOLS
from atlasbot.market_data import get_market

_md = None

def _get_md():
    global _md
    if _md is None:
        _md = get_market(SYMBOLS)
    return _md

# --------------------------------------------------------------------------- helpers
def _ensure_ready(timeout: int = 60) -> None:
    """Wait for market data feed readiness or raise ``RuntimeError``.

    If ``CI=true`` or ``MARKET_DATA_MOCK=true`` is set in the environment, the
    readiness check is skipped.
    """
    md = _get_md()
    if (
        os.getenv("CI", "").lower() == "true"
        or os.getenv("MARKET_DATA_MOCK", "").lower() == "true"
    ):
        logging.warning("CI mode – skipping market-data readiness check")
        return

    for attempt in range(3):
        if md.wait_ready(timeout):
            return
        logging.warning("Market feed not ready – retry %d/3", attempt + 1)

    msg = f"Market feed still not ready after {timeout}s (mode={md.mode})"
    raise RuntimeError(msg)

# --------------------------------------------------------------------------- façade
def fetch_price(symbol: str) -> float:
    """Return the latest trade price for *symbol* (blocks until ready)."""
    _ensure_ready()
    return _get_md().latest_trade(symbol)

def calculate_atr(symbol: str, period: int = 10) -> float:
    """
    Average True Range over *period* 1-minute bars.
    Raises if insufficient history is available.
    """
    _ensure_ready()
    bars = list(_get_md().minute_bars(symbol))[-period - 1 :]
    if len(bars) < period + 1:
        return float("nan")
    trs = [
        max(h, prev_close) - min(low, prev_close)
        for prev_close, (_, h, low, _) in zip((b[3] for b in bars[:-1]), bars[1:])
    ]
    return sum(trs) / period

def fetch_volatility(symbol: str, period: int = 30) -> float:
    """
    Mean absolute deviation of the closing price over *period* 1-minute bars.
    A quick-and-dirty proxy for intraday volatility.
    """
    _ensure_ready()
    closes: List[float] = [b[3] for b in list(_get_md().minute_bars(symbol))[-period:]]
    if len(closes) < period:
        return float("nan")

    mean = sum(closes) / len(closes)
    return sum(abs(px - mean) for px in closes) / len(closes)


1,(a1)             ; for clipping, add sizes to
          add.w     d1,(a2)             ; x/y/w/h values in rectangles...
          add.w     d1,2(a1)
          add.w     d1,2(a2)
          addq.w    #1,d1               ; Add the one back in.
          neg.w     d1
          add.w     d1,4(a2)
          add.w     d1,6(a2)
          lsl.w     #1,d1
          addq.w    #1,d1
          add.w     d1,4(a1)
          add.w     d1,6(a1)

          add.w     d2,4(a1)            ; Add in shadow sizes to right
          add.w     d2,6(a1)            ; and bottom numbers.
          add.w     d2,4(a2)
          add.w     d2,6(a2)

          move.l    (sp)+,a2            ; Restore Laser C register.
          unlk      a6
          rts

;         end of code


! Generated file. DO NOT EDIT.
!
! This file was generated by gas/testsuite/gas/sh/arch/sh-opc-gen-as.pl .
! This file should contain every instruction valid on
! architecture sh2a-or-sh4 but no more.
! If the tests are failing because the expected results have changed then run
!    'cat ../../../../../opcodes/sh-opc.h | perl sh-opc-gen-as.pl'
! in <srcdir>/gas/testsuite/gas/sh/arch to re-generate the files.
! Make sure there are no unexpected or missing instructions.

	.section .text
sh2a_or_sh4:
! Instructions introduced into sh2a-or-sh4
	fabs dr2                  ;!/* 1111nnn001011101 fabs <D_REG_N>     */{"fabs",{D_REG_N},{HEX_F,REG_N,HEX_5,HEX_D}, arch_sh2a_or_sh4_up}
	fadd dr4,dr2              ;!/* 1111nnn0mmm00000 fadd <D_REG_M>,<D_REG_N>*/{"fadd",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_0}, arch_sh2a_or_sh4_up}
	fcmp/eq dr4,dr2           ;!/* 1111nnn0mmm00100 fcmp/eq <D_REG_M>,<D_REG_N>*/{"fcmp/eq",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_4}, arch_sh2a_or_sh4_up}
	fcmp/gt dr4,dr2           ;!/* 1111nnn0mmm00101 fcmp/gt <D_REG_M>,<D_REG_N>*/{"fcmp/gt",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_5}, arch_sh2a_or_sh4_up}
	fcnvds dr2,FPUL           ;!/* 1111nnn010111101 fcnvds <D_REG_N>,FPUL*/{"fcnvds",{D_REG_N,FPUL_M},{HEX_F,REG_N_D,HEX_B,HEX_D}, arch_sh2a_or_sh4_up}
	fcnvsd FPUL,dr2           ;!/* 1111nnn010101101 fcnvsd FPUL,<D_REG_N>*/{"fcnvsd",{FPUL_M,D_REG_N},{HEX_F,REG_N_D,HEX_A,HEX_D}, arch_sh2a_or_sh4_up}
	fdiv dr4,dr2              ;!/* 1111nnn0mmm00011 fdiv <D_REG_M>,<D_REG_N>*/{"fdiv",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_3}, arch_sh2a_or_sh4_up}
	float FPUL,dr2            ;!/* 1111nnn000101101 float FPUL,<D_REG_N>*/{"float",{FPUL_M,D_REG_N},{HEX_F,REG_N,HEX_2,HEX_D}, arch_sh2a_or_sh4_up}
	fmov xd4,xd2              ;!/* 1111nnn1mmmm1100 fmov <DX_REG_M>,<DX_REG_N>*/{"fm


px var(--jp-shadow-penumbra-color),
    0 3px 14px 2px var(--jp-shadow-ambient-color);
  --jp-elevation-z12: 0 7px 8px -4px var(--jp-shadow-umbra-color),
    0 12px 17px 2px var(--jp-shadow-penumbra-color),
    0 5px 22px 4px var(--jp-shadow-ambient-color);
  --jp-elevation-z16: 0 8px 10px -5px var(--jp-shadow-umbra-color),
    0 16px 24px 2px var(--jp-shadow-penumbra-color),
    0 6px 30px 5px var(--jp-shadow-ambient-color);
  --jp-elevation-z20: 0 10px 13px -6px var(--jp-shadow-umbra-color),
    0 20px 31px 3px var(--jp-shadow-penumbra-color),
    0 8px 38px 7px var(--jp-shadow-ambient-color);
  --jp-elevation-z24: 0 11px 15px -7px var(--jp-shadow-umbra-color),
    0 24px 38px 3px var(--jp-shadow-penumbra-color),
    0 9px 46px 8px var(--jp-shadow-ambient-color);

  /* Borders
   *
   * The following variables, specify the visual styling of borders in JupyterLab.
   */

  --jp-border-width: 1px;
  --jp-border-color0: var(--md-grey-700);
  --jp-border-color1: var(--md-grey-700);
  --jp-border-color2: var(--md-grey-800);
  --jp-border-color3: var(--md-grey-900);
  --jp-inverse-border-color: var(--md-grey-600);
  --jp-border-radius: 2px;

  /* UI Fonts
   *
   * The UI font CSS variables are used for the typography all of the JupyterLab
   * user interface elements that are not directly user generated content.
   *
   * The font sizing here is done assuming that the body font size of --jp-ui-font-size1
   * is applied to a parent element. When children elements, such as headings, are sized
   * in em all things will be computed relative to that body size.
   */

  --jp-ui-font-scale-factor: 1.2;
  --jp-ui-font-size0: 0.83333em;
  --jp-ui-font-size1: 13px; /* Base font size */
  --jp-ui-font-size2: 1.2em;
  --jp-ui-font-size3: 1.44em;
  --jp-ui-font-family: system-ui, -apple-system, blinkmacsystemfont, 'Segoe UI',
    helvetica, arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
    'Segoe UI Symbol';

  /*
   * Use these font colors against the corresponding main layout colors.
   * In a light theme, these go from dark to light.
   */

  /* Defaults use Material Design specification */
  --jp-ui-font-color0: rgba(255, 255, 255, 1);
  --jp-ui-font-color1: rgba(255, 255, 255, 0.87);
  --jp-ui-font-color2: rgba(255, 255, 255, 0.54);
  --jp-ui-font-color3: rgba(255, 255, 255, 0.38);

  /*
   * Use these against the brand/accent/warn/error colors.
   * These will typically go from light to darker, in both a dark and light theme.
   */

  --jp-ui-inverse-font-color0: rgba(0, 0, 0, 1);
  --jp-ui-inverse-font-color1: rgba(0, 0, 0, 0.8);
  --jp-ui-inverse-font-color2: rgba(0, 0, 0, 0.5);
  --jp-ui-inverse-font-color3: rgba(0, 0, 0, 0.3)


stanford.edu/people/dorarad/gqa/download.html):
```
$DETECTRON2_DATASETS/
  gqa/
    images/
    gqa_region_{train,val}.json
    gqa_region.json
```

`gqa_region*.json` are generated by running
```
python3 datasets/tools/gqa2coco/convert.py --data_path datasets/gqa/ --img_path datasets/gqa/images --sg_path datasets/gqa/ --vg_img_data_path datasets/visualgenome/annotations/ --out_path datasets/gqa/
```

## Expected dataset structure for [PhraseCut](https://github.com/ChenyunWu/PhraseCutDataset):
```
$DETECTRON2_DATASETS/
  phrasecut/
    images/
    phrasecut_{train,val,miniv,test}.json
```

`phrasecut_*.json` are generated by running
```
python3 datasets/tools/phrasecut2coco/convert.py --data_path datasets/phrasecut/ --img_path datasets/phrasecut/images --out_path datasets/phrasecut/
```

## Expected dataset structure for [Flickr30k](https://shannon.cs.illinois.edu/DenotationGraph/):
```
$DETECTRON2_DATASETS/
  flickr30k/
    flickr30k-images/
    flickr30k_separateGT_{train,val.test}.json
```

`flickr30k_separateGT_*.json` are generated by running
```
python3 datasets/tools/flickr2coco/convert.py --flickr_path datasets/flickr30k/flickr30k_entities/ --out_path datasets/flickr30k/
```

## Expected dataset structure for [ODinW](https://github.com/microsoft/GLIP#the-object-detection-in-the-wild-benchmark):
```
$DETECTRON2_DATASETS/
  odinw/
    AerialMaritimeDrone/
    AmericanSignLanguageLetters/
    ...
    WildfireSmoke/
```

After download, update json files by runing
```
python3 datasets/tools/odinw/convert.py
```

This is because
```
https://github.com/cocodataset/cocoapi/issues/507#issuecomment-857272753
```

## Expected dataset structure for [SegInW](https://github.com/microsoft/X-Decoder/tree/seginw#download):
```
$DETECTRON2_DATASETS/
  seginw/
    Airplane-Parts/
    Bottles/
    ...
    Watermelon/
```

## Expected dataset structure for [Roboflow100](https://github.com/roboflow/roboflow-100-benchmark#local-env):
```
$DETECTRON2_DATASETS/
  rf100/
    4-fold-defect/
    abdomen-mri/
    ...
    x-ray-rheumatology/
```

## Expected dataset structure for [ADE20k-Full](https://groups.csail.mit.edu/vision/datasets/ADE20K/):
```
ADE20K_2021_17_01/
  images/
  images_detectron2/
  annotations_detectron2/
  index_ade20k.pkl
  objects.txt
```

The directories `images_detectron2` and `annotations_detectron2` are generated by running
```
python datasets/prepare_ade20k_full_sem_seg.py
```

## Expected dataset structure for [BDD10k](https://bdd-data.berkeley.edu/):
```
$DETECTRON2_DATASETS/
  bdd100k/
    images/
    labels/
      pan_seg/
        coco_pano/
        meta/
        ...
      ...
    seg/
```

`coco_pano` and `meta` is generated by running
```
wget https://github.com/shenyunhang/APE/releases/download/0/bdd_generated.tar.gz
tar xvzf bdd_generated.tar.gz


"""
# Definition for a QuadTree node.
class Node:
    def __init__(self, val, isLeaf, topLeft, topRight, bottomLeft, bottomRight):
        self.val = val
        self.isLeaf = isLeaf
        self.topLeft = topLeft
        self.topRight = topRight
        self.bottomLeft = bottomLeft
        self.bottomRight = bottomRight
"""

# Time complexity = n^2 log(n)

class Solution:
    def construct(self, grid: List[List[int]]) -> 'Node':
        def dfs(n, row, column):
            allSame = True
            for i in range(n):
                for j in range(n):
                    if grid[row][column] != grid[row + i][column + j]:
                        allSame = False
                        break
            if allSame:
                return Node(grid[row][column], True)

            n = n // 2 # integer division
            topleft = dfs(n, row, column)
            topright = dfs(n, row, column + n)
            bottomleft = dfs(n, row + n, column)
            bottomright = dfs(n, row + n, column + n)
            return Node(0, False, topleft, topright, bottomleft, bottomright)

        return dfs(len(grid), 0, 0)


win32/api/dwrite_3/nn-dwrite_3-idwritegdiinterop1">IDWriteGdiInterop1
---
UID: NF:dwrite_3.IDWriteRenderingParams3.GetRenderingMode1
title: IDWriteRenderingParams3::GetRenderingMode1 (dwrite_3.h)
description: Gets the rendering mode.
helpviewer_keywords: ["GetRenderingMode1","GetRenderingMode1 method [Direct Write]","GetRenderingMode1 method [Direct Write]","IDWriteRenderingParams3 interface","IDWriteRenderingParams3 interface [Direct Write]","GetRenderingMode1 method","IDWriteRenderingParams3.GetRenderingMode1","IDWriteRenderingParams3::GetRenderingMode1","directwrite.idwriterenderingparams3_getrenderingmode1","dwrite_3/IDWriteRenderingParams3::GetRenderingMode1"]
old-location: directwrite\idwriterenderingparams3_getrenderingmode1.htm
tech.root: DirectWrite
ms.assetid: 3C8CBE42-D7F5-4646-A1C4-1C9C8C4EBAD1
ms.date: 09/10/2025
ms.keywords: GetRenderingMode1, GetRenderingMode1 method [Direct Write], GetRenderingMode1 method [Direct Write],IDWriteRenderingParams3 interface, IDWriteRenderingParams3 interface [Direct Write],GetRenderingMode1 method, IDWriteRenderingParams3.GetRenderingMode1, IDWriteRenderingParams3::GetRenderingMode1, directwrite.idwriterenderingparams3_getrenderingmode1, dwrite_3/IDWriteRenderingParams3::GetRenderingMode1
req.header: dwrite_3.h
req.include-header:
req.target-type: Windows
req.target-min-winverclnt: Windows 10 [desktop apps only]
req.target-min-winversvr: Windows Server 2016 [desktop apps only]
req.kmdf-ver:
req.umdf-ver:
req.ddi-compliance:
req.unicode-ansi:
req.idl:
req.max-support:
req.namespace:
req.assembly:
req.type-library:
req.lib: Dwrite.lib
req.dll: Dwrite.dll
req.irql:
targetos: Windows
req.typenames:
req.redist:
ms.custom: 19H1
f1_keywords:
 - IDWriteRenderingParams3::GetRenderingMode1
 - dwrite_3/IDWriteRenderingParams3::GetRenderingMode1
dev_langs:
 - c++
topic_type:
 - APIRef
 - kbSyntax
api_type:
 - COM
api_location:
 - dwrite.dll
api_name:
 - IDWriteRenderingParams3.GetRenderingMode1
---

# IDWriteRenderingParams3::GetRenderingMode1

## -description

Gets the rendering mode.

## -returns

Type: DWRITE_RENDERING_MODE1

Returns a DWRITE_RENDERING_MODE1-typed value for the rendering mode.

## -see-also

IDWriteRenderingParams3

---
UID: NN:dwrite_3.IDWriteGdiInterop1
title: IDWriteGdiInterop1 (dwrite_3.h)
description: Provides interoperability with GDI, such as methods to convert a font face to a LOGFONT structure, or to convert a GDI font description into a font face. It is also used to create bitmap render target objects. (IDWriteGdiInterop1)
helpviewer_keywords: ["IDWrite


+"
  "568>>2]=0;m[b+529|0]=1}}function uv(c,d,i){var g=h;h+=48;var q=g+32,e;e=0==(a[c+356>>"
  "2]|0);var l=c+348|0,l=(b[0]=a[l>>2],b[1]=a[l+4>>2],f[0]);if(e){e=c+512|0;var k=c+496|"
  "0,d=d/(l*(b[0]=a[e>>2],b[1]=a[e+4>>2],f[0]))-(b[0]=a[k>>2],b[1]=a[k+4>>2],f[0]);e=c+5"
  "20|0;k=c+504|0;l=i/(l*(b[0]=a[e>>2],b[1]=a[e+4>>2],f[0]))-(b[0]=a[k>>2],b[1]=a[k+4>>2"
  "],f[0]);e=(q|0)>>2;f[0]=d}else{e=c+520|0,k=c+496|0,i=i/(l*(b[0]=a[e>>2],b[1]=a[e+4>>2"
  "],f[0]))-(b[0]=a[k>>2],b[1]=a[k+4>>2],f[0]),e=c+512|0,k=c+504|0,l=-d/(l*(b[0]=a[e>>2]"
  ",b[1]=a[e+4>>2],f[0]))-(b[0]=a[k>>2],b[1]=a[k+4>>2],f[0]),e=(q|0)>>2,f[0]=i}a[e]=b[0]"
  ";a[e+1]=b[1];d=q+8|0;d>>=2;f[0]=l;a[d]=b[0];a[d+1]=b[1];l=q|0;l=(b[0]=a[l>>2],b[1]=a["
  "l+4>>2],f[0]);q=q+8|0;q=(b[0]=a[q>>2],b[1]=a[q+4>>2],f[0]);d=c+348|0;d=1/(b[0]=a[d>>2"
  "],b[1]=a[d+4>>2],f[0]);i=g+16|0;f[0]=l+d;a[i>>2]=b[0];a[i+4>>2]=b[1];i=g+24|0;f[0]=q+"
  "d;a[i>>2]=b[0];a[i+4>>2]=b[1];i=g|0;f[0]=l-d;a[i>>2]=b[0];a[i+4>>2]=b[1];l=g+8|0;f[0]"
  "=q-d;a[l>>2]=b[0];a[l+4>>2]=b[1];var n,q=a[a[c>>2]+128>>2],d=h,i=g>>2,l=h;h+=32;a[l>>"
  "2]=a[i];a[l+4>>2]=a[i+1];a[l+8>>2]=a[i+2];a[l+12>>2]=a[i+3];a[l+16>>2]=a[i+4];a[l+20>"
  ">2]=a[i+5];a[l+24>>2]=a[i+6];a[l+28>>2]=a[i+7];i=ra(q);a:for(;;){if(0==(i|0)){n=1222;"
  "break}for(var j=Ib(q,i);0!=(j|0);){b:{var p=j;e=l;var s=cc,k=h,s=e>>


6_2
                  L8_2 = L8_2(L9_2, L10_2)
                  if -1 == L8_2 then
                    L8_2 = A0_2[21]
                    L9_2 = L8_2
                    L8_2 = L8_2.push
                    L10_2 = L6_2
                    L8_2(L9_2, L10_2)
                  end
                end
              end
              L8_2 = A2_2
              L7_2 = A2_2.lastIndexOf
              L9_2 = L6_2
              L7_2 = L7_2(L8_2, L9_2)
              if -1 == L7_2 then
                L8_2 = A2_2
                L7_2 = A2_2.push
                L9_2 = L6_2
                L7_2(L8_2, L9_2)
              end
            end
          end
        end
      end
    end
    if L5_2 then
      L5_2 = false
      break
    end
  end
end

_ENV["C33BCA5D3162D22AB"]["prototype"]["F4D97EAA848A926D3"] = function(A0_2)

  local L1_2, L2_2, L3_2, L4_2, L5_2, L6_2, L7_2, L8_2, L9_2
  while true do
    L1_2 = A0_2[21]
    L2_2 = L1_2
    L1_2 = L1_2.remove
    L3_2 = ""
    L1_2 = L1_2(L2_2, L3_2)
    if false == L1_2 then
      break
    end
  end
  L1_2 = 0
  L2_2 = A0_2[21]
  L2_2 = L2_2.length
  L3_2 = false
  while L1_2 < L2_2 do
    L1_2 = L1_2 + 1
    L4_2 = L1_2 - 1
    L5_2 = A0_2[21]
    L5_2 = L5_2[L4_2]
    L6_2 = A0_2[22]
    L7_2 = L6_2
    L6_2 = L6_2.lastIndexOf
    L8_2 = L5_2
    L6_2 = L6_2(L7_2, L8_2)
    if -1 == L6_2 then
      L6_2 = A0_2[6]
      L7_2 = L6_2
      L6_2 = L6_2.fA36E439A
      L8_2 = L5_2
      L9_2 = 0
      L6_2 = L6_2(L7_2, L8_2, L9_2)
      if false == L6_2 then
        L6_2 = A0_2[6]
        L7_2 = L6_2
        L6_2 = L6_2.fA3454B11
        L8_2 = L5_2
        L6_2 = L6_2(L7_2, L8_2)
        if 1 ~= L6_2 and 2 ~= L6_2 then
          goto lbl_43
        end
      end
    end
    L6_2 = A0_2[21]
    L6_2[L4_2] = "


lsl	x3, x3, x16
  45f6f0:	cb0500e7 	sub	x7, x7, x5
  45f6f4:	9287fdcc 	mov	x12, #0xffffffffffffc011    	// #-16367
  45f6f8:	d2800006 	mov	x6, #0x0                   	// #0
  45f6fc:	8b0c00e7 	add	x7, x7, x12
  45f700:	17ffffc6 	b	45f618 <__multf3+0xc8>
  45f704:	d503201f 	nop
  45f708:	f1000dbf 	cmp	x13, #0x3
  45f70c:	54000e60 	b.eq	45f8d8 <__multf3+0x388>  // b.none
  45f710:	54000c0c 	b.gt	45f890 <__multf3+0x340>
  45f714:	f10005bf 	cmp	x13, #0x1
  45f718:	5400128b 	b.lt	45f968 <__multf3+0x418>  // b.tstop
  45f71c:	12000189 	and	w9, w12, #0x1
  45f720:	f10008df 	cmp	x6, #0x2
  45f724:	540007a0 	b.eq	45f818 <__multf3+0x2c8>  // b.none
  45f728:	f1000cdf 	cmp	x6, #0x3
  45f72c:	54002f60 	b.eq	45fd18 <__multf3+0x7c8>  // b.none
  45f730:	52800004 	mov	w4, #0x0                   	// #0
  45f734:	d2800001 	mov	x1, #0x0                   	// #0
  45f738:	d2800008 	mov	x8, #0x0                   	// #0
  45f73c:	f10004df 	cmp	x6, #0x1
  45f740:	54002901 	b.ne	45fc60 <__multf3+0x710>  // b.any
  45f744:	d2800003 	mov	x3, #0x0                   	// #0
  45f748:	9e670101 	fmov	d1, x8
  45f74c:	b340bc23 	bfxil	x3, x1, #0, #48
  45f750:	b3503883 	bfi	x3, x4, #48, #15
  45f754:	b3410123 	bfi	x3, x9, #63, #1
  45f758:	9eaf0061 	fmov	v1.d[1], x3
  45f75c:	35000e80 	cbnz	w0, 45f92c <__multf3+0x3dc>
  45f760:	4ea11c20 	mov	v0.16b, v1.16b
  45f764:	a8c37bfd 	ldp	x29, x30, [sp], #48
  45f768:	d65f03c0 	ret
  45f76c:	d503201f 	nop
  45f770:	aa000028 	orr	x8, x1, x0
  45f774:	b40005a8 	cbz	x8, 45f828 <__multf3+0x2d8>
  45f778:	dac01005 	clz	x5, x0
  45f77c:	f100003f 	cmp	x1, #0x0
  45f780:	dac0102


',	'時間化作滾滾長江，滙入黑框眼鏡',	'時間化作滾滾長江，滙入黑框眼鏡'},
{'61944',	'立克巧',	'立克巧'},
{'61945',	'立尅巧',	'立尅巧'},
{'61946',	'决赛圈又缩小了',	'决赛圈又缩小了'},
{'61947',	'决赛圈选手减一',	'决赛圈选手减一'},
{'61948',	'決賽圈又縮小了',	'決賽圈又縮小了'},
{'61949',	'決賽圈選手減壹',	'決賽圈選手減壹'},
{'61950',	'神必王',	'神必王'},
{'61951',	'桃上飞',	'桃上飞'},
{'61952',	'八云紫',	'八云紫'},
{'61953',	'桃上飛',	'桃上飛'},
{'61954',	'八雲紫',	'八雲紫'},
{'61955',	'捨诙朱毅',	'捨诙朱毅'},
{'61956',	'捨詼硃毅',	'捨詼硃毅'},
{'61957',	'是硬菜',	'是硬菜'},
{'61958',	'硬菜|嗯菜',	'硬菜|嗯菜'},
{'61959',	'习惯每天起床听一首刘老师的作品  近期因为工作原因没时间再次聆听  平常只要有时间我都会戴上耳机听',	'习惯每天起床听一首刘老师的作品  近期因为工作原因没时间再次聆听  平常只要有时间我都会戴上耳机听'},
{'61960',	'民宗委|西纠|跟裆走|听裆话',	'民宗委|西纠|跟裆走|听裆话'},
{'61961',	'民宗委|西糾|跟襠走|聽襠話',	'民宗委|西糾|跟襠走|聽襠話'},
{'61962',	'Jo清Jo泽蛤',	'Jo清Jo泽蛤'},
{'61963',	'给他筹es',	'给他筹es'},
{'61964',	'Frog-jiang',	'Frog-jiang'},
{'61965',	'真的不让续秒了吗',	'真的不让续秒了吗'},
{'61966',	'59秒的一分',	'59秒的一分'},
{'61967',	'苟利国家の蛙',	'苟利国家の蛙'},
{'61968',	'江黑框',	'江黑框'},
{'61969',	'时光守护者-魔沼蛙',	'时光�


1.07c0-0.52,0.42-0.93,0.93-0.93h12.63c0.51,0,0.92,0.41,0.92,0.93
	C22,18.94,21.59,19.5,21.08,19.5z"/>
<polygon points="2,5.899 2,5.899 2.699,5.199 2.699,5.199 2.699,5.199 4.1,6.599 6.901,3.798 6.901,3.798 6.901,3.798 7.6,4.499
	7.6,4.499 7.6,4.499 4.1,8 "/>
<polygon points="2,11.899 2,11.899 2.699,11.199 2.699,11.199 2.699,11.199 4.1,12.599 6.901,9.798 6.901,9.798 6.901,9.798
	7.6,10.499 7.6,10.499 7.6,10.499 4.1,14 "/>
<polygon points="2,17.899 2,17.899 2.699,17.199 2.699,17.199 2.699,17.199 4.1,18.599 6.901,15.798 6.901,15.798 6.901,15.798
	7.6,16.499 7.6,16.499 7.6,16.499 4.1,20 "/>
</svg>

MsPortalFx.Base.Images.Book()
<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<path fill="#59B4D9" d="M36.194,30.337c2.303,0,4.003,0.407,5.126,0.801c0.562,0.197,0.969,0.393,1.236,0.534l0.256,0.148v-3.206
	c-1.418-0.555-3.619-1.156-6.619-1.156c-2.991,0-5.15,0.597-6.545,1.154v3.214C29.831,31.713,31.966,30.337,36.194,30.337z"/>
<path fill="#59B4D9" d="M36.194,24.101c2.303,0,4.003,0.421,5.126,0.815c0.562,0.197,0.969,0.379,1.236,0.52l0.256,0.148v-3.206
	c-1.418-0.555-3.619-1.156-6.619-1.156c-2.991,0-5.15,0.602-6.545,1.159v3.223C29.747,25.548,31.882,24.115,36.194,24.101z"/>
<path fill="#59B4D9" d="M29.649,19.382c0.098-0.07,2.233-1.503,6.545-1.503c2.303,0,4.003,0.407,5.126,0.801
	c0


)
     * maxDiff = max(maxDiff, T[i-1][j] - prices[j])
     */
    public int maxProfit(int prices[], int K) {
        if (K == 0 || prices.length == 0) {
            return 0;
        }
        int T[][] = new int[K+1][prices.length];

        for (int i = 1; i < T.length; i++) {
            int maxDiff = -prices[0];
            for (int j = 1; j < T[0].length; j++) {
                T[i][j] = Math.max(T[i][j-1], prices[j] + maxDiff);
                maxDiff = Math.max(maxDiff, T[i-1][j] - prices[j]);
            }
        }
        printActualSolution(T, prices);
        return T[K][prices.length-1];
    }

    /**
     * This is slow method but easier to understand.
     * Time complexity is O(k * number of days ^ 2)
     * T[i][j] = max(T[i][j-1], max(prices[j] - prices[m] + T[i-1][m])) where m is 0...j-1
     */
    public int maxProfitSlowSolution(int prices[], int K) {
        if (K == 0 || prices.length == 0) {
            return 0;
        }
        int T[][] = new int[K+1][prices.length];

        for (int i = 1; i < T.length; i++) {
            for (int j = 1; j < T[0].length; j++) {
                int maxVal = 0;
                for (int m = 0; m < j; m++) {
                    maxVal = Math.max(maxVal, prices[j] - prices[m] + T[i-1][m]);
                }
                T[i][j] = Math.max(T[i][j-1], maxVal);
            }
        }
        printActualSolution(T, prices);
        return T[K][prices.length - 1];
    }

    public void printActualSolution(int T[][], int prices[]) {
        int i = T.length - 1;
        int j = T[0].length - 1;

        Deque<Integer> stack = new LinkedList<>();
        while(true) {
            if(i == 0 || j == 0) {
                break;
            }
            if (T[i][j] == T[i][j-1]) {
                j = j - 1;
            } else {
                stack.addFirst(j);
                int maxDiff = T[i][j] - prices[j];
                for (int k = j-1; k >= 0; k--) {
                    if (T[i-1][k] - prices[k] == maxDiff) {
                        i = i - 1;
                        j = k;
                        stack.addFirst(j);
                        break;
                    }
                }
            }
        }

        while(!stack.isEmpty()) {
            System.out.println("Buy at price " + prices[stack.pollFirst()]);
            System.out.println("Sell at price " + prices[stack.pollFirst()]);
        }

    }

    public static void main(String args[]) {
        StockBuySellKTransactions sbt = new StockBuySellKTransactions();
        int prices[] = {2, 5, 7, 1, 4, 3, 1, 3};

        System.out.println("Max profit fast solution " + sbt.maxProfit(prices, 3));
        System.out.println("Max profit slow solution " + sbt.maxProfitSlowSolution(prices, 3));
    }
}
package com.interview.dynamic;

/**
 * Date 03/21/2016
 * @author Tushar Roy
 *
 * Minim